@sourcegraph/amp 0.0.1760933153-gfb8d21 → 0.0.1760950038-g7a3f50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +9 -9
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-warnings
|
|
2
2
|
import{createRequire as pF6}from"node:module";var hF6=Object.create;var{getPrototypeOf:gF6,defineProperty:gC,getOwnPropertyNames:Au1,getOwnPropertyDescriptor:mF6}=Object,wu1=Object.prototype.hasOwnProperty;var m6=(J,Q,Z)=>{Z=J!=null?hF6(gF6(J)):{};let X=Q||!J||!J.__esModule?gC(Z,"default",{value:J,enumerable:!0}):Z;for(let Y of Au1(J))if(!wu1.call(X,Y))gC(X,Y,{get:()=>J[Y],enumerable:!0});return X},Lu1=new WeakMap,uF6=(J)=>{var Q=Lu1.get(J),Z;if(Q)return Q;if(Q=gC({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function")Au1(J).map((X)=>!wu1.call(Q,X)&&gC(Q,X,{get:()=>J[X],enumerable:!(Z=mF6(J,X))||Z.enumerable}));return Lu1.set(J,Q),Q},a=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var R6=(J,Q)=>{for(var Z in Q)gC(J,Z,{get:Q[Z],enumerable:!0,configurable:!0,set:(X)=>Q[Z]=()=>X})};var B1=(J,Q)=>()=>(J&&(Q=J(J=0)),Q);var i1=pF6(import.meta.url);function up(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function Ru1(J){let Q=J._cleanup;if(Q===void 0)return;if(J._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(Z){console.error("cleanupSubscription",Z)}}function sJ1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function dF6(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Z of Q)if(Ou1(J,Z.type,Z.value),J._state==="closed")break}function Ou1(J,Q,Z){J._state="running";let X=J._observer;try{switch(Q){case"next":if(X&&typeof X.next==="function")X.next(Z);break;case"error":if(sJ1(J),X&&typeof X.error==="function")X.error(Z);else throw Z;break;case"complete":if(sJ1(J),X&&typeof X.complete==="function")X.complete();break}}catch(Y){console.error("notifySubscription",Y)}if(J._state==="closed")Ru1(J);else if(J._state==="running")J._state="ready"}function rJ1(J,Q,Z){if(J._state==="closed")return;if(J._state==="buffering"){J._queue=J._queue||[],J._queue.push({type:Q,value:Z});return}if(J._state!=="ready"){J._state="buffering",J._queue=[{type:Q,value:Z}],up(()=>dF6(J));return}Ou1(J,Q,Z)}class ju1{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Z=new $u1(this);try{this._cleanup=Q.call(void 0,Z)}catch(X){Z.error(X)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")sJ1(this),Ru1(this)}}class $u1{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){rJ1(this._subscription,"next",J)}error(J){rJ1(this._subscription,"error",J)}complete(){rJ1(this._subscription,"complete")}}function G4(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class SR{_baseObserver;_pendingPromises;constructor(J){this._baseObserver=J,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((J)=>this._baseObserver.error(J))}error(J){this._baseObserver.error(J)}schedule(J){let Q=Promise.all(this._pendingPromises),Z=[],X=(K)=>Z.push(K),Y=Promise.resolve().then(async()=>{await Q,await J(X),this._pendingPromises.delete(Y);for(let K of Z)this._baseObserver.next(K)}).catch((K)=>{this._pendingPromises.delete(Y),this._baseObserver.error(K)});this._pendingPromises.add(Y)}}function oJ1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function tJ1(J){if(oJ1(J))return J;return e1.of(J)}var e1;var vR=B1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");e1=class e1{_subscriber;constructor(J){if(!(this instanceof e1))throw TypeError("Observable cannot be called as a function");if(typeof J!=="function")throw TypeError("Observable initializer must be a function");this._subscriber=J}subscribe(J,Q,Z){if(typeof J!=="object"||J===null)J={next:J,error:Q,complete:Z};return new ju1(J,this._subscriber)}pipe(J,...Q){let Z=this;for(let X of[J,...Q])Z=X(Z);return Z}[Symbol.observable](){return this}static from(J){let Q=typeof this==="function"?this:e1;if(J==null)throw TypeError(J+" is not an object");let Z=J[Symbol.observable];if(typeof Z==="function"){let Y=Z.call(J);if(Object(Y)!==Y)throw TypeError(Y+" is not an object");if(Y instanceof e1)return Y;return new Q((K)=>Y.subscribe(K))}let X=J[Symbol.iterator];if(typeof X==="function")return new Q((Y)=>{up(()=>{if(Y.closed)return;for(let K of X.call(J))if(Y.next(K),Y.closed)return;Y.complete()})});if(Array.isArray(J))return new Q((Y)=>{up(()=>{if(Y.closed)return;for(let K of J)if(Y.next(K),Y.closed)return;Y.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof this==="function"?this:e1)((Z)=>{up(()=>{if(Z.closed)return;for(let X of J)if(Z.next(X),Z.closed)return;Z.complete()})})}static get[Symbol.species](){return this}}});var b8,o2;var pp=B1(()=>{vR();b8=class b8 extends e1{_observers=new Set;constructor(){super((J)=>{return this._observers.add(J),()=>this._observers.delete(J)})}next(J){for(let Q of this._observers)Q.next(J)}error(J){for(let Q of this._observers)Q.error(J)}complete(){for(let J of this._observers)J.complete()}};o2=class o2 extends b8{currentValue;constructor(J){super();this.currentValue=J}next(J){this.currentValue=J,super.next(J)}subscribe(J,Q,Z){if(typeof J!=="object"||J===null){let X={};if(J)X.next=J;if(Q)X.error=Q;if(Z)X.complete=Z;J=X}return J.next?.(this.currentValue),super.subscribe(J)}getValue(){return this.currentValue}}});var eJ1,mC;var Eu1=B1(()=>{vR();pp();eJ1=class eJ1 extends Set{subject=new o2(this);add(J){return super.add(J),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return e1.from(this.subject)}dispose(){this.subject.complete()}};mC=class mC extends Map{subject=new o2(this);set(J,Q){return super.set(J,Q),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return e1.from(this.subject)}dispose(){this.subject.complete()}}});function dp(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Z=Array.isArray(J),X=Array.isArray(Q);if(Z!==X)return!1;if(Z&&X)return J.length===Q.length&&J.every((K,q)=>dp(K,Q[q]));let Y=new Set([...Object.keys(J),...Object.keys(Q)]);for(let K of Y)if(!dp(J[K],Q[K]))return!1;return!0}function JQ1(J){return{dispose:J.unsubscribe.bind(J)}}async function J6(J,Q){return new Promise((Z,X)=>{let Y=void 0,K=()=>{Y?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",K,{once:!0}),Y=J.subscribe({next:(q)=>{Y?.unsubscribe(),Q?.removeEventListener("abort",K),Z(q)},error:(q)=>{Q?.removeEventListener("abort",K),X(q)},complete:()=>{Q?.removeEventListener("abort",K),X("Observable completed without emitting a value")}})})}async function GB(J,Q){return new Promise((Z,X)=>{let Y,K=!1,q=void 0,G=()=>{q?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",G,{once:!0}),q=J.subscribe({next:(z)=>{Y=z,K=!0},error:(z)=>{Q?.removeEventListener("abort",G),X(z)},complete:()=>{if(Q?.removeEventListener("abort",G),K)Z(Y);else X("Observable completed without emitting a value")}})})}function j7(J){return new e1((Q)=>{J.then((Z)=>{Q.next(Z),Q.complete()}).catch((Z)=>{Q.error(Z)})})}function d6(J){return new e1((Q)=>{let Z=!1,X=new AbortController,Y=X.signal;return(async()=>{try{Y?.throwIfAborted();let q=await J(Y);if(Y?.throwIfAborted(),!Z)Q.next(q),Q.complete()}catch(q){if(!Z)if(Y.aborted)Q.complete();else Q.error(q)}})(),()=>{Z=!0,X.abort()}})}function C0(J){return(Q)=>{return new e1((Z)=>{let X=new SR(Z),Y=0,K=Q.subscribe({complete(){X.complete()},error(q){X.error(q)},next(q){X.schedule(async(G)=>{let z=await J(q,Y);Y++,G(z)})}});return()=>G4(K)})}}function cp(J){return new e1((Q)=>{let Z=0,X=setInterval(()=>{Q.next(Z++)},J);return()=>clearInterval(X)})}function uC(...J){return new e1((Q)=>{let Z=0,X=J.map((Y)=>Y.subscribe({next:(K)=>Q.next(K),error:(K)=>Q.error(K),complete:()=>{if(Z++,Z===J.length)Q.complete()}}));return()=>{Pu1(X)}})}function S9(...J){if(J.length===0)return QQ1;return new e1((Q)=>{let Z=Array(J.length),X=Array(J.length).fill(0),Y=Array(J.length).fill(!1),K=0,q=[],G=new SR(Q);for(let z=0;z<J.length;z++){let U=J[z];q.push(U.subscribe({next(F){Z[z]=F,Y[z]=!0;let W=++X[z];if(Y.every(Boolean))G.schedule(async(H)=>{if(X[z]===W)H([...Z])})},error(F){G.error(F)},complete(){if(K++,K===J.length)G.complete()}}))}return()=>{Pu1(q)}})}function M9(J){let Z=J?.shouldCountRefs??!0,X=cF6++,Y=(K,...q)=>{};return(K)=>{let q=new b8,G=null,z=!1,U,F=0;return new e1((W)=>{if(F++,z)Y("new subscriber, emitting buffered value",U),W.next(U);else Y("new subscriber, no buffered value to emit");if(!G)G=K.subscribe({next:(B)=>{z=!0,U=B,q.next(B)},error:(B)=>q.error(B),complete:()=>q.complete()});let H=q.subscribe(W);return()=>{if(F--,H.unsubscribe(),Z&&F===0){if(G)G4(G),G=null;z=!1}}})}}function Pu1(J){for(let Q of J)if(Q)G4(Q)}function kR(J){return(Q)=>{return new e1((Z)=>{let X=Q.subscribe({next:(K)=>Z.next(K),error:(K)=>Z.error(K),complete:()=>Z.complete()}),Y=J.subscribe({next:()=>{Z.complete(),X.unsubscribe(),Y.unsubscribe()},error:(K)=>{Z.error(K),X.unsubscribe()}});return()=>{X.unsubscribe(),Y.unsubscribe()}})}}function nK(J){return(Q)=>{return new e1((Z)=>{let X,Y=Q.subscribe({next(K){X=K,Z.next(K)},error(K){Z.error(K)},complete(){Z.complete()}});return()=>{G4(Y),J(X)}})}}function o6(J=dp){return(Q)=>{return new e1((Z)=>{let X=Iu1,Y=new SR(Z),K=Q.subscribe({complete(){Y.complete()},error(q){Y.error(q)},next(q){Y.schedule(async(G)=>{if(X===Iu1||!J(X,q))X=q,G(q)})}});return()=>G4(K)})}}function MN(J){return lF6(typeof J==="function"?{next:J}:J)}function lF6(J){return(Q)=>new e1((Z)=>{let X=typeof J==="function"?J():J,Y=Q.subscribe({next(K){if(X.next)try{X.next(K)}catch(q){Z.error(q);return}Z.next(K)},error(K){if(X.error)try{X.error(K)}catch(q){Z.error(q);return}Z.error(K)},complete(){if(X.complete)try{X.complete()}catch(K){Z.error(K);return}Z.complete()}});return()=>G4(Y)})}function _R(J){return(Q)=>{return new e1((Z)=>{let X=!1,Y=Q.subscribe({next:(q)=>{X=!0,clearTimeout(K),Z.next(q)},error:(q)=>{clearTimeout(K),Z.error(q)},complete:()=>{clearTimeout(K),Z.complete()}}),K=setTimeout(()=>{if(!X)Y.unsubscribe(),Z.error(new Tu1(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(K),Y.unsubscribe()}})}}function E2(J){return(Q)=>new e1((Z)=>{let X;try{Z.next(J),X=Q.subscribe({next(Y){Z.next(Y)},error(Y){Z.error(Y)},complete(){Z.complete()}})}catch(Y){Z.error(Y)}return()=>{if(X)G4(X)}})}function VN(J){return(Q)=>new e1((Z)=>{let X=0,Y=Q.subscribe({next(K){if(X<J){if(Z.next(K),X++,X===J)Z.complete(),G4(Y)}},error(K){Z.error(K)},complete(){Z.complete()}});return()=>{G4(Y)}})}function Cu1(J){return(Q)=>new e1((Z)=>{let X=0,Y=Q.subscribe({next(K){if(X>=J)Z.next(K);else X++},error(K){Z.error(K)},complete(){Z.complete()}});return()=>{G4(Y)}})}function q8(J){return(Q)=>{return new e1((Z)=>{let X=0,Y=null,K=!1,q=()=>{if(K&&!Y)Z.complete()},G=Q.subscribe({next(z){if(Y)G4(Y),Y=null;let U;try{U=J(z,X++)}catch(F){Z.error(F);return}Y=U.subscribe({next(F){Z.next(F)},error(F){Z.error(F)},complete(){Y=null,q()}})},error(z){Z.error(z)},complete(){K=!0,q()}});return()=>{if(G4(G),Y)G4(Y)}})}}function Su1(J){let Q={last:void 0,isSet:!1},Z=J.subscribe((X)=>{Object.assign(Q,{last:X,isSet:!0})});return{value:Q,observable:J,subscription:Z}}function aK(J){return(Q)=>new e1((Z)=>{let X=null,Y=null,K=!1,q=Q.subscribe({next:(G)=>{if(Y=G,K=!0,X===null)X=setTimeout(()=>{if(K)Z.next(Y),K=!1;X=null},J)},error:(G)=>Z.error(G),complete:()=>{if(X!==null)clearTimeout(X);if(K)Z.next(Y);Z.complete()}});return()=>{if(G4(q),X!==null)clearTimeout(X)}})}function ZQ1(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Z)=>new e1((X)=>{let Y=0,K=null,q=null,G=!1,z=Z.subscribe({next:(U)=>{let F=Date.now();if(q=U,G=!0,F-Y>=J)X.next(U),Y=F,G=!1;else if(K===null)K=setTimeout(()=>{if(G)X.next(q),Y=Date.now(),G=!1;K=null},J-(F-Y));if(Y===0)X.next(U),Y=F,G=!1},error:(U)=>X.error(U),complete:()=>{if(K!==null)clearTimeout(K);if(G)X.next(q);X.complete()}});return()=>{if(G4(z),K!==null)clearTimeout(K)}})}function pC(...J){return new e1((Q)=>{let Z=0,X=null;function Y(){if(Z>=J.length){Q.complete();return}X=J[Z].subscribe({next:(q)=>Q.next(q),error:(q)=>Q.error(q),complete:()=>{Z++,Y()}})}return Y(),()=>{if(X)G4(X)}})}function rK(J){return(Q)=>new e1((Z)=>{let X=0,Y=!1,K=null,q=Q.subscribe({next(G){try{let z=J(G,X++);if(K)G4(K);K=z.subscribe({next(U){Z.next(U)},error(U){Z.error(U)},complete(){if(K=null,Y&&!K)Z.complete()}})}catch(z){Z.error(z)}},error(G){Z.error(G)},complete(){if(Y=!0,!K)Z.complete()}});return()=>{if(G4(q),K)G4(K)}})}function lp({onSubscribe:J,onUnsubscribe:Q}){return(Z)=>new e1((X)=>{J?.();let Y=Z.subscribe(X);return()=>{G4(Y),Q?.()}})}function JF(J){return(Q)=>e1.from(Q).pipe(q8((Z)=>d6((X)=>J(Z,X))))}function MQ(J){return(Q)=>new e1((Z)=>{let X,Y=Q.subscribe({next(K){Z.next(K)},error(K){try{X=J(K).subscribe({next(G){Z.next(G)},error(G){Z.error(G)},complete(){Z.complete()}})}catch(q){Z.error(q)}},complete(){Z.complete()}});return()=>{if(G4(Y),X)G4(X)}})}function P5(J){return(Q)=>{return new e1((Z)=>{let X=Q.subscribe({next(Y){if(J(Y))Z.next(Y)},error(Y){Z.error(Y)},complete(){Z.complete()}});return()=>G4(X)})}}function vu1(J,Q){return(Z)=>{return new e1((X)=>{let Y,K=0,q=new SR(X),G=Z.subscribe({complete(){q.complete()},error(z){q.error(z)},next(z){q.schedule(async(U)=>{Y=await J(K===0?typeof Q>"u"?z:Q:Y,z,K++),U(Y)})}});return()=>G4(G)})}}var QQ1,NY,YH9,cF6=0,Iu1,Tu1;var XQ1=B1(()=>{vR();pp();QQ1=new e1((J)=>{J.complete()}),NY=new e1(()=>{});YH9=Symbol("noInitialValue");Iu1={};Tu1=class Tu1 extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function NN(J,Q){return(Z)=>{return e1.from(Z).pipe(q8((X)=>X===PJ?e1.of(PJ):J(X).pipe(MQ((Y)=>e1.of(Y instanceof Error?Y:Error(Y))),E2(PJ))),M9(Q))}}function iF6(){return(J)=>e1.from(J).pipe(P5((Q)=>Q!==PJ))}async function dC(J,Q){let Z=await J6(e1.from(J).pipe(iF6()),Q);if(Z instanceof Error)throw Z;return Z}var PJ;var ku1=B1(()=>{vR();XQ1();PJ=Symbol.for("@@pendingOperation")});var T0=B1(()=>{Eu1();vR();ku1();XQ1();pp()});var bu1=a((_u1)=>{Object.defineProperty(_u1,"__esModule",{value:!0});_u1._globalThis=void 0;_u1._globalThis=typeof globalThis==="object"?globalThis:global});var yu1=a((LN)=>{var nF6=LN&&LN.__createBinding||(Object.create?function(J,Q,Z,X){if(X===void 0)X=Z;Object.defineProperty(J,X,{enumerable:!0,get:function(){return Q[Z]}})}:function(J,Q,Z,X){if(X===void 0)X=Z;J[X]=Q[Z]}),aF6=LN&&LN.__exportStar||function(J,Q){for(var Z in J)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call(Q,Z))nF6(Q,J,Z)};Object.defineProperty(LN,"__esModule",{value:!0});aF6(bu1(),LN)});var fu1=a((AN)=>{var rF6=AN&&AN.__createBinding||(Object.create?function(J,Q,Z,X){if(X===void 0)X=Z;Object.defineProperty(J,X,{enumerable:!0,get:function(){return Q[Z]}})}:function(J,Q,Z,X){if(X===void 0)X=Z;J[X]=Q[Z]}),sF6=AN&&AN.__exportStar||function(J,Q){for(var Z in J)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call(Q,Z))rF6(Q,J,Z)};Object.defineProperty(AN,"__esModule",{value:!0});sF6(yu1(),AN)});var YQ1=a((hu1)=>{Object.defineProperty(hu1,"__esModule",{value:!0});hu1.VERSION=void 0;hu1.VERSION="1.9.0"});var cu1=a((pu1)=>{Object.defineProperty(pu1,"__esModule",{value:!0});pu1.isCompatible=pu1._makeCompatibilityCheck=void 0;var oF6=YQ1(),mu1=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function uu1(J){let Q=new Set([J]),Z=new Set,X=J.match(mu1);if(!X)return()=>!1;let Y={major:+X[1],minor:+X[2],patch:+X[3],prerelease:X[4]};if(Y.prerelease!=null)return function(z){return z===J};function K(G){return Z.add(G),!1}function q(G){return Q.add(G),!0}return function(z){if(Q.has(z))return!0;if(Z.has(z))return!1;let U=z.match(mu1);if(!U)return K(z);let F={major:+U[1],minor:+U[2],patch:+U[3],prerelease:U[4]};if(F.prerelease!=null)return K(z);if(Y.major!==F.major)return K(z);if(Y.major===0){if(Y.minor===F.minor&&Y.patch<=F.patch)return q(z);return K(z)}if(Y.minor<=F.minor)return q(z);return K(z)}}pu1._makeCompatibilityCheck=uu1;pu1.isCompatible=uu1(oF6.VERSION)});var wN=a((lu1)=>{Object.defineProperty(lu1,"__esModule",{value:!0});lu1.unregisterGlobal=lu1.getGlobal=lu1.registerGlobal=void 0;var eF6=fu1(),xR=YQ1(),JW6=cu1(),QW6=xR.VERSION.split(".")[0],cC=Symbol.for(`opentelemetry.js.api.${QW6}`),lC=eF6._globalThis;function ZW6(J,Q,Z,X=!1){var Y;let K=lC[cC]=(Y=lC[cC])!==null&&Y!==void 0?Y:{version:xR.VERSION};if(!X&&K[J]){let q=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${J}`);return Z.error(q.stack||q.message),!1}if(K.version!==xR.VERSION){let q=Error(`@opentelemetry/api: Registration of version v${K.version} for ${J} does not match previously registered API v${xR.VERSION}`);return Z.error(q.stack||q.message),!1}return K[J]=Q,Z.debug(`@opentelemetry/api: Registered a global for ${J} v${xR.VERSION}.`),!0}lu1.registerGlobal=ZW6;function XW6(J){var Q,Z;let X=(Q=lC[cC])===null||Q===void 0?void 0:Q.version;if(!X||!(0,JW6.isCompatible)(X))return;return(Z=lC[cC])===null||Z===void 0?void 0:Z[J]}lu1.getGlobal=XW6;function YW6(J,Q){Q.debug(`@opentelemetry/api: Unregistering a global for ${J} v${xR.VERSION}.`);let Z=lC[cC];if(Z)delete Z[J]}lu1.unregisterGlobal=YW6});var su1=a((au1)=>{Object.defineProperty(au1,"__esModule",{value:!0});au1.DiagComponentLogger=void 0;var GW6=wN();class nu1{constructor(J){this._namespace=J.namespace||"DiagComponentLogger"}debug(...J){return iC("debug",this._namespace,J)}error(...J){return iC("error",this._namespace,J)}info(...J){return iC("info",this._namespace,J)}warn(...J){return iC("warn",this._namespace,J)}verbose(...J){return iC("verbose",this._namespace,J)}}au1.DiagComponentLogger=nu1;function iC(J,Q,Z){let X=(0,GW6.getGlobal)("diag");if(!X)return;return Z.unshift(Q),X[J](...Z)}});var ip=a((ou1)=>{Object.defineProperty(ou1,"__esModule",{value:!0});ou1.DiagLogLevel=void 0;var zW6;(function(J){J[J.NONE=0]="NONE",J[J.ERROR=30]="ERROR",J[J.WARN=50]="WARN",J[J.INFO=60]="INFO",J[J.DEBUG=70]="DEBUG",J[J.VERBOSE=80]="VERBOSE",J[J.ALL=9999]="ALL"})(zW6=ou1.DiagLogLevel||(ou1.DiagLogLevel={}))});var Jp1=a((tu1)=>{Object.defineProperty(tu1,"__esModule",{value:!0});tu1.createLogLevelDiagLogger=void 0;var QF=ip();function UW6(J,Q){if(J<QF.DiagLogLevel.NONE)J=QF.DiagLogLevel.NONE;else if(J>QF.DiagLogLevel.ALL)J=QF.DiagLogLevel.ALL;Q=Q||{};function Z(X,Y){let K=Q[X];if(typeof K==="function"&&J>=Y)return K.bind(Q);return function(){}}return{error:Z("error",QF.DiagLogLevel.ERROR),warn:Z("warn",QF.DiagLogLevel.WARN),info:Z("info",QF.DiagLogLevel.INFO),debug:Z("debug",QF.DiagLogLevel.DEBUG),verbose:Z("verbose",QF.DiagLogLevel.VERBOSE)}}tu1.createLogLevelDiagLogger=UW6});var RN=a((Zp1)=>{Object.defineProperty(Zp1,"__esModule",{value:!0});Zp1.DiagAPI=void 0;var FW6=su1(),WW6=Jp1(),Qp1=ip(),np=wN(),HW6="diag";class qQ1{constructor(){function J(X){return function(...Y){let K=(0,np.getGlobal)("diag");if(!K)return;return K[X](...Y)}}let Q=this,Z=(X,Y={logLevel:Qp1.DiagLogLevel.INFO})=>{var K,q,G;if(X===Q){let F=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return Q.error((K=F.stack)!==null&&K!==void 0?K:F.message),!1}if(typeof Y==="number")Y={logLevel:Y};let z=(0,np.getGlobal)("diag"),U=(0,WW6.createLogLevelDiagLogger)((q=Y.logLevel)!==null&&q!==void 0?q:Qp1.DiagLogLevel.INFO,X);if(z&&!Y.suppressOverrideMessage){let F=(G=Error().stack)!==null&&G!==void 0?G:"<failed to generate stacktrace>";z.warn(`Current logger will be overwritten from ${F}`),U.warn(`Current logger will overwrite one already registered from ${F}`)}return(0,np.registerGlobal)("diag",U,Q,!0)};Q.setLogger=Z,Q.disable=()=>{(0,np.unregisterGlobal)(HW6,Q)},Q.createComponentLogger=(X)=>{return new FW6.DiagComponentLogger(X)},Q.verbose=J("verbose"),Q.debug=J("debug"),Q.info=J("info"),Q.warn=J("warn"),Q.error=J("error")}static instance(){if(!this._instance)this._instance=new qQ1;return this._instance}}Zp1.DiagAPI=qQ1});var qp1=a((Yp1)=>{Object.defineProperty(Yp1,"__esModule",{value:!0});Yp1.BaggageImpl=void 0;class bR{constructor(J){this._entries=J?new Map(J):new Map}getEntry(J){let Q=this._entries.get(J);if(!Q)return;return Object.assign({},Q)}getAllEntries(){return Array.from(this._entries.entries()).map(([J,Q])=>[J,Q])}setEntry(J,Q){let Z=new bR(this._entries);return Z._entries.set(J,Q),Z}removeEntry(J){let Q=new bR(this._entries);return Q._entries.delete(J),Q}removeEntries(...J){let Q=new bR(this._entries);for(let Z of J)Q._entries.delete(Z);return Q}clear(){return new bR}}Yp1.BaggageImpl=bR});var Up1=a((Gp1)=>{Object.defineProperty(Gp1,"__esModule",{value:!0});Gp1.baggageEntryMetadataSymbol=void 0;Gp1.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var GQ1=a((Fp1)=>{Object.defineProperty(Fp1,"__esModule",{value:!0});Fp1.baggageEntryMetadataFromString=Fp1.createBaggage=void 0;var BW6=RN(),DW6=qp1(),MW6=Up1(),VW6=BW6.DiagAPI.instance();function NW6(J={}){return new DW6.BaggageImpl(new Map(Object.entries(J)))}Fp1.createBaggage=NW6;function LW6(J){if(typeof J!=="string")VW6.error(`Cannot create baggage metadata from unknown type: ${typeof J}`),J="";return{__TYPE__:MW6.baggageEntryMetadataSymbol,toString(){return J}}}Fp1.baggageEntryMetadataFromString=LW6});var nC=a((Hp1)=>{Object.defineProperty(Hp1,"__esModule",{value:!0});Hp1.ROOT_CONTEXT=Hp1.createContextKey=void 0;function wW6(J){return Symbol.for(J)}Hp1.createContextKey=wW6;class ap{constructor(J){let Q=this;Q._currentContext=J?new Map(J):new Map,Q.getValue=(Z)=>Q._currentContext.get(Z),Q.setValue=(Z,X)=>{let Y=new ap(Q._currentContext);return Y._currentContext.set(Z,X),Y},Q.deleteValue=(Z)=>{let X=new ap(Q._currentContext);return X._currentContext.delete(Z),X}}}Hp1.ROOT_CONTEXT=new ap});var Np1=a((Mp1)=>{Object.defineProperty(Mp1,"__esModule",{value:!0});Mp1.DiagConsoleLogger=void 0;var zQ1=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class Dp1{constructor(){function J(Q){return function(...Z){if(console){let X=console[Q];if(typeof X!=="function")X=console.log;if(typeof X==="function")return X.apply(console,Z)}}}for(let Q=0;Q<zQ1.length;Q++)this[zQ1[Q].n]=J(zQ1[Q].c)}}Mp1.DiagConsoleLogger=Dp1});var NQ1=a((Lp1)=>{Object.defineProperty(Lp1,"__esModule",{value:!0});Lp1.createNoopMeter=Lp1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Lp1.NOOP_OBSERVABLE_GAUGE_METRIC=Lp1.NOOP_OBSERVABLE_COUNTER_METRIC=Lp1.NOOP_UP_DOWN_COUNTER_METRIC=Lp1.NOOP_HISTOGRAM_METRIC=Lp1.NOOP_GAUGE_METRIC=Lp1.NOOP_COUNTER_METRIC=Lp1.NOOP_METER=Lp1.NoopObservableUpDownCounterMetric=Lp1.NoopObservableGaugeMetric=Lp1.NoopObservableCounterMetric=Lp1.NoopObservableMetric=Lp1.NoopHistogramMetric=Lp1.NoopGaugeMetric=Lp1.NoopUpDownCounterMetric=Lp1.NoopCounterMetric=Lp1.NoopMetric=Lp1.NoopMeter=void 0;class UQ1{constructor(){}createGauge(J,Q){return Lp1.NOOP_GAUGE_METRIC}createHistogram(J,Q){return Lp1.NOOP_HISTOGRAM_METRIC}createCounter(J,Q){return Lp1.NOOP_COUNTER_METRIC}createUpDownCounter(J,Q){return Lp1.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(J,Q){return Lp1.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(J,Q){return Lp1.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(J,Q){return Lp1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(J,Q){}removeBatchObservableCallback(J){}}Lp1.NoopMeter=UQ1;class yR{}Lp1.NoopMetric=yR;class FQ1 extends yR{add(J,Q){}}Lp1.NoopCounterMetric=FQ1;class WQ1 extends yR{add(J,Q){}}Lp1.NoopUpDownCounterMetric=WQ1;class HQ1 extends yR{record(J,Q){}}Lp1.NoopGaugeMetric=HQ1;class BQ1 extends yR{record(J,Q){}}Lp1.NoopHistogramMetric=BQ1;class aC{addCallback(J){}removeCallback(J){}}Lp1.NoopObservableMetric=aC;class DQ1 extends aC{}Lp1.NoopObservableCounterMetric=DQ1;class MQ1 extends aC{}Lp1.NoopObservableGaugeMetric=MQ1;class VQ1 extends aC{}Lp1.NoopObservableUpDownCounterMetric=VQ1;Lp1.NOOP_METER=new UQ1;Lp1.NOOP_COUNTER_METRIC=new FQ1;Lp1.NOOP_GAUGE_METRIC=new HQ1;Lp1.NOOP_HISTOGRAM_METRIC=new BQ1;Lp1.NOOP_UP_DOWN_COUNTER_METRIC=new WQ1;Lp1.NOOP_OBSERVABLE_COUNTER_METRIC=new DQ1;Lp1.NOOP_OBSERVABLE_GAUGE_METRIC=new MQ1;Lp1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new VQ1;function OW6(){return Lp1.NOOP_METER}Lp1.createNoopMeter=OW6});var Cp1=a((Tp1)=>{Object.defineProperty(Tp1,"__esModule",{value:!0});Tp1.ValueType=void 0;var _W6;(function(J){J[J.INT=0]="INT",J[J.DOUBLE=1]="DOUBLE"})(_W6=Tp1.ValueType||(Tp1.ValueType={}))});var AQ1=a((Sp1)=>{Object.defineProperty(Sp1,"__esModule",{value:!0});Sp1.defaultTextMapSetter=Sp1.defaultTextMapGetter=void 0;Sp1.defaultTextMapGetter={get(J,Q){if(J==null)return;return J[Q]},keys(J){if(J==null)return[];return Object.keys(J)}};Sp1.defaultTextMapSetter={set(J,Q,Z){if(J==null)return;J[Q]=Z}}});var bp1=a((_p1)=>{Object.defineProperty(_p1,"__esModule",{value:!0});_p1.NoopContextManager=void 0;var bW6=nC();class kp1{active(){return bW6.ROOT_CONTEXT}with(J,Q,Z,...X){return Q.call(Z,...X)}bind(J,Q){return Q}enable(){return this}disable(){return this}}_p1.NoopContextManager=kp1});var rC=a((fp1)=>{Object.defineProperty(fp1,"__esModule",{value:!0});fp1.ContextAPI=void 0;var yW6=bp1(),wQ1=wN(),yp1=RN(),RQ1="context",fW6=new yW6.NoopContextManager;class OQ1{constructor(){}static getInstance(){if(!this._instance)this._instance=new OQ1;return this._instance}setGlobalContextManager(J){return(0,wQ1.registerGlobal)(RQ1,J,yp1.DiagAPI.instance())}active(){return this._getContextManager().active()}with(J,Q,Z,...X){return this._getContextManager().with(J,Q,Z,...X)}bind(J,Q){return this._getContextManager().bind(J,Q)}_getContextManager(){return(0,wQ1.getGlobal)(RQ1)||fW6}disable(){this._getContextManager().disable(),(0,wQ1.unregisterGlobal)(RQ1,yp1.DiagAPI.instance())}}fp1.ContextAPI=OQ1});var $Q1=a((gp1)=>{Object.defineProperty(gp1,"__esModule",{value:!0});gp1.TraceFlags=void 0;var hW6;(function(J){J[J.NONE=0]="NONE",J[J.SAMPLED=1]="SAMPLED"})(hW6=gp1.TraceFlags||(gp1.TraceFlags={}))});var rp=a((mp1)=>{Object.defineProperty(mp1,"__esModule",{value:!0});mp1.INVALID_SPAN_CONTEXT=mp1.INVALID_TRACEID=mp1.INVALID_SPANID=void 0;var gW6=$Q1();mp1.INVALID_SPANID="0000000000000000";mp1.INVALID_TRACEID="00000000000000000000000000000000";mp1.INVALID_SPAN_CONTEXT={traceId:mp1.INVALID_TRACEID,spanId:mp1.INVALID_SPANID,traceFlags:gW6.TraceFlags.NONE}});var sp=a((lp1)=>{Object.defineProperty(lp1,"__esModule",{value:!0});lp1.NonRecordingSpan=void 0;var mW6=rp();class cp1{constructor(J=mW6.INVALID_SPAN_CONTEXT){this._spanContext=J}spanContext(){return this._spanContext}setAttribute(J,Q){return this}setAttributes(J){return this}addEvent(J,Q){return this}addLink(J){return this}addLinks(J){return this}setStatus(J){return this}updateName(J){return this}end(J){}isRecording(){return!1}recordException(J,Q){}}lp1.NonRecordingSpan=cp1});var PQ1=a((ap1)=>{Object.defineProperty(ap1,"__esModule",{value:!0});ap1.getSpanContext=ap1.setSpanContext=ap1.deleteSpan=ap1.setSpan=ap1.getActiveSpan=ap1.getSpan=void 0;var uW6=nC(),pW6=sp(),dW6=rC(),EQ1=(0,uW6.createContextKey)("OpenTelemetry Context Key SPAN");function IQ1(J){return J.getValue(EQ1)||void 0}ap1.getSpan=IQ1;function cW6(){return IQ1(dW6.ContextAPI.getInstance().active())}ap1.getActiveSpan=cW6;function np1(J,Q){return J.setValue(EQ1,Q)}ap1.setSpan=np1;function lW6(J){return J.deleteValue(EQ1)}ap1.deleteSpan=lW6;function iW6(J,Q){return np1(J,new pW6.NonRecordingSpan(Q))}ap1.setSpanContext=iW6;function nW6(J){var Q;return(Q=IQ1(J))===null||Q===void 0?void 0:Q.spanContext()}ap1.getSpanContext=nW6});var op=a((ep1)=>{Object.defineProperty(ep1,"__esModule",{value:!0});ep1.wrapSpanContext=ep1.isSpanContextValid=ep1.isValidSpanId=ep1.isValidTraceId=void 0;var sp1=rp(),eW6=sp(),JH6=/^([0-9a-f]{32})$/i,QH6=/^[0-9a-f]{16}$/i;function op1(J){return JH6.test(J)&&J!==sp1.INVALID_TRACEID}ep1.isValidTraceId=op1;function tp1(J){return QH6.test(J)&&J!==sp1.INVALID_SPANID}ep1.isValidSpanId=tp1;function ZH6(J){return op1(J.traceId)&&tp1(J.spanId)}ep1.isSpanContextValid=ZH6;function XH6(J){return new eW6.NonRecordingSpan(J)}ep1.wrapSpanContext=XH6});var SQ1=a((Xd1)=>{Object.defineProperty(Xd1,"__esModule",{value:!0});Xd1.NoopTracer=void 0;var GH6=rC(),Qd1=PQ1(),TQ1=sp(),zH6=op(),CQ1=GH6.ContextAPI.getInstance();class Zd1{startSpan(J,Q,Z=CQ1.active()){if(Boolean(Q===null||Q===void 0?void 0:Q.root))return new TQ1.NonRecordingSpan;let Y=Z&&(0,Qd1.getSpanContext)(Z);if(UH6(Y)&&(0,zH6.isSpanContextValid)(Y))return new TQ1.NonRecordingSpan(Y);else return new TQ1.NonRecordingSpan}startActiveSpan(J,Q,Z,X){let Y,K,q;if(arguments.length<2)return;else if(arguments.length===2)q=Q;else if(arguments.length===3)Y=Q,q=Z;else Y=Q,K=Z,q=X;let G=K!==null&&K!==void 0?K:CQ1.active(),z=this.startSpan(J,Y,G),U=(0,Qd1.setSpan)(G,z);return CQ1.with(U,q,void 0,z)}}Xd1.NoopTracer=Zd1;function UH6(J){return typeof J==="object"&&typeof J.spanId==="string"&&typeof J.traceId==="string"&&typeof J.traceFlags==="number"}});var vQ1=a((qd1)=>{Object.defineProperty(qd1,"__esModule",{value:!0});qd1.ProxyTracer=void 0;var FH6=SQ1(),WH6=new FH6.NoopTracer;class Kd1{constructor(J,Q,Z,X){this._provider=J,this.name=Q,this.version=Z,this.options=X}startSpan(J,Q,Z){return this._getTracer().startSpan(J,Q,Z)}startActiveSpan(J,Q,Z,X){let Y=this._getTracer();return Reflect.apply(Y.startActiveSpan,Y,arguments)}_getTracer(){if(this._delegate)return this._delegate;let J=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!J)return WH6;return this._delegate=J,this._delegate}}qd1.ProxyTracer=Kd1});var Wd1=a((Ud1)=>{Object.defineProperty(Ud1,"__esModule",{value:!0});Ud1.NoopTracerProvider=void 0;var HH6=SQ1();class zd1{getTracer(J,Q,Z){return new HH6.NoopTracer}}Ud1.NoopTracerProvider=zd1});var kQ1=a((Bd1)=>{Object.defineProperty(Bd1,"__esModule",{value:!0});Bd1.ProxyTracerProvider=void 0;var BH6=vQ1(),DH6=Wd1(),MH6=new DH6.NoopTracerProvider;class Hd1{getTracer(J,Q,Z){var X;return(X=this.getDelegateTracer(J,Q,Z))!==null&&X!==void 0?X:new BH6.ProxyTracer(this,J,Q,Z)}getDelegate(){var J;return(J=this._delegate)!==null&&J!==void 0?J:MH6}setDelegate(J){this._delegate=J}getDelegateTracer(J,Q,Z){var X;return(X=this._delegate)===null||X===void 0?void 0:X.getTracer(J,Q,Z)}}Bd1.ProxyTracerProvider=Hd1});var Vd1=a((Md1)=>{Object.defineProperty(Md1,"__esModule",{value:!0});Md1.SamplingDecision=void 0;var VH6;(function(J){J[J.NOT_RECORD=0]="NOT_RECORD",J[J.RECORD=1]="RECORD",J[J.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(VH6=Md1.SamplingDecision||(Md1.SamplingDecision={}))});var Ld1=a((Nd1)=>{Object.defineProperty(Nd1,"__esModule",{value:!0});Nd1.SpanKind=void 0;var NH6;(function(J){J[J.INTERNAL=0]="INTERNAL",J[J.SERVER=1]="SERVER",J[J.CLIENT=2]="CLIENT",J[J.PRODUCER=3]="PRODUCER",J[J.CONSUMER=4]="CONSUMER"})(NH6=Nd1.SpanKind||(Nd1.SpanKind={}))});var wd1=a((Ad1)=>{Object.defineProperty(Ad1,"__esModule",{value:!0});Ad1.SpanStatusCode=void 0;var LH6;(function(J){J[J.UNSET=0]="UNSET",J[J.OK=1]="OK",J[J.ERROR=2]="ERROR"})(LH6=Ad1.SpanStatusCode||(Ad1.SpanStatusCode={}))});var jd1=a((Rd1)=>{Object.defineProperty(Rd1,"__esModule",{value:!0});Rd1.validateValue=Rd1.validateKey=void 0;var yQ1="[_0-9a-z-*/]",AH6=`[a-z]${yQ1}{0,255}`,wH6=`[a-z0-9]${yQ1}{0,240}@[a-z]${yQ1}{0,13}`,RH6=new RegExp(`^(?:${AH6}|${wH6})$`),OH6=/^[ -~]{0,255}[!-~]$/,jH6=/,|=/;function $H6(J){return RH6.test(J)}Rd1.validateKey=$H6;function EH6(J){return OH6.test(J)&&!jH6.test(J)}Rd1.validateValue=EH6});var Sd1=a((Td1)=>{Object.defineProperty(Td1,"__esModule",{value:!0});Td1.TraceStateImpl=void 0;var $d1=jd1(),Ed1=32,PH6=512,Id1=",",Pd1="=";class fQ1{constructor(J){if(this._internalState=new Map,J)this._parse(J)}set(J,Q){let Z=this._clone();if(Z._internalState.has(J))Z._internalState.delete(J);return Z._internalState.set(J,Q),Z}unset(J){let Q=this._clone();return Q._internalState.delete(J),Q}get(J){return this._internalState.get(J)}serialize(){return this._keys().reduce((J,Q)=>{return J.push(Q+Pd1+this.get(Q)),J},[]).join(Id1)}_parse(J){if(J.length>PH6)return;if(this._internalState=J.split(Id1).reverse().reduce((Q,Z)=>{let X=Z.trim(),Y=X.indexOf(Pd1);if(Y!==-1){let K=X.slice(0,Y),q=X.slice(Y+1,Z.length);if((0,$d1.validateKey)(K)&&(0,$d1.validateValue)(q))Q.set(K,q)}return Q},new Map),this._internalState.size>Ed1)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Ed1))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let J=new fQ1;return J._internalState=new Map(this._internalState),J}}Td1.TraceStateImpl=fQ1});var _d1=a((vd1)=>{Object.defineProperty(vd1,"__esModule",{value:!0});vd1.createTraceState=void 0;var TH6=Sd1();function CH6(J){return new TH6.TraceStateImpl(J)}vd1.createTraceState=CH6});var yd1=a((xd1)=>{Object.defineProperty(xd1,"__esModule",{value:!0});xd1.context=void 0;var SH6=rC();xd1.context=SH6.ContextAPI.getInstance()});var gd1=a((fd1)=>{Object.defineProperty(fd1,"__esModule",{value:!0});fd1.diag=void 0;var vH6=RN();fd1.diag=vH6.DiagAPI.instance()});var pd1=a((md1)=>{Object.defineProperty(md1,"__esModule",{value:!0});md1.NOOP_METER_PROVIDER=md1.NoopMeterProvider=void 0;var kH6=NQ1();class hQ1{getMeter(J,Q,Z){return kH6.NOOP_METER}}md1.NoopMeterProvider=hQ1;md1.NOOP_METER_PROVIDER=new hQ1});var id1=a((cd1)=>{Object.defineProperty(cd1,"__esModule",{value:!0});cd1.MetricsAPI=void 0;var xH6=pd1(),gQ1=wN(),dd1=RN(),mQ1="metrics";class uQ1{constructor(){}static getInstance(){if(!this._instance)this._instance=new uQ1;return this._instance}setGlobalMeterProvider(J){return(0,gQ1.registerGlobal)(mQ1,J,dd1.DiagAPI.instance())}getMeterProvider(){return(0,gQ1.getGlobal)(mQ1)||xH6.NOOP_METER_PROVIDER}getMeter(J,Q,Z){return this.getMeterProvider().getMeter(J,Q,Z)}disable(){(0,gQ1.unregisterGlobal)(mQ1,dd1.DiagAPI.instance())}}cd1.MetricsAPI=uQ1});var rd1=a((nd1)=>{Object.defineProperty(nd1,"__esModule",{value:!0});nd1.metrics=void 0;var bH6=id1();nd1.metrics=bH6.MetricsAPI.getInstance()});var ed1=a((od1)=>{Object.defineProperty(od1,"__esModule",{value:!0});od1.NoopTextMapPropagator=void 0;class sd1{inject(J,Q){}extract(J,Q){return J}fields(){return[]}}od1.NoopTextMapPropagator=sd1});var Xc1=a((Qc1)=>{Object.defineProperty(Qc1,"__esModule",{value:!0});Qc1.deleteBaggage=Qc1.setBaggage=Qc1.getActiveBaggage=Qc1.getBaggage=void 0;var yH6=rC(),fH6=nC(),pQ1=(0,fH6.createContextKey)("OpenTelemetry Baggage Key");function Jc1(J){return J.getValue(pQ1)||void 0}Qc1.getBaggage=Jc1;function hH6(){return Jc1(yH6.ContextAPI.getInstance().active())}Qc1.getActiveBaggage=hH6;function gH6(J,Q){return J.setValue(pQ1,Q)}Qc1.setBaggage=gH6;function mH6(J){return J.deleteValue(pQ1)}Qc1.deleteBaggage=mH6});var zc1=a((qc1)=>{Object.defineProperty(qc1,"__esModule",{value:!0});qc1.PropagationAPI=void 0;var dQ1=wN(),cH6=ed1(),Yc1=AQ1(),tp=Xc1(),lH6=GQ1(),Kc1=RN(),cQ1="propagation",iH6=new cH6.NoopTextMapPropagator;class lQ1{constructor(){this.createBaggage=lH6.createBaggage,this.getBaggage=tp.getBaggage,this.getActiveBaggage=tp.getActiveBaggage,this.setBaggage=tp.setBaggage,this.deleteBaggage=tp.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new lQ1;return this._instance}setGlobalPropagator(J){return(0,dQ1.registerGlobal)(cQ1,J,Kc1.DiagAPI.instance())}inject(J,Q,Z=Yc1.defaultTextMapSetter){return this._getGlobalPropagator().inject(J,Q,Z)}extract(J,Q,Z=Yc1.defaultTextMapGetter){return this._getGlobalPropagator().extract(J,Q,Z)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,dQ1.unregisterGlobal)(cQ1,Kc1.DiagAPI.instance())}_getGlobalPropagator(){return(0,dQ1.getGlobal)(cQ1)||iH6}}qc1.PropagationAPI=lQ1});var Wc1=a((Uc1)=>{Object.defineProperty(Uc1,"__esModule",{value:!0});Uc1.propagation=void 0;var nH6=zc1();Uc1.propagation=nH6.PropagationAPI.getInstance()});var Nc1=a((Mc1)=>{Object.defineProperty(Mc1,"__esModule",{value:!0});Mc1.TraceAPI=void 0;var iQ1=wN(),Hc1=kQ1(),Bc1=op(),fR=PQ1(),Dc1=RN(),nQ1="trace";class aQ1{constructor(){this._proxyTracerProvider=new Hc1.ProxyTracerProvider,this.wrapSpanContext=Bc1.wrapSpanContext,this.isSpanContextValid=Bc1.isSpanContextValid,this.deleteSpan=fR.deleteSpan,this.getSpan=fR.getSpan,this.getActiveSpan=fR.getActiveSpan,this.getSpanContext=fR.getSpanContext,this.setSpan=fR.setSpan,this.setSpanContext=fR.setSpanContext}static getInstance(){if(!this._instance)this._instance=new aQ1;return this._instance}setGlobalTracerProvider(J){let Q=(0,iQ1.registerGlobal)(nQ1,this._proxyTracerProvider,Dc1.DiagAPI.instance());if(Q)this._proxyTracerProvider.setDelegate(J);return Q}getTracerProvider(){return(0,iQ1.getGlobal)(nQ1)||this._proxyTracerProvider}getTracer(J,Q){return this.getTracerProvider().getTracer(J,Q)}disable(){(0,iQ1.unregisterGlobal)(nQ1,Dc1.DiagAPI.instance()),this._proxyTracerProvider=new Hc1.ProxyTracerProvider}}Mc1.TraceAPI=aQ1});var wc1=a((Lc1)=>{Object.defineProperty(Lc1,"__esModule",{value:!0});Lc1.trace=void 0;var aH6=Nc1();Lc1.trace=aH6.TraceAPI.getInstance()});var ep=a((I2)=>{Object.defineProperty(I2,"__esModule",{value:!0});I2.trace=I2.propagation=I2.metrics=I2.diag=I2.context=I2.INVALID_SPAN_CONTEXT=I2.INVALID_TRACEID=I2.INVALID_SPANID=I2.isValidSpanId=I2.isValidTraceId=I2.isSpanContextValid=I2.createTraceState=I2.TraceFlags=I2.SpanStatusCode=I2.SpanKind=I2.SamplingDecision=I2.ProxyTracerProvider=I2.ProxyTracer=I2.defaultTextMapSetter=I2.defaultTextMapGetter=I2.ValueType=I2.createNoopMeter=I2.DiagLogLevel=I2.DiagConsoleLogger=I2.ROOT_CONTEXT=I2.createContextKey=I2.baggageEntryMetadataFromString=void 0;var rH6=GQ1();Object.defineProperty(I2,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return rH6.baggageEntryMetadataFromString}});var Rc1=nC();Object.defineProperty(I2,"createContextKey",{enumerable:!0,get:function(){return Rc1.createContextKey}});Object.defineProperty(I2,"ROOT_CONTEXT",{enumerable:!0,get:function(){return Rc1.ROOT_CONTEXT}});var sH6=Np1();Object.defineProperty(I2,"DiagConsoleLogger",{enumerable:!0,get:function(){return sH6.DiagConsoleLogger}});var oH6=ip();Object.defineProperty(I2,"DiagLogLevel",{enumerable:!0,get:function(){return oH6.DiagLogLevel}});var tH6=NQ1();Object.defineProperty(I2,"createNoopMeter",{enumerable:!0,get:function(){return tH6.createNoopMeter}});var eH6=Cp1();Object.defineProperty(I2,"ValueType",{enumerable:!0,get:function(){return eH6.ValueType}});var Oc1=AQ1();Object.defineProperty(I2,"defaultTextMapGetter",{enumerable:!0,get:function(){return Oc1.defaultTextMapGetter}});Object.defineProperty(I2,"defaultTextMapSetter",{enumerable:!0,get:function(){return Oc1.defaultTextMapSetter}});var JB6=vQ1();Object.defineProperty(I2,"ProxyTracer",{enumerable:!0,get:function(){return JB6.ProxyTracer}});var QB6=kQ1();Object.defineProperty(I2,"ProxyTracerProvider",{enumerable:!0,get:function(){return QB6.ProxyTracerProvider}});var ZB6=Vd1();Object.defineProperty(I2,"SamplingDecision",{enumerable:!0,get:function(){return ZB6.SamplingDecision}});var XB6=Ld1();Object.defineProperty(I2,"SpanKind",{enumerable:!0,get:function(){return XB6.SpanKind}});var YB6=wd1();Object.defineProperty(I2,"SpanStatusCode",{enumerable:!0,get:function(){return YB6.SpanStatusCode}});var KB6=$Q1();Object.defineProperty(I2,"TraceFlags",{enumerable:!0,get:function(){return KB6.TraceFlags}});var qB6=_d1();Object.defineProperty(I2,"createTraceState",{enumerable:!0,get:function(){return qB6.createTraceState}});var rQ1=op();Object.defineProperty(I2,"isSpanContextValid",{enumerable:!0,get:function(){return rQ1.isSpanContextValid}});Object.defineProperty(I2,"isValidTraceId",{enumerable:!0,get:function(){return rQ1.isValidTraceId}});Object.defineProperty(I2,"isValidSpanId",{enumerable:!0,get:function(){return rQ1.isValidSpanId}});var sQ1=rp();Object.defineProperty(I2,"INVALID_SPANID",{enumerable:!0,get:function(){return sQ1.INVALID_SPANID}});Object.defineProperty(I2,"INVALID_TRACEID",{enumerable:!0,get:function(){return sQ1.INVALID_TRACEID}});Object.defineProperty(I2,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return sQ1.INVALID_SPAN_CONTEXT}});var jc1=yd1();Object.defineProperty(I2,"context",{enumerable:!0,get:function(){return jc1.context}});var $c1=gd1();Object.defineProperty(I2,"diag",{enumerable:!0,get:function(){return $c1.diag}});var Ec1=rd1();Object.defineProperty(I2,"metrics",{enumerable:!0,get:function(){return Ec1.metrics}});var Ic1=Wc1();Object.defineProperty(I2,"propagation",{enumerable:!0,get:function(){return Ic1.propagation}});var Pc1=wc1();Object.defineProperty(I2,"trace",{enumerable:!0,get:function(){return Pc1.trace}});I2.default={context:jc1.context,diag:$c1.diag,metrics:Ec1.metrics,propagation:Ic1.propagation,trace:Pc1.trace}});function FB6(){return UB6}function Tc1(J){let Q=ON;return ON=J,Q}class uG{baseLogger;scope;context={};constructor(J=Cc1){this.baseLogger=J}with(J){let Q=new uG(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new uG(this.baseLogger);return Q.scope=this.scope?`${this.scope}.${J}`:J,Q.context={...this.context},Q}error(J,...Q){let Z=this.mergeContextWithMeta(Q);this.baseLogger.error(this.messageWithPrefix(J),...Z)}warn(J,...Q){let Z=this.mergeContextWithMeta(Q);this.baseLogger.warn(this.messageWithPrefix(J),...Z)}info(J,...Q){let Z=this.mergeContextWithMeta(Q);this.baseLogger.info(this.messageWithPrefix(J),...Z)}debug(J,...Q){let Z=this.mergeContextWithMeta(Q);this.baseLogger.debug(this.messageWithPrefix(J),...Z)}audit(J,...Q){let Z=this.mergeContextWithMeta(Q);this.baseLogger.audit(this.messageWithPrefix(J),...Z)}messageWithPrefix(J){return this.scope?`${this.scope}: ${J}`:J}mergeContextWithMeta(J){let Q={...this.context},Z=oQ1.trace.getActiveSpan();if(Z){let Y=Z.spanContext();if(Y.traceId)Q.traceId=Y.traceId,Q.spanId=Y.spanId}if(J.length===0)return[Q];let X=J[0];if(typeof X==="object"&&X!==null)return[{...X,...Q},...J.slice(1)];else return[Q,...J]}}var oQ1,UB6=!1,WB6,ON,Cc1,l;var z0=B1(()=>{oQ1=m6(ep(),1);WB6={error:(J,...Q)=>console.error(J,...Q),warn:(J,...Q)=>console.warn(J,...Q),info:(J,...Q)=>console.info(J,...Q),debug:(J,...Q)=>{if(FB6())console.debug(J,...Q)},audit:(J,...Q)=>{let Z=Q.length>0?Q[0]:{};if(typeof Z==="object"&&Z!==null&&!("audit"in Z))Z.audit=!0;let X=oQ1.trace.getActiveSpan();if(X){let Y=X.spanContext();if(Y.traceId)Z.traceId=Y.traceId,Z.spanId=Y.spanId}console.info(J,Z)}},ON=WB6;Cc1={error:(J,...Q)=>ON.error(J,...Q),warn:(J,...Q)=>ON.warn(J,...Q),info:(J,...Q)=>ON.info(J,...Q),debug:(J,...Q)=>ON.debug(J,...Q),audit:(J,...Q)=>ON.audit(J,...Q)};l=Cc1});function Sc1(){if(typeof process==="object")return process.platform==="win32"?"windows":"posix";else if(typeof navigator==="object")return navigator.userAgent.indexOf("Windows")>=0?"windows":"posix";return"posix"}function vc1(J,Q){if(!J.scheme&&Q)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${J.authority}", path: "${J.path}", query: "${J.query}", fragment: "${J.fragment}"}`);if(J.scheme&&!HB6.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!BB6.test(J.path))throw Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(DB6.test(J.path))throw Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function MB6(J,Q){if(!J&&!Q)return"file";return J}function VB6(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=sK;else if(Q[0]!==sK)Q=sK+Q;break}return Q}class j0{static isUri(J){if(J instanceof j0)return!0;if(!J)return!1;let Q=J;return typeof Q.authority==="string"&&typeof Q.fragment==="string"&&typeof Q.path==="string"&&typeof Q.query==="string"&&typeof Q.scheme==="string"&&typeof Q.fsPath==="string"&&typeof Q.with==="function"&&typeof Q.toString==="function"}scheme;authority;path;query;fragment;platform;constructor(J,Q,Z,X,Y,K=!1,q){if(typeof J==="object")this.scheme=J.scheme||g2,this.authority=J.authority||g2,this.path=J.path||g2,this.query=J.query||g2,this.fragment=J.fragment||g2,this.platform=J.platform;else this.scheme=MB6(J,K),this.authority=Q||g2,this.path=VB6(this.scheme,Z||g2),this.query=X||g2,this.fragment=Y||g2,this.platform=q,vc1(this,K)}get fsPath(){return yc1(this,!1)}with(J){if(!J)return this;let{scheme:Q,authority:Z,path:X,query:Y,fragment:K,platform:q}=J;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=g2;if(Z===void 0)Z=this.authority;else if(Z===null)Z=g2;if(X===void 0)X=this.path;else if(X===null)X=g2;if(Y===void 0)Y=this.query;else if(Y===null)Y=g2;if(K===void 0)K=this.fragment;else if(K===null)K=g2;if(q===void 0)q=this.platform;else if(q===null)q=void 0;if(Q===this.scheme&&Z===this.authority&&X===this.path&&Y===this.query&&K===this.fragment&&q===this.platform)return this;return new jN(Q,Z,X,Y,K,!1,q)}static parse(J,Q=!1){let Z=NB6.exec(J);if(!Z)return new jN(g2,g2,g2,g2,g2);return new jN(Z[2]||g2,Jd(Z[4]||g2),Jd(Z[5]||g2),Jd(Z[7]||g2),Jd(Z[9]||g2),Q)}static file(J,Q=Sc1()){let Z=g2;if(Q==="windows")J=J.replace(/\\/g,sK);if(J[0]===sK&&J[1]===sK){let X=J.indexOf(sK,2);if(X===-1)Z=J.substring(2),J=sK;else Z=J.substring(2,X),J=J.substring(X)||sK}return new jN("file",Z,J,g2,g2,!1,Q)}static from(J){let Q=new jN(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return vc1(Q,!0),Q}toString(J=!1){return tQ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof j0)return J;let Q=new jN(J),Z=J;return Q._formatted=Z.external,Q._fsPath=Z._sep===xc1(Q.platform)?Z.fsPath:null,Q}}function xc1(J){return J==="windows"?1:void 0}function kc1(J,Q,Z){let X=void 0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);if(K>=97&&K<=122||K>=65&&K<=90||K>=48&&K<=57||K===45||K===46||K===95||K===126||Q&&K===47||Z&&K===91||Z&&K===93||Z&&K===58){if(X!==void 0)X+=J.charAt(Y)}else{if(X===void 0)X=J.substring(0,Y);let q=bc1[K];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(Y))}}return X!==void 0?X:J}function LB6(J){let Q=void 0;for(let Z=0;Z<J.length;Z++){let X=J.charCodeAt(Z);if(X===35||X===63){if(Q===void 0)Q=J.substring(0,Z);Q+=bc1[X]}else if(Q!==void 0)Q+=J[Z]}return Q!==void 0?Q:J}function yc1(J,Q){let Z;if(J.authority&&J.path.length>1&&J.scheme==="file")Z=`//${J.authority}${J.path}`;else if(J.path.charCodeAt(0)===47&&(J.path.charCodeAt(1)>=65&&J.path.charCodeAt(1)<=90||J.path.charCodeAt(1)>=97&&J.path.charCodeAt(1)<=122)&&J.path.charCodeAt(2)===58)if(!Q)Z=J.path[1].toLowerCase()+J.path.substring(2);else Z=J.path.substring(1);else Z=J.path;if(J.platform==="windows")Z=Z.replace(/\//g,"\\");return Z}function tQ1(J,Q){let Z=!Q?kc1:LB6,X="",{scheme:Y,authority:K,path:q,query:G,fragment:z}=J;if(Y)X+=Y,X+=":";if(K||Y==="file")X+=sK,X+=sK;if(K){let U=K.indexOf("@");if(U!==-1){let F=K.substring(0,U);if(K=K.substring(U+1),U=F.lastIndexOf(":"),U===-1)X+=Z(F,!1,!1);else X+=Z(F.substring(0,U),!1,!1),X+=":",X+=Z(F.substring(U+1),!1,!0);X+="@"}if(K=K.toLowerCase(),U=K.lastIndexOf(":"),U===-1)X+=Z(K,!1,!0);else X+=Z(K.substring(0,U),!1,!0),X+=K.substring(U)}if(q){if(q.length>=3&&q.charCodeAt(0)===47&&q.charCodeAt(2)===58){let U=q.charCodeAt(1);if(U>=65&&U<=90)q=`/${String.fromCharCode(U+32)}:${q.substring(3)}`}else if(q.length>=2&&q.charCodeAt(1)===58){let U=q.charCodeAt(0);if(U>=65&&U<=90)q=`${String.fromCharCode(U+32)}:${q.substring(2)}`}X+=Z(q,!0,!1)}if(G)X+="?",X+=Z(G,!1,!1);if(z)X+="#",X+=!Q?kc1(z,!1,!1):z;return X}function fc1(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+fc1(J.substring(3));else return J}}function Jd(J){if(!J.match(_c1))return J;return J.replace(_c1,(Q)=>fc1(Q))}function zB(J){return J.scheme==="file"}function VQ(J){return j0.parse(J)}function C6(J){return J.toString()}function W8(J){if(typeof J==="string"||J instanceof URL)return j0.parse(J.toString());return J}function sC(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var HB6,BB6,DB6,g2="",sK="/",NB6,jN,bc1,_c1;var Qd=B1(()=>{HB6=/^\w[\w\d+.-]*$/,BB6=/^\//,DB6=/^\/\//;NB6=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;jN=class jN extends j0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=yc1(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=tQ1(this,!1);return this._formatted}return tQ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=xc1(this.platform);if(this._formatted)J.external=this._formatted;if(J.scheme=this.scheme,J.authority=this.authority,J.path=this.path,J.query=this.query,J.fragment=this.fragment,this.platform)J.platform=this.platform;return J}};bc1={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};_c1=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function eQ1(J){if(J==="/")return"/";if(J==="")return".";let Q=J.replace(/\/+$/,"");if(!Q)return".";let Z=Q.lastIndexOf("/");if(Z===-1)return".";if(Z===0)return"/";return Q.slice(0,Z)}function $N(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Z=Q.lastIndexOf("/");return Z===-1?Q:Q.slice(Z+1)}function hR(...J){if(J.length===0)return".";let Q="";for(let q of J)if(q)if(Q)Q+="/"+q;else Q=q;if(!Q)return".";let Z=Q.endsWith("/"),X=Q.split("/").filter(Boolean),Y=[];for(let q of X)if(q===".."){if(Y.length>0&&Y[Y.length-1]!=="..")Y.pop();else if(!Q.startsWith("/"))Y.push("..")}else if(q!==".")Y.push(q);let K=Q.startsWith("/")?"/"+Y.join("/"):Y.join("/");if(!K)K=Q.startsWith("/")?"/":".";if(Z&&K!=="/"&&K!==".")K+="/";return K}function hc1(J,Q,Z="/",X="/",Y=!0){function K(W,H){return Y?W===H:W.toLowerCase()===H.toLowerCase()}if(Z==="/")J=J.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else J=J.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(J!==Z&&J.endsWith(Z))J=J.slice(0,-1);if(Q!==Z&&Q.endsWith(Z))Q=Q.slice(0,-1);if(K(J,Q))return"";if(!J.startsWith(Z)&&Q.startsWith(Z))return Q;let q=J===Z?[""]:J.split(Z),G=Q===Z?[""]:Q.split(Z),z=0;while(z<q.length&&z<G.length&&K(q[z],G[z]))z++;let U=q.length-z,F=[];for(let W=0;W<U;W++)F.push("..");return F.push(...G.slice(z)),F.join(X)}function Zd(J){let Q=$N(J.replace(/\/+$/,"")),Z=Q.lastIndexOf(".");if(Z===0||Z===-1)return"";return Q.slice(Z)}function NQ(J){if(J=W8(J),J.scheme==="file")return J.path;return J.toString()}var gR=B1(()=>{Qd()});function AB6(J,...Q){return J=W8(J),J.with({path:hR(J.path,...Q)})}function wB6(J,...Q){let Z=J.path,X=!1;if(Z[0]!==Xd)Z=Xd+Z,X=!0;let Y=Z;for(let K of Q)if(K.startsWith("/"))Y=hR(K);else Y=hR(Y,K);if(Y!=="/"&&Y.endsWith("/"))Y=Y.replace(/\/+$/,"");if(X&&Y[0]===Xd&&!J.authority)Y=Y.substring(1);return J.with({path:Y})}function RB6(J){if(J=W8(J),J.path.length===0||J.path===Xd)return J;let Q=eQ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function OB6(J,Q){if(Q.scheme!==J.scheme||(Q.authority??"")!==(J.authority??""))return!1;let Z=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),X=Z?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,Y=Z?J.path.slice(0,2).toUpperCase()+J.path.slice(2):J.path;return Y===X||Y.startsWith(X.endsWith("/")?X:`${X}/`)||X.endsWith("/")&&Y===X.slice(0,-1)}function jB6(J,Q){if(J.scheme!==Q.scheme||J.authority!==Q.authority||J.query!==Q.query||J.fragment!==Q.fragment)return null;let Z=J.platform==="windows"?"\\":"/";return hc1(J.path,Q.path,Z,Z)}function $B6(J,Q){let Z=C6(J),X=C6(Q);if(Z.startsWith("file:///")&&X.startsWith("file:///"))return gc1(Z)===gc1(X);return Z===X}function gc1(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Xd="/",y0;var JZ1=B1(()=>{gR();Qd();y0={joinPath:AB6,resolvePath:wB6,dirname:RB6,basename:(J)=>$N(W8(J).path),extname:(J)=>Zd(W8(J).path),hasPrefix:OB6,relativePath:jB6,equalURIs:$B6}});var _6=B1(()=>{Qd();JZ1();gR()});import EB6 from"os";import Yd from"path";var UB,EN,FB,WB,mc1,rB9,sB9,IB6,PB6;var mR=B1(()=>{UB=EB6.homedir(),{env:EN}=process,FB=EN.XDG_DATA_HOME||(UB?Yd.join(UB,".local","share"):void 0),WB=EN.XDG_CONFIG_HOME||(UB?Yd.join(UB,".config"):void 0),mc1=EN.XDG_STATE_HOME||(UB?Yd.join(UB,".local","state"):void 0),rB9=EN.XDG_CACHE_HOME||(UB?Yd.join(UB,".cache"):void 0),sB9=EN.XDG_RUNTIME_DIR||void 0,IB6=(EN.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(FB)IB6.unshift(FB);PB6=(EN.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(WB)PB6.unshift(WB)});import{promises as TB6}from"node:fs";import*as IN from"node:path";async function uc1(J){try{let Q=await TB6.open(J,"r");try{let Z=Buffer.alloc(128);await Q.read(Z,0,128,0);let X=Z.toString("utf-8").split(`
|
|
3
|
-
`)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let Y=X.slice(2).trim();if(!Y)return{interpreter:null,isValid:!1};let K=Y.split(/\s+/).filter((q)=>q.length>0);if(K[0]?.endsWith("/env")&&K.length>1)return{interpreter:K.slice(1),isValid:!0};return{interpreter:K,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function pc1(J,Q){let Z=(J&73)!==0;if(process.platform==="win32"){let X=IN.extname(Q).toLowerCase();return Z||[".exe",".bat",".cmd",".ps1"].includes(X)}return Z}function dc1(J){return IN.extname(J).toLowerCase()===".md"}function cc1(J){let Q=J.replace(/\\/g,"/"),Z=IN.basename(Q);return IN.basename(Z,IN.extname(Z))}function lc1(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var ic1=()=>{};var sc1={};R6(sc1,{CommandDiscovery:()=>rc1});import*as ac1 from"node:fs";import{promises as Kd}from"node:fs";import{homedir as nc1}from"node:os";import*as BX from"node:path";function ZZ1(J,Q,Z){return Promise.race([J,new Promise((X,Y)=>setTimeout(()=>Y(Error(`${Z} timed out after ${Q}ms`)),Q))])}class rc1{config;workspaceRoots;watchFactory;debounceMs;changes=new b8;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Z={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Z.watchFactory??CB6,this.debounceMs=Z.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Z=new Map;for(let Y of Q)Z.set(Y.name,Y);for(let Y of J)Z.set(Y.name,Y);let X=Array.from(Z.values());if(l.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return l.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Z of this.config.workspacePaths){let X=y0.joinPath(Q,Z),Y=await this.discoverCommandsInDirectory(X,"workspace");J.push(...Y)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Z=this.resolveGlobalPath(Q),X=j0.file(Z),Y=await this.discoverCommandsInDirectory(X,"global");J.push(...Y)}return J}async discoverCommandsInDirectory(J,Q){try{let Z=J.fsPath;try{await ZZ1(Kd.access(Z),QZ1,"directory access")}catch{return[]}let Y=(await ZZ1(Kd.readdir(Z,{withFileTypes:!0}),QZ1,"directory read")).filter((q)=>q.isFile()),K=[];for(let q of Y){let G=BX.join(Z,q.name),z=await this.createCommand(G);if(z)K.push(z)}return l.debug(`Discovered ${K.length} commands in ${Q} directory`,{directory:Z,commands:K.map((q)=>q.name)}),K}catch(Z){return l.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Z}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J){try{let Q=await Kd.stat(J),Z=BX.basename(J);if(this.ignoreCommandName(Z))return null;let X=cc1(Z);if(!lc1(X))return l.warn(`Invalid command name: ${X}`,{filePath:J}),null;if(dc1(Z))return this.createMarkdownCommand(J,Q,X);else return this.createExecutableCommand(J,Q,X)}catch(Q){return l.warn(`Failed to process file: ${J}`,{error:Q}),null}}async createMarkdownCommand(J,Q,Z){return{kind:"markdown",name:Z,filePath:J,sourceDirectory:BX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0}}async createExecutableCommand(J,Q,Z){let X=BX.basename(J),Y=pc1(Q.mode,X),K=await uc1(J),q=BX.extname(X);if(!Y&&!K.isValid&&!this.isNativeBinary(q))return l.debug(`Skipping non-executable file without shebang: ${J}`),null;let G=Y&&(K.isValid||this.isNativeBinary(q)),z=this.getExecutableUnavailableReason(Y,K.isValid,q);return{kind:"executable",name:Z,filePath:J,sourceDirectory:BX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Y,interpreter:K.interpreter,extension:q,available:G,unavailableReason:z}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Z){let X=this.isNativeBinary(Z);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return BX.join(nc1(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=WB||BX.join(nc1(),".config");return BX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Z of this.config.workspacePaths){let X=y0.joinPath(Q,Z);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Z=this.resolveGlobalPath(Q);J.add(Z)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await ZZ1(Kd.access(J),QZ1,"watcher access check");try{let Q=this.watchFactory(J,(Z,X)=>{l.debug("Command directory change detected",{directory:J,eventType:Z,filename:X}),this.scheduleRefresh()});this.watchers.set(J,Q),l.debug("Started watching command directory",{directory:J})}catch(Q){l.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){l.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Z=new Map;for(let Y of Q)Z.set(Y.name,Y);for(let Y of J)Z.set(Y.name,Y);let X=Array.from(Z.values());l.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){l.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),l.debug("Stopped watching command directory",{directory:J})}catch(Z){l.warn("Failed to close watcher",{directory:J,error:Z})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){l.warn("Error during command discovery cleanup",{error:J})}}}var QZ1=5000,CB6=(J,Q)=>ac1.watch(J,Q);var oc1=B1(()=>{_6();T0();mR();z0();ic1()});import{homedir as qd}from"node:os";import PN from"node:path";var ec1,vB6,Jl1,kB6,Gd,_B6,uR,HB,XZ1;var ZF=B1(()=>{mR();ec1=PN.join(qd(),".local/share"),vB6=process.platform==="win32"||process.platform==="darwin"?ec1:FB??ec1,Jl1=PN.join(qd(),".config"),kB6=process.platform==="win32"||process.platform==="darwin"?Jl1:WB??Jl1,Gd=PN.join(vB6,"amp"),_B6=PN.join(kB6,"amp"),uR=PN.join(_B6,"tools"),HB=PN.join(qd(),".cache","amp"),XZ1=PN.join(qd(),".cache","amp","http-debug-logs")});function DX(J,Q,Z=Q+"s"){return J===1?Q:Z}var Gl1="run_terminal_command",zl1="read_file",t5="Task",Ul1="chat_llm",q7="finder",BB="fast_finder",pG="xai_finder",dG="kimiK2_finder",DB="gossip_finder",MB="sonoma_finder",XF="get_diagnostics",z4="Bash",e5="oracle",tC="mermaid",VB="todo_read",JJ="todo_write",cG="read_web_page",Fl1="run_javascript",TJ="create_file",lG="glob",Wl1="Glob",zd="undo_edit",Ud="read_mcp_resource",t8="Read",CJ="edit_file",Fd="format_file",NB="web_search",U4="Grep",eC="Check",TN="librarian",Wd="read_github",Hd="search_github",Bd="commit_search",Dd="list_directory_github",Md="list_repositories",Vd="glob_github",Nd="diff",Hl1;var N8=B1(()=>{Hl1=["Task","chat_llm","finder","fast_finder","xai_finder","kimiK2_finder","gossip_finder","sonoma_finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","run_javascript","create_file","glob","Glob","undo_edit","Read","edit_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","librarian"]});var JS=a((xD9,Dl1)=>{var Bl1={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:"/"},iB6={...Bl1,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:"\\"},nB6={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"};Dl1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nB6,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?iB6:Bl1}}});var QS=a((tB6)=>{var{REGEX_BACKSLASH:aB6,REGEX_REMOVE_BACKSLASH:rB6,REGEX_SPECIAL_CHARS:sB6,REGEX_SPECIAL_CHARS_GLOBAL:oB6}=JS();tB6.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tB6.hasRegexChars=(J)=>sB6.test(J);tB6.isRegexChar=(J)=>J.length===1&&tB6.hasRegexChars(J);tB6.escapeRegex=(J)=>J.replace(oB6,"\\$1");tB6.toPosixSlashes=(J)=>J.replace(aB6,"/");tB6.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};tB6.removeBackslashes=(J)=>{return J.replace(rB6,(Q)=>{return Q==="\\"?"":Q})};tB6.escapeLast=(J,Q,Z)=>{let X=J.lastIndexOf(Q,Z);if(X===-1)return J;if(J[X-1]==="\\")return tB6.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};tB6.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};tB6.wrapOutput=(J,Q={},Z={})=>{let X=Z.contains?"":"^",Y=Z.contains?"":"$",K=`${X}(?:${J})${Y}`;if(Q.negated===!0)K=`(?:^(?!${K}).*$)`;return K};tB6.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),X=Z[Z.length-1];if(X==="")return Z[Z.length-2];return X}});var $l1=a((yD9,jl1)=>{var Nl1=QS(),{CHAR_ASTERISK:KZ1,CHAR_AT:zD6,CHAR_BACKWARD_SLASH:ZS,CHAR_COMMA:UD6,CHAR_DOT:qZ1,CHAR_EXCLAMATION_MARK:GZ1,CHAR_FORWARD_SLASH:Ol1,CHAR_LEFT_CURLY_BRACE:zZ1,CHAR_LEFT_PARENTHESES:UZ1,CHAR_LEFT_SQUARE_BRACKET:FD6,CHAR_PLUS:WD6,CHAR_QUESTION_MARK:Ll1,CHAR_RIGHT_CURLY_BRACE:HD6,CHAR_RIGHT_PARENTHESES:Al1,CHAR_RIGHT_SQUARE_BRACKET:BD6}=JS(),wl1=(J)=>{return J===Ol1||J===ZS},Rl1=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},DD6=(J,Q)=>{let Z=Q||{},X=J.length-1,Y=Z.parts===!0||Z.scanToEnd===!0,K=[],q=[],G=[],z=J,U=-1,F=0,W=0,H=!1,B=!1,M=!1,V=!1,N=!1,L=!1,A=!1,w=!1,R=!1,O=!1,j=0,$,E,I={value:"",depth:0,isGlob:!1},T=()=>U>=X,S=()=>z.charCodeAt(U+1),x=()=>{return $=E,z.charCodeAt(++U)};while(U<X){E=x();let g;if(E===ZS){if(A=I.backslashes=!0,E=x(),E===zZ1)L=!0;continue}if(L===!0||E===zZ1){j++;while(T()!==!0&&(E=x())){if(E===ZS){A=I.backslashes=!0,x();continue}if(E===zZ1){j++;continue}if(L!==!0&&E===qZ1&&(E=x())===qZ1){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(L!==!0&&E===UD6){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===HD6){if(j--,j===0){L=!1,H=I.isBrace=!0,O=!0;break}}}if(Y===!0)continue;break}if(E===Ol1){if(K.push(U),q.push(I),I={value:"",depth:0,isGlob:!1},O===!0)continue;if($===qZ1&&U===F+1){F+=2;continue}W=U+1;continue}if(Z.noext!==!0){if((E===WD6||E===zD6||E===KZ1||E===Ll1||E===GZ1)===!0&&S()===UZ1){if(M=I.isGlob=!0,V=I.isExtglob=!0,O=!0,E===GZ1&&U===F)R=!0;if(Y===!0){while(T()!==!0&&(E=x())){if(E===ZS){A=I.backslashes=!0,E=x();continue}if(E===Al1){M=I.isGlob=!0,O=!0;break}}continue}break}}if(E===KZ1){if($===KZ1)N=I.isGlobstar=!0;if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===Ll1){if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===FD6){while(T()!==!0&&(g=x())){if(g===ZS){A=I.backslashes=!0,x();continue}if(g===BD6){B=I.isBracket=!0,M=I.isGlob=!0,O=!0;break}}if(Y===!0)continue;break}if(Z.nonegate!==!0&&E===GZ1&&U===F){w=I.negated=!0,F++;continue}if(Z.noparen!==!0&&E===UZ1){if(M=I.isGlob=!0,Y===!0){while(T()!==!0&&(E=x())){if(E===UZ1){A=I.backslashes=!0,E=x();continue}if(E===Al1){O=!0;break}}continue}break}if(M===!0){if(O=!0,Y===!0)continue;break}}if(Z.noext===!0)V=!1,M=!1;let h=z,v="",_="";if(F>0)v=z.slice(0,F),z=z.slice(F),W-=F;if(h&&M===!0&&W>0)h=z.slice(0,W),_=z.slice(W);else if(M===!0)h="",_=z;else h=z;if(h&&h!==""&&h!=="/"&&h!==z){if(wl1(h.charCodeAt(h.length-1)))h=h.slice(0,-1)}if(Z.unescape===!0){if(_)_=Nl1.removeBackslashes(_);if(h&&A===!0)h=Nl1.removeBackslashes(h)}let b={prefix:v,input:J,start:F,base:h,glob:_,isBrace:H,isBracket:B,isGlob:M,isExtglob:V,isGlobstar:N,negated:w,negatedExtglob:R};if(Z.tokens===!0){if(b.maxDepth=0,!wl1(E))q.push(I);b.tokens=q}if(Z.parts===!0||Z.tokens===!0){let g;for(let k=0;k<K.length;k++){let y=g?g+1:F,f=K[k],m=J.slice(y,f);if(Z.tokens){if(k===0&&F!==0)q[k].isPrefix=!0,q[k].value=v;else q[k].value=m;Rl1(q[k]),b.maxDepth+=q[k].depth}if(k!==0||m!=="")G.push(m);g=f}if(g&&g+1<J.length){let k=J.slice(g+1);if(G.push(k),Z.tokens)q[q.length-1].value=k,Rl1(q[q.length-1]),b.maxDepth+=q[q.length-1].depth}b.slashes=K,b.parts=G}return b};jl1.exports=DD6});var Pl1=a((fD9,Il1)=>{var Ld=JS(),iG=QS(),{MAX_LENGTH:Ad,POSIX_REGEX_SOURCE:MD6,REGEX_NON_SPECIAL_CHARS:VD6,REGEX_SPECIAL_CHARS_BACKREF:ND6,REPLACEMENTS:El1}=Ld,LD6=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Z=`[${J.join("-")}]`;try{new RegExp(Z)}catch(X){return J.map((Y)=>iG.escapeRegex(Y)).join("..")}return Z},dR=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},FZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=El1[J]||J;let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(Ad,Z.maxLength):Ad,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);let K={type:"bos",value:"",output:Z.prepend||""},q=[K],G=Z.capture?"":"?:",z=Ld.globChars(Z.windows),U=Ld.extglobChars(z),{DOT_LITERAL:F,PLUS_LITERAL:W,SLASH_LITERAL:H,ONE_CHAR:B,DOTS_SLASH:M,NO_DOT:V,NO_DOT_SLASH:N,NO_DOTS_SLASH:L,QMARK:A,QMARK_NO_DOT:w,STAR:R,START_ANCHOR:O}=z,j=(W1)=>{return`(${G}(?:(?!${O}${W1.dot?M:F}).)*?)`},$=Z.dot?"":V,E=Z.dot?A:w,I=Z.bash===!0?j(Z):R;if(Z.capture)I=`(${I})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let T={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:q};J=iG.removePrefix(J,T),Y=J.length;let S=[],x=[],h=[],v=K,_,b=()=>T.index===Y-1,g=T.peek=(W1=1)=>J[T.index+W1],k=T.advance=()=>J[++T.index]||"",y=()=>J.slice(T.index+1),f=(W1="",d=0)=>{T.consumed+=W1,T.index+=d},m=(W1)=>{T.output+=W1.output!=null?W1.output:W1.value,f(W1.value)},n=()=>{let W1=1;while(g()==="!"&&(g(2)!=="("||g(3)==="?"))k(),T.start++,W1++;if(W1%2===0)return!1;return T.negated=!0,T.start++,!0},u=(W1)=>{T[W1]++,h.push(W1)},e=(W1)=>{T[W1]--,h.pop()},G1=(W1)=>{if(v.type==="globstar"){let d=T.braces>0&&(W1.type==="comma"||W1.type==="brace"),p=W1.extglob===!0||S.length&&(W1.type==="pipe"||W1.type==="paren");if(W1.type!=="slash"&&W1.type!=="paren"&&!d&&!p)T.output=T.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=I,T.output+=v.output}if(S.length&&W1.type!=="paren")S[S.length-1].inner+=W1.value;if(W1.value||W1.output)m(W1);if(v&&v.type==="text"&&W1.type==="text"){v.output=(v.output||v.value)+W1.value,v.value+=W1.value;return}W1.prev=v,q.push(W1),v=W1},F1=(W1,d)=>{let p={...U[d],conditions:1,inner:""};p.prev=v,p.parens=T.parens,p.output=T.output;let i=(Z.capture?"(":"")+p.open;u("parens"),G1({type:W1,value:d,output:T.output?"":B}),G1({type:"paren",extglob:!0,value:k(),output:i}),S.push(p)},Z1=(W1)=>{let d=W1.close+(Z.capture?")":""),p;if(W1.type==="negate"){let i=I;if(W1.inner&&W1.inner.length>1&&W1.inner.includes("/"))i=j(Z);if(i!==I||b()||/^\)+$/.test(y()))d=W1.close=`)$))${i}`;if(W1.inner.includes("*")&&(p=y())&&/^\.[^\\/.]+$/.test(p)){let r=FZ1(p,{...Q,fastpaths:!1}).output;d=W1.close=`)${r})${i})`}if(W1.prev.type==="bos")T.negatedExtglob=!0}G1({type:"paren",extglob:!0,value:_,output:d}),e("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let W1=!1,d=J.replace(ND6,(p,i,r,o,X1,J1)=>{if(o==="\\")return W1=!0,p;if(o==="?"){if(i)return i+o+(X1?A.repeat(X1.length):"");if(J1===0)return E+(X1?A.repeat(X1.length):"");return A.repeat(r.length)}if(o===".")return F.repeat(r.length);if(o==="*"){if(i)return i+o+(X1?I:"");return I}return i?p:`\\${p}`});if(W1===!0)if(Z.unescape===!0)d=d.replace(/\\/g,"");else d=d.replace(/\\+/g,(p)=>{return p.length%2===0?"\\\\":p?"\\":""});if(d===J&&Z.contains===!0)return T.output=J,T;return T.output=iG.wrapOutput(d,T,Q),T}while(!b()){if(_=k(),_==="\x00")continue;if(_==="\\"){let p=g();if(p==="/"&&Z.bash!==!0)continue;if(p==="."||p===";")continue;if(!p){_+="\\",G1({type:"text",value:_});continue}let i=/^\\+/.exec(y()),r=0;if(i&&i[0].length>2){if(r=i[0].length,T.index+=r,r%2!==0)_+="\\"}if(Z.unescape===!0)_=k();else _+=k();if(T.brackets===0){G1({type:"text",value:_});continue}}if(T.brackets>0&&(_!=="]"||v.value==="["||v.value==="[^")){if(Z.posix!==!1&&_===":"){let p=v.value.slice(1);if(p.includes("[")){if(v.posix=!0,p.includes(":")){let i=v.value.lastIndexOf("["),r=v.value.slice(0,i),o=v.value.slice(i+2),X1=MD6[o];if(X1){if(v.value=r+X1,T.backtrack=!0,k(),!K.output&&q.indexOf(v)===1)K.output=B;continue}}}}if(_==="["&&g()!==":"||_==="-"&&g()==="]")_=`\\${_}`;if(_==="]"&&(v.value==="["||v.value==="[^"))_=`\\${_}`;if(Z.posix===!0&&_==="!"&&v.value==="[")_="^";v.value+=_,m({value:_});continue}if(T.quotes===1&&_!=='"'){_=iG.escapeRegex(_),v.value+=_,m({value:_});continue}if(_==='"'){if(T.quotes=T.quotes===1?0:1,Z.keepQuotes===!0)G1({type:"text",value:_});continue}if(_==="("){u("parens"),G1({type:"paren",value:_});continue}if(_===")"){if(T.parens===0&&Z.strictBrackets===!0)throw SyntaxError(dR("opening","("));let p=S[S.length-1];if(p&&T.parens===p.parens+1){Z1(S.pop());continue}G1({type:"paren",value:_,output:T.parens?")":"\\)"}),e("parens");continue}if(_==="["){if(Z.nobracket===!0||!y().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw SyntaxError(dR("closing","]"));_=`\\${_}`}else u("brackets");G1({type:"bracket",value:_});continue}if(_==="]"){if(Z.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){G1({type:"text",value:_,output:`\\${_}`});continue}if(T.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(dR("opening","["));G1({type:"text",value:_,output:`\\${_}`});continue}e("brackets");let p=v.value.slice(1);if(v.posix!==!0&&p[0]==="^"&&!p.includes("/"))_=`/${_}`;if(v.value+=_,m({value:_}),Z.literalBrackets===!1||iG.hasRegexChars(p))continue;let i=iG.escapeRegex(v.value);if(T.output=T.output.slice(0,-v.value.length),Z.literalBrackets===!0){T.output+=i,v.value=i;continue}v.value=`(${G}${i}|${v.value})`,T.output+=v.value;continue}if(_==="{"&&Z.nobrace!==!0){u("braces");let p={type:"brace",value:_,output:"(",outputIndex:T.output.length,tokensIndex:T.tokens.length};x.push(p),G1(p);continue}if(_==="}"){let p=x[x.length-1];if(Z.nobrace===!0||!p){G1({type:"text",value:_,output:_});continue}let i=")";if(p.dots===!0){let r=q.slice(),o=[];for(let X1=r.length-1;X1>=0;X1--){if(q.pop(),r[X1].type==="brace")break;if(r[X1].type!=="dots")o.unshift(r[X1].value)}i=LD6(o,Z),T.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let r=T.output.slice(0,p.outputIndex),o=T.tokens.slice(p.tokensIndex);p.value=p.output="\\{",_=i="\\}",T.output=r;for(let X1 of o)T.output+=X1.output||X1.value}G1({type:"brace",value:_,output:i}),e("braces"),x.pop();continue}if(_==="|"){if(S.length>0)S[S.length-1].conditions++;G1({type:"text",value:_});continue}if(_===","){let p=_,i=x[x.length-1];if(i&&h[h.length-1]==="braces")i.comma=!0,p="|";G1({type:"comma",value:_,output:p});continue}if(_==="/"){if(v.type==="dot"&&T.index===T.start+1){T.start=T.index+1,T.consumed="",T.output="",q.pop(),v=K;continue}G1({type:"slash",value:_,output:H});continue}if(_==="."){if(T.braces>0&&v.type==="dot"){if(v.value===".")v.output=F;let p=x[x.length-1];v.type="dots",v.output+=_,v.value+=_,p.dots=!0;continue}if(T.braces+T.parens===0&&v.type!=="bos"&&v.type!=="slash"){G1({type:"text",value:_,output:F});continue}G1({type:"dot",value:_,output:F});continue}if(_==="?"){if(!(v&&v.value==="(")&&Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){F1("qmark",_);continue}if(v&&v.type==="paren"){let i=g(),r=_;if(v.value==="("&&!/[!=<:]/.test(i)||i==="<"&&!/<([!=]|\w+>)/.test(y()))r=`\\${_}`;G1({type:"text",value:_,output:r});continue}if(Z.dot!==!0&&(v.type==="slash"||v.type==="bos")){G1({type:"qmark",value:_,output:w});continue}G1({type:"qmark",value:_,output:A});continue}if(_==="!"){if(Z.noextglob!==!0&&g()==="("){if(g(2)!=="?"||!/[!=<:]/.test(g(3))){F1("negate",_);continue}}if(Z.nonegate!==!0&&T.index===0){n();continue}}if(_==="+"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){F1("plus",_);continue}if(v&&v.value==="("||Z.regex===!1){G1({type:"plus",value:_,output:W});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||T.parens>0){G1({type:"plus",value:_});continue}G1({type:"plus",value:W});continue}if(_==="@"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){G1({type:"at",extglob:!0,value:_,output:""});continue}G1({type:"text",value:_});continue}if(_!=="*"){if(_==="$"||_==="^")_=`\\${_}`;let p=VD6.exec(y());if(p)_+=p[0],T.index+=p[0].length;G1({type:"text",value:_});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=_,v.output=I,T.backtrack=!0,T.globstar=!0,f(_);continue}let W1=y();if(Z.noextglob!==!0&&/^\([^?]/.test(W1)){F1("star",_);continue}if(v.type==="star"){if(Z.noglobstar===!0){f(_);continue}let p=v.prev,i=p.prev,r=p.type==="slash"||p.type==="bos",o=i&&(i.type==="star"||i.type==="globstar");if(Z.bash===!0&&(!r||W1[0]&&W1[0]!=="/")){G1({type:"star",value:_,output:""});continue}let X1=T.braces>0&&(p.type==="comma"||p.type==="brace"),J1=S.length&&(p.type==="pipe"||p.type==="paren");if(!r&&p.type!=="paren"&&!X1&&!J1){G1({type:"star",value:_,output:""});continue}while(W1.slice(0,3)==="/**"){let H1=J[T.index+4];if(H1&&H1!=="/")break;W1=W1.slice(3),f("/**",3)}if(p.type==="bos"&&b()){v.type="globstar",v.value+=_,v.output=j(Z),T.output=v.output,T.globstar=!0,f(_);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!o&&b()){T.output=T.output.slice(0,-(p.output+v.output).length),p.output=`(?:${p.output}`,v.type="globstar",v.output=j(Z)+(Z.strictSlashes?")":"|$)"),v.value+=_,T.globstar=!0,T.output+=p.output+v.output,f(_);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&W1[0]==="/"){let H1=W1[1]!==void 0?"|$":"";T.output=T.output.slice(0,-(p.output+v.output).length),p.output=`(?:${p.output}`,v.type="globstar",v.output=`${j(Z)}${H}|${H}${H1})`,v.value+=_,T.output+=p.output+v.output,T.globstar=!0,f(_+k()),G1({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&W1[0]==="/"){v.type="globstar",v.value+=_,v.output=`(?:^|${H}|${j(Z)}${H})`,T.output=v.output,T.globstar=!0,f(_+k()),G1({type:"slash",value:"/",output:""});continue}T.output=T.output.slice(0,-v.output.length),v.type="globstar",v.output=j(Z),v.value+=_,T.output+=v.output,T.globstar=!0,f(_);continue}let d={type:"star",value:_,output:I};if(Z.bash===!0){if(d.output=".*?",v.type==="bos"||v.type==="slash")d.output=$+d.output;G1(d);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Z.regex===!0){d.output=_,G1(d);continue}if(T.index===T.start||v.type==="slash"||v.type==="dot"){if(v.type==="dot")T.output+=N,v.output+=N;else if(Z.dot===!0)T.output+=L,v.output+=L;else T.output+=$,v.output+=$;if(g()!=="*")T.output+=B,v.output+=B}G1(d)}while(T.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing","]"));T.output=iG.escapeLast(T.output,"["),e("brackets")}while(T.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing",")"));T.output=iG.escapeLast(T.output,"("),e("parens")}while(T.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing","}"));T.output=iG.escapeLast(T.output,"{"),e("braces")}if(Z.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))G1({type:"maybe_slash",value:"",output:`${H}?`});if(T.backtrack===!0){T.output="";for(let W1 of T.tokens)if(T.output+=W1.output!=null?W1.output:W1.value,W1.suffix)T.output+=W1.suffix}return T};FZ1.fastpaths=(J,Q)=>{let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(Ad,Z.maxLength):Ad,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);J=El1[J]||J;let{DOT_LITERAL:K,SLASH_LITERAL:q,ONE_CHAR:G,DOTS_SLASH:z,NO_DOT:U,NO_DOTS:F,NO_DOTS_SLASH:W,STAR:H,START_ANCHOR:B}=Ld.globChars(Z.windows),M=Z.dot?F:U,V=Z.dot?W:U,N=Z.capture?"":"?:",L={negated:!1,prefix:""},A=Z.bash===!0?".*?":H;if(Z.capture)A=`(${A})`;let w=($)=>{if($.noglobstar===!0)return A;return`(${N}(?:(?!${B}${$.dot?z:K}).)*?)`},R=($)=>{switch($){case"*":return`${M}${G}${A}`;case".*":return`${K}${G}${A}`;case"*.*":return`${M}${A}${K}${G}${A}`;case"*/*":return`${M}${A}${q}${G}${V}${A}`;case"**":return M+w(Z);case"**/*":return`(?:${M}${w(Z)}${q})?${V}${G}${A}`;case"**/*.*":return`(?:${M}${w(Z)}${q})?${V}${A}${K}${G}${A}`;case"**/.*":return`(?:${M}${w(Z)}${q})?${K}${G}${A}`;default:{let E=/^(.*?)\.(\w+)$/.exec($);if(!E)return;let I=R(E[1]);if(!I)return;return I+K+E[2]}}},O=iG.removePrefix(J,L),j=R(O);if(j&&Z.strictSlashes!==!0)j+=`${q}?`;return j};Il1.exports=FZ1});var XS=a((hD9,Cl1)=>{var AD6=$l1(),WZ1=Pl1(),Tl1=QS(),wD6=JS(),RD6=(J)=>J&&typeof J==="object"&&!Array.isArray(J),G7=(J,Q,Z=!1)=>{if(Array.isArray(J)){let F=J.map((H)=>G7(H,Q,Z));return(H)=>{for(let B of F){let M=B(H);if(M)return M}return!1}}let X=RD6(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let Y=Q||{},K=Y.windows,q=X?G7.compileRe(J,Q):G7.makeRe(J,Q,!1,!0),G=q.state;delete q.state;let z=()=>!1;if(Y.ignore){let F={...Q,ignore:null,onMatch:null,onResult:null};z=G7(Y.ignore,F,Z)}let U=(F,W=!1)=>{let{isMatch:H,match:B,output:M}=G7.test(F,q,Q,{glob:J,posix:K}),V={glob:J,state:G,regex:q,posix:K,input:F,output:M,match:B,isMatch:H};if(typeof Y.onResult==="function")Y.onResult(V);if(H===!1)return V.isMatch=!1,W?V:!1;if(z(F)){if(typeof Y.onIgnore==="function")Y.onIgnore(V);return V.isMatch=!1,W?V:!1}if(typeof Y.onMatch==="function")Y.onMatch(V);return W?V:!0};if(Z)U.state=G;return U};G7.test=(J,Q,Z,{glob:X,posix:Y}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let K=Z||{},q=K.format||(Y?Tl1.toPosixSlashes:null),G=J===X,z=G&&q?q(J):J;if(G===!1)z=q?q(J):J,G=z===X;if(G===!1||K.capture===!0)if(K.matchBase===!0||K.basename===!0)G=G7.matchBase(J,Q,Z,Y);else G=Q.exec(z);return{isMatch:Boolean(G),match:G,output:z}};G7.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:G7.makeRe(Q,Z)).test(Tl1.basename(J))};G7.isMatch=(J,Q,Z)=>G7(Q,Z)(J);G7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>G7.parse(Z,Q));return WZ1(J,{...Q,fastpaths:!1})};G7.scan=(J,Q)=>AD6(J,Q);G7.compileRe=(J,Q,Z=!1,X=!1)=>{if(Z===!0)return J.output;let Y=Q||{},K=Y.contains?"":"^",q=Y.contains?"":"$",G=`${K}(?:${J.output})${q}`;if(J&&J.negated===!0)G=`^(?!${G}).*$`;let z=G7.toRegex(G,Q);if(X===!0)z.state=J;return z};G7.makeRe=(J,Q={},Z=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))Y.output=WZ1.fastpaths(J,Q);if(!Y.output)Y=WZ1(J,Q);return G7.compileRe(Y,Q,Z,X)};G7.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/$^/}};G7.constants=wD6;Cl1.exports=G7});var CN=a((gD9,kl1)=>{var Sl1=XS(),OD6=QS();function vl1(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:OD6.isWindows()};return Sl1(J,Q,Z)}Object.assign(vl1,Sl1);kl1.exports=vl1});function wd(J){if(!J)return null;let Z=Od(J)?.toolAllowlist;if(!Z)return null;let X=Object.entries(YS).find(([K,q])=>q.includes(J))?.[0],Y=bl1.filter((K)=>K!==X).map((K)=>`!${K}`);if(X&&X!=="finder")Y.push("!finder");return[...Z,...Y]}function Rd(J,Q){let Z=!1;for(let X of Q){if(X==="")continue;if(X.startsWith("!")){let Y=X.slice(1);if(_l1(J,Y))return!1;continue}if(_l1(J,X))Z=!0}return Z}function _l1(J,Q){if(Q==="")return!1;if(Q.length===1){if(Q==="*")return!0;return!1}if(J===Q)return!0;if(Q.includes("*")||Q.includes("?")||Q.includes("[")||Q.includes("{"))try{return xl1.default(Q,{dot:!0})(J)}catch(Z){return!1}return!1}var xl1;var HZ1=B1(()=>{z2();xl1=m6(CN(),1)});function v8(J){let Q=m2[J];return`${Q.provider}/${Q.name}`}function MX(J){let[Q,Z]=J.split("/");for(let X of Object.values(m2))if(X.provider===Q&&X.name===Z)return X;switch(Q){case"anthropic":return m2.CLAUDE_SONNET_4_5;case"openai":return m2.GPT_5;case"xai":return m2.GROK_CODE_FAST_1;case"cerebras":return m2.QWEN_3_CODER_480B;case"moonshotai":return m2.KIMI_K2_INSTRUCT;case"openrouter":return m2.SONOMA_SKY_ALPHA;case"supernova":return m2.CODE_SUPERNOVA;case"groq":return m2.GPT_OSS_120B;default:throw Error(`Unknown provider: ${Q}`)}}function cR(J){let[,Q]=J.split("/");return Q||J}function nG(J){let Q=MX(J);return Q.contextWindow-Q.maxOutputTokens}function LB(J){let Q=J?.["internal.visibleModes"]??[];return Object.values(SN).filter((Z)=>{let X="visible"in Z?Z.visible:!1,Y=Q.includes(Z.key);return X||Y}).map((Z)=>({mode:Z.key,description:"description"in Z?Z.description:void 0})).sort((Z,X)=>Z.mode.localeCompare(X.mode))}function Od(J){return Object.values(SN).find((Q)=>Q.key===J)}function yl1(J){return Od(J)?.primaryModel??v8("CLAUDE_SONNET_4_5")}function $d(J){let Q=Od(J);if(!Q)return!1;return MX(Q.primaryModel).capabilities?.vision??!1}function BZ1(J,Q){return Q.find((Z)=>Z.mode===J)?.description}function Ed(J,Q){let X=(Q.findIndex((K)=>K.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var P2,m2,SN,jd,YS,bl1;var z2=B1(()=>{P2={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai",SUPERNOVA:"supernova"},m2={CLAUDE_SONNET_4:{provider:P2.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:P2.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:P2.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:P2.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:P2.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_3_5_HAIKU:{provider:P2.ANTHROPIC,name:"claude-3-5-haiku-20241022",displayName:"Claude 3.5 Haiku",contextWindow:200000,maxOutputTokens:8000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0},CLAUDE_3_5_SONNET:{provider:P2.ANTHROPIC,name:"claude-3-5-sonnet-20241022",displayName:"Claude 3.5 Sonnet",contextWindow:200000,maxOutputTokens:8000,capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5:{provider:P2.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_CODEX:{provider:P2.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_MINI:{provider:P2.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:P2.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}},GPT_4_1:{provider:P2.OPENAI,name:"gpt-4.1",displayName:"GPT-4.1",contextWindow:1047576,maxOutputTokens:32768,pricing:{input:2,output:8,cached:0.5},capabilities:{vision:!0,tools:!0}},GPT_4O:{provider:P2.OPENAI,name:"gpt-4o",displayName:"GPT-4o",contextWindow:128000,maxOutputTokens:16384,pricing:{input:2.5,output:10,cached:1.25},capabilities:{vision:!0,tools:!0}},O3:{provider:P2.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:P2.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:P2.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:P2.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE:{provider:P2.XAI,name:"grok-code",displayName:"Grok Code",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:P2.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:P2.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:P2.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}},GEMINI_2_5_FLASH_LITE:{provider:P2.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:P2.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},QWEN_3_CODER_480B:{provider:P2.CEREBRAS,name:"qwen-3-coder-480b",displayName:"Qwen 3 Coder 480B",contextWindow:128000,maxOutputTokens:32000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:P2.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:P2.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},CODE_SUPERNOVA:{provider:P2.SUPERNOVA,name:"code-supernova",displayName:"Code Supernova",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0},freeTierEligible:!0}};SN={SMART:{key:"smart",displayName:"Smart",description:"Smarter, but slower",primaryModel:v8("CLAUDE_SONNET_4_5"),visible:!0},FAST:{key:"fast",displayName:"Fast",description:"Faster, but dumber",primaryModel:v8("GROK_CODE_FAST_1"),toolAllowlist:["*","!todo_read","!todo_write","!Task","!oracle","!web_search","!read_web_page","!read_mcp_resource"],visible:!1},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:v8("GROK_CODE"),visible:!0,toolAllowlist:["*","!oracle","!librarian","!Task"]},GRONK_FAST_MAIN:{key:"gronk-fast:main",displayName:"Gronk Fast Main",primaryModel:v8("GROK_CODE_FAST_1")},GRONK_FAST_SEARCH:{key:"gronk-fast:search",displayName:"Gronk Fast Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("GROK_CODE_FAST_1")},GRONK_FAST_MAIN_SEARCH:{key:"gronk-fast:main+search",displayName:"Gronk Fast Main+Search",primaryModel:v8("GROK_CODE_FAST_1"),searchModel:v8("GROK_CODE_FAST_1")},BOLT_SEARCH:{key:"bolt:search",displayName:"Bolt Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("QWEN_3_CODER_480B")},BOLT_MAIN:{key:"bolt:main",displayName:"Bolt Main",primaryModel:v8("QWEN_3_CODER_480B")},BOLT_MAIN_SEARCH:{key:"bolt:main+search",displayName:"Bolt Main+Search",primaryModel:v8("QWEN_3_CODER_480B"),searchModel:v8("QWEN_3_CODER_480B")},GEPPETTO_MAIN:{key:"geppetto:main",displayName:"Geppetto Main",primaryModel:v8("GPT_5")},GEPPETTO_PRO_MAIN:{key:"geppetto-pro:main",displayName:"Geppetto Pro Main",primaryModel:v8("GPT_5")},PINOCCHIO_MAIN:{key:"pinocchio:main",displayName:"Pinocchio Main",primaryModel:v8("GPT_5_CODEX")},CLAUDIUS_MAIN:{key:"claudius:main",displayName:"Claudius Main",primaryModel:v8("CLAUDE_OPUS_4")},OPUS_4_1:{key:"opus4.1",displayName:"Opus 4.1",primaryModel:v8("CLAUDE_OPUS_4_1")},HYDROGEN_MAIN:{key:"hydrogen:main",displayName:"Hydrogen Main",primaryModel:v8("CODE_SUPERNOVA")},KASHMIR_MAIN:{key:"kashmir:main",displayName:"Kashmir Main",primaryModel:v8("KIMI_K2_INSTRUCT")},KASHMIR_SEARCH:{key:"kashmir:search",displayName:"Kashmir Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("KIMI_K2_INSTRUCT")},KASHMIR_MAIN_SEARCH:{key:"kashmir:main+search",displayName:"Kashmir Main+Search",primaryModel:v8("KIMI_K2_INSTRUCT"),searchModel:v8("KIMI_K2_INSTRUCT")},GOSSIP_MAIN:{key:"gossip:main",displayName:"Gossip Main",primaryModel:v8("GPT_OSS_120B")},GOSSIP_SEARCH:{key:"gossip:search",displayName:"Gossip Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("GPT_OSS_120B")},GOSSIP_MAIN_SEARCH:{key:"gossip:main+search",displayName:"Gossip Main+Search",primaryModel:v8("GPT_OSS_120B"),searchModel:v8("GPT_OSS_120B")},SONOMOON_MAIN:{key:"sonomoon:main",displayName:"Sonomoon Main",primaryModel:v8("SONOMA_SKY_ALPHA")},SONOMOON_SEARCH:{key:"sonomoon:search",displayName:"Sonomoon Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("SONOMA_SKY_ALPHA")},SONOMOON_MAIN_SEARCH:{key:"sonomoon:main+search",displayName:"Sonomoon Main+Search",primaryModel:v8("SONOMA_SKY_ALPHA"),searchModel:v8("SONOMA_SKY_ALPHA")}},jd=Object.values(SN).map((J)=>J.key),YS={xai_finder:["fast","free","gronk-fast:search","gronk-fast:main+search"],fast_finder:["bolt:search","bolt:main+search"],kimiK2_finder:["kashmir:search","kashmir:main+search"],gossip_finder:["gossip:search","gossip:main+search"],sonoma_finder:["sonomoon:search","sonomoon:main+search"]},bl1=Object.keys(YS)});function DZ1(J){return jD6.includes(J)}function hl1(J){let Q=J["internal.oracleModel"]?.trim();if(Q&&Q.length>0)return Q;return m2.GPT_5.name}function gl1(J){let Q=J["internal.model"]?.trim();if(!Q||Q.length===0)return null;let Z=Q.indexOf(":");if(Z===-1)return null;let X=Q.slice(0,Z).trim(),Y=Q.slice(Z+1).trim();if(!X||!Y)return null;return`${X}/${Y}`}var jD6,fl1;var KS=B1(()=>{z2();jD6=["guardedFiles.allowlist","mcpPermissions","tools.disable","permissions"];fl1=["apiKey","buildkite-access-token","github-access-token","gitlab-access-token","gitlab-instance-url"]});function AB(J){let Q=typeof J==="string"?J:J.toString();return Q===zZ||Q===zZ.slice(0,-1)}function lR(J){return AB(J)?zZ:J}var ID6,zZ,PD6,sD9;var wB=B1(()=>{ID6=new URL("https://ampcode.com/"),zZ=ID6.toString(),PD6=new URL("https://api.anthropic.com/"),sD9=PD6.toString()});var V9,MZ1,r0,rG=(J)=>{switch(typeof J){case"undefined":return r0.undefined;case"string":return r0.string;case"number":return Number.isNaN(J)?r0.nan:r0.number;case"boolean":return r0.boolean;case"function":return r0.function;case"bigint":return r0.bigint;case"symbol":return r0.symbol;case"object":if(Array.isArray(J))return r0.array;if(J===null)return r0.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return r0.promise;if(typeof Map<"u"&&J instanceof Map)return r0.map;if(typeof Set<"u"&&J instanceof Set)return r0.set;if(typeof Date<"u"&&J instanceof Date)return r0.date;return r0.object;default:return r0.unknown}};var qS=B1(()=>{(function(J){J.assertEqual=(Y)=>{};function Q(Y){}J.assertIs=Q;function Z(Y){throw Error()}J.assertNever=Z,J.arrayToEnum=(Y)=>{let K={};for(let q of Y)K[q]=q;return K},J.getValidEnumValues=(Y)=>{let K=J.objectKeys(Y).filter((G)=>typeof Y[Y[G]]!=="number"),q={};for(let G of K)q[G]=Y[G];return J.objectValues(q)},J.objectValues=(Y)=>{return J.objectKeys(Y).map(function(K){return Y[K]})},J.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let K=[];for(let q in Y)if(Object.prototype.hasOwnProperty.call(Y,q))K.push(q);return K},J.find=(Y,K)=>{for(let q of Y)if(K(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function X(Y,K=" | "){return Y.map((q)=>typeof q==="string"?`'${q}'`:q).join(K)}J.joinValues=X,J.jsonStringifyReplacer=(Y,K)=>{if(typeof K==="bigint")return K.toString();return K}})(V9||(V9={}));(function(J){J.mergeShapes=(Q,Z)=>{return{...Q,...Z}}})(MZ1||(MZ1={}));r0=V9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b0,TD6=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},UZ;var Pd=B1(()=>{qS();b0=V9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);UZ=class UZ extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Z)=>{this.issues=[...this.issues,Z]},this.addIssues=(Z=[])=>{this.issues=[...this.issues,...Z]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(Y){return Y.message},Z={_errors:[]},X=(Y)=>{for(let K of Y.issues)if(K.code==="invalid_union")K.unionErrors.map(X);else if(K.code==="invalid_return_type")X(K.returnTypeError);else if(K.code==="invalid_arguments")X(K.argumentsError);else if(K.path.length===0)Z._errors.push(Q(K));else{let q=Z,G=0;while(G<K.path.length){let z=K.path[G];if(G!==K.path.length-1)q[z]=q[z]||{_errors:[]};else q[z]=q[z]||{_errors:[]},q[z]._errors.push(Q(K));q=q[z],G++}}};return X(this),Z}static assert(J){if(!(J instanceof UZ))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Z=[];for(let X of this.issues)if(X.path.length>0){let Y=X.path[0];Q[Y]=Q[Y]||[],Q[Y].push(J(X))}else Z.push(J(X));return{formErrors:Z,fieldErrors:Q}}get formErrors(){return this.flatten()}};UZ.create=(J)=>{return new UZ(J)}});var CD6=(J,Q)=>{let Z;switch(J.code){case b0.invalid_type:if(J.received===r0.undefined)Z="Required";else Z=`Expected ${J.expected}, received ${J.received}`;break;case b0.invalid_literal:Z=`Invalid literal value, expected ${JSON.stringify(J.expected,V9.jsonStringifyReplacer)}`;break;case b0.unrecognized_keys:Z=`Unrecognized key(s) in object: ${V9.joinValues(J.keys,", ")}`;break;case b0.invalid_union:Z="Invalid input";break;case b0.invalid_union_discriminator:Z=`Invalid discriminator value. Expected ${V9.joinValues(J.options)}`;break;case b0.invalid_enum_value:Z=`Invalid enum value. Expected ${V9.joinValues(J.options)}, received '${J.received}'`;break;case b0.invalid_arguments:Z="Invalid function arguments";break;case b0.invalid_return_type:Z="Invalid function return type";break;case b0.invalid_date:Z="Invalid date";break;case b0.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Z=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Z=`${Z} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Z=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Z=`Invalid input: must end with "${J.validation.endsWith}"`;else V9.assertNever(J.validation);else if(J.validation!=="regex")Z=`Invalid ${J.validation}`;else Z="Invalid";break;case b0.too_small:if(J.type==="array")Z=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Z=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Z=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Z=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Z=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Z="Invalid input";break;case b0.too_big:if(J.type==="array")Z=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Z=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Z=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Z=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Z=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Z="Invalid input";break;case b0.custom:Z="Invalid input";break;case b0.invalid_intersection_types:Z="Intersection results could not be merged";break;case b0.not_multiple_of:Z=`Number must be a multiple of ${J.multipleOf}`;break;case b0.not_finite:Z="Number must be finite";break;default:Z=Q.defaultError,V9.assertNever(J)}return{message:Z}},YF;var VZ1=B1(()=>{Pd();qS();YF=CD6});function SD6(J){ul1=J}function iR(){return ul1}var ul1;var Td=B1(()=>{VZ1();ul1=YF});function U6(J,Q){let Z=iR(),X=GS({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Z,Z===YF?void 0:YF].filter((Y)=>!!Y)});J.common.issues.push(X)}class QJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Z=[];for(let X of Q){if(X.status==="aborted")return H8;if(X.status==="dirty")J.dirty();Z.push(X.value)}return{status:J.value,value:Z}}static async mergeObjectAsync(J,Q){let Z=[];for(let X of Q){let Y=await X.key,K=await X.value;Z.push({key:Y,value:K})}return QJ.mergeObjectSync(J,Z)}static mergeObjectSync(J,Q){let Z={};for(let X of Q){let{key:Y,value:K}=X;if(Y.status==="aborted")return H8;if(K.status==="aborted")return H8;if(Y.status==="dirty")J.dirty();if(K.status==="dirty")J.dirty();if(Y.value!=="__proto__"&&(typeof K.value<"u"||X.alwaysSet))Z[Y.value]=K.value}return{status:J.value,value:Z}}}var GS=(J)=>{let{data:Q,path:Z,errorMaps:X,issueData:Y}=J,K=[...Z,...Y.path||[]],q={...Y,path:K};if(Y.message!==void 0)return{...Y,path:K,message:Y.message};let G="",z=X.filter((U)=>!!U).slice().reverse();for(let U of z)G=U(q,{data:Q,defaultError:G}).message;return{...Y,path:K,message:G}},vD6,H8,vN=(J)=>({status:"dirty",value:J}),SJ=(J)=>({status:"valid",value:J}),Cd=(J)=>J.status==="aborted",Sd=(J)=>J.status==="dirty",RB=(J)=>J.status==="valid",nR=(J)=>typeof Promise<"u"&&J instanceof Promise;var NZ1=B1(()=>{Td();VZ1();vD6=[];H8=Object.freeze({status:"aborted"})});var pl1=()=>{};var k6;var dl1=B1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(k6||(k6={}))});class Jq{constructor(J,Q,Z,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Z,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function p8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Z,required_error:X,description:Y}=J;if(Q&&(Z||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:Y};return{errorMap:(q,G)=>{let{message:z}=J;if(q.code==="invalid_enum_value")return{message:z??G.defaultError};if(typeof G.data>"u")return{message:z??X??G.defaultError};if(q.code!=="invalid_type")return{message:G.defaultError};return{message:z??Z??G.defaultError}},description:Y}}class Z9{get description(){return this._def.description}_getType(J){return rG(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:rG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new QJ,ctx:{common:J.parent.common,data:J.data,parsedType:rG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(nR(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Z=this.safeParse(J,Q);if(Z.success)return Z.data;throw Z.error}safeParse(J,Q){let Z={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)},X=this._parseSync({data:J,path:Z.path,parent:Z});return cl1(Z,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)};if(!this["~standard"].async)try{let Z=this._parseSync({data:J,path:[],parent:Q});return RB(Z)?{value:Z.value}:{issues:Q.common.issues}}catch(Z){if(Z?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Z)=>RB(Z)?{value:Z.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Z=await this.safeParseAsync(J,Q);if(Z.success)return Z.data;throw Z.error}async safeParseAsync(J,Q){let Z={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)},X=this._parse({data:J,path:Z.path,parent:Z}),Y=await(nR(X)?X:Promise.resolve(X));return cl1(Z,Y)}refine(J,Q){let Z=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,Y)=>{let K=J(X),q=()=>Y.addIssue({code:b0.custom,...Z(X)});if(typeof Promise<"u"&&K instanceof Promise)return K.then((G)=>{if(!G)return q(),!1;else return!0});if(!K)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Z,X)=>{if(!J(Z))return X.addIssue(typeof Q==="function"?Q(Z,X):Q),!1;else return!0})}_refinement(J){return new Qq({schema:this,typeName:L8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return eK.create(this,this._def)}nullable(){return qF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tK.create(this)}promise(){return bN.create(this,this._def)}or(J){return eR.create([this,J],this._def)}and(J){return JO.create(this,J,this._def)}transform(J){return new Qq({...p8(this._def),schema:this,typeName:L8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new YO({...p8(this._def),innerType:this,defaultValue:Q,typeName:L8.ZodDefault})}brand(){return new kd({typeName:L8.ZodBranded,type:this,...p8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new KO({...p8(this._def),innerType:this,catchValue:Q,typeName:L8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return BS.create(this,J)}readonly(){return qO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function nl1(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Z=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Z}`}function aD6(J){return new RegExp(`^${nl1(J)}$`)}function al1(J){let Q=`${il1}T${nl1(J)}`,Z=[];if(Z.push(J.local?"Z?":"Z"),J.offset)Z.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Z.join("|")})`,new RegExp(`^${Q}$`)}function rD6(J,Q){if((Q==="v4"||!Q)&&uD6.test(J))return!0;if((Q==="v6"||!Q)&&dD6.test(J))return!0;return!1}function sD6(J,Q){if(!fD6.test(J))return!1;try{let[Z]=J.split(".");if(!Z)return!1;let X=Z.replace(/-/g,"+").replace(/_/g,"/").padEnd(Z.length+(4-Z.length%4)%4,"="),Y=JSON.parse(atob(X));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(Q&&Y.alg!==Q)return!1;return!0}catch{return!1}}function oD6(J,Q){if((Q==="v4"||!Q)&&pD6.test(J))return!0;if((Q==="v6"||!Q)&&cD6.test(J))return!0;return!1}function tD6(J,Q){let Z=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,Y=Z>X?Z:X,K=Number.parseInt(J.toFixed(Y).replace(".","")),q=Number.parseInt(Q.toFixed(Y).replace(".",""));return K%q/10**Y}function aR(J){if(J instanceof v4){let Q={};for(let Z in J.shape){let X=J.shape[Z];Q[Z]=eK.create(aR(X))}return new v4({...J._def,shape:()=>Q})}else if(J instanceof tK)return new tK({...J._def,type:aR(J.element)});else if(J instanceof eK)return eK.create(aR(J.unwrap()));else if(J instanceof qF)return qF.create(aR(J.unwrap()));else if(J instanceof oG)return oG.create(J.items.map((Q)=>aR(Q)));else return J}function AZ1(J,Q){let Z=rG(J),X=rG(Q);if(J===Q)return{valid:!0,data:J};else if(Z===r0.object&&X===r0.object){let Y=V9.objectKeys(Q),K=V9.objectKeys(J).filter((G)=>Y.indexOf(G)!==-1),q={...J,...Q};for(let G of K){let z=AZ1(J[G],Q[G]);if(!z.valid)return{valid:!1};q[G]=z.data}return{valid:!0,data:q}}else if(Z===r0.array&&X===r0.array){if(J.length!==Q.length)return{valid:!1};let Y=[];for(let K=0;K<J.length;K++){let q=J[K],G=Q[K],z=AZ1(q,G);if(!z.valid)return{valid:!1};Y.push(z.data)}return{valid:!0,data:Y}}else if(Z===r0.date&&X===r0.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function rl1(J,Q){return new EB({values:J,typeName:L8.ZodEnum,...p8(Q)})}function ll1(J,Q){let Z=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Z==="string"?{message:Z}:Z}function sl1(J,Q={},Z){if(J)return _N.create().superRefine((X,Y)=>{let K=J(X);if(K instanceof Promise)return K.then((q)=>{if(!q){let G=ll1(Q,X),z=G.fatal??Z??!0;Y.addIssue({code:"custom",...G,fatal:z})}});if(!K){let q=ll1(Q,X),G=q.fatal??Z??!0;Y.addIssue({code:"custom",...q,fatal:G})}return});return _N.create()}var cl1=(J,Q)=>{if(RB(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Z=new UZ(J.common.issues);return this._error=Z,this._error}}}},kD6,_D6,xD6,bD6,yD6,fD6,hD6,gD6,mD6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",LZ1,uD6,pD6,dD6,cD6,lD6,iD6,il1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",nD6,oK,jB,$B,sR,kN,zS,oR,tR,_N,OB,sG,US,tK,v4,eR,KF=(J)=>{if(J instanceof QO)return KF(J.schema);else if(J instanceof Qq)return KF(J.innerType());else if(J instanceof ZO)return[J.value];else if(J instanceof EB)return J.options;else if(J instanceof XO)return V9.objectValues(J.enum);else if(J instanceof YO)return KF(J._def.innerType);else if(J instanceof oR)return[void 0];else if(J instanceof tR)return[null];else if(J instanceof eK)return[void 0,...KF(J.unwrap())];else if(J instanceof qF)return[null,...KF(J.unwrap())];else if(J instanceof kd)return KF(J.unwrap());else if(J instanceof qO)return KF(J.unwrap());else if(J instanceof KO)return KF(J._def.innerType);else return[]},vd,JO,oG,FS,WS,xN,rR,QO,ZO,EB,XO,bN,Qq,eK,qF,YO,KO,HS,eD6,kd,BS,qO,JM6,L8,QM6=(J,Q={message:`Input not instance of ${J.name}`})=>sl1((Z)=>Z instanceof J,Q),ol1,tl1,ZM6,XM6,el1,YM6,KM6,qM6,GM6,zM6,UM6,FM6,WM6,HM6,BM6,DM6,MM6,VM6,NM6,LM6,AM6,wM6,RM6,OM6,jM6,$M6,EM6,IM6,PM6,TM6,CM6,SM6,vM6,kM6,_M6=()=>ol1().optional(),xM6=()=>tl1().optional(),bM6=()=>el1().optional(),yM6,fM6;var Ji1=B1(()=>{Pd();Td();dl1();NZ1();qS();kD6=/^c[^\s-]{8,}$/i,_D6=/^[0-9a-z]+$/,xD6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bD6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yD6=/^[a-z0-9_-]{21}$/i,fD6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hD6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gD6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uD6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pD6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dD6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cD6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lD6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iD6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nD6=new RegExp(`^${il1}$`);oK=class oK extends Z9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==r0.string){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.string,received:Y.parsedType}),H8}let Z=new QJ,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(J.data.length<Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Z.dirty()}else if(Y.kind==="max"){if(J.data.length>Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Z.dirty()}else if(Y.kind==="length"){let K=J.data.length>Y.value,q=J.data.length<Y.value;if(K||q){if(X=this._getOrReturnCtx(J,X),K)U6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(q)U6(X,{code:b0.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Z.dirty()}}else if(Y.kind==="email"){if(!gD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"email",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="emoji"){if(!LZ1)LZ1=new RegExp(mD6,"u");if(!LZ1.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"emoji",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="uuid"){if(!bD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"uuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="nanoid"){if(!yD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"nanoid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid"){if(!kD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid2"){if(!_D6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cuid2",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ulid"){if(!xD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"ulid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),U6(X,{validation:"url",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"regex",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="trim")J.data=J.data.trim();else if(Y.kind==="includes"){if(!J.data.includes(Y.value,Y.position))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Z.dirty()}else if(Y.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(Y.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(Y.kind==="startsWith"){if(!J.data.startsWith(Y.value))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="endsWith"){if(!J.data.endsWith(Y.value))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="datetime"){if(!al1(Y).test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"datetime",message:Y.message}),Z.dirty()}else if(Y.kind==="date"){if(!nD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"date",message:Y.message}),Z.dirty()}else if(Y.kind==="time"){if(!aD6(Y).test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"time",message:Y.message}),Z.dirty()}else if(Y.kind==="duration"){if(!hD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"duration",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ip"){if(!rD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),U6(X,{validation:"ip",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="jwt"){if(!sD6(J.data,Y.alg))X=this._getOrReturnCtx(J,X),U6(X,{validation:"jwt",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cidr"){if(!oD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cidr",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64"){if(!lD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"base64",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64url"){if(!iD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"base64url",code:b0.invalid_string,message:Y.message}),Z.dirty()}else V9.assertNever(Y);return{status:Z.value,value:J.data}}_regex(J,Q,Z){return this.refinement((X)=>J.test(X),{validation:Q,code:b0.invalid_string,...k6.errToObj(Z)})}_addCheck(J){return new oK({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...k6.errToObj(J)})}url(J){return this._addCheck({kind:"url",...k6.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...k6.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...k6.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...k6.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...k6.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...k6.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...k6.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...k6.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...k6.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...k6.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...k6.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...k6.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...k6.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...k6.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...k6.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...k6.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...k6.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...k6.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...k6.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...k6.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...k6.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...k6.errToObj(Q)})}nonempty(J){return this.min(1,k6.errToObj(J))}trim(){return new oK({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oK({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oK({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};oK.create=(J)=>{return new oK({checks:[],typeName:L8.ZodString,coerce:J?.coerce??!1,...p8(J)})};jB=class jB extends Z9{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==r0.number){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.number,received:Y.parsedType}),H8}let Z=void 0,X=new QJ;for(let Y of this._def.checks)if(Y.kind==="int"){if(!V9.isInteger(J.data))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.invalid_type,expected:"integer",received:"float",message:Y.message}),X.dirty()}else if(Y.kind==="min"){if(Y.inclusive?J.data<Y.value:J.data<=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?J.data>Y.value:J.data>=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(tD6(J.data,Y.value)!==0)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(J.data))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_finite,message:Y.message}),X.dirty()}else V9.assertNever(Y);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,k6.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,k6.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,k6.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,k6.toString(Q))}setLimit(J,Q,Z,X){return new jB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new jB({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:k6.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k6.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k6.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k6.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k6.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:k6.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:k6.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k6.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k6.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&V9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Z of this._def.checks)if(Z.kind==="finite"||Z.kind==="int"||Z.kind==="multipleOf")return!0;else if(Z.kind==="min"){if(Q===null||Z.value>Q)Q=Z.value}else if(Z.kind==="max"){if(J===null||Z.value<J)J=Z.value}return Number.isFinite(Q)&&Number.isFinite(J)}};jB.create=(J)=>{return new jB({checks:[],typeName:L8.ZodNumber,coerce:J?.coerce||!1,...p8(J)})};$B=class $B extends Z9{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==r0.bigint)return this._getInvalidInput(J);let Z=void 0,X=new QJ;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?J.data<Y.value:J.data<=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?J.data>Y.value:J.data>=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(J.data%Y.value!==BigInt(0))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else V9.assertNever(Y);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return U6(Q,{code:b0.invalid_type,expected:r0.bigint,received:Q.parsedType}),H8}gte(J,Q){return this.setLimit("min",J,!0,k6.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,k6.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,k6.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,k6.toString(Q))}setLimit(J,Q,Z,X){return new $B({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new $B({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k6.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k6.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k6.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k6.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:k6.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};$B.create=(J)=>{return new $B({checks:[],typeName:L8.ZodBigInt,coerce:J?.coerce??!1,...p8(J)})};sR=class sR extends Z9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==r0.boolean){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.boolean,received:Z.parsedType}),H8}return SJ(J.data)}};sR.create=(J)=>{return new sR({typeName:L8.ZodBoolean,coerce:J?.coerce||!1,...p8(J)})};kN=class kN extends Z9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==r0.date){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.date,received:Y.parsedType}),H8}if(Number.isNaN(J.data.getTime())){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_date}),H8}let Z=new QJ,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(J.data.getTime()<Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Z.dirty()}else if(Y.kind==="max"){if(J.data.getTime()>Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Z.dirty()}else V9.assertNever(Y);return{status:Z.value,value:new Date(J.data.getTime())}}_addCheck(J){return new kN({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:k6.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:k6.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};kN.create=(J)=>{return new kN({checks:[],coerce:J?.coerce||!1,typeName:L8.ZodDate,...p8(J)})};zS=class zS extends Z9{_parse(J){if(this._getType(J)!==r0.symbol){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.symbol,received:Z.parsedType}),H8}return SJ(J.data)}};zS.create=(J)=>{return new zS({typeName:L8.ZodSymbol,...p8(J)})};oR=class oR extends Z9{_parse(J){if(this._getType(J)!==r0.undefined){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.undefined,received:Z.parsedType}),H8}return SJ(J.data)}};oR.create=(J)=>{return new oR({typeName:L8.ZodUndefined,...p8(J)})};tR=class tR extends Z9{_parse(J){if(this._getType(J)!==r0.null){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.null,received:Z.parsedType}),H8}return SJ(J.data)}};tR.create=(J)=>{return new tR({typeName:L8.ZodNull,...p8(J)})};_N=class _N extends Z9{constructor(){super(...arguments);this._any=!0}_parse(J){return SJ(J.data)}};_N.create=(J)=>{return new _N({typeName:L8.ZodAny,...p8(J)})};OB=class OB extends Z9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return SJ(J.data)}};OB.create=(J)=>{return new OB({typeName:L8.ZodUnknown,...p8(J)})};sG=class sG extends Z9{_parse(J){let Q=this._getOrReturnCtx(J);return U6(Q,{code:b0.invalid_type,expected:r0.never,received:Q.parsedType}),H8}};sG.create=(J)=>{return new sG({typeName:L8.ZodNever,...p8(J)})};US=class US extends Z9{_parse(J){if(this._getType(J)!==r0.undefined){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.void,received:Z.parsedType}),H8}return SJ(J.data)}};US.create=(J)=>{return new US({typeName:L8.ZodVoid,...p8(J)})};tK=class tK extends Z9{_parse(J){let{ctx:Q,status:Z}=this._processInputParams(J),X=this._def;if(Q.parsedType!==r0.array)return U6(Q,{code:b0.invalid_type,expected:r0.array,received:Q.parsedType}),H8;if(X.exactLength!==null){let K=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(K||q)U6(Q,{code:K?b0.too_big:b0.too_small,minimum:q?X.exactLength.value:void 0,maximum:K?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Z.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)U6(Q,{code:b0.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Z.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)U6(Q,{code:b0.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Z.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((K,q)=>{return X.type._parseAsync(new Jq(Q,K,Q.path,q))})).then((K)=>{return QJ.mergeArray(Z,K)});let Y=[...Q.data].map((K,q)=>{return X.type._parseSync(new Jq(Q,K,Q.path,q))});return QJ.mergeArray(Z,Y)}get element(){return this._def.type}min(J,Q){return new tK({...this._def,minLength:{value:J,message:k6.toString(Q)}})}max(J,Q){return new tK({...this._def,maxLength:{value:J,message:k6.toString(Q)}})}length(J,Q){return new tK({...this._def,exactLength:{value:J,message:k6.toString(Q)}})}nonempty(J){return this.min(1,J)}};tK.create=(J,Q)=>{return new tK({type:J,minLength:null,maxLength:null,exactLength:null,typeName:L8.ZodArray,...p8(Q)})};v4=class v4 extends Z9{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=V9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==r0.object){let z=this._getOrReturnCtx(J);return U6(z,{code:b0.invalid_type,expected:r0.object,received:z.parsedType}),H8}let{status:Z,ctx:X}=this._processInputParams(J),{shape:Y,keys:K}=this._getCached(),q=[];if(!(this._def.catchall instanceof sG&&this._def.unknownKeys==="strip")){for(let z in X.data)if(!K.includes(z))q.push(z)}let G=[];for(let z of K){let U=Y[z],F=X.data[z];G.push({key:{status:"valid",value:z},value:U._parse(new Jq(X,F,X.path,z)),alwaysSet:z in X.data})}if(this._def.catchall instanceof sG){let z=this._def.unknownKeys;if(z==="passthrough")for(let U of q)G.push({key:{status:"valid",value:U},value:{status:"valid",value:X.data[U]}});else if(z==="strict"){if(q.length>0)U6(X,{code:b0.unrecognized_keys,keys:q}),Z.dirty()}else if(z==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let z=this._def.catchall;for(let U of q){let F=X.data[U];G.push({key:{status:"valid",value:U},value:z._parse(new Jq(X,F,X.path,U)),alwaysSet:U in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let z=[];for(let U of G){let F=await U.key,W=await U.value;z.push({key:F,value:W,alwaysSet:U.alwaysSet})}return z}).then((z)=>{return QJ.mergeObjectSync(Z,z)});else return QJ.mergeObjectSync(Z,G)}get shape(){return this._def.shape()}strict(J){return k6.errToObj,new v4({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Z)=>{let X=this._def.errorMap?.(Q,Z).message??Z.defaultError;if(Q.code==="unrecognized_keys")return{message:k6.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new v4({...this._def,unknownKeys:"strip"})}passthrough(){return new v4({...this._def,unknownKeys:"passthrough"})}extend(J){return new v4({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new v4({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:L8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new v4({...this._def,catchall:J})}pick(J){let Q={};for(let Z of V9.objectKeys(J))if(J[Z]&&this.shape[Z])Q[Z]=this.shape[Z];return new v4({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Z of V9.objectKeys(this.shape))if(!J[Z])Q[Z]=this.shape[Z];return new v4({...this._def,shape:()=>Q})}deepPartial(){return aR(this)}partial(J){let Q={};for(let Z of V9.objectKeys(this.shape)){let X=this.shape[Z];if(J&&!J[Z])Q[Z]=X;else Q[Z]=X.optional()}return new v4({...this._def,shape:()=>Q})}required(J){let Q={};for(let Z of V9.objectKeys(this.shape))if(J&&!J[Z])Q[Z]=this.shape[Z];else{let Y=this.shape[Z];while(Y instanceof eK)Y=Y._def.innerType;Q[Z]=Y}return new v4({...this._def,shape:()=>Q})}keyof(){return rl1(V9.objectKeys(this.shape))}};v4.create=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strip",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};v4.strictCreate=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strict",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};v4.lazycreate=(J,Q)=>{return new v4({shape:J,unknownKeys:"strip",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};eR=class eR extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=this._def.options;function X(Y){for(let q of Y)if(q.result.status==="valid")return q.result;for(let q of Y)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let K=Y.map((q)=>new UZ(q.ctx.common.issues));return U6(Q,{code:b0.invalid_union,unionErrors:K}),H8}if(Q.common.async)return Promise.all(Z.map(async(Y)=>{let K={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:Q.data,path:Q.path,parent:K}),ctx:K}})).then(X);else{let Y=void 0,K=[];for(let G of Z){let z={...Q,common:{...Q.common,issues:[]},parent:null},U=G._parseSync({data:Q.data,path:Q.path,parent:z});if(U.status==="valid")return U;else if(U.status==="dirty"&&!Y)Y={result:U,ctx:z};if(z.common.issues.length)K.push(z.common.issues)}if(Y)return Q.common.issues.push(...Y.ctx.common.issues),Y.result;let q=K.map((G)=>new UZ(G));return U6(Q,{code:b0.invalid_union,unionErrors:q}),H8}}get options(){return this._def.options}};eR.create=(J,Q)=>{return new eR({options:J,typeName:L8.ZodUnion,...p8(Q)})};vd=class vd extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.object)return U6(Q,{code:b0.invalid_type,expected:r0.object,received:Q.parsedType}),H8;let Z=this.discriminator,X=Q.data[Z],Y=this.optionsMap.get(X);if(!Y)return U6(Q,{code:b0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Z]}),H8;if(Q.common.async)return Y._parseAsync({data:Q.data,path:Q.path,parent:Q});else return Y._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Z){let X=new Map;for(let Y of Q){let K=KF(Y.shape[J]);if(!K.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of K){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,Y)}}return new vd({typeName:L8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...p8(Z)})}};JO=class JO extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=(Y,K)=>{if(Cd(Y)||Cd(K))return H8;let q=AZ1(Y.value,K.value);if(!q.valid)return U6(Z,{code:b0.invalid_intersection_types}),H8;if(Sd(Y)||Sd(K))Q.dirty();return{status:Q.value,value:q.data}};if(Z.common.async)return Promise.all([this._def.left._parseAsync({data:Z.data,path:Z.path,parent:Z}),this._def.right._parseAsync({data:Z.data,path:Z.path,parent:Z})]).then(([Y,K])=>X(Y,K));else return X(this._def.left._parseSync({data:Z.data,path:Z.path,parent:Z}),this._def.right._parseSync({data:Z.data,path:Z.path,parent:Z}))}};JO.create=(J,Q,Z)=>{return new JO({left:J,right:Q,typeName:L8.ZodIntersection,...p8(Z)})};oG=class oG extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.array)return U6(Z,{code:b0.invalid_type,expected:r0.array,received:Z.parsedType}),H8;if(Z.data.length<this._def.items.length)return U6(Z,{code:b0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H8;if(!this._def.rest&&Z.data.length>this._def.items.length)U6(Z,{code:b0.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let Y=[...Z.data].map((K,q)=>{let G=this._def.items[q]||this._def.rest;if(!G)return null;return G._parse(new Jq(Z,K,Z.path,q))}).filter((K)=>!!K);if(Z.common.async)return Promise.all(Y).then((K)=>{return QJ.mergeArray(Q,K)});else return QJ.mergeArray(Q,Y)}get items(){return this._def.items}rest(J){return new oG({...this._def,rest:J})}};oG.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new oG({items:J,typeName:L8.ZodTuple,rest:null,...p8(Q)})};FS=class FS extends Z9{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.object)return U6(Z,{code:b0.invalid_type,expected:r0.object,received:Z.parsedType}),H8;let X=[],Y=this._def.keyType,K=this._def.valueType;for(let q in Z.data)X.push({key:Y._parse(new Jq(Z,q,Z.path,q)),value:K._parse(new Jq(Z,Z.data[q],Z.path,q)),alwaysSet:q in Z.data});if(Z.common.async)return QJ.mergeObjectAsync(Q,X);else return QJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Z){if(Q instanceof Z9)return new FS({keyType:J,valueType:Q,typeName:L8.ZodRecord,...p8(Z)});return new FS({keyType:oK.create(),valueType:J,typeName:L8.ZodRecord,...p8(Q)})}};WS=class WS extends Z9{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.map)return U6(Z,{code:b0.invalid_type,expected:r0.map,received:Z.parsedType}),H8;let X=this._def.keyType,Y=this._def.valueType,K=[...Z.data.entries()].map(([q,G],z)=>{return{key:X._parse(new Jq(Z,q,Z.path,[z,"key"])),value:Y._parse(new Jq(Z,G,Z.path,[z,"value"]))}});if(Z.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let G of K){let z=await G.key,U=await G.value;if(z.status==="aborted"||U.status==="aborted")return H8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let G of K){let{key:z,value:U}=G;if(z.status==="aborted"||U.status==="aborted")return H8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}}}};WS.create=(J,Q,Z)=>{return new WS({valueType:Q,keyType:J,typeName:L8.ZodMap,...p8(Z)})};xN=class xN extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.set)return U6(Z,{code:b0.invalid_type,expected:r0.set,received:Z.parsedType}),H8;let X=this._def;if(X.minSize!==null){if(Z.data.size<X.minSize.value)U6(Z,{code:b0.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Z.data.size>X.maxSize.value)U6(Z,{code:b0.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let Y=this._def.valueType;function K(G){let z=new Set;for(let U of G){if(U.status==="aborted")return H8;if(U.status==="dirty")Q.dirty();z.add(U.value)}return{status:Q.value,value:z}}let q=[...Z.data.values()].map((G,z)=>Y._parse(new Jq(Z,G,Z.path,z)));if(Z.common.async)return Promise.all(q).then((G)=>K(G));else return K(q)}min(J,Q){return new xN({...this._def,minSize:{value:J,message:k6.toString(Q)}})}max(J,Q){return new xN({...this._def,maxSize:{value:J,message:k6.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};xN.create=(J,Q)=>{return new xN({valueType:J,minSize:null,maxSize:null,typeName:L8.ZodSet,...p8(Q)})};rR=class rR extends Z9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.function)return U6(Q,{code:b0.invalid_type,expected:r0.function,received:Q.parsedType}),H8;function Z(q,G){return GS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,iR(),YF].filter((z)=>!!z),issueData:{code:b0.invalid_arguments,argumentsError:G}})}function X(q,G){return GS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,iR(),YF].filter((z)=>!!z),issueData:{code:b0.invalid_return_type,returnTypeError:G}})}let Y={errorMap:Q.common.contextualErrorMap},K=Q.data;if(this._def.returns instanceof bN){let q=this;return SJ(async function(...G){let z=new UZ([]),U=await q._def.args.parseAsync(G,Y).catch((H)=>{throw z.addIssue(Z(G,H)),z}),F=await Reflect.apply(K,this,U);return await q._def.returns._def.type.parseAsync(F,Y).catch((H)=>{throw z.addIssue(X(F,H)),z})})}else{let q=this;return SJ(function(...G){let z=q._def.args.safeParse(G,Y);if(!z.success)throw new UZ([Z(G,z.error)]);let U=Reflect.apply(K,this,z.data),F=q._def.returns.safeParse(U,Y);if(!F.success)throw new UZ([X(U,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new rR({...this._def,args:oG.create(J).rest(OB.create())})}returns(J){return new rR({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Z){return new rR({args:J?J:oG.create([]).rest(OB.create()),returns:Q||OB.create(),typeName:L8.ZodFunction,...p8(Z)})}};QO=class QO extends Z9{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};QO.create=(J,Q)=>{return new QO({getter:J,typeName:L8.ZodLazy,...p8(Q)})};ZO=class ZO extends Z9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return U6(Q,{received:Q.data,code:b0.invalid_literal,expected:this._def.value}),H8}return{status:"valid",value:J.data}}get value(){return this._def.value}};ZO.create=(J,Q)=>{return new ZO({value:J,typeName:L8.ZodLiteral,...p8(Q)})};EB=class EB extends Z9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Z=this._def.values;return U6(Q,{expected:V9.joinValues(Z),received:Q.parsedType,code:b0.invalid_type}),H8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Z=this._def.values;return U6(Q,{received:Q.data,code:b0.invalid_enum_value,options:Z}),H8}return SJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return EB.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return EB.create(this.options.filter((Z)=>!J.includes(Z)),{...this._def,...Q})}};EB.create=rl1;XO=class XO extends Z9{_parse(J){let Q=V9.getValidEnumValues(this._def.values),Z=this._getOrReturnCtx(J);if(Z.parsedType!==r0.string&&Z.parsedType!==r0.number){let X=V9.objectValues(Q);return U6(Z,{expected:V9.joinValues(X),received:Z.parsedType,code:b0.invalid_type}),H8}if(!this._cache)this._cache=new Set(V9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=V9.objectValues(Q);return U6(Z,{received:Z.data,code:b0.invalid_enum_value,options:X}),H8}return SJ(J.data)}get enum(){return this._def.values}};XO.create=(J,Q)=>{return new XO({values:J,typeName:L8.ZodNativeEnum,...p8(Q)})};bN=class bN extends Z9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.promise&&Q.common.async===!1)return U6(Q,{code:b0.invalid_type,expected:r0.promise,received:Q.parsedType}),H8;let Z=Q.parsedType===r0.promise?Q.data:Promise.resolve(Q.data);return SJ(Z.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};bN.create=(J,Q)=>{return new bN({type:J,typeName:L8.ZodPromise,...p8(Q)})};Qq=class Qq extends Z9{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=this._def.effect||null,Y={addIssue:(K)=>{if(U6(Z,K),K.fatal)Q.abort();else Q.dirty()},get path(){return Z.path}};if(Y.addIssue=Y.addIssue.bind(Y),X.type==="preprocess"){let K=X.transform(Z.data,Y);if(Z.common.async)return Promise.resolve(K).then(async(q)=>{if(Q.value==="aborted")return H8;let G=await this._def.schema._parseAsync({data:q,path:Z.path,parent:Z});if(G.status==="aborted")return H8;if(G.status==="dirty")return vN(G.value);if(Q.value==="dirty")return vN(G.value);return G});else{if(Q.value==="aborted")return H8;let q=this._def.schema._parseSync({data:K,path:Z.path,parent:Z});if(q.status==="aborted")return H8;if(q.status==="dirty")return vN(q.value);if(Q.value==="dirty")return vN(q.value);return q}}if(X.type==="refinement"){let K=(q)=>{let G=X.refinement(q,Y);if(Z.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Z.common.async===!1){let q=this._def.schema._parseSync({data:Z.data,path:Z.path,parent:Z});if(q.status==="aborted")return H8;if(q.status==="dirty")Q.dirty();return K(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Z.data,path:Z.path,parent:Z}).then((q)=>{if(q.status==="aborted")return H8;if(q.status==="dirty")Q.dirty();return K(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Z.common.async===!1){let K=this._def.schema._parseSync({data:Z.data,path:Z.path,parent:Z});if(!RB(K))return H8;let q=X.transform(K.value,Y);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Z.data,path:Z.path,parent:Z}).then((K)=>{if(!RB(K))return H8;return Promise.resolve(X.transform(K.value,Y)).then((q)=>({status:Q.value,value:q}))});V9.assertNever(X)}};Qq.create=(J,Q,Z)=>{return new Qq({schema:J,typeName:L8.ZodEffects,effect:Q,...p8(Z)})};Qq.createWithPreprocess=(J,Q,Z)=>{return new Qq({schema:Q,effect:{type:"preprocess",transform:J},typeName:L8.ZodEffects,...p8(Z)})};eK=class eK extends Z9{_parse(J){if(this._getType(J)===r0.undefined)return SJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};eK.create=(J,Q)=>{return new eK({innerType:J,typeName:L8.ZodOptional,...p8(Q)})};qF=class qF extends Z9{_parse(J){if(this._getType(J)===r0.null)return SJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};qF.create=(J,Q)=>{return new qF({innerType:J,typeName:L8.ZodNullable,...p8(Q)})};YO=class YO extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;if(Q.parsedType===r0.undefined)Z=this._def.defaultValue();return this._def.innerType._parse({data:Z,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};YO.create=(J,Q)=>{return new YO({innerType:J,typeName:L8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...p8(Q)})};KO=class KO extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Z.data,path:Z.path,parent:{...Z}});if(nR(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new UZ(Z.common.issues)},input:Z.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new UZ(Z.common.issues)},input:Z.data})}}removeCatch(){return this._def.innerType}};KO.create=(J,Q)=>{return new KO({innerType:J,typeName:L8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...p8(Q)})};HS=class HS extends Z9{_parse(J){if(this._getType(J)!==r0.nan){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.nan,received:Z.parsedType}),H8}return{status:"valid",value:J.data}}};HS.create=(J)=>{return new HS({typeName:L8.ZodNaN,...p8(J)})};eD6=Symbol("zod_brand");kd=class kd extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;return this._def.type._parse({data:Z,path:Q.path,parent:Q})}unwrap(){return this._def.type}};BS=class BS extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Z.data,path:Z.path,parent:Z});if(Y.status==="aborted")return H8;if(Y.status==="dirty")return Q.dirty(),vN(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Z.path,parent:Z})})();else{let X=this._def.in._parseSync({data:Z.data,path:Z.path,parent:Z});if(X.status==="aborted")return H8;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Z.path,parent:Z})}}static create(J,Q){return new BS({in:J,out:Q,typeName:L8.ZodPipeline})}};qO=class qO extends Z9{_parse(J){let Q=this._def.innerType._parse(J),Z=(X)=>{if(RB(X))X.value=Object.freeze(X.value);return X};return nR(Q)?Q.then((X)=>Z(X)):Z(Q)}unwrap(){return this._def.innerType}};qO.create=(J,Q)=>{return new qO({innerType:J,typeName:L8.ZodReadonly,...p8(Q)})};JM6={object:v4.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})(L8||(L8={}));ol1=oK.create,tl1=jB.create,ZM6=HS.create,XM6=$B.create,el1=sR.create,YM6=kN.create,KM6=zS.create,qM6=oR.create,GM6=tR.create,zM6=_N.create,UM6=OB.create,FM6=sG.create,WM6=US.create,HM6=tK.create,BM6=v4.create,DM6=v4.strictCreate,MM6=eR.create,VM6=vd.create,NM6=JO.create,LM6=oG.create,AM6=FS.create,wM6=WS.create,RM6=xN.create,OM6=rR.create,jM6=QO.create,$M6=ZO.create,EM6=EB.create,IM6=XO.create,PM6=bN.create,TM6=Qq.create,CM6=eK.create,SM6=qF.create,vM6=Qq.createWithPreprocess,kM6=BS.create,yM6={string:(J)=>oK.create({...J,coerce:!0}),number:(J)=>jB.create({...J,coerce:!0}),boolean:(J)=>sR.create({...J,coerce:!0}),bigint:(J)=>$B.create({...J,coerce:!0}),date:(J)=>kN.create({...J,coerce:!0})},fM6=H8});var Q1={};R6(Q1,{void:()=>WM6,util:()=>V9,unknown:()=>UM6,union:()=>MM6,undefined:()=>qM6,tuple:()=>LM6,transformer:()=>TM6,symbol:()=>KM6,string:()=>ol1,strictObject:()=>DM6,setErrorMap:()=>SD6,set:()=>RM6,record:()=>AM6,quotelessJson:()=>TD6,promise:()=>PM6,preprocess:()=>vM6,pipeline:()=>kM6,ostring:()=>_M6,optional:()=>CM6,onumber:()=>xM6,oboolean:()=>bM6,objectUtil:()=>MZ1,object:()=>BM6,number:()=>tl1,nullable:()=>SM6,null:()=>GM6,never:()=>FM6,nativeEnum:()=>IM6,nan:()=>ZM6,map:()=>wM6,makeIssue:()=>GS,literal:()=>$M6,lazy:()=>jM6,late:()=>JM6,isValid:()=>RB,isDirty:()=>Sd,isAsync:()=>nR,isAborted:()=>Cd,intersection:()=>NM6,instanceof:()=>QM6,getParsedType:()=>rG,getErrorMap:()=>iR,function:()=>OM6,enum:()=>EM6,effect:()=>TM6,discriminatedUnion:()=>VM6,defaultErrorMap:()=>YF,datetimeRegex:()=>al1,date:()=>YM6,custom:()=>sl1,coerce:()=>yM6,boolean:()=>el1,bigint:()=>XM6,array:()=>HM6,any:()=>zM6,addIssueToContext:()=>U6,ZodVoid:()=>US,ZodUnknown:()=>OB,ZodUnion:()=>eR,ZodUndefined:()=>oR,ZodType:()=>Z9,ZodTuple:()=>oG,ZodTransformer:()=>Qq,ZodSymbol:()=>zS,ZodString:()=>oK,ZodSet:()=>xN,ZodSchema:()=>Z9,ZodRecord:()=>FS,ZodReadonly:()=>qO,ZodPromise:()=>bN,ZodPipeline:()=>BS,ZodParsedType:()=>r0,ZodOptional:()=>eK,ZodObject:()=>v4,ZodNumber:()=>jB,ZodNullable:()=>qF,ZodNull:()=>tR,ZodNever:()=>sG,ZodNativeEnum:()=>XO,ZodNaN:()=>HS,ZodMap:()=>WS,ZodLiteral:()=>ZO,ZodLazy:()=>QO,ZodIssueCode:()=>b0,ZodIntersection:()=>JO,ZodFunction:()=>rR,ZodFirstPartyTypeKind:()=>L8,ZodError:()=>UZ,ZodEnum:()=>EB,ZodEffects:()=>Qq,ZodDiscriminatedUnion:()=>vd,ZodDefault:()=>YO,ZodDate:()=>kN,ZodCatch:()=>KO,ZodBranded:()=>kd,ZodBoolean:()=>sR,ZodBigInt:()=>$B,ZodArray:()=>tK,ZodAny:()=>_N,Schema:()=>Z9,ParseStatus:()=>QJ,OK:()=>SJ,NEVER:()=>fM6,INVALID:()=>H8,EMPTY_PATH:()=>vD6,DIRTY:()=>vN,BRAND:()=>eD6});var wZ1=B1(()=>{Td();NZ1();pl1();qS();Ji1();Pd()});var GF=B1(()=>{wZ1();wZ1()});function gM6(J){return Qi1.safeParse(J)}function IB(J){return hM6.safeParse(J)}function GO(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Z,X]of J.entries()){let Y=gM6(X);if(Y.success)Q.push(Y.data);else{let K=typeof X==="object"&&X!==null&&"tool"in X?String(X.tool):`entry at index ${Z}`;l.warn(`Permission entry for tool "${K}" is invalid: ${Y.error.errors.map((q)=>`${q.path.join(".")}: ${q.message}`).join(", ")}`)}}return Q}var RZ1,Qi1,hM6;var yN=B1(()=>{GF();z0();RZ1=Q1.lazy(()=>Q1.union([Q1.string().describe('Pattern match where "*" matches any number of any characters'),Q1.array(RZ1).min(1).describe("OR match of each entry"),Q1.boolean().describe("A literal boolean match"),Q1.number().describe("A literal number match"),Q1.null().describe("A literal null match"),Q1.undefined().describe("A literal undefined match"),Q1.record(Q1.string(),RZ1).describe("Matching individual keys of an object")])),Qi1=Q1.object({tool:Q1.string().min(1).describe("The name of the tool to which this entry applies"),matches:Q1.record(Q1.string(),RZ1).optional().describe("Maps tool inputs to conditions"),action:Q1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:Q1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:Q1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((J,Q)=>{if(J.action==="delegate"&&!J.to)Q.addIssue({code:Q1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(J.action!=="delegate"&&J.to)Q.addIssue({code:Q1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),hM6=Q1.array(Qi1).describe("Entries checked in sequence to configure tool permissions")});function FZ(J,Q){let Z=mM6(J,Q);return typeof Z==="string"?Z:Z.toString()}function mM6(J,Q,Z=!0){if(!Q)Q=uM6();let{workspaceFolders:X,isWindows:Y,homeDir:K}=Q,q=typeof J==="string"?j0.parse(J):j0.from(J);if(X)for(let G of X){let z=W8(G);if(y0.hasPrefix(q,z)){let U=z.path.endsWith("/")?z.path.slice(0,-1):z.path,W=Z&&X&&X.length>=2?$N(z.path)+(Y?"\\":"/"):"";return OZ1(W+q.path.slice(U.length+1),Y,q.scheme)}}if(q?.scheme==="file"){if(K){let G=W8(K);if(y0.hasPrefix(q,G)){let z=G.path.endsWith("/")?G.path.slice(0,-1):G.path,U=q.path.slice(z.length+1);return OZ1("~"+(Y?"\\":"/")+U,Y,q.scheme)}}return OZ1(q.fsPath,Y,q.scheme)}return q}function OZ1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function xd(J){let Q=_d;return _d=J,Q}function uM6(){if(_d)return _d;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var _d=null;var PB=B1(()=>{_6();gR();JZ1()});function vJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function gN(J){return!!J&&!!J[VX]}function TB(J){if(!J)return!1;return qi1(J)||Array.isArray(J)||!!J[DS]||!!J.constructor?.[DS]||AS(J)||wS(J)}function qi1(J){if(!J||typeof J!=="object")return!1;let Q=hN(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)===pM6}function MS(J,Q){if(mN(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,X)=>Q(X,Z,J))}function mN(J){let Q=J[VX];return Q?Q.type_:Array.isArray(J)?1:AS(J)?2:wS(J)?3:0}function VS(J,Q){return mN(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function jZ1(J,Q){return mN(J)===2?J.get(Q):J[Q]}function Gi1(J,Q,Z){let X=mN(J);if(X===2)J.set(Q,Z);else if(X===3)J.add(Z);else J[Q]=Z}function dM6(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function AS(J){return J instanceof Map}function wS(J){return J instanceof Set}function fN(J){return J.copy_||J.base_}function IZ1(J,Q){if(AS(J))return new Map(J);if(wS(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=qi1(J);if(Q===!0||Q==="class_only"&&!Z){let X=Object.getOwnPropertyDescriptors(J);delete X[VX];let Y=Reflect.ownKeys(X);for(let K=0;K<Y.length;K++){let q=Y[K],G=X[q];if(G.writable===!1)G.writable=!0,G.configurable=!0;if(G.get||G.set)X[q]={configurable:!0,writable:!0,enumerable:G.enumerable,value:J[q]}}return Object.create(hN(J),X)}else{let X=hN(J);if(X!==null&&Z)return{...J};let Y=Object.create(X);return Object.assign(Y,J)}}function LQ(J,Q=!1){if(fd(J)||gN(J)||!TB(J))return J;if(mN(J)>1)J.set=J.add=J.clear=J.delete=cM6;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,X])=>LQ(X,!0));return J}function cM6(){vJ(2)}function fd(J){return Object.isFrozen(J)}function uN(J){let Q=PZ1[J];if(!Q)vJ(0,J);return Q}function lM6(J,Q){if(!PZ1[J])PZ1[J]=Q}function zi1(){return NS}function iM6(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zi1(J,Q){if(Q)uN("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function TZ1(J){CZ1(J),J.drafts_.forEach(nM6),J.drafts_=null}function CZ1(J){if(J===NS)NS=J.parent_}function Xi1(J){return NS=iM6(NS,J)}function nM6(J){let Q=J[VX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function Yi1(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[VX].modified_)TZ1(Q),vJ(4);if(TB(J)){if(J=bd(Q,J),!Q.parent_)yd(Q,J)}if(Q.patches_)uN("Patches").generateReplacementPatches_(Z[VX].base_,J,Q.patches_,Q.inversePatches_)}else J=bd(Q,Z,[]);if(TZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==kZ1?J:void 0}function bd(J,Q,Z){if(fd(Q))return Q;let X=Q[VX];if(!X)return MS(Q,(Y,K)=>Ki1(J,X,Q,Y,K,Z)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return yd(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let Y=X.copy_,K=Y,q=!1;if(X.type_===3)K=new Set(Y),Y.clear(),q=!0;if(MS(K,(G,z)=>Ki1(J,X,Y,G,z,Z,q)),yd(J,Y,!1),Z&&J.patches_)uN("Patches").generatePatches_(X,Z,J.patches_,J.inversePatches_)}return X.copy_}function Ki1(J,Q,Z,X,Y,K,q){if(gN(Y)){let G=K&&Q&&Q.type_!==3&&!VS(Q.assigned_,X)?K.concat(X):void 0,z=bd(J,Y,G);if(Gi1(Z,X,z),gN(z))J.canAutoFreeze_=!1;else return}else if(q)Z.add(Y);if(TB(Y)&&!fd(Y)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(bd(J,Y),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,X))yd(J,Y)}}function yd(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)LQ(Q,Z)}function aM6(J,Q){let Z=Array.isArray(J),X={type_:Z?1:0,scope_:Q?Q.scope_:zi1(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=X,K=_Z1;if(Z)Y=[X],K=LS;let{revoke:q,proxy:G}=Proxy.revocable(Y,K);return X.draft_=G,X.revoke_=q,G}function $Z1(J,Q){let Z=J[VX];return(Z?fN(Z):J)[Q]}function rM6(J,Q,Z){let X=Ui1(Q,Z);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function Ui1(J,Q){if(!(Q in J))return;let Z=hN(J);while(Z){let X=Object.getOwnPropertyDescriptor(Z,Q);if(X)return X;Z=hN(Z)}return}function SZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)SZ1(J.parent_)}}function EZ1(J){if(!J.copy_)J.copy_=IZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function vZ1(J,Q){let Z=AS(J)?uN("MapSet").proxyMap_(J,Q):wS(J)?uN("MapSet").proxySet_(J,Q):aM6(J,Q);return(Q?Q.scope_:zi1()).drafts_.push(Z),Z}function oM6(J){if(!gN(J))vJ(10,J);return Fi1(J)}function Fi1(J){if(!TB(J)||fd(J))return J;let Q=J[VX],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=IZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=IZ1(J,!0);if(MS(Z,(X,Y)=>{Gi1(Z,X,Fi1(Y))}),Q)Q.finalized_=!1;return Z}function hd(){let Q="replace",Z="add",X="remove";function Y(H,B,M,V){switch(H.type_){case 0:case 2:return q(H,B,M,V);case 1:return K(H,B,M,V);case 3:return G(H,B,M,V)}}function K(H,B,M,V){let{base_:N,assigned_:L}=H,A=H.copy_;if(A.length<N.length)[N,A]=[A,N],[M,V]=[V,M];for(let w=0;w<N.length;w++)if(L[w]&&A[w]!==N[w]){let R=B.concat([w]);M.push({op:Q,path:R,value:W(A[w])}),V.push({op:Q,path:R,value:W(N[w])})}for(let w=N.length;w<A.length;w++){let R=B.concat([w]);M.push({op:Z,path:R,value:W(A[w])})}for(let w=A.length-1;N.length<=w;--w){let R=B.concat([w]);V.push({op:X,path:R})}}function q(H,B,M,V){let{base_:N,copy_:L}=H;MS(H.assigned_,(A,w)=>{let R=jZ1(N,A),O=jZ1(L,A),j=!w?X:VS(N,A)?Q:Z;if(R===O&&j===Q)return;let $=B.concat(A);M.push(j===X?{op:j,path:$}:{op:j,path:$,value:O}),V.push(j===Z?{op:X,path:$}:j===X?{op:Z,path:$,value:W(R)}:{op:Q,path:$,value:W(R)})})}function G(H,B,M,V){let{base_:N,copy_:L}=H,A=0;N.forEach((w)=>{if(!L.has(w)){let R=B.concat([A]);M.push({op:X,path:R,value:w}),V.unshift({op:Z,path:R,value:w})}A++}),A=0,L.forEach((w)=>{if(!N.has(w)){let R=B.concat([A]);M.push({op:Z,path:R,value:w}),V.unshift({op:X,path:R,value:w})}A++})}function z(H,B,M,V){M.push({op:Q,path:[],value:B===kZ1?void 0:B}),V.push({op:Q,path:[],value:H})}function U(H,B){return B.forEach((M)=>{let{path:V,op:N}=M,L=H;for(let O=0;O<V.length-1;O++){let j=mN(L),$=V[O];if(typeof $!=="string"&&typeof $!=="number")$=""+$;if((j===0||j===1)&&($==="__proto__"||$==="constructor"))vJ(19);if(typeof L==="function"&&$==="prototype")vJ(19);if(L=jZ1(L,$),typeof L!=="object")vJ(18,V.join("/"))}let A=mN(L),w=F(M.value),R=V[V.length-1];switch(N){case Q:switch(A){case 2:return L.set(R,w);case 3:vJ(16);default:return L[R]=w}case Z:switch(A){case 1:return R==="-"?L.push(w):L.splice(R,0,w);case 2:return L.set(R,w);case 3:return L.add(w);default:return L[R]=w}case X:switch(A){case 1:return L.splice(R,1);case 2:return L.delete(R);case 3:return L.delete(M.value);default:return delete L[R]}default:vJ(17,N)}}),H}function F(H){if(!TB(H))return H;if(Array.isArray(H))return H.map(F);if(AS(H))return new Map(Array.from(H.entries()).map(([M,V])=>[M,F(V)]));if(wS(H))return new Set(Array.from(H).map(F));let B=Object.create(hN(H));for(let M in H)B[M]=F(H[M]);if(VS(H,DS))B[DS]=H[DS];return B}function W(H){if(gN(H))return F(H);else return H}lM6("Patches",{applyPatches_:U,generatePatches_:Y,generateReplacementPatches_:z})}function n8(J){return J}var kZ1,DS,VX,hN,pM6,PZ1,NS,_Z1,LS,sM6=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Z,X)=>{if(typeof Q==="function"&&typeof Z!=="function"){let K=Z;Z=Q;let q=this;return function(z=K,...U){return q.produce(z,(F)=>Z.call(this,F,...U))}}if(typeof Z!=="function")vJ(6);if(X!==void 0&&typeof X!=="function")vJ(7);let Y;if(TB(Q)){let K=Xi1(this),q=vZ1(Q,void 0),G=!0;try{Y=Z(q),G=!1}finally{if(G)TZ1(K);else CZ1(K)}return Zi1(K,X),Yi1(Y,K)}else if(!Q||typeof Q!=="object"){if(Y=Z(Q),Y===void 0)Y=Q;if(Y===kZ1)Y=void 0;if(this.autoFreeze_)LQ(Y,!0);if(X){let K=[],q=[];uN("Patches").generateReplacementPatches_(Q,Y,K,q),X(K,q)}return Y}else vJ(1,Q)},this.produceWithPatches=(Q,Z)=>{if(typeof Q==="function")return(q,...G)=>this.produceWithPatches(q,(z)=>Q(z,...G));let X,Y;return[this.produce(Q,Z,(q,G)=>{X=q,Y=G}),X,Y]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!TB(J))vJ(8);if(gN(J))J=oM6(J);let Q=Xi1(this),Z=vZ1(J,void 0);return Z[VX].isManual_=!0,CZ1(Q),Z}finishDraft(J,Q){let Z=J&&J[VX];if(!Z||!Z.isManual_)vJ(9);let{scope_:X}=Z;return Zi1(X,Q),Yi1(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Z;for(Z=Q.length-1;Z>=0;Z--){let Y=Q[Z];if(Y.path.length===0&&Y.op==="replace"){J=Y.value;break}}if(Z>-1)Q=Q.slice(Z+1);let X=uN("Patches").applyPatches_;if(gN(J))return X(J,Q);return this.produce(J,(Y)=>X(Y,Q))}},NX,gd,xZ1,_M9,xM9,Wi1,bM9,yM9;var AQ=B1(()=>{kZ1=Symbol.for("immer-nothing"),DS=Symbol.for("immer-draftable"),VX=Symbol.for("immer-state");hN=Object.getPrototypeOf;pM6=Object.prototype.constructor.toString();PZ1={};_Z1={get(J,Q){if(Q===VX)return J;let Z=fN(J);if(!VS(Z,Q))return rM6(J,Z,Q);let X=Z[Q];if(J.finalized_||!TB(X))return X;if(X===$Z1(J.base_,Q))return EZ1(J),J.copy_[Q]=vZ1(X,J);return X},has(J,Q){return Q in fN(J)},ownKeys(J){return Reflect.ownKeys(fN(J))},set(J,Q,Z){let X=Ui1(fN(J),Q);if(X?.set)return X.set.call(J.draft_,Z),!0;if(!J.modified_){let Y=$Z1(fN(J),Q),K=Y?.[VX];if(K&&K.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(dM6(Z,Y)&&(Z!==void 0||VS(J.base_,Q)))return!0;EZ1(J),SZ1(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($Z1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,EZ1(J),SZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=fN(J),X=Reflect.getOwnPropertyDescriptor(Z,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Z[Q]}},defineProperty(){vJ(11)},getPrototypeOf(J){return hN(J.base_)},setPrototypeOf(){vJ(12)}},LS={};MS(_Z1,(J,Q)=>{LS[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});LS.deleteProperty=function(J,Q){return LS.set.call(this,J,Q,void 0)};LS.set=function(J,Q,Z){return _Z1.set.call(this,J[0],Q,Z,J[0])};NX=new sM6,gd=NX.produce,xZ1=NX.produceWithPatches.bind(NX),_M9=NX.setAutoFreeze.bind(NX),xM9=NX.setUseStrictShallowCopy.bind(NX),Wi1=NX.applyPatches.bind(NX),bM9=NX.createDraft.bind(NX),yM9=NX.finishDraft.bind(NX)});function bZ1({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 RS(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(tM6,"")}var tM6;var yZ1=B1(()=>{tM6=bZ1()});var Bi1=a((pM9,Hi1)=>{Hi1.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 md;var Di1=B1(()=>{md={name:"amp",description:"An agentic coding tool, built by Sourcegraph.",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","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:web":"vscode-test-web --extensionDevelopmentPath=. --browserOption=--disable-web-security --verbose --open-devtools --verbose --printServerLog","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","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":"vite build",build:"pnpm run -s _build:extension && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review:production'","_build:extension":"vite build","_build:extension:production":"cross-env NODE_ENV=production vite build","_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:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","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":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && pnpm run -s _build:tab:review && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && pnpm run -s _build:tab:review && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force",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 at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.js",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.experimental.diffView || amp.isSourcegraphTeammate"}]},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.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.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{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"},{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.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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.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.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{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.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !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"}],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"}}},required:["url"]}]}},"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.librarian":{type:"boolean",default:!1,description:"Enable the experimental librarian tool",scope:"application"},"amp.experimental.promptAutocompleteMode":{type:"string",enum:["disabled","word-based","tab"],enumDescriptions:["Disabled - no prompt autocomplete","Offline word completion from workspace and thread context","AI-powered suggestions via Amp Tab"],default:"disabled",markdownDescription:"**Experimental:** Prompt autocomplete suggestions while typing.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: chat_llm",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.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",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.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.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",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.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"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.reviewTool":{type:"boolean",default:!1,description:"Experimental: Enable the code review tool.",scope:"application"},"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"},"amp.gpt5":{type:"boolean",default:!1,description:"[DEPRECATED] GPT-5 is no longer available as the main model. It's now the oracle. See https://ampcode.com/news/gpt-5-oracle",scope:"window",deprecationMessage:"GPT-5 is no longer available as the main model. It's now the oracle. See https://ampcode.com/news/gpt-5-oracle"}}},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","amp.anthropic.baseURL"]},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:{"@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","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5",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"},devDependencies:{"@sourcegraph/amp-web":"workspace:*","@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/test-web":"*","@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","vite-plugin-static-copy":"^3.0.0"}}});function JV6(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function Mi1(J){let Q=J.settings["tools.inactivityTimeout"],Z=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Z!==void 0)X=Z;if(X===void 0)X=md.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!JV6(X))return null;return X*1000}function Vi1(J){let Q=J.settings["tools.stopTimeout"],Z=md.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var lM9;var fZ1=B1(()=>{Di1();lM9=md.contributes.configuration.properties});function ud(J,Q){return new e1((Z)=>{let X=setTimeout(Y,Q);function Y(){Z.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function K(){if(X)clearTimeout(X);X=setTimeout(Y,Q)}let q=J.subscribe({next:(G)=>{K(),Z.next(G)},error:(G)=>{if(X)clearTimeout(X),X=null;Z.error(G)},complete:()=>{if(X)clearTimeout(X),X=null;Z.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var hZ1=B1(()=>{T0()});function $7(J,Q){let Z={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let Y of X)if(Y.modelSelector.test(J))Z={...Z,name:Y.name??Z.name,description:Y.description??Z.description,inputSchema:Y.inputSchema??Z.inputSchema,customizedForModel:!0}}return Z}function kJ(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function Ai1(J){return["done","error","cancelled"].includes(J.status)}function zO(J){let Q=[],Z=new b8;function X(K,q){let G=Q.filter((z)=>z.spec.name===K);if(G.length===0&&K==="Glob")G=Q.filter((z)=>z.spec.name==="glob");for(let z of G)if(OS(z.spec,q).enabled)return z;return}function Y(K,q,G){if(!K)throw Error("spec is required");let z={spec:K,fn:Promise.resolve(q),preprocessArgs:G};return Q.push(z),Z.next(),{dispose:()=>{let U=Q.indexOf(z);if(U!==-1)Q.splice(U,1),Z.next()}}}return{registerTool({spec:K,fn:q,preprocessArgs:G}){if(!q)return QV6;return Y(K,q,G)},tools:S9(J.configService.config,Z.pipe(E2(void 0))).pipe(C0(([K])=>{return Q.map((q)=>({spec:q.spec,...OS(q.spec,K)})).sort((q,G)=>q.spec.name.localeCompare(G.spec.name))})),invokeTool(K,q,G){let z=performance.now(),U=()=>ZV6.record(performance.now()-z,{toolName:K});if(K===mZ1&&q.args&&"invalid_tool_name"in q.args&&typeof q.args.invalid_tool_name==="string"){dd.add(1,{toolName:K,error:"invalid"});let W=gZ1(q.args.invalid_tool_name);return new e1((H)=>{H.error(Error(W))})}let F=X(K,G.config);if(!F){let W=Q.filter((V)=>V.spec.name===K);if(W.length===0)return dd.add(1,{toolName:K,error:"not_found"}),new e1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} not found`))});let H=W[0],B=OS(H.spec,G.config);dd.add(1,{toolName:K,error:"disabled"});let M=B.enabled?"unknown":B.disabledReason;return new e1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} is disabled: ${M}`))})}return dd.add(1,{toolName:K}),d6(()=>F.fn).pipe(q8((W)=>{let H=W(q,G);if(F.spec.meta?.disableTimeout)return H;return ud(H,Vi1(G.config))}),nK(()=>U()))},preprocessArgs(K,q,G){let z=X(K,G.config);if(!z||!z.preprocessArgs)return;let U=z.preprocessArgs;try{return U(q,G)}catch(F){l.error("preprocessArgs",{id:K,args:q,error:String(F)});return}},dispose(){}}}function pd(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(Li1.default(Z,{dot:!0})(J))return!0}catch(X){continue}}return!1}function OS(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(pd(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=Ri1(J.name);if(X&&J.source.mcp===X.server&&pd(X.tool,Z))return{enabled:!1,disabledReason:"settings"}}if(J.source==="builtin"&&pd(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&pd(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===JJ||J.name===VB){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function gZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${jS.toString()}. Try again with a valid tool name.`}function Ri1(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function uZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function _J(J,Q,Z=!0){let X=new Set(Q.map((K)=>K.spec.name));function Y(K){if(X.has(K))return!0;if(K==="Glob"&&X.has("glob"))return!0;if(Z&&Ri1(K))return!0;return!1}return{registerTool(K){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(K,q,G){if(!Y(K))return new e1((z)=>{z.error(Error(`tool ${JSON.stringify(K)} not allowed in filtered service`))});return J.invokeTool(K,q,G)},preprocessArgs(K,q,G){if(!Y(K))return;return J.preprocessArgs?.(K,q,G)},tools:J.tools.pipe(C0((K)=>K.filter((q)=>Y(q.spec.name)))),dispose(){}}}var Ni1,Li1,QV6,mZ1="invalid_tool",jS,wi1,dd,ZV6;var u2=B1(()=>{T0();z0();fZ1();hZ1();N8();Ni1=m6(ep(),1),Li1=m6(CN(),1);QV6={dispose(){}};jS=/^[a-zA-Z0-9_]{1,64}$/,wi1=Ni1.metrics.getMeter("tool_service"),dd=wi1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),ZV6=wi1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var Pi1=a((Ei1)=>{Object.defineProperty(Ei1,"__esModule",{value:!0});Ei1.calcSlices=Ei1.applyPatch=Ei1.calcPatch=Ei1.lcs=Ei1.diff=Ei1.diff_core=void 0;function XV6(J,Q){let{b:Z,eq:X,stack_base:Y}=J,{i:K,N:q,j:G,M:z,Z:U,stack_top:F}=J;for(;;)switch(Q){case 0:{J:while(q>0&&z>0){Z.fill(0,0,2*U);let W=q-z,H=q+z,B=H&1,M=K+q-1,V=G+z-1,N=(H+B)/2,L;Q:for(let A=0;A<=N;A++){let w=2*Math.max(0,A-z)-A,R=A-2*Math.max(0,A-q);for(let O=w;O<=R;O+=2){let j=Z[O-1-U*Math.floor((O-1)/U)],$=Z[O+1-U*Math.floor((O+1)/U)],E=O===-A||O!==A&&j<$?$:j+1,I=E-O,T=E,S=I;while(T<q&&S<z&&X(K+T,G+S))T++,S++;if(Z[O-U*Math.floor(O/U)]=T,B===1&&(L=W-O)>=1-A&&L<A&&T+Z[U+L-U*Math.floor(L/U)]>=q)if(A>1||T!==E){Y[F++]=K+T,Y[F++]=q-T,Y[F++]=G+S,Y[F++]=z-S,q=E,z=I,U=2*(Math.min(q,z)+1);continue J}else break Q}for(let O=w;O<=R;O+=2){let j=Z[U+O-1-U*Math.floor((O-1)/U)],$=Z[U+O+1-U*Math.floor((O+1)/U)],E=O===-A||O!==A&&j<$?$:j+1,I=E-O,T=E,S=I;while(T<q&&S<z&&X(M-T,V-S))T++,S++;if(Z[U+O-U*Math.floor(O/U)]=T,B===0&&(L=W-O)>=-A&&L<=A&&T+Z[L-U*Math.floor(L/U)]>=q)if(A>0||T!==E){Y[F++]=K+q-E,Y[F++]=E,Y[F++]=G+z-I,Y[F++]=I,q=q-T,z=z-S,U=2*(Math.min(q,z)+1);continue J}else break Q}}if(q===z)continue;if(z>q)K+=q,G+=q,z-=q,q=0;else K+=z,G+=z,q-=z,z=0;break}if(q+z!==0)if(J.pxe===K||J.pye===G)J.pxe=K+q,J.pye=G+z;else{let W=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=K,J.pxe=K+q,J.pys=G,J.pye=G+z,W>=0)return J.i=K,J.N=q,J.j=G,J.M=z,J.Z=U,J.stack_top=F,1}}case 1:{if(F===0)return 2;z=Y[--F],G=Y[--F],q=Y[--F],K=Y[--F],U=2*(Math.min(q,z)+1),Q=0}}}class Oi1{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=XV6(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 ji1(J,Q,Z,X,Y){let K=(Math.min(Q,X)+1)*2,q=Q+X,G=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*K);return new Oi1({i:J,N:Q,j:Z,M:X,Z:K,b:G,eq:Y,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}Ei1.diff_core=ji1;function cd(J,Q,Z){let[X,Y,K]=[0,J.length,Q.length];if(typeof Z==="function"){while(X<Y&&X<K&&Z(X,X))X++;if(X===Y&&X===K)return[][Symbol.iterator]();while(Z(--Y,--K)&&Y>X&&K>X);}else{while(X<Y&&X<K&&J[X]===Q[X])X++;if(X===Y&&X===K)return[][Symbol.iterator]();while(J[--Y]===Q[--K]&&Y>X&&K>X);Z=(q,G)=>J[q]===Q[G]}return ji1(X,Y+1-X,X,K+1-X,Z)}Ei1.diff=cd;class $i1{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:G,j:z,N:U}=this;if(G<U)J.done=!1,J.value=[G,z,U-G],this.i=U;return J}let Q=J.value,Z=Q[0],X=Q[1],Y=Q[3],{i:K,j:q}=this;if(K!==Z)Q.length--,Q[0]=K,Q[1]=q,Q[2]=Z-K;return this.i=X,this.j=Y,J}}function YV6(J,Q,Z){return new $i1(cd(J,Q,Z),J.length)}Ei1.lcs=YV6;function*KV6(J,Q,Z){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let Y of cd(J,Q,Z))Y[2]=X.call(Q,Y[2],Y[3]),yield Y}Ei1.calcPatch=KV6;function*qV6(J,Q){let Z=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Y,K,q]of Q){if(Z<Y)yield X.call(J,Z,Y);if(q.length>0)yield q;Z=K}if(Z<J.length)yield X.call(J,Z)}Ei1.applyPatch=qV6;function*GV6(J,Q,Z){let X=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[K,q,G,z]of cd(J,Q,Z)){if(X<K)yield[0,Y.call(J,X,K)];if(K<q)yield[-1,Y.call(J,K,q)];if(G<z)yield[1,Y.call(Q,G,z)];X=q}if(X<J.length)yield[0,J.slice(X)]}Ei1.calcSlices=GV6});function ld(J,Q){if(J===void 0||Q===void 0||J===Q)return{added:0,deleted:0,changed:0};let Z={added:0,deleted:0,changed:0};for(let[X,Y,K,q]of Ti1.diff(J.split(`
|
|
3
|
+
`)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let Y=X.slice(2).trim();if(!Y)return{interpreter:null,isValid:!1};let K=Y.split(/\s+/).filter((q)=>q.length>0);if(K[0]?.endsWith("/env")&&K.length>1)return{interpreter:K.slice(1),isValid:!0};return{interpreter:K,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function pc1(J,Q){let Z=(J&73)!==0;if(process.platform==="win32"){let X=IN.extname(Q).toLowerCase();return Z||[".exe",".bat",".cmd",".ps1"].includes(X)}return Z}function dc1(J){return IN.extname(J).toLowerCase()===".md"}function cc1(J){let Q=J.replace(/\\/g,"/"),Z=IN.basename(Q);return IN.basename(Z,IN.extname(Z))}function lc1(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var ic1=()=>{};var sc1={};R6(sc1,{CommandDiscovery:()=>rc1});import*as ac1 from"node:fs";import{promises as Kd}from"node:fs";import{homedir as nc1}from"node:os";import*as BX from"node:path";function ZZ1(J,Q,Z){return Promise.race([J,new Promise((X,Y)=>setTimeout(()=>Y(Error(`${Z} timed out after ${Q}ms`)),Q))])}class rc1{config;workspaceRoots;watchFactory;debounceMs;changes=new b8;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Z={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Z.watchFactory??CB6,this.debounceMs=Z.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Z=new Map;for(let Y of Q)Z.set(Y.name,Y);for(let Y of J)Z.set(Y.name,Y);let X=Array.from(Z.values());if(l.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return l.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Z of this.config.workspacePaths){let X=y0.joinPath(Q,Z),Y=await this.discoverCommandsInDirectory(X,"workspace");J.push(...Y)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Z=this.resolveGlobalPath(Q),X=j0.file(Z),Y=await this.discoverCommandsInDirectory(X,"global");J.push(...Y)}return J}async discoverCommandsInDirectory(J,Q){try{let Z=J.fsPath;try{await ZZ1(Kd.access(Z),QZ1,"directory access")}catch{return[]}let Y=(await ZZ1(Kd.readdir(Z,{withFileTypes:!0}),QZ1,"directory read")).filter((q)=>q.isFile()),K=[];for(let q of Y){let G=BX.join(Z,q.name),z=await this.createCommand(G);if(z)K.push(z)}return l.debug(`Discovered ${K.length} commands in ${Q} directory`,{directory:Z,commands:K.map((q)=>q.name)}),K}catch(Z){return l.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Z}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J){try{let Q=await Kd.stat(J),Z=BX.basename(J);if(this.ignoreCommandName(Z))return null;let X=cc1(Z);if(!lc1(X))return l.warn(`Invalid command name: ${X}`,{filePath:J}),null;if(dc1(Z))return this.createMarkdownCommand(J,Q,X);else return this.createExecutableCommand(J,Q,X)}catch(Q){return l.warn(`Failed to process file: ${J}`,{error:Q}),null}}async createMarkdownCommand(J,Q,Z){return{kind:"markdown",name:Z,filePath:J,sourceDirectory:BX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0}}async createExecutableCommand(J,Q,Z){let X=BX.basename(J),Y=pc1(Q.mode,X),K=await uc1(J),q=BX.extname(X);if(!Y&&!K.isValid&&!this.isNativeBinary(q))return l.debug(`Skipping non-executable file without shebang: ${J}`),null;let G=Y&&(K.isValid||this.isNativeBinary(q)),z=this.getExecutableUnavailableReason(Y,K.isValid,q);return{kind:"executable",name:Z,filePath:J,sourceDirectory:BX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Y,interpreter:K.interpreter,extension:q,available:G,unavailableReason:z}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Z){let X=this.isNativeBinary(Z);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return BX.join(nc1(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=WB||BX.join(nc1(),".config");return BX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Z of this.config.workspacePaths){let X=y0.joinPath(Q,Z);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Z=this.resolveGlobalPath(Q);J.add(Z)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await ZZ1(Kd.access(J),QZ1,"watcher access check");try{let Q=this.watchFactory(J,(Z,X)=>{l.debug("Command directory change detected",{directory:J,eventType:Z,filename:X}),this.scheduleRefresh()});this.watchers.set(J,Q),l.debug("Started watching command directory",{directory:J})}catch(Q){l.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){l.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Z=new Map;for(let Y of Q)Z.set(Y.name,Y);for(let Y of J)Z.set(Y.name,Y);let X=Array.from(Z.values());l.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){l.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),l.debug("Stopped watching command directory",{directory:J})}catch(Z){l.warn("Failed to close watcher",{directory:J,error:Z})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){l.warn("Error during command discovery cleanup",{error:J})}}}var QZ1=5000,CB6=(J,Q)=>ac1.watch(J,Q);var oc1=B1(()=>{_6();T0();mR();z0();ic1()});import{homedir as qd}from"node:os";import PN from"node:path";var ec1,vB6,Jl1,kB6,Gd,_B6,uR,HB,XZ1;var ZF=B1(()=>{mR();ec1=PN.join(qd(),".local/share"),vB6=process.platform==="win32"||process.platform==="darwin"?ec1:FB??ec1,Jl1=PN.join(qd(),".config"),kB6=process.platform==="win32"||process.platform==="darwin"?Jl1:WB??Jl1,Gd=PN.join(vB6,"amp"),_B6=PN.join(kB6,"amp"),uR=PN.join(_B6,"tools"),HB=PN.join(qd(),".cache","amp"),XZ1=PN.join(qd(),".cache","amp","http-debug-logs")});function DX(J,Q,Z=Q+"s"){return J===1?Q:Z}var Gl1="run_terminal_command",zl1="read_file",t5="Task",Ul1="chat_llm",q7="finder",BB="fast_finder",pG="xai_finder",dG="kimiK2_finder",DB="gossip_finder",MB="sonoma_finder",XF="get_diagnostics",z4="Bash",e5="oracle",tC="mermaid",VB="todo_read",JJ="todo_write",cG="read_web_page",Fl1="run_javascript",TJ="create_file",lG="glob",Wl1="Glob",zd="undo_edit",Ud="read_mcp_resource",t8="Read",CJ="edit_file",Fd="format_file",NB="web_search",U4="Grep",eC="Check",TN="librarian",Wd="read_github",Hd="search_github",Bd="commit_search",Dd="list_directory_github",Md="list_repositories",Vd="glob_github",Nd="diff",Hl1;var N8=B1(()=>{Hl1=["Task","chat_llm","finder","fast_finder","xai_finder","kimiK2_finder","gossip_finder","sonoma_finder","get_diagnostics","Bash","oracle","mermaid","todo_read","todo_write","read_web_page","run_javascript","create_file","glob","Glob","undo_edit","Read","edit_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","librarian"]});var JS=a((xD9,Dl1)=>{var Bl1={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:"/"},iB6={...Bl1,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:"\\"},nB6={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"};Dl1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nB6,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?iB6:Bl1}}});var QS=a((tB6)=>{var{REGEX_BACKSLASH:aB6,REGEX_REMOVE_BACKSLASH:rB6,REGEX_SPECIAL_CHARS:sB6,REGEX_SPECIAL_CHARS_GLOBAL:oB6}=JS();tB6.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tB6.hasRegexChars=(J)=>sB6.test(J);tB6.isRegexChar=(J)=>J.length===1&&tB6.hasRegexChars(J);tB6.escapeRegex=(J)=>J.replace(oB6,"\\$1");tB6.toPosixSlashes=(J)=>J.replace(aB6,"/");tB6.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};tB6.removeBackslashes=(J)=>{return J.replace(rB6,(Q)=>{return Q==="\\"?"":Q})};tB6.escapeLast=(J,Q,Z)=>{let X=J.lastIndexOf(Q,Z);if(X===-1)return J;if(J[X-1]==="\\")return tB6.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};tB6.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};tB6.wrapOutput=(J,Q={},Z={})=>{let X=Z.contains?"":"^",Y=Z.contains?"":"$",K=`${X}(?:${J})${Y}`;if(Q.negated===!0)K=`(?:^(?!${K}).*$)`;return K};tB6.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),X=Z[Z.length-1];if(X==="")return Z[Z.length-2];return X}});var $l1=a((yD9,jl1)=>{var Nl1=QS(),{CHAR_ASTERISK:KZ1,CHAR_AT:zD6,CHAR_BACKWARD_SLASH:ZS,CHAR_COMMA:UD6,CHAR_DOT:qZ1,CHAR_EXCLAMATION_MARK:GZ1,CHAR_FORWARD_SLASH:Ol1,CHAR_LEFT_CURLY_BRACE:zZ1,CHAR_LEFT_PARENTHESES:UZ1,CHAR_LEFT_SQUARE_BRACKET:FD6,CHAR_PLUS:WD6,CHAR_QUESTION_MARK:Ll1,CHAR_RIGHT_CURLY_BRACE:HD6,CHAR_RIGHT_PARENTHESES:Al1,CHAR_RIGHT_SQUARE_BRACKET:BD6}=JS(),wl1=(J)=>{return J===Ol1||J===ZS},Rl1=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},DD6=(J,Q)=>{let Z=Q||{},X=J.length-1,Y=Z.parts===!0||Z.scanToEnd===!0,K=[],q=[],G=[],z=J,U=-1,F=0,W=0,H=!1,B=!1,M=!1,V=!1,N=!1,L=!1,A=!1,w=!1,R=!1,O=!1,j=0,$,E,I={value:"",depth:0,isGlob:!1},T=()=>U>=X,S=()=>z.charCodeAt(U+1),x=()=>{return $=E,z.charCodeAt(++U)};while(U<X){E=x();let g;if(E===ZS){if(A=I.backslashes=!0,E=x(),E===zZ1)L=!0;continue}if(L===!0||E===zZ1){j++;while(T()!==!0&&(E=x())){if(E===ZS){A=I.backslashes=!0,x();continue}if(E===zZ1){j++;continue}if(L!==!0&&E===qZ1&&(E=x())===qZ1){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(L!==!0&&E===UD6){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===HD6){if(j--,j===0){L=!1,H=I.isBrace=!0,O=!0;break}}}if(Y===!0)continue;break}if(E===Ol1){if(K.push(U),q.push(I),I={value:"",depth:0,isGlob:!1},O===!0)continue;if($===qZ1&&U===F+1){F+=2;continue}W=U+1;continue}if(Z.noext!==!0){if((E===WD6||E===zD6||E===KZ1||E===Ll1||E===GZ1)===!0&&S()===UZ1){if(M=I.isGlob=!0,V=I.isExtglob=!0,O=!0,E===GZ1&&U===F)R=!0;if(Y===!0){while(T()!==!0&&(E=x())){if(E===ZS){A=I.backslashes=!0,E=x();continue}if(E===Al1){M=I.isGlob=!0,O=!0;break}}continue}break}}if(E===KZ1){if($===KZ1)N=I.isGlobstar=!0;if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===Ll1){if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===FD6){while(T()!==!0&&(g=x())){if(g===ZS){A=I.backslashes=!0,x();continue}if(g===BD6){B=I.isBracket=!0,M=I.isGlob=!0,O=!0;break}}if(Y===!0)continue;break}if(Z.nonegate!==!0&&E===GZ1&&U===F){w=I.negated=!0,F++;continue}if(Z.noparen!==!0&&E===UZ1){if(M=I.isGlob=!0,Y===!0){while(T()!==!0&&(E=x())){if(E===UZ1){A=I.backslashes=!0,E=x();continue}if(E===Al1){O=!0;break}}continue}break}if(M===!0){if(O=!0,Y===!0)continue;break}}if(Z.noext===!0)V=!1,M=!1;let h=z,v="",_="";if(F>0)v=z.slice(0,F),z=z.slice(F),W-=F;if(h&&M===!0&&W>0)h=z.slice(0,W),_=z.slice(W);else if(M===!0)h="",_=z;else h=z;if(h&&h!==""&&h!=="/"&&h!==z){if(wl1(h.charCodeAt(h.length-1)))h=h.slice(0,-1)}if(Z.unescape===!0){if(_)_=Nl1.removeBackslashes(_);if(h&&A===!0)h=Nl1.removeBackslashes(h)}let b={prefix:v,input:J,start:F,base:h,glob:_,isBrace:H,isBracket:B,isGlob:M,isExtglob:V,isGlobstar:N,negated:w,negatedExtglob:R};if(Z.tokens===!0){if(b.maxDepth=0,!wl1(E))q.push(I);b.tokens=q}if(Z.parts===!0||Z.tokens===!0){let g;for(let k=0;k<K.length;k++){let y=g?g+1:F,f=K[k],m=J.slice(y,f);if(Z.tokens){if(k===0&&F!==0)q[k].isPrefix=!0,q[k].value=v;else q[k].value=m;Rl1(q[k]),b.maxDepth+=q[k].depth}if(k!==0||m!=="")G.push(m);g=f}if(g&&g+1<J.length){let k=J.slice(g+1);if(G.push(k),Z.tokens)q[q.length-1].value=k,Rl1(q[q.length-1]),b.maxDepth+=q[q.length-1].depth}b.slashes=K,b.parts=G}return b};jl1.exports=DD6});var Pl1=a((fD9,Il1)=>{var Ld=JS(),iG=QS(),{MAX_LENGTH:Ad,POSIX_REGEX_SOURCE:MD6,REGEX_NON_SPECIAL_CHARS:VD6,REGEX_SPECIAL_CHARS_BACKREF:ND6,REPLACEMENTS:El1}=Ld,LD6=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Z=`[${J.join("-")}]`;try{new RegExp(Z)}catch(X){return J.map((Y)=>iG.escapeRegex(Y)).join("..")}return Z},dR=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},FZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=El1[J]||J;let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(Ad,Z.maxLength):Ad,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);let K={type:"bos",value:"",output:Z.prepend||""},q=[K],G=Z.capture?"":"?:",z=Ld.globChars(Z.windows),U=Ld.extglobChars(z),{DOT_LITERAL:F,PLUS_LITERAL:W,SLASH_LITERAL:H,ONE_CHAR:B,DOTS_SLASH:M,NO_DOT:V,NO_DOT_SLASH:N,NO_DOTS_SLASH:L,QMARK:A,QMARK_NO_DOT:w,STAR:R,START_ANCHOR:O}=z,j=(W1)=>{return`(${G}(?:(?!${O}${W1.dot?M:F}).)*?)`},$=Z.dot?"":V,E=Z.dot?A:w,I=Z.bash===!0?j(Z):R;if(Z.capture)I=`(${I})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let T={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:q};J=iG.removePrefix(J,T),Y=J.length;let S=[],x=[],h=[],v=K,_,b=()=>T.index===Y-1,g=T.peek=(W1=1)=>J[T.index+W1],k=T.advance=()=>J[++T.index]||"",y=()=>J.slice(T.index+1),f=(W1="",d=0)=>{T.consumed+=W1,T.index+=d},m=(W1)=>{T.output+=W1.output!=null?W1.output:W1.value,f(W1.value)},n=()=>{let W1=1;while(g()==="!"&&(g(2)!=="("||g(3)==="?"))k(),T.start++,W1++;if(W1%2===0)return!1;return T.negated=!0,T.start++,!0},u=(W1)=>{T[W1]++,h.push(W1)},e=(W1)=>{T[W1]--,h.pop()},G1=(W1)=>{if(v.type==="globstar"){let d=T.braces>0&&(W1.type==="comma"||W1.type==="brace"),p=W1.extglob===!0||S.length&&(W1.type==="pipe"||W1.type==="paren");if(W1.type!=="slash"&&W1.type!=="paren"&&!d&&!p)T.output=T.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=I,T.output+=v.output}if(S.length&&W1.type!=="paren")S[S.length-1].inner+=W1.value;if(W1.value||W1.output)m(W1);if(v&&v.type==="text"&&W1.type==="text"){v.output=(v.output||v.value)+W1.value,v.value+=W1.value;return}W1.prev=v,q.push(W1),v=W1},F1=(W1,d)=>{let p={...U[d],conditions:1,inner:""};p.prev=v,p.parens=T.parens,p.output=T.output;let i=(Z.capture?"(":"")+p.open;u("parens"),G1({type:W1,value:d,output:T.output?"":B}),G1({type:"paren",extglob:!0,value:k(),output:i}),S.push(p)},Z1=(W1)=>{let d=W1.close+(Z.capture?")":""),p;if(W1.type==="negate"){let i=I;if(W1.inner&&W1.inner.length>1&&W1.inner.includes("/"))i=j(Z);if(i!==I||b()||/^\)+$/.test(y()))d=W1.close=`)$))${i}`;if(W1.inner.includes("*")&&(p=y())&&/^\.[^\\/.]+$/.test(p)){let r=FZ1(p,{...Q,fastpaths:!1}).output;d=W1.close=`)${r})${i})`}if(W1.prev.type==="bos")T.negatedExtglob=!0}G1({type:"paren",extglob:!0,value:_,output:d}),e("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let W1=!1,d=J.replace(ND6,(p,i,r,o,X1,J1)=>{if(o==="\\")return W1=!0,p;if(o==="?"){if(i)return i+o+(X1?A.repeat(X1.length):"");if(J1===0)return E+(X1?A.repeat(X1.length):"");return A.repeat(r.length)}if(o===".")return F.repeat(r.length);if(o==="*"){if(i)return i+o+(X1?I:"");return I}return i?p:`\\${p}`});if(W1===!0)if(Z.unescape===!0)d=d.replace(/\\/g,"");else d=d.replace(/\\+/g,(p)=>{return p.length%2===0?"\\\\":p?"\\":""});if(d===J&&Z.contains===!0)return T.output=J,T;return T.output=iG.wrapOutput(d,T,Q),T}while(!b()){if(_=k(),_==="\x00")continue;if(_==="\\"){let p=g();if(p==="/"&&Z.bash!==!0)continue;if(p==="."||p===";")continue;if(!p){_+="\\",G1({type:"text",value:_});continue}let i=/^\\+/.exec(y()),r=0;if(i&&i[0].length>2){if(r=i[0].length,T.index+=r,r%2!==0)_+="\\"}if(Z.unescape===!0)_=k();else _+=k();if(T.brackets===0){G1({type:"text",value:_});continue}}if(T.brackets>0&&(_!=="]"||v.value==="["||v.value==="[^")){if(Z.posix!==!1&&_===":"){let p=v.value.slice(1);if(p.includes("[")){if(v.posix=!0,p.includes(":")){let i=v.value.lastIndexOf("["),r=v.value.slice(0,i),o=v.value.slice(i+2),X1=MD6[o];if(X1){if(v.value=r+X1,T.backtrack=!0,k(),!K.output&&q.indexOf(v)===1)K.output=B;continue}}}}if(_==="["&&g()!==":"||_==="-"&&g()==="]")_=`\\${_}`;if(_==="]"&&(v.value==="["||v.value==="[^"))_=`\\${_}`;if(Z.posix===!0&&_==="!"&&v.value==="[")_="^";v.value+=_,m({value:_});continue}if(T.quotes===1&&_!=='"'){_=iG.escapeRegex(_),v.value+=_,m({value:_});continue}if(_==='"'){if(T.quotes=T.quotes===1?0:1,Z.keepQuotes===!0)G1({type:"text",value:_});continue}if(_==="("){u("parens"),G1({type:"paren",value:_});continue}if(_===")"){if(T.parens===0&&Z.strictBrackets===!0)throw SyntaxError(dR("opening","("));let p=S[S.length-1];if(p&&T.parens===p.parens+1){Z1(S.pop());continue}G1({type:"paren",value:_,output:T.parens?")":"\\)"}),e("parens");continue}if(_==="["){if(Z.nobracket===!0||!y().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw SyntaxError(dR("closing","]"));_=`\\${_}`}else u("brackets");G1({type:"bracket",value:_});continue}if(_==="]"){if(Z.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){G1({type:"text",value:_,output:`\\${_}`});continue}if(T.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(dR("opening","["));G1({type:"text",value:_,output:`\\${_}`});continue}e("brackets");let p=v.value.slice(1);if(v.posix!==!0&&p[0]==="^"&&!p.includes("/"))_=`/${_}`;if(v.value+=_,m({value:_}),Z.literalBrackets===!1||iG.hasRegexChars(p))continue;let i=iG.escapeRegex(v.value);if(T.output=T.output.slice(0,-v.value.length),Z.literalBrackets===!0){T.output+=i,v.value=i;continue}v.value=`(${G}${i}|${v.value})`,T.output+=v.value;continue}if(_==="{"&&Z.nobrace!==!0){u("braces");let p={type:"brace",value:_,output:"(",outputIndex:T.output.length,tokensIndex:T.tokens.length};x.push(p),G1(p);continue}if(_==="}"){let p=x[x.length-1];if(Z.nobrace===!0||!p){G1({type:"text",value:_,output:_});continue}let i=")";if(p.dots===!0){let r=q.slice(),o=[];for(let X1=r.length-1;X1>=0;X1--){if(q.pop(),r[X1].type==="brace")break;if(r[X1].type!=="dots")o.unshift(r[X1].value)}i=LD6(o,Z),T.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let r=T.output.slice(0,p.outputIndex),o=T.tokens.slice(p.tokensIndex);p.value=p.output="\\{",_=i="\\}",T.output=r;for(let X1 of o)T.output+=X1.output||X1.value}G1({type:"brace",value:_,output:i}),e("braces"),x.pop();continue}if(_==="|"){if(S.length>0)S[S.length-1].conditions++;G1({type:"text",value:_});continue}if(_===","){let p=_,i=x[x.length-1];if(i&&h[h.length-1]==="braces")i.comma=!0,p="|";G1({type:"comma",value:_,output:p});continue}if(_==="/"){if(v.type==="dot"&&T.index===T.start+1){T.start=T.index+1,T.consumed="",T.output="",q.pop(),v=K;continue}G1({type:"slash",value:_,output:H});continue}if(_==="."){if(T.braces>0&&v.type==="dot"){if(v.value===".")v.output=F;let p=x[x.length-1];v.type="dots",v.output+=_,v.value+=_,p.dots=!0;continue}if(T.braces+T.parens===0&&v.type!=="bos"&&v.type!=="slash"){G1({type:"text",value:_,output:F});continue}G1({type:"dot",value:_,output:F});continue}if(_==="?"){if(!(v&&v.value==="(")&&Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){F1("qmark",_);continue}if(v&&v.type==="paren"){let i=g(),r=_;if(v.value==="("&&!/[!=<:]/.test(i)||i==="<"&&!/<([!=]|\w+>)/.test(y()))r=`\\${_}`;G1({type:"text",value:_,output:r});continue}if(Z.dot!==!0&&(v.type==="slash"||v.type==="bos")){G1({type:"qmark",value:_,output:w});continue}G1({type:"qmark",value:_,output:A});continue}if(_==="!"){if(Z.noextglob!==!0&&g()==="("){if(g(2)!=="?"||!/[!=<:]/.test(g(3))){F1("negate",_);continue}}if(Z.nonegate!==!0&&T.index===0){n();continue}}if(_==="+"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){F1("plus",_);continue}if(v&&v.value==="("||Z.regex===!1){G1({type:"plus",value:_,output:W});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||T.parens>0){G1({type:"plus",value:_});continue}G1({type:"plus",value:W});continue}if(_==="@"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){G1({type:"at",extglob:!0,value:_,output:""});continue}G1({type:"text",value:_});continue}if(_!=="*"){if(_==="$"||_==="^")_=`\\${_}`;let p=VD6.exec(y());if(p)_+=p[0],T.index+=p[0].length;G1({type:"text",value:_});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=_,v.output=I,T.backtrack=!0,T.globstar=!0,f(_);continue}let W1=y();if(Z.noextglob!==!0&&/^\([^?]/.test(W1)){F1("star",_);continue}if(v.type==="star"){if(Z.noglobstar===!0){f(_);continue}let p=v.prev,i=p.prev,r=p.type==="slash"||p.type==="bos",o=i&&(i.type==="star"||i.type==="globstar");if(Z.bash===!0&&(!r||W1[0]&&W1[0]!=="/")){G1({type:"star",value:_,output:""});continue}let X1=T.braces>0&&(p.type==="comma"||p.type==="brace"),J1=S.length&&(p.type==="pipe"||p.type==="paren");if(!r&&p.type!=="paren"&&!X1&&!J1){G1({type:"star",value:_,output:""});continue}while(W1.slice(0,3)==="/**"){let H1=J[T.index+4];if(H1&&H1!=="/")break;W1=W1.slice(3),f("/**",3)}if(p.type==="bos"&&b()){v.type="globstar",v.value+=_,v.output=j(Z),T.output=v.output,T.globstar=!0,f(_);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!o&&b()){T.output=T.output.slice(0,-(p.output+v.output).length),p.output=`(?:${p.output}`,v.type="globstar",v.output=j(Z)+(Z.strictSlashes?")":"|$)"),v.value+=_,T.globstar=!0,T.output+=p.output+v.output,f(_);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&W1[0]==="/"){let H1=W1[1]!==void 0?"|$":"";T.output=T.output.slice(0,-(p.output+v.output).length),p.output=`(?:${p.output}`,v.type="globstar",v.output=`${j(Z)}${H}|${H}${H1})`,v.value+=_,T.output+=p.output+v.output,T.globstar=!0,f(_+k()),G1({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&W1[0]==="/"){v.type="globstar",v.value+=_,v.output=`(?:^|${H}|${j(Z)}${H})`,T.output=v.output,T.globstar=!0,f(_+k()),G1({type:"slash",value:"/",output:""});continue}T.output=T.output.slice(0,-v.output.length),v.type="globstar",v.output=j(Z),v.value+=_,T.output+=v.output,T.globstar=!0,f(_);continue}let d={type:"star",value:_,output:I};if(Z.bash===!0){if(d.output=".*?",v.type==="bos"||v.type==="slash")d.output=$+d.output;G1(d);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Z.regex===!0){d.output=_,G1(d);continue}if(T.index===T.start||v.type==="slash"||v.type==="dot"){if(v.type==="dot")T.output+=N,v.output+=N;else if(Z.dot===!0)T.output+=L,v.output+=L;else T.output+=$,v.output+=$;if(g()!=="*")T.output+=B,v.output+=B}G1(d)}while(T.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing","]"));T.output=iG.escapeLast(T.output,"["),e("brackets")}while(T.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing",")"));T.output=iG.escapeLast(T.output,"("),e("parens")}while(T.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(dR("closing","}"));T.output=iG.escapeLast(T.output,"{"),e("braces")}if(Z.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))G1({type:"maybe_slash",value:"",output:`${H}?`});if(T.backtrack===!0){T.output="";for(let W1 of T.tokens)if(T.output+=W1.output!=null?W1.output:W1.value,W1.suffix)T.output+=W1.suffix}return T};FZ1.fastpaths=(J,Q)=>{let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(Ad,Z.maxLength):Ad,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);J=El1[J]||J;let{DOT_LITERAL:K,SLASH_LITERAL:q,ONE_CHAR:G,DOTS_SLASH:z,NO_DOT:U,NO_DOTS:F,NO_DOTS_SLASH:W,STAR:H,START_ANCHOR:B}=Ld.globChars(Z.windows),M=Z.dot?F:U,V=Z.dot?W:U,N=Z.capture?"":"?:",L={negated:!1,prefix:""},A=Z.bash===!0?".*?":H;if(Z.capture)A=`(${A})`;let w=($)=>{if($.noglobstar===!0)return A;return`(${N}(?:(?!${B}${$.dot?z:K}).)*?)`},R=($)=>{switch($){case"*":return`${M}${G}${A}`;case".*":return`${K}${G}${A}`;case"*.*":return`${M}${A}${K}${G}${A}`;case"*/*":return`${M}${A}${q}${G}${V}${A}`;case"**":return M+w(Z);case"**/*":return`(?:${M}${w(Z)}${q})?${V}${G}${A}`;case"**/*.*":return`(?:${M}${w(Z)}${q})?${V}${A}${K}${G}${A}`;case"**/.*":return`(?:${M}${w(Z)}${q})?${K}${G}${A}`;default:{let E=/^(.*?)\.(\w+)$/.exec($);if(!E)return;let I=R(E[1]);if(!I)return;return I+K+E[2]}}},O=iG.removePrefix(J,L),j=R(O);if(j&&Z.strictSlashes!==!0)j+=`${q}?`;return j};Il1.exports=FZ1});var XS=a((hD9,Cl1)=>{var AD6=$l1(),WZ1=Pl1(),Tl1=QS(),wD6=JS(),RD6=(J)=>J&&typeof J==="object"&&!Array.isArray(J),G7=(J,Q,Z=!1)=>{if(Array.isArray(J)){let F=J.map((H)=>G7(H,Q,Z));return(H)=>{for(let B of F){let M=B(H);if(M)return M}return!1}}let X=RD6(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let Y=Q||{},K=Y.windows,q=X?G7.compileRe(J,Q):G7.makeRe(J,Q,!1,!0),G=q.state;delete q.state;let z=()=>!1;if(Y.ignore){let F={...Q,ignore:null,onMatch:null,onResult:null};z=G7(Y.ignore,F,Z)}let U=(F,W=!1)=>{let{isMatch:H,match:B,output:M}=G7.test(F,q,Q,{glob:J,posix:K}),V={glob:J,state:G,regex:q,posix:K,input:F,output:M,match:B,isMatch:H};if(typeof Y.onResult==="function")Y.onResult(V);if(H===!1)return V.isMatch=!1,W?V:!1;if(z(F)){if(typeof Y.onIgnore==="function")Y.onIgnore(V);return V.isMatch=!1,W?V:!1}if(typeof Y.onMatch==="function")Y.onMatch(V);return W?V:!0};if(Z)U.state=G;return U};G7.test=(J,Q,Z,{glob:X,posix:Y}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let K=Z||{},q=K.format||(Y?Tl1.toPosixSlashes:null),G=J===X,z=G&&q?q(J):J;if(G===!1)z=q?q(J):J,G=z===X;if(G===!1||K.capture===!0)if(K.matchBase===!0||K.basename===!0)G=G7.matchBase(J,Q,Z,Y);else G=Q.exec(z);return{isMatch:Boolean(G),match:G,output:z}};G7.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:G7.makeRe(Q,Z)).test(Tl1.basename(J))};G7.isMatch=(J,Q,Z)=>G7(Q,Z)(J);G7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>G7.parse(Z,Q));return WZ1(J,{...Q,fastpaths:!1})};G7.scan=(J,Q)=>AD6(J,Q);G7.compileRe=(J,Q,Z=!1,X=!1)=>{if(Z===!0)return J.output;let Y=Q||{},K=Y.contains?"":"^",q=Y.contains?"":"$",G=`${K}(?:${J.output})${q}`;if(J&&J.negated===!0)G=`^(?!${G}).*$`;let z=G7.toRegex(G,Q);if(X===!0)z.state=J;return z};G7.makeRe=(J,Q={},Z=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))Y.output=WZ1.fastpaths(J,Q);if(!Y.output)Y=WZ1(J,Q);return G7.compileRe(Y,Q,Z,X)};G7.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/$^/}};G7.constants=wD6;Cl1.exports=G7});var CN=a((gD9,kl1)=>{var Sl1=XS(),OD6=QS();function vl1(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:OD6.isWindows()};return Sl1(J,Q,Z)}Object.assign(vl1,Sl1);kl1.exports=vl1});function wd(J){if(!J)return null;let Z=Od(J)?.toolAllowlist;if(!Z)return null;let X=Object.entries(YS).find(([K,q])=>q.includes(J))?.[0],Y=bl1.filter((K)=>K!==X).map((K)=>`!${K}`);if(X&&X!=="finder")Y.push("!finder");return[...Z,...Y]}function Rd(J,Q){let Z=!1;for(let X of Q){if(X==="")continue;if(X.startsWith("!")){let Y=X.slice(1);if(_l1(J,Y))return!1;continue}if(_l1(J,X))Z=!0}return Z}function _l1(J,Q){if(Q==="")return!1;if(Q.length===1){if(Q==="*")return!0;return!1}if(J===Q)return!0;if(Q.includes("*")||Q.includes("?")||Q.includes("[")||Q.includes("{"))try{return xl1.default(Q,{dot:!0})(J)}catch(Z){return!1}return!1}var xl1;var HZ1=B1(()=>{z2();xl1=m6(CN(),1)});function v8(J){let Q=m2[J];return`${Q.provider}/${Q.name}`}function MX(J){let[Q,Z]=J.split("/");for(let X of Object.values(m2))if(X.provider===Q&&X.name===Z)return X;switch(Q){case"anthropic":return m2.CLAUDE_SONNET_4_5;case"openai":return m2.GPT_5;case"xai":return m2.GROK_CODE_FAST_1;case"cerebras":return m2.QWEN_3_CODER_480B;case"moonshotai":return m2.KIMI_K2_INSTRUCT;case"openrouter":return m2.SONOMA_SKY_ALPHA;case"supernova":return m2.CODE_SUPERNOVA;case"groq":return m2.GPT_OSS_120B;default:throw Error(`Unknown provider: ${Q}`)}}function cR(J){let[,Q]=J.split("/");return Q||J}function nG(J){let Q=MX(J);return Q.contextWindow-Q.maxOutputTokens}function LB(J){let Q=J?.["internal.visibleModes"]??[];return Object.values(SN).filter((Z)=>{if(Q.includes(`!${Z.key}`))return!1;let Y="visible"in Z?Z.visible:!1,K=Q.includes(Z.key);return Y||K}).map((Z)=>({mode:Z.key,description:"description"in Z?Z.description:void 0})).sort((Z,X)=>Z.mode.localeCompare(X.mode))}function Od(J){return Object.values(SN).find((Q)=>Q.key===J)}function yl1(J){return Od(J)?.primaryModel??v8("CLAUDE_SONNET_4_5")}function $d(J){let Q=Od(J);if(!Q)return!1;return MX(Q.primaryModel).capabilities?.vision??!1}function BZ1(J,Q){return Q.find((Z)=>Z.mode===J)?.description}function Ed(J,Q){let X=(Q.findIndex((K)=>K.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var P2,m2,SN,jd,YS,bl1;var z2=B1(()=>{P2={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai",SUPERNOVA:"supernova"},m2={CLAUDE_SONNET_4:{provider:P2.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:P2.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:P2.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:P2.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:P2.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_3_5_HAIKU:{provider:P2.ANTHROPIC,name:"claude-3-5-haiku-20241022",displayName:"Claude 3.5 Haiku",contextWindow:200000,maxOutputTokens:8000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0},CLAUDE_3_5_SONNET:{provider:P2.ANTHROPIC,name:"claude-3-5-sonnet-20241022",displayName:"Claude 3.5 Sonnet",contextWindow:200000,maxOutputTokens:8000,capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5:{provider:P2.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_CODEX:{provider:P2.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_MINI:{provider:P2.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:P2.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}},GPT_4_1:{provider:P2.OPENAI,name:"gpt-4.1",displayName:"GPT-4.1",contextWindow:1047576,maxOutputTokens:32768,pricing:{input:2,output:8,cached:0.5},capabilities:{vision:!0,tools:!0}},GPT_4O:{provider:P2.OPENAI,name:"gpt-4o",displayName:"GPT-4o",contextWindow:128000,maxOutputTokens:16384,pricing:{input:2.5,output:10,cached:1.25},capabilities:{vision:!0,tools:!0}},O3:{provider:P2.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:P2.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:P2.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:P2.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE:{provider:P2.XAI,name:"grok-code",displayName:"Grok Code",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:P2.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:P2.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:P2.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}},GEMINI_2_5_FLASH_LITE:{provider:P2.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:P2.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},QWEN_3_CODER_480B:{provider:P2.CEREBRAS,name:"qwen-3-coder-480b",displayName:"Qwen 3 Coder 480B",contextWindow:128000,maxOutputTokens:32000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:P2.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:P2.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},CODE_SUPERNOVA:{provider:P2.SUPERNOVA,name:"code-supernova",displayName:"Code Supernova",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0},freeTierEligible:!0}};SN={SMART:{key:"smart",displayName:"Smart",description:"Smarter, but slower",primaryModel:v8("CLAUDE_SONNET_4_5"),visible:!0},FAST:{key:"fast",displayName:"Fast",description:"Faster, but dumber",primaryModel:v8("GROK_CODE_FAST_1"),toolAllowlist:["*","!todo_read","!todo_write","!Task","!oracle","!web_search","!read_web_page","!read_mcp_resource"],visible:!1},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:v8("GROK_CODE"),visible:!0,toolAllowlist:["*","!oracle","!librarian","!Task"]},GRONK_FAST_MAIN:{key:"gronk-fast:main",displayName:"Gronk Fast Main",primaryModel:v8("GROK_CODE_FAST_1")},GRONK_FAST_SEARCH:{key:"gronk-fast:search",displayName:"Gronk Fast Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("GROK_CODE_FAST_1")},GRONK_FAST_MAIN_SEARCH:{key:"gronk-fast:main+search",displayName:"Gronk Fast Main+Search",primaryModel:v8("GROK_CODE_FAST_1"),searchModel:v8("GROK_CODE_FAST_1")},BOLT_SEARCH:{key:"bolt:search",displayName:"Bolt Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("QWEN_3_CODER_480B")},BOLT_MAIN:{key:"bolt:main",displayName:"Bolt Main",primaryModel:v8("QWEN_3_CODER_480B")},BOLT_MAIN_SEARCH:{key:"bolt:main+search",displayName:"Bolt Main+Search",primaryModel:v8("QWEN_3_CODER_480B"),searchModel:v8("QWEN_3_CODER_480B")},GEPPETTO_MAIN:{key:"geppetto:main",displayName:"Geppetto Main",primaryModel:v8("GPT_5")},GEPPETTO_PRO_MAIN:{key:"geppetto-pro:main",displayName:"Geppetto Pro Main",primaryModel:v8("GPT_5")},PINOCCHIO_MAIN:{key:"pinocchio:main",displayName:"Pinocchio Main",primaryModel:v8("GPT_5_CODEX")},CLAUDIUS_MAIN:{key:"claudius:main",displayName:"Claudius Main",primaryModel:v8("CLAUDE_OPUS_4")},OPUS_4_1:{key:"opus4.1",displayName:"Opus 4.1",primaryModel:v8("CLAUDE_OPUS_4_1")},HYDROGEN_MAIN:{key:"hydrogen:main",displayName:"Hydrogen Main",primaryModel:v8("CODE_SUPERNOVA")},KASHMIR_MAIN:{key:"kashmir:main",displayName:"Kashmir Main",primaryModel:v8("KIMI_K2_INSTRUCT")},KASHMIR_SEARCH:{key:"kashmir:search",displayName:"Kashmir Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("KIMI_K2_INSTRUCT")},KASHMIR_MAIN_SEARCH:{key:"kashmir:main+search",displayName:"Kashmir Main+Search",primaryModel:v8("KIMI_K2_INSTRUCT"),searchModel:v8("KIMI_K2_INSTRUCT")},GOSSIP_MAIN:{key:"gossip:main",displayName:"Gossip Main",primaryModel:v8("GPT_OSS_120B")},GOSSIP_SEARCH:{key:"gossip:search",displayName:"Gossip Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("GPT_OSS_120B")},GOSSIP_MAIN_SEARCH:{key:"gossip:main+search",displayName:"Gossip Main+Search",primaryModel:v8("GPT_OSS_120B"),searchModel:v8("GPT_OSS_120B")},SONOMOON_MAIN:{key:"sonomoon:main",displayName:"Sonomoon Main",primaryModel:v8("SONOMA_SKY_ALPHA")},SONOMOON_SEARCH:{key:"sonomoon:search",displayName:"Sonomoon Search",primaryModel:v8("CLAUDE_SONNET_4_5"),searchModel:v8("SONOMA_SKY_ALPHA")},SONOMOON_MAIN_SEARCH:{key:"sonomoon:main+search",displayName:"Sonomoon Main+Search",primaryModel:v8("SONOMA_SKY_ALPHA"),searchModel:v8("SONOMA_SKY_ALPHA")}},jd=Object.values(SN).map((J)=>J.key),YS={xai_finder:["fast","free","gronk-fast:search","gronk-fast:main+search"],fast_finder:["bolt:search","bolt:main+search"],kimiK2_finder:["kashmir:search","kashmir:main+search"],gossip_finder:["gossip:search","gossip:main+search"],sonoma_finder:["sonomoon:search","sonomoon:main+search"]},bl1=Object.keys(YS)});function DZ1(J){return jD6.includes(J)}function hl1(J){let Q=J["internal.oracleModel"]?.trim();if(Q&&Q.length>0)return Q;return m2.GPT_5.name}function gl1(J){let Q=J["internal.model"]?.trim();if(!Q||Q.length===0)return null;let Z=Q.indexOf(":");if(Z===-1)return null;let X=Q.slice(0,Z).trim(),Y=Q.slice(Z+1).trim();if(!X||!Y)return null;return`${X}/${Y}`}var jD6,fl1;var KS=B1(()=>{z2();jD6=["guardedFiles.allowlist","mcpPermissions","tools.disable","permissions"];fl1=["apiKey","buildkite-access-token","github-access-token","gitlab-access-token","gitlab-instance-url"]});function AB(J){let Q=typeof J==="string"?J:J.toString();return Q===zZ||Q===zZ.slice(0,-1)}function lR(J){return AB(J)?zZ:J}var ID6,zZ,PD6,sD9;var wB=B1(()=>{ID6=new URL("https://ampcode.com/"),zZ=ID6.toString(),PD6=new URL("https://api.anthropic.com/"),sD9=PD6.toString()});var V9,MZ1,r0,rG=(J)=>{switch(typeof J){case"undefined":return r0.undefined;case"string":return r0.string;case"number":return Number.isNaN(J)?r0.nan:r0.number;case"boolean":return r0.boolean;case"function":return r0.function;case"bigint":return r0.bigint;case"symbol":return r0.symbol;case"object":if(Array.isArray(J))return r0.array;if(J===null)return r0.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return r0.promise;if(typeof Map<"u"&&J instanceof Map)return r0.map;if(typeof Set<"u"&&J instanceof Set)return r0.set;if(typeof Date<"u"&&J instanceof Date)return r0.date;return r0.object;default:return r0.unknown}};var qS=B1(()=>{(function(J){J.assertEqual=(Y)=>{};function Q(Y){}J.assertIs=Q;function Z(Y){throw Error()}J.assertNever=Z,J.arrayToEnum=(Y)=>{let K={};for(let q of Y)K[q]=q;return K},J.getValidEnumValues=(Y)=>{let K=J.objectKeys(Y).filter((G)=>typeof Y[Y[G]]!=="number"),q={};for(let G of K)q[G]=Y[G];return J.objectValues(q)},J.objectValues=(Y)=>{return J.objectKeys(Y).map(function(K){return Y[K]})},J.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let K=[];for(let q in Y)if(Object.prototype.hasOwnProperty.call(Y,q))K.push(q);return K},J.find=(Y,K)=>{for(let q of Y)if(K(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function X(Y,K=" | "){return Y.map((q)=>typeof q==="string"?`'${q}'`:q).join(K)}J.joinValues=X,J.jsonStringifyReplacer=(Y,K)=>{if(typeof K==="bigint")return K.toString();return K}})(V9||(V9={}));(function(J){J.mergeShapes=(Q,Z)=>{return{...Q,...Z}}})(MZ1||(MZ1={}));r0=V9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b0,TD6=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},UZ;var Pd=B1(()=>{qS();b0=V9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);UZ=class UZ extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Z)=>{this.issues=[...this.issues,Z]},this.addIssues=(Z=[])=>{this.issues=[...this.issues,...Z]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(Y){return Y.message},Z={_errors:[]},X=(Y)=>{for(let K of Y.issues)if(K.code==="invalid_union")K.unionErrors.map(X);else if(K.code==="invalid_return_type")X(K.returnTypeError);else if(K.code==="invalid_arguments")X(K.argumentsError);else if(K.path.length===0)Z._errors.push(Q(K));else{let q=Z,G=0;while(G<K.path.length){let z=K.path[G];if(G!==K.path.length-1)q[z]=q[z]||{_errors:[]};else q[z]=q[z]||{_errors:[]},q[z]._errors.push(Q(K));q=q[z],G++}}};return X(this),Z}static assert(J){if(!(J instanceof UZ))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Z=[];for(let X of this.issues)if(X.path.length>0){let Y=X.path[0];Q[Y]=Q[Y]||[],Q[Y].push(J(X))}else Z.push(J(X));return{formErrors:Z,fieldErrors:Q}}get formErrors(){return this.flatten()}};UZ.create=(J)=>{return new UZ(J)}});var CD6=(J,Q)=>{let Z;switch(J.code){case b0.invalid_type:if(J.received===r0.undefined)Z="Required";else Z=`Expected ${J.expected}, received ${J.received}`;break;case b0.invalid_literal:Z=`Invalid literal value, expected ${JSON.stringify(J.expected,V9.jsonStringifyReplacer)}`;break;case b0.unrecognized_keys:Z=`Unrecognized key(s) in object: ${V9.joinValues(J.keys,", ")}`;break;case b0.invalid_union:Z="Invalid input";break;case b0.invalid_union_discriminator:Z=`Invalid discriminator value. Expected ${V9.joinValues(J.options)}`;break;case b0.invalid_enum_value:Z=`Invalid enum value. Expected ${V9.joinValues(J.options)}, received '${J.received}'`;break;case b0.invalid_arguments:Z="Invalid function arguments";break;case b0.invalid_return_type:Z="Invalid function return type";break;case b0.invalid_date:Z="Invalid date";break;case b0.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Z=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Z=`${Z} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Z=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Z=`Invalid input: must end with "${J.validation.endsWith}"`;else V9.assertNever(J.validation);else if(J.validation!=="regex")Z=`Invalid ${J.validation}`;else Z="Invalid";break;case b0.too_small:if(J.type==="array")Z=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Z=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Z=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Z=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Z=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Z="Invalid input";break;case b0.too_big:if(J.type==="array")Z=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Z=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Z=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Z=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Z=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Z="Invalid input";break;case b0.custom:Z="Invalid input";break;case b0.invalid_intersection_types:Z="Intersection results could not be merged";break;case b0.not_multiple_of:Z=`Number must be a multiple of ${J.multipleOf}`;break;case b0.not_finite:Z="Number must be finite";break;default:Z=Q.defaultError,V9.assertNever(J)}return{message:Z}},YF;var VZ1=B1(()=>{Pd();qS();YF=CD6});function SD6(J){ul1=J}function iR(){return ul1}var ul1;var Td=B1(()=>{VZ1();ul1=YF});function U6(J,Q){let Z=iR(),X=GS({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Z,Z===YF?void 0:YF].filter((Y)=>!!Y)});J.common.issues.push(X)}class QJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Z=[];for(let X of Q){if(X.status==="aborted")return H8;if(X.status==="dirty")J.dirty();Z.push(X.value)}return{status:J.value,value:Z}}static async mergeObjectAsync(J,Q){let Z=[];for(let X of Q){let Y=await X.key,K=await X.value;Z.push({key:Y,value:K})}return QJ.mergeObjectSync(J,Z)}static mergeObjectSync(J,Q){let Z={};for(let X of Q){let{key:Y,value:K}=X;if(Y.status==="aborted")return H8;if(K.status==="aborted")return H8;if(Y.status==="dirty")J.dirty();if(K.status==="dirty")J.dirty();if(Y.value!=="__proto__"&&(typeof K.value<"u"||X.alwaysSet))Z[Y.value]=K.value}return{status:J.value,value:Z}}}var GS=(J)=>{let{data:Q,path:Z,errorMaps:X,issueData:Y}=J,K=[...Z,...Y.path||[]],q={...Y,path:K};if(Y.message!==void 0)return{...Y,path:K,message:Y.message};let G="",z=X.filter((U)=>!!U).slice().reverse();for(let U of z)G=U(q,{data:Q,defaultError:G}).message;return{...Y,path:K,message:G}},vD6,H8,vN=(J)=>({status:"dirty",value:J}),SJ=(J)=>({status:"valid",value:J}),Cd=(J)=>J.status==="aborted",Sd=(J)=>J.status==="dirty",RB=(J)=>J.status==="valid",nR=(J)=>typeof Promise<"u"&&J instanceof Promise;var NZ1=B1(()=>{Td();VZ1();vD6=[];H8=Object.freeze({status:"aborted"})});var pl1=()=>{};var k6;var dl1=B1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(k6||(k6={}))});class Jq{constructor(J,Q,Z,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Z,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function p8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Z,required_error:X,description:Y}=J;if(Q&&(Z||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:Y};return{errorMap:(q,G)=>{let{message:z}=J;if(q.code==="invalid_enum_value")return{message:z??G.defaultError};if(typeof G.data>"u")return{message:z??X??G.defaultError};if(q.code!=="invalid_type")return{message:G.defaultError};return{message:z??Z??G.defaultError}},description:Y}}class Z9{get description(){return this._def.description}_getType(J){return rG(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:rG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new QJ,ctx:{common:J.parent.common,data:J.data,parsedType:rG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(nR(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Z=this.safeParse(J,Q);if(Z.success)return Z.data;throw Z.error}safeParse(J,Q){let Z={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)},X=this._parseSync({data:J,path:Z.path,parent:Z});return cl1(Z,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)};if(!this["~standard"].async)try{let Z=this._parseSync({data:J,path:[],parent:Q});return RB(Z)?{value:Z.value}:{issues:Q.common.issues}}catch(Z){if(Z?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Z)=>RB(Z)?{value:Z.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Z=await this.safeParseAsync(J,Q);if(Z.success)return Z.data;throw Z.error}async safeParseAsync(J,Q){let Z={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:rG(J)},X=this._parse({data:J,path:Z.path,parent:Z}),Y=await(nR(X)?X:Promise.resolve(X));return cl1(Z,Y)}refine(J,Q){let Z=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,Y)=>{let K=J(X),q=()=>Y.addIssue({code:b0.custom,...Z(X)});if(typeof Promise<"u"&&K instanceof Promise)return K.then((G)=>{if(!G)return q(),!1;else return!0});if(!K)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Z,X)=>{if(!J(Z))return X.addIssue(typeof Q==="function"?Q(Z,X):Q),!1;else return!0})}_refinement(J){return new Qq({schema:this,typeName:L8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return eK.create(this,this._def)}nullable(){return qF.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tK.create(this)}promise(){return bN.create(this,this._def)}or(J){return eR.create([this,J],this._def)}and(J){return JO.create(this,J,this._def)}transform(J){return new Qq({...p8(this._def),schema:this,typeName:L8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new YO({...p8(this._def),innerType:this,defaultValue:Q,typeName:L8.ZodDefault})}brand(){return new kd({typeName:L8.ZodBranded,type:this,...p8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new KO({...p8(this._def),innerType:this,catchValue:Q,typeName:L8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return BS.create(this,J)}readonly(){return qO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function nl1(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Z=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Z}`}function aD6(J){return new RegExp(`^${nl1(J)}$`)}function al1(J){let Q=`${il1}T${nl1(J)}`,Z=[];if(Z.push(J.local?"Z?":"Z"),J.offset)Z.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Z.join("|")})`,new RegExp(`^${Q}$`)}function rD6(J,Q){if((Q==="v4"||!Q)&&uD6.test(J))return!0;if((Q==="v6"||!Q)&&dD6.test(J))return!0;return!1}function sD6(J,Q){if(!fD6.test(J))return!1;try{let[Z]=J.split(".");if(!Z)return!1;let X=Z.replace(/-/g,"+").replace(/_/g,"/").padEnd(Z.length+(4-Z.length%4)%4,"="),Y=JSON.parse(atob(X));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(Q&&Y.alg!==Q)return!1;return!0}catch{return!1}}function oD6(J,Q){if((Q==="v4"||!Q)&&pD6.test(J))return!0;if((Q==="v6"||!Q)&&cD6.test(J))return!0;return!1}function tD6(J,Q){let Z=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,Y=Z>X?Z:X,K=Number.parseInt(J.toFixed(Y).replace(".","")),q=Number.parseInt(Q.toFixed(Y).replace(".",""));return K%q/10**Y}function aR(J){if(J instanceof v4){let Q={};for(let Z in J.shape){let X=J.shape[Z];Q[Z]=eK.create(aR(X))}return new v4({...J._def,shape:()=>Q})}else if(J instanceof tK)return new tK({...J._def,type:aR(J.element)});else if(J instanceof eK)return eK.create(aR(J.unwrap()));else if(J instanceof qF)return qF.create(aR(J.unwrap()));else if(J instanceof oG)return oG.create(J.items.map((Q)=>aR(Q)));else return J}function AZ1(J,Q){let Z=rG(J),X=rG(Q);if(J===Q)return{valid:!0,data:J};else if(Z===r0.object&&X===r0.object){let Y=V9.objectKeys(Q),K=V9.objectKeys(J).filter((G)=>Y.indexOf(G)!==-1),q={...J,...Q};for(let G of K){let z=AZ1(J[G],Q[G]);if(!z.valid)return{valid:!1};q[G]=z.data}return{valid:!0,data:q}}else if(Z===r0.array&&X===r0.array){if(J.length!==Q.length)return{valid:!1};let Y=[];for(let K=0;K<J.length;K++){let q=J[K],G=Q[K],z=AZ1(q,G);if(!z.valid)return{valid:!1};Y.push(z.data)}return{valid:!0,data:Y}}else if(Z===r0.date&&X===r0.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function rl1(J,Q){return new EB({values:J,typeName:L8.ZodEnum,...p8(Q)})}function ll1(J,Q){let Z=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Z==="string"?{message:Z}:Z}function sl1(J,Q={},Z){if(J)return _N.create().superRefine((X,Y)=>{let K=J(X);if(K instanceof Promise)return K.then((q)=>{if(!q){let G=ll1(Q,X),z=G.fatal??Z??!0;Y.addIssue({code:"custom",...G,fatal:z})}});if(!K){let q=ll1(Q,X),G=q.fatal??Z??!0;Y.addIssue({code:"custom",...q,fatal:G})}return});return _N.create()}var cl1=(J,Q)=>{if(RB(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Z=new UZ(J.common.issues);return this._error=Z,this._error}}}},kD6,_D6,xD6,bD6,yD6,fD6,hD6,gD6,mD6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",LZ1,uD6,pD6,dD6,cD6,lD6,iD6,il1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",nD6,oK,jB,$B,sR,kN,zS,oR,tR,_N,OB,sG,US,tK,v4,eR,KF=(J)=>{if(J instanceof QO)return KF(J.schema);else if(J instanceof Qq)return KF(J.innerType());else if(J instanceof ZO)return[J.value];else if(J instanceof EB)return J.options;else if(J instanceof XO)return V9.objectValues(J.enum);else if(J instanceof YO)return KF(J._def.innerType);else if(J instanceof oR)return[void 0];else if(J instanceof tR)return[null];else if(J instanceof eK)return[void 0,...KF(J.unwrap())];else if(J instanceof qF)return[null,...KF(J.unwrap())];else if(J instanceof kd)return KF(J.unwrap());else if(J instanceof qO)return KF(J.unwrap());else if(J instanceof KO)return KF(J._def.innerType);else return[]},vd,JO,oG,FS,WS,xN,rR,QO,ZO,EB,XO,bN,Qq,eK,qF,YO,KO,HS,eD6,kd,BS,qO,JM6,L8,QM6=(J,Q={message:`Input not instance of ${J.name}`})=>sl1((Z)=>Z instanceof J,Q),ol1,tl1,ZM6,XM6,el1,YM6,KM6,qM6,GM6,zM6,UM6,FM6,WM6,HM6,BM6,DM6,MM6,VM6,NM6,LM6,AM6,wM6,RM6,OM6,jM6,$M6,EM6,IM6,PM6,TM6,CM6,SM6,vM6,kM6,_M6=()=>ol1().optional(),xM6=()=>tl1().optional(),bM6=()=>el1().optional(),yM6,fM6;var Ji1=B1(()=>{Pd();Td();dl1();NZ1();qS();kD6=/^c[^\s-]{8,}$/i,_D6=/^[0-9a-z]+$/,xD6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bD6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yD6=/^[a-z0-9_-]{21}$/i,fD6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hD6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gD6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uD6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pD6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dD6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cD6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lD6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iD6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nD6=new RegExp(`^${il1}$`);oK=class oK extends Z9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==r0.string){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.string,received:Y.parsedType}),H8}let Z=new QJ,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(J.data.length<Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Z.dirty()}else if(Y.kind==="max"){if(J.data.length>Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Z.dirty()}else if(Y.kind==="length"){let K=J.data.length>Y.value,q=J.data.length<Y.value;if(K||q){if(X=this._getOrReturnCtx(J,X),K)U6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(q)U6(X,{code:b0.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Z.dirty()}}else if(Y.kind==="email"){if(!gD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"email",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="emoji"){if(!LZ1)LZ1=new RegExp(mD6,"u");if(!LZ1.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"emoji",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="uuid"){if(!bD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"uuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="nanoid"){if(!yD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"nanoid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid"){if(!kD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid2"){if(!_D6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cuid2",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ulid"){if(!xD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"ulid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),U6(X,{validation:"url",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"regex",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="trim")J.data=J.data.trim();else if(Y.kind==="includes"){if(!J.data.includes(Y.value,Y.position))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Z.dirty()}else if(Y.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(Y.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(Y.kind==="startsWith"){if(!J.data.startsWith(Y.value))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="endsWith"){if(!J.data.endsWith(Y.value))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="datetime"){if(!al1(Y).test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"datetime",message:Y.message}),Z.dirty()}else if(Y.kind==="date"){if(!nD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"date",message:Y.message}),Z.dirty()}else if(Y.kind==="time"){if(!aD6(Y).test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{code:b0.invalid_string,validation:"time",message:Y.message}),Z.dirty()}else if(Y.kind==="duration"){if(!hD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"duration",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ip"){if(!rD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),U6(X,{validation:"ip",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="jwt"){if(!sD6(J.data,Y.alg))X=this._getOrReturnCtx(J,X),U6(X,{validation:"jwt",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cidr"){if(!oD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),U6(X,{validation:"cidr",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64"){if(!lD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"base64",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64url"){if(!iD6.test(J.data))X=this._getOrReturnCtx(J,X),U6(X,{validation:"base64url",code:b0.invalid_string,message:Y.message}),Z.dirty()}else V9.assertNever(Y);return{status:Z.value,value:J.data}}_regex(J,Q,Z){return this.refinement((X)=>J.test(X),{validation:Q,code:b0.invalid_string,...k6.errToObj(Z)})}_addCheck(J){return new oK({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...k6.errToObj(J)})}url(J){return this._addCheck({kind:"url",...k6.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...k6.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...k6.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...k6.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...k6.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...k6.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...k6.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...k6.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...k6.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...k6.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...k6.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...k6.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...k6.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...k6.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...k6.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...k6.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...k6.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...k6.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...k6.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...k6.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...k6.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...k6.errToObj(Q)})}nonempty(J){return this.min(1,k6.errToObj(J))}trim(){return new oK({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oK({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oK({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};oK.create=(J)=>{return new oK({checks:[],typeName:L8.ZodString,coerce:J?.coerce??!1,...p8(J)})};jB=class jB extends Z9{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==r0.number){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.number,received:Y.parsedType}),H8}let Z=void 0,X=new QJ;for(let Y of this._def.checks)if(Y.kind==="int"){if(!V9.isInteger(J.data))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.invalid_type,expected:"integer",received:"float",message:Y.message}),X.dirty()}else if(Y.kind==="min"){if(Y.inclusive?J.data<Y.value:J.data<=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?J.data>Y.value:J.data>=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(tD6(J.data,Y.value)!==0)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(J.data))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_finite,message:Y.message}),X.dirty()}else V9.assertNever(Y);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,k6.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,k6.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,k6.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,k6.toString(Q))}setLimit(J,Q,Z,X){return new jB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new jB({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:k6.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k6.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k6.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k6.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k6.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:k6.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:k6.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k6.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k6.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&V9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Z of this._def.checks)if(Z.kind==="finite"||Z.kind==="int"||Z.kind==="multipleOf")return!0;else if(Z.kind==="min"){if(Q===null||Z.value>Q)Q=Z.value}else if(Z.kind==="max"){if(J===null||Z.value<J)J=Z.value}return Number.isFinite(Q)&&Number.isFinite(J)}};jB.create=(J)=>{return new jB({checks:[],typeName:L8.ZodNumber,coerce:J?.coerce||!1,...p8(J)})};$B=class $B extends Z9{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==r0.bigint)return this._getInvalidInput(J);let Z=void 0,X=new QJ;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?J.data<Y.value:J.data<=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?J.data>Y.value:J.data>=Y.value)Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(J.data%Y.value!==BigInt(0))Z=this._getOrReturnCtx(J,Z),U6(Z,{code:b0.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else V9.assertNever(Y);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return U6(Q,{code:b0.invalid_type,expected:r0.bigint,received:Q.parsedType}),H8}gte(J,Q){return this.setLimit("min",J,!0,k6.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,k6.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,k6.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,k6.toString(Q))}setLimit(J,Q,Z,X){return new $B({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new $B({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k6.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k6.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k6.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k6.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:k6.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};$B.create=(J)=>{return new $B({checks:[],typeName:L8.ZodBigInt,coerce:J?.coerce??!1,...p8(J)})};sR=class sR extends Z9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==r0.boolean){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.boolean,received:Z.parsedType}),H8}return SJ(J.data)}};sR.create=(J)=>{return new sR({typeName:L8.ZodBoolean,coerce:J?.coerce||!1,...p8(J)})};kN=class kN extends Z9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==r0.date){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_type,expected:r0.date,received:Y.parsedType}),H8}if(Number.isNaN(J.data.getTime())){let Y=this._getOrReturnCtx(J);return U6(Y,{code:b0.invalid_date}),H8}let Z=new QJ,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(J.data.getTime()<Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Z.dirty()}else if(Y.kind==="max"){if(J.data.getTime()>Y.value)X=this._getOrReturnCtx(J,X),U6(X,{code:b0.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Z.dirty()}else V9.assertNever(Y);return{status:Z.value,value:new Date(J.data.getTime())}}_addCheck(J){return new kN({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:k6.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:k6.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};kN.create=(J)=>{return new kN({checks:[],coerce:J?.coerce||!1,typeName:L8.ZodDate,...p8(J)})};zS=class zS extends Z9{_parse(J){if(this._getType(J)!==r0.symbol){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.symbol,received:Z.parsedType}),H8}return SJ(J.data)}};zS.create=(J)=>{return new zS({typeName:L8.ZodSymbol,...p8(J)})};oR=class oR extends Z9{_parse(J){if(this._getType(J)!==r0.undefined){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.undefined,received:Z.parsedType}),H8}return SJ(J.data)}};oR.create=(J)=>{return new oR({typeName:L8.ZodUndefined,...p8(J)})};tR=class tR extends Z9{_parse(J){if(this._getType(J)!==r0.null){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.null,received:Z.parsedType}),H8}return SJ(J.data)}};tR.create=(J)=>{return new tR({typeName:L8.ZodNull,...p8(J)})};_N=class _N extends Z9{constructor(){super(...arguments);this._any=!0}_parse(J){return SJ(J.data)}};_N.create=(J)=>{return new _N({typeName:L8.ZodAny,...p8(J)})};OB=class OB extends Z9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return SJ(J.data)}};OB.create=(J)=>{return new OB({typeName:L8.ZodUnknown,...p8(J)})};sG=class sG extends Z9{_parse(J){let Q=this._getOrReturnCtx(J);return U6(Q,{code:b0.invalid_type,expected:r0.never,received:Q.parsedType}),H8}};sG.create=(J)=>{return new sG({typeName:L8.ZodNever,...p8(J)})};US=class US extends Z9{_parse(J){if(this._getType(J)!==r0.undefined){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.void,received:Z.parsedType}),H8}return SJ(J.data)}};US.create=(J)=>{return new US({typeName:L8.ZodVoid,...p8(J)})};tK=class tK extends Z9{_parse(J){let{ctx:Q,status:Z}=this._processInputParams(J),X=this._def;if(Q.parsedType!==r0.array)return U6(Q,{code:b0.invalid_type,expected:r0.array,received:Q.parsedType}),H8;if(X.exactLength!==null){let K=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(K||q)U6(Q,{code:K?b0.too_big:b0.too_small,minimum:q?X.exactLength.value:void 0,maximum:K?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Z.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)U6(Q,{code:b0.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Z.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)U6(Q,{code:b0.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Z.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((K,q)=>{return X.type._parseAsync(new Jq(Q,K,Q.path,q))})).then((K)=>{return QJ.mergeArray(Z,K)});let Y=[...Q.data].map((K,q)=>{return X.type._parseSync(new Jq(Q,K,Q.path,q))});return QJ.mergeArray(Z,Y)}get element(){return this._def.type}min(J,Q){return new tK({...this._def,minLength:{value:J,message:k6.toString(Q)}})}max(J,Q){return new tK({...this._def,maxLength:{value:J,message:k6.toString(Q)}})}length(J,Q){return new tK({...this._def,exactLength:{value:J,message:k6.toString(Q)}})}nonempty(J){return this.min(1,J)}};tK.create=(J,Q)=>{return new tK({type:J,minLength:null,maxLength:null,exactLength:null,typeName:L8.ZodArray,...p8(Q)})};v4=class v4 extends Z9{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=V9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==r0.object){let z=this._getOrReturnCtx(J);return U6(z,{code:b0.invalid_type,expected:r0.object,received:z.parsedType}),H8}let{status:Z,ctx:X}=this._processInputParams(J),{shape:Y,keys:K}=this._getCached(),q=[];if(!(this._def.catchall instanceof sG&&this._def.unknownKeys==="strip")){for(let z in X.data)if(!K.includes(z))q.push(z)}let G=[];for(let z of K){let U=Y[z],F=X.data[z];G.push({key:{status:"valid",value:z},value:U._parse(new Jq(X,F,X.path,z)),alwaysSet:z in X.data})}if(this._def.catchall instanceof sG){let z=this._def.unknownKeys;if(z==="passthrough")for(let U of q)G.push({key:{status:"valid",value:U},value:{status:"valid",value:X.data[U]}});else if(z==="strict"){if(q.length>0)U6(X,{code:b0.unrecognized_keys,keys:q}),Z.dirty()}else if(z==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let z=this._def.catchall;for(let U of q){let F=X.data[U];G.push({key:{status:"valid",value:U},value:z._parse(new Jq(X,F,X.path,U)),alwaysSet:U in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let z=[];for(let U of G){let F=await U.key,W=await U.value;z.push({key:F,value:W,alwaysSet:U.alwaysSet})}return z}).then((z)=>{return QJ.mergeObjectSync(Z,z)});else return QJ.mergeObjectSync(Z,G)}get shape(){return this._def.shape()}strict(J){return k6.errToObj,new v4({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Z)=>{let X=this._def.errorMap?.(Q,Z).message??Z.defaultError;if(Q.code==="unrecognized_keys")return{message:k6.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new v4({...this._def,unknownKeys:"strip"})}passthrough(){return new v4({...this._def,unknownKeys:"passthrough"})}extend(J){return new v4({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new v4({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:L8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new v4({...this._def,catchall:J})}pick(J){let Q={};for(let Z of V9.objectKeys(J))if(J[Z]&&this.shape[Z])Q[Z]=this.shape[Z];return new v4({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Z of V9.objectKeys(this.shape))if(!J[Z])Q[Z]=this.shape[Z];return new v4({...this._def,shape:()=>Q})}deepPartial(){return aR(this)}partial(J){let Q={};for(let Z of V9.objectKeys(this.shape)){let X=this.shape[Z];if(J&&!J[Z])Q[Z]=X;else Q[Z]=X.optional()}return new v4({...this._def,shape:()=>Q})}required(J){let Q={};for(let Z of V9.objectKeys(this.shape))if(J&&!J[Z])Q[Z]=this.shape[Z];else{let Y=this.shape[Z];while(Y instanceof eK)Y=Y._def.innerType;Q[Z]=Y}return new v4({...this._def,shape:()=>Q})}keyof(){return rl1(V9.objectKeys(this.shape))}};v4.create=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strip",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};v4.strictCreate=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strict",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};v4.lazycreate=(J,Q)=>{return new v4({shape:J,unknownKeys:"strip",catchall:sG.create(),typeName:L8.ZodObject,...p8(Q)})};eR=class eR extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=this._def.options;function X(Y){for(let q of Y)if(q.result.status==="valid")return q.result;for(let q of Y)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let K=Y.map((q)=>new UZ(q.ctx.common.issues));return U6(Q,{code:b0.invalid_union,unionErrors:K}),H8}if(Q.common.async)return Promise.all(Z.map(async(Y)=>{let K={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:Q.data,path:Q.path,parent:K}),ctx:K}})).then(X);else{let Y=void 0,K=[];for(let G of Z){let z={...Q,common:{...Q.common,issues:[]},parent:null},U=G._parseSync({data:Q.data,path:Q.path,parent:z});if(U.status==="valid")return U;else if(U.status==="dirty"&&!Y)Y={result:U,ctx:z};if(z.common.issues.length)K.push(z.common.issues)}if(Y)return Q.common.issues.push(...Y.ctx.common.issues),Y.result;let q=K.map((G)=>new UZ(G));return U6(Q,{code:b0.invalid_union,unionErrors:q}),H8}}get options(){return this._def.options}};eR.create=(J,Q)=>{return new eR({options:J,typeName:L8.ZodUnion,...p8(Q)})};vd=class vd extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.object)return U6(Q,{code:b0.invalid_type,expected:r0.object,received:Q.parsedType}),H8;let Z=this.discriminator,X=Q.data[Z],Y=this.optionsMap.get(X);if(!Y)return U6(Q,{code:b0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Z]}),H8;if(Q.common.async)return Y._parseAsync({data:Q.data,path:Q.path,parent:Q});else return Y._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Z){let X=new Map;for(let Y of Q){let K=KF(Y.shape[J]);if(!K.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of K){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,Y)}}return new vd({typeName:L8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...p8(Z)})}};JO=class JO extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=(Y,K)=>{if(Cd(Y)||Cd(K))return H8;let q=AZ1(Y.value,K.value);if(!q.valid)return U6(Z,{code:b0.invalid_intersection_types}),H8;if(Sd(Y)||Sd(K))Q.dirty();return{status:Q.value,value:q.data}};if(Z.common.async)return Promise.all([this._def.left._parseAsync({data:Z.data,path:Z.path,parent:Z}),this._def.right._parseAsync({data:Z.data,path:Z.path,parent:Z})]).then(([Y,K])=>X(Y,K));else return X(this._def.left._parseSync({data:Z.data,path:Z.path,parent:Z}),this._def.right._parseSync({data:Z.data,path:Z.path,parent:Z}))}};JO.create=(J,Q,Z)=>{return new JO({left:J,right:Q,typeName:L8.ZodIntersection,...p8(Z)})};oG=class oG extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.array)return U6(Z,{code:b0.invalid_type,expected:r0.array,received:Z.parsedType}),H8;if(Z.data.length<this._def.items.length)return U6(Z,{code:b0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H8;if(!this._def.rest&&Z.data.length>this._def.items.length)U6(Z,{code:b0.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let Y=[...Z.data].map((K,q)=>{let G=this._def.items[q]||this._def.rest;if(!G)return null;return G._parse(new Jq(Z,K,Z.path,q))}).filter((K)=>!!K);if(Z.common.async)return Promise.all(Y).then((K)=>{return QJ.mergeArray(Q,K)});else return QJ.mergeArray(Q,Y)}get items(){return this._def.items}rest(J){return new oG({...this._def,rest:J})}};oG.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new oG({items:J,typeName:L8.ZodTuple,rest:null,...p8(Q)})};FS=class FS extends Z9{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.object)return U6(Z,{code:b0.invalid_type,expected:r0.object,received:Z.parsedType}),H8;let X=[],Y=this._def.keyType,K=this._def.valueType;for(let q in Z.data)X.push({key:Y._parse(new Jq(Z,q,Z.path,q)),value:K._parse(new Jq(Z,Z.data[q],Z.path,q)),alwaysSet:q in Z.data});if(Z.common.async)return QJ.mergeObjectAsync(Q,X);else return QJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Z){if(Q instanceof Z9)return new FS({keyType:J,valueType:Q,typeName:L8.ZodRecord,...p8(Z)});return new FS({keyType:oK.create(),valueType:J,typeName:L8.ZodRecord,...p8(Q)})}};WS=class WS extends Z9{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.map)return U6(Z,{code:b0.invalid_type,expected:r0.map,received:Z.parsedType}),H8;let X=this._def.keyType,Y=this._def.valueType,K=[...Z.data.entries()].map(([q,G],z)=>{return{key:X._parse(new Jq(Z,q,Z.path,[z,"key"])),value:Y._parse(new Jq(Z,G,Z.path,[z,"value"]))}});if(Z.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let G of K){let z=await G.key,U=await G.value;if(z.status==="aborted"||U.status==="aborted")return H8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let G of K){let{key:z,value:U}=G;if(z.status==="aborted"||U.status==="aborted")return H8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}}}};WS.create=(J,Q,Z)=>{return new WS({valueType:Q,keyType:J,typeName:L8.ZodMap,...p8(Z)})};xN=class xN extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==r0.set)return U6(Z,{code:b0.invalid_type,expected:r0.set,received:Z.parsedType}),H8;let X=this._def;if(X.minSize!==null){if(Z.data.size<X.minSize.value)U6(Z,{code:b0.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Z.data.size>X.maxSize.value)U6(Z,{code:b0.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let Y=this._def.valueType;function K(G){let z=new Set;for(let U of G){if(U.status==="aborted")return H8;if(U.status==="dirty")Q.dirty();z.add(U.value)}return{status:Q.value,value:z}}let q=[...Z.data.values()].map((G,z)=>Y._parse(new Jq(Z,G,Z.path,z)));if(Z.common.async)return Promise.all(q).then((G)=>K(G));else return K(q)}min(J,Q){return new xN({...this._def,minSize:{value:J,message:k6.toString(Q)}})}max(J,Q){return new xN({...this._def,maxSize:{value:J,message:k6.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};xN.create=(J,Q)=>{return new xN({valueType:J,minSize:null,maxSize:null,typeName:L8.ZodSet,...p8(Q)})};rR=class rR extends Z9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.function)return U6(Q,{code:b0.invalid_type,expected:r0.function,received:Q.parsedType}),H8;function Z(q,G){return GS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,iR(),YF].filter((z)=>!!z),issueData:{code:b0.invalid_arguments,argumentsError:G}})}function X(q,G){return GS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,iR(),YF].filter((z)=>!!z),issueData:{code:b0.invalid_return_type,returnTypeError:G}})}let Y={errorMap:Q.common.contextualErrorMap},K=Q.data;if(this._def.returns instanceof bN){let q=this;return SJ(async function(...G){let z=new UZ([]),U=await q._def.args.parseAsync(G,Y).catch((H)=>{throw z.addIssue(Z(G,H)),z}),F=await Reflect.apply(K,this,U);return await q._def.returns._def.type.parseAsync(F,Y).catch((H)=>{throw z.addIssue(X(F,H)),z})})}else{let q=this;return SJ(function(...G){let z=q._def.args.safeParse(G,Y);if(!z.success)throw new UZ([Z(G,z.error)]);let U=Reflect.apply(K,this,z.data),F=q._def.returns.safeParse(U,Y);if(!F.success)throw new UZ([X(U,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new rR({...this._def,args:oG.create(J).rest(OB.create())})}returns(J){return new rR({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Z){return new rR({args:J?J:oG.create([]).rest(OB.create()),returns:Q||OB.create(),typeName:L8.ZodFunction,...p8(Z)})}};QO=class QO extends Z9{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};QO.create=(J,Q)=>{return new QO({getter:J,typeName:L8.ZodLazy,...p8(Q)})};ZO=class ZO extends Z9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return U6(Q,{received:Q.data,code:b0.invalid_literal,expected:this._def.value}),H8}return{status:"valid",value:J.data}}get value(){return this._def.value}};ZO.create=(J,Q)=>{return new ZO({value:J,typeName:L8.ZodLiteral,...p8(Q)})};EB=class EB extends Z9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Z=this._def.values;return U6(Q,{expected:V9.joinValues(Z),received:Q.parsedType,code:b0.invalid_type}),H8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Z=this._def.values;return U6(Q,{received:Q.data,code:b0.invalid_enum_value,options:Z}),H8}return SJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return EB.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return EB.create(this.options.filter((Z)=>!J.includes(Z)),{...this._def,...Q})}};EB.create=rl1;XO=class XO extends Z9{_parse(J){let Q=V9.getValidEnumValues(this._def.values),Z=this._getOrReturnCtx(J);if(Z.parsedType!==r0.string&&Z.parsedType!==r0.number){let X=V9.objectValues(Q);return U6(Z,{expected:V9.joinValues(X),received:Z.parsedType,code:b0.invalid_type}),H8}if(!this._cache)this._cache=new Set(V9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=V9.objectValues(Q);return U6(Z,{received:Z.data,code:b0.invalid_enum_value,options:X}),H8}return SJ(J.data)}get enum(){return this._def.values}};XO.create=(J,Q)=>{return new XO({values:J,typeName:L8.ZodNativeEnum,...p8(Q)})};bN=class bN extends Z9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==r0.promise&&Q.common.async===!1)return U6(Q,{code:b0.invalid_type,expected:r0.promise,received:Q.parsedType}),H8;let Z=Q.parsedType===r0.promise?Q.data:Promise.resolve(Q.data);return SJ(Z.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};bN.create=(J,Q)=>{return new bN({type:J,typeName:L8.ZodPromise,...p8(Q)})};Qq=class Qq extends Z9{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=this._def.effect||null,Y={addIssue:(K)=>{if(U6(Z,K),K.fatal)Q.abort();else Q.dirty()},get path(){return Z.path}};if(Y.addIssue=Y.addIssue.bind(Y),X.type==="preprocess"){let K=X.transform(Z.data,Y);if(Z.common.async)return Promise.resolve(K).then(async(q)=>{if(Q.value==="aborted")return H8;let G=await this._def.schema._parseAsync({data:q,path:Z.path,parent:Z});if(G.status==="aborted")return H8;if(G.status==="dirty")return vN(G.value);if(Q.value==="dirty")return vN(G.value);return G});else{if(Q.value==="aborted")return H8;let q=this._def.schema._parseSync({data:K,path:Z.path,parent:Z});if(q.status==="aborted")return H8;if(q.status==="dirty")return vN(q.value);if(Q.value==="dirty")return vN(q.value);return q}}if(X.type==="refinement"){let K=(q)=>{let G=X.refinement(q,Y);if(Z.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Z.common.async===!1){let q=this._def.schema._parseSync({data:Z.data,path:Z.path,parent:Z});if(q.status==="aborted")return H8;if(q.status==="dirty")Q.dirty();return K(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Z.data,path:Z.path,parent:Z}).then((q)=>{if(q.status==="aborted")return H8;if(q.status==="dirty")Q.dirty();return K(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Z.common.async===!1){let K=this._def.schema._parseSync({data:Z.data,path:Z.path,parent:Z});if(!RB(K))return H8;let q=X.transform(K.value,Y);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Z.data,path:Z.path,parent:Z}).then((K)=>{if(!RB(K))return H8;return Promise.resolve(X.transform(K.value,Y)).then((q)=>({status:Q.value,value:q}))});V9.assertNever(X)}};Qq.create=(J,Q,Z)=>{return new Qq({schema:J,typeName:L8.ZodEffects,effect:Q,...p8(Z)})};Qq.createWithPreprocess=(J,Q,Z)=>{return new Qq({schema:Q,effect:{type:"preprocess",transform:J},typeName:L8.ZodEffects,...p8(Z)})};eK=class eK extends Z9{_parse(J){if(this._getType(J)===r0.undefined)return SJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};eK.create=(J,Q)=>{return new eK({innerType:J,typeName:L8.ZodOptional,...p8(Q)})};qF=class qF extends Z9{_parse(J){if(this._getType(J)===r0.null)return SJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};qF.create=(J,Q)=>{return new qF({innerType:J,typeName:L8.ZodNullable,...p8(Q)})};YO=class YO extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;if(Q.parsedType===r0.undefined)Z=this._def.defaultValue();return this._def.innerType._parse({data:Z,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};YO.create=(J,Q)=>{return new YO({innerType:J,typeName:L8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...p8(Q)})};KO=class KO extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Z.data,path:Z.path,parent:{...Z}});if(nR(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new UZ(Z.common.issues)},input:Z.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new UZ(Z.common.issues)},input:Z.data})}}removeCatch(){return this._def.innerType}};KO.create=(J,Q)=>{return new KO({innerType:J,typeName:L8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...p8(Q)})};HS=class HS extends Z9{_parse(J){if(this._getType(J)!==r0.nan){let Z=this._getOrReturnCtx(J);return U6(Z,{code:b0.invalid_type,expected:r0.nan,received:Z.parsedType}),H8}return{status:"valid",value:J.data}}};HS.create=(J)=>{return new HS({typeName:L8.ZodNaN,...p8(J)})};eD6=Symbol("zod_brand");kd=class kd extends Z9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;return this._def.type._parse({data:Z,path:Q.path,parent:Q})}unwrap(){return this._def.type}};BS=class BS extends Z9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Z.data,path:Z.path,parent:Z});if(Y.status==="aborted")return H8;if(Y.status==="dirty")return Q.dirty(),vN(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Z.path,parent:Z})})();else{let X=this._def.in._parseSync({data:Z.data,path:Z.path,parent:Z});if(X.status==="aborted")return H8;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Z.path,parent:Z})}}static create(J,Q){return new BS({in:J,out:Q,typeName:L8.ZodPipeline})}};qO=class qO extends Z9{_parse(J){let Q=this._def.innerType._parse(J),Z=(X)=>{if(RB(X))X.value=Object.freeze(X.value);return X};return nR(Q)?Q.then((X)=>Z(X)):Z(Q)}unwrap(){return this._def.innerType}};qO.create=(J,Q)=>{return new qO({innerType:J,typeName:L8.ZodReadonly,...p8(Q)})};JM6={object:v4.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})(L8||(L8={}));ol1=oK.create,tl1=jB.create,ZM6=HS.create,XM6=$B.create,el1=sR.create,YM6=kN.create,KM6=zS.create,qM6=oR.create,GM6=tR.create,zM6=_N.create,UM6=OB.create,FM6=sG.create,WM6=US.create,HM6=tK.create,BM6=v4.create,DM6=v4.strictCreate,MM6=eR.create,VM6=vd.create,NM6=JO.create,LM6=oG.create,AM6=FS.create,wM6=WS.create,RM6=xN.create,OM6=rR.create,jM6=QO.create,$M6=ZO.create,EM6=EB.create,IM6=XO.create,PM6=bN.create,TM6=Qq.create,CM6=eK.create,SM6=qF.create,vM6=Qq.createWithPreprocess,kM6=BS.create,yM6={string:(J)=>oK.create({...J,coerce:!0}),number:(J)=>jB.create({...J,coerce:!0}),boolean:(J)=>sR.create({...J,coerce:!0}),bigint:(J)=>$B.create({...J,coerce:!0}),date:(J)=>kN.create({...J,coerce:!0})},fM6=H8});var Q1={};R6(Q1,{void:()=>WM6,util:()=>V9,unknown:()=>UM6,union:()=>MM6,undefined:()=>qM6,tuple:()=>LM6,transformer:()=>TM6,symbol:()=>KM6,string:()=>ol1,strictObject:()=>DM6,setErrorMap:()=>SD6,set:()=>RM6,record:()=>AM6,quotelessJson:()=>TD6,promise:()=>PM6,preprocess:()=>vM6,pipeline:()=>kM6,ostring:()=>_M6,optional:()=>CM6,onumber:()=>xM6,oboolean:()=>bM6,objectUtil:()=>MZ1,object:()=>BM6,number:()=>tl1,nullable:()=>SM6,null:()=>GM6,never:()=>FM6,nativeEnum:()=>IM6,nan:()=>ZM6,map:()=>wM6,makeIssue:()=>GS,literal:()=>$M6,lazy:()=>jM6,late:()=>JM6,isValid:()=>RB,isDirty:()=>Sd,isAsync:()=>nR,isAborted:()=>Cd,intersection:()=>NM6,instanceof:()=>QM6,getParsedType:()=>rG,getErrorMap:()=>iR,function:()=>OM6,enum:()=>EM6,effect:()=>TM6,discriminatedUnion:()=>VM6,defaultErrorMap:()=>YF,datetimeRegex:()=>al1,date:()=>YM6,custom:()=>sl1,coerce:()=>yM6,boolean:()=>el1,bigint:()=>XM6,array:()=>HM6,any:()=>zM6,addIssueToContext:()=>U6,ZodVoid:()=>US,ZodUnknown:()=>OB,ZodUnion:()=>eR,ZodUndefined:()=>oR,ZodType:()=>Z9,ZodTuple:()=>oG,ZodTransformer:()=>Qq,ZodSymbol:()=>zS,ZodString:()=>oK,ZodSet:()=>xN,ZodSchema:()=>Z9,ZodRecord:()=>FS,ZodReadonly:()=>qO,ZodPromise:()=>bN,ZodPipeline:()=>BS,ZodParsedType:()=>r0,ZodOptional:()=>eK,ZodObject:()=>v4,ZodNumber:()=>jB,ZodNullable:()=>qF,ZodNull:()=>tR,ZodNever:()=>sG,ZodNativeEnum:()=>XO,ZodNaN:()=>HS,ZodMap:()=>WS,ZodLiteral:()=>ZO,ZodLazy:()=>QO,ZodIssueCode:()=>b0,ZodIntersection:()=>JO,ZodFunction:()=>rR,ZodFirstPartyTypeKind:()=>L8,ZodError:()=>UZ,ZodEnum:()=>EB,ZodEffects:()=>Qq,ZodDiscriminatedUnion:()=>vd,ZodDefault:()=>YO,ZodDate:()=>kN,ZodCatch:()=>KO,ZodBranded:()=>kd,ZodBoolean:()=>sR,ZodBigInt:()=>$B,ZodArray:()=>tK,ZodAny:()=>_N,Schema:()=>Z9,ParseStatus:()=>QJ,OK:()=>SJ,NEVER:()=>fM6,INVALID:()=>H8,EMPTY_PATH:()=>vD6,DIRTY:()=>vN,BRAND:()=>eD6});var wZ1=B1(()=>{Td();NZ1();pl1();qS();Ji1();Pd()});var GF=B1(()=>{wZ1();wZ1()});function gM6(J){return Qi1.safeParse(J)}function IB(J){return hM6.safeParse(J)}function GO(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Z,X]of J.entries()){let Y=gM6(X);if(Y.success)Q.push(Y.data);else{let K=typeof X==="object"&&X!==null&&"tool"in X?String(X.tool):`entry at index ${Z}`;l.warn(`Permission entry for tool "${K}" is invalid: ${Y.error.errors.map((q)=>`${q.path.join(".")}: ${q.message}`).join(", ")}`)}}return Q}var RZ1,Qi1,hM6;var yN=B1(()=>{GF();z0();RZ1=Q1.lazy(()=>Q1.union([Q1.string().describe('Pattern match where "*" matches any number of any characters'),Q1.array(RZ1).min(1).describe("OR match of each entry"),Q1.boolean().describe("A literal boolean match"),Q1.number().describe("A literal number match"),Q1.null().describe("A literal null match"),Q1.undefined().describe("A literal undefined match"),Q1.record(Q1.string(),RZ1).describe("Matching individual keys of an object")])),Qi1=Q1.object({tool:Q1.string().min(1).describe("The name of the tool to which this entry applies"),matches:Q1.record(Q1.string(),RZ1).optional().describe("Maps tool inputs to conditions"),action:Q1.enum(["allow","reject","ask","delegate"]).describe("How Amp should proceed in case of a match"),context:Q1.enum(["thread","subagent"]).optional().describe("Only apply this entry in this context"),to:Q1.string().min(1).optional().describe('Command to delegate to when action is "delegate"')}).superRefine((J,Q)=>{if(J.action==="delegate"&&!J.to)Q.addIssue({code:Q1.ZodIssueCode.custom,message:'delegate action requires "to" field',path:["to"]});if(J.action!=="delegate"&&J.to)Q.addIssue({code:Q1.ZodIssueCode.custom,message:'"to" field only allowed with delegate action',path:["to"]})}),hM6=Q1.array(Qi1).describe("Entries checked in sequence to configure tool permissions")});function FZ(J,Q){let Z=mM6(J,Q);return typeof Z==="string"?Z:Z.toString()}function mM6(J,Q,Z=!0){if(!Q)Q=uM6();let{workspaceFolders:X,isWindows:Y,homeDir:K}=Q,q=typeof J==="string"?j0.parse(J):j0.from(J);if(X)for(let G of X){let z=W8(G);if(y0.hasPrefix(q,z)){let U=z.path.endsWith("/")?z.path.slice(0,-1):z.path,W=Z&&X&&X.length>=2?$N(z.path)+(Y?"\\":"/"):"";return OZ1(W+q.path.slice(U.length+1),Y,q.scheme)}}if(q?.scheme==="file"){if(K){let G=W8(K);if(y0.hasPrefix(q,G)){let z=G.path.endsWith("/")?G.path.slice(0,-1):G.path,U=q.path.slice(z.length+1);return OZ1("~"+(Y?"\\":"/")+U,Y,q.scheme)}}return OZ1(q.fsPath,Y,q.scheme)}return q}function OZ1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function xd(J){let Q=_d;return _d=J,Q}function uM6(){if(_d)return _d;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var _d=null;var PB=B1(()=>{_6();gR();JZ1()});function vJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function gN(J){return!!J&&!!J[VX]}function TB(J){if(!J)return!1;return qi1(J)||Array.isArray(J)||!!J[DS]||!!J.constructor?.[DS]||AS(J)||wS(J)}function qi1(J){if(!J||typeof J!=="object")return!1;let Q=hN(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)===pM6}function MS(J,Q){if(mN(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,X)=>Q(X,Z,J))}function mN(J){let Q=J[VX];return Q?Q.type_:Array.isArray(J)?1:AS(J)?2:wS(J)?3:0}function VS(J,Q){return mN(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function jZ1(J,Q){return mN(J)===2?J.get(Q):J[Q]}function Gi1(J,Q,Z){let X=mN(J);if(X===2)J.set(Q,Z);else if(X===3)J.add(Z);else J[Q]=Z}function dM6(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function AS(J){return J instanceof Map}function wS(J){return J instanceof Set}function fN(J){return J.copy_||J.base_}function IZ1(J,Q){if(AS(J))return new Map(J);if(wS(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=qi1(J);if(Q===!0||Q==="class_only"&&!Z){let X=Object.getOwnPropertyDescriptors(J);delete X[VX];let Y=Reflect.ownKeys(X);for(let K=0;K<Y.length;K++){let q=Y[K],G=X[q];if(G.writable===!1)G.writable=!0,G.configurable=!0;if(G.get||G.set)X[q]={configurable:!0,writable:!0,enumerable:G.enumerable,value:J[q]}}return Object.create(hN(J),X)}else{let X=hN(J);if(X!==null&&Z)return{...J};let Y=Object.create(X);return Object.assign(Y,J)}}function LQ(J,Q=!1){if(fd(J)||gN(J)||!TB(J))return J;if(mN(J)>1)J.set=J.add=J.clear=J.delete=cM6;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,X])=>LQ(X,!0));return J}function cM6(){vJ(2)}function fd(J){return Object.isFrozen(J)}function uN(J){let Q=PZ1[J];if(!Q)vJ(0,J);return Q}function lM6(J,Q){if(!PZ1[J])PZ1[J]=Q}function zi1(){return NS}function iM6(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zi1(J,Q){if(Q)uN("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function TZ1(J){CZ1(J),J.drafts_.forEach(nM6),J.drafts_=null}function CZ1(J){if(J===NS)NS=J.parent_}function Xi1(J){return NS=iM6(NS,J)}function nM6(J){let Q=J[VX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function Yi1(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[VX].modified_)TZ1(Q),vJ(4);if(TB(J)){if(J=bd(Q,J),!Q.parent_)yd(Q,J)}if(Q.patches_)uN("Patches").generateReplacementPatches_(Z[VX].base_,J,Q.patches_,Q.inversePatches_)}else J=bd(Q,Z,[]);if(TZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==kZ1?J:void 0}function bd(J,Q,Z){if(fd(Q))return Q;let X=Q[VX];if(!X)return MS(Q,(Y,K)=>Ki1(J,X,Q,Y,K,Z)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return yd(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let Y=X.copy_,K=Y,q=!1;if(X.type_===3)K=new Set(Y),Y.clear(),q=!0;if(MS(K,(G,z)=>Ki1(J,X,Y,G,z,Z,q)),yd(J,Y,!1),Z&&J.patches_)uN("Patches").generatePatches_(X,Z,J.patches_,J.inversePatches_)}return X.copy_}function Ki1(J,Q,Z,X,Y,K,q){if(gN(Y)){let G=K&&Q&&Q.type_!==3&&!VS(Q.assigned_,X)?K.concat(X):void 0,z=bd(J,Y,G);if(Gi1(Z,X,z),gN(z))J.canAutoFreeze_=!1;else return}else if(q)Z.add(Y);if(TB(Y)&&!fd(Y)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(bd(J,Y),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,X))yd(J,Y)}}function yd(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)LQ(Q,Z)}function aM6(J,Q){let Z=Array.isArray(J),X={type_:Z?1:0,scope_:Q?Q.scope_:zi1(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=X,K=_Z1;if(Z)Y=[X],K=LS;let{revoke:q,proxy:G}=Proxy.revocable(Y,K);return X.draft_=G,X.revoke_=q,G}function $Z1(J,Q){let Z=J[VX];return(Z?fN(Z):J)[Q]}function rM6(J,Q,Z){let X=Ui1(Q,Z);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function Ui1(J,Q){if(!(Q in J))return;let Z=hN(J);while(Z){let X=Object.getOwnPropertyDescriptor(Z,Q);if(X)return X;Z=hN(Z)}return}function SZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)SZ1(J.parent_)}}function EZ1(J){if(!J.copy_)J.copy_=IZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function vZ1(J,Q){let Z=AS(J)?uN("MapSet").proxyMap_(J,Q):wS(J)?uN("MapSet").proxySet_(J,Q):aM6(J,Q);return(Q?Q.scope_:zi1()).drafts_.push(Z),Z}function oM6(J){if(!gN(J))vJ(10,J);return Fi1(J)}function Fi1(J){if(!TB(J)||fd(J))return J;let Q=J[VX],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=IZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=IZ1(J,!0);if(MS(Z,(X,Y)=>{Gi1(Z,X,Fi1(Y))}),Q)Q.finalized_=!1;return Z}function hd(){let Q="replace",Z="add",X="remove";function Y(H,B,M,V){switch(H.type_){case 0:case 2:return q(H,B,M,V);case 1:return K(H,B,M,V);case 3:return G(H,B,M,V)}}function K(H,B,M,V){let{base_:N,assigned_:L}=H,A=H.copy_;if(A.length<N.length)[N,A]=[A,N],[M,V]=[V,M];for(let w=0;w<N.length;w++)if(L[w]&&A[w]!==N[w]){let R=B.concat([w]);M.push({op:Q,path:R,value:W(A[w])}),V.push({op:Q,path:R,value:W(N[w])})}for(let w=N.length;w<A.length;w++){let R=B.concat([w]);M.push({op:Z,path:R,value:W(A[w])})}for(let w=A.length-1;N.length<=w;--w){let R=B.concat([w]);V.push({op:X,path:R})}}function q(H,B,M,V){let{base_:N,copy_:L}=H;MS(H.assigned_,(A,w)=>{let R=jZ1(N,A),O=jZ1(L,A),j=!w?X:VS(N,A)?Q:Z;if(R===O&&j===Q)return;let $=B.concat(A);M.push(j===X?{op:j,path:$}:{op:j,path:$,value:O}),V.push(j===Z?{op:X,path:$}:j===X?{op:Z,path:$,value:W(R)}:{op:Q,path:$,value:W(R)})})}function G(H,B,M,V){let{base_:N,copy_:L}=H,A=0;N.forEach((w)=>{if(!L.has(w)){let R=B.concat([A]);M.push({op:X,path:R,value:w}),V.unshift({op:Z,path:R,value:w})}A++}),A=0,L.forEach((w)=>{if(!N.has(w)){let R=B.concat([A]);M.push({op:Z,path:R,value:w}),V.unshift({op:X,path:R,value:w})}A++})}function z(H,B,M,V){M.push({op:Q,path:[],value:B===kZ1?void 0:B}),V.push({op:Q,path:[],value:H})}function U(H,B){return B.forEach((M)=>{let{path:V,op:N}=M,L=H;for(let O=0;O<V.length-1;O++){let j=mN(L),$=V[O];if(typeof $!=="string"&&typeof $!=="number")$=""+$;if((j===0||j===1)&&($==="__proto__"||$==="constructor"))vJ(19);if(typeof L==="function"&&$==="prototype")vJ(19);if(L=jZ1(L,$),typeof L!=="object")vJ(18,V.join("/"))}let A=mN(L),w=F(M.value),R=V[V.length-1];switch(N){case Q:switch(A){case 2:return L.set(R,w);case 3:vJ(16);default:return L[R]=w}case Z:switch(A){case 1:return R==="-"?L.push(w):L.splice(R,0,w);case 2:return L.set(R,w);case 3:return L.add(w);default:return L[R]=w}case X:switch(A){case 1:return L.splice(R,1);case 2:return L.delete(R);case 3:return L.delete(M.value);default:return delete L[R]}default:vJ(17,N)}}),H}function F(H){if(!TB(H))return H;if(Array.isArray(H))return H.map(F);if(AS(H))return new Map(Array.from(H.entries()).map(([M,V])=>[M,F(V)]));if(wS(H))return new Set(Array.from(H).map(F));let B=Object.create(hN(H));for(let M in H)B[M]=F(H[M]);if(VS(H,DS))B[DS]=H[DS];return B}function W(H){if(gN(H))return F(H);else return H}lM6("Patches",{applyPatches_:U,generatePatches_:Y,generateReplacementPatches_:z})}function n8(J){return J}var kZ1,DS,VX,hN,pM6,PZ1,NS,_Z1,LS,sM6=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Z,X)=>{if(typeof Q==="function"&&typeof Z!=="function"){let K=Z;Z=Q;let q=this;return function(z=K,...U){return q.produce(z,(F)=>Z.call(this,F,...U))}}if(typeof Z!=="function")vJ(6);if(X!==void 0&&typeof X!=="function")vJ(7);let Y;if(TB(Q)){let K=Xi1(this),q=vZ1(Q,void 0),G=!0;try{Y=Z(q),G=!1}finally{if(G)TZ1(K);else CZ1(K)}return Zi1(K,X),Yi1(Y,K)}else if(!Q||typeof Q!=="object"){if(Y=Z(Q),Y===void 0)Y=Q;if(Y===kZ1)Y=void 0;if(this.autoFreeze_)LQ(Y,!0);if(X){let K=[],q=[];uN("Patches").generateReplacementPatches_(Q,Y,K,q),X(K,q)}return Y}else vJ(1,Q)},this.produceWithPatches=(Q,Z)=>{if(typeof Q==="function")return(q,...G)=>this.produceWithPatches(q,(z)=>Q(z,...G));let X,Y;return[this.produce(Q,Z,(q,G)=>{X=q,Y=G}),X,Y]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!TB(J))vJ(8);if(gN(J))J=oM6(J);let Q=Xi1(this),Z=vZ1(J,void 0);return Z[VX].isManual_=!0,CZ1(Q),Z}finishDraft(J,Q){let Z=J&&J[VX];if(!Z||!Z.isManual_)vJ(9);let{scope_:X}=Z;return Zi1(X,Q),Yi1(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Z;for(Z=Q.length-1;Z>=0;Z--){let Y=Q[Z];if(Y.path.length===0&&Y.op==="replace"){J=Y.value;break}}if(Z>-1)Q=Q.slice(Z+1);let X=uN("Patches").applyPatches_;if(gN(J))return X(J,Q);return this.produce(J,(Y)=>X(Y,Q))}},NX,gd,xZ1,_M9,xM9,Wi1,bM9,yM9;var AQ=B1(()=>{kZ1=Symbol.for("immer-nothing"),DS=Symbol.for("immer-draftable"),VX=Symbol.for("immer-state");hN=Object.getPrototypeOf;pM6=Object.prototype.constructor.toString();PZ1={};_Z1={get(J,Q){if(Q===VX)return J;let Z=fN(J);if(!VS(Z,Q))return rM6(J,Z,Q);let X=Z[Q];if(J.finalized_||!TB(X))return X;if(X===$Z1(J.base_,Q))return EZ1(J),J.copy_[Q]=vZ1(X,J);return X},has(J,Q){return Q in fN(J)},ownKeys(J){return Reflect.ownKeys(fN(J))},set(J,Q,Z){let X=Ui1(fN(J),Q);if(X?.set)return X.set.call(J.draft_,Z),!0;if(!J.modified_){let Y=$Z1(fN(J),Q),K=Y?.[VX];if(K&&K.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(dM6(Z,Y)&&(Z!==void 0||VS(J.base_,Q)))return!0;EZ1(J),SZ1(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($Z1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,EZ1(J),SZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=fN(J),X=Reflect.getOwnPropertyDescriptor(Z,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Z[Q]}},defineProperty(){vJ(11)},getPrototypeOf(J){return hN(J.base_)},setPrototypeOf(){vJ(12)}},LS={};MS(_Z1,(J,Q)=>{LS[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});LS.deleteProperty=function(J,Q){return LS.set.call(this,J,Q,void 0)};LS.set=function(J,Q,Z){return _Z1.set.call(this,J[0],Q,Z,J[0])};NX=new sM6,gd=NX.produce,xZ1=NX.produceWithPatches.bind(NX),_M9=NX.setAutoFreeze.bind(NX),xM9=NX.setUseStrictShallowCopy.bind(NX),Wi1=NX.applyPatches.bind(NX),bM9=NX.createDraft.bind(NX),yM9=NX.finishDraft.bind(NX)});function bZ1({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 RS(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(tM6,"")}var tM6;var yZ1=B1(()=>{tM6=bZ1()});var Bi1=a((pM9,Hi1)=>{Hi1.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 md;var Di1=B1(()=>{md={name:"amp",description:"An agentic coding tool, built by Sourcegraph.",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","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:web":"vscode-test-web --extensionDevelopmentPath=. --browserOption=--disable-web-security --verbose --open-devtools --verbose --printServerLog","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","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":"vite build",build:"pnpm run -s _build:extension && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review:production'","_build:extension":"vite build","_build:extension:production":"cross-env NODE_ENV=production vite build","_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:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","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":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && pnpm run -s _build:tab:review && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"vite build && pnpm run -s _build:web && pnpm run -s _build:debugger && pnpm run -s _build:tab:review && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force",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 at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.js",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.experimental.diffView || amp.isSourcegraphTeammate"}]},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.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.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{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"},{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.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{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.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.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{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.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !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"}],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"}}},required:["url"]}]}},"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.librarian":{type:"boolean",default:!1,description:"Enable the experimental librarian tool",scope:"application"},"amp.experimental.promptAutocompleteMode":{type:"string",enum:["disabled","word-based","tab"],enumDescriptions:["Disabled - no prompt autocomplete","Offline word completion from workspace and thread context","AI-powered suggestions via Amp Tab"],default:"disabled",markdownDescription:"**Experimental:** Prompt autocomplete suggestions while typing.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: chat_llm",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.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",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.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.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",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.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"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.reviewTool":{type:"boolean",default:!1,description:"Experimental: Enable the code review tool.",scope:"application"},"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"},"amp.gpt5":{type:"boolean",default:!1,description:"[DEPRECATED] GPT-5 is no longer available as the main model. It's now the oracle. See https://ampcode.com/news/gpt-5-oracle",scope:"window",deprecationMessage:"GPT-5 is no longer available as the main model. It's now the oracle. See https://ampcode.com/news/gpt-5-oracle"}}},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","amp.anthropic.baseURL"]},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:{"@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","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5",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"},devDependencies:{"@sourcegraph/amp-web":"workspace:*","@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/test-web":"*","@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","vite-plugin-static-copy":"^3.0.0"}}});function JV6(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function Mi1(J){let Q=J.settings["tools.inactivityTimeout"],Z=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Z!==void 0)X=Z;if(X===void 0)X=md.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!JV6(X))return null;return X*1000}function Vi1(J){let Q=J.settings["tools.stopTimeout"],Z=md.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var lM9;var fZ1=B1(()=>{Di1();lM9=md.contributes.configuration.properties});function ud(J,Q){return new e1((Z)=>{let X=setTimeout(Y,Q);function Y(){Z.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function K(){if(X)clearTimeout(X);X=setTimeout(Y,Q)}let q=J.subscribe({next:(G)=>{K(),Z.next(G)},error:(G)=>{if(X)clearTimeout(X),X=null;Z.error(G)},complete:()=>{if(X)clearTimeout(X),X=null;Z.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var hZ1=B1(()=>{T0()});function $7(J,Q){let Z={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let Y of X)if(Y.modelSelector.test(J))Z={...Z,name:Y.name??Z.name,description:Y.description??Z.description,inputSchema:Y.inputSchema??Z.inputSchema,customizedForModel:!0}}return Z}function kJ(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function Ai1(J){return["done","error","cancelled"].includes(J.status)}function zO(J){let Q=[],Z=new b8;function X(K,q){let G=Q.filter((z)=>z.spec.name===K);if(G.length===0&&K==="Glob")G=Q.filter((z)=>z.spec.name==="glob");for(let z of G)if(OS(z.spec,q).enabled)return z;return}function Y(K,q,G){if(!K)throw Error("spec is required");let z={spec:K,fn:Promise.resolve(q),preprocessArgs:G};return Q.push(z),Z.next(),{dispose:()=>{let U=Q.indexOf(z);if(U!==-1)Q.splice(U,1),Z.next()}}}return{registerTool({spec:K,fn:q,preprocessArgs:G}){if(!q)return QV6;return Y(K,q,G)},tools:S9(J.configService.config,Z.pipe(E2(void 0))).pipe(C0(([K])=>{return Q.map((q)=>({spec:q.spec,...OS(q.spec,K)})).sort((q,G)=>q.spec.name.localeCompare(G.spec.name))})),invokeTool(K,q,G){let z=performance.now(),U=()=>ZV6.record(performance.now()-z,{toolName:K});if(K===mZ1&&q.args&&"invalid_tool_name"in q.args&&typeof q.args.invalid_tool_name==="string"){dd.add(1,{toolName:K,error:"invalid"});let W=gZ1(q.args.invalid_tool_name);return new e1((H)=>{H.error(Error(W))})}let F=X(K,G.config);if(!F){let W=Q.filter((V)=>V.spec.name===K);if(W.length===0)return dd.add(1,{toolName:K,error:"not_found"}),new e1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} not found`))});let H=W[0],B=OS(H.spec,G.config);dd.add(1,{toolName:K,error:"disabled"});let M=B.enabled?"unknown":B.disabledReason;return new e1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} is disabled: ${M}`))})}return dd.add(1,{toolName:K}),d6(()=>F.fn).pipe(q8((W)=>{let H=W(q,G);if(F.spec.meta?.disableTimeout)return H;return ud(H,Vi1(G.config))}),nK(()=>U()))},preprocessArgs(K,q,G){let z=X(K,G.config);if(!z||!z.preprocessArgs)return;let U=z.preprocessArgs;try{return U(q,G)}catch(F){l.error("preprocessArgs",{id:K,args:q,error:String(F)});return}},dispose(){}}}function pd(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(Li1.default(Z,{dot:!0})(J))return!0}catch(X){continue}}return!1}function OS(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(pd(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=Ri1(J.name);if(X&&J.source.mcp===X.server&&pd(X.tool,Z))return{enabled:!1,disabledReason:"settings"}}if(J.source==="builtin"&&pd(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&pd(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===JJ||J.name===VB){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function gZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${jS.toString()}. Try again with a valid tool name.`}function Ri1(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function uZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function _J(J,Q,Z=!0){let X=new Set(Q.map((K)=>K.spec.name));function Y(K){if(X.has(K))return!0;if(K==="Glob"&&X.has("glob"))return!0;if(Z&&Ri1(K))return!0;return!1}return{registerTool(K){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(K,q,G){if(!Y(K))return new e1((z)=>{z.error(Error(`tool ${JSON.stringify(K)} not allowed in filtered service`))});return J.invokeTool(K,q,G)},preprocessArgs(K,q,G){if(!Y(K))return;return J.preprocessArgs?.(K,q,G)},tools:J.tools.pipe(C0((K)=>K.filter((q)=>Y(q.spec.name)))),dispose(){}}}var Ni1,Li1,QV6,mZ1="invalid_tool",jS,wi1,dd,ZV6;var u2=B1(()=>{T0();z0();fZ1();hZ1();N8();Ni1=m6(ep(),1),Li1=m6(CN(),1);QV6={dispose(){}};jS=/^[a-zA-Z0-9_]{1,64}$/,wi1=Ni1.metrics.getMeter("tool_service"),dd=wi1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),ZV6=wi1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var Pi1=a((Ei1)=>{Object.defineProperty(Ei1,"__esModule",{value:!0});Ei1.calcSlices=Ei1.applyPatch=Ei1.calcPatch=Ei1.lcs=Ei1.diff=Ei1.diff_core=void 0;function XV6(J,Q){let{b:Z,eq:X,stack_base:Y}=J,{i:K,N:q,j:G,M:z,Z:U,stack_top:F}=J;for(;;)switch(Q){case 0:{J:while(q>0&&z>0){Z.fill(0,0,2*U);let W=q-z,H=q+z,B=H&1,M=K+q-1,V=G+z-1,N=(H+B)/2,L;Q:for(let A=0;A<=N;A++){let w=2*Math.max(0,A-z)-A,R=A-2*Math.max(0,A-q);for(let O=w;O<=R;O+=2){let j=Z[O-1-U*Math.floor((O-1)/U)],$=Z[O+1-U*Math.floor((O+1)/U)],E=O===-A||O!==A&&j<$?$:j+1,I=E-O,T=E,S=I;while(T<q&&S<z&&X(K+T,G+S))T++,S++;if(Z[O-U*Math.floor(O/U)]=T,B===1&&(L=W-O)>=1-A&&L<A&&T+Z[U+L-U*Math.floor(L/U)]>=q)if(A>1||T!==E){Y[F++]=K+T,Y[F++]=q-T,Y[F++]=G+S,Y[F++]=z-S,q=E,z=I,U=2*(Math.min(q,z)+1);continue J}else break Q}for(let O=w;O<=R;O+=2){let j=Z[U+O-1-U*Math.floor((O-1)/U)],$=Z[U+O+1-U*Math.floor((O+1)/U)],E=O===-A||O!==A&&j<$?$:j+1,I=E-O,T=E,S=I;while(T<q&&S<z&&X(M-T,V-S))T++,S++;if(Z[U+O-U*Math.floor(O/U)]=T,B===0&&(L=W-O)>=-A&&L<=A&&T+Z[L-U*Math.floor(L/U)]>=q)if(A>0||T!==E){Y[F++]=K+q-E,Y[F++]=E,Y[F++]=G+z-I,Y[F++]=I,q=q-T,z=z-S,U=2*(Math.min(q,z)+1);continue J}else break Q}}if(q===z)continue;if(z>q)K+=q,G+=q,z-=q,q=0;else K+=z,G+=z,q-=z,z=0;break}if(q+z!==0)if(J.pxe===K||J.pye===G)J.pxe=K+q,J.pye=G+z;else{let W=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=K,J.pxe=K+q,J.pys=G,J.pye=G+z,W>=0)return J.i=K,J.N=q,J.j=G,J.M=z,J.Z=U,J.stack_top=F,1}}case 1:{if(F===0)return 2;z=Y[--F],G=Y[--F],q=Y[--F],K=Y[--F],U=2*(Math.min(q,z)+1),Q=0}}}class Oi1{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=XV6(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 ji1(J,Q,Z,X,Y){let K=(Math.min(Q,X)+1)*2,q=Q+X,G=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*K);return new Oi1({i:J,N:Q,j:Z,M:X,Z:K,b:G,eq:Y,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}Ei1.diff_core=ji1;function cd(J,Q,Z){let[X,Y,K]=[0,J.length,Q.length];if(typeof Z==="function"){while(X<Y&&X<K&&Z(X,X))X++;if(X===Y&&X===K)return[][Symbol.iterator]();while(Z(--Y,--K)&&Y>X&&K>X);}else{while(X<Y&&X<K&&J[X]===Q[X])X++;if(X===Y&&X===K)return[][Symbol.iterator]();while(J[--Y]===Q[--K]&&Y>X&&K>X);Z=(q,G)=>J[q]===Q[G]}return ji1(X,Y+1-X,X,K+1-X,Z)}Ei1.diff=cd;class $i1{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:G,j:z,N:U}=this;if(G<U)J.done=!1,J.value=[G,z,U-G],this.i=U;return J}let Q=J.value,Z=Q[0],X=Q[1],Y=Q[3],{i:K,j:q}=this;if(K!==Z)Q.length--,Q[0]=K,Q[1]=q,Q[2]=Z-K;return this.i=X,this.j=Y,J}}function YV6(J,Q,Z){return new $i1(cd(J,Q,Z),J.length)}Ei1.lcs=YV6;function*KV6(J,Q,Z){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let Y of cd(J,Q,Z))Y[2]=X.call(Q,Y[2],Y[3]),yield Y}Ei1.calcPatch=KV6;function*qV6(J,Q){let Z=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Y,K,q]of Q){if(Z<Y)yield X.call(J,Z,Y);if(q.length>0)yield q;Z=K}if(Z<J.length)yield X.call(J,Z)}Ei1.applyPatch=qV6;function*GV6(J,Q,Z){let X=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[K,q,G,z]of cd(J,Q,Z)){if(X<K)yield[0,Y.call(J,X,K)];if(K<q)yield[-1,Y.call(J,K,q)];if(G<z)yield[1,Y.call(Q,G,z)];X=q}if(X<J.length)yield[0,J.slice(X)]}Ei1.calcSlices=GV6});function ld(J,Q){if(J===void 0||Q===void 0||J===Q)return{added:0,deleted:0,changed:0};let Z={added:0,deleted:0,changed:0};for(let[X,Y,K,q]of Ti1.diff(J.split(`
|
|
4
4
|
`),Q.split(`
|
|
5
5
|
`)))Z.deleted+=Y-X,Z.added+=q-K,Z.changed+=Math.min(Y-X,q-K);return Z}function Ci1(J){return{added:J?.split(`
|
|
6
6
|
`).length??0,deleted:0,changed:0}}function pZ1(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((z)=>z.created).length,X=J.files.filter((z)=>z.reverted).length,Y=X===Q&&Q>0,K=0,q=0,G=0;for(let z of J.files){if(z.reverted)continue;K+=z.diffStat.added,q+=z.diffStat.removed,G+=z.diffStat.modified}return{totalFiles:Q,createdFiles:Z,totalAdded:K,totalRemoved:q,totalModified:G,revertedFiles:X,allReverted:Y}}var Ti1;var id=B1(()=>{Ti1=m6(Pi1(),1)});function Zq(){return`T-${crypto.randomUUID()}`}function zF(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 UO(){return`toolu_${crypto.randomUUID()}`}function Si1(J){return J.startsWith("toolu_")||J.startsWith("call_")}function vi1(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="info"){let X=Z.content[0];if(X?.type==="summary"&&X?.summary.type==="message")return}if(Z?.role==="assistant"&&Z.usage)return Z.usage}return J["~debug"]?.lastInferenceUsage}function LX(J,Q){for(let Z of J.messages){if(Z.role!=="assistant")continue;for(let X of Z.content)if(X.type==="tool_use"&&X.id===Q)return X}return}function FO(J,Q){for(let[Z,X]of J.messages.entries()){if(X.role!=="assistant")continue;for(let[Y,K]of X.content.entries())if(K.type==="tool_use"&&K.id===Q)return{message:X,messageIndex:Z,block:K,blockIndex:Y}}return null}function pN(J,Q){for(let Z of J.messages){if(Z.role!=="user")continue;for(let X of Z.content)if(X.type==="tool_result"&&X.toolUseID===Q)return X}return}function wQ(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 dZ1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&zF(Q))return Q}return}function cZ1(J){let Q=[],Z=new Map;for(let X of J)if(X.role==="assistant"){for(let Y of X.content)if(Y.type==="tool_use"&&Y.name===t5)Z.set(Y.id,Y)}else if(X.role==="user"){for(let Y of X.content)if(Y.type==="tool_result"){let K=Z.get(Y.toolUseID);if(K){let q=Y.run,G=(q.status==="in-progress"||q.status==="cancelled"||q.status==="done"||q.status==="error")&&q.progress?dZ1(q.progress):void 0;if(G)Q.push({toolUseID:Y.toolUseID,threadID:G,toolUse:K,toolResult:Y})}}}return Q}function ki1(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 _i1(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 lZ1(J){if(!J)return!1;return J.role==="info"}function BV6(J){return J.replace(/u([0-9A-Fa-f]{4})(\s)/gi,(Q,Z,X)=>{try{return String.fromCodePoint(parseInt(Z,16))+X}catch{return`u${Z}${X}`}})}function nd(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="info"){if(Z.content.some((Y)=>Y.type==="summary"&&Y.summary.type==="message"))break}if(Z?.role!=="assistant"||!Z.state||Z.state.type!=="complete"||Z.state.stopReason!=="tool_use")continue;for(let X of Z.content)if(X.type==="tool_use"&&X.name===JJ&&X.input){let Y=X.input.todos;if(Array.isArray(Y))return Y;let K=X.input.content;if(typeof K==="string")return BV6(K)}}return}function T5(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
|
|
@@ -6129,7 +6129,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||uR}function hZ6(J,Q){let
|
|
|
6129
6129
|
`;async function pZ6(J,Q,Z,X){let Y=performance.now(),K=[...d_(fM1(J)),{role:"user",parts:[{text:j59.replace("{USER_GOAL}",Q)}]}],q=await C$(Cr,K,[],J,Z,X,{responseMimeType:"application/json",responseJsonSchema:M0.toJSONSchema(uZ6)}),G=uZ6.parse(JSON.parse(q.message.text??"")),z=performance.now()-Y;return l.debug("Thread handoff prepared",{threadId:J.id,goalLength:Q.length,instructionsLength:G.instructions.length,fileCount:G.relevantFiles.length,durationMs:Math.round(z)}),{instructions:G.instructions,relevantFiles:G.relevantFiles}}UL();_6();function dZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}function cZ6(J,Q,Z){if(J.agentMode)return J.agentMode;if(Q?.agentMode){let X=Q.agentMode;if(X==="free"){if(Z?.canUseAmpFree??!1)return"free";return"smart"}return X}return"smart"}z0();iB();import $59 from"node:fs";import lZ6 from"node:path";function iZ6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!lZ6.isAbsolute(Q))return null;return l.debug("Extracted image path",{original:J,extracted:Q}),Q}function nZ6(J){try{let Q=lZ6.extname(J).toLowerCase(),Z=Ie1(Q);if(!Z)return l.warn("Unsupported image file extension",{ext:Q}),null;try{let X=$59.readFileSync(J);return E59(X,Z)}catch(X){l.error(`Failed to read image file ${J}:`,X)}}catch(Q){l.error("Error handling image file path",{imagePath:J,error:Q})}return null}function E59(J,Q){if(J.length>OF)return l.warn(`Image file too large: ${J.length} bytes (max: ${OF})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as LK6}from"node:child_process";import{rmdir as AY9}from"node:fs/promises";import{tmpdir as wY9}from"node:os";import AK6 from"node:path";aO();z0();import{spawn as I59}from"node:child_process";import{promises as P59}from"node:fs";function aZ6(J){return J.kind==="executable"}function rZ6(J){return J.kind==="markdown"}var pH=50000,sZ6=300000;async function Ly1(J,Q,Z,X={}){let{timeoutMs:Y=sZ6,signal:K}=X;try{let q=await Z.getCommand(J);if(!q)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(l.debug("Executing command",{commandName:J,filePath:q.filePath,args:Q}),rZ6(q))return await T59(q,Q);else if(aZ6(q))return await C59(q,Q,Y,K);else return{success:!1,output:"",error:"Unsupported command type"}}catch(q){return l.error("Failed to execute command",{commandName:J,error:q}),{success:!1,output:"",error:q instanceof Error?q.message:"Unknown error occurred"}}}async function T59(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await P59.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>pH?Z.slice(0,pH)+`
|
|
6130
6130
|
... (output truncated at ${pH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function C59(J,Q,Z=sZ6,X){return new Promise((Y)=>{let[K,q]=S59(J,Q);l.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=Oe1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),l.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),F=I59(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),W=[],H=[],B=0;F.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=pH)W.push(V);else{let N=pH-(B-V.length);if(N>0)W.push(V.slice(0,N))}}),F.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=pH)H.push(V);else{let N=pH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),F.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:W.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:W.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=W.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
|
|
6131
6131
|
${L}`:L;if(B>pH)A+=`
|
|
6132
|
-
... (output truncated at ${pH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function S59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return k59(Z,X?[...X]:null,Y,Q);else return v59(Z,X?[...X]:null,Y,Q)}function v59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function k59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();z2();PB();CY();bF();_6();T0();import{mkdtemp as RY9,readFile as OY9,unlink as jY9,writeFile as iw2}from"fs/promises";var X51={};R6(X51,{scrollUp:()=>t59,scrollDown:()=>e59,link:()=>KJ9,image:()=>qJ9,iTerm:()=>GJ9,exitAlternativeScreen:()=>XJ9,eraseUp:()=>o59,eraseStartLine:()=>r59,eraseScreen:()=>Ay1,eraseLines:()=>n59,eraseLine:()=>JX6,eraseEndLine:()=>a59,eraseDown:()=>s59,enterAlternativeScreen:()=>ZJ9,cursorUp:()=>tZ6,cursorTo:()=>b59,cursorShow:()=>i59,cursorSavePosition:()=>m59,cursorRestorePosition:()=>u59,cursorPrevLine:()=>c59,cursorNextLine:()=>d59,cursorMove:()=>y59,cursorLeft:()=>eZ6,cursorHide:()=>l59,cursorGetPosition:()=>p59,cursorForward:()=>h59,cursorDown:()=>f59,cursorBackward:()=>g59,clearTerminal:()=>QJ9,clearScreen:()=>JJ9,beep:()=>YJ9});import wy1 from"node:process";var Z51=globalThis.window?.document!==void 0,iL2=globalThis.process?.versions?.node!==void 0,nL2=globalThis.process?.versions?.bun!==void 0,aL2=globalThis.Deno?.version?.deno!==void 0,rL2=globalThis.process?.versions?.electron!==void 0,sL2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,oL2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,tL2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,eL2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,JA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Tu=globalThis.navigator?.userAgentData?.platform,QA2=Tu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",ZA2=Tu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",XA2=Tu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",YA2=Tu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),KA2=Tu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var V2="\x1B[",Su="\x1B]",FC="\x07",Cu=";",oZ6=!Z51&&wy1.env.TERM_PROGRAM==="Apple_Terminal",_59=!Z51&&wy1.platform==="win32",x59=Z51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:wy1.cwd,b59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return V2+(J+1)+"G";return V2+(Q+1)+Cu+(J+1)+"H"},y59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=V2+-J+"D";else if(J>0)Z+=V2+J+"C";if(Q<0)Z+=V2+-Q+"A";else if(Q>0)Z+=V2+Q+"B";return Z},tZ6=(J=1)=>V2+J+"A",f59=(J=1)=>V2+J+"B",h59=(J=1)=>V2+J+"C",g59=(J=1)=>V2+J+"D",eZ6=V2+"G",m59=oZ6?"\x1B7":V2+"s",u59=oZ6?"\x1B8":V2+"u",p59=V2+"6n",d59=V2+"E",c59=V2+"F",l59=V2+"?25l",i59=V2+"?25h",n59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=JX6+(Z<J-1?tZ6():"");if(J)Q+=eZ6;return Q},a59=V2+"K",r59=V2+"1K",JX6=V2+"2K",s59=V2+"J",o59=V2+"1J",Ay1=V2+"2J",t59=V2+"S",e59=V2+"T",JJ9="\x1Bc",QJ9=_59?`${Ay1}${V2}0f`:`${Ay1}${V2}3J${V2}H`,ZJ9=V2+"?1049h",XJ9=V2+"?1049l",YJ9=FC,KJ9=(J,Q)=>[Su,"8",Cu,Cu,Q,FC,J,Su,"8",Cu,Cu,FC].join(""),qJ9=(J,Q={})=>{let Z=`${Su}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+FC},GJ9={setCwd:(J=x59())=>`${Su}50;CurrentDir=${J}${FC}`,annotation(J,Q={}){let Z=`${Su}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+FC}};var Y51=m6(GX6(),1);function aV(J,Q,{target:Z="stdout",...X}={}){if(!Y51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return X51.link(J,Q)}aV.isSupported=Y51.default.stdout;aV.stderr=(J,Q,Z={})=>aV(J,Q,{target:"stderr",...Z});aV.stderr.isSupported=Y51.default.stderr;z0();CY();class Ey1{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.1760933153-gfb8d21"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await cn(Q,this.configService)}catch(Q){l.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}}import{execFile as q51}from"node:child_process";import{platform as Iy1}from"node:os";import{promisify as WJ9}from"node:util";var K51=WJ9(q51),HJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,BJ9="\x1B]52;c;?\x1B\\",DJ9="\x1B]52;p;?\x1B\\";class zX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await K51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=q51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=q51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=q51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(BJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await K51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await K51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await K51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(DJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Iy1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Iy1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=HJ9(Z);process.stdout.write(X);return}if(Iy1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var zY=new zX6;z0();class G51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class p7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function UX6(J){if(J instanceof G51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof p7)return{title:"Info",description:J.message,type:"info"};return l.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var QN=null,$Y9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(QN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (bb1(),SJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{QN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});QN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{QN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/clients/${Y}/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => m6(wf1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new p7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!QN)return new p7("Not connected to Amp web interface");try{QN.disconnect();let Z=QN.clientID;return QN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new p7(`Disconnected from Amp web interface
|
|
6132
|
+
... (output truncated at ${pH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function S59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return k59(Z,X?[...X]:null,Y,Q);else return v59(Z,X?[...X]:null,Y,Q)}function v59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function k59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();z2();PB();CY();bF();_6();T0();import{mkdtemp as RY9,readFile as OY9,unlink as jY9,writeFile as iw2}from"fs/promises";var X51={};R6(X51,{scrollUp:()=>t59,scrollDown:()=>e59,link:()=>KJ9,image:()=>qJ9,iTerm:()=>GJ9,exitAlternativeScreen:()=>XJ9,eraseUp:()=>o59,eraseStartLine:()=>r59,eraseScreen:()=>Ay1,eraseLines:()=>n59,eraseLine:()=>JX6,eraseEndLine:()=>a59,eraseDown:()=>s59,enterAlternativeScreen:()=>ZJ9,cursorUp:()=>tZ6,cursorTo:()=>b59,cursorShow:()=>i59,cursorSavePosition:()=>m59,cursorRestorePosition:()=>u59,cursorPrevLine:()=>c59,cursorNextLine:()=>d59,cursorMove:()=>y59,cursorLeft:()=>eZ6,cursorHide:()=>l59,cursorGetPosition:()=>p59,cursorForward:()=>h59,cursorDown:()=>f59,cursorBackward:()=>g59,clearTerminal:()=>QJ9,clearScreen:()=>JJ9,beep:()=>YJ9});import wy1 from"node:process";var Z51=globalThis.window?.document!==void 0,iL2=globalThis.process?.versions?.node!==void 0,nL2=globalThis.process?.versions?.bun!==void 0,aL2=globalThis.Deno?.version?.deno!==void 0,rL2=globalThis.process?.versions?.electron!==void 0,sL2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,oL2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,tL2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,eL2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,JA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Tu=globalThis.navigator?.userAgentData?.platform,QA2=Tu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",ZA2=Tu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",XA2=Tu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",YA2=Tu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),KA2=Tu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var V2="\x1B[",Su="\x1B]",FC="\x07",Cu=";",oZ6=!Z51&&wy1.env.TERM_PROGRAM==="Apple_Terminal",_59=!Z51&&wy1.platform==="win32",x59=Z51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:wy1.cwd,b59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return V2+(J+1)+"G";return V2+(Q+1)+Cu+(J+1)+"H"},y59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=V2+-J+"D";else if(J>0)Z+=V2+J+"C";if(Q<0)Z+=V2+-Q+"A";else if(Q>0)Z+=V2+Q+"B";return Z},tZ6=(J=1)=>V2+J+"A",f59=(J=1)=>V2+J+"B",h59=(J=1)=>V2+J+"C",g59=(J=1)=>V2+J+"D",eZ6=V2+"G",m59=oZ6?"\x1B7":V2+"s",u59=oZ6?"\x1B8":V2+"u",p59=V2+"6n",d59=V2+"E",c59=V2+"F",l59=V2+"?25l",i59=V2+"?25h",n59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=JX6+(Z<J-1?tZ6():"");if(J)Q+=eZ6;return Q},a59=V2+"K",r59=V2+"1K",JX6=V2+"2K",s59=V2+"J",o59=V2+"1J",Ay1=V2+"2J",t59=V2+"S",e59=V2+"T",JJ9="\x1Bc",QJ9=_59?`${Ay1}${V2}0f`:`${Ay1}${V2}3J${V2}H`,ZJ9=V2+"?1049h",XJ9=V2+"?1049l",YJ9=FC,KJ9=(J,Q)=>[Su,"8",Cu,Cu,Q,FC,J,Su,"8",Cu,Cu,FC].join(""),qJ9=(J,Q={})=>{let Z=`${Su}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+FC},GJ9={setCwd:(J=x59())=>`${Su}50;CurrentDir=${J}${FC}`,annotation(J,Q={}){let Z=`${Su}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+FC}};var Y51=m6(GX6(),1);function aV(J,Q,{target:Z="stdout",...X}={}){if(!Y51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return X51.link(J,Q)}aV.isSupported=Y51.default.stdout;aV.stderr=(J,Q,Z={})=>aV(J,Q,{target:"stderr",...Z});aV.stderr.isSupported=Y51.default.stderr;z0();CY();class Ey1{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.1760950038-g7a3f50"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await cn(Q,this.configService)}catch(Q){l.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}}import{execFile as q51}from"node:child_process";import{platform as Iy1}from"node:os";import{promisify as WJ9}from"node:util";var K51=WJ9(q51),HJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,BJ9="\x1B]52;c;?\x1B\\",DJ9="\x1B]52;p;?\x1B\\";class zX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await K51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=q51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=q51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=q51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(BJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await K51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await K51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await K51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(DJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Iy1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Iy1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=HJ9(Z);process.stdout.write(X);return}if(Iy1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var zY=new zX6;z0();class G51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class p7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function UX6(J){if(J instanceof G51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof p7)return{title:"Info",description:J.message,type:"info"};return l.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var QN=null,$Y9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(QN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (bb1(),SJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{QN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});QN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{QN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/clients/${Y}/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => m6(wf1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new p7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!QN)return new p7("Not connected to Amp web interface");try{QN.disconnect();let Z=QN.clientID;return QN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new p7(`Disconnected from Amp web interface
|
|
6133
6133
|
Client ID: ${Z}
|
|
6134
6134
|
Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class Rf1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=oC(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new Ey1(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(C0((Z)=>LB(Z.settings)),o6()).subscribe((Z)=>{this._initBaseCommands(Z.length>1)})}_initBaseCommands(J){if(this.commands={...EY9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,$Y9);if(J)Object.assign(this.commands,IY9)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((G)=>{l.debug("Failed to submit command telemetry",G)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((G)=>G.name===J),q=await Ly1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.submitMessage(q.output);return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var EY9={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${Z5} file in the current workspace`,execute:async(J,Q)=>{let Z=await J.configService.getLatest(),X=xq(Z.settings),K=J.getInMemoryAgentModeOverride()??X;J.worker.handle({type:"user:message",message:{content:[{type:"text",text:X90}],agentMode:K}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new G51;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread(new AbortController().signal)}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}},isVisible:(J)=>J.agentMode!=="free"},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await RY9(AK6.join(wY9(),"amp-edit-")),Y=AK6.join(X,"message.amp.md");LK6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await OY9(Y,"utf-8")).trim();if(q)J.editorDispatch({type:"set-input",input:q})}catch(K){if(K?.code==="ENOENT")return;return l.error("Failed to read temporary file",K),Error("Failed to read editor content")}try{await jY9(Y),await AY9(X)}catch(K){l.warn("Failed to clean up temporary file",K)}return}catch(Z){return l.error("Failed to open editor",Z),Error("Failed to open editor")}}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return aG("dangerouslyAllowAll",!1),new p7("Amp is now following permissions rules for this session")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return aG("dangerouslyAllowAll",!0),new p7("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await zC();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw l.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:zC};await e71(Y);return}catch(Y){l.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return l.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},handoff:{name:"handoff",description:"Start new focused thread with relevant files and prompt: /handoff <your goal>",statusMessage:"Handing off...",requiresArgs:!0,execute:async()=>{return},isVisible:(J)=>J.messages.length!==0&&J.agentMode!=="free"},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new p7(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return l.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join("").trim()}).filter(Boolean).join(`
|
|
6135
6135
|
`).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=Cj(new URL(Y),Z.id).toString(),G=`Thread URL: ${aV(K,K,{fallback:()=>K})}`,z=Q[0]?.trim().toLowerCase(),U;switch(z){case"private":U={visibility:"private",sharedGroupIDs:[]};break;case"workspace":U={visibility:"thread_workspace_shared"};break;case"group":U={visibility:"private",sharedGroupIDs:[],shareWithAllCreatorGroups:!0};break;case"public":U={visibility:"public"};break;default:return Error(`Invalid visibility option: ${z}. Use: private, workspace, group, or public`)}try{return await X.updateThreadMeta(Z.id,U),new p7(`${G}
|
|
@@ -6330,11 +6330,11 @@ ${G}
|
|
|
6330
6330
|
|
|
6331
6331
|
(Note: AI handoff preparation failed, starting with your goal only)`}};switchToExistingThread=async(J)=>{try{l.info(`[switchToExistingThread] Switching to thread: ${J}`);let Q=await this.widget.dependencies.switchToThread(J),Z=Q.thread.agentMode??null;l.info(`[switchToExistingThread] Thread ${J} has agentMode: ${Z??"null"}`),this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,QR(Q),S71()?.switchWorker(this.widget.dependencies.worker),this.setState(()=>{l.info(`[switchToExistingThread] Setting inMemoryAgentModeOverride to: ${Z??"null"}`),this.inMemoryAgentModeOverride=Z})}catch(Q){throw l.error("Failed to switch to thread:",J,Q),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=CG()||this.widget.dependencies.worker,Z=Q.thread.messages.length===0,X=this.inMemoryAgentModeOverride??this.currentAgentMode;if(Q.thread.agentMode&&!Z&&X!==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 Y=[{type:"text",text:J}];if(this.imageAttachments.length>0)Y.push(...this.imageAttachments);await Q.handle({type:"user:message",message:{content:Y,agentMode:this.inMemoryAgentModeOverride??this.currentAgentMode}}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})};onTrainingModeDialogResponse=async(J)=>{if(this.setState(()=>{this.isShowingTrainingModeDialog=!1}),J&&this.pendingTrainingMode)try{let Q=await this.widget.dependencies.internalAPIClient.updateUserTrainingMode({enabled:!0},{config:this.widget.dependencies.configService});if(!Q.ok){let Z=Q.error.message||"Failed to enable training mode";await this.showErrorMessage(Z),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else await this.proceedWithUserMessage(this.pendingTrainingMode)}catch(Q){await this.showErrorMessage(`Failed to enable training mode:
|
|
6332
6332
|
|
|
6333
|
-
${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else if(!J&&this.pendingTrainingMode)this.textController.clear(),this.textController.insertText(this.pendingTrainingMode);this.setState(()=>{this.pendingTrainingMode=null})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;let J=this.inMemoryAgentModeOverride??this.currentAgentMode;Hy1({agentMode:J}).catch((Q)=>{l.warn("Failed to save session state on exit:",Q)}).finally(()=>{$5.instance.stop()})}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=HW9();if(J===Q)return"~";if(J.startsWith(Q+xp.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(xp.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(xp.sep),"…",Q.slice(-2).join(xp.sep)].join(xp.sep)}build(J){let Q=T8.of(J),Z=Z8.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let G=(CG()||this.widget.dependencies.worker).thread.agentMode==="free"&&this.randomAd!==null,{threadState:z}=this.widget.dependencies;if(this.isShowingThreadPicker)return new sH({child:new Ju1({onSelect:async(K1)=>{if(K1)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(K1);else process.exit(0)},pageSize:50,threadFetcher:new pJ1(this.widget.dependencies.configService)})});this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),F=z.todosList,W=z.mainThread?.id,H=z.mainThread||void 0,M=this.isTranscriptEmpty()?new EJ1({agentMode:this.inMemoryAgentModeOverride??this.currentAgentMode}):new jm1({key:W?new O5(`message-view-${W}`):void 0,items:z.items,subagentToolsByParentID:z.subagentToolsByParentID,controller:W?this.getMessageScrollController(W):new YN,autofocus:!1,onCopy:this._handleTextCopy.bind(this),thread:H,onMessageEditSubmit:this.handleMessageEditSubmit,onMessageRestoreSubmit:this.handleMessageRestoreSubmit,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{this.autocompleteFocusNode.requestFocus()}}),V=Math.max(Math.floor(Q.size.height*0.4),12),N=this.getCurrentEphemeralError(),L=this.buildBottomWidget(N,U,Y,Z,z,F,V,G?this.randomAd:null),A=Q.size.width<40,w=z.mainThread?vi1(z.mainThread):void 0,R=new n51({threadViewState:z.viewState,threadTokenUsage:w,threadID:W??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:A,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}),O=new i51({bashInvocations:this.bashInvocations}),j=[],$=this.inMemoryAgentModeOverride??this.currentAgentMode,E=this.currentShellModeStatus,I=Fu1($),T=!E?$.length+1:0,S=Q.capabilities.animationSupport,x=S==="disabled"?0:S==="slow"?30:60,h=$==="fast"?3:1,v=x>0&&this.agentModePulseSeq>0?new cK({children:[L,new _G({top:0,left:1,right:1,height:1,child:new sm1({color:I,trigger:this.agentModePulseSeq,fps:x,speed:h,leftOffset:T})})]}):L;if(j.push(new I9({child:M}),O),G)j.push(new Em1({ad:this.randomAd,onButtonClick:async()=>{let K1=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (cJ1(),dJ1)).then(({recordAdEvent:z1})=>{z1("clicked",{adId:K1.id,advertiserId:K1.advertiserId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to"})});try{await mK(K1.shortDestinationUrl)}catch(z1){let D1=$5.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:D1,url:K1.shortDestinationUrl}})}}}));j.push(new N6({constraints:new I6(0,Q.size.width,0,V),child:v}),new A0({height:1,child:new s6({padding:p0.horizontal(1),child:R})}));let _=new K6({crossAxisAlignment:"stretch",mainAxisSize:"max",children:j}),b=new L2(()=>{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.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.isShowingQRCodeOverlay)return this.setState(()=>{this.isShowingQRCodeOverlay=!1,this.qrCodeOverlayData=null}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"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.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return l.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.markLastUserMessageAsInterrupted().catch((z1)=>{l.error("Failed to mark message as interrupted:",z1)}),this.cancelStreamingMessage().catch((z1)=>{l.error("Failed to cancel streaming message:",z1)}),"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"}),g=new L2(()=>{return this.onExitPressed(),"handled"}),k=new L2(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),y=new L2(()=>{return fG.instance.toggleAll(),"handled"}),f=new L2(()=>{return this.widget.dependencies.configService.getLatest().then((K1)=>{aG("internal.showCost",!(K1.settings["internal.showCost"]??!0))}),"handled"}),m=new L2(()=>{return $5.instance.toggleFrameStatsOverlay(),"handled"}),n=new L2(()=>{return $5.instance.tuiInstance.getScreen().markForRefresh(),d7.instance.requestFrame(),"handled"}),u=new L2(()=>{return this.toggleAgentMode(),"handled"}),e=new L2(()=>{let K1=this.findElementByKey("message-view-selection-area");if(K1?.state){let z1=K1.state,A1=z1.controller?.copySelection();if(A1&&A1.length>0)return this.setState(()=>{this.showingSelectionCopiedHint=!0}),setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1})},2000),setTimeout(()=>{z1.controller.endCopyHighlight(),z1.controller.clear()},350),"handled"}return this.onExitPressed(),"handled"}),G1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1){let A1=this.getMessageScrollController(z1),D1=Math.max(Math.floor(Q.size.height*0.4),10),p1=Q.size.height-D1;A1.animatePageUp(p1,100)}return"handled"}),F1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1){let A1=this.getMessageScrollController(z1),D1=Math.max(Math.floor(Q.size.height*0.4),10),p1=Q.size.height-D1;A1.animatePageDown(p1,100)}return"handled"}),Z1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1)this.getMessageScrollController(z1).animateTo(0,100);return"handled"}),W1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1)this.getMessageScrollController(z1).animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),d=new L2(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return this.messageViewFocusNode.requestFocus(),"handled"}),p=new L2((K1)=>{if(K1.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),i=new Map([[u8.ctrl("c"),new OC],[u8.ctrl("l"),new Gp],[u8.alt("s"),new jC],[u8.ctrl("s"),new jC],[u8.alt("p"),new qp],[u8.ctrl("r"),new Yp],[u8.alt("d"),new Kp],[u8.key("PageUp"),new P51],[u8.key("PageDown"),new T51],[u8.key("Home"),new C51],[u8.key("End"),new S51],[u8.key("Escape"),new Zp],[u8.ctrl("p"),new $C("previous")],[u8.ctrl("n"),new $C("next")],[u8.key("Tab"),new v51]]);if(!1)i.set(u8.alt("c"),new Xp);if(process.platform==="darwin")i.set(u8.meta("c"),new OC);let o=new Map([[Zp,b],[E51,g],[Gp,n],[jC,u],[Xp,k],[Yp,y],[Kp,f],[qp,m],[OC,e],[P51,G1],[T51,F1],[C51,Z1],[S51,W1],[v51,d],[$C,p]]),X1=[_];if(this.isShowingConsoleOverlay)X1.push(new vm1);if(this.isShowingHelp)X1.push(new bm1);if(this.isShowingEnableTrainingModal)X1.push(new _m1({onEnableTraining:this.onEnableTraining,onLearnMore:this.onEnableTrainingLearnMore,onDismiss:this.onEnableTrainingDismiss}));if(this.adActionModal)X1.push(new Im1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(K1)=>{let z1=this.adActionModal.url;if(K1==="copy")try{await $5.instance.tuiInstance.clipboard.writeText(z1),this.setState(()=>{this.displayMessage=new p7("Link copied to clipboard")})}catch(A1){l.error("Failed to copy to clipboard",{error:A1}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.isShowingFileChangesOverlay)X1.push(new xh1);if(this.isShowingCostBreakdownOverlay&&z.mainThread)X1.push(new km1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)X1.push(new Cm1({details:this.confirmationOverlayContent}));if(this.isShowingQRCodeOverlay&&this.qrCodeOverlayData)X1.push(new tm1({url:this.qrCodeOverlayData.url,qrCode:this.qrCodeOverlayData.qrCode}));let J1=new cK({children:X1});if(this.isShowingIdePicker)return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"ide-picker-shortcuts",child:new ym1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode})})})});if(this.isShowingJetBrainsInstaller)return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"jetbrains-installer-shortcuts",child:new rm1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let H1=new KN({onError:(K1)=>{this.showErrorMessage(K1.message)},child:J1});return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"main-app-shortcuts",child:H1})})})}buildBottomWidget(J,Q,Z,X,Y,K,q,G){if(J)return new xm1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(this.isShowingTrainingModeDialog)return new Qu1({onResponse:this.onTrainingModeDialogResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Sm1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new om1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let z=X.app,U=BW9(X),F=new y51({key:this.textFieldKey,controller:this.textController,triggers:[Yu1()],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(S)=>Pm1(S),overlayBorderColor:Z.border,focusNode:this.autocompleteFocusNode,textFieldProps:{placeholder:"Type your message... (use / for commands, @ for files)",wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!1,enabled:this.isTextfieldAndAutocompleteFocused,onSubmitted:this.onTextSubmitted,onOpenInEditor:this.onOpenInEditor,submitKey:{character:"Enter"},prompts:U,style:{border:null},clipboard:$5.instance.tuiInstance.clipboard},optionViewBuilder:(S,x,h)=>{let v=h?Z.selection:void 0,_=x.type==="command"?Z.warning:Z.secondary,b=Z.foreground,g=Z.foreground,k,y;switch(x.type){case"command":k="/",y=x.name;break;case"file":k="@",y=x.path;break;case"thread":k="",y=x.title;break;default:k="",y=Pm1(x);break}let f=jU6(x),m=new O1(k,new v1({color:_})),n=new O1(y,new v1({color:b})),u=[m,n];if(f){let e=new O1(" - ",new v1({color:g,dim:!0})),G1=new O1(f,new v1({color:g,dim:!0}));u.push(e,G1)}return new N6({decoration:new E9(v),child:new t1({text:new O1("",void 0,u),maxLines:1,overflow:"ellipsis"})})}}),W=Y.mainThread?.queuedMessages??[],H=this.currentShellModeStatus,B=this.imageAttachments.length>0?new N6({padding:p0.only({bottom:1,left:1}),child:new t1({text:new O1("",void 0,[new O1("Images: ",new v1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((S,x)=>[new O1(`[image ${x+1}]`,new v1({color:Z.success})),...x<this.imageAttachments.length-1?[new O1(" ")]:[]])])})}):null,M=Array.isArray(K)&&K.length>0,V=Array.isArray(W)&&W.length>0,N=[];if(B)N.push(B);N.push(new I9({child:F}));let L=new K6({crossAxisAlignment:"start",children:N}),A=V?new em1({queuedMessages:W}):void 0,w=M?new cf1(new $m1({todos:K,enabled:this.isTextfieldAndAutocompleteFocused}),{clipBehavior:"antiAlias"}):void 0,R=[],O=Y.viewState;if(!this.isSummarizing(O))R.push({text:new O1("",void 0,[new O1("Enter",new v1({color:z.keybind})),new O1(" to send",new v1({color:Z.foreground,dim:!0}))]),position:"bottom-left"});if(H)R.push({text:new O1(H==="hidden"?"shell mode (incognito)":"shell mode",new v1({color:H==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:B?1:0});let j=this.inMemoryAgentModeOverride??this.currentAgentMode;if(!H&&this.cachedVisibleModes.length>1){let S=Fu1(j),h=Ed(j,this.cachedVisibleModes)!==j,_=(CG()||this.widget.dependencies.worker).thread.messages.length===0,b=this.hasToggledAgentMode||!h||!_?new O1(j,new v1({color:S})):new O1("",void 0,[new O1(j,new v1({color:S})),new O1(" (click or ",new v1({color:Z.foreground,dim:!0})),new O1("Ctrl+S",new v1({color:z.keybind})),new O1(" to switch)",new v1({color:Z.foreground,dim:!0}))]);R.push({text:b,position:"top-left",offsetY:0,onClick:_?this.toggleAgentMode:void 0})}let $=Y.mainThread?.metadata?.treeInfo?.uri,E;if($)E=j0.isUri($)?$.fsPath:$;else E=process.cwd();let I=this.toHomeRelative(E),T=this.shorten(I);return R.push({text:new O1(T,new v1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new $h1({leftChild:L,rightChild1:A,rightChild2:w,maxHeight:q,overlayTexts:R,borderColor:this.isTextfieldAndAutocompleteFocused?void 0:k1.index(8),hasBanner:G!==null})}}async function CF6(J){let X=new dH(!1,1000,J.inspectorPort),Y=new vb1({threadService:J.threadService,worker:J.worker,builder:(H,B)=>{let M=CG(),V=M?.thread.id||J.threadID,N={...J,worker:M||J.worker,threadID:V};return new PF6({...N,threadState:B})}}),K=new Sh1({configService:J.configService,child:Y}),q=new Ph1({configService:J.configService,child:K}),G=new Y8({data:rH.default(),child:q}),z=new Z8({data:TC.fromBaseTheme(rH.default()),child:G});try{await pf1(z,{onRootElementMounted:void 0})}finally{}let F=CG()?.thread.id||J.threadID;if((await J.threadService.get(F))?.messages.length!==0){let H=`${J.ampURL.replace(/\/$/,"")}/threads/${F}`;J.stdout.write(`
|
|
6333
|
+
${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTrainingMode)}else if(!J&&this.pendingTrainingMode)this.textController.clear(),this.textController.insertText(this.pendingTrainingMode);this.setState(()=>{this.pendingTrainingMode=null})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;let J=this.inMemoryAgentModeOverride??this.currentAgentMode;Hy1({agentMode:J}).catch((Q)=>{l.warn("Failed to save session state on exit:",Q)}).finally(()=>{$5.instance.stop()})}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=HW9();if(J===Q)return"~";if(J.startsWith(Q+xp.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(xp.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(xp.sep),"…",Q.slice(-2).join(xp.sep)].join(xp.sep)}build(J){let Q=T8.of(J),Z=Z8.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let G=(CG()||this.widget.dependencies.worker).thread.agentMode==="free"&&this.randomAd!==null,{threadState:z}=this.widget.dependencies;if(this.isShowingThreadPicker)return new sH({child:new Ju1({onSelect:async(K1)=>{if(K1)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(K1);else process.exit(0)},pageSize:50,threadFetcher:new pJ1(this.widget.dependencies.configService)})});this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),F=z.todosList,W=z.mainThread?.id,H=z.mainThread||void 0,M=this.isTranscriptEmpty()?new EJ1({agentMode:this.inMemoryAgentModeOverride??this.currentAgentMode}):new jm1({key:W?new O5(`message-view-${W}`):void 0,items:z.items,subagentToolsByParentID:z.subagentToolsByParentID,controller:W?this.getMessageScrollController(W):new YN,autofocus:!1,onCopy:this._handleTextCopy.bind(this),thread:H,onMessageEditSubmit:this.handleMessageEditSubmit,onMessageRestoreSubmit:this.handleMessageRestoreSubmit,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{this.autocompleteFocusNode.requestFocus()}}),V=Math.max(Math.floor(Q.size.height*0.4),12),N=this.getCurrentEphemeralError(),L=this.buildBottomWidget(N,U,Y,Z,z,F,V,G?this.randomAd:null),A=Q.size.width<40,w=z.mainThread?vi1(z.mainThread):void 0,R=new n51({threadViewState:z.viewState,threadTokenUsage:w,threadID:W??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:A,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}),O=new i51({bashInvocations:this.bashInvocations}),j=[],$=this.inMemoryAgentModeOverride??this.currentAgentMode,E=this.currentShellModeStatus,I=Fu1($),T=!E?$.length+1:0,S=Q.capabilities.animationSupport,x=S==="disabled"?0:S==="slow"?30:60,h=$==="fast"?3:1,v=x>0&&this.agentModePulseSeq>0?new cK({children:[L,new _G({top:0,left:1,right:1,height:1,child:new sm1({color:I,trigger:this.agentModePulseSeq,fps:x,speed:h,leftOffset:T})})]}):L;if(j.push(new I9({child:M}),O),G)j.push(new Em1({ad:this.randomAd,onButtonClick:async()=>{let K1=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (cJ1(),dJ1)).then(({recordAdEvent:z1})=>{z1("clicked",{adId:K1.id,advertiserId:K1.advertiserId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to"})});try{await mK(K1.shortDestinationUrl)}catch(z1){let D1=$5.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:D1,url:K1.shortDestinationUrl}})}}}));j.push(new N6({constraints:new I6(0,Q.size.width,0,V),child:v}),new A0({height:1,child:new s6({padding:p0.horizontal(1),child:R})}));let _=new K6({crossAxisAlignment:"stretch",mainAxisSize:"max",children:j}),b=new L2(()=>{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.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.isShowingQRCodeOverlay)return this.setState(()=>{this.isShowingQRCodeOverlay=!1,this.qrCodeOverlayData=null}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"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.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return l.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.markLastUserMessageAsInterrupted().catch((z1)=>{l.error("Failed to mark message as interrupted:",z1)}),this.cancelStreamingMessage().catch((z1)=>{l.error("Failed to cancel streaming message:",z1)}),"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"}),g=new L2(()=>{return this.onExitPressed(),"handled"}),k=new L2(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),y=new L2(()=>{return fG.instance.toggleAll(),"handled"}),f=new L2(()=>{return this.widget.dependencies.configService.getLatest().then((K1)=>{aG("internal.showCost",!(K1.settings["internal.showCost"]??!0))}),"handled"}),m=new L2(()=>{return $5.instance.toggleFrameStatsOverlay(),"handled"}),n=new L2(()=>{return $5.instance.tuiInstance.getScreen().markForRefresh(),d7.instance.requestFrame(),"handled"}),u=new L2(()=>{return this.toggleAgentMode(),"handled"}),e=new L2(()=>{let K1=this.findElementByKey("message-view-selection-area");if(K1?.state){let z1=K1.state,A1=z1.controller?.copySelection();if(A1&&A1.length>0)return this.setState(()=>{this.showingSelectionCopiedHint=!0}),setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1})},2000),setTimeout(()=>{z1.controller.endCopyHighlight(),z1.controller.clear()},350),"handled"}return this.onExitPressed(),"handled"}),G1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1){let A1=this.getMessageScrollController(z1),D1=Math.max(Math.floor(Q.size.height*0.4),10),p1=Q.size.height-D1;A1.animatePageUp(p1,100)}return"handled"}),F1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1){let A1=this.getMessageScrollController(z1),D1=Math.max(Math.floor(Q.size.height*0.4),10),p1=Q.size.height-D1;A1.animatePageDown(p1,100)}return"handled"}),Z1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1)this.getMessageScrollController(z1).animateTo(0,100);return"handled"}),W1=new L2(()=>{let{threadState:K1}=this.widget.dependencies,z1=K1.mainThread?.id;if(z1)this.getMessageScrollController(z1).animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),d=new L2(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return this.messageViewFocusNode.requestFocus(),"handled"}),p=new L2((K1)=>{if(K1.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),i=new Map([[u8.ctrl("c"),new OC],[u8.ctrl("l"),new Gp],[u8.alt("s"),new jC],[u8.ctrl("s"),new jC],[u8.alt("p"),new qp],[u8.ctrl("r"),new Yp],[u8.alt("d"),new Kp],[u8.key("PageUp"),new P51],[u8.key("PageDown"),new T51],[u8.key("Home"),new C51],[u8.key("End"),new S51],[u8.key("Escape"),new Zp],[u8.ctrl("p"),new $C("previous")],[u8.ctrl("n"),new $C("next")],[u8.key("Tab"),new v51]]);if(!1)i.set(u8.alt("c"),new Xp);if(process.platform==="darwin")i.set(u8.meta("c"),new OC);let o=new Map([[Zp,b],[E51,g],[Gp,n],[jC,u],[Xp,k],[Yp,y],[Kp,f],[qp,m],[OC,e],[P51,G1],[T51,F1],[C51,Z1],[S51,W1],[v51,d],[$C,p]]),X1=[_];if(this.isShowingConsoleOverlay)X1.push(new vm1);if(this.isShowingHelp)X1.push(new bm1);if(this.isShowingEnableTrainingModal)X1.push(new _m1({onEnableTraining:this.onEnableTraining,onLearnMore:this.onEnableTrainingLearnMore,onDismiss:this.onEnableTrainingDismiss}));if(this.adActionModal)X1.push(new Im1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(K1)=>{let z1=this.adActionModal.url;if(K1==="copy")try{await $5.instance.tuiInstance.clipboard.writeText(z1),this.setState(()=>{this.displayMessage=new p7("Link copied to clipboard")})}catch(A1){l.error("Failed to copy to clipboard",{error:A1}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.isShowingFileChangesOverlay)X1.push(new xh1);if(this.isShowingCostBreakdownOverlay&&z.mainThread)X1.push(new km1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)X1.push(new Cm1({details:this.confirmationOverlayContent}));if(this.isShowingQRCodeOverlay&&this.qrCodeOverlayData)X1.push(new tm1({url:this.qrCodeOverlayData.url,qrCode:this.qrCodeOverlayData.qrCode}));let J1=new cK({children:X1});if(this.isShowingIdePicker)return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"ide-picker-shortcuts",child:new ym1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode})})})});if(this.isShowingJetBrainsInstaller)return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"jetbrains-installer-shortcuts",child:new rm1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let H1=new KN({onError:(K1)=>{this.showErrorMessage(K1.message)},child:J1});return new sH({child:new UX({actions:o,child:new nU({shortcuts:i,debugLabel:"main-app-shortcuts",child:H1})})})}buildBottomWidget(J,Q,Z,X,Y,K,q,G){if(J)return new xm1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(this.isShowingTrainingModeDialog)return new Qu1({onResponse:this.onTrainingModeDialogResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Sm1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new om1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let z=X.app,U=BW9(X),F=new y51({key:this.textFieldKey,controller:this.textController,triggers:[Yu1()],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(S)=>Pm1(S),overlayBorderColor:Z.border,focusNode:this.autocompleteFocusNode,textFieldProps:{placeholder:"Type your message... (use / for commands, @ for files)",wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!1,enabled:this.isTextfieldAndAutocompleteFocused,onSubmitted:this.onTextSubmitted,onOpenInEditor:this.onOpenInEditor,submitKey:{character:"Enter"},prompts:U,style:{border:null},clipboard:$5.instance.tuiInstance.clipboard},optionViewBuilder:(S,x,h)=>{let v=h?Z.selection:void 0,_=x.type==="command"?Z.warning:Z.secondary,b=Z.foreground,g=Z.foreground,k,y;switch(x.type){case"command":k="/",y=x.name;break;case"file":k="@",y=x.path;break;case"thread":k="",y=x.title;break;default:k="",y=Pm1(x);break}let f=jU6(x),m=new O1(k,new v1({color:_})),n=new O1(y,new v1({color:b})),u=[m,n];if(f){let e=new O1(" - ",new v1({color:g,dim:!0})),G1=new O1(f,new v1({color:g,dim:!0}));u.push(e,G1)}return new N6({decoration:new E9(v),child:new t1({text:new O1("",void 0,u),maxLines:1,overflow:"ellipsis"})})}}),W=Y.mainThread?.queuedMessages??[],H=this.currentShellModeStatus,B=this.imageAttachments.length>0?new N6({padding:p0.only({bottom:1,left:1}),child:new t1({text:new O1("",void 0,[new O1("Images: ",new v1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((S,x)=>[new O1(`[image ${x+1}]`,new v1({color:Z.success})),...x<this.imageAttachments.length-1?[new O1(" ")]:[]])])})}):null,M=Array.isArray(K)&&K.length>0,V=Array.isArray(W)&&W.length>0,N=[];if(B)N.push(B);N.push(new I9({child:F}));let L=new K6({crossAxisAlignment:"start",children:N}),A=V?new em1({queuedMessages:W}):void 0,w=M?new cf1(new $m1({todos:K,enabled:this.isTextfieldAndAutocompleteFocused}),{clipBehavior:"antiAlias"}):void 0,R=[],O=Y.viewState;if(H)R.push({text:new O1(H==="hidden"?"shell mode (incognito)":"shell mode",new v1({color:H==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:B?1:0});let j=this.inMemoryAgentModeOverride??this.currentAgentMode;if(!H&&this.cachedVisibleModes.length>1){let S=Fu1(j),h=Ed(j,this.cachedVisibleModes)!==j,_=(CG()||this.widget.dependencies.worker).thread.messages.length===0,b=this.hasToggledAgentMode||!h||!_?new O1(j,new v1({color:S})):new O1("",void 0,[new O1(j,new v1({color:S})),new O1(" (click or ",new v1({color:Z.foreground,dim:!0})),new O1("Ctrl+S",new v1({color:z.keybind})),new O1(" to switch)",new v1({color:Z.foreground,dim:!0}))]);R.push({text:b,position:"top-left",offsetY:0,onClick:_?this.toggleAgentMode:void 0})}let $=Y.mainThread?.metadata?.treeInfo?.uri,E;if($)E=j0.isUri($)?$.fsPath:$;else E=process.cwd();let I=this.toHomeRelative(E),T=this.shorten(I);return R.push({text:new O1(T,new v1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new $h1({leftChild:L,rightChild1:A,rightChild2:w,maxHeight:q,overlayTexts:R,borderColor:this.isTextfieldAndAutocompleteFocused?void 0:k1.index(8),hasBanner:G!==null})}}async function CF6(J){let X=new dH(!1,1000,J.inspectorPort),Y=new vb1({threadService:J.threadService,worker:J.worker,builder:(H,B)=>{let M=CG(),V=M?.thread.id||J.threadID,N={...J,worker:M||J.worker,threadID:V};return new PF6({...N,threadState:B})}}),K=new Sh1({configService:J.configService,child:Y}),q=new Ph1({configService:J.configService,child:K}),G=new Y8({data:rH.default(),child:q}),z=new Z8({data:TC.fromBaseTheme(rH.default()),child:G});try{await pf1(z,{onRootElementMounted:void 0})}finally{}let F=CG()?.thread.id||J.threadID;if((await J.threadService.get(F))?.messages.length!==0){let H=`${J.ampURL.replace(/\/$/,"")}/threads/${F}`;J.stdout.write(`
|
|
6334
6334
|
`),J.stdout.write(`Thread: ${H}
|
|
6335
6335
|
`),J.stdout.write(`Continue this thread with: amp threads continue ${F}
|
|
6336
6336
|
`)}}function Fu1(J){return J==="smart"?k1.rgb(3,197,97):J==="fast"?k1.rgb(228,180,2):J==="free"?k1.rgb(0,184,255):DW9(J)}function DW9(J){let Q=0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);Q=(Q<<5)-Q+K,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Z.length;return k1.index(Z[X])}uf1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){n7.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
6337
|
-
`)}var Hu1=Wu1.join(mc1||Wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function AW9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function KB(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")aG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new g9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${M8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")aG("experimental.agentMode",Q.agentMode)}async function Du1(J){try{await VW9(Wu1.dirname(Hu1),{recursive:!0}),await NW9(Hu1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function wW9(){try{return(await _F6(Hu1,"utf-8")).trim()}catch(J){return null}}function RW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return ml1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var SF6=[{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??GY,description:`Custom settings file path (overrides the default location ${GY})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${$b1})`},{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:hK(),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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:jd}],vF6=(J)=>("deprecated"in J)&&J.deprecated===!0,OW9=(J)=>("hidden"in J)&&J.hidden===!0,jW9=(J)=>("default"in J),$W9=(J)=>("default"in J)?J.default:void 0;function EW9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new g9(fK.unknownCommand(Z),1,q)}}var xF6=null;function Qt2(){return xF6}function iJ1(J){return{...J,getThreadEnvironment:I71,vfs:u20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new U_(J.fileSystem),generateThreadTitle:ZG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Mu1=j0.file(LW9.homedir()),bF6=process.env.XDG_CONFIG_HOME?j0.file(process.env.XDG_CONFIG_HOME):y0.joinPath(Mu1,".config");async function qB(J,Q){ci1("0.0.
|
|
6337
|
+
`)}var Hu1=Wu1.join(mc1||Wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function AW9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function KB(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")aG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new g9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${M8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")aG("experimental.agentMode",Q.agentMode)}async function Du1(J){try{await VW9(Wu1.dirname(Hu1),{recursive:!0}),await NW9(Hu1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function wW9(){try{return(await _F6(Hu1,"utf-8")).trim()}catch(J){return null}}function RW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return ml1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var SF6=[{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??GY,description:`Custom settings file path (overrides the default location ${GY})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${$b1})`},{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:hK(),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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:jd}],vF6=(J)=>("deprecated"in J)&&J.deprecated===!0,OW9=(J)=>("hidden"in J)&&J.hidden===!0,jW9=(J)=>("default"in J),$W9=(J)=>("default"in J)?J.default:void 0;function EW9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new g9(fK.unknownCommand(Z),1,q)}}var xF6=null;function Qt2(){return xF6}function iJ1(J){return{...J,getThreadEnvironment:I71,vfs:u20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new U_(J.fileSystem),generateThreadTitle:ZG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Mu1=j0.file(LW9.homedir()),bF6=process.env.XDG_CONFIG_HOME?j0.file(process.env.XDG_CONFIG_HOME):y0.joinPath(Mu1,".config");async function qB(J,Q){ci1("0.0.1760950038-g7a3f50");let Z=aZ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Mu1,userConfigDir:bF6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (cJ1(),dJ1));X(Z);let Y=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=Ga(zO({configService:Z})),q=N20({configService:Z,toolService:K}),G=OR0(K,T9,xe).catch((w)=>{l.warn("Toolbox registration failed, continuing anyway:",w)}),z=q.initialized.catch((w)=>{l.warn("MCP service initialization failed, continuing anyway:",w)});if(J.executeMode)await Promise.all([z,G]);if(Q.jetbrains)WO("JetBrains");else if(Q.ide&&yQ6())WO("VS Code");else if(Q.ide&&fQ6())WO("Neovim");if(J.executeMode)li1(!0);T96(K,{configService:Z});let U,F=S5.status.pipe(C0((w)=>Boolean(w.connected&&w.authenticated)),o6()).subscribe((w)=>{if(w){if(!U)U=K.registerTool(er)}else U?.dispose(),U=void 0}),W;if(!J.executeMode)W=new m71(process.cwd(),{},!0);else W=new class extends m71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(s2.write(`No API key found. Starting login flow...
|
|
6338
6338
|
`),!await IW9(J))await tw(),process.exit(1)}let H=await i20({isDevelopment:!1}),B=new OH1(H),M=new wH1(H,Z,{lazy:!0}),V=Q.notifications!==void 0?Q.notifications:!J.executeMode,N=S96({playNotificationSound:async(w)=>{if(V){C96(w);let R=gf1(),O=mf1();if((!R||O)&&Y.settings["notifications.system.enabled"]!==!1){if(w==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(w==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:B,configService:Z});l.info("Starting Amp background services");let L=s20({threadService:B,threadHistoryService:M,configService:Z,isExtensionDevelopment:!1}),A={configService:Z,toolService:K,mcpService:q,threadService:B,threadHistoryService:M,threadSyncService:L,threadStorage:H,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:W,notificationService:N,fileSystem:Q.jetbrains||Q.ide?h20:T9};return{...A,async asyncDispose(){await A.mcpService.dispose(),await A.threadService.asyncDispose(),A.configService.unsubscribe(),A.toolService.dispose(),A.fuzzyServer.dispose(),A.threadSyncService.dispose(),A.settingsStorage[Symbol.dispose](),F.unsubscribe(),U?.dispose()}}}async function IW9(J){if(!J.executeMode){if(!await Wy1("Would you like to log in to Amp? [(y)es, (n)o]: "))return s2.write(`Login cancelled. Run the command again to retry.
|
|
6339
6339
|
`),!1}return await yF6(J)}async function yF6(J){let Q=MW9(32).toString("hex"),Z=await Fy1(J.ampURL,Q);try{await mK(Z)}catch(Y){l.error("Failed to open browser",{error:Y})}let X=await Fy1(J.ampURL,Q,!1);s2.write(`If your browser did not open automatically, visit:
|
|
6340
6340
|
|
|
@@ -6344,12 +6344,12 @@ ${M8.blue.bold(X)}
|
|
|
6344
6344
|
Login successful! You can now use the Amp CLI.
|
|
6345
6345
|
`),!0}catch(Y){return l.error("Login failed",{error:Y}),n7.write(`
|
|
6346
6346
|
Login failed: ${Y instanceof Error?Y.message:String(Y)}
|
|
6347
|
-
`),!1}}function PW9(){let J=new o41().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)ZR(),process.exit(0);let H=W.originalError??W;_J6(H)}),J.option("-V, --version","output the version number",()=>{s2.write(`0.0.
|
|
6348
|
-
`),process.exit(0)}),J.addHelpText("after",_Q6()),J.configureHelp({formatHelp:xQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await vW9(M)}),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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await SW9(M,await tb1(B,M.settings))});let Q=async(W,H,B)=>{aZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Mu1,userConfigDir:bF6});let M={...H,executeMode:!1};await Bu1(M,{...W,startWithPicker:!0},B)},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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await kF6(B,M,H)});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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await fW9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);if(H.pick)await Q(M,V,B);else await yW9(M,V,W,B)}),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(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await bW9(M,V,W,B)}),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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await kF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, 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, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await xW9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await _W9(M,V,W,B)}),hZ6(J,async(W,H)=>{let B=await DY(H);KB(W,H);let M=await qB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:ZR,asyncDispose:M.asyncDispose.bind(M)}}),WZ6(J),XZ6(J,async(W)=>{let H=await DY(W);return{settings:H.settings,getThreadDeps:async(B)=>{KB(B,W);let M=await qB(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);KB(H,B);let V=await qB(M,B);try{await xb1(V,V.configService,{})}finally{await V.asyncDispose(),await ZR()}});let X=new o41().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(W)=>{await Ky1(W.force||!1,W.verbose||!1,"0.0.
|
|
6347
|
+
`),!1}}function PW9(){let J=new o41().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)ZR(),process.exit(0);let H=W.originalError??W;_J6(H)}),J.option("-V, --version","output the version number",()=>{s2.write(`0.0.1760950038-g7a3f50 (released 2025-10-20T08:53:01.999Z)
|
|
6348
|
+
`),process.exit(0)}),J.addHelpText("after",_Q6()),J.configureHelp({formatHelp:xQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await vW9(M)}),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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await SW9(M,await tb1(B,M.settings))});let Q=async(W,H,B)=>{aZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Mu1,userConfigDir:bF6});let M={...H,executeMode:!1};await Bu1(M,{...W,startWithPicker:!0},B)},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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await kF6(B,M,H)});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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await fW9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);if(H.pick)await Q(M,V,B);else await yW9(M,V,W,B)}),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(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await bW9(M,V,W,B)}),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(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);await kF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, 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, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await xW9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await DY(M);await _W9(M,V,W,B)}),hZ6(J,async(W,H)=>{let B=await DY(H);KB(W,H);let M=await qB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:ZR,asyncDispose:M.asyncDispose.bind(M)}}),WZ6(J),XZ6(J,async(W)=>{let H=await DY(W);return{settings:H.settings,getThreadDeps:async(B)=>{KB(B,W);let M=await qB(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await DY(B);KB(H,B);let V=await qB(M,B);try{await xb1(V,V.configService,{})}finally{await V.asyncDispose(),await ZR()}});let X=new o41().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(W)=>{await Ky1(W.force||!1,W.verbose||!1,"0.0.1760950038-g7a3f50"),process.exit()});J.addCommand(X,{hidden:!0});function Y(W,H,B){let V=typeof W.description==="string"?W.description:B===void 0?W.description(!0):W.description(B),N=new fV(H,V),L=$W9(W);if(L)N.default(L);if(N.hidden=OW9(W)||vF6(W),"choices"in W)N.choices([...W.choices]);return N}for(let W of SF6)switch(W.type){case"flag":{J.addOption(Y(W,`--${W.long}`)),J.addOption(Y(W,`--no-${W.long}`,!1));break}case"switch":{J.addOption(Y(W,`--${W.long}`,!0));break}default:{J.addOption(Y(W,`--${W.long} <value>`));break}}let K=new fV("-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(K);let q=new fV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let G=new fV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(G);let z=new fV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(z);let U=new fV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(U),process.env.AMP_CONNECT==="1"){let W=new fV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(W)}J.action(async(W,H)=>{let B=W,M=await DY(B);if(Object.keys(B).forEach((V)=>{let N=SF6.find((L)=>L.name===V);if(N&&vF6(N)&&!jW9(N))n7.write(M8.yellow(`Warning: '--${V}' flag is deprecated
|
|
6349
6349
|
`))}),H.args.length>0)EW9(M,H);await Bu1(M,B,H)});let F=new o41("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("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(W)=>{await kW9(W.version)});return J.addCommand(F),J}async function lJ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??Zq(),K=iJ1(J);if(Z)await J.threadStorage.set(Y,Z);let q=await mJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,o71(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(a7(z,"assistant"))await Du1(Y),G.unsubscribe()});return await q.resume(),q}async function Bu1(J,Q,Z){let X=s71(Q);if(X instanceof Error)MY(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let R=(await By1()).trimEnd();if(R)K=R}else Y=(await By1()).trimEnd();if(Q.remote&&!J.executeMode)throw new g9("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new g9("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new g9("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new g9("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&Q.agentMode&&Q.agentMode!=="smart")throw new g9(`Execute mode is not permitted with --agent-mode '${Q.agentMode}'`,1);if(Q.stats&&!J.executeMode)throw new g9("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new g9("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&Y===""&&!Q.streamJsonInput)throw new g9("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
6350
6350
|
Or pipe via stdin: echo "your message" | amp --execute`);KB(Z,Q);let q=await qB(J,Q);xF6=q;let G=iJ1(q),z=async(R)=>{let O=await _F6(R,"utf-8"),j=JSON.parse(O);if(!zF(j.id))throw new g9(fK.invalidThreadId);return lJ1(q,{visibility:X,thread:j})},U=async(R)=>{if(!zF(R))throw new g9(fK.invalidThreadId);let O=await q.threadService.get(R)??void 0;if(l.info(`[fetchAndStartThread] Loaded thread ${R}, agentMode: ${O?.agentMode??"undefined"}`),O?.agentMode)l.info(`[fetchAndStartThread] Setting runtime override for agentMode to: ${O.agentMode}`),aG("experimental.agentMode",O.agentMode);else l.info("[fetchAndStartThread] No agentMode on thread, not setting override");return lJ1(q,{visibility:X,thread:O})},F=async()=>{try{if(Q.threadId)return U(Q.threadId);else return lJ1(q,{visibility:X})}catch(R){if(R instanceof g9)throw R;throw await k71(R,Q.threadId),Error("handleError should have called process.exit()")}},W=async()=>{return lJ1(q,{visibility:X})};if(Q.format==="jsonl")n7.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
6351
|
-
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await HZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await iJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Gr1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)S5.selectConfig(O)}else B=!0}let V=zy1("0.0.
|
|
6352
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await uU(J.settingsFile),Y=pU({...J,settingsFile:X,getHook:process.env.AMP_URL?(G,z)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return z()}:void 0});if(await NZ6(Y),await LZ6(Y),J.mcpConfig){let G=await YZ6(J.mcpConfig);Y=RW9(Y,G)}let K=await Y.get("url","global");if(!K)K=zZ;if(!AB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=ql1(Y),await Y.get("debug.httpLogging"))Xl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:BZ6(await tb1(J,Y))}}function TW9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function CW9(){let J=TW9(process.argv);if(DJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),AW9(l),l.info("Starting Amp CLI.",{version:"0.0.
|
|
6351
|
+
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await HZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await iJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Gr1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)S5.selectConfig(O)}else B=!0}let V=zy1("0.0.1760950038-g7a3f50",q.settingsStorage),N=e1.of([j0.file(process.cwd())]),L=oC(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A;try{A=await XJ.getUserFreeTierStatus({},{config:q.configService})}catch(R){A={ok:!1,error:R}}l.info("User free tier status:",A);let w=await VZ6();l.info("Loaded session state:",w),await CF6({stdout:process.stdout,history:new gb1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:XJ,ampURL:J.ampURL,startNewThread:W,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:S5,connectedClientsService:new sd,commandRegistry:L,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:w,freeTierStatus:A.ok?A.result:void 0}),await q.asyncDispose(),process.exit(0)}async function DY(J){if(J.interactive)n7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
6352
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await uU(J.settingsFile),Y=pU({...J,settingsFile:X,getHook:process.env.AMP_URL?(G,z)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return z()}:void 0});if(await NZ6(Y),await LZ6(Y),J.mcpConfig){let G=await YZ6(J.mcpConfig);Y=RW9(Y,G)}let K=await Y.get("url","global");if(!K)K=zZ;if(!AB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=ql1(Y),await Y.get("debug.httpLogging"))Xl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:BZ6(await tb1(J,Y))}}function TW9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function CW9(){let J=TW9(process.argv);if(DJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),AW9(l),l.info("Starting Amp CLI.",{version:"0.0.1760950038-g7a3f50",buildTimestamp:"2025-10-20T08:53:01.999Z",buildType:"'release'"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new g9(fK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await PW9().parseAsync(process.argv)}CW9().catch(k71);async function SW9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),s2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
6353
6353
|
`);else if(!AB(J.ampURL))s2.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
6354
6354
|
`);let Z=process.env.AMP_API_KEY;if(Z)s2.write(`API key found in environment variable, storing...
|
|
6355
6355
|
`),await Q.set("apiKey",Z,J.ampURL),s2.write(`API key successfully stored.
|
|
@@ -6365,7 +6365,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);KB(Z,Q);let q=await qB(
|
|
|
6365
6365
|
`));try{let Q;if(J)Q=J,n7.write(M8.blue(`Updating to version ${J}...
|
|
6366
6366
|
`)),await qC(J),n7.write(M8.green(`✓ Successfully updated to version ${J}
|
|
6367
6367
|
`));else{n7.write(M8.blue(`Checking for updates...
|
|
6368
|
-
`));let{hasUpdate:X,latestVersion:Y}=await n41("0.0.
|
|
6368
|
+
`));let{hasUpdate:X,latestVersion:Y}=await n41("0.0.1760950038-g7a3f50");if(!X)n7.write(M8.green(`✓ Amp CLI is already up to date.
|
|
6369
6369
|
`)),process.exit(0);if(!Y)n7.write(M8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,n7.write(M8.blue(`Updating to version ${Y}...
|
|
6370
6370
|
`)),await qC(Y),n7.write(M8.green(`✓ Successfully updated to version ${Y}
|
|
6371
6371
|
`))}let Z=await qR(Q);if(Z.warning)n7.write(`
|