@sourcegraph/amp 0.0.1760673682-g1d3f74 → 0.0.1760688104-gc38593
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 +8 -8
- 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 uW6}from"node:module";var fW6=Object.create;var{getPrototypeOf:hW6,defineProperty:uC,getOwnPropertyNames:Lu1,getOwnPropertyDescriptor:gW6}=Object,Au1=Object.prototype.hasOwnProperty;var _6=(J,Q,Z)=>{Z=J!=null?fW6(hW6(J)):{};let X=Q||!J||!J.__esModule?uC(Z,"default",{value:J,enumerable:!0}):Z;for(let Y of Lu1(J))if(!Au1.call(X,Y))uC(X,Y,{get:()=>J[Y],enumerable:!0});return X},Nu1=new WeakMap,mW6=(J)=>{var Q=Nu1.get(J),Z;if(Q)return Q;if(Q=uC({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function")Lu1(J).map((X)=>!Au1.call(Q,X)&&uC(Q,X,{get:()=>J[X],enumerable:!(Z=gW6(J,X))||Z.enumerable}));return Nu1.set(J,Q),Q},a=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var A6=(J,Q)=>{for(var Z in Q)uC(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=uW6(import.meta.url);function up(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function wu1(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 iJ1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function pW6(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Z of Q)if(Ru1(J,Z.type,Z.value),J._state==="closed")break}function Ru1(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(iJ1(J),X&&typeof X.error==="function")X.error(Z);else throw Z;break;case"complete":if(iJ1(J),X&&typeof X.complete==="function")X.complete();break}}catch(Y){console.error("notifySubscription",Y)}if(J._state==="closed")wu1(J);else if(J._state==="running")J._state="ready"}function lJ1(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(()=>pW6(J));return}Ru1(J,Q,Z)}class Ou1{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Z=new ju1(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")iJ1(this),wu1(this)}}class ju1{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){lJ1(this._subscription,"next",J)}error(J){lJ1(this._subscription,"error",J)}complete(){lJ1(this._subscription,"complete")}}function G4(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class CR{_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 nJ1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function aJ1(J){if(nJ1(J))return J;return t1.of(J)}var t1;var SR=B1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");t1=class t1{_subscriber;constructor(J){if(!(this instanceof t1))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 Ou1(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:t1;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 t1)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:t1)((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 y8,s2;var pp=B1(()=>{SR();y8=class y8 extends t1{_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()}};s2=class s2 extends y8{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 rJ1,pC;var $u1=B1(()=>{SR();pp();rJ1=class rJ1 extends Set{subject=new s2(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 t1.from(this.subject)}dispose(){this.subject.complete()}};pC=class pC extends Map{subject=new s2(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 t1.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 sJ1(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 KB(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 P7(J){return new t1((Q)=>{J.then((Z)=>{Q.next(Z),Q.complete()}).catch((Z)=>{Q.error(Z)})})}function g6(J){return new t1((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 t1((Z)=>{let X=new CR(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 vR(J){return new t1((Q)=>{let Z=0,X=setInterval(()=>{Q.next(Z++)},J);return()=>clearInterval(X)})}function dC(...J){return new t1((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()=>{Iu1(X)}})}function S9(...J){if(J.length===0)return oJ1;return new t1((Q)=>{let Z=Array(J.length),X=Array(J.length).fill(0),Y=Array(J.length).fill(!1),K=0,q=[],G=new CR(Q);for(let z=0;z<J.length;z++){let U=J[z];q.push(U.subscribe({next(W){Z[z]=W,Y[z]=!0;let F=++X[z];if(Y.every(Boolean))G.schedule(async(H)=>{if(X[z]===F)H([...Z])})},error(W){G.error(W)},complete(){if(K++,K===J.length)G.complete()}}))}return()=>{Iu1(q)}})}function X9(J){let Z=J?.shouldCountRefs??!0,X=dW6++,Y=(K,...q)=>{};return(K)=>{let q=new y8,G=null,z=!1,U,W=0;return new t1((F)=>{if(W++,z)Y("new subscriber, emitting buffered value",U),F.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(F);return()=>{if(W--,H.unsubscribe(),Z&&W===0){if(G)G4(G),G=null;z=!1}}})}}function Iu1(J){for(let Q of J)if(Q)G4(Q)}function kR(J){return(Q)=>{return new t1((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 gG(J){return(Q)=>{return new t1((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 c6(J=dp){return(Q)=>{return new t1((Z)=>{let X=Eu1,Y=new CR(Z),K=Q.subscribe({complete(){Y.complete()},error(q){Y.error(q)},next(q){Y.schedule(async(G)=>{if(X===Eu1||!J(X,q))X=q,G(q)})}});return()=>G4(K)})}}function DN(J){return cW6(typeof J==="function"?{next:J}:J)}function cW6(J){return(Q)=>new t1((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 t1((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 Pu1(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(K),Y.unsubscribe()}})}}function j2(J){return(Q)=>new t1((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 MN(J){return(Q)=>new t1((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 Tu1(J){return(Q)=>new t1((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 J8(J){return(Q)=>{return new t1((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(W){Z.error(W);return}Y=U.subscribe({next(W){Z.next(W)},error(W){Z.error(W)},complete(){Y=null,q()}})},error(z){Z.error(z)},complete(){K=!0,q()}});return()=>{if(G4(G),Y)G4(Y)}})}}function Cu1(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 lK(J){return(Q)=>new t1((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 tJ1(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Z)=>new t1((X)=>{let Y=0,K=null,q=null,G=!1,z=Z.subscribe({next:(U)=>{let W=Date.now();if(q=U,G=!0,W-Y>=J)X.next(U),Y=W,G=!1;else if(K===null)K=setTimeout(()=>{if(G)X.next(q),Y=Date.now(),G=!1;K=null},J-(W-Y));if(Y===0)X.next(U),Y=W,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 cC(...J){return new t1((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 iK(J){return(Q)=>new t1((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 cp({onSubscribe:J,onUnsubscribe:Q}){return(Z)=>new t1((X)=>{J?.();let Y=Z.subscribe(X);return()=>{G4(Y),Q?.()}})}function JW(J){return(Q)=>t1.from(Q).pipe(J8((Z)=>g6((X)=>J(Z,X))))}function MQ(J){return(Q)=>new t1((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 T5(J){return(Q)=>{return new t1((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 Su1(J,Q){return(Z)=>{return new t1((X)=>{let Y,K=0,q=new CR(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 oJ1,LY,AH9,dW6=0,Eu1,Pu1;var eJ1=B1(()=>{SR();pp();oJ1=new t1((J)=>{J.complete()}),LY=new t1(()=>{});AH9=Symbol("noInitialValue");Eu1={};Pu1=class Pu1 extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function VN(J,Q){return(Z)=>{return t1.from(Z).pipe(J8((X)=>X===IJ?t1.of(IJ):J(X).pipe(MQ((Y)=>t1.of(Y instanceof Error?Y:Error(Y))),j2(IJ))),X9(Q))}}function lW6(){return(J)=>t1.from(J).pipe(T5((Q)=>Q!==IJ))}async function lC(J,Q){let Z=await J6(t1.from(J).pipe(lW6()),Q);if(Z instanceof Error)throw Z;return Z}var IJ;var vu1=B1(()=>{SR();eJ1();IJ=Symbol.for("@@pendingOperation")});var I0=B1(()=>{$u1();SR();vu1();eJ1();pp()});var xu1=a((ku1)=>{Object.defineProperty(ku1,"__esModule",{value:!0});ku1._globalThis=void 0;ku1._globalThis=typeof globalThis==="object"?globalThis:global});var bu1=a((NN)=>{var iW6=NN&&NN.__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]}),nW6=NN&&NN.__exportStar||function(J,Q){for(var Z in J)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call(Q,Z))iW6(Q,J,Z)};Object.defineProperty(NN,"__esModule",{value:!0});nW6(xu1(),NN)});var yu1=a((LN)=>{var aW6=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]}),rW6=LN&&LN.__exportStar||function(J,Q){for(var Z in J)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call(Q,Z))aW6(Q,J,Z)};Object.defineProperty(LN,"__esModule",{value:!0});rW6(bu1(),LN)});var JQ1=a((fu1)=>{Object.defineProperty(fu1,"__esModule",{value:!0});fu1.VERSION=void 0;fu1.VERSION="1.9.0"});var du1=a((uu1)=>{Object.defineProperty(uu1,"__esModule",{value:!0});uu1.isCompatible=uu1._makeCompatibilityCheck=void 0;var sW6=JQ1(),gu1=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function mu1(J){let Q=new Set([J]),Z=new Set,X=J.match(gu1);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(gu1);if(!U)return K(z);let W={major:+U[1],minor:+U[2],patch:+U[3],prerelease:U[4]};if(W.prerelease!=null)return K(z);if(Y.major!==W.major)return K(z);if(Y.major===0){if(Y.minor===W.minor&&Y.patch<=W.patch)return q(z);return K(z)}if(Y.minor<=W.minor)return q(z);return K(z)}}uu1._makeCompatibilityCheck=mu1;uu1.isCompatible=mu1(sW6.VERSION)});var AN=a((cu1)=>{Object.defineProperty(cu1,"__esModule",{value:!0});cu1.unregisterGlobal=cu1.getGlobal=cu1.registerGlobal=void 0;var tW6=yu1(),xR=JQ1(),eW6=du1(),JF6=xR.VERSION.split(".")[0],iC=Symbol.for(`opentelemetry.js.api.${JF6}`),nC=tW6._globalThis;function QF6(J,Q,Z,X=!1){var Y;let K=nC[iC]=(Y=nC[iC])!==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}cu1.registerGlobal=QF6;function ZF6(J){var Q,Z;let X=(Q=nC[iC])===null||Q===void 0?void 0:Q.version;if(!X||!(0,eW6.isCompatible)(X))return;return(Z=nC[iC])===null||Z===void 0?void 0:Z[J]}cu1.getGlobal=ZF6;function XF6(J,Q){Q.debug(`@opentelemetry/api: Unregistering a global for ${J} v${xR.VERSION}.`);let Z=nC[iC];if(Z)delete Z[J]}cu1.unregisterGlobal=XF6});var ru1=a((nu1)=>{Object.defineProperty(nu1,"__esModule",{value:!0});nu1.DiagComponentLogger=void 0;var qF6=AN();class iu1{constructor(J){this._namespace=J.namespace||"DiagComponentLogger"}debug(...J){return aC("debug",this._namespace,J)}error(...J){return aC("error",this._namespace,J)}info(...J){return aC("info",this._namespace,J)}warn(...J){return aC("warn",this._namespace,J)}verbose(...J){return aC("verbose",this._namespace,J)}}nu1.DiagComponentLogger=iu1;function aC(J,Q,Z){let X=(0,qF6.getGlobal)("diag");if(!X)return;return Z.unshift(Q),X[J](...Z)}});var lp=a((su1)=>{Object.defineProperty(su1,"__esModule",{value:!0});su1.DiagLogLevel=void 0;var GF6;(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"})(GF6=su1.DiagLogLevel||(su1.DiagLogLevel={}))});var eu1=a((ou1)=>{Object.defineProperty(ou1,"__esModule",{value:!0});ou1.createLogLevelDiagLogger=void 0;var QW=lp();function zF6(J,Q){if(J<QW.DiagLogLevel.NONE)J=QW.DiagLogLevel.NONE;else if(J>QW.DiagLogLevel.ALL)J=QW.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",QW.DiagLogLevel.ERROR),warn:Z("warn",QW.DiagLogLevel.WARN),info:Z("info",QW.DiagLogLevel.INFO),debug:Z("debug",QW.DiagLogLevel.DEBUG),verbose:Z("verbose",QW.DiagLogLevel.VERBOSE)}}ou1.createLogLevelDiagLogger=zF6});var wN=a((Qp1)=>{Object.defineProperty(Qp1,"__esModule",{value:!0});Qp1.DiagAPI=void 0;var UF6=ru1(),WF6=eu1(),Jp1=lp(),ip=AN(),FF6="diag";class ZQ1{constructor(){function J(X){return function(...Y){let K=(0,ip.getGlobal)("diag");if(!K)return;return K[X](...Y)}}let Q=this,Z=(X,Y={logLevel:Jp1.DiagLogLevel.INFO})=>{var K,q,G;if(X===Q){let W=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return Q.error((K=W.stack)!==null&&K!==void 0?K:W.message),!1}if(typeof Y==="number")Y={logLevel:Y};let z=(0,ip.getGlobal)("diag"),U=(0,WF6.createLogLevelDiagLogger)((q=Y.logLevel)!==null&&q!==void 0?q:Jp1.DiagLogLevel.INFO,X);if(z&&!Y.suppressOverrideMessage){let W=(G=Error().stack)!==null&&G!==void 0?G:"<failed to generate stacktrace>";z.warn(`Current logger will be overwritten from ${W}`),U.warn(`Current logger will overwrite one already registered from ${W}`)}return(0,ip.registerGlobal)("diag",U,Q,!0)};Q.setLogger=Z,Q.disable=()=>{(0,ip.unregisterGlobal)(FF6,Q)},Q.createComponentLogger=(X)=>{return new UF6.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 ZQ1;return this._instance}}Qp1.DiagAPI=ZQ1});var Kp1=a((Xp1)=>{Object.defineProperty(Xp1,"__esModule",{value:!0});Xp1.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}}Xp1.BaggageImpl=bR});var zp1=a((qp1)=>{Object.defineProperty(qp1,"__esModule",{value:!0});qp1.baggageEntryMetadataSymbol=void 0;qp1.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var XQ1=a((Up1)=>{Object.defineProperty(Up1,"__esModule",{value:!0});Up1.baggageEntryMetadataFromString=Up1.createBaggage=void 0;var HF6=wN(),BF6=Kp1(),DF6=zp1(),MF6=HF6.DiagAPI.instance();function VF6(J={}){return new BF6.BaggageImpl(new Map(Object.entries(J)))}Up1.createBaggage=VF6;function NF6(J){if(typeof J!=="string")MF6.error(`Cannot create baggage metadata from unknown type: ${typeof J}`),J="";return{__TYPE__:DF6.baggageEntryMetadataSymbol,toString(){return J}}}Up1.baggageEntryMetadataFromString=NF6});var rC=a((Fp1)=>{Object.defineProperty(Fp1,"__esModule",{value:!0});Fp1.ROOT_CONTEXT=Fp1.createContextKey=void 0;function AF6(J){return Symbol.for(J)}Fp1.createContextKey=AF6;class np{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 np(Q._currentContext);return Y._currentContext.set(Z,X),Y},Q.deleteValue=(Z)=>{let X=new np(Q._currentContext);return X._currentContext.delete(Z),X}}}Fp1.ROOT_CONTEXT=new np});var Vp1=a((Dp1)=>{Object.defineProperty(Dp1,"__esModule",{value:!0});Dp1.DiagConsoleLogger=void 0;var YQ1=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class Bp1{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<YQ1.length;Q++)this[YQ1[Q].n]=J(YQ1[Q].c)}}Dp1.DiagConsoleLogger=Bp1});var BQ1=a((Np1)=>{Object.defineProperty(Np1,"__esModule",{value:!0});Np1.createNoopMeter=Np1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Np1.NOOP_OBSERVABLE_GAUGE_METRIC=Np1.NOOP_OBSERVABLE_COUNTER_METRIC=Np1.NOOP_UP_DOWN_COUNTER_METRIC=Np1.NOOP_HISTOGRAM_METRIC=Np1.NOOP_GAUGE_METRIC=Np1.NOOP_COUNTER_METRIC=Np1.NOOP_METER=Np1.NoopObservableUpDownCounterMetric=Np1.NoopObservableGaugeMetric=Np1.NoopObservableCounterMetric=Np1.NoopObservableMetric=Np1.NoopHistogramMetric=Np1.NoopGaugeMetric=Np1.NoopUpDownCounterMetric=Np1.NoopCounterMetric=Np1.NoopMetric=Np1.NoopMeter=void 0;class KQ1{constructor(){}createGauge(J,Q){return Np1.NOOP_GAUGE_METRIC}createHistogram(J,Q){return Np1.NOOP_HISTOGRAM_METRIC}createCounter(J,Q){return Np1.NOOP_COUNTER_METRIC}createUpDownCounter(J,Q){return Np1.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(J,Q){return Np1.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(J,Q){return Np1.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(J,Q){return Np1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(J,Q){}removeBatchObservableCallback(J){}}Np1.NoopMeter=KQ1;class yR{}Np1.NoopMetric=yR;class qQ1 extends yR{add(J,Q){}}Np1.NoopCounterMetric=qQ1;class GQ1 extends yR{add(J,Q){}}Np1.NoopUpDownCounterMetric=GQ1;class zQ1 extends yR{record(J,Q){}}Np1.NoopGaugeMetric=zQ1;class UQ1 extends yR{record(J,Q){}}Np1.NoopHistogramMetric=UQ1;class sC{addCallback(J){}removeCallback(J){}}Np1.NoopObservableMetric=sC;class WQ1 extends sC{}Np1.NoopObservableCounterMetric=WQ1;class FQ1 extends sC{}Np1.NoopObservableGaugeMetric=FQ1;class HQ1 extends sC{}Np1.NoopObservableUpDownCounterMetric=HQ1;Np1.NOOP_METER=new KQ1;Np1.NOOP_COUNTER_METRIC=new qQ1;Np1.NOOP_GAUGE_METRIC=new zQ1;Np1.NOOP_HISTOGRAM_METRIC=new UQ1;Np1.NOOP_UP_DOWN_COUNTER_METRIC=new GQ1;Np1.NOOP_OBSERVABLE_COUNTER_METRIC=new WQ1;Np1.NOOP_OBSERVABLE_GAUGE_METRIC=new FQ1;Np1.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new HQ1;function RF6(){return Np1.NOOP_METER}Np1.createNoopMeter=RF6});var Tp1=a((Pp1)=>{Object.defineProperty(Pp1,"__esModule",{value:!0});Pp1.ValueType=void 0;var kF6;(function(J){J[J.INT=0]="INT",J[J.DOUBLE=1]="DOUBLE"})(kF6=Pp1.ValueType||(Pp1.ValueType={}))});var MQ1=a((Cp1)=>{Object.defineProperty(Cp1,"__esModule",{value:!0});Cp1.defaultTextMapSetter=Cp1.defaultTextMapGetter=void 0;Cp1.defaultTextMapGetter={get(J,Q){if(J==null)return;return J[Q]},keys(J){if(J==null)return[];return Object.keys(J)}};Cp1.defaultTextMapSetter={set(J,Q,Z){if(J==null)return;J[Q]=Z}}});var xp1=a((kp1)=>{Object.defineProperty(kp1,"__esModule",{value:!0});kp1.NoopContextManager=void 0;var xF6=rC();class vp1{active(){return xF6.ROOT_CONTEXT}with(J,Q,Z,...X){return Q.call(Z,...X)}bind(J,Q){return Q}enable(){return this}disable(){return this}}kp1.NoopContextManager=vp1});var oC=a((yp1)=>{Object.defineProperty(yp1,"__esModule",{value:!0});yp1.ContextAPI=void 0;var bF6=xp1(),VQ1=AN(),bp1=wN(),NQ1="context",yF6=new bF6.NoopContextManager;class LQ1{constructor(){}static getInstance(){if(!this._instance)this._instance=new LQ1;return this._instance}setGlobalContextManager(J){return(0,VQ1.registerGlobal)(NQ1,J,bp1.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,VQ1.getGlobal)(NQ1)||yF6}disable(){this._getContextManager().disable(),(0,VQ1.unregisterGlobal)(NQ1,bp1.DiagAPI.instance())}}yp1.ContextAPI=LQ1});var wQ1=a((hp1)=>{Object.defineProperty(hp1,"__esModule",{value:!0});hp1.TraceFlags=void 0;var fF6;(function(J){J[J.NONE=0]="NONE",J[J.SAMPLED=1]="SAMPLED"})(fF6=hp1.TraceFlags||(hp1.TraceFlags={}))});var ap=a((gp1)=>{Object.defineProperty(gp1,"__esModule",{value:!0});gp1.INVALID_SPAN_CONTEXT=gp1.INVALID_TRACEID=gp1.INVALID_SPANID=void 0;var hF6=wQ1();gp1.INVALID_SPANID="0000000000000000";gp1.INVALID_TRACEID="00000000000000000000000000000000";gp1.INVALID_SPAN_CONTEXT={traceId:gp1.INVALID_TRACEID,spanId:gp1.INVALID_SPANID,traceFlags:hF6.TraceFlags.NONE}});var rp=a((cp1)=>{Object.defineProperty(cp1,"__esModule",{value:!0});cp1.NonRecordingSpan=void 0;var gF6=ap();class dp1{constructor(J=gF6.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){}}cp1.NonRecordingSpan=dp1});var jQ1=a((np1)=>{Object.defineProperty(np1,"__esModule",{value:!0});np1.getSpanContext=np1.setSpanContext=np1.deleteSpan=np1.setSpan=np1.getActiveSpan=np1.getSpan=void 0;var mF6=rC(),uF6=rp(),pF6=oC(),RQ1=(0,mF6.createContextKey)("OpenTelemetry Context Key SPAN");function OQ1(J){return J.getValue(RQ1)||void 0}np1.getSpan=OQ1;function dF6(){return OQ1(pF6.ContextAPI.getInstance().active())}np1.getActiveSpan=dF6;function ip1(J,Q){return J.setValue(RQ1,Q)}np1.setSpan=ip1;function cF6(J){return J.deleteValue(RQ1)}np1.deleteSpan=cF6;function lF6(J,Q){return ip1(J,new uF6.NonRecordingSpan(Q))}np1.setSpanContext=lF6;function iF6(J){var Q;return(Q=OQ1(J))===null||Q===void 0?void 0:Q.spanContext()}np1.getSpanContext=iF6});var sp=a((tp1)=>{Object.defineProperty(tp1,"__esModule",{value:!0});tp1.wrapSpanContext=tp1.isSpanContextValid=tp1.isValidSpanId=tp1.isValidTraceId=void 0;var rp1=ap(),tF6=rp(),eF6=/^([0-9a-f]{32})$/i,JH6=/^[0-9a-f]{16}$/i;function sp1(J){return eF6.test(J)&&J!==rp1.INVALID_TRACEID}tp1.isValidTraceId=sp1;function op1(J){return JH6.test(J)&&J!==rp1.INVALID_SPANID}tp1.isValidSpanId=op1;function QH6(J){return sp1(J.traceId)&&op1(J.spanId)}tp1.isSpanContextValid=QH6;function ZH6(J){return new tF6.NonRecordingSpan(J)}tp1.wrapSpanContext=ZH6});var IQ1=a((Zd1)=>{Object.defineProperty(Zd1,"__esModule",{value:!0});Zd1.NoopTracer=void 0;var qH6=oC(),Jd1=jQ1(),$Q1=rp(),GH6=sp(),EQ1=qH6.ContextAPI.getInstance();class Qd1{startSpan(J,Q,Z=EQ1.active()){if(Boolean(Q===null||Q===void 0?void 0:Q.root))return new $Q1.NonRecordingSpan;let Y=Z&&(0,Jd1.getSpanContext)(Z);if(zH6(Y)&&(0,GH6.isSpanContextValid)(Y))return new $Q1.NonRecordingSpan(Y);else return new $Q1.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:EQ1.active(),z=this.startSpan(J,Y,G),U=(0,Jd1.setSpan)(G,z);return EQ1.with(U,q,void 0,z)}}Zd1.NoopTracer=Qd1;function zH6(J){return typeof J==="object"&&typeof J.spanId==="string"&&typeof J.traceId==="string"&&typeof J.traceFlags==="number"}});var PQ1=a((Kd1)=>{Object.defineProperty(Kd1,"__esModule",{value:!0});Kd1.ProxyTracer=void 0;var UH6=IQ1(),WH6=new UH6.NoopTracer;class Yd1{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}}Kd1.ProxyTracer=Yd1});var Wd1=a((zd1)=>{Object.defineProperty(zd1,"__esModule",{value:!0});zd1.NoopTracerProvider=void 0;var FH6=IQ1();class Gd1{getTracer(J,Q,Z){return new FH6.NoopTracer}}zd1.NoopTracerProvider=Gd1});var TQ1=a((Hd1)=>{Object.defineProperty(Hd1,"__esModule",{value:!0});Hd1.ProxyTracerProvider=void 0;var HH6=PQ1(),BH6=Wd1(),DH6=new BH6.NoopTracerProvider;class Fd1{getTracer(J,Q,Z){var X;return(X=this.getDelegateTracer(J,Q,Z))!==null&&X!==void 0?X:new HH6.ProxyTracer(this,J,Q,Z)}getDelegate(){var J;return(J=this._delegate)!==null&&J!==void 0?J:DH6}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)}}Hd1.ProxyTracerProvider=Fd1});var Md1=a((Dd1)=>{Object.defineProperty(Dd1,"__esModule",{value:!0});Dd1.SamplingDecision=void 0;var MH6;(function(J){J[J.NOT_RECORD=0]="NOT_RECORD",J[J.RECORD=1]="RECORD",J[J.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(MH6=Dd1.SamplingDecision||(Dd1.SamplingDecision={}))});var Nd1=a((Vd1)=>{Object.defineProperty(Vd1,"__esModule",{value:!0});Vd1.SpanKind=void 0;var VH6;(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"})(VH6=Vd1.SpanKind||(Vd1.SpanKind={}))});var Ad1=a((Ld1)=>{Object.defineProperty(Ld1,"__esModule",{value:!0});Ld1.SpanStatusCode=void 0;var NH6;(function(J){J[J.UNSET=0]="UNSET",J[J.OK=1]="OK",J[J.ERROR=2]="ERROR"})(NH6=Ld1.SpanStatusCode||(Ld1.SpanStatusCode={}))});var Od1=a((wd1)=>{Object.defineProperty(wd1,"__esModule",{value:!0});wd1.validateValue=wd1.validateKey=void 0;var kQ1="[_0-9a-z-*/]",LH6=`[a-z]${kQ1}{0,255}`,AH6=`[a-z0-9]${kQ1}{0,240}@[a-z]${kQ1}{0,13}`,wH6=new RegExp(`^(?:${LH6}|${AH6})$`),RH6=/^[ -~]{0,255}[!-~]$/,OH6=/,|=/;function jH6(J){return wH6.test(J)}wd1.validateKey=jH6;function $H6(J){return RH6.test(J)&&!OH6.test(J)}wd1.validateValue=$H6});var Cd1=a((Pd1)=>{Object.defineProperty(Pd1,"__esModule",{value:!0});Pd1.TraceStateImpl=void 0;var jd1=Od1(),$d1=32,IH6=512,Ed1=",",Id1="=";class _Q1{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+Id1+this.get(Q)),J},[]).join(Ed1)}_parse(J){if(J.length>IH6)return;if(this._internalState=J.split(Ed1).reverse().reduce((Q,Z)=>{let X=Z.trim(),Y=X.indexOf(Id1);if(Y!==-1){let K=X.slice(0,Y),q=X.slice(Y+1,Z.length);if((0,jd1.validateKey)(K)&&(0,jd1.validateValue)(q))Q.set(K,q)}return Q},new Map),this._internalState.size>$d1)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,$d1))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let J=new _Q1;return J._internalState=new Map(this._internalState),J}}Pd1.TraceStateImpl=_Q1});var kd1=a((Sd1)=>{Object.defineProperty(Sd1,"__esModule",{value:!0});Sd1.createTraceState=void 0;var PH6=Cd1();function TH6(J){return new PH6.TraceStateImpl(J)}Sd1.createTraceState=TH6});var bd1=a((_d1)=>{Object.defineProperty(_d1,"__esModule",{value:!0});_d1.context=void 0;var CH6=oC();_d1.context=CH6.ContextAPI.getInstance()});var hd1=a((yd1)=>{Object.defineProperty(yd1,"__esModule",{value:!0});yd1.diag=void 0;var SH6=wN();yd1.diag=SH6.DiagAPI.instance()});var ud1=a((gd1)=>{Object.defineProperty(gd1,"__esModule",{value:!0});gd1.NOOP_METER_PROVIDER=gd1.NoopMeterProvider=void 0;var vH6=BQ1();class xQ1{getMeter(J,Q,Z){return vH6.NOOP_METER}}gd1.NoopMeterProvider=xQ1;gd1.NOOP_METER_PROVIDER=new xQ1});var ld1=a((dd1)=>{Object.defineProperty(dd1,"__esModule",{value:!0});dd1.MetricsAPI=void 0;var _H6=ud1(),bQ1=AN(),pd1=wN(),yQ1="metrics";class fQ1{constructor(){}static getInstance(){if(!this._instance)this._instance=new fQ1;return this._instance}setGlobalMeterProvider(J){return(0,bQ1.registerGlobal)(yQ1,J,pd1.DiagAPI.instance())}getMeterProvider(){return(0,bQ1.getGlobal)(yQ1)||_H6.NOOP_METER_PROVIDER}getMeter(J,Q,Z){return this.getMeterProvider().getMeter(J,Q,Z)}disable(){(0,bQ1.unregisterGlobal)(yQ1,pd1.DiagAPI.instance())}}dd1.MetricsAPI=fQ1});var ad1=a((id1)=>{Object.defineProperty(id1,"__esModule",{value:!0});id1.metrics=void 0;var xH6=ld1();id1.metrics=xH6.MetricsAPI.getInstance()});var td1=a((sd1)=>{Object.defineProperty(sd1,"__esModule",{value:!0});sd1.NoopTextMapPropagator=void 0;class rd1{inject(J,Q){}extract(J,Q){return J}fields(){return[]}}sd1.NoopTextMapPropagator=rd1});var Zc1=a((Jc1)=>{Object.defineProperty(Jc1,"__esModule",{value:!0});Jc1.deleteBaggage=Jc1.setBaggage=Jc1.getActiveBaggage=Jc1.getBaggage=void 0;var bH6=oC(),yH6=rC(),hQ1=(0,yH6.createContextKey)("OpenTelemetry Baggage Key");function ed1(J){return J.getValue(hQ1)||void 0}Jc1.getBaggage=ed1;function fH6(){return ed1(bH6.ContextAPI.getInstance().active())}Jc1.getActiveBaggage=fH6;function hH6(J,Q){return J.setValue(hQ1,Q)}Jc1.setBaggage=hH6;function gH6(J){return J.deleteValue(hQ1)}Jc1.deleteBaggage=gH6});var Gc1=a((Kc1)=>{Object.defineProperty(Kc1,"__esModule",{value:!0});Kc1.PropagationAPI=void 0;var gQ1=AN(),dH6=td1(),Xc1=MQ1(),op=Zc1(),cH6=XQ1(),Yc1=wN(),mQ1="propagation",lH6=new dH6.NoopTextMapPropagator;class uQ1{constructor(){this.createBaggage=cH6.createBaggage,this.getBaggage=op.getBaggage,this.getActiveBaggage=op.getActiveBaggage,this.setBaggage=op.setBaggage,this.deleteBaggage=op.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new uQ1;return this._instance}setGlobalPropagator(J){return(0,gQ1.registerGlobal)(mQ1,J,Yc1.DiagAPI.instance())}inject(J,Q,Z=Xc1.defaultTextMapSetter){return this._getGlobalPropagator().inject(J,Q,Z)}extract(J,Q,Z=Xc1.defaultTextMapGetter){return this._getGlobalPropagator().extract(J,Q,Z)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,gQ1.unregisterGlobal)(mQ1,Yc1.DiagAPI.instance())}_getGlobalPropagator(){return(0,gQ1.getGlobal)(mQ1)||lH6}}Kc1.PropagationAPI=uQ1});var Wc1=a((zc1)=>{Object.defineProperty(zc1,"__esModule",{value:!0});zc1.propagation=void 0;var iH6=Gc1();zc1.propagation=iH6.PropagationAPI.getInstance()});var Vc1=a((Dc1)=>{Object.defineProperty(Dc1,"__esModule",{value:!0});Dc1.TraceAPI=void 0;var pQ1=AN(),Fc1=TQ1(),Hc1=sp(),fR=jQ1(),Bc1=wN(),dQ1="trace";class cQ1{constructor(){this._proxyTracerProvider=new Fc1.ProxyTracerProvider,this.wrapSpanContext=Hc1.wrapSpanContext,this.isSpanContextValid=Hc1.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 cQ1;return this._instance}setGlobalTracerProvider(J){let Q=(0,pQ1.registerGlobal)(dQ1,this._proxyTracerProvider,Bc1.DiagAPI.instance());if(Q)this._proxyTracerProvider.setDelegate(J);return Q}getTracerProvider(){return(0,pQ1.getGlobal)(dQ1)||this._proxyTracerProvider}getTracer(J,Q){return this.getTracerProvider().getTracer(J,Q)}disable(){(0,pQ1.unregisterGlobal)(dQ1,Bc1.DiagAPI.instance()),this._proxyTracerProvider=new Fc1.ProxyTracerProvider}}Dc1.TraceAPI=cQ1});var Ac1=a((Nc1)=>{Object.defineProperty(Nc1,"__esModule",{value:!0});Nc1.trace=void 0;var nH6=Vc1();Nc1.trace=nH6.TraceAPI.getInstance()});var tp=a(($2)=>{Object.defineProperty($2,"__esModule",{value:!0});$2.trace=$2.propagation=$2.metrics=$2.diag=$2.context=$2.INVALID_SPAN_CONTEXT=$2.INVALID_TRACEID=$2.INVALID_SPANID=$2.isValidSpanId=$2.isValidTraceId=$2.isSpanContextValid=$2.createTraceState=$2.TraceFlags=$2.SpanStatusCode=$2.SpanKind=$2.SamplingDecision=$2.ProxyTracerProvider=$2.ProxyTracer=$2.defaultTextMapSetter=$2.defaultTextMapGetter=$2.ValueType=$2.createNoopMeter=$2.DiagLogLevel=$2.DiagConsoleLogger=$2.ROOT_CONTEXT=$2.createContextKey=$2.baggageEntryMetadataFromString=void 0;var aH6=XQ1();Object.defineProperty($2,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return aH6.baggageEntryMetadataFromString}});var wc1=rC();Object.defineProperty($2,"createContextKey",{enumerable:!0,get:function(){return wc1.createContextKey}});Object.defineProperty($2,"ROOT_CONTEXT",{enumerable:!0,get:function(){return wc1.ROOT_CONTEXT}});var rH6=Vp1();Object.defineProperty($2,"DiagConsoleLogger",{enumerable:!0,get:function(){return rH6.DiagConsoleLogger}});var sH6=lp();Object.defineProperty($2,"DiagLogLevel",{enumerable:!0,get:function(){return sH6.DiagLogLevel}});var oH6=BQ1();Object.defineProperty($2,"createNoopMeter",{enumerable:!0,get:function(){return oH6.createNoopMeter}});var tH6=Tp1();Object.defineProperty($2,"ValueType",{enumerable:!0,get:function(){return tH6.ValueType}});var Rc1=MQ1();Object.defineProperty($2,"defaultTextMapGetter",{enumerable:!0,get:function(){return Rc1.defaultTextMapGetter}});Object.defineProperty($2,"defaultTextMapSetter",{enumerable:!0,get:function(){return Rc1.defaultTextMapSetter}});var eH6=PQ1();Object.defineProperty($2,"ProxyTracer",{enumerable:!0,get:function(){return eH6.ProxyTracer}});var JB6=TQ1();Object.defineProperty($2,"ProxyTracerProvider",{enumerable:!0,get:function(){return JB6.ProxyTracerProvider}});var QB6=Md1();Object.defineProperty($2,"SamplingDecision",{enumerable:!0,get:function(){return QB6.SamplingDecision}});var ZB6=Nd1();Object.defineProperty($2,"SpanKind",{enumerable:!0,get:function(){return ZB6.SpanKind}});var XB6=Ad1();Object.defineProperty($2,"SpanStatusCode",{enumerable:!0,get:function(){return XB6.SpanStatusCode}});var YB6=wQ1();Object.defineProperty($2,"TraceFlags",{enumerable:!0,get:function(){return YB6.TraceFlags}});var KB6=kd1();Object.defineProperty($2,"createTraceState",{enumerable:!0,get:function(){return KB6.createTraceState}});var lQ1=sp();Object.defineProperty($2,"isSpanContextValid",{enumerable:!0,get:function(){return lQ1.isSpanContextValid}});Object.defineProperty($2,"isValidTraceId",{enumerable:!0,get:function(){return lQ1.isValidTraceId}});Object.defineProperty($2,"isValidSpanId",{enumerable:!0,get:function(){return lQ1.isValidSpanId}});var iQ1=ap();Object.defineProperty($2,"INVALID_SPANID",{enumerable:!0,get:function(){return iQ1.INVALID_SPANID}});Object.defineProperty($2,"INVALID_TRACEID",{enumerable:!0,get:function(){return iQ1.INVALID_TRACEID}});Object.defineProperty($2,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return iQ1.INVALID_SPAN_CONTEXT}});var Oc1=bd1();Object.defineProperty($2,"context",{enumerable:!0,get:function(){return Oc1.context}});var jc1=hd1();Object.defineProperty($2,"diag",{enumerable:!0,get:function(){return jc1.diag}});var $c1=ad1();Object.defineProperty($2,"metrics",{enumerable:!0,get:function(){return $c1.metrics}});var Ec1=Wc1();Object.defineProperty($2,"propagation",{enumerable:!0,get:function(){return Ec1.propagation}});var Ic1=Ac1();Object.defineProperty($2,"trace",{enumerable:!0,get:function(){return Ic1.trace}});$2.default={context:Oc1.context,diag:jc1.diag,metrics:$c1.metrics,propagation:Ec1.propagation,trace:Ic1.trace}});function UB6(){return zB6}function Pc1(J){let Q=RN;return RN=J,Q}class mG{baseLogger;scope;context={};constructor(J=Tc1){this.baseLogger=J}with(J){let Q=new mG(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new mG(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=nQ1.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 nQ1,zB6=!1,WB6,RN,Tc1,l;var z0=B1(()=>{nQ1=_6(tp(),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(UB6())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=nQ1.trace.getActiveSpan();if(X){let Y=X.spanContext();if(Y.traceId)Z.traceId=Y.traceId,Z.spanId=Y.spanId}console.info(J,Z)}},RN=WB6;Tc1={error:(J,...Q)=>RN.error(J,...Q),warn:(J,...Q)=>RN.warn(J,...Q),info:(J,...Q)=>RN.info(J,...Q),debug:(J,...Q)=>RN.debug(J,...Q),audit:(J,...Q)=>RN.audit(J,...Q)};l=Tc1});function Cc1(){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 Sc1(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&&!FB6.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!HB6.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(BB6.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 DB6(J,Q){if(!J&&!Q)return"file";return J}function MB6(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=nK;else if(Q[0]!==nK)Q=nK+Q;break}return Q}class O0{static isUri(J){if(J instanceof O0)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||h2,this.authority=J.authority||h2,this.path=J.path||h2,this.query=J.query||h2,this.fragment=J.fragment||h2,this.platform=J.platform;else this.scheme=DB6(J,K),this.authority=Q||h2,this.path=MB6(this.scheme,Z||h2),this.query=X||h2,this.fragment=Y||h2,this.platform=q,Sc1(this,K)}get fsPath(){return bc1(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=h2;if(Z===void 0)Z=this.authority;else if(Z===null)Z=h2;if(X===void 0)X=this.path;else if(X===null)X=h2;if(Y===void 0)Y=this.query;else if(Y===null)Y=h2;if(K===void 0)K=this.fragment;else if(K===null)K=h2;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 ON(Q,Z,X,Y,K,!1,q)}static parse(J,Q=!1){let Z=VB6.exec(J);if(!Z)return new ON(h2,h2,h2,h2,h2);return new ON(Z[2]||h2,ep(Z[4]||h2),ep(Z[5]||h2),ep(Z[7]||h2),ep(Z[9]||h2),Q)}static file(J,Q=Cc1()){let Z=h2;if(Q==="windows")J=J.replace(/\\/g,nK);if(J[0]===nK&&J[1]===nK){let X=J.indexOf(nK,2);if(X===-1)Z=J.substring(2),J=nK;else Z=J.substring(2,X),J=J.substring(X)||nK}return new ON("file",Z,J,h2,h2,!1,Q)}static from(J){let Q=new ON(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return Sc1(Q,!0),Q}toString(J=!1){return aQ1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof O0)return J;let Q=new ON(J),Z=J;return Q._formatted=Z.external,Q._fsPath=Z._sep===_c1(Q.platform)?Z.fsPath:null,Q}}function _c1(J){return J==="windows"?1:void 0}function vc1(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=xc1[K];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(Y))}}return X!==void 0?X:J}function NB6(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+=xc1[X]}else if(Q!==void 0)Q+=J[Z]}return Q!==void 0?Q:J}function bc1(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 aQ1(J,Q){let Z=!Q?vc1:NB6,X="",{scheme:Y,authority:K,path:q,query:G,fragment:z}=J;if(Y)X+=Y,X+=":";if(K||Y==="file")X+=nK,X+=nK;if(K){let U=K.indexOf("@");if(U!==-1){let W=K.substring(0,U);if(K=K.substring(U+1),U=W.lastIndexOf(":"),U===-1)X+=Z(W,!1,!1);else X+=Z(W.substring(0,U),!1,!1),X+=":",X+=Z(W.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?vc1(z,!1,!1):z;return X}function yc1(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+yc1(J.substring(3));else return J}}function ep(J){if(!J.match(kc1))return J;return J.replace(kc1,(Q)=>yc1(Q))}function qB(J){return J.scheme==="file"}function VQ(J){return O0.parse(J)}function C6(J){return J.toString()}function B8(J){if(typeof J==="string"||J instanceof URL)return O0.parse(J.toString());return J}function tC(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var FB6,HB6,BB6,h2="",nK="/",VB6,ON,xc1,kc1;var Jd=B1(()=>{FB6=/^\w[\w\d+.-]*$/,HB6=/^\//,BB6=/^\/\//;VB6=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;ON=class ON extends O0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=bc1(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=aQ1(this,!1);return this._formatted}return aQ1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=_c1(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}};xc1={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"};kc1=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function rQ1(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 jN(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 fc1(J,Q,Z="/",X="/",Y=!0){function K(F,H){return Y?F===H:F.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,W=[];for(let F=0;F<U;F++)W.push("..");return W.push(...G.slice(z)),W.join(X)}function Qd(J){let Q=jN(J.replace(/\/+$/,"")),Z=Q.lastIndexOf(".");if(Z===0||Z===-1)return"";return Q.slice(Z)}function NQ(J){if(J=B8(J),J.scheme==="file")return J.path;return J.toString()}var gR=B1(()=>{Jd()});function LB6(J,...Q){return J=B8(J),J.with({path:hR(J.path,...Q)})}function AB6(J,...Q){let Z=J.path,X=!1;if(Z[0]!==Zd)Z=Zd+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]===Zd&&!J.authority)Y=Y.substring(1);return J.with({path:Y})}function wB6(J){if(J=B8(J),J.path.length===0||J.path===Zd)return J;let Q=rQ1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function RB6(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 OB6(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 fc1(J.path,Q.path,Z,Z)}function jB6(J,Q){let Z=C6(J),X=C6(Q);if(Z.startsWith("file:///")&&X.startsWith("file:///"))return hc1(Z)===hc1(X);return Z===X}function hc1(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Zd="/",m0;var sQ1=B1(()=>{gR();Jd();m0={joinPath:LB6,resolvePath:AB6,dirname:wB6,basename:(J)=>jN(B8(J).path),extname:(J)=>Qd(B8(J).path),hasPrefix:RB6,relativePath:OB6,equalURIs:jB6}});var x6=B1(()=>{Jd();sQ1();gR()});import $B6 from"os";import Xd from"path";var GB,$N,zB,UB,gc1,WD9,FD9,EB6,IB6;var mR=B1(()=>{GB=$B6.homedir(),{env:$N}=process,zB=$N.XDG_DATA_HOME||(GB?Xd.join(GB,".local","share"):void 0),UB=$N.XDG_CONFIG_HOME||(GB?Xd.join(GB,".config"):void 0),gc1=$N.XDG_STATE_HOME||(GB?Xd.join(GB,".local","state"):void 0),WD9=$N.XDG_CACHE_HOME||(GB?Xd.join(GB,".cache"):void 0),FD9=$N.XDG_RUNTIME_DIR||void 0,EB6=($N.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(zB)EB6.unshift(zB);IB6=($N.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(UB)IB6.unshift(UB)});import{promises as PB6}from"node:fs";import*as EN from"node:path";async function mc1(J){try{let Q=await PB6.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 uc1(J,Q){let Z=(J&73)!==0;if(process.platform==="win32"){let X=EN.extname(Q).toLowerCase();return Z||[".exe",".bat",".cmd",".ps1"].includes(X)}return Z}function pc1(J){return EN.extname(J).toLowerCase()===".md"}function dc1(J){let Q=J.replace(/\\/g,"/"),Z=EN.basename(Q);return EN.basename(Z,EN.extname(Z))}function cc1(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var lc1=()=>{};var rc1={};A6(rc1,{CommandDiscovery:()=>ac1});import*as nc1 from"node:fs";import{promises as Yd}from"node:fs";import{homedir as ic1}from"node:os";import*as VX from"node:path";function tQ1(J,Q,Z){return Promise.race([J,new Promise((X,Y)=>setTimeout(()=>Y(Error(`${Z} timed out after ${Q}ms`)),Q))])}class ac1{config;workspaceRoots;watchFactory;debounceMs;changes=new y8;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Z={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Z.watchFactory??TB6,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=m0.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=O0.file(Z),Y=await this.discoverCommandsInDirectory(X,"global");J.push(...Y)}return J}async discoverCommandsInDirectory(J,Q){try{let Z=J.fsPath;try{await tQ1(Yd.access(Z),oQ1,"directory access")}catch{return[]}let Y=(await tQ1(Yd.readdir(Z,{withFileTypes:!0}),oQ1,"directory read")).filter((q)=>q.isFile()),K=[];for(let q of Y){let G=VX.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 Yd.stat(J),Z=VX.basename(J);if(this.ignoreCommandName(Z))return null;let X=dc1(Z);if(!cc1(X))return l.warn(`Invalid command name: ${X}`,{filePath:J}),null;if(pc1(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:VX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0}}async createExecutableCommand(J,Q,Z){let X=VX.basename(J),Y=uc1(Q.mode,X),K=await mc1(J),q=VX.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:VX.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 VX.join(ic1(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=UB||VX.join(ic1(),".config");return VX.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=m0.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 tQ1(Yd.access(J),oQ1,"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 oQ1=5000,TB6=(J,Q)=>nc1.watch(J,Q);var sc1=B1(()=>{x6();I0();mR();z0();lc1()});import{homedir as Kd}from"node:os";import IN from"node:path";var tc1,SB6,ec1,vB6,qd,kB6,uR,WB,eQ1;var ZW=B1(()=>{mR();tc1=IN.join(Kd(),".local/share"),SB6=process.platform==="win32"||process.platform==="darwin"?tc1:zB??tc1,ec1=IN.join(Kd(),".config"),vB6=process.platform==="win32"||process.platform==="darwin"?ec1:UB??ec1,qd=IN.join(SB6,"amp"),kB6=IN.join(vB6,"amp"),uR=IN.join(kB6,"tools"),WB=IN.join(Kd(),".cache","amp"),eQ1=IN.join(Kd(),".cache","amp","http-debug-logs")});function NX(J,Q,Z=Q+"s"){return J===1?Q:Z}function FB(J){let Q=typeof J==="string"?J:J.toString();return Q===FZ||Q===FZ.slice(0,-1)}function dR(J){return FB(J)?FZ:J}var lB6,FZ,iB6,sD9;var HB=B1(()=>{lB6=new URL("https://ampcode.com/"),FZ=lB6.toString(),iB6=new URL("https://api.anthropic.com/"),sD9=iB6.toString()});var V9,QZ1,o0,pG=(J)=>{switch(typeof J){case"undefined":return o0.undefined;case"string":return o0.string;case"number":return Number.isNaN(J)?o0.nan:o0.number;case"boolean":return o0.boolean;case"function":return o0.function;case"bigint":return o0.bigint;case"symbol":return o0.symbol;case"object":if(Array.isArray(J))return o0.array;if(J===null)return o0.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return o0.promise;if(typeof Map<"u"&&J instanceof Map)return o0.map;if(typeof Set<"u"&&J instanceof Set)return o0.set;if(typeof Date<"u"&&J instanceof Date)return o0.date;return o0.object;default:return o0.unknown}};var JS=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}}})(QZ1||(QZ1={}));o0=V9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b0,nB6=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},HZ;var zd=B1(()=>{JS();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"]);HZ=class HZ 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 HZ))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()}};HZ.create=(J)=>{return new HZ(J)}});var aB6=(J,Q)=>{let Z;switch(J.code){case b0.invalid_type:if(J.received===o0.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}},XW;var ZZ1=B1(()=>{zd();JS();XW=aB6});function rB6(J){ql1=J}function cR(){return ql1}var ql1;var Ud=B1(()=>{ZZ1();ql1=XW});function z6(J,Q){let Z=cR(),X=QS({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Z,Z===XW?void 0:XW].filter((Y)=>!!Y)});J.common.issues.push(X)}class e5{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 D8;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 e5.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 D8;if(K.status==="aborted")return D8;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 QS=(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}},sB6,D8,PN=(J)=>({status:"dirty",value:J}),PJ=(J)=>({status:"valid",value:J}),Wd=(J)=>J.status==="aborted",Fd=(J)=>J.status==="dirty",BB=(J)=>J.status==="valid",lR=(J)=>typeof Promise<"u"&&J instanceof Promise;var XZ1=B1(()=>{Ud();ZZ1();sB6=[];D8=Object.freeze({status:"aborted"})});var Gl1=()=>{};var k6;var zl1=B1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(k6||(k6={}))});class oK{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 d8(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 Y9{get description(){return this._def.description}_getType(J){return pG(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:pG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new e5,ctx:{common:J.parent.common,data:J.data,parsedType:pG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(lR(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:pG(J)},X=this._parseSync({data:J,path:Z.path,parent:Z});return Ul1(Z,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:pG(J)};if(!this["~standard"].async)try{let Z=this._parseSync({data:J,path:[],parent:Q});return BB(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)=>BB(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:pG(J)},X=this._parse({data:J,path:Z.path,parent:Z}),Y=await(lR(X)?X:Promise.resolve(X));return Ul1(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 tK({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 sK.create(this,this._def)}nullable(){return KW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rK.create(this)}promise(){return vN.create(this,this._def)}or(J){return oR.create([this,J],this._def)}and(J){return tR.create(this,J,this._def)}transform(J){return new tK({...d8(this._def),schema:this,typeName:L8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new ZO({...d8(this._def),innerType:this,defaultValue:Q,typeName:L8.ZodDefault})}brand(){return new Bd({typeName:L8.ZodBranded,type:this,...d8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new XO({...d8(this._def),innerType:this,catchValue:Q,typeName:L8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return GS.create(this,J)}readonly(){return YO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Hl1(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 BD6(J){return new RegExp(`^${Hl1(J)}$`)}function Bl1(J){let Q=`${Fl1}T${Hl1(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 DD6(J,Q){if((Q==="v4"||!Q)&&qD6.test(J))return!0;if((Q==="v6"||!Q)&&zD6.test(J))return!0;return!1}function MD6(J,Q){if(!ZD6.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 VD6(J,Q){if((Q==="v4"||!Q)&&GD6.test(J))return!0;if((Q==="v6"||!Q)&&UD6.test(J))return!0;return!1}function ND6(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 iR(J){if(J instanceof v4){let Q={};for(let Z in J.shape){let X=J.shape[Z];Q[Z]=sK.create(iR(X))}return new v4({...J._def,shape:()=>Q})}else if(J instanceof rK)return new rK({...J._def,type:iR(J.element)});else if(J instanceof sK)return sK.create(iR(J.unwrap()));else if(J instanceof KW)return KW.create(iR(J.unwrap()));else if(J instanceof cG)return cG.create(J.items.map((Q)=>iR(Q)));else return J}function KZ1(J,Q){let Z=pG(J),X=pG(Q);if(J===Q)return{valid:!0,data:J};else if(Z===o0.object&&X===o0.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=KZ1(J[G],Q[G]);if(!z.valid)return{valid:!1};q[G]=z.data}return{valid:!0,data:q}}else if(Z===o0.array&&X===o0.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=KZ1(q,G);if(!z.valid)return{valid:!1};Y.push(z.data)}return{valid:!0,data:Y}}else if(Z===o0.date&&X===o0.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function Dl1(J,Q){return new NB({values:J,typeName:L8.ZodEnum,...d8(Q)})}function Wl1(J,Q){let Z=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Z==="string"?{message:Z}:Z}function Ml1(J,Q={},Z){if(J)return CN.create().superRefine((X,Y)=>{let K=J(X);if(K instanceof Promise)return K.then((q)=>{if(!q){let G=Wl1(Q,X),z=G.fatal??Z??!0;Y.addIssue({code:"custom",...G,fatal:z})}});if(!K){let q=Wl1(Q,X),G=q.fatal??Z??!0;Y.addIssue({code:"custom",...q,fatal:G})}return});return CN.create()}var Ul1=(J,Q)=>{if(BB(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 HZ(J.common.issues);return this._error=Z,this._error}}}},oB6,tB6,eB6,JD6,QD6,ZD6,XD6,YD6,KD6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",YZ1,qD6,GD6,zD6,UD6,WD6,FD6,Fl1="((\\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])))",HD6,aK,MB,VB,aR,TN,ZS,rR,sR,CN,DB,dG,XS,rK,v4,oR,YW=(J)=>{if(J instanceof eR)return YW(J.schema);else if(J instanceof tK)return YW(J.innerType());else if(J instanceof JO)return[J.value];else if(J instanceof NB)return J.options;else if(J instanceof QO)return V9.objectValues(J.enum);else if(J instanceof ZO)return YW(J._def.innerType);else if(J instanceof rR)return[void 0];else if(J instanceof sR)return[null];else if(J instanceof sK)return[void 0,...YW(J.unwrap())];else if(J instanceof KW)return[null,...YW(J.unwrap())];else if(J instanceof Bd)return YW(J.unwrap());else if(J instanceof YO)return YW(J.unwrap());else if(J instanceof XO)return YW(J._def.innerType);else return[]},Hd,tR,cG,YS,KS,SN,nR,eR,JO,NB,QO,vN,tK,sK,KW,ZO,XO,qS,LD6,Bd,GS,YO,AD6,L8,wD6=(J,Q={message:`Input not instance of ${J.name}`})=>Ml1((Z)=>Z instanceof J,Q),Vl1,Nl1,RD6,OD6,Ll1,jD6,$D6,ED6,ID6,PD6,TD6,CD6,SD6,vD6,kD6,_D6,xD6,bD6,yD6,fD6,hD6,gD6,mD6,uD6,pD6,dD6,cD6,lD6,iD6,nD6,aD6,rD6,sD6,oD6,tD6=()=>Vl1().optional(),eD6=()=>Nl1().optional(),JM6=()=>Ll1().optional(),QM6,ZM6;var Al1=B1(()=>{zd();Ud();zl1();XZ1();JS();oB6=/^c[^\s-]{8,}$/i,tB6=/^[0-9a-z]+$/,eB6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JD6=/^[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,QD6=/^[a-z0-9_-]{21}$/i,ZD6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,XD6=/^[-+]?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)?)??$/,YD6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qD6=/^(?:(?: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])$/,GD6=/^(?:(?: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])$/,zD6=/^(([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]))$/,UD6=/^(([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])$/,WD6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,FD6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,HD6=new RegExp(`^${Fl1}$`);aK=class aK extends Y9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==o0.string){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.string,received:Y.parsedType}),D8}let Z=new e5,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),z6(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),z6(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)z6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(q)z6(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(!YD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"email",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="emoji"){if(!YZ1)YZ1=new RegExp(KD6,"u");if(!YZ1.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"emoji",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="uuid"){if(!JD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"uuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="nanoid"){if(!QD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"nanoid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid"){if(!oB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid2"){if(!tB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cuid2",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ulid"){if(!eB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(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),z6(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),z6(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),z6(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),z6(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),z6(X,{code:b0.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="datetime"){if(!Bl1(Y).test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"datetime",message:Y.message}),Z.dirty()}else if(Y.kind==="date"){if(!HD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"date",message:Y.message}),Z.dirty()}else if(Y.kind==="time"){if(!BD6(Y).test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"time",message:Y.message}),Z.dirty()}else if(Y.kind==="duration"){if(!XD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"duration",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ip"){if(!DD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),z6(X,{validation:"ip",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="jwt"){if(!MD6(J.data,Y.alg))X=this._getOrReturnCtx(J,X),z6(X,{validation:"jwt",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cidr"){if(!VD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cidr",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64"){if(!WD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"base64",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64url"){if(!FD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(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 aK({...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 aK({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aK({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aK({...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}};aK.create=(J)=>{return new aK({checks:[],typeName:L8.ZodString,coerce:J?.coerce??!1,...d8(J)})};MB=class MB extends Y9{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)!==o0.number){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.number,received:Y.parsedType}),D8}let Z=void 0,X=new e5;for(let Y of this._def.checks)if(Y.kind==="int"){if(!V9.isInteger(J.data))Z=this._getOrReturnCtx(J,Z),z6(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),z6(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),z6(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(ND6(J.data,Y.value)!==0)Z=this._getOrReturnCtx(J,Z),z6(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),z6(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 MB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new MB({...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)}};MB.create=(J)=>{return new MB({checks:[],typeName:L8.ZodNumber,coerce:J?.coerce||!1,...d8(J)})};VB=class VB extends Y9{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)!==o0.bigint)return this._getInvalidInput(J);let Z=void 0,X=new e5;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),z6(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),z6(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),z6(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 z6(Q,{code:b0.invalid_type,expected:o0.bigint,received:Q.parsedType}),D8}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 VB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new VB({...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}};VB.create=(J)=>{return new VB({checks:[],typeName:L8.ZodBigInt,coerce:J?.coerce??!1,...d8(J)})};aR=class aR extends Y9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==o0.boolean){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.boolean,received:Z.parsedType}),D8}return PJ(J.data)}};aR.create=(J)=>{return new aR({typeName:L8.ZodBoolean,coerce:J?.coerce||!1,...d8(J)})};TN=class TN extends Y9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==o0.date){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.date,received:Y.parsedType}),D8}if(Number.isNaN(J.data.getTime())){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_date}),D8}let Z=new e5,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),z6(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),z6(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 TN({...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}};TN.create=(J)=>{return new TN({checks:[],coerce:J?.coerce||!1,typeName:L8.ZodDate,...d8(J)})};ZS=class ZS extends Y9{_parse(J){if(this._getType(J)!==o0.symbol){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.symbol,received:Z.parsedType}),D8}return PJ(J.data)}};ZS.create=(J)=>{return new ZS({typeName:L8.ZodSymbol,...d8(J)})};rR=class rR extends Y9{_parse(J){if(this._getType(J)!==o0.undefined){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.undefined,received:Z.parsedType}),D8}return PJ(J.data)}};rR.create=(J)=>{return new rR({typeName:L8.ZodUndefined,...d8(J)})};sR=class sR extends Y9{_parse(J){if(this._getType(J)!==o0.null){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.null,received:Z.parsedType}),D8}return PJ(J.data)}};sR.create=(J)=>{return new sR({typeName:L8.ZodNull,...d8(J)})};CN=class CN extends Y9{constructor(){super(...arguments);this._any=!0}_parse(J){return PJ(J.data)}};CN.create=(J)=>{return new CN({typeName:L8.ZodAny,...d8(J)})};DB=class DB extends Y9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return PJ(J.data)}};DB.create=(J)=>{return new DB({typeName:L8.ZodUnknown,...d8(J)})};dG=class dG extends Y9{_parse(J){let Q=this._getOrReturnCtx(J);return z6(Q,{code:b0.invalid_type,expected:o0.never,received:Q.parsedType}),D8}};dG.create=(J)=>{return new dG({typeName:L8.ZodNever,...d8(J)})};XS=class XS extends Y9{_parse(J){if(this._getType(J)!==o0.undefined){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.void,received:Z.parsedType}),D8}return PJ(J.data)}};XS.create=(J)=>{return new XS({typeName:L8.ZodVoid,...d8(J)})};rK=class rK extends Y9{_parse(J){let{ctx:Q,status:Z}=this._processInputParams(J),X=this._def;if(Q.parsedType!==o0.array)return z6(Q,{code:b0.invalid_type,expected:o0.array,received:Q.parsedType}),D8;if(X.exactLength!==null){let K=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(K||q)z6(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)z6(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)z6(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 oK(Q,K,Q.path,q))})).then((K)=>{return e5.mergeArray(Z,K)});let Y=[...Q.data].map((K,q)=>{return X.type._parseSync(new oK(Q,K,Q.path,q))});return e5.mergeArray(Z,Y)}get element(){return this._def.type}min(J,Q){return new rK({...this._def,minLength:{value:J,message:k6.toString(Q)}})}max(J,Q){return new rK({...this._def,maxLength:{value:J,message:k6.toString(Q)}})}length(J,Q){return new rK({...this._def,exactLength:{value:J,message:k6.toString(Q)}})}nonempty(J){return this.min(1,J)}};rK.create=(J,Q)=>{return new rK({type:J,minLength:null,maxLength:null,exactLength:null,typeName:L8.ZodArray,...d8(Q)})};v4=class v4 extends Y9{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)!==o0.object){let z=this._getOrReturnCtx(J);return z6(z,{code:b0.invalid_type,expected:o0.object,received:z.parsedType}),D8}let{status:Z,ctx:X}=this._processInputParams(J),{shape:Y,keys:K}=this._getCached(),q=[];if(!(this._def.catchall instanceof dG&&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],W=X.data[z];G.push({key:{status:"valid",value:z},value:U._parse(new oK(X,W,X.path,z)),alwaysSet:z in X.data})}if(this._def.catchall instanceof dG){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)z6(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 W=X.data[U];G.push({key:{status:"valid",value:U},value:z._parse(new oK(X,W,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 W=await U.key,F=await U.value;z.push({key:W,value:F,alwaysSet:U.alwaysSet})}return z}).then((z)=>{return e5.mergeObjectSync(Z,z)});else return e5.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 iR(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 sK)Y=Y._def.innerType;Q[Z]=Y}return new v4({...this._def,shape:()=>Q})}keyof(){return Dl1(V9.objectKeys(this.shape))}};v4.create=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strip",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};v4.strictCreate=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strict",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};v4.lazycreate=(J,Q)=>{return new v4({shape:J,unknownKeys:"strip",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};oR=class oR extends Y9{_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 HZ(q.ctx.common.issues));return z6(Q,{code:b0.invalid_union,unionErrors:K}),D8}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 HZ(G));return z6(Q,{code:b0.invalid_union,unionErrors:q}),D8}}get options(){return this._def.options}};oR.create=(J,Q)=>{return new oR({options:J,typeName:L8.ZodUnion,...d8(Q)})};Hd=class Hd extends Y9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.object)return z6(Q,{code:b0.invalid_type,expected:o0.object,received:Q.parsedType}),D8;let Z=this.discriminator,X=Q.data[Z],Y=this.optionsMap.get(X);if(!Y)return z6(Q,{code:b0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Z]}),D8;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=YW(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 Hd({typeName:L8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...d8(Z)})}};tR=class tR extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=(Y,K)=>{if(Wd(Y)||Wd(K))return D8;let q=KZ1(Y.value,K.value);if(!q.valid)return z6(Z,{code:b0.invalid_intersection_types}),D8;if(Fd(Y)||Fd(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}))}};tR.create=(J,Q,Z)=>{return new tR({left:J,right:Q,typeName:L8.ZodIntersection,...d8(Z)})};cG=class cG extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==o0.array)return z6(Z,{code:b0.invalid_type,expected:o0.array,received:Z.parsedType}),D8;if(Z.data.length<this._def.items.length)return z6(Z,{code:b0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),D8;if(!this._def.rest&&Z.data.length>this._def.items.length)z6(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 oK(Z,K,Z.path,q))}).filter((K)=>!!K);if(Z.common.async)return Promise.all(Y).then((K)=>{return e5.mergeArray(Q,K)});else return e5.mergeArray(Q,Y)}get items(){return this._def.items}rest(J){return new cG({...this._def,rest:J})}};cG.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new cG({items:J,typeName:L8.ZodTuple,rest:null,...d8(Q)})};YS=class YS extends Y9{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!==o0.object)return z6(Z,{code:b0.invalid_type,expected:o0.object,received:Z.parsedType}),D8;let X=[],Y=this._def.keyType,K=this._def.valueType;for(let q in Z.data)X.push({key:Y._parse(new oK(Z,q,Z.path,q)),value:K._parse(new oK(Z,Z.data[q],Z.path,q)),alwaysSet:q in Z.data});if(Z.common.async)return e5.mergeObjectAsync(Q,X);else return e5.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Z){if(Q instanceof Y9)return new YS({keyType:J,valueType:Q,typeName:L8.ZodRecord,...d8(Z)});return new YS({keyType:aK.create(),valueType:J,typeName:L8.ZodRecord,...d8(Q)})}};KS=class KS extends Y9{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!==o0.map)return z6(Z,{code:b0.invalid_type,expected:o0.map,received:Z.parsedType}),D8;let X=this._def.keyType,Y=this._def.valueType,K=[...Z.data.entries()].map(([q,G],z)=>{return{key:X._parse(new oK(Z,q,Z.path,[z,"key"])),value:Y._parse(new oK(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 D8;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 D8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}}}};KS.create=(J,Q,Z)=>{return new KS({valueType:Q,keyType:J,typeName:L8.ZodMap,...d8(Z)})};SN=class SN extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==o0.set)return z6(Z,{code:b0.invalid_type,expected:o0.set,received:Z.parsedType}),D8;let X=this._def;if(X.minSize!==null){if(Z.data.size<X.minSize.value)z6(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)z6(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 D8;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 oK(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 SN({...this._def,minSize:{value:J,message:k6.toString(Q)}})}max(J,Q){return new SN({...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)}};SN.create=(J,Q)=>{return new SN({valueType:J,minSize:null,maxSize:null,typeName:L8.ZodSet,...d8(Q)})};nR=class nR extends Y9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.function)return z6(Q,{code:b0.invalid_type,expected:o0.function,received:Q.parsedType}),D8;function Z(q,G){return QS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,cR(),XW].filter((z)=>!!z),issueData:{code:b0.invalid_arguments,argumentsError:G}})}function X(q,G){return QS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,cR(),XW].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 vN){let q=this;return PJ(async function(...G){let z=new HZ([]),U=await q._def.args.parseAsync(G,Y).catch((H)=>{throw z.addIssue(Z(G,H)),z}),W=await Reflect.apply(K,this,U);return await q._def.returns._def.type.parseAsync(W,Y).catch((H)=>{throw z.addIssue(X(W,H)),z})})}else{let q=this;return PJ(function(...G){let z=q._def.args.safeParse(G,Y);if(!z.success)throw new HZ([Z(G,z.error)]);let U=Reflect.apply(K,this,z.data),W=q._def.returns.safeParse(U,Y);if(!W.success)throw new HZ([X(U,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new nR({...this._def,args:cG.create(J).rest(DB.create())})}returns(J){return new nR({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Z){return new nR({args:J?J:cG.create([]).rest(DB.create()),returns:Q||DB.create(),typeName:L8.ZodFunction,...d8(Z)})}};eR=class eR extends Y9{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})}};eR.create=(J,Q)=>{return new eR({getter:J,typeName:L8.ZodLazy,...d8(Q)})};JO=class JO extends Y9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return z6(Q,{received:Q.data,code:b0.invalid_literal,expected:this._def.value}),D8}return{status:"valid",value:J.data}}get value(){return this._def.value}};JO.create=(J,Q)=>{return new JO({value:J,typeName:L8.ZodLiteral,...d8(Q)})};NB=class NB extends Y9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Z=this._def.values;return z6(Q,{expected:V9.joinValues(Z),received:Q.parsedType,code:b0.invalid_type}),D8}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 z6(Q,{received:Q.data,code:b0.invalid_enum_value,options:Z}),D8}return PJ(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 NB.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return NB.create(this.options.filter((Z)=>!J.includes(Z)),{...this._def,...Q})}};NB.create=Dl1;QO=class QO extends Y9{_parse(J){let Q=V9.getValidEnumValues(this._def.values),Z=this._getOrReturnCtx(J);if(Z.parsedType!==o0.string&&Z.parsedType!==o0.number){let X=V9.objectValues(Q);return z6(Z,{expected:V9.joinValues(X),received:Z.parsedType,code:b0.invalid_type}),D8}if(!this._cache)this._cache=new Set(V9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=V9.objectValues(Q);return z6(Z,{received:Z.data,code:b0.invalid_enum_value,options:X}),D8}return PJ(J.data)}get enum(){return this._def.values}};QO.create=(J,Q)=>{return new QO({values:J,typeName:L8.ZodNativeEnum,...d8(Q)})};vN=class vN extends Y9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.promise&&Q.common.async===!1)return z6(Q,{code:b0.invalid_type,expected:o0.promise,received:Q.parsedType}),D8;let Z=Q.parsedType===o0.promise?Q.data:Promise.resolve(Q.data);return PJ(Z.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};vN.create=(J,Q)=>{return new vN({type:J,typeName:L8.ZodPromise,...d8(Q)})};tK=class tK extends Y9{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(z6(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 D8;let G=await this._def.schema._parseAsync({data:q,path:Z.path,parent:Z});if(G.status==="aborted")return D8;if(G.status==="dirty")return PN(G.value);if(Q.value==="dirty")return PN(G.value);return G});else{if(Q.value==="aborted")return D8;let q=this._def.schema._parseSync({data:K,path:Z.path,parent:Z});if(q.status==="aborted")return D8;if(q.status==="dirty")return PN(q.value);if(Q.value==="dirty")return PN(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 D8;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 D8;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(!BB(K))return D8;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(!BB(K))return D8;return Promise.resolve(X.transform(K.value,Y)).then((q)=>({status:Q.value,value:q}))});V9.assertNever(X)}};tK.create=(J,Q,Z)=>{return new tK({schema:J,typeName:L8.ZodEffects,effect:Q,...d8(Z)})};tK.createWithPreprocess=(J,Q,Z)=>{return new tK({schema:Q,effect:{type:"preprocess",transform:J},typeName:L8.ZodEffects,...d8(Z)})};sK=class sK extends Y9{_parse(J){if(this._getType(J)===o0.undefined)return PJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};sK.create=(J,Q)=>{return new sK({innerType:J,typeName:L8.ZodOptional,...d8(Q)})};KW=class KW extends Y9{_parse(J){if(this._getType(J)===o0.null)return PJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};KW.create=(J,Q)=>{return new KW({innerType:J,typeName:L8.ZodNullable,...d8(Q)})};ZO=class ZO extends Y9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;if(Q.parsedType===o0.undefined)Z=this._def.defaultValue();return this._def.innerType._parse({data:Z,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};ZO.create=(J,Q)=>{return new ZO({innerType:J,typeName:L8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...d8(Q)})};XO=class XO extends Y9{_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(lR(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new HZ(Z.common.issues)},input:Z.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new HZ(Z.common.issues)},input:Z.data})}}removeCatch(){return this._def.innerType}};XO.create=(J,Q)=>{return new XO({innerType:J,typeName:L8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...d8(Q)})};qS=class qS extends Y9{_parse(J){if(this._getType(J)!==o0.nan){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.nan,received:Z.parsedType}),D8}return{status:"valid",value:J.data}}};qS.create=(J)=>{return new qS({typeName:L8.ZodNaN,...d8(J)})};LD6=Symbol("zod_brand");Bd=class Bd extends Y9{_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}};GS=class GS extends Y9{_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 D8;if(Y.status==="dirty")return Q.dirty(),PN(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 D8;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 GS({in:J,out:Q,typeName:L8.ZodPipeline})}};YO=class YO extends Y9{_parse(J){let Q=this._def.innerType._parse(J),Z=(X)=>{if(BB(X))X.value=Object.freeze(X.value);return X};return lR(Q)?Q.then((X)=>Z(X)):Z(Q)}unwrap(){return this._def.innerType}};YO.create=(J,Q)=>{return new YO({innerType:J,typeName:L8.ZodReadonly,...d8(Q)})};AD6={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={}));Vl1=aK.create,Nl1=MB.create,RD6=qS.create,OD6=VB.create,Ll1=aR.create,jD6=TN.create,$D6=ZS.create,ED6=rR.create,ID6=sR.create,PD6=CN.create,TD6=DB.create,CD6=dG.create,SD6=XS.create,vD6=rK.create,kD6=v4.create,_D6=v4.strictCreate,xD6=oR.create,bD6=Hd.create,yD6=tR.create,fD6=cG.create,hD6=YS.create,gD6=KS.create,mD6=SN.create,uD6=nR.create,pD6=eR.create,dD6=JO.create,cD6=NB.create,lD6=QO.create,iD6=vN.create,nD6=tK.create,aD6=sK.create,rD6=KW.create,sD6=tK.createWithPreprocess,oD6=GS.create,QM6={string:(J)=>aK.create({...J,coerce:!0}),number:(J)=>MB.create({...J,coerce:!0}),boolean:(J)=>aR.create({...J,coerce:!0}),bigint:(J)=>VB.create({...J,coerce:!0}),date:(J)=>TN.create({...J,coerce:!0})},ZM6=D8});var Q1={};A6(Q1,{void:()=>SD6,util:()=>V9,unknown:()=>TD6,union:()=>xD6,undefined:()=>ED6,tuple:()=>fD6,transformer:()=>nD6,symbol:()=>$D6,string:()=>Vl1,strictObject:()=>_D6,setErrorMap:()=>rB6,set:()=>mD6,record:()=>hD6,quotelessJson:()=>nB6,promise:()=>iD6,preprocess:()=>sD6,pipeline:()=>oD6,ostring:()=>tD6,optional:()=>aD6,onumber:()=>eD6,oboolean:()=>JM6,objectUtil:()=>QZ1,object:()=>kD6,number:()=>Nl1,nullable:()=>rD6,null:()=>ID6,never:()=>CD6,nativeEnum:()=>lD6,nan:()=>RD6,map:()=>gD6,makeIssue:()=>QS,literal:()=>dD6,lazy:()=>pD6,late:()=>AD6,isValid:()=>BB,isDirty:()=>Fd,isAsync:()=>lR,isAborted:()=>Wd,intersection:()=>yD6,instanceof:()=>wD6,getParsedType:()=>pG,getErrorMap:()=>cR,function:()=>uD6,enum:()=>cD6,effect:()=>nD6,discriminatedUnion:()=>bD6,defaultErrorMap:()=>XW,datetimeRegex:()=>Bl1,date:()=>jD6,custom:()=>Ml1,coerce:()=>QM6,boolean:()=>Ll1,bigint:()=>OD6,array:()=>vD6,any:()=>PD6,addIssueToContext:()=>z6,ZodVoid:()=>XS,ZodUnknown:()=>DB,ZodUnion:()=>oR,ZodUndefined:()=>rR,ZodType:()=>Y9,ZodTuple:()=>cG,ZodTransformer:()=>tK,ZodSymbol:()=>ZS,ZodString:()=>aK,ZodSet:()=>SN,ZodSchema:()=>Y9,ZodRecord:()=>YS,ZodReadonly:()=>YO,ZodPromise:()=>vN,ZodPipeline:()=>GS,ZodParsedType:()=>o0,ZodOptional:()=>sK,ZodObject:()=>v4,ZodNumber:()=>MB,ZodNullable:()=>KW,ZodNull:()=>sR,ZodNever:()=>dG,ZodNativeEnum:()=>QO,ZodNaN:()=>qS,ZodMap:()=>KS,ZodLiteral:()=>JO,ZodLazy:()=>eR,ZodIssueCode:()=>b0,ZodIntersection:()=>tR,ZodFunction:()=>nR,ZodFirstPartyTypeKind:()=>L8,ZodError:()=>HZ,ZodEnum:()=>NB,ZodEffects:()=>tK,ZodDiscriminatedUnion:()=>Hd,ZodDefault:()=>ZO,ZodDate:()=>TN,ZodCatch:()=>XO,ZodBranded:()=>Bd,ZodBoolean:()=>aR,ZodBigInt:()=>VB,ZodArray:()=>rK,ZodAny:()=>CN,Schema:()=>Y9,ParseStatus:()=>e5,OK:()=>PJ,NEVER:()=>ZM6,INVALID:()=>D8,EMPTY_PATH:()=>sB6,DIRTY:()=>PN,BRAND:()=>LD6});var qZ1=B1(()=>{Ud();XZ1();Gl1();JS();Al1();zd()});var qW=B1(()=>{qZ1();qZ1()});function YM6(J){return wl1.safeParse(J)}function LB(J){return XM6.safeParse(J)}function KO(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Z,X]of J.entries()){let Y=YM6(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 GZ1,wl1,XM6;var kN=B1(()=>{qW();z0();GZ1=Q1.lazy(()=>Q1.union([Q1.string().describe('Pattern match where "*" matches any number of any characters'),Q1.array(GZ1).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(),GZ1).describe("Matching individual keys of an object")])),wl1=Q1.object({tool:Q1.string().min(1).describe("The name of the tool to which this entry applies"),matches:Q1.record(Q1.string(),GZ1).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"]})}),XM6=Q1.array(wl1).describe("Entries checked in sequence to configure tool permissions")});function BZ(J,Q){let Z=KM6(J,Q);return typeof Z==="string"?Z:Z.toString()}function KM6(J,Q,Z=!0){if(!Q)Q=qM6();let{workspaceFolders:X,isWindows:Y,homeDir:K}=Q,q=typeof J==="string"?O0.parse(J):O0.from(J);if(X)for(let G of X){let z=B8(G);if(m0.hasPrefix(q,z)){let U=z.path.endsWith("/")?z.path.slice(0,-1):z.path,F=Z&&X&&X.length>=2?jN(z.path)+(Y?"\\":"/"):"";return zZ1(F+q.path.slice(U.length+1),Y,q.scheme)}}if(q?.scheme==="file"){if(K){let G=B8(K);if(m0.hasPrefix(q,G)){let z=G.path.endsWith("/")?G.path.slice(0,-1):G.path,U=q.path.slice(z.length+1);return zZ1("~"+(Y?"\\":"/")+U,Y,q.scheme)}}return zZ1(q.fsPath,Y,q.scheme)}return q}function zZ1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function Md(J){let Q=Dd;return Dd=J,Q}function qM6(){if(Dd)return Dd;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Dd=null;var AB=B1(()=>{x6();gR();sQ1()});function TJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function bN(J){return!!J&&!!J[LX]}function wB(J){if(!J)return!1;return El1(J)||Array.isArray(J)||!!J[zS]||!!J.constructor?.[zS]||BS(J)||DS(J)}function El1(J){if(!J||typeof J!=="object")return!1;let Q=xN(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)===GM6}function US(J,Q){if(yN(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,X)=>Q(X,Z,J))}function yN(J){let Q=J[LX];return Q?Q.type_:Array.isArray(J)?1:BS(J)?2:DS(J)?3:0}function WS(J,Q){return yN(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function UZ1(J,Q){return yN(J)===2?J.get(Q):J[Q]}function Il1(J,Q,Z){let X=yN(J);if(X===2)J.set(Q,Z);else if(X===3)J.add(Z);else J[Q]=Z}function zM6(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function BS(J){return J instanceof Map}function DS(J){return J instanceof Set}function _N(J){return J.copy_||J.base_}function HZ1(J,Q){if(BS(J))return new Map(J);if(DS(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=El1(J);if(Q===!0||Q==="class_only"&&!Z){let X=Object.getOwnPropertyDescriptors(J);delete X[LX];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(xN(J),X)}else{let X=xN(J);if(X!==null&&Z)return{...J};let Y=Object.create(X);return Object.assign(Y,J)}}function LQ(J,Q=!1){if(Ld(J)||bN(J)||!wB(J))return J;if(yN(J)>1)J.set=J.add=J.clear=J.delete=UM6;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,X])=>LQ(X,!0));return J}function UM6(){TJ(2)}function Ld(J){return Object.isFrozen(J)}function fN(J){let Q=BZ1[J];if(!Q)TJ(0,J);return Q}function WM6(J,Q){if(!BZ1[J])BZ1[J]=Q}function Pl1(){return FS}function FM6(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rl1(J,Q){if(Q)fN("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function DZ1(J){MZ1(J),J.drafts_.forEach(HM6),J.drafts_=null}function MZ1(J){if(J===FS)FS=J.parent_}function Ol1(J){return FS=FM6(FS,J)}function HM6(J){let Q=J[LX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function jl1(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[LX].modified_)DZ1(Q),TJ(4);if(wB(J)){if(J=Vd(Q,J),!Q.parent_)Nd(Q,J)}if(Q.patches_)fN("Patches").generateReplacementPatches_(Z[LX].base_,J,Q.patches_,Q.inversePatches_)}else J=Vd(Q,Z,[]);if(DZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==LZ1?J:void 0}function Vd(J,Q,Z){if(Ld(Q))return Q;let X=Q[LX];if(!X)return US(Q,(Y,K)=>$l1(J,X,Q,Y,K,Z)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Nd(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(US(K,(G,z)=>$l1(J,X,Y,G,z,Z,q)),Nd(J,Y,!1),Z&&J.patches_)fN("Patches").generatePatches_(X,Z,J.patches_,J.inversePatches_)}return X.copy_}function $l1(J,Q,Z,X,Y,K,q){if(bN(Y)){let G=K&&Q&&Q.type_!==3&&!WS(Q.assigned_,X)?K.concat(X):void 0,z=Vd(J,Y,G);if(Il1(Z,X,z),bN(z))J.canAutoFreeze_=!1;else return}else if(q)Z.add(Y);if(wB(Y)&&!Ld(Y)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Vd(J,Y),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,X))Nd(J,Y)}}function Nd(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)LQ(Q,Z)}function BM6(J,Q){let Z=Array.isArray(J),X={type_:Z?1:0,scope_:Q?Q.scope_:Pl1(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=X,K=AZ1;if(Z)Y=[X],K=HS;let{revoke:q,proxy:G}=Proxy.revocable(Y,K);return X.draft_=G,X.revoke_=q,G}function WZ1(J,Q){let Z=J[LX];return(Z?_N(Z):J)[Q]}function DM6(J,Q,Z){let X=Tl1(Q,Z);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function Tl1(J,Q){if(!(Q in J))return;let Z=xN(J);while(Z){let X=Object.getOwnPropertyDescriptor(Z,Q);if(X)return X;Z=xN(Z)}return}function VZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)VZ1(J.parent_)}}function FZ1(J){if(!J.copy_)J.copy_=HZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function NZ1(J,Q){let Z=BS(J)?fN("MapSet").proxyMap_(J,Q):DS(J)?fN("MapSet").proxySet_(J,Q):BM6(J,Q);return(Q?Q.scope_:Pl1()).drafts_.push(Z),Z}function VM6(J){if(!bN(J))TJ(10,J);return Cl1(J)}function Cl1(J){if(!wB(J)||Ld(J))return J;let Q=J[LX],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=HZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=HZ1(J,!0);if(US(Z,(X,Y)=>{Il1(Z,X,Cl1(Y))}),Q)Q.finalized_=!1;return Z}function Ad(){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:F(A[w])}),V.push({op:Q,path:R,value:F(N[w])})}for(let w=N.length;w<A.length;w++){let R=B.concat([w]);M.push({op:Z,path:R,value:F(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;US(H.assigned_,(A,w)=>{let R=UZ1(N,A),O=UZ1(L,A),j=!w?X:WS(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:F(R)}:{op:Q,path:$,value:F(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===LZ1?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=yN(L),$=V[O];if(typeof $!=="string"&&typeof $!=="number")$=""+$;if((j===0||j===1)&&($==="__proto__"||$==="constructor"))TJ(19);if(typeof L==="function"&&$==="prototype")TJ(19);if(L=UZ1(L,$),typeof L!=="object")TJ(18,V.join("/"))}let A=yN(L),w=W(M.value),R=V[V.length-1];switch(N){case Q:switch(A){case 2:return L.set(R,w);case 3:TJ(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:TJ(17,N)}}),H}function W(H){if(!wB(H))return H;if(Array.isArray(H))return H.map(W);if(BS(H))return new Map(Array.from(H.entries()).map(([M,V])=>[M,W(V)]));if(DS(H))return new Set(Array.from(H).map(W));let B=Object.create(xN(H));for(let M in H)B[M]=W(H[M]);if(WS(H,zS))B[zS]=H[zS];return B}function F(H){if(bN(H))return W(H);else return H}WM6("Patches",{applyPatches_:U,generatePatches_:Y,generateReplacementPatches_:z})}function a8(J){return J}var LZ1,zS,LX,xN,GM6,BZ1,FS,AZ1,HS,MM6=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,(W)=>Z.call(this,W,...U))}}if(typeof Z!=="function")TJ(6);if(X!==void 0&&typeof X!=="function")TJ(7);let Y;if(wB(Q)){let K=Ol1(this),q=NZ1(Q,void 0),G=!0;try{Y=Z(q),G=!1}finally{if(G)DZ1(K);else MZ1(K)}return Rl1(K,X),jl1(Y,K)}else if(!Q||typeof Q!=="object"){if(Y=Z(Q),Y===void 0)Y=Q;if(Y===LZ1)Y=void 0;if(this.autoFreeze_)LQ(Y,!0);if(X){let K=[],q=[];fN("Patches").generateReplacementPatches_(Q,Y,K,q),X(K,q)}return Y}else TJ(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(!wB(J))TJ(8);if(bN(J))J=VM6(J);let Q=Ol1(this),Z=NZ1(J,void 0);return Z[LX].isManual_=!0,MZ1(Q),Z}finishDraft(J,Q){let Z=J&&J[LX];if(!Z||!Z.isManual_)TJ(9);let{scope_:X}=Z;return Rl1(X,Q),jl1(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=fN("Patches").applyPatches_;if(bN(J))return X(J,Q);return this.produce(J,(Y)=>X(Y,Q))}},AX,wd,wZ1,_M9,xM9,Sl1,bM9,yM9;var AQ=B1(()=>{LZ1=Symbol.for("immer-nothing"),zS=Symbol.for("immer-draftable"),LX=Symbol.for("immer-state");xN=Object.getPrototypeOf;GM6=Object.prototype.constructor.toString();BZ1={};AZ1={get(J,Q){if(Q===LX)return J;let Z=_N(J);if(!WS(Z,Q))return DM6(J,Z,Q);let X=Z[Q];if(J.finalized_||!wB(X))return X;if(X===WZ1(J.base_,Q))return FZ1(J),J.copy_[Q]=NZ1(X,J);return X},has(J,Q){return Q in _N(J)},ownKeys(J){return Reflect.ownKeys(_N(J))},set(J,Q,Z){let X=Tl1(_N(J),Q);if(X?.set)return X.set.call(J.draft_,Z),!0;if(!J.modified_){let Y=WZ1(_N(J),Q),K=Y?.[LX];if(K&&K.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(zM6(Z,Y)&&(Z!==void 0||WS(J.base_,Q)))return!0;FZ1(J),VZ1(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(WZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,FZ1(J),VZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=_N(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(){TJ(11)},getPrototypeOf(J){return xN(J.base_)},setPrototypeOf(){TJ(12)}},HS={};US(AZ1,(J,Q)=>{HS[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});HS.deleteProperty=function(J,Q){return HS.set.call(this,J,Q,void 0)};HS.set=function(J,Q,Z){return AZ1.set.call(this,J[0],Q,Z,J[0])};AX=new MM6,wd=AX.produce,wZ1=AX.produceWithPatches.bind(AX),_M9=AX.setAutoFreeze.bind(AX),xM9=AX.setUseStrictShallowCopy.bind(AX),Sl1=AX.applyPatches.bind(AX),bM9=AX.createDraft.bind(AX),yM9=AX.finishDraft.bind(AX)});function RZ1({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 MS(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(NM6,"")}var NM6;var OZ1=B1(()=>{NM6=RZ1()});var kl1=a((pM9,vl1)=>{vl1.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 _l1="run_terminal_command",xl1="read_file",C5="Task",bl1="chat_llm",z7="finder",RB="fast_finder",lG="xai_finder",iG="kimiK2_finder",OB="gossip_finder",jB="sonoma_finder",GW="get_diagnostics",z4="Bash",JJ="oracle",VS="mermaid",$B="todo_read",QJ="todo_write",nG="read_web_page",yl1="run_javascript",CJ="create_file",aG="glob",fl1="Glob",Rd="undo_edit",Od="read_mcp_resource",t8="Read",SJ="edit_file",jd="format_file",qO="web_search",U4="Grep",NS="Check",hN="librarian",$d="read_github",Ed="search_github",Id="commit_search",Pd="list_directory_github",Td="list_repositories",Cd="glob_github",Sd="diff",hl1;var A8=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 LS=a((cM9,ml1)=>{var gl1={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:"/"},LM6={...gl1,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:"\\"},AM6={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"};ml1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:AM6,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?LM6:gl1}}});var AS=a(($M6)=>{var{REGEX_BACKSLASH:wM6,REGEX_REMOVE_BACKSLASH:RM6,REGEX_SPECIAL_CHARS:OM6,REGEX_SPECIAL_CHARS_GLOBAL:jM6}=LS();$M6.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);$M6.hasRegexChars=(J)=>OM6.test(J);$M6.isRegexChar=(J)=>J.length===1&&$M6.hasRegexChars(J);$M6.escapeRegex=(J)=>J.replace(jM6,"\\$1");$M6.toPosixSlashes=(J)=>J.replace(wM6,"/");$M6.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};$M6.removeBackslashes=(J)=>{return J.replace(RM6,(Q)=>{return Q==="\\"?"":Q})};$M6.escapeLast=(J,Q,Z)=>{let X=J.lastIndexOf(Q,Z);if(X===-1)return J;if(J[X-1]==="\\")return $M6.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};$M6.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};$M6.wrapOutput=(J,Q={},Z={})=>{let X=Z.contains?"":"^",Y=Z.contains?"":"$",K=`${X}(?:${J})${Y}`;if(Q.negated===!0)K=`(?:^(?!${K}).*$)`;return K};$M6.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),X=Z[Z.length-1];if(X==="")return Z[Z.length-2];return X}});var sl1=a((iM9,rl1)=>{var dl1=AS(),{CHAR_ASTERISK:jZ1,CHAR_AT:xM6,CHAR_BACKWARD_SLASH:wS,CHAR_COMMA:bM6,CHAR_DOT:$Z1,CHAR_EXCLAMATION_MARK:EZ1,CHAR_FORWARD_SLASH:al1,CHAR_LEFT_CURLY_BRACE:IZ1,CHAR_LEFT_PARENTHESES:PZ1,CHAR_LEFT_SQUARE_BRACKET:yM6,CHAR_PLUS:fM6,CHAR_QUESTION_MARK:cl1,CHAR_RIGHT_CURLY_BRACE:hM6,CHAR_RIGHT_PARENTHESES:ll1,CHAR_RIGHT_SQUARE_BRACKET:gM6}=LS(),il1=(J)=>{return J===al1||J===wS},nl1=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},mM6=(J,Q)=>{let Z=Q||{},X=J.length-1,Y=Z.parts===!0||Z.scanToEnd===!0,K=[],q=[],G=[],z=J,U=-1,W=0,F=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===wS){if(A=I.backslashes=!0,E=x(),E===IZ1)L=!0;continue}if(L===!0||E===IZ1){j++;while(T()!==!0&&(E=x())){if(E===wS){A=I.backslashes=!0,x();continue}if(E===IZ1){j++;continue}if(L!==!0&&E===$Z1&&(E=x())===$Z1){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(L!==!0&&E===bM6){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===hM6){if(j--,j===0){L=!1,H=I.isBrace=!0,O=!0;break}}}if(Y===!0)continue;break}if(E===al1){if(K.push(U),q.push(I),I={value:"",depth:0,isGlob:!1},O===!0)continue;if($===$Z1&&U===W+1){W+=2;continue}F=U+1;continue}if(Z.noext!==!0){if((E===fM6||E===xM6||E===jZ1||E===cl1||E===EZ1)===!0&&S()===PZ1){if(M=I.isGlob=!0,V=I.isExtglob=!0,O=!0,E===EZ1&&U===W)R=!0;if(Y===!0){while(T()!==!0&&(E=x())){if(E===wS){A=I.backslashes=!0,E=x();continue}if(E===ll1){M=I.isGlob=!0,O=!0;break}}continue}break}}if(E===jZ1){if($===jZ1)N=I.isGlobstar=!0;if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===cl1){if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===yM6){while(T()!==!0&&(g=x())){if(g===wS){A=I.backslashes=!0,x();continue}if(g===gM6){B=I.isBracket=!0,M=I.isGlob=!0,O=!0;break}}if(Y===!0)continue;break}if(Z.nonegate!==!0&&E===EZ1&&U===W){w=I.negated=!0,W++;continue}if(Z.noparen!==!0&&E===PZ1){if(M=I.isGlob=!0,Y===!0){while(T()!==!0&&(E=x())){if(E===PZ1){A=I.backslashes=!0,E=x();continue}if(E===ll1){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(W>0)v=z.slice(0,W),z=z.slice(W),F-=W;if(h&&M===!0&&F>0)h=z.slice(0,F),_=z.slice(F);else if(M===!0)h="",_=z;else h=z;if(h&&h!==""&&h!=="/"&&h!==z){if(il1(h.charCodeAt(h.length-1)))h=h.slice(0,-1)}if(Z.unescape===!0){if(_)_=dl1.removeBackslashes(_);if(h&&A===!0)h=dl1.removeBackslashes(h)}let b={prefix:v,input:J,start:W,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,!il1(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:W,f=K[k],m=J.slice(y,f);if(Z.tokens){if(k===0&&W!==0)q[k].isPrefix=!0,q[k].value=v;else q[k].value=m;nl1(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,nl1(q[q.length-1]),b.maxDepth+=q[q.length-1].depth}b.slashes=K,b.parts=G}return b};rl1.exports=mM6});var el1=a((nM9,tl1)=>{var vd=LS(),rG=AS(),{MAX_LENGTH:kd,POSIX_REGEX_SOURCE:uM6,REGEX_NON_SPECIAL_CHARS:pM6,REGEX_SPECIAL_CHARS_BACKREF:dM6,REPLACEMENTS:ol1}=vd,cM6=(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)=>rG.escapeRegex(Y)).join("..")}return Z},GO=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},TZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=ol1[J]||J;let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(kd,Z.maxLength):kd,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=vd.globChars(Z.windows),U=vd.extglobChars(z),{DOT_LITERAL:W,PLUS_LITERAL:F,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=(F1)=>{return`(${G}(?:(?!${O}${F1.dot?M:W}).)*?)`},$=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=rG.removePrefix(J,T),Y=J.length;let S=[],x=[],h=[],v=K,_,b=()=>T.index===Y-1,g=T.peek=(F1=1)=>J[T.index+F1],k=T.advance=()=>J[++T.index]||"",y=()=>J.slice(T.index+1),f=(F1="",d=0)=>{T.consumed+=F1,T.index+=d},m=(F1)=>{T.output+=F1.output!=null?F1.output:F1.value,f(F1.value)},n=()=>{let F1=1;while(g()==="!"&&(g(2)!=="("||g(3)==="?"))k(),T.start++,F1++;if(F1%2===0)return!1;return T.negated=!0,T.start++,!0},u=(F1)=>{T[F1]++,h.push(F1)},e=(F1)=>{T[F1]--,h.pop()},q1=(F1)=>{if(v.type==="globstar"){let d=T.braces>0&&(F1.type==="comma"||F1.type==="brace"),p=F1.extglob===!0||S.length&&(F1.type==="pipe"||F1.type==="paren");if(F1.type!=="slash"&&F1.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&&F1.type!=="paren")S[S.length-1].inner+=F1.value;if(F1.value||F1.output)m(F1);if(v&&v.type==="text"&&F1.type==="text"){v.output=(v.output||v.value)+F1.value,v.value+=F1.value;return}F1.prev=v,q.push(F1),v=F1},U1=(F1,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"),q1({type:F1,value:d,output:T.output?"":B}),q1({type:"paren",extglob:!0,value:k(),output:i}),S.push(p)},X1=(F1)=>{let d=F1.close+(Z.capture?")":""),p;if(F1.type==="negate"){let i=I;if(F1.inner&&F1.inner.length>1&&F1.inner.includes("/"))i=j(Z);if(i!==I||b()||/^\)+$/.test(y()))d=F1.close=`)$))${i}`;if(F1.inner.includes("*")&&(p=y())&&/^\.[^\\/.]+$/.test(p)){let s=TZ1(p,{...Q,fastpaths:!1}).output;d=F1.close=`)${s})${i})`}if(F1.prev.type==="bos")T.negatedExtglob=!0}q1({type:"paren",extglob:!0,value:_,output:d}),e("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let F1=!1,d=J.replace(dM6,(p,i,s,r,Z1,J1)=>{if(r==="\\")return F1=!0,p;if(r==="?"){if(i)return i+r+(Z1?A.repeat(Z1.length):"");if(J1===0)return E+(Z1?A.repeat(Z1.length):"");return A.repeat(s.length)}if(r===".")return W.repeat(s.length);if(r==="*"){if(i)return i+r+(Z1?I:"");return I}return i?p:`\\${p}`});if(F1===!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=rG.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){_+="\\",q1({type:"text",value:_});continue}let i=/^\\+/.exec(y()),s=0;if(i&&i[0].length>2){if(s=i[0].length,T.index+=s,s%2!==0)_+="\\"}if(Z.unescape===!0)_=k();else _+=k();if(T.brackets===0){q1({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("["),s=v.value.slice(0,i),r=v.value.slice(i+2),Z1=uM6[r];if(Z1){if(v.value=s+Z1,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&&_!=='"'){_=rG.escapeRegex(_),v.value+=_,m({value:_});continue}if(_==='"'){if(T.quotes=T.quotes===1?0:1,Z.keepQuotes===!0)q1({type:"text",value:_});continue}if(_==="("){u("parens"),q1({type:"paren",value:_});continue}if(_===")"){if(T.parens===0&&Z.strictBrackets===!0)throw SyntaxError(GO("opening","("));let p=S[S.length-1];if(p&&T.parens===p.parens+1){X1(S.pop());continue}q1({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(GO("closing","]"));_=`\\${_}`}else u("brackets");q1({type:"bracket",value:_});continue}if(_==="]"){if(Z.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){q1({type:"text",value:_,output:`\\${_}`});continue}if(T.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(GO("opening","["));q1({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||rG.hasRegexChars(p))continue;let i=rG.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),q1(p);continue}if(_==="}"){let p=x[x.length-1];if(Z.nobrace===!0||!p){q1({type:"text",value:_,output:_});continue}let i=")";if(p.dots===!0){let s=q.slice(),r=[];for(let Z1=s.length-1;Z1>=0;Z1--){if(q.pop(),s[Z1].type==="brace")break;if(s[Z1].type!=="dots")r.unshift(s[Z1].value)}i=cM6(r,Z),T.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let s=T.output.slice(0,p.outputIndex),r=T.tokens.slice(p.tokensIndex);p.value=p.output="\\{",_=i="\\}",T.output=s;for(let Z1 of r)T.output+=Z1.output||Z1.value}q1({type:"brace",value:_,output:i}),e("braces"),x.pop();continue}if(_==="|"){if(S.length>0)S[S.length-1].conditions++;q1({type:"text",value:_});continue}if(_===","){let p=_,i=x[x.length-1];if(i&&h[h.length-1]==="braces")i.comma=!0,p="|";q1({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}q1({type:"slash",value:_,output:H});continue}if(_==="."){if(T.braces>0&&v.type==="dot"){if(v.value===".")v.output=W;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"){q1({type:"text",value:_,output:W});continue}q1({type:"dot",value:_,output:W});continue}if(_==="?"){if(!(v&&v.value==="(")&&Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){U1("qmark",_);continue}if(v&&v.type==="paren"){let i=g(),s=_;if(v.value==="("&&!/[!=<:]/.test(i)||i==="<"&&!/<([!=]|\w+>)/.test(y()))s=`\\${_}`;q1({type:"text",value:_,output:s});continue}if(Z.dot!==!0&&(v.type==="slash"||v.type==="bos")){q1({type:"qmark",value:_,output:w});continue}q1({type:"qmark",value:_,output:A});continue}if(_==="!"){if(Z.noextglob!==!0&&g()==="("){if(g(2)!=="?"||!/[!=<:]/.test(g(3))){U1("negate",_);continue}}if(Z.nonegate!==!0&&T.index===0){n();continue}}if(_==="+"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){U1("plus",_);continue}if(v&&v.value==="("||Z.regex===!1){q1({type:"plus",value:_,output:F});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||T.parens>0){q1({type:"plus",value:_});continue}q1({type:"plus",value:F});continue}if(_==="@"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){q1({type:"at",extglob:!0,value:_,output:""});continue}q1({type:"text",value:_});continue}if(_!=="*"){if(_==="$"||_==="^")_=`\\${_}`;let p=pM6.exec(y());if(p)_+=p[0],T.index+=p[0].length;q1({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 F1=y();if(Z.noextglob!==!0&&/^\([^?]/.test(F1)){U1("star",_);continue}if(v.type==="star"){if(Z.noglobstar===!0){f(_);continue}let p=v.prev,i=p.prev,s=p.type==="slash"||p.type==="bos",r=i&&(i.type==="star"||i.type==="globstar");if(Z.bash===!0&&(!s||F1[0]&&F1[0]!=="/")){q1({type:"star",value:_,output:""});continue}let Z1=T.braces>0&&(p.type==="comma"||p.type==="brace"),J1=S.length&&(p.type==="pipe"||p.type==="paren");if(!s&&p.type!=="paren"&&!Z1&&!J1){q1({type:"star",value:_,output:""});continue}while(F1.slice(0,3)==="/**"){let H1=J[T.index+4];if(H1&&H1!=="/")break;F1=F1.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"&&!r&&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"&&F1[0]==="/"){let H1=F1[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()),q1({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&F1[0]==="/"){v.type="globstar",v.value+=_,v.output=`(?:^|${H}|${j(Z)}${H})`,T.output=v.output,T.globstar=!0,f(_+k()),q1({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;q1(d);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Z.regex===!0){d.output=_,q1(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}q1(d)}while(T.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing","]"));T.output=rG.escapeLast(T.output,"["),e("brackets")}while(T.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing",")"));T.output=rG.escapeLast(T.output,"("),e("parens")}while(T.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing","}"));T.output=rG.escapeLast(T.output,"{"),e("braces")}if(Z.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))q1({type:"maybe_slash",value:"",output:`${H}?`});if(T.backtrack===!0){T.output="";for(let F1 of T.tokens)if(T.output+=F1.output!=null?F1.output:F1.value,F1.suffix)T.output+=F1.suffix}return T};TZ1.fastpaths=(J,Q)=>{let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(kd,Z.maxLength):kd,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);J=ol1[J]||J;let{DOT_LITERAL:K,SLASH_LITERAL:q,ONE_CHAR:G,DOTS_SLASH:z,NO_DOT:U,NO_DOTS:W,NO_DOTS_SLASH:F,STAR:H,START_ANCHOR:B}=vd.globChars(Z.windows),M=Z.dot?W:U,V=Z.dot?F: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=rG.removePrefix(J,L),j=R(O);if(j&&Z.strictSlashes!==!0)j+=`${q}?`;return j};tl1.exports=TZ1});var RS=a((aM9,Qi1)=>{var lM6=sl1(),CZ1=el1(),Ji1=AS(),iM6=LS(),nM6=(J)=>J&&typeof J==="object"&&!Array.isArray(J),U7=(J,Q,Z=!1)=>{if(Array.isArray(J)){let W=J.map((H)=>U7(H,Q,Z));return(H)=>{for(let B of W){let M=B(H);if(M)return M}return!1}}let X=nM6(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?U7.compileRe(J,Q):U7.makeRe(J,Q,!1,!0),G=q.state;delete q.state;let z=()=>!1;if(Y.ignore){let W={...Q,ignore:null,onMatch:null,onResult:null};z=U7(Y.ignore,W,Z)}let U=(W,F=!1)=>{let{isMatch:H,match:B,output:M}=U7.test(W,q,Q,{glob:J,posix:K}),V={glob:J,state:G,regex:q,posix:K,input:W,output:M,match:B,isMatch:H};if(typeof Y.onResult==="function")Y.onResult(V);if(H===!1)return V.isMatch=!1,F?V:!1;if(z(W)){if(typeof Y.onIgnore==="function")Y.onIgnore(V);return V.isMatch=!1,F?V:!1}if(typeof Y.onMatch==="function")Y.onMatch(V);return F?V:!0};if(Z)U.state=G;return U};U7.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?Ji1.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=U7.matchBase(J,Q,Z,Y);else G=Q.exec(z);return{isMatch:Boolean(G),match:G,output:z}};U7.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:U7.makeRe(Q,Z)).test(Ji1.basename(J))};U7.isMatch=(J,Q,Z)=>U7(Q,Z)(J);U7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>U7.parse(Z,Q));return CZ1(J,{...Q,fastpaths:!1})};U7.scan=(J,Q)=>lM6(J,Q);U7.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=U7.toRegex(G,Q);if(X===!0)z.state=J;return z};U7.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=CZ1.fastpaths(J,Q);if(!Y.output)Y=CZ1(J,Q);return U7.compileRe(Y,Q,Z,X)};U7.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/$^/}};U7.constants=iM6;Qi1.exports=U7});var gN=a((rM9,Yi1)=>{var Zi1=RS(),aM6=AS();function Xi1(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:aM6.isWindows()};return Zi1(J,Q,Z)}Object.assign(Xi1,Zi1);Yi1.exports=Xi1});var _d;var Ki1=B1(()=>{_d={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"}],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"}],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.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 sM6(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function qi1(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=_d.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!sM6(X))return null;return X*1000}function Gi1(J){let Q=J.settings["tools.stopTimeout"],Z=_d.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var tM9;var SZ1=B1(()=>{Ki1();tM9=_d.contributes.configuration.properties});function xd(J,Q){return new t1((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 vZ1=B1(()=>{I0()});function T7(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 vJ(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function Wi1(J){return["done","error","cancelled"].includes(J.status)}function zO(J){let Q=[],Z=new y8;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 oM6;return Y(K,q,G)},tools:S9(J.configService.config,Z.pipe(j2(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=()=>tM6.record(performance.now()-z,{toolName:K});if(K===_Z1&&q.args&&"invalid_tool_name"in q.args&&typeof q.args.invalid_tool_name==="string"){yd.add(1,{toolName:K,error:"invalid"});let F=kZ1(q.args.invalid_tool_name);return new t1((H)=>{H.error(Error(F))})}let W=X(K,G.config);if(!W){let F=Q.filter((V)=>V.spec.name===K);if(F.length===0)return yd.add(1,{toolName:K,error:"not_found"}),new t1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} not found`))});let H=F[0],B=OS(H.spec,G.config);yd.add(1,{toolName:K,error:"disabled"});let M=B.enabled?"unknown":B.disabledReason;return new t1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} is disabled: ${M}`))})}return yd.add(1,{toolName:K}),g6(()=>W.fn).pipe(J8((F)=>{let H=F(q,G);if(W.spec.meta?.disableTimeout)return H;return xd(H,Gi1(G.config))}),gG(()=>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(W){l.error("preprocessArgs",{id:K,args:q,error:String(W)});return}},dispose(){}}}function bd(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(Ui1.default(Z,{dot:!0})(J))return!0}catch(X){continue}}return!1}function OS(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(bd(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=Hi1(J.name);if(X&&J.source.mcp===X.server&&bd(X.tool,Z))return{enabled:!1,disabledReason:"settings"}}if(J.source==="builtin"&&bd(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&bd(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===QJ||J.name===$B){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function kZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${jS.toString()}. Try again with a valid tool name.`}function Hi1(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function xZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function kJ(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&&Hi1(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 t1((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 zi1,Ui1,oM6,_Z1="invalid_tool",jS,Fi1,yd,tM6;var g2=B1(()=>{I0();z0();SZ1();vZ1();A8();zi1=_6(tp(),1),Ui1=_6(gN(),1);oM6={dispose(){}};jS=/^[a-zA-Z0-9_]{1,64}$/,Fi1=zi1.metrics.getMeter("tool_service"),yd=Fi1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),tM6=Fi1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var Li1=a((Vi1)=>{Object.defineProperty(Vi1,"__esModule",{value:!0});Vi1.calcSlices=Vi1.applyPatch=Vi1.calcPatch=Vi1.lcs=Vi1.diff=Vi1.diff_core=void 0;function eM6(J,Q){let{b:Z,eq:X,stack_base:Y}=J,{i:K,N:q,j:G,M:z,Z:U,stack_top:W}=J;for(;;)switch(Q){case 0:{J:while(q>0&&z>0){Z.fill(0,0,2*U);let F=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=F-O)>=1-A&&L<A&&T+Z[U+L-U*Math.floor(L/U)]>=q)if(A>1||T!==E){Y[W++]=K+T,Y[W++]=q-T,Y[W++]=G+S,Y[W++]=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=F-O)>=-A&&L<=A&&T+Z[L-U*Math.floor(L/U)]>=q)if(A>0||T!==E){Y[W++]=K+q-E,Y[W++]=E,Y[W++]=G+z-I,Y[W++]=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 F=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,F>=0)return J.i=K,J.N=q,J.j=G,J.M=z,J.Z=U,J.stack_top=W,1}}case 1:{if(W===0)return 2;z=Y[--W],G=Y[--W],q=Y[--W],K=Y[--W],U=2*(Math.min(q,z)+1),Q=0}}}class Bi1{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=eM6(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 Di1(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 Bi1({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:[]})}Vi1.diff_core=Di1;function fd(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 Di1(X,Y+1-X,X,K+1-X,Z)}Vi1.diff=fd;class Mi1{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 JV6(J,Q,Z){return new Mi1(fd(J,Q,Z),J.length)}Vi1.lcs=JV6;function*QV6(J,Q,Z){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let Y of fd(J,Q,Z))Y[2]=X.call(Q,Y[2],Y[3]),yield Y}Vi1.calcPatch=QV6;function*ZV6(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)}Vi1.applyPatch=ZV6;function*XV6(J,Q,Z){let X=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[K,q,G,z]of fd(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)]}Vi1.calcSlices=XV6});function hd(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 Ai1.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 uc1(J,Q){let Z=(J&73)!==0;if(process.platform==="win32"){let X=EN.extname(Q).toLowerCase();return Z||[".exe",".bat",".cmd",".ps1"].includes(X)}return Z}function pc1(J){return EN.extname(J).toLowerCase()===".md"}function dc1(J){let Q=J.replace(/\\/g,"/"),Z=EN.basename(Q);return EN.basename(Z,EN.extname(Z))}function cc1(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var lc1=()=>{};var rc1={};A6(rc1,{CommandDiscovery:()=>ac1});import*as nc1 from"node:fs";import{promises as Yd}from"node:fs";import{homedir as ic1}from"node:os";import*as VX from"node:path";function tQ1(J,Q,Z){return Promise.race([J,new Promise((X,Y)=>setTimeout(()=>Y(Error(`${Z} timed out after ${Q}ms`)),Q))])}class ac1{config;workspaceRoots;watchFactory;debounceMs;changes=new y8;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Z={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Z.watchFactory??TB6,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=m0.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=O0.file(Z),Y=await this.discoverCommandsInDirectory(X,"global");J.push(...Y)}return J}async discoverCommandsInDirectory(J,Q){try{let Z=J.fsPath;try{await tQ1(Yd.access(Z),oQ1,"directory access")}catch{return[]}let Y=(await tQ1(Yd.readdir(Z,{withFileTypes:!0}),oQ1,"directory read")).filter((q)=>q.isFile()),K=[];for(let q of Y){let G=VX.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 Yd.stat(J),Z=VX.basename(J);if(this.ignoreCommandName(Z))return null;let X=dc1(Z);if(!cc1(X))return l.warn(`Invalid command name: ${X}`,{filePath:J}),null;if(pc1(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:VX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0}}async createExecutableCommand(J,Q,Z){let X=VX.basename(J),Y=uc1(Q.mode,X),K=await mc1(J),q=VX.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:VX.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 VX.join(ic1(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=UB||VX.join(ic1(),".config");return VX.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=m0.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 tQ1(Yd.access(J),oQ1,"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 oQ1=5000,TB6=(J,Q)=>nc1.watch(J,Q);var sc1=B1(()=>{x6();I0();mR();z0();lc1()});import{homedir as Kd}from"node:os";import IN from"node:path";var tc1,SB6,ec1,vB6,qd,kB6,uR,WB,eQ1;var ZW=B1(()=>{mR();tc1=IN.join(Kd(),".local/share"),SB6=process.platform==="win32"||process.platform==="darwin"?tc1:zB??tc1,ec1=IN.join(Kd(),".config"),vB6=process.platform==="win32"||process.platform==="darwin"?ec1:UB??ec1,qd=IN.join(SB6,"amp"),kB6=IN.join(vB6,"amp"),uR=IN.join(kB6,"tools"),WB=IN.join(Kd(),".cache","amp"),eQ1=IN.join(Kd(),".cache","amp","http-debug-logs")});function NX(J,Q,Z=Q+"s"){return J===1?Q:Z}function FB(J){let Q=typeof J==="string"?J:J.toString();return Q===FZ||Q===FZ.slice(0,-1)}function dR(J){return FB(J)?FZ:J}var lB6,FZ,iB6,sD9;var HB=B1(()=>{lB6=new URL("https://ampcode.com/"),FZ=lB6.toString(),iB6=new URL("https://api.anthropic.com/"),sD9=iB6.toString()});var V9,QZ1,o0,pG=(J)=>{switch(typeof J){case"undefined":return o0.undefined;case"string":return o0.string;case"number":return Number.isNaN(J)?o0.nan:o0.number;case"boolean":return o0.boolean;case"function":return o0.function;case"bigint":return o0.bigint;case"symbol":return o0.symbol;case"object":if(Array.isArray(J))return o0.array;if(J===null)return o0.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return o0.promise;if(typeof Map<"u"&&J instanceof Map)return o0.map;if(typeof Set<"u"&&J instanceof Set)return o0.set;if(typeof Date<"u"&&J instanceof Date)return o0.date;return o0.object;default:return o0.unknown}};var JS=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}}})(QZ1||(QZ1={}));o0=V9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b0,nB6=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},HZ;var zd=B1(()=>{JS();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"]);HZ=class HZ 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 HZ))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()}};HZ.create=(J)=>{return new HZ(J)}});var aB6=(J,Q)=>{let Z;switch(J.code){case b0.invalid_type:if(J.received===o0.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}},XW;var ZZ1=B1(()=>{zd();JS();XW=aB6});function rB6(J){ql1=J}function cR(){return ql1}var ql1;var Ud=B1(()=>{ZZ1();ql1=XW});function z6(J,Q){let Z=cR(),X=QS({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Z,Z===XW?void 0:XW].filter((Y)=>!!Y)});J.common.issues.push(X)}class e5{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 D8;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 e5.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 D8;if(K.status==="aborted")return D8;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 QS=(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}},sB6,D8,PN=(J)=>({status:"dirty",value:J}),PJ=(J)=>({status:"valid",value:J}),Wd=(J)=>J.status==="aborted",Fd=(J)=>J.status==="dirty",BB=(J)=>J.status==="valid",lR=(J)=>typeof Promise<"u"&&J instanceof Promise;var XZ1=B1(()=>{Ud();ZZ1();sB6=[];D8=Object.freeze({status:"aborted"})});var Gl1=()=>{};var k6;var zl1=B1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(k6||(k6={}))});class oK{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 d8(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 Y9{get description(){return this._def.description}_getType(J){return pG(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:pG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new e5,ctx:{common:J.parent.common,data:J.data,parsedType:pG(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(lR(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:pG(J)},X=this._parseSync({data:J,path:Z.path,parent:Z});return Ul1(Z,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:pG(J)};if(!this["~standard"].async)try{let Z=this._parseSync({data:J,path:[],parent:Q});return BB(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)=>BB(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:pG(J)},X=this._parse({data:J,path:Z.path,parent:Z}),Y=await(lR(X)?X:Promise.resolve(X));return Ul1(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 tK({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 sK.create(this,this._def)}nullable(){return KW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rK.create(this)}promise(){return vN.create(this,this._def)}or(J){return oR.create([this,J],this._def)}and(J){return tR.create(this,J,this._def)}transform(J){return new tK({...d8(this._def),schema:this,typeName:L8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new ZO({...d8(this._def),innerType:this,defaultValue:Q,typeName:L8.ZodDefault})}brand(){return new Bd({typeName:L8.ZodBranded,type:this,...d8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new XO({...d8(this._def),innerType:this,catchValue:Q,typeName:L8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return GS.create(this,J)}readonly(){return YO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Hl1(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 BD6(J){return new RegExp(`^${Hl1(J)}$`)}function Bl1(J){let Q=`${Fl1}T${Hl1(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 DD6(J,Q){if((Q==="v4"||!Q)&&qD6.test(J))return!0;if((Q==="v6"||!Q)&&zD6.test(J))return!0;return!1}function MD6(J,Q){if(!ZD6.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 VD6(J,Q){if((Q==="v4"||!Q)&&GD6.test(J))return!0;if((Q==="v6"||!Q)&&UD6.test(J))return!0;return!1}function ND6(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 iR(J){if(J instanceof v4){let Q={};for(let Z in J.shape){let X=J.shape[Z];Q[Z]=sK.create(iR(X))}return new v4({...J._def,shape:()=>Q})}else if(J instanceof rK)return new rK({...J._def,type:iR(J.element)});else if(J instanceof sK)return sK.create(iR(J.unwrap()));else if(J instanceof KW)return KW.create(iR(J.unwrap()));else if(J instanceof cG)return cG.create(J.items.map((Q)=>iR(Q)));else return J}function KZ1(J,Q){let Z=pG(J),X=pG(Q);if(J===Q)return{valid:!0,data:J};else if(Z===o0.object&&X===o0.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=KZ1(J[G],Q[G]);if(!z.valid)return{valid:!1};q[G]=z.data}return{valid:!0,data:q}}else if(Z===o0.array&&X===o0.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=KZ1(q,G);if(!z.valid)return{valid:!1};Y.push(z.data)}return{valid:!0,data:Y}}else if(Z===o0.date&&X===o0.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function Dl1(J,Q){return new NB({values:J,typeName:L8.ZodEnum,...d8(Q)})}function Wl1(J,Q){let Z=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Z==="string"?{message:Z}:Z}function Ml1(J,Q={},Z){if(J)return CN.create().superRefine((X,Y)=>{let K=J(X);if(K instanceof Promise)return K.then((q)=>{if(!q){let G=Wl1(Q,X),z=G.fatal??Z??!0;Y.addIssue({code:"custom",...G,fatal:z})}});if(!K){let q=Wl1(Q,X),G=q.fatal??Z??!0;Y.addIssue({code:"custom",...q,fatal:G})}return});return CN.create()}var Ul1=(J,Q)=>{if(BB(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 HZ(J.common.issues);return this._error=Z,this._error}}}},oB6,tB6,eB6,JD6,QD6,ZD6,XD6,YD6,KD6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",YZ1,qD6,GD6,zD6,UD6,WD6,FD6,Fl1="((\\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])))",HD6,aK,MB,VB,aR,TN,ZS,rR,sR,CN,DB,dG,XS,rK,v4,oR,YW=(J)=>{if(J instanceof eR)return YW(J.schema);else if(J instanceof tK)return YW(J.innerType());else if(J instanceof JO)return[J.value];else if(J instanceof NB)return J.options;else if(J instanceof QO)return V9.objectValues(J.enum);else if(J instanceof ZO)return YW(J._def.innerType);else if(J instanceof rR)return[void 0];else if(J instanceof sR)return[null];else if(J instanceof sK)return[void 0,...YW(J.unwrap())];else if(J instanceof KW)return[null,...YW(J.unwrap())];else if(J instanceof Bd)return YW(J.unwrap());else if(J instanceof YO)return YW(J.unwrap());else if(J instanceof XO)return YW(J._def.innerType);else return[]},Hd,tR,cG,YS,KS,SN,nR,eR,JO,NB,QO,vN,tK,sK,KW,ZO,XO,qS,LD6,Bd,GS,YO,AD6,L8,wD6=(J,Q={message:`Input not instance of ${J.name}`})=>Ml1((Z)=>Z instanceof J,Q),Vl1,Nl1,RD6,OD6,Ll1,jD6,$D6,ED6,ID6,PD6,TD6,CD6,SD6,vD6,kD6,_D6,xD6,bD6,yD6,fD6,hD6,gD6,mD6,uD6,pD6,dD6,cD6,lD6,iD6,nD6,aD6,rD6,sD6,oD6,tD6=()=>Vl1().optional(),eD6=()=>Nl1().optional(),JM6=()=>Ll1().optional(),QM6,ZM6;var Al1=B1(()=>{zd();Ud();zl1();XZ1();JS();oB6=/^c[^\s-]{8,}$/i,tB6=/^[0-9a-z]+$/,eB6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,JD6=/^[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,QD6=/^[a-z0-9_-]{21}$/i,ZD6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,XD6=/^[-+]?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)?)??$/,YD6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qD6=/^(?:(?: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])$/,GD6=/^(?:(?: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])$/,zD6=/^(([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]))$/,UD6=/^(([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])$/,WD6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,FD6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,HD6=new RegExp(`^${Fl1}$`);aK=class aK extends Y9{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==o0.string){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.string,received:Y.parsedType}),D8}let Z=new e5,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),z6(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),z6(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)z6(X,{code:b0.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(q)z6(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(!YD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"email",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="emoji"){if(!YZ1)YZ1=new RegExp(KD6,"u");if(!YZ1.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"emoji",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="uuid"){if(!JD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"uuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="nanoid"){if(!QD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"nanoid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid"){if(!oB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cuid",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cuid2"){if(!tB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cuid2",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ulid"){if(!eB6.test(J.data))X=this._getOrReturnCtx(J,X),z6(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),z6(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),z6(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),z6(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),z6(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),z6(X,{code:b0.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Z.dirty()}else if(Y.kind==="datetime"){if(!Bl1(Y).test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"datetime",message:Y.message}),Z.dirty()}else if(Y.kind==="date"){if(!HD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"date",message:Y.message}),Z.dirty()}else if(Y.kind==="time"){if(!BD6(Y).test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{code:b0.invalid_string,validation:"time",message:Y.message}),Z.dirty()}else if(Y.kind==="duration"){if(!XD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"duration",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="ip"){if(!DD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),z6(X,{validation:"ip",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="jwt"){if(!MD6(J.data,Y.alg))X=this._getOrReturnCtx(J,X),z6(X,{validation:"jwt",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="cidr"){if(!VD6(J.data,Y.version))X=this._getOrReturnCtx(J,X),z6(X,{validation:"cidr",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64"){if(!WD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(X,{validation:"base64",code:b0.invalid_string,message:Y.message}),Z.dirty()}else if(Y.kind==="base64url"){if(!FD6.test(J.data))X=this._getOrReturnCtx(J,X),z6(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 aK({...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 aK({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aK({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aK({...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}};aK.create=(J)=>{return new aK({checks:[],typeName:L8.ZodString,coerce:J?.coerce??!1,...d8(J)})};MB=class MB extends Y9{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)!==o0.number){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.number,received:Y.parsedType}),D8}let Z=void 0,X=new e5;for(let Y of this._def.checks)if(Y.kind==="int"){if(!V9.isInteger(J.data))Z=this._getOrReturnCtx(J,Z),z6(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),z6(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),z6(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(ND6(J.data,Y.value)!==0)Z=this._getOrReturnCtx(J,Z),z6(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),z6(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 MB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new MB({...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)}};MB.create=(J)=>{return new MB({checks:[],typeName:L8.ZodNumber,coerce:J?.coerce||!1,...d8(J)})};VB=class VB extends Y9{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)!==o0.bigint)return this._getInvalidInput(J);let Z=void 0,X=new e5;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),z6(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),z6(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),z6(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 z6(Q,{code:b0.invalid_type,expected:o0.bigint,received:Q.parsedType}),D8}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 VB({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Z,message:k6.toString(X)}]})}_addCheck(J){return new VB({...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}};VB.create=(J)=>{return new VB({checks:[],typeName:L8.ZodBigInt,coerce:J?.coerce??!1,...d8(J)})};aR=class aR extends Y9{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==o0.boolean){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.boolean,received:Z.parsedType}),D8}return PJ(J.data)}};aR.create=(J)=>{return new aR({typeName:L8.ZodBoolean,coerce:J?.coerce||!1,...d8(J)})};TN=class TN extends Y9{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==o0.date){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_type,expected:o0.date,received:Y.parsedType}),D8}if(Number.isNaN(J.data.getTime())){let Y=this._getOrReturnCtx(J);return z6(Y,{code:b0.invalid_date}),D8}let Z=new e5,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),z6(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),z6(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 TN({...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}};TN.create=(J)=>{return new TN({checks:[],coerce:J?.coerce||!1,typeName:L8.ZodDate,...d8(J)})};ZS=class ZS extends Y9{_parse(J){if(this._getType(J)!==o0.symbol){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.symbol,received:Z.parsedType}),D8}return PJ(J.data)}};ZS.create=(J)=>{return new ZS({typeName:L8.ZodSymbol,...d8(J)})};rR=class rR extends Y9{_parse(J){if(this._getType(J)!==o0.undefined){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.undefined,received:Z.parsedType}),D8}return PJ(J.data)}};rR.create=(J)=>{return new rR({typeName:L8.ZodUndefined,...d8(J)})};sR=class sR extends Y9{_parse(J){if(this._getType(J)!==o0.null){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.null,received:Z.parsedType}),D8}return PJ(J.data)}};sR.create=(J)=>{return new sR({typeName:L8.ZodNull,...d8(J)})};CN=class CN extends Y9{constructor(){super(...arguments);this._any=!0}_parse(J){return PJ(J.data)}};CN.create=(J)=>{return new CN({typeName:L8.ZodAny,...d8(J)})};DB=class DB extends Y9{constructor(){super(...arguments);this._unknown=!0}_parse(J){return PJ(J.data)}};DB.create=(J)=>{return new DB({typeName:L8.ZodUnknown,...d8(J)})};dG=class dG extends Y9{_parse(J){let Q=this._getOrReturnCtx(J);return z6(Q,{code:b0.invalid_type,expected:o0.never,received:Q.parsedType}),D8}};dG.create=(J)=>{return new dG({typeName:L8.ZodNever,...d8(J)})};XS=class XS extends Y9{_parse(J){if(this._getType(J)!==o0.undefined){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.void,received:Z.parsedType}),D8}return PJ(J.data)}};XS.create=(J)=>{return new XS({typeName:L8.ZodVoid,...d8(J)})};rK=class rK extends Y9{_parse(J){let{ctx:Q,status:Z}=this._processInputParams(J),X=this._def;if(Q.parsedType!==o0.array)return z6(Q,{code:b0.invalid_type,expected:o0.array,received:Q.parsedType}),D8;if(X.exactLength!==null){let K=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(K||q)z6(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)z6(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)z6(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 oK(Q,K,Q.path,q))})).then((K)=>{return e5.mergeArray(Z,K)});let Y=[...Q.data].map((K,q)=>{return X.type._parseSync(new oK(Q,K,Q.path,q))});return e5.mergeArray(Z,Y)}get element(){return this._def.type}min(J,Q){return new rK({...this._def,minLength:{value:J,message:k6.toString(Q)}})}max(J,Q){return new rK({...this._def,maxLength:{value:J,message:k6.toString(Q)}})}length(J,Q){return new rK({...this._def,exactLength:{value:J,message:k6.toString(Q)}})}nonempty(J){return this.min(1,J)}};rK.create=(J,Q)=>{return new rK({type:J,minLength:null,maxLength:null,exactLength:null,typeName:L8.ZodArray,...d8(Q)})};v4=class v4 extends Y9{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)!==o0.object){let z=this._getOrReturnCtx(J);return z6(z,{code:b0.invalid_type,expected:o0.object,received:z.parsedType}),D8}let{status:Z,ctx:X}=this._processInputParams(J),{shape:Y,keys:K}=this._getCached(),q=[];if(!(this._def.catchall instanceof dG&&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],W=X.data[z];G.push({key:{status:"valid",value:z},value:U._parse(new oK(X,W,X.path,z)),alwaysSet:z in X.data})}if(this._def.catchall instanceof dG){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)z6(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 W=X.data[U];G.push({key:{status:"valid",value:U},value:z._parse(new oK(X,W,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 W=await U.key,F=await U.value;z.push({key:W,value:F,alwaysSet:U.alwaysSet})}return z}).then((z)=>{return e5.mergeObjectSync(Z,z)});else return e5.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 iR(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 sK)Y=Y._def.innerType;Q[Z]=Y}return new v4({...this._def,shape:()=>Q})}keyof(){return Dl1(V9.objectKeys(this.shape))}};v4.create=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strip",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};v4.strictCreate=(J,Q)=>{return new v4({shape:()=>J,unknownKeys:"strict",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};v4.lazycreate=(J,Q)=>{return new v4({shape:J,unknownKeys:"strip",catchall:dG.create(),typeName:L8.ZodObject,...d8(Q)})};oR=class oR extends Y9{_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 HZ(q.ctx.common.issues));return z6(Q,{code:b0.invalid_union,unionErrors:K}),D8}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 HZ(G));return z6(Q,{code:b0.invalid_union,unionErrors:q}),D8}}get options(){return this._def.options}};oR.create=(J,Q)=>{return new oR({options:J,typeName:L8.ZodUnion,...d8(Q)})};Hd=class Hd extends Y9{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.object)return z6(Q,{code:b0.invalid_type,expected:o0.object,received:Q.parsedType}),D8;let Z=this.discriminator,X=Q.data[Z],Y=this.optionsMap.get(X);if(!Y)return z6(Q,{code:b0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Z]}),D8;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=YW(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 Hd({typeName:L8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...d8(Z)})}};tR=class tR extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J),X=(Y,K)=>{if(Wd(Y)||Wd(K))return D8;let q=KZ1(Y.value,K.value);if(!q.valid)return z6(Z,{code:b0.invalid_intersection_types}),D8;if(Fd(Y)||Fd(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}))}};tR.create=(J,Q,Z)=>{return new tR({left:J,right:Q,typeName:L8.ZodIntersection,...d8(Z)})};cG=class cG extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==o0.array)return z6(Z,{code:b0.invalid_type,expected:o0.array,received:Z.parsedType}),D8;if(Z.data.length<this._def.items.length)return z6(Z,{code:b0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),D8;if(!this._def.rest&&Z.data.length>this._def.items.length)z6(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 oK(Z,K,Z.path,q))}).filter((K)=>!!K);if(Z.common.async)return Promise.all(Y).then((K)=>{return e5.mergeArray(Q,K)});else return e5.mergeArray(Q,Y)}get items(){return this._def.items}rest(J){return new cG({...this._def,rest:J})}};cG.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new cG({items:J,typeName:L8.ZodTuple,rest:null,...d8(Q)})};YS=class YS extends Y9{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!==o0.object)return z6(Z,{code:b0.invalid_type,expected:o0.object,received:Z.parsedType}),D8;let X=[],Y=this._def.keyType,K=this._def.valueType;for(let q in Z.data)X.push({key:Y._parse(new oK(Z,q,Z.path,q)),value:K._parse(new oK(Z,Z.data[q],Z.path,q)),alwaysSet:q in Z.data});if(Z.common.async)return e5.mergeObjectAsync(Q,X);else return e5.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Z){if(Q instanceof Y9)return new YS({keyType:J,valueType:Q,typeName:L8.ZodRecord,...d8(Z)});return new YS({keyType:aK.create(),valueType:J,typeName:L8.ZodRecord,...d8(Q)})}};KS=class KS extends Y9{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!==o0.map)return z6(Z,{code:b0.invalid_type,expected:o0.map,received:Z.parsedType}),D8;let X=this._def.keyType,Y=this._def.valueType,K=[...Z.data.entries()].map(([q,G],z)=>{return{key:X._parse(new oK(Z,q,Z.path,[z,"key"])),value:Y._parse(new oK(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 D8;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 D8;if(z.status==="dirty"||U.status==="dirty")Q.dirty();q.set(z.value,U.value)}return{status:Q.value,value:q}}}};KS.create=(J,Q,Z)=>{return new KS({valueType:Q,keyType:J,typeName:L8.ZodMap,...d8(Z)})};SN=class SN extends Y9{_parse(J){let{status:Q,ctx:Z}=this._processInputParams(J);if(Z.parsedType!==o0.set)return z6(Z,{code:b0.invalid_type,expected:o0.set,received:Z.parsedType}),D8;let X=this._def;if(X.minSize!==null){if(Z.data.size<X.minSize.value)z6(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)z6(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 D8;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 oK(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 SN({...this._def,minSize:{value:J,message:k6.toString(Q)}})}max(J,Q){return new SN({...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)}};SN.create=(J,Q)=>{return new SN({valueType:J,minSize:null,maxSize:null,typeName:L8.ZodSet,...d8(Q)})};nR=class nR extends Y9{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.function)return z6(Q,{code:b0.invalid_type,expected:o0.function,received:Q.parsedType}),D8;function Z(q,G){return QS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,cR(),XW].filter((z)=>!!z),issueData:{code:b0.invalid_arguments,argumentsError:G}})}function X(q,G){return QS({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,cR(),XW].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 vN){let q=this;return PJ(async function(...G){let z=new HZ([]),U=await q._def.args.parseAsync(G,Y).catch((H)=>{throw z.addIssue(Z(G,H)),z}),W=await Reflect.apply(K,this,U);return await q._def.returns._def.type.parseAsync(W,Y).catch((H)=>{throw z.addIssue(X(W,H)),z})})}else{let q=this;return PJ(function(...G){let z=q._def.args.safeParse(G,Y);if(!z.success)throw new HZ([Z(G,z.error)]);let U=Reflect.apply(K,this,z.data),W=q._def.returns.safeParse(U,Y);if(!W.success)throw new HZ([X(U,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new nR({...this._def,args:cG.create(J).rest(DB.create())})}returns(J){return new nR({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Z){return new nR({args:J?J:cG.create([]).rest(DB.create()),returns:Q||DB.create(),typeName:L8.ZodFunction,...d8(Z)})}};eR=class eR extends Y9{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})}};eR.create=(J,Q)=>{return new eR({getter:J,typeName:L8.ZodLazy,...d8(Q)})};JO=class JO extends Y9{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return z6(Q,{received:Q.data,code:b0.invalid_literal,expected:this._def.value}),D8}return{status:"valid",value:J.data}}get value(){return this._def.value}};JO.create=(J,Q)=>{return new JO({value:J,typeName:L8.ZodLiteral,...d8(Q)})};NB=class NB extends Y9{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Z=this._def.values;return z6(Q,{expected:V9.joinValues(Z),received:Q.parsedType,code:b0.invalid_type}),D8}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 z6(Q,{received:Q.data,code:b0.invalid_enum_value,options:Z}),D8}return PJ(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 NB.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return NB.create(this.options.filter((Z)=>!J.includes(Z)),{...this._def,...Q})}};NB.create=Dl1;QO=class QO extends Y9{_parse(J){let Q=V9.getValidEnumValues(this._def.values),Z=this._getOrReturnCtx(J);if(Z.parsedType!==o0.string&&Z.parsedType!==o0.number){let X=V9.objectValues(Q);return z6(Z,{expected:V9.joinValues(X),received:Z.parsedType,code:b0.invalid_type}),D8}if(!this._cache)this._cache=new Set(V9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=V9.objectValues(Q);return z6(Z,{received:Z.data,code:b0.invalid_enum_value,options:X}),D8}return PJ(J.data)}get enum(){return this._def.values}};QO.create=(J,Q)=>{return new QO({values:J,typeName:L8.ZodNativeEnum,...d8(Q)})};vN=class vN extends Y9{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==o0.promise&&Q.common.async===!1)return z6(Q,{code:b0.invalid_type,expected:o0.promise,received:Q.parsedType}),D8;let Z=Q.parsedType===o0.promise?Q.data:Promise.resolve(Q.data);return PJ(Z.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};vN.create=(J,Q)=>{return new vN({type:J,typeName:L8.ZodPromise,...d8(Q)})};tK=class tK extends Y9{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(z6(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 D8;let G=await this._def.schema._parseAsync({data:q,path:Z.path,parent:Z});if(G.status==="aborted")return D8;if(G.status==="dirty")return PN(G.value);if(Q.value==="dirty")return PN(G.value);return G});else{if(Q.value==="aborted")return D8;let q=this._def.schema._parseSync({data:K,path:Z.path,parent:Z});if(q.status==="aborted")return D8;if(q.status==="dirty")return PN(q.value);if(Q.value==="dirty")return PN(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 D8;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 D8;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(!BB(K))return D8;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(!BB(K))return D8;return Promise.resolve(X.transform(K.value,Y)).then((q)=>({status:Q.value,value:q}))});V9.assertNever(X)}};tK.create=(J,Q,Z)=>{return new tK({schema:J,typeName:L8.ZodEffects,effect:Q,...d8(Z)})};tK.createWithPreprocess=(J,Q,Z)=>{return new tK({schema:Q,effect:{type:"preprocess",transform:J},typeName:L8.ZodEffects,...d8(Z)})};sK=class sK extends Y9{_parse(J){if(this._getType(J)===o0.undefined)return PJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};sK.create=(J,Q)=>{return new sK({innerType:J,typeName:L8.ZodOptional,...d8(Q)})};KW=class KW extends Y9{_parse(J){if(this._getType(J)===o0.null)return PJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};KW.create=(J,Q)=>{return new KW({innerType:J,typeName:L8.ZodNullable,...d8(Q)})};ZO=class ZO extends Y9{_parse(J){let{ctx:Q}=this._processInputParams(J),Z=Q.data;if(Q.parsedType===o0.undefined)Z=this._def.defaultValue();return this._def.innerType._parse({data:Z,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};ZO.create=(J,Q)=>{return new ZO({innerType:J,typeName:L8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...d8(Q)})};XO=class XO extends Y9{_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(lR(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new HZ(Z.common.issues)},input:Z.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new HZ(Z.common.issues)},input:Z.data})}}removeCatch(){return this._def.innerType}};XO.create=(J,Q)=>{return new XO({innerType:J,typeName:L8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...d8(Q)})};qS=class qS extends Y9{_parse(J){if(this._getType(J)!==o0.nan){let Z=this._getOrReturnCtx(J);return z6(Z,{code:b0.invalid_type,expected:o0.nan,received:Z.parsedType}),D8}return{status:"valid",value:J.data}}};qS.create=(J)=>{return new qS({typeName:L8.ZodNaN,...d8(J)})};LD6=Symbol("zod_brand");Bd=class Bd extends Y9{_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}};GS=class GS extends Y9{_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 D8;if(Y.status==="dirty")return Q.dirty(),PN(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 D8;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 GS({in:J,out:Q,typeName:L8.ZodPipeline})}};YO=class YO extends Y9{_parse(J){let Q=this._def.innerType._parse(J),Z=(X)=>{if(BB(X))X.value=Object.freeze(X.value);return X};return lR(Q)?Q.then((X)=>Z(X)):Z(Q)}unwrap(){return this._def.innerType}};YO.create=(J,Q)=>{return new YO({innerType:J,typeName:L8.ZodReadonly,...d8(Q)})};AD6={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={}));Vl1=aK.create,Nl1=MB.create,RD6=qS.create,OD6=VB.create,Ll1=aR.create,jD6=TN.create,$D6=ZS.create,ED6=rR.create,ID6=sR.create,PD6=CN.create,TD6=DB.create,CD6=dG.create,SD6=XS.create,vD6=rK.create,kD6=v4.create,_D6=v4.strictCreate,xD6=oR.create,bD6=Hd.create,yD6=tR.create,fD6=cG.create,hD6=YS.create,gD6=KS.create,mD6=SN.create,uD6=nR.create,pD6=eR.create,dD6=JO.create,cD6=NB.create,lD6=QO.create,iD6=vN.create,nD6=tK.create,aD6=sK.create,rD6=KW.create,sD6=tK.createWithPreprocess,oD6=GS.create,QM6={string:(J)=>aK.create({...J,coerce:!0}),number:(J)=>MB.create({...J,coerce:!0}),boolean:(J)=>aR.create({...J,coerce:!0}),bigint:(J)=>VB.create({...J,coerce:!0}),date:(J)=>TN.create({...J,coerce:!0})},ZM6=D8});var Q1={};A6(Q1,{void:()=>SD6,util:()=>V9,unknown:()=>TD6,union:()=>xD6,undefined:()=>ED6,tuple:()=>fD6,transformer:()=>nD6,symbol:()=>$D6,string:()=>Vl1,strictObject:()=>_D6,setErrorMap:()=>rB6,set:()=>mD6,record:()=>hD6,quotelessJson:()=>nB6,promise:()=>iD6,preprocess:()=>sD6,pipeline:()=>oD6,ostring:()=>tD6,optional:()=>aD6,onumber:()=>eD6,oboolean:()=>JM6,objectUtil:()=>QZ1,object:()=>kD6,number:()=>Nl1,nullable:()=>rD6,null:()=>ID6,never:()=>CD6,nativeEnum:()=>lD6,nan:()=>RD6,map:()=>gD6,makeIssue:()=>QS,literal:()=>dD6,lazy:()=>pD6,late:()=>AD6,isValid:()=>BB,isDirty:()=>Fd,isAsync:()=>lR,isAborted:()=>Wd,intersection:()=>yD6,instanceof:()=>wD6,getParsedType:()=>pG,getErrorMap:()=>cR,function:()=>uD6,enum:()=>cD6,effect:()=>nD6,discriminatedUnion:()=>bD6,defaultErrorMap:()=>XW,datetimeRegex:()=>Bl1,date:()=>jD6,custom:()=>Ml1,coerce:()=>QM6,boolean:()=>Ll1,bigint:()=>OD6,array:()=>vD6,any:()=>PD6,addIssueToContext:()=>z6,ZodVoid:()=>XS,ZodUnknown:()=>DB,ZodUnion:()=>oR,ZodUndefined:()=>rR,ZodType:()=>Y9,ZodTuple:()=>cG,ZodTransformer:()=>tK,ZodSymbol:()=>ZS,ZodString:()=>aK,ZodSet:()=>SN,ZodSchema:()=>Y9,ZodRecord:()=>YS,ZodReadonly:()=>YO,ZodPromise:()=>vN,ZodPipeline:()=>GS,ZodParsedType:()=>o0,ZodOptional:()=>sK,ZodObject:()=>v4,ZodNumber:()=>MB,ZodNullable:()=>KW,ZodNull:()=>sR,ZodNever:()=>dG,ZodNativeEnum:()=>QO,ZodNaN:()=>qS,ZodMap:()=>KS,ZodLiteral:()=>JO,ZodLazy:()=>eR,ZodIssueCode:()=>b0,ZodIntersection:()=>tR,ZodFunction:()=>nR,ZodFirstPartyTypeKind:()=>L8,ZodError:()=>HZ,ZodEnum:()=>NB,ZodEffects:()=>tK,ZodDiscriminatedUnion:()=>Hd,ZodDefault:()=>ZO,ZodDate:()=>TN,ZodCatch:()=>XO,ZodBranded:()=>Bd,ZodBoolean:()=>aR,ZodBigInt:()=>VB,ZodArray:()=>rK,ZodAny:()=>CN,Schema:()=>Y9,ParseStatus:()=>e5,OK:()=>PJ,NEVER:()=>ZM6,INVALID:()=>D8,EMPTY_PATH:()=>sB6,DIRTY:()=>PN,BRAND:()=>LD6});var qZ1=B1(()=>{Ud();XZ1();Gl1();JS();Al1();zd()});var qW=B1(()=>{qZ1();qZ1()});function YM6(J){return wl1.safeParse(J)}function LB(J){return XM6.safeParse(J)}function KO(J){if(!J||!Array.isArray(J))return[];let Q=[];for(let[Z,X]of J.entries()){let Y=YM6(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 GZ1,wl1,XM6;var kN=B1(()=>{qW();z0();GZ1=Q1.lazy(()=>Q1.union([Q1.string().describe('Pattern match where "*" matches any number of any characters'),Q1.array(GZ1).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(),GZ1).describe("Matching individual keys of an object")])),wl1=Q1.object({tool:Q1.string().min(1).describe("The name of the tool to which this entry applies"),matches:Q1.record(Q1.string(),GZ1).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"]})}),XM6=Q1.array(wl1).describe("Entries checked in sequence to configure tool permissions")});function BZ(J,Q){let Z=KM6(J,Q);return typeof Z==="string"?Z:Z.toString()}function KM6(J,Q,Z=!0){if(!Q)Q=qM6();let{workspaceFolders:X,isWindows:Y,homeDir:K}=Q,q=typeof J==="string"?O0.parse(J):O0.from(J);if(X)for(let G of X){let z=B8(G);if(m0.hasPrefix(q,z)){let U=z.path.endsWith("/")?z.path.slice(0,-1):z.path,F=Z&&X&&X.length>=2?jN(z.path)+(Y?"\\":"/"):"";return zZ1(F+q.path.slice(U.length+1),Y,q.scheme)}}if(q?.scheme==="file"){if(K){let G=B8(K);if(m0.hasPrefix(q,G)){let z=G.path.endsWith("/")?G.path.slice(0,-1):G.path,U=q.path.slice(z.length+1);return zZ1("~"+(Y?"\\":"/")+U,Y,q.scheme)}}return zZ1(q.fsPath,Y,q.scheme)}return q}function zZ1(J,Q,Z){return Q&&Z==="file"?J.replaceAll("/","\\"):J}function Md(J){let Q=Dd;return Dd=J,Q}function qM6(){if(Dd)return Dd;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Dd=null;var AB=B1(()=>{x6();gR();sQ1()});function TJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function bN(J){return!!J&&!!J[LX]}function wB(J){if(!J)return!1;return El1(J)||Array.isArray(J)||!!J[zS]||!!J.constructor?.[zS]||BS(J)||DS(J)}function El1(J){if(!J||typeof J!=="object")return!1;let Q=xN(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)===GM6}function US(J,Q){if(yN(J)===0)Reflect.ownKeys(J).forEach((Z)=>{Q(Z,J[Z],J)});else J.forEach((Z,X)=>Q(X,Z,J))}function yN(J){let Q=J[LX];return Q?Q.type_:Array.isArray(J)?1:BS(J)?2:DS(J)?3:0}function WS(J,Q){return yN(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function UZ1(J,Q){return yN(J)===2?J.get(Q):J[Q]}function Il1(J,Q,Z){let X=yN(J);if(X===2)J.set(Q,Z);else if(X===3)J.add(Z);else J[Q]=Z}function zM6(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function BS(J){return J instanceof Map}function DS(J){return J instanceof Set}function _N(J){return J.copy_||J.base_}function HZ1(J,Q){if(BS(J))return new Map(J);if(DS(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Z=El1(J);if(Q===!0||Q==="class_only"&&!Z){let X=Object.getOwnPropertyDescriptors(J);delete X[LX];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(xN(J),X)}else{let X=xN(J);if(X!==null&&Z)return{...J};let Y=Object.create(X);return Object.assign(Y,J)}}function LQ(J,Q=!1){if(Ld(J)||bN(J)||!wB(J))return J;if(yN(J)>1)J.set=J.add=J.clear=J.delete=UM6;if(Object.freeze(J),Q)Object.entries(J).forEach(([Z,X])=>LQ(X,!0));return J}function UM6(){TJ(2)}function Ld(J){return Object.isFrozen(J)}function fN(J){let Q=BZ1[J];if(!Q)TJ(0,J);return Q}function WM6(J,Q){if(!BZ1[J])BZ1[J]=Q}function Pl1(){return FS}function FM6(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rl1(J,Q){if(Q)fN("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function DZ1(J){MZ1(J),J.drafts_.forEach(HM6),J.drafts_=null}function MZ1(J){if(J===FS)FS=J.parent_}function Ol1(J){return FS=FM6(FS,J)}function HM6(J){let Q=J[LX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function jl1(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Z=Q.drafts_[0];if(J!==void 0&&J!==Z){if(Z[LX].modified_)DZ1(Q),TJ(4);if(wB(J)){if(J=Vd(Q,J),!Q.parent_)Nd(Q,J)}if(Q.patches_)fN("Patches").generateReplacementPatches_(Z[LX].base_,J,Q.patches_,Q.inversePatches_)}else J=Vd(Q,Z,[]);if(DZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==LZ1?J:void 0}function Vd(J,Q,Z){if(Ld(Q))return Q;let X=Q[LX];if(!X)return US(Q,(Y,K)=>$l1(J,X,Q,Y,K,Z)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return Nd(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(US(K,(G,z)=>$l1(J,X,Y,G,z,Z,q)),Nd(J,Y,!1),Z&&J.patches_)fN("Patches").generatePatches_(X,Z,J.patches_,J.inversePatches_)}return X.copy_}function $l1(J,Q,Z,X,Y,K,q){if(bN(Y)){let G=K&&Q&&Q.type_!==3&&!WS(Q.assigned_,X)?K.concat(X):void 0,z=Vd(J,Y,G);if(Il1(Z,X,z),bN(z))J.canAutoFreeze_=!1;else return}else if(q)Z.add(Y);if(wB(Y)&&!Ld(Y)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(Vd(J,Y),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Z,X))Nd(J,Y)}}function Nd(J,Q,Z=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)LQ(Q,Z)}function BM6(J,Q){let Z=Array.isArray(J),X={type_:Z?1:0,scope_:Q?Q.scope_:Pl1(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},Y=X,K=AZ1;if(Z)Y=[X],K=HS;let{revoke:q,proxy:G}=Proxy.revocable(Y,K);return X.draft_=G,X.revoke_=q,G}function WZ1(J,Q){let Z=J[LX];return(Z?_N(Z):J)[Q]}function DM6(J,Q,Z){let X=Tl1(Q,Z);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function Tl1(J,Q){if(!(Q in J))return;let Z=xN(J);while(Z){let X=Object.getOwnPropertyDescriptor(Z,Q);if(X)return X;Z=xN(Z)}return}function VZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)VZ1(J.parent_)}}function FZ1(J){if(!J.copy_)J.copy_=HZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function NZ1(J,Q){let Z=BS(J)?fN("MapSet").proxyMap_(J,Q):DS(J)?fN("MapSet").proxySet_(J,Q):BM6(J,Q);return(Q?Q.scope_:Pl1()).drafts_.push(Z),Z}function VM6(J){if(!bN(J))TJ(10,J);return Cl1(J)}function Cl1(J){if(!wB(J)||Ld(J))return J;let Q=J[LX],Z;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Z=HZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Z=HZ1(J,!0);if(US(Z,(X,Y)=>{Il1(Z,X,Cl1(Y))}),Q)Q.finalized_=!1;return Z}function Ad(){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:F(A[w])}),V.push({op:Q,path:R,value:F(N[w])})}for(let w=N.length;w<A.length;w++){let R=B.concat([w]);M.push({op:Z,path:R,value:F(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;US(H.assigned_,(A,w)=>{let R=UZ1(N,A),O=UZ1(L,A),j=!w?X:WS(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:F(R)}:{op:Q,path:$,value:F(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===LZ1?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=yN(L),$=V[O];if(typeof $!=="string"&&typeof $!=="number")$=""+$;if((j===0||j===1)&&($==="__proto__"||$==="constructor"))TJ(19);if(typeof L==="function"&&$==="prototype")TJ(19);if(L=UZ1(L,$),typeof L!=="object")TJ(18,V.join("/"))}let A=yN(L),w=W(M.value),R=V[V.length-1];switch(N){case Q:switch(A){case 2:return L.set(R,w);case 3:TJ(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:TJ(17,N)}}),H}function W(H){if(!wB(H))return H;if(Array.isArray(H))return H.map(W);if(BS(H))return new Map(Array.from(H.entries()).map(([M,V])=>[M,W(V)]));if(DS(H))return new Set(Array.from(H).map(W));let B=Object.create(xN(H));for(let M in H)B[M]=W(H[M]);if(WS(H,zS))B[zS]=H[zS];return B}function F(H){if(bN(H))return W(H);else return H}WM6("Patches",{applyPatches_:U,generatePatches_:Y,generateReplacementPatches_:z})}function a8(J){return J}var LZ1,zS,LX,xN,GM6,BZ1,FS,AZ1,HS,MM6=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,(W)=>Z.call(this,W,...U))}}if(typeof Z!=="function")TJ(6);if(X!==void 0&&typeof X!=="function")TJ(7);let Y;if(wB(Q)){let K=Ol1(this),q=NZ1(Q,void 0),G=!0;try{Y=Z(q),G=!1}finally{if(G)DZ1(K);else MZ1(K)}return Rl1(K,X),jl1(Y,K)}else if(!Q||typeof Q!=="object"){if(Y=Z(Q),Y===void 0)Y=Q;if(Y===LZ1)Y=void 0;if(this.autoFreeze_)LQ(Y,!0);if(X){let K=[],q=[];fN("Patches").generateReplacementPatches_(Q,Y,K,q),X(K,q)}return Y}else TJ(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(!wB(J))TJ(8);if(bN(J))J=VM6(J);let Q=Ol1(this),Z=NZ1(J,void 0);return Z[LX].isManual_=!0,MZ1(Q),Z}finishDraft(J,Q){let Z=J&&J[LX];if(!Z||!Z.isManual_)TJ(9);let{scope_:X}=Z;return Rl1(X,Q),jl1(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=fN("Patches").applyPatches_;if(bN(J))return X(J,Q);return this.produce(J,(Y)=>X(Y,Q))}},AX,wd,wZ1,_M9,xM9,Sl1,bM9,yM9;var AQ=B1(()=>{LZ1=Symbol.for("immer-nothing"),zS=Symbol.for("immer-draftable"),LX=Symbol.for("immer-state");xN=Object.getPrototypeOf;GM6=Object.prototype.constructor.toString();BZ1={};AZ1={get(J,Q){if(Q===LX)return J;let Z=_N(J);if(!WS(Z,Q))return DM6(J,Z,Q);let X=Z[Q];if(J.finalized_||!wB(X))return X;if(X===WZ1(J.base_,Q))return FZ1(J),J.copy_[Q]=NZ1(X,J);return X},has(J,Q){return Q in _N(J)},ownKeys(J){return Reflect.ownKeys(_N(J))},set(J,Q,Z){let X=Tl1(_N(J),Q);if(X?.set)return X.set.call(J.draft_,Z),!0;if(!J.modified_){let Y=WZ1(_N(J),Q),K=Y?.[LX];if(K&&K.base_===Z)return J.copy_[Q]=Z,J.assigned_[Q]=!1,!0;if(zM6(Z,Y)&&(Z!==void 0||WS(J.base_,Q)))return!0;FZ1(J),VZ1(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(WZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,FZ1(J),VZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Z=_N(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(){TJ(11)},getPrototypeOf(J){return xN(J.base_)},setPrototypeOf(){TJ(12)}},HS={};US(AZ1,(J,Q)=>{HS[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});HS.deleteProperty=function(J,Q){return HS.set.call(this,J,Q,void 0)};HS.set=function(J,Q,Z){return AZ1.set.call(this,J[0],Q,Z,J[0])};AX=new MM6,wd=AX.produce,wZ1=AX.produceWithPatches.bind(AX),_M9=AX.setAutoFreeze.bind(AX),xM9=AX.setUseStrictShallowCopy.bind(AX),Sl1=AX.applyPatches.bind(AX),bM9=AX.createDraft.bind(AX),yM9=AX.finishDraft.bind(AX)});function RZ1({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 MS(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(NM6,"")}var NM6;var OZ1=B1(()=>{NM6=RZ1()});var kl1=a((pM9,vl1)=>{vl1.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 _l1="run_terminal_command",xl1="read_file",C5="Task",bl1="chat_llm",z7="finder",RB="fast_finder",lG="xai_finder",iG="kimiK2_finder",OB="gossip_finder",jB="sonoma_finder",GW="get_diagnostics",z4="Bash",JJ="oracle",VS="mermaid",$B="todo_read",QJ="todo_write",nG="read_web_page",yl1="run_javascript",CJ="create_file",aG="glob",fl1="Glob",Rd="undo_edit",Od="read_mcp_resource",t8="Read",SJ="edit_file",jd="format_file",qO="web_search",U4="Grep",NS="Check",hN="librarian",$d="read_github",Ed="search_github",Id="commit_search",Pd="list_directory_github",Td="list_repositories",Cd="glob_github",Sd="diff",hl1;var A8=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 LS=a((cM9,ml1)=>{var gl1={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:"/"},LM6={...gl1,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:"\\"},AM6={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"};ml1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:AM6,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?LM6:gl1}}});var AS=a(($M6)=>{var{REGEX_BACKSLASH:wM6,REGEX_REMOVE_BACKSLASH:RM6,REGEX_SPECIAL_CHARS:OM6,REGEX_SPECIAL_CHARS_GLOBAL:jM6}=LS();$M6.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);$M6.hasRegexChars=(J)=>OM6.test(J);$M6.isRegexChar=(J)=>J.length===1&&$M6.hasRegexChars(J);$M6.escapeRegex=(J)=>J.replace(jM6,"\\$1");$M6.toPosixSlashes=(J)=>J.replace(wM6,"/");$M6.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};$M6.removeBackslashes=(J)=>{return J.replace(RM6,(Q)=>{return Q==="\\"?"":Q})};$M6.escapeLast=(J,Q,Z)=>{let X=J.lastIndexOf(Q,Z);if(X===-1)return J;if(J[X-1]==="\\")return $M6.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};$M6.removePrefix=(J,Q={})=>{let Z=J;if(Z.startsWith("./"))Z=Z.slice(2),Q.prefix="./";return Z};$M6.wrapOutput=(J,Q={},Z={})=>{let X=Z.contains?"":"^",Y=Z.contains?"":"$",K=`${X}(?:${J})${Y}`;if(Q.negated===!0)K=`(?:^(?!${K}).*$)`;return K};$M6.basename=(J,{windows:Q}={})=>{let Z=J.split(Q?/[\\/]/:"/"),X=Z[Z.length-1];if(X==="")return Z[Z.length-2];return X}});var sl1=a((iM9,rl1)=>{var dl1=AS(),{CHAR_ASTERISK:jZ1,CHAR_AT:xM6,CHAR_BACKWARD_SLASH:wS,CHAR_COMMA:bM6,CHAR_DOT:$Z1,CHAR_EXCLAMATION_MARK:EZ1,CHAR_FORWARD_SLASH:al1,CHAR_LEFT_CURLY_BRACE:IZ1,CHAR_LEFT_PARENTHESES:PZ1,CHAR_LEFT_SQUARE_BRACKET:yM6,CHAR_PLUS:fM6,CHAR_QUESTION_MARK:cl1,CHAR_RIGHT_CURLY_BRACE:hM6,CHAR_RIGHT_PARENTHESES:ll1,CHAR_RIGHT_SQUARE_BRACKET:gM6}=LS(),il1=(J)=>{return J===al1||J===wS},nl1=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},mM6=(J,Q)=>{let Z=Q||{},X=J.length-1,Y=Z.parts===!0||Z.scanToEnd===!0,K=[],q=[],G=[],z=J,U=-1,W=0,F=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===wS){if(A=I.backslashes=!0,E=x(),E===IZ1)L=!0;continue}if(L===!0||E===IZ1){j++;while(T()!==!0&&(E=x())){if(E===wS){A=I.backslashes=!0,x();continue}if(E===IZ1){j++;continue}if(L!==!0&&E===$Z1&&(E=x())===$Z1){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(L!==!0&&E===bM6){if(H=I.isBrace=!0,M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===hM6){if(j--,j===0){L=!1,H=I.isBrace=!0,O=!0;break}}}if(Y===!0)continue;break}if(E===al1){if(K.push(U),q.push(I),I={value:"",depth:0,isGlob:!1},O===!0)continue;if($===$Z1&&U===W+1){W+=2;continue}F=U+1;continue}if(Z.noext!==!0){if((E===fM6||E===xM6||E===jZ1||E===cl1||E===EZ1)===!0&&S()===PZ1){if(M=I.isGlob=!0,V=I.isExtglob=!0,O=!0,E===EZ1&&U===W)R=!0;if(Y===!0){while(T()!==!0&&(E=x())){if(E===wS){A=I.backslashes=!0,E=x();continue}if(E===ll1){M=I.isGlob=!0,O=!0;break}}continue}break}}if(E===jZ1){if($===jZ1)N=I.isGlobstar=!0;if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===cl1){if(M=I.isGlob=!0,O=!0,Y===!0)continue;break}if(E===yM6){while(T()!==!0&&(g=x())){if(g===wS){A=I.backslashes=!0,x();continue}if(g===gM6){B=I.isBracket=!0,M=I.isGlob=!0,O=!0;break}}if(Y===!0)continue;break}if(Z.nonegate!==!0&&E===EZ1&&U===W){w=I.negated=!0,W++;continue}if(Z.noparen!==!0&&E===PZ1){if(M=I.isGlob=!0,Y===!0){while(T()!==!0&&(E=x())){if(E===PZ1){A=I.backslashes=!0,E=x();continue}if(E===ll1){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(W>0)v=z.slice(0,W),z=z.slice(W),F-=W;if(h&&M===!0&&F>0)h=z.slice(0,F),_=z.slice(F);else if(M===!0)h="",_=z;else h=z;if(h&&h!==""&&h!=="/"&&h!==z){if(il1(h.charCodeAt(h.length-1)))h=h.slice(0,-1)}if(Z.unescape===!0){if(_)_=dl1.removeBackslashes(_);if(h&&A===!0)h=dl1.removeBackslashes(h)}let b={prefix:v,input:J,start:W,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,!il1(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:W,f=K[k],m=J.slice(y,f);if(Z.tokens){if(k===0&&W!==0)q[k].isPrefix=!0,q[k].value=v;else q[k].value=m;nl1(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,nl1(q[q.length-1]),b.maxDepth+=q[q.length-1].depth}b.slashes=K,b.parts=G}return b};rl1.exports=mM6});var el1=a((nM9,tl1)=>{var vd=LS(),rG=AS(),{MAX_LENGTH:kd,POSIX_REGEX_SOURCE:uM6,REGEX_NON_SPECIAL_CHARS:pM6,REGEX_SPECIAL_CHARS_BACKREF:dM6,REPLACEMENTS:ol1}=vd,cM6=(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)=>rG.escapeRegex(Y)).join("..")}return Z},GO=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},TZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=ol1[J]||J;let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(kd,Z.maxLength):kd,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=vd.globChars(Z.windows),U=vd.extglobChars(z),{DOT_LITERAL:W,PLUS_LITERAL:F,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=(F1)=>{return`(${G}(?:(?!${O}${F1.dot?M:W}).)*?)`},$=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=rG.removePrefix(J,T),Y=J.length;let S=[],x=[],h=[],v=K,_,b=()=>T.index===Y-1,g=T.peek=(F1=1)=>J[T.index+F1],k=T.advance=()=>J[++T.index]||"",y=()=>J.slice(T.index+1),f=(F1="",d=0)=>{T.consumed+=F1,T.index+=d},m=(F1)=>{T.output+=F1.output!=null?F1.output:F1.value,f(F1.value)},n=()=>{let F1=1;while(g()==="!"&&(g(2)!=="("||g(3)==="?"))k(),T.start++,F1++;if(F1%2===0)return!1;return T.negated=!0,T.start++,!0},u=(F1)=>{T[F1]++,h.push(F1)},e=(F1)=>{T[F1]--,h.pop()},q1=(F1)=>{if(v.type==="globstar"){let d=T.braces>0&&(F1.type==="comma"||F1.type==="brace"),p=F1.extglob===!0||S.length&&(F1.type==="pipe"||F1.type==="paren");if(F1.type!=="slash"&&F1.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&&F1.type!=="paren")S[S.length-1].inner+=F1.value;if(F1.value||F1.output)m(F1);if(v&&v.type==="text"&&F1.type==="text"){v.output=(v.output||v.value)+F1.value,v.value+=F1.value;return}F1.prev=v,q.push(F1),v=F1},U1=(F1,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"),q1({type:F1,value:d,output:T.output?"":B}),q1({type:"paren",extglob:!0,value:k(),output:i}),S.push(p)},X1=(F1)=>{let d=F1.close+(Z.capture?")":""),p;if(F1.type==="negate"){let i=I;if(F1.inner&&F1.inner.length>1&&F1.inner.includes("/"))i=j(Z);if(i!==I||b()||/^\)+$/.test(y()))d=F1.close=`)$))${i}`;if(F1.inner.includes("*")&&(p=y())&&/^\.[^\\/.]+$/.test(p)){let s=TZ1(p,{...Q,fastpaths:!1}).output;d=F1.close=`)${s})${i})`}if(F1.prev.type==="bos")T.negatedExtglob=!0}q1({type:"paren",extglob:!0,value:_,output:d}),e("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let F1=!1,d=J.replace(dM6,(p,i,s,r,Z1,J1)=>{if(r==="\\")return F1=!0,p;if(r==="?"){if(i)return i+r+(Z1?A.repeat(Z1.length):"");if(J1===0)return E+(Z1?A.repeat(Z1.length):"");return A.repeat(s.length)}if(r===".")return W.repeat(s.length);if(r==="*"){if(i)return i+r+(Z1?I:"");return I}return i?p:`\\${p}`});if(F1===!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=rG.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){_+="\\",q1({type:"text",value:_});continue}let i=/^\\+/.exec(y()),s=0;if(i&&i[0].length>2){if(s=i[0].length,T.index+=s,s%2!==0)_+="\\"}if(Z.unescape===!0)_=k();else _+=k();if(T.brackets===0){q1({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("["),s=v.value.slice(0,i),r=v.value.slice(i+2),Z1=uM6[r];if(Z1){if(v.value=s+Z1,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&&_!=='"'){_=rG.escapeRegex(_),v.value+=_,m({value:_});continue}if(_==='"'){if(T.quotes=T.quotes===1?0:1,Z.keepQuotes===!0)q1({type:"text",value:_});continue}if(_==="("){u("parens"),q1({type:"paren",value:_});continue}if(_===")"){if(T.parens===0&&Z.strictBrackets===!0)throw SyntaxError(GO("opening","("));let p=S[S.length-1];if(p&&T.parens===p.parens+1){X1(S.pop());continue}q1({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(GO("closing","]"));_=`\\${_}`}else u("brackets");q1({type:"bracket",value:_});continue}if(_==="]"){if(Z.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){q1({type:"text",value:_,output:`\\${_}`});continue}if(T.brackets===0){if(Z.strictBrackets===!0)throw SyntaxError(GO("opening","["));q1({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||rG.hasRegexChars(p))continue;let i=rG.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),q1(p);continue}if(_==="}"){let p=x[x.length-1];if(Z.nobrace===!0||!p){q1({type:"text",value:_,output:_});continue}let i=")";if(p.dots===!0){let s=q.slice(),r=[];for(let Z1=s.length-1;Z1>=0;Z1--){if(q.pop(),s[Z1].type==="brace")break;if(s[Z1].type!=="dots")r.unshift(s[Z1].value)}i=cM6(r,Z),T.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let s=T.output.slice(0,p.outputIndex),r=T.tokens.slice(p.tokensIndex);p.value=p.output="\\{",_=i="\\}",T.output=s;for(let Z1 of r)T.output+=Z1.output||Z1.value}q1({type:"brace",value:_,output:i}),e("braces"),x.pop();continue}if(_==="|"){if(S.length>0)S[S.length-1].conditions++;q1({type:"text",value:_});continue}if(_===","){let p=_,i=x[x.length-1];if(i&&h[h.length-1]==="braces")i.comma=!0,p="|";q1({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}q1({type:"slash",value:_,output:H});continue}if(_==="."){if(T.braces>0&&v.type==="dot"){if(v.value===".")v.output=W;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"){q1({type:"text",value:_,output:W});continue}q1({type:"dot",value:_,output:W});continue}if(_==="?"){if(!(v&&v.value==="(")&&Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){U1("qmark",_);continue}if(v&&v.type==="paren"){let i=g(),s=_;if(v.value==="("&&!/[!=<:]/.test(i)||i==="<"&&!/<([!=]|\w+>)/.test(y()))s=`\\${_}`;q1({type:"text",value:_,output:s});continue}if(Z.dot!==!0&&(v.type==="slash"||v.type==="bos")){q1({type:"qmark",value:_,output:w});continue}q1({type:"qmark",value:_,output:A});continue}if(_==="!"){if(Z.noextglob!==!0&&g()==="("){if(g(2)!=="?"||!/[!=<:]/.test(g(3))){U1("negate",_);continue}}if(Z.nonegate!==!0&&T.index===0){n();continue}}if(_==="+"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){U1("plus",_);continue}if(v&&v.value==="("||Z.regex===!1){q1({type:"plus",value:_,output:F});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||T.parens>0){q1({type:"plus",value:_});continue}q1({type:"plus",value:F});continue}if(_==="@"){if(Z.noextglob!==!0&&g()==="("&&g(2)!=="?"){q1({type:"at",extglob:!0,value:_,output:""});continue}q1({type:"text",value:_});continue}if(_!=="*"){if(_==="$"||_==="^")_=`\\${_}`;let p=pM6.exec(y());if(p)_+=p[0],T.index+=p[0].length;q1({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 F1=y();if(Z.noextglob!==!0&&/^\([^?]/.test(F1)){U1("star",_);continue}if(v.type==="star"){if(Z.noglobstar===!0){f(_);continue}let p=v.prev,i=p.prev,s=p.type==="slash"||p.type==="bos",r=i&&(i.type==="star"||i.type==="globstar");if(Z.bash===!0&&(!s||F1[0]&&F1[0]!=="/")){q1({type:"star",value:_,output:""});continue}let Z1=T.braces>0&&(p.type==="comma"||p.type==="brace"),J1=S.length&&(p.type==="pipe"||p.type==="paren");if(!s&&p.type!=="paren"&&!Z1&&!J1){q1({type:"star",value:_,output:""});continue}while(F1.slice(0,3)==="/**"){let H1=J[T.index+4];if(H1&&H1!=="/")break;F1=F1.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"&&!r&&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"&&F1[0]==="/"){let H1=F1[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()),q1({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&F1[0]==="/"){v.type="globstar",v.value+=_,v.output=`(?:^|${H}|${j(Z)}${H})`,T.output=v.output,T.globstar=!0,f(_+k()),q1({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;q1(d);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&Z.regex===!0){d.output=_,q1(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}q1(d)}while(T.brackets>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing","]"));T.output=rG.escapeLast(T.output,"["),e("brackets")}while(T.parens>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing",")"));T.output=rG.escapeLast(T.output,"("),e("parens")}while(T.braces>0){if(Z.strictBrackets===!0)throw SyntaxError(GO("closing","}"));T.output=rG.escapeLast(T.output,"{"),e("braces")}if(Z.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket"))q1({type:"maybe_slash",value:"",output:`${H}?`});if(T.backtrack===!0){T.output="";for(let F1 of T.tokens)if(T.output+=F1.output!=null?F1.output:F1.value,F1.suffix)T.output+=F1.suffix}return T};TZ1.fastpaths=(J,Q)=>{let Z={...Q},X=typeof Z.maxLength==="number"?Math.min(kd,Z.maxLength):kd,Y=J.length;if(Y>X)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${X}`);J=ol1[J]||J;let{DOT_LITERAL:K,SLASH_LITERAL:q,ONE_CHAR:G,DOTS_SLASH:z,NO_DOT:U,NO_DOTS:W,NO_DOTS_SLASH:F,STAR:H,START_ANCHOR:B}=vd.globChars(Z.windows),M=Z.dot?W:U,V=Z.dot?F: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=rG.removePrefix(J,L),j=R(O);if(j&&Z.strictSlashes!==!0)j+=`${q}?`;return j};tl1.exports=TZ1});var RS=a((aM9,Qi1)=>{var lM6=sl1(),CZ1=el1(),Ji1=AS(),iM6=LS(),nM6=(J)=>J&&typeof J==="object"&&!Array.isArray(J),U7=(J,Q,Z=!1)=>{if(Array.isArray(J)){let W=J.map((H)=>U7(H,Q,Z));return(H)=>{for(let B of W){let M=B(H);if(M)return M}return!1}}let X=nM6(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?U7.compileRe(J,Q):U7.makeRe(J,Q,!1,!0),G=q.state;delete q.state;let z=()=>!1;if(Y.ignore){let W={...Q,ignore:null,onMatch:null,onResult:null};z=U7(Y.ignore,W,Z)}let U=(W,F=!1)=>{let{isMatch:H,match:B,output:M}=U7.test(W,q,Q,{glob:J,posix:K}),V={glob:J,state:G,regex:q,posix:K,input:W,output:M,match:B,isMatch:H};if(typeof Y.onResult==="function")Y.onResult(V);if(H===!1)return V.isMatch=!1,F?V:!1;if(z(W)){if(typeof Y.onIgnore==="function")Y.onIgnore(V);return V.isMatch=!1,F?V:!1}if(typeof Y.onMatch==="function")Y.onMatch(V);return F?V:!0};if(Z)U.state=G;return U};U7.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?Ji1.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=U7.matchBase(J,Q,Z,Y);else G=Q.exec(z);return{isMatch:Boolean(G),match:G,output:z}};U7.matchBase=(J,Q,Z)=>{return(Q instanceof RegExp?Q:U7.makeRe(Q,Z)).test(Ji1.basename(J))};U7.isMatch=(J,Q,Z)=>U7(Q,Z)(J);U7.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Z)=>U7.parse(Z,Q));return CZ1(J,{...Q,fastpaths:!1})};U7.scan=(J,Q)=>lM6(J,Q);U7.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=U7.toRegex(G,Q);if(X===!0)z.state=J;return z};U7.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=CZ1.fastpaths(J,Q);if(!Y.output)Y=CZ1(J,Q);return U7.compileRe(Y,Q,Z,X)};U7.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/$^/}};U7.constants=iM6;Qi1.exports=U7});var gN=a((rM9,Yi1)=>{var Zi1=RS(),aM6=AS();function Xi1(J,Q,Z=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:aM6.isWindows()};return Zi1(J,Q,Z)}Object.assign(Xi1,Zi1);Yi1.exports=Xi1});var _d;var Ki1=B1(()=>{_d={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"}],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"}],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 sM6(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function qi1(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=_d.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!sM6(X))return null;return X*1000}function Gi1(J){let Q=J.settings["tools.stopTimeout"],Z=_d.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Z)*1000}var tM9;var SZ1=B1(()=>{Ki1();tM9=_d.contributes.configuration.properties});function xd(J,Q){return new t1((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 vZ1=B1(()=>{I0()});function T7(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 vJ(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function Wi1(J){return["done","error","cancelled"].includes(J.status)}function zO(J){let Q=[],Z=new y8;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 oM6;return Y(K,q,G)},tools:S9(J.configService.config,Z.pipe(j2(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=()=>tM6.record(performance.now()-z,{toolName:K});if(K===_Z1&&q.args&&"invalid_tool_name"in q.args&&typeof q.args.invalid_tool_name==="string"){yd.add(1,{toolName:K,error:"invalid"});let F=kZ1(q.args.invalid_tool_name);return new t1((H)=>{H.error(Error(F))})}let W=X(K,G.config);if(!W){let F=Q.filter((V)=>V.spec.name===K);if(F.length===0)return yd.add(1,{toolName:K,error:"not_found"}),new t1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} not found`))});let H=F[0],B=OS(H.spec,G.config);yd.add(1,{toolName:K,error:"disabled"});let M=B.enabled?"unknown":B.disabledReason;return new t1((V)=>{V.error(Error(`tool ${JSON.stringify(K)} is disabled: ${M}`))})}return yd.add(1,{toolName:K}),g6(()=>W.fn).pipe(J8((F)=>{let H=F(q,G);if(W.spec.meta?.disableTimeout)return H;return xd(H,Gi1(G.config))}),gG(()=>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(W){l.error("preprocessArgs",{id:K,args:q,error:String(W)});return}},dispose(){}}}function bd(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(Ui1.default(Z,{dot:!0})(J))return!0}catch(X){continue}}return!1}function OS(J,Q){let Z=Q.settings?.["tools.disable"]??[];if(bd(J.name,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=Hi1(J.name);if(X&&J.source.mcp===X.server&&bd(X.tool,Z))return{enabled:!1,disabledReason:"settings"}}if(J.source==="builtin"&&bd(`builtin:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&bd(`toolbox:${J.name}`,Z))return{enabled:!1,disabledReason:"settings"};if(J.name===QJ||J.name===$B){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function kZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${jS.toString()}. Try again with a valid tool name.`}function Hi1(J){let[,Q,Z]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Z)return{server:Q,tool:Z};return}function xZ1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}function kJ(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&&Hi1(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 t1((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 zi1,Ui1,oM6,_Z1="invalid_tool",jS,Fi1,yd,tM6;var g2=B1(()=>{I0();z0();SZ1();vZ1();A8();zi1=_6(tp(),1),Ui1=_6(gN(),1);oM6={dispose(){}};jS=/^[a-zA-Z0-9_]{1,64}$/,Fi1=zi1.metrics.getMeter("tool_service"),yd=Fi1.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),tM6=Fi1.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var Li1=a((Vi1)=>{Object.defineProperty(Vi1,"__esModule",{value:!0});Vi1.calcSlices=Vi1.applyPatch=Vi1.calcPatch=Vi1.lcs=Vi1.diff=Vi1.diff_core=void 0;function eM6(J,Q){let{b:Z,eq:X,stack_base:Y}=J,{i:K,N:q,j:G,M:z,Z:U,stack_top:W}=J;for(;;)switch(Q){case 0:{J:while(q>0&&z>0){Z.fill(0,0,2*U);let F=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=F-O)>=1-A&&L<A&&T+Z[U+L-U*Math.floor(L/U)]>=q)if(A>1||T!==E){Y[W++]=K+T,Y[W++]=q-T,Y[W++]=G+S,Y[W++]=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=F-O)>=-A&&L<=A&&T+Z[L-U*Math.floor(L/U)]>=q)if(A>0||T!==E){Y[W++]=K+q-E,Y[W++]=E,Y[W++]=G+z-I,Y[W++]=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 F=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,F>=0)return J.i=K,J.N=q,J.j=G,J.M=z,J.Z=U,J.stack_top=W,1}}case 1:{if(W===0)return 2;z=Y[--W],G=Y[--W],q=Y[--W],K=Y[--W],U=2*(Math.min(q,z)+1),Q=0}}}class Bi1{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=eM6(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 Di1(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 Bi1({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:[]})}Vi1.diff_core=Di1;function fd(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 Di1(X,Y+1-X,X,K+1-X,Z)}Vi1.diff=fd;class Mi1{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 JV6(J,Q,Z){return new Mi1(fd(J,Q,Z),J.length)}Vi1.lcs=JV6;function*QV6(J,Q,Z){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let Y of fd(J,Q,Z))Y[2]=X.call(Q,Y[2],Y[3]),yield Y}Vi1.calcPatch=QV6;function*ZV6(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)}Vi1.applyPatch=ZV6;function*XV6(J,Q,Z){let X=0,Y=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[K,q,G,z]of fd(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)]}Vi1.calcSlices=XV6});function hd(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 Ai1.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 wi1(J){return{added:J?.split(`
|
|
6
6
|
`).length??0,deleted:0,changed:0}}function bZ1(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 Ai1;var gd=B1(()=>{Ai1=_6(Li1(),1)});function eK(){return`T-${crypto.randomUUID()}`}function zW(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 Ri1(J){return J.startsWith("toolu_")||J.startsWith("call_")}function Oi1(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 wX(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 WO(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 mN(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 yZ1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&zW(Q))return Q}return}function fZ1(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===C5)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?yZ1(q.progress):void 0;if(G)Q.push({toolUseID:Y.toolUseID,threadID:G,toolUse:K,toolResult:Y})}}}return Q}function ji1(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 hZ1(J){if(!J)return!1;return J.role==="info"}function UV6(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 md(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===QJ&&X.input){let Y=X.input.todos;if(Array.isArray(Y))return Y;let K=X.input.content;if(typeof K==="string")return UV6(K)}}return}function RQ(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
|
|
@@ -6135,7 +6135,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||uR}function hZ6(J,Q){let
|
|
|
6135
6135
|
`;async function dZ6(J,Q,Z,X){let Y=performance.now(),K=[...c_(uM1(J)),{role:"user",parts:[{text:_59.replace("{USER_GOAL}",Q)}]}],q=await _$(_r,K,[],J,Z,X,{responseMimeType:"application/json",responseJsonSchema:M0.toJSONSchema(pZ6)}),G=pZ6.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();x6();function cZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}function lZ6(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();dB();import x59 from"node:fs";import iZ6 from"node:path";function nZ6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!iZ6.isAbsolute(Q))return null;return l.debug("Extracted image path",{original:J,extracted:Q}),Q}function aZ6(J){try{let Q=iZ6.extname(J).toLowerCase(),Z=je1(Q);if(!Z)return l.warn("Unsupported image file extension",{ext:Q}),null;try{let X=x59.readFileSync(J);return b59(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 b59(J,Q){if(J.length>OW)return l.warn(`Image file too large: ${J.length} bytes (max: ${OW})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as AK6}from"node:child_process";import{rmdir as CY9}from"node:fs/promises";import{tmpdir as SY9}from"node:os";import wK6 from"node:path";rO();z0();import{spawn as y59}from"node:child_process";import{promises as f59}from"node:fs";function rZ6(J){return J.kind==="executable"}function sZ6(J){return J.kind==="markdown"}var uH=50000,oZ6=300000;async function wy1(J,Q,Z,X={}){let{timeoutMs:Y=oZ6,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}),sZ6(q))return await h59(q,Q);else if(rZ6(q))return await g59(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 h59(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await f59.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>uH?Z.slice(0,uH)+`
|
|
6136
6136
|
... (output truncated at ${uH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function g59(J,Q,Z=oZ6,X){return new Promise((Y)=>{let[K,q]=m59(J,Q);l.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=Ae1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),l.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),W=y59(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),F=[],H=[],B=0;W.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=uH)F.push(V);else{let N=uH-(B-V.length);if(N>0)F.push(V.slice(0,N))}}),W.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=uH)H.push(V);else{let N=uH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),W.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:F.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:F.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=F.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
|
|
6137
6137
|
${L}`:L;if(B>uH)A+=`
|
|
6138
|
-
... (output truncated at ${uH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.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:F.join(""),error:V})})})}function m59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return p59(Z,X?[...X]:null,Y,Q);else return u59(Z,X?[...X]:null,Y,Q)}function u59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function p59(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();Cj();V2();AB();kX();yW();x6();I0();import{mkdtemp as vY9,readFile as kY9,unlink as _Y9,writeFile as kR2}from"fs/promises";var Q51={};A6(Q51,{scrollUp:()=>zJ9,scrollDown:()=>UJ9,link:()=>MJ9,image:()=>VJ9,iTerm:()=>NJ9,exitAlternativeScreen:()=>BJ9,eraseUp:()=>GJ9,eraseStartLine:()=>KJ9,eraseScreen:()=>Ry1,eraseLines:()=>XJ9,eraseLine:()=>QX6,eraseEndLine:()=>YJ9,eraseDown:()=>qJ9,enterAlternativeScreen:()=>HJ9,cursorUp:()=>eZ6,cursorTo:()=>l59,cursorShow:()=>ZJ9,cursorSavePosition:()=>s59,cursorRestorePosition:()=>o59,cursorPrevLine:()=>JJ9,cursorNextLine:()=>e59,cursorMove:()=>i59,cursorLeft:()=>JX6,cursorHide:()=>QJ9,cursorGetPosition:()=>t59,cursorForward:()=>a59,cursorDown:()=>n59,cursorBackward:()=>r59,clearTerminal:()=>FJ9,clearScreen:()=>WJ9,beep:()=>DJ9});import Oy1 from"node:process";var J51=globalThis.window?.document!==void 0,kA2=globalThis.process?.versions?.node!==void 0,_A2=globalThis.process?.versions?.bun!==void 0,xA2=globalThis.Deno?.version?.deno!==void 0,bA2=globalThis.process?.versions?.electron!==void 0,yA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,fA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,hA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,gA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,mA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,vu=globalThis.navigator?.userAgentData?.platform,uA2=vu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",pA2=vu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",dA2=vu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",cA2=vu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),lA2=vu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var D2="\x1B[",_u="\x1B]",DC="\x07",ku=";",tZ6=!J51&&Oy1.env.TERM_PROGRAM==="Apple_Terminal",d59=!J51&&Oy1.platform==="win32",c59=J51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Oy1.cwd,l59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return D2+(J+1)+"G";return D2+(Q+1)+ku+(J+1)+"H"},i59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=D2+-J+"D";else if(J>0)Z+=D2+J+"C";if(Q<0)Z+=D2+-Q+"A";else if(Q>0)Z+=D2+Q+"B";return Z},eZ6=(J=1)=>D2+J+"A",n59=(J=1)=>D2+J+"B",a59=(J=1)=>D2+J+"C",r59=(J=1)=>D2+J+"D",JX6=D2+"G",s59=tZ6?"\x1B7":D2+"s",o59=tZ6?"\x1B8":D2+"u",t59=D2+"6n",e59=D2+"E",JJ9=D2+"F",QJ9=D2+"?25l",ZJ9=D2+"?25h",XJ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=QX6+(Z<J-1?eZ6():"");if(J)Q+=JX6;return Q},YJ9=D2+"K",KJ9=D2+"1K",QX6=D2+"2K",qJ9=D2+"J",GJ9=D2+"1J",Ry1=D2+"2J",zJ9=D2+"S",UJ9=D2+"T",WJ9="\x1Bc",FJ9=d59?`${Ry1}${D2}0f`:`${Ry1}${D2}3J${D2}H`,HJ9=D2+"?1049h",BJ9=D2+"?1049l",DJ9=DC,MJ9=(J,Q)=>[_u,"8",ku,ku,Q,DC,J,_u,"8",ku,ku,DC].join(""),VJ9=(J,Q={})=>{let Z=`${_u}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")+DC},NJ9={setCwd:(J=c59())=>`${_u}50;CurrentDir=${J}${DC}`,annotation(J,Q={}){let Z=`${_u}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+DC}};var Z51=_6(zX6(),1);function lV(J,Q,{target:Z="stdout",...X}={}){if(!Z51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return Q51.link(J,Q)}lV.isSupported=Z51.default.stdout;lV.stderr=(J,Q,Z={})=>lV(J,Q,{target:"stderr",...Z});lV.stderr.isSupported=Z51.default.stderr;z0();kX();class Py1{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.1760673682-g1d3f74"},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 Y51}from"node:child_process";import{platform as Ty1}from"node:os";import{promisify as RJ9}from"node:util";var X51=RJ9(Y51),OJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,jJ9="\x1B]52;c;?\x1B\\",$J9="\x1B]52;p;?\x1B\\";class UX6{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 X51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=Y51("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=Y51("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=Y51("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(jJ9)}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 X51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await X51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await X51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery($J9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Ty1()==="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(Ty1()==="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=OJ9(Z);process.stdout.write(X);return}if(Ty1()==="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 FY=new UX6;z0();class K51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class i7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function WX6(J){if(J instanceof K51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof i7)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 tV=null,xY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(tV)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(() => (gb1(),SJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{tV=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});tV=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{tV=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,W=new URL(`/clients/${Y}/${U}`,z).toString(),F=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => _6(Of1(),1))).toString(W,{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:F,qrCode:H});else return new i7(`Continue at ${F}`)}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(!tV)return new i7("Not connected to Amp web interface");try{tV.disconnect();let Z=tV.clientID;return tV=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new i7(`Disconnected from Amp web interface
|
|
6138
|
+
... (output truncated at ${uH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.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:F.join(""),error:V})})})}function m59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return p59(Z,X?[...X]:null,Y,Q);else return u59(Z,X?[...X]:null,Y,Q)}function u59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function p59(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();Cj();V2();AB();kX();yW();x6();I0();import{mkdtemp as vY9,readFile as kY9,unlink as _Y9,writeFile as kR2}from"fs/promises";var Q51={};A6(Q51,{scrollUp:()=>zJ9,scrollDown:()=>UJ9,link:()=>MJ9,image:()=>VJ9,iTerm:()=>NJ9,exitAlternativeScreen:()=>BJ9,eraseUp:()=>GJ9,eraseStartLine:()=>KJ9,eraseScreen:()=>Ry1,eraseLines:()=>XJ9,eraseLine:()=>QX6,eraseEndLine:()=>YJ9,eraseDown:()=>qJ9,enterAlternativeScreen:()=>HJ9,cursorUp:()=>eZ6,cursorTo:()=>l59,cursorShow:()=>ZJ9,cursorSavePosition:()=>s59,cursorRestorePosition:()=>o59,cursorPrevLine:()=>JJ9,cursorNextLine:()=>e59,cursorMove:()=>i59,cursorLeft:()=>JX6,cursorHide:()=>QJ9,cursorGetPosition:()=>t59,cursorForward:()=>a59,cursorDown:()=>n59,cursorBackward:()=>r59,clearTerminal:()=>FJ9,clearScreen:()=>WJ9,beep:()=>DJ9});import Oy1 from"node:process";var J51=globalThis.window?.document!==void 0,kA2=globalThis.process?.versions?.node!==void 0,_A2=globalThis.process?.versions?.bun!==void 0,xA2=globalThis.Deno?.version?.deno!==void 0,bA2=globalThis.process?.versions?.electron!==void 0,yA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,fA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,hA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,gA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,mA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,vu=globalThis.navigator?.userAgentData?.platform,uA2=vu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",pA2=vu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",dA2=vu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",cA2=vu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),lA2=vu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var D2="\x1B[",_u="\x1B]",DC="\x07",ku=";",tZ6=!J51&&Oy1.env.TERM_PROGRAM==="Apple_Terminal",d59=!J51&&Oy1.platform==="win32",c59=J51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Oy1.cwd,l59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return D2+(J+1)+"G";return D2+(Q+1)+ku+(J+1)+"H"},i59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=D2+-J+"D";else if(J>0)Z+=D2+J+"C";if(Q<0)Z+=D2+-Q+"A";else if(Q>0)Z+=D2+Q+"B";return Z},eZ6=(J=1)=>D2+J+"A",n59=(J=1)=>D2+J+"B",a59=(J=1)=>D2+J+"C",r59=(J=1)=>D2+J+"D",JX6=D2+"G",s59=tZ6?"\x1B7":D2+"s",o59=tZ6?"\x1B8":D2+"u",t59=D2+"6n",e59=D2+"E",JJ9=D2+"F",QJ9=D2+"?25l",ZJ9=D2+"?25h",XJ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=QX6+(Z<J-1?eZ6():"");if(J)Q+=JX6;return Q},YJ9=D2+"K",KJ9=D2+"1K",QX6=D2+"2K",qJ9=D2+"J",GJ9=D2+"1J",Ry1=D2+"2J",zJ9=D2+"S",UJ9=D2+"T",WJ9="\x1Bc",FJ9=d59?`${Ry1}${D2}0f`:`${Ry1}${D2}3J${D2}H`,HJ9=D2+"?1049h",BJ9=D2+"?1049l",DJ9=DC,MJ9=(J,Q)=>[_u,"8",ku,ku,Q,DC,J,_u,"8",ku,ku,DC].join(""),VJ9=(J,Q={})=>{let Z=`${_u}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")+DC},NJ9={setCwd:(J=c59())=>`${_u}50;CurrentDir=${J}${DC}`,annotation(J,Q={}){let Z=`${_u}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+DC}};var Z51=_6(zX6(),1);function lV(J,Q,{target:Z="stdout",...X}={}){if(!Z51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return Q51.link(J,Q)}lV.isSupported=Z51.default.stdout;lV.stderr=(J,Q,Z={})=>lV(J,Q,{target:"stderr",...Z});lV.stderr.isSupported=Z51.default.stderr;z0();kX();class Py1{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.1760688104-gc38593"},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 Y51}from"node:child_process";import{platform as Ty1}from"node:os";import{promisify as RJ9}from"node:util";var X51=RJ9(Y51),OJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,jJ9="\x1B]52;c;?\x1B\\",$J9="\x1B]52;p;?\x1B\\";class UX6{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 X51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=Y51("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=Y51("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=Y51("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(jJ9)}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 X51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await X51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await X51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery($J9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Ty1()==="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(Ty1()==="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=OJ9(Z);process.stdout.write(X);return}if(Ty1()==="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 FY=new UX6;z0();class K51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class i7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function WX6(J){if(J instanceof K51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof i7)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 tV=null,xY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(tV)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(() => (gb1(),SJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{tV=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});tV=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{tV=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,W=new URL(`/clients/${Y}/${U}`,z).toString(),F=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => _6(Of1(),1))).toString(W,{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:F,qrCode:H});else return new i7(`Continue at ${F}`)}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(!tV)return new i7("Not connected to Amp web interface");try{tV.disconnect();let Z=tV.clientID;return tV=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new i7(`Disconnected from Amp web interface
|
|
6139
6139
|
Client ID: ${Z}
|
|
6140
6140
|
Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class jf1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=eC(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new Py1(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(C0((Z)=>PB(Z.settings)),c6()).subscribe((Z)=>{this._initBaseCommands(Z.length>1)})}_initBaseCommands(J){if(this.commands={...bY9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,xY9);if(J)Object.assign(this.commands,yY9)}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 wy1(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 bY9={"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=vq(Z.settings),K=J.getInMemoryAgentModeOverride()??X;J.worker.handle({type:"user:message",message:{content:[{type:"text",text:J90}],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 K51;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 vY9(wK6.join(SY9(),"amp-edit-")),Y=wK6.join(X,"message.amp.md");AK6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await kY9(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 _Y9(Y),await CY9(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 uG("dangerouslyAllowAll",!1),new i7("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 uG("dangerouslyAllowAll",!0),new i7("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 HC();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:HC};await o71(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 a new thread with AI-prepared context: /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 i7(`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(`
|
|
6141
6141
|
`).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=Sj(new URL(Y),Z.id).toString(),G=`Thread URL: ${lV(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 i7(`${G}
|
|
@@ -6339,7 +6339,7 @@ ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTr
|
|
|
6339
6339
|
`),J.stdout.write(`Thread: ${H}
|
|
6340
6340
|
`),J.stdout.write(`Continue this thread with: amp threads continue ${W}
|
|
6341
6341
|
`)}}function Uu1(J){return J==="smart"?v1.rgb(3,197,97):J==="fast"?v1.rgb(228,180,2):J==="free"?v1.rgb(0,184,255):EF9(J)}function EF9(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 v1.index(Z[X])}df1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){K4.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
6342
|
-
`)}var Fu1=Wu1.join(gc1||Wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function SF9(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 XB(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")uG("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: ${W8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")uG("experimental.agentMode",Q.agentMode)}var vF9=M0.union([M0.object({command:M0.string(),args:M0.array(M0.string()).optional(),env:M0.record(M0.string(),M0.string()).optional()}).strict(),M0.object({url:M0.string()}).strict()]),kF9=M0.record(M0.string(),vF9);async function Bu1(J){try{await PF9(Wu1.dirname(Fu1),{recursive:!0}),await TF9(Fu1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function _F9(){try{return(await kW6(Fu1,"utf-8")).trim()}catch(J){return null}}async function xF9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return kF9.parse(Q)}catch(Z){if(Z instanceof M0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function bF9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}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 CW6=[{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??j5,description:`Custom settings file path (overrides the default location ${j5})`},{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 ${Tb1})`},{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:id}],SW6=(J)=>("deprecated"in J)&&J.deprecated===!0,yF9=(J)=>("hidden"in J)&&J.hidden===!0,fF9=(J)=>("default"in J),hF9=(J)=>("default"in J)?J.default:void 0;function gF9(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 _W6=null;function ze2(){return _W6}function pJ1(J){return{...J,getThreadEnvironment:$71,vfs:h20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new W_(J.fileSystem),generateThreadTitle:XG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Du1=O0.file(CF9.homedir()),xW6=process.env.XDG_CONFIG_HOME?O0.file(process.env.XDG_CONFIG_HOME):m0.joinPath(Du1,".config");async function YB(J,Q){bi1("0.0.
|
|
6342
|
+
`)}var Fu1=Wu1.join(gc1||Wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function SF9(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 XB(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")uG("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: ${W8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")uG("experimental.agentMode",Q.agentMode)}var vF9=M0.union([M0.object({command:M0.string(),args:M0.array(M0.string()).optional(),env:M0.record(M0.string(),M0.string()).optional()}).strict(),M0.object({url:M0.string()}).strict()]),kF9=M0.record(M0.string(),vF9);async function Bu1(J){try{await PF9(Wu1.dirname(Fu1),{recursive:!0}),await TF9(Fu1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function _F9(){try{return(await kW6(Fu1,"utf-8")).trim()}catch(J){return null}}async function xF9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return kF9.parse(Q)}catch(Z){if(Z instanceof M0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function bF9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}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 CW6=[{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??j5,description:`Custom settings file path (overrides the default location ${j5})`},{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 ${Tb1})`},{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:id}],SW6=(J)=>("deprecated"in J)&&J.deprecated===!0,yF9=(J)=>("hidden"in J)&&J.hidden===!0,fF9=(J)=>("default"in J),hF9=(J)=>("default"in J)?J.default:void 0;function gF9(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 _W6=null;function ze2(){return _W6}function pJ1(J){return{...J,getThreadEnvironment:$71,vfs:h20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new W_(J.fileSystem),generateThreadTitle:XG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Du1=O0.file(CF9.homedir()),xW6=process.env.XDG_CONFIG_HOME?O0.file(process.env.XDG_CONFIG_HOME):m0.joinPath(Du1,".config");async function YB(J,Q){bi1("0.0.1760688104-gc38593");let Z=dZ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:t1.of([O0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Du1,userConfigDir:xW6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (mJ1(),gJ1));X(Z);let Y=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=Ga(zO({configService:Z})),q=D20({configService:Z,toolService:K}),G=OR0(K,P9,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)FO("JetBrains");else if(Q.ide&&yQ6())FO("VS Code");else if(Q.ide&&fQ6())FO("Neovim");if(J.executeMode)yi1(!0);T96(K,{configService:Z});let U,W=v5.status.pipe(C0((w)=>Boolean(w.connected&&w.authenticated)),c6()).subscribe((w)=>{if(w){if(!U)U=K.registerTool(Zs)}else U?.dispose(),U=void 0}),F;if(!J.executeMode)F=new h71(process.cwd(),{},!0);else F=new class extends h71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(r2.write(`No API key found. Starting login flow...
|
|
6343
6343
|
`),!await mF9(J))await tw(),process.exit(1)}let H=await d20({isDevelopment:!1}),B=new IH1(H),M=new $H1(H,Z,{lazy:!0}),V=Q.notifications!==void 0?Q.notifications:!J.executeMode,N=S96({playNotificationSound:async(w)=>{if(V){C96(w);let R=uf1(),O=pf1();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=o20({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:F,notificationService:N,fileSystem:Q.jetbrains||Q.ide?b20:P9};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](),W.unsubscribe(),U?.dispose()}}}async function mF9(J){if(!J.executeMode){if(!await Dy1("Would you like to log in to Amp? [(y)es, (n)o]: "))return r2.write(`Login cancelled. Run the command again to retry.
|
|
6344
6344
|
`),!1}return await bW6(J)}async function bW6(J){let Q=IF9(32).toString("hex"),Z=await By1(J.ampURL,Q);try{await KZ(Z)}catch(Y){l.error("Failed to open browser",{error:Y})}let X=await By1(J.ampURL,Q,!1);r2.write(`If your browser did not open automatically, visit:
|
|
6345
6345
|
|
|
@@ -6349,12 +6349,12 @@ ${W8.blue.bold(X)}
|
|
|
6349
6349
|
Login successful! You can now use the Amp CLI.
|
|
6350
6350
|
`),!0}catch(Y){return l.error("Login failed",{error:Y}),K4.write(`
|
|
6351
6351
|
Login failed: ${Y instanceof Error?Y.message:String(Y)}
|
|
6352
|
-
`),!1}}function uF9(){let J=new mm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)QR(),process.exit(0);let H=F.originalError??F;_J6(H)}),J.option("-V, --version","output the version number",()=>{r2.write(`0.0.
|
|
6353
|
-
`),process.exit(0)}),J.addHelpText("after",_Q6()),J.configureHelp({formatHelp:xQ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await lF9(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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await cF9(M,await Qy1(B,M.settings))});let Q=async(F,H,B)=>{dZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:t1.of([O0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Du1,userConfigDir:xW6});let M={...H,executeMode:!1};await Hu1(M,{...F,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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await vW6(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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await tF9(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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);if(H.pick)await Q(M,V,B);else await oF9(M,V,F,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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await sF9(M,V,F,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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await vW6(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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await rF9(M,V,F,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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await aF9(M,V,F,B)}),hZ6(J,async(F,H)=>{let B=await VY(H);XB(F,H);let M=await YB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:QR,asyncDispose:M.asyncDispose.bind(M)}}),WZ6(J),XZ6(J,async(F)=>{let H=await VY(F);return{settings:H.settings,getThreadDeps:async(B)=>{XB(B,F);let M=await YB(H,F);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);XB(H,B);let V=await YB(M,B);try{await hb1(V,V.configService,{})}finally{await V.asyncDispose(),await QR()}});let X=new mm().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(F)=>{await zy1(F.force||!1,F.verbose||!1,"0.0.
|
|
6352
|
+
`),!1}}function uF9(){let J=new mm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)QR(),process.exit(0);let H=F.originalError??F;_J6(H)}),J.option("-V, --version","output the version number",()=>{r2.write(`0.0.1760688104-gc38593 (released 2025-10-17T08:07:32.617Z)
|
|
6353
|
+
`),process.exit(0)}),J.addHelpText("after",_Q6()),J.configureHelp({formatHelp:xQ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await lF9(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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await cF9(M,await Qy1(B,M.settings))});let Q=async(F,H,B)=>{dZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:t1.of([O0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Du1,userConfigDir:xW6});let M={...H,executeMode:!1};await Hu1(M,{...F,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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await vW6(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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await tF9(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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);if(H.pick)await Q(M,V,B);else await oF9(M,V,F,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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await sF9(M,V,F,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(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);await vW6(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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await rF9(M,V,F,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(F,H,B)=>{let M=B.optsWithGlobals(),V=await VY(M);await aF9(M,V,F,B)}),hZ6(J,async(F,H)=>{let B=await VY(H);XB(F,H);let M=await YB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:QR,asyncDispose:M.asyncDispose.bind(M)}}),WZ6(J),XZ6(J,async(F)=>{let H=await VY(F);return{settings:H.settings,getThreadDeps:async(B)=>{XB(B,F);let M=await YB(H,F);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await VY(B);XB(H,B);let V=await YB(M,B);try{await hb1(V,V.configService,{})}finally{await V.asyncDispose(),await QR()}});let X=new mm().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(F)=>{await zy1(F.force||!1,F.verbose||!1,"0.0.1760688104-gc38593"),process.exit()});J.addCommand(X,{hidden:!0});function Y(F,H,B){let V=typeof F.description==="string"?F.description:B===void 0?F.description(!0):F.description(B),N=new xV(H,V),L=hF9(F);if(L)N.default(L);if(N.hidden=yF9(F)||SW6(F),"choices"in F)N.choices([...F.choices]);return N}for(let F of CW6)switch(F.type){case"flag":{J.addOption(Y(F,`--${F.long}`)),J.addOption(Y(F,`--no-${F.long}`,!1));break}case"switch":{J.addOption(Y(F,`--${F.long}`,!0));break}default:{J.addOption(Y(F,`--${F.long} <value>`));break}}let K=new xV("-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);if(J.addOption(K),process.env.AMP_CLI_REMOTE){let F=new xV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1);J.addOption(F)}let q=new xV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(q);let G=new xV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(G);let z=new xV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(z),process.env.AMP_CONNECT==="1"){let F=new xV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(F)}J.action(async(F,H)=>{let B=F,M=await VY(B);if(Object.keys(B).forEach((V)=>{let N=CW6.find((L)=>L.name===V);if(N&&SW6(N)&&!fF9(N))K4.write(W8.yellow(`Warning: '--${V}' flag is deprecated
|
|
6354
6354
|
`))}),H.args.length>0)gF9(M,H);await Hu1(M,B,H)});let U=new mm("doctor").summary("Generate support bundle").description("Generate a support bundle for troubleshooting issues. This collects logs, configuration, and system information into a file that can be shared with Amp support for debugging.").option("--output-dir <path>","Directory to save the support bundle",process.cwd()).option("--include-full-logs","Include full log history",!1).allowUnknownOption(!1).action(async(F)=>{await nF9(F.outputDir,F.includeFullLogs)});J.addCommand(U);let W=new mm("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(F)=>{await iF9(F.version)});return J.addCommand(W),J}async function uJ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??eK(),K=pJ1(J);if(Z)await J.threadStorage.set(Y,Z);let q=await gJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,r71(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(a7(z,"assistant"))await Bu1(Y),G.unsubscribe()});return await q.resume(),q}async function Hu1(J,Q,Z){let X=a71(Q);if(X instanceof Error)HX(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let R=(await My1()).trimEnd();if(R)K=R}else Y=(await My1()).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"
|
|
6355
6355
|
Or pipe via stdin: echo "your message" | amp --execute`);XB(Z,Q);let q=await YB(J,Q);_W6=q;let G=pJ1(q),z=async(R)=>{let O=await kW6(R,"utf-8"),j=JSON.parse(O);if(!zW(j.id))throw new g9(fK.invalidThreadId);return uJ1(q,{visibility:X,thread:j})},U=async(R)=>{if(!zW(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}`),uG("experimental.agentMode",O.agentMode);else l.info("[fetchAndStartThread] No agentMode on thread, not setting override");return uJ1(q,{visibility:X,thread:O})},W=async()=>{try{if(Q.threadId)return U(Q.threadId);else return uJ1(q,{visibility:X})}catch(R){if(R instanceof g9)throw R;throw await S71(R,Q.threadId),Error("handleError should have called process.exit()")}},F=async()=>{return uJ1(q,{visibility:X})};if(Q.format==="jsonl")K4.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
6356
|
-
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await FZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await W();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 Kr1();let R=await IO({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)v5.selectConfig(O)}else B=!0}let V=Fy1("0.0.
|
|
6357
|
-
`);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 xF9(J.mcpConfig);Y=bF9(Y,G)}let K=await Y.get("url","global");if(!K)K=FZ;if(!FB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=Kl1(Y),await Y.get("debug.httpLogging"))Zl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:HZ6(await Qy1(J,Y))}}function pF9(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 dF9(){let J=pF9(process.argv);if(DJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),SF9(l),l.info("Starting Amp CLI.",{version:"0.0.
|
|
6356
|
+
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await FZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await W();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 Kr1();let R=await IO({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)v5.selectConfig(O)}else B=!0}let V=Fy1("0.0.1760688104-gc38593",q.settingsStorage),N=t1.of([O0.file(process.cwd())]),L=eC(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A=await X5.getUserFreeTierStatus({},{config:q.configService});l.info("User free tier status:",A);let w=await MZ6();l.info("Loaded session state:",w),await TW6({stdout:process.stdout,history:new pb1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:X5,ampURL:J.ampURL,startNewThread:F,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:v5,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 VY(J){if(J.interactive)K4.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
6357
|
+
`);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 xF9(J.mcpConfig);Y=bF9(Y,G)}let K=await Y.get("url","global");if(!K)K=FZ;if(!FB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=Kl1(Y),await Y.get("debug.httpLogging"))Zl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:HZ6(await Qy1(J,Y))}}function pF9(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 dF9(){let J=pF9(process.argv);if(DJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),SF9(l),l.info("Starting Amp CLI.",{version:"0.0.1760688104-gc38593",buildTimestamp:"2025-10-17T08:07:32.617Z",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 uF9().parseAsync(process.argv)}dF9().catch(S71);async function cF9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),r2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
6358
6358
|
`);else if(!FB(J.ampURL))r2.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
6359
6359
|
`);let Z=process.env.AMP_API_KEY;if(Z)r2.write(`API key found in environment variable, storing...
|
|
6360
6360
|
`),await Q.set("apiKey",Z,J.ampURL),r2.write(`API key successfully stored.
|
|
@@ -6370,7 +6370,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);XB(Z,Q);let q=await YB(
|
|
|
6370
6370
|
`));try{let Q;if(J)Q=J,K4.write(W8.blue(`Updating to version ${J}...
|
|
6371
6371
|
`)),await WC(J),K4.write(W8.green(`✓ Successfully updated to version ${J}
|
|
6372
6372
|
`));else{K4.write(W8.blue(`Checking for updates...
|
|
6373
|
-
`));let{hasUpdate:X,latestVersion:Y}=await gj("0.0.
|
|
6373
|
+
`));let{hasUpdate:X,latestVersion:Y}=await gj("0.0.1760688104-gc38593");if(!X)K4.write(W8.green(`✓ Amp CLI is already up to date.
|
|
6374
6374
|
`)),process.exit(0);if(!Y)K4.write(W8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,K4.write(W8.blue(`Updating to version ${Y}...
|
|
6375
6375
|
`)),await WC(Y),K4.write(W8.green(`✓ Successfully updated to version ${Y}
|
|
6376
6376
|
`))}let Z=await KR(Q);if(Z.warning)K4.write(`
|