@sourcegraph/amp 0.0.1764808732-gb9c377 → 0.0.1764811816-g233bde

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +15 -15
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -67,7 +67,7 @@ ${X}
67
67
 
68
68
  `)}D.write("payload.value = newResult;"),D.write("return payload;");let I=D.compile();return(P,C)=>I(U,P,C)},G,V=xD,K=!t_.jitless,W=K&&FG1.value,H=Q.catchall,z;J._zod.parse=(U,D)=>{z??(z=Y.value);let M=U.value;if(!V(M))return U.issues.push({expected:"object",code:"invalid_type",input:M,inst:J}),U;if(K&&W&&D?.async===!1&&D.jitless!==!0){if(!G)G=X(Q.shape);if(U=G(U,D),!H)return U;return LB0([],M,U,D,z,J)}return Z(U,D)}});Ui=F0("$ZodUnion",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"optin",()=>Q.options.some((X)=>X._zod.optin==="optional")?"optional":void 0),Z9(J._zod,"optout",()=>Q.options.some((X)=>X._zod.optout==="optional")?"optional":void 0),Z9(J._zod,"values",()=>{if(Q.options.every((X)=>X._zod.values))return new Set(Q.options.flatMap((X)=>Array.from(X._zod.values)));return}),Z9(J._zod,"pattern",()=>{if(Q.options.every((X)=>X._zod.pattern)){let X=Q.options.map((G)=>G._zod.pattern);return new RegExp(`^(${X.map((G)=>Zk(G.source)).join("|")})$`)}return});let Z=Q.options.length===1,Y=Q.options[0]._zod.run;J._zod.parse=(X,G)=>{if(Z)return Y(X,G);let V=!1,K=[];for(let q of Q.options){let W=q._zod.run({value:X.value,issues:[]},G);if(W instanceof Promise)K.push(W),V=!0;else{if(W.issues.length===0)return W;K.push(W)}}if(!V)return VB0(K,X,J,G);return Promise.all(K).then((q)=>{return VB0(q,X,J,G)})}}),YK1=F0("$ZodDiscriminatedUnion",(J,Q)=>{Ui.init(J,Q);let Z=J._zod.parse;Z9(J._zod,"propValues",()=>{let X={};for(let G of Q.options){let V=G._zod.propValues;if(!V||Object.keys(V).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(G)}"`);for(let[K,q]of Object.entries(V)){if(!X[K])X[K]=new Set;for(let W of q)X[K].add(W)}}return X});let Y=WE(()=>{let X=Q.options,G=new Map;for(let V of X){let K=V._zod.propValues?.[Q.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(V)}"`);for(let q of K){if(G.has(q))throw Error(`Duplicate discriminator value "${String(q)}"`);G.set(q,V)}}return G});J._zod.parse=(X,G)=>{let V=X.value;if(!xD(V))return X.issues.push({code:"invalid_type",expected:"object",input:V,inst:J}),X;let K=Y.value.get(V?.[Q.discriminator]);if(K)return K._zod.run(X,G);if(Q.unionFallback)return Z(X,G);return X.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Q.discriminator,input:V,path:[Q.discriminator],inst:J}),X}}),XK1=F0("$ZodIntersection",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{let X=Z.value,G=Q.left._zod.run({value:X,issues:[]},Y),V=Q.right._zod.run({value:X,issues:[]},Y);if(G instanceof Promise||V instanceof Promise)return Promise.all([G,V]).then(([q,W])=>{return KB0(Z,q,W)});return KB0(Z,G,V)}});Bi=F0("$ZodTuple",(J,Q)=>{X8.init(J,Q);let Z=Q.items;J._zod.parse=(Y,X)=>{let G=Y.value;if(!Array.isArray(G))return Y.issues.push({input:G,inst:J,expected:"tuple",code:"invalid_type"}),Y;Y.value=[];let V=[],K=[...Z].reverse().findIndex((H)=>H._zod.optin!=="optional"),q=K===-1?0:Z.length-K;if(!Q.rest){let H=G.length>Z.length,z=G.length<q-1;if(H||z)return Y.issues.push({...H?{code:"too_big",maximum:Z.length}:{code:"too_small",minimum:Z.length},input:G,inst:J,origin:"array"}),Y}let W=-1;for(let H of Z){if(W++,W>=G.length){if(W>=q)continue}let z=H._zod.run({value:G[W],issues:[]},X);if(z instanceof Promise)V.push(z.then((U)=>Vi(U,Y,W)));else Vi(z,Y,W)}if(Q.rest){let H=G.slice(Z.length);for(let z of H){W++;let U=Q.rest._zod.run({value:z,issues:[]},X);if(U instanceof Promise)V.push(U.then((D)=>Vi(D,Y,W)));else Vi(U,Y,W)}}if(V.length)return Promise.all(V).then(()=>Y);return Y}});$K1=F0("$ZodRecord",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{let X=Z.value;if(!AF(X))return Z.issues.push({expected:"record",code:"invalid_type",input:X,inst:J}),Z;let G=[],V=Q.keyType._zod.values;if(V){Z.value={};let K=new Set;for(let W of V)if(typeof W==="string"||typeof W==="number"||typeof W==="symbol"){K.add(typeof W==="number"?W.toString():W);let H=Q.valueType._zod.run({value:X[W],issues:[]},Y);if(H instanceof Promise)G.push(H.then((z)=>{if(z.issues.length)Z.issues.push(...ZY(W,z.issues));Z.value[W]=z.value}));else{if(H.issues.length)Z.issues.push(...ZY(W,H.issues));Z.value[W]=H.value}}let q;for(let W in X)if(!K.has(W))q=q??[],q.push(W);if(q&&q.length>0)Z.issues.push({code:"unrecognized_keys",input:X,inst:J,keys:q})}else{Z.value={};for(let K of Reflect.ownKeys(X)){if(K==="__proto__")continue;let q=Q.keyType._zod.run({value:K,issues:[]},Y);if(q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(q.issues.length){Z.issues.push({code:"invalid_key",origin:"record",issues:q.issues.map((H)=>YY(H,Y,I3())),input:K,path:[K],inst:J}),Z.value[q.value]=q.value;continue}let W=Q.valueType._zod.run({value:X[K],issues:[]},Y);if(W instanceof Promise)G.push(W.then((H)=>{if(H.issues.length)Z.issues.push(...ZY(K,H.issues));Z.value[q.value]=H.value}));else{if(W.issues.length)Z.issues.push(...ZY(K,W.issues));Z.value[q.value]=W.value}}}if(G.length)return Promise.all(G).then(()=>Z);return Z}}),GK1=F0("$ZodMap",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{let X=Z.value;if(!(X instanceof Map))return Z.issues.push({expected:"map",code:"invalid_type",input:X,inst:J}),Z;let G=[];Z.value=new Map;for(let[V,K]of X){let q=Q.keyType._zod.run({value:V,issues:[]},Y),W=Q.valueType._zod.run({value:K,issues:[]},Y);if(q instanceof Promise||W instanceof Promise)G.push(Promise.all([q,W]).then(([H,z])=>{qB0(H,z,Z,V,X,J,Y)}));else qB0(q,W,Z,V,X,J,Y)}if(G.length)return Promise.all(G).then(()=>Z);return Z}});VK1=F0("$ZodSet",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{let X=Z.value;if(!(X instanceof Set))return Z.issues.push({input:X,inst:J,expected:"set",code:"invalid_type"}),Z;let G=[];Z.value=new Set;for(let V of X){let K=Q.valueType._zod.run({value:V,issues:[]},Y);if(K instanceof Promise)G.push(K.then((q)=>WB0(q,Z)));else WB0(K,Z)}if(G.length)return Promise.all(G).then(()=>Z);return Z}});KK1=F0("$ZodEnum",(J,Q)=>{X8.init(J,Q);let Z=Qk(Q.entries),Y=new Set(Z);J._zod.values=Y,J._zod.pattern=new RegExp(`^(${Z.filter((X)=>Yk.has(typeof X)).map((X)=>typeof X==="string"?RX(X):X.toString()).join("|")})$`),J._zod.parse=(X,G)=>{let V=X.value;if(Y.has(V))return X;return X.issues.push({code:"invalid_value",values:Z,input:V,inst:J}),X}}),qK1=F0("$ZodLiteral",(J,Q)=>{if(X8.init(J,Q),Q.values.length===0)throw Error("Cannot create literal schema with no valid values");let Z=new Set(Q.values);J._zod.values=Z,J._zod.pattern=new RegExp(`^(${Q.values.map((Y)=>typeof Y==="string"?RX(Y):Y?RX(Y.toString()):String(Y)).join("|")})$`),J._zod.parse=(Y,X)=>{let G=Y.value;if(Z.has(G))return Y;return Y.issues.push({code:"invalid_value",values:Q.values,input:G,inst:J}),Y}}),WK1=F0("$ZodFile",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{let X=Z.value;if(X instanceof File)return Z;return Z.issues.push({expected:"file",code:"invalid_type",input:X,inst:J}),Z}}),HK1=F0("$ZodTransform",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")throw new yD(J.constructor.name);let X=Q.transform(Z.value,Z);if(Y.async)return(X instanceof Promise?X:Promise.resolve(X)).then((V)=>{return Z.value=V,Z});if(X instanceof Promise)throw new zK;return Z.value=X,Z}});zK1=F0("$ZodOptional",(J,Q)=>{X8.init(J,Q),J._zod.optin="optional",J._zod.optout="optional",Z9(J._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),Z9(J._zod,"pattern",()=>{let Z=Q.innerType._zod.pattern;return Z?new RegExp(`^(${Zk(Z.source)})?$`):void 0}),J._zod.parse=(Z,Y)=>{if(Q.innerType._zod.optin==="optional"){let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>HB0(G,Z.value));return HB0(X,Z.value)}if(Z.value===void 0)return Z;return Q.innerType._zod.run(Z,Y)}}),FK1=F0("$ZodNullable",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"optin",()=>Q.innerType._zod.optin),Z9(J._zod,"optout",()=>Q.innerType._zod.optout),Z9(J._zod,"pattern",()=>{let Z=Q.innerType._zod.pattern;return Z?new RegExp(`^(${Zk(Z.source)}|null)$`):void 0}),Z9(J._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),J._zod.parse=(Z,Y)=>{if(Z.value===null)return Z;return Q.innerType._zod.run(Z,Y)}}),UK1=F0("$ZodDefault",(J,Q)=>{X8.init(J,Q),J._zod.optin="optional",Z9(J._zod,"values",()=>Q.innerType._zod.values),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(Z,Y);if(Z.value===void 0)return Z.value=Q.defaultValue,Z;let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>zB0(G,Q));return zB0(X,Q)}});BK1=F0("$ZodPrefault",(J,Q)=>{X8.init(J,Q),J._zod.optin="optional",Z9(J._zod,"values",()=>Q.innerType._zod.values),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(Z,Y);if(Z.value===void 0)Z.value=Q.defaultValue;return Q.innerType._zod.run(Z,Y)}}),NK1=F0("$ZodNonOptional",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"values",()=>{let Z=Q.innerType._zod.values;return Z?new Set([...Z].filter((Y)=>Y!==void 0)):void 0}),J._zod.parse=(Z,Y)=>{let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>FB0(G,J));return FB0(X,J)}});DK1=F0("$ZodSuccess",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")throw new yD("ZodSuccess");let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>{return Z.value=G.issues.length===0,Z});return Z.value=X.issues.length===0,Z}}),MK1=F0("$ZodCatch",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"optin",()=>Q.innerType._zod.optin),Z9(J._zod,"optout",()=>Q.innerType._zod.optout),Z9(J._zod,"values",()=>Q.innerType._zod.values),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(Z,Y);let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>{if(Z.value=G.value,G.issues.length)Z.value=Q.catchValue({...Z,error:{issues:G.issues.map((V)=>YY(V,Y,I3()))},input:Z.value}),Z.issues=[];return Z});if(Z.value=X.value,X.issues.length)Z.value=Q.catchValue({...Z,error:{issues:X.issues.map((G)=>YY(G,Y,I3()))},input:Z.value}),Z.issues=[];return Z}}),LK1=F0("$ZodNaN",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{if(typeof Z.value!=="number"||!Number.isNaN(Z.value))return Z.issues.push({input:Z.value,inst:J,expected:"nan",code:"invalid_type"}),Z;return Z}}),AK1=F0("$ZodPipe",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"values",()=>Q.in._zod.values),Z9(J._zod,"optin",()=>Q.in._zod.optin),Z9(J._zod,"optout",()=>Q.out._zod.optout),Z9(J._zod,"propValues",()=>Q.in._zod.propValues),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward"){let G=Q.out._zod.run(Z,Y);if(G instanceof Promise)return G.then((V)=>Ki(V,Q.in,Y));return Ki(G,Q.in,Y)}let X=Q.in._zod.run(Z,Y);if(X instanceof Promise)return X.then((G)=>Ki(G,Q.out,Y));return Ki(X,Q.out,Y)}});Bk=F0("$ZodCodec",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"values",()=>Q.in._zod.values),Z9(J._zod,"optin",()=>Q.in._zod.optin),Z9(J._zod,"optout",()=>Q.out._zod.optout),Z9(J._zod,"propValues",()=>Q.in._zod.propValues),J._zod.parse=(Z,Y)=>{if((Y.direction||"forward")==="forward"){let G=Q.in._zod.run(Z,Y);if(G instanceof Promise)return G.then((V)=>qi(V,Q,Y));return qi(G,Q,Y)}else{let G=Q.out._zod.run(Z,Y);if(G instanceof Promise)return G.then((V)=>qi(V,Q,Y));return qi(G,Q,Y)}}});OK1=F0("$ZodReadonly",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"propValues",()=>Q.innerType._zod.propValues),Z9(J._zod,"values",()=>Q.innerType._zod.values),Z9(J._zod,"optin",()=>Q.innerType?._zod?.optin),Z9(J._zod,"optout",()=>Q.innerType?._zod?.optout),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(Z,Y);let X=Q.innerType._zod.run(Z,Y);if(X instanceof Promise)return X.then(UB0);return UB0(X)}});wK1=F0("$ZodTemplateLiteral",(J,Q)=>{X8.init(J,Q);let Z=[];for(let Y of Q.parts)if(typeof Y==="object"&&Y!==null){if(!Y._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...Y._zod.traits].shift()}`);let X=Y._zod.pattern instanceof RegExp?Y._zod.pattern.source:Y._zod.pattern;if(!X)throw Error(`Invalid template literal part: ${Y._zod.traits}`);let G=X.startsWith("^")?1:0,V=X.endsWith("$")?X.length-1:X.length;Z.push(X.slice(G,V))}else if(Y===null||BG1.has(typeof Y))Z.push(RX(`${Y}`));else throw Error(`Invalid template literal part: ${Y}`);J._zod.pattern=new RegExp(`^${Z.join("")}$`),J._zod.parse=(Y,X)=>{if(typeof Y.value!=="string")return Y.issues.push({input:Y.value,inst:J,expected:"template_literal",code:"invalid_type"}),Y;if(J._zod.pattern.lastIndex=0,!J._zod.pattern.test(Y.value))return Y.issues.push({input:Y.value,inst:J,code:"invalid_format",format:Q.format??"template_literal",pattern:J._zod.pattern.source}),Y;return Y}}),EK1=F0("$ZodFunction",(J,Q)=>{return X8.init(J,Q),J._def=Q,J._zod.def=Q,J.implement=(Z)=>{if(typeof Z!=="function")throw Error("implement() must be called with a function");return function(...Y){let X=J._def.input?qk(J._def.input,Y):Y,G=Reflect.apply(Z,this,X);if(J._def.output)return qk(J._def.output,G);return G}},J.implementAsync=(Z)=>{if(typeof Z!=="function")throw Error("implementAsync() must be called with a function");return async function(...Y){let X=J._def.input?await Wk(J._def.input,Y):Y,G=await Reflect.apply(Z,this,X);if(J._def.output)return await Wk(J._def.output,G);return G}},J._zod.parse=(Z,Y)=>{if(typeof Z.value!=="function")return Z.issues.push({code:"invalid_type",expected:"function",input:Z.value,inst:J}),Z;if(J._def.output&&J._def.output._zod.def.type==="promise")Z.value=J.implementAsync(Z.value);else Z.value=J.implement(Z.value);return Z},J.input=(...Z)=>{let Y=J.constructor;if(Array.isArray(Z[0]))return new Y({type:"function",input:new Bi({type:"tuple",items:Z[0],rest:Z[1]}),output:J._def.output});return new Y({type:"function",input:Z[0],output:J._def.output})},J.output=(Z)=>{return new J.constructor({type:"function",input:J._def.input,output:Z})},J}),IK1=F0("$ZodPromise",(J,Q)=>{X8.init(J,Q),J._zod.parse=(Z,Y)=>{return Promise.resolve(Z.value).then((X)=>Q.innerType._zod.run({value:X,issues:[]},Y))}}),PK1=F0("$ZodLazy",(J,Q)=>{X8.init(J,Q),Z9(J._zod,"innerType",()=>Q.getter()),Z9(J._zod,"pattern",()=>J._zod.innerType?._zod?.pattern),Z9(J._zod,"propValues",()=>J._zod.innerType?._zod?.propValues),Z9(J._zod,"optin",()=>J._zod.innerType?._zod?.optin??void 0),Z9(J._zod,"optout",()=>J._zod.innerType?._zod?.optout??void 0),J._zod.parse=(Z,Y)=>{return J._zod.innerType._zod.run(Z,Y)}}),TK1=F0("$ZodCustom",(J,Q)=>{w5.init(J,Q),X8.init(J,Q),J._zod.parse=(Z,Y)=>{return Z},J._zod.check=(Z)=>{let Y=Z.value,X=Q.fn(Y);if(X instanceof Promise)return X.then((G)=>BB0(G,Z,Y,J));BB0(X,Z,Y,J);return}})});function CK1(){return{localeError:lY4()}}var lY4=()=>{let J={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(X)=>{switch(X.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${X.expected}، ولكن تم إدخال ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${F6(X.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return` أكبر من اللازم: يفترض أن تكون ${X.origin??"القيمة"} ${G} ${X.maximum.toString()} ${V.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${X.origin??"القيمة"} ${G} ${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`أصغر من اللازم: يفترض لـ ${X.origin} أن يكون ${G} ${X.minimum.toString()} ${V.unit}`;return`أصغر من اللازم: يفترض لـ ${X.origin} أن يكون ${G} ${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${X.prefix}"`;if(G.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${G.suffix}"`;if(G.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${G.includes}"`;if(G.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${G.pattern}`;return`${Y[G.format]??X.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${X.divisor}`;case"unrecognized_keys":return`معرف${X.keys.length>1?"ات":""} غريب${X.keys.length>1?"ة":""}: ${h0(X.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${X.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${X.origin}`;default:return"مدخل غير مقبول"}}};var OB0=N1(()=>{S4()});function jK1(){return{localeError:iY4()}}var iY4=()=>{let J={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${X.expected}, daxil olan ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Yanlış dəyər: gözlənilən ${F6(X.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Çox böyük: gözlənilən ${X.origin??"dəyər"} ${G}${X.maximum.toString()} ${V.unit??"element"}`;return`Çox böyük: gözlənilən ${X.origin??"dəyər"} ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Çox kiçik: gözlənilən ${X.origin} ${G}${X.minimum.toString()} ${V.unit}`;return`Çox kiçik: gözlənilən ${X.origin} ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Yanlış mətn: "${G.prefix}" ilə başlamalıdır`;if(G.format==="ends_with")return`Yanlış mətn: "${G.suffix}" ilə bitməlidir`;if(G.format==="includes")return`Yanlış mətn: "${G.includes}" daxil olmalıdır`;if(G.format==="regex")return`Yanlış mətn: ${G.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${Y[G.format]??X.format}`}case"not_multiple_of":return`Yanlış ədəd: ${X.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${X.keys.length>1?"lar":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`${X.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${X.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};var wB0=N1(()=>{S4()});function EB0(J,Q,Z,Y){let X=Math.abs(J),G=X%10,V=X%100;if(V>=11&&V<=19)return Y;if(G===1)return Q;if(G>=2&&G<=4)return Z;return Y}function SK1(){return{localeError:nY4()}}var nY4=()=>{let J={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"лік";case"object":{if(Array.isArray(X))return"масіў";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(X)=>{switch(X.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${X.expected}, атрымана ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Няправільны ўвод: чакалася ${F6(X.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V){let K=Number(X.maximum),q=EB0(K,V.unit.one,V.unit.few,V.unit.many);return`Занадта вялікі: чакалася, што ${X.origin??"значэнне"} павінна ${V.verb} ${G}${X.maximum.toString()} ${q}`}return`Занадта вялікі: чакалася, што ${X.origin??"значэнне"} павінна быць ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V){let K=Number(X.minimum),q=EB0(K,V.unit.one,V.unit.few,V.unit.many);return`Занадта малы: чакалася, што ${X.origin} павінна ${V.verb} ${G}${X.minimum.toString()} ${q}`}return`Занадта малы: чакалася, што ${X.origin} павінна быць ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${G.prefix}"`;if(G.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${G.suffix}"`;if(G.format==="includes")return`Няправільны радок: павінен змяшчаць "${G.includes}"`;if(G.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${G.pattern}`;return`Няправільны ${Y[G.format]??X.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${X.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${X.keys.length>1?"ключы":"ключ"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${X.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${X.origin}`;default:return"Няправільны ўвод"}}};var IB0=N1(()=>{S4()});function _K1(){return{localeError:oY4()}}var aY4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"число";case"object":{if(Array.isArray(J))return"масив";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return Q},oY4=()=>{let J={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function Q(Y){return J[Y]??null}let Z={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"};return(Y)=>{switch(Y.code){case"invalid_type":return`Невалиден вход: очакван ${Y.expected}, получен ${aY4(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Невалиден вход: очакван ${F6(Y.values[0])}`;return`Невалидна опция: очаквано едно от ${h0(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`Твърде голямо: очаква се ${Y.origin??"стойност"} да съдържа ${X}${Y.maximum.toString()} ${G.unit??"елемента"}`;return`Твърде голямо: очаква се ${Y.origin??"стойност"} да бъде ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`Твърде малко: очаква се ${Y.origin} да съдържа ${X}${Y.minimum.toString()} ${G.unit}`;return`Твърде малко: очаква се ${Y.origin} да бъде ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Невалиден низ: трябва да започва с "${X.prefix}"`;if(X.format==="ends_with")return`Невалиден низ: трябва да завършва с "${X.suffix}"`;if(X.format==="includes")return`Невалиден низ: трябва да включва "${X.includes}"`;if(X.format==="regex")return`Невалиден низ: трябва да съвпада с ${X.pattern}`;let G="Невалиден";if(X.format==="emoji")G="Невалидно";if(X.format==="datetime")G="Невалидно";if(X.format==="date")G="Невалидна";if(X.format==="time")G="Невалидно";if(X.format==="duration")G="Невалидна";return`${G} ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${Y.divisor}`;case"unrecognized_keys":return`Неразпознат${Y.keys.length>1?"и":""} ключ${Y.keys.length>1?"ове":""}: ${h0(Y.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${Y.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${Y.origin}`;default:return"Невалиден вход"}}};var PB0=N1(()=>{S4()});function kK1(){return{localeError:rY4()}}var rY4=()=>{let J={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(X)=>{switch(X.code){case"invalid_type":return`Tipus invàlid: s'esperava ${X.expected}, s'ha rebut ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Valor invàlid: s'esperava ${F6(X.values[0])}`;return`Opció invàlida: s'esperava una de ${h0(X.values," o ")}`;case"too_big":{let G=X.inclusive?"com a màxim":"menys de",V=Q(X.origin);if(V)return`Massa gran: s'esperava que ${X.origin??"el valor"} contingués ${G} ${X.maximum.toString()} ${V.unit??"elements"}`;return`Massa gran: s'esperava que ${X.origin??"el valor"} fos ${G} ${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?"com a mínim":"més de",V=Q(X.origin);if(V)return`Massa petit: s'esperava que ${X.origin} contingués ${G} ${X.minimum.toString()} ${V.unit}`;return`Massa petit: s'esperava que ${X.origin} fos ${G} ${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Format invàlid: ha de començar amb "${G.prefix}"`;if(G.format==="ends_with")return`Format invàlid: ha d'acabar amb "${G.suffix}"`;if(G.format==="includes")return`Format invàlid: ha d'incloure "${G.includes}"`;if(G.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${G.pattern}`;return`Format invàlid per a ${Y[G.format]??X.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${X.divisor}`;case"unrecognized_keys":return`Clau${X.keys.length>1?"s":""} no reconeguda${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${X.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${X.origin}`;default:return"Entrada invàlida"}}};var TB0=N1(()=>{S4()});function yK1(){return{localeError:sY4()}}var sY4=()=>{let J={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(X))return"pole";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(X)=>{switch(X.code){case"invalid_type":return`Neplatný vstup: očekáváno ${X.expected}, obdrženo ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neplatný vstup: očekáváno ${F6(X.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Hodnota je příliš velká: ${X.origin??"hodnota"} musí mít ${G}${X.maximum.toString()} ${V.unit??"prvků"}`;return`Hodnota je příliš velká: ${X.origin??"hodnota"} musí být ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Hodnota je příliš malá: ${X.origin??"hodnota"} musí mít ${G}${X.minimum.toString()} ${V.unit??"prvků"}`;return`Hodnota je příliš malá: ${X.origin??"hodnota"} musí být ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Neplatný řetězec: musí začínat na "${G.prefix}"`;if(G.format==="ends_with")return`Neplatný řetězec: musí končit na "${G.suffix}"`;if(G.format==="includes")return`Neplatný řetězec: musí obsahovat "${G.includes}"`;if(G.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${G.pattern}`;return`Neplatný formát ${Y[G.format]??X.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${X.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${h0(X.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${X.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${X.origin}`;default:return"Neplatný vstup"}}};var RB0=N1(()=>{S4()});function xK1(){return{localeError:tY4()}}var tY4=()=>{let J={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},Q={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function Z(V){return J[V]??null}function Y(V){return Q[V]??V}let X=(V)=>{let K=typeof V;switch(K){case"number":return Number.isNaN(V)?"NaN":"tal";case"object":{if(Array.isArray(V))return"liste";if(V===null)return"null";if(Object.getPrototypeOf(V)!==Object.prototype&&V.constructor)return V.constructor.name;return"objekt"}}return K},G={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(V)=>{switch(V.code){case"invalid_type":return`Ugyldigt input: forventede ${Y(V.expected)}, fik ${Y(X(V.input))}`;case"invalid_value":if(V.values.length===1)return`Ugyldig værdi: forventede ${F6(V.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${h0(V.values,"|")}`;case"too_big":{let K=V.inclusive?"<=":"<",q=Z(V.origin),W=Y(V.origin);if(q)return`For stor: forventede ${W??"value"} ${q.verb} ${K} ${V.maximum.toString()} ${q.unit??"elementer"}`;return`For stor: forventede ${W??"value"} havde ${K} ${V.maximum.toString()}`}case"too_small":{let K=V.inclusive?">=":">",q=Z(V.origin),W=Y(V.origin);if(q)return`For lille: forventede ${W} ${q.verb} ${K} ${V.minimum.toString()} ${q.unit}`;return`For lille: forventede ${W} havde ${K} ${V.minimum.toString()}`}case"invalid_format":{let K=V;if(K.format==="starts_with")return`Ugyldig streng: skal starte med "${K.prefix}"`;if(K.format==="ends_with")return`Ugyldig streng: skal ende med "${K.suffix}"`;if(K.format==="includes")return`Ugyldig streng: skal indeholde "${K.includes}"`;if(K.format==="regex")return`Ugyldig streng: skal matche mønsteret ${K.pattern}`;return`Ugyldig ${G[K.format]??V.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${V.divisor}`;case"unrecognized_keys":return`${V.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${h0(V.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${V.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${V.origin}`;default:return"Ugyldigt input"}}};var CB0=N1(()=>{S4()});function vK1(){return{localeError:eY4()}}var eY4=()=>{let J={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"Zahl";case"object":{if(Array.isArray(X))return"Array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(X)=>{switch(X.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${X.expected}, erhalten ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ungültige Eingabe: erwartet ${F6(X.values[0])}`;return`Ungültige Option: erwartet eine von ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Zu groß: erwartet, dass ${X.origin??"Wert"} ${G}${X.maximum.toString()} ${V.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${X.origin??"Wert"} ${G}${X.maximum.toString()} ist`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Zu klein: erwartet, dass ${X.origin} ${G}${X.minimum.toString()} ${V.unit} hat`;return`Zu klein: erwartet, dass ${X.origin} ${G}${X.minimum.toString()} ist`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Ungültiger String: muss mit "${G.prefix}" beginnen`;if(G.format==="ends_with")return`Ungültiger String: muss mit "${G.suffix}" enden`;if(G.format==="includes")return`Ungültiger String: muss "${G.includes}" enthalten`;if(G.format==="regex")return`Ungültiger String: muss dem Muster ${G.pattern} entsprechen`;return`Ungültig: ${Y[G.format]??X.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${X.divisor} sein`;case"unrecognized_keys":return`${X.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${X.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${X.origin}`;default:return"Ungültige Eingabe"}}};var jB0=N1(()=>{S4()});function Nk(){return{localeError:QX4()}}var JX4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return Q},QX4=()=>{let J={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function Q(Y){return J[Y]??null}let Z={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(Y)=>{switch(Y.code){case"invalid_type":return`Invalid input: expected ${Y.expected}, received ${JX4(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Invalid input: expected ${F6(Y.values[0])}`;return`Invalid option: expected one of ${h0(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`Too big: expected ${Y.origin??"value"} to have ${X}${Y.maximum.toString()} ${G.unit??"elements"}`;return`Too big: expected ${Y.origin??"value"} to be ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`Too small: expected ${Y.origin} to have ${X}${Y.minimum.toString()} ${G.unit}`;return`Too small: expected ${Y.origin} to be ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Invalid string: must start with "${X.prefix}"`;if(X.format==="ends_with")return`Invalid string: must end with "${X.suffix}"`;if(X.format==="includes")return`Invalid string: must include "${X.includes}"`;if(X.format==="regex")return`Invalid string: must match pattern ${X.pattern}`;return`Invalid ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${Y.divisor}`;case"unrecognized_keys":return`Unrecognized key${Y.keys.length>1?"s":""}: ${h0(Y.keys,", ")}`;case"invalid_key":return`Invalid key in ${Y.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${Y.origin}`;default:return"Invalid input"}}};var fK1=N1(()=>{S4()});function hK1(){return{localeError:YX4()}}var ZX4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"nombro";case"object":{if(Array.isArray(J))return"tabelo";if(J===null)return"senvalora";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return Q},YX4=()=>{let J={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function Q(Y){return J[Y]??null}let Z={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(Y)=>{switch(Y.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${Y.expected}, riceviĝis ${ZX4(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Nevalida enigo: atendiĝis ${F6(Y.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${h0(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`Tro granda: atendiĝis ke ${Y.origin??"valoro"} havu ${X}${Y.maximum.toString()} ${G.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${Y.origin??"valoro"} havu ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`Tro malgranda: atendiĝis ke ${Y.origin} havu ${X}${Y.minimum.toString()} ${G.unit}`;return`Tro malgranda: atendiĝis ke ${Y.origin} estu ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${X.prefix}"`;if(X.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${X.suffix}"`;if(X.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${X.includes}"`;if(X.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${X.pattern}`;return`Nevalida ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${Y.divisor}`;case"unrecognized_keys":return`Nekonata${Y.keys.length>1?"j":""} ŝlosilo${Y.keys.length>1?"j":""}: ${h0(Y.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${Y.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${Y.origin}`;default:return"Nevalida enigo"}}};var SB0=N1(()=>{S4()});function bK1(){return{localeError:XX4()}}var XX4=()=>{let J={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},Q={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function Z(V){return J[V]??null}function Y(V){return Q[V]??V}let X=(V)=>{let K=typeof V;switch(K){case"number":return Number.isNaN(V)?"NaN":"number";case"object":{if(Array.isArray(V))return"array";if(V===null)return"null";if(Object.getPrototypeOf(V)!==Object.prototype)return V.constructor.name;return"object"}}return K},G={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(V)=>{switch(V.code){case"invalid_type":return`Entrada inválida: se esperaba ${Y(V.expected)}, recibido ${Y(X(V.input))}`;case"invalid_value":if(V.values.length===1)return`Entrada inválida: se esperaba ${F6(V.values[0])}`;return`Opción inválida: se esperaba una de ${h0(V.values,"|")}`;case"too_big":{let K=V.inclusive?"<=":"<",q=Z(V.origin),W=Y(V.origin);if(q)return`Demasiado grande: se esperaba que ${W??"valor"} tuviera ${K}${V.maximum.toString()} ${q.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${W??"valor"} fuera ${K}${V.maximum.toString()}`}case"too_small":{let K=V.inclusive?">=":">",q=Z(V.origin),W=Y(V.origin);if(q)return`Demasiado pequeño: se esperaba que ${W} tuviera ${K}${V.minimum.toString()} ${q.unit}`;return`Demasiado pequeño: se esperaba que ${W} fuera ${K}${V.minimum.toString()}`}case"invalid_format":{let K=V;if(K.format==="starts_with")return`Cadena inválida: debe comenzar con "${K.prefix}"`;if(K.format==="ends_with")return`Cadena inválida: debe terminar en "${K.suffix}"`;if(K.format==="includes")return`Cadena inválida: debe incluir "${K.includes}"`;if(K.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${K.pattern}`;return`Inválido ${G[K.format]??V.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${V.divisor}`;case"unrecognized_keys":return`Llave${V.keys.length>1?"s":""} desconocida${V.keys.length>1?"s":""}: ${h0(V.keys,", ")}`;case"invalid_key":return`Llave inválida en ${Y(V.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${Y(V.origin)}`;default:return"Entrada inválida"}}};var _B0=N1(()=>{S4()});function gK1(){return{localeError:$X4()}}var $X4=()=>{let J={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"عدد";case"object":{if(Array.isArray(X))return"آرایه";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(X)=>{switch(X.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${X.expected} می‌بود، ${Z(X.input)} دریافت شد`;case"invalid_value":if(X.values.length===1)return`ورودی نامعتبر: می‌بایست ${F6(X.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${h0(X.values,"|")} می‌بود`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`خیلی بزرگ: ${X.origin??"مقدار"} باید ${G}${X.maximum.toString()} ${V.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${X.origin??"مقدار"} باید ${G}${X.maximum.toString()} باشد`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`خیلی کوچک: ${X.origin} باید ${G}${X.minimum.toString()} ${V.unit} باشد`;return`خیلی کوچک: ${X.origin} باید ${G}${X.minimum.toString()} باشد`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`رشته نامعتبر: باید با "${G.prefix}" شروع شود`;if(G.format==="ends_with")return`رشته نامعتبر: باید با "${G.suffix}" تمام شود`;if(G.format==="includes")return`رشته نامعتبر: باید شامل "${G.includes}" باشد`;if(G.format==="regex")return`رشته نامعتبر: باید با الگوی ${G.pattern} مطابقت داشته باشد`;return`${Y[G.format]??X.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${X.divisor} باشد`;case"unrecognized_keys":return`کلید${X.keys.length>1?"های":""} ناشناس: ${h0(X.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${X.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${X.origin}`;default:return"ورودی نامعتبر"}}};var kB0=N1(()=>{S4()});function mK1(){return{localeError:GX4()}}var GX4=()=>{let J={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(X)=>{switch(X.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${X.expected}, oli ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Virheellinen syöte: täytyy olla ${F6(X.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Liian suuri: ${V.subject} täytyy olla ${G}${X.maximum.toString()} ${V.unit}`.trim();return`Liian suuri: arvon täytyy olla ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Liian pieni: ${V.subject} täytyy olla ${G}${X.minimum.toString()} ${V.unit}`.trim();return`Liian pieni: arvon täytyy olla ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${G.prefix}"`;if(G.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${G.suffix}"`;if(G.format==="includes")return`Virheellinen syöte: täytyy sisältää "${G.includes}"`;if(G.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${G.pattern}`;return`Virheellinen ${Y[G.format]??X.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${X.divisor} monikerta`;case"unrecognized_keys":return`${X.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${h0(X.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};var yB0=N1(()=>{S4()});function uK1(){return{localeError:VX4()}}var VX4=()=>{let J={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"nombre";case"object":{if(Array.isArray(X))return"tableau";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(X)=>{switch(X.code){case"invalid_type":return`Entrée invalide : ${X.expected} attendu, ${Z(X.input)} reçu`;case"invalid_value":if(X.values.length===1)return`Entrée invalide : ${F6(X.values[0])} attendu`;return`Option invalide : une valeur parmi ${h0(X.values,"|")} attendue`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Trop grand : ${X.origin??"valeur"} doit ${V.verb} ${G}${X.maximum.toString()} ${V.unit??"élément(s)"}`;return`Trop grand : ${X.origin??"valeur"} doit être ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Trop petit : ${X.origin} doit ${V.verb} ${G}${X.minimum.toString()} ${V.unit}`;return`Trop petit : ${X.origin} doit être ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Chaîne invalide : doit commencer par "${G.prefix}"`;if(G.format==="ends_with")return`Chaîne invalide : doit se terminer par "${G.suffix}"`;if(G.format==="includes")return`Chaîne invalide : doit inclure "${G.includes}"`;if(G.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${G.pattern}`;return`${Y[G.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${X.divisor}`;case"unrecognized_keys":return`Clé${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${h0(X.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${X.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entrée invalide"}}};var xB0=N1(()=>{S4()});function pK1(){return{localeError:KX4()}}var KX4=()=>{let J={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(X)=>{switch(X.code){case"invalid_type":return`Entrée invalide : attendu ${X.expected}, reçu ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrée invalide : attendu ${F6(X.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"≤":"<",V=Q(X.origin);if(V)return`Trop grand : attendu que ${X.origin??"la valeur"} ait ${G}${X.maximum.toString()} ${V.unit}`;return`Trop grand : attendu que ${X.origin??"la valeur"} soit ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?"≥":">",V=Q(X.origin);if(V)return`Trop petit : attendu que ${X.origin} ait ${G}${X.minimum.toString()} ${V.unit}`;return`Trop petit : attendu que ${X.origin} soit ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Chaîne invalide : doit commencer par "${G.prefix}"`;if(G.format==="ends_with")return`Chaîne invalide : doit se terminer par "${G.suffix}"`;if(G.format==="includes")return`Chaîne invalide : doit inclure "${G.includes}"`;if(G.format==="regex")return`Chaîne invalide : doit correspondre au motif ${G.pattern}`;return`${Y[G.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${X.divisor}`;case"unrecognized_keys":return`Clé${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${h0(X.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${X.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entrée invalide"}}};var vB0=N1(()=>{S4()});function dK1(){return{localeError:qX4()}}var qX4=()=>{let J={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},Q={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},Z=(W)=>W?J[W]:void 0,Y=(W)=>{let H=Z(W);if(H)return H.label;return W??J.unknown.label},X=(W)=>`ה${Y(W)}`,G=(W)=>{return(Z(W)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},V=(W)=>{if(!W)return null;return Q[W]??null},K=(W)=>{let H=typeof W;switch(H){case"number":return Number.isNaN(W)?"NaN":"number";case"object":{if(Array.isArray(W))return"array";if(W===null)return"null";if(Object.getPrototypeOf(W)!==Object.prototype&&W.constructor)return W.constructor.name;return"object"}default:return H}},q={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}};return(W)=>{switch(W.code){case"invalid_type":{let H=W.expected,z=Y(H),U=K(W.input),D=J[U]?.label??U;return`קלט לא תקין: צריך להיות ${z}, התקבל ${D}`}case"invalid_value":{if(W.values.length===1)return`ערך לא תקין: הערך חייב להיות ${F6(W.values[0])}`;let H=W.values.map((D)=>F6(D));if(W.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${H[0]} או ${H[1]}`;let z=H[H.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${H.slice(0,-1).join(", ")} או ${z}`}case"too_big":{let H=V(W.origin),z=X(W.origin??"value");if(W.origin==="string")return`${H?.longLabel??"ארוך"} מדי: ${z} צריכה להכיל ${W.maximum.toString()} ${H?.unit??""} ${W.inclusive?"או פחות":"לכל היותר"}`.trim();if(W.origin==="number"){let M=W.inclusive?`קטן או שווה ל-${W.maximum}`:`קטן מ-${W.maximum}`;return`גדול מדי: ${z} צריך להיות ${M}`}if(W.origin==="array"||W.origin==="set"){let M=W.origin==="set"?"צריכה":"צריך",L=W.inclusive?`${W.maximum} ${H?.unit??""} או פחות`:`פחות מ-${W.maximum} ${H?.unit??""}`;return`גדול מדי: ${z} ${M} להכיל ${L}`.trim()}let U=W.inclusive?"<=":"<",D=G(W.origin??"value");if(H?.unit)return`${H.longLabel} מדי: ${z} ${D} ${U}${W.maximum.toString()} ${H.unit}`;return`${H?.longLabel??"גדול"} מדי: ${z} ${D} ${U}${W.maximum.toString()}`}case"too_small":{let H=V(W.origin),z=X(W.origin??"value");if(W.origin==="string")return`${H?.shortLabel??"קצר"} מדי: ${z} צריכה להכיל ${W.minimum.toString()} ${H?.unit??""} ${W.inclusive?"או יותר":"לפחות"}`.trim();if(W.origin==="number"){let M=W.inclusive?`גדול או שווה ל-${W.minimum}`:`גדול מ-${W.minimum}`;return`קטן מדי: ${z} צריך להיות ${M}`}if(W.origin==="array"||W.origin==="set"){let M=W.origin==="set"?"צריכה":"צריך";if(W.minimum===1&&W.inclusive){let A=W.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${z} ${M} להכיל ${A}`}let L=W.inclusive?`${W.minimum} ${H?.unit??""} או יותר`:`יותר מ-${W.minimum} ${H?.unit??""}`;return`קטן מדי: ${z} ${M} להכיל ${L}`.trim()}let U=W.inclusive?">=":">",D=G(W.origin??"value");if(H?.unit)return`${H.shortLabel} מדי: ${z} ${D} ${U}${W.minimum.toString()} ${H.unit}`;return`${H?.shortLabel??"קטן"} מדי: ${z} ${D} ${U}${W.minimum.toString()}`}case"invalid_format":{let H=W;if(H.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${H.prefix}"`;if(H.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${H.suffix}"`;if(H.format==="includes")return`המחרוזת חייבת לכלול "${H.includes}"`;if(H.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${H.pattern}`;let z=q[H.format],U=z?.label??H.format,M=(z?.gender??"m")==="f"?"תקינה":"תקין";return`${U} לא ${M}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${W.divisor}`;case"unrecognized_keys":return`מפתח${W.keys.length>1?"ות":""} לא מזוה${W.keys.length>1?"ים":"ה"}: ${h0(W.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${X(W.origin??"array")}`;default:return"קלט לא תקין"}}};var fB0=N1(()=>{S4()});function cK1(){return{localeError:WX4()}}var WX4=()=>{let J={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"szám";case"object":{if(Array.isArray(X))return"tömb";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(X)=>{switch(X.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${X.expected}, a kapott érték ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Érvénytelen bemenet: a várt érték ${F6(X.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Túl nagy: ${X.origin??"érték"} mérete túl nagy ${G}${X.maximum.toString()} ${V.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${X.origin??"érték"} túl nagy: ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Túl kicsi: a bemeneti érték ${X.origin} mérete túl kicsi ${G}${X.minimum.toString()} ${V.unit}`;return`Túl kicsi: a bemeneti érték ${X.origin} túl kicsi ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Érvénytelen string: "${G.prefix}" értékkel kell kezdődnie`;if(G.format==="ends_with")return`Érvénytelen string: "${G.suffix}" értékkel kell végződnie`;if(G.format==="includes")return`Érvénytelen string: "${G.includes}" értéket kell tartalmaznia`;if(G.format==="regex")return`Érvénytelen string: ${G.pattern} mintának kell megfelelnie`;return`Érvénytelen ${Y[G.format]??X.format}`}case"not_multiple_of":return`Érvénytelen szám: ${X.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${X.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${X.origin}`;default:return"Érvénytelen bemenet"}}};var hB0=N1(()=>{S4()});function lK1(){return{localeError:HX4()}}var HX4=()=>{let J={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input tidak valid: diharapkan ${X.expected}, diterima ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak valid: diharapkan ${F6(X.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Terlalu besar: diharapkan ${X.origin??"value"} memiliki ${G}${X.maximum.toString()} ${V.unit??"elemen"}`;return`Terlalu besar: diharapkan ${X.origin??"value"} menjadi ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Terlalu kecil: diharapkan ${X.origin} memiliki ${G}${X.minimum.toString()} ${V.unit}`;return`Terlalu kecil: diharapkan ${X.origin} menjadi ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`String tidak valid: harus dimulai dengan "${G.prefix}"`;if(G.format==="ends_with")return`String tidak valid: harus berakhir dengan "${G.suffix}"`;if(G.format==="includes")return`String tidak valid: harus menyertakan "${G.includes}"`;if(G.format==="regex")return`String tidak valid: harus sesuai pola ${G.pattern}`;return`${Y[G.format]??X.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${X.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${X.origin}`;default:return"Input tidak valid"}}};var bB0=N1(()=>{S4()});function iK1(){return{localeError:FX4()}}var zX4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"númer";case"object":{if(Array.isArray(J))return"fylki";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return Q},FX4=()=>{let J={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function Q(Y){return J[Y]??null}let Z={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(Y)=>{switch(Y.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${zX4(Y.input)} þar sem á að vera ${Y.expected}`;case"invalid_value":if(Y.values.length===1)return`Rangt gildi: gert ráð fyrir ${F6(Y.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${h0(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`Of stórt: gert er ráð fyrir að ${Y.origin??"gildi"} hafi ${X}${Y.maximum.toString()} ${G.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${Y.origin??"gildi"} sé ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`Of lítið: gert er ráð fyrir að ${Y.origin} hafi ${X}${Y.minimum.toString()} ${G.unit}`;return`Of lítið: gert er ráð fyrir að ${Y.origin} sé ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Ógildur strengur: verður að byrja á "${X.prefix}"`;if(X.format==="ends_with")return`Ógildur strengur: verður að enda á "${X.suffix}"`;if(X.format==="includes")return`Ógildur strengur: verður að innihalda "${X.includes}"`;if(X.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${X.pattern}`;return`Rangt ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${Y.divisor}`;case"unrecognized_keys":return`Óþekkt ${Y.keys.length>1?"ir lyklar":"ur lykill"}: ${h0(Y.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${Y.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${Y.origin}`;default:return"Rangt gildi"}}};var gB0=N1(()=>{S4()});function nK1(){return{localeError:UX4()}}var UX4=()=>{let J={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"numero";case"object":{if(Array.isArray(X))return"vettore";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input non valido: atteso ${X.expected}, ricevuto ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input non valido: atteso ${F6(X.values[0])}`;return`Opzione non valida: atteso uno tra ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Troppo grande: ${X.origin??"valore"} deve avere ${G}${X.maximum.toString()} ${V.unit??"elementi"}`;return`Troppo grande: ${X.origin??"valore"} deve essere ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Troppo piccolo: ${X.origin} deve avere ${G}${X.minimum.toString()} ${V.unit}`;return`Troppo piccolo: ${X.origin} deve essere ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Stringa non valida: deve iniziare con "${G.prefix}"`;if(G.format==="ends_with")return`Stringa non valida: deve terminare con "${G.suffix}"`;if(G.format==="includes")return`Stringa non valida: deve includere "${G.includes}"`;if(G.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${G.pattern}`;return`Invalid ${Y[G.format]??X.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${X.divisor}`;case"unrecognized_keys":return`Chiav${X.keys.length>1?"i":"e"} non riconosciut${X.keys.length>1?"e":"a"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${X.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${X.origin}`;default:return"Input non valido"}}};var mB0=N1(()=>{S4()});function aK1(){return{localeError:BX4()}}var BX4=()=>{let J={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"数値";case"object":{if(Array.isArray(X))return"配列";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(X)=>{switch(X.code){case"invalid_type":return`無効な入力: ${X.expected}が期待されましたが、${Z(X.input)}が入力されました`;case"invalid_value":if(X.values.length===1)return`無効な入力: ${F6(X.values[0])}が期待されました`;return`無効な選択: ${h0(X.values,"、")}のいずれかである必要があります`;case"too_big":{let G=X.inclusive?"以下である":"より小さい",V=Q(X.origin);if(V)return`大きすぎる値: ${X.origin??"値"}は${X.maximum.toString()}${V.unit??"要素"}${G}必要があります`;return`大きすぎる値: ${X.origin??"値"}は${X.maximum.toString()}${G}必要があります`}case"too_small":{let G=X.inclusive?"以上である":"より大きい",V=Q(X.origin);if(V)return`小さすぎる値: ${X.origin}は${X.minimum.toString()}${V.unit}${G}必要があります`;return`小さすぎる値: ${X.origin}は${X.minimum.toString()}${G}必要があります`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`無効な文字列: "${G.prefix}"で始まる必要があります`;if(G.format==="ends_with")return`無効な文字列: "${G.suffix}"で終わる必要があります`;if(G.format==="includes")return`無効な文字列: "${G.includes}"を含む必要があります`;if(G.format==="regex")return`無効な文字列: パターン${G.pattern}に一致する必要があります`;return`無効な${Y[G.format]??X.format}`}case"not_multiple_of":return`無効な数値: ${X.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${X.keys.length>1?"群":""}: ${h0(X.keys,"、")}`;case"invalid_key":return`${X.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${X.origin}内の無効な値`;default:return"無効な入力"}}};var uB0=N1(()=>{S4()});function oK1(){return{localeError:DX4()}}var NX4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"რიცხვი";case"object":{if(Array.isArray(J))return"მასივი";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[Q]??Q},DX4=()=>{let J={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function Q(Y){return J[Y]??null}let Z={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return(Y)=>{switch(Y.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${Y.expected}, მიღებული ${NX4(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${F6(Y.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${h0(Y.values,"|")}-დან`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`ზედმეტად დიდი: მოსალოდნელი ${Y.origin??"მნიშვნელობა"} ${G.verb} ${X}${Y.maximum.toString()} ${G.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${Y.origin??"მნიშვნელობა"} იყოს ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`ზედმეტად პატარა: მოსალოდნელი ${Y.origin} ${G.verb} ${X}${Y.minimum.toString()} ${G.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${Y.origin} იყოს ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${X.prefix}"-ით`;if(X.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${X.suffix}"-ით`;if(X.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${X.includes}"-ს`;if(X.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${X.pattern}`;return`არასწორი ${Z[X.format]??Y.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${Y.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${Y.keys.length>1?"ები":"ი"}: ${h0(Y.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${Y.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${Y.origin}-ში`;default:return"არასწორი შეყვანა"}}};var pB0=N1(()=>{S4()});function Dk(){return{localeError:MX4()}}var MX4=()=>{let J={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(X))return"អារេ (Array)";if(X===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(X)=>{switch(X.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${X.expected} ប៉ុន្តែទទួលបាន ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${F6(X.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`ធំពេក៖ ត្រូវការ ${X.origin??"តម្លៃ"} ${G} ${X.maximum.toString()} ${V.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${X.origin??"តម្លៃ"} ${G} ${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`តូចពេក៖ ត្រូវការ ${X.origin} ${G} ${X.minimum.toString()} ${V.unit}`;return`តូចពេក៖ ត្រូវការ ${X.origin} ${G} ${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${G.prefix}"`;if(G.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${G.suffix}"`;if(G.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${G.includes}"`;if(G.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${G.pattern}`;return`មិនត្រឹមត្រូវ៖ ${Y[G.format]??X.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${X.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${h0(X.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${X.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${X.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};var rK1=N1(()=>{S4()});function sK1(){return Dk()}var dB0=N1(()=>{rK1()});function tK1(){return{localeError:LX4()}}var LX4=()=>{let J={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(X)=>{switch(X.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${X.expected}, 받은 타입은 ${Z(X.input)}입니다`;case"invalid_value":if(X.values.length===1)return`잘못된 입력: 값은 ${F6(X.values[0])} 이어야 합니다`;return`잘못된 옵션: ${h0(X.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let G=X.inclusive?"이하":"미만",V=G==="미만"?"이어야 합니다":"여야 합니다",K=Q(X.origin),q=K?.unit??"요소";if(K)return`${X.origin??"값"}이 너무 큽니다: ${X.maximum.toString()}${q} ${G}${V}`;return`${X.origin??"값"}이 너무 큽니다: ${X.maximum.toString()} ${G}${V}`}case"too_small":{let G=X.inclusive?"이상":"초과",V=G==="이상"?"이어야 합니다":"여야 합니다",K=Q(X.origin),q=K?.unit??"요소";if(K)return`${X.origin??"값"}이 너무 작습니다: ${X.minimum.toString()}${q} ${G}${V}`;return`${X.origin??"값"}이 너무 작습니다: ${X.minimum.toString()} ${G}${V}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`잘못된 문자열: "${G.prefix}"(으)로 시작해야 합니다`;if(G.format==="ends_with")return`잘못된 문자열: "${G.suffix}"(으)로 끝나야 합니다`;if(G.format==="includes")return`잘못된 문자열: "${G.includes}"을(를) 포함해야 합니다`;if(G.format==="regex")return`잘못된 문자열: 정규식 ${G.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${Y[G.format]??X.format}`}case"not_multiple_of":return`잘못된 숫자: ${X.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${h0(X.keys,", ")}`;case"invalid_key":return`잘못된 키: ${X.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${X.origin}`;default:return"잘못된 입력"}}};var cB0=N1(()=>{S4()});function lB0(J){let Q=Math.abs(J),Z=Q%10,Y=Q%100;if(Y>=11&&Y<=19||Z===0)return"many";if(Z===1)return"one";return"few"}function eK1(){return{localeError:OX4()}}var AX4=(J)=>{return Lk(typeof J,J)},Lk=(J,Q=void 0)=>{switch(J){case"number":return Number.isNaN(Q)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":{if(Q===void 0)return"nežinomas objektas";if(Q===null)return"nulinė reikšmė";if(Array.isArray(Q))return"masyvas";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name;return"objektas"}case"null":return"nulinė reikšmė"}return J},Mk=(J)=>{return J.charAt(0).toUpperCase()+J.slice(1)},OX4=()=>{let J={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function Q(Y,X,G,V){let K=J[Y]??null;if(K===null)return K;return{unit:K.unit[X],verb:K.verb[V][G?"inclusive":"notInclusive"]}}let Z={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return(Y)=>{switch(Y.code){case"invalid_type":return`Gautas tipas ${AX4(Y.input)}, o tikėtasi - ${Lk(Y.expected)}`;case"invalid_value":if(Y.values.length===1)return`Privalo būti ${F6(Y.values[0])}`;return`Privalo būti vienas iš ${h0(Y.values,"|")} pasirinkimų`;case"too_big":{let X=Lk(Y.origin),G=Q(Y.origin,lB0(Number(Y.maximum)),Y.inclusive??!1,"smaller");if(G?.verb)return`${Mk(X??Y.origin??"reikšmė")} ${G.verb} ${Y.maximum.toString()} ${G.unit??"elementų"}`;let V=Y.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Mk(X??Y.origin??"reikšmė")} turi būti ${V} ${Y.maximum.toString()} ${G?.unit}`}case"too_small":{let X=Lk(Y.origin),G=Q(Y.origin,lB0(Number(Y.minimum)),Y.inclusive??!1,"bigger");if(G?.verb)return`${Mk(X??Y.origin??"reikšmė")} ${G.verb} ${Y.minimum.toString()} ${G.unit??"elementų"}`;let V=Y.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Mk(X??Y.origin??"reikšmė")} turi būti ${V} ${Y.minimum.toString()} ${G?.unit}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Eilutė privalo prasidėti "${X.prefix}"`;if(X.format==="ends_with")return`Eilutė privalo pasibaigti "${X.suffix}"`;if(X.format==="includes")return`Eilutė privalo įtraukti "${X.includes}"`;if(X.format==="regex")return`Eilutė privalo atitikti ${X.pattern}`;return`Neteisingas ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Skaičius privalo būti ${Y.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${Y.keys.length>1?"i":"as"} rakt${Y.keys.length>1?"ai":"as"}: ${h0(Y.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let X=Lk(Y.origin);return`${Mk(X??Y.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};var iB0=N1(()=>{S4()});function Jq1(){return{localeError:wX4()}}var wX4=()=>{let J={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"број";case"object":{if(Array.isArray(X))return"низа";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(X)=>{switch(X.code){case"invalid_type":return`Грешен внес: се очекува ${X.expected}, примено ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Invalid input: expected ${F6(X.values[0])}`;return`Грешана опција: се очекува една ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Премногу голем: се очекува ${X.origin??"вредноста"} да има ${G}${X.maximum.toString()} ${V.unit??"елементи"}`;return`Премногу голем: се очекува ${X.origin??"вредноста"} да биде ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Премногу мал: се очекува ${X.origin} да има ${G}${X.minimum.toString()} ${V.unit}`;return`Премногу мал: се очекува ${X.origin} да биде ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Неважечка низа: мора да започнува со "${G.prefix}"`;if(G.format==="ends_with")return`Неважечка низа: мора да завршува со "${G.suffix}"`;if(G.format==="includes")return`Неважечка низа: мора да вклучува "${G.includes}"`;if(G.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${G.pattern}`;return`Invalid ${Y[G.format]??X.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${X.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${X.origin}`;default:return"Грешен внес"}}};var nB0=N1(()=>{S4()});function Qq1(){return{localeError:EX4()}}var EX4=()=>{let J={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"nombor";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input tidak sah: dijangka ${X.expected}, diterima ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak sah: dijangka ${F6(X.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Terlalu besar: dijangka ${X.origin??"nilai"} ${V.verb} ${G}${X.maximum.toString()} ${V.unit??"elemen"}`;return`Terlalu besar: dijangka ${X.origin??"nilai"} adalah ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Terlalu kecil: dijangka ${X.origin} ${V.verb} ${G}${X.minimum.toString()} ${V.unit}`;return`Terlalu kecil: dijangka ${X.origin} adalah ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`String tidak sah: mesti bermula dengan "${G.prefix}"`;if(G.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${G.suffix}"`;if(G.format==="includes")return`String tidak sah: mesti mengandungi "${G.includes}"`;if(G.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${G.pattern}`;return`${Y[G.format]??X.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${h0(X.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${X.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${X.origin}`;default:return"Input tidak sah"}}};var aB0=N1(()=>{S4()});function Zq1(){return{localeError:IX4()}}var IX4=()=>{let J={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"getal";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(X)=>{switch(X.code){case"invalid_type":return`Ongeldige invoer: verwacht ${X.expected}, ontving ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ongeldige invoer: verwacht ${F6(X.values[0])}`;return`Ongeldige optie: verwacht één van ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Te groot: verwacht dat ${X.origin??"waarde"} ${V.verb} ${G}${X.maximum.toString()} ${V.unit??"elementen"}`;return`Te groot: verwacht dat ${X.origin??"waarde"} ${G}${X.maximum.toString()} is`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Te klein: verwacht dat ${X.origin} ${V.verb} ${G}${X.minimum.toString()} ${V.unit}`;return`Te klein: verwacht dat ${X.origin} ${G}${X.minimum.toString()} is`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Ongeldige tekst: moet met "${G.prefix}" beginnen`;if(G.format==="ends_with")return`Ongeldige tekst: moet op "${G.suffix}" eindigen`;if(G.format==="includes")return`Ongeldige tekst: moet "${G.includes}" bevatten`;if(G.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${G.pattern}`;return`Ongeldig: ${Y[G.format]??X.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${X.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${X.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${X.origin}`;default:return"Ongeldige invoer"}}};var oB0=N1(()=>{S4()});function Yq1(){return{localeError:PX4()}}var PX4=()=>{let J={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"tall";case"object":{if(Array.isArray(X))return"liste";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Ugyldig input: forventet ${X.expected}, fikk ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ugyldig verdi: forventet ${F6(X.values[0])}`;return`Ugyldig valg: forventet en av ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`For stor(t): forventet ${X.origin??"value"} til å ha ${G}${X.maximum.toString()} ${V.unit??"elementer"}`;return`For stor(t): forventet ${X.origin??"value"} til å ha ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`For lite(n): forventet ${X.origin} til å ha ${G}${X.minimum.toString()} ${V.unit}`;return`For lite(n): forventet ${X.origin} til å ha ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Ugyldig streng: må starte med "${G.prefix}"`;if(G.format==="ends_with")return`Ugyldig streng: må ende med "${G.suffix}"`;if(G.format==="includes")return`Ugyldig streng: må inneholde "${G.includes}"`;if(G.format==="regex")return`Ugyldig streng: må matche mønsteret ${G.pattern}`;return`Ugyldig ${Y[G.format]??X.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${X.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${X.origin}`;default:return"Ugyldig input"}}};var rB0=N1(()=>{S4()});function Xq1(){return{localeError:TX4()}}var TX4=()=>{let J={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"numara";case"object":{if(Array.isArray(X))return"saf";if(X===null)return"gayb";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(X)=>{switch(X.code){case"invalid_type":return`Fâsit giren: umulan ${X.expected}, alınan ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Fâsit giren: umulan ${F6(X.values[0])}`;return`Fâsit tercih: mûteberler ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Fazla büyük: ${X.origin??"value"}, ${G}${X.maximum.toString()} ${V.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${X.origin??"value"}, ${G}${X.maximum.toString()} olmalıydı.`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Fazla küçük: ${X.origin}, ${G}${X.minimum.toString()} ${V.unit} sahip olmalıydı.`;return`Fazla küçük: ${X.origin}, ${G}${X.minimum.toString()} olmalıydı.`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Fâsit metin: "${G.prefix}" ile başlamalı.`;if(G.format==="ends_with")return`Fâsit metin: "${G.suffix}" ile bitmeli.`;if(G.format==="includes")return`Fâsit metin: "${G.includes}" ihtivâ etmeli.`;if(G.format==="regex")return`Fâsit metin: ${G.pattern} nakşına uymalı.`;return`Fâsit ${Y[G.format]??X.format}`}case"not_multiple_of":return`Fâsit sayı: ${X.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`${X.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${X.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};var sB0=N1(()=>{S4()});function $q1(){return{localeError:RX4()}}var RX4=()=>{let J={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"عدد";case"object":{if(Array.isArray(X))return"ارې";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(X)=>{switch(X.code){case"invalid_type":return`ناسم ورودي: باید ${X.expected} وای, مګر ${Z(X.input)} ترلاسه شو`;case"invalid_value":if(X.values.length===1)return`ناسم ورودي: باید ${F6(X.values[0])} وای`;return`ناسم انتخاب: باید یو له ${h0(X.values,"|")} څخه وای`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`ډیر لوی: ${X.origin??"ارزښت"} باید ${G}${X.maximum.toString()} ${V.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${X.origin??"ارزښت"} باید ${G}${X.maximum.toString()} وي`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`ډیر کوچنی: ${X.origin} باید ${G}${X.minimum.toString()} ${V.unit} ولري`;return`ډیر کوچنی: ${X.origin} باید ${G}${X.minimum.toString()} وي`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`ناسم متن: باید د "${G.prefix}" سره پیل شي`;if(G.format==="ends_with")return`ناسم متن: باید د "${G.suffix}" سره پای ته ورسيږي`;if(G.format==="includes")return`ناسم متن: باید "${G.includes}" ولري`;if(G.format==="regex")return`ناسم متن: باید د ${G.pattern} سره مطابقت ولري`;return`${Y[G.format]??X.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${X.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${X.keys.length>1?"کلیډونه":"کلیډ"}: ${h0(X.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${X.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${X.origin} کې`;default:return"ناسمه ورودي"}}};var tB0=N1(()=>{S4()});function Gq1(){return{localeError:CX4()}}var CX4=()=>{let J={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"liczba";case"object":{if(Array.isArray(X))return"tablica";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(X)=>{switch(X.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${X.expected}, otrzymano ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${F6(X.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Za duża wartość: oczekiwano, że ${X.origin??"wartość"} będzie mieć ${G}${X.maximum.toString()} ${V.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${X.origin??"wartość"} będzie wynosić ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Za mała wartość: oczekiwano, że ${X.origin??"wartość"} będzie mieć ${G}${X.minimum.toString()} ${V.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${X.origin??"wartość"} będzie wynosić ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${G.prefix}"`;if(G.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${G.suffix}"`;if(G.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${G.includes}"`;if(G.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${G.pattern}`;return`Nieprawidłow(y/a/e) ${Y[G.format]??X.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${X.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${X.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${X.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};var eB0=N1(()=>{S4()});function Vq1(){return{localeError:jX4()}}var jX4=()=>{let J={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"número";case"object":{if(Array.isArray(X))return"array";if(X===null)return"nulo";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(X)=>{switch(X.code){case"invalid_type":return`Tipo inválido: esperado ${X.expected}, recebido ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrada inválida: esperado ${F6(X.values[0])}`;return`Opção inválida: esperada uma das ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Muito grande: esperado que ${X.origin??"valor"} tivesse ${G}${X.maximum.toString()} ${V.unit??"elementos"}`;return`Muito grande: esperado que ${X.origin??"valor"} fosse ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Muito pequeno: esperado que ${X.origin} tivesse ${G}${X.minimum.toString()} ${V.unit}`;return`Muito pequeno: esperado que ${X.origin} fosse ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Texto inválido: deve começar com "${G.prefix}"`;if(G.format==="ends_with")return`Texto inválido: deve terminar com "${G.suffix}"`;if(G.format==="includes")return`Texto inválido: deve incluir "${G.includes}"`;if(G.format==="regex")return`Texto inválido: deve corresponder ao padrão ${G.pattern}`;return`${Y[G.format]??X.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${X.divisor}`;case"unrecognized_keys":return`Chave${X.keys.length>1?"s":""} desconhecida${X.keys.length>1?"s":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Chave inválida em ${X.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${X.origin}`;default:return"Campo inválido"}}};var JN0=N1(()=>{S4()});function QN0(J,Q,Z,Y){let X=Math.abs(J),G=X%10,V=X%100;if(V>=11&&V<=19)return Y;if(G===1)return Q;if(G>=2&&G<=4)return Z;return Y}function Kq1(){return{localeError:SX4()}}var SX4=()=>{let J={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"число";case"object":{if(Array.isArray(X))return"массив";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(X)=>{switch(X.code){case"invalid_type":return`Неверный ввод: ожидалось ${X.expected}, получено ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Неверный ввод: ожидалось ${F6(X.values[0])}`;return`Неверный вариант: ожидалось одно из ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V){let K=Number(X.maximum),q=QN0(K,V.unit.one,V.unit.few,V.unit.many);return`Слишком большое значение: ожидалось, что ${X.origin??"значение"} будет иметь ${G}${X.maximum.toString()} ${q}`}return`Слишком большое значение: ожидалось, что ${X.origin??"значение"} будет ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V){let K=Number(X.minimum),q=QN0(K,V.unit.one,V.unit.few,V.unit.many);return`Слишком маленькое значение: ожидалось, что ${X.origin} будет иметь ${G}${X.minimum.toString()} ${q}`}return`Слишком маленькое значение: ожидалось, что ${X.origin} будет ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Неверная строка: должна начинаться с "${G.prefix}"`;if(G.format==="ends_with")return`Неверная строка: должна заканчиваться на "${G.suffix}"`;if(G.format==="includes")return`Неверная строка: должна содержать "${G.includes}"`;if(G.format==="regex")return`Неверная строка: должна соответствовать шаблону ${G.pattern}`;return`Неверный ${Y[G.format]??X.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${X.divisor}`;case"unrecognized_keys":return`Нераспознанн${X.keys.length>1?"ые":"ый"} ключ${X.keys.length>1?"и":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${X.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${X.origin}`;default:return"Неверные входные данные"}}};var ZN0=N1(()=>{S4()});function qq1(){return{localeError:_X4()}}var _X4=()=>{let J={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"število";case"object":{if(Array.isArray(X))return"tabela";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(X)=>{switch(X.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${X.expected}, prejeto ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neveljaven vnos: pričakovano ${F6(X.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Preveliko: pričakovano, da bo ${X.origin??"vrednost"} imelo ${G}${X.maximum.toString()} ${V.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${X.origin??"vrednost"} ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Premajhno: pričakovano, da bo ${X.origin} imelo ${G}${X.minimum.toString()} ${V.unit}`;return`Premajhno: pričakovano, da bo ${X.origin} ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Neveljaven niz: mora se začeti z "${G.prefix}"`;if(G.format==="ends_with")return`Neveljaven niz: mora se končati z "${G.suffix}"`;if(G.format==="includes")return`Neveljaven niz: mora vsebovati "${G.includes}"`;if(G.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${G.pattern}`;return`Neveljaven ${Y[G.format]??X.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${X.divisor}`;case"unrecognized_keys":return`Neprepoznan${X.keys.length>1?"i ključi":" ključ"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${X.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${X.origin}`;default:return"Neveljaven vnos"}}};var YN0=N1(()=>{S4()});function Wq1(){return{localeError:kX4()}}var kX4=()=>{let J={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"antal";case"object":{if(Array.isArray(X))return"lista";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(X)=>{switch(X.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${X.expected}, fick ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ogiltig inmatning: förväntat ${F6(X.values[0])}`;return`Ogiltigt val: förväntade en av ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`För stor(t): förväntade ${X.origin??"värdet"} att ha ${G}${X.maximum.toString()} ${V.unit??"element"}`;return`För stor(t): förväntat ${X.origin??"värdet"} att ha ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`För lite(t): förväntade ${X.origin??"värdet"} att ha ${G}${X.minimum.toString()} ${V.unit}`;return`För lite(t): förväntade ${X.origin??"värdet"} att ha ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Ogiltig sträng: måste börja med "${G.prefix}"`;if(G.format==="ends_with")return`Ogiltig sträng: måste sluta med "${G.suffix}"`;if(G.format==="includes")return`Ogiltig sträng: måste innehålla "${G.includes}"`;if(G.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${G.pattern}"`;return`Ogiltig(t) ${Y[G.format]??X.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${h0(X.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${X.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${X.origin??"värdet"}`;default:return"Ogiltig input"}}};var XN0=N1(()=>{S4()});function Hq1(){return{localeError:yX4()}}var yX4=()=>{let J={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(X))return"அணி";if(X===null)return"வெறுமை";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${X.expected}, பெறப்பட்டது ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${F6(X.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${h0(X.values,"|")} இல் ஒன்று`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${X.origin??"மதிப்பு"} ${G}${X.maximum.toString()} ${V.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${X.origin??"மதிப்பு"} ${G}${X.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${X.origin} ${G}${X.minimum.toString()} ${V.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${X.origin} ${G}${X.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`தவறான சரம்: "${G.prefix}" இல் தொடங்க வேண்டும்`;if(G.format==="ends_with")return`தவறான சரம்: "${G.suffix}" இல் முடிவடைய வேண்டும்`;if(G.format==="includes")return`தவறான சரம்: "${G.includes}" ஐ உள்ளடக்க வேண்டும்`;if(G.format==="regex")return`தவறான சரம்: ${G.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${Y[G.format]??X.format}`}case"not_multiple_of":return`தவறான எண்: ${X.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${X.keys.length>1?"கள்":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`${X.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${X.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};var $N0=N1(()=>{S4()});function zq1(){return{localeError:xX4()}}var xX4=()=>{let J={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(X))return"อาร์เรย์ (Array)";if(X===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(X)=>{switch(X.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${X.expected} แต่ได้รับ ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${F6(X.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"ไม่เกิน":"น้อยกว่า",V=Q(X.origin);if(V)return`เกินกำหนด: ${X.origin??"ค่า"} ควรมี${G} ${X.maximum.toString()} ${V.unit??"รายการ"}`;return`เกินกำหนด: ${X.origin??"ค่า"} ควรมี${G} ${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?"อย่างน้อย":"มากกว่า",V=Q(X.origin);if(V)return`น้อยกว่ากำหนด: ${X.origin} ควรมี${G} ${X.minimum.toString()} ${V.unit}`;return`น้อยกว่ากำหนด: ${X.origin} ควรมี${G} ${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${G.prefix}"`;if(G.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${G.suffix}"`;if(G.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${G.includes}" อยู่ในข้อความ`;if(G.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${G.pattern}`;return`รูปแบบไม่ถูกต้อง: ${Y[G.format]??X.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${X.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${h0(X.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${X.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${X.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};var GN0=N1(()=>{S4()});function Fq1(){return{localeError:fX4()}}var vX4=(J)=>{let Q=typeof J;switch(Q){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return Q},fX4=()=>{let J={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function Q(Y){return J[Y]??null}let Z={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(Y)=>{switch(Y.code){case"invalid_type":return`Geçersiz değer: beklenen ${Y.expected}, alınan ${vX4(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Geçersiz değer: beklenen ${F6(Y.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${h0(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",G=Q(Y.origin);if(G)return`Çok büyük: beklenen ${Y.origin??"değer"} ${X}${Y.maximum.toString()} ${G.unit??"öğe"}`;return`Çok büyük: beklenen ${Y.origin??"değer"} ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",G=Q(Y.origin);if(G)return`Çok küçük: beklenen ${Y.origin} ${X}${Y.minimum.toString()} ${G.unit}`;return`Çok küçük: beklenen ${Y.origin} ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Geçersiz metin: "${X.prefix}" ile başlamalı`;if(X.format==="ends_with")return`Geçersiz metin: "${X.suffix}" ile bitmeli`;if(X.format==="includes")return`Geçersiz metin: "${X.includes}" içermeli`;if(X.format==="regex")return`Geçersiz metin: ${X.pattern} desenine uymalı`;return`Geçersiz ${Z[X.format]??Y.format}`}case"not_multiple_of":return`Geçersiz sayı: ${Y.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${Y.keys.length>1?"lar":""}: ${h0(Y.keys,", ")}`;case"invalid_key":return`${Y.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${Y.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};var VN0=N1(()=>{S4()});function Ak(){return{localeError:hX4()}}var hX4=()=>{let J={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"число";case"object":{if(Array.isArray(X))return"масив";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(X)=>{switch(X.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${X.expected}, отримано ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Неправильні вхідні дані: очікується ${F6(X.values[0])}`;return`Неправильна опція: очікується одне з ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Занадто велике: очікується, що ${X.origin??"значення"} ${V.verb} ${G}${X.maximum.toString()} ${V.unit??"елементів"}`;return`Занадто велике: очікується, що ${X.origin??"значення"} буде ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Занадто мале: очікується, що ${X.origin} ${V.verb} ${G}${X.minimum.toString()} ${V.unit}`;return`Занадто мале: очікується, що ${X.origin} буде ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Неправильний рядок: повинен починатися з "${G.prefix}"`;if(G.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${G.suffix}"`;if(G.format==="includes")return`Неправильний рядок: повинен містити "${G.includes}"`;if(G.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${G.pattern}`;return`Неправильний ${Y[G.format]??X.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${X.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${X.keys.length>1?"і":""}: ${h0(X.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${X.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${X.origin}`;default:return"Неправильні вхідні дані"}}};var Uq1=N1(()=>{S4()});function Bq1(){return Ak()}var KN0=N1(()=>{Uq1()});function Nq1(){return{localeError:bX4()}}var bX4=()=>{let J={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"نمبر";case"object":{if(Array.isArray(X))return"آرے";if(X===null)return"نل";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(X)=>{switch(X.code){case"invalid_type":return`غلط ان پٹ: ${X.expected} متوقع تھا، ${Z(X.input)} موصول ہوا`;case"invalid_value":if(X.values.length===1)return`غلط ان پٹ: ${F6(X.values[0])} متوقع تھا`;return`غلط آپشن: ${h0(X.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`بہت بڑا: ${X.origin??"ویلیو"} کے ${G}${X.maximum.toString()} ${V.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${X.origin??"ویلیو"} کا ${G}${X.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`بہت چھوٹا: ${X.origin} کے ${G}${X.minimum.toString()} ${V.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${X.origin} کا ${G}${X.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`غلط سٹرنگ: "${G.prefix}" سے شروع ہونا چاہیے`;if(G.format==="ends_with")return`غلط سٹرنگ: "${G.suffix}" پر ختم ہونا چاہیے`;if(G.format==="includes")return`غلط سٹرنگ: "${G.includes}" شامل ہونا چاہیے`;if(G.format==="regex")return`غلط سٹرنگ: پیٹرن ${G.pattern} سے میچ ہونا چاہیے`;return`غلط ${Y[G.format]??X.format}`}case"not_multiple_of":return`غلط نمبر: ${X.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${X.keys.length>1?"ز":""}: ${h0(X.keys,"، ")}`;case"invalid_key":return`${X.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${X.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};var qN0=N1(()=>{S4()});function Dq1(){return{localeError:gX4()}}var gX4=()=>{let J={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"số";case"object":{if(Array.isArray(X))return"mảng";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(X)=>{switch(X.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${X.expected}, nhận được ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${F6(X.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Quá lớn: mong đợi ${X.origin??"giá trị"} ${V.verb} ${G}${X.maximum.toString()} ${V.unit??"phần tử"}`;return`Quá lớn: mong đợi ${X.origin??"giá trị"} ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Quá nhỏ: mong đợi ${X.origin} ${V.verb} ${G}${X.minimum.toString()} ${V.unit}`;return`Quá nhỏ: mong đợi ${X.origin} ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${G.prefix}"`;if(G.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${G.suffix}"`;if(G.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${G.includes}"`;if(G.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${G.pattern}`;return`${Y[G.format]??X.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${X.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${h0(X.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${X.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${X.origin}`;default:return"Đầu vào không hợp lệ"}}};var WN0=N1(()=>{S4()});function Mq1(){return{localeError:mX4()}}var mX4=()=>{let J={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(X))return"数组";if(X===null)return"空值(null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(X)=>{switch(X.code){case"invalid_type":return`无效输入:期望 ${X.expected},实际接收 ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`无效输入:期望 ${F6(X.values[0])}`;return`无效选项:期望以下之一 ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`数值过大:期望 ${X.origin??"值"} ${G}${X.maximum.toString()} ${V.unit??"个元素"}`;return`数值过大:期望 ${X.origin??"值"} ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`数值过小:期望 ${X.origin} ${G}${X.minimum.toString()} ${V.unit}`;return`数值过小:期望 ${X.origin} ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`无效字符串:必须以 "${G.prefix}" 开头`;if(G.format==="ends_with")return`无效字符串:必须以 "${G.suffix}" 结尾`;if(G.format==="includes")return`无效字符串:必须包含 "${G.includes}"`;if(G.format==="regex")return`无效字符串:必须满足正则表达式 ${G.pattern}`;return`无效${Y[G.format]??X.format}`}case"not_multiple_of":return`无效数字:必须是 ${X.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${h0(X.keys,", ")}`;case"invalid_key":return`${X.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${X.origin} 中包含无效值(value)`;default:return"无效输入"}}};var HN0=N1(()=>{S4()});function Lq1(){return{localeError:uX4()}}var uX4=()=>{let J={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(X)=>{switch(X.code){case"invalid_type":return`無效的輸入值:預期為 ${X.expected},但收到 ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`無效的輸入值:預期為 ${F6(X.values[0])}`;return`無效的選項:預期為以下其中之一 ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`數值過大:預期 ${X.origin??"值"} 應為 ${G}${X.maximum.toString()} ${V.unit??"個元素"}`;return`數值過大:預期 ${X.origin??"值"} 應為 ${G}${X.maximum.toString()}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`數值過小:預期 ${X.origin} 應為 ${G}${X.minimum.toString()} ${V.unit}`;return`數值過小:預期 ${X.origin} 應為 ${G}${X.minimum.toString()}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`無效的字串:必須以 "${G.prefix}" 開頭`;if(G.format==="ends_with")return`無效的字串:必須以 "${G.suffix}" 結尾`;if(G.format==="includes")return`無效的字串:必須包含 "${G.includes}"`;if(G.format==="regex")return`無效的字串:必須符合格式 ${G.pattern}`;return`無效的 ${Y[G.format]??X.format}`}case"not_multiple_of":return`無效的數字:必須為 ${X.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${X.keys.length>1?"們":""}:${h0(X.keys,"、")}`;case"invalid_key":return`${X.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${X.origin} 中有無效的值`;default:return"無效的輸入值"}}};var zN0=N1(()=>{S4()});function Aq1(){return{localeError:pX4()}}var pX4=()=>{let J={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function Q(X){return J[X]??null}let Z=(X)=>{let G=typeof X;switch(G){case"number":return Number.isNaN(X)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(X))return"akopọ";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return G},Y={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(X)=>{switch(X.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${X.expected}, àmọ̀ a rí ${Z(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${F6(X.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${h0(X.values,"|")}`;case"too_big":{let G=X.inclusive?"<=":"<",V=Q(X.origin);if(V)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${X.origin??"iye"} ${V.verb} ${G}${X.maximum} ${V.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${G}${X.maximum}`}case"too_small":{let G=X.inclusive?">=":">",V=Q(X.origin);if(V)return`Kéré ju: a ní láti jẹ́ pé ${X.origin} ${V.verb} ${G}${X.minimum} ${V.unit}`;return`Kéré ju: a ní láti jẹ́ ${G}${X.minimum}`}case"invalid_format":{let G=X;if(G.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${G.prefix}"`;if(G.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${G.suffix}"`;if(G.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${G.includes}"`;if(G.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${G.pattern}`;return`Aṣìṣe: ${Y[G.format]??X.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${X.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${h0(X.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${X.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${X.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};var FN0=N1(()=>{S4()});var Ok={};Q9(Ok,{zhTW:()=>Lq1,zhCN:()=>Mq1,yo:()=>Aq1,vi:()=>Dq1,ur:()=>Nq1,uk:()=>Ak,ua:()=>Bq1,tr:()=>Fq1,th:()=>zq1,ta:()=>Hq1,sv:()=>Wq1,sl:()=>qq1,ru:()=>Kq1,pt:()=>Vq1,ps:()=>$q1,pl:()=>Gq1,ota:()=>Xq1,no:()=>Yq1,nl:()=>Zq1,ms:()=>Qq1,mk:()=>Jq1,lt:()=>eK1,ko:()=>tK1,km:()=>Dk,kh:()=>sK1,ka:()=>oK1,ja:()=>aK1,it:()=>nK1,is:()=>iK1,id:()=>lK1,hu:()=>cK1,he:()=>dK1,frCA:()=>pK1,fr:()=>uK1,fi:()=>mK1,fa:()=>gK1,es:()=>bK1,eo:()=>hK1,en:()=>Nk,de:()=>vK1,da:()=>xK1,cs:()=>yK1,ca:()=>kK1,bg:()=>_K1,be:()=>SK1,az:()=>jK1,ar:()=>CK1});var Oq1=N1(()=>{OB0();wB0();IB0();PB0();TB0();RB0();CB0();jB0();fK1();SB0();_B0();kB0();yB0();xB0();vB0();fB0();hB0();bB0();gB0();mB0();uB0();pB0();dB0();rK1();cB0();iB0();nB0();aB0();oB0();rB0();sB0();tB0();eB0();JN0();ZN0();YN0();XN0();$N0();GN0();VN0();KN0();Uq1();qN0();WN0();HN0();zN0();FN0()});class wk{constructor(){this._map=new WeakMap,this._idmap=new Map}add(J,...Q){let Z=Q[0];if(this._map.set(J,Z),Z&&typeof Z==="object"&&"id"in Z){if(this._idmap.has(Z.id))throw Error(`ID ${Z.id} already exists in the registry`);this._idmap.set(Z.id,J)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(J){let Q=this._map.get(J);if(Q&&typeof Q==="object"&&"id"in Q)this._idmap.delete(Q.id);return this._map.delete(J),this}get(J){let Q=J._zod.parent;if(Q){let Z={...this.get(Q)??{}};delete Z.id;let Y={...Z,...this._map.get(J)};return Object.keys(Y).length?Y:void 0}return this._map.get(J)}has(J){return this._map.has(J)}}function Ni(){return new wk}var UN0,wq1,Eq1,NQ;var Di=N1(()=>{wq1=Symbol("ZodOutput"),Eq1=Symbol("ZodInput");(UN0=globalThis).__zod_globalRegistry??(UN0.__zod_globalRegistry=Ni());NQ=globalThis.__zod_globalRegistry});function Iq1(J,Q){return new J({type:"string",...B6(Q)})}function Pq1(J,Q){return new J({type:"string",coerce:!0,...B6(Q)})}function Mi(J,Q){return new J({type:"string",format:"email",check:"string_format",abort:!1,...B6(Q)})}function Ek(J,Q){return new J({type:"string",format:"guid",check:"string_format",abort:!1,...B6(Q)})}function Li(J,Q){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,...B6(Q)})}function Ai(J,Q){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B6(Q)})}function Oi(J,Q){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B6(Q)})}function wi(J,Q){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B6(Q)})}function Ik(J,Q){return new J({type:"string",format:"url",check:"string_format",abort:!1,...B6(Q)})}function Ei(J,Q){return new J({type:"string",format:"emoji",check:"string_format",abort:!1,...B6(Q)})}function Ii(J,Q){return new J({type:"string",format:"nanoid",check:"string_format",abort:!1,...B6(Q)})}function Pi(J,Q){return new J({type:"string",format:"cuid",check:"string_format",abort:!1,...B6(Q)})}function Ti(J,Q){return new J({type:"string",format:"cuid2",check:"string_format",abort:!1,...B6(Q)})}function Ri(J,Q){return new J({type:"string",format:"ulid",check:"string_format",abort:!1,...B6(Q)})}function Ci(J,Q){return new J({type:"string",format:"xid",check:"string_format",abort:!1,...B6(Q)})}function ji(J,Q){return new J({type:"string",format:"ksuid",check:"string_format",abort:!1,...B6(Q)})}function Si(J,Q){return new J({type:"string",format:"ipv4",check:"string_format",abort:!1,...B6(Q)})}function _i(J,Q){return new J({type:"string",format:"ipv6",check:"string_format",abort:!1,...B6(Q)})}function Tq1(J,Q){return new J({type:"string",format:"mac",check:"string_format",abort:!1,...B6(Q)})}function ki(J,Q){return new J({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B6(Q)})}function yi(J,Q){return new J({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B6(Q)})}function xi(J,Q){return new J({type:"string",format:"base64",check:"string_format",abort:!1,...B6(Q)})}function vi(J,Q){return new J({type:"string",format:"base64url",check:"string_format",abort:!1,...B6(Q)})}function fi(J,Q){return new J({type:"string",format:"e164",check:"string_format",abort:!1,...B6(Q)})}function hi(J,Q){return new J({type:"string",format:"jwt",check:"string_format",abort:!1,...B6(Q)})}function Cq1(J,Q){return new J({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B6(Q)})}function jq1(J,Q){return new J({type:"string",format:"date",check:"string_format",...B6(Q)})}function Sq1(J,Q){return new J({type:"string",format:"time",check:"string_format",precision:null,...B6(Q)})}function _q1(J,Q){return new J({type:"string",format:"duration",check:"string_format",...B6(Q)})}function kq1(J,Q){return new J({type:"number",checks:[],...B6(Q)})}function yq1(J,Q){return new J({type:"number",coerce:!0,checks:[],...B6(Q)})}function xq1(J,Q){return new J({type:"number",check:"number_format",abort:!1,format:"safeint",...B6(Q)})}function vq1(J,Q){return new J({type:"number",check:"number_format",abort:!1,format:"float32",...B6(Q)})}function fq1(J,Q){return new J({type:"number",check:"number_format",abort:!1,format:"float64",...B6(Q)})}function hq1(J,Q){return new J({type:"number",check:"number_format",abort:!1,format:"int32",...B6(Q)})}function bq1(J,Q){return new J({type:"number",check:"number_format",abort:!1,format:"uint32",...B6(Q)})}function gq1(J,Q){return new J({type:"boolean",...B6(Q)})}function mq1(J,Q){return new J({type:"boolean",coerce:!0,...B6(Q)})}function uq1(J,Q){return new J({type:"bigint",...B6(Q)})}function pq1(J,Q){return new J({type:"bigint",coerce:!0,...B6(Q)})}function dq1(J,Q){return new J({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...B6(Q)})}function cq1(J,Q){return new J({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...B6(Q)})}function lq1(J,Q){return new J({type:"symbol",...B6(Q)})}function iq1(J,Q){return new J({type:"undefined",...B6(Q)})}function nq1(J,Q){return new J({type:"null",...B6(Q)})}function aq1(J){return new J({type:"any"})}function oq1(J){return new J({type:"unknown"})}function rq1(J,Q){return new J({type:"never",...B6(Q)})}function sq1(J,Q){return new J({type:"void",...B6(Q)})}function tq1(J,Q){return new J({type:"date",...B6(Q)})}function eq1(J,Q){return new J({type:"date",coerce:!0,...B6(Q)})}function JW1(J,Q){return new J({type:"nan",...B6(Q)})}function jW(J,Q){return new Yi({check:"less_than",...B6(Q),value:J,inclusive:!1})}function jX(J,Q){return new Yi({check:"less_than",...B6(Q),value:J,inclusive:!0})}function SW(J,Q){return new Xi({check:"greater_than",...B6(Q),value:J,inclusive:!1})}function KZ(J,Q){return new Xi({check:"greater_than",...B6(Q),value:J,inclusive:!0})}function QW1(J){return SW(0,J)}function ZW1(J){return jW(0,J)}function YW1(J){return jX(0,J)}function XW1(J){return KZ(0,J)}function hD(J,Q){return new tG1({check:"multiple_of",...B6(Q),value:J})}function ME(J,Q){return new QV1({check:"max_size",...B6(Q),maximum:J})}function bD(J,Q){return new ZV1({check:"min_size",...B6(Q),minimum:J})}function Pk(J,Q){return new YV1({check:"size_equals",...B6(Q),size:J})}function LE(J,Q){return new XV1({check:"max_length",...B6(Q),maximum:J})}function wF(J,Q){return new $V1({check:"min_length",...B6(Q),minimum:J})}function AE(J,Q){return new GV1({check:"length_equals",...B6(Q),length:J})}function Tk(J,Q){return new VV1({check:"string_format",format:"regex",...B6(Q),pattern:J})}function Rk(J){return new KV1({check:"string_format",format:"lowercase",...B6(J)})}function Ck(J){return new qV1({check:"string_format",format:"uppercase",...B6(J)})}function jk(J,Q){return new WV1({check:"string_format",format:"includes",...B6(Q),includes:J})}function Sk(J,Q){return new HV1({check:"string_format",format:"starts_with",...B6(Q),prefix:J})}function _k(J,Q){return new zV1({check:"string_format",format:"ends_with",...B6(Q),suffix:J})}function $W1(J,Q,Z){return new FV1({check:"property",property:J,schema:Q,...B6(Z)})}function kk(J,Q){return new UV1({check:"mime_type",mime:J,...B6(Q)})}function FK(J){return new BV1({check:"overwrite",tx:J})}function yk(J){return FK((Q)=>Q.normalize(J))}function xk(){return FK((J)=>J.trim())}function vk(){return FK((J)=>J.toLowerCase())}function fk(){return FK((J)=>J.toUpperCase())}function hk(){return FK((J)=>zG1(J))}function GW1(J,Q,Z){return new J({type:"array",element:Q,...B6(Z)})}function cX4(J,Q,Z){return new J({type:"union",options:Q,...B6(Z)})}function lX4(J,Q,Z,Y){return new J({type:"union",options:Z,discriminator:Q,...B6(Y)})}function iX4(J,Q,Z){return new J({type:"intersection",left:Q,right:Z})}function nX4(J,Q,Z,Y){let X=Z instanceof X8;return new J({type:"tuple",items:Q,rest:X?Z:null,...B6(X?Y:Z)})}function aX4(J,Q,Z,Y){return new J({type:"record",keyType:Q,valueType:Z,...B6(Y)})}function oX4(J,Q,Z,Y){return new J({type:"map",keyType:Q,valueType:Z,...B6(Y)})}function rX4(J,Q,Z){return new J({type:"set",valueType:Q,...B6(Z)})}function sX4(J,Q,Z){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((X)=>[X,X])):Q;return new J({type:"enum",entries:Y,...B6(Z)})}function tX4(J,Q,Z){return new J({type:"enum",entries:Q,...B6(Z)})}function eX4(J,Q,Z){return new J({type:"literal",values:Array.isArray(Q)?Q:[Q],...B6(Z)})}function VW1(J,Q){return new J({type:"file",...B6(Q)})}function J$4(J,Q){return new J({type:"transform",transform:Q})}function Q$4(J,Q){return new J({type:"optional",innerType:Q})}function Z$4(J,Q){return new J({type:"nullable",innerType:Q})}function Y$4(J,Q,Z){return new J({type:"default",innerType:Q,get defaultValue(){return typeof Z==="function"?Z():UG1(Z)}})}function X$4(J,Q,Z){return new J({type:"nonoptional",innerType:Q,...B6(Z)})}function $$4(J,Q){return new J({type:"success",innerType:Q})}function G$4(J,Q,Z){return new J({type:"catch",innerType:Q,catchValue:typeof Z==="function"?Z:()=>Z})}function V$4(J,Q,Z){return new J({type:"pipe",in:Q,out:Z})}function K$4(J,Q){return new J({type:"readonly",innerType:Q})}function q$4(J,Q,Z){return new J({type:"template_literal",parts:Q,...B6(Z)})}function W$4(J,Q){return new J({type:"lazy",getter:Q})}function H$4(J,Q){return new J({type:"promise",innerType:Q})}function KW1(J,Q,Z){let Y=B6(Z);return Y.abort??(Y.abort=!0),new J({type:"custom",check:"custom",fn:Q,...Y})}function qW1(J,Q,Z){return new J({type:"custom",check:"custom",fn:Q,...B6(Z)})}function WW1(J){let Q=BN0((Z)=>{return Z.addIssue=(Y)=>{if(typeof Y==="string")Z.issues.push(HE(Y,Z.value,Q._zod.def));else{let X=Y;if(X.fatal)X.continue=!1;X.code??(X.code="custom"),X.input??(X.input=Z.value),X.inst??(X.inst=Q),X.continue??(X.continue=!Q._zod.def.abort),Z.issues.push(HE(X))}},J(Z.value,Z)});return Q}function BN0(J,Q){let Z=new w5({check:"custom",...B6(Q)});return Z._zod.check=J,Z}function HW1(J){let Q=new w5({check:"describe"});return Q._zod.onattach=[(Z)=>{let Y=NQ.get(Z)??{};NQ.add(Z,{...Y,description:J})}],Q._zod.check=()=>{},Q}function zW1(J){let Q=new w5({check:"meta"});return Q._zod.onattach=[(Z)=>{let Y=NQ.get(Z)??{};NQ.add(Z,{...Y,...J})}],Q._zod.check=()=>{},Q}function FW1(J,Q){let Z=B6(Q),Y=Z.truthy??["true","1","yes","on","y","enabled"],X=Z.falsy??["false","0","no","off","n","disabled"];if(Z.case!=="sensitive")Y=Y.map((D)=>typeof D==="string"?D.toLowerCase():D),X=X.map((D)=>typeof D==="string"?D.toLowerCase():D);let G=new Set(Y),V=new Set(X),K=J.Codec??Bk,q=J.Boolean??Uk,H=new(J.String??fD)({type:"string",error:Z.error}),z=new q({type:"boolean",error:Z.error}),U=new K({type:"pipe",in:H,out:z,transform:(D,M)=>{let L=D;if(Z.case!=="sensitive")L=L.toLowerCase();if(G.has(L))return!0;else if(V.has(L))return!1;else return M.issues.push({code:"invalid_value",expected:"stringbool",values:[...G,...V],input:M.value,inst:U,continue:!1}),{}},reverseTransform:(D,M)=>{if(D===!0)return Y[0]||"true";else return X[0]||"false"},error:Z.error});return U}function OE(J,Q,Z,Y={}){let X=B6(Y),G={...B6(Y),check:"string_format",type:"string",format:Q,fn:typeof Z==="function"?Z:(K)=>Z.test(K),...X};if(Z instanceof RegExp)G.pattern=Z;return new J(G)}var Rq1;var NN0=N1(()=>{$i();Di();RK1();S4();Rq1={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});class bi{constructor(J){this.counter=0,this.metadataRegistry=J?.metadata??NQ,this.target=J?.target??"draft-2020-12",this.unrepresentable=J?.unrepresentable??"throw",this.override=J?.override??(()=>{}),this.io=J?.io??"output",this.seen=new Map}process(J,Q={path:[],schemaPath:[]}){var Z;let Y=J._zod.def,X={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G=this.seen.get(J);if(G){if(G.count++,Q.schemaPath.includes(J))G.cycle=Q.path;return G.schema}let V={schema:{},count:1,cycle:void 0,path:Q.path};this.seen.set(J,V);let K=J._zod.toJSONSchema?.();if(K)V.schema=K;else{let H={...Q,schemaPath:[...Q.schemaPath,J],path:Q.path},z=J._zod.parent;if(z)V.ref=z,this.process(z,H),this.seen.get(z).isParent=!0;else{let U=V.schema;switch(Y.type){case"string":{let D=U;D.type="string";let{minimum:M,maximum:L,format:A,patterns:E,contentEncoding:I}=J._zod.bag;if(typeof M==="number")D.minLength=M;if(typeof L==="number")D.maxLength=L;if(A){if(D.format=X[A]??A,D.format==="")delete D.format}if(I)D.contentEncoding=I;if(E&&E.size>0){let P=[...E];if(P.length===1)D.pattern=P[0].source;else if(P.length>1)V.schema.allOf=[...P.map((C)=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:C.source}))]}break}case"number":{let D=U,{minimum:M,maximum:L,format:A,multipleOf:E,exclusiveMaximum:I,exclusiveMinimum:P}=J._zod.bag;if(typeof A==="string"&&A.includes("int"))D.type="integer";else D.type="number";if(typeof P==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")D.minimum=P,D.exclusiveMinimum=!0;else D.exclusiveMinimum=P;if(typeof M==="number"){if(D.minimum=M,typeof P==="number"&&this.target!=="draft-4")if(P>=M)delete D.minimum;else delete D.exclusiveMinimum}if(typeof I==="number")if(this.target==="draft-4"||this.target==="openapi-3.0")D.maximum=I,D.exclusiveMaximum=!0;else D.exclusiveMaximum=I;if(typeof L==="number"){if(D.maximum=L,typeof I==="number"&&this.target!=="draft-4")if(I<=L)delete D.maximum;else delete D.exclusiveMaximum}if(typeof E==="number")D.multipleOf=E;break}case"boolean":{let D=U;D.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{if(this.target==="openapi-3.0")U.type="string",U.nullable=!0,U.enum=[null];else U.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{U.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let D=U,{minimum:M,maximum:L}=J._zod.bag;if(typeof M==="number")D.minItems=M;if(typeof L==="number")D.maxItems=L;D.type="array",D.items=this.process(Y.element,{...H,path:[...H.path,"items"]});break}case"object":{let D=U;D.type="object",D.properties={};let M=Y.shape;for(let E in M)D.properties[E]=this.process(M[E],{...H,path:[...H.path,"properties",E]});let L=new Set(Object.keys(M)),A=new Set([...L].filter((E)=>{let I=Y.shape[E]._zod;if(this.io==="input")return I.optin===void 0;else return I.optout===void 0}));if(A.size>0)D.required=Array.from(A);if(Y.catchall?._zod.def.type==="never")D.additionalProperties=!1;else if(!Y.catchall){if(this.io==="output")D.additionalProperties=!1}else if(Y.catchall)D.additionalProperties=this.process(Y.catchall,{...H,path:[...H.path,"additionalProperties"]});break}case"union":{let D=U,M=Y.discriminator!==void 0,L=Y.options.map((A,E)=>this.process(A,{...H,path:[...H.path,M?"oneOf":"anyOf",E]}));if(M)D.oneOf=L;else D.anyOf=L;break}case"intersection":{let D=U,M=this.process(Y.left,{...H,path:[...H.path,"allOf",0]}),L=this.process(Y.right,{...H,path:[...H.path,"allOf",1]}),A=(I)=>("allOf"in I)&&Object.keys(I).length===1,E=[...A(M)?M.allOf:[M],...A(L)?L.allOf:[L]];D.allOf=E;break}case"tuple":{let D=U;D.type="array";let M=this.target==="draft-2020-12"?"prefixItems":"items",L=this.target==="draft-2020-12"?"items":this.target==="openapi-3.0"?"items":"additionalItems",A=Y.items.map((C,k)=>this.process(C,{...H,path:[...H.path,M,k]})),E=Y.rest?this.process(Y.rest,{...H,path:[...H.path,L,...this.target==="openapi-3.0"?[Y.items.length]:[]]}):null;if(this.target==="draft-2020-12"){if(D.prefixItems=A,E)D.items=E}else if(this.target==="openapi-3.0"){if(D.items={anyOf:A},E)D.items.anyOf.push(E);if(D.minItems=A.length,!E)D.maxItems=A.length}else if(D.items=A,E)D.additionalItems=E;let{minimum:I,maximum:P}=J._zod.bag;if(typeof I==="number")D.minItems=I;if(typeof P==="number")D.maxItems=P;break}case"record":{let D=U;if(D.type="object",this.target==="draft-7"||this.target==="draft-2020-12")D.propertyNames=this.process(Y.keyType,{...H,path:[...H.path,"propertyNames"]});D.additionalProperties=this.process(Y.valueType,{...H,path:[...H.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let D=U,M=Qk(Y.entries);if(M.every((L)=>typeof L==="number"))D.type="number";if(M.every((L)=>typeof L==="string"))D.type="string";D.enum=M;break}case"literal":{let D=U,M=[];for(let L of Y.values)if(L===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof L==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else M.push(Number(L));else M.push(L);if(M.length===0);else if(M.length===1){let L=M[0];if(D.type=L===null?"null":typeof L,this.target==="draft-4"||this.target==="openapi-3.0")D.enum=[L];else D.const=L}else{if(M.every((L)=>typeof L==="number"))D.type="number";if(M.every((L)=>typeof L==="string"))D.type="string";if(M.every((L)=>typeof L==="boolean"))D.type="string";if(M.every((L)=>L===null))D.type="null";D.enum=M}break}case"file":{let D=U,M={type:"string",format:"binary",contentEncoding:"binary"},{minimum:L,maximum:A,mime:E}=J._zod.bag;if(L!==void 0)M.minLength=L;if(A!==void 0)M.maxLength=A;if(E)if(E.length===1)M.contentMediaType=E[0],Object.assign(D,M);else D.anyOf=E.map((I)=>{return{...M,contentMediaType:I}});else Object.assign(D,M);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let D=this.process(Y.innerType,H);if(this.target==="openapi-3.0")V.ref=Y.innerType,U.nullable=!0;else U.anyOf=[D,{type:"null"}];break}case"nonoptional":{this.process(Y.innerType,H),V.ref=Y.innerType;break}case"success":{let D=U;D.type="boolean";break}case"default":{this.process(Y.innerType,H),V.ref=Y.innerType,U.default=JSON.parse(JSON.stringify(Y.defaultValue));break}case"prefault":{if(this.process(Y.innerType,H),V.ref=Y.innerType,this.io==="input")U._prefault=JSON.parse(JSON.stringify(Y.defaultValue));break}case"catch":{this.process(Y.innerType,H),V.ref=Y.innerType;let D;try{D=Y.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}U.default=D;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let D=U,M=J._zod.pattern;if(!M)throw Error("Pattern not found in template literal");D.type="string",D.pattern=M.source;break}case"pipe":{let D=this.io==="input"?Y.in._zod.def.type==="transform"?Y.out:Y.in:Y.out;this.process(D,H),V.ref=D;break}case"readonly":{this.process(Y.innerType,H),V.ref=Y.innerType,U.readOnly=!0;break}case"promise":{this.process(Y.innerType,H),V.ref=Y.innerType;break}case"optional":{this.process(Y.innerType,H),V.ref=Y.innerType;break}case"lazy":{let D=J._zod.innerType;this.process(D,H),V.ref=D;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema");break}default:}}}let q=this.metadataRegistry.get(J);if(q)Object.assign(V.schema,q);if(this.io==="input"&&DQ(J))delete V.schema.examples,delete V.schema.default;if(this.io==="input"&&V.schema._prefault)(Z=V.schema).default??(Z.default=V.schema._prefault);return delete V.schema._prefault,this.seen.get(J).schema}emit(J,Q){let Z={cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0},Y=this.seen.get(J);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let X=(W)=>{let H=this.target==="draft-2020-12"?"$defs":"definitions";if(Z.external){let M=Z.external.registry.get(W[0])?.id,L=Z.external.uri??((E)=>E);if(M)return{ref:L(M)};let A=W[1].defId??W[1].schema.id??`schema${this.counter++}`;return W[1].defId=A,{defId:A,ref:`${L("__shared")}#/${H}/${A}`}}if(W[1]===Y)return{ref:"#"};let U=`${"#"}/${H}/`,D=W[1].schema.id??`__schema${this.counter++}`;return{defId:D,ref:U+D}},G=(W)=>{if(W[1].schema.$ref)return;let H=W[1],{ref:z,defId:U}=X(W);if(H.def={...H.schema},U)H.defId=U;let D=H.schema;for(let M in D)delete D[M];D.$ref=z};if(Z.cycles==="throw")for(let W of this.seen.entries()){let H=W[1];if(H.cycle)throw Error(`Cycle detected: #/${H.cycle?.join("/")}/<root>
69
69
 
70
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let W of this.seen.entries()){let H=W[1];if(J===W[0]){G(W);continue}if(Z.external){let U=Z.external.registry.get(W[0])?.id;if(J!==W[0]&&U){G(W);continue}}if(this.metadataRegistry.get(W[0])?.id){G(W);continue}if(H.cycle){G(W);continue}if(H.count>1){if(Z.reused==="ref"){G(W);continue}}}let V=(W,H)=>{let z=this.seen.get(W),U=z.def??z.schema,D={...U};if(z.ref===null)return;let M=z.ref;if(z.ref=null,M){V(M,H);let L=this.seen.get(M).schema;if(L.$ref&&(H.target==="draft-7"||H.target==="draft-4"||H.target==="openapi-3.0"))U.allOf=U.allOf??[],U.allOf.push(L);else Object.assign(U,L),Object.assign(U,D)}if(!z.isParent)this.override({zodSchema:W,jsonSchema:U,path:z.path??[]})};for(let W of[...this.seen.entries()].reverse())V(W[0],{target:this.target});let K={};if(this.target==="draft-2020-12")K.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")K.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")K.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(Z.external?.uri){let W=Z.external.registry.get(J)?.id;if(!W)throw Error("Schema is missing an `id` property");K.$id=Z.external.uri(W)}Object.assign(K,Y.def);let q=Z.external?.defs??{};for(let W of this.seen.entries()){let H=W[1];if(H.def&&H.defId)q[H.defId]=H.def}if(Z.external);else if(Object.keys(q).length>0)if(this.target==="draft-2020-12")K.$defs=q;else K.definitions=q;try{return JSON.parse(JSON.stringify(K))}catch(W){throw Error("Error converting schema to JSON.")}}}function UW1(J,Q){if(J instanceof wk){let Y=new bi(Q),X={};for(let K of J._idmap.entries()){let[q,W]=K;Y.process(W)}let G={},V={registry:J,uri:Q?.uri,defs:X};for(let K of J._idmap.entries()){let[q,W]=K;G[q]=Y.emit(W,{...Q,external:V})}if(Object.keys(X).length>0){let K=Y.target==="draft-2020-12"?"$defs":"definitions";G.__shared={[K]:X}}return{schemas:G}}let Z=new bi(Q);return Z.process(J),Z.emit(J,Q)}function DQ(J,Q){let Z=Q??{seen:new Set};if(Z.seen.has(J))return!1;Z.seen.add(J);let Y=J._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return DQ(Y.element,Z);if(Y.type==="set")return DQ(Y.valueType,Z);if(Y.type==="lazy")return DQ(Y.getter(),Z);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return DQ(Y.innerType,Z);if(Y.type==="intersection")return DQ(Y.left,Z)||DQ(Y.right,Z);if(Y.type==="record"||Y.type==="map")return DQ(Y.keyType,Z)||DQ(Y.valueType,Z);if(Y.type==="pipe")return DQ(Y.in,Z)||DQ(Y.out,Z);if(Y.type==="object"){for(let X in Y.shape)if(DQ(Y.shape[X],Z))return!0;return!1}if(Y.type==="union"){for(let X of Y.options)if(DQ(X,Z))return!0;return!1}if(Y.type==="tuple"){for(let X of Y.items)if(DQ(X,Z))return!0;if(Y.rest&&DQ(Y.rest,Z))return!0;return!1}return!1}var DN0=N1(()=>{Di();S4()});var MN0={};var LN0=()=>{};var _W={};Q9(_W,{version:()=>NV1,util:()=>N6,treeifyError:()=>LG1,toJSONSchema:()=>UW1,toDotPath:()=>lU0,safeParseAsync:()=>Hk,safeParse:()=>BE,safeEncodeAsync:()=>tU0,safeEncode:()=>rU0,safeDecodeAsync:()=>eU0,safeDecode:()=>sU0,registry:()=>Ni,regexes:()=>CX,prettifyError:()=>AG1,parseAsync:()=>Wk,parse:()=>qk,meta:()=>zW1,locales:()=>Ok,isValidJWT:()=>DB0,isValidBase64URL:()=>NB0,isValidBase64:()=>gV1,globalRegistry:()=>NQ,globalConfig:()=>t_,formatError:()=>Kk,flattenError:()=>Vk,encodeAsync:()=>aU0,encode:()=>iU0,describe:()=>HW1,decodeAsync:()=>oU0,decode:()=>nU0,config:()=>I3,clone:()=>BQ,_xid:()=>Ci,_void:()=>sq1,_uuidv7:()=>wi,_uuidv6:()=>Oi,_uuidv4:()=>Ai,_uuid:()=>Li,_url:()=>Ik,_uppercase:()=>Ck,_unknown:()=>oq1,_union:()=>cX4,_undefined:()=>iq1,_ulid:()=>Ri,_uint64:()=>cq1,_uint32:()=>bq1,_tuple:()=>nX4,_trim:()=>xk,_transform:()=>J$4,_toUpperCase:()=>fk,_toLowerCase:()=>vk,_templateLiteral:()=>q$4,_symbol:()=>lq1,_superRefine:()=>WW1,_success:()=>$$4,_stringbool:()=>FW1,_stringFormat:()=>OE,_string:()=>Iq1,_startsWith:()=>Sk,_slugify:()=>hk,_size:()=>Pk,_set:()=>rX4,_safeParseAsync:()=>NE,_safeParse:()=>UE,_safeEncodeAsync:()=>el,_safeEncode:()=>sl,_safeDecodeAsync:()=>Ji,_safeDecode:()=>tl,_regex:()=>Tk,_refine:()=>qW1,_record:()=>aX4,_readonly:()=>K$4,_property:()=>$W1,_promise:()=>H$4,_positive:()=>QW1,_pipe:()=>V$4,_parseAsync:()=>FE,_parse:()=>zE,_overwrite:()=>FK,_optional:()=>Q$4,_number:()=>kq1,_nullable:()=>Z$4,_null:()=>nq1,_normalize:()=>yk,_nonpositive:()=>YW1,_nonoptional:()=>X$4,_nonnegative:()=>XW1,_never:()=>rq1,_negative:()=>ZW1,_nativeEnum:()=>tX4,_nanoid:()=>Ii,_nan:()=>JW1,_multipleOf:()=>hD,_minSize:()=>bD,_minLength:()=>wF,_min:()=>KZ,_mime:()=>kk,_maxSize:()=>ME,_maxLength:()=>LE,_max:()=>jX,_map:()=>oX4,_mac:()=>Tq1,_lte:()=>jX,_lt:()=>jW,_lowercase:()=>Rk,_literal:()=>eX4,_length:()=>AE,_lazy:()=>W$4,_ksuid:()=>ji,_jwt:()=>hi,_isoTime:()=>Sq1,_isoDuration:()=>_q1,_isoDateTime:()=>Cq1,_isoDate:()=>jq1,_ipv6:()=>_i,_ipv4:()=>Si,_intersection:()=>iX4,_int64:()=>dq1,_int32:()=>hq1,_int:()=>xq1,_includes:()=>jk,_guid:()=>Ek,_gte:()=>KZ,_gt:()=>SW,_float64:()=>fq1,_float32:()=>vq1,_file:()=>VW1,_enum:()=>sX4,_endsWith:()=>_k,_encodeAsync:()=>ol,_encode:()=>nl,_emoji:()=>Ei,_email:()=>Mi,_e164:()=>fi,_discriminatedUnion:()=>lX4,_default:()=>Y$4,_decodeAsync:()=>rl,_decode:()=>al,_date:()=>tq1,_custom:()=>KW1,_cuid2:()=>Ti,_cuid:()=>Pi,_coercedString:()=>Pq1,_coercedNumber:()=>yq1,_coercedDate:()=>eq1,_coercedBoolean:()=>mq1,_coercedBigint:()=>pq1,_cidrv6:()=>yi,_cidrv4:()=>ki,_check:()=>BN0,_catch:()=>G$4,_boolean:()=>gq1,_bigint:()=>uq1,_base64url:()=>vi,_base64:()=>xi,_array:()=>GW1,_any:()=>aq1,TimePrecision:()=>Rq1,NEVER:()=>e_,JSONSchemaGenerator:()=>bi,JSONSchema:()=>MN0,Doc:()=>Gi,$output:()=>wq1,$input:()=>Eq1,$constructor:()=>F0,$brand:()=>qG1,$ZodXID:()=>CV1,$ZodVoid:()=>eV1,$ZodUnknown:()=>sV1,$ZodUnion:()=>Ui,$ZodUndefined:()=>aV1,$ZodUUID:()=>AV1,$ZodURL:()=>wV1,$ZodULID:()=>RV1,$ZodType:()=>X8,$ZodTuple:()=>Bi,$ZodTransform:()=>HK1,$ZodTemplateLiteral:()=>wK1,$ZodSymbol:()=>nV1,$ZodSuccess:()=>DK1,$ZodStringFormat:()=>z5,$ZodString:()=>fD,$ZodSet:()=>VK1,$ZodRegistry:()=>wk,$ZodRecord:()=>$K1,$ZodRealError:()=>VZ,$ZodReadonly:()=>OK1,$ZodPromise:()=>IK1,$ZodPrefault:()=>BK1,$ZodPipe:()=>AK1,$ZodOptional:()=>zK1,$ZodObjectJIT:()=>ZK1,$ZodObject:()=>AB0,$ZodNumberFormat:()=>lV1,$ZodNumber:()=>zi,$ZodNullable:()=>FK1,$ZodNull:()=>oV1,$ZodNonOptional:()=>NK1,$ZodNever:()=>tV1,$ZodNanoID:()=>IV1,$ZodNaN:()=>LK1,$ZodMap:()=>GK1,$ZodMAC:()=>fV1,$ZodLiteral:()=>qK1,$ZodLazy:()=>PK1,$ZodKSUID:()=>jV1,$ZodJWT:()=>dV1,$ZodIntersection:()=>XK1,$ZodISOTime:()=>kV1,$ZodISODuration:()=>yV1,$ZodISODateTime:()=>SV1,$ZodISODate:()=>_V1,$ZodIPv6:()=>vV1,$ZodIPv4:()=>xV1,$ZodGUID:()=>LV1,$ZodFunction:()=>EK1,$ZodFile:()=>WK1,$ZodError:()=>Gk,$ZodEnum:()=>KK1,$ZodEncodeError:()=>yD,$ZodEmoji:()=>EV1,$ZodEmail:()=>OV1,$ZodE164:()=>pV1,$ZodDiscriminatedUnion:()=>YK1,$ZodDefault:()=>UK1,$ZodDate:()=>JK1,$ZodCustomStringFormat:()=>cV1,$ZodCustom:()=>TK1,$ZodCodec:()=>Bk,$ZodCheckUpperCase:()=>qV1,$ZodCheckStringFormat:()=>DE,$ZodCheckStartsWith:()=>HV1,$ZodCheckSizeEquals:()=>YV1,$ZodCheckRegex:()=>VV1,$ZodCheckProperty:()=>FV1,$ZodCheckOverwrite:()=>BV1,$ZodCheckNumberFormat:()=>eG1,$ZodCheckMultipleOf:()=>tG1,$ZodCheckMinSize:()=>ZV1,$ZodCheckMinLength:()=>$V1,$ZodCheckMimeType:()=>UV1,$ZodCheckMaxSize:()=>QV1,$ZodCheckMaxLength:()=>XV1,$ZodCheckLowerCase:()=>KV1,$ZodCheckLessThan:()=>Yi,$ZodCheckLengthEquals:()=>GV1,$ZodCheckIncludes:()=>WV1,$ZodCheckGreaterThan:()=>Xi,$ZodCheckEndsWith:()=>zV1,$ZodCheckBigIntFormat:()=>JV1,$ZodCheck:()=>w5,$ZodCatch:()=>MK1,$ZodCUID2:()=>TV1,$ZodCUID:()=>PV1,$ZodCIDRv6:()=>bV1,$ZodCIDRv4:()=>hV1,$ZodBoolean:()=>Uk,$ZodBigIntFormat:()=>iV1,$ZodBigInt:()=>Fi,$ZodBase64URL:()=>uV1,$ZodBase64:()=>mV1,$ZodAsyncError:()=>zK,$ZodArray:()=>QK1,$ZodAny:()=>rV1});var qZ=N1(()=>{S4();Zi();Oq1();LN0();KE();wG1();OG1();RK1();$i();DV1();Di();NN0();DN0()});var BW1=N1(()=>{qZ()});var di={};Q9(di,{time:()=>MW1,duration:()=>LW1,datetime:()=>NW1,date:()=>DW1,ZodISOTime:()=>ui,ZodISODuration:()=>pi,ZodISODateTime:()=>gi,ZodISODate:()=>mi});function NW1(J){return Cq1(gi,J)}function DW1(J){return jq1(mi,J)}function MW1(J){return Sq1(ui,J)}function LW1(J){return _q1(pi,J)}var gi,mi,ui,pi;var ci=N1(()=>{qZ();li();gi=F0("ZodISODateTime",(J,Q)=>{SV1.init(J,Q),E5.init(J,Q)});mi=F0("ZodISODate",(J,Q)=>{_V1.init(J,Q),E5.init(J,Q)});ui=F0("ZodISOTime",(J,Q)=>{kV1.init(J,Q),E5.init(J,Q)});pi=F0("ZodISODuration",(J,Q)=>{yV1.init(J,Q),E5.init(J,Q)})});var ON0=(J,Q)=>{Gk.init(J,Q),J.name="ZodError",Object.defineProperties(J,{format:{value:(Z)=>Kk(J,Z)},flatten:{value:(Z)=>Vk(J,Z)},addIssue:{value:(Z)=>{J.issues.push(Z),J.message=JSON.stringify(J.issues,qE,2)}},addIssues:{value:(Z)=>{J.issues.push(...Z),J.message=JSON.stringify(J.issues,qE,2)}},isEmpty:{get(){return J.issues.length===0}}})},F$4,WZ;var AW1=N1(()=>{qZ();qZ();S4();F$4=F0("ZodError",ON0),WZ=F0("ZodError",ON0,{Parent:Error})});var OW1,wW1,EW1,IW1,PW1,TW1,RW1,CW1,jW1,SW1,_W1,kW1;var yW1=N1(()=>{qZ();AW1();OW1=zE(WZ),wW1=FE(WZ),EW1=UE(WZ),IW1=NE(WZ),PW1=nl(WZ),TW1=al(WZ),RW1=ol(WZ),CW1=rl(WZ),jW1=sl(WZ),SW1=tl(WZ),_W1=el(WZ),kW1=Ji(WZ)});function Z0(J){return Iq1(gk,J)}function B$4(J){return Mi(fW1,J)}function N$4(J){return Ek(ii,J)}function D$4(J){return Li(kW,J)}function M$4(J){return Ai(kW,J)}function L$4(J){return Oi(kW,J)}function A$4(J){return wi(kW,J)}function hW1(J){return Ik(oi,J)}function O$4(J){return Ik(oi,{protocol:/^https?$/,hostname:CX.domain,...N6.normalizeParams(J)})}function w$4(J){return Ei(bW1,J)}function E$4(J){return Ii(gW1,J)}function I$4(J){return Pi(mW1,J)}function P$4(J){return Ti(uW1,J)}function T$4(J){return Ri(pW1,J)}function R$4(J){return Ci(dW1,J)}function C$4(J){return ji(cW1,J)}function j$4(J){return Si(lW1,J)}function S$4(J){return Tq1(wN0,J)}function _$4(J){return _i(iW1,J)}function k$4(J){return ki(nW1,J)}function y$4(J){return yi(aW1,J)}function x$4(J){return xi(oW1,J)}function v$4(J){return vi(rW1,J)}function f$4(J){return fi(sW1,J)}function h$4(J){return hi(tW1,J)}function b$4(J,Q,Z={}){return OE(mk,J,Q,Z)}function g$4(J){return OE(mk,"hostname",CX.hostname,J)}function m$4(J){return OE(mk,"hex",CX.hex,J)}function u$4(J,Q){let Z=Q?.enc??"hex",Y=`${J}_${Z}`,X=CX[Y];if(!X)throw Error(`Unrecognized hash format: ${Y}`);return OE(mk,Y,X,Q)}function p9(J){return kq1(uk,J)}function xW1(J){return xq1(wE,J)}function p$4(J){return vq1(wE,J)}function d$4(J){return fq1(wE,J)}function c$4(J){return hq1(wE,J)}function l$4(J){return bq1(wE,J)}function F5(J){return gq1(pk,J)}function i$4(J){return uq1(dk,J)}function n$4(J){return dq1(eW1,J)}function a$4(J){return cq1(eW1,J)}function o$4(J){return lq1(EN0,J)}function r$4(J){return iq1(IN0,J)}function ck(J){return nq1(PN0,J)}function JH1(){return aq1(TN0)}function L7(){return oq1(RN0)}function QH1(J){return rq1(CN0,J)}function s$4(J){return sq1(jN0,J)}function t$4(J){return tq1(ri,J)}function y6(J,Q){return GW1(SN0,J,Q)}function e$4(J){let Q=J._zod.def.shape;return U2(Object.keys(Q))}function U6(J,Q){let Z={type:"object",shape:J??{},...N6.normalizeParams(Q)};return new si(Z)}function JG4(J,Q){return new si({type:"object",shape:J,catchall:QH1(),...N6.normalizeParams(Q)})}function h2(J,Q){return new si({type:"object",shape:J,catchall:L7(),...N6.normalizeParams(Q)})}function I5(J,Q){return new ZH1({type:"union",options:J,...N6.normalizeParams(Q)})}function ti(J,Q,Z){return new _N0({type:"union",options:Q,discriminator:J,...N6.normalizeParams(Z)})}function lk(J,Q){return new kN0({type:"intersection",left:J,right:Q})}function xN0(J,Q,Z){let Y=Q instanceof X8,X=Y?Z:Q;return new yN0({type:"tuple",items:J,rest:Y?Q:null,...N6.normalizeParams(X)})}function _7(J,Q,Z){return new YH1({type:"record",keyType:J,valueType:Q,...N6.normalizeParams(Z)})}function QG4(J,Q,Z){let Y=BQ(J);return Y._zod.values=void 0,new YH1({type:"record",keyType:Y,valueType:Q,...N6.normalizeParams(Z)})}function ZG4(J,Q,Z){return new vN0({type:"map",keyType:J,valueType:Q,...N6.normalizeParams(Z)})}function YG4(J,Q){return new fN0({type:"set",valueType:J,...N6.normalizeParams(Q)})}function U2(J,Q){let Z=Array.isArray(J)?Object.fromEntries(J.map((Y)=>[Y,Y])):J;return new bk({type:"enum",entries:Z,...N6.normalizeParams(Q)})}function XG4(J,Q){return new bk({type:"enum",entries:J,...N6.normalizeParams(Q)})}function F4(J,Q){return new hN0({type:"literal",values:Array.isArray(J)?J:[J],...N6.normalizeParams(Q)})}function $G4(J){return VW1(bN0,J)}function XH1(J){return new gN0({type:"transform",transform:J})}function D4(J){return new $H1({type:"optional",innerType:J})}function ni(J){return new mN0({type:"nullable",innerType:J})}function GG4(J){return D4(ni(J))}function pN0(J,Q){return new uN0({type:"default",innerType:J,get defaultValue(){return typeof Q==="function"?Q():N6.shallowClone(Q)}})}function cN0(J,Q){return new dN0({type:"prefault",innerType:J,get defaultValue(){return typeof Q==="function"?Q():N6.shallowClone(Q)}})}function lN0(J,Q){return new GH1({type:"nonoptional",innerType:J,...N6.normalizeParams(Q)})}function VG4(J){return new iN0({type:"success",innerType:J})}function aN0(J,Q){return new nN0({type:"catch",innerType:J,catchValue:typeof Q==="function"?Q:()=>Q})}function KG4(J){return JW1(oN0,J)}function ai(J,Q){return new VH1({type:"pipe",in:J,out:Q})}function qG4(J,Q,Z){return new KH1({type:"pipe",in:J,out:Q,transform:Z.decode,reverseTransform:Z.encode})}function sN0(J){return new rN0({type:"readonly",innerType:J})}function WG4(J,Q){return new tN0({type:"template_literal",parts:J,...N6.normalizeParams(Q)})}function JD0(J){return new eN0({type:"lazy",getter:J})}function HG4(J){return new QD0({type:"promise",innerType:J})}function zG4(J){return new ZD0({type:"function",input:Array.isArray(J?.input)?xN0(J?.input):J?.input??y6(L7()),output:J?.output??L7()})}function FG4(J){let Q=new w5({check:"custom"});return Q._zod.check=J,Q}function qH1(J,Q){return KW1(ei,J??(()=>!0),Q)}function YD0(J,Q={}){return qW1(ei,J,Q)}function XD0(J){return WW1(J)}function NG4(J,Q={error:`Input not instance of ${J.name}`}){let Z=new ei({type:"custom",check:"custom",fn:(Y)=>Y instanceof J,abort:!0,...N6.normalizeParams(Q)});return Z._zod.bag.Class=J,Z}function MG4(J){let Q=JD0(()=>{return I5([Z0(J),p9(),F5(),ck(),y6(Q),_7(Z0(),Q)])});return Q}function Jn(J,Q){return ai(XH1(J),Q)}var _8,vW1,gk,E5,fW1,ii,kW,oi,bW1,gW1,mW1,uW1,pW1,dW1,cW1,lW1,wN0,iW1,nW1,aW1,oW1,rW1,sW1,tW1,mk,uk,wE,pk,dk,eW1,EN0,IN0,PN0,TN0,RN0,CN0,jN0,ri,SN0,si,ZH1,_N0,kN0,yN0,YH1,vN0,fN0,bk,hN0,bN0,gN0,$H1,mN0,uN0,dN0,GH1,iN0,nN0,oN0,VH1,KH1,rN0,tN0,eN0,QD0,ZD0,ei,UG4,BG4,DG4=(...J)=>FW1({Codec:KH1,Boolean:pk,String:gk},...J);var li=N1(()=>{qZ();qZ();BW1();ci();yW1();_8=F0("ZodType",(J,Q)=>{return X8.init(J,Q),J.def=Q,J.type=Q.type,Object.defineProperty(J,"_def",{value:Q}),J.check=(...Z)=>{return J.clone(N6.mergeDefs(Q,{checks:[...Q.checks??[],...Z.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]}))},J.clone=(Z,Y)=>BQ(J,Z,Y),J.brand=()=>J,J.register=(Z,Y)=>{return Z.add(J,Y),J},J.parse=(Z,Y)=>OW1(J,Z,Y,{callee:J.parse}),J.safeParse=(Z,Y)=>EW1(J,Z,Y),J.parseAsync=async(Z,Y)=>wW1(J,Z,Y,{callee:J.parseAsync}),J.safeParseAsync=async(Z,Y)=>IW1(J,Z,Y),J.spa=J.safeParseAsync,J.encode=(Z,Y)=>PW1(J,Z,Y),J.decode=(Z,Y)=>TW1(J,Z,Y),J.encodeAsync=async(Z,Y)=>RW1(J,Z,Y),J.decodeAsync=async(Z,Y)=>CW1(J,Z,Y),J.safeEncode=(Z,Y)=>jW1(J,Z,Y),J.safeDecode=(Z,Y)=>SW1(J,Z,Y),J.safeEncodeAsync=async(Z,Y)=>_W1(J,Z,Y),J.safeDecodeAsync=async(Z,Y)=>kW1(J,Z,Y),J.refine=(Z,Y)=>J.check(YD0(Z,Y)),J.superRefine=(Z)=>J.check(XD0(Z)),J.overwrite=(Z)=>J.check(FK(Z)),J.optional=()=>D4(J),J.nullable=()=>ni(J),J.nullish=()=>D4(ni(J)),J.nonoptional=(Z)=>lN0(J,Z),J.array=()=>y6(J),J.or=(Z)=>I5([J,Z]),J.and=(Z)=>lk(J,Z),J.transform=(Z)=>ai(J,XH1(Z)),J.default=(Z)=>pN0(J,Z),J.prefault=(Z)=>cN0(J,Z),J.catch=(Z)=>aN0(J,Z),J.pipe=(Z)=>ai(J,Z),J.readonly=()=>sN0(J),J.describe=(Z)=>{let Y=J.clone();return NQ.add(Y,{description:Z}),Y},Object.defineProperty(J,"description",{get(){return NQ.get(J)?.description},configurable:!0}),J.meta=(...Z)=>{if(Z.length===0)return NQ.get(J);let Y=J.clone();return NQ.add(Y,Z[0]),Y},J.isOptional=()=>J.safeParse(void 0).success,J.isNullable=()=>J.safeParse(null).success,J}),vW1=F0("_ZodString",(J,Q)=>{fD.init(J,Q),_8.init(J,Q);let Z=J._zod.bag;J.format=Z.format??null,J.minLength=Z.minimum??null,J.maxLength=Z.maximum??null,J.regex=(...Y)=>J.check(Tk(...Y)),J.includes=(...Y)=>J.check(jk(...Y)),J.startsWith=(...Y)=>J.check(Sk(...Y)),J.endsWith=(...Y)=>J.check(_k(...Y)),J.min=(...Y)=>J.check(wF(...Y)),J.max=(...Y)=>J.check(LE(...Y)),J.length=(...Y)=>J.check(AE(...Y)),J.nonempty=(...Y)=>J.check(wF(1,...Y)),J.lowercase=(Y)=>J.check(Rk(Y)),J.uppercase=(Y)=>J.check(Ck(Y)),J.trim=()=>J.check(xk()),J.normalize=(...Y)=>J.check(yk(...Y)),J.toLowerCase=()=>J.check(vk()),J.toUpperCase=()=>J.check(fk()),J.slugify=()=>J.check(hk())}),gk=F0("ZodString",(J,Q)=>{fD.init(J,Q),vW1.init(J,Q),J.email=(Z)=>J.check(Mi(fW1,Z)),J.url=(Z)=>J.check(Ik(oi,Z)),J.jwt=(Z)=>J.check(hi(tW1,Z)),J.emoji=(Z)=>J.check(Ei(bW1,Z)),J.guid=(Z)=>J.check(Ek(ii,Z)),J.uuid=(Z)=>J.check(Li(kW,Z)),J.uuidv4=(Z)=>J.check(Ai(kW,Z)),J.uuidv6=(Z)=>J.check(Oi(kW,Z)),J.uuidv7=(Z)=>J.check(wi(kW,Z)),J.nanoid=(Z)=>J.check(Ii(gW1,Z)),J.guid=(Z)=>J.check(Ek(ii,Z)),J.cuid=(Z)=>J.check(Pi(mW1,Z)),J.cuid2=(Z)=>J.check(Ti(uW1,Z)),J.ulid=(Z)=>J.check(Ri(pW1,Z)),J.base64=(Z)=>J.check(xi(oW1,Z)),J.base64url=(Z)=>J.check(vi(rW1,Z)),J.xid=(Z)=>J.check(Ci(dW1,Z)),J.ksuid=(Z)=>J.check(ji(cW1,Z)),J.ipv4=(Z)=>J.check(Si(lW1,Z)),J.ipv6=(Z)=>J.check(_i(iW1,Z)),J.cidrv4=(Z)=>J.check(ki(nW1,Z)),J.cidrv6=(Z)=>J.check(yi(aW1,Z)),J.e164=(Z)=>J.check(fi(sW1,Z)),J.datetime=(Z)=>J.check(NW1(Z)),J.date=(Z)=>J.check(DW1(Z)),J.time=(Z)=>J.check(MW1(Z)),J.duration=(Z)=>J.check(LW1(Z))});E5=F0("ZodStringFormat",(J,Q)=>{z5.init(J,Q),vW1.init(J,Q)}),fW1=F0("ZodEmail",(J,Q)=>{OV1.init(J,Q),E5.init(J,Q)});ii=F0("ZodGUID",(J,Q)=>{LV1.init(J,Q),E5.init(J,Q)});kW=F0("ZodUUID",(J,Q)=>{AV1.init(J,Q),E5.init(J,Q)});oi=F0("ZodURL",(J,Q)=>{wV1.init(J,Q),E5.init(J,Q)});bW1=F0("ZodEmoji",(J,Q)=>{EV1.init(J,Q),E5.init(J,Q)});gW1=F0("ZodNanoID",(J,Q)=>{IV1.init(J,Q),E5.init(J,Q)});mW1=F0("ZodCUID",(J,Q)=>{PV1.init(J,Q),E5.init(J,Q)});uW1=F0("ZodCUID2",(J,Q)=>{TV1.init(J,Q),E5.init(J,Q)});pW1=F0("ZodULID",(J,Q)=>{RV1.init(J,Q),E5.init(J,Q)});dW1=F0("ZodXID",(J,Q)=>{CV1.init(J,Q),E5.init(J,Q)});cW1=F0("ZodKSUID",(J,Q)=>{jV1.init(J,Q),E5.init(J,Q)});lW1=F0("ZodIPv4",(J,Q)=>{xV1.init(J,Q),E5.init(J,Q)});wN0=F0("ZodMAC",(J,Q)=>{fV1.init(J,Q),E5.init(J,Q)});iW1=F0("ZodIPv6",(J,Q)=>{vV1.init(J,Q),E5.init(J,Q)});nW1=F0("ZodCIDRv4",(J,Q)=>{hV1.init(J,Q),E5.init(J,Q)});aW1=F0("ZodCIDRv6",(J,Q)=>{bV1.init(J,Q),E5.init(J,Q)});oW1=F0("ZodBase64",(J,Q)=>{mV1.init(J,Q),E5.init(J,Q)});rW1=F0("ZodBase64URL",(J,Q)=>{uV1.init(J,Q),E5.init(J,Q)});sW1=F0("ZodE164",(J,Q)=>{pV1.init(J,Q),E5.init(J,Q)});tW1=F0("ZodJWT",(J,Q)=>{dV1.init(J,Q),E5.init(J,Q)});mk=F0("ZodCustomStringFormat",(J,Q)=>{cV1.init(J,Q),E5.init(J,Q)});uk=F0("ZodNumber",(J,Q)=>{zi.init(J,Q),_8.init(J,Q),J.gt=(Y,X)=>J.check(SW(Y,X)),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.lt=(Y,X)=>J.check(jW(Y,X)),J.lte=(Y,X)=>J.check(jX(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X)),J.int=(Y)=>J.check(xW1(Y)),J.safe=(Y)=>J.check(xW1(Y)),J.positive=(Y)=>J.check(SW(0,Y)),J.nonnegative=(Y)=>J.check(KZ(0,Y)),J.negative=(Y)=>J.check(jW(0,Y)),J.nonpositive=(Y)=>J.check(jX(0,Y)),J.multipleOf=(Y,X)=>J.check(hD(Y,X)),J.step=(Y,X)=>J.check(hD(Y,X)),J.finite=()=>J;let Z=J._zod.bag;J.minValue=Math.max(Z.minimum??Number.NEGATIVE_INFINITY,Z.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,J.maxValue=Math.min(Z.maximum??Number.POSITIVE_INFINITY,Z.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,J.isInt=(Z.format??"").includes("int")||Number.isSafeInteger(Z.multipleOf??0.5),J.isFinite=!0,J.format=Z.format??null});wE=F0("ZodNumberFormat",(J,Q)=>{lV1.init(J,Q),uk.init(J,Q)});pk=F0("ZodBoolean",(J,Q)=>{Uk.init(J,Q),_8.init(J,Q)});dk=F0("ZodBigInt",(J,Q)=>{Fi.init(J,Q),_8.init(J,Q),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.gt=(Y,X)=>J.check(SW(Y,X)),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.lt=(Y,X)=>J.check(jW(Y,X)),J.lte=(Y,X)=>J.check(jX(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X)),J.positive=(Y)=>J.check(SW(BigInt(0),Y)),J.negative=(Y)=>J.check(jW(BigInt(0),Y)),J.nonpositive=(Y)=>J.check(jX(BigInt(0),Y)),J.nonnegative=(Y)=>J.check(KZ(BigInt(0),Y)),J.multipleOf=(Y,X)=>J.check(hD(Y,X));let Z=J._zod.bag;J.minValue=Z.minimum??null,J.maxValue=Z.maximum??null,J.format=Z.format??null});eW1=F0("ZodBigIntFormat",(J,Q)=>{iV1.init(J,Q),dk.init(J,Q)});EN0=F0("ZodSymbol",(J,Q)=>{nV1.init(J,Q),_8.init(J,Q)});IN0=F0("ZodUndefined",(J,Q)=>{aV1.init(J,Q),_8.init(J,Q)});PN0=F0("ZodNull",(J,Q)=>{oV1.init(J,Q),_8.init(J,Q)});TN0=F0("ZodAny",(J,Q)=>{rV1.init(J,Q),_8.init(J,Q)});RN0=F0("ZodUnknown",(J,Q)=>{sV1.init(J,Q),_8.init(J,Q)});CN0=F0("ZodNever",(J,Q)=>{tV1.init(J,Q),_8.init(J,Q)});jN0=F0("ZodVoid",(J,Q)=>{eV1.init(J,Q),_8.init(J,Q)});ri=F0("ZodDate",(J,Q)=>{JK1.init(J,Q),_8.init(J,Q),J.min=(Y,X)=>J.check(KZ(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X));let Z=J._zod.bag;J.minDate=Z.minimum?new Date(Z.minimum):null,J.maxDate=Z.maximum?new Date(Z.maximum):null});SN0=F0("ZodArray",(J,Q)=>{QK1.init(J,Q),_8.init(J,Q),J.element=Q.element,J.min=(Z,Y)=>J.check(wF(Z,Y)),J.nonempty=(Z)=>J.check(wF(1,Z)),J.max=(Z,Y)=>J.check(LE(Z,Y)),J.length=(Z,Y)=>J.check(AE(Z,Y)),J.unwrap=()=>J.element});si=F0("ZodObject",(J,Q)=>{ZK1.init(J,Q),_8.init(J,Q),N6.defineLazy(J,"shape",()=>{return Q.shape}),J.keyof=()=>U2(Object.keys(J._zod.def.shape)),J.catchall=(Z)=>J.clone({...J._zod.def,catchall:Z}),J.passthrough=()=>J.clone({...J._zod.def,catchall:L7()}),J.loose=()=>J.clone({...J._zod.def,catchall:L7()}),J.strict=()=>J.clone({...J._zod.def,catchall:QH1()}),J.strip=()=>J.clone({...J._zod.def,catchall:void 0}),J.extend=(Z)=>{return N6.extend(J,Z)},J.safeExtend=(Z)=>{return N6.safeExtend(J,Z)},J.merge=(Z)=>N6.merge(J,Z),J.pick=(Z)=>N6.pick(J,Z),J.omit=(Z)=>N6.omit(J,Z),J.partial=(...Z)=>N6.partial($H1,J,Z[0]),J.required=(...Z)=>N6.required(GH1,J,Z[0])});ZH1=F0("ZodUnion",(J,Q)=>{Ui.init(J,Q),_8.init(J,Q),J.options=Q.options});_N0=F0("ZodDiscriminatedUnion",(J,Q)=>{ZH1.init(J,Q),YK1.init(J,Q)});kN0=F0("ZodIntersection",(J,Q)=>{XK1.init(J,Q),_8.init(J,Q)});yN0=F0("ZodTuple",(J,Q)=>{Bi.init(J,Q),_8.init(J,Q),J.rest=(Z)=>J.clone({...J._zod.def,rest:Z})});YH1=F0("ZodRecord",(J,Q)=>{$K1.init(J,Q),_8.init(J,Q),J.keyType=Q.keyType,J.valueType=Q.valueType});vN0=F0("ZodMap",(J,Q)=>{GK1.init(J,Q),_8.init(J,Q),J.keyType=Q.keyType,J.valueType=Q.valueType});fN0=F0("ZodSet",(J,Q)=>{VK1.init(J,Q),_8.init(J,Q),J.min=(...Z)=>J.check(bD(...Z)),J.nonempty=(Z)=>J.check(bD(1,Z)),J.max=(...Z)=>J.check(ME(...Z)),J.size=(...Z)=>J.check(Pk(...Z))});bk=F0("ZodEnum",(J,Q)=>{KK1.init(J,Q),_8.init(J,Q),J.enum=Q.entries,J.options=Object.values(Q.entries);let Z=new Set(Object.keys(Q.entries));J.extract=(Y,X)=>{let G={};for(let V of Y)if(Z.has(V))G[V]=Q.entries[V];else throw Error(`Key ${V} not found in enum`);return new bk({...Q,checks:[],...N6.normalizeParams(X),entries:G})},J.exclude=(Y,X)=>{let G={...Q.entries};for(let V of Y)if(Z.has(V))delete G[V];else throw Error(`Key ${V} not found in enum`);return new bk({...Q,checks:[],...N6.normalizeParams(X),entries:G})}});hN0=F0("ZodLiteral",(J,Q)=>{qK1.init(J,Q),_8.init(J,Q),J.values=new Set(Q.values),Object.defineProperty(J,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});bN0=F0("ZodFile",(J,Q)=>{WK1.init(J,Q),_8.init(J,Q),J.min=(Z,Y)=>J.check(bD(Z,Y)),J.max=(Z,Y)=>J.check(ME(Z,Y)),J.mime=(Z,Y)=>J.check(kk(Array.isArray(Z)?Z:[Z],Y))});gN0=F0("ZodTransform",(J,Q)=>{HK1.init(J,Q),_8.init(J,Q),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")throw new yD(J.constructor.name);Z.addIssue=(G)=>{if(typeof G==="string")Z.issues.push(N6.issue(G,Z.value,Q));else{let V=G;if(V.fatal)V.continue=!1;V.code??(V.code="custom"),V.input??(V.input=Z.value),V.inst??(V.inst=J),Z.issues.push(N6.issue(V))}};let X=Q.transform(Z.value,Z);if(X instanceof Promise)return X.then((G)=>{return Z.value=G,Z});return Z.value=X,Z}});$H1=F0("ZodOptional",(J,Q)=>{zK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});mN0=F0("ZodNullable",(J,Q)=>{FK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});uN0=F0("ZodDefault",(J,Q)=>{UK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType,J.removeDefault=J.unwrap});dN0=F0("ZodPrefault",(J,Q)=>{BK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});GH1=F0("ZodNonOptional",(J,Q)=>{NK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});iN0=F0("ZodSuccess",(J,Q)=>{DK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});nN0=F0("ZodCatch",(J,Q)=>{MK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType,J.removeCatch=J.unwrap});oN0=F0("ZodNaN",(J,Q)=>{LK1.init(J,Q),_8.init(J,Q)});VH1=F0("ZodPipe",(J,Q)=>{AK1.init(J,Q),_8.init(J,Q),J.in=Q.in,J.out=Q.out});KH1=F0("ZodCodec",(J,Q)=>{VH1.init(J,Q),Bk.init(J,Q)});rN0=F0("ZodReadonly",(J,Q)=>{OK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});tN0=F0("ZodTemplateLiteral",(J,Q)=>{wK1.init(J,Q),_8.init(J,Q)});eN0=F0("ZodLazy",(J,Q)=>{PK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.getter()});QD0=F0("ZodPromise",(J,Q)=>{IK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});ZD0=F0("ZodFunction",(J,Q)=>{EK1.init(J,Q),_8.init(J,Q)});ei=F0("ZodCustom",(J,Q)=>{TK1.init(J,Q),_8.init(J,Q)});UG4=HW1,BG4=zW1});function LG4(J){I3({customError:J})}function AG4(){return I3().customError}var HH1,WH1;var $D0=N1(()=>{qZ();HH1={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};(function(J){})(WH1||(WH1={}))});var ik={};Q9(ik,{string:()=>OG4,number:()=>wG4,date:()=>PG4,boolean:()=>EG4,bigint:()=>IG4});function OG4(J){return Pq1(gk,J)}function wG4(J){return yq1(uk,J)}function EG4(J){return mq1(pk,J)}function IG4(J){return pq1(dk,J)}function PG4(J){return eq1(ri,J)}var GD0=N1(()=>{qZ();li()});var f1={};Q9(f1,{xid:()=>R$4,void:()=>s$4,uuidv7:()=>A$4,uuidv6:()=>L$4,uuidv4:()=>M$4,uuid:()=>D$4,util:()=>N6,url:()=>hW1,uppercase:()=>Ck,unknown:()=>L7,union:()=>I5,undefined:()=>r$4,ulid:()=>T$4,uint64:()=>a$4,uint32:()=>l$4,tuple:()=>xN0,trim:()=>xk,treeifyError:()=>LG1,transform:()=>XH1,toUpperCase:()=>fk,toLowerCase:()=>vk,toJSONSchema:()=>UW1,templateLiteral:()=>WG4,symbol:()=>o$4,superRefine:()=>XD0,success:()=>VG4,stringbool:()=>DG4,stringFormat:()=>b$4,string:()=>Z0,strictObject:()=>JG4,startsWith:()=>Sk,slugify:()=>hk,size:()=>Pk,setErrorMap:()=>LG4,set:()=>YG4,safeParseAsync:()=>IW1,safeParse:()=>EW1,safeEncodeAsync:()=>_W1,safeEncode:()=>jW1,safeDecodeAsync:()=>kW1,safeDecode:()=>SW1,registry:()=>Ni,regexes:()=>CX,regex:()=>Tk,refine:()=>YD0,record:()=>_7,readonly:()=>sN0,property:()=>$W1,promise:()=>HG4,prettifyError:()=>AG1,preprocess:()=>Jn,prefault:()=>cN0,positive:()=>QW1,pipe:()=>ai,partialRecord:()=>QG4,parseAsync:()=>wW1,parse:()=>OW1,overwrite:()=>FK,optional:()=>D4,object:()=>U6,number:()=>p9,nullish:()=>GG4,nullable:()=>ni,null:()=>ck,normalize:()=>yk,nonpositive:()=>YW1,nonoptional:()=>lN0,nonnegative:()=>XW1,never:()=>QH1,negative:()=>ZW1,nativeEnum:()=>XG4,nanoid:()=>E$4,nan:()=>KG4,multipleOf:()=>hD,minSize:()=>bD,minLength:()=>wF,mime:()=>kk,meta:()=>BG4,maxSize:()=>ME,maxLength:()=>LE,map:()=>ZG4,mac:()=>S$4,lte:()=>jX,lt:()=>jW,lowercase:()=>Rk,looseObject:()=>h2,locales:()=>Ok,literal:()=>F4,length:()=>AE,lazy:()=>JD0,ksuid:()=>C$4,keyof:()=>e$4,jwt:()=>h$4,json:()=>MG4,iso:()=>di,ipv6:()=>_$4,ipv4:()=>j$4,intersection:()=>lk,int64:()=>n$4,int32:()=>c$4,int:()=>xW1,instanceof:()=>NG4,includes:()=>jk,httpUrl:()=>O$4,hostname:()=>g$4,hex:()=>m$4,hash:()=>u$4,guid:()=>N$4,gte:()=>KZ,gt:()=>SW,globalRegistry:()=>NQ,getErrorMap:()=>AG4,function:()=>zG4,formatError:()=>Kk,float64:()=>d$4,float32:()=>p$4,flattenError:()=>Vk,file:()=>$G4,enum:()=>U2,endsWith:()=>_k,encodeAsync:()=>RW1,encode:()=>PW1,emoji:()=>w$4,email:()=>B$4,e164:()=>f$4,discriminatedUnion:()=>ti,describe:()=>UG4,decodeAsync:()=>CW1,decode:()=>TW1,date:()=>t$4,custom:()=>qH1,cuid2:()=>P$4,cuid:()=>I$4,core:()=>_W,config:()=>I3,coerce:()=>ik,codec:()=>qG4,clone:()=>BQ,cidrv6:()=>y$4,cidrv4:()=>k$4,check:()=>FG4,catch:()=>aN0,boolean:()=>F5,bigint:()=>i$4,base64url:()=>v$4,base64:()=>x$4,array:()=>y6,any:()=>JH1,_function:()=>zG4,_default:()=>pN0,_ZodString:()=>vW1,ZodXID:()=>dW1,ZodVoid:()=>jN0,ZodUnknown:()=>RN0,ZodUnion:()=>ZH1,ZodUndefined:()=>IN0,ZodUUID:()=>kW,ZodURL:()=>oi,ZodULID:()=>pW1,ZodType:()=>_8,ZodTuple:()=>yN0,ZodTransform:()=>gN0,ZodTemplateLiteral:()=>tN0,ZodSymbol:()=>EN0,ZodSuccess:()=>iN0,ZodStringFormat:()=>E5,ZodString:()=>gk,ZodSet:()=>fN0,ZodRecord:()=>YH1,ZodRealError:()=>WZ,ZodReadonly:()=>rN0,ZodPromise:()=>QD0,ZodPrefault:()=>dN0,ZodPipe:()=>VH1,ZodOptional:()=>$H1,ZodObject:()=>si,ZodNumberFormat:()=>wE,ZodNumber:()=>uk,ZodNullable:()=>mN0,ZodNull:()=>PN0,ZodNonOptional:()=>GH1,ZodNever:()=>CN0,ZodNanoID:()=>gW1,ZodNaN:()=>oN0,ZodMap:()=>vN0,ZodMAC:()=>wN0,ZodLiteral:()=>hN0,ZodLazy:()=>eN0,ZodKSUID:()=>cW1,ZodJWT:()=>tW1,ZodIssueCode:()=>HH1,ZodIntersection:()=>kN0,ZodISOTime:()=>ui,ZodISODuration:()=>pi,ZodISODateTime:()=>gi,ZodISODate:()=>mi,ZodIPv6:()=>iW1,ZodIPv4:()=>lW1,ZodGUID:()=>ii,ZodFunction:()=>ZD0,ZodFirstPartyTypeKind:()=>WH1,ZodFile:()=>bN0,ZodError:()=>F$4,ZodEnum:()=>bk,ZodEmoji:()=>bW1,ZodEmail:()=>fW1,ZodE164:()=>sW1,ZodDiscriminatedUnion:()=>_N0,ZodDefault:()=>uN0,ZodDate:()=>ri,ZodCustomStringFormat:()=>mk,ZodCustom:()=>ei,ZodCodec:()=>KH1,ZodCatch:()=>nN0,ZodCUID2:()=>uW1,ZodCUID:()=>mW1,ZodCIDRv6:()=>aW1,ZodCIDRv4:()=>nW1,ZodBoolean:()=>pk,ZodBigIntFormat:()=>eW1,ZodBigInt:()=>dk,ZodBase64URL:()=>rW1,ZodBase64:()=>oW1,ZodArray:()=>SN0,ZodAny:()=>TN0,TimePrecision:()=>Rq1,NEVER:()=>e_,$output:()=>wq1,$input:()=>Eq1,$brand:()=>qG1});var nk=N1(()=>{qZ();qZ();fK1();qZ();Oq1();ci();ci();GD0();li();BW1();AW1();yW1();$D0();I3(Nk())});var Qn=N1(()=>{nk();nk()});function SJ(J,Q){let Z=CG4(J,Q);return typeof Z==="string"?Z:Z.toString()}function CG4(J,Q,Z=!0){if(!Q)Q=jG4();let{workspaceFolders:Y,isWindows:X,homeDir:G}=Q,V=typeof J==="string"?f0.parse(J):f0.from(J);if(Y)for(let K of Y){let q=m4(K);if(n0.hasPrefix(V,q)){let W=q.path.endsWith("/")?q.path.slice(0,-1):q.path,z=Z&&Y&&Y.length>=2?jD(q.path)+(X?"\\":"/"):"";return FH1(z+V.path.slice(W.length+1),X,V.scheme)}}if(V?.scheme==="file"){if(G){let K=m4(G);if(n0.hasPrefix(V,K)){let q=K.path.endsWith("/")?K.path.slice(0,-1):K.path,W=V.path.slice(q.length+1);return FH1("~"+(X?"\\":"/")+W,X,V.scheme)}}return FH1(V.fsPath,X,V.scheme)}return V}function FH1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function Yn(J){let Q=Zn;return Zn=J,Q}function jG4(){if(Zn)return Zn;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Zn=null;var yW=N1(()=>{s6();ZE();yl()});var SG4=(J)=>{let Q=0,Z=[];while(Q<J.length){let Y=J[Q];if(Y==="\\"){Q++;continue}if(Y==="{"){Z.push({type:"brace",value:"{"}),Q++;continue}if(Y==="}"){Z.push({type:"brace",value:"}"}),Q++;continue}if(Y==="["){Z.push({type:"paren",value:"["}),Q++;continue}if(Y==="]"){Z.push({type:"paren",value:"]"}),Q++;continue}if(Y===":"){Z.push({type:"separator",value:":"}),Q++;continue}if(Y===","){Z.push({type:"delimiter",value:","}),Q++;continue}if(Y==='"'){let K="",q=!1;Y=J[++Q];while(Y!=='"'){if(Q===J.length){q=!0;break}if(Y==="\\"){if(Q++,Q===J.length){q=!0;break}K+=Y+J[Q],Y=J[++Q]}else K+=Y,Y=J[++Q]}if(Y=J[++Q],!q)Z.push({type:"string",value:K});continue}if(Y&&/\s/.test(Y)){Q++;continue}let G=/[0-9]/;if(Y&&G.test(Y)||Y==="-"||Y==="."){let K="";if(Y==="-")K+=Y,Y=J[++Q];while(Y&&G.test(Y)||Y===".")K+=Y,Y=J[++Q];Z.push({type:"number",value:K});continue}let V=/[a-z]/i;if(Y&&V.test(Y)){let K="";while(Y&&V.test(Y)){if(Q===J.length)break;K+=Y,Y=J[++Q]}if(K=="true"||K=="false"||K==="null")Z.push({type:"name",value:K});else{Q++;continue}continue}Q++}return Z},IE=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),IE(J);break;case"number":let Z=Q.value[Q.value.length-1];if(Z==="."||Z==="-")return J=J.slice(0,J.length-1),IE(J);case"string":let Y=J[J.length-2];if(Y?.type==="delimiter")return J=J.slice(0,J.length-1),IE(J);else if(Y?.type==="brace"&&Y.value==="{")return J=J.slice(0,J.length-1),IE(J);break;case"delimiter":return J=J.slice(0,J.length-1),IE(J);break}return J},_G4=(J)=>{let Q=[];if(J.map((Z)=>{if(Z.type==="brace")if(Z.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Z.type==="paren")if(Z.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Z)=>{if(Z==="}")J.push({type:"brace",value:"}"});else if(Z==="]")J.push({type:"paren",value:"]"})});return J},kG4=(J)=>{let Q="";return J.map((Z)=>{switch(Z.type){case"string":Q+='"'+Z.value+'"';break;default:Q+=Z.value;break}}),Q},SX=(J)=>JSON.parse(kG4(_G4(IE(SG4(J)))));var gD=()=>{};function _J(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function pD(J){return!!J&&!!J[XY]}function IF(J){if(!J)return!1;return zD0(J)||Array.isArray(J)||!!J[ak]||!!J.constructor?.[ak]||ek(J)||Jy(J)}function zD0(J){if(!J||typeof J!=="object")return!1;let Q=uD(J);if(Q===null)return!0;let Z=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Z===Object)return!0;return typeof Z=="function"&&Function.toString.call(Z)===yG4}function ok(J,Q){if(dD(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,Y)=>Q(Y,Z,J))}function dD(J){let Q=J[XY];return Q?Q.type_:Array.isArray(J)?1:ek(J)?2:Jy(J)?3:0}function rk(J,Q){return dD(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function UH1(J,Q){return dD(J)===2?J.get(Q):J[Q]}function FD0(J,Q,Z){let Y=dD(J);if(Y===2)J.set(Q,Z);else if(Y===3)J.add(Z);else J[Q]=Z}function xG4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function ek(J){return J instanceof Map}function Jy(J){return J instanceof Set}function mD(J){return J.copy_||J.base_}function DH1(J,Q){if(ek(J))return new Map(J);if(Jy(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=zD0(J);if(Q===!0||Q==="class_only"&&!Z){let Y=Object.getOwnPropertyDescriptors(J);delete Y[XY];let X=Reflect.ownKeys(Y);for(let G=0;G<X.length;G++){let V=X[G],K=Y[V];if(K.writable===!1)K.writable=!0,K.configurable=!0;if(K.get||K.set)Y[V]={configurable:!0,writable:!0,enumerable:K.enumerable,value:J[V]}}return Object.create(uD(J),Y)}else{let Y=uD(J);if(Y!==null&&Z)return{...J};let X=Object.create(Y);return Object.assign(X,J)}}function GY(J,Q=!1){if(Gn(J)||pD(J)||!IF(J))return J;if(dD(J)>1)J.set=J.add=J.clear=J.delete=vG4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,Y])=>GY(Y,!0));return J}function vG4(){_J(2)}function Gn(J){return Object.isFrozen(J)}function cD(J){let Q=MH1[J];if(!Q)_J(0,J);return Q}function fG4(J,Q){if(!MH1[J])MH1[J]=Q}function UD0(){return sk}function hG4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function KD0(J,Q){if(Q)cD("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function LH1(J){AH1(J),J.drafts_.forEach(bG4),J.drafts_=null}function AH1(J){if(J===sk)sk=J.parent_}function qD0(J){return sk=hG4(sk,J)}function bG4(J){let Q=J[XY];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function WD0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[XY].modified_)LH1(Q),_J(4);if(IF(J)){if(J=Xn(Q,J),!Q.parent_)$n(Q,J)}if(Q.patches_)cD("Patches").generateReplacementPatches_(Z[XY].base_,J,Q.patches_,Q.inversePatches_)}else J=Xn(Q,Z,[]);if(LH1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==EH1?J:void 0}function Xn(J,Q,Z){if(Gn(Q))return Q;let Y=Q[XY];if(!Y)return ok(Q,(X,G)=>HD0(J,Y,Q,X,G,Z)),Q;if(Y.scope_!==J)return Q;if(!Y.modified_)return $n(J,Y.base_,!0),Y.base_;if(!Y.finalized_){Y.finalized_=!0,Y.scope_.unfinalizedDrafts_--;let X=Y.copy_,G=X,V=!1;if(Y.type_===3)G=new Set(X),X.clear(),V=!0;if(ok(G,(K,q)=>HD0(J,Y,X,K,q,Z,V)),$n(J,X,!1),Z&&J.patches_)cD("Patches").generatePatches_(Y,Z,J.patches_,J.inversePatches_)}return Y.copy_}function HD0(J,Q,Z,Y,X,G,V){if(pD(X)){let K=G&&Q&&Q.type_!==3&&!rk(Q.assigned_,Y)?G.concat(Y):void 0,q=Xn(J,X,K);if(FD0(Z,Y,q),pD(q))J.canAutoFreeze_=!1;else return}else if(V)Z.add(X);if(IF(X)&&!Gn(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Xn(J,X),(!Q||!Q.scope_.parent_)&&typeof Y!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,Y))$n(J,X)}}function $n(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)GY(Q,Z)}function gG4(J,Q){let Z=Array.isArray(J),Y={type_:Z?1:0,scope_:Q?Q.scope_:UD0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Y,G=IH1;if(Z)X=[Y],G=tk;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Y.draft_=K,Y.revoke_=V,K}function BH1(J,Q){let Z=J[XY];return(Z?mD(Z):J)[Q]}function mG4(J,Q,Z){let Y=BD0(Q,Z);return Y?"value"in Y?Y.value:Y.get?.call(J.draft_):void 0}function BD0(J,Q){if(!(Q in J))return;let Z=uD(J);while(Z){let Y=Object.getOwnPropertyDescriptor(Z,Q);if(Y)return Y;Z=uD(Z)}return}function OH1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)OH1(J.parent_)}}function NH1(J){if(!J.copy_)J.copy_=DH1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function wH1(J,Q){let Z=ek(J)?cD("MapSet").proxyMap_(J,Q):Jy(J)?cD("MapSet").proxySet_(J,Q):gG4(J,Q);return(Q?Q.scope_:UD0()).drafts_.push(Z),Z}function pG4(J){if(!pD(J))_J(10,J);return ND0(J)}function ND0(J){if(!IF(J)||Gn(J))return J;let Q=J[XY],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=DH1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=DH1(J,!0);if(ok(Z,(Y,X)=>{FD0(Z,Y,ND0(X))}),Q)Q.finalized_=!1;return Z}function Vn(){let Q="replace",Z="add",Y="remove";function X(U,D,M,L){switch(U.type_){case 0:case 2:return V(U,D,M,L);case 1:return G(U,D,M,L);case 3:return K(U,D,M,L)}}function G(U,D,M,L){let{base_:A,assigned_:E}=U,I=U.copy_;if(I.length<A.length)[A,I]=[I,A],[M,L]=[L,M];for(let P=0;P<A.length;P++)if(E[P]&&I[P]!==A[P]){let C=D.concat([P]);M.push({op:Q,path:C,value:z(I[P])}),L.push({op:Q,path:C,value:z(A[P])})}for(let P=A.length;P<I.length;P++){let C=D.concat([P]);M.push({op:Z,path:C,value:z(I[P])})}for(let P=I.length-1;A.length<=P;--P){let C=D.concat([P]);L.push({op:Y,path:C})}}function V(U,D,M,L){let{base_:A,copy_:E}=U;ok(U.assigned_,(I,P)=>{let C=UH1(A,I),k=UH1(E,I),y=!P?Y:rk(A,I)?Q:Z;if(C===k&&y===Q)return;let v=D.concat(I);M.push(y===Y?{op:y,path:v}:{op:y,path:v,value:k}),L.push(y===Z?{op:Y,path:v}:y===Y?{op:Z,path:v,value:z(C)}:{op:Q,path:v,value:z(C)})})}function K(U,D,M,L){let{base_:A,copy_:E}=U,I=0;A.forEach((P)=>{if(!E.has(P)){let C=D.concat([I]);M.push({op:Y,path:C,value:P}),L.unshift({op:Z,path:C,value:P})}I++}),I=0,E.forEach((P)=>{if(!A.has(P)){let C=D.concat([I]);M.push({op:Z,path:C,value:P}),L.unshift({op:Y,path:C,value:P})}I++})}function q(U,D,M,L){M.push({op:Q,path:[],value:D===EH1?void 0:D}),L.push({op:Q,path:[],value:U})}function W(U,D){return D.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let k=0;k<L.length-1;k++){let y=dD(E),v=L[k];if(typeof v!=="string"&&typeof v!=="number")v=""+v;if((y===0||y===1)&&(v==="__proto__"||v==="constructor"))_J(19);if(typeof E==="function"&&v==="prototype")_J(19);if(E=UH1(E,v),typeof E!=="object")_J(18,L.join("/"))}let I=dD(E),P=H(M.value),C=L[L.length-1];switch(A){case Q:switch(I){case 2:return E.set(C,P);case 3:_J(16);default:return E[C]=P}case Z:switch(I){case 1:return C==="-"?E.push(P):E.splice(C,0,P);case 2:return E.set(C,P);case 3:return E.add(P);default:return E[C]=P}case Y:switch(I){case 1:return E.splice(C,1);case 2:return E.delete(C);case 3:return E.delete(M.value);default:return delete E[C]}default:_J(17,A)}}),U}function H(U){if(!IF(U))return U;if(Array.isArray(U))return U.map(H);if(ek(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(Jy(U))return new Set(Array.from(U).map(H));let D=Object.create(uD(U));for(let M in U)D[M]=H(U[M]);if(rk(U,ak))D[ak]=U[ak];return D}function z(U){if(pD(U))return H(U);else return U}fG4("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function k8(J){return J}var EH1,ak,XY,uD,yG4,MH1,sk,IH1,tk,uG4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Z,Y)=>{if(typeof Q==="function"&&typeof Z!=="function"){let G=Z;Z=Q;let V=this;return function(q=G,...W){return V.produce(q,(H)=>Z.call(this,H,...W))}}if(typeof Z!=="function")_J(6);if(Y!==void 0&&typeof Y!=="function")_J(7);let X;if(IF(Q)){let G=qD0(this),V=wH1(Q,void 0),K=!0;try{X=Z(V),K=!1}finally{if(K)LH1(G);else AH1(G)}return KD0(G,Y),WD0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Z(Q),X===void 0)X=Q;if(X===EH1)X=void 0;if(this.autoFreeze_)GY(X,!0);if(Y){let G=[],V=[];cD("Patches").generateReplacementPatches_(Q,X,G,V),Y(G,V)}return X}else _J(1,Q)},this.produceWithPatches=(Q,Z)=>{if(typeof Q==="function")return(V,...K)=>this.produceWithPatches(V,(q)=>Q(q,...K));let Y,X;return[this.produce(Q,Z,(V,K)=>{Y=V,X=K}),Y,X]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!IF(J))_J(8);if(pD(J))J=pG4(J);let Q=qD0(this),Z=wH1(J,void 0);return Z[XY].isManual_=!0,AH1(Q),Z}finishDraft(J,Q){let Z=J&&J[XY];if(!Z||!Z.isManual_)_J(9);let{scope_:Y}=Z;return KD0(Y,Q),WD0(void 0,Y)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Z;for(Z=Q.length-1;Z>=0;Z--){let X=Q[Z];if(X.path.length===0&&X.op==="replace"){J=X.value;break}}if(Z>-1)Q=Q.slice(Z+1);let Y=cD("Patches").applyPatches_;if(pD(J))return Y(J,Q);return this.produce(J,(X)=>Y(X,Q))}},$Y,PF,lD,vc8,fc8,DD0,hc8,bc8;var MQ=N1(()=>{EH1=Symbol.for("immer-nothing"),ak=Symbol.for("immer-draftable"),XY=Symbol.for("immer-state");uD=Object.getPrototypeOf;yG4=Object.prototype.constructor.toString();MH1={};IH1={get(J,Q){if(Q===XY)return J;let Z=mD(J);if(!rk(Z,Q))return mG4(J,Z,Q);let Y=Z[Q];if(J.finalized_||!IF(Y))return Y;if(Y===BH1(J.base_,Q))return NH1(J),J.copy_[Q]=wH1(Y,J);return Y},has(J,Q){return Q in mD(J)},ownKeys(J){return Reflect.ownKeys(mD(J))},set(J,Q,Z){let Y=BD0(mD(J),Q);if(Y?.set)return Y.set.call(J.draft_,Z),!0;if(!J.modified_){let X=BH1(mD(J),Q),G=X?.[XY];if(G&&G.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(xG4(Z,X)&&(Z!==void 0||rk(J.base_,Q)))return!0;NH1(J),OH1(J)}if(J.copy_[Q]===Z&&(Z!==void 0||(Q in J.copy_))||Number.isNaN(Z)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Z,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(BH1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,NH1(J),OH1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=mD(J),Y=Reflect.getOwnPropertyDescriptor(Z,Q);if(!Y)return Y;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:Y.enumerable,value:Z[Q]}},defineProperty(){_J(11)},getPrototypeOf(J){return uD(J.base_)},setPrototypeOf(){_J(12)}},tk={};ok(IH1,(J,Q)=>{tk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});tk.deleteProperty=function(J,Q){return tk.set.call(this,J,Q,void 0)};tk.set=function(J,Q,Z){return IH1.set.call(this,J[0],Q,Z,J[0])};$Y=new uG4,PF=$Y.produce,lD=$Y.produceWithPatches.bind($Y),vc8=$Y.setAutoFreeze.bind($Y),fc8=$Y.setUseStrictShallowCopy.bind($Y),DD0=$Y.applyPatches.bind($Y),hc8=$Y.createDraft.bind($Y),bc8=$Y.finishDraft.bind($Y)});function PH1({onlyFirst:J=!1}={}){let Z=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Z,J?void 0:"g")}function PE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(dG4,"")}var dG4;var Kn=N1(()=>{dG4=PH1()});var LD0=h((cc8,TH1)=>{var TF={};if(typeof TH1>"u")window.eastasianwidth=TF;else TH1.exports=TF;TF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Z=J.length==2?J.charCodeAt(1):0,Y=Q;if(55296<=Q&&Q<=56319&&(56320<=Z&&Z<=57343))Q&=1023,Z&=1023,Y=Q<<10|Z,Y+=65536;if(Y==12288||65281<=Y&&Y<=65376||65504<=Y&&Y<=65510)return"F";if(Y==8361||65377<=Y&&Y<=65470||65474<=Y&&Y<=65479||65482<=Y&&Y<=65487||65490<=Y&&Y<=65495||65498<=Y&&Y<=65500||65512<=Y&&Y<=65518)return"H";if(4352<=Y&&Y<=4447||4515<=Y&&Y<=4519||4602<=Y&&Y<=4607||9001<=Y&&Y<=9002||11904<=Y&&Y<=11929||11931<=Y&&Y<=12019||12032<=Y&&Y<=12245||12272<=Y&&Y<=12283||12289<=Y&&Y<=12350||12353<=Y&&Y<=12438||12441<=Y&&Y<=12543||12549<=Y&&Y<=12589||12593<=Y&&Y<=12686||12688<=Y&&Y<=12730||12736<=Y&&Y<=12771||12784<=Y&&Y<=12830||12832<=Y&&Y<=12871||12880<=Y&&Y<=13054||13056<=Y&&Y<=19903||19968<=Y&&Y<=42124||42128<=Y&&Y<=42182||43360<=Y&&Y<=43388||44032<=Y&&Y<=55203||55216<=Y&&Y<=55238||55243<=Y&&Y<=55291||63744<=Y&&Y<=64255||65040<=Y&&Y<=65049||65072<=Y&&Y<=65106||65108<=Y&&Y<=65126||65128<=Y&&Y<=65131||110592<=Y&&Y<=110593||127488<=Y&&Y<=127490||127504<=Y&&Y<=127546||127552<=Y&&Y<=127560||127568<=Y&&Y<=127569||131072<=Y&&Y<=194367||177984<=Y&&Y<=196605||196608<=Y&&Y<=262141)return"W";if(32<=Y&&Y<=126||162<=Y&&Y<=163||165<=Y&&Y<=166||Y==172||Y==175||10214<=Y&&Y<=10221||10629<=Y&&Y<=10630)return"Na";if(Y==161||Y==164||167<=Y&&Y<=168||Y==170||173<=Y&&Y<=174||176<=Y&&Y<=180||182<=Y&&Y<=186||188<=Y&&Y<=191||Y==198||Y==208||215<=Y&&Y<=216||222<=Y&&Y<=225||Y==230||232<=Y&&Y<=234||236<=Y&&Y<=237||Y==240||242<=Y&&Y<=243||247<=Y&&Y<=250||Y==252||Y==254||Y==257||Y==273||Y==275||Y==283||294<=Y&&Y<=295||Y==299||305<=Y&&Y<=307||Y==312||319<=Y&&Y<=322||Y==324||328<=Y&&Y<=331||Y==333||338<=Y&&Y<=339||358<=Y&&Y<=359||Y==363||Y==462||Y==464||Y==466||Y==468||Y==470||Y==472||Y==474||Y==476||Y==593||Y==609||Y==708||Y==711||713<=Y&&Y<=715||Y==717||Y==720||728<=Y&&Y<=731||Y==733||Y==735||768<=Y&&Y<=879||913<=Y&&Y<=929||931<=Y&&Y<=937||945<=Y&&Y<=961||963<=Y&&Y<=969||Y==1025||1040<=Y&&Y<=1103||Y==1105||Y==8208||8211<=Y&&Y<=8214||8216<=Y&&Y<=8217||8220<=Y&&Y<=8221||8224<=Y&&Y<=8226||8228<=Y&&Y<=8231||Y==8240||8242<=Y&&Y<=8243||Y==8245||Y==8251||Y==8254||Y==8308||Y==8319||8321<=Y&&Y<=8324||Y==8364||Y==8451||Y==8453||Y==8457||Y==8467||Y==8470||8481<=Y&&Y<=8482||Y==8486||Y==8491||8531<=Y&&Y<=8532||8539<=Y&&Y<=8542||8544<=Y&&Y<=8555||8560<=Y&&Y<=8569||Y==8585||8592<=Y&&Y<=8601||8632<=Y&&Y<=8633||Y==8658||Y==8660||Y==8679||Y==8704||8706<=Y&&Y<=8707||8711<=Y&&Y<=8712||Y==8715||Y==8719||Y==8721||Y==8725||Y==8730||8733<=Y&&Y<=8736||Y==8739||Y==8741||8743<=Y&&Y<=8748||Y==8750||8756<=Y&&Y<=8759||8764<=Y&&Y<=8765||Y==8776||Y==8780||Y==8786||8800<=Y&&Y<=8801||8804<=Y&&Y<=8807||8810<=Y&&Y<=8811||8814<=Y&&Y<=8815||8834<=Y&&Y<=8835||8838<=Y&&Y<=8839||Y==8853||Y==8857||Y==8869||Y==8895||Y==8978||9312<=Y&&Y<=9449||9451<=Y&&Y<=9547||9552<=Y&&Y<=9587||9600<=Y&&Y<=9615||9618<=Y&&Y<=9621||9632<=Y&&Y<=9633||9635<=Y&&Y<=9641||9650<=Y&&Y<=9651||9654<=Y&&Y<=9655||9660<=Y&&Y<=9661||9664<=Y&&Y<=9665||9670<=Y&&Y<=9672||Y==9675||9678<=Y&&Y<=9681||9698<=Y&&Y<=9701||Y==9711||9733<=Y&&Y<=9734||Y==9737||9742<=Y&&Y<=9743||9748<=Y&&Y<=9749||Y==9756||Y==9758||Y==9792||Y==9794||9824<=Y&&Y<=9825||9827<=Y&&Y<=9829||9831<=Y&&Y<=9834||9836<=Y&&Y<=9837||Y==9839||9886<=Y&&Y<=9887||9918<=Y&&Y<=9919||9924<=Y&&Y<=9933||9935<=Y&&Y<=9953||Y==9955||9960<=Y&&Y<=9983||Y==10045||Y==10071||10102<=Y&&Y<=10111||11093<=Y&&Y<=11097||12872<=Y&&Y<=12879||57344<=Y&&Y<=63743||65024<=Y&&Y<=65039||Y==65533||127232<=Y&&Y<=127242||127248<=Y&&Y<=127277||127280<=Y&&Y<=127337||127344<=Y&&Y<=127386||917760<=Y&&Y<=917999||983040<=Y&&Y<=1048573||1048576<=Y&&Y<=1114109)return"A";return"N"};TF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function MD0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}TF.length=function(J){var Q=MD0(J),Z=0;for(var Y=0;Y<Q.length;Y++)Z=Z+this.characterLength(Q[Y]);return Z};TF.slice=function(J,Q,Z){if(textLen=TF.length(J),Q=Q?Q:0,Z=Z?Z:1,Q<0)Q=textLen+Q;if(Z<0)Z=textLen+Z;var Y="",X=0,G=MD0(J);for(var V=0;V<G.length;V++){var K=G[V],q=TF.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Z)Y+=K;else break;X+=q}return Y}});var RH1=h((lc8,AD0)=>{AD0.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var cG4,lG4;var OD0=N1(()=>{Kn();cG4=W6(LD0(),1),lG4=W6(RH1(),1)});function qn(J,Q,Z="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Z.length))+Z}var CH1=N1(()=>{OD0()});var wD0="run_terminal_command",jH1="read_file",b2="Task",i8="finder",HZ="get_diagnostics",U5="Bash",B5="oracle",UK="mermaid",BK="todo_read",i5="todo_write",P3="read_web_page",TE="read_thread",RE="find_thread",P5="create_file",p3="glob",Wn="undo_edit",Hn="read_mcp_resource",i6="Read",Y7="edit_file",CE="format_file",B2="web_search",E8="Grep",iD="Check",VY="librarian",zn="kraken",ED0="look_at",ID0="read_artifact",PD0="edit_artifact",Fn="read_plan",jE="edit_plan",Un="read_github",Bn="search_github",Nn="commit_search",Dn="list_directory_github",Mn="list_repositories",Ln="glob_github",An="diff",TD0="bookkeeper",RD0="describe_workbook",CD0="execute_query",Qy="skill",jD0;var M4=N1(()=>{jD0=["Task","finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","bookkeeper","read_thread","find_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Zy=h((tc8,_D0)=>{var SD0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},iG4={...SD0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nG4={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_D0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nG4,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?iG4:SD0}}});var Yy=h((tG4)=>{var{REGEX_BACKSLASH:aG4,REGEX_REMOVE_BACKSLASH:oG4,REGEX_SPECIAL_CHARS:rG4,REGEX_SPECIAL_CHARS_GLOBAL:sG4}=Zy();tG4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tG4.hasRegexChars=(J)=>rG4.test(J);tG4.isRegexChar=(J)=>J.length===1&&tG4.hasRegexChars(J);tG4.escapeRegex=(J)=>J.replace(sG4,"\\$1");tG4.toPosixSlashes=(J)=>J.replace(aG4,"/");tG4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};tG4.removeBackslashes=(J)=>{return J.replace(oG4,(Q)=>{return Q==="\\"?"":Q})};tG4.escapeLast=(J,Q,Z)=>{let Y=J.lastIndexOf(Q,Z);if(Y===-1)return J;if(J[Y-1]==="\\")return tG4.escapeLast(J,Q,Y-1);return`${J.slice(0,Y)}\\${J.slice(Y)}`};tG4.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};tG4.wrapOutput=(J,Q={},Z={})=>{let Y=Z.contains?"":"^",X=Z.contains?"":"$",G=`${Y}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};tG4.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),Y=Z[Z.length-1];if(Y==="")return Z[Z.length-2];return Y}});var uD0=h((Jl8,mD0)=>{var xD0=Yy(),{CHAR_ASTERISK:SH1,CHAR_AT:KV4,CHAR_BACKWARD_SLASH:Xy,CHAR_COMMA:qV4,CHAR_DOT:_H1,CHAR_EXCLAMATION_MARK:kH1,CHAR_FORWARD_SLASH:gD0,CHAR_LEFT_CURLY_BRACE:yH1,CHAR_LEFT_PARENTHESES:xH1,CHAR_LEFT_SQUARE_BRACKET:WV4,CHAR_PLUS:HV4,CHAR_QUESTION_MARK:vD0,CHAR_RIGHT_CURLY_BRACE:zV4,CHAR_RIGHT_PARENTHESES:fD0,CHAR_RIGHT_SQUARE_BRACKET:FV4}=Zy(),hD0=(J)=>{return J===gD0||J===Xy},bD0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},UV4=(J,Q)=>{let Z=Q||{},Y=J.length-1,X=Z.parts===!0||Z.scanToEnd===!0,G=[],V=[],K=[],q=J,W=-1,H=0,z=0,U=!1,D=!1,M=!1,L=!1,A=!1,E=!1,I=!1,P=!1,C=!1,k=!1,y=0,v,b,d={value:"",depth:0,isGlob:!1},m=()=>W>=Y,n=()=>q.charCodeAt(W+1),$1=()=>{return v=b,q.charCodeAt(++W)};while(W<Y){b=$1();let q1;if(b===Xy){if(I=d.backslashes=!0,b=$1(),b===yH1)E=!0;continue}if(E===!0||b===yH1){y++;while(m()!==!0&&(b=$1())){if(b===Xy){I=d.backslashes=!0,$1();continue}if(b===yH1){y++;continue}if(E!==!0&&b===_H1&&(b=$1())===_H1){if(U=d.isBrace=!0,M=d.isGlob=!0,k=!0,X===!0)continue;break}if(E!==!0&&b===qV4){if(U=d.isBrace=!0,M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===zV4){if(y--,y===0){E=!1,U=d.isBrace=!0,k=!0;break}}}if(X===!0)continue;break}if(b===gD0){if(G.push(W),V.push(d),d={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_H1&&W===H+1){H+=2;continue}z=W+1;continue}if(Z.noext!==!0){if((b===HV4||b===KV4||b===SH1||b===vD0||b===kH1)===!0&&n()===xH1){if(M=d.isGlob=!0,L=d.isExtglob=!0,k=!0,b===kH1&&W===H)C=!0;if(X===!0){while(m()!==!0&&(b=$1())){if(b===Xy){I=d.backslashes=!0,b=$1();continue}if(b===fD0){M=d.isGlob=!0,k=!0;break}}continue}break}}if(b===SH1){if(v===SH1)A=d.isGlobstar=!0;if(M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===vD0){if(M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===WV4){while(m()!==!0&&(q1=$1())){if(q1===Xy){I=d.backslashes=!0,$1();continue}if(q1===FV4){D=d.isBracket=!0,M=d.isGlob=!0,k=!0;break}}if(X===!0)continue;break}if(Z.nonegate!==!0&&b===kH1&&W===H){P=d.negated=!0,H++;continue}if(Z.noparen!==!0&&b===xH1){if(M=d.isGlob=!0,X===!0){while(m()!==!0&&(b=$1())){if(b===xH1){I=d.backslashes=!0,b=$1();continue}if(b===fD0){k=!0;break}}continue}break}if(M===!0){if(k=!0,X===!0)continue;break}}if(Z.noext===!0)L=!1,M=!1;let t=q,p="",e="";if(H>0)p=q.slice(0,H),q=q.slice(H),z-=H;if(t&&M===!0&&z>0)t=q.slice(0,z),e=q.slice(z);else if(M===!0)t="",e=q;else t=q;if(t&&t!==""&&t!=="/"&&t!==q){if(hD0(t.charCodeAt(t.length-1)))t=t.slice(0,-1)}if(Z.unescape===!0){if(e)e=xD0.removeBackslashes(e);if(t&&I===!0)t=xD0.removeBackslashes(t)}let F1={prefix:p,input:J,start:H,base:t,glob:e,isBrace:U,isBracket:D,isGlob:M,isExtglob:L,isGlobstar:A,negated:P,negatedExtglob:C};if(Z.tokens===!0){if(F1.maxDepth=0,!hD0(b))V.push(d);F1.tokens=V}if(Z.parts===!0||Z.tokens===!0){let q1;for(let o=0;o<G.length;o++){let r=q1?q1+1:H,l=G[o],W1=J.slice(r,l);if(Z.tokens){if(o===0&&H!==0)V[o].isPrefix=!0,V[o].value=p;else V[o].value=W1;bD0(V[o]),F1.maxDepth+=V[o].depth}if(o!==0||W1!=="")K.push(W1);q1=l}if(q1&&q1+1<J.length){let o=J.slice(q1+1);if(K.push(o),Z.tokens)V[V.length-1].value=o,bD0(V[V.length-1]),F1.maxDepth+=V[V.length-1].depth}F1.slashes=G,F1.parts=K}return F1};mD0.exports=UV4});var cD0=h((Ql8,dD0)=>{var On=Zy(),NK=Yy(),{MAX_LENGTH:wn,POSIX_REGEX_SOURCE:BV4,REGEX_NON_SPECIAL_CHARS:NV4,REGEX_SPECIAL_CHARS_BACKREF:DV4,REPLACEMENTS:pD0}=On,MV4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Z=`[${J.join("-")}]`;try{new RegExp(Z)}catch(Y){return J.map((X)=>NK.escapeRegex(X)).join("..")}return Z},SE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},vH1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=pD0[J]||J;let Z={...Q},Y=typeof Z.maxLength==="number"?Math.min(wn,Z.maxLength):wn,X=J.length;if(X>Y)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Y}`);let G={type:"bos",value:"",output:Z.prepend||""},V=[G],K=Z.capture?"":"?:",q=On.globChars(Z.windows),W=On.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:D,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:I,QMARK_NO_DOT:P,STAR:C,START_ANCHOR:k}=q,y=(r1)=>{return`(${K}(?:(?!${k}${r1.dot?M:H}).)*?)`},v=Z.dot?"":L,b=Z.dot?I:P,d=Z.bash===!0?y(Z):C;if(Z.capture)d=`(${d})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let m={input:J,index:-1,start:0,dot:Z.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};J=NK.removePrefix(J,m),X=J.length;let n=[],$1=[],t=[],p=G,e,F1=()=>m.index===X-1,q1=m.peek=(r1=1)=>J[m.index+r1],o=m.advance=()=>J[++m.index]||"",r=()=>J.slice(m.index+1),l=(r1="",z1=0)=>{m.consumed+=r1,m.index+=z1},W1=(r1)=>{m.output+=r1.output!=null?r1.output:r1.value,l(r1.value)},_1=()=>{let r1=1;while(q1()==="!"&&(q1(2)!=="("||q1(3)==="?"))o(),m.start++,r1++;if(r1%2===0)return!1;return m.negated=!0,m.start++,!0},s=(r1)=>{m[r1]++,t.push(r1)},u1=(r1)=>{m[r1]--,t.pop()},j1=(r1)=>{if(p.type==="globstar"){let z1=m.braces>0&&(r1.type==="comma"||r1.type==="brace"),Z1=r1.extglob===!0||n.length&&(r1.type==="pipe"||r1.type==="paren");if(r1.type!=="slash"&&r1.type!=="paren"&&!z1&&!Z1)m.output=m.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=d,m.output+=p.output}if(n.length&&r1.type!=="paren")n[n.length-1].inner+=r1.value;if(r1.value||r1.output)W1(r1);if(p&&p.type==="text"&&r1.type==="text"){p.output=(p.output||p.value)+r1.value,p.value+=r1.value;return}r1.prev=p,V.push(r1),p=r1},R0=(r1,z1)=>{let Z1={...W[z1],conditions:1,inner:""};Z1.prev=p,Z1.parens=m.parens,Z1.output=m.output;let O1=(Z.capture?"(":"")+Z1.open;s("parens"),j1({type:r1,value:z1,output:m.output?"":D}),j1({type:"paren",extglob:!0,value:o(),output:O1}),n.push(Z1)},C1=(r1)=>{let z1=r1.close+(Z.capture?")":""),Z1;if(r1.type==="negate"){let O1=d;if(r1.inner&&r1.inner.length>1&&r1.inner.includes("/"))O1=y(Z);if(O1!==d||F1()||/^\)+$/.test(r()))z1=r1.close=`)$))${O1}`;if(r1.inner.includes("*")&&(Z1=r())&&/^\.[^\\/.]+$/.test(Z1)){let A1=vH1(Z1,{...Q,fastpaths:!1}).output;z1=r1.close=`)${A1})${O1})`}if(r1.prev.type==="bos")m.negatedExtglob=!0}j1({type:"paren",extglob:!0,value:e,output:z1}),u1("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let r1=!1,z1=J.replace(DV4,(Z1,O1,A1,T1,S1,c1)=>{if(T1==="\\")return r1=!0,Z1;if(T1==="?"){if(O1)return O1+T1+(S1?I.repeat(S1.length):"");if(c1===0)return b+(S1?I.repeat(S1.length):"");return I.repeat(A1.length)}if(T1===".")return H.repeat(A1.length);if(T1==="*"){if(O1)return O1+T1+(S1?d:"");return d}return O1?Z1:`\\${Z1}`});if(r1===!0)if(Z.unescape===!0)z1=z1.replace(/\\/g,"");else z1=z1.replace(/\\+/g,(Z1)=>{return Z1.length%2===0?"\\\\":Z1?"\\":""});if(z1===J&&Z.contains===!0)return m.output=J,m;return m.output=NK.wrapOutput(z1,m,Q),m}while(!F1()){if(e=o(),e==="\x00")continue;if(e==="\\"){let Z1=q1();if(Z1==="/"&&Z.bash!==!0)continue;if(Z1==="."||Z1===";")continue;if(!Z1){e+="\\",j1({type:"text",value:e});continue}let O1=/^\\+/.exec(r()),A1=0;if(O1&&O1[0].length>2){if(A1=O1[0].length,m.index+=A1,A1%2!==0)e+="\\"}if(Z.unescape===!0)e=o();else e+=o();if(m.brackets===0){j1({type:"text",value:e});continue}}if(m.brackets>0&&(e!=="]"||p.value==="["||p.value==="[^")){if(Z.posix!==!1&&e===":"){let Z1=p.value.slice(1);if(Z1.includes("[")){if(p.posix=!0,Z1.includes(":")){let O1=p.value.lastIndexOf("["),A1=p.value.slice(0,O1),T1=p.value.slice(O1+2),S1=BV4[T1];if(S1){if(p.value=A1+S1,m.backtrack=!0,o(),!G.output&&V.indexOf(p)===1)G.output=D;continue}}}}if(e==="["&&q1()!==":"||e==="-"&&q1()==="]")e=`\\${e}`;if(e==="]"&&(p.value==="["||p.value==="[^"))e=`\\${e}`;if(Z.posix===!0&&e==="!"&&p.value==="[")e="^";p.value+=e,W1({value:e});continue}if(m.quotes===1&&e!=='"'){e=NK.escapeRegex(e),p.value+=e,W1({value:e});continue}if(e==='"'){if(m.quotes=m.quotes===1?0:1,Z.keepQuotes===!0)j1({type:"text",value:e});continue}if(e==="("){s("parens"),j1({type:"paren",value:e});continue}if(e===")"){if(m.parens===0&&Z.strictBrackets===!0)throw SyntaxError(SE("opening","("));let Z1=n[n.length-1];if(Z1&&m.parens===Z1.parens+1){C1(n.pop());continue}j1({type:"paren",value:e,output:m.parens?")":"\\)"}),u1("parens");continue}if(e==="["){if(Z.nobracket===!0||!r().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw SyntaxError(SE("closing","]"));e=`\\${e}`}else s("brackets");j1({type:"bracket",value:e});continue}if(e==="]"){if(Z.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){j1({type:"text",value:e,output:`\\${e}`});continue}if(m.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(SE("opening","["));j1({type:"text",value:e,output:`\\${e}`});continue}u1("brackets");let Z1=p.value.slice(1);if(p.posix!==!0&&Z1[0]==="^"&&!Z1.includes("/"))e=`/${e}`;if(p.value+=e,W1({value:e}),Z.literalBrackets===!1||NK.hasRegexChars(Z1))continue;let O1=NK.escapeRegex(p.value);if(m.output=m.output.slice(0,-p.value.length),Z.literalBrackets===!0){m.output+=O1,p.value=O1;continue}p.value=`(${K}${O1}|${p.value})`,m.output+=p.value;continue}if(e==="{"&&Z.nobrace!==!0){s("braces");let Z1={type:"brace",value:e,output:"(",outputIndex:m.output.length,tokensIndex:m.tokens.length};$1.push(Z1),j1(Z1);continue}if(e==="}"){let Z1=$1[$1.length-1];if(Z.nobrace===!0||!Z1){j1({type:"text",value:e,output:e});continue}let O1=")";if(Z1.dots===!0){let A1=V.slice(),T1=[];for(let S1=A1.length-1;S1>=0;S1--){if(V.pop(),A1[S1].type==="brace")break;if(A1[S1].type!=="dots")T1.unshift(A1[S1].value)}O1=MV4(T1,Z),m.backtrack=!0}if(Z1.comma!==!0&&Z1.dots!==!0){let A1=m.output.slice(0,Z1.outputIndex),T1=m.tokens.slice(Z1.tokensIndex);Z1.value=Z1.output="\\{",e=O1="\\}",m.output=A1;for(let S1 of T1)m.output+=S1.output||S1.value}j1({type:"brace",value:e,output:O1}),u1("braces"),$1.pop();continue}if(e==="|"){if(n.length>0)n[n.length-1].conditions++;j1({type:"text",value:e});continue}if(e===","){let Z1=e,O1=$1[$1.length-1];if(O1&&t[t.length-1]==="braces")O1.comma=!0,Z1="|";j1({type:"comma",value:e,output:Z1});continue}if(e==="/"){if(p.type==="dot"&&m.index===m.start+1){m.start=m.index+1,m.consumed="",m.output="",V.pop(),p=G;continue}j1({type:"slash",value:e,output:U});continue}if(e==="."){if(m.braces>0&&p.type==="dot"){if(p.value===".")p.output=H;let Z1=$1[$1.length-1];p.type="dots",p.output+=e,p.value+=e,Z1.dots=!0;continue}if(m.braces+m.parens===0&&p.type!=="bos"&&p.type!=="slash"){j1({type:"text",value:e,output:H});continue}j1({type:"dot",value:e,output:H});continue}if(e==="?"){if(!(p&&p.value==="(")&&Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){R0("qmark",e);continue}if(p&&p.type==="paren"){let O1=q1(),A1=e;if(p.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(r()))A1=`\\${e}`;j1({type:"text",value:e,output:A1});continue}if(Z.dot!==!0&&(p.type==="slash"||p.type==="bos")){j1({type:"qmark",value:e,output:P});continue}j1({type:"qmark",value:e,output:I});continue}if(e==="!"){if(Z.noextglob!==!0&&q1()==="("){if(q1(2)!=="?"||!/[!=<:]/.test(q1(3))){R0("negate",e);continue}}if(Z.nonegate!==!0&&m.index===0){_1();continue}}if(e==="+"){if(Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){R0("plus",e);continue}if(p&&p.value==="("||Z.regex===!1){j1({type:"plus",value:e,output:z});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||m.parens>0){j1({type:"plus",value:e});continue}j1({type:"plus",value:z});continue}if(e==="@"){if(Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){j1({type:"at",extglob:!0,value:e,output:""});continue}j1({type:"text",value:e});continue}if(e!=="*"){if(e==="$"||e==="^")e=`\\${e}`;let Z1=NV4.exec(r());if(Z1)e+=Z1[0],m.index+=Z1[0].length;j1({type:"text",value:e});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=e,p.output=d,m.backtrack=!0,m.globstar=!0,l(e);continue}let r1=r();if(Z.noextglob!==!0&&/^\([^?]/.test(r1)){R0("star",e);continue}if(p.type==="star"){if(Z.noglobstar===!0){l(e);continue}let Z1=p.prev,O1=Z1.prev,A1=Z1.type==="slash"||Z1.type==="bos",T1=O1&&(O1.type==="star"||O1.type==="globstar");if(Z.bash===!0&&(!A1||r1[0]&&r1[0]!=="/")){j1({type:"star",value:e,output:""});continue}let S1=m.braces>0&&(Z1.type==="comma"||Z1.type==="brace"),c1=n.length&&(Z1.type==="pipe"||Z1.type==="paren");if(!A1&&Z1.type!=="paren"&&!S1&&!c1){j1({type:"star",value:e,output:""});continue}while(r1.slice(0,3)==="/**"){let g1=J[m.index+4];if(g1&&g1!=="/")break;r1=r1.slice(3),l("/**",3)}if(Z1.type==="bos"&&F1()){p.type="globstar",p.value+=e,p.output=y(Z),m.output=p.output,m.globstar=!0,l(e);continue}if(Z1.type==="slash"&&Z1.prev.type!=="bos"&&!T1&&F1()){m.output=m.output.slice(0,-(Z1.output+p.output).length),Z1.output=`(?:${Z1.output}`,p.type="globstar",p.output=y(Z)+(Z.strictSlashes?")":"|$)"),p.value+=e,m.globstar=!0,m.output+=Z1.output+p.output,l(e);continue}if(Z1.type==="slash"&&Z1.prev.type!=="bos"&&r1[0]==="/"){let g1=r1[1]!==void 0?"|$":"";m.output=m.output.slice(0,-(Z1.output+p.output).length),Z1.output=`(?:${Z1.output}`,p.type="globstar",p.output=`${y(Z)}${U}|${U}${g1})`,p.value+=e,m.output+=Z1.output+p.output,m.globstar=!0,l(e+o()),j1({type:"slash",value:"/",output:""});continue}if(Z1.type==="bos"&&r1[0]==="/"){p.type="globstar",p.value+=e,p.output=`(?:^|${U}|${y(Z)}${U})`,m.output=p.output,m.globstar=!0,l(e+o()),j1({type:"slash",value:"/",output:""});continue}m.output=m.output.slice(0,-p.output.length),p.type="globstar",p.output=y(Z),p.value+=e,m.output+=p.output,m.globstar=!0,l(e);continue}let z1={type:"star",value:e,output:d};if(Z.bash===!0){if(z1.output=".*?",p.type==="bos"||p.type==="slash")z1.output=v+z1.output;j1(z1);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&Z.regex===!0){z1.output=e,j1(z1);continue}if(m.index===m.start||p.type==="slash"||p.type==="dot"){if(p.type==="dot")m.output+=A,p.output+=A;else if(Z.dot===!0)m.output+=E,p.output+=E;else m.output+=v,p.output+=v;if(q1()!=="*")m.output+=D,p.output+=D}j1(z1)}while(m.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing","]"));m.output=NK.escapeLast(m.output,"["),u1("brackets")}while(m.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing",")"));m.output=NK.escapeLast(m.output,"("),u1("parens")}while(m.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing","}"));m.output=NK.escapeLast(m.output,"{"),u1("braces")}if(Z.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket"))j1({type:"maybe_slash",value:"",output:`${U}?`});if(m.backtrack===!0){m.output="";for(let r1 of m.tokens)if(m.output+=r1.output!=null?r1.output:r1.value,r1.suffix)m.output+=r1.suffix}return m};vH1.fastpaths=(J,Q)=>{let Z={...Q},Y=typeof Z.maxLength==="number"?Math.min(wn,Z.maxLength):wn,X=J.length;if(X>Y)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Y}`);J=pD0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:D}=On.globChars(Z.windows),M=Z.dot?H:W,L=Z.dot?z:W,A=Z.capture?"":"?:",E={negated:!1,prefix:""},I=Z.bash===!0?".*?":U;if(Z.capture)I=`(${I})`;let P=(v)=>{if(v.noglobstar===!0)return I;return`(${A}(?:(?!${D}${v.dot?q:G}).)*?)`},C=(v)=>{switch(v){case"*":return`${M}${K}${I}`;case".*":return`${G}${K}${I}`;case"*.*":return`${M}${I}${G}${K}${I}`;case"*/*":return`${M}${I}${V}${K}${L}${I}`;case"**":return M+P(Z);case"**/*":return`(?:${M}${P(Z)}${V})?${L}${K}${I}`;case"**/*.*":return`(?:${M}${P(Z)}${V})?${L}${I}${G}${K}${I}`;case"**/.*":return`(?:${M}${P(Z)}${V})?${G}${K}${I}`;default:{let b=/^(.*?)\.(\w+)$/.exec(v);if(!b)return;let d=C(b[1]);if(!d)return;return d+G+b[2]}}},k=NK.removePrefix(J,E),y=C(k);if(y&&Z.strictSlashes!==!0)y+=`${V}?`;return y};dD0.exports=vH1});var $y=h((Zl8,iD0)=>{var LV4=uD0(),fH1=cD0(),lD0=Yy(),AV4=Zy(),OV4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),Q3=(J,Q,Z=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>Q3(U,Q,Z));return(U)=>{for(let D of H){let M=D(U);if(M)return M}return!1}}let Y=OV4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!Y)throw TypeError("Expected pattern to be a non-empty string");let X=Q||{},G=X.windows,V=Y?Q3.compileRe(J,Q):Q3.makeRe(J,Q,!1,!0),K=V.state;delete V.state;let q=()=>!1;if(X.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};q=Q3(X.ignore,H,Z)}let W=(H,z=!1)=>{let{isMatch:U,match:D,output:M}=Q3.test(H,V,Q,{glob:J,posix:G}),L={glob:J,state:K,regex:V,posix:G,input:H,output:M,match:D,isMatch:U};if(typeof X.onResult==="function")X.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof X.onMatch==="function")X.onMatch(L);return z?L:!0};if(Z)W.state=K;return W};Q3.test=(J,Q,Z,{glob:Y,posix:X}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let G=Z||{},V=G.format||(X?lD0.toPosixSlashes:null),K=J===Y,q=K&&V?V(J):J;if(K===!1)q=V?V(J):J,K=q===Y;if(K===!1||G.capture===!0)if(G.matchBase===!0||G.basename===!0)K=Q3.matchBase(J,Q,Z,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};Q3.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:Q3.makeRe(Q,Z)).test(lD0.basename(J))};Q3.isMatch=(J,Q,Z)=>Q3(Q,Z)(J);Q3.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>Q3.parse(Z,Q));return fH1(J,{...Q,fastpaths:!1})};Q3.scan=(J,Q)=>LV4(J,Q);Q3.compileRe=(J,Q,Z=!1,Y=!1)=>{if(Z===!0)return J.output;let X=Q||{},G=X.contains?"":"^",V=X.contains?"":"$",K=`${G}(?:${J.output})${V}`;if(J&&J.negated===!0)K=`^(?!${K}).*$`;let q=Q3.toRegex(K,Q);if(Y===!0)q.state=J;return q};Q3.makeRe=(J,Q={},Z=!1,Y=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let X={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))X.output=fH1.fastpaths(J,Q);if(!X.output)X=fH1(J,Q);return Q3.compileRe(X,Q,Z,Y)};Q3.toRegex=(J,Q)=>{try{let Z=Q||{};return new RegExp(J,Z.flags||(Z.nocase?"i":""))}catch(Z){if(Q&&Q.debug===!0)throw Z;return/$^/}};Q3.constants=AV4;iD0.exports=Q3});var nD=h((Yl8,oD0)=>{var nD0=$y(),wV4=Yy();function aD0(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:wV4.isWindows()};return nD0(J,Q,Z)}Object.assign(aD0,nD0);oD0.exports=aD0});var _E;var hH1=N1(()=>{_E={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && pnpm run -s _build:web","build:production":"pnpm run -s _build:extension:production && pnpm run -s _build:web:production","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team",email:"amp-devs@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.guidanceFilesInContext":{type:"boolean",default:!0,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3",zod:"catalog:"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function IV4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function sD0(J){let Q=J.settings["tools.inactivityTimeout"],Z=J.settings["tools.stopTimeout"],Y=Q;if(Y===void 0&&Z!==void 0)Y=Z;if(Y===void 0)Y=_E.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!IV4(Y))return null;return Y*1000}function tD0(J){let Q=J.settings["tools.stopTimeout"],Z=_E.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var rD0;var En=N1(()=>{hH1();rD0=_E.contributes.configuration.properties});function d3(J){let Q=I8[J];return`${Q.provider}/${Q.name}`}function zZ(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Z=J.slice(0,Q),Y=J.slice(Q+1);for(let X of Object.values(I8))if(X.provider===Z&&X.name===Y)return X;switch(Z){case"anthropic":return I8.CLAUDE_SONNET_4_5;case"openai":return I8.GPT_5;case"xai":return I8.GROK_CODE_FAST_1;case"cerebras":return I8.Z_AI_GLM_4_6;case"fireworks":return I8.FIREWORKS_GLM_4P6;case"moonshotai":return I8.KIMI_K2_INSTRUCT;case"openrouter":return I8.SONOMA_SKY_ALPHA;case"groq":return I8.GPT_OSS_120B;case"vertexai":return I8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Z}`)}}function eD0(J){for(let Q of Object.values(I8))if(Q.name===J)return Q;return}function LQ(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function MG(J,Q){let Z=zZ(J);if(Q&&Z.maxInputTokensInFreeMode)return Z.maxInputTokensInFreeMode;return Z.contextWindow-Z.maxOutputTokens}function JM0(J,Q){if(!Q?.pricing?.cached||!Q.pricing.cacheWrite)return 0;let Z=Q.pricing.cacheWrite/1e6,Y=Q.pricing.cached/1e6;return J*(Z-Y)}function QM0(J){return J?.pricing?.cacheTTL??300}var F9,I8,bH1;var KY=N1(()=>{F9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},I8={CLAUDE_SONNET_4:{provider:F9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:F9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:F9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:F9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:F9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:F9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:F9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:F9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:F9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:F9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:F9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:F9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:F9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:F9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:F9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:F9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:F9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:F9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:F9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:F9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,freeTierEligible:!0,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:F9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:F9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:F9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:F9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:F9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:F9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};bH1={FINDER:"finder"}});function gH1(J,Q){let Z=DK(Q);if(!Z)return!1;if(PV4.has(J)){let Y=Z.finder??bH1.FINDER,X=TV4[Y];if(J!==X)return!1}if(Z.includeTools)return Z.includeTools.includes(J);return!0}function _X(J,Q){let Z=J?.["internal.visibleModes"]??[];return Object.values(kE).filter((Y)=>{if(Z.includes(`!${Y.key}`))return!1;if(Q===!1&&d9(Y.key))return!1;let G="visible"in Y?Y.visible:!1,V=Z.includes(Y.key),K=Y.key==="plan"&&J?.["experimental.planMode"]===!0,q=J?.["experimental.dojoMode"]===!0;if(Y.key==="free-dojo")return q&&(Q===!0||Q===void 0);if(Y.key==="dojo")return q&&(Q===!1||Q===void 0);return G||V||K}).map((Y)=>({mode:Y.key,description:"description"in Y?Y.description:void 0})).sort((Y,X)=>Y.mode.localeCompare(X.mode))}function DK(J){return Object.values(kE).find((Q)=>Q.key===J)}function aD(J){return DK(J)?.primaryModel??d3("CLAUDE_SONNET_4_5")}function Gy(J){let Q=DK(J);if(!Q)return!1;return zZ(Q.primaryModel).capabilities?.vision??!1}function d9(J){return J==="free"||J.startsWith("free-")}function mH1(J,Q){return Q.find((Z)=>Z.mode===J)?.description}function uH1(J,Q){let Y=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Y]?.mode??"smart"}var PV4,TV4,YM0,XM0,RV4,CV4,ZM0,jV4,SV4,kE,_V4;var LG=N1(()=>{KY();PV4=new Set(["finder"]),TV4={finder:"finder"},YM0={r:0,g:55,b:0},XM0={r:0,g:255,b:136},RV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],CV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at"],ZM0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],jV4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","read_thread","web_search","read_web_page"],SV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","code_review"],kE={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:d3("CLAUDE_OPUS_4_5"),includeTools:SV4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:RV4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:CV4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:d3("GPT_5_1_CODEX"),includeTools:jV4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:ZM0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:d3("CLAUDE_SONNET_4_5"),includeTools:ZM0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},_V4=Object.values(kE).map((J)=>J.key)});function In(J,Q,Z){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let Y="subagentType"in Q?Q.subagentType:void 0;if(Y&&Z){if(!Z.subagentTypes)return!1;return Z.subagentTypes.includes("all")||Z.subagentTypes.includes(Y)}return!0}return Q.includeTools.includes(J)}var kV4,yV4,pH1,xV4,vV4,fV4,hV4,bV4,k7,Hl8;var MK=N1(()=>{KY();kV4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],yV4=["Grep","glob","Read"],pH1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],xV4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],vV4=["Read","glob","Grep","enqueue_file_edit","fastmod"],fV4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],hV4=["describe_workbook","execute_query"],bV4=["Read","Grep","glob","web_search","read_web_page","Bash"],k7={finder:{key:"finder",displayName:"Finder",model:d3("CLAUDE_HAIKU_4_5"),includeTools:yV4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:d3("GPT_5_1"),includeTools:pH1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:d3("CLAUDE_HAIKU_4_5"),includeTools:kV4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:xV4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:d3("CLAUDE_HAIKU_4_5"),includeTools:vV4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:d3("CLAUDE_HAIKU_4_5"),includeTools:fV4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:d3("CLAUDE_HAIKU_4_5"),includeTools:hV4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:d3("CLAUDE_SONNET_4_5"),includeTools:bV4,allowMcp:!1,allowToolbox:!1}},Hl8=Object.keys(k7)});function $M0(J,Q){return new Q0((Z)=>{let Y=setTimeout(X,Q);function X(){Z.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function G(){if(Y)clearTimeout(Y);Y=setTimeout(X,Q)}let V=J.subscribe({next:(K)=>{G(),Z.next(K)},error:(K)=>{if(Y)clearTimeout(Y),Y=null;Z.error(K)},complete:()=>{if(Y)clearTimeout(Y),Y=null;Z.complete()}});return()=>{if(Y)clearTimeout(Y),Y=null;V.unsubscribe()}})}var GM0=N1(()=>{o0()});function X7(J,Q){let Z={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},Y=Q.modelCustomizations;if(Y){for(let X of Y)if(X.modelSelector.test(J))Z={...Z,name:X.name??Z.name,description:X.description??Z.description,inputSchema:X.inputSchema??Z.inputSchema,customizedForModel:!0}}return Z}function Z3(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function qM0(J){return["done","error","cancelled"].includes(J.status)}function dH1(J){return typeof J==="object"&&"key"in J}function Pn(J){let Q=[],Z=new u4,Y;function X(V,K){let q=Q.filter((W)=>W.spec.name===V);if(q.length===0){let W=V.toLowerCase();q=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of q)if(xE(W.spec,K).enabled)return W;return}function G(V,K,q){if(!V)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===V.name),H=W!==-1?Q[W]:void 0;if(V.source!=="builtin"&&H?.spec.source==="builtin")return x.warn("Ignoring external tool registration - builtin takes precedence",{toolName:V.name,externalSource:V.source}),{dispose:()=>{}};let D={spec:V,fn:Promise.resolve(K),preprocessArgs:q};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(V.source))Q[W]=D;else Q.push(D);return Z.next(),{dispose:()=>{let L=Q.indexOf(D);if(L!==-1)Q.splice(L,1),Z.next()}}}return J.configService.config.subscribe((V)=>{Y=V}),{registerTool({spec:V,fn:K,preprocessArgs:q}){if(!K)return gV4;return G(V,K,q)},tools:j8(J.configService.config,Z.pipe(S8(void 0))).pipe(Q6(([V])=>{return Q.map((K)=>({spec:K.spec,...xE(K.spec,V)})).sort((K,q)=>K.spec.name.localeCompare(q.spec.name))})),invokeTool(V,K,q){let W=performance.now(),H=()=>mV4.record(performance.now()-W,{toolName:V});if(V===lH1&&K.args&&"invalid_tool_name"in K.args&&typeof K.args.invalid_tool_name==="string"){yE.add(1,{toolName:V,error:"invalid"});let D=cH1(K.args.invalid_tool_name);return new Q0((M)=>{M.error(Error(D))})}let z=X(V,q.config);if(!z){let D=V.toLowerCase(),M=Q.filter((I)=>I.spec.name.toLowerCase()===D);if(M.length===0)return yE.add(1,{toolName:V,error:"not_found"}),new Q0((I)=>{I.error(Error(`tool ${JSON.stringify(V)} not found`))});let L=M[0],A=xE(L.spec,q.config);yE.add(1,{toolName:V,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new Q0((I)=>{I.error(Error(`tool ${JSON.stringify(V)} is disabled: ${E}`))})}let U=q.subagentSpec??q.agentMode;if(U&&!this.isToolAllowed(V,U)){yE.add(1,{toolName:V,error:"disabled"});let D=dH1(U)?U.displayName??U.key:`${U} mode`;return new Q0((M)=>{M.error(Error(`tool ${JSON.stringify(V)} is not allowed for ${D}`))})}if(q.thread.mainThreadID&&!q.subagentSpec&&!In(V,k7["task-subagent"]))return yE.add(1,{toolName:V,error:"disabled"}),new Q0((D)=>{D.error(Error(`tool ${JSON.stringify(V)} is not allowed for subagents`))});return yE.add(1,{toolName:V}),l6(()=>z.fn).pipe(T4((D)=>{let M=D(K,q);if(z.spec.meta?.disableTimeout)return M;return $M0(M,tD0(q.config))}),BG(()=>H()))},preprocessArgs(V,K,q){let W=X(V,q.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(K,q)}catch(z){x.error("preprocessArgs",{id:V,args:K,error:String(z)});return}},isToolAllowed(V,K){let q=Q.find((H)=>H.spec.name===V),W=q?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(dH1(K))return In(V,K,q?.spec.meta);return gH1(V,K)},getTools(V){return j8(J.configService.config,Z.pipe(S8(void 0))).pipe(Q6(([K])=>{return Q.filter((q)=>{let W=q.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(dH1(V))return In(q.spec.name,V,q.spec.meta);return gH1(q.spec.name,V)}).map((q)=>({spec:q.spec,...xE(q.spec,K)})).sort((q,W)=>q.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(V,K){if(K)return this.getTools(k7["task-subagent"]);return this.getTools(V)},getExecutionProfile(V){if(!Y)return;return X(V,Y)?.spec.executionProfile},dispose(){}}}function Vy(J,Q){for(let Z of Q){if(Z==="")continue;if(Z.length===1){if(Z==="*")return!0;if(Z===J)return!0;continue}if(J===Z)return!0;if(Z.includes("*")||Z.includes("?")||Z.includes("[")||Z.includes("{"))try{if(KM0.default(Z,{dot:!0})(J))return!0}catch(Y){continue}}return!1}function xE(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(Vy(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let Y=uV4(J.name);if(Y){if(J.source.mcp.replace(/[\s-]+/g,"_")===Y.server){if(Vy(Y.tool,Z))return{enabled:!1,disabledReason:"settings"};let G=`mcp__${J.source.mcp}__${Y.tool}`;if(Vy(G,Z))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Vy(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Vy(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===i5||J.name===BK){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function cH1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Ky.toString()}. Try again with a valid tool name.`}function uV4(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function iH1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var VM0,KM0,gV4,lH1="invalid_tool",Ky,WM0,yE,mV4;var A7=N1(()=>{o0();U0();En();LG();MK();GM0();M4();VM0=W6(k6(),1),KM0=W6(nD(),1);gV4={dispose(){}};Ky=/^[-a-zA-Z0-9_]{1,64}$/,WM0=VM0.metrics.getMeter("tool_service"),yE=WM0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),mV4=WM0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var NM0=h((UM0)=>{Object.defineProperty(UM0,"__esModule",{value:!0});UM0.calcSlices=UM0.applyPatch=UM0.calcPatch=UM0.lcs=UM0.diff=UM0.diff_core=void 0;function pV4(J,Q){let{b:Z,eq:Y,stack_base:X}=J,{i:G,N:V,j:K,M:q,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(V>0&&q>0){Z.fill(0,0,2*W);let z=V-q,U=V+q,D=U&1,M=G+V-1,L=K+q-1,A=(U+D)/2,E;Q:for(let I=0;I<=A;I++){let P=2*Math.max(0,I-q)-I,C=I-2*Math.max(0,I-V);for(let k=P;k<=C;k+=2){let y=Z[k-1-W*Math.floor((k-1)/W)],v=Z[k+1-W*Math.floor((k+1)/W)],b=k===-I||k!==I&&y<v?v:y+1,d=b-k,m=b,n=d;while(m<V&&n<q&&Y(G+m,K+n))m++,n++;if(Z[k-W*Math.floor(k/W)]=m,D===1&&(E=z-k)>=1-I&&E<I&&m+Z[W+E-W*Math.floor(E/W)]>=V)if(I>1||m!==b){X[H++]=G+m,X[H++]=V-m,X[H++]=K+n,X[H++]=q-n,V=b,q=d,W=2*(Math.min(V,q)+1);continue J}else break Q}for(let k=P;k<=C;k+=2){let y=Z[W+k-1-W*Math.floor((k-1)/W)],v=Z[W+k+1-W*Math.floor((k+1)/W)],b=k===-I||k!==I&&y<v?v:y+1,d=b-k,m=b,n=d;while(m<V&&n<q&&Y(M-m,L-n))m++,n++;if(Z[W+k-W*Math.floor(k/W)]=m,D===0&&(E=z-k)>=-I&&E<=I&&m+Z[E-W*Math.floor(E/W)]>=V)if(I>0||m!==b){X[H++]=G+V-b,X[H++]=b,X[H++]=K+q-d,X[H++]=d,V=V-m,q=q-n,W=2*(Math.min(V,q)+1);continue J}else break Q}}if(V===q)continue;if(q>V)G+=V,K+=V,q-=V,V=0;else G+=q,K+=q,V-=q,q=0;break}if(V+q!==0)if(J.pxe===G||J.pye===K)J.pxe=G+V,J.pye=K+q;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=G,J.pxe=G+V,J.pys=K,J.pye=K+q,z>=0)return J.i=G,J.N=V,J.j=K,J.M=q,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;q=X[--H],K=X[--H],V=X[--H],G=X[--H],W=2*(Math.min(V,q)+1),Q=0}}}class HM0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Z=pV4(J,this.c);if(this.c=Z,Z===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function zM0(J,Q,Z,Y,X){let G=(Math.min(Q,Y)+1)*2,V=Q+Y,K=new(V<256?Uint8Array:V<65536?Uint16Array:Uint32Array)(2*G);return new HM0({i:J,N:Q,j:Z,M:Y,Z:G,b:K,eq:X,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}UM0.diff_core=zM0;function Tn(J,Q,Z){let[Y,X,G]=[0,J.length,Q.length];if(typeof Z==="function"){while(Y<X&&Y<G&&Z(Y,Y))Y++;if(Y===X&&Y===G)return[][Symbol.iterator]();while(Z(--X,--G)&&X>Y&&G>Y);}else{while(Y<X&&Y<G&&J[Y]===Q[Y])Y++;if(Y===X&&Y===G)return[][Symbol.iterator]();while(J[--X]===Q[--G]&&X>Y&&G>Y);Z=(V,K)=>J[V]===Q[K]}return zM0(Y,X+1-Y,Y,G+1-Y,Z)}UM0.diff=Tn;class FM0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:K,j:q,N:W}=this;if(K<W)J.done=!1,J.value=[K,q,W-K],this.i=W;return J}let Q=J.value,Z=Q[0],Y=Q[1],X=Q[3],{i:G,j:V}=this;if(G!==Z)Q.length--,Q[0]=G,Q[1]=V,Q[2]=Z-G;return this.i=Y,this.j=X,J}}function dV4(J,Q,Z){return new FM0(Tn(J,Q,Z),J.length)}UM0.lcs=dV4;function*cV4(J,Q,Z){let Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let X of Tn(J,Q,Z))X[2]=Y.call(Q,X[2],X[3]),yield X}UM0.calcPatch=cV4;function*lV4(J,Q){let Z=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[X,G,V]of Q){if(Z<X)yield Y.call(J,Z,X);if(V.length>0)yield V;Z=G}if(Z<J.length)yield Y.call(J,Z)}UM0.applyPatch=lV4;function*iV4(J,Q,Z){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,V,K,q]of Tn(J,Q,Z)){if(Y<G)yield[0,X.call(J,Y,G)];if(G<V)yield[-1,X.call(J,G,V)];if(K<q)yield[1,X.call(Q,K,q)];Y=V}if(Y<J.length)yield[0,J.slice(Y)]}UM0.calcSlices=iV4});function vE(J,Q){let Z={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Z;if(J===Q)return Z;try{let Y={added:0,deleted:0,changed:0};for(let[X,G,V,K]of DM0.diff(J.split(`
70
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let W of this.seen.entries()){let H=W[1];if(J===W[0]){G(W);continue}if(Z.external){let U=Z.external.registry.get(W[0])?.id;if(J!==W[0]&&U){G(W);continue}}if(this.metadataRegistry.get(W[0])?.id){G(W);continue}if(H.cycle){G(W);continue}if(H.count>1){if(Z.reused==="ref"){G(W);continue}}}let V=(W,H)=>{let z=this.seen.get(W),U=z.def??z.schema,D={...U};if(z.ref===null)return;let M=z.ref;if(z.ref=null,M){V(M,H);let L=this.seen.get(M).schema;if(L.$ref&&(H.target==="draft-7"||H.target==="draft-4"||H.target==="openapi-3.0"))U.allOf=U.allOf??[],U.allOf.push(L);else Object.assign(U,L),Object.assign(U,D)}if(!z.isParent)this.override({zodSchema:W,jsonSchema:U,path:z.path??[]})};for(let W of[...this.seen.entries()].reverse())V(W[0],{target:this.target});let K={};if(this.target==="draft-2020-12")K.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")K.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")K.$schema="http://json-schema.org/draft-04/schema#";else if(this.target==="openapi-3.0");else console.warn(`Invalid target: ${this.target}`);if(Z.external?.uri){let W=Z.external.registry.get(J)?.id;if(!W)throw Error("Schema is missing an `id` property");K.$id=Z.external.uri(W)}Object.assign(K,Y.def);let q=Z.external?.defs??{};for(let W of this.seen.entries()){let H=W[1];if(H.def&&H.defId)q[H.defId]=H.def}if(Z.external);else if(Object.keys(q).length>0)if(this.target==="draft-2020-12")K.$defs=q;else K.definitions=q;try{return JSON.parse(JSON.stringify(K))}catch(W){throw Error("Error converting schema to JSON.")}}}function UW1(J,Q){if(J instanceof wk){let Y=new bi(Q),X={};for(let K of J._idmap.entries()){let[q,W]=K;Y.process(W)}let G={},V={registry:J,uri:Q?.uri,defs:X};for(let K of J._idmap.entries()){let[q,W]=K;G[q]=Y.emit(W,{...Q,external:V})}if(Object.keys(X).length>0){let K=Y.target==="draft-2020-12"?"$defs":"definitions";G.__shared={[K]:X}}return{schemas:G}}let Z=new bi(Q);return Z.process(J),Z.emit(J,Q)}function DQ(J,Q){let Z=Q??{seen:new Set};if(Z.seen.has(J))return!1;Z.seen.add(J);let Y=J._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return DQ(Y.element,Z);if(Y.type==="set")return DQ(Y.valueType,Z);if(Y.type==="lazy")return DQ(Y.getter(),Z);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return DQ(Y.innerType,Z);if(Y.type==="intersection")return DQ(Y.left,Z)||DQ(Y.right,Z);if(Y.type==="record"||Y.type==="map")return DQ(Y.keyType,Z)||DQ(Y.valueType,Z);if(Y.type==="pipe")return DQ(Y.in,Z)||DQ(Y.out,Z);if(Y.type==="object"){for(let X in Y.shape)if(DQ(Y.shape[X],Z))return!0;return!1}if(Y.type==="union"){for(let X of Y.options)if(DQ(X,Z))return!0;return!1}if(Y.type==="tuple"){for(let X of Y.items)if(DQ(X,Z))return!0;if(Y.rest&&DQ(Y.rest,Z))return!0;return!1}return!1}var DN0=N1(()=>{Di();S4()});var MN0={};var LN0=()=>{};var _W={};Q9(_W,{version:()=>NV1,util:()=>N6,treeifyError:()=>LG1,toJSONSchema:()=>UW1,toDotPath:()=>lU0,safeParseAsync:()=>Hk,safeParse:()=>BE,safeEncodeAsync:()=>tU0,safeEncode:()=>rU0,safeDecodeAsync:()=>eU0,safeDecode:()=>sU0,registry:()=>Ni,regexes:()=>CX,prettifyError:()=>AG1,parseAsync:()=>Wk,parse:()=>qk,meta:()=>zW1,locales:()=>Ok,isValidJWT:()=>DB0,isValidBase64URL:()=>NB0,isValidBase64:()=>gV1,globalRegistry:()=>NQ,globalConfig:()=>t_,formatError:()=>Kk,flattenError:()=>Vk,encodeAsync:()=>aU0,encode:()=>iU0,describe:()=>HW1,decodeAsync:()=>oU0,decode:()=>nU0,config:()=>I3,clone:()=>BQ,_xid:()=>Ci,_void:()=>sq1,_uuidv7:()=>wi,_uuidv6:()=>Oi,_uuidv4:()=>Ai,_uuid:()=>Li,_url:()=>Ik,_uppercase:()=>Ck,_unknown:()=>oq1,_union:()=>cX4,_undefined:()=>iq1,_ulid:()=>Ri,_uint64:()=>cq1,_uint32:()=>bq1,_tuple:()=>nX4,_trim:()=>xk,_transform:()=>J$4,_toUpperCase:()=>fk,_toLowerCase:()=>vk,_templateLiteral:()=>q$4,_symbol:()=>lq1,_superRefine:()=>WW1,_success:()=>$$4,_stringbool:()=>FW1,_stringFormat:()=>OE,_string:()=>Iq1,_startsWith:()=>Sk,_slugify:()=>hk,_size:()=>Pk,_set:()=>rX4,_safeParseAsync:()=>NE,_safeParse:()=>UE,_safeEncodeAsync:()=>el,_safeEncode:()=>sl,_safeDecodeAsync:()=>Ji,_safeDecode:()=>tl,_regex:()=>Tk,_refine:()=>qW1,_record:()=>aX4,_readonly:()=>K$4,_property:()=>$W1,_promise:()=>H$4,_positive:()=>QW1,_pipe:()=>V$4,_parseAsync:()=>FE,_parse:()=>zE,_overwrite:()=>FK,_optional:()=>Q$4,_number:()=>kq1,_nullable:()=>Z$4,_null:()=>nq1,_normalize:()=>yk,_nonpositive:()=>YW1,_nonoptional:()=>X$4,_nonnegative:()=>XW1,_never:()=>rq1,_negative:()=>ZW1,_nativeEnum:()=>tX4,_nanoid:()=>Ii,_nan:()=>JW1,_multipleOf:()=>hD,_minSize:()=>bD,_minLength:()=>wF,_min:()=>KZ,_mime:()=>kk,_maxSize:()=>ME,_maxLength:()=>LE,_max:()=>jX,_map:()=>oX4,_mac:()=>Tq1,_lte:()=>jX,_lt:()=>jW,_lowercase:()=>Rk,_literal:()=>eX4,_length:()=>AE,_lazy:()=>W$4,_ksuid:()=>ji,_jwt:()=>hi,_isoTime:()=>Sq1,_isoDuration:()=>_q1,_isoDateTime:()=>Cq1,_isoDate:()=>jq1,_ipv6:()=>_i,_ipv4:()=>Si,_intersection:()=>iX4,_int64:()=>dq1,_int32:()=>hq1,_int:()=>xq1,_includes:()=>jk,_guid:()=>Ek,_gte:()=>KZ,_gt:()=>SW,_float64:()=>fq1,_float32:()=>vq1,_file:()=>VW1,_enum:()=>sX4,_endsWith:()=>_k,_encodeAsync:()=>ol,_encode:()=>nl,_emoji:()=>Ei,_email:()=>Mi,_e164:()=>fi,_discriminatedUnion:()=>lX4,_default:()=>Y$4,_decodeAsync:()=>rl,_decode:()=>al,_date:()=>tq1,_custom:()=>KW1,_cuid2:()=>Ti,_cuid:()=>Pi,_coercedString:()=>Pq1,_coercedNumber:()=>yq1,_coercedDate:()=>eq1,_coercedBoolean:()=>mq1,_coercedBigint:()=>pq1,_cidrv6:()=>yi,_cidrv4:()=>ki,_check:()=>BN0,_catch:()=>G$4,_boolean:()=>gq1,_bigint:()=>uq1,_base64url:()=>vi,_base64:()=>xi,_array:()=>GW1,_any:()=>aq1,TimePrecision:()=>Rq1,NEVER:()=>e_,JSONSchemaGenerator:()=>bi,JSONSchema:()=>MN0,Doc:()=>Gi,$output:()=>wq1,$input:()=>Eq1,$constructor:()=>F0,$brand:()=>qG1,$ZodXID:()=>CV1,$ZodVoid:()=>eV1,$ZodUnknown:()=>sV1,$ZodUnion:()=>Ui,$ZodUndefined:()=>aV1,$ZodUUID:()=>AV1,$ZodURL:()=>wV1,$ZodULID:()=>RV1,$ZodType:()=>X8,$ZodTuple:()=>Bi,$ZodTransform:()=>HK1,$ZodTemplateLiteral:()=>wK1,$ZodSymbol:()=>nV1,$ZodSuccess:()=>DK1,$ZodStringFormat:()=>z5,$ZodString:()=>fD,$ZodSet:()=>VK1,$ZodRegistry:()=>wk,$ZodRecord:()=>$K1,$ZodRealError:()=>VZ,$ZodReadonly:()=>OK1,$ZodPromise:()=>IK1,$ZodPrefault:()=>BK1,$ZodPipe:()=>AK1,$ZodOptional:()=>zK1,$ZodObjectJIT:()=>ZK1,$ZodObject:()=>AB0,$ZodNumberFormat:()=>lV1,$ZodNumber:()=>zi,$ZodNullable:()=>FK1,$ZodNull:()=>oV1,$ZodNonOptional:()=>NK1,$ZodNever:()=>tV1,$ZodNanoID:()=>IV1,$ZodNaN:()=>LK1,$ZodMap:()=>GK1,$ZodMAC:()=>fV1,$ZodLiteral:()=>qK1,$ZodLazy:()=>PK1,$ZodKSUID:()=>jV1,$ZodJWT:()=>dV1,$ZodIntersection:()=>XK1,$ZodISOTime:()=>kV1,$ZodISODuration:()=>yV1,$ZodISODateTime:()=>SV1,$ZodISODate:()=>_V1,$ZodIPv6:()=>vV1,$ZodIPv4:()=>xV1,$ZodGUID:()=>LV1,$ZodFunction:()=>EK1,$ZodFile:()=>WK1,$ZodError:()=>Gk,$ZodEnum:()=>KK1,$ZodEncodeError:()=>yD,$ZodEmoji:()=>EV1,$ZodEmail:()=>OV1,$ZodE164:()=>pV1,$ZodDiscriminatedUnion:()=>YK1,$ZodDefault:()=>UK1,$ZodDate:()=>JK1,$ZodCustomStringFormat:()=>cV1,$ZodCustom:()=>TK1,$ZodCodec:()=>Bk,$ZodCheckUpperCase:()=>qV1,$ZodCheckStringFormat:()=>DE,$ZodCheckStartsWith:()=>HV1,$ZodCheckSizeEquals:()=>YV1,$ZodCheckRegex:()=>VV1,$ZodCheckProperty:()=>FV1,$ZodCheckOverwrite:()=>BV1,$ZodCheckNumberFormat:()=>eG1,$ZodCheckMultipleOf:()=>tG1,$ZodCheckMinSize:()=>ZV1,$ZodCheckMinLength:()=>$V1,$ZodCheckMimeType:()=>UV1,$ZodCheckMaxSize:()=>QV1,$ZodCheckMaxLength:()=>XV1,$ZodCheckLowerCase:()=>KV1,$ZodCheckLessThan:()=>Yi,$ZodCheckLengthEquals:()=>GV1,$ZodCheckIncludes:()=>WV1,$ZodCheckGreaterThan:()=>Xi,$ZodCheckEndsWith:()=>zV1,$ZodCheckBigIntFormat:()=>JV1,$ZodCheck:()=>w5,$ZodCatch:()=>MK1,$ZodCUID2:()=>TV1,$ZodCUID:()=>PV1,$ZodCIDRv6:()=>bV1,$ZodCIDRv4:()=>hV1,$ZodBoolean:()=>Uk,$ZodBigIntFormat:()=>iV1,$ZodBigInt:()=>Fi,$ZodBase64URL:()=>uV1,$ZodBase64:()=>mV1,$ZodAsyncError:()=>zK,$ZodArray:()=>QK1,$ZodAny:()=>rV1});var qZ=N1(()=>{S4();Zi();Oq1();LN0();KE();wG1();OG1();RK1();$i();DV1();Di();NN0();DN0()});var BW1=N1(()=>{qZ()});var di={};Q9(di,{time:()=>MW1,duration:()=>LW1,datetime:()=>NW1,date:()=>DW1,ZodISOTime:()=>ui,ZodISODuration:()=>pi,ZodISODateTime:()=>gi,ZodISODate:()=>mi});function NW1(J){return Cq1(gi,J)}function DW1(J){return jq1(mi,J)}function MW1(J){return Sq1(ui,J)}function LW1(J){return _q1(pi,J)}var gi,mi,ui,pi;var ci=N1(()=>{qZ();li();gi=F0("ZodISODateTime",(J,Q)=>{SV1.init(J,Q),E5.init(J,Q)});mi=F0("ZodISODate",(J,Q)=>{_V1.init(J,Q),E5.init(J,Q)});ui=F0("ZodISOTime",(J,Q)=>{kV1.init(J,Q),E5.init(J,Q)});pi=F0("ZodISODuration",(J,Q)=>{yV1.init(J,Q),E5.init(J,Q)})});var ON0=(J,Q)=>{Gk.init(J,Q),J.name="ZodError",Object.defineProperties(J,{format:{value:(Z)=>Kk(J,Z)},flatten:{value:(Z)=>Vk(J,Z)},addIssue:{value:(Z)=>{J.issues.push(Z),J.message=JSON.stringify(J.issues,qE,2)}},addIssues:{value:(Z)=>{J.issues.push(...Z),J.message=JSON.stringify(J.issues,qE,2)}},isEmpty:{get(){return J.issues.length===0}}})},F$4,WZ;var AW1=N1(()=>{qZ();qZ();S4();F$4=F0("ZodError",ON0),WZ=F0("ZodError",ON0,{Parent:Error})});var OW1,wW1,EW1,IW1,PW1,TW1,RW1,CW1,jW1,SW1,_W1,kW1;var yW1=N1(()=>{qZ();AW1();OW1=zE(WZ),wW1=FE(WZ),EW1=UE(WZ),IW1=NE(WZ),PW1=nl(WZ),TW1=al(WZ),RW1=ol(WZ),CW1=rl(WZ),jW1=sl(WZ),SW1=tl(WZ),_W1=el(WZ),kW1=Ji(WZ)});function Z0(J){return Iq1(gk,J)}function B$4(J){return Mi(fW1,J)}function N$4(J){return Ek(ii,J)}function D$4(J){return Li(kW,J)}function M$4(J){return Ai(kW,J)}function L$4(J){return Oi(kW,J)}function A$4(J){return wi(kW,J)}function hW1(J){return Ik(oi,J)}function O$4(J){return Ik(oi,{protocol:/^https?$/,hostname:CX.domain,...N6.normalizeParams(J)})}function w$4(J){return Ei(bW1,J)}function E$4(J){return Ii(gW1,J)}function I$4(J){return Pi(mW1,J)}function P$4(J){return Ti(uW1,J)}function T$4(J){return Ri(pW1,J)}function R$4(J){return Ci(dW1,J)}function C$4(J){return ji(cW1,J)}function j$4(J){return Si(lW1,J)}function S$4(J){return Tq1(wN0,J)}function _$4(J){return _i(iW1,J)}function k$4(J){return ki(nW1,J)}function y$4(J){return yi(aW1,J)}function x$4(J){return xi(oW1,J)}function v$4(J){return vi(rW1,J)}function f$4(J){return fi(sW1,J)}function h$4(J){return hi(tW1,J)}function b$4(J,Q,Z={}){return OE(mk,J,Q,Z)}function g$4(J){return OE(mk,"hostname",CX.hostname,J)}function m$4(J){return OE(mk,"hex",CX.hex,J)}function u$4(J,Q){let Z=Q?.enc??"hex",Y=`${J}_${Z}`,X=CX[Y];if(!X)throw Error(`Unrecognized hash format: ${Y}`);return OE(mk,Y,X,Q)}function p9(J){return kq1(uk,J)}function xW1(J){return xq1(wE,J)}function p$4(J){return vq1(wE,J)}function d$4(J){return fq1(wE,J)}function c$4(J){return hq1(wE,J)}function l$4(J){return bq1(wE,J)}function F5(J){return gq1(pk,J)}function i$4(J){return uq1(dk,J)}function n$4(J){return dq1(eW1,J)}function a$4(J){return cq1(eW1,J)}function o$4(J){return lq1(EN0,J)}function r$4(J){return iq1(IN0,J)}function ck(J){return nq1(PN0,J)}function JH1(){return aq1(TN0)}function L7(){return oq1(RN0)}function QH1(J){return rq1(CN0,J)}function s$4(J){return sq1(jN0,J)}function t$4(J){return tq1(ri,J)}function y6(J,Q){return GW1(SN0,J,Q)}function e$4(J){let Q=J._zod.def.shape;return U2(Object.keys(Q))}function U6(J,Q){let Z={type:"object",shape:J??{},...N6.normalizeParams(Q)};return new si(Z)}function JG4(J,Q){return new si({type:"object",shape:J,catchall:QH1(),...N6.normalizeParams(Q)})}function h2(J,Q){return new si({type:"object",shape:J,catchall:L7(),...N6.normalizeParams(Q)})}function I5(J,Q){return new ZH1({type:"union",options:J,...N6.normalizeParams(Q)})}function ti(J,Q,Z){return new _N0({type:"union",options:Q,discriminator:J,...N6.normalizeParams(Z)})}function lk(J,Q){return new kN0({type:"intersection",left:J,right:Q})}function xN0(J,Q,Z){let Y=Q instanceof X8,X=Y?Z:Q;return new yN0({type:"tuple",items:J,rest:Y?Q:null,...N6.normalizeParams(X)})}function _7(J,Q,Z){return new YH1({type:"record",keyType:J,valueType:Q,...N6.normalizeParams(Z)})}function QG4(J,Q,Z){let Y=BQ(J);return Y._zod.values=void 0,new YH1({type:"record",keyType:Y,valueType:Q,...N6.normalizeParams(Z)})}function ZG4(J,Q,Z){return new vN0({type:"map",keyType:J,valueType:Q,...N6.normalizeParams(Z)})}function YG4(J,Q){return new fN0({type:"set",valueType:J,...N6.normalizeParams(Q)})}function U2(J,Q){let Z=Array.isArray(J)?Object.fromEntries(J.map((Y)=>[Y,Y])):J;return new bk({type:"enum",entries:Z,...N6.normalizeParams(Q)})}function XG4(J,Q){return new bk({type:"enum",entries:J,...N6.normalizeParams(Q)})}function F4(J,Q){return new hN0({type:"literal",values:Array.isArray(J)?J:[J],...N6.normalizeParams(Q)})}function $G4(J){return VW1(bN0,J)}function XH1(J){return new gN0({type:"transform",transform:J})}function D4(J){return new $H1({type:"optional",innerType:J})}function ni(J){return new mN0({type:"nullable",innerType:J})}function GG4(J){return D4(ni(J))}function pN0(J,Q){return new uN0({type:"default",innerType:J,get defaultValue(){return typeof Q==="function"?Q():N6.shallowClone(Q)}})}function cN0(J,Q){return new dN0({type:"prefault",innerType:J,get defaultValue(){return typeof Q==="function"?Q():N6.shallowClone(Q)}})}function lN0(J,Q){return new GH1({type:"nonoptional",innerType:J,...N6.normalizeParams(Q)})}function VG4(J){return new iN0({type:"success",innerType:J})}function aN0(J,Q){return new nN0({type:"catch",innerType:J,catchValue:typeof Q==="function"?Q:()=>Q})}function KG4(J){return JW1(oN0,J)}function ai(J,Q){return new VH1({type:"pipe",in:J,out:Q})}function qG4(J,Q,Z){return new KH1({type:"pipe",in:J,out:Q,transform:Z.decode,reverseTransform:Z.encode})}function sN0(J){return new rN0({type:"readonly",innerType:J})}function WG4(J,Q){return new tN0({type:"template_literal",parts:J,...N6.normalizeParams(Q)})}function JD0(J){return new eN0({type:"lazy",getter:J})}function HG4(J){return new QD0({type:"promise",innerType:J})}function zG4(J){return new ZD0({type:"function",input:Array.isArray(J?.input)?xN0(J?.input):J?.input??y6(L7()),output:J?.output??L7()})}function FG4(J){let Q=new w5({check:"custom"});return Q._zod.check=J,Q}function qH1(J,Q){return KW1(ei,J??(()=>!0),Q)}function YD0(J,Q={}){return qW1(ei,J,Q)}function XD0(J){return WW1(J)}function NG4(J,Q={error:`Input not instance of ${J.name}`}){let Z=new ei({type:"custom",check:"custom",fn:(Y)=>Y instanceof J,abort:!0,...N6.normalizeParams(Q)});return Z._zod.bag.Class=J,Z}function MG4(J){let Q=JD0(()=>{return I5([Z0(J),p9(),F5(),ck(),y6(Q),_7(Z0(),Q)])});return Q}function Jn(J,Q){return ai(XH1(J),Q)}var _8,vW1,gk,E5,fW1,ii,kW,oi,bW1,gW1,mW1,uW1,pW1,dW1,cW1,lW1,wN0,iW1,nW1,aW1,oW1,rW1,sW1,tW1,mk,uk,wE,pk,dk,eW1,EN0,IN0,PN0,TN0,RN0,CN0,jN0,ri,SN0,si,ZH1,_N0,kN0,yN0,YH1,vN0,fN0,bk,hN0,bN0,gN0,$H1,mN0,uN0,dN0,GH1,iN0,nN0,oN0,VH1,KH1,rN0,tN0,eN0,QD0,ZD0,ei,UG4,BG4,DG4=(...J)=>FW1({Codec:KH1,Boolean:pk,String:gk},...J);var li=N1(()=>{qZ();qZ();BW1();ci();yW1();_8=F0("ZodType",(J,Q)=>{return X8.init(J,Q),J.def=Q,J.type=Q.type,Object.defineProperty(J,"_def",{value:Q}),J.check=(...Z)=>{return J.clone(N6.mergeDefs(Q,{checks:[...Q.checks??[],...Z.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]}))},J.clone=(Z,Y)=>BQ(J,Z,Y),J.brand=()=>J,J.register=(Z,Y)=>{return Z.add(J,Y),J},J.parse=(Z,Y)=>OW1(J,Z,Y,{callee:J.parse}),J.safeParse=(Z,Y)=>EW1(J,Z,Y),J.parseAsync=async(Z,Y)=>wW1(J,Z,Y,{callee:J.parseAsync}),J.safeParseAsync=async(Z,Y)=>IW1(J,Z,Y),J.spa=J.safeParseAsync,J.encode=(Z,Y)=>PW1(J,Z,Y),J.decode=(Z,Y)=>TW1(J,Z,Y),J.encodeAsync=async(Z,Y)=>RW1(J,Z,Y),J.decodeAsync=async(Z,Y)=>CW1(J,Z,Y),J.safeEncode=(Z,Y)=>jW1(J,Z,Y),J.safeDecode=(Z,Y)=>SW1(J,Z,Y),J.safeEncodeAsync=async(Z,Y)=>_W1(J,Z,Y),J.safeDecodeAsync=async(Z,Y)=>kW1(J,Z,Y),J.refine=(Z,Y)=>J.check(YD0(Z,Y)),J.superRefine=(Z)=>J.check(XD0(Z)),J.overwrite=(Z)=>J.check(FK(Z)),J.optional=()=>D4(J),J.nullable=()=>ni(J),J.nullish=()=>D4(ni(J)),J.nonoptional=(Z)=>lN0(J,Z),J.array=()=>y6(J),J.or=(Z)=>I5([J,Z]),J.and=(Z)=>lk(J,Z),J.transform=(Z)=>ai(J,XH1(Z)),J.default=(Z)=>pN0(J,Z),J.prefault=(Z)=>cN0(J,Z),J.catch=(Z)=>aN0(J,Z),J.pipe=(Z)=>ai(J,Z),J.readonly=()=>sN0(J),J.describe=(Z)=>{let Y=J.clone();return NQ.add(Y,{description:Z}),Y},Object.defineProperty(J,"description",{get(){return NQ.get(J)?.description},configurable:!0}),J.meta=(...Z)=>{if(Z.length===0)return NQ.get(J);let Y=J.clone();return NQ.add(Y,Z[0]),Y},J.isOptional=()=>J.safeParse(void 0).success,J.isNullable=()=>J.safeParse(null).success,J}),vW1=F0("_ZodString",(J,Q)=>{fD.init(J,Q),_8.init(J,Q);let Z=J._zod.bag;J.format=Z.format??null,J.minLength=Z.minimum??null,J.maxLength=Z.maximum??null,J.regex=(...Y)=>J.check(Tk(...Y)),J.includes=(...Y)=>J.check(jk(...Y)),J.startsWith=(...Y)=>J.check(Sk(...Y)),J.endsWith=(...Y)=>J.check(_k(...Y)),J.min=(...Y)=>J.check(wF(...Y)),J.max=(...Y)=>J.check(LE(...Y)),J.length=(...Y)=>J.check(AE(...Y)),J.nonempty=(...Y)=>J.check(wF(1,...Y)),J.lowercase=(Y)=>J.check(Rk(Y)),J.uppercase=(Y)=>J.check(Ck(Y)),J.trim=()=>J.check(xk()),J.normalize=(...Y)=>J.check(yk(...Y)),J.toLowerCase=()=>J.check(vk()),J.toUpperCase=()=>J.check(fk()),J.slugify=()=>J.check(hk())}),gk=F0("ZodString",(J,Q)=>{fD.init(J,Q),vW1.init(J,Q),J.email=(Z)=>J.check(Mi(fW1,Z)),J.url=(Z)=>J.check(Ik(oi,Z)),J.jwt=(Z)=>J.check(hi(tW1,Z)),J.emoji=(Z)=>J.check(Ei(bW1,Z)),J.guid=(Z)=>J.check(Ek(ii,Z)),J.uuid=(Z)=>J.check(Li(kW,Z)),J.uuidv4=(Z)=>J.check(Ai(kW,Z)),J.uuidv6=(Z)=>J.check(Oi(kW,Z)),J.uuidv7=(Z)=>J.check(wi(kW,Z)),J.nanoid=(Z)=>J.check(Ii(gW1,Z)),J.guid=(Z)=>J.check(Ek(ii,Z)),J.cuid=(Z)=>J.check(Pi(mW1,Z)),J.cuid2=(Z)=>J.check(Ti(uW1,Z)),J.ulid=(Z)=>J.check(Ri(pW1,Z)),J.base64=(Z)=>J.check(xi(oW1,Z)),J.base64url=(Z)=>J.check(vi(rW1,Z)),J.xid=(Z)=>J.check(Ci(dW1,Z)),J.ksuid=(Z)=>J.check(ji(cW1,Z)),J.ipv4=(Z)=>J.check(Si(lW1,Z)),J.ipv6=(Z)=>J.check(_i(iW1,Z)),J.cidrv4=(Z)=>J.check(ki(nW1,Z)),J.cidrv6=(Z)=>J.check(yi(aW1,Z)),J.e164=(Z)=>J.check(fi(sW1,Z)),J.datetime=(Z)=>J.check(NW1(Z)),J.date=(Z)=>J.check(DW1(Z)),J.time=(Z)=>J.check(MW1(Z)),J.duration=(Z)=>J.check(LW1(Z))});E5=F0("ZodStringFormat",(J,Q)=>{z5.init(J,Q),vW1.init(J,Q)}),fW1=F0("ZodEmail",(J,Q)=>{OV1.init(J,Q),E5.init(J,Q)});ii=F0("ZodGUID",(J,Q)=>{LV1.init(J,Q),E5.init(J,Q)});kW=F0("ZodUUID",(J,Q)=>{AV1.init(J,Q),E5.init(J,Q)});oi=F0("ZodURL",(J,Q)=>{wV1.init(J,Q),E5.init(J,Q)});bW1=F0("ZodEmoji",(J,Q)=>{EV1.init(J,Q),E5.init(J,Q)});gW1=F0("ZodNanoID",(J,Q)=>{IV1.init(J,Q),E5.init(J,Q)});mW1=F0("ZodCUID",(J,Q)=>{PV1.init(J,Q),E5.init(J,Q)});uW1=F0("ZodCUID2",(J,Q)=>{TV1.init(J,Q),E5.init(J,Q)});pW1=F0("ZodULID",(J,Q)=>{RV1.init(J,Q),E5.init(J,Q)});dW1=F0("ZodXID",(J,Q)=>{CV1.init(J,Q),E5.init(J,Q)});cW1=F0("ZodKSUID",(J,Q)=>{jV1.init(J,Q),E5.init(J,Q)});lW1=F0("ZodIPv4",(J,Q)=>{xV1.init(J,Q),E5.init(J,Q)});wN0=F0("ZodMAC",(J,Q)=>{fV1.init(J,Q),E5.init(J,Q)});iW1=F0("ZodIPv6",(J,Q)=>{vV1.init(J,Q),E5.init(J,Q)});nW1=F0("ZodCIDRv4",(J,Q)=>{hV1.init(J,Q),E5.init(J,Q)});aW1=F0("ZodCIDRv6",(J,Q)=>{bV1.init(J,Q),E5.init(J,Q)});oW1=F0("ZodBase64",(J,Q)=>{mV1.init(J,Q),E5.init(J,Q)});rW1=F0("ZodBase64URL",(J,Q)=>{uV1.init(J,Q),E5.init(J,Q)});sW1=F0("ZodE164",(J,Q)=>{pV1.init(J,Q),E5.init(J,Q)});tW1=F0("ZodJWT",(J,Q)=>{dV1.init(J,Q),E5.init(J,Q)});mk=F0("ZodCustomStringFormat",(J,Q)=>{cV1.init(J,Q),E5.init(J,Q)});uk=F0("ZodNumber",(J,Q)=>{zi.init(J,Q),_8.init(J,Q),J.gt=(Y,X)=>J.check(SW(Y,X)),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.lt=(Y,X)=>J.check(jW(Y,X)),J.lte=(Y,X)=>J.check(jX(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X)),J.int=(Y)=>J.check(xW1(Y)),J.safe=(Y)=>J.check(xW1(Y)),J.positive=(Y)=>J.check(SW(0,Y)),J.nonnegative=(Y)=>J.check(KZ(0,Y)),J.negative=(Y)=>J.check(jW(0,Y)),J.nonpositive=(Y)=>J.check(jX(0,Y)),J.multipleOf=(Y,X)=>J.check(hD(Y,X)),J.step=(Y,X)=>J.check(hD(Y,X)),J.finite=()=>J;let Z=J._zod.bag;J.minValue=Math.max(Z.minimum??Number.NEGATIVE_INFINITY,Z.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,J.maxValue=Math.min(Z.maximum??Number.POSITIVE_INFINITY,Z.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,J.isInt=(Z.format??"").includes("int")||Number.isSafeInteger(Z.multipleOf??0.5),J.isFinite=!0,J.format=Z.format??null});wE=F0("ZodNumberFormat",(J,Q)=>{lV1.init(J,Q),uk.init(J,Q)});pk=F0("ZodBoolean",(J,Q)=>{Uk.init(J,Q),_8.init(J,Q)});dk=F0("ZodBigInt",(J,Q)=>{Fi.init(J,Q),_8.init(J,Q),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.gt=(Y,X)=>J.check(SW(Y,X)),J.gte=(Y,X)=>J.check(KZ(Y,X)),J.min=(Y,X)=>J.check(KZ(Y,X)),J.lt=(Y,X)=>J.check(jW(Y,X)),J.lte=(Y,X)=>J.check(jX(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X)),J.positive=(Y)=>J.check(SW(BigInt(0),Y)),J.negative=(Y)=>J.check(jW(BigInt(0),Y)),J.nonpositive=(Y)=>J.check(jX(BigInt(0),Y)),J.nonnegative=(Y)=>J.check(KZ(BigInt(0),Y)),J.multipleOf=(Y,X)=>J.check(hD(Y,X));let Z=J._zod.bag;J.minValue=Z.minimum??null,J.maxValue=Z.maximum??null,J.format=Z.format??null});eW1=F0("ZodBigIntFormat",(J,Q)=>{iV1.init(J,Q),dk.init(J,Q)});EN0=F0("ZodSymbol",(J,Q)=>{nV1.init(J,Q),_8.init(J,Q)});IN0=F0("ZodUndefined",(J,Q)=>{aV1.init(J,Q),_8.init(J,Q)});PN0=F0("ZodNull",(J,Q)=>{oV1.init(J,Q),_8.init(J,Q)});TN0=F0("ZodAny",(J,Q)=>{rV1.init(J,Q),_8.init(J,Q)});RN0=F0("ZodUnknown",(J,Q)=>{sV1.init(J,Q),_8.init(J,Q)});CN0=F0("ZodNever",(J,Q)=>{tV1.init(J,Q),_8.init(J,Q)});jN0=F0("ZodVoid",(J,Q)=>{eV1.init(J,Q),_8.init(J,Q)});ri=F0("ZodDate",(J,Q)=>{JK1.init(J,Q),_8.init(J,Q),J.min=(Y,X)=>J.check(KZ(Y,X)),J.max=(Y,X)=>J.check(jX(Y,X));let Z=J._zod.bag;J.minDate=Z.minimum?new Date(Z.minimum):null,J.maxDate=Z.maximum?new Date(Z.maximum):null});SN0=F0("ZodArray",(J,Q)=>{QK1.init(J,Q),_8.init(J,Q),J.element=Q.element,J.min=(Z,Y)=>J.check(wF(Z,Y)),J.nonempty=(Z)=>J.check(wF(1,Z)),J.max=(Z,Y)=>J.check(LE(Z,Y)),J.length=(Z,Y)=>J.check(AE(Z,Y)),J.unwrap=()=>J.element});si=F0("ZodObject",(J,Q)=>{ZK1.init(J,Q),_8.init(J,Q),N6.defineLazy(J,"shape",()=>{return Q.shape}),J.keyof=()=>U2(Object.keys(J._zod.def.shape)),J.catchall=(Z)=>J.clone({...J._zod.def,catchall:Z}),J.passthrough=()=>J.clone({...J._zod.def,catchall:L7()}),J.loose=()=>J.clone({...J._zod.def,catchall:L7()}),J.strict=()=>J.clone({...J._zod.def,catchall:QH1()}),J.strip=()=>J.clone({...J._zod.def,catchall:void 0}),J.extend=(Z)=>{return N6.extend(J,Z)},J.safeExtend=(Z)=>{return N6.safeExtend(J,Z)},J.merge=(Z)=>N6.merge(J,Z),J.pick=(Z)=>N6.pick(J,Z),J.omit=(Z)=>N6.omit(J,Z),J.partial=(...Z)=>N6.partial($H1,J,Z[0]),J.required=(...Z)=>N6.required(GH1,J,Z[0])});ZH1=F0("ZodUnion",(J,Q)=>{Ui.init(J,Q),_8.init(J,Q),J.options=Q.options});_N0=F0("ZodDiscriminatedUnion",(J,Q)=>{ZH1.init(J,Q),YK1.init(J,Q)});kN0=F0("ZodIntersection",(J,Q)=>{XK1.init(J,Q),_8.init(J,Q)});yN0=F0("ZodTuple",(J,Q)=>{Bi.init(J,Q),_8.init(J,Q),J.rest=(Z)=>J.clone({...J._zod.def,rest:Z})});YH1=F0("ZodRecord",(J,Q)=>{$K1.init(J,Q),_8.init(J,Q),J.keyType=Q.keyType,J.valueType=Q.valueType});vN0=F0("ZodMap",(J,Q)=>{GK1.init(J,Q),_8.init(J,Q),J.keyType=Q.keyType,J.valueType=Q.valueType});fN0=F0("ZodSet",(J,Q)=>{VK1.init(J,Q),_8.init(J,Q),J.min=(...Z)=>J.check(bD(...Z)),J.nonempty=(Z)=>J.check(bD(1,Z)),J.max=(...Z)=>J.check(ME(...Z)),J.size=(...Z)=>J.check(Pk(...Z))});bk=F0("ZodEnum",(J,Q)=>{KK1.init(J,Q),_8.init(J,Q),J.enum=Q.entries,J.options=Object.values(Q.entries);let Z=new Set(Object.keys(Q.entries));J.extract=(Y,X)=>{let G={};for(let V of Y)if(Z.has(V))G[V]=Q.entries[V];else throw Error(`Key ${V} not found in enum`);return new bk({...Q,checks:[],...N6.normalizeParams(X),entries:G})},J.exclude=(Y,X)=>{let G={...Q.entries};for(let V of Y)if(Z.has(V))delete G[V];else throw Error(`Key ${V} not found in enum`);return new bk({...Q,checks:[],...N6.normalizeParams(X),entries:G})}});hN0=F0("ZodLiteral",(J,Q)=>{qK1.init(J,Q),_8.init(J,Q),J.values=new Set(Q.values),Object.defineProperty(J,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});bN0=F0("ZodFile",(J,Q)=>{WK1.init(J,Q),_8.init(J,Q),J.min=(Z,Y)=>J.check(bD(Z,Y)),J.max=(Z,Y)=>J.check(ME(Z,Y)),J.mime=(Z,Y)=>J.check(kk(Array.isArray(Z)?Z:[Z],Y))});gN0=F0("ZodTransform",(J,Q)=>{HK1.init(J,Q),_8.init(J,Q),J._zod.parse=(Z,Y)=>{if(Y.direction==="backward")throw new yD(J.constructor.name);Z.addIssue=(G)=>{if(typeof G==="string")Z.issues.push(N6.issue(G,Z.value,Q));else{let V=G;if(V.fatal)V.continue=!1;V.code??(V.code="custom"),V.input??(V.input=Z.value),V.inst??(V.inst=J),Z.issues.push(N6.issue(V))}};let X=Q.transform(Z.value,Z);if(X instanceof Promise)return X.then((G)=>{return Z.value=G,Z});return Z.value=X,Z}});$H1=F0("ZodOptional",(J,Q)=>{zK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});mN0=F0("ZodNullable",(J,Q)=>{FK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});uN0=F0("ZodDefault",(J,Q)=>{UK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType,J.removeDefault=J.unwrap});dN0=F0("ZodPrefault",(J,Q)=>{BK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});GH1=F0("ZodNonOptional",(J,Q)=>{NK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});iN0=F0("ZodSuccess",(J,Q)=>{DK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});nN0=F0("ZodCatch",(J,Q)=>{MK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType,J.removeCatch=J.unwrap});oN0=F0("ZodNaN",(J,Q)=>{LK1.init(J,Q),_8.init(J,Q)});VH1=F0("ZodPipe",(J,Q)=>{AK1.init(J,Q),_8.init(J,Q),J.in=Q.in,J.out=Q.out});KH1=F0("ZodCodec",(J,Q)=>{VH1.init(J,Q),Bk.init(J,Q)});rN0=F0("ZodReadonly",(J,Q)=>{OK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});tN0=F0("ZodTemplateLiteral",(J,Q)=>{wK1.init(J,Q),_8.init(J,Q)});eN0=F0("ZodLazy",(J,Q)=>{PK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.getter()});QD0=F0("ZodPromise",(J,Q)=>{IK1.init(J,Q),_8.init(J,Q),J.unwrap=()=>J._zod.def.innerType});ZD0=F0("ZodFunction",(J,Q)=>{EK1.init(J,Q),_8.init(J,Q)});ei=F0("ZodCustom",(J,Q)=>{TK1.init(J,Q),_8.init(J,Q)});UG4=HW1,BG4=zW1});function LG4(J){I3({customError:J})}function AG4(){return I3().customError}var HH1,WH1;var $D0=N1(()=>{qZ();HH1={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};(function(J){})(WH1||(WH1={}))});var ik={};Q9(ik,{string:()=>OG4,number:()=>wG4,date:()=>PG4,boolean:()=>EG4,bigint:()=>IG4});function OG4(J){return Pq1(gk,J)}function wG4(J){return yq1(uk,J)}function EG4(J){return mq1(pk,J)}function IG4(J){return pq1(dk,J)}function PG4(J){return eq1(ri,J)}var GD0=N1(()=>{qZ();li()});var f1={};Q9(f1,{xid:()=>R$4,void:()=>s$4,uuidv7:()=>A$4,uuidv6:()=>L$4,uuidv4:()=>M$4,uuid:()=>D$4,util:()=>N6,url:()=>hW1,uppercase:()=>Ck,unknown:()=>L7,union:()=>I5,undefined:()=>r$4,ulid:()=>T$4,uint64:()=>a$4,uint32:()=>l$4,tuple:()=>xN0,trim:()=>xk,treeifyError:()=>LG1,transform:()=>XH1,toUpperCase:()=>fk,toLowerCase:()=>vk,toJSONSchema:()=>UW1,templateLiteral:()=>WG4,symbol:()=>o$4,superRefine:()=>XD0,success:()=>VG4,stringbool:()=>DG4,stringFormat:()=>b$4,string:()=>Z0,strictObject:()=>JG4,startsWith:()=>Sk,slugify:()=>hk,size:()=>Pk,setErrorMap:()=>LG4,set:()=>YG4,safeParseAsync:()=>IW1,safeParse:()=>EW1,safeEncodeAsync:()=>_W1,safeEncode:()=>jW1,safeDecodeAsync:()=>kW1,safeDecode:()=>SW1,registry:()=>Ni,regexes:()=>CX,regex:()=>Tk,refine:()=>YD0,record:()=>_7,readonly:()=>sN0,property:()=>$W1,promise:()=>HG4,prettifyError:()=>AG1,preprocess:()=>Jn,prefault:()=>cN0,positive:()=>QW1,pipe:()=>ai,partialRecord:()=>QG4,parseAsync:()=>wW1,parse:()=>OW1,overwrite:()=>FK,optional:()=>D4,object:()=>U6,number:()=>p9,nullish:()=>GG4,nullable:()=>ni,null:()=>ck,normalize:()=>yk,nonpositive:()=>YW1,nonoptional:()=>lN0,nonnegative:()=>XW1,never:()=>QH1,negative:()=>ZW1,nativeEnum:()=>XG4,nanoid:()=>E$4,nan:()=>KG4,multipleOf:()=>hD,minSize:()=>bD,minLength:()=>wF,mime:()=>kk,meta:()=>BG4,maxSize:()=>ME,maxLength:()=>LE,map:()=>ZG4,mac:()=>S$4,lte:()=>jX,lt:()=>jW,lowercase:()=>Rk,looseObject:()=>h2,locales:()=>Ok,literal:()=>F4,length:()=>AE,lazy:()=>JD0,ksuid:()=>C$4,keyof:()=>e$4,jwt:()=>h$4,json:()=>MG4,iso:()=>di,ipv6:()=>_$4,ipv4:()=>j$4,intersection:()=>lk,int64:()=>n$4,int32:()=>c$4,int:()=>xW1,instanceof:()=>NG4,includes:()=>jk,httpUrl:()=>O$4,hostname:()=>g$4,hex:()=>m$4,hash:()=>u$4,guid:()=>N$4,gte:()=>KZ,gt:()=>SW,globalRegistry:()=>NQ,getErrorMap:()=>AG4,function:()=>zG4,formatError:()=>Kk,float64:()=>d$4,float32:()=>p$4,flattenError:()=>Vk,file:()=>$G4,enum:()=>U2,endsWith:()=>_k,encodeAsync:()=>RW1,encode:()=>PW1,emoji:()=>w$4,email:()=>B$4,e164:()=>f$4,discriminatedUnion:()=>ti,describe:()=>UG4,decodeAsync:()=>CW1,decode:()=>TW1,date:()=>t$4,custom:()=>qH1,cuid2:()=>P$4,cuid:()=>I$4,core:()=>_W,config:()=>I3,coerce:()=>ik,codec:()=>qG4,clone:()=>BQ,cidrv6:()=>y$4,cidrv4:()=>k$4,check:()=>FG4,catch:()=>aN0,boolean:()=>F5,bigint:()=>i$4,base64url:()=>v$4,base64:()=>x$4,array:()=>y6,any:()=>JH1,_function:()=>zG4,_default:()=>pN0,_ZodString:()=>vW1,ZodXID:()=>dW1,ZodVoid:()=>jN0,ZodUnknown:()=>RN0,ZodUnion:()=>ZH1,ZodUndefined:()=>IN0,ZodUUID:()=>kW,ZodURL:()=>oi,ZodULID:()=>pW1,ZodType:()=>_8,ZodTuple:()=>yN0,ZodTransform:()=>gN0,ZodTemplateLiteral:()=>tN0,ZodSymbol:()=>EN0,ZodSuccess:()=>iN0,ZodStringFormat:()=>E5,ZodString:()=>gk,ZodSet:()=>fN0,ZodRecord:()=>YH1,ZodRealError:()=>WZ,ZodReadonly:()=>rN0,ZodPromise:()=>QD0,ZodPrefault:()=>dN0,ZodPipe:()=>VH1,ZodOptional:()=>$H1,ZodObject:()=>si,ZodNumberFormat:()=>wE,ZodNumber:()=>uk,ZodNullable:()=>mN0,ZodNull:()=>PN0,ZodNonOptional:()=>GH1,ZodNever:()=>CN0,ZodNanoID:()=>gW1,ZodNaN:()=>oN0,ZodMap:()=>vN0,ZodMAC:()=>wN0,ZodLiteral:()=>hN0,ZodLazy:()=>eN0,ZodKSUID:()=>cW1,ZodJWT:()=>tW1,ZodIssueCode:()=>HH1,ZodIntersection:()=>kN0,ZodISOTime:()=>ui,ZodISODuration:()=>pi,ZodISODateTime:()=>gi,ZodISODate:()=>mi,ZodIPv6:()=>iW1,ZodIPv4:()=>lW1,ZodGUID:()=>ii,ZodFunction:()=>ZD0,ZodFirstPartyTypeKind:()=>WH1,ZodFile:()=>bN0,ZodError:()=>F$4,ZodEnum:()=>bk,ZodEmoji:()=>bW1,ZodEmail:()=>fW1,ZodE164:()=>sW1,ZodDiscriminatedUnion:()=>_N0,ZodDefault:()=>uN0,ZodDate:()=>ri,ZodCustomStringFormat:()=>mk,ZodCustom:()=>ei,ZodCodec:()=>KH1,ZodCatch:()=>nN0,ZodCUID2:()=>uW1,ZodCUID:()=>mW1,ZodCIDRv6:()=>aW1,ZodCIDRv4:()=>nW1,ZodBoolean:()=>pk,ZodBigIntFormat:()=>eW1,ZodBigInt:()=>dk,ZodBase64URL:()=>rW1,ZodBase64:()=>oW1,ZodArray:()=>SN0,ZodAny:()=>TN0,TimePrecision:()=>Rq1,NEVER:()=>e_,$output:()=>wq1,$input:()=>Eq1,$brand:()=>qG1});var nk=N1(()=>{qZ();qZ();fK1();qZ();Oq1();ci();ci();GD0();li();BW1();AW1();yW1();$D0();I3(Nk())});var Qn=N1(()=>{nk();nk()});function SJ(J,Q){let Z=CG4(J,Q);return typeof Z==="string"?Z:Z.toString()}function CG4(J,Q,Z=!0){if(!Q)Q=jG4();let{workspaceFolders:Y,isWindows:X,homeDir:G}=Q,V=typeof J==="string"?f0.parse(J):f0.from(J);if(Y)for(let K of Y){let q=m4(K);if(n0.hasPrefix(V,q)){let W=q.path.endsWith("/")?q.path.slice(0,-1):q.path,z=Z&&Y&&Y.length>=2?jD(q.path)+(X?"\\":"/"):"";return FH1(z+V.path.slice(W.length+1),X,V.scheme)}}if(V?.scheme==="file"){if(G){let K=m4(G);if(n0.hasPrefix(V,K)){let q=K.path.endsWith("/")?K.path.slice(0,-1):K.path,W=V.path.slice(q.length+1);return FH1("~"+(X?"\\":"/")+W,X,V.scheme)}}return FH1(V.fsPath,X,V.scheme)}return V}function FH1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function Yn(J){let Q=Zn;return Zn=J,Q}function jG4(){if(Zn)return Zn;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Zn=null;var yW=N1(()=>{s6();ZE();yl()});var SG4=(J)=>{let Q=0,Z=[];while(Q<J.length){let Y=J[Q];if(Y==="\\"){Q++;continue}if(Y==="{"){Z.push({type:"brace",value:"{"}),Q++;continue}if(Y==="}"){Z.push({type:"brace",value:"}"}),Q++;continue}if(Y==="["){Z.push({type:"paren",value:"["}),Q++;continue}if(Y==="]"){Z.push({type:"paren",value:"]"}),Q++;continue}if(Y===":"){Z.push({type:"separator",value:":"}),Q++;continue}if(Y===","){Z.push({type:"delimiter",value:","}),Q++;continue}if(Y==='"'){let K="",q=!1;Y=J[++Q];while(Y!=='"'){if(Q===J.length){q=!0;break}if(Y==="\\"){if(Q++,Q===J.length){q=!0;break}K+=Y+J[Q],Y=J[++Q]}else K+=Y,Y=J[++Q]}if(Y=J[++Q],!q)Z.push({type:"string",value:K});continue}if(Y&&/\s/.test(Y)){Q++;continue}let G=/[0-9]/;if(Y&&G.test(Y)||Y==="-"||Y==="."){let K="";if(Y==="-")K+=Y,Y=J[++Q];while(Y&&G.test(Y)||Y===".")K+=Y,Y=J[++Q];Z.push({type:"number",value:K});continue}let V=/[a-z]/i;if(Y&&V.test(Y)){let K="";while(Y&&V.test(Y)){if(Q===J.length)break;K+=Y,Y=J[++Q]}if(K=="true"||K=="false"||K==="null")Z.push({type:"name",value:K});else{Q++;continue}continue}Q++}return Z},IE=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),IE(J);break;case"number":let Z=Q.value[Q.value.length-1];if(Z==="."||Z==="-")return J=J.slice(0,J.length-1),IE(J);case"string":let Y=J[J.length-2];if(Y?.type==="delimiter")return J=J.slice(0,J.length-1),IE(J);else if(Y?.type==="brace"&&Y.value==="{")return J=J.slice(0,J.length-1),IE(J);break;case"delimiter":return J=J.slice(0,J.length-1),IE(J);break}return J},_G4=(J)=>{let Q=[];if(J.map((Z)=>{if(Z.type==="brace")if(Z.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Z.type==="paren")if(Z.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Z)=>{if(Z==="}")J.push({type:"brace",value:"}"});else if(Z==="]")J.push({type:"paren",value:"]"})});return J},kG4=(J)=>{let Q="";return J.map((Z)=>{switch(Z.type){case"string":Q+='"'+Z.value+'"';break;default:Q+=Z.value;break}}),Q},SX=(J)=>JSON.parse(kG4(_G4(IE(SG4(J)))));var gD=()=>{};function _J(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function pD(J){return!!J&&!!J[XY]}function IF(J){if(!J)return!1;return zD0(J)||Array.isArray(J)||!!J[ak]||!!J.constructor?.[ak]||ek(J)||Jy(J)}function zD0(J){if(!J||typeof J!=="object")return!1;let Q=uD(J);if(Q===null)return!0;let Z=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Z===Object)return!0;return typeof Z=="function"&&Function.toString.call(Z)===yG4}function ok(J,Q){if(dD(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,Y)=>Q(Y,Z,J))}function dD(J){let Q=J[XY];return Q?Q.type_:Array.isArray(J)?1:ek(J)?2:Jy(J)?3:0}function rk(J,Q){return dD(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function UH1(J,Q){return dD(J)===2?J.get(Q):J[Q]}function FD0(J,Q,Z){let Y=dD(J);if(Y===2)J.set(Q,Z);else if(Y===3)J.add(Z);else J[Q]=Z}function xG4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function ek(J){return J instanceof Map}function Jy(J){return J instanceof Set}function mD(J){return J.copy_||J.base_}function DH1(J,Q){if(ek(J))return new Map(J);if(Jy(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=zD0(J);if(Q===!0||Q==="class_only"&&!Z){let Y=Object.getOwnPropertyDescriptors(J);delete Y[XY];let X=Reflect.ownKeys(Y);for(let G=0;G<X.length;G++){let V=X[G],K=Y[V];if(K.writable===!1)K.writable=!0,K.configurable=!0;if(K.get||K.set)Y[V]={configurable:!0,writable:!0,enumerable:K.enumerable,value:J[V]}}return Object.create(uD(J),Y)}else{let Y=uD(J);if(Y!==null&&Z)return{...J};let X=Object.create(Y);return Object.assign(X,J)}}function GY(J,Q=!1){if(Gn(J)||pD(J)||!IF(J))return J;if(dD(J)>1)J.set=J.add=J.clear=J.delete=vG4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,Y])=>GY(Y,!0));return J}function vG4(){_J(2)}function Gn(J){return Object.isFrozen(J)}function cD(J){let Q=MH1[J];if(!Q)_J(0,J);return Q}function fG4(J,Q){if(!MH1[J])MH1[J]=Q}function UD0(){return sk}function hG4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function KD0(J,Q){if(Q)cD("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function LH1(J){AH1(J),J.drafts_.forEach(bG4),J.drafts_=null}function AH1(J){if(J===sk)sk=J.parent_}function qD0(J){return sk=hG4(sk,J)}function bG4(J){let Q=J[XY];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function WD0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[XY].modified_)LH1(Q),_J(4);if(IF(J)){if(J=Xn(Q,J),!Q.parent_)$n(Q,J)}if(Q.patches_)cD("Patches").generateReplacementPatches_(Z[XY].base_,J,Q.patches_,Q.inversePatches_)}else J=Xn(Q,Z,[]);if(LH1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==EH1?J:void 0}function Xn(J,Q,Z){if(Gn(Q))return Q;let Y=Q[XY];if(!Y)return ok(Q,(X,G)=>HD0(J,Y,Q,X,G,Z)),Q;if(Y.scope_!==J)return Q;if(!Y.modified_)return $n(J,Y.base_,!0),Y.base_;if(!Y.finalized_){Y.finalized_=!0,Y.scope_.unfinalizedDrafts_--;let X=Y.copy_,G=X,V=!1;if(Y.type_===3)G=new Set(X),X.clear(),V=!0;if(ok(G,(K,q)=>HD0(J,Y,X,K,q,Z,V)),$n(J,X,!1),Z&&J.patches_)cD("Patches").generatePatches_(Y,Z,J.patches_,J.inversePatches_)}return Y.copy_}function HD0(J,Q,Z,Y,X,G,V){if(pD(X)){let K=G&&Q&&Q.type_!==3&&!rk(Q.assigned_,Y)?G.concat(Y):void 0,q=Xn(J,X,K);if(FD0(Z,Y,q),pD(q))J.canAutoFreeze_=!1;else return}else if(V)Z.add(X);if(IF(X)&&!Gn(X)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Xn(J,X),(!Q||!Q.scope_.parent_)&&typeof Y!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,Y))$n(J,X)}}function $n(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)GY(Q,Z)}function gG4(J,Q){let Z=Array.isArray(J),Y={type_:Z?1:0,scope_:Q?Q.scope_:UD0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},X=Y,G=IH1;if(Z)X=[Y],G=tk;let{revoke:V,proxy:K}=Proxy.revocable(X,G);return Y.draft_=K,Y.revoke_=V,K}function BH1(J,Q){let Z=J[XY];return(Z?mD(Z):J)[Q]}function mG4(J,Q,Z){let Y=BD0(Q,Z);return Y?"value"in Y?Y.value:Y.get?.call(J.draft_):void 0}function BD0(J,Q){if(!(Q in J))return;let Z=uD(J);while(Z){let Y=Object.getOwnPropertyDescriptor(Z,Q);if(Y)return Y;Z=uD(Z)}return}function OH1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)OH1(J.parent_)}}function NH1(J){if(!J.copy_)J.copy_=DH1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function wH1(J,Q){let Z=ek(J)?cD("MapSet").proxyMap_(J,Q):Jy(J)?cD("MapSet").proxySet_(J,Q):gG4(J,Q);return(Q?Q.scope_:UD0()).drafts_.push(Z),Z}function pG4(J){if(!pD(J))_J(10,J);return ND0(J)}function ND0(J){if(!IF(J)||Gn(J))return J;let Q=J[XY],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=DH1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=DH1(J,!0);if(ok(Z,(Y,X)=>{FD0(Z,Y,ND0(X))}),Q)Q.finalized_=!1;return Z}function Vn(){let Q="replace",Z="add",Y="remove";function X(U,D,M,L){switch(U.type_){case 0:case 2:return V(U,D,M,L);case 1:return G(U,D,M,L);case 3:return K(U,D,M,L)}}function G(U,D,M,L){let{base_:A,assigned_:E}=U,I=U.copy_;if(I.length<A.length)[A,I]=[I,A],[M,L]=[L,M];for(let P=0;P<A.length;P++)if(E[P]&&I[P]!==A[P]){let C=D.concat([P]);M.push({op:Q,path:C,value:z(I[P])}),L.push({op:Q,path:C,value:z(A[P])})}for(let P=A.length;P<I.length;P++){let C=D.concat([P]);M.push({op:Z,path:C,value:z(I[P])})}for(let P=I.length-1;A.length<=P;--P){let C=D.concat([P]);L.push({op:Y,path:C})}}function V(U,D,M,L){let{base_:A,copy_:E}=U;ok(U.assigned_,(I,P)=>{let C=UH1(A,I),k=UH1(E,I),y=!P?Y:rk(A,I)?Q:Z;if(C===k&&y===Q)return;let v=D.concat(I);M.push(y===Y?{op:y,path:v}:{op:y,path:v,value:k}),L.push(y===Z?{op:Y,path:v}:y===Y?{op:Z,path:v,value:z(C)}:{op:Q,path:v,value:z(C)})})}function K(U,D,M,L){let{base_:A,copy_:E}=U,I=0;A.forEach((P)=>{if(!E.has(P)){let C=D.concat([I]);M.push({op:Y,path:C,value:P}),L.unshift({op:Z,path:C,value:P})}I++}),I=0,E.forEach((P)=>{if(!A.has(P)){let C=D.concat([I]);M.push({op:Z,path:C,value:P}),L.unshift({op:Y,path:C,value:P})}I++})}function q(U,D,M,L){M.push({op:Q,path:[],value:D===EH1?void 0:D}),L.push({op:Q,path:[],value:U})}function W(U,D){return D.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let k=0;k<L.length-1;k++){let y=dD(E),v=L[k];if(typeof v!=="string"&&typeof v!=="number")v=""+v;if((y===0||y===1)&&(v==="__proto__"||v==="constructor"))_J(19);if(typeof E==="function"&&v==="prototype")_J(19);if(E=UH1(E,v),typeof E!=="object")_J(18,L.join("/"))}let I=dD(E),P=H(M.value),C=L[L.length-1];switch(A){case Q:switch(I){case 2:return E.set(C,P);case 3:_J(16);default:return E[C]=P}case Z:switch(I){case 1:return C==="-"?E.push(P):E.splice(C,0,P);case 2:return E.set(C,P);case 3:return E.add(P);default:return E[C]=P}case Y:switch(I){case 1:return E.splice(C,1);case 2:return E.delete(C);case 3:return E.delete(M.value);default:return delete E[C]}default:_J(17,A)}}),U}function H(U){if(!IF(U))return U;if(Array.isArray(U))return U.map(H);if(ek(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(Jy(U))return new Set(Array.from(U).map(H));let D=Object.create(uD(U));for(let M in U)D[M]=H(U[M]);if(rk(U,ak))D[ak]=U[ak];return D}function z(U){if(pD(U))return H(U);else return U}fG4("Patches",{applyPatches_:W,generatePatches_:X,generateReplacementPatches_:q})}function k8(J){return J}var EH1,ak,XY,uD,yG4,MH1,sk,IH1,tk,uG4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Z,Y)=>{if(typeof Q==="function"&&typeof Z!=="function"){let G=Z;Z=Q;let V=this;return function(q=G,...W){return V.produce(q,(H)=>Z.call(this,H,...W))}}if(typeof Z!=="function")_J(6);if(Y!==void 0&&typeof Y!=="function")_J(7);let X;if(IF(Q)){let G=qD0(this),V=wH1(Q,void 0),K=!0;try{X=Z(V),K=!1}finally{if(K)LH1(G);else AH1(G)}return KD0(G,Y),WD0(X,G)}else if(!Q||typeof Q!=="object"){if(X=Z(Q),X===void 0)X=Q;if(X===EH1)X=void 0;if(this.autoFreeze_)GY(X,!0);if(Y){let G=[],V=[];cD("Patches").generateReplacementPatches_(Q,X,G,V),Y(G,V)}return X}else _J(1,Q)},this.produceWithPatches=(Q,Z)=>{if(typeof Q==="function")return(V,...K)=>this.produceWithPatches(V,(q)=>Q(q,...K));let Y,X;return[this.produce(Q,Z,(V,K)=>{Y=V,X=K}),Y,X]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!IF(J))_J(8);if(pD(J))J=pG4(J);let Q=qD0(this),Z=wH1(J,void 0);return Z[XY].isManual_=!0,AH1(Q),Z}finishDraft(J,Q){let Z=J&&J[XY];if(!Z||!Z.isManual_)_J(9);let{scope_:Y}=Z;return KD0(Y,Q),WD0(void 0,Y)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Z;for(Z=Q.length-1;Z>=0;Z--){let X=Q[Z];if(X.path.length===0&&X.op==="replace"){J=X.value;break}}if(Z>-1)Q=Q.slice(Z+1);let Y=cD("Patches").applyPatches_;if(pD(J))return Y(J,Q);return this.produce(J,(X)=>Y(X,Q))}},$Y,PF,lD,vc8,fc8,DD0,hc8,bc8;var MQ=N1(()=>{EH1=Symbol.for("immer-nothing"),ak=Symbol.for("immer-draftable"),XY=Symbol.for("immer-state");uD=Object.getPrototypeOf;yG4=Object.prototype.constructor.toString();MH1={};IH1={get(J,Q){if(Q===XY)return J;let Z=mD(J);if(!rk(Z,Q))return mG4(J,Z,Q);let Y=Z[Q];if(J.finalized_||!IF(Y))return Y;if(Y===BH1(J.base_,Q))return NH1(J),J.copy_[Q]=wH1(Y,J);return Y},has(J,Q){return Q in mD(J)},ownKeys(J){return Reflect.ownKeys(mD(J))},set(J,Q,Z){let Y=BD0(mD(J),Q);if(Y?.set)return Y.set.call(J.draft_,Z),!0;if(!J.modified_){let X=BH1(mD(J),Q),G=X?.[XY];if(G&&G.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(xG4(Z,X)&&(Z!==void 0||rk(J.base_,Q)))return!0;NH1(J),OH1(J)}if(J.copy_[Q]===Z&&(Z!==void 0||(Q in J.copy_))||Number.isNaN(Z)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Z,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(BH1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,NH1(J),OH1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=mD(J),Y=Reflect.getOwnPropertyDescriptor(Z,Q);if(!Y)return Y;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:Y.enumerable,value:Z[Q]}},defineProperty(){_J(11)},getPrototypeOf(J){return uD(J.base_)},setPrototypeOf(){_J(12)}},tk={};ok(IH1,(J,Q)=>{tk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});tk.deleteProperty=function(J,Q){return tk.set.call(this,J,Q,void 0)};tk.set=function(J,Q,Z){return IH1.set.call(this,J[0],Q,Z,J[0])};$Y=new uG4,PF=$Y.produce,lD=$Y.produceWithPatches.bind($Y),vc8=$Y.setAutoFreeze.bind($Y),fc8=$Y.setUseStrictShallowCopy.bind($Y),DD0=$Y.applyPatches.bind($Y),hc8=$Y.createDraft.bind($Y),bc8=$Y.finishDraft.bind($Y)});function PH1({onlyFirst:J=!1}={}){let Z=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Z,J?void 0:"g")}function PE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(dG4,"")}var dG4;var Kn=N1(()=>{dG4=PH1()});var LD0=h((cc8,TH1)=>{var TF={};if(typeof TH1>"u")window.eastasianwidth=TF;else TH1.exports=TF;TF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Z=J.length==2?J.charCodeAt(1):0,Y=Q;if(55296<=Q&&Q<=56319&&(56320<=Z&&Z<=57343))Q&=1023,Z&=1023,Y=Q<<10|Z,Y+=65536;if(Y==12288||65281<=Y&&Y<=65376||65504<=Y&&Y<=65510)return"F";if(Y==8361||65377<=Y&&Y<=65470||65474<=Y&&Y<=65479||65482<=Y&&Y<=65487||65490<=Y&&Y<=65495||65498<=Y&&Y<=65500||65512<=Y&&Y<=65518)return"H";if(4352<=Y&&Y<=4447||4515<=Y&&Y<=4519||4602<=Y&&Y<=4607||9001<=Y&&Y<=9002||11904<=Y&&Y<=11929||11931<=Y&&Y<=12019||12032<=Y&&Y<=12245||12272<=Y&&Y<=12283||12289<=Y&&Y<=12350||12353<=Y&&Y<=12438||12441<=Y&&Y<=12543||12549<=Y&&Y<=12589||12593<=Y&&Y<=12686||12688<=Y&&Y<=12730||12736<=Y&&Y<=12771||12784<=Y&&Y<=12830||12832<=Y&&Y<=12871||12880<=Y&&Y<=13054||13056<=Y&&Y<=19903||19968<=Y&&Y<=42124||42128<=Y&&Y<=42182||43360<=Y&&Y<=43388||44032<=Y&&Y<=55203||55216<=Y&&Y<=55238||55243<=Y&&Y<=55291||63744<=Y&&Y<=64255||65040<=Y&&Y<=65049||65072<=Y&&Y<=65106||65108<=Y&&Y<=65126||65128<=Y&&Y<=65131||110592<=Y&&Y<=110593||127488<=Y&&Y<=127490||127504<=Y&&Y<=127546||127552<=Y&&Y<=127560||127568<=Y&&Y<=127569||131072<=Y&&Y<=194367||177984<=Y&&Y<=196605||196608<=Y&&Y<=262141)return"W";if(32<=Y&&Y<=126||162<=Y&&Y<=163||165<=Y&&Y<=166||Y==172||Y==175||10214<=Y&&Y<=10221||10629<=Y&&Y<=10630)return"Na";if(Y==161||Y==164||167<=Y&&Y<=168||Y==170||173<=Y&&Y<=174||176<=Y&&Y<=180||182<=Y&&Y<=186||188<=Y&&Y<=191||Y==198||Y==208||215<=Y&&Y<=216||222<=Y&&Y<=225||Y==230||232<=Y&&Y<=234||236<=Y&&Y<=237||Y==240||242<=Y&&Y<=243||247<=Y&&Y<=250||Y==252||Y==254||Y==257||Y==273||Y==275||Y==283||294<=Y&&Y<=295||Y==299||305<=Y&&Y<=307||Y==312||319<=Y&&Y<=322||Y==324||328<=Y&&Y<=331||Y==333||338<=Y&&Y<=339||358<=Y&&Y<=359||Y==363||Y==462||Y==464||Y==466||Y==468||Y==470||Y==472||Y==474||Y==476||Y==593||Y==609||Y==708||Y==711||713<=Y&&Y<=715||Y==717||Y==720||728<=Y&&Y<=731||Y==733||Y==735||768<=Y&&Y<=879||913<=Y&&Y<=929||931<=Y&&Y<=937||945<=Y&&Y<=961||963<=Y&&Y<=969||Y==1025||1040<=Y&&Y<=1103||Y==1105||Y==8208||8211<=Y&&Y<=8214||8216<=Y&&Y<=8217||8220<=Y&&Y<=8221||8224<=Y&&Y<=8226||8228<=Y&&Y<=8231||Y==8240||8242<=Y&&Y<=8243||Y==8245||Y==8251||Y==8254||Y==8308||Y==8319||8321<=Y&&Y<=8324||Y==8364||Y==8451||Y==8453||Y==8457||Y==8467||Y==8470||8481<=Y&&Y<=8482||Y==8486||Y==8491||8531<=Y&&Y<=8532||8539<=Y&&Y<=8542||8544<=Y&&Y<=8555||8560<=Y&&Y<=8569||Y==8585||8592<=Y&&Y<=8601||8632<=Y&&Y<=8633||Y==8658||Y==8660||Y==8679||Y==8704||8706<=Y&&Y<=8707||8711<=Y&&Y<=8712||Y==8715||Y==8719||Y==8721||Y==8725||Y==8730||8733<=Y&&Y<=8736||Y==8739||Y==8741||8743<=Y&&Y<=8748||Y==8750||8756<=Y&&Y<=8759||8764<=Y&&Y<=8765||Y==8776||Y==8780||Y==8786||8800<=Y&&Y<=8801||8804<=Y&&Y<=8807||8810<=Y&&Y<=8811||8814<=Y&&Y<=8815||8834<=Y&&Y<=8835||8838<=Y&&Y<=8839||Y==8853||Y==8857||Y==8869||Y==8895||Y==8978||9312<=Y&&Y<=9449||9451<=Y&&Y<=9547||9552<=Y&&Y<=9587||9600<=Y&&Y<=9615||9618<=Y&&Y<=9621||9632<=Y&&Y<=9633||9635<=Y&&Y<=9641||9650<=Y&&Y<=9651||9654<=Y&&Y<=9655||9660<=Y&&Y<=9661||9664<=Y&&Y<=9665||9670<=Y&&Y<=9672||Y==9675||9678<=Y&&Y<=9681||9698<=Y&&Y<=9701||Y==9711||9733<=Y&&Y<=9734||Y==9737||9742<=Y&&Y<=9743||9748<=Y&&Y<=9749||Y==9756||Y==9758||Y==9792||Y==9794||9824<=Y&&Y<=9825||9827<=Y&&Y<=9829||9831<=Y&&Y<=9834||9836<=Y&&Y<=9837||Y==9839||9886<=Y&&Y<=9887||9918<=Y&&Y<=9919||9924<=Y&&Y<=9933||9935<=Y&&Y<=9953||Y==9955||9960<=Y&&Y<=9983||Y==10045||Y==10071||10102<=Y&&Y<=10111||11093<=Y&&Y<=11097||12872<=Y&&Y<=12879||57344<=Y&&Y<=63743||65024<=Y&&Y<=65039||Y==65533||127232<=Y&&Y<=127242||127248<=Y&&Y<=127277||127280<=Y&&Y<=127337||127344<=Y&&Y<=127386||917760<=Y&&Y<=917999||983040<=Y&&Y<=1048573||1048576<=Y&&Y<=1114109)return"A";return"N"};TF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function MD0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}TF.length=function(J){var Q=MD0(J),Z=0;for(var Y=0;Y<Q.length;Y++)Z=Z+this.characterLength(Q[Y]);return Z};TF.slice=function(J,Q,Z){if(textLen=TF.length(J),Q=Q?Q:0,Z=Z?Z:1,Q<0)Q=textLen+Q;if(Z<0)Z=textLen+Z;var Y="",X=0,G=MD0(J);for(var V=0;V<G.length;V++){var K=G[V],q=TF.length(K);if(X>=Q-(q==2?1:0))if(X+q<=Z)Y+=K;else break;X+=q}return Y}});var RH1=h((lc8,AD0)=>{AD0.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var cG4,lG4;var OD0=N1(()=>{Kn();cG4=W6(LD0(),1),lG4=W6(RH1(),1)});function qn(J,Q,Z="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Z.length))+Z}var CH1=N1(()=>{OD0()});var wD0="run_terminal_command",jH1="read_file",b2="Task",i8="finder",HZ="get_diagnostics",U5="Bash",B5="oracle",UK="mermaid",BK="todo_read",i5="todo_write",P3="read_web_page",TE="read_thread",RE="find_thread",P5="create_file",p3="glob",Wn="undo_edit",Hn="read_mcp_resource",i6="Read",Y7="edit_file",CE="format_file",B2="web_search",E8="Grep",iD="Check",VY="librarian",zn="kraken",ED0="look_at",ID0="read_artifact",PD0="edit_artifact",Fn="read_plan",jE="edit_plan",Un="read_github",Bn="search_github",Nn="commit_search",Dn="list_directory_github",Mn="list_repositories",Ln="glob_github",An="diff",TD0="bookkeeper",RD0="describe_workbook",CD0="execute_query",Qy="skill",jD0;var M4=N1(()=>{jD0=["Task","finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","look_at","librarian","bookkeeper","read_thread","find_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Zy=h((tc8,_D0)=>{var SD0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},iG4={...SD0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nG4={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_D0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nG4,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?iG4:SD0}}});var Yy=h((tG4)=>{var{REGEX_BACKSLASH:aG4,REGEX_REMOVE_BACKSLASH:oG4,REGEX_SPECIAL_CHARS:rG4,REGEX_SPECIAL_CHARS_GLOBAL:sG4}=Zy();tG4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tG4.hasRegexChars=(J)=>rG4.test(J);tG4.isRegexChar=(J)=>J.length===1&&tG4.hasRegexChars(J);tG4.escapeRegex=(J)=>J.replace(sG4,"\\$1");tG4.toPosixSlashes=(J)=>J.replace(aG4,"/");tG4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};tG4.removeBackslashes=(J)=>{return J.replace(oG4,(Q)=>{return Q==="\\"?"":Q})};tG4.escapeLast=(J,Q,Z)=>{let Y=J.lastIndexOf(Q,Z);if(Y===-1)return J;if(J[Y-1]==="\\")return tG4.escapeLast(J,Q,Y-1);return`${J.slice(0,Y)}\\${J.slice(Y)}`};tG4.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};tG4.wrapOutput=(J,Q={},Z={})=>{let Y=Z.contains?"":"^",X=Z.contains?"":"$",G=`${Y}(?:${J})${X}`;if(Q.negated===!0)G=`(?:^(?!${G}).*$)`;return G};tG4.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),Y=Z[Z.length-1];if(Y==="")return Z[Z.length-2];return Y}});var uD0=h((Jl8,mD0)=>{var xD0=Yy(),{CHAR_ASTERISK:SH1,CHAR_AT:KV4,CHAR_BACKWARD_SLASH:Xy,CHAR_COMMA:qV4,CHAR_DOT:_H1,CHAR_EXCLAMATION_MARK:kH1,CHAR_FORWARD_SLASH:gD0,CHAR_LEFT_CURLY_BRACE:yH1,CHAR_LEFT_PARENTHESES:xH1,CHAR_LEFT_SQUARE_BRACKET:WV4,CHAR_PLUS:HV4,CHAR_QUESTION_MARK:vD0,CHAR_RIGHT_CURLY_BRACE:zV4,CHAR_RIGHT_PARENTHESES:fD0,CHAR_RIGHT_SQUARE_BRACKET:FV4}=Zy(),hD0=(J)=>{return J===gD0||J===Xy},bD0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},UV4=(J,Q)=>{let Z=Q||{},Y=J.length-1,X=Z.parts===!0||Z.scanToEnd===!0,G=[],V=[],K=[],q=J,W=-1,H=0,z=0,U=!1,D=!1,M=!1,L=!1,A=!1,E=!1,I=!1,P=!1,C=!1,k=!1,y=0,v,b,d={value:"",depth:0,isGlob:!1},m=()=>W>=Y,n=()=>q.charCodeAt(W+1),$1=()=>{return v=b,q.charCodeAt(++W)};while(W<Y){b=$1();let q1;if(b===Xy){if(I=d.backslashes=!0,b=$1(),b===yH1)E=!0;continue}if(E===!0||b===yH1){y++;while(m()!==!0&&(b=$1())){if(b===Xy){I=d.backslashes=!0,$1();continue}if(b===yH1){y++;continue}if(E!==!0&&b===_H1&&(b=$1())===_H1){if(U=d.isBrace=!0,M=d.isGlob=!0,k=!0,X===!0)continue;break}if(E!==!0&&b===qV4){if(U=d.isBrace=!0,M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===zV4){if(y--,y===0){E=!1,U=d.isBrace=!0,k=!0;break}}}if(X===!0)continue;break}if(b===gD0){if(G.push(W),V.push(d),d={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_H1&&W===H+1){H+=2;continue}z=W+1;continue}if(Z.noext!==!0){if((b===HV4||b===KV4||b===SH1||b===vD0||b===kH1)===!0&&n()===xH1){if(M=d.isGlob=!0,L=d.isExtglob=!0,k=!0,b===kH1&&W===H)C=!0;if(X===!0){while(m()!==!0&&(b=$1())){if(b===Xy){I=d.backslashes=!0,b=$1();continue}if(b===fD0){M=d.isGlob=!0,k=!0;break}}continue}break}}if(b===SH1){if(v===SH1)A=d.isGlobstar=!0;if(M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===vD0){if(M=d.isGlob=!0,k=!0,X===!0)continue;break}if(b===WV4){while(m()!==!0&&(q1=$1())){if(q1===Xy){I=d.backslashes=!0,$1();continue}if(q1===FV4){D=d.isBracket=!0,M=d.isGlob=!0,k=!0;break}}if(X===!0)continue;break}if(Z.nonegate!==!0&&b===kH1&&W===H){P=d.negated=!0,H++;continue}if(Z.noparen!==!0&&b===xH1){if(M=d.isGlob=!0,X===!0){while(m()!==!0&&(b=$1())){if(b===xH1){I=d.backslashes=!0,b=$1();continue}if(b===fD0){k=!0;break}}continue}break}if(M===!0){if(k=!0,X===!0)continue;break}}if(Z.noext===!0)L=!1,M=!1;let t=q,p="",e="";if(H>0)p=q.slice(0,H),q=q.slice(H),z-=H;if(t&&M===!0&&z>0)t=q.slice(0,z),e=q.slice(z);else if(M===!0)t="",e=q;else t=q;if(t&&t!==""&&t!=="/"&&t!==q){if(hD0(t.charCodeAt(t.length-1)))t=t.slice(0,-1)}if(Z.unescape===!0){if(e)e=xD0.removeBackslashes(e);if(t&&I===!0)t=xD0.removeBackslashes(t)}let F1={prefix:p,input:J,start:H,base:t,glob:e,isBrace:U,isBracket:D,isGlob:M,isExtglob:L,isGlobstar:A,negated:P,negatedExtglob:C};if(Z.tokens===!0){if(F1.maxDepth=0,!hD0(b))V.push(d);F1.tokens=V}if(Z.parts===!0||Z.tokens===!0){let q1;for(let o=0;o<G.length;o++){let r=q1?q1+1:H,l=G[o],W1=J.slice(r,l);if(Z.tokens){if(o===0&&H!==0)V[o].isPrefix=!0,V[o].value=p;else V[o].value=W1;bD0(V[o]),F1.maxDepth+=V[o].depth}if(o!==0||W1!=="")K.push(W1);q1=l}if(q1&&q1+1<J.length){let o=J.slice(q1+1);if(K.push(o),Z.tokens)V[V.length-1].value=o,bD0(V[V.length-1]),F1.maxDepth+=V[V.length-1].depth}F1.slashes=G,F1.parts=K}return F1};mD0.exports=UV4});var cD0=h((Ql8,dD0)=>{var On=Zy(),NK=Yy(),{MAX_LENGTH:wn,POSIX_REGEX_SOURCE:BV4,REGEX_NON_SPECIAL_CHARS:NV4,REGEX_SPECIAL_CHARS_BACKREF:DV4,REPLACEMENTS:pD0}=On,MV4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Z=`[${J.join("-")}]`;try{new RegExp(Z)}catch(Y){return J.map((X)=>NK.escapeRegex(X)).join("..")}return Z},SE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},vH1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=pD0[J]||J;let Z={...Q},Y=typeof Z.maxLength==="number"?Math.min(wn,Z.maxLength):wn,X=J.length;if(X>Y)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Y}`);let G={type:"bos",value:"",output:Z.prepend||""},V=[G],K=Z.capture?"":"?:",q=On.globChars(Z.windows),W=On.extglobChars(q),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:D,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:I,QMARK_NO_DOT:P,STAR:C,START_ANCHOR:k}=q,y=(r1)=>{return`(${K}(?:(?!${k}${r1.dot?M:H}).)*?)`},v=Z.dot?"":L,b=Z.dot?I:P,d=Z.bash===!0?y(Z):C;if(Z.capture)d=`(${d})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let m={input:J,index:-1,start:0,dot:Z.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};J=NK.removePrefix(J,m),X=J.length;let n=[],$1=[],t=[],p=G,e,F1=()=>m.index===X-1,q1=m.peek=(r1=1)=>J[m.index+r1],o=m.advance=()=>J[++m.index]||"",r=()=>J.slice(m.index+1),l=(r1="",z1=0)=>{m.consumed+=r1,m.index+=z1},W1=(r1)=>{m.output+=r1.output!=null?r1.output:r1.value,l(r1.value)},_1=()=>{let r1=1;while(q1()==="!"&&(q1(2)!=="("||q1(3)==="?"))o(),m.start++,r1++;if(r1%2===0)return!1;return m.negated=!0,m.start++,!0},s=(r1)=>{m[r1]++,t.push(r1)},u1=(r1)=>{m[r1]--,t.pop()},j1=(r1)=>{if(p.type==="globstar"){let z1=m.braces>0&&(r1.type==="comma"||r1.type==="brace"),Z1=r1.extglob===!0||n.length&&(r1.type==="pipe"||r1.type==="paren");if(r1.type!=="slash"&&r1.type!=="paren"&&!z1&&!Z1)m.output=m.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=d,m.output+=p.output}if(n.length&&r1.type!=="paren")n[n.length-1].inner+=r1.value;if(r1.value||r1.output)W1(r1);if(p&&p.type==="text"&&r1.type==="text"){p.output=(p.output||p.value)+r1.value,p.value+=r1.value;return}r1.prev=p,V.push(r1),p=r1},R0=(r1,z1)=>{let Z1={...W[z1],conditions:1,inner:""};Z1.prev=p,Z1.parens=m.parens,Z1.output=m.output;let O1=(Z.capture?"(":"")+Z1.open;s("parens"),j1({type:r1,value:z1,output:m.output?"":D}),j1({type:"paren",extglob:!0,value:o(),output:O1}),n.push(Z1)},C1=(r1)=>{let z1=r1.close+(Z.capture?")":""),Z1;if(r1.type==="negate"){let O1=d;if(r1.inner&&r1.inner.length>1&&r1.inner.includes("/"))O1=y(Z);if(O1!==d||F1()||/^\)+$/.test(r()))z1=r1.close=`)$))${O1}`;if(r1.inner.includes("*")&&(Z1=r())&&/^\.[^\\/.]+$/.test(Z1)){let A1=vH1(Z1,{...Q,fastpaths:!1}).output;z1=r1.close=`)${A1})${O1})`}if(r1.prev.type==="bos")m.negatedExtglob=!0}j1({type:"paren",extglob:!0,value:e,output:z1}),u1("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let r1=!1,z1=J.replace(DV4,(Z1,O1,A1,T1,S1,c1)=>{if(T1==="\\")return r1=!0,Z1;if(T1==="?"){if(O1)return O1+T1+(S1?I.repeat(S1.length):"");if(c1===0)return b+(S1?I.repeat(S1.length):"");return I.repeat(A1.length)}if(T1===".")return H.repeat(A1.length);if(T1==="*"){if(O1)return O1+T1+(S1?d:"");return d}return O1?Z1:`\\${Z1}`});if(r1===!0)if(Z.unescape===!0)z1=z1.replace(/\\/g,"");else z1=z1.replace(/\\+/g,(Z1)=>{return Z1.length%2===0?"\\\\":Z1?"\\":""});if(z1===J&&Z.contains===!0)return m.output=J,m;return m.output=NK.wrapOutput(z1,m,Q),m}while(!F1()){if(e=o(),e==="\x00")continue;if(e==="\\"){let Z1=q1();if(Z1==="/"&&Z.bash!==!0)continue;if(Z1==="."||Z1===";")continue;if(!Z1){e+="\\",j1({type:"text",value:e});continue}let O1=/^\\+/.exec(r()),A1=0;if(O1&&O1[0].length>2){if(A1=O1[0].length,m.index+=A1,A1%2!==0)e+="\\"}if(Z.unescape===!0)e=o();else e+=o();if(m.brackets===0){j1({type:"text",value:e});continue}}if(m.brackets>0&&(e!=="]"||p.value==="["||p.value==="[^")){if(Z.posix!==!1&&e===":"){let Z1=p.value.slice(1);if(Z1.includes("[")){if(p.posix=!0,Z1.includes(":")){let O1=p.value.lastIndexOf("["),A1=p.value.slice(0,O1),T1=p.value.slice(O1+2),S1=BV4[T1];if(S1){if(p.value=A1+S1,m.backtrack=!0,o(),!G.output&&V.indexOf(p)===1)G.output=D;continue}}}}if(e==="["&&q1()!==":"||e==="-"&&q1()==="]")e=`\\${e}`;if(e==="]"&&(p.value==="["||p.value==="[^"))e=`\\${e}`;if(Z.posix===!0&&e==="!"&&p.value==="[")e="^";p.value+=e,W1({value:e});continue}if(m.quotes===1&&e!=='"'){e=NK.escapeRegex(e),p.value+=e,W1({value:e});continue}if(e==='"'){if(m.quotes=m.quotes===1?0:1,Z.keepQuotes===!0)j1({type:"text",value:e});continue}if(e==="("){s("parens"),j1({type:"paren",value:e});continue}if(e===")"){if(m.parens===0&&Z.strictBrackets===!0)throw SyntaxError(SE("opening","("));let Z1=n[n.length-1];if(Z1&&m.parens===Z1.parens+1){C1(n.pop());continue}j1({type:"paren",value:e,output:m.parens?")":"\\)"}),u1("parens");continue}if(e==="["){if(Z.nobracket===!0||!r().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw SyntaxError(SE("closing","]"));e=`\\${e}`}else s("brackets");j1({type:"bracket",value:e});continue}if(e==="]"){if(Z.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){j1({type:"text",value:e,output:`\\${e}`});continue}if(m.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(SE("opening","["));j1({type:"text",value:e,output:`\\${e}`});continue}u1("brackets");let Z1=p.value.slice(1);if(p.posix!==!0&&Z1[0]==="^"&&!Z1.includes("/"))e=`/${e}`;if(p.value+=e,W1({value:e}),Z.literalBrackets===!1||NK.hasRegexChars(Z1))continue;let O1=NK.escapeRegex(p.value);if(m.output=m.output.slice(0,-p.value.length),Z.literalBrackets===!0){m.output+=O1,p.value=O1;continue}p.value=`(${K}${O1}|${p.value})`,m.output+=p.value;continue}if(e==="{"&&Z.nobrace!==!0){s("braces");let Z1={type:"brace",value:e,output:"(",outputIndex:m.output.length,tokensIndex:m.tokens.length};$1.push(Z1),j1(Z1);continue}if(e==="}"){let Z1=$1[$1.length-1];if(Z.nobrace===!0||!Z1){j1({type:"text",value:e,output:e});continue}let O1=")";if(Z1.dots===!0){let A1=V.slice(),T1=[];for(let S1=A1.length-1;S1>=0;S1--){if(V.pop(),A1[S1].type==="brace")break;if(A1[S1].type!=="dots")T1.unshift(A1[S1].value)}O1=MV4(T1,Z),m.backtrack=!0}if(Z1.comma!==!0&&Z1.dots!==!0){let A1=m.output.slice(0,Z1.outputIndex),T1=m.tokens.slice(Z1.tokensIndex);Z1.value=Z1.output="\\{",e=O1="\\}",m.output=A1;for(let S1 of T1)m.output+=S1.output||S1.value}j1({type:"brace",value:e,output:O1}),u1("braces"),$1.pop();continue}if(e==="|"){if(n.length>0)n[n.length-1].conditions++;j1({type:"text",value:e});continue}if(e===","){let Z1=e,O1=$1[$1.length-1];if(O1&&t[t.length-1]==="braces")O1.comma=!0,Z1="|";j1({type:"comma",value:e,output:Z1});continue}if(e==="/"){if(p.type==="dot"&&m.index===m.start+1){m.start=m.index+1,m.consumed="",m.output="",V.pop(),p=G;continue}j1({type:"slash",value:e,output:U});continue}if(e==="."){if(m.braces>0&&p.type==="dot"){if(p.value===".")p.output=H;let Z1=$1[$1.length-1];p.type="dots",p.output+=e,p.value+=e,Z1.dots=!0;continue}if(m.braces+m.parens===0&&p.type!=="bos"&&p.type!=="slash"){j1({type:"text",value:e,output:H});continue}j1({type:"dot",value:e,output:H});continue}if(e==="?"){if(!(p&&p.value==="(")&&Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){R0("qmark",e);continue}if(p&&p.type==="paren"){let O1=q1(),A1=e;if(p.value==="("&&!/[!=<:]/.test(O1)||O1==="<"&&!/<([!=]|\w+>)/.test(r()))A1=`\\${e}`;j1({type:"text",value:e,output:A1});continue}if(Z.dot!==!0&&(p.type==="slash"||p.type==="bos")){j1({type:"qmark",value:e,output:P});continue}j1({type:"qmark",value:e,output:I});continue}if(e==="!"){if(Z.noextglob!==!0&&q1()==="("){if(q1(2)!=="?"||!/[!=<:]/.test(q1(3))){R0("negate",e);continue}}if(Z.nonegate!==!0&&m.index===0){_1();continue}}if(e==="+"){if(Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){R0("plus",e);continue}if(p&&p.value==="("||Z.regex===!1){j1({type:"plus",value:e,output:z});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||m.parens>0){j1({type:"plus",value:e});continue}j1({type:"plus",value:z});continue}if(e==="@"){if(Z.noextglob!==!0&&q1()==="("&&q1(2)!=="?"){j1({type:"at",extglob:!0,value:e,output:""});continue}j1({type:"text",value:e});continue}if(e!=="*"){if(e==="$"||e==="^")e=`\\${e}`;let Z1=NV4.exec(r());if(Z1)e+=Z1[0],m.index+=Z1[0].length;j1({type:"text",value:e});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=e,p.output=d,m.backtrack=!0,m.globstar=!0,l(e);continue}let r1=r();if(Z.noextglob!==!0&&/^\([^?]/.test(r1)){R0("star",e);continue}if(p.type==="star"){if(Z.noglobstar===!0){l(e);continue}let Z1=p.prev,O1=Z1.prev,A1=Z1.type==="slash"||Z1.type==="bos",T1=O1&&(O1.type==="star"||O1.type==="globstar");if(Z.bash===!0&&(!A1||r1[0]&&r1[0]!=="/")){j1({type:"star",value:e,output:""});continue}let S1=m.braces>0&&(Z1.type==="comma"||Z1.type==="brace"),c1=n.length&&(Z1.type==="pipe"||Z1.type==="paren");if(!A1&&Z1.type!=="paren"&&!S1&&!c1){j1({type:"star",value:e,output:""});continue}while(r1.slice(0,3)==="/**"){let g1=J[m.index+4];if(g1&&g1!=="/")break;r1=r1.slice(3),l("/**",3)}if(Z1.type==="bos"&&F1()){p.type="globstar",p.value+=e,p.output=y(Z),m.output=p.output,m.globstar=!0,l(e);continue}if(Z1.type==="slash"&&Z1.prev.type!=="bos"&&!T1&&F1()){m.output=m.output.slice(0,-(Z1.output+p.output).length),Z1.output=`(?:${Z1.output}`,p.type="globstar",p.output=y(Z)+(Z.strictSlashes?")":"|$)"),p.value+=e,m.globstar=!0,m.output+=Z1.output+p.output,l(e);continue}if(Z1.type==="slash"&&Z1.prev.type!=="bos"&&r1[0]==="/"){let g1=r1[1]!==void 0?"|$":"";m.output=m.output.slice(0,-(Z1.output+p.output).length),Z1.output=`(?:${Z1.output}`,p.type="globstar",p.output=`${y(Z)}${U}|${U}${g1})`,p.value+=e,m.output+=Z1.output+p.output,m.globstar=!0,l(e+o()),j1({type:"slash",value:"/",output:""});continue}if(Z1.type==="bos"&&r1[0]==="/"){p.type="globstar",p.value+=e,p.output=`(?:^|${U}|${y(Z)}${U})`,m.output=p.output,m.globstar=!0,l(e+o()),j1({type:"slash",value:"/",output:""});continue}m.output=m.output.slice(0,-p.output.length),p.type="globstar",p.output=y(Z),p.value+=e,m.output+=p.output,m.globstar=!0,l(e);continue}let z1={type:"star",value:e,output:d};if(Z.bash===!0){if(z1.output=".*?",p.type==="bos"||p.type==="slash")z1.output=v+z1.output;j1(z1);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&Z.regex===!0){z1.output=e,j1(z1);continue}if(m.index===m.start||p.type==="slash"||p.type==="dot"){if(p.type==="dot")m.output+=A,p.output+=A;else if(Z.dot===!0)m.output+=E,p.output+=E;else m.output+=v,p.output+=v;if(q1()!=="*")m.output+=D,p.output+=D}j1(z1)}while(m.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing","]"));m.output=NK.escapeLast(m.output,"["),u1("brackets")}while(m.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing",")"));m.output=NK.escapeLast(m.output,"("),u1("parens")}while(m.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(SE("closing","}"));m.output=NK.escapeLast(m.output,"{"),u1("braces")}if(Z.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket"))j1({type:"maybe_slash",value:"",output:`${U}?`});if(m.backtrack===!0){m.output="";for(let r1 of m.tokens)if(m.output+=r1.output!=null?r1.output:r1.value,r1.suffix)m.output+=r1.suffix}return m};vH1.fastpaths=(J,Q)=>{let Z={...Q},Y=typeof Z.maxLength==="number"?Math.min(wn,Z.maxLength):wn,X=J.length;if(X>Y)throw SyntaxError(`Input length: ${X}, exceeds maximum allowed length: ${Y}`);J=pD0[J]||J;let{DOT_LITERAL:G,SLASH_LITERAL:V,ONE_CHAR:K,DOTS_SLASH:q,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:D}=On.globChars(Z.windows),M=Z.dot?H:W,L=Z.dot?z:W,A=Z.capture?"":"?:",E={negated:!1,prefix:""},I=Z.bash===!0?".*?":U;if(Z.capture)I=`(${I})`;let P=(v)=>{if(v.noglobstar===!0)return I;return`(${A}(?:(?!${D}${v.dot?q:G}).)*?)`},C=(v)=>{switch(v){case"*":return`${M}${K}${I}`;case".*":return`${G}${K}${I}`;case"*.*":return`${M}${I}${G}${K}${I}`;case"*/*":return`${M}${I}${V}${K}${L}${I}`;case"**":return M+P(Z);case"**/*":return`(?:${M}${P(Z)}${V})?${L}${K}${I}`;case"**/*.*":return`(?:${M}${P(Z)}${V})?${L}${I}${G}${K}${I}`;case"**/.*":return`(?:${M}${P(Z)}${V})?${G}${K}${I}`;default:{let b=/^(.*?)\.(\w+)$/.exec(v);if(!b)return;let d=C(b[1]);if(!d)return;return d+G+b[2]}}},k=NK.removePrefix(J,E),y=C(k);if(y&&Z.strictSlashes!==!0)y+=`${V}?`;return y};dD0.exports=vH1});var $y=h((Zl8,iD0)=>{var LV4=uD0(),fH1=cD0(),lD0=Yy(),AV4=Zy(),OV4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),Q3=(J,Q,Z=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>Q3(U,Q,Z));return(U)=>{for(let D of H){let M=D(U);if(M)return M}return!1}}let Y=OV4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!Y)throw TypeError("Expected pattern to be a non-empty string");let X=Q||{},G=X.windows,V=Y?Q3.compileRe(J,Q):Q3.makeRe(J,Q,!1,!0),K=V.state;delete V.state;let q=()=>!1;if(X.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};q=Q3(X.ignore,H,Z)}let W=(H,z=!1)=>{let{isMatch:U,match:D,output:M}=Q3.test(H,V,Q,{glob:J,posix:G}),L={glob:J,state:K,regex:V,posix:G,input:H,output:M,match:D,isMatch:U};if(typeof X.onResult==="function")X.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(q(H)){if(typeof X.onIgnore==="function")X.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof X.onMatch==="function")X.onMatch(L);return z?L:!0};if(Z)W.state=K;return W};Q3.test=(J,Q,Z,{glob:Y,posix:X}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let G=Z||{},V=G.format||(X?lD0.toPosixSlashes:null),K=J===Y,q=K&&V?V(J):J;if(K===!1)q=V?V(J):J,K=q===Y;if(K===!1||G.capture===!0)if(G.matchBase===!0||G.basename===!0)K=Q3.matchBase(J,Q,Z,X);else K=Q.exec(q);return{isMatch:Boolean(K),match:K,output:q}};Q3.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:Q3.makeRe(Q,Z)).test(lD0.basename(J))};Q3.isMatch=(J,Q,Z)=>Q3(Q,Z)(J);Q3.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>Q3.parse(Z,Q));return fH1(J,{...Q,fastpaths:!1})};Q3.scan=(J,Q)=>LV4(J,Q);Q3.compileRe=(J,Q,Z=!1,Y=!1)=>{if(Z===!0)return J.output;let X=Q||{},G=X.contains?"":"^",V=X.contains?"":"$",K=`${G}(?:${J.output})${V}`;if(J&&J.negated===!0)K=`^(?!${K}).*$`;let q=Q3.toRegex(K,Q);if(Y===!0)q.state=J;return q};Q3.makeRe=(J,Q={},Z=!1,Y=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let X={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))X.output=fH1.fastpaths(J,Q);if(!X.output)X=fH1(J,Q);return Q3.compileRe(X,Q,Z,Y)};Q3.toRegex=(J,Q)=>{try{let Z=Q||{};return new RegExp(J,Z.flags||(Z.nocase?"i":""))}catch(Z){if(Q&&Q.debug===!0)throw Z;return/$^/}};Q3.constants=AV4;iD0.exports=Q3});var nD=h((Yl8,oD0)=>{var nD0=$y(),wV4=Yy();function aD0(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:wV4.isWindows()};return nD0(J,Q,Z)}Object.assign(aD0,nD0);oD0.exports=aD0});var _E;var hH1=N1(()=>{_E={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && pnpm run -s _build:web","build:production":"pnpm run -s _build:extension:production && pnpm run -s _build:web:production","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team",email:"amp-devs@ampcode.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp",enablement:"amp.isSourcegraphTeammate"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.guidanceFilesInContext":{type:"boolean",default:!1,markdownDescription:"Deliver AGENTS.md guidance files in message context instead of system prompt for improved cache efficiency.",scope:"window"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debug.logReview":{type:"boolean",default:!1,description:"Enable debug logging for review git operations",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.courseCorrection.enabled":{type:"boolean",default:!1,description:"Enable course correction agent that monitors the thread and provides guidance when the model goes off track",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3",zod:"catalog:"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function IV4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function sD0(J){let Q=J.settings["tools.inactivityTimeout"],Z=J.settings["tools.stopTimeout"],Y=Q;if(Y===void 0&&Z!==void 0)Y=Z;if(Y===void 0)Y=_E.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!IV4(Y))return null;return Y*1000}function tD0(J){let Q=J.settings["tools.stopTimeout"],Z=_E.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var rD0;var En=N1(()=>{hH1();rD0=_E.contributes.configuration.properties});function d3(J){let Q=I8[J];return`${Q.provider}/${Q.name}`}function zZ(J){let Q=J.indexOf("/");if(Q===-1)throw Error(`Invalid provider/model format: ${J}`);let Z=J.slice(0,Q),Y=J.slice(Q+1);for(let X of Object.values(I8))if(X.provider===Z&&X.name===Y)return X;switch(Z){case"anthropic":return I8.CLAUDE_SONNET_4_5;case"openai":return I8.GPT_5;case"xai":return I8.GROK_CODE_FAST_1;case"cerebras":return I8.Z_AI_GLM_4_6;case"fireworks":return I8.FIREWORKS_GLM_4P6;case"moonshotai":return I8.KIMI_K2_INSTRUCT;case"openrouter":return I8.SONOMA_SKY_ALPHA;case"groq":return I8.GPT_OSS_120B;case"vertexai":return I8.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Z}`)}}function eD0(J){for(let Q of Object.values(I8))if(Q.name===J)return Q;return}function LQ(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function MG(J,Q){let Z=zZ(J);if(Q&&Z.maxInputTokensInFreeMode)return Z.maxInputTokensInFreeMode;return Z.contextWindow-Z.maxOutputTokens}function JM0(J,Q){if(!Q?.pricing?.cached||!Q.pricing.cacheWrite)return 0;let Z=Q.pricing.cacheWrite/1e6,Y=Q.pricing.cached/1e6;return J*(Z-Y)}function QM0(J){return J?.pricing?.cacheTTL??300}var F9,I8,bH1;var KY=N1(()=>{F9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},I8={CLAUDE_SONNET_4:{provider:F9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:F9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,pricing:{input:3,output:15,cached:0.3,cacheWrite:3.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:F9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:F9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,pricing:{input:15,output:75,cached:1.5,cacheWrite:18.75,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:F9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,pricing:{input:5,output:25,cached:0.5,cacheWrite:6.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:F9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,pricing:{input:1,output:5,cached:0.1,cacheWrite:1.25,cacheTTL:300},capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:F9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:F9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:F9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:F9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:F9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:F9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:F9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:F9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:F9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:F9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:F9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:F9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:F9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:F9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:F9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:F9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,freeTierEligible:!0,maxOutputTokens:40000,capabilities:{tools:!0,reasoning:!0}},KIMI_K2_INSTRUCT:{provider:F9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:F9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:F9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:F9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:F9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:F9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};bH1={FINDER:"finder"}});function gH1(J,Q){let Z=DK(Q);if(!Z)return!1;if(PV4.has(J)){let Y=Z.finder??bH1.FINDER,X=TV4[Y];if(J!==X)return!1}if(Z.includeTools)return Z.includeTools.includes(J);return!0}function _X(J,Q){let Z=J?.["internal.visibleModes"]??[];return Object.values(kE).filter((Y)=>{if(Z.includes(`!${Y.key}`))return!1;if(Q===!1&&d9(Y.key))return!1;let G="visible"in Y?Y.visible:!1,V=Z.includes(Y.key),K=Y.key==="plan"&&J?.["experimental.planMode"]===!0,q=J?.["experimental.dojoMode"]===!0;if(Y.key==="free-dojo")return q&&(Q===!0||Q===void 0);if(Y.key==="dojo")return q&&(Q===!1||Q===void 0);return G||V||K}).map((Y)=>({mode:Y.key,description:"description"in Y?Y.description:void 0})).sort((Y,X)=>Y.mode.localeCompare(X.mode))}function DK(J){return Object.values(kE).find((Q)=>Q.key===J)}function aD(J){return DK(J)?.primaryModel??d3("CLAUDE_SONNET_4_5")}function Gy(J){let Q=DK(J);if(!Q)return!1;return zZ(Q.primaryModel).capabilities?.vision??!1}function d9(J){return J==="free"||J.startsWith("free-")}function mH1(J,Q){return Q.find((Z)=>Z.mode===J)?.description}function uH1(J,Q){let Y=(Q.findIndex((G)=>G.mode===J)+1)%Q.length;return Q[Y]?.mode??"smart"}var PV4,TV4,YM0,XM0,RV4,CV4,ZM0,jV4,SV4,kE,_V4;var LG=N1(()=>{KY();PV4=new Set(["finder"]),TV4={finder:"finder"},YM0={r:0,g:55,b:0},XM0={r:0,g:255,b:136},RV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","find_thread","skill"],CV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at"],ZM0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],jV4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","read_thread","web_search","read_web_page"],SV4=["Read","Grep","glob","finder","Bash","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","find_thread","skill","oracle","librarian","Task","kraken","look_at","code_review"],kE={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:d3("CLAUDE_OPUS_4_5"),includeTools:SV4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:RV4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:CV4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:d3("GPT_5_1_CODEX"),includeTools:jV4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:d3("CLAUDE_HAIKU_4_5"),includeTools:ZM0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:d3("CLAUDE_SONNET_4_5"),includeTools:ZM0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},_V4=Object.values(kE).map((J)=>J.key)});function In(J,Q,Z){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let Y="subagentType"in Q?Q.subagentType:void 0;if(Y&&Z){if(!Z.subagentTypes)return!1;return Z.subagentTypes.includes("all")||Z.subagentTypes.includes(Y)}return!0}return Q.includeTools.includes(J)}var kV4,yV4,pH1,xV4,vV4,fV4,hV4,bV4,k7,Hl8;var MK=N1(()=>{KY();kV4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],yV4=["Grep","glob","Read"],pH1=["Read","Grep","glob","web_search","read_web_page","read_thread","find_thread"],xV4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],vV4=["Read","glob","Grep","enqueue_file_edit","fastmod"],fV4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],hV4=["describe_workbook","execute_query"],bV4=["Read","Grep","glob","web_search","read_web_page","Bash"],k7={finder:{key:"finder",displayName:"Finder",model:d3("CLAUDE_HAIKU_4_5"),includeTools:yV4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:d3("GPT_5_1"),includeTools:pH1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:d3("CLAUDE_HAIKU_4_5"),includeTools:kV4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:xV4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:d3("CLAUDE_HAIKU_4_5"),includeTools:vV4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:d3("CLAUDE_HAIKU_4_5"),includeTools:fV4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:d3("CLAUDE_HAIKU_4_5"),includeTools:hV4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:d3("CLAUDE_SONNET_4_5"),includeTools:bV4,allowMcp:!1,allowToolbox:!1}},Hl8=Object.keys(k7)});function $M0(J,Q){return new Q0((Z)=>{let Y=setTimeout(X,Q);function X(){Z.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function G(){if(Y)clearTimeout(Y);Y=setTimeout(X,Q)}let V=J.subscribe({next:(K)=>{G(),Z.next(K)},error:(K)=>{if(Y)clearTimeout(Y),Y=null;Z.error(K)},complete:()=>{if(Y)clearTimeout(Y),Y=null;Z.complete()}});return()=>{if(Y)clearTimeout(Y),Y=null;V.unsubscribe()}})}var GM0=N1(()=>{o0()});function X7(J,Q){let Z={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},Y=Q.modelCustomizations;if(Y){for(let X of Y)if(X.modelSelector.test(J))Z={...Z,name:X.name??Z.name,description:X.description??Z.description,inputSchema:X.inputSchema??Z.inputSchema,customizedForModel:!0}}return Z}function Z3(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function qM0(J){return["done","error","cancelled"].includes(J.status)}function dH1(J){return typeof J==="object"&&"key"in J}function Pn(J){let Q=[],Z=new u4,Y;function X(V,K){let q=Q.filter((W)=>W.spec.name===V);if(q.length===0){let W=V.toLowerCase();q=Q.filter((H)=>H.spec.name.toLowerCase()===W)}for(let W of q)if(xE(W.spec,K).enabled)return W;return}function G(V,K,q){if(!V)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===V.name),H=W!==-1?Q[W]:void 0;if(V.source!=="builtin"&&H?.spec.source==="builtin")return x.warn("Ignoring external tool registration - builtin takes precedence",{toolName:V.name,externalSource:V.source}),{dispose:()=>{}};let D={spec:V,fn:Promise.resolve(K),preprocessArgs:q};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(V.source))Q[W]=D;else Q.push(D);return Z.next(),{dispose:()=>{let L=Q.indexOf(D);if(L!==-1)Q.splice(L,1),Z.next()}}}return J.configService.config.subscribe((V)=>{Y=V}),{registerTool({spec:V,fn:K,preprocessArgs:q}){if(!K)return gV4;return G(V,K,q)},tools:j8(J.configService.config,Z.pipe(S8(void 0))).pipe(Q6(([V])=>{return Q.map((K)=>({spec:K.spec,...xE(K.spec,V)})).sort((K,q)=>K.spec.name.localeCompare(q.spec.name))})),invokeTool(V,K,q){let W=performance.now(),H=()=>mV4.record(performance.now()-W,{toolName:V});if(V===lH1&&K.args&&"invalid_tool_name"in K.args&&typeof K.args.invalid_tool_name==="string"){yE.add(1,{toolName:V,error:"invalid"});let D=cH1(K.args.invalid_tool_name);return new Q0((M)=>{M.error(Error(D))})}let z=X(V,q.config);if(!z){let D=V.toLowerCase(),M=Q.filter((I)=>I.spec.name.toLowerCase()===D);if(M.length===0)return yE.add(1,{toolName:V,error:"not_found"}),new Q0((I)=>{I.error(Error(`tool ${JSON.stringify(V)} not found`))});let L=M[0],A=xE(L.spec,q.config);yE.add(1,{toolName:V,error:"disabled"});let E=A.enabled?"unknown":A.disabledReason;return new Q0((I)=>{I.error(Error(`tool ${JSON.stringify(V)} is disabled: ${E}`))})}let U=q.subagentSpec??q.agentMode;if(U&&!this.isToolAllowed(V,U)){yE.add(1,{toolName:V,error:"disabled"});let D=dH1(U)?U.displayName??U.key:`${U} mode`;return new Q0((M)=>{M.error(Error(`tool ${JSON.stringify(V)} is not allowed for ${D}`))})}if(q.thread.mainThreadID&&!q.subagentSpec&&!In(V,k7["task-subagent"]))return yE.add(1,{toolName:V,error:"disabled"}),new Q0((D)=>{D.error(Error(`tool ${JSON.stringify(V)} is not allowed for subagents`))});return yE.add(1,{toolName:V}),l6(()=>z.fn).pipe(T4((D)=>{let M=D(K,q);if(z.spec.meta?.disableTimeout)return M;return $M0(M,tD0(q.config))}),BG(()=>H()))},preprocessArgs(V,K,q){let W=X(V,q.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(K,q)}catch(z){x.error("preprocessArgs",{id:V,args:K,error:String(z)});return}},isToolAllowed(V,K){let q=Q.find((H)=>H.spec.name===V),W=q?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(dH1(K))return In(V,K,q?.spec.meta);return gH1(V,K)},getTools(V){return j8(J.configService.config,Z.pipe(S8(void 0))).pipe(Q6(([K])=>{return Q.filter((q)=>{let W=q.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(dH1(V))return In(q.spec.name,V,q.spec.meta);return gH1(q.spec.name,V)}).map((q)=>({spec:q.spec,...xE(q.spec,K)})).sort((q,W)=>q.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(V,K){if(K)return this.getTools(k7["task-subagent"]);return this.getTools(V)},getExecutionProfile(V){if(!Y)return;return X(V,Y)?.spec.executionProfile},dispose(){}}}function Vy(J,Q){for(let Z of Q){if(Z==="")continue;if(Z.length===1){if(Z==="*")return!0;if(Z===J)return!0;continue}if(J===Z)return!0;if(Z.includes("*")||Z.includes("?")||Z.includes("[")||Z.includes("{"))try{if(KM0.default(Z,{dot:!0})(J))return!0}catch(Y){continue}}return!1}function xE(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(Vy(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let Y=uV4(J.name);if(Y){if(J.source.mcp.replace(/[\s-]+/g,"_")===Y.server){if(Vy(Y.tool,Z))return{enabled:!1,disabledReason:"settings"};let G=`mcp__${J.source.mcp}__${Y.tool}`;if(Vy(G,Z))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Vy(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Vy(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===i5||J.name===BK){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function cH1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Ky.toString()}. Try again with a valid tool name.`}function uV4(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function iH1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var VM0,KM0,gV4,lH1="invalid_tool",Ky,WM0,yE,mV4;var A7=N1(()=>{o0();U0();En();LG();MK();GM0();M4();VM0=W6(k6(),1),KM0=W6(nD(),1);gV4={dispose(){}};Ky=/^[-a-zA-Z0-9_]{1,64}$/,WM0=VM0.metrics.getMeter("tool_service"),yE=WM0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),mV4=WM0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var NM0=h((UM0)=>{Object.defineProperty(UM0,"__esModule",{value:!0});UM0.calcSlices=UM0.applyPatch=UM0.calcPatch=UM0.lcs=UM0.diff=UM0.diff_core=void 0;function pV4(J,Q){let{b:Z,eq:Y,stack_base:X}=J,{i:G,N:V,j:K,M:q,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(V>0&&q>0){Z.fill(0,0,2*W);let z=V-q,U=V+q,D=U&1,M=G+V-1,L=K+q-1,A=(U+D)/2,E;Q:for(let I=0;I<=A;I++){let P=2*Math.max(0,I-q)-I,C=I-2*Math.max(0,I-V);for(let k=P;k<=C;k+=2){let y=Z[k-1-W*Math.floor((k-1)/W)],v=Z[k+1-W*Math.floor((k+1)/W)],b=k===-I||k!==I&&y<v?v:y+1,d=b-k,m=b,n=d;while(m<V&&n<q&&Y(G+m,K+n))m++,n++;if(Z[k-W*Math.floor(k/W)]=m,D===1&&(E=z-k)>=1-I&&E<I&&m+Z[W+E-W*Math.floor(E/W)]>=V)if(I>1||m!==b){X[H++]=G+m,X[H++]=V-m,X[H++]=K+n,X[H++]=q-n,V=b,q=d,W=2*(Math.min(V,q)+1);continue J}else break Q}for(let k=P;k<=C;k+=2){let y=Z[W+k-1-W*Math.floor((k-1)/W)],v=Z[W+k+1-W*Math.floor((k+1)/W)],b=k===-I||k!==I&&y<v?v:y+1,d=b-k,m=b,n=d;while(m<V&&n<q&&Y(M-m,L-n))m++,n++;if(Z[W+k-W*Math.floor(k/W)]=m,D===0&&(E=z-k)>=-I&&E<=I&&m+Z[E-W*Math.floor(E/W)]>=V)if(I>0||m!==b){X[H++]=G+V-b,X[H++]=b,X[H++]=K+q-d,X[H++]=d,V=V-m,q=q-n,W=2*(Math.min(V,q)+1);continue J}else break Q}}if(V===q)continue;if(q>V)G+=V,K+=V,q-=V,V=0;else G+=q,K+=q,V-=q,q=0;break}if(V+q!==0)if(J.pxe===G||J.pye===K)J.pxe=G+V,J.pye=K+q;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=G,J.pxe=G+V,J.pys=K,J.pye=K+q,z>=0)return J.i=G,J.N=V,J.j=K,J.M=q,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;q=X[--H],K=X[--H],V=X[--H],G=X[--H],W=2*(Math.min(V,q)+1),Q=0}}}class HM0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Z=pV4(J,this.c);if(this.c=Z,Z===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function zM0(J,Q,Z,Y,X){let G=(Math.min(Q,Y)+1)*2,V=Q+Y,K=new(V<256?Uint8Array:V<65536?Uint16Array:Uint32Array)(2*G);return new HM0({i:J,N:Q,j:Z,M:Y,Z:G,b:K,eq:X,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}UM0.diff_core=zM0;function Tn(J,Q,Z){let[Y,X,G]=[0,J.length,Q.length];if(typeof Z==="function"){while(Y<X&&Y<G&&Z(Y,Y))Y++;if(Y===X&&Y===G)return[][Symbol.iterator]();while(Z(--X,--G)&&X>Y&&G>Y);}else{while(Y<X&&Y<G&&J[Y]===Q[Y])Y++;if(Y===X&&Y===G)return[][Symbol.iterator]();while(J[--X]===Q[--G]&&X>Y&&G>Y);Z=(V,K)=>J[V]===Q[K]}return zM0(Y,X+1-Y,Y,G+1-Y,Z)}UM0.diff=Tn;class FM0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:K,j:q,N:W}=this;if(K<W)J.done=!1,J.value=[K,q,W-K],this.i=W;return J}let Q=J.value,Z=Q[0],Y=Q[1],X=Q[3],{i:G,j:V}=this;if(G!==Z)Q.length--,Q[0]=G,Q[1]=V,Q[2]=Z-G;return this.i=Y,this.j=X,J}}function dV4(J,Q,Z){return new FM0(Tn(J,Q,Z),J.length)}UM0.lcs=dV4;function*cV4(J,Q,Z){let Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let X of Tn(J,Q,Z))X[2]=Y.call(Q,X[2],X[3]),yield X}UM0.calcPatch=cV4;function*lV4(J,Q){let Z=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[X,G,V]of Q){if(Z<X)yield Y.call(J,Z,X);if(V.length>0)yield V;Z=G}if(Z<J.length)yield Y.call(J,Z)}UM0.applyPatch=lV4;function*iV4(J,Q,Z){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,V,K,q]of Tn(J,Q,Z)){if(Y<G)yield[0,X.call(J,Y,G)];if(G<V)yield[-1,X.call(J,G,V)];if(K<q)yield[1,X.call(Q,K,q)];Y=V}if(Y<J.length)yield[0,J.slice(Y)]}UM0.calcSlices=iV4});function vE(J,Q){let Z={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Z;if(J===Q)return Z;try{let Y={added:0,deleted:0,changed:0};for(let[X,G,V,K]of DM0.diff(J.split(`
71
71
  `),Q.split(`
72
72
  `)))Y.deleted+=G-X,Y.added+=K-V,Y.changed+=Math.min(G-X,K-V);return Y}catch{return Z}}function MM0(J){if(typeof J!=="string")return{added:0,deleted:0,changed:0};return{added:J.split(`
73
73
  `).length,deleted:0,changed:0}}function nH1(J){if(!J)return{totalFiles:0,createdFiles:0,totalAdded:0,totalRemoved:0,totalModified:0,revertedFiles:0,allReverted:!1};let Q=J.files.length,Z=J.files.filter((q)=>q.created).length,Y=J.files.filter((q)=>q.reverted).length,X=Y===Q&&Q>0,G=0,V=0,K=0;for(let q of J.files){if(q.reverted)continue;G+=q.diffStat.added,V+=q.diffStat.removed,K+=q.diffStat.modified}return{totalFiles:Q,createdFiles:Z,totalAdded:G,totalRemoved:V,totalModified:K,revertedFiles:Y,allReverted:X}}var DM0;var qy=N1(()=>{DM0=W6(NM0(),1)});function AG(){return`T-${crypto.randomUUID()}`}function OG(J){if(!J.startsWith("T-"))return!1;let Q=J.slice(2);return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(Q)}function oD(){return`toolu_${crypto.randomUUID()}`}function fE(J,Q,Z=oD()){return{type:"tool_use",complete:!0,id:Z,name:J,input:Q}}function T3(J){if("complete"in J)return J.complete;return!("inputPartialJSON"in J)}function aH1(J){return J.role==="user"&&J.source?.type==="course-correction"}function LM0(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="info"){let Y=Z.content[0];if(Y?.type==="summary"&&Y?.summary.type==="message")return}if(Z?.role==="assistant"&&Z.usage){if(Z.usage.totalInputTokens===0)continue;return Z.usage}}return J["~debug"]?.lastInferenceUsage}function qY(J,Q){for(let Z of J.messages){if(Z.role!=="assistant")continue;for(let Y of Z.content)if(Y.type==="tool_use"&&Y.id===Q)return Y}return}function hE(J,Q){for(let[Z,Y]of J.messages.entries()){if(Y.role!=="assistant")continue;for(let[X,G]of Y.content.entries())if(G.type==="tool_use"&&G.id===Q)return{message:Y,messageIndex:Z,block:G,blockIndex:X}}return null}function xW(J,Q){for(let Z of J.messages){if(Z.role!=="user")continue;for(let Y of Z.content)if(Y.type==="tool_result"&&Y.toolUseID===Q)return Y}return}function kJ(J){return J.messages.filter((Q)=>Q.role==="user").flatMap((Q)=>Q.content).filter((Q)=>Q.type==="tool_result").reduce((Q,Z)=>{return Q.set(Z.toolUseID,Z),Q},new Map)}function oH1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&OG(Q))return Q}return}function rH1(J){let Q=[],Z=new Map;for(let Y of J)if(Y.role==="assistant"){for(let X of Y.content)if(X.type==="tool_use"&&X.name===b2)Z.set(X.id,X)}else if(Y.role==="user"){for(let X of Y.content)if(X.type==="tool_result"){let G=Z.get(X.toolUseID);if(G){let V=X.run,K=(V.status==="in-progress"||V.status==="cancelled"||V.status==="done"||V.status==="error")&&V.progress?oH1(V.progress):void 0;if(K)Q.push({toolUseID:X.toolUseID,threadID:K,toolUse:G,toolResult:X})}}}return Q}function AM0(J,Q="Untitled"){if(J.title)return qn(J.title,300);return Q}function OM0(J){if(!J)return!1;if(J.role==="assistant")return J.state?.type==="cancelled";if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="cancelled");return!1}function wM0(J){if(!J)return!1;if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="rejected-by-user");return!1}function sH1(J){if(!J)return!1;return J.role==="info"}function bE(J){return J.role==="info"&&J.content.some((Q)=>Q.type==="manual_bash_invocation")}function Rn(J){if(J.role!=="info")return;return J.content.find((Q)=>Q.type==="manual_bash_invocation")}function tV4(J){return J.replace(/u([0-9A-Fa-f]{4})(\s)/gi,(Q,Z,Y)=>{try{return String.fromCodePoint(parseInt(Z,16))+Y}catch{return`u${Z}${Y}`}})}function gE(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="info"){if(Z.content.some((X)=>X.type==="summary"&&X.summary.type==="message"))break}if(Z?.role!=="assistant"||!Z.state||Z.state.type!=="complete"||Z.state.stopReason!=="tool_use")continue;for(let Y of Z.content)if(Y.type==="tool_use"&&Y.name===i5&&Y.input){let X=Y.input.todos;if(Array.isArray(X))return X;let G=Y.input.content;if(typeof G==="string")return tV4(G)}}return}function Y3(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
@@ -1713,7 +1713,7 @@ List of files (top-level only) in the user's workspace:
1713
1713
  ${q.rootDirectoryListing}
1714
1714
  `:null].filter((D)=>D!==null).join(`
1715
1715
 
1716
- `)}),{blocks:H,hasMultipleRoots:W}}async function L2(J,Q,{enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G},{model:V,provider:K,agentMode:q},W){let H=Boolean(Q.mainThreadID),z=await H6(J.toolService.getToolsForMode(q,H),W),D=(await H6(J.configService.workspaceRoots,W)??[]).map((q1)=>T6(q1)),M=await Promise.all(z.filter(({enabled:q1})=>q1).filter(({spec:q1})=>Z||q1.name!==BK&&q1.name!==i5).filter(({spec:q1})=>Y||q1.name!==b2).filter(({spec:q1})=>X||q1.name!==B5).map(async({spec:q1})=>{if(q1.name===Qy)return Uy0(q1,J.filesystem,D,W);return q1}));Z=M.some((q1)=>q1.name===BK)&&M.some((q1)=>q1.name===i5),Y=M.some((q1)=>q1.name===b2),X=M.some((q1)=>q1.name===B5),G=M.some((q1)=>q1.name===HZ);let L=M.some((q1)=>q1.name===iD),A=await J.configService.getLatest(),E=A.settings["experimental.guidanceFilesInContext"]??!0,I=q==="plan",P=q==="free-dojo"||q==="dojo",C=d9(q),k=q==="rush",y="default",v=zZ(`${K}/${V}`);if(I)y="plan";else if(P)y="dojo";else if(C)y="free";else if(k)y="rush";else if(v){if(v.name==="gpt-5-codex")y="gpt-5-codex";else if(v.provider==="openai"||v.name==="kimi-k2-instruct-0905")y="gpt";else if(v.provider==="xai")y="xai";else if(v.provider==="vertexai")y="gemini"}else if(V.includes("gpt-5-codex"))y="gpt-5-codex";else if(V.includes("gpt")||V.includes("moonshotai/kimi-k2-instruct-0905"))y="gpt";else if(K==="xai")y="xai";else if(K==="vertexai")y="gemini";let b;switch(y){case"plan":b=_y0();break;case"dojo":b=Oy0();break;case"free":b=Ey0();break;case"rush":b=yy0({enableDiagnostics:G});break;case"gpt":b=Ry0();break;case"gpt-5-codex":b=jy0();break;case"xai":b=vy0();break;case"gemini":b=Py0({enableTodos:Z,enableOracle:X,enableDiagnostics:G,enableCheck:L});break;default:b=$f4({enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L});break}let{blocks:d,hasMultipleRoots:m}=await Wf4(J,Q,W),n=[];if(y==="default")n.push({type:"text",text:Z?Vf4:Kf4});if(A.settings["anthropic.toolSearchTool.enabled"]===!0&&V.includes("claude-opus-4-5"))n.push({type:"text",text:Gf4});let t=[{type:"text",text:b,cache_control:{type:"ephemeral"}},...Ms(d),...Ms(n)],p=null,e=A.settings["internal.scaffoldCustomizationFile"];if(e)try{let q1=await J.filesystem.readFile(f0.file(e),{signal:W}),o=jM1.default.parse(q1);p=My0(o)}catch(q1){let o={systemPrompt:{type:"replaceAll",value:t.map(({text:l})=>l)},enableToolSpecs:M.map(({name:l})=>({name:l})),disableTools:[]},r=jM1.default.stringify(o,{lineWidth:0,blockQuote:"literal"});await(J.writeFile??Hf4)(e,r)}if(p){let q1=p?Ly0(M,p):M,o=t;if(p.systemPrompt){let l=(typeof p.systemPrompt.value==="string"?[p.systemPrompt.value]:p.systemPrompt.value).map((W1)=>({type:"text",text:W1}));switch(p.systemPrompt.type){case"replaceAll":o=l;break;case"replaceBase":o=[...l,...d,...n];break}}let r=await hy0(b,d,n,o,q1);return by0(Q.id,r,{basePrompt:b,contextComponents:d,additionalComponents:n,finalBlocks:o,tools:q1},{model:V,provider:K,agentMode:q,isPlanMode:I,isFreeMode:C,basePromptType:y,enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L,hasScaffoldCustomization:!0,scaffoldCustomizationType:p.systemPrompt?.type}),{systemPrompt:Ms(o),tools:q1,guidanceFilesInContext:E,hasMultipleRoots:m}}let F1=await hy0(b,d,n,t,M);return by0(Q.id,F1,{basePrompt:b,contextComponents:d,additionalComponents:n,finalBlocks:t,tools:M},{model:V,provider:K,agentMode:q,isPlanMode:I,isFreeMode:C,basePromptType:y,enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L,hasScaffoldCustomization:!1,scaffoldCustomizationType:void 0}),{systemPrompt:t,tools:M,guidanceFilesInContext:E,hasMultipleRoots:m}}async function Hf4(J,Q){{let{writeFile:Z}=await import("node:fs/promises");await Z(J,Q,"utf8"),x.info("Created scaffold customization file",{file:J})}}var jM1,CM1,gy0,$f4=({enableTodos:J=!1,enableTask:Q=!1,enableOracle:Z=!1,enableDiagnostics:Y=!1,enableCheck:X=!1})=>`You are Amp, a powerful AI coding agent. You help the user with software engineering tasks. Use the instructions below and the tools available to you to help the user.
1716
+ `)}),{blocks:H,hasMultipleRoots:W}}async function L2(J,Q,{enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G},{model:V,provider:K,agentMode:q},W){let H=Boolean(Q.mainThreadID),z=await H6(J.toolService.getToolsForMode(q,H),W),D=(await H6(J.configService.workspaceRoots,W)??[]).map((q1)=>T6(q1)),M=await Promise.all(z.filter(({enabled:q1})=>q1).filter(({spec:q1})=>Z||q1.name!==BK&&q1.name!==i5).filter(({spec:q1})=>Y||q1.name!==b2).filter(({spec:q1})=>X||q1.name!==B5).map(async({spec:q1})=>{if(q1.name===Qy)return Uy0(q1,J.filesystem,D,W);return q1}));Z=M.some((q1)=>q1.name===BK)&&M.some((q1)=>q1.name===i5),Y=M.some((q1)=>q1.name===b2),X=M.some((q1)=>q1.name===B5),G=M.some((q1)=>q1.name===HZ);let L=M.some((q1)=>q1.name===iD),A=await J.configService.getLatest(),E=A.settings["experimental.guidanceFilesInContext"]??!1,I=q==="plan",P=q==="free-dojo"||q==="dojo",C=d9(q),k=q==="rush",y="default",v=zZ(`${K}/${V}`);if(I)y="plan";else if(P)y="dojo";else if(C)y="free";else if(k)y="rush";else if(v){if(v.name==="gpt-5-codex")y="gpt-5-codex";else if(v.provider==="openai"||v.name==="kimi-k2-instruct-0905")y="gpt";else if(v.provider==="xai")y="xai";else if(v.provider==="vertexai")y="gemini"}else if(V.includes("gpt-5-codex"))y="gpt-5-codex";else if(V.includes("gpt")||V.includes("moonshotai/kimi-k2-instruct-0905"))y="gpt";else if(K==="xai")y="xai";else if(K==="vertexai")y="gemini";let b;switch(y){case"plan":b=_y0();break;case"dojo":b=Oy0();break;case"free":b=Ey0();break;case"rush":b=yy0({enableDiagnostics:G});break;case"gpt":b=Ry0();break;case"gpt-5-codex":b=jy0();break;case"xai":b=vy0();break;case"gemini":b=Py0({enableTodos:Z,enableOracle:X,enableDiagnostics:G,enableCheck:L});break;default:b=$f4({enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L});break}let{blocks:d,hasMultipleRoots:m}=await Wf4(J,Q,W),n=[];if(y==="default")n.push({type:"text",text:Z?Vf4:Kf4});if(A.settings["anthropic.toolSearchTool.enabled"]===!0&&V.includes("claude-opus-4-5"))n.push({type:"text",text:Gf4});let t=[{type:"text",text:b,cache_control:{type:"ephemeral"}},...Ms(d),...Ms(n)],p=null,e=A.settings["internal.scaffoldCustomizationFile"];if(e)try{let q1=await J.filesystem.readFile(f0.file(e),{signal:W}),o=jM1.default.parse(q1);p=My0(o)}catch(q1){let o={systemPrompt:{type:"replaceAll",value:t.map(({text:l})=>l)},enableToolSpecs:M.map(({name:l})=>({name:l})),disableTools:[]},r=jM1.default.stringify(o,{lineWidth:0,blockQuote:"literal"});await(J.writeFile??Hf4)(e,r)}if(p){let q1=p?Ly0(M,p):M,o=t;if(p.systemPrompt){let l=(typeof p.systemPrompt.value==="string"?[p.systemPrompt.value]:p.systemPrompt.value).map((W1)=>({type:"text",text:W1}));switch(p.systemPrompt.type){case"replaceAll":o=l;break;case"replaceBase":o=[...l,...d,...n];break}}let r=await hy0(b,d,n,o,q1);return by0(Q.id,r,{basePrompt:b,contextComponents:d,additionalComponents:n,finalBlocks:o,tools:q1},{model:V,provider:K,agentMode:q,isPlanMode:I,isFreeMode:C,basePromptType:y,enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L,hasScaffoldCustomization:!0,scaffoldCustomizationType:p.systemPrompt?.type}),{systemPrompt:Ms(o),tools:q1,guidanceFilesInContext:E,hasMultipleRoots:m}}let F1=await hy0(b,d,n,t,M);return by0(Q.id,F1,{basePrompt:b,contextComponents:d,additionalComponents:n,finalBlocks:t,tools:M},{model:V,provider:K,agentMode:q,isPlanMode:I,isFreeMode:C,basePromptType:y,enableTodos:Z,enableTask:Y,enableOracle:X,enableDiagnostics:G,enableCheck:L,hasScaffoldCustomization:!1,scaffoldCustomizationType:void 0}),{systemPrompt:t,tools:M,guidanceFilesInContext:E,hasMultipleRoots:m}}async function Hf4(J,Q){{let{writeFile:Z}=await import("node:fs/promises");await Z(J,Q,"utf8"),x.info("Created scaffold customization file",{file:J})}}var jM1,CM1,gy0,$f4=({enableTodos:J=!1,enableTask:Q=!1,enableOracle:Z=!1,enableDiagnostics:Y=!1,enableCheck:X=!1})=>`You are Amp, a powerful AI coding agent. You help the user with software engineering tasks. Use the instructions below and the tools available to you to help the user.
1717
1717
 
1718
1718
  # Agency
1719
1719
 
@@ -2068,7 +2068,7 @@ IMPORTANT: Always use the ${i5} tool to plan and track tasks throughout the conv
2068
2068
  ${Q.join(`
2069
2069
  `)}
2070
2070
 
2071
- `}var my0;var pM=N1(()=>{s6();pX();my0={currentlyVisibleFiles:[]}});function uy0(J){return Boolean(J&&typeof J==="object"&&"isImage"in J&&J.isImage&&"imageInfo"in J&&J.imageInfo&&typeof J.imageInfo==="object"&&"mimeType"in J.imageInfo&&typeof J.imageInfo.mimeType==="string"&&jI(J.imageInfo.mimeType)&&"size"in J.imageInfo&&typeof J.imageInfo.size==="number")}function py0(J,Q,Z){return(Y,X)=>{let G=JT0({readFileFn:async(V,K)=>X.filesystem.readFile(V,{signal:K}),readBinaryFileFn:(V,K)=>X.filesystem.readBinaryFile(V,{signal:K}),maxFileSizeBytes:J,maxLines:Q,maxLineBytes:Z});return l6(async(V)=>{let K=await G(Y,X,V);if(K.status==="done"&&typeof K.result==="object"){let q=f0.file(K.result.absolutePath),W=X.config?.settings["experimental.guidanceFilesInContext"]??!0,H=await OP(X.filesystem,q,X.dirs,X.thread,X.discoveredGuidanceFileURIs,V,{includeContent:W});if(H.length>0)return{...K,result:{...K.result,discoveredGuidanceFiles:H}}}return K})}}var zf4,Ff4,dM,wP;var EP=N1(()=>{s6();o0();hK();S3();NM();aW();M4();pX();zf4=py0(Ho,cU1,lU1),Ff4=py0(eP0,200,1024);dM={spec:{name:i6,description:a5`
2071
+ `}var my0;var pM=N1(()=>{s6();pX();my0={currentlyVisibleFiles:[]}});function uy0(J){return Boolean(J&&typeof J==="object"&&"isImage"in J&&J.isImage&&"imageInfo"in J&&J.imageInfo&&typeof J.imageInfo==="object"&&"mimeType"in J.imageInfo&&typeof J.imageInfo.mimeType==="string"&&jI(J.imageInfo.mimeType)&&"size"in J.imageInfo&&typeof J.imageInfo.size==="number")}function py0(J,Q,Z){return(Y,X)=>{let G=JT0({readFileFn:async(V,K)=>X.filesystem.readFile(V,{signal:K}),readBinaryFileFn:(V,K)=>X.filesystem.readBinaryFile(V,{signal:K}),maxFileSizeBytes:J,maxLines:Q,maxLineBytes:Z});return l6(async(V)=>{let K=await G(Y,X,V);if(K.status==="done"&&typeof K.result==="object"){let q=f0.file(K.result.absolutePath),W=X.config?.settings["experimental.guidanceFilesInContext"]??!1,H=await OP(X.filesystem,q,X.dirs,X.thread,X.discoveredGuidanceFileURIs,V,{includeContent:W});if(H.length>0)return{...K,result:{...K.result,discoveredGuidanceFiles:H}}}return K})}}var zf4,Ff4,dM,wP;var EP=N1(()=>{s6();o0();hK();S3();NM();aW();M4();pX();zf4=py0(Ho,cU1,lU1),Ff4=py0(eP0,200,1024);dM={spec:{name:i6,description:a5`
2072
2072
  Read a file or list a directory from the file system. If the path is a directory, it returns a line-numbered list of entries. If the file or directory doesn't exist, an error is returned.
2073
2073
 
2074
2074
  - The path parameter MUST be an absolute path.
@@ -2293,7 +2293,7 @@ ${y3(B98)}
2293
2293
  - Use ${"finder"} first to locate relevant code concepts
2294
2294
  - Then use ${"Grep"} to find specific implementations or all occurrences
2295
2295
  - For complex tasks, iterate between both tools to refine your understanding
2296
- `,D98=N98,Fq={spec:{name:E8,description:D98,inputSchema:{type:"object",properties:{pattern:{type:"string",description:"The pattern to search for (regex)"},path:{type:"string",description:"The file or directory path to search in. Cannot be used with glob."},glob:{type:"string",description:"The glob pattern to search for. Cannot be used with path."},caseSensitive:{type:"boolean",description:"Whether to search case-sensitively"},literal:{type:"boolean",description:"Whether to treat the pattern as a literal string instead of a regex"}},required:["pattern"]},source:"builtin",executionProfile:{resourceKeys:(J)=>{if(J&&typeof J==="object"&&"path"in J&&typeof J.path==="string")return[{key:J.path,mode:"read"}];return[]}}},fn:rF({os:()=>Promise.resolve().then(() => ($s0(),Xs0)).then(({nodeGrepTool:J})=>J),github:null,gitlab:null})}});var Ws0={};Q9(Ws0,{nodeCreateFileTool:()=>I98});var I98=({args:J,userInput:Q},Z)=>{let{filesystem:Y,config:X}=Z;return l6(async(G)=>{if(typeof J.content!=="string")throw Error("create_file: content must be specified");G.throwIfAborted();let V=zY(J.path);await rW(V).acquire();try{let K=await SI(V,Y,X.settings);if(K.requiresConsent){if(Q&&!Q.accepted)return{status:"rejected-by-user",reason:K.reason,toAllow:K.toAllow?[K.toAllow]:void 0};else if(!Q?.accepted)return{status:"blocked-on-user",reason:K.reason,toAllow:K.toAllow?[K.toAllow]:void 0}}await Y.mkdirp(n0.dirname(V),{signal:G}),await Y.writeFile(V,J.content,{signal:G});let q=Z.config?.settings["experimental.guidanceFilesInContext"]??!0,W=await OP(Y,V,Z.dirs,Z.thread,Z.discoveredGuidanceFileURIs,G,{includeContent:q});if(W.length>0)return{status:"done",result:{message:`Successfully created file ${J.path}`,discoveredGuidanceFiles:W},trackFiles:[T6(V)]};return{status:"done",result:`Successfully created file ${J.path}`,trackFiles:[T6(V)]}}finally{rW(V).release()}})};var Hs0=N1(()=>{s6();o0();S3();_I();Ro();pX()});var P98=`Create or overwrite a file in the workspace.
2296
+ `,D98=N98,Fq={spec:{name:E8,description:D98,inputSchema:{type:"object",properties:{pattern:{type:"string",description:"The pattern to search for (regex)"},path:{type:"string",description:"The file or directory path to search in. Cannot be used with glob."},glob:{type:"string",description:"The glob pattern to search for. Cannot be used with path."},caseSensitive:{type:"boolean",description:"Whether to search case-sensitively"},literal:{type:"boolean",description:"Whether to treat the pattern as a literal string instead of a regex"}},required:["pattern"]},source:"builtin",executionProfile:{resourceKeys:(J)=>{if(J&&typeof J==="object"&&"path"in J&&typeof J.path==="string")return[{key:J.path,mode:"read"}];return[]}}},fn:rF({os:()=>Promise.resolve().then(() => ($s0(),Xs0)).then(({nodeGrepTool:J})=>J),github:null,gitlab:null})}});var Ws0={};Q9(Ws0,{nodeCreateFileTool:()=>I98});var I98=({args:J,userInput:Q},Z)=>{let{filesystem:Y,config:X}=Z;return l6(async(G)=>{if(typeof J.content!=="string")throw Error("create_file: content must be specified");G.throwIfAborted();let V=zY(J.path);await rW(V).acquire();try{let K=await SI(V,Y,X.settings);if(K.requiresConsent){if(Q&&!Q.accepted)return{status:"rejected-by-user",reason:K.reason,toAllow:K.toAllow?[K.toAllow]:void 0};else if(!Q?.accepted)return{status:"blocked-on-user",reason:K.reason,toAllow:K.toAllow?[K.toAllow]:void 0}}await Y.mkdirp(n0.dirname(V),{signal:G}),await Y.writeFile(V,J.content,{signal:G});let q=Z.config?.settings["experimental.guidanceFilesInContext"]??!1,W=await OP(Y,V,Z.dirs,Z.thread,Z.discoveredGuidanceFileURIs,G,{includeContent:q});if(W.length>0)return{status:"done",result:{message:`Successfully created file ${J.path}`,discoveredGuidanceFiles:W},trackFiles:[T6(V)]};return{status:"done",result:`Successfully created file ${J.path}`,trackFiles:[T6(V)]}}finally{rW(V).release()}})};var Hs0=N1(()=>{s6();o0();S3();_I();Ro();pX()});var P98=`Create or overwrite a file in the workspace.
2297
2297
 
2298
2298
  Use this tool when you want to create a new file with the given content, or when you want to replace the contents of an existing file.
2299
2299
 
@@ -3024,7 +3024,7 @@ ${J}`:""}
3024
3024
  The following shows recent messages from the conversation.
3025
3025
  User messages are marked with "## User" and assistant messages with "## Assistant".
3026
3026
  `}async function Pa0(J){let{thread:Q,configService:Z,signal:Y}=J;x.debug("Running course correction",{threadId:Q.id});let X=await Z.getLatest(Y),G=S08(Q),V=y08(G),K=k08(Q),W=[{role:"user",parts:[{text:Ea0(K)}]}],H=await tT(I8.GEMINI_3_PRO_PREVIEW.name,W,[VP1],{id:Q.id,agentMode:Q.agentMode},X,Y,{temperature:0.1,systemInstruction:V,toolConfig:{functionCallingConfig:{mode:nT.ANY}}}),z=H.message.functionCalls?.at(0);if(z?.name!==VP1.name)throw Error(`Expected tool call for ${VP1.name}`);let U=z.args;return x.debug("Course correction result",{threadId:Q.id,needsCorrection:U.needsCorrection,hasMessage:!!U.message}),{result:U,"~debugUsage":H["~debugUsage"]}}Ra0();U0();U0();function v08(J){if(J.action.type==="redact-tool-input"&&J.on.event!=="tool:post-execute")return"redact-tool-input action can only be used with tool:post-execute event";if(J.action.type==="send-user-message"&&J.on.event!=="tool:pre-execute")return"send-user-message action can only be used with tool:pre-execute event";return null}function KP1(J){if(!J||!Array.isArray(J))return[];return J.filter((Q)=>{if(Q.compatibilityDate!=="2025-05-13")return!1;let Z=v08(Q);if(Z)return x.warn(`Hook "${Q.id}" is invalid: ${Z}`),!1;return!0})}function Ca0(J,Q){if(!J)return{action:null};J=KP1(J);for(let Z of J){if(Z.if===!1)continue;if(Z.on.event==="tool:pre-execute"){if(!(Array.isArray(Z.on.tool)?Z.on.tool:[Z.on.tool]).includes(Q.toolUse.name))continue;let X=JSON.stringify(Q.toolUse.input),G=Array.isArray(Z.on["input.contains"])?Z.on["input.contains"]:[Z.on["input.contains"]];for(let V of G)if(X.includes(V)){if(x.debug(`Hook triggered: ${Z.id}`,{hookID:Z.id,threadID:Q.threadID,toolName:Q.toolUse.name,toolUseID:Q.toolUse.id,matchString:V,action:Z.action}),Z.action.type==="send-user-message")return{hookID:Z.id,action:Z.action}}}}return{action:null}}function ja0(J,Q){if(!J)return{action:null};J=KP1(J);for(let Z of J){if(Z.if===!1)continue;if(Z.on.event==="tool:post-execute"){if(!(Array.isArray(Z.on.tool)?Z.on.tool:[Z.on.tool]).includes(Q.toolUse.name))continue;if(x.debug(`Post-execution hook triggered: ${Z.id}`,{hookID:Z.id,threadID:Q.threadID,toolName:Q.toolUse.name,toolUseID:Q.toolUse.id,action:Z.action}),Z.action.type==="redact-tool-input")return{hookID:Z.id,action:Z.action}}}return{action:null}}function Sa0(J,Q){if(!J)return{action:null};try{return J(Q.thread)}catch(Z){return x.error("Error processing assistant end-turn hook",Z),{action:null}}}async function s11(J,Q,Z){if(!Q.action)return{abortOp:!1};switch(Q.action.type){case"send-user-message":{let Y={type:"user:message",message:{content:[{type:"text",text:Q.action.message}],source:{type:"hook",hook:Q.hookID}}};return J.updateThread(Y),J.onThreadDelta(Y),{abortOp:!0}}case"redact-tool-input":{if(!Z?.toolUseID)return x.warn("redact-tool-input action requires toolUseID in context"),{abortOp:!1};let Y={type:"tool:processed",toolUse:Z.toolUseID,newArgs:Q.action.redactedInput};return J.updateThread(Y),J.onThreadDelta(Y),x.debug("Tool input redacted",{hookID:Q.hookID,toolUseID:Z.toolUseID}),{abortOp:!1}}}}function qB(J){return f08(J?.["experimental.agentMode"])}function f08(J){return J??"smart"}y7();y8();function yb(J,Q){let Z=Q.agentMode??zy(Q),Y=xM0(J);if(Y)return{agentMode:Z??"smart",model:Y};if(J["model.sonnet"])return{agentMode:Z??"smart",model:"anthropic/claude-sonnet-4-5-20250929"};let X=Z??qB(J);return{model:aD(X),agentMode:X}}y8();st();function iL(J,Q){let Z=J&&Q?.state==="active"&&Q.inferenceState!=="running"?h08(J):{running:0,blocked:0};return{...Q,interactionState:J&&Q?.state==="active"?qP1(J,Q.inferenceState):!1,toolState:Z}}function h08(J){let Q=J.messages.at(-1);if(!Q||Q.role==="assistant")return{running:0,blocked:0};let Z=0,Y=0;for(let X of Q.content){if(X.type!=="tool_result")continue;let G=X.run.status;if(G==="in-progress")Z++;else if(G==="blocked-on-user")Y++}return{running:Z,blocked:Y}}function qP1(J,Q){if(Q==="running")return!1;let Z=J.messages.at(-1);if(!Z)return"user-message-initial";if(Z.role==="assistant")return Z.state.type==="complete"&&Z.state.stopReason==="end_turn"?"user-message-reply":!1;if(Z.content.some((Y)=>Y.type==="tool_result"&&Y.run.status==="blocked-on-user"))return"user-tool-approval";if(Z.content.some((Y)=>Y.type==="tool_result"&&Y.run.status==="in-progress"))return"tool-running";return!1}o0();U0();bG();var ya0=W6(k6(),1);var _a0=W6(LP(),1);function ka0(J){if(J.status==="done"){if(J.result!==null&&typeof J.result==="object"&&"output"in J.result&&typeof J.result.output==="string"){if("truncation"in J.result&&typeof J.result.truncation==="object"&&J.result.truncation!==null&&"prefixLinesOmitted"in J.result.truncation&&typeof J.result.truncation.prefixLinesOmitted==="number"){let Q=J.result.truncation.prefixLinesOmitted;return`--- Truncated ${Q} ${P9(Q,"line")} above this ---
3027
- `+J.result.output}return J.result.output}}return _a0.default.stringify(J)}var b08=ya0.metrics.getMeter("thread-worker-service"),WP1=b08.createGauge("thread_worker_count",{description:"Number of active thread workers"});class xa0{threadWorkers=new c_;async getOrCreateForThread(J,Q){if(await J.threadService.getPrimitiveProperty(Q,"mainThreadID"))return this.getOrCreateForSubThread(J,Q);return this.getOrCreateForThreadInternal(J,Q)}async getOrCreateForSubThread(J,Q){return this.getOrCreateForThreadInternal(J,Q)}async getOrCreateForThreadInternal(J,Q){let Z=this.threadWorkers.get(Q);if(!Z){if(Z=new xb(J,Q),this.threadWorkers.set(Q,Z),this.threadWorkers.size>25)x.info("Many active thread workers detected",{name:"ThreadWorkerService.memoryCheck",threadID:Q,totalWorkerCount:this.threadWorkers.size})}return WP1.record(this.threadWorkers.size),Z}get workers(){return this.threadWorkers.observable}get statuses(){return this.threadWorkers.observable.pipe(T4((J)=>J.size===0?Q0.of({}):j8(...Array.from(J.values()).map((Q)=>Q.status.pipe(Q6((Z)=>[Q.threadID,Q.threadReadWriter?iL(Q.thread,Z):void 0])))).pipe(Q6((Q)=>Object.fromEntries(Q)))),NG(25),A8())}get(J){return this.threadWorkers.get(J)}prettyPrintToolRun(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No worker found for thread ${J}`);for(let Y of Z.thread.messages)for(let X of Y.content)if(X.type==="tool_result"&&X.toolUseID===Q)return ka0(X.run);throw Error(`Tool run not found for thread ${J} and tool use ${Q}`)}async cancelToolOnly(J,Q){await this.threadWorkers.get(J)?.cancelToolOnly(Q)}async cancel(J){await this.threadWorkers.get(J)?.cancel()}async dispose(J){let Q=this.threadWorkers.get(J);if(Q)await Q.asyncDispose(),this.threadWorkers.delete(J),WP1.record(this.threadWorkers.size);this.threadWorkers.dispose()}async retry(J){let Q=this.threadWorkers.get(J);if(!Q)throw Error(`No active worker for thread ${J}`);await Q.retry()}async revertFileChanges(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No active worker for thread ${J}`);await Z.revertFileChanges(Q)}async getFilesAffectedByTruncation(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No active worker for thread ${J}`);return Z.getFilesAffectedByTruncation(Q)}async cleanupThreadBackups(J,Q){let Z=this.threadWorkers.get(Q);if(Z)await Z.fs.tracker.cleanupBackups();else{let Y=await J.threadService.get(Q);if(!Y)return;let X=J.vfs.fileSystemWithMountedTrees(jx(Y));try{await new rx(X).cleanup(Q),x.debug(`Cleaned up backup files for thread ${Q}`,{threadID:Q})}catch(G){x.error("Error cleaning up thread backups",G,{threadID:Q})}}}async disposeAll(){await Promise.all(Array.from(this.threadWorkers.values()).map(async(J)=>await J.asyncDispose())),this.threadWorkers.clear(),WP1.record(0)}}var J2=new xa0;s6();o0();S3();y7();MU();function va0(J){let Q=[],Z=/@((?:[^\s@\\,;]|\\.)+)/g,Y;while((Y=Z.exec(J))!==null){let X=Y[1],G=g08(X).replace(/[.,;:!?)}\]]+$/,"");Q.push(G)}return Q}function g08(J){if(J.match(/^[A-Za-z]:[\\]/))return J.replace(/\\(.)/g,(Q,Z)=>{if(Z===" "||Z==="("||Z===")"||Z==="["||Z==="]"||Z==="?"||Z==="*")return Z;return Q});return J.replace(/\\(.)/g,"$1")}y8();pM();async function ba0(J,{configService:Q,filesystem:Z}){let Y={sentAt:Date.now()},X=await H6(Q.workspaceRoots)??[],G=Y3(J.content);if(X.length===0)return{role:"user",content:J.content,source:J.source,fileMentions:void 0,userState:void 0,agentMode:J.agentMode,meta:Y};let V=await Ds({fileSystem:Z},va0(G),{searchPaths:X,shouldIncludeImages:!J.agentMode||Gy(J.agentMode)}),K;if(V?.files&&V.files.length>0){let H=new Set,z=[],D=(await Q.getLatest()).settings["experimental.guidanceFilesInContext"]??!0;for(let M of V.files){let L=m4(M.uri),A=await OP(Z,L,X,null,H,void 0,{includeContent:D});for(let E of A){if(!z.some((I)=>I.uri===E.uri))z.push(E);H.add(E.uri)}}if(z.length>0)K=z}let q=await(await Promise.resolve().then(() => (ha0(),fa0))).getUserState();return{role:"user",content:V?.imageBlocks?.length?[...J.content,...V.imageBlocks]:J.content,source:J.source,fileMentions:V,userState:{...q??my0},agentMode:J.agentMode,discoveredGuidanceFiles:K,meta:Y}}class xb{deps;threadID;async resumeInProgressTools(){for(let J of this.thread.messages){if(J.role!=="user")continue;for(let Q of J.content){if(Q.type!=="tool_result")continue;if(!(!Z3(Q.run)&&Q.run.status!=="blocked-on-user"&&!this.ops.tools[Q.toolUseID]))continue;let Y=this.findToolUseById(Q.toolUseID);if(!Y)continue;if(Y.name===U5||Y.name===wD0){this.findAndCancelToolRun(Q.toolUseID);continue}x.debug(`re-invoking tool ${Y.name} with ID ${Q.toolUseID}`,{name:"resumeInProgressTools",threadID:this.threadID}),this.invokeTool(Y,Q.userInput)}}await this.updateFileChanges()}findToolUseById(J){for(let Q of this.thread.messages){if(Q.role!=="assistant")continue;for(let Z of Q.content)if(Z.type==="tool_use"&&Z.id===J)return Z}return}trackFilesFromHistory(){x.debug("Tracking files from thread history",{name:"trackFilesFromHistory",threadID:this.threadID});for(let J of this.thread.messages){if(J.role==="user"&&J.fileMentions?.files)this.trackFiles(J.fileMentions.files.map((Q)=>Q.uri).filter((Q)=>Q!==void 0));if(J.role==="user"){for(let Q of J.content)if(Q.type==="tool_result"&&Q.run.status==="done")this.trackFiles(Q.run.trackFiles??[])}}}async getConfig(J){return H6(this.deps.configService.config,J)}async getCodeHostService(J){if(!this.codeHostService){let Q=this.thread.env?.initial.trees||[],Z=await this.getConfig(J);this.codeHostService=pj0(Q,this.deps.threadService,this.deps.mcpService,Z,this.threadID)}return this.codeHostService}setupSettingsChangeHandlers(){this.setupPermissionsChangeHandler()}setupPermissionsChangeHandler(){this.deps.configService.config.pipe(Q6((J)=>EE(J.settings?.permissions)),N4(),NU0(1),HF(this.disposed$)).subscribe(()=>{this.reevaluateBlockedTools()})}reevaluateBlockedTools(){for(let J=this.thread.messages.length-1;J>=0;J--){let Q=this.thread.messages[J];if(!Q||Q.role!=="user")continue;let Z=!1;for(let Y of Q.content)if(Y.type==="tool_result"&&Y.run?.status==="blocked-on-user"&&Y.toolUseID)Z=!0,this.checkAndApproveBlockedTool(Y.toolUseID);if(!Z)break}}async checkAndApproveBlockedTool(J){try{let Q=this.findToolUseById(J);if(!Q){x.warn("Tool use block not found for blocked tool",{toolUseID:J});return}let Z=await n11(Q.name,Q.input??{},{configService:this.deps.configService},this.thread.mainThreadID?"subagent":"thread",this.threadID,J);if(Z.permitted)x.info("Auto-approving previously blocked tool due to permission change",{toolName:Q.name,toolUseID:J,threadID:this.threadID}),this.handle({type:"user:tool-input",toolUse:J,value:{accepted:!0}});else x.debug("Tool remains blocked after permission change",{toolName:Q.name,toolUseID:J,reason:Z.reason})}catch(Q){x.warn("Failed to re-evaluate blocked tool",{error:Q,toolUseID:J})}}async cleanupTaskToolSubThreads(J=this.thread.messages.length){let Q=this.thread.messages.slice(0,J),Z=rH1(Q),Y=new Set(Z.map((G)=>G.toolUseID)),X=new Set;for(let[G]of this.registeredSubthreads.entries())if(!Y.has(G))X.add(G);for(let G of X){let V=this.registeredSubthreads.get(G);if(V.fileChanges?.unsubscribe(),await V.worker?.revertFileChanges(),V.latestFiles=[],this.mergeAndEmit(),await this.cleanupThreadBackups(V.threadID),await V.worker?.asyncDispose(),this.deps.deleteThread)try{await this.deps.deleteThread(V.threadID)}catch(K){x.error(`Failed to delete Task tool sub-thread: ${V.threadID}`,K,{threadID:this.threadID,subThreadID:V.threadID})}else x.warn(`Cannot delete Task tool sub-thread: ${V.threadID} - threadHistoryService not available`,{threadID:this.threadID,subThreadID:V.threadID});this.registeredSubthreads.delete(G)}if(X.size>0)this.emitSubthreads()}ops={tools:{},toolMessages:{},inference:null,pendingCourseCorrection:null};_state=new s9("initial");state=this._state.pipe(N4(),A8({shouldCountRefs:!0}));handleMutex=new vG;ephemeralError=new s9(void 0);inferenceState=new s9("idle");fileChanges=new s9({files:[]});toolCallUpdates=new u4;cacheExpiryTimer=new s9({secondsRemaining:null,potentialSavingsUSD:0,cacheableTokens:0});cacheTimer=this.cacheExpiryTimer.pipe(N4((J,Q)=>J.secondsRemaining===Q.secondsRemaining&&J.potentialSavingsUSD===Q.potentialSavingsUSD&&J.cacheableTokens===Q.cacheableTokens),A8({shouldCountRefs:!0}));cacheTimerInterval=null;trackedFiles=new gJ;discoveredGuidanceFileURIs=new Set;fs;cachedFileChanges=[];registeredSubthreads=new Map;subthreadSequenceNumber=0;_subthreadsSubject=new s9([]);subthreads=this._subthreadsSubject.pipe(N4(),A8({shouldCountRefs:!0}));disposed$=new u4;isDisposed=!1;cancelledToolUses=new Set;codeHostService=null;shouldContinueAfterRejection=!1;lastInferenceRequestId;constructor(J,Q){this.deps=J;this.threadID=Q;this.fs=La0({fileChangeTrackerStorage:this.deps.fileChangeTrackerStorage},this.deps.vfs,Q,()=>jx(this.thread))}status=this.state.pipe(T4((J)=>J==="active"?j8(this.inferenceState.pipe(N4()),this.fileChanges.pipe(N4()),this.ephemeralError,this.toolCallUpdates.pipe(S8(void 0))).pipe(Q6(([Q,Z,Y])=>({state:J,inferenceState:Q,fileChanges:Z,ephemeralError:Y?{message:Y.message,stack:"stack"in Y?Y.stack:void 0,error:"error"in Y&&Y.error&&typeof Y.error==="object"&&"error"in Y.error?Y.error.error:void 0}:void 0})),HF(this.disposed$)):Q0.of({state:J})),A8({shouldCountRefs:!0}));threadReadWriter=null;get thread(){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);return this.threadReadWriter.read()}set thread(J){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);this.threadReadWriter.write(J),this.__testing__setThread(J)}updateThread(J){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);this.threadReadWriter.update(Ob0(J)),this.__testing__setThread(this.threadReadWriter.read())}async acquireThread(){if(!this.threadReadWriter)this.threadReadWriter=await this.deps.threadService.exclusiveSyncReadWriter(this.threadID),this._state.next("active")}__testing__setThread(J){}__testing__getDeps(){return this.deps}async resume(){if(this.resumed)return;if(this.resumed=!0,this.handleCalled)throw Error("cannot call ThreadWorker.resume after ThreadWorker.handle");await this.acquireThread(),await this.restoreFileChangesFromBackups();let J=this.thread.messages.at(-1);if(J?.role==="assistant"&&J.state.type==="streaming")this.updateThread({type:"thread:truncate",fromIndex:this.thread.messages.length-1});if(this.trackFilesFromHistory(),await this.initializeCompletedSubthreads(),this.thread.mainThreadID)return;if(OM0(J)||wM0(J)&&!this.shouldContinueAfterRejection||sH1(J)){this.inferenceState.next("cancelled");return}await this.resumeInProgressTools(),this.setupSettingsChangeHandlers();let Q=this.thread.messages.findLastIndex((Y)=>Y.role==="user"?EM0(Y):Y.role==="assistant"&&Y.state.type==="complete");if(Q===-1){if(this.thread.messages.length!==0)throw Error(`(bug) invalid thread: ${this.threadID}`);return}let Z=this.thread.messages[Q];switch(Z.role){case"user":if(!Z.interrupted)this.onThreadDelta({type:"user:message",message:Z});break;case"assistant":this.onThreadDelta({type:"assistant:message",message:Z});break}}resumed=!1;async initializeCompletedSubthreads(){let J=rH1(this.thread.messages);for(let{toolUseID:Q,threadID:Z,toolUse:Y,toolResult:X}of J){let G=Z3(X.run),V=X.run.status==="blocked-on-user";if(G&&!V)await this.registerSubthread(Q,Z,Y)}}async forkThread(J){await this.acquireThread();let{threadService:Q}=this.deps,Z=await Q.forkThread(this.threadID,J);await this.handle({type:"fork:created",forkThreadID:Z.threadID,fromMessageIndex:J});let Y=await Q.getPrimitiveProperty(this.threadID,"v");if(Y!==null)await Q.flushVersion(this.threadID,Y);return Z.threadID}async handle(J,Q){await this.handleMutex.acquire();try{await this.innerHandle(J,Q)}finally{this.handleMutex.release()}}async innerHandle(J,Q){if(this.isDisposed){x.debug(`Skipping ${J.type} - worker disposed.`,{name:"handle queue",threadID:this.threadID});return}if(Q?.aborted){x.debug(`Skipping ${J.type} - signal aborted.`,{name:"handle queue",threadID:this.threadID});return}if(await this.resume(),this.handleCalled=!0,await this.acquireThread(),J.type==="thread:truncate")await this.cleanupFileChanges(J.fromIndex),await this.cleanupTaskToolSubThreads(J.fromIndex);let Z=J;if(J.type==="user:message"){let Y=await ba0(J.message,{configService:this.deps.configService,filesystem:this.fs.fileSystemReader()});Z=PF(J,(X)=>{X.message=k8(Y),Q?.throwIfAborted()})}try{if(this.ephemeralError.getValue()!==void 0)this.ephemeralError.next(void 0);let Y=J.type==="user:message"&&J.index!==void 0;if(this.updateThread(Z),this.onThreadDelta(Z),Y)await this.cleanupFileChanges(),await this.cleanupTaskToolSubThreads(),await this.cleanupForkThreads()}catch(Y){if(!l3(Y))x.error("Ephemeral error during handle processing",Y,{name:"ThreadWorker",threadID:this.threadID}),this.ephemeralError.next(Y instanceof Error?Y:Error(String(Y)));else x.debug(`AbortError caught during handle processing for ${Z.type}.`,{name:"handle queue",threadID:this.threadID})}}handleCalled=!1;onThreadDelta(J){switch(J.type){case"user:message":{if(this.abortPendingCourseCorrection(),J.index!==void 0)this.trackedFiles.clear(),this.thread.messages.forEach((Q)=>{if(Q.role==="user"){for(let Z of Q.content)if(Z.type==="tool_result"&&Z.run.status==="done"&&Z.run.trackFiles)this.trackFiles(Z.run.trackFiles);if(Q.fileMentions?.files)this.trackFiles(Q.fileMentions.files.map((Z)=>Z.uri).filter((Z)=>Z!==void 0))}});else this.trackFiles(J.message.fileMentions?.files?.map((Q)=>Q.uri).filter((Q)=>Q!==void 0)??[]);this.runInferenceAndUpdateThread({skipCourseCorrection:!0});break}case"user:message-queue:dequeue":{let Q=this.thread.messages.at(-1);if(!Q)break;if(Q.role!=="user")break;this.trackFiles(Q.fileMentions?.files?.map((Z)=>Z.uri).filter((Z)=>Z!==void 0)??[]),this.runInferenceAndUpdateThread({skipCourseCorrection:!0});break}case"user:tool-input":{let Q=qY(this.thread,J.toolUse);if(Q)this.invokeTool(Q,J.value);break}case"tool:data":{if(this.cancelledToolUses.has(J.toolUse)){this.updateThread({type:"tool:data",toolUse:J.toolUse,data:{status:"cancelled",reason:"cancelled by user message"}});return}let Q=qY(this.thread,J.toolUse);if(J.data.status==="in-progress"&&Q?.name===b2){let Z=Q,Y=oH1(J.data.progress);if(Y)this.registerSubthread(J.toolUse,Y,Z)}if(Z3(J.data)){this.cancelledToolUses.delete(J.toolUse);let Z=this.ops.toolCompletionResolvers?.[J.toolUse];if(Z){if(J.data.status==="done")Z.resolve();else Z.reject(Error(`Tool ${J.data.status}: ${J.toolUse}`));delete this.ops.toolCompletionResolvers?.[J.toolUse]}}if(Q){let Z=u08(this.thread,J.toolUse,this.shouldContinueAfterRejection);x.debug(`updated tool_result${Z?" and running inference because all tools completed":""}`,{name:`handleThreadDelta(${J.type}, ${J.toolUse}, ${J.data.status})`,threadID:this.threadID});let Y=this.shouldContinueAfterRejection||this.inferenceState.getValue()!=="cancelled";if(Z&&Y)this.runInferenceAndUpdateThread()}this.toolCallUpdates.next();break}case"assistant:message":{this.resetCacheTimer();let Q=this.findToolUsesNeedingInvocation(J.message);x.debug(`saw ${Q.length} tool uses (${Q.map((Z)=>Z.name).join(", ")})`,{name:`handleThreadDelta(${J.type})`,threadID:this.threadID}),this.executeToolsWithPlan(Q);break}case"user:message-queue:enqueue":{let Q=this.inferenceState.getValue();if(qP1(this.thread,Q)!=="tool-running"){if(Q==="cancelled"){this.handle({type:"user:message-queue:dequeue"});break}else if(Q==="idle"){let Y=this.thread.messages.at(-1);if(Y?.role==="assistant"){if(Y.state.type==="cancelled"||Y.state.type==="error"){this.handle({type:"user:message-queue:dequeue"});break}if(Y.state.type==="complete"&&Y.state.stopReason!=="tool_use"){this.handle({type:"user:message-queue:dequeue"});break}}else if(Y?.role==="info"){this.handle({type:"user:message-queue:dequeue"});break}}}break}case"info:manual-bash-invocation":{this.handle({type:"user:message-queue:dequeue"});break}case"info:skill-injection":break;case"cancelled":break;case"inference:completed":{if(J.usage)this.startCacheTimer(J.usage);let Q=g2(this.thread,"assistant");if(Q&&Q.state.type==="complete"&&Q.state.stopReason==="refusal"){this.ephemeralError.next(Error("The model refused to respond to this request. Please retry with a different prompt."));break}if(Q){let Y=this.findToolUsesNeedingInvocation(Q);this.executeToolsWithPlan(Y)}if(Q&&Q.state.type==="complete"&&Q.state.stopReason==="end_turn")if(this.thread.queuedMessages&&this.thread.queuedMessages.length>0)this.handle({type:"user:message-queue:dequeue"});else this.runCourseCorrectionOnEndTurn(),s11(this,Sa0(this.deps.internalHooks?.onAssistantTurnEnd,{thread:this.thread}));break}}}findToolUsesNeedingInvocation(J){if(J.content.some((X)=>X.type==="tool_use"&&!T3(X)))return[];if(!(J.state?.type==="complete"||J.state?.type==="cancelled"))return[];let Y=kJ(this.thread);return J.content.filter((X)=>X.type==="tool_use").filter((X)=>!Y.has(X.id)&&!this.cancelledToolUses.has(X.id))}async getWorkspaceRoots(J){return await H6(this.deps.configService.workspaceRoots,J)??this.thread.env?.initial?.trees?.map((Q)=>Q.uri).filter((Q)=>Q!==void 0).map(jJ)??[]}async executeToolsWithPlan(J){if(J.length===0)return;let Q=Aa0(J,this.deps.toolService);x.debug(`executing ${J.length} tools in ${Q.length} batch(es)`,{name:"executeToolsWithPlan",threadID:this.threadID,batches:Q.map((Z)=>Z.map((Y)=>Y.name))}),this.startCourseCorrectionAssessment(),await this.executeToolBatchesSequentially(Q)}async executeToolBatchesSequentially(J){for(let Q of J){let Y=(await Promise.allSettled(Q.map((X)=>this.invokeToolAndWait(X,void 0)))).filter((X)=>X.status==="rejected");if(Y.length>0)x.warn(`${Y.length} tool(s) failed in batch`,{name:"executeToolBatchesSequentially",threadID:this.threadID,errors:Y.map((X)=>X.reason)})}}async invokeToolAndWait(J,Q){let Z=new Promise((Y,X)=>{if(!this.ops.toolCompletionResolvers)this.ops.toolCompletionResolvers={};this.ops.toolCompletionResolvers[J.id]={resolve:Y,reject:X}});this.invokeTool(J,Q).catch((Y)=>{let X=this.ops.toolCompletionResolvers?.[J.id];if(X)x.debug(`Tool invocation setup failed for ${J.id}`,{name:"invokeToolAndWait",threadID:this.threadID,error:String(Y)}),X.reject(Y),delete this.ops.toolCompletionResolvers?.[J.id]}),await Z}async invokeTool(J,Q){if(this.ops.tools[J.id])throw Error(`(bug) tool invocation already in progress: ${J.id}`);if(!T3(J))throw Error(`(bug) tool use is incomplete: ${J.id}`);let Z=await this.getConfig(),Y=Ca0(Z.settings?.hooks,{threadID:this.threadID,toolUse:J}),{abortOp:X}=await s11(this,Y);if(X){let V=this.ops.toolCompletionResolvers?.[J.id];if(V)V.resolve(),delete this.ops.toolCompletionResolvers?.[J.id];return}let G=new AbortController;this.ops.tools[J.id]=G,this.updateThread({type:"tool:data",toolUse:J.id,data:{status:"in-progress"}});try{let V=await this.getWorkspaceRoots(G.signal),K=gE(this.thread),q=new Q0((M)=>{this.ops.toolMessages[J.id]=M}),W=await this.getCodeHostService(G.signal),H={...this.deps,dir:V.at(0)??null,dirs:V,tool:J.name,thread:this.thread,config:await this.getConfig(),trackedFiles:new gJ(this.trackedFiles),filesystem:this.fs.trackedFileSystem(J.id),fileChangeTracker:this.fs.tracker,getAllTrackedChanges:this.getAllTrackedChanges.bind(this),toolUseID:J.id,todos:K,toolMessages:q,threadEnvironment:this.thread.env?.initial??await this.deps.getThreadEnvironment(),handleThreadDelta:this.handle.bind(this),pullRequestChanges:W.pullRequestChanges,agentMode:await this.getSelectedAgentMode(),discoveredGuidanceFileURIs:this.discoveredGuidanceFileURIs},z=this.deps.toolService.preprocessArgs?.(J.name,J.input,H);if(z)this.handle({type:"tool:processed",toolUse:J.id,newArgs:z});let U=z??J.input,D=this.deps.toolService.invokeTool(J.name,{args:U,userInput:Q},H).pipe(HF(this.disposed$),BG(()=>{delete this.ops.tools[J.id],this.ops.toolMessages[J.id]?.complete(),delete this.ops.toolMessages[J.id]})).subscribe({next:async(M)=>{if(x.debug(`${J.id}, ${M.status}`,{name:"invokeTool",threadID:this.threadID}),Z3(M)){delete this.ops.tools[J.id],D.unsubscribe();let L=this.ops.toolCompletionResolvers?.[J.id];if(L){if(M.status==="done")L.resolve();else L.reject(Error(`Tool ${M.status}: ${J.id}`));delete this.ops.toolCompletionResolvers?.[J.id]}if(M.status==="done"&&M.trackFiles?.length)this.trackFiles(M.trackFiles);if(Z.settings?.hooks){let A=ja0(Z.settings.hooks,{threadID:this.threadID,toolUse:J});await s11(this,A,{toolUseID:J.id})}}await this.updateFileChanges(),await this.handle({type:"tool:data",toolUse:J.id,data:M},G.signal)},error:async(M)=>{let L=this.ops.toolCompletionResolvers?.[J.id];if(L)L.reject(M),delete this.ops.toolCompletionResolvers?.[J.id];await this.handle({type:"tool:data",toolUse:J.id,data:{status:"error",error:{message:"message"in M?M.message:String(M),displayMessage:"displayMessage"in M?M.displayMessage:void 0}}},G.signal)},complete:()=>{let M=this.ops.toolCompletionResolvers?.[J.id];if(!M)return;let L=kJ(this.thread).get(J.id)?.run;if(L&&Z3(L))return;let A;if(this.isDisposed)A="Worker disposed";else if(G.signal.aborted)A="Tool aborted";else if(this.cancelledToolUses.has(J.id))A="Tool cancelled";else A="Tool observable completed without terminal state";M.reject(Error(A)),delete this.ops.toolCompletionResolvers?.[J.id]}});BM(G.signal,()=>D.unsubscribe())}catch(V){delete this.ops.tools[J.id];let K=this.ops.toolCompletionResolvers?.[J.id];if(K)K.reject(V),delete this.ops.toolCompletionResolvers?.[J.id];throw V}}async cancelInProgressTools(){for(let J of Object.keys(this.ops.tools))await this.cancelTool(J)}cancelAllActiveTools(){let J=kJ(this.thread);for(let Q of this.thread.messages){if(Q.role!=="assistant")continue;for(let Z of Q.content)if(Z.type==="tool_use"&&T3(Z)){let Y=J.get(Z.id);if(!(Y&&Z3(Y.run)))this.cancelledToolUses.add(Z.id)}}for(let Q of this.thread.messages)if(Q.role==="user"){for(let Z of Q.content)if(Z.type==="tool_result"){if(!Z3(Z.run))this.cancelledToolUses.add(Z.toolUseID)}}}cancelUnstartedTools(){let J=kJ(this.thread),Q=this.thread.messages.findLastIndex((Y)=>sH1(Y)),Z=Q===-1?this.thread.messages:this.thread.messages.slice(Q+1);for(let Y of Z){if(Y.role!=="assistant")continue;for(let X of Y.content)if(X.type==="tool_use"&&T3(X)){let G=J.get(X.id);if(!G||G.run.status==="blocked-on-user")this.updateThread({type:"tool:data",toolUse:X.id,data:{status:"cancelled"}})}}}async runInferenceAndUpdateThread(J){this.ops.inference?.abort(),this.ops.inference=null;let Q=new AbortController;this.ops.inference=Q,this.cancelAllActiveTools(),this.cancelUnstartedTools(),await this.cancelInProgressTools();for(let K of this.thread.messages)if(K.role==="user"){for(let q of K.content)if(q.type==="tool_result"&&q.run.status==="blocked-on-user")this.updateThread({type:"tool:data",toolUse:q.toolUseID,data:{status:"cancelled"}})}if(!J?.skipCourseCorrection){if(await this.checkPendingCourseCorrection())return}let Z=this.thread.messages.at(-1);if(this.thread.mainThreadID===void 0&&Z?.role==="user"&&this.thread.messages.filter((K)=>K.role==="user").length===1){if(this.deps.getThreadEnvironment)this.deps.getThreadEnvironment().then(async(K)=>{this.updateThread({type:"environment",env:{initial:{...this.thread.env?.initial,...K}}})}).catch((K)=>{x.error("Failed to initialize thread environment",K,{threadID:this.threadID})})}if(this.thread.mainThreadID===void 0&&!this.thread.title)this.getConfig(Q.signal).then((K)=>{if(Q.signal.aborted)return;let q=K.settings?.["agent.skipTitleGenerationIfMessageContains"]||[],W=this.thread.messages.find((H)=>{if(H.role!=="user")return!1;if(q.length===0)return!0;let z=Y3(H.content);return!q.some((U)=>z.includes(U))});if(W)this.deps.generateThreadTitle(W,this.thread,this.deps.configService,Q.signal).then(({title:H,usage:z})=>{if(Q.signal.aborted||this.isDisposed)return;if(H!==void 0&&this.thread.title!==H)this.updateThread({type:"title",value:H,usage:z})}).catch((H)=>{if(!l3(H))x.error("generateThreadTitle error",H,{name:"ThreadWorker",threadID:this.threadID})})}).catch((K)=>{if(!l3(K))x.error("ThreadWorker title generation config error",K)});let X=await this.getConfig(),{model:G,agentMode:V}=yb(X.settings,this.thread);try{let[K,q,W]=G.match(/(.*?)\/(.*)/)??[],H=Fa0(q??"",W??""),z=crypto.randomUUID();this.lastInferenceRequestId=z;let U=H.stream({model:W??"",thread:this.thread,buildSystemPromptDeps:{toolService:this.deps.toolService,configService:this.deps.configService,getThreadEnvironment:this.deps.getThreadEnvironment,filesystem:this.fs.fileSystemReader(),threadService:this.deps.threadService},signal:Q.signal,agentMode:V,clientRequestId:z});this.inferenceState.next("running");let D;for await(let M of U)D=M,await this.handle({type:"assistant:message-update",message:M});if(D?.usage&&this.lastInferenceRequestId){let{fetchCreditsByRequestId:M}=await Promise.resolve().then(() => (gH(),pa0)),L=await M(this.lastInferenceRequestId,this.deps.configService,{signal:Q.signal});if(L!==null)D={...D,usage:{...D.usage,credits:L}};this.lastInferenceRequestId=void 0}await this.handle({type:"inference:completed",model:D?.usage?.model,usage:D?.usage})}catch(K){if(!(l3(K)||rP0(K))){let q=K instanceof Error?K:Error(String(K));this.ephemeralError.next(q)}return}finally{if(this.ops.inference===Q)this.ops.inference=null,this.inferenceState.next("idle")}}async findAndCancelToolRun(J,Q){if(this.cancelInference(),!qY(this.thread,J))return;await this.cancelTool(J,Q)}async cancelToolOnly(J,Q){if(!qY(this.thread,J))return;let Y=this.cancelDataForToolRun(J);await this.cancelSubthread(J);let X=this.ops.toolMessages[J];if(X){try{X.next({type:"stop-command"})}catch(G){x.warn("Failed to send stop-command",{id:J,error:G})}X.complete(),delete this.ops.toolMessages[J]}x.debug(`cancelToolOnly(${J})`),await this.handle({type:"tool:data",toolUse:J,data:Y},Q)}invokeBashTool(J,Q,Z){return new Q0((Y)=>{let X,G,V,q=((H)=>{return BM(H,()=>{if(x.warn("Manual bash abort -> unsubscribe",{threadID:this.threadID}),V?.unsubscribe(),G?.unsubscribe(),Y?.complete(),X)this.handleManualBashInvocation(J,{status:"cancelled",progress:iH1(X)},Z)})})(Q);return(async()=>{try{if(Q.aborted){Y.error(Error("Operation was aborted"));return}let H=await this.getWorkspaceRoots(Q),z=await this.getConfig(Q),U=await this.getCodeHostService(Q),D={...this.deps,dir:H.at(0)??null,dirs:H,tool:U5,thread:this.thread,config:z,trackedFiles:new gJ(this.trackedFiles),filesystem:nR0(this.fs.fileSystemReader()),fileChangeTracker:this.fs.tracker,getAllTrackedChanges:this.getAllTrackedChanges.bind(this),toolUseID:oD(),todos:[],threadEnvironment:this.thread.env?.initial??await this.deps.getThreadEnvironment(),handleThreadDelta:this.handle.bind(this),pullRequestChanges:U.pullRequestChanges,discoveredGuidanceFileURIs:this.discoveredGuidanceFileURIs};G=this.deps.toolService.invokeTool(U5,{args:J,userInput:{accepted:!0}},D).subscribe({next:(M)=>{X=M,Y.next(M)},error:(M)=>{Y.error(M)},complete:()=>{if(X)this.handleManualBashInvocation(J,X,Z);Y.complete()}}),V=this.disposed$.subscribe(()=>{q(),G?.unsubscribe(),Y?.complete()})}catch(H){Y.error(H)}})(),()=>{q(),G?.unsubscribe(),V?.unsubscribe()}})}async handleManualBashInvocation(J,Q,Z){await this.handle({type:"info:manual-bash-invocation",args:J,toolRun:Q,hidden:Z})}async cleanupThreadBackups(J){try{await this.fs.tracker.cleanupBackups(),x.debug(`Cleaned up backup files for thread ${J}`,{threadID:J})}catch(Q){x.error("Error cleaning up thread backups",Q,{threadID:J})}}cancelDataForToolRun(J){let Z=kJ(this.thread).get(J)?.run;return{status:"cancelled",progress:Z?iH1(Z):void 0}}async cancelTool(J,Q){let Z=this.cancelDataForToolRun(J);await this.cancelSubthread(J);let Y=this.ops.toolMessages[J];if(Y){try{Y.next({type:"stop-command"})}catch(X){x.warn("Failed to send stop-command",{id:J,error:X})}Y.complete(),delete this.ops.toolMessages[J]}x.debug(`cancelToolRun(${J})`),await this.handle({type:"tool:data",toolUse:J,data:Z},Q)}async cancel(){x.debug("cancel: aborting inference operation and tools"),this.cancelInference(),this.cancelAllActiveTools(),this.cancelUnstartedTools(),await this.cancelInProgressTools(),await this.handle({type:"cancelled"},void 0)}cancelInference(){if(this.ops.inference)this.ops.inference.abort(Error(mU1.USER_CANCELLED)),this.ops.inference=null;this.inferenceState.next("cancelled")}async retry(){if(x.debug("retry: retrying inference operation"),this.ephemeralError.getValue()!==void 0)this.ephemeralError.next(void 0);if(this.ops.inference)this.ops.inference.abort(),this.ops.inference=null;let J=this.thread.messages.at(-1);if(J?.role==="assistant"&&J.state.type==="complete"&&J.state.stopReason==="refusal")this.updateThread({type:"thread:truncate",fromIndex:this.thread.messages.length-1});this.inferenceState.next("idle"),await this.runInferenceAndUpdateThread()}startCourseCorrectionAssessment(){this.ops.pendingCourseCorrection?.abort.abort(),this.ops.pendingCourseCorrection=null,this.getConfig().then((J)=>{if(!J.settings?.["experimental.courseCorrection.enabled"])return;let Q=new AbortController,Z=this.runCourseCorrectionAssessment(Q.signal);this.ops.pendingCourseCorrection={abort:Q,promise:Z}}).catch((J)=>{x.error("Failed to check course correction config",J,{threadID:this.threadID})})}async runCourseCorrectionAssessment(J){try{x.debug("Starting course correction assessment",{threadID:this.threadID});let Q=await Pa0({thread:this.thread,configService:this.deps.configService,signal:J});if(J.aborted)return null;return x.debug("Course correction assessment complete",{threadID:this.threadID,needsCorrection:Q.result.needsCorrection}),{...Q.result,usage:Q["~debugUsage"]}}catch(Q){if(!l3(Q))x.error("Course correction assessment failed",Q,{threadID:this.threadID});return null}}async checkPendingCourseCorrection(){let J=this.ops.pendingCourseCorrection;if(!J)return!1;let Q=1000,Z=new Promise((Y)=>setTimeout(()=>Y(null),Q));try{let Y=await Promise.race([J.promise,Z]);if(this.ops.pendingCourseCorrection===J)this.ops.pendingCourseCorrection=null;if(!Y||!Y.needsCorrection||!Y.message)return!1;if(J.abort.signal.aborted)return!1;let{message:X,usage:G}=Y;x.debug("Course correction triggered",{threadID:this.threadID,message:X});let V={type:"course-correction",message:X,usage:G};return this.updateThread(V),this.onThreadDelta(V),!0}catch(Y){if(this.ops.pendingCourseCorrection===J)this.ops.pendingCourseCorrection=null;if(!l3(Y))x.error("Course correction check failed",Y,{threadID:this.threadID});return!1}}abortPendingCourseCorrection(){if(this.ops.pendingCourseCorrection)this.ops.pendingCourseCorrection.abort.abort(),this.ops.pendingCourseCorrection=null}runCourseCorrectionOnEndTurn(){this.getConfig().then(async(J)=>{if(!J.settings?.["experimental.courseCorrection.enabled"])return;let Q=new AbortController,Z=await this.runCourseCorrectionAssessment(Q.signal);if(Q.signal.aborted||!Z?.needsCorrection||!Z.message)return;x.debug("Course correction triggered on end_turn",{threadID:this.threadID,message:Z.message});let Y={type:"user:message",message:{content:[{type:"text",text:Z.message}],source:{type:"course-correction"}}};this.updateThread(Y),this.onThreadDelta(Y)}).catch((J)=>{if(!l3(J))x.error("Course correction on end_turn failed",J,{threadID:this.threadID})})}startCacheTimer(J){this.stopCacheTimer();let Q=J.cacheReadInputTokens??0,Z=J.cacheCreationInputTokens??0;if(Q===0&&Z===0)return;let Y=J.model?eD0(J.model):void 0,X=QM0(Y),G=Q>0?Q:Z,V=JM0(G,Y),K=X;this.cacheExpiryTimer.next({secondsRemaining:K,potentialSavingsUSD:V,cacheableTokens:G}),this.cacheTimerInterval=setInterval(()=>{if(K--,K<=0)this.cacheExpiryTimer.next({secondsRemaining:0,potentialSavingsUSD:0,cacheableTokens:G}),this.stopCacheTimer();else this.cacheExpiryTimer.next({secondsRemaining:K,potentialSavingsUSD:V,cacheableTokens:G})},1000)}stopCacheTimer(){if(this.cacheTimerInterval)clearInterval(this.cacheTimerInterval),this.cacheTimerInterval=null}resetCacheTimer(){this.stopCacheTimer(),this.cacheExpiryTimer.next({secondsRemaining:null,potentialSavingsUSD:0,cacheableTokens:0})}setTestEphemeralError(J){this.ephemeralError.next(J)}async cancelSubthread(J){let Q=this.registeredSubthreads.get(J);if(Q&&Q.worker)await Q.worker.cancel()}abortToolOp(J){this.ops.tools[J]?.abort(),delete this.ops.tools[J]}abortAllTools(){for(let J of Object.keys(this.ops.tools)){let Q=J,Z=this.ops.toolMessages[Q];if(Z)try{Z.next({type:"stop-command"}),Z.complete(),delete this.ops.toolMessages[Q]}catch(Y){x.warn("Failed to send stop-command during disposal",{id:Q,error:Y})}this.abortToolOp(Q)}}trackFiles(J){for(let Q of J)this.trackedFiles.add(Q)}async restoreFileChangesFromBackups(){try{let J=await this.fs.tracker.restoreFromBackups();x.debug(`Restored ${J.totalBackups} backup files from disk`),await this.updateFileChanges()}catch(J){x.error("Error restoring file changes",J,{threadID:this.threadID})}}async revertFileChanges(J){for(let Q of this.registeredSubthreads.values()){let Z=Q?.worker;if(Z)await Z.revertFileChanges(J)}await this.fs.tracker.revertAll(J),await this.updateFileChanges()}async getAllTrackedChanges(){let J=new Map;for(let Z of this.registeredSubthreads.values()){let Y=Z?.worker;if(Y){let X=await Y.getAllTrackedChanges();for(let[G,V]of X.entries())J.set(G,V)}}let Q=await this.fs.tracker.getAllRecords();for(let[Z,Y]of Q.entries())J.set(Z,Y);return J}async cleanupForkThreads(J=this.thread.messages.length){await this.acquireThread(),this.updateThread({type:"thread:truncate",fromIndex:J})}async getToolUsesToRevert(J=this.thread.messages.length){let Q=new Set;this.thread.messages.slice(0,J).forEach((X)=>{if(X.role==="user"){for(let G of X.content)if(G.type==="tool_result")Q.add(G.toolUseID)}else for(let G of X.content)if(G.type==="tool_use")Q.add(G.id)});let Z=new Set,Y=await this.fs.tracker.getAllRecords();for(let[X]of Y.entries())if(!Q.has(X))Z.add(X);return Z}async getFilesAffectedByTruncation(J){let Q=await this.getToolUsesToRevert(J);if(Q.size===0)return[];return this.fs.tracker.getFilesForToolUses(Q)}async cleanupFileChanges(J=this.thread.messages.length){let Q=await this.getToolUsesToRevert(J);if(Q.size===0)return;await this.fs.tracker.revertChanges(Q),await this.updateFileChanges()}async updateFileChanges(){this.cachedFileChanges=await Ta0(this.fs.tracker),this.mergeAndEmit()}mergeAndEmit(){let J=new V3;for(let Z of this.cachedFileChanges)J.set(Z.uri,Z);for(let Z of this.registeredSubthreads.values())for(let Y of Z.latestFiles??[])J.set(Y.uri,Y);let Q=J.size;if(Q>50)x.warn("Excessive file changes detected - potential memory issue",{name:"mergeAndEmit",threadID:this.threadID,fileChangeCount:Q,ownFileChanges:this.cachedFileChanges.length,subthreadCount:this.registeredSubthreads.size});this.fileChanges.next({files:[...J.values()]})}emitSubthreads(){let J=Array.from(this.registeredSubthreads.values()).sort((Q,Z)=>Q.sequenceNumber-Z.sequenceNumber).map((Q)=>({threadID:Q.threadID,toolUse:Q.toolUse,sequenceNumber:Q.sequenceNumber}));this._subthreadsSubject.next(J)}async registerSubthread(J,Q,Z){if(this.registeredSubthreads.has(J))return;let Y=await J2.getOrCreateForSubThread(this.deps,Q);await Y.resume();let X=Y.status.pipe(v5((G)=>G.state==="active"),Q6((G)=>G.fileChanges.files),HF(this.disposed$)).subscribe((G)=>{let V=this.registeredSubthreads.get(J);if(!V)return;V.latestFiles=G,this.mergeAndEmit()});this.registeredSubthreads.set(J,{threadID:Q,worker:Y,fileChanges:X,toolUse:Z,sequenceNumber:++this.subthreadSequenceNumber}),this.emitSubthreads()}continueInferenceAfterRejection(J=!0){this.shouldContinueAfterRejection=J}async asyncDispose(){if(this.isDisposed)return;if(x.debug("ThreadWorker disposal starting",{name:"ThreadWorker.dispose",threadID:this.threadID,subthreadCount:this.registeredSubthreads.size,activeToolCount:Object.keys(this.ops.tools).length}),this.isDisposed=!0,this.disposed$.next(),this.disposed$.complete(),await Promise.all(Array.from(this.registeredSubthreads.values()).map(async(J)=>{J.fileChanges?.unsubscribe(),await J.worker?.asyncDispose()})),this.registeredSubthreads.clear(),this.cancelledToolUses.clear(),this.ops.toolCompletionResolvers)for(let J of Object.keys(this.ops.toolCompletionResolvers)){let Q=this.ops.toolCompletionResolvers[J];if(Q)try{Q.reject(Error("Worker disposed"))}finally{delete this.ops.toolCompletionResolvers[J]}}if(this.stopCacheTimer(),this._state.complete(),this.ephemeralError.complete(),this.inferenceState.complete(),this.fileChanges.complete(),this.toolCallUpdates.complete(),this._subthreadsSubject.complete(),this.cacheExpiryTimer.complete(),this.abortAllTools(),this.ops.inference)this.ops.inference.abort(),this.ops.inference=null;if(this.fs.tracker.dispose(),this.codeHostService)this.codeHostService.dispose(),this.codeHostService=null;if(this.threadReadWriter)await this.threadReadWriter.asyncDispose(),this.threadReadWriter=null}async getSelectedAgentMode(){let J=await this.getConfig(),{agentMode:Q}=yb(J.settings,this.thread);return Q}}n71([$P1],xb.prototype,"invokeTool",null),n71([$P1],xb.prototype,"runInferenceAndUpdateThread",null);function u08(J,Q,Z=!1){let Y=g2(J,"assistant");if(!Y||Y.state.type!=="complete"||Y.state.stopReason!=="tool_use")return!1;let X=Y.content.filter((K)=>K.type==="tool_use").map((K)=>K.id);if(Q&&!X.includes(Q))return x.debug(`tool:data for orphaned tool_use ${Q} - ignoring for inference`,{name:"shouldRunInferenceWithToolData",threadID:J.id}),!1;if(X.length===0)return!1;let G=kJ(J);return X.every((K)=>{let q=G.get(K);if(!q||!Z3(q.run))return!1;let W=q.run.status;if(W==="cancelled")return!1;if(W==="rejected-by-user")return Z;return!0})}class J01 extends xb{constructor(J,Q){super(J,Q)}static fromWorker(J){let Q=J.__testing__getDeps(),Z=new J01(Q,J.threadID);return Z.threadReadWriter=J.threadReadWriter,Z}async resume(){throw Error("ReplayThreadWorker: resume() is not allowed in replay mode")}async handle(J,Q){throw Error("ReplayThreadWorker: handle() is not allowed in replay mode")}async forkThread(J){throw Error("ReplayThreadWorker: forkThread() is not allowed in replay mode")}invokeBashTool(J,Q,Z){throw Error("ReplayThreadWorker: invokeBashTool() is not allowed in replay mode")}async retry(){throw Error("ReplayThreadWorker: retry() is not allowed in replay mode")}async cancel(){throw Error("ReplayThreadWorker: cancel() is not allowed in replay mode")}async findAndCancelToolRun(J,Q){throw Error("ReplayThreadWorker: findAndCancelToolRun() is not allowed in replay mode")}async cancelToolOnly(J,Q){throw Error("ReplayThreadWorker: cancelToolOnly() is not allowed in replay mode")}async revertFileChanges(){throw Error("ReplayThreadWorker: revertFileChanges() is not allowed in replay mode")}continueInferenceAfterRejection(J){}}y8();s6();U0();class Q01{storage;index=new Map;initialized=!1;initPromise=null;constructor(J){this.storage=J;this.ensureInitialized(),this.setupChangeListener()}async search(J,Q=20){if(!this.initialized)return[];if(this.index.size===0)return[];let Z=Array.from(this.index.entries()).map(([G,V])=>{return new wZ({id:G,kind:"file",path:V,uri:f0.parse(`thread://${G}`),metadata:{size:0,mtime:0,isSymlink:!1}})});return new to(J,{maxResults:Q,minScore:J?400:0}).match(Z).map((G)=>({id:G.entry.id,title:G.entry.path,score:G.score}))}async ensureInitialized(){if(this.initialized)return;if(this.initPromise)return this.initPromise;return this.initPromise=this.loadIndex(),this.initPromise}async loadIndex(){try{let J=await this.storage.keys(),Q=50;for(let Z=0;Z<J.length;Z+=50){let Y=J.slice(Z,Z+50),X=await Promise.all(Y.map(async(G)=>{return(await this.storage.get(G))?.title||null}));for(let G=0;G<Y.length;G++){let V=Y[G],K=X[G];if(V&&K&&K.trim().length>0)this.index.set(V,K)}if(Z+50<J.length)await new Promise((G)=>setImmediate(G))}this.initialized=!0,x.debug("Thread fuzzy indexer initialized",{indexedCount:this.index.size})}catch(J){x.warn("Failed to load thread index",J),this.initialized=!0}}setupChangeListener(){this.storage.changes.subscribe(async(J)=>{if(!this.initialized)return;if(J===void 0){await this.loadIndex();return}try{let Q=await this.storage.get(J);if(Q?.title)this.index.set(J,Q.title);else this.index.delete(J)}catch(Q){x.warn("Failed to update thread index for change",{key:J,error:Q})}})}dispose(){this.index.clear(),this.initialized=!1,this.initPromise=null}}o0();o0();function da0(J){return new Q0((Q)=>{let Z=!1,Y=!1;(async()=>{try{let V=await J.keys();if(Y)return;for(let K of V){if(Y)return;let q=await J.get(K);if(Y)return;Q.next({key:K,value:q,type:"initial"})}if(Z=!0,!Y)Q.next({type:"initial-complete"})}catch(V){if(!Y)Q.error(V)}})();let G=J.changes.subscribe({next:async(V)=>{if(!Z||V===void 0)return;try{let K=await J.get(V);if(!Y)Q.next({key:V,value:K,type:"change"})}catch(K){if(!Y)Q.error(K)}},error:(V)=>Q.error(V),complete:()=>Q.complete()});return()=>{Y=!0,G.unsubscribe()}})}function ca0(J){let Q=J??{},Z=new Map,Y=new u4;if(J){let X=Date.now();for(let G of Object.keys(J))Z.set(G,X)}return{async get(X){return Promise.resolve(Q[X])},async set(X,G){Q[X]=G,Z.set(X,Date.now()),Y.next(X)},async delete(X){delete Q[X],Z.delete(X),Y.next(X)},async keys(){return Object.keys(Q).toSorted((G,V)=>(Z.get(V)??0)-(Z.get(G)??0))},async path(X){return Promise.resolve(void 0)},changes:Y.pipe(S8(void 0))}}y8();class HP1{storage;entriesMap=new Map;historySubject=new u4;storageSubscription;_observeHistory;constructor(J,Q={}){this.storage=J;if(!Q.lazy)this.initializeObservable()}initializeObservable(){if(this._observeHistory)return;this._observeHistory=Q0.from(this.historySubject).pipe(i_(200,{leading:!0,trailing:!0}),A8()),this.storageSubscription=da0(this.storage).subscribe({next:(J)=>{if(J.type==="initial-complete"){this.emitCurrentList();return}let{key:Q,value:Z}=J;if(Z&&"messages"in Z)if(!(Z.messages.length===0&&!Z.draft))this.entriesMap.set(Q,p08(Z));else this.entriesMap.delete(Q);else this.entriesMap.delete(Q);this.emitCurrentList()},error:(J)=>this.historySubject.error(J),complete:()=>{this.emitCurrentList(),this.historySubject.complete()}})}emitCurrentList(){let J=Array.from(this.entriesMap.values()).toSorted((Q,Z)=>Z.userLastInteractedAt-Q.userLastInteractedAt);this.historySubject.next(J)}observeHistory(){if(!this._observeHistory)this.initializeObservable();return this._observeHistory}observeThreadList(){return this.observeHistory().pipe(N4((J,Q)=>{if(J.length!==Q.length)return!1;return J.every((Z,Y)=>{let X=Q[Y];if(!X)return!1;return Z.id===X.id&&Z.title===X.title&&Z.userLastInteractedAt===X.userLastInteractedAt&&Z.mainThreadID===X.mainThreadID&&JSON.stringify(Z.parentRelationships)===JSON.stringify(X.parentRelationships)&&JSON.stringify(Z.env?.initial?.trees?.map((G)=>G.displayName))===JSON.stringify(X.env?.initial?.trees?.map((G)=>G.displayName))})}))}dispose(){this.storageSubscription?.unsubscribe()}}function Z01(J){return Math.max(J.created,...J.messages.map((Q)=>Q.role==="user"?Q.meta?.sentAt:void 0).filter((Q)=>Q!==void 0))}function p08(J){return{id:J.id,v:J.v,created:J.created,title:J.title??null,userLastInteractedAt:Z01(J),env:J.env,originThreadID:J.originThreadID,mainThreadID:J.mainThreadID,parentRelationships:Hy(J),summaryStats:{diffStats:mE(J)}}}o0();MQ();MQ();U0();s6();yW();class zP1 extends Error{constructor(J){super(J);this.name="PlanHandoffError"}}function la0(J){if(J.agentMode!=="plan")throw new zP1("Thread is not in plan mode");let Q=aF(J);if(!Q||Q.trim()===""||Q===xG)throw new zP1("No plan content to execute. Please create a plan using edit_plan before switching to execution mode.")}function d08(J,Q){let Z=/\[([^\]]+)\]\((file:\/\/[^)]+)\)/g;return J.replace(Z,(Y,X,G)=>{try{let V=G.split("#")[0],K=T6(f0.parse(V)),q=SJ(K,Q);return`@${TK(q)}`}catch{return Y}})}function ia0(J,Q){let Z=Q.env?.initial;if(!Z)return`Execute the following plan:
3027
+ `+J.result.output}return J.result.output}}return _a0.default.stringify(J)}var b08=ya0.metrics.getMeter("thread-worker-service"),WP1=b08.createGauge("thread_worker_count",{description:"Number of active thread workers"});class xa0{threadWorkers=new c_;async getOrCreateForThread(J,Q){if(await J.threadService.getPrimitiveProperty(Q,"mainThreadID"))return this.getOrCreateForSubThread(J,Q);return this.getOrCreateForThreadInternal(J,Q)}async getOrCreateForSubThread(J,Q){return this.getOrCreateForThreadInternal(J,Q)}async getOrCreateForThreadInternal(J,Q){let Z=this.threadWorkers.get(Q);if(!Z){if(Z=new xb(J,Q),this.threadWorkers.set(Q,Z),this.threadWorkers.size>25)x.info("Many active thread workers detected",{name:"ThreadWorkerService.memoryCheck",threadID:Q,totalWorkerCount:this.threadWorkers.size})}return WP1.record(this.threadWorkers.size),Z}get workers(){return this.threadWorkers.observable}get statuses(){return this.threadWorkers.observable.pipe(T4((J)=>J.size===0?Q0.of({}):j8(...Array.from(J.values()).map((Q)=>Q.status.pipe(Q6((Z)=>[Q.threadID,Q.threadReadWriter?iL(Q.thread,Z):void 0])))).pipe(Q6((Q)=>Object.fromEntries(Q)))),NG(25),A8())}get(J){return this.threadWorkers.get(J)}prettyPrintToolRun(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No worker found for thread ${J}`);for(let Y of Z.thread.messages)for(let X of Y.content)if(X.type==="tool_result"&&X.toolUseID===Q)return ka0(X.run);throw Error(`Tool run not found for thread ${J} and tool use ${Q}`)}async cancelToolOnly(J,Q){await this.threadWorkers.get(J)?.cancelToolOnly(Q)}async cancel(J){await this.threadWorkers.get(J)?.cancel()}async dispose(J){let Q=this.threadWorkers.get(J);if(Q)await Q.asyncDispose(),this.threadWorkers.delete(J),WP1.record(this.threadWorkers.size);this.threadWorkers.dispose()}async retry(J){let Q=this.threadWorkers.get(J);if(!Q)throw Error(`No active worker for thread ${J}`);await Q.retry()}async revertFileChanges(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No active worker for thread ${J}`);await Z.revertFileChanges(Q)}async getFilesAffectedByTruncation(J,Q){let Z=this.threadWorkers.get(J);if(!Z)throw Error(`No active worker for thread ${J}`);return Z.getFilesAffectedByTruncation(Q)}async cleanupThreadBackups(J,Q){let Z=this.threadWorkers.get(Q);if(Z)await Z.fs.tracker.cleanupBackups();else{let Y=await J.threadService.get(Q);if(!Y)return;let X=J.vfs.fileSystemWithMountedTrees(jx(Y));try{await new rx(X).cleanup(Q),x.debug(`Cleaned up backup files for thread ${Q}`,{threadID:Q})}catch(G){x.error("Error cleaning up thread backups",G,{threadID:Q})}}}async disposeAll(){await Promise.all(Array.from(this.threadWorkers.values()).map(async(J)=>await J.asyncDispose())),this.threadWorkers.clear(),WP1.record(0)}}var J2=new xa0;s6();o0();S3();y7();MU();function va0(J){let Q=[],Z=/@((?:[^\s@\\,;]|\\.)+)/g,Y;while((Y=Z.exec(J))!==null){let X=Y[1],G=g08(X).replace(/[.,;:!?)}\]]+$/,"");Q.push(G)}return Q}function g08(J){if(J.match(/^[A-Za-z]:[\\]/))return J.replace(/\\(.)/g,(Q,Z)=>{if(Z===" "||Z==="("||Z===")"||Z==="["||Z==="]"||Z==="?"||Z==="*")return Z;return Q});return J.replace(/\\(.)/g,"$1")}y8();pM();async function ba0(J,{configService:Q,filesystem:Z}){let Y={sentAt:Date.now()},X=await H6(Q.workspaceRoots)??[],G=Y3(J.content);if(X.length===0)return{role:"user",content:J.content,source:J.source,fileMentions:void 0,userState:void 0,agentMode:J.agentMode,meta:Y};let V=await Ds({fileSystem:Z},va0(G),{searchPaths:X,shouldIncludeImages:!J.agentMode||Gy(J.agentMode)}),K;if(V?.files&&V.files.length>0){let H=new Set,z=[],D=(await Q.getLatest()).settings["experimental.guidanceFilesInContext"]??!1;for(let M of V.files){let L=m4(M.uri),A=await OP(Z,L,X,null,H,void 0,{includeContent:D});for(let E of A){if(!z.some((I)=>I.uri===E.uri))z.push(E);H.add(E.uri)}}if(z.length>0)K=z}let q=await(await Promise.resolve().then(() => (ha0(),fa0))).getUserState();return{role:"user",content:V?.imageBlocks?.length?[...J.content,...V.imageBlocks]:J.content,source:J.source,fileMentions:V,userState:{...q??my0},agentMode:J.agentMode,discoveredGuidanceFiles:K,meta:Y}}class xb{deps;threadID;async resumeInProgressTools(){for(let J of this.thread.messages){if(J.role!=="user")continue;for(let Q of J.content){if(Q.type!=="tool_result")continue;if(!(!Z3(Q.run)&&Q.run.status!=="blocked-on-user"&&!this.ops.tools[Q.toolUseID]))continue;let Y=this.findToolUseById(Q.toolUseID);if(!Y)continue;if(Y.name===U5||Y.name===wD0){this.findAndCancelToolRun(Q.toolUseID);continue}x.debug(`re-invoking tool ${Y.name} with ID ${Q.toolUseID}`,{name:"resumeInProgressTools",threadID:this.threadID}),this.invokeTool(Y,Q.userInput)}}await this.updateFileChanges()}findToolUseById(J){for(let Q of this.thread.messages){if(Q.role!=="assistant")continue;for(let Z of Q.content)if(Z.type==="tool_use"&&Z.id===J)return Z}return}trackFilesFromHistory(){x.debug("Tracking files from thread history",{name:"trackFilesFromHistory",threadID:this.threadID});for(let J of this.thread.messages){if(J.role==="user"&&J.fileMentions?.files)this.trackFiles(J.fileMentions.files.map((Q)=>Q.uri).filter((Q)=>Q!==void 0));if(J.role==="user"){for(let Q of J.content)if(Q.type==="tool_result"&&Q.run.status==="done")this.trackFiles(Q.run.trackFiles??[])}}}async getConfig(J){return H6(this.deps.configService.config,J)}async getCodeHostService(J){if(!this.codeHostService){let Q=this.thread.env?.initial.trees||[],Z=await this.getConfig(J);this.codeHostService=pj0(Q,this.deps.threadService,this.deps.mcpService,Z,this.threadID)}return this.codeHostService}setupSettingsChangeHandlers(){this.setupPermissionsChangeHandler()}setupPermissionsChangeHandler(){this.deps.configService.config.pipe(Q6((J)=>EE(J.settings?.permissions)),N4(),NU0(1),HF(this.disposed$)).subscribe(()=>{this.reevaluateBlockedTools()})}reevaluateBlockedTools(){for(let J=this.thread.messages.length-1;J>=0;J--){let Q=this.thread.messages[J];if(!Q||Q.role!=="user")continue;let Z=!1;for(let Y of Q.content)if(Y.type==="tool_result"&&Y.run?.status==="blocked-on-user"&&Y.toolUseID)Z=!0,this.checkAndApproveBlockedTool(Y.toolUseID);if(!Z)break}}async checkAndApproveBlockedTool(J){try{let Q=this.findToolUseById(J);if(!Q){x.warn("Tool use block not found for blocked tool",{toolUseID:J});return}let Z=await n11(Q.name,Q.input??{},{configService:this.deps.configService},this.thread.mainThreadID?"subagent":"thread",this.threadID,J);if(Z.permitted)x.info("Auto-approving previously blocked tool due to permission change",{toolName:Q.name,toolUseID:J,threadID:this.threadID}),this.handle({type:"user:tool-input",toolUse:J,value:{accepted:!0}});else x.debug("Tool remains blocked after permission change",{toolName:Q.name,toolUseID:J,reason:Z.reason})}catch(Q){x.warn("Failed to re-evaluate blocked tool",{error:Q,toolUseID:J})}}async cleanupTaskToolSubThreads(J=this.thread.messages.length){let Q=this.thread.messages.slice(0,J),Z=rH1(Q),Y=new Set(Z.map((G)=>G.toolUseID)),X=new Set;for(let[G]of this.registeredSubthreads.entries())if(!Y.has(G))X.add(G);for(let G of X){let V=this.registeredSubthreads.get(G);if(V.fileChanges?.unsubscribe(),await V.worker?.revertFileChanges(),V.latestFiles=[],this.mergeAndEmit(),await this.cleanupThreadBackups(V.threadID),await V.worker?.asyncDispose(),this.deps.deleteThread)try{await this.deps.deleteThread(V.threadID)}catch(K){x.error(`Failed to delete Task tool sub-thread: ${V.threadID}`,K,{threadID:this.threadID,subThreadID:V.threadID})}else x.warn(`Cannot delete Task tool sub-thread: ${V.threadID} - threadHistoryService not available`,{threadID:this.threadID,subThreadID:V.threadID});this.registeredSubthreads.delete(G)}if(X.size>0)this.emitSubthreads()}ops={tools:{},toolMessages:{},inference:null,pendingCourseCorrection:null};_state=new s9("initial");state=this._state.pipe(N4(),A8({shouldCountRefs:!0}));handleMutex=new vG;ephemeralError=new s9(void 0);inferenceState=new s9("idle");fileChanges=new s9({files:[]});toolCallUpdates=new u4;cacheExpiryTimer=new s9({secondsRemaining:null,potentialSavingsUSD:0,cacheableTokens:0});cacheTimer=this.cacheExpiryTimer.pipe(N4((J,Q)=>J.secondsRemaining===Q.secondsRemaining&&J.potentialSavingsUSD===Q.potentialSavingsUSD&&J.cacheableTokens===Q.cacheableTokens),A8({shouldCountRefs:!0}));cacheTimerInterval=null;trackedFiles=new gJ;discoveredGuidanceFileURIs=new Set;fs;cachedFileChanges=[];registeredSubthreads=new Map;subthreadSequenceNumber=0;_subthreadsSubject=new s9([]);subthreads=this._subthreadsSubject.pipe(N4(),A8({shouldCountRefs:!0}));disposed$=new u4;isDisposed=!1;cancelledToolUses=new Set;codeHostService=null;shouldContinueAfterRejection=!1;lastInferenceRequestId;constructor(J,Q){this.deps=J;this.threadID=Q;this.fs=La0({fileChangeTrackerStorage:this.deps.fileChangeTrackerStorage},this.deps.vfs,Q,()=>jx(this.thread))}status=this.state.pipe(T4((J)=>J==="active"?j8(this.inferenceState.pipe(N4()),this.fileChanges.pipe(N4()),this.ephemeralError,this.toolCallUpdates.pipe(S8(void 0))).pipe(Q6(([Q,Z,Y])=>({state:J,inferenceState:Q,fileChanges:Z,ephemeralError:Y?{message:Y.message,stack:"stack"in Y?Y.stack:void 0,error:"error"in Y&&Y.error&&typeof Y.error==="object"&&"error"in Y.error?Y.error.error:void 0}:void 0})),HF(this.disposed$)):Q0.of({state:J})),A8({shouldCountRefs:!0}));threadReadWriter=null;get thread(){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);return this.threadReadWriter.read()}set thread(J){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);this.threadReadWriter.write(J),this.__testing__setThread(J)}updateThread(J){if(!this.threadReadWriter)throw Error(`thread read-writer not initialized for ThreadWorker: ${this.threadID}`);this.threadReadWriter.update(Ob0(J)),this.__testing__setThread(this.threadReadWriter.read())}async acquireThread(){if(!this.threadReadWriter)this.threadReadWriter=await this.deps.threadService.exclusiveSyncReadWriter(this.threadID),this._state.next("active")}__testing__setThread(J){}__testing__getDeps(){return this.deps}async resume(){if(this.resumed)return;if(this.resumed=!0,this.handleCalled)throw Error("cannot call ThreadWorker.resume after ThreadWorker.handle");await this.acquireThread(),await this.restoreFileChangesFromBackups();let J=this.thread.messages.at(-1);if(J?.role==="assistant"&&J.state.type==="streaming")this.updateThread({type:"thread:truncate",fromIndex:this.thread.messages.length-1});if(this.trackFilesFromHistory(),await this.initializeCompletedSubthreads(),this.thread.mainThreadID)return;if(OM0(J)||wM0(J)&&!this.shouldContinueAfterRejection||sH1(J)){this.inferenceState.next("cancelled");return}await this.resumeInProgressTools(),this.setupSettingsChangeHandlers();let Q=this.thread.messages.findLastIndex((Y)=>Y.role==="user"?EM0(Y):Y.role==="assistant"&&Y.state.type==="complete");if(Q===-1){if(this.thread.messages.length!==0)throw Error(`(bug) invalid thread: ${this.threadID}`);return}let Z=this.thread.messages[Q];switch(Z.role){case"user":if(!Z.interrupted)this.onThreadDelta({type:"user:message",message:Z});break;case"assistant":this.onThreadDelta({type:"assistant:message",message:Z});break}}resumed=!1;async initializeCompletedSubthreads(){let J=rH1(this.thread.messages);for(let{toolUseID:Q,threadID:Z,toolUse:Y,toolResult:X}of J){let G=Z3(X.run),V=X.run.status==="blocked-on-user";if(G&&!V)await this.registerSubthread(Q,Z,Y)}}async forkThread(J){await this.acquireThread();let{threadService:Q}=this.deps,Z=await Q.forkThread(this.threadID,J);await this.handle({type:"fork:created",forkThreadID:Z.threadID,fromMessageIndex:J});let Y=await Q.getPrimitiveProperty(this.threadID,"v");if(Y!==null)await Q.flushVersion(this.threadID,Y);return Z.threadID}async handle(J,Q){await this.handleMutex.acquire();try{await this.innerHandle(J,Q)}finally{this.handleMutex.release()}}async innerHandle(J,Q){if(this.isDisposed){x.debug(`Skipping ${J.type} - worker disposed.`,{name:"handle queue",threadID:this.threadID});return}if(Q?.aborted){x.debug(`Skipping ${J.type} - signal aborted.`,{name:"handle queue",threadID:this.threadID});return}if(await this.resume(),this.handleCalled=!0,await this.acquireThread(),J.type==="thread:truncate")await this.cleanupFileChanges(J.fromIndex),await this.cleanupTaskToolSubThreads(J.fromIndex);let Z=J;if(J.type==="user:message"){let Y=await ba0(J.message,{configService:this.deps.configService,filesystem:this.fs.fileSystemReader()});Z=PF(J,(X)=>{X.message=k8(Y),Q?.throwIfAborted()})}try{if(this.ephemeralError.getValue()!==void 0)this.ephemeralError.next(void 0);let Y=J.type==="user:message"&&J.index!==void 0;if(this.updateThread(Z),this.onThreadDelta(Z),Y)await this.cleanupFileChanges(),await this.cleanupTaskToolSubThreads(),await this.cleanupForkThreads()}catch(Y){if(!l3(Y))x.error("Ephemeral error during handle processing",Y,{name:"ThreadWorker",threadID:this.threadID}),this.ephemeralError.next(Y instanceof Error?Y:Error(String(Y)));else x.debug(`AbortError caught during handle processing for ${Z.type}.`,{name:"handle queue",threadID:this.threadID})}}handleCalled=!1;onThreadDelta(J){switch(J.type){case"user:message":{if(this.abortPendingCourseCorrection(),J.index!==void 0)this.trackedFiles.clear(),this.thread.messages.forEach((Q)=>{if(Q.role==="user"){for(let Z of Q.content)if(Z.type==="tool_result"&&Z.run.status==="done"&&Z.run.trackFiles)this.trackFiles(Z.run.trackFiles);if(Q.fileMentions?.files)this.trackFiles(Q.fileMentions.files.map((Z)=>Z.uri).filter((Z)=>Z!==void 0))}});else this.trackFiles(J.message.fileMentions?.files?.map((Q)=>Q.uri).filter((Q)=>Q!==void 0)??[]);this.runInferenceAndUpdateThread({skipCourseCorrection:!0});break}case"user:message-queue:dequeue":{let Q=this.thread.messages.at(-1);if(!Q)break;if(Q.role!=="user")break;this.trackFiles(Q.fileMentions?.files?.map((Z)=>Z.uri).filter((Z)=>Z!==void 0)??[]),this.runInferenceAndUpdateThread({skipCourseCorrection:!0});break}case"user:tool-input":{let Q=qY(this.thread,J.toolUse);if(Q)this.invokeTool(Q,J.value);break}case"tool:data":{if(this.cancelledToolUses.has(J.toolUse)){this.updateThread({type:"tool:data",toolUse:J.toolUse,data:{status:"cancelled",reason:"cancelled by user message"}});return}let Q=qY(this.thread,J.toolUse);if(J.data.status==="in-progress"&&Q?.name===b2){let Z=Q,Y=oH1(J.data.progress);if(Y)this.registerSubthread(J.toolUse,Y,Z)}if(Z3(J.data)){this.cancelledToolUses.delete(J.toolUse);let Z=this.ops.toolCompletionResolvers?.[J.toolUse];if(Z){if(J.data.status==="done")Z.resolve();else Z.reject(Error(`Tool ${J.data.status}: ${J.toolUse}`));delete this.ops.toolCompletionResolvers?.[J.toolUse]}}if(Q){let Z=u08(this.thread,J.toolUse,this.shouldContinueAfterRejection);x.debug(`updated tool_result${Z?" and running inference because all tools completed":""}`,{name:`handleThreadDelta(${J.type}, ${J.toolUse}, ${J.data.status})`,threadID:this.threadID});let Y=this.shouldContinueAfterRejection||this.inferenceState.getValue()!=="cancelled";if(Z&&Y)this.runInferenceAndUpdateThread()}this.toolCallUpdates.next();break}case"assistant:message":{this.resetCacheTimer();let Q=this.findToolUsesNeedingInvocation(J.message);x.debug(`saw ${Q.length} tool uses (${Q.map((Z)=>Z.name).join(", ")})`,{name:`handleThreadDelta(${J.type})`,threadID:this.threadID}),this.executeToolsWithPlan(Q);break}case"user:message-queue:enqueue":{let Q=this.inferenceState.getValue();if(qP1(this.thread,Q)!=="tool-running"){if(Q==="cancelled"){this.handle({type:"user:message-queue:dequeue"});break}else if(Q==="idle"){let Y=this.thread.messages.at(-1);if(Y?.role==="assistant"){if(Y.state.type==="cancelled"||Y.state.type==="error"){this.handle({type:"user:message-queue:dequeue"});break}if(Y.state.type==="complete"&&Y.state.stopReason!=="tool_use"){this.handle({type:"user:message-queue:dequeue"});break}}else if(Y?.role==="info"){this.handle({type:"user:message-queue:dequeue"});break}}}break}case"info:manual-bash-invocation":{this.handle({type:"user:message-queue:dequeue"});break}case"info:skill-injection":break;case"cancelled":break;case"inference:completed":{if(J.usage)this.startCacheTimer(J.usage);let Q=g2(this.thread,"assistant");if(Q&&Q.state.type==="complete"&&Q.state.stopReason==="refusal"){this.ephemeralError.next(Error("The model refused to respond to this request. Please retry with a different prompt."));break}if(Q){let Y=this.findToolUsesNeedingInvocation(Q);this.executeToolsWithPlan(Y)}if(Q&&Q.state.type==="complete"&&Q.state.stopReason==="end_turn")if(this.thread.queuedMessages&&this.thread.queuedMessages.length>0)this.handle({type:"user:message-queue:dequeue"});else this.runCourseCorrectionOnEndTurn(),s11(this,Sa0(this.deps.internalHooks?.onAssistantTurnEnd,{thread:this.thread}));break}}}findToolUsesNeedingInvocation(J){if(J.content.some((X)=>X.type==="tool_use"&&!T3(X)))return[];if(!(J.state?.type==="complete"||J.state?.type==="cancelled"))return[];let Y=kJ(this.thread);return J.content.filter((X)=>X.type==="tool_use").filter((X)=>!Y.has(X.id)&&!this.cancelledToolUses.has(X.id))}async getWorkspaceRoots(J){return await H6(this.deps.configService.workspaceRoots,J)??this.thread.env?.initial?.trees?.map((Q)=>Q.uri).filter((Q)=>Q!==void 0).map(jJ)??[]}async executeToolsWithPlan(J){if(J.length===0)return;let Q=Aa0(J,this.deps.toolService);x.debug(`executing ${J.length} tools in ${Q.length} batch(es)`,{name:"executeToolsWithPlan",threadID:this.threadID,batches:Q.map((Z)=>Z.map((Y)=>Y.name))}),this.startCourseCorrectionAssessment(),await this.executeToolBatchesSequentially(Q)}async executeToolBatchesSequentially(J){for(let Q of J){let Y=(await Promise.allSettled(Q.map((X)=>this.invokeToolAndWait(X,void 0)))).filter((X)=>X.status==="rejected");if(Y.length>0)x.warn(`${Y.length} tool(s) failed in batch`,{name:"executeToolBatchesSequentially",threadID:this.threadID,errors:Y.map((X)=>X.reason)})}}async invokeToolAndWait(J,Q){let Z=new Promise((Y,X)=>{if(!this.ops.toolCompletionResolvers)this.ops.toolCompletionResolvers={};this.ops.toolCompletionResolvers[J.id]={resolve:Y,reject:X}});this.invokeTool(J,Q).catch((Y)=>{let X=this.ops.toolCompletionResolvers?.[J.id];if(X)x.debug(`Tool invocation setup failed for ${J.id}`,{name:"invokeToolAndWait",threadID:this.threadID,error:String(Y)}),X.reject(Y),delete this.ops.toolCompletionResolvers?.[J.id]}),await Z}async invokeTool(J,Q){if(this.ops.tools[J.id])throw Error(`(bug) tool invocation already in progress: ${J.id}`);if(!T3(J))throw Error(`(bug) tool use is incomplete: ${J.id}`);let Z=await this.getConfig(),Y=Ca0(Z.settings?.hooks,{threadID:this.threadID,toolUse:J}),{abortOp:X}=await s11(this,Y);if(X){let V=this.ops.toolCompletionResolvers?.[J.id];if(V)V.resolve(),delete this.ops.toolCompletionResolvers?.[J.id];return}let G=new AbortController;this.ops.tools[J.id]=G,this.updateThread({type:"tool:data",toolUse:J.id,data:{status:"in-progress"}});try{let V=await this.getWorkspaceRoots(G.signal),K=gE(this.thread),q=new Q0((M)=>{this.ops.toolMessages[J.id]=M}),W=await this.getCodeHostService(G.signal),H={...this.deps,dir:V.at(0)??null,dirs:V,tool:J.name,thread:this.thread,config:await this.getConfig(),trackedFiles:new gJ(this.trackedFiles),filesystem:this.fs.trackedFileSystem(J.id),fileChangeTracker:this.fs.tracker,getAllTrackedChanges:this.getAllTrackedChanges.bind(this),toolUseID:J.id,todos:K,toolMessages:q,threadEnvironment:this.thread.env?.initial??await this.deps.getThreadEnvironment(),handleThreadDelta:this.handle.bind(this),pullRequestChanges:W.pullRequestChanges,agentMode:await this.getSelectedAgentMode(),discoveredGuidanceFileURIs:this.discoveredGuidanceFileURIs},z=this.deps.toolService.preprocessArgs?.(J.name,J.input,H);if(z)this.handle({type:"tool:processed",toolUse:J.id,newArgs:z});let U=z??J.input,D=this.deps.toolService.invokeTool(J.name,{args:U,userInput:Q},H).pipe(HF(this.disposed$),BG(()=>{delete this.ops.tools[J.id],this.ops.toolMessages[J.id]?.complete(),delete this.ops.toolMessages[J.id]})).subscribe({next:async(M)=>{if(x.debug(`${J.id}, ${M.status}`,{name:"invokeTool",threadID:this.threadID}),Z3(M)){delete this.ops.tools[J.id],D.unsubscribe();let L=this.ops.toolCompletionResolvers?.[J.id];if(L){if(M.status==="done")L.resolve();else L.reject(Error(`Tool ${M.status}: ${J.id}`));delete this.ops.toolCompletionResolvers?.[J.id]}if(M.status==="done"&&M.trackFiles?.length)this.trackFiles(M.trackFiles);if(Z.settings?.hooks){let A=ja0(Z.settings.hooks,{threadID:this.threadID,toolUse:J});await s11(this,A,{toolUseID:J.id})}}await this.updateFileChanges(),await this.handle({type:"tool:data",toolUse:J.id,data:M},G.signal)},error:async(M)=>{let L=this.ops.toolCompletionResolvers?.[J.id];if(L)L.reject(M),delete this.ops.toolCompletionResolvers?.[J.id];await this.handle({type:"tool:data",toolUse:J.id,data:{status:"error",error:{message:"message"in M?M.message:String(M),displayMessage:"displayMessage"in M?M.displayMessage:void 0}}},G.signal)},complete:()=>{let M=this.ops.toolCompletionResolvers?.[J.id];if(!M)return;let L=kJ(this.thread).get(J.id)?.run;if(L&&Z3(L))return;let A;if(this.isDisposed)A="Worker disposed";else if(G.signal.aborted)A="Tool aborted";else if(this.cancelledToolUses.has(J.id))A="Tool cancelled";else A="Tool observable completed without terminal state";M.reject(Error(A)),delete this.ops.toolCompletionResolvers?.[J.id]}});BM(G.signal,()=>D.unsubscribe())}catch(V){delete this.ops.tools[J.id];let K=this.ops.toolCompletionResolvers?.[J.id];if(K)K.reject(V),delete this.ops.toolCompletionResolvers?.[J.id];throw V}}async cancelInProgressTools(){for(let J of Object.keys(this.ops.tools))await this.cancelTool(J)}cancelAllActiveTools(){let J=kJ(this.thread);for(let Q of this.thread.messages){if(Q.role!=="assistant")continue;for(let Z of Q.content)if(Z.type==="tool_use"&&T3(Z)){let Y=J.get(Z.id);if(!(Y&&Z3(Y.run)))this.cancelledToolUses.add(Z.id)}}for(let Q of this.thread.messages)if(Q.role==="user"){for(let Z of Q.content)if(Z.type==="tool_result"){if(!Z3(Z.run))this.cancelledToolUses.add(Z.toolUseID)}}}cancelUnstartedTools(){let J=kJ(this.thread),Q=this.thread.messages.findLastIndex((Y)=>sH1(Y)),Z=Q===-1?this.thread.messages:this.thread.messages.slice(Q+1);for(let Y of Z){if(Y.role!=="assistant")continue;for(let X of Y.content)if(X.type==="tool_use"&&T3(X)){let G=J.get(X.id);if(!G||G.run.status==="blocked-on-user")this.updateThread({type:"tool:data",toolUse:X.id,data:{status:"cancelled"}})}}}async runInferenceAndUpdateThread(J){this.ops.inference?.abort(),this.ops.inference=null;let Q=new AbortController;this.ops.inference=Q,this.cancelAllActiveTools(),this.cancelUnstartedTools(),await this.cancelInProgressTools();for(let K of this.thread.messages)if(K.role==="user"){for(let q of K.content)if(q.type==="tool_result"&&q.run.status==="blocked-on-user")this.updateThread({type:"tool:data",toolUse:q.toolUseID,data:{status:"cancelled"}})}if(!J?.skipCourseCorrection){if(await this.checkPendingCourseCorrection())return}let Z=this.thread.messages.at(-1);if(this.thread.mainThreadID===void 0&&Z?.role==="user"&&this.thread.messages.filter((K)=>K.role==="user").length===1){if(this.deps.getThreadEnvironment)this.deps.getThreadEnvironment().then(async(K)=>{this.updateThread({type:"environment",env:{initial:{...this.thread.env?.initial,...K}}})}).catch((K)=>{x.error("Failed to initialize thread environment",K,{threadID:this.threadID})})}if(this.thread.mainThreadID===void 0&&!this.thread.title)this.getConfig(Q.signal).then((K)=>{if(Q.signal.aborted)return;let q=K.settings?.["agent.skipTitleGenerationIfMessageContains"]||[],W=this.thread.messages.find((H)=>{if(H.role!=="user")return!1;if(q.length===0)return!0;let z=Y3(H.content);return!q.some((U)=>z.includes(U))});if(W)this.deps.generateThreadTitle(W,this.thread,this.deps.configService,Q.signal).then(({title:H,usage:z})=>{if(Q.signal.aborted||this.isDisposed)return;if(H!==void 0&&this.thread.title!==H)this.updateThread({type:"title",value:H,usage:z})}).catch((H)=>{if(!l3(H))x.error("generateThreadTitle error",H,{name:"ThreadWorker",threadID:this.threadID})})}).catch((K)=>{if(!l3(K))x.error("ThreadWorker title generation config error",K)});let X=await this.getConfig(),{model:G,agentMode:V}=yb(X.settings,this.thread);try{let[K,q,W]=G.match(/(.*?)\/(.*)/)??[],H=Fa0(q??"",W??""),z=crypto.randomUUID();this.lastInferenceRequestId=z;let U=H.stream({model:W??"",thread:this.thread,buildSystemPromptDeps:{toolService:this.deps.toolService,configService:this.deps.configService,getThreadEnvironment:this.deps.getThreadEnvironment,filesystem:this.fs.fileSystemReader(),threadService:this.deps.threadService},signal:Q.signal,agentMode:V,clientRequestId:z});this.inferenceState.next("running");let D;for await(let M of U)D=M,await this.handle({type:"assistant:message-update",message:M});if(D?.usage&&this.lastInferenceRequestId){let{fetchCreditsByRequestId:M}=await Promise.resolve().then(() => (gH(),pa0)),L=await M(this.lastInferenceRequestId,this.deps.configService,{signal:Q.signal});if(L!==null)D={...D,usage:{...D.usage,credits:L}};this.lastInferenceRequestId=void 0}await this.handle({type:"inference:completed",model:D?.usage?.model,usage:D?.usage})}catch(K){if(!(l3(K)||rP0(K))){let q=K instanceof Error?K:Error(String(K));this.ephemeralError.next(q)}return}finally{if(this.ops.inference===Q)this.ops.inference=null,this.inferenceState.next("idle")}}async findAndCancelToolRun(J,Q){if(this.cancelInference(),!qY(this.thread,J))return;await this.cancelTool(J,Q)}async cancelToolOnly(J,Q){if(!qY(this.thread,J))return;let Y=this.cancelDataForToolRun(J);await this.cancelSubthread(J);let X=this.ops.toolMessages[J];if(X){try{X.next({type:"stop-command"})}catch(G){x.warn("Failed to send stop-command",{id:J,error:G})}X.complete(),delete this.ops.toolMessages[J]}x.debug(`cancelToolOnly(${J})`),await this.handle({type:"tool:data",toolUse:J,data:Y},Q)}invokeBashTool(J,Q,Z){return new Q0((Y)=>{let X,G,V,q=((H)=>{return BM(H,()=>{if(x.warn("Manual bash abort -> unsubscribe",{threadID:this.threadID}),V?.unsubscribe(),G?.unsubscribe(),Y?.complete(),X)this.handleManualBashInvocation(J,{status:"cancelled",progress:iH1(X)},Z)})})(Q);return(async()=>{try{if(Q.aborted){Y.error(Error("Operation was aborted"));return}let H=await this.getWorkspaceRoots(Q),z=await this.getConfig(Q),U=await this.getCodeHostService(Q),D={...this.deps,dir:H.at(0)??null,dirs:H,tool:U5,thread:this.thread,config:z,trackedFiles:new gJ(this.trackedFiles),filesystem:nR0(this.fs.fileSystemReader()),fileChangeTracker:this.fs.tracker,getAllTrackedChanges:this.getAllTrackedChanges.bind(this),toolUseID:oD(),todos:[],threadEnvironment:this.thread.env?.initial??await this.deps.getThreadEnvironment(),handleThreadDelta:this.handle.bind(this),pullRequestChanges:U.pullRequestChanges,discoveredGuidanceFileURIs:this.discoveredGuidanceFileURIs};G=this.deps.toolService.invokeTool(U5,{args:J,userInput:{accepted:!0}},D).subscribe({next:(M)=>{X=M,Y.next(M)},error:(M)=>{Y.error(M)},complete:()=>{if(X)this.handleManualBashInvocation(J,X,Z);Y.complete()}}),V=this.disposed$.subscribe(()=>{q(),G?.unsubscribe(),Y?.complete()})}catch(H){Y.error(H)}})(),()=>{q(),G?.unsubscribe(),V?.unsubscribe()}})}async handleManualBashInvocation(J,Q,Z){await this.handle({type:"info:manual-bash-invocation",args:J,toolRun:Q,hidden:Z})}async cleanupThreadBackups(J){try{await this.fs.tracker.cleanupBackups(),x.debug(`Cleaned up backup files for thread ${J}`,{threadID:J})}catch(Q){x.error("Error cleaning up thread backups",Q,{threadID:J})}}cancelDataForToolRun(J){let Z=kJ(this.thread).get(J)?.run;return{status:"cancelled",progress:Z?iH1(Z):void 0}}async cancelTool(J,Q){let Z=this.cancelDataForToolRun(J);await this.cancelSubthread(J);let Y=this.ops.toolMessages[J];if(Y){try{Y.next({type:"stop-command"})}catch(X){x.warn("Failed to send stop-command",{id:J,error:X})}Y.complete(),delete this.ops.toolMessages[J]}x.debug(`cancelToolRun(${J})`),await this.handle({type:"tool:data",toolUse:J,data:Z},Q)}async cancel(){x.debug("cancel: aborting inference operation and tools"),this.cancelInference(),this.cancelAllActiveTools(),this.cancelUnstartedTools(),await this.cancelInProgressTools(),await this.handle({type:"cancelled"},void 0)}cancelInference(){if(this.ops.inference)this.ops.inference.abort(Error(mU1.USER_CANCELLED)),this.ops.inference=null;this.inferenceState.next("cancelled")}async retry(){if(x.debug("retry: retrying inference operation"),this.ephemeralError.getValue()!==void 0)this.ephemeralError.next(void 0);if(this.ops.inference)this.ops.inference.abort(),this.ops.inference=null;let J=this.thread.messages.at(-1);if(J?.role==="assistant"&&J.state.type==="complete"&&J.state.stopReason==="refusal")this.updateThread({type:"thread:truncate",fromIndex:this.thread.messages.length-1});this.inferenceState.next("idle"),await this.runInferenceAndUpdateThread()}startCourseCorrectionAssessment(){this.ops.pendingCourseCorrection?.abort.abort(),this.ops.pendingCourseCorrection=null,this.getConfig().then((J)=>{if(!J.settings?.["experimental.courseCorrection.enabled"])return;let Q=new AbortController,Z=this.runCourseCorrectionAssessment(Q.signal);this.ops.pendingCourseCorrection={abort:Q,promise:Z}}).catch((J)=>{x.error("Failed to check course correction config",J,{threadID:this.threadID})})}async runCourseCorrectionAssessment(J){try{x.debug("Starting course correction assessment",{threadID:this.threadID});let Q=await Pa0({thread:this.thread,configService:this.deps.configService,signal:J});if(J.aborted)return null;return x.debug("Course correction assessment complete",{threadID:this.threadID,needsCorrection:Q.result.needsCorrection}),{...Q.result,usage:Q["~debugUsage"]}}catch(Q){if(!l3(Q))x.error("Course correction assessment failed",Q,{threadID:this.threadID});return null}}async checkPendingCourseCorrection(){let J=this.ops.pendingCourseCorrection;if(!J)return!1;let Q=1000,Z=new Promise((Y)=>setTimeout(()=>Y(null),Q));try{let Y=await Promise.race([J.promise,Z]);if(this.ops.pendingCourseCorrection===J)this.ops.pendingCourseCorrection=null;if(!Y||!Y.needsCorrection||!Y.message)return!1;if(J.abort.signal.aborted)return!1;let{message:X,usage:G}=Y;x.debug("Course correction triggered",{threadID:this.threadID,message:X});let V={type:"course-correction",message:X,usage:G};return this.updateThread(V),this.onThreadDelta(V),!0}catch(Y){if(this.ops.pendingCourseCorrection===J)this.ops.pendingCourseCorrection=null;if(!l3(Y))x.error("Course correction check failed",Y,{threadID:this.threadID});return!1}}abortPendingCourseCorrection(){if(this.ops.pendingCourseCorrection)this.ops.pendingCourseCorrection.abort.abort(),this.ops.pendingCourseCorrection=null}runCourseCorrectionOnEndTurn(){this.getConfig().then(async(J)=>{if(!J.settings?.["experimental.courseCorrection.enabled"])return;let Q=new AbortController,Z=await this.runCourseCorrectionAssessment(Q.signal);if(Q.signal.aborted||!Z?.needsCorrection||!Z.message)return;x.debug("Course correction triggered on end_turn",{threadID:this.threadID,message:Z.message});let Y={type:"user:message",message:{content:[{type:"text",text:Z.message}],source:{type:"course-correction"}}};this.updateThread(Y),this.onThreadDelta(Y)}).catch((J)=>{if(!l3(J))x.error("Course correction on end_turn failed",J,{threadID:this.threadID})})}startCacheTimer(J){this.stopCacheTimer();let Q=J.cacheReadInputTokens??0,Z=J.cacheCreationInputTokens??0;if(Q===0&&Z===0)return;let Y=J.model?eD0(J.model):void 0,X=QM0(Y),G=Q>0?Q:Z,V=JM0(G,Y),K=X;this.cacheExpiryTimer.next({secondsRemaining:K,potentialSavingsUSD:V,cacheableTokens:G}),this.cacheTimerInterval=setInterval(()=>{if(K--,K<=0)this.cacheExpiryTimer.next({secondsRemaining:0,potentialSavingsUSD:0,cacheableTokens:G}),this.stopCacheTimer();else this.cacheExpiryTimer.next({secondsRemaining:K,potentialSavingsUSD:V,cacheableTokens:G})},1000)}stopCacheTimer(){if(this.cacheTimerInterval)clearInterval(this.cacheTimerInterval),this.cacheTimerInterval=null}resetCacheTimer(){this.stopCacheTimer(),this.cacheExpiryTimer.next({secondsRemaining:null,potentialSavingsUSD:0,cacheableTokens:0})}setTestEphemeralError(J){this.ephemeralError.next(J)}async cancelSubthread(J){let Q=this.registeredSubthreads.get(J);if(Q&&Q.worker)await Q.worker.cancel()}abortToolOp(J){this.ops.tools[J]?.abort(),delete this.ops.tools[J]}abortAllTools(){for(let J of Object.keys(this.ops.tools)){let Q=J,Z=this.ops.toolMessages[Q];if(Z)try{Z.next({type:"stop-command"}),Z.complete(),delete this.ops.toolMessages[Q]}catch(Y){x.warn("Failed to send stop-command during disposal",{id:Q,error:Y})}this.abortToolOp(Q)}}trackFiles(J){for(let Q of J)this.trackedFiles.add(Q)}async restoreFileChangesFromBackups(){try{let J=await this.fs.tracker.restoreFromBackups();x.debug(`Restored ${J.totalBackups} backup files from disk`),await this.updateFileChanges()}catch(J){x.error("Error restoring file changes",J,{threadID:this.threadID})}}async revertFileChanges(J){for(let Q of this.registeredSubthreads.values()){let Z=Q?.worker;if(Z)await Z.revertFileChanges(J)}await this.fs.tracker.revertAll(J),await this.updateFileChanges()}async getAllTrackedChanges(){let J=new Map;for(let Z of this.registeredSubthreads.values()){let Y=Z?.worker;if(Y){let X=await Y.getAllTrackedChanges();for(let[G,V]of X.entries())J.set(G,V)}}let Q=await this.fs.tracker.getAllRecords();for(let[Z,Y]of Q.entries())J.set(Z,Y);return J}async cleanupForkThreads(J=this.thread.messages.length){await this.acquireThread(),this.updateThread({type:"thread:truncate",fromIndex:J})}async getToolUsesToRevert(J=this.thread.messages.length){let Q=new Set;this.thread.messages.slice(0,J).forEach((X)=>{if(X.role==="user"){for(let G of X.content)if(G.type==="tool_result")Q.add(G.toolUseID)}else for(let G of X.content)if(G.type==="tool_use")Q.add(G.id)});let Z=new Set,Y=await this.fs.tracker.getAllRecords();for(let[X]of Y.entries())if(!Q.has(X))Z.add(X);return Z}async getFilesAffectedByTruncation(J){let Q=await this.getToolUsesToRevert(J);if(Q.size===0)return[];return this.fs.tracker.getFilesForToolUses(Q)}async cleanupFileChanges(J=this.thread.messages.length){let Q=await this.getToolUsesToRevert(J);if(Q.size===0)return;await this.fs.tracker.revertChanges(Q),await this.updateFileChanges()}async updateFileChanges(){this.cachedFileChanges=await Ta0(this.fs.tracker),this.mergeAndEmit()}mergeAndEmit(){let J=new V3;for(let Z of this.cachedFileChanges)J.set(Z.uri,Z);for(let Z of this.registeredSubthreads.values())for(let Y of Z.latestFiles??[])J.set(Y.uri,Y);let Q=J.size;if(Q>50)x.warn("Excessive file changes detected - potential memory issue",{name:"mergeAndEmit",threadID:this.threadID,fileChangeCount:Q,ownFileChanges:this.cachedFileChanges.length,subthreadCount:this.registeredSubthreads.size});this.fileChanges.next({files:[...J.values()]})}emitSubthreads(){let J=Array.from(this.registeredSubthreads.values()).sort((Q,Z)=>Q.sequenceNumber-Z.sequenceNumber).map((Q)=>({threadID:Q.threadID,toolUse:Q.toolUse,sequenceNumber:Q.sequenceNumber}));this._subthreadsSubject.next(J)}async registerSubthread(J,Q,Z){if(this.registeredSubthreads.has(J))return;let Y=await J2.getOrCreateForSubThread(this.deps,Q);await Y.resume();let X=Y.status.pipe(v5((G)=>G.state==="active"),Q6((G)=>G.fileChanges.files),HF(this.disposed$)).subscribe((G)=>{let V=this.registeredSubthreads.get(J);if(!V)return;V.latestFiles=G,this.mergeAndEmit()});this.registeredSubthreads.set(J,{threadID:Q,worker:Y,fileChanges:X,toolUse:Z,sequenceNumber:++this.subthreadSequenceNumber}),this.emitSubthreads()}continueInferenceAfterRejection(J=!0){this.shouldContinueAfterRejection=J}async asyncDispose(){if(this.isDisposed)return;if(x.debug("ThreadWorker disposal starting",{name:"ThreadWorker.dispose",threadID:this.threadID,subthreadCount:this.registeredSubthreads.size,activeToolCount:Object.keys(this.ops.tools).length}),this.isDisposed=!0,this.disposed$.next(),this.disposed$.complete(),await Promise.all(Array.from(this.registeredSubthreads.values()).map(async(J)=>{J.fileChanges?.unsubscribe(),await J.worker?.asyncDispose()})),this.registeredSubthreads.clear(),this.cancelledToolUses.clear(),this.ops.toolCompletionResolvers)for(let J of Object.keys(this.ops.toolCompletionResolvers)){let Q=this.ops.toolCompletionResolvers[J];if(Q)try{Q.reject(Error("Worker disposed"))}finally{delete this.ops.toolCompletionResolvers[J]}}if(this.stopCacheTimer(),this._state.complete(),this.ephemeralError.complete(),this.inferenceState.complete(),this.fileChanges.complete(),this.toolCallUpdates.complete(),this._subthreadsSubject.complete(),this.cacheExpiryTimer.complete(),this.abortAllTools(),this.ops.inference)this.ops.inference.abort(),this.ops.inference=null;if(this.fs.tracker.dispose(),this.codeHostService)this.codeHostService.dispose(),this.codeHostService=null;if(this.threadReadWriter)await this.threadReadWriter.asyncDispose(),this.threadReadWriter=null}async getSelectedAgentMode(){let J=await this.getConfig(),{agentMode:Q}=yb(J.settings,this.thread);return Q}}n71([$P1],xb.prototype,"invokeTool",null),n71([$P1],xb.prototype,"runInferenceAndUpdateThread",null);function u08(J,Q,Z=!1){let Y=g2(J,"assistant");if(!Y||Y.state.type!=="complete"||Y.state.stopReason!=="tool_use")return!1;let X=Y.content.filter((K)=>K.type==="tool_use").map((K)=>K.id);if(Q&&!X.includes(Q))return x.debug(`tool:data for orphaned tool_use ${Q} - ignoring for inference`,{name:"shouldRunInferenceWithToolData",threadID:J.id}),!1;if(X.length===0)return!1;let G=kJ(J);return X.every((K)=>{let q=G.get(K);if(!q||!Z3(q.run))return!1;let W=q.run.status;if(W==="cancelled")return!1;if(W==="rejected-by-user")return Z;return!0})}class J01 extends xb{constructor(J,Q){super(J,Q)}static fromWorker(J){let Q=J.__testing__getDeps(),Z=new J01(Q,J.threadID);return Z.threadReadWriter=J.threadReadWriter,Z}async resume(){throw Error("ReplayThreadWorker: resume() is not allowed in replay mode")}async handle(J,Q){throw Error("ReplayThreadWorker: handle() is not allowed in replay mode")}async forkThread(J){throw Error("ReplayThreadWorker: forkThread() is not allowed in replay mode")}invokeBashTool(J,Q,Z){throw Error("ReplayThreadWorker: invokeBashTool() is not allowed in replay mode")}async retry(){throw Error("ReplayThreadWorker: retry() is not allowed in replay mode")}async cancel(){throw Error("ReplayThreadWorker: cancel() is not allowed in replay mode")}async findAndCancelToolRun(J,Q){throw Error("ReplayThreadWorker: findAndCancelToolRun() is not allowed in replay mode")}async cancelToolOnly(J,Q){throw Error("ReplayThreadWorker: cancelToolOnly() is not allowed in replay mode")}async revertFileChanges(){throw Error("ReplayThreadWorker: revertFileChanges() is not allowed in replay mode")}continueInferenceAfterRejection(J){}}y8();s6();U0();class Q01{storage;index=new Map;initialized=!1;initPromise=null;constructor(J){this.storage=J;this.ensureInitialized(),this.setupChangeListener()}async search(J,Q=20){if(!this.initialized)return[];if(this.index.size===0)return[];let Z=Array.from(this.index.entries()).map(([G,V])=>{return new wZ({id:G,kind:"file",path:V,uri:f0.parse(`thread://${G}`),metadata:{size:0,mtime:0,isSymlink:!1}})});return new to(J,{maxResults:Q,minScore:J?400:0}).match(Z).map((G)=>({id:G.entry.id,title:G.entry.path,score:G.score}))}async ensureInitialized(){if(this.initialized)return;if(this.initPromise)return this.initPromise;return this.initPromise=this.loadIndex(),this.initPromise}async loadIndex(){try{let J=await this.storage.keys(),Q=50;for(let Z=0;Z<J.length;Z+=50){let Y=J.slice(Z,Z+50),X=await Promise.all(Y.map(async(G)=>{return(await this.storage.get(G))?.title||null}));for(let G=0;G<Y.length;G++){let V=Y[G],K=X[G];if(V&&K&&K.trim().length>0)this.index.set(V,K)}if(Z+50<J.length)await new Promise((G)=>setImmediate(G))}this.initialized=!0,x.debug("Thread fuzzy indexer initialized",{indexedCount:this.index.size})}catch(J){x.warn("Failed to load thread index",J),this.initialized=!0}}setupChangeListener(){this.storage.changes.subscribe(async(J)=>{if(!this.initialized)return;if(J===void 0){await this.loadIndex();return}try{let Q=await this.storage.get(J);if(Q?.title)this.index.set(J,Q.title);else this.index.delete(J)}catch(Q){x.warn("Failed to update thread index for change",{key:J,error:Q})}})}dispose(){this.index.clear(),this.initialized=!1,this.initPromise=null}}o0();o0();function da0(J){return new Q0((Q)=>{let Z=!1,Y=!1;(async()=>{try{let V=await J.keys();if(Y)return;for(let K of V){if(Y)return;let q=await J.get(K);if(Y)return;Q.next({key:K,value:q,type:"initial"})}if(Z=!0,!Y)Q.next({type:"initial-complete"})}catch(V){if(!Y)Q.error(V)}})();let G=J.changes.subscribe({next:async(V)=>{if(!Z||V===void 0)return;try{let K=await J.get(V);if(!Y)Q.next({key:V,value:K,type:"change"})}catch(K){if(!Y)Q.error(K)}},error:(V)=>Q.error(V),complete:()=>Q.complete()});return()=>{Y=!0,G.unsubscribe()}})}function ca0(J){let Q=J??{},Z=new Map,Y=new u4;if(J){let X=Date.now();for(let G of Object.keys(J))Z.set(G,X)}return{async get(X){return Promise.resolve(Q[X])},async set(X,G){Q[X]=G,Z.set(X,Date.now()),Y.next(X)},async delete(X){delete Q[X],Z.delete(X),Y.next(X)},async keys(){return Object.keys(Q).toSorted((G,V)=>(Z.get(V)??0)-(Z.get(G)??0))},async path(X){return Promise.resolve(void 0)},changes:Y.pipe(S8(void 0))}}y8();class HP1{storage;entriesMap=new Map;historySubject=new u4;storageSubscription;_observeHistory;constructor(J,Q={}){this.storage=J;if(!Q.lazy)this.initializeObservable()}initializeObservable(){if(this._observeHistory)return;this._observeHistory=Q0.from(this.historySubject).pipe(i_(200,{leading:!0,trailing:!0}),A8()),this.storageSubscription=da0(this.storage).subscribe({next:(J)=>{if(J.type==="initial-complete"){this.emitCurrentList();return}let{key:Q,value:Z}=J;if(Z&&"messages"in Z)if(!(Z.messages.length===0&&!Z.draft))this.entriesMap.set(Q,p08(Z));else this.entriesMap.delete(Q);else this.entriesMap.delete(Q);this.emitCurrentList()},error:(J)=>this.historySubject.error(J),complete:()=>{this.emitCurrentList(),this.historySubject.complete()}})}emitCurrentList(){let J=Array.from(this.entriesMap.values()).toSorted((Q,Z)=>Z.userLastInteractedAt-Q.userLastInteractedAt);this.historySubject.next(J)}observeHistory(){if(!this._observeHistory)this.initializeObservable();return this._observeHistory}observeThreadList(){return this.observeHistory().pipe(N4((J,Q)=>{if(J.length!==Q.length)return!1;return J.every((Z,Y)=>{let X=Q[Y];if(!X)return!1;return Z.id===X.id&&Z.title===X.title&&Z.userLastInteractedAt===X.userLastInteractedAt&&Z.mainThreadID===X.mainThreadID&&JSON.stringify(Z.parentRelationships)===JSON.stringify(X.parentRelationships)&&JSON.stringify(Z.env?.initial?.trees?.map((G)=>G.displayName))===JSON.stringify(X.env?.initial?.trees?.map((G)=>G.displayName))})}))}dispose(){this.storageSubscription?.unsubscribe()}}function Z01(J){return Math.max(J.created,...J.messages.map((Q)=>Q.role==="user"?Q.meta?.sentAt:void 0).filter((Q)=>Q!==void 0))}function p08(J){return{id:J.id,v:J.v,created:J.created,title:J.title??null,userLastInteractedAt:Z01(J),env:J.env,originThreadID:J.originThreadID,mainThreadID:J.mainThreadID,parentRelationships:Hy(J),summaryStats:{diffStats:mE(J)}}}o0();MQ();MQ();U0();s6();yW();class zP1 extends Error{constructor(J){super(J);this.name="PlanHandoffError"}}function la0(J){if(J.agentMode!=="plan")throw new zP1("Thread is not in plan mode");let Q=aF(J);if(!Q||Q.trim()===""||Q===xG)throw new zP1("No plan content to execute. Please create a plan using edit_plan before switching to execution mode.")}function d08(J,Q){let Z=/\[([^\]]+)\]\((file:\/\/[^)]+)\)/g;return J.replace(Z,(Y,X,G)=>{try{let V=G.split("#")[0],K=T6(f0.parse(V)),q=SJ(K,Q);return`@${TK(q)}`}catch{return Y}})}function ia0(J,Q){let Z=Q.env?.initial;if(!Z)return`Execute the following plan:
3028
3028
 
3029
3029
  ${J}
3030
3030
 
@@ -3959,15 +3959,15 @@ Actual: ${X}`)}async function PV8(J,Q,Z){let{execSync:Y}=await import("node:ch
3959
3959
  ${D}`;if(X==="pnpm"&&D.includes("Unable to find the global bin directory"))M+=`
3960
3960
 
3961
3961
  Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
3962
- npm install -g @sourcegraph/amp`;K(Error(M))}},error:(U)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${U.message}`))},complete:()=>{if(!H)H=!0,V()}})})}U0();U0();async function n61(J,Q){let Y=Q||"https://registry.npmjs.org";try{let X=new AbortController,G=setTimeout(()=>X.abort(),5000),V=await fetch(`${Y}/@sourcegraph/amp`,{signal:X.signal});if(clearTimeout(G),!V.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await V.json(),q=K["dist-tags"]?.latest;if(!q)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=SV8(J,q),H=W<0,z,U;if(K.time){let D=K.time[J],M=K.time[q],L=Date.now();if(D)z=Math.floor((L-new Date(D).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return x.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(X){return x.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function SV8(J,Q){let Z=(V)=>{let[K,q]=V.split("-");return{parts:K?.split(".").map(Number)||[],label:q}},Y=Z(J),X=Z(Q),G=Math.max(Y.parts.length,X.parts.length);for(let V=0;V<G;V++){let K=Y.parts[V]||0,q=X.parts[V]||0;if(K<q)return-1;if(K>q)return 1}if(Y.label===X.label)return 0;if(!Y.label&&X.label)return 1;if(Y.label&&!X.label)return-1;if(Y.label&&X.label)return Y.label<X.label?-1:1;return 0}o0();function a61(J,Q){let Z=new u4,Y=Z.pipe(A8({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new qK().scoped("update"),G=Y.subscribe({next:(V)=>{X.debug("emit new state",V)}});try{let V=process.env.AMP_TEST_UPDATE_STATUS;if(V){X.debug("using fake update status for testing",{status:V}),await XR(500),Z.next(V);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){X.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let K=await Q.get("updates.mode");if(K==="disabled"){X.debug("checking disabled");return}X.debug("checking",{currentVersion:J,mode:K});let q=EA(),W=await n61(J,q);if(!(W.latestVersion&&W.hasUpdate)){X.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,D=0.5;if(Math.abs(U)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await i61();if(!K)K=z==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:K});if(K==="warn"){if(!H())Z.next("update-available");return}if(!z){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Z.next("update-available");return}try{await ug(W.latestVersion,z);let U=await EB(W.latestVersion),D={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")X.info("success",D),Z.next("updated");else X.warn("success with warning",D),Z.next("updated-with-warning")}catch(U){Z.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await XR(5000),Z.next("hidden"),G.unsubscribe(),Z.complete()}}),{state:Y}}import{stderr as Iq}from"node:process";function I96(J){let Q=new qA().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(Y)=>{await xC1(Y.force||!1,Y.verbose||!1,"0.0.1764808732-gb9c377"),process.exit()});J.addCommand(Q,{hidden:!0});let Z=new qA("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(Y)=>{await _V8(Y.targetVersion)});J.addCommand(Z)}async function _V8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")Iq.write(k4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
3962
+ npm install -g @sourcegraph/amp`;K(Error(M))}},error:(U)=>{if(!H)H=!0,K(Error(`Failed to spawn ${X}: ${U.message}`))},complete:()=>{if(!H)H=!0,V()}})})}U0();U0();async function n61(J,Q){let Y=Q||"https://registry.npmjs.org";try{let X=new AbortController,G=setTimeout(()=>X.abort(),5000),V=await fetch(`${Y}/@sourcegraph/amp`,{signal:X.signal});if(clearTimeout(G),!V.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await V.json(),q=K["dist-tags"]?.latest;if(!q)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=SV8(J,q),H=W<0,z,U;if(K.time){let D=K.time[J],M=K.time[q],L=Date.now();if(D)z=Math.floor((L-new Date(D).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return x.info("NPM version comparison",{currentVersion:J,latestVersion:q,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:q,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(X){return x.debug("Error checking npm version",{error:X}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function SV8(J,Q){let Z=(V)=>{let[K,q]=V.split("-");return{parts:K?.split(".").map(Number)||[],label:q}},Y=Z(J),X=Z(Q),G=Math.max(Y.parts.length,X.parts.length);for(let V=0;V<G;V++){let K=Y.parts[V]||0,q=X.parts[V]||0;if(K<q)return-1;if(K>q)return 1}if(Y.label===X.label)return 0;if(!Y.label&&X.label)return 1;if(Y.label&&!X.label)return-1;if(Y.label&&X.label)return Y.label<X.label?-1:1;return 0}o0();function a61(J,Q){let Z=new u4,Y=Z.pipe(A8({shouldCountRefs:!1}));return setImmediate(async()=>{let X=new qK().scoped("update"),G=Y.subscribe({next:(V)=>{X.debug("emit new state",V)}});try{let V=process.env.AMP_TEST_UPDATE_STATUS;if(V){X.debug("using fake update status for testing",{status:V}),await XR(500),Z.next(V);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){X.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let K=await Q.get("updates.mode");if(K==="disabled"){X.debug("checking disabled");return}X.debug("checking",{currentVersion:J,mode:K});let q=EA(),W=await n61(J,q);if(!(W.latestVersion&&W.hasUpdate)){X.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,D=0.5;if(Math.abs(U)<0.5)return X.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await i61();if(!K)K=z==="pnpm"?"warn":"auto",X.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:K});if(K==="warn"){if(!H())Z.next("update-available");return}if(!z){if(X.debug("auto-update not supported, falling back to warn mode"),!H())Z.next("update-available");return}try{await ug(W.latestVersion,z);let U=await EB(W.latestVersion),D={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")X.info("success",D),Z.next("updated");else X.warn("success with warning",D),Z.next("updated-with-warning")}catch(U){Z.next("update-error")}}catch(V){X.debug("check failed",{error:V})}finally{await XR(5000),Z.next("hidden"),G.unsubscribe(),Z.complete()}}),{state:Y}}import{stderr as Iq}from"node:process";function I96(J){let Q=new qA().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(Y)=>{await xC1(Y.force||!1,Y.verbose||!1,"0.0.1764811816-g233bde"),process.exit()});J.addCommand(Q,{hidden:!0});let Z=new qA("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(Y)=>{await _V8(Y.targetVersion)});J.addCommand(Z)}async function _V8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")Iq.write(k4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
3963
3963
 
3964
3964
  `));try{if(!J){Iq.write(k4.blue(`Checking for updates...
3965
- `));let Y=EA(),{hasUpdate:X,latestVersion:G}=await n61("0.0.1764808732-gb9c377",Y);if(!X){Iq.write(k4.green(`✓ Amp CLI is already up to date: ${"0.0.1764808732-gb9c377"} (${"released"} ${"2025-12-04T00:44:17.586Z"})
3966
- `));let K=await EB("0.0.1764808732-gb9c377");if(K.warning)Iq.write(`
3965
+ `));let Y=EA(),{hasUpdate:X,latestVersion:G}=await n61("0.0.1764811816-g233bde",Y);if(!X){Iq.write(k4.green(`✓ Amp CLI is already up to date: ${"0.0.1764811816-g233bde"} (${"released"} ${"2025-12-04T01:35:51.954Z"})
3966
+ `));let K=await EB("0.0.1764811816-g233bde");if(K.warning)Iq.write(`
3967
3967
  `+k4.yellow(K.warning)+`
3968
3968
  `);process.exit(0)}if(!G)Iq.write(k4.yellow("[WARN] could not find latest version")),process.exit(0);J=G}Iq.write(k4.blue(`Updating to version ${J}...
3969
3969
  `)),await ug(J,void 0,(Y)=>{Iq.write(k4.dim(`Running: ${Y}
3970
- `))});let Q="released";Iq.write(k4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-12-04T00:44:17.586Z"})
3970
+ `))});let Q="released";Iq.write(k4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-12-04T01:35:51.954Z"})
3971
3971
  `));let Z=await EB(J);if(Z.warning)Iq.write(`
3972
3972
  `+k4.yellow(Z.warning)+`
3973
3973
  `);process.exit(0)}catch(Q){let Z=Q instanceof Error?Q.message:String(Q);Iq.write(k4.red.bold("Error: ")+Z+`
@@ -4599,7 +4599,7 @@ exit code: ${G}`,new J1({color:Y.foreground,dim:!0,italic:!0})));if(V)K.push(new
4599
4599
  `,M),...L])})];if(H.url){let v=H.url.replace(/^https?:\/\//,"");k.push(new B7({uri:H.url,text:v,style:new J1({color:Z.secondary,underline:!0})}))}if(C)k.push(new X0({height:1})),k.push(C);let y=new X0({width:40,child:new b0({crossAxisAlignment:"start",mainAxisSize:"min",children:k})});return j4.child(new R6({mainAxisAlignment:"center",crossAxisAlignment:"center",mainAxisSize:"min",children:[new ZS1({width:_k1,height:kk1,agentMode:this.widget.agentMode,glow:this._glow,t:A,fps:0,shockwaves:this._shockwaves,onShockwave:I,...V==="disabled"&&{seed:42}}),new X0({width:2}),y]}))}}U0();y8();M4();A7();y8();o0();function BM8(J,Q){return`${J}:${Q}`}class yk1{threadService;workers=new Map;threadsMap=new Map;subthreadsMap=new Map;mainThreadSubs=new Map;subthreadsSubs=new Map;workerStatusSubs=new Map;subthreadPatchSubs=new Map;mainThreadObservable;subthreadObservable;workerStatusObservable;emitMainThread=null;emitSubthread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new Q0((Q)=>{return this.emitMainThread=(Z)=>Q.next(Z),()=>{this.emitMainThread=null}}),this.subthreadObservable=new Q0((Q)=>{return this.emitSubthread=(Z)=>Q.next(Z),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new Q0((Q)=>{return this.emitWorkerStatus=(Z)=>Q.next(Z),()=>{this.emitWorkerStatus=null}})}registerWorker(J){let Q=J.thread.id;if(this.workers.has(Q))this.unregisterWorker(Q);this.threadsMap.set(Q,J.thread),this.subthreadsMap.set(Q,[]),this.workers.set(Q,{state:"initial"});let Z=this.threadService.observePatches(Q).pipe(rD()).subscribe((G)=>{this.threadsMap.set(Q,G);let V=this.subthreadsMap.get(Q)||[],K=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:G,subthreads:V,workerStatus:K})});this.mainThreadSubs.set(Q,Z);let Y=J.status.subscribe((G)=>{if(this.workers.set(Q,G),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:G})});this.workerStatusSubs.set(Q,Y);let X=J.subthreads.subscribe((G)=>{this.subthreadsMap.set(Q,G);for(let V of G){let K=BM8(Q,V.toolUse.id);if(this.subthreadPatchSubs.has(K))continue;let q=this.threadService.observePatches(V.threadID).pipe(rD()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:V})});this.subthreadPatchSubs.set(K,q)}});this.subthreadsSubs.set(Q,X)}unregisterWorker(J){let Q=this.mainThreadSubs.get(J);if(Q)Q.unsubscribe(),this.mainThreadSubs.delete(J);let Z=this.workerStatusSubs.get(J);if(Z)Z.unsubscribe(),this.workerStatusSubs.delete(J);let Y=this.subthreadsSubs.get(J);if(Y)Y.unsubscribe(),this.subthreadsSubs.delete(J);for(let[X,G]of this.subthreadPatchSubs.entries())if(X.startsWith(`${J}:`))G.unsubscribe(),this.subthreadPatchSubs.delete(X);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new Q0((Q)=>{return this.mainThreadObservable.subscribe((Z)=>{if(Z.threadID===J)Q.next(Z)})}),subthreads:new Q0((Q)=>{return this.subthreadObservable.subscribe((Z)=>{if(Z.threadID===J)Q.next(Z)})}),workerStatus:new Q0((Q)=>{return this.workerStatusObservable.subscribe((Z)=>{if(Z.threadID===J)Q.next(Z)})})}}get threadViewStates(){let J={};for(let[Q,Z]of this.threadsMap){let Y=this.workers.get(Q);if(Y)J[Q]=iL(Z,Y)}return J}dispose(){for(let J of this.mainThreadSubs.values())J.unsubscribe();for(let J of this.subthreadsSubs.values())J.unsubscribe();for(let J of this.workerStatusSubs.values())J.unsubscribe();for(let J of this.subthreadPatchSubs.values())J.unsubscribe();this.mainThreadSubs.clear(),this.subthreadsSubs.clear(),this.workerStatusSubs.clear(),this.subthreadPatchSubs.clear(),this.workers.clear(),this.threadsMap.clear(),this.subthreadsMap.clear()}}function NM8(J,Q){switch(Q.type){case"subthread-patch":{let{thread:Z,subthread:Y}=Q,X=J.subagents[Y.threadID];if(!X){if(X={subThreadID:Z.id,parentToolID:Y.toolUse.id,taskDescription:Y.toolUse.input.description||"Task",isCompleted:!1,agentState:{type:"idle"}},J.mainThread){let W=kJ(J.mainThread);X.isCompleted=HZ6(W,Y.toolUse.id)}}let G=DM8(Z,X.agentState),V=X.agentState===G?X:{...X,agentState:G},K={...J.tools},q=LC(Z).items.filter((W)=>W.type==="toolResult");for(let W of q)K[W.id]={id:W.id,subthreadID:Z.id,toolRun:W.toolResult.run,toolUse:W.toolUse};return{subagents:{...J.subagents,[Y.threadID]:V},tools:K,items:J.items,viewState:J.viewState,todosList:J.todosList,mainThread:J.mainThread}}case"main-thread-patch":{let{thread:Z,subthreads:Y,workerStatus:X}=Q,G=kJ(Z),V={...J.subagents};for(let z of Y){let U=V[z.threadID];if(!U)continue;let D=HZ6(G,z.toolUse.id);V[z.threadID]={...U,isCompleted:D}}let{items:K}=LC(Z),q=iL(Z,X),W=gE({messages:Z.messages}),H=Array.isArray(W)?W:[];return{...J,subagents:V,items:K,viewState:q,todosList:H,mainThread:Z}}case"worker-status-change":{if(!J.mainThread)return J;let Z=iL(J.mainThread,Q.workerStatus);if(Z===J.viewState)return J;return{...J,viewState:Z}}default:return J}}function LC(J){let Q=[],Z=new Map,Y=new Set;for(let[X,G]of J.messages.entries()){let V=`${G.role}-${X}`;switch(G.role){case"assistant":{let K=G.state.type==="streaming";for(let W of G.content)if(W.type==="tool_use"){if(Z.set(W.id,W),K)Y.add(W.id)}if(G.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:V,message:G});for(let W of G.content)if(W.type==="tool_use"){let H=!1;for(let z=X+1;z<J.messages.length;z++){let U=J.messages[z];if(U){for(let D of U.content)if(D.type==="tool_result"&&D.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:K?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:V,message:G});break;case"user":{let K=G.content.some((q)=>q.type==="text"&&q.text.trim()||q.type==="image");for(let q of G.content)if(q.type==="tool_result"){let W=Z.get(q.toolUseID)??qY(J,q.toolUseID);if(!W)throw Error(`(bug) tool use ${q.toolUseID} not found`);Q.push({type:"toolResult",id:q.toolUseID,toolUse:W,toolResult:q})}if(K)Q.push({type:"message",id:V,message:G});break}}}return{items:Q}}function HZ6(J,Q){let Z=J.get(Q);return(Z&&Z3(Z.run))??!1}function DM8(J,Q){let Z=J.messages.at(-1);if(Z?.content.some((X)=>X.type==="tool_result"&&X.run.status==="blocked-on-user"))return x.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(LC(J).items.some((X)=>X.type==="toolResult"&&X.toolResult.run.status==="in-progress")){let X=Q?.type==="running-tools"?Q.startTime:Date.now();return x.info("Subagent status: running-tools",{threadID:J.id,startTime:X,hasStartTime:!!X}),{type:"running-tools",startTime:X}}if(Z&&Z.role==="assistant"&&Z.state.type==="streaming")switch(Z.content.at(-1)?.type){case"text":return x.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return x.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let G=Q?.type==="running-tools"?Q.startTime:Date.now();return x.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:G,hasStartTime:!!G}),{type:"running-tools",startTime:G}}default:return x.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return x.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class xk1 extends c0{props;constructor(J){super();this.props=J}createState(){return new zZ6}}class zZ6 extends p0{state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];recentThreadIDs=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}addToRecentThreads(J){this.setState(()=>{let Q=this.recentThreadIDs.indexOf(J);if(Q!==-1)this.recentThreadIDs.splice(Q,1);if(this.recentThreadIDs.unshift(J),this.recentThreadIDs.length>50)this.recentThreadIDs.pop()})}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new yk1(J),this.currentWorker=Q,this.setupSubscriptions(Q),this.addToRecentThreads(Q.thread.id)}dispose(){this.cleanup()}didUpdateWidget(J){if(J.props.threadService!==this.widget.props.threadService||J.props.worker!==this.widget.props.worker)this.cleanup(),this.setupSubscriptions(this.widget.props.worker)}setupSubscriptions(J){this.workerController.registerWorker(J);let Q=this.workerController.observeThread(J.thread.id),Z=Q.mainThread.subscribe((G)=>{this.dispatch({type:"main-thread-patch",thread:G.mainThread,subthreads:G.subthreads,workerStatus:G.workerStatus})});this.subscriptions.push(Z);let Y=Q.subthreads.subscribe((G)=>{this.dispatch({type:"subthread-patch",thread:G.thread,subthread:G.subthread})});this.subscriptions.push(Y);let X=Q.workerStatus.subscribe((G)=>{this.dispatch({type:"worker-status-change",workerStatus:G.status})});this.subscriptions.push(X)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null}}),this.setupSubscriptions(J),this.addToRecentThreads(J.thread.id)}dispatch(J){this.setState(()=>{this.state=NM8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((G)=>({toolUse:G.toolUse,toolRun:G.toolRun,subthreadID:G.subthreadID})),Q={};for(let G of Object.values(this.state.subagents)){let V=J.filter((K)=>K.subthreadID===G.subThreadID);Q[G.parentToolID]=V}let Z=(G)=>G===B5||G===i8||G===VY,Y=new Map;for(let G of this.state.items)if(G.type==="toolResult"&&Z(G.toolUse.name))Y.set(G.toolUse.id,{toolUseId:G.toolUse.id,toolName:G.toolUse.name,toolRun:G.toolResult.run});let X=Array.from(Y.values());for(let{toolUseId:G,toolRun:V}of X){let K=[],q;if(V.status==="in-progress"||V.status==="done"||V.status==="error"||V.status==="cancelled")q=V.progress;if(q){let W=0;for(let H of q)if(H.tool_uses)for(let z of H.tool_uses){let U=`${G}:progress:${W++}`;K.push({toolUse:fE(z.tool_name,z.input,U),toolRun:{status:z.status}})}}Q[G]=K}return{...this.state,subagents:Object.values(this.state.subagents),subagentActiveTools:J,subagentToolsByParentID:Q}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Z)=>this.switchWorker(Z),()=>this.currentWorker,this.recentThreadIDs)}}class vk1 extends c0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new FZ6}}class FZ6 extends p0{build(J){let Z=Y6.of(J).colors,{todos:Y,title:X="TODOs"}=this.widget.props;if(!Array.isArray(Y)||Y.length===0)return new X0({width:0,height:0});let G=Y.map((V)=>this.buildTodoItem(V,Z));return new l0({child:new V6({padding:B0.symmetric(1,0),child:new b0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new y1({text:new i(X,new J1({bold:!0,color:Z.foreground}))}),...G]})})})}buildTodoItem(J,Q){let Z=this.getStatusIcon(J.status),Y=J.status==="completed",X=new J1({bold:J.status==="in-progress",color:Q.foreground,dim:Y}),G=new J1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:Y});return new R6({crossAxisAlignment:"start",children:[new y1({text:new i(Z,X)}),new X0({width:1}),new a6({child:new y1({text:new i(J.content,G)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class fk1 extends E6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Z,onButtonClick:Y}){super({key:J});this.ad=Q,this.onDismiss=Z,this.onButtonClick=Y}build(J){let Q=Y6.of(J),Z=Q.colors.primary,Y=Q.colors.foreground;return new l0({decoration:new Z8(void 0,new A4(new q4(Z,1,"rounded"),new q4(Z,1,"rounded"),void 0,new q4(Z,1,"rounded"))),child:new V6({padding:B0.horizontal(1),child:new b0({children:[new R6({crossAxisAlignment:"start",children:[new a6({child:new y1({text:new i(this.ad.content,new J1({color:Y}))})}),new X0({width:4}),new B7({uri:"https://ampcode.com/free",text:"Ad",style:new J1({color:Y,dim:!0})})]}),new R6({crossAxisAlignment:"start",children:[new FS1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:B0.horizontal(1),color:Z,reverse:!0}),new X0({width:2}),new y1({text:new i(this.ad.destinationUrlHostname,new J1({color:Y,dim:!0}))})]})]})})})}}class hk1 extends c0{props;constructor(J){super();this.props=J}createState(){return new UZ6(this.props.autofocus??!0)}}class UZ6 extends p0{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(K)=>{if(K.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(K.ctrlKey&&K.key==="c"||K.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Z=f4.sizeOf(J),Y=Math.min(60,Z.width-4),X=Z.height-4,G=[];if(this.widget.props.title)G.push(new y1({text:new i(this.widget.props.title,new J1({bold:!0,color:D1.blue}))}),new X0({height:1}));if(this.widget.props.message)G.push(new y1({text:new i(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)G.push(new X0({height:1}));let V=[];if(this.widget.props.showCopyOption)V.push(new y1({text:new i("Enter to copy",new J1({dim:!0}))}));return V.push(new y1({text:new i("Escape to close",new J1({dim:!0}))})),G.push(new R6({children:V.flatMap((K,q)=>q<V.length-1?[K,new X0({width:1}),new y1({text:new i("•",new J1({dim:!0}))}),new X0({width:1})]:[K]),mainAxisSize:"min"})),new j4({child:new l0({constraints:new A6(Y,Y,0,X),decoration:new Z8(D1.default(),new A4(new q4(D1.blue,1,"rounded"),new q4(D1.blue,1,"rounded"),new q4(D1.blue,1,"rounded"),new q4(D1.blue,1,"rounded"))),padding:new B0(2,2,2,2),child:new D8({autofocus:this.autofocus,onKey:Q,child:new b0({children:G,mainAxisSize:"min"})})})})}}function MM8(J){let Q=Math.floor(J/60),Z=J%60;if(Q===0)return`${Z}s`;return`${Q}:${Z.toString().padStart(2,"0")}`}function LM8(J){if(J<0.01)return"<$0.01";return`$${J.toFixed(2)}`}function AM8(J){if(J<=60)return"~ 1m";if(J<=120)return"~ 2m";if(J<=300)return"~ 5m";return"~ 10m"}function BZ6(J,Q={}){if(J.secondsRemaining===null)return null;if(J.secondsRemaining===0)return{text:"cache expired",urgency:"expired"};let Z=J.secondsRemaining<=60,Y=Q.isIdle!==!1&&Z,X=Y?MM8(J.secondsRemaining):AM8(J.secondsRemaining),G=LM8(J.potentialSavingsUSD);if(Q.isNarrow)return{text:X,urgency:Y?"warning":"normal"};if(Q.prominent&&Y)return{text:`${X} left - respond now to save up to ${G}`,urgency:"warning"};return{text:`${X} (save up to ${G})`,urgency:Y?"warning":"normal"}}class N91 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,N91.prototype)}}class D91 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,D91.prototype)}}function bk1(J){let Q=J.match(/"([^"]*)"|'([^']*)'|([^\s"']+)/g);if(!Q)return[];return Q.map((Z)=>{if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);return Z})}nW();U0();import{spawn as OM8}from"node:child_process";import{promises as wM8}from"node:fs";function NZ6(J){return J.kind==="executable"}function DZ6(J){return J.kind==="markdown"}var Xz=50000,MZ6=300000;async function gk1(J,Q,Z,Y={}){let{timeoutMs:X=MZ6,signal:G,source:V}=Y;try{let K=await Z.getCommand(J,V);if(!K)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J,V))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(x.debug("Executing command",{commandName:J,filePath:K.filePath,args:Q}),DZ6(K))return await EM8(K,Q);else if(NZ6(K))return await IM8(K,Q,X,G);else return{success:!1,output:"",error:"Unsupported command type"}}catch(K){return x.error("Failed to execute command",{commandName:J,error:K}),{success:!1,output:"",error:K instanceof Error?K.message:"Unknown error occurred"}}}async function EM8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await wM8.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>Xz?Z.slice(0,Xz)+`
4600
4600
  ... (output truncated at ${Xz} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function IM8(J,Q,Z=MZ6,Y){return new Promise((X)=>{let[G,V]=PM8(J,Q);x.debug("Spawning command",{spawnCommand:G,spawnArgs:V.slice(0,10),filePath:J.filePath,timeoutMs:Z});let K=oP0(Y),q=!1,W=setTimeout(()=>{q=!0,K.abort(),x.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),H=OM8(G,V,{stdio:["pipe","pipe","pipe"],signal:K.signal,detached:!0}),z=[],U=[],D=0;H.stdout?.on("data",(M)=>{let L=M.toString();if(D+=L.length,D<=Xz)z.push(L);else{let A=Xz-(D-L.length);if(A>0)z.push(L.slice(0,A))}}),H.stderr?.on("data",(M)=>{let L=M.toString();if(D+=L.length,D<=Xz)U.push(L);else{let A=Xz-(D-L.length);if(A>0)U.push(L.slice(0,A))}}),H.on("close",(M)=>{if(clearTimeout(W),q){X({success:!1,output:z.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(K.signal.aborted){X({success:!1,output:z.join(""),error:"The command was aborted",exitCode:M??void 0});return}let L=M===0||M===1,A=z.join(""),E=U.join(""),I=A;if(!L&&!A.trim()&&E.trim())I=E;else if(E.trim())I+=A?`
4601
4601
  ${E}`:E;if(D>Xz)I+=`
4602
- ... (output truncated at ${Xz} characters)`;X({success:L,output:I.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(q)L=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";X({success:!1,output:z.join(""),error:L})})})}function PM8(J,Q){let{filePath:Z,interpreter:Y,extension:X}=J;if(process.platform==="win32")return RM8(Z,Y?[...Y]:null,X,Q);else return TM8(Z,Y?[...Y]:null,X,Q)}function TM8(J,Q,Z,Y){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Y]];else return[J,Y]}function RM8(J,Q,Z,Y){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Y]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...Y]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...Y]];case".exe":return[J,Y];default:return[J,Y]}}U0();LG();y7();yW();NY();gG();aW();mK();y8();A7();d_();o0();var vZ6=W6(LP(),1);import{writeFile as kZ6}from"fs/promises";import yZ6 from"path";U0();NY();class mk1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1764808732-gb9c377"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await ao(Q,this.configService)}catch(Q){x.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class xm extends c0{props;constructor(J){super();this.props=J}createState(){return new LZ6}}class LZ6 extends p0{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Z)=>{this.setState(()=>{this._state=Z(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class AZ6 extends p0{controller=new P$;focusNode=new w8({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=Y6.of(J),{colors:Z,app:Y}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=A4.all(new q4(Z.foreground,1,"solid")),q=new bA({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(D)=>{let M=D.trim();if(X&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Z.foreground,border:null},maxLines:1}),W=new R6({children:[new l0({decoration:{color:D1.default()},child:new y1({text:new i(">",new J1({color:Z.foreground}))})}),new a6({child:q})]}),H=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,[new i("Command: ",new J1({color:Z.foreground})),new i(this.widget.props.commandName,new J1({color:D1.yellow,bold:!0}))])})}),z=[];if(V)z.push(new i("Enter",new J1({color:Y.keybind}))),z.push(new i(" to submit, ",new J1({color:Z.foreground,dim:!0})));z.push(new i("Esc",new J1({color:Y.keybind}))),z.push(new i(" to cancel",new J1({color:Z.foreground,dim:!0})));let U=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,z)})});return new l0({decoration:{border:K,color:D1.default()},padding:B0.all(1),child:new b0({children:[H,new X0({height:1}),W,new t9,U]})})}}class M91 extends c0{props;constructor(J){super();this.props=J}createState(){return new AZ6}}aW();class OZ6 extends p0{controller=new P$;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new w8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=iF)return!1;let Q=ZC(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=Y6.of(J),{colors:Z,app:Y}=Q,G=f4.of(J).size.height,V=Math.max(Math.floor(G*0.5),10),K=new sA({controller:this.controller,triggers:[new pB],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(D)=>{this.widget.props.onSubmit(D.trim(),this.imageAttachments)},theme:Z,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:o8.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),q=new D8({focusNode:this.focusNode,child:K}),W=new l0({constraints:new A6({maxHeight:V}),padding:B0.symmetric(1,0),child:q}),H=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,[new i("Command: ",new J1({color:Z.foreground})),new i(this.widget.props.commandName,new J1({color:D1.yellow,bold:!0}))])})}),z=new l0({padding:B0.symmetric(1,0),child:new y1({text:this.isConfirmingClearInput?new i("",void 0,[new i("Esc",new J1({color:Y.keybind})),new i(" again to clear input",new J1({color:Z.foreground,dim:!0}))]):new i("",void 0,[new i("Press ",new J1({color:Z.foreground,dim:!0})),new i("Enter",new J1({color:Y.keybind})),new i(" to submit, ",new J1({color:Z.foreground,dim:!0})),new i("Esc",new J1({color:Y.keybind})),new i(" to clear",new J1({color:Z.foreground,dim:!0}))])})}),U=[H,new X0({height:1}),new a6({child:W}),new X0({height:1}),z];return new l0({decoration:{border:A4.all(new q4(Z.foreground,1,"solid")),color:D1.default()},padding:B0.all(1),child:new b0({children:U})})}}class AC extends c0{props;constructor(J){super();this.props=J}createState(){return new OZ6}}import{isDeepStrictEqual as _M8}from"node:util";var CM8=/[\\/_ +.#"@[({&]/,jM8=/[\\/_ +.#"@[({&]/g,SM8=/[\s-]/,wZ6=/[\s-]/g;function A91(J,Q,Z,Y,X,G,V){if(G===Q.length){if(X===J.length)return 1;return 0.99}let K=`${X},${G}`;if(V[K]!==void 0)return V[K];let q=Y.charAt(G),W=Z.indexOf(q,X),H=0,z,U,D,M;while(W>=0){if(z=A91(J,Q,Z,Y,W+1,G+1,V),z>H){if(W===X)z*=1;else if(SM8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(X,W-1).match(wZ6),M&&X>0)z*=Math.pow(0.999,M.length)}else if(CM8.test(J.charAt(W-1))){if(z*=0.8,D=J.slice(X,W-1).match(jM8),D&&X>0)z*=Math.pow(0.999,D.length)}else if(z*=0.3,X>0)z*=Math.pow(0.999,W-X);if(J.charAt(W)!==Q.charAt(G))z*=0.9999}if(z<0.1&&(Z.charAt(W-1)===Y.charAt(G+1)||Y.charAt(G+1)===Y.charAt(G)&&Z.charAt(W-1)!==Y.charAt(G))){if(U=A91(J,Q,Z,Y,W+1,G+2,V),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Z.indexOf(q,W+1)}return V[K]=H,H}function L91(J){return J.toLowerCase().replace(wZ6," ")}function EZ6(J,Q){let Z=A91(J,Q,L91(J),L91(Q),0,0,{}),Y=Q.trim().split(/\s+/);if(Y.length>1){let X=0,G=0;for(let K of Y){let q=A91(J,K,L91(J),L91(K),0,0,{});if(q===0)return Z;X+=q,G+=K.length}let V=X/Y.length*0.95;return Math.max(Z,V)}return Z}class OC{}class wC{}class O91{}class w91{}class IZ6 extends c0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new PZ6}}class PZ6 extends p0{build(J){return this.widget.onContext(J),this.widget.child}}function kM8(J,Q){if(J==="")return{matches:!0,score:1};let Z=EZ6(Q,J);return{matches:Z>0.15,score:Z}}class bZ extends c0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new TZ6}}class TZ6 extends p0{controller=new P$;focusNode;scrollController=new U7;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new w8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),m8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!_M8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof OC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof wC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof O91){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Z=Q[this.selectedIndex];if(Z){if(!(this.widget.props.isItemDisabled?.(Z)??!1))this.widget.props.onAccept(Z)}}return"handled"}if(J instanceof w91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Z)=>!this.widget.props.filterItem||this.widget.props.filterItem(Z,J)).map((Z)=>({item:Z,...kM8(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,Y)=>this.widget.props.sortItems(Z,Y,J):(Z,Y)=>Y.score-Z.score).map((Z)=>Z.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Z=0,Y=Q.size.height;D81(J,{top:Z,bottom:Y},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),m8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Z=this.getFilteredItems();if(J>=0&&J<Z.length){let Y=Z[J],X=Y?this.widget.props.isItemDisabled?.(Y)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Z[this.selectedIndex]??null);else if(Q===2&&!X){if(Y)this.widget.props.onAccept(Y)}}};build(J){let Q=Y6.of(J),{colors:Z}=Q,Y=this.getFilteredItems(),X=A4.all(new q4(Z.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new bA({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Z.foreground,border:null},maxLines:1}),K=new DV({shortcuts:new Map([[new K4("ArrowDown"),new OC],[new K4("ArrowUp"),new wC],[new K4("Tab"),new OC],[new K4("Tab",{shift:!0}),new wC],[new K4("n",{ctrl:!0}),new OC],[new K4("p",{ctrl:!0}),new wC],[new K4("Enter"),new O91],[new K4("Escape"),new w91]]),focusNode:this.focusNode,child:V}),q=new mQ({actions:new Map([[OC,new T8(this.invoke)],[wC,new T8(this.invoke)],[O91,new T8(this.invoke)],[w91,new T8(this.invoke)]]),child:K}),W=new R6({children:[new l0({decoration:{color:D1.default()},child:new y1({text:new i(">",new J1({color:Z.foreground}))})}),new a6({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new X0({height:10,child:new j4({child:new y1({text:new i(L,new J1({color:Z.foreground}))})})})}else if(Y.length===0&&this.widget.props.emptyStateText)H=new a6({child:new j4({child:new y1({text:new i(this.widget.props.emptyStateText,new J1({color:Z.foreground,dim:!0}))})})});else{let L=Y.map((A,E)=>{let I=E===this.selectedIndex,P=this.widget.props.isItemDisabled?.(A)??!1,C;if(this.widget.props.renderItem)C=this.widget.props.renderItem(A,I,P,J);else{let k=I?D1.yellow:void 0,y=I?D1.black:Z.foreground;C=new l0({decoration:k?{color:k}:void 0,padding:B0.symmetric(2,0),child:new y1({text:new i(this.widget.props.getLabel(A),new J1({color:y,dim:P}))})})}return new IZ6(new G8({onClick:(k)=>this.handleItemClick(E,k.clickCount),child:C}),(k)=>{this.itemContexts[E]=k})});H=new b0({children:L,crossAxisAlignment:"start"})}let z=new a6({child:new G8({onScroll:this.handleScroll,opaque:!1,child:new S5({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i(this.widget.props.title,new J1({color:D1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new X0({height:1}),z),this.controller.text!==""){let L=Y.length>0?Y[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new l0({padding:B0.vertical(1),child:new j4({child:A})}));else U.push(new X0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new l0({decoration:{border:X,color:D1.default()},padding:B0.symmetric(1,0),child:new b0({children:U})})}}class uk1 extends c0{createState(){return new RZ6}}class RZ6 extends p0{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new y1({text:new i("●",new J1({color:this.isGreen?D1.green:D1.index(8),bold:!0})),maxLines:1})}}function yM8(J){let Q=new Map,Z=new Map,Y=new Map,X=[];for(let V of J)Q.set(V.id,V);for(let V of J){let K=V.parentRelationships.find((q)=>q.role==="child"&&Q.has(q.threadID));if(K){Y.set(V.id,K.type);let q=K.threadID,W=Z.get(q)||[];W.push(V),Z.set(q,W)}else X.push(V)}return lY.flatten(X,(V)=>Z.get(V.id)).map((V)=>({...V.item,depth:V.depth,isLast:V.isLast,ancestorsAreLast:V.ancestorsAreLast,relationshipType:Y.get(V.item.id)}))}function pk1(J,Q,Z){return new y1({text:new i(`${J}${Q}`,new J1({color:Z})),maxLines:1})}function xM8(J,Q,Z,Y){return[pk1("+",J,Y.success),t9.horizontal(1),pk1("~",Q,Y.warning),t9.horizontal(1),pk1("-",Z,Y.destructive)]}class E91 extends E6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Z=this.props.recentThreadIDs||[],Y=this.props.currentThreadID,X=[...Q].sort((H,z)=>{if(Y){if(H.id===Y)return-1;if(z.id===Y)return 1}let U=Z.indexOf(H.id),D=Z.indexOf(z.id);if(U!==-1&&D!==-1)return U-D;if(U!==-1)return-1;if(D!==-1)return 1;return 0}),G=yM8(X),V=Math.max(0,...G.map((H)=>H.description.timeAgo.length)),K=Y6.of(J),q=new V6({padding:B0.symmetric(0,1),child:new j4({child:new y1({text:new i("",new J1({color:K.colors.foreground,dim:!0}),[new i("Ctrl+T",new J1({color:D1.blue,dim:!0})),new i(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new J1({color:K.colors.foreground,dim:!0}))])})})});return new bZ({items:G,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:q,renderItem:(H,z,U,D)=>{let M=Y6.of(D),{colors:L}=M,A=z?D1.yellow:void 0,E=z?D1.black:L.foreground,I=D1.index(8),P=($1,t)=>new X0({width:t,child:R6.end([new y1({text:new i($1,new J1({color:I}))})])}),C=this.props.threadViewStates[H.id],k=[],y=H.relationshipType==="handoff",v=new I81;if(H.depth>0){let $1=[],t=H.ancestorsAreLast.slice(1);for(let F1 of t)$1.push(new i(v.getAncestorPrefix(F1),new J1({color:v.connectorColor,dim:v.connectorDim})));let p=H.isLast?v.elbow:v.tee,e=v.getConnectorText(p);$1.push(new i(e,new J1({color:v.connectorColor,dim:v.connectorDim}))),k.push(new y1({text:new i("",void 0,$1)}))}let b=[],d=this.props.currentThreadID===H.id?new i("(current) ",new J1({color:D1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new i("(visited) ",new J1({color:L.foreground,dim:!0})):null;if(d)b.push(new y1({text:d}));if(C){if(C.state==="active"&&(C.interactionState==="tool-running"||C.interactionState===!1))b.push(new uk1),b.push(new X0({width:1}))}let m=H.title;if(H.relationshipType==="fork"){let $1=m.match(/^Forked\((\d+)\): /);if($1)m=m.slice($1[0].length);else while(m.startsWith("Forked: "))m=m.slice(8);b.push(new y1({text:new i("[fork] ",new J1({color:D1.blue}))}))}else if(y)b.push(new y1({text:new i("[handoff] ",new J1({color:D1.index(208)}))}));if(b.push(new a6({child:new y1({text:new i(m,new J1({color:E})),overflow:"ellipsis",maxLines:1})})),b.push(new X0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let $1=z?{success:I,warning:I,destructive:I}:L;b.push(...xM8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,$1)),b.push(new X0({width:2}))}return b.push(P(H.description.timeAgo,V)),new l0({decoration:A?{color:A}:void 0,padding:B0.symmetric(2,0),child:new R6({children:[...k,...b]})})}})}}function CZ6(J){let Z=new Date().getTime()-J.getTime(),Y=Math.floor(Z/60000),X=Math.floor(Z/3600000),G=Math.floor(Z/86400000);if(Y<1)return"just now";if(Y<60)return`${Y}m ago`;if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;return J.toLocaleDateString()}class dk1 extends E6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((X,G)=>G.pubDate.getTime()-X.pubDate.getTime()),Z=Math.max(0,...Q.map((X)=>CZ6(X.pubDate).length));return new bZ({items:Q,getLabel:(X)=>X.title,onAccept:(X)=>this.props.onSelect?.(X),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(X,G,V,K)=>{let q=Y6.of(K),{colors:W}=q,H=G?D1.yellow:void 0,z=G?D1.black:W.foreground,U=D1.index(8),D=X.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new X0({width:A,child:R6.end([new y1({text:new i(L,new J1({color:U}))})])});return new l0({decoration:H?{color:H}:void 0,padding:B0.symmetric(2,0),child:new R6({children:[new a6({child:new y1({text:new i(X.title,new J1({color:z})),overflow:"ellipsis",maxLines:1})}),new X0({width:2}),new y1({text:new i(D,new J1({color:U})),maxLines:1}),new X0({width:2}),M(CZ6(X.pubDate),Z)]})})}})}}class ck1 extends E6{props;constructor(J){super();this.props=J}build(){return new j4({child:new y1({text:new i("",void 0,[new i(`Forked to new thread:
4602
+ ... (output truncated at ${Xz} characters)`;X({success:L,output:I.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(q)L=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";X({success:!1,output:z.join(""),error:L})})})}function PM8(J,Q){let{filePath:Z,interpreter:Y,extension:X}=J;if(process.platform==="win32")return RM8(Z,Y?[...Y]:null,X,Q);else return TM8(Z,Y?[...Y]:null,X,Q)}function TM8(J,Q,Z,Y){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Y]];else return[J,Y]}function RM8(J,Q,Z,Y){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...Y]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...Y]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...Y]];case".exe":return[J,Y];default:return[J,Y]}}U0();LG();y7();yW();NY();gG();aW();mK();y8();A7();d_();o0();var vZ6=W6(LP(),1);import{writeFile as kZ6}from"fs/promises";import yZ6 from"path";U0();NY();class mk1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1764811816-g233bde"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await ao(Q,this.configService)}catch(Q){x.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class xm extends c0{props;constructor(J){super();this.props=J}createState(){return new LZ6}}class LZ6 extends p0{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Z)=>{this.setState(()=>{this._state=Z(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class AZ6 extends p0{controller=new P$;focusNode=new w8({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=Y6.of(J),{colors:Z,app:Y}=Q,X=this.widget.props.isRequiredArg??!0,G=this.controller.text.trim().length>0,V=!X||G,K=A4.all(new q4(Z.foreground,1,"solid")),q=new bA({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(D)=>{let M=D.trim();if(X&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Z.foreground,border:null},maxLines:1}),W=new R6({children:[new l0({decoration:{color:D1.default()},child:new y1({text:new i(">",new J1({color:Z.foreground}))})}),new a6({child:q})]}),H=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,[new i("Command: ",new J1({color:Z.foreground})),new i(this.widget.props.commandName,new J1({color:D1.yellow,bold:!0}))])})}),z=[];if(V)z.push(new i("Enter",new J1({color:Y.keybind}))),z.push(new i(" to submit, ",new J1({color:Z.foreground,dim:!0})));z.push(new i("Esc",new J1({color:Y.keybind}))),z.push(new i(" to cancel",new J1({color:Z.foreground,dim:!0})));let U=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,z)})});return new l0({decoration:{border:K,color:D1.default()},padding:B0.all(1),child:new b0({children:[H,new X0({height:1}),W,new t9,U]})})}}class M91 extends c0{props;constructor(J){super();this.props=J}createState(){return new AZ6}}aW();class OZ6 extends p0{controller=new P$;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new w8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=iF)return!1;let Q=ZC(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=Y6.of(J),{colors:Z,app:Y}=Q,G=f4.of(J).size.height,V=Math.max(Math.floor(G*0.5),10),K=new sA({controller:this.controller,triggers:[new pB],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(D)=>{this.widget.props.onSubmit(D.trim(),this.imageAttachments)},theme:Z,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:o8.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),q=new D8({focusNode:this.focusNode,child:K}),W=new l0({constraints:new A6({maxHeight:V}),padding:B0.symmetric(1,0),child:q}),H=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i("",void 0,[new i("Command: ",new J1({color:Z.foreground})),new i(this.widget.props.commandName,new J1({color:D1.yellow,bold:!0}))])})}),z=new l0({padding:B0.symmetric(1,0),child:new y1({text:this.isConfirmingClearInput?new i("",void 0,[new i("Esc",new J1({color:Y.keybind})),new i(" again to clear input",new J1({color:Z.foreground,dim:!0}))]):new i("",void 0,[new i("Press ",new J1({color:Z.foreground,dim:!0})),new i("Enter",new J1({color:Y.keybind})),new i(" to submit, ",new J1({color:Z.foreground,dim:!0})),new i("Esc",new J1({color:Y.keybind})),new i(" to clear",new J1({color:Z.foreground,dim:!0}))])})}),U=[H,new X0({height:1}),new a6({child:W}),new X0({height:1}),z];return new l0({decoration:{border:A4.all(new q4(Z.foreground,1,"solid")),color:D1.default()},padding:B0.all(1),child:new b0({children:U})})}}class AC extends c0{props;constructor(J){super();this.props=J}createState(){return new OZ6}}import{isDeepStrictEqual as _M8}from"node:util";var CM8=/[\\/_ +.#"@[({&]/,jM8=/[\\/_ +.#"@[({&]/g,SM8=/[\s-]/,wZ6=/[\s-]/g;function A91(J,Q,Z,Y,X,G,V){if(G===Q.length){if(X===J.length)return 1;return 0.99}let K=`${X},${G}`;if(V[K]!==void 0)return V[K];let q=Y.charAt(G),W=Z.indexOf(q,X),H=0,z,U,D,M;while(W>=0){if(z=A91(J,Q,Z,Y,W+1,G+1,V),z>H){if(W===X)z*=1;else if(SM8.test(J.charAt(W-1))){if(z*=0.9,M=J.slice(X,W-1).match(wZ6),M&&X>0)z*=Math.pow(0.999,M.length)}else if(CM8.test(J.charAt(W-1))){if(z*=0.8,D=J.slice(X,W-1).match(jM8),D&&X>0)z*=Math.pow(0.999,D.length)}else if(z*=0.3,X>0)z*=Math.pow(0.999,W-X);if(J.charAt(W)!==Q.charAt(G))z*=0.9999}if(z<0.1&&(Z.charAt(W-1)===Y.charAt(G+1)||Y.charAt(G+1)===Y.charAt(G)&&Z.charAt(W-1)!==Y.charAt(G))){if(U=A91(J,Q,Z,Y,W+1,G+2,V),U*0.1>z)z=U*0.1}if(z>H)H=z;W=Z.indexOf(q,W+1)}return V[K]=H,H}function L91(J){return J.toLowerCase().replace(wZ6," ")}function EZ6(J,Q){let Z=A91(J,Q,L91(J),L91(Q),0,0,{}),Y=Q.trim().split(/\s+/);if(Y.length>1){let X=0,G=0;for(let K of Y){let q=A91(J,K,L91(J),L91(K),0,0,{});if(q===0)return Z;X+=q,G+=K.length}let V=X/Y.length*0.95;return Math.max(Z,V)}return Z}class OC{}class wC{}class O91{}class w91{}class IZ6 extends c0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new PZ6}}class PZ6 extends p0{build(J){return this.widget.onContext(J),this.widget.child}}function kM8(J,Q){if(J==="")return{matches:!0,score:1};let Z=EZ6(Q,J);return{matches:Z>0.15,score:Z}}class bZ extends c0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new TZ6}}class TZ6 extends p0{controller=new P$;focusNode;scrollController=new U7;selectedIndex=0;itemContexts=[];initState(){this.scrollController.disableFollowMode(),this.focusNode=new w8({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),m8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),this.ensureSelectedItemVisible()}didUpdateWidget(J){if(!_M8(J.props.items,this.widget.props.items)){this.ensureSelectedItemVisible();let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)}}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof OC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof wC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),this.ensureSelectedItemVisible(),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof O91){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Z=Q[this.selectedIndex];if(Z){if(!(this.widget.props.isItemDisabled?.(Z)??!1))this.widget.props.onAccept(Z)}}return"handled"}if(J instanceof w91)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text,Q=this.widget.props.items.filter((Z)=>!this.widget.props.filterItem||this.widget.props.filterItem(Z,J)).map((Z)=>({item:Z,...kM8(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,Y)=>this.widget.props.sortItems(Z,Y,J):(Z,Y)=>Y.score-Z.score).map((Z)=>Z.item);if(this.widget.props.maxRenderItems)return Q.slice(0,this.widget.props.maxRenderItems);return Q}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Z=0,Y=Q.size.height;D81(J,{top:Z,bottom:Y},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),m8.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Z=this.getFilteredItems();if(J>=0&&J<Z.length){let Y=Z[J],X=Y?this.widget.props.isItemDisabled?.(Y)??!1:!1;if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Z[this.selectedIndex]??null);else if(Q===2&&!X){if(Y)this.widget.props.onAccept(Y)}}};build(J){let Q=Y6.of(J),{colors:Z}=Q,Y=this.getFilteredItems(),X=A4.all(new q4(Z.foreground,1,"solid")),G=this.widget.props.enabled??!0,V=new bA({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:G,style:{textColor:Z.foreground,border:null},maxLines:1}),K=new DV({shortcuts:new Map([[new K4("ArrowDown"),new OC],[new K4("ArrowUp"),new wC],[new K4("Tab"),new OC],[new K4("Tab",{shift:!0}),new wC],[new K4("n",{ctrl:!0}),new OC],[new K4("p",{ctrl:!0}),new wC],[new K4("Enter"),new O91],[new K4("Escape"),new w91]]),focusNode:this.focusNode,child:V}),q=new mQ({actions:new Map([[OC,new T8(this.invoke)],[wC,new T8(this.invoke)],[O91,new T8(this.invoke)],[w91,new T8(this.invoke)]]),child:K}),W=new R6({children:[new l0({decoration:{color:D1.default()},child:new y1({text:new i(">",new J1({color:Z.foreground}))})}),new a6({child:q})]});this.itemContexts=[];let H;if(this.widget.props.isLoading){let L=this.widget.props.loadingText??"Loading...";H=new X0({height:10,child:new j4({child:new y1({text:new i(L,new J1({color:Z.foreground}))})})})}else if(Y.length===0&&this.widget.props.emptyStateText)H=new a6({child:new j4({child:new y1({text:new i(this.widget.props.emptyStateText,new J1({color:Z.foreground,dim:!0}))})})});else{let L=Y.map((A,E)=>{let I=E===this.selectedIndex,P=this.widget.props.isItemDisabled?.(A)??!1,C;if(this.widget.props.renderItem)C=this.widget.props.renderItem(A,I,P,J);else{let k=I?D1.yellow:void 0,y=I?D1.black:Z.foreground;C=new l0({decoration:k?{color:k}:void 0,padding:B0.symmetric(2,0),child:new y1({text:new i(this.widget.props.getLabel(A),new J1({color:y,dim:P}))})})}return new IZ6(new G8({onClick:(k)=>this.handleItemClick(E,k.clickCount),child:C}),(k)=>{this.itemContexts[E]=k})});H=new b0({children:L,crossAxisAlignment:"start"})}let z=new a6({child:new G8({onScroll:this.handleScroll,opaque:!1,child:new S5({controller:this.scrollController,autofocus:!1,child:H})})}),U=[];if(this.widget.props.title){let L=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i(this.widget.props.title,new J1({color:D1.yellow,bold:!0}))})});U.push(L)}if(U.push(W,new X0({height:1}),z),this.controller.text!==""){let L=Y.length>0?Y[this.selectedIndex]:void 0,A=L&&this.widget.props.buildDisabledReasonWidget?.(L);if(A)U.push(new l0({padding:B0.vertical(1),child:new j4({child:A})}));else U.push(new X0({height:3}))}if(this.widget.props.footer)U.push(this.widget.props.footer);return new l0({decoration:{border:X,color:D1.default()},padding:B0.symmetric(1,0),child:new b0({children:U})})}}class uk1 extends c0{createState(){return new RZ6}}class RZ6 extends p0{isGreen=!0;timer;initState(){this.timer=setInterval(()=>{this.isGreen=!this.isGreen,this.setState()},700)}dispose(){if(this.timer)clearInterval(this.timer);super.dispose()}build(J){return new y1({text:new i("●",new J1({color:this.isGreen?D1.green:D1.index(8),bold:!0})),maxLines:1})}}function yM8(J){let Q=new Map,Z=new Map,Y=new Map,X=[];for(let V of J)Q.set(V.id,V);for(let V of J){let K=V.parentRelationships.find((q)=>q.role==="child"&&Q.has(q.threadID));if(K){Y.set(V.id,K.type);let q=K.threadID,W=Z.get(q)||[];W.push(V),Z.set(q,W)}else X.push(V)}return lY.flatten(X,(V)=>Z.get(V.id)).map((V)=>({...V.item,depth:V.depth,isLast:V.isLast,ancestorsAreLast:V.ancestorsAreLast,relationshipType:Y.get(V.item.id)}))}function pk1(J,Q,Z){return new y1({text:new i(`${J}${Q}`,new J1({color:Z})),maxLines:1})}function xM8(J,Q,Z,Y){return[pk1("+",J,Y.success),t9.horizontal(1),pk1("~",Q,Y.warning),t9.horizontal(1),pk1("-",Z,Y.destructive)]}class E91 extends E6{props;debugLabel="ThreadContinuationPicker";constructor(J){super();this.props=J}build(J){let Q=this.props.filterByWorkspace&&this.props.currentWorkspaceURI?this.props.threads.filter((H)=>H.workspaceURI===this.props.currentWorkspaceURI):this.props.threads;if(this.props.excludeCurrentThread&&this.props.currentThreadID)Q=Q.filter((H)=>H.id!==this.props.currentThreadID);let Z=this.props.recentThreadIDs||[],Y=this.props.currentThreadID,X=[...Q].sort((H,z)=>{if(Y){if(H.id===Y)return-1;if(z.id===Y)return 1}let U=Z.indexOf(H.id),D=Z.indexOf(z.id);if(U!==-1&&D!==-1)return U-D;if(U!==-1)return-1;if(D!==-1)return 1;return 0}),G=yM8(X),V=Math.max(0,...G.map((H)=>H.description.timeAgo.length)),K=Y6.of(J),q=new V6({padding:B0.symmetric(0,1),child:new j4({child:new y1({text:new i("",new J1({color:K.colors.foreground,dim:!0}),[new i("Ctrl+T",new J1({color:D1.blue,dim:!0})),new i(this.props.filterByWorkspace?" for all workspaces":" to filter by workspace",new J1({color:K.colors.foreground,dim:!0}))])})})});return new bZ({items:G,getLabel:(H)=>H.title,onAccept:(H)=>this.props.onSelect?.(H.id),onDismiss:this.props.onDismiss,onSelectionChange:(H)=>{if(this.props.previewController){if(H)this.props.previewController.select(H.id)}},title:this.props.title,isLoading:this.props.isLoading,loadingText:"Loading threads...",emptyStateText:"No threads match your filter",maxRenderItems:1000,footer:this.props.isLoading?void 0:q,renderItem:(H,z,U,D)=>{let M=Y6.of(D),{colors:L}=M,A=z?D1.yellow:void 0,E=z?D1.black:L.foreground,I=D1.index(8),P=($1,t)=>new X0({width:t,child:R6.end([new y1({text:new i($1,new J1({color:I}))})])}),C=this.props.threadViewStates[H.id],k=[],y=H.relationshipType==="handoff",v=new I81;if(H.depth>0){let $1=[],t=H.ancestorsAreLast.slice(1);for(let F1 of t)$1.push(new i(v.getAncestorPrefix(F1),new J1({color:v.connectorColor,dim:v.connectorDim})));let p=H.isLast?v.elbow:v.tee,e=v.getConnectorText(p);$1.push(new i(e,new J1({color:v.connectorColor,dim:v.connectorDim}))),k.push(new y1({text:new i("",void 0,$1)}))}let b=[],d=this.props.currentThreadID===H.id?new i("(current) ",new J1({color:D1.green})):(this.props.recentThreadIDs||[]).includes(H.id)?new i("(visited) ",new J1({color:L.foreground,dim:!0})):null;if(d)b.push(new y1({text:d}));if(C){if(C.state==="active"&&(C.interactionState==="tool-running"||C.interactionState===!1))b.push(new uk1),b.push(new X0({width:1}))}let m=H.title;if(H.relationshipType==="fork"){let $1=m.match(/^Forked\((\d+)\): /);if($1)m=m.slice($1[0].length);else while(m.startsWith("Forked: "))m=m.slice(8);b.push(new y1({text:new i("[fork] ",new J1({color:D1.blue}))}))}else if(y)b.push(new y1({text:new i("[handoff] ",new J1({color:D1.index(208)}))}));if(b.push(new a6({child:new y1({text:new i(m,new J1({color:E})),overflow:"ellipsis",maxLines:1})})),b.push(new X0({width:2})),H.diffStats&&(H.diffStats.added>0||H.diffStats.changed>0||H.diffStats.deleted>0)){let $1=z?{success:I,warning:I,destructive:I}:L;b.push(...xM8(H.diffStats.added,H.diffStats.changed,H.diffStats.deleted,$1)),b.push(new X0({width:2}))}return b.push(P(H.description.timeAgo,V)),new l0({decoration:A?{color:A}:void 0,padding:B0.symmetric(2,0),child:new R6({children:[...k,...b]})})}})}}function CZ6(J){let Z=new Date().getTime()-J.getTime(),Y=Math.floor(Z/60000),X=Math.floor(Z/3600000),G=Math.floor(Z/86400000);if(Y<1)return"just now";if(Y<60)return`${Y}m ago`;if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;return J.toLocaleDateString()}class dk1 extends E6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((X,G)=>G.pubDate.getTime()-X.pubDate.getTime()),Z=Math.max(0,...Q.map((X)=>CZ6(X.pubDate).length));return new bZ({items:Q,getLabel:(X)=>X.title,onAccept:(X)=>this.props.onSelect?.(X),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(X,G,V,K)=>{let q=Y6.of(K),{colors:W}=q,H=G?D1.yellow:void 0,z=G?D1.black:W.foreground,U=D1.index(8),D=X.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new X0({width:A,child:R6.end([new y1({text:new i(L,new J1({color:U}))})])});return new l0({decoration:H?{color:H}:void 0,padding:B0.symmetric(2,0),child:new R6({children:[new a6({child:new y1({text:new i(X.title,new J1({color:z})),overflow:"ellipsis",maxLines:1})}),new X0({width:2}),new y1({text:new i(D,new J1({color:U})),maxLines:1}),new X0({width:2}),M(CZ6(X.pubDate),Z)]})})}})}}class ck1 extends E6{props;constructor(J){super();this.props=J}build(){return new j4({child:new y1({text:new i("",void 0,[new i(`Forked to new thread:
4603
4603
 
4604
4604
  `,new J1({color:D1.white,dim:!0})),new i(`"${this.props.newThreadTitle||"Untitled"}"`,new J1({color:D1.white}))]),textAlign:"center"})})}}U0();class jZ6 extends p0{labels=[];isLoading=!0;currentQuery="";initState(){this.loadLabels()}async loadLabels(){try{let J=await this.widget.props.internalAPIClient.getUserLabels({query:""},{config:this.widget.props.configService});if(!J.ok){x.error("Failed to load labels",J.error),this.isLoading=!1,this.labels=[],this.setState();return}this.labels=J.result,this.isLoading=!1,this.setState()}catch(J){x.error("Failed to load labels",J),this.isLoading=!1,this.labels=[],this.setState()}}getValidationError(J){if(J.length===0)return null;if(J.length>32)return"Label name cannot exceed 32 characters";if(!/^[a-z0-9][a-z0-9-]*$/.test(J))return"Label must be lowercase alphanumeric with hyphens, starting with a letter or number";return null}isValidLabelName(J){return this.getValidationError(J)===null}buildItemsWithCreateOption(){let J=this.widget.props.currentLabels||[],Z=[...this.labels.filter((Y)=>!J.includes(Y.name))];if(this.currentQuery.trim().length>0&&!this.isLoading){let Y=this.currentQuery.trim().toLowerCase(),X=this.labels.some((V)=>V.name===Y),G=J.includes(Y);if(!X&&!G&&this.isValidLabelName(Y))Z.unshift({id:"__create__",name:Y,createdAt:"",__isCreateMarker:!0})}return Z}build(J){let Q=Y6.of(J),{colors:Z}=Q,Y=this.currentQuery.trim().toLowerCase(),X=Y.length>0?this.getValidationError(Y):null;return new bZ({title:"Add Label",items:this.buildItemsWithCreateOption(),getLabel:(G)=>G.name,onAccept:(G)=>{this.widget.props.onSelect(G.name)},onDismiss:this.widget.props.onDismiss,isLoading:this.isLoading,loadingText:"Loading labels...",emptyStateText:X||"Type to create a new label",renderItem:(G,V,K,q)=>{let W=V?D1.yellow:void 0,H=V?D1.black:Z.foreground;if("__isCreateMarker"in G&&G.__isCreateMarker)return new l0({decoration:W?{color:W}:void 0,padding:B0.symmetric(2,0),child:new y1({text:new i("",void 0,[new i("Create: ",new J1({color:H})),new i(G.name,new J1({color:H,bold:!0}))])})});return new l0({decoration:W?{color:W}:void 0,padding:B0.symmetric(2,0),child:new y1({text:new i(G.name,new J1({color:H}))})})},filterItem:(G,V)=>{let K=this.currentQuery;if(this.currentQuery=V,K!==V)this.setState();if("__isCreateMarker"in G&&G.__isCreateMarker)return!0;let W=V.trim().toLowerCase();return W.length===0||G.name.includes(W)}})}}class lk1 extends c0{props;constructor(J){super();this.props=J}createState(){return new jZ6}}class vq extends c0{props;constructor(J){super();this.props=J}createState(){return new SZ6}}class SZ6 extends p0{_spinner=new T$;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(J){let Q=Y6.of(J),{colors:Z}=Q,Y=A4.all(new q4(Z.foreground,1,"solid")),X=this._spinner.toBraille(),G=new y1({textAlign:"center",text:new i("",void 0,[new i(X,new J1({color:D1.yellow})),new i(" ",void 0),new i(this.widget.props.message,new J1({color:Z.foreground}))])}),K=[new a6({child:new b0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[G]})})];if(this.widget.props.onAbort)K.push(new X0({height:2,child:new l0({padding:B0.symmetric(2,0),child:new y1({text:new i("",new J1({dim:!0}),[new i("Press ",new J1({color:Z.foreground})),new i("Esc",new J1({color:Z.info})),new i(" to cancel",new J1({color:Z.foreground}))])})})}));let q=new l0({decoration:new Z8(D1.default(),Y),child:new X0({width:60,height:7,child:new b0({mainAxisAlignment:"start",children:K})})});if(this.widget.props.onAbort)return new D8({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:q});return q}}class AV extends c0{props;constructor(J){super();this.props=J}createState(){return new _Z6}}class _Z6 extends p0{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof MV}build(J){let Q=this.widget.props.message,Z=(()=>{if(this.isWidgetMessage(Q))return{title:Q.title,type:Q.type};if(Q instanceof Error&&Q.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:Q.message};if(Q instanceof Error&&Q.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:Q.message};let W=A81(Q);return{title:W.title,type:W.type,description:W.description}})(),Y=Z.type==="error"?D1.red:D1.yellow,X=A4.all(new q4(D1.default(),1,"solid")),G=new l0({padding:B0.symmetric(1,0),child:new y1({text:new i(Z.title,new J1({color:Y,bold:!0}))})}),V=this.isWidgetMessage(Q)?Q.widget:new y1({text:new i(Z.description,new J1({color:D1.default()})),selectable:!0}),K=new a6({child:new vA({child:new l0({padding:B0.symmetric(1,0),child:V})})}),q=new l0({padding:B0.symmetric(1,0),child:new y1({text:this.widget.props.onRetry?new i("",void 0,[new i("Press ",new J1({color:D1.default(),dim:!0})),new i("R",new J1({color:D1.yellow})),new i(" to retry, ",new J1({color:D1.default(),dim:!0})),new i("Esc",new J1({color:D1.yellow})),new i(" to cancel",new J1({color:D1.default(),dim:!0}))]):new i("Press any key to close",new J1({color:D1.default(),dim:!0,italic:!0}))})});return new D8({onKey:(W)=>{if(this.widget.props.onRetry&&W.key==="r")return this.widget.props.onRetry(),"handled";if(W.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!0,child:new l0({decoration:{border:X,color:D1.default()},padding:B0.all(1),child:new b0({mainAxisAlignment:"center",children:[G,new X0({height:1}),K,q]})})})}}class ik1 extends E6{build(){return new j4({child:new y1({text:new i("",void 0,[new i(`✓ Thread Shared
4605
4605
 
@@ -4698,7 +4698,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
4698
4698
  `)?`${K}...`:X,W=new J1({color:D1.index(8)}),H=[new i(q,W)];if(V>0){let z=new J1({color:Z.success});for(let U=1;U<=V;U++)H.push(new i(" ")),H.push(new i(`[${U}]`,z))}return new V6({padding:B0.only({bottom:0}),child:new R6({crossAxisAlignment:"start",children:[new V6({padding:B0.only({right:1}),child:new y1({text:new i("•",new J1({color:D1.index(8)}))})}),new a6({child:new y1({text:new i("",void 0,H)})})]})})}}class Iy1 extends c0{createState(){return new _Y6}}class _Y6 extends p0{_animationTimer;_visible=!0;initState(){super.initState(),this._startAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._visible=!this._visible})},500)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Q=new J1({color:D1.red}),Z=new J1({color:this._visible?D1.red:D1.transparent()});return new R6({children:[new y1({text:new i("⏺",Z)}),new X0({width:1}),new y1({text:new i("Replay",Q)})]})}}class Py1 extends E6{entry;width;constructor({key:J,entry:Q,width:Z}){super({key:J});this.entry=Q,this.width=Z}build(J){let Z=Y6.of(J).colors.mutedForeground,Y=this.entry,X=Y.authors[0]?.name||"Community";if(X.includes("@"))X=X.split("@")[0]??X;let G=" · ",V=50,K=this.truncateToWidth(Y.title,V),q=`${G}${K}`,W=Math.max(1,this.width-q.length-2),H=Y.description.replace(/\s+/g," ").trim(),z=`@${X}: ${H}`,U=this.truncateToWidth(z,W),D=new y1({text:new i(U,new J1({color:Z,dim:!0}))}),M=new y1({text:new i(q,new J1({color:Z,dim:!0}))});return new G8({onClick:()=>eJ(J,Y.link),cursor:"pointer",child:new X0({width:this.width,height:1,child:new V6({padding:B0.horizontal(1),child:new R6({children:[new a6({child:new Km(new X0({width:W,height:1,child:D}))}),M]})})})})}truncateToWidth(J,Q){if(J.length<=Q)return J;return J.slice(0,Q-1)+"…"}}o0();function lL8(J){let Z=new Date().getTime()-J.getTime(),Y=Math.floor(Z/3600000),X=Math.floor(Y/24),G=Math.floor(X/7),V=Math.floor(X/30);if(Y<1)return"Just now";if(Y<24)return`${Y}h ago`;if(X<7)return`${X}d ago`;if(G<=4)return`${G}w ago`;return`${V}mo ago`}class Ty1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{let Q=await new Promise((Z)=>{let Y=this.threadHistoryService.observeThreadList().subscribe((X)=>{Y.unsubscribe(),Z(X)})});return{ok:!0,threads:this.formatThreadSummaries(Q,J)}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}observeThreadSummaries(J=""){return this.threadHistoryService.observeHistory().pipe(Q6((Q)=>this.formatThreadSummaries(Q,J)))}formatThreadSummaries(J,Q){return J.filter((Y)=>{if(!Q.trim())return!0;let X=Y.title?.toLowerCase()||"untitled",G=Y.id.toLowerCase(),V=Q.toLowerCase();return X.includes(V)||G.includes(V)}).map((Y)=>{let X=new Date(Y.userLastInteractedAt),G=lL8(X),V=Y.id.slice(-8),K=Y.env?.initial.trees?.[0]?.uri;return{id:Y.id,title:Y.title||"Untitled",updatedAt:new Date(Y.userLastInteractedAt).toISOString(),description:{timeAgo:G,title:Y.title||"Untitled",shortThreadID:V},diffStats:Y.summaryStats?.diffStats,workspaceURI:K,parentRelationships:Y.parentRelationships}})}}U0();y8();class Ry1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new U7;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){x.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId===J)return;this.cancelTimerAndSubscription(),this.currentId=J;let Q=await this.threadService.get(J);if(Q){if(this.currentId===J)this.current=Q,this.notifyListeners()}this.subscribeTimer=setTimeout(()=>{this.subscribeLive(J)},1000)}clear(){this.cancelTimerAndSubscription(),this.currentId=null,this.current=null,this.notifyListeners()}addListener(J){this.listeners.push(J)}removeListener(J){let Q=this.listeners.indexOf(J);if(Q!==-1)this.listeners.splice(Q,1)}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){x.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(rD()).subscribe((Q)=>{if(this.currentId===J)this.current=Q,this.notifyListeners()})}cancelTimerAndSubscription(){if(this.subscribeTimer)clearTimeout(this.subscribeTimer),this.subscribeTimer=null;if(this.subscription)this.subscription.unsubscribe(),this.subscription=null}notifyListeners(){for(let J of this.listeners)J(this.current)}}function kY6(J,Q){switch(J){case"update-available":return[new i("A newer Amp is available. Run ",new J1({color:Q.foreground,dim:!0})),new i("amp update",new J1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new i("Update complete, run ",new J1({color:Q.foreground,dim:!0})),new i("amp update",new J1({color:Q.warning})),new i(" to see warnings",new J1({color:Q.foreground,dim:!0}))];case"update-error":return[new i("Update failed, run ",new J1({color:Q.foreground,dim:!0})),new i("amp update",new J1({color:Q.warning})),new i(" to see warnings",new J1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function rL8(J){return new Promise((Q)=>{nL8("git",["branch","--show-current"],{cwd:J},(Z,Y)=>{if(Z){Q(null);return}let X=Y.trim();Q(X||null)})})}class mY6 extends c0{dependencies;constructor(J){super();this.dependencies=J}createState(){return new xy1}}class xy1 extends p0{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;threadLoadSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;statusMessage=null;statusMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingMCPStatusModal=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;isShowingContextDetailOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;paletteShowOptions=null;threadsForPicker=[];isLoadingThreads=!1;threadPreviewController=new Ry1;previewThread=null;planScrollController=(()=>{let J=new U7;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new U7;return J.followMode=!1,J})();filterThreadPickerByWorkspace=!0;currentGitBranch=null;messageViewFocusNode=new w8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new w8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;threadFeedReader=null;currentThreadFeedEntry=null;threadFeedEntries=[];threadFeedSubscription=null;threadFeedRotationTimer=null;threadFeedHidden=!1;threadFeedTickerQueue=[];hasSubmittedFirstMessage=!1;currentUserInfo=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;previousThreadIdForHint=null;pendingMCPServers=[];mcpTrustSubscription=null;mcpServers=[];mcpServersSubscription=null;cacheTimerState=null;cacheTimerSubscription=null;agentModeController=null;freeTierStatus=void 0;agentModePulseSeq=0;agentModeSlideProgress=null;agentModeSlideTimer=null;updateState="hidden";updateServiceSubscription=null;toastController=new OS1;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;mysteriousMessage=null;isShowingMysteriousMessageModal=!1;mysteriousMessageSubscription=null;mysterySequenceManager=null;mysterySequenceProgress=null;mysteryKeyInterceptorUnsubscribe=null;static MYSTERY_SEQUENCE=["ctrl+x","y","z"];async initThreadFeed(){let J=await H6(this.widget.dependencies.configService.config);if(J.settings["feed.enabled"]===!1)this.threadFeedHidden=!0;let Q=J.settings.url,Z=Q.includes("localhost")||Q.includes("127.0.0.1");try{let V=await this.widget.dependencies.internalAPIClient.getUserInfo({},{config:this.widget.dependencies.configService});if(V.ok){let K=V.result,q="user"in K?K.user:K;this.currentUserInfo={username:q.username??void 0,displayName:q.displayName??void 0};let W="ffe10a0c-6c42-41ce-a3a6-38990fd6caf8";if(!Z&&K.team?.id!==W)return}else return}catch(V){x.debug("Failed to fetch user info for thread feed filtering",V);return}let Y="/threads.rss",X=async(V,K)=>{let q=V instanceof Request?V.url:V.toString();return n2(q,K,this.widget.dependencies.configService)},G=ca0();G.get("entries").then((V)=>{if(V){let K=this.filterEntries(V);if(this.threadFeedEntries=K,K.length>0&&!this.currentThreadFeedEntry){let q=[...K].sort((H,z)=>z.pubDate.getTime()-H.pubDate.getTime());this.threadFeedTickerQueue=[...q,...this.threadFeedTickerQueue];let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}),this.threadFeedReader=new hj1(G,X,{url:Y}),this.threadFeedSubscription=this.threadFeedReader.stream().subscribe({next:(V)=>{try{let K=this.filterEntries(V);if(K.length>0){this.threadFeedEntries=[...K,...this.threadFeedEntries];let q=[...K].sort((W,H)=>H.pubDate.getTime()-W.pubDate.getTime());if(this.threadFeedTickerQueue=[...q,...this.threadFeedTickerQueue],!this.currentThreadFeedEntry){let W=this.getNextFeedEntry();if(W)this.setState(()=>{this.currentThreadFeedEntry=W})}}}catch(K){x.error("Thread feed: error in next handler",K)}},error:(V)=>{x.error("Thread feed error:",V)}}),this.resetThreadFeedRotation()}filterEntries(J){if(!this.currentUserInfo)return J;let{username:Q,displayName:Z}=this.currentUserInfo;return J.filter((Y)=>{return!Y.authors.some((X)=>{let G=X.name;if(!G)return!1;return Q&&G===Q||Z&&G===Z||Q&&G.includes(Q)})})}rotateThreadFeed(){if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);this.threadFeedRotationTimer=setInterval(()=>{let J=this.getNextFeedEntry();if(J)this.setState(()=>{this.currentThreadFeedEntry=J})},30000)}resetThreadFeedRotation(){this.rotateThreadFeed()}getNextFeedEntry(){if(this.threadFeedTickerQueue.length>0)return this.threadFeedTickerQueue.shift();return null}recordNavigation(J){this.threadBackStack.push(J),this.threadForwardStack=[]}navigateBack=async()=>{if(this.threadBackStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadBackStack.pop();this.threadForwardStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};navigateForward=async()=>{if(this.threadForwardStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadForwardStack.pop();this.threadBackStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};startAndSwitchToNewThread=async()=>{let J=this.widget.dependencies.worker.thread.id;this.recordNavigation(J);let Q=await this.widget.dependencies.startNewThread();return this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,this.widget.dependencies.switchWorker(Q),this.setState(()=>{this.isMessageViewInSelectionMode=!1,this.previousThreadIdForHint=J}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Z,baseWpm:Y}=J,X=Q.messages;for(let G=0;G<X.length;G++){if(this.replayAbortController.signal.aborted)break;let V=X[G];if(!V)continue;if(G>0)await this.replaySleep(J.messageDelayMs);if(V.role==="user"&&Z){let W=V.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
4699
4699
  `);if(W)await this.replayTypeMessage(W,Y)}if(V.role==="assistant"){let W=V.content.some((U)=>U.type==="tool_use"),H=X[G+1],z=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&z){let U={...V,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let D=J.thread.id;this.getMessageScrollController(D).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),V]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,V],this.textController.clear()});let K=J.thread.id;this.getMessageScrollController(K).scrollToBottom()}await this.replaySleep(J.exitDelayMs),o8.instance.stop()}async replayTypeMessage(J,Q){this.textController.clear();let Z=J.split(/(?<=\s)/),Y=60000/Q;for(let X of Z){if(this.replayAbortController.signal.aborted)break;if(this.looksLikePastedContent(X.trim())){await this.replaySleep(150),this.textController.text=this.textController.text+X,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{}),await this.replaySleep(300);continue}let G=Y/X.length;for(let V of X){this.textController.text=this.textController.text+V,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{});let K=0.8+Math.random()*0.4,q=G*K;await this.replaySleep(q)}}}looksLikePastedContent(J){if(/^[a-z][a-z0-9+.-]*:\/\//i.test(J))return!0;if(J.startsWith("/")&&J.length>10)return!0;if(/^[a-z]:\\/i.test(J))return!0;if(/^[a-f0-9]{7,40}$/i.test(J))return!0;if(/^T-[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(J))return!0;return!1}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return this.agentModeController?.getEffectiveMode()??"smart"}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Z=J.items.filter((G)=>G.type==="toolResult").filter((G)=>G.toolResult.run.status==="in-progress"||G.toolResult.run.status==="queued"),Y=J.subagentActiveTools.filter((G)=>G.toolRun.status==="in-progress"||G.toolRun.status==="queued");return[...Z,...Y].length>0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new i(this.submitDisabledHint,new J1({color:J.foreground,dim:!0}));if(this.isExiting)return new i("Exiting...",new J1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new i("",void 0,[new i("Ctrl+C",new J1({color:Q.keybind})),new i(" again to exit",new J1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new i("",void 0,[new i("Esc",new J1({color:Q.keybind})),new i(" again to clear input",new J1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new i("",void 0,[new i("Escape",new J1({color:Q.keybind})),new i(" to close help",new J1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let X=this.getEffectiveAgentMode(),G=yy1(X);return new i("",void 0,[new i("Images aren't supported in ",new J1({color:J.warning,dim:!1})),new i(X,new J1({color:G})),new i(" mode.",new J1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new i("",void 0,[new i("Esc",new J1({color:Q.keybind})),new i(" again to cancel",new J1({color:J.foreground,dim:!0}))]);return new i("",void 0,[new i("Esc",new J1({color:Q.keybind})),new i(" to cancel",new J1({color:J.foreground,dim:!0}))])}if(this.statusMessage)return new i(this.statusMessage,new J1({color:J.foreground,dim:!0}));let Z=kY6(this.updateState,J);if(Z)return new i("",void 0,Z);let Y=this.widget.dependencies.worker.thread;if(Y.agentMode==="plan"&&TA(Y))return new i("",void 0,[new i("Ctrl+O",new J1({color:Q.keybind})),new i(" → Execute Plan",new J1({color:J.foreground,dim:!0}))]);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Z}=this.widget.dependencies;if(!Q.mainThread?.id)return;let X=Q.mainThread?.messages.findIndex((G)=>G===J);if(X===void 0||X===-1)return;try{this.cancelBashInvocations(),await Z.cancel(),await Z.handle({type:"thread:truncate",fromIndex:X}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(G){x.error("Failed to edit message:",G)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Z,threadSyncService:Y}=this.widget.dependencies,X=Q.mainThread?.id;if(!X)return;let G=Q.mainThread?.messages.findIndex((V)=>V===J);if(G===void 0||G<=0)return;try{let V=await J2.getOrCreateForThread(Z,X),K=await $R(V,Y,G-1);await this.switchToExistingThread(K)}catch(V){x.error("Failed to fork thread:",V),this.showErrorMessage(`Failed to fork thread: ${V}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Z,worker:Y}=this.widget.dependencies,X=Z.mainThread;if(!X)return;let G=X.messages.findIndex((V)=>V.messageId!==void 0&&V.messageId===J.messageId);if(G===-1)return;try{this.cancelBashInvocations(),await Y.cancel(),this.widget.dependencies.history.add(Q);let V=vB(Q);if(V)await Y.handle({type:"thread:truncate",fromIndex:G}),this.invokeBashCommand(V.cmd,{visibility:V.visibility});else{let K=[{type:"text",text:Q}];if(this.imageAttachments.length>0)K.push(...this.imageAttachments);let q={content:K,agentMode:X.agentMode},W=G===0;if(X.agentMode&&!W&&q.agentMode!==X.agentMode){x.error(`Cannot edit message: This thread uses ${X.agentMode} mode. To change mode, create a new thread.`);return}await Y.handle({type:"user:message",message:q,index:G})}this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(V){x.error("Failed to edit message:",V)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(f2)}catch(Z){return x.error("Failed to get affected files:",Z),[]}};textController=new P$;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new U7);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let Y=this.searchElementTreeByKey(J.child,Q);if(Y)return Y}if(J?.children)for(let Y of J.children){let X=this.searchElementTreeByKey(Y,Q);if(X)return X}return null}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{this.toastController.show("Selection copied to clipboard","success",2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Z=process.cwd().replace(process.env.HOME||"","~"),Y=Q?`amp - ${Q} - ${Z}`:"";process.stdout.write(oC1(Y))}}_handleTextCopy(J){if(J&&J.length>0)this.toastController.show("Selection copied to clipboard","success",2000)}textFieldKey=new m7("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands;paletteConfig;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Z=vB(J)?.visibility;if(Z!==this.currentShellModeStatus)this.currentShellModeStatus=Z,this.setState(()=>{})};navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1}),m8.instance.addPostFrameCallback(()=>{this.autocompleteFocusNode.requestFocus()})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.dismissIdePicker();return}try{await this.connectToSelectedIde(J,Q)}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Y}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.dismissIdePicker()};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}previewControllerListener=(J)=>{this.setState(()=>{this.previewThread=J})};showStandaloneThreadPicker=()=>{this.showCommandPalette({type:"standalone",commandId:"continue",onSubmit:()=>{this.threadPreviewController.clear(),this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null}),m8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette)this.autocompleteFocusNode.requestFocus()})},onCancel:()=>{this.exitApplication()}})};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(J){if(this.setState(()=>{this.isShowingPalette=!this.isShowingPalette,this.paletteShowOptions=J??null}),this.isShowingPalette)this.loadThreadsForPicker()}isShowingStandalonePalette(){return this.isShowingPalette&&this.paletteShowOptions?.type==="standalone"}getPaletteCommands(){if(!this.paletteCommands){if(!this.paletteConfig)throw Error("Config not yet available");this.paletteCommands=new ak1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding,this.paletteConfig)}return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new sk1(this.widget.dependencies.fuzzyServer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1,this.paletteShowOptions=null})};getCommandPaletteContext=(J)=>{let{threadState:Q,recentThreadIDs:Z}=this.widget.dependencies;if(!Q.mainThread)return null;let Y=f0.file(process.cwd()),X=T6(Y);return{recentThreadIDs:Z,currentThreadID:Q.mainThread.id,context:J,worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let G=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),G},setImageAttachments:(G)=>{this.setState(()=>{this.imageAttachments=G})},editorDispatch:(G)=>{switch(G.type){case"set-input":this.textController.clear(),this.textController.insertText(G.input);break;case"insert-text":this.textController.insertText(G.text);break;case"clear":this.textController.clear();break}},submitMessage:(G)=>{return this.proceedWithUserMessage(G)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,mcpService:this.widget.dependencies.mcpService,startNewThread:async()=>{await this.startAndSwitchToNewThread()},navigateBack:this.navigateBack,navigateForward:this.navigateForward,canNavigateBack:this.threadBackStack.length>0,canNavigateForward:this.threadForwardStack.length>0,canUseAmpFree:this.widget.dependencies.freeTierStatus?.canUseAmpFree??!1,switchToThread:async(G)=>{return await this.switchToExistingThread(G),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(G,V,K)=>{let q=this.widget.dependencies.threadState.mainThread?.id;if(!q)throw Error("No active thread");let W=setTimeout(()=>{K.throwIfAborted()},60000);try{let H=await this.widget.dependencies.threadService.generateHandoffPrompt(q,G,V,this.widget.dependencies.configService,K);return clearTimeout(W),H}catch(H){throw clearTimeout(W),H}},handleHandoff:async(G,V)=>{let{goal:K,generatedPrompt:q,images:W}=V;if(!K&&!q)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let H=this.widget.dependencies.threadState.mainThread?.id;if(!H)return{ok:!1,error:Error("No active thread")};let z=setTimeout(()=>G.abort(new N91("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let U=await this.widget.dependencies.threadService.createHandoffThread(H,{goal:K,generatedPrompt:q,images:W},this.widget.dependencies.configService,G.signal);return clearTimeout(z),await this.switchToExistingThread(U),{ok:!0}}catch(U){if(clearTimeout(z),U instanceof Error&&(U.name==="AbortError"||U.message.includes("aborted")))throw G.signal.reason;throw U}}catch(H){return x.error("Failed to create handoff thread",H),{ok:!1,error:H instanceof Error?H:Error(String(H))}}},getGuidanceFiles:async(G)=>{if(!Q.mainThread)return[];return(await Ns({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,G)).map((K)=>({uri:K.uri,type:K.type}))},openIdePicker:()=>{this.openIdePicker()},getAgentMode:()=>{return this.agentModeController?.getMode()??null},setAgentMode:(G)=>{this.agentModeController?.setMode(G)},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let G=Q.mainThread?.id;if(!G){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let V=await this.widget.dependencies.threadService.createPlanExecutionThread(G,"smart");await this.switchToExistingThread(V)}catch(G){x.error("Failed to execute plan",G),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${G instanceof Error?G.message:String(G)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:X,threadViewStates:this.widget.dependencies.workerController.threadViewStates,currentThreadFeedEntry:this.currentThreadFeedEntry,threadFeedEntries:this.threadFeedEntries,threadFeedHidden:this.threadFeedHidden,setThreadFeedHidden:(G)=>{this.setState(()=>{this.threadFeedHidden=G})},showMCPStatusModal:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!0})},internalAPIClient:this.widget.dependencies.internalAPIClient,features:this.widget.dependencies.features??[],showStatusMessage:(G,V=2000)=>{if(this.statusMessageTimer)clearTimeout(this.statusMessageTimer);this.setState(()=>{this.statusMessage=G}),this.statusMessageTimer=setTimeout(()=>{this.setState(()=>{this.statusMessage=null}),this.statusMessageTimer=null},V)}}};loadThreadsForPicker(){if(this.threadLoadSubscription)return;this.setState(()=>{this.isLoadingThreads=!0});let J=new Ty1(this.widget.dependencies.threadHistoryService);this.threadLoadSubscription=J.observeThreadSummaries("").subscribe({next:(Q)=>{this.setState(()=>{this.threadsForPicker=Q,this.isLoadingThreads=!1})},error:()=>{this.setState(()=>{this.isLoadingThreads=!1})}})}updateGitBranch=async()=>{let J=await rL8(process.cwd());this.setState(()=>{this.currentGitBranch=J})};removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{visibility:Q})=>{let Z=Date.now(),Y=`bash-${Z}-${Math.random().toString(36).substring(7)}`,X={cmd:J},G=new AbortController;this.widget.dependencies.worker.invokeBashTool(X,G.signal,Q===xB).subscribe({next:(V)=>{this.setState(()=>{if(this.bashInvocations.find((q)=>q.id===Y))this.bashInvocations=this.bashInvocations.map((q)=>q.id===Y?{...q,toolRun:V}:q);else{let q={id:Y,args:X,toolRun:V,startTime:Z,abortController:G,hidden:Q===xB};this.bashInvocations=[...this.bashInvocations,q]}})},error:()=>this.removeBashInvocation(Y),complete:()=>this.removeBashInvocation(Y)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleConnectedClientsStatus=()=>{this.setState(()=>{this.connectedClientsStatusExpanded=!this.connectedClientsStatusExpanded})};showContextDetailOverlay=()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!0})};toggleAgentMode=()=>{if(!this.agentModeController)return;if(this.agentModeController.toggle())this.setState(()=>{this.showImageUnsupportedHint=!1,this.agentModePulseSeq++})};startAgentModeSlide=()=>{if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer);this.setState(()=>{this.agentModeSlideProgress=0});let J=800,Q=16,Z=Q/J;this.agentModeSlideTimer=setInterval(()=>{this.setState(()=>{if(this.agentModeSlideProgress!==null){if(this.agentModeSlideProgress=Math.min(1,this.agentModeSlideProgress+Z),this.agentModeSlideProgress>=1){if(this.agentModeSlideProgress=null,this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null}}})},Q)};handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!Gy(Q)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=iF)return!1;let Z=ZC(J);if(typeof Z==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Z]}),!1;return this.setState(()=>{this.displayMessage=Error(`Failed to attach image: ${Z}`)}),!1};handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1)})};handleShowMysteryModal=()=>{if(this.mysteriousMessage)this.setState(()=>{this.isShowingMysteriousMessageModal=!0})};handleCloseMysteryModal=()=>{this.setState(()=>{this.isShowingMysteriousMessageModal=!1})};handleDestructMysteriousMessage=()=>{if(!this.mysteriousMessage)return;let J=this.mysteriousMessage.id;this.widget.dependencies.internalAPIClient.markAsReadMysteriousMessage({messageId:J},{config:this.widget.dependencies.configService}).then((Q)=>{if(!Q.ok)x.error("Failed to destruct mysterious message",Q.error);else this.setState(()=>{this.mysteriousMessage=null,this.isShowingMysteriousMessageModal=!1})}).catch((Q)=>{x.error("Failed to destruct mysterious message",Q)})};openInEditor=async(J)=>{let{mkdtemp:Q,readFile:Z,unlink:Y,rmdir:X,writeFile:G}=await import("node:fs/promises"),{tmpdir:V}=await import("node:os"),K=await import("node:path");try{let q=await Q(K.join(V(),"amp-edit-")),W=K.join(q,"message.amp.md");await G(W,J,"utf-8"),await UV(W);try{let H=await Z(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")x.error("Failed to read temporary file",H)}try{await Y(W),await X(q)}catch(H){x.warn("Failed to clean up temporary file",H)}}catch(q){x.error("Error opening editor:",q)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=vB(J);if(Q)if(!Q.cmd){this.showSubmitDisabledHint("No command provided");return}else if(this.isProcessing()){this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}else{this.invokeBashCommand(Q.cmd,{visibility:Q.visibility}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();return}this.textController.clear(),this.resetHistory(),await this.updateGitBranch(),await this.sendUserMessage(J)};agentModeListener=()=>{this.setState(()=>{})};initState(){if(mY.getInstance().interceptConsole(),this.freeTierStatus=this.widget.dependencies.freeTierStatus,this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();o8.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),o8.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),o8.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Z)=>{m8.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Z.hasFocus})})}),H6(this.widget.dependencies.configService.config).then((Z)=>{this.paletteConfig=Z,this.agentModeController=new dj1({initialCliMode:this.widget.dependencies.initialAgentMode,sessionState:this.widget.dependencies.sessionState??null,freeTierStatus:this.freeTierStatus?{canUseAmpFree:this.freeTierStatus.canUseAmpFree,eligible:this.freeTierStatus.eligible,workspaceAllowsAmpFree:this.freeTierStatus.workspaceAllowsAmpFree}:void 0,initialSettings:Z.settings,config$:this.widget.dependencies.configService.config,getThread:()=>this.widget.dependencies.getCurrentWorker()?.thread??this.widget.dependencies.worker.thread}),this.agentModeController.addListener(this.agentModeListener)}),this.updateGitBranch(),this.adSubscription=Dj1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{let Z=this.agentModeController?.getMode();return(Z&&d9(Z)||this.randomAd===null)&&Nj1(this.lastUserInteractionTime)}).subscribe({next:(Z)=>{if(Z){let Y=aL8(16).toString("hex");this.lastAdImpressionId=Y,Promise.resolve().then(() => (d91(),p91)).then(({recordAdEvent:X})=>{let G=this.widget.dependencies.worker.thread,V=G.messages[G.messages.length-1];X("viewed",{adId:Z.id,advertiserId:Z.advertiserId,threadId:G.id,messageId:V?.messageId,impressionId:Y,placement:"tui",matchType:Z.metadata?.matchType,matchedPatterns:Z.metadata?.matchedPatterns,candidateAdPoolCount:Z.metadata?.candidateAdPoolCount,clientRegion:Z.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=Z}),m8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Z)=>{this.setState(()=>{this.pendingMCPServers=Z})}),this.mcpServersSubscription=this.widget.dependencies.mcpService.servers.subscribe((Z)=>{this.setState(()=>{this.mcpServers=Z})}),this.cacheTimerSubscription=this.widget.dependencies.worker.cacheTimer.subscribe((Z)=>{this.setState(()=>{this.cacheTimerState=Z})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Z)=>{this.setState(()=>{this.ideStatus=Z})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Z)=>{let Y=this.widget.dependencies.getCurrentWorker();if(!Y){x.warn("No active thread worker found to handle IDE message");return}await new Promise((X)=>setTimeout(X,50)),await Y.handle({type:"user:message",message:{content:[{type:"text",text:Z}]}}),x.debug("Message sent from IDE to agent",{message:Z.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Z)=>{this.textController.insertText(Z),x.debug("Appended text to CLI prompt from IDE",{text:Z.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Z)=>{this.setState(()=>{this.connectedClientsStatus=Z})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Z)=>{this.setState(()=>{this.updateState=Z})}),this.mysteriousMessageSubscription=U41(this.widget.dependencies.configService).pipe(v5((Z)=>Z!=="pending"),Q6((Z)=>B41(Z)?Z.mysteriousMessage??null:null),N4((Z,Y)=>Z?.id===Y?.id)).subscribe((Z)=>{this.setState(()=>{if(Z?.id!==this.mysteriousMessage?.id)this.isShowingMysteriousMessageModal=!1;if(this.mysteriousMessage=Z,Z&&!this.mysterySequenceManager)this.mysterySequenceManager=new q81(new Map([[new K81(xy1.MYSTERY_SEQUENCE),new Lm]])),this.mysteryKeyInterceptorUnsubscribe=o8.instance.addKeyInterceptor((Y)=>{if(!this.mysterySequenceManager)return!1;if(this.isShowingMysteriousMessageModal)return!1;let X=this.mysterySequenceManager.handleKeyEvent(Y);if(X.consumed){if(X.intent)this.handleShowMysteryModal();return this.setState(()=>{this.mysterySequenceProgress=X.progress}),!0}else if(this.mysterySequenceProgress)this.setState(()=>{this.mysterySequenceProgress=null});return!1});else if(!Z)this.mysteryKeyInterceptorUnsubscribe?.(),this.mysteryKeyInterceptorUnsubscribe=null,this.mysterySequenceManager?.dispose(),this.mysterySequenceManager=null,this.mysterySequenceProgress=null})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Z)=>{let Y=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${Y}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100);this.initThreadFeed()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.replayAbortController.abort(),this.replayTypingTimer)clearTimeout(this.replayTypingTimer);if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeController)this.agentModeController.removeListener(this.agentModeListener),this.agentModeController.dispose();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(this.mcpServersSubscription)this.mcpServersSubscription.unsubscribe();if(this.cacheTimerSubscription)this.cacheTimerSubscription.unsubscribe();if(this.threadLoadSubscription)this.threadLoadSubscription.unsubscribe();if(this.threadFeedSubscription)this.threadFeedSubscription.unsubscribe();if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);if(this.agentModeSlideTimer)clearInterval(this.agentModeSlideTimer),this.agentModeSlideTimer=null;if(this.mysteriousMessageSubscription)this.mysteriousMessageSubscription.unsubscribe();if(this.mysteryKeyInterceptorUnsubscribe?.(),this.mysterySequenceManager?.dispose(),this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.dispose(),this.toastController.dispose(),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.textController.removeListener(this.textChangeListener);for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(oC1("")),this.shouldUseProgressBar())process.stdout.write(F56())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,Y=[...J.items.filter((K)=>K.type==="toolResult").map((K)=>({toolUse:K.toolUse,toolRun:K.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((K)=>K.toolRun.status==="blocked-on-user");if(Y.length===0)return null;let X=Y[0],G=X.toolRun.status==="blocked-on-user"?X.toolRun.toAllow??[]:[],V=X.toolRun.status==="blocked-on-user"?X.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:X.toolUse,toAllow:G}],subthreadID:X.subthreadID,reason:V}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){x.error("No current tool confirmation found");return}let Z=Q.tools[0]?.useBlock;if(!Z){x.error("No tool use block found in confirmation");return}if(J==="allow-all-session")DG("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0,"global")}catch(X){if(X&&X instanceof Error)this.setState(()=>{this.displayMessage=X});else x.error("Failed to write dangerouslyAllowAll setting:",X);return}if(J==="always-guarded"){let X=Q.tools[0]?.toAllow??[],G=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],V=[...X,...G];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",V,"global")}if(J==="connect-github"){let X=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();await eJ(this.context,X);return}if(J==="disable-librarian"){let X=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!X.includes(VY))await this.widget.dependencies.settingsStorage.set("tools.disable",[...X,VY],"global")}let Y=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let X={type:"user:tool-input",toolUse:Z.id,value:{accepted:Y}};if(Q.subthreadID)await(await J2.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(X);else await this.widget.dependencies.worker.handle(X)}catch(X){x.error("Failed to send tool confirmation:",X)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Z=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Z)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Z=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Z.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null}),await this.startAndSwitchToNewThread();break}case"new-smart-thread":{this.agentModeController?.setMode("smart"),this.setState(()=>{this.dismissedEphemeralErrorKey=null}),e61({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}case"handoff":{if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);this.showCommandPalette({type:"normal",commandId:"handoff"});break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await UV(Q.getSettingsFilePath())}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);await this.showErrorMessage(`Failed to open settings: ${Y}`)}};cancelStreamingMessage=async()=>{await J2.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="user"&&!Z.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J,Q={})=>{let{recordInNavigationHistory:Z=!0}=Q;if(Z){let Y=this.widget.dependencies.worker.thread.id;if(Y!==J)this.recordNavigation(Y)}try{x.info(`[switchToExistingThread] Switching to thread: ${J}`);let Y=await this.widget.dependencies.switchToThread(J);if(x.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${Y.thread.agentMode}`),this.widget.dependencies.worker=Y,this.widget.dependencies.threadID=Y.thread.id,this.widget.dependencies.switchWorker(Y),x.info("[switchToExistingThread] Clearing agent mode"),this.agentModeController?.setMode(null),Y.thread.draft)if(x.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof Y.thread.draft==="string")this.textController.insertText(Y.thread.draft);else{let X=Y.thread.draft.filter((K)=>K.type==="text"),G=Y.thread.draft.filter((K)=>K.type==="image"),V=X.map((K)=>K.text).join(`
4700
4700
  `);if(V)this.textController.insertText(V);if(G.length>0)this.setState(()=>{this.imageAttachments=G})}}catch(Y){throw x.error("Failed to switch to thread:",J,Y),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,Z=m2(Q.thread)===0,Y=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Z&&Y!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let X=[{type:"text",text:J}];if(this.imageAttachments.length>0)X.push(...this.imageAttachments);if(Z)this.startAgentModeSlide();if(await Q.handle({type:"user:message",message:{content:X,agentMode:Y}}),Z)e61({agentMode:Y});this.scrollMessageViewToBottom(),this.setState(()=>{if(this.imageAttachments=[],!this.hasSubmittedFirstMessage)this.hasSubmittedFirstMessage=!0}),m8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{this.setState(()=>{this.isExiting=!0});let J=this.widget.dependencies.threadState.mainThread;if(J?.messages.length===0){if(J.relationships?.find((Y)=>Y.type==="handoff"&&Y.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();e61({agentMode:Q}).catch((Z)=>{x.warn("Failed to save session state on exit:",Z)}).finally(()=>{o8.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=oL8();if(J===Q)return"~";if(J.startsWith(Q+gm.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(gm.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(gm.sep),"…",Q.slice(-2).join(gm.sep)].join(gm.sep)}build(J){let Q=f4.of(J),Z=Y6.of(J),Y=Z.base;this.themeColors=Y;let{colors:X,app:G}=Z;this.themeApp=G;let V=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,K=V.thread.agentMode&&d9(V.thread.agentMode),q=K&&this.randomAd!==null,W=!K&&this.currentThreadFeedEntry!==null&&!this.threadFeedHidden,H=Boolean(q),{threadState:z}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),D=this.widget.dependencies.replayMode,M=Boolean(D),L=z.items,A=z.mainThread||void 0,E=z.subagentToolsByParentID,I=z.todosList;if(M){let u6={...D.thread,messages:this.replayDisplayedMessages};L=LC(u6).items,A=u6,E={};let c6=gE({messages:this.replayDisplayedMessages});I=Array.isArray(c6)?c6:[]}let P=A?.id,C=A,k=M?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),y=(u6)=>new z91({key:new m7(`preview-message-view-${u6.id}`),items:LC(u6).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:u6,focusNode:new w8({debugLabel:"PreviewFocus"})}),v=this.previewThread,b=v?v.messages.length>2000?new b0({mainAxisSize:"max",children:[new a6({child:new X0}),new V6({padding:B0.all(2),child:new j4({child:new y1({text:new i("Thread too long for preview",new J1({color:X.mutedForeground,dim:!0}))})})})]}):y(v):k?new B91({agentMode:this.getEffectiveAgentMode(),mysteriousMessage:this.mysteriousMessage,mysterySequenceProgress:this.mysterySequenceProgress,onShowMysteryModal:this.handleShowMysteryModal}):new z91({key:P?new m7(`message-view-${P}`):void 0,items:L,subagentToolsByParentID:E,controller:P?this.getMessageScrollController(P):new U7,autofocus:!1,onCopy:M?void 0:this._handleTextCopy.bind(this),thread:C,onMessageEditSubmit:M?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:M?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:M?void 0:this.forkMessage,getAffectedFiles:M?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),d=Math.max(Math.floor(Q.size.height*0.4),12),m=this.getCurrentEphemeralError(),n=Q.size.width<40,$1=z.mainThread?LM0(z.mainThread):void 0,t=Zz(J),p=this.buildBottomWidget(m,U,X,Z,z,I,d,H,M,$1,this.cacheTimerState??void 0,Q,t),e=new R81({threadViewState:z.viewState,threadTokenUsage:$1,threadID:P??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,mcpServers:this.mcpServers,isNarrow:n,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),F1=new P81({bashInvocations:this.bashInvocations}),q1=[];if(W&&this.currentThreadFeedEntry)q1.push(new Py1({entry:this.currentThreadFeedEntry,width:Q.size.width}));let o=this.getEffectiveAgentMode(),r=this.currentShellModeStatus,l=yy1(o),W1=!r?o.length+1:0,_1=Q.capabilities.animationSupport,s=_1==="disabled"?0:_1==="slow"?30:60,u1=DK(o)?.uiHints?.fasterAnimation?3:1,j1=s>0&&this.agentModePulseSeq>0?new x9({children:[p,new g5({top:0,left:1,right:1,height:1,child:new Ay1({color:l,trigger:this.agentModePulseSeq,fps:s,speed:u1,leftOffset:W1})})]}):p;q1.push(new a6({child:b}),F1);let R0=new x9({children:[new b0({mainAxisSize:"min",children:[q?new fk1({ad:this.randomAd,onButtonClick:async()=>{let u6=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (d91(),p91)).then(({recordAdEvent:B9})=>{let O4=this.widget.dependencies.worker.thread,WJ=O4.messages[O4.messages.length-1];B9("clicked",{adId:u6.id,advertiserId:u6.advertiserId,threadId:O4.id,messageId:WJ?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:u6.metadata?.matchType,matchedPatterns:u6.metadata?.matchedPatterns,candidateAdPoolCount:u6.metadata?.candidateAdPoolCount,clientRegion:u6.metadata?.clientRegion})});if(!await eJ(this.context,u6.shortDestinationUrl)){let O4=o8.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:O4,url:u6.shortDestinationUrl}})}}}):new X0({height:0}),new l0({constraints:new A6(0,Q.size.width,0,d),child:j1})]}),H?new g5({top:0,left:0,right:0,child:new dY6({userHeight:this.bottomGridUserHeight,maxHeight:d,onInitializeHeight:(u6)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(u6,d)})},onDrag:(u6)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(u6.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let c6=Math.floor(u6.localPosition.y)-this.bottomGridDragStartY,B9=Math.max(4,this.bottomGridDragStartHeight-c6),O4=Math.min(B9,d),WJ=Math.floor(O4);if(this.bottomGridUserHeight!==WJ)this.setState(()=>{this.bottomGridUserHeight=WJ})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new X0({height:0})]});q1.push(R0,new X0({height:1,child:new V6({padding:B0.horizontal(1),child:e})}));let C1=new b0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:q1}),z1=M&&D?.showIndicator!==!1?new x9({children:[C1,new g5({top:0,left:0,child:new Iy1})]}):C1,Z1=new T8(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.isShowingMCPStatusModal)return this.setState(()=>{this.isShowingMCPStatusModal=!1}),"handled";if(this.pendingMCPServers.length>0)return this.widget.dependencies.mcpTrustHandler.deny(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingContextDetailOverlay)return this.setState(()=>{this.isShowingContextDetailOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.textController.hasSelection)return this.textController.clearSelection(),"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.isConfirmingCancelProcessing){if(this.bashInvocations.length>0)this.cancelBashInvocations();if(this.isProcessing())this.markLastUserMessageAsInterrupted().catch((c6)=>{x.error("Failed to mark message as interrupted:",c6)}),this.cancelStreamingMessage().catch((c6)=>{x.error("Failed to cancel streaming message:",c6)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return x.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.bashInvocations.length>0||this.isProcessing()){if(this.setState(()=>{this.isConfirmingCancelProcessing=!0}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout);return this.cancelProcessingConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout=null},1000),"handled"}if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),O1=new T8(()=>{return this.onExitPressed(),"handled"}),A1=new T8(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),T1=new T8(()=>{return this.setState(()=>{this.isShowingMCPStatusModal=!this.isShowingMCPStatusModal}),"handled"}),S1=new T8(()=>{return GJ.instance.toggleAll(),"handled"}),c1=new T8(()=>{return this.widget.dependencies.configService.getLatest().then((u6)=>{DG("internal.showCost",!(u6.settings["internal.showCost"]??!0))}),"handled"}),g1=new T8(()=>{return o8.instance.toggleFrameStatsOverlay(),"handled"}),s1=new T8(()=>{return o8.instance.tuiInstance.getScreen().markForRefresh(),m8.instance.requestFrame(),"handled"}),K0=new T8(()=>{return this.toggleAgentMode(),"handled"}),q0=new T8(()=>{let c6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:B9}=this.widget.dependencies,O4=B9.mainThread?.id;return O4?this.getMessageScrollController(O4):null})();if(c6){let B9=Math.max(Math.floor(Q.size.height*0.4),10),O4=Q.size.height-B9;c6.animatePageUp(O4,100)}return"handled"}),k0=new T8(()=>{let c6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:B9}=this.widget.dependencies,O4=B9.mainThread?.id;return O4?this.getMessageScrollController(O4):null})();if(c6){let B9=Math.max(Math.floor(Q.size.height*0.4),10),O4=Q.size.height-B9;c6.animatePageDown(O4,100)}return"handled"}),v6=new T8(()=>{let c6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:B9}=this.widget.dependencies,O4=B9.mainThread?.id;return O4?this.getMessageScrollController(O4):null})();if(c6)c6.animateTo(0,100);return"handled"}),m6=new T8(()=>{let c6=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:B9}=this.widget.dependencies,O4=B9.mainThread?.id;return O4?this.getMessageScrollController(O4):null})();if(c6)c6.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),e4=new T8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:u6}=this.widget.dependencies;if(!u6.mainThread?.messages.some((B9)=>B9.role==="user"||bE(B9)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),s8=new T8((u6)=>{if(u6.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),a9=new T8(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return L81().then(async(u6)=>{if(u6)try{this.handleInsertImage(u6)}finally{try{let{unlink:c6}=await import("node:fs/promises");await c6(u6)}catch{}}}),"handled"}),E0=new Map([[K4.ctrl("c"),new zm],[K4.ctrl("l"),new Dm],[K4.ctrl("o"),new B81],[K4.ctrl("v"),new Wm],[K4.alt("s"),new GC],[K4.ctrl("s"),new GC],[K4.alt("p"),new Nm],[K4.ctrl("r"),new Um],[K4.alt("d"),new Bm],[K4.ctrl("t"),new Mm],[K4.key("PageUp"),new H81],[K4.key("PageDown"),new z81],[K4.key("Home"),new F81],[K4.key("End"),new U81],[K4.key("Escape"),new Hm],[K4.ctrl("p"),new VC("previous")],[K4.ctrl("n"),new VC("next")],[K4.key("Tab"),new Am]]);if(!v3())E0.set(K4.key("ArrowUp"),new Am);if(!1)E0.set(K4.alt("c"),new Fm);let Y4=new T8(()=>{if(this.isShowingStandalonePalette())return"handled";return this.showCommandPalette(),"handled"}),Y8=new T8(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),u8=new T8(()=>{if(this.mysteriousMessage)this.handleShowMysteryModal();return"handled"}),J7=new Map([[Hm,Z1],[Dm,s1],[GC,K0],[B81,Y4],[Wm,a9],[Fm,A1],[$81,T1],[Um,S1],[Bm,c1],[Nm,g1],[Mm,Y8],[zm,O1],[H81,q0],[z81,k0],[F81,v6],[U81,m6],[Am,e4],[VC,s8],[Lm,u8]]),p8=[z1];if(this.isShowingConsoleOverlay)p8.push(new Jy1);if(this.isShowingHelp&&this.paletteConfig)p8.push(new Xy1({commands:this.getPaletteCommands().getAllCommands()}));if(this.isShowingMCPStatusModal)p8.push(new Qk1({servers:this.mcpServers,onDismiss:()=>{this.setState(()=>{this.isShowingMCPStatusModal=!1})}}));if(this.isShowingMysteriousMessageModal&&this.mysteriousMessage)p8.push(new Ey1({message:this.mysteriousMessage,onClose:this.handleCloseMysteryModal,onDestruct:this.handleDestructMysteriousMessage}));if(this.adActionModal)p8.push(new hk1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(u6)=>{let c6=this.adActionModal.url;if(u6==="copy")try{await o8.instance.tuiInstance.clipboard.writeText(c6),this.setState(()=>{this.displayMessage=new cY("Link copied to clipboard")})}catch(B9){x.error("Failed to copy to clipboard",{error:B9}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:u6}=this.widget.dependencies;p8.push(new Oy1({servers:this.pendingMCPServers,onAlwaysTrust:u6.trustAlways.bind(u6),onTrustOnce:u6.trustOnce.bind(u6),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:u6.deny.bind(u6)}))}if(this.isShowingFileChangesOverlay)p8.push(new kS1({threadData:z}));if(this.isShowingCostBreakdownOverlay&&z.mainThread)p8.push(new Zy1({thread:z.mainThread}));if(this.isShowingContextDetailOverlay)p8.push(new Qy1({thread:z.mainThread??void 0,tokenUsage:$1??void 0,cacheTimerState:this.cacheTimerState??void 0,onDismiss:()=>{this.setState(()=>{this.isShowingContextDetailOverlay=!1})}}));if(this.isShowingConfirmationOverlay)p8.push(new tk1({details:this.confirmationOverlayContent}));let Q7=this.getCommandPaletteContext(J);if(Q7&&this.isShowingPalette&&this.paletteConfig)p8.push(new j4({child:new l0({constraints:A6.loose(80,20),child:new rk1({commandContext:Q7,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,showOptions:this.paletteShowOptions??void 0})})}));if(this.isShowingIdePicker)p8.push(new Gy1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let k5=new x9({children:p8});if(this.isShowingJetBrainsInstaller)return new hA({child:new mQ({actions:J7,child:new DV({shortcuts:E0,debugLabel:"jetbrains-installer-shortcuts",child:new Ly1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new eH({controller:this.toastController,child:new hA({child:new wS1({controller:this.toastController,child:new mQ({actions:J7,child:new DV({shortcuts:E0,debugLabel:"main-app-shortcuts",child:k5})})})})})}buildScrollableTodoList(J,Q,Z){return new uY6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Z})}buildBottomWidget(J,Q,Z,Y,X,G,V,K,q,W,H,z,U){if(J)return new Yy1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new ek1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new wy1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let D=E81(Y),M=this.agentModeController?.isInRestrictedFreeMode()??!1,L=new sA({key:this.textFieldKey,controller:this.textController,triggers:q?[]:[new pB],completionBuilder:q?void 0:this.getCompletionBuilder(),ampURL:this.widget.dependencies.ampURL,onSubmitted:q?void 0:this.onTextSubmitted,theme:Z,placeholder:q?"Press Ctrl+C to exit":M?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!M&&!this.isShowingStandalonePalette(),shellPromptRules:D,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandalonePalette()&&!this.isShowingIdePicker,clipboard:o8.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage,previousThreadId:this.previousThreadIdForHint&&(X.mainThread?.messages.length??0)===0?this.previousThreadIdForHint:void 0,onPreviousThreadHintAccepted:()=>{let o=this.previousThreadIdForHint;if(o)this.setState(()=>{this.previousThreadIdForHint=null}),this.textController.text=`following: @${o} `},onDoubleAtTrigger:q?void 0:()=>{let o=this.textController.text,r=this.textController.cursorPosition,W1=o.slice(0,r).lastIndexOf("@@");this.showCommandPalette({type:"standalone",commandId:"mention-thread",onBeforeExecute:()=>{if(W1!==-1){let _1=this.textController.text,s=_1.slice(0,W1)+_1.slice(W1+2);this.textController.text=s,this.textController.cursorPosition=W1}},onSubmit:()=>{this.dismissPalette()},onCancel:()=>{this.dismissPalette()}})}}),A=X.mainThread?.queuedMessages??[],E=Array.isArray(G)&&G.length>0,I=Array.isArray(A)&&A.length>0,P=X.mainThread?.agentMode==="plan"&&TA(X.mainThread),C,k;if(P){if(C=new Km(new F91({thread:X.mainThread,onExecute:async()=>{let o=this.getCommandPaletteContext();if(o)await this.getPaletteCommands().execute("execute-plan",o,void 0,new AbortController)},onEdit:async()=>{try{let o=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:r}=await this.widget.dependencies.planFileManager.ensureSync(X.mainThread.id);o8.instance.tuiInstance.suspend();let{execSync:l}=await import("child_process");l(`${o} "${r}"`,{stdio:"inherit"}),o8.instance.tuiInstance.resume()}catch(o){x.error("Failed to edit plan",o),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:Y}),{clipBehavior:"antiAlias"}),I)k=new u91({queuedMessages:A});else if(E)k=this.buildScrollableTodoList(G,this.isTextfieldAndAutocompleteFocused&&!M,Y)}else C=I?new u91({queuedMessages:A}):void 0,k=E?this.buildScrollableTodoList(G,this.isTextfieldAndAutocompleteFocused&&!M,Y):void 0;let y=[],v=this.currentShellModeStatus;if(v)y.push({child:new y1({text:new i(v==="hidden"?"shell mode (incognito)":"shell mode",new J1({color:v==="hidden"?Y.app.shellModeHidden:Y.app.shellMode}))}),position:"top-left"});let d=this.connectedClientsStatus&&this.connectedClientsStatus.enabled?this.connectedClientsStatusExpanded?(this.connectedClientsStatus?.clientID?.length??7)+3:3:0,m=this.agentModeController?.getVisibleModes()??[];if(!v&&m.length>1){let o=this.previewThread,r=o?o.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),l=yy1(r),W1=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,_1=m2(W1.thread)>0,s=this.agentModeSlideProgress!==null,u1,j1;if(s){u1="top-left";let C1=z.size.width-r.length-4-d;j1=Math.floor(this.agentModeSlideProgress*C1)}else if(_1)u1="top-right",j1=d;else u1="top-left",j1=void 0;if(o)y.push({child:new y1({text:new i(r,new J1({color:l}))}),position:u1,offsetX:j1});else{let R0=!_1&&!s,C1=new y1({text:new i(r,new J1({color:l}))});y.push({child:R0?new G8({child:C1,onClick:this.toggleAgentMode,cursor:"pointer"}):C1,position:u1,offsetX:j1})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let o=this.connectedClientsStatus,r=o.mode||"disconnected",l=!!o.errorMessage,W1=o.clientID||"unknown",_1,s;if(l)_1="●",s=D1.red;else if(r==="presence")_1="○",s=D1.yellow;else if(r==="connected"&&o.connected)_1="●",s=D1.green;else _1="○",s=D1.yellow;let u1=this.connectedClientsStatusExpanded?`${W1} ${_1}`:_1;y.push({child:new G8({child:new y1({text:new i(u1,new J1({color:s}))}),onClick:this.toggleConnectedClientsStatus,cursor:"pointer"}),position:"top-right",offsetX:-2})}let n=q?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:X.mainThread?.env?.initial.trees?.[0]?.uri,$1;if(n)$1=f0.parse(n).fsPath;else $1=process.cwd();let t=this.toHomeRelative($1),p=this.shorten(t),e=!q&&this.currentGitBranch?`${p} (${this.currentGitBranch})`:p;y.push({child:new y1({text:new i(e,new J1({color:Z.foreground,dim:!0}))}),position:"bottom-right"});let F1=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(m2(F1.thread)>0&&!v){let o=[],r=new J1({color:Z.foreground,dim:!0}),l=new i(" · ",r);if(U&&X.mainThread){let W1=nt(X.mainThread);if(W1>0)o.push(new i(NV(W1),r))}if(W){if(o.length>0)o.push(l);let W1=W.totalInputTokens/W.maxInputTokens,_1=Math.round(W1*100),s=Math.max(0,Math.min(_1,100)),u1=T81(W1,W.maxInputTokens),j1=r;if(u1==="danger")j1=new J1({color:Z.destructive});else if(u1==="warning")j1=new J1({color:Z.warning});else if(u1==="recommendation")j1=new J1({color:Y.app.recommendation});o.push(new i(`${s}%`,j1))}if(U&&H){let W1=X.viewState.state==="active"&&X.viewState.inferenceState==="idle",_1=BZ6(H,{isNarrow:!0,isIdle:W1});if(_1){if(o.length>0)o.push(l);let s=r;if(_1.urgency==="warning")s=new J1({color:Z.warning});o.push(new i(_1.text,s))}}if(o.length>0){let W1=new y1({text:new i("",void 0,o)});y.push({child:U?new G8({child:W1,onClick:this.showContextDetailOverlay,cursor:"pointer"}):W1,position:"top-left"})}}return new RS1({leftChild:new a6({child:L}),rightChild1:C,rightChild2:k,maxHeight:V,overlayTexts:y,borderColor:M||!this.isTextfieldAndAutocompleteFocused?D1.index(8):void 0,hasBanner:K,userHeight:this.bottomGridUserHeight,onInitializeHeight:(o)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(o,V)})},onDrag:(o)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(o.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let r=Math.floor(o.localPosition.y)-this.bottomGridDragStartY,l=Math.max(4,this.bottomGridDragStartHeight-r),W1=Math.min(l,V),_1=Math.floor(W1);if(this.bottomGridUserHeight!==_1)this.setState(()=>{this.bottomGridUserHeight=_1})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:!K})}}async function vy1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)o8.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let Y=()=>null,G=!1,V=new nH(G,1000,J.inspectorPort),K=J.features?.find((A)=>A.name==="amp-connect")?.enabled??!1,q=new xk1({threadService:J.threadService,worker:J.worker,builder:(A,E,I,P,C,k)=>{if(Y=C,J.threadDependencies&&K)uj1(J.threadDependencies,J.configService,C,P,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((b)=>{x.error("Failed to start automatic presence:",b)});let y=C(),v={...J,worker:y,threadID:y.thread.id};return new mY6({...v,threadState:E,workerController:I,switchWorker:P,getCurrentWorker:C,recentThreadIDs:k})}}),W=new CS1({configService:J.configService,child:q}),H=new Yk1({configService:J.configService,child:W}),z=new US1(H),U=new Y6({data:KC.fromBaseTheme(I$.default()),child:z});try{await Wj1(U,{onRootElementMounted:(A)=>{if(x.info("TUI input ready for user interaction"),G)V.start(A)}})}finally{if(G)V.stop();if(J.threadDependencies&&K){let{stopGlobalSession:A}=await Promise.resolve().then(() => (pj1(),B36));A()}}let M=Y()?.thread.id||J.threadID,L=await J.threadService.get(M);if(L&&L.messages.length>0){let A=`${J.ampURL.replace(/\/$/,"")}/threads/${M}`;f36(L,A,J.stdout)}}function yy1(J){let Z=DK(J)?.uiHints?.secondaryColor;if(Z)return D1.rgb(Z.r,Z.g,Z.b);return sL8(J)}class uY6 extends c0{props;constructor(J){super();this.props=J}createState(){return new pY6}}class pY6 extends p0{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{todos:Q,controller:Z,appTheme:Y}=this.widget.props;return new R6({crossAxisAlignment:"stretch",children:[new a6({child:new S5({controller:Z,autofocus:!1,child:new vk1({todos:Q})})}),new Y2({controller:Z,thumbColor:Y.app.scrollbarThumb,trackColor:Y.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:X,offset:G}=Z,V=this.viewportHeight,K=X+V;return{totalContentHeight:Math.max(K,0),viewportHeight:Math.max(V,1),scrollOffset:Math.max(G,0)}}})]})}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(Y,X=0)=>{if(Y&&"size"in Y&&"children"in Y){let G=Y.children||[];for(let V of G){if(V&&"size"in V){let q=V.size;if(typeof q?.height==="number"&&q.height>0)return q.height}let K=Q(V,X+1);if(K>0)return K}}return 0},Z=Q(J);if(Z>0)return Z;if("size"in J){let Y=J.size;if(typeof Y?.height==="number"&&Y.height>0)return Y.height}return this.viewportHeight}}class dY6 extends E6{props;constructor(J){super();this.props=J}build(J){return new G8({child:new X0({height:1}),cursor:C9.NS_RESIZE,onDrag:(Q)=>{if(this.props.userHeight===void 0){let Y=J.findRenderObject()?.size.height??0;if(Y>0){this.props.onInitializeHeight(Y);return}}this.props.onDrag(Q)},onRelease:this.props.onRelease})}}function sL8(J){let Q=0;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],Y=Math.abs(Q)%Z.length;return D1.index(Z[Y])}qj1();try{if(process.platform==="win32")await Promise.resolve().then(() => W6(uC(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){h$.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
4701
- `)}var Wv1=qv1.join(mF0||qv1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function MI8(J){process.emitWarning=function(Q,Z,Y,X){let G=typeof Q==="string"?Q:Q.message||String(Q),V=Z||"Warning",K=!1;J.warn(G,{name:V,code:Y})}}function v$(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")DG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")DG("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")DG("model.sonnet",Q.useSonnet)}async function zv1(J){try{await BI8(qv1.dirname(Wv1),{recursive:!0}),await NI8(Wv1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function LI8(){try{return(await NV6(Wv1,"utf-8")).trim()}catch(J){return null}}var FV6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??M$,description:`Custom settings file path (overrides the default location ${M$})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${UC1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:v3(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:kE.SMART.key,description:`Set the agent mode (${_X().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:_X().map((J)=>J.mode)}],UV6=(J)=>("deprecated"in J)&&J.deprecated===!0,AI8=(J)=>("hidden"in J)&&J.hidden===!0,OI8=(J)=>("default"in J),wI8=(J)=>("default"in J)?J.default:void 0;function EI8(J,Q){let Z=Q.args[0],Y=Q.commands.map((G)=>G.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let G=Y.filter((K)=>Z.includes(K)||K.includes(Z)),V="Run amp --help for a list of available commands.";if(G.length>0)V=`Did you mean: ${G.join(", ")}? Or run amp --help for all commands.`;throw new O8(D$.unknownCommand(Z),1,V)}}var DV6=null;function LI5(){return DV6}function Ku(J){return{...J,getThreadEnvironment:C61,vfs:eR0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new rx(J.fileSystem),generateThreadTitle:sa0,deleteThread:(Q)=>J.threadService.delete(Q)}}var Fv1=f0.file(DI8.homedir()),MV6=process.env.XDG_CONFIG_HOME?f0.file(process.env.XDG_CONFIG_HOME):n0.joinPath(Fv1,".config");async function f$(J,Q){SM0("0.0.1764808732-gb9c377");let Z=Qz1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:Q0.of([f0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Fv1,userConfigDir:MV6}),{initializeCLITelemetry:Y}=await Promise.resolve().then(() => (d91(),p91));Y(Z);let X=await Z.getLatest();x.debug("Global configuration initialized",{settingsKeys:Object.keys(X.settings)});let{toolService:G,dispose:V}=Ye0({configService:Z}),K=new Map,q=()=>K.clear(),W=new NB1(Z,J.settings.getWorkspaceRootPath()),H=GR0({configService:Z,trustStore:W,createOAuthProvider:async(t,p,e)=>{let F1=`${t}:${p}`,q1=K.get(F1);if(q1)return x.debug("Reusing existing OAuth provider for server",{serverName:t,serverUrl:p}),q1;x.debug("Creating OAuth provider for server",{serverName:t,serverUrl:p});let o=(async()=>{let r=new UM(J.secrets),l=await r.getClientInfo(t,p),W1=e?.scopes??l?.scopes,_1=new bU1({storage:r,serverName:t,serverUrl:p,clientId:e?.clientId??l?.clientId,clientSecret:e?.clientSecret??l?.clientSecret,scopes:W1});return x.debug("OAuth provider created",{serverName:t,serverUrl:p,hasManualClientId:!!(e?.clientId??l?.clientId),willUseDCR:!(e?.clientId??l?.clientId),scopes:W1}),_1})();return K.set(F1,o),o}}),z=R01({configService:Z,filesystem:n8,spawn:eL}),{initializeToolProviders:U,startToolProviders:D}=await Promise.resolve().then(() => (zV6(),HV6)),M;if(J.executeMode){let t=await U({toolService:G,providers:[H,z],initialTimeout:15000});M=t.registrations;for(let[p,e]of t.initErrors)x.warn(`${p} provider initialization slow or failed:`,e)}else M=D({toolService:G,providers:[H,z]});if(Q.jetbrains)uE("JetBrains");else if(Q.ide&&V96())uE("VS Code");else if(Q.ide&&K96())uE("Neovim");if(J.executeMode)_M0(!0);let L,A=$3.status.pipe(Q6((t)=>Boolean(t.connected&&t.authenticated)),N4()).subscribe((t)=>{if(t){if(!L)L=G.registerTool(rr0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new g61(process.cwd(),{},!0);else E=new class extends g61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(D5.write(`No API key found. Starting login flow...
4701
+ `)}var Wv1=qv1.join(mF0||qv1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function MI8(J){process.emitWarning=function(Q,Z,Y,X){let G=typeof Q==="string"?Q:Q.message||String(Q),V=Z||"Warning",K=!1;J.warn(G,{name:V,code:Y})}}function v$(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")DG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")DG("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")DG("model.sonnet",Q.useSonnet)}async function zv1(J){try{await BI8(qv1.dirname(Wv1),{recursive:!0}),await NI8(Wv1,J,"utf-8")}catch(Q){x.debug("Failed to save last thread ID",Q)}}async function LI8(){try{return(await NV6(Wv1,"utf-8")).trim()}catch(J){return null}}var FV6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??M$,description:`Custom settings file path (overrides the default location ${M$})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(x).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${UC1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:v3(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:kE.SMART.key,description:`Set the agent mode (${_X().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:_X().map((J)=>J.mode)}],UV6=(J)=>("deprecated"in J)&&J.deprecated===!0,AI8=(J)=>("hidden"in J)&&J.hidden===!0,OI8=(J)=>("default"in J),wI8=(J)=>("default"in J)?J.default:void 0;function EI8(J,Q){let Z=Q.args[0],Y=Q.commands.map((G)=>G.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let G=Y.filter((K)=>Z.includes(K)||K.includes(Z)),V="Run amp --help for a list of available commands.";if(G.length>0)V=`Did you mean: ${G.join(", ")}? Or run amp --help for all commands.`;throw new O8(D$.unknownCommand(Z),1,V)}}var DV6=null;function LI5(){return DV6}function Ku(J){return{...J,getThreadEnvironment:C61,vfs:eR0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new rx(J.fileSystem),generateThreadTitle:sa0,deleteThread:(Q)=>J.threadService.delete(Q)}}var Fv1=f0.file(DI8.homedir()),MV6=process.env.XDG_CONFIG_HOME?f0.file(process.env.XDG_CONFIG_HOME):n0.joinPath(Fv1,".config");async function f$(J,Q){SM0("0.0.1764811816-g233bde");let Z=Qz1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:Q0.of([f0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Fv1,userConfigDir:MV6}),{initializeCLITelemetry:Y}=await Promise.resolve().then(() => (d91(),p91));Y(Z);let X=await Z.getLatest();x.debug("Global configuration initialized",{settingsKeys:Object.keys(X.settings)});let{toolService:G,dispose:V}=Ye0({configService:Z}),K=new Map,q=()=>K.clear(),W=new NB1(Z,J.settings.getWorkspaceRootPath()),H=GR0({configService:Z,trustStore:W,createOAuthProvider:async(t,p,e)=>{let F1=`${t}:${p}`,q1=K.get(F1);if(q1)return x.debug("Reusing existing OAuth provider for server",{serverName:t,serverUrl:p}),q1;x.debug("Creating OAuth provider for server",{serverName:t,serverUrl:p});let o=(async()=>{let r=new UM(J.secrets),l=await r.getClientInfo(t,p),W1=e?.scopes??l?.scopes,_1=new bU1({storage:r,serverName:t,serverUrl:p,clientId:e?.clientId??l?.clientId,clientSecret:e?.clientSecret??l?.clientSecret,scopes:W1});return x.debug("OAuth provider created",{serverName:t,serverUrl:p,hasManualClientId:!!(e?.clientId??l?.clientId),willUseDCR:!(e?.clientId??l?.clientId),scopes:W1}),_1})();return K.set(F1,o),o}}),z=R01({configService:Z,filesystem:n8,spawn:eL}),{initializeToolProviders:U,startToolProviders:D}=await Promise.resolve().then(() => (zV6(),HV6)),M;if(J.executeMode){let t=await U({toolService:G,providers:[H,z],initialTimeout:15000});M=t.registrations;for(let[p,e]of t.initErrors)x.warn(`${p} provider initialization slow or failed:`,e)}else M=D({toolService:G,providers:[H,z]});if(Q.jetbrains)uE("JetBrains");else if(Q.ide&&V96())uE("VS Code");else if(Q.ide&&K96())uE("Neovim");if(J.executeMode)_M0(!0);let L,A=$3.status.pipe(Q6((t)=>Boolean(t.connected&&t.authenticated)),N4()).subscribe((t)=>{if(t){if(!L)L=G.registerTool(rr0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new g61(process.cwd(),{},!0);else E=new class extends g61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(D5.write(`No API key found. Starting login flow...
4702
4702
  `),!await II8(J))await OA(),process.exit(1)}let I=await Sj0({isDevelopment:!1}),P=new BP1(I,Z),C=new HP1(I,{lazy:!0}),k=new TB1(P,(t,p)=>{let e=J2.get(t);if(e)e.handle(p).catch((F1)=>{x.error("Failed to apply artifact delta",F1)})}),y=Q.notifications!==void 0?Q.notifications:!J.executeMode,v=$e0({playNotificationSound:async(t)=>{if(y){Xe0(t);let p=Vj1(),e=Kj1();if((!p||e)&&X.settings["notifications.system.enabled"]!==!1){if(t==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(t==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:P,configService:Z});x.info("Starting Amp background services");let b=ea0({threadService:P,threadHistoryService:C,configService:Z,isExtensionDevelopment:!1}),d;$3.status.subscribe((t)=>{d=t});let m=new u$1({workspaceRoots:[f0.file(process.cwd())],getCurrentFile:()=>{if(!d?.openFile)return;try{return f0.parse(d.openFile)}catch(t){x.warn("Failed to parse current file URI",{uri:d.openFile,error:t});return}},getOpenFiles:()=>{if(!d?.visibleFiles?.length)return[];let t=d.openFile;return d.visibleFiles.filter((p)=>p!==t).map((p)=>{try{return f0.parse(p)}catch(e){return x.warn("Failed to parse visible file URI",{uri:p,error:e}),null}}).filter((p)=>p!==null)}}),n=new Hj1,$1={codebaseContextService:m,configService:Z,toolService:G,mcpService:H,trustStore:W,threadService:P,threadHistoryService:C,threadSyncService:b,planFileManager:k,threadStorage:I,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:E,notificationService:v,fileSystem:Q.jetbrains||Q.ide?rR0:n8,terminal:n};return{...$1,async asyncDispose(){if($1.mcpService.hasAuthenticatingClients())x.info("Waiting for OAuth authentication to complete before exit..."),await $1.mcpService.waitForAuthentication();for(let t of M.values())t.dispose();await $1.mcpService.dispose(),q(),await $1.threadService.asyncDispose(),$1.configService.unsubscribe(),V(),$1.fuzzyServer.dispose(),$1.threadSyncService.dispose(),$1.settingsStorage[Symbol.dispose](),A.unsubscribe(),L?.dispose()}}}async function II8(J){if(!J.executeMode){if(!await gC1("Would you like to log in to Amp? [(y)es, (n)o]: "))return D5.write(`Login cancelled. Run the command again to retry.
4703
4703
  `),!1}return await LV6(J)}async function LV6(J){let Q=UI8(32).toString("hex"),Z=await bC1(J.ampURL,Q),Y=new AbortController;try{await CW(Z,Y.signal)}catch(G){x.error("Error opening browser",{error:G})}let X=await bC1(J.ampURL,Q,!1);D5.write(`If your browser does not open automatically, visit:
4704
4704
 
@@ -4708,7 +4708,7 @@ ${k4.blue.bold(X)}
4708
4708
  Login successful! You can now use the Amp CLI.
4709
4709
  `),!0}catch(G){return x.error("Login failed",{error:G}),h$.write(`
4710
4710
  Login failed: ${G instanceof Error?G.message:String(G)}
4711
- `),!1}}function PI8(){let J=new qA().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)RR(),process.exit(0);let z=H.originalError??H;Q86(z)}),J.option("-V, --version","Print the version number and exit",()=>{D5.write(`0.0.1764808732-gb9c377 (released 2025-12-04T00:44:17.586Z)
4711
+ `),!1}}function PI8(){let J=new qA().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)RR(),process.exit(0);let z=H.originalError??H;Q86(z)}),J.option("-V, --version","Print the version number and exit",()=>{D5.write(`0.0.1764811816-g233bde (released 2025-12-04T01:35:51.954Z)
4712
4712
  `),process.exit(0)}),J.addHelpText("after",X96()),J.configureHelp({formatHelp:$96}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),D=await nQ(U);await jI8(D)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),D=await nQ(U);await CI8(D,await RC1(U,D.settings))});let Q=async(H,z,U)=>{Qz1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:Q0.of([f0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:Fv1,userConfigDir:MV6});let D={...z,executeMode:!1};await Hv1(D,{...H,openThreadSwitcher:!0},U)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let U=z.optsWithGlobals(),D=await nQ(U);await BV6(U,D,z)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let U=z.optsWithGlobals(),D=await nQ(U);await fI8(U,D,z)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,U)=>{let D=U.optsWithGlobals(),M=await nQ(D);if(z.pick)h$.write(`${k4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
4713
4713
  `);if(z.last||H||M.executeMode)await vI8(D,M,H,U);else await Q(D,M,U)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(H,z,U)=>{let D=U.optsWithGlobals(),M=await nQ(D);await xI8(D,M,H,U)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(H,z)=>{let U=z.optsWithGlobals(),D=await nQ(U);await BV6(U,D,z)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,U)=>{let D=U.optsWithGlobals(),M=await nQ(D);await yI8(D,M,H,U,z.support)}),Z.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,U,D)=>{let M=D.optsWithGlobals(),L=await nQ(M);await SI8(M,L,H,z,D)}),Z.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,U)=>{let D=U.optsWithGlobals(),M=await nQ(D);await _I8(D,M,H,U)}),Z.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,U)=>{let D=U.optsWithGlobals(),M=await nQ(D);await kI8(D,M,H,z,U)}),a56(J,async(H,z)=>{let U=await nQ(z);v$(H,z);let D=await f$(U,z);return{context:U,mcpService:D.mcpService,toolService:D.toolService,toolServices:D.toolService,configService:D.configService,cleanupTerminal:RR,asyncDispose:D.asyncDispose.bind(D)}}),p96(J,async(H)=>{let z=H.optsWithGlobals();return await nQ(z)}),k96(J,async(H)=>{let z=await nQ(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{v$(U,H);let D=await f$(z,H);return{mcpService:D.mcpService,settings:z.settings,asyncDispose:D.asyncDispose.bind(D)}}}});function X(H,z,U){let M=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),L=new Dq(z,M),A=wI8(H);if(A)L.default(A);if(L.hidden=AI8(H)||UV6(H),"choices"in H)L.choices([...H.choices]);return L}for(let H of FV6)switch(H.type){case"flag":{J.addOption(X(H,`--${H.long}`)),J.addOption(X(H,`--no-${H.long}`,!1));break}case"switch":{J.addOption(X(H,`--${H.long}`,!0));break}default:{J.addOption(X(H,`${"short"in H?`-${H.short}, `:""}--${H.long} <value>`));break}}let G=new Dq("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(G);let V=new Dq("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(V);let K=new Dq("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);J.addOption(K);let q=new Dq("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(q);let W=new Dq("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(W),process.env.AMP_CONNECT==="1"){let H=new Dq("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return Q76(J),J.action(async(H,z)=>{let U=H,D=await nQ(U);if(z.getOptionValueSourceWithGlobals("tryOpus")==="cli")D5.write(k4.yellow(`Opus 4.5 is now the default in Amp's smart mode. Rerun without --try-opus.
4714
4714
  `)),process.exit(0);if(Object.keys(U).forEach((L)=>{let A=FV6.find((E)=>E.name===L);if(A&&UV6(A)&&!OI8(A))h$.write(k4.yellow(`Warning: '--${L}' flag is deprecated
@@ -4716,8 +4716,8 @@ Login failed: ${G instanceof Error?G.message:String(G)}
4716
4716
  Or pipe via stdin: echo "your message" | amp --execute`);v$(Z,Q);let V=await f$(J,Q);DV6=V;let K=Ku(V),q=async(n)=>{let $1=await NV6(n,"utf-8"),t=JSON.parse($1);if(!OG(t.id))throw new O8(D$.invalidThreadId);return _51(V,{visibility:Y,agentMode:Q.mode,thread:t})},W=async(n)=>{if(!OG(n))throw new O8(D$.invalidThreadId);try{let[t,p]=await Promise.all([X5.getThreadLinkInfo({thread:n},{config:V.configService}),X5.getUserInfo({},{config:V.configService})]);if(t.ok&&p.ok){let e=t.result.creatorUserID,F1=p.result.id;if(e&&e!==F1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new O8(`Cannot resume thread created by another user.
4717
4717
 
4718
4718
  This thread belongs to a different user and cannot be continued for security reasons. Set AMP_RESUME_OTHER_USER_THREADS_INSECURE=1 to bypass this check.`)}}catch(t){if(t instanceof O8)throw t;x.warn("Failed to validate thread ownership in CLI, allowing to open",{error:t})}let $1=await V.threadService.get(n)??void 0;return x.info(`[fetchAndStartThread] Loaded thread ${n}, agentMode: ${$1?.agentMode??"undefined"}`),_51(V,{visibility:Y,agentMode:$1?void 0:Q.mode,thread:$1})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return _51(V,{visibility:Y,agentMode:Q.mode})}catch(n){if(n instanceof O8)throw n;throw await jg(n,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return _51(V,{visibility:Y,agentMode:Q.mode})};if(Q.format==="jsonl")h$.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
4719
- `),await OA(),process.exit(1);if(J.executeMode&&Q.remote)await d96(X,G,V.configService),await V.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)v96(V.mcpService,J.settings),await N86(U,U.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await V.asyncDispose(),process.exit(0);let D=!1,M=!1;if(Q.jetbrains||Q.ide){await lM0();let n=cE({jetbrainsOnly:Q.jetbrains});if(n.length===0){if(Q.jetbrains)M=!await V.configService.get("jetbrains.skipInstall")}else if(n.length===1){let $1=n[0];if($1)$3.selectConfig($1)}else D=!0}let L=a61("0.0.1764808732-gb9c377",V.settingsStorage),A=new Q01(V.threadStorage),E=Q0.of([f0.file(process.cwd())]),I=t$1(void 0,E),P=new o61(V.mcpService,J.settings.getWorkspaceRootPath());if(X)U.handle({type:"user:message",message:{content:[{type:"text",text:X}]}});let C=(async()=>{try{let n=await X5.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(5000)});if(n.ok)return x.info("User free tier status:",n),n.result}catch(n){x.error("Failed to fetch free tier status:",n)}})(),k=(async()=>{try{let n=await X5.getUserInfo({},{config:V.configService});if(n.ok)return n.result}catch(n){x.debug("Failed to fetch user workspace info:",n)}})(),[y,v]=await Promise.all([C,k]),b=v?.email,d=b&&(b.endsWith("@sourcegraph.com")||b.endsWith("@ampcode.com")||b==="auth-bypass-user@example.com"),m=await n96();x.info("Loaded session state:",m),await vy1({codebaseContextService:V.codebaseContextService,stdout:process.stdout,history:new k61,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,threadHistoryService:V.threadHistoryService,threadSyncService:V.threadSyncService,planFileManager:V.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:K,configService:V.configService,internalAPIClient:X5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:$3,connectedClientsService:new _n,commandRegistry:I,mcpService:V.mcpService,mcpTrustHandler:P,showJetBrainsInstaller:M,showIdePicker:D,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:m,freeTierStatus:y,workspace:v?.team??null,features:v?.features??[],isDogfooding:d||!1,threadDependencies:V,initialAgentMode:Z.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0}),await V.asyncDispose(),process.exit(0)}async function nQ(J){if(J.interactive)h$.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4720
- `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,Y=await p86({...J,workspaceTrust:{current:!0,changes:l_},getHook:process.env.AMP_URL?(G,V)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return V()}:void 0});if(J.mcpConfig){let G=await y96(J.mcpConfig);Y=x96(Y,G)}let X=await Y.get("url","global");if(!X)X=GZ;if(!BF(X))x.info("Targeting custom Amp server",{ampURL:X});return Y=gU0(Y),{executeMode:Q,isTTY:Z,ampURL:X,settings:Y,secrets:c96(await RC1(J,Y))}}function TI8(J){let Q={};for(let Z=0;Z<J.length;Z++){let Y=J[Z];if(Y?.startsWith("--")){let G=Y.slice(2).replace(/-([a-z])/g,(K,q)=>q.toUpperCase()),V=J[Z+1];if(V&&!V.startsWith("--"))Q[G]=V,Z++}}return Q}async function RI8(){let J=TI8(process.argv);if(i46({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),MI8(x),x.info("Starting Amp CLI.",{version:"0.0.1764808732-gb9c377",buildTimestamp:"2025-12-04T00:44:17.586Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new O8(D$.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await PI8().parseAsync(process.argv)}XP1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await RI8().catch(jg)});async function CI8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),D5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4719
+ `),await OA(),process.exit(1);if(J.executeMode&&Q.remote)await d96(X,G,V.configService),await V.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)v96(V.mcpService,J.settings),await N86(U,U.threadID,X,G,V,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await V.asyncDispose(),process.exit(0);let D=!1,M=!1;if(Q.jetbrains||Q.ide){await lM0();let n=cE({jetbrainsOnly:Q.jetbrains});if(n.length===0){if(Q.jetbrains)M=!await V.configService.get("jetbrains.skipInstall")}else if(n.length===1){let $1=n[0];if($1)$3.selectConfig($1)}else D=!0}let L=a61("0.0.1764811816-g233bde",V.settingsStorage),A=new Q01(V.threadStorage),E=Q0.of([f0.file(process.cwd())]),I=t$1(void 0,E),P=new o61(V.mcpService,J.settings.getWorkspaceRootPath());if(X)U.handle({type:"user:message",message:{content:[{type:"text",text:X}]}});let C=(async()=>{try{let n=await X5.getUserFreeTierStatus({},{config:V.configService,signal:AbortSignal.timeout(5000)});if(n.ok)return x.info("User free tier status:",n),n.result}catch(n){x.error("Failed to fetch free tier status:",n)}})(),k=(async()=>{try{let n=await X5.getUserInfo({},{config:V.configService});if(n.ok)return n.result}catch(n){x.debug("Failed to fetch user workspace info:",n)}})(),[y,v]=await Promise.all([C,k]),b=v?.email,d=b&&(b.endsWith("@sourcegraph.com")||b.endsWith("@ampcode.com")||b==="auth-bypass-user@example.com"),m=await n96();x.info("Loaded session state:",m),await vy1({codebaseContextService:V.codebaseContextService,stdout:process.stdout,history:new k61,fuzzyServer:V.fuzzyServer,settingsStorage:V.settingsStorage,threadService:V.threadService,threadHistoryService:V.threadHistoryService,threadSyncService:V.threadSyncService,planFileManager:V.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:K,configService:V.configService,internalAPIClient:X5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:$3,connectedClientsService:new _n,commandRegistry:I,mcpService:V.mcpService,mcpTrustHandler:P,showJetBrainsInstaller:M,showIdePicker:D,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:m,freeTierStatus:y,workspace:v?.team??null,features:v?.features??[],isDogfooding:d||!1,threadDependencies:V,initialAgentMode:Z.getOptionValueSourceWithGlobals("mode")==="cli"?Q.mode:void 0}),await V.asyncDispose(),process.exit(0)}async function nQ(J){if(J.interactive)h$.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4720
+ `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,Y=await p86({...J,workspaceTrust:{current:!0,changes:l_},getHook:process.env.AMP_URL?(G,V)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return V()}:void 0});if(J.mcpConfig){let G=await y96(J.mcpConfig);Y=x96(Y,G)}let X=await Y.get("url","global");if(!X)X=GZ;if(!BF(X))x.info("Targeting custom Amp server",{ampURL:X});return Y=gU0(Y),{executeMode:Q,isTTY:Z,ampURL:X,settings:Y,secrets:c96(await RC1(J,Y))}}function TI8(J){let Q={};for(let Z=0;Z<J.length;Z++){let Y=J[Z];if(Y?.startsWith("--")){let G=Y.slice(2).replace(/-([a-z])/g,(K,q)=>q.toUpperCase()),V=J[Z+1];if(V&&!V.startsWith("--"))Q[G]=V,Z++}}return Q}async function RI8(){let J=TI8(process.argv);if(i46({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),MI8(x),x.info("Starting Amp CLI.",{version:"0.0.1764811816-g233bde",buildTimestamp:"2025-12-04T01:35:51.954Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new O8(D$.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await PI8().parseAsync(process.argv)}XP1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await RI8().catch(jg)});async function CI8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),D5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4721
4721
  `);else if(!BF(J.ampURL))D5.write(`Logging in to ${new URL(J.ampURL).hostname}
4722
4722
  `);let Z=process.env.AMP_API_KEY;if(Z)D5.write(`API key found in environment variable, storing...
4723
4723
  `),await Q.set("apiKey",Z,J.ampURL),D5.write(`API key successfully stored.
@@ -4730,7 +4730,7 @@ This thread belongs to a different user and cannot be continued for security rea
4730
4730
  `);else D5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
4731
4731
  `);process.exit(0)}async function SI8(J,Q,Z,Y,X){v$(X,J);let G=await f$(Q,J);try{let V=k51(Z);if(!V)y51(Z);let K=V,q=Y.trim();if(q.length===0)x$("Thread name cannot be empty");if(q.length>256)x$("Thread name cannot exceed 256 characters");if(!(await pC(K,G)).messages.length)x$("Cannot rename an empty thread.");let H=Ku(G);await(await J2.getOrCreateForThread(H,K)).handle({type:"title",value:q}),x.info("GOT HERE"),await G.threadSyncService.sync(),x.info("GOT THERE"),D5.write(k4.green(`✓ Thread ${K} renamed to "${q}"
4732
4732
  `)),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose();let K=`Failed to rename thread: ${V instanceof Error?V.message:String(V)}`;x$(K)}}async function _I8(J,Q,Z,Y){v$(Y,J);let X=await f$(Q,J);try{let G=k51(Z);if(!G)y51(Z);let K=await pC(G,X),q=YR(K);D5.write(q+`
4733
- `),await X.asyncDispose(),process.exit(0)}catch(G){await X.asyncDispose();let V=`Failed to render thread as markdown: ${G instanceof Error?G.message:String(G)}`;x$(V)}}async function kI8(J,Q,Z,Y,X){v$(X,J);let G=await f$(Q,J);try{let V=await Uv1(Z),K=await pC(V,G),q=Y.typing!==!1,W=parseInt(Y.wpm||"120",10),H=parseInt(Y.messageDelay||"1000",10),z=parseInt(Y.toolProgressDelay||"800",10),U=parseInt(Y.exitDelay||"3",10)*1000,D=Y.indicator!==!1,M=Ku(G),L=K.id;await G.threadStorage.set(L,K);let A=await J2.getOrCreateForThread(M,L);await A.resume();let E=J01.fromWorker(A),I=new Q01(G.threadStorage),P=Q0.of([f0.file(process.cwd())]),C=t$1(void 0,P),k=new o61(G.mcpService,Q.settings.getWorkspaceRootPath()),y=a61("0.0.1764808732-gb9c377",G.settingsStorage);await vy1({codebaseContextService:G.codebaseContextService,stdout:process.stdout,history:new k61,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadHistoryService:G.threadHistoryService,threadSyncService:G.threadSyncService,planFileManager:G.planFileManager,threadID:L,threadFuzzyIndexer:I,worker:E,workerDeps:M,configService:G.configService,internalAPIClient:X5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:$3,connectedClientsService:new _n,commandRegistry:C,mcpService:G.mcpService,mcpTrustHandler:k,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:K,typingEnabled:q,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:D}}),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),await jg(V,Z)}}async function yI8(J,Q,Z,Y,X){v$(Y,J);let G=await f$(Q,J);try{let V=k51(Z);if(!V)y51(Z);let K=V,q=await X5.getUserInfo({},{config:G.configService}),W=q.ok?q.result:null,H=r61(J,W);if(!H&&!X)x$("Must specify either --visibility or --support");if(H&&X)x$("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)x$(H.message);if(H)await G.threadSyncService.updateThreadMeta(K,s61(H)),D5.write(k4.green("✓ ")+`Thread ${K} visibility changed to ${H}.
4733
+ `),await X.asyncDispose(),process.exit(0)}catch(G){await X.asyncDispose();let V=`Failed to render thread as markdown: ${G instanceof Error?G.message:String(G)}`;x$(V)}}async function kI8(J,Q,Z,Y,X){v$(X,J);let G=await f$(Q,J);try{let V=await Uv1(Z),K=await pC(V,G),q=Y.typing!==!1,W=parseInt(Y.wpm||"120",10),H=parseInt(Y.messageDelay||"1000",10),z=parseInt(Y.toolProgressDelay||"800",10),U=parseInt(Y.exitDelay||"3",10)*1000,D=Y.indicator!==!1,M=Ku(G),L=K.id;await G.threadStorage.set(L,K);let A=await J2.getOrCreateForThread(M,L);await A.resume();let E=J01.fromWorker(A),I=new Q01(G.threadStorage),P=Q0.of([f0.file(process.cwd())]),C=t$1(void 0,P),k=new o61(G.mcpService,Q.settings.getWorkspaceRootPath()),y=a61("0.0.1764811816-g233bde",G.settingsStorage);await vy1({codebaseContextService:G.codebaseContextService,stdout:process.stdout,history:new k61,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadHistoryService:G.threadHistoryService,threadSyncService:G.threadSyncService,planFileManager:G.planFileManager,threadID:L,threadFuzzyIndexer:I,worker:E,workerDeps:M,configService:G.configService,internalAPIClient:X5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:$3,connectedClientsService:new _n,commandRegistry:C,mcpService:G.mcpService,mcpTrustHandler:k,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:K,typingEnabled:q,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:D}}),await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),await jg(V,Z)}}async function yI8(J,Q,Z,Y,X){v$(Y,J);let G=await f$(Q,J);try{let V=k51(Z);if(!V)y51(Z);let K=V,q=await X5.getUserInfo({},{config:G.configService}),W=q.ok?q.result:null,H=r61(J,W);if(!H&&!X)x$("Must specify either --visibility or --support");if(H&&X)x$("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)x$(H.message);if(H)await G.threadSyncService.updateThreadMeta(K,s61(H)),D5.write(k4.green("✓ ")+`Thread ${K} visibility changed to ${H}.
4734
4734
  `);if(X){await pC(K,G);let z=typeof X==="string"?X:void 0;await Ij0(G.threadService,K,G.configService,z),D5.write(k4.green("✓ ")+`Thread ${K} has been shared with Amp support. These thread reports will be aggregated and analysed.
4735
4735
  `)}await G.asyncDispose(),process.exit(0)}catch(V){await G.asyncDispose(),x$(`Failed to update thread: ${V instanceof Error?V.message:String(V)}`)}}async function xI8(J,Q,Z,Y){v$(Y,J);let X=await f$(Q,J),G=Ku(X);try{let V=await Uv1(Z),q=(await pC(V,X)).messages.length-1,W=await J2.getOrCreateForThread(G,V),H=await $R(W,X.threadSyncService,q);await Promise.all([X.threadSyncService.uploadThread(V),X.threadSyncService.uploadThread(H)]),await zv1(H),D5.write(`${H}
4736
4736
  `),await X.asyncDispose(),process.exit(0)}catch(V){h$.write(`Error forking thread: ${V instanceof Error?V.message:String(V)}