@linzumi/cli 1.0.274 → 1.0.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +10 -9
  2. package/dist/{impl-ts/cloud-supervisor.mjs → cloud-supervisor.mjs} +85 -85
  3. package/dist/hosted-coding-account-worker.js +25 -0
  4. package/dist/index.js +1609 -3
  5. package/dist/mcp-server.mjs +174 -168
  6. package/dist/{impl-res/native → native}/darwin/manifest.json +5 -2
  7. package/dist/remote-codex-harness-worker.js +757 -0
  8. package/dist/tcp-tunnel-cli.mjs +25 -69
  9. package/dist/topics-cli.mjs +137 -13
  10. package/package.json +9 -16
  11. package/scripts/build.mjs +33 -356
  12. package/scripts/bump-cli-version.mjs +35 -9
  13. package/scripts/check-package-size-budget.mjs +13 -61
  14. package/dist/impl-res/cloud-supervisor.mjs +0 -281
  15. package/dist/impl-res/index.js +0 -1546
  16. package/dist/impl-res/mcp-server.mjs +0 -461
  17. package/dist/impl-ts/assets/linzumi-logo.svg +0 -1
  18. package/dist/impl-ts/crossHarnessFailover.mjs +0 -14
  19. package/dist/impl-ts/index.js +0 -2617
  20. package/dist/impl-ts/mcp-server.mjs +0 -455
  21. package/dist/impl-ts/native/darwin/manifest.json +0 -21
  22. package/dist/impl-ts/native/darwin/preview-process-identity +0 -0
  23. package/dist/impl-ts/tcp-tunnel-cli.mjs +0 -93
  24. package/scripts/build-differential-entry-impl-res.mjs +0 -64
  25. package/scripts/build-differential-entry.mjs +0 -180
  26. package/scripts/build-onboarding-demo-evidence.mjs +0 -186
  27. package/scripts/build-tui-demo-evidence.mjs +0 -107
  28. package/scripts/diagnose-claude-probe.ts +0 -198
  29. package/scripts/differentialMutations.mjs +0 -114
  30. package/scripts/f5_live_cross_harness_failover_e2e.mjs +0 -239
  31. package/scripts/golden-chaos-harness.mjs +0 -1420
  32. package/scripts/normalize-agent-replay-fixture.ts +0 -281
  33. package/scripts/promote-gstack-claude-smoke-fixture.ts +0 -891
  34. package/scripts/record-agent-replay-fixtures.ts +0 -610
  35. package/scripts/replay-agent-backend-browser.ts +0 -198
  36. package/scripts/replay-agent-backend.ts +0 -1961
  37. package/scripts/replay-agent-fixture.ts +0 -326
  38. package/scripts/typecheck.mjs +0 -42
  39. /package/dist/{impl-res/assets → assets}/linzumi-logo.svg +0 -0
  40. /package/dist/{impl-res/crossHarnessFailover.mjs → crossHarnessFailover.mjs} +0 -0
  41. /package/dist/{impl-res/native → native}/darwin/preview-process-identity +0 -0
@@ -1,281 +0,0 @@
1
- import { createRequire as __linzumiBundleCreateRequire } from 'node:module';
2
- const require = __linzumiBundleCreateRequire(import.meta.url);
3
- var ZF=Object.create;var Zm=Object.defineProperty;var QF=Object.getOwnPropertyDescriptor;var YF=Object.getOwnPropertyNames;var XF=Object.getPrototypeOf,eD=Object.prototype.hasOwnProperty;var He=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var q=(e,t)=>()=>(e&&(t=e(e=0)),t);var tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tD=(e,t)=>{for(var n in t)Zm(e,n,{get:t[n],enumerable:!0})},nD=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of YF(t))!eD.call(e,r)&&r!==n&&Zm(e,r,{get:()=>t[r],enumerable:!(i=QF(t,r))||i.enumerable});return e};var oa=(e,t,n)=>(n=e!=null?ZF(XF(e)):{},nD(t||!e||!e.__esModule?Zm(n,"default",{value:e,enumerable:!0}):n,e));var Qm=q(()=>{});function Nt(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Ou(e){if(e!=null)return Nt(e)}function Ve(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}var nt=q(()=>{});function aa(e,t){if(e!==void 0)return t(Ve(e))}function St(e,t){if(e!==void 0)return Nt(t(Ve(e)))}function mn(e,t){if(e!==void 0)return t(Ve(e))}function Ke(e,t){return e!==void 0?Ve(e):t}var Me=q(()=>{Qm();nt()});var Ru=q(()=>{});function dn(e,t,n){return e.reduce(n,t)}var Et=q(()=>{Ru();nt()});function ri(e){if(e.RE_EXN_ID==="JsExn")return Nt(e._1)}var $u,iD,Dr,Bue,Wue,ii=q(()=>{nt();$u=(e=>t=>t&&typeof t[e]=="string"?t[e]:void 0),iD=$u("stack"),Dr=$u("message"),Bue=$u("name"),Wue=$u("fileName")});var Mu=q(()=>{});var ik=tt((Hue,rk)=>{var Ci=He("constants"),oD=process.cwd,ju=null,aD=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ju||(ju=oD.call(process)),ju};try{process.cwd()}catch{}typeof process.chdir=="function"&&(eh=process.chdir,process.chdir=function(e){ju=null,eh.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,eh));var eh;rk.exports=sD;function sD(e){Ci.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=r(e.chmodSync),e.fchmodSync=r(e.fchmodSync),e.lchmodSync=r(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=d(e.statSync),e.fstatSync=d(e.fstatSync),e.lstatSync=d(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(u,c,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(u,c,p,f){f&&process.nextTick(f)},e.lchownSync=function(){}),aD==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(u){function c(p,f,h){var g=Date.now(),_=0;u(p,f,function y(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){e.stat(f,function(v,w){v&&v.code==="ENOENT"?u(p,f,y):h(b)})},_),_<100&&(_+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,u),c})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(u){function c(p,f,h,g,_,y){var b;if(y&&typeof y=="function"){var v=0;b=function(w,A,C){if(w&&w.code==="EAGAIN"&&v<10)return v++,u.call(e,p,f,h,g,_,b);y.apply(this,arguments)}}return u.call(e,p,f,h,g,_,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,u),c})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(u){return function(c,p,f,h,g){for(var _=0;;)try{return u.call(e,c,p,f,h,g)}catch(y){if(y.code==="EAGAIN"&&_<10){_++;continue}throw y}}})(e.readSync);function t(u){u.lchmod=function(c,p,f){u.open(c,Ci.O_WRONLY|Ci.O_SYMLINK,p,function(h,g){if(h){f&&f(h);return}u.fchmod(g,p,function(_){u.close(g,function(y){f&&f(_||y)})})})},u.lchmodSync=function(c,p){var f=u.openSync(c,Ci.O_WRONLY|Ci.O_SYMLINK,p),h=!0,g;try{g=u.fchmodSync(f,p),h=!1}finally{if(h)try{u.closeSync(f)}catch{}else u.closeSync(f)}return g}}function n(u){Ci.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(c,p,f,h){u.open(c,Ci.O_SYMLINK,function(g,_){if(g){h&&h(g);return}u.futimes(_,p,f,function(y){u.close(_,function(b){h&&h(y||b)})})})},u.lutimesSync=function(c,p,f){var h=u.openSync(c,Ci.O_SYMLINK),g,_=!0;try{g=u.futimesSync(h,p,f),_=!1}finally{if(_)try{u.closeSync(h)}catch{}else u.closeSync(h)}return g}):u.futimes&&(u.lutimes=function(c,p,f,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function i(u){return u&&function(c,p,f){return u.call(e,c,p,function(h){l(h)&&(h=null),f&&f.apply(this,arguments)})}}function r(u){return u&&function(c,p){try{return u.call(e,c,p)}catch(f){if(!l(f))throw f}}}function o(u){return u&&function(c,p,f,h){return u.call(e,c,p,f,function(g){l(g)&&(g=null),h&&h.apply(this,arguments)})}}function a(u){return u&&function(c,p,f){try{return u.call(e,c,p,f)}catch(h){if(!l(h))throw h}}}function s(u){return u&&function(c,p,f){typeof p=="function"&&(f=p,p=null);function h(g,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),f&&f.apply(this,arguments)}return p?u.call(e,c,p,h):u.call(e,c,h)}}function d(u){return u&&function(c,p){var f=p?u.call(e,c,p):u.call(e,c);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(u){if(!u||u.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var sk=tt((Vue,ak)=>{var ok=He("stream").Stream;ak.exports=dD;function dD(e){return{ReadStream:t,WriteStream:n};function t(i,r){if(!(this instanceof t))return new t(i,r);ok.call(this);var o=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,r=r||{};for(var a=Object.keys(r),s=0,d=a.length;s<d;s++){var l=a[s];this[l]=r[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(u,c){if(u){o.emit("error",u),o.readable=!1;return}o.fd=c,o.emit("open",c),o._read()})}function n(i,r){if(!(this instanceof n))return new n(i,r);ok.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var o=Object.keys(r),a=0,s=o.length;a<s;a++){var d=o[a];this[d]=r[d]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var lk=tt((Zue,dk)=>{"use strict";dk.exports=uD;var lD=Object.getPrototypeOf||function(e){return e.__proto__};function uD(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:lD(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var ih=tt((Que,rh)=>{var wt=He("fs"),cD=ik(),fD=sk(),pD=lk(),qu=He("util"),Yt,Fu;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Yt=Symbol.for("graceful-fs.queue"),Fu=Symbol.for("graceful-fs.previous")):(Yt="___graceful-fs.queue",Fu="___graceful-fs.previous");function mD(){}function fk(e,t){Object.defineProperty(e,Yt,{get:function(){return t}})}var ao=mD;qu.debuglog?ao=qu.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ao=function(){var e=qu.format.apply(qu,arguments);e="GFS4: "+e.split(/\n/).join(`
4
- GFS4: `),console.error(e)});wt[Yt]||(uk=global[Yt]||[],fk(wt,uk),wt.close=(function(e){function t(n,i){return e.call(wt,n,function(r){r||ck(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Fu,{value:e}),t})(wt.close),wt.closeSync=(function(e){function t(n){e.apply(wt,arguments),ck()}return Object.defineProperty(t,Fu,{value:e}),t})(wt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ao(wt[Yt]),He("assert").equal(wt[Yt].length,0)}));var uk;global[Yt]||fk(global,wt[Yt]);rh.exports=th(pD(wt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wt.__patched&&(rh.exports=th(wt),wt.__patched=!0);function th(e){cD(e),e.gracefulify=th,e.createReadStream=A,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(T,E,P){return typeof E=="function"&&(P=E,E=null),R(T,E,P);function R(O,M,J,Z){return t(O,M,function(z){z&&(z.code==="EMFILE"||z.code==="ENFILE")?sa([R,[O,M,J],z,Z||Date.now(),Date.now()]):typeof J=="function"&&J.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return i(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return o(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=d);function d(T,E,P,R){return typeof P=="function"&&(R=P,P=0),O(T,E,P,R);function O(M,J,Z,z,X){return s(M,J,Z,function(ee){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var l=e.readdir;e.readdir=c;var u=/^v[0-5]\./;function c(T,E,P){typeof E=="function"&&(P=E,E=null);var R=u.test(process.version)?function(J,Z,z,X){return l(J,O(J,Z,z,X))}:function(J,Z,z,X){return l(J,Z,O(J,Z,z,X))};return R(T,E,P);function O(M,J,Z,z){return function(X,ee){X&&(X.code==="EMFILE"||X.code==="ENFILE")?sa([R,[M,J,Z],X,z||Date.now(),Date.now()]):(ee&&ee.sort&&ee.sort(),typeof Z=="function"&&Z.call(this,X,ee))}}}if(process.version.substr(0,4)==="v0.8"){var p=fD(e);y=p.ReadStream,v=p.WriteStream}var f=e.ReadStream;f&&(y.prototype=Object.create(f.prototype),y.prototype.open=b);var h=e.WriteStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(T){v=T},enumerable:!0,configurable:!0});var g=y;Object.defineProperty(e,"FileReadStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var _=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return _},set:function(T){_=T},enumerable:!0,configurable:!0});function y(T,E){return this instanceof y?(f.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function b(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.autoClose&&T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P),T.read())})}function v(T,E){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function w(){var T=this;k(T.path,T.flags,T.mode,function(E,P){E?(T.destroy(),T.emit("error",E)):(T.fd=P,T.emit("open",P))})}function A(T,E){return new e.ReadStream(T,E)}function C(T,E){return new e.WriteStream(T,E)}var S=e.open;e.open=k;function k(T,E,P,R){return typeof P=="function"&&(R=P,P=null),O(T,E,P,R);function O(M,J,Z,z,X){return S(M,J,Z,function(ee,B){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?sa([O,[M,J,Z,z],ee,X||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}return e}function sa(e){ao("ENQUEUE",e[0].name,e[1]),wt[Yt].push(e),nh()}var Nu;function ck(){for(var e=Date.now(),t=0;t<wt[Yt].length;++t)wt[Yt][t].length>2&&(wt[Yt][t][3]=e,wt[Yt][t][4]=e);nh()}function nh(){if(clearTimeout(Nu),Nu=void 0,wt[Yt].length!==0){var e=wt[Yt].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)ao("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){ao("TIMEOUT",t.name,n);var a=n.pop();typeof a=="function"&&a.call(null,i)}else{var s=Date.now()-o,d=Math.max(o-r,1),l=Math.min(d*1.2,100);s>=l?(ao("RETRY",t.name,n),t.apply(null,n.concat([r]))):wt[Yt].push(e)}Nu===void 0&&(Nu=setTimeout(nh,0))}}});var mk=tt((Yue,pk)=>{function Vn(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}pk.exports=Vn;Vn.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Vn.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Vn.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};Vn.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Vn.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Vn.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Vn.prototype.start=Vn.prototype.try;Vn.prototype.errors=function(){return this._errors};Vn.prototype.attempts=function(){return this._attempts};Vn.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,a=(e[o]||0)+1;e[o]=a,a>=n&&(t=r,n=a)}return t}});var hk=tt(so=>{var hD=mk();so.operation=function(e){var t=so.timeouts(e);return new hD(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};so.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,a){return o-a}),i};so.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};so.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],a=e[o];e[o]=function(d){var l=so.operation(t),u=Array.prototype.slice.call(arguments,1),c=u.pop();u.push(function(p){l.retry(p)||(p&&(arguments[0]=l.mainError()),c.apply(this,arguments))}),l.attempt(function(){d.apply(e,u)})}.bind(e,a),e[o].options=t}}});var yk=tt((ece,gk)=>{gk.exports=hk()});var _k=tt((tce,Du)=>{Du.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Du.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Du.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var kk=tt((nce,ua)=>{var ft=global.process,lo=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};lo(ft)?(bk=He("assert"),da=_k(),vk=/^win/i.test(ft.platform),Zs=He("events"),typeof Zs!="function"&&(Zs=Zs.EventEmitter),ft.__signal_exit_emitter__?zt=ft.__signal_exit_emitter__:(zt=ft.__signal_exit_emitter__=new Zs,zt.count=0,zt.emitted={}),zt.infinite||(zt.setMaxListeners(1/0),zt.infinite=!0),ua.exports=function(e,t){if(!lo(global.process))return function(){};bk.equal(typeof e,"function","a callback must be provided for exit handler"),la===!1&&oh();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){zt.removeListener(n,e),zt.listeners("exit").length===0&&zt.listeners("afterexit").length===0&&Lu()};return zt.on(n,e),i},Lu=function(){!la||!lo(global.process)||(la=!1,da.forEach(function(t){try{ft.removeListener(t,Uu[t])}catch{}}),ft.emit=Gu,ft.reallyExit=ah,zt.count-=1)},ua.exports.unload=Lu,uo=function(t,n,i){zt.emitted[t]||(zt.emitted[t]=!0,zt.emit(t,n,i))},Uu={},da.forEach(function(e){Uu[e]=function(){if(lo(global.process)){var n=ft.listeners(e);n.length===zt.count&&(Lu(),uo("exit",null,e),uo("afterexit",null,e),vk&&e==="SIGHUP"&&(e="SIGINT"),ft.kill(ft.pid,e))}}}),ua.exports.signals=function(){return da},la=!1,oh=function(){la||!lo(global.process)||(la=!0,zt.count+=1,da=da.filter(function(t){try{return ft.on(t,Uu[t]),!0}catch{return!1}}),ft.emit=wk,ft.reallyExit=Sk)},ua.exports.load=oh,ah=ft.reallyExit,Sk=function(t){lo(global.process)&&(ft.exitCode=t||0,uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),ah.call(ft,ft.exitCode))},Gu=ft.emit,wk=function(t,n){if(t==="exit"&&lo(global.process)){n!==void 0&&(ft.exitCode=n);var i=Gu.apply(this,arguments);return uo("exit",ft.exitCode,null),uo("afterexit",ft.exitCode,null),i}else return Gu.apply(this,arguments)}):ua.exports=function(){return function(){}};var bk,da,vk,Zs,zt,Lu,uo,Uu,la,oh,ah,Sk,Gu,wk});var Ek=tt((rce,Qs)=>{"use strict";var gD=He("path"),lh=ih(),yD=yk(),_D=kk(),oi={};function ca(e,t){return t.lockfilePath||`${e}.lock`}function uh(e,t,n){if(!t.realpath)return n(null,gD.resolve(e));t.fs.realpath(e,n)}function sh(e,t,n){t.fs.mkdir(ca(e,t),i=>{if(!i)return n();if(i.code!=="EEXIST")return n(i);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));t.fs.stat(ca(e,t),(r,o)=>{if(r)return r.code==="ENOENT"?sh(e,{...t,stale:0},n):n(r);if(!Tk(o,t))return n(Object.assign(new Error("Lock file is already being hold"),{code:"ELOCKED",file:e}));Ck(e,t,a=>{if(a)return n(a);sh(e,{...t,stale:0},n)})})})}function Tk(e,t){return e.mtime.getTime()<Date.now()-t.stale}function Ck(e,t,n){t.fs.rmdir(ca(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function dh(e,t){let n=oi[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{let i=Date.now()/1e3;n.updateTimeout=null,t.fs.utimes(ca(e,t),i,i,r=>{if(!n.released){if(n.lastUpdate<=Date.now()-t.stale&&n.lastUpdate>Date.now()-t.stale*2){let o=Object.assign(new Error(n.updateError||"Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"});return xk(e,n,o)}if(r)return r.code==="ENOENT"?xk(e,n,Object.assign(r,{code:"ECOMPROMISED"})):(n.updateError=r,n.updateDelay=1e3,dh(e,t));n.lastUpdate=Date.now(),n.updateError=null,n.updateDelay=null,dh(e,t)}})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function xk(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),oi[e]===t&&delete oi[e],t.options.onCompromised(n)}function bD(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:lh,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),uh(e,t,(i,r)=>{if(i)return n(i);let o=yD.operation(t.retries);o.attempt(()=>{sh(r,t,a=>{if(o.retry(a))return;if(a)return n(o.mainError());let s=oi[r]={options:t,lastUpdate:Date.now()};dh(r,t),n(null,d=>{if(s.released)return d&&d(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));Ak(r,{...t,realpath:!1},d)})})})})}function Ak(e,t,n){t={fs:lh,realpath:!0,...t},uh(e,t,(i,r)=>{if(i)return n(i);let o=oi[r];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete oi[r],Ck(r,t,n)})}function vD(e,t,n){t={stale:1e4,realpath:!0,fs:lh,...t},t.stale=Math.max(t.stale||0,2e3),uh(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(ca(r,t),(o,a)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!Tk(a,t)))})}function SD(){return oi}_D(()=>{for(let e in oi){let t=oi[e].options;try{t.fs.rmdirSync(ca(e,t))}catch{}}});Qs.exports.lock=bD;Qs.exports.unlock=Ak;Qs.exports.check=vD;Qs.exports.getLocks=SD});var Ik=tt((ice,Pk)=>{"use strict";var wD=ih();function kD(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),a;try{a=e[`${i}Sync`](...r)}catch(s){return o(s)}o(null,a)}}),n}function xD(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function TD(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function CD(e){if(e={...e},e.fs=kD(e.fs||wD),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}Pk.exports={toPromise:xD,toSync:TD,toSyncOptions:CD}});var Rk=tt((oce,Ai)=>{"use strict";var fa=Ek(),{toPromise:zu,toSync:Ju,toSyncOptions:ch}=Ik();async function Ok(e,t){let n=await zu(fa.lock)(e,t);return zu(n)}function AD(e,t){let n=Ju(fa.lock)(e,ch(t));return Ju(n)}function ED(e,t){return zu(fa.unlock)(e,t)}function PD(e,t){return Ju(fa.unlock)(e,ch(t))}function ID(e,t){return zu(fa.check)(e,t)}function OD(e,t){return Ju(fa.check)(e,ch(t))}Ai.exports=Ok;Ai.exports.lock=Ok;Ai.exports.unlock=ED;Ai.exports.lockSync=AD;Ai.exports.unlockSync=PD;Ai.exports.check=ID;Ai.exports.checkSync=OD});var $k=q(()=>{});var Mk=q(()=>{});var Ku=q(()=>{});var Jt=q(()=>{$k();Mk();Ku()});function MD(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function Kt(e){return MD(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function mh(e){let t=ph[e];if(t!==void 0){let n=t+1|0;return ph[e]=n,e+("/"+n)}return ph[e]=1,e}var ph,en=q(()=>{ph={}});import*as Nk from"node:child_process";function pa(e){let t=ri(e);if(t===void 0)return{code:void 0,message:"unknown error"};let n=Ve(t);return{code:Ou(n.code),message:Ke(Dr(n),"unknown error")}}function Fk(e,t,n,i){try{return{TAG:"Ok",_0:Nk.execFileSync(e,t,{encoding:"utf8",timeout:n,maxBuffer:i})}}catch(r){let o=Kt(r);return{TAG:"Error",_0:pa(o)}}}var jD,Bt=q(()=>{ii();Me();Mu();jD=oa(Rk(),1);Jt();nt();en()});function Lk(e){let t=Fk(e,["--version"],1e4,1048576);if(t.TAG!=="Ok")return;let n=Dk.exec(t._0);if(n!=null)return mn(n.slice(1)[0],i=>i)}function Uk(e,t){return e!==void 0&&t!==void 0?e===t?{TAG:"Match",version:e}:{TAG:"Mismatch",pathVersion:e,pinnedVersion:t}:{TAG:"Unverified",pathVersion:e,pinnedVersion:t}}var Dk,Gk=q(()=>{Et();Bt();Me();Jt();Dk=new RegExp("(\\d+\\.\\d+\\.\\d+)")});function ND(e,t){let n=Uk(e,t);switch(n.TAG){case"Match":return{TAG:"Ok",_0:n.version};case"Mismatch":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=mismatch observed="+n.pathVersion+" expected="+n.pinnedVersion};case"Unverified":return{TAG:"Error",_0:"hosted_codex_runtime_refused reason=unverified observed=unverified expected="+t}}}function zk(e,t){return ND(Lk(e),t)}var Jk=q(()=>{Me();Gk()});var Kk,hh=q(()=>{Jk();Kk=zk});var Wk,Bk=q(()=>{Wk={name:"@linzumi/cli",version:"1.0.274",description:"Linzumi CLI \u2014 point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",type:"module",bin:{linzumi:"bin/linzumi.js"},files:["README.md","bin","dist","scripts","!scripts/build-*-oracle.mjs"],scripts:{"test:agent-source":"LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts test/llmProxySessionCredential.test.ts test/runnerBridge.test.ts test/threadCodexWorkerIpc.test.ts -t '(?:^| )(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup|does not install an old mint after its credential is (replaced|stopped)|worker agent capability requires an exact true ready flag|starts an explicitly server-keyed OpenAI agent worker without local OpenAI credentials|applies the accepted OpenAI follow-up model on an existing worker|refuses explicit OpenAI worker creation with (passthrough|missing-token|blank-origin) binding|refuses a private agent turn without an owned relay before Codex|explicitly capable worker receives a private request through ordinary IPC|old worker receives no private agent source descriptor)$'",build:"rescript build ../linzumi-cli-rescript && node scripts/build.mjs","test:actual-commander-parity":"pnpm --dir ../linzumi-cli-rescript build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/ActualCommanderParityConformance.res.mjs","bump-version":"node scripts/bump-cli-version.mjs","codex:history-table":"node scripts/codex_history_table.mjs",test:"npm run test:startup && node --import tsx --test ../linzumi-cli-rescript/src/parity/McpToolCallBoundaryTest.res.mjs && rescript build ../../kandan/server_v2/web/replay_harness && vitest run --config vitest.config.mjs",typecheck:"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json","typecheck:all":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.json","typecheck:watch":"rescript build ../linzumi-cli-rescript && tsgo --noEmit -w -p tsconfig.source.json",prepack:"rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs","pack:dry-run":"npm pack --dry-run","record:agent-fixtures":"tsx scripts/record-agent-replay-fixtures.ts","normalize:agent-fixture":"tsx scripts/normalize-agent-replay-fixture.ts","vendor:codex-app-server-protocol":"tsx scripts/vendor-codex-app-server-protocol.ts","replay:agent-fixture":"tsx scripts/replay-agent-fixture.ts","replay:agent-backend":"tsx scripts/replay-agent-backend.ts","vendor:codex-app-server-protocol:check":"tsx scripts/vendor-codex-app-server-protocol.ts --check","replay:agent-backend-browser":"tsx scripts/replay-agent-backend-browser.ts","promote:gstack-claude-smoke-fixture":"tsx scripts/promote-gstack-claude-smoke-fixture.ts","diagnose:claude-probe":"tsx scripts/diagnose-claude-probe.ts","test:startup":"npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs"},keywords:["linzumi","kandan","codex","local-runner"],license:"MIT",publishConfig:{access:"public"},dependencies:{"@anthropic-ai/claude-agent-sdk":"0.3.199","@inquirer/prompts":"^7.8.6","@modelcontextprotocol/sdk":"^1.29.0","@openai/codex":"0.153.2",blessed:"^0.1.81","proper-lockfile":"3.2.0",undici:"^6.25.0",ws:"^8.18.0",zod:"^3.25.76"},engines:{node:">=20"},readmeFilename:"README.md",devDependencies:{"@types/blessed":"^0.1.27","@types/node":"^22.18.6","@types/proper-lockfile":"4.1.4","@typescript/native-preview":"7.0.0-dev.20260703.1",esbuild:"^0.27.2","fast-check":"^3.23.2",rescript:"12.3.0",tsx:"^4.21.0",typescript:"^5.9.3",vitest:"^1.6.1"}}});var gh,Wu=q(()=>{"use strict";Bk();gh=Wk.dependencies["@openai/codex"]});async function Hk(e,t,n){let i;try{e(),i=!0}catch{i=!1}let r;try{await t(),r=!0}catch{r=!1}return i&&r?{TAG:"Ok",_0:void 0}:(n("hosted_auth_quota_cleanup_failed reason=owned_process_not_confirmed_reaped"),{TAG:"Error",_0:"cleanup_failed"})}function Vk(e,t){let n=e.quotaWindow,i=e.credits;if(n===void 0&&i===void 0)return{status:"unavailable",reason:"empty_response"};let r=n!==void 0?[n.usedPercent,n.windowMinutes,n.resetsAtMs]:[void 0,void 0,void 0];return{status:"captured",quotaWindow:{usedPercent:r[0],windowMinutes:r[1],resetsAtMs:r[2],capturedAtMs:t,credits:i}}}var Zk=q(()=>{});var Qk,Yk,Xk=q(()=>{Zk();Qk=Hk,Yk=Vk});function Be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yh(e){let t=[["threadId",e.threadId],["turnId",e.turnId],["itemId",e.itemId],["processId",e.processId],["requestId",e.requestId]].filter(n=>n[1]!==void 0);return Object.fromEntries(t)}var Pt=q(()=>{"use strict"});var Hu=q(()=>{"use strict";Pt()});function rx(e){let t=Lr(e.rateLimits)??Lr(e.rate_limits)??Lr(e.limits)??e,n=[t,...Object.values(t).flatMap(_=>{let y=Lr(_);return y===void 0?[]:[y]})],i=n.reduce((_,y)=>{let b=De(y.usedPercent)??De(y.used_percent);return b===void 0?_:_===void 0?b:Math.max(_,b)},void 0),o=n.some(_=>De(_.remaining)===0||De(_.remainingRequests)===0||De(_.remaining_requests)===0||De(_.remainingTokens)===0||De(_.remaining_tokens)===0||De(_.retryAfterSeconds)!==void 0||De(_.retry_after_seconds)!==void 0)?"rejected":i!==void 0&&i>=80?"allowed_warning":"allowed",a=Lr(t.primary),s=De(a?.usedPercent),d=De(a?.windowDurationMins),l=De(a?.resetsAt),u=Lr(t.credits),c=nx(u?.hasCredits),p=nx(u?.unlimited),f=u?.balance,h=c===void 0||p===void 0?void 0:{hasCredits:c,unlimited:p,balance:typeof f=="string"?f:null},g=s===void 0&&d===void 0&&l===void 0?void 0:{...s===void 0?{}:{usedPercent:s},...d===void 0?{}:{windowMinutes:d},...l===void 0?{}:{resetsAtMs:l*1e3}};return{summary:GD(e)??"seen (no details)",status:o,utilizationPercent:i,...g===void 0?{}:{quotaWindow:g},...h===void 0?{}:{credits:h}}}function GD(e){let t=Lr(e.rateLimits)??Lr(e.rate_limits)??Lr(e.limits)??e,n=ex(t,void 0),i=Object.entries(t).flatMap(([o,a])=>{let s=Lr(a);return s===void 0?[]:[ex(s,o)]}),r=[n,...i].filter(o=>o!==void 0);return r.length===0?void 0:r.join(" | ")}function ex(e,t){let n=gr(e.limitName)??gr(e.limit_name)??gr(e.name)??gr(e.type)??t,i=gr(e.planType)??gr(e.plan_type)??gr(e.plan),r=De(e.remaining)??De(e.remainingRequests)??De(e.remaining_requests)??De(e.remainingTokens)??De(e.remaining_tokens),o=De(e.limit)??De(e.requestLimit)??De(e.request_limit)??De(e.limitRequests)??De(e.limit_requests)??De(e.tokenLimit)??De(e.token_limit)??De(e.limitTokens)??De(e.limit_tokens),a=gr(e.resetAt)??gr(e.reset_at)??gr(e.resetsAt)??gr(e.resets_at)??tx(e.resetsAt)??tx(e.resets_at)??Vu(e.resetAfterSeconds)??Vu(e.reset_after_seconds)??Vu(e.retryAfterSeconds)??Vu(e.retry_after_seconds),s=De(e.usedPercent)??De(e.used_percent),d=De(e.windowDurationMins)??De(e.window_duration_mins),l=[n,i].filter(f=>f!==void 0).join(" "),u=l===""?void 0:l,p=[r===void 0?void 0:o===void 0?`${r} remaining`:`${r}/${o} remaining`,s===void 0?void 0:`${s}% used`,d===void 0?void 0:`${d}m window`,a===void 0?void 0:`reset ${a}`].filter(f=>f!==void 0);return p.length===0?u===void 0?void 0:`${u} seen (no details)`:u===void 0?p.join(" "):`${u} ${p.join(" ")}`}function Vu(e){let t=De(e);return t===void 0?void 0:`${t}s`}function tx(e){let t=De(e);return t===void 0?void 0:new Date(t*1e3).toISOString()}function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function gr(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function nx(e){return typeof e=="boolean"?e:void 0}function De(e){if(typeof e=="number"&&Number.isSafeInteger(e))return e;if(typeof e!="string")return;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)&&t.toString()===e.trim()?t:void 0}var ix=q(()=>{"use strict";Hu();Pt()});var ai=tt((kce,sx)=>{"use strict";var ox=["nodebuffer","arraybuffer","fragments"],ax=typeof Blob<"u";ax&&ox.push("blob");sx.exports={BINARY_TYPES:ox,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ax,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Xs=tt((xce,Zu)=>{"use strict";var{EMPTY_BUFFER:zD}=ai(),_h=Buffer[Symbol.species];function JD(e,t){if(e.length===0)return zD;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),i=0;for(let r=0;r<e.length;r++){let o=e[r];n.set(o,i),i+=o.length}return i<t?new _h(n.buffer,n.byteOffset,i):n}function dx(e,t,n,i,r){for(let o=0;o<r;o++)n[i+o]=e[o]^t[o&3]}function lx(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function KD(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function bh(e){if(bh.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new _h(e):ArrayBuffer.isView(e)?t=new _h(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),bh.readOnly=!1),t}Zu.exports={concat:JD,mask:dx,toArrayBuffer:KD,toBuffer:bh,unmask:lx};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=He("bufferutil");Zu.exports.mask=function(t,n,i,r,o){o<48?dx(t,n,i,r,o):e.mask(t,n,i,r,o)},Zu.exports.unmask=function(t,n){t.length<32?lx(t,n):e.unmask(t,n)}}catch{}});var fx=tt((Tce,cx)=>{"use strict";var ux=Symbol("kDone"),vh=Symbol("kRun"),Sh=class{constructor(t){this[ux]=()=>{this.pending--,this[vh]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[vh]()}[vh](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[ux])}}};cx.exports=Sh});var td=tt((Cce,gx)=>{"use strict";var ed=He("zlib"),px=Xs(),BD=fx(),{kStatusCode:mx}=ai(),WD=Buffer[Symbol.species],HD=Buffer.from([0,0,255,255]),Yu=Symbol("permessage-deflate"),si=Symbol("total-length"),ha=Symbol("callback"),Ei=Symbol("buffers"),ga=Symbol("error"),Qu,wh=class{constructor(t,n,i){if(this._maxPayload=i|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!n,this._deflate=null,this._inflate=null,this.params=null,!Qu){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Qu=new BD(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ha];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,i=t.find(r=>!(n.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>r.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(i.server_no_context_takeover=!0),n.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(i.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?i.client_max_window_bits=n.clientMaxWindowBits:(i.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(i=>{let r=n[i];if(r.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(r=r[0],i==="client_max_window_bits"){if(r!==!0){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else if(i==="server_max_window_bits"){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${i}": ${r}`);r=o}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${r}`)}else throw new Error(`Unknown parameter "${i}"`);n[i]=r})}),t}decompress(t,n,i){Qu.add(r=>{this._decompress(t,n,(o,a)=>{r(),i(o,a)})})}compress(t,n,i){Qu.add(r=>{this._compress(t,n,(o,a)=>{r(),i(o,a)})})}_decompress(t,n,i){let r=this._isServer?"client":"server";if(!this._inflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?ed.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=ed.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Yu]=this,this._inflate[si]=0,this._inflate[Ei]=[],this._inflate.on("error",ZD),this._inflate.on("data",hx)}this._inflate[ha]=i,this._inflate.write(t),n&&this._inflate.write(HD),this._inflate.flush(()=>{let o=this._inflate[ga];if(o){this._inflate.close(),this._inflate=null,i(o);return}let a=px.concat(this._inflate[Ei],this._inflate[si]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[si]=0,this._inflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),i(null,a)})}_compress(t,n,i){let r=this._isServer?"server":"client";if(!this._deflate){let o=`${r}_max_window_bits`,a=typeof this.params[o]!="number"?ed.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=ed.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[si]=0,this._deflate[Ei]=[],this._deflate.on("data",VD)}this._deflate[ha]=i,this._deflate.write(t),this._deflate.flush(ed.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=px.concat(this._deflate[Ei],this._deflate[si]);n&&(o=new WD(o.buffer,o.byteOffset,o.length-4)),this._deflate[ha]=null,this._deflate[si]=0,this._deflate[Ei]=[],n&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),i(null,o)})}};gx.exports=wh;function VD(e){this[Ei].push(e),this[si]+=e.length}function hx(e){if(this[si]+=e.length,this[Yu]._maxPayload<1||this[si]<=this[Yu]._maxPayload){this[Ei].push(e);return}this[ga]=new RangeError("Max payload size exceeded"),this[ga].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ga][mx]=1009,this.removeListener("data",hx),this.reset()}function ZD(e){if(this[Yu]._inflate=null,this[ga]){this[ha](this[ga]);return}e[mx]=1007,this[ha](e)}});var ya=tt((Ace,Xu)=>{"use strict";var{isUtf8:yx}=He("buffer"),{hasBlob:QD}=ai(),YD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function XD(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function kh(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function eL(e){return QD&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Xu.exports={isBlob:eL,isValidStatusCode:XD,isValidUTF8:kh,tokenChars:YD};if(yx)Xu.exports.isValidUTF8=function(e){return e.length<24?kh(e):yx(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=He("utf-8-validate");Xu.exports.isValidUTF8=function(t){return t.length<32?kh(t):e(t)}}catch{}});var Eh=tt((Ece,xx)=>{"use strict";var{Writable:tL}=He("stream"),_x=td(),{BINARY_TYPES:nL,EMPTY_BUFFER:bx,kStatusCode:rL,kWebSocket:iL}=ai(),{concat:xh,toArrayBuffer:oL,unmask:aL}=Xs(),{isValidStatusCode:sL,isValidUTF8:vx}=ya(),ec=Buffer[Symbol.species],Zn=0,Sx=1,wx=2,kx=3,Th=4,Ch=5,tc=6,Ah=class extends tL{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||nL[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[iL]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Zn}_write(t,n,i){if(this._opcode===8&&this._state==Zn)return i();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(i)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new ec(i.buffer,i.byteOffset+t,i.length-t),new ec(i.buffer,i.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let i=this._buffers[0],r=n.length-t;t>=i.length?n.set(this._buffers.shift(),r):(n.set(new Uint8Array(i.buffer,i.byteOffset,t),r),this._buffers[0]=new ec(i.buffer,i.byteOffset+t,i.length-t)),t-=i.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case Zn:this.getInfo(t);break;case Sx:this.getPayloadLength16(t);break;case wx:this.getPayloadLength64(t);break;case kx:this.getMask();break;case Th:this.getData(t);break;case Ch:case tc:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let i=(n[0]&64)===64;if(i&&!this._extensions[_x.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(i){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=Sx:this._payloadLength===127?this._state=wx:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),i=n.readUInt32BE(0);if(i>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=i*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=kx:this._state=Th}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Th}getData(t){let n=bx;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&aL(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._compressed){this._state=Ch,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[_x.extensionName].decompress(t,this._fin,(r,o)=>{if(r)return n(r);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(a);return}this._fragments.push(o)}this.dataMessage(n),this._state===Zn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=Zn;return}let n=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=xh(i,n):this._binaryType==="arraybuffer"?r=oL(xh(i,n)):this._binaryType==="blob"?r=new Blob(i):r=i,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=Zn):(this._state=tc,setImmediate(()=>{this.emit("message",r,!0),this._state=Zn,this.startLoop(t)}))}else{let r=xh(i,n);if(!this._skipUTF8Validation&&!vx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._state===Ch||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=Zn):(this._state=tc,setImmediate(()=>{this.emit("message",r,!1),this._state=Zn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,bx),this.end();else{let i=t.readUInt16BE(0);if(!sL(i)){let o=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(o);return}let r=new ec(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!vx(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(o);return}this._loop=!1,this.emit("conclude",i,r),this.end()}this._state=Zn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn):(this._state=tc,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Zn,this.startLoop(n)}))}createError(t,n,i,r,o){this._loop=!1,this._errored=!0;let a=new t(i?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(a,this.createError),a.code=o,a[rL]=r,a}};xx.exports=Ah});var Oh=tt((Ice,Ax)=>{"use strict";var{Duplex:Pce}=He("stream"),{randomFillSync:dL}=He("crypto"),Tx=td(),{EMPTY_BUFFER:lL,kWebSocket:uL,NOOP:cL}=ai(),{isBlob:_a,isValidStatusCode:fL}=ya(),{mask:Cx,toBuffer:co}=Xs(),Qn=Symbol("kByteLength"),pL=Buffer.alloc(4),nc=8*1024,fo,ba=nc,yr=0,mL=1,hL=2,Ph=class e{constructor(t,n,i){this._extensions=n||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=yr,this.onerror=cL,this[uL]=void 0}static frame(t,n){let i,r=!1,o=2,a=!1;n.mask&&(i=n.maskBuffer||pL,n.generateMask?n.generateMask(i):(ba===nc&&(fo===void 0&&(fo=Buffer.alloc(nc)),dL(fo,0,nc),ba=0),i[0]=fo[ba++],i[1]=fo[ba++],i[2]=fo[ba++],i[3]=fo[ba++]),a=(i[0]|i[1]|i[2]|i[3])===0,o=6);let s;typeof t=="string"?(!n.mask||a)&&n[Qn]!==void 0?s=n[Qn]:(t=Buffer.from(t),s=t.length):(s=t.length,r=n.mask&&n.readOnly&&!a);let d=s;s>=65536?(o+=8,d=127):s>125&&(o+=2,d=126);let l=Buffer.allocUnsafe(r?s+o:o);return l[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(s,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),n.mask?(l[1]|=128,l[o-4]=i[0],l[o-3]=i[1],l[o-2]=i[2],l[o-1]=i[3],a?[l,t]:r?(Cx(t,i,l,o,s),[l]):(Cx(t,i,t,0,s),[l,t])):[l,t]}close(t,n,i,r){let o;if(t===void 0)o=lL;else{if(typeof t!="number"||!fL(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let s=Buffer.byteLength(n);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+s),o.writeUInt16BE(t,0),typeof n=="string"?o.write(n,2):o.set(n,2)}}let a={[Qn]:o.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==yr?this.enqueue([this.dispatch,o,!1,a,r]):this.sendFrame(e.frame(o,a),r)}ping(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}pong(t,n,i){let r,o;if(typeof t=="string"?(r=Buffer.byteLength(t),o=!1):_a(t)?(r=t.size,o=!1):(t=co(t),r=t.length,o=co.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Qn]:r,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,!1,a,i]):this.getBlobData(t,!1,a,i):this._state!==yr?this.enqueue([this.dispatch,t,!1,a,i]):this.sendFrame(e.frame(t,a),i)}send(t,n,i){let r=this._extensions[Tx.extensionName],o=n.binary?2:1,a=n.compress,s,d;typeof t=="string"?(s=Buffer.byteLength(t),d=!1):_a(t)?(s=t.size,d=!1):(t=co(t),s=t.length,d=co.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=r._threshold),this._compress=a):(a=!1,o=0),n.fin&&(this._firstFragment=!0);let l={[Qn]:s,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:d,rsv1:a};_a(t)?this._state!==yr?this.enqueue([this.getBlobData,t,this._compress,l,i]):this.getBlobData(t,this._compress,l,i):this._state!==yr?this.enqueue([this.dispatch,t,this._compress,l,i]):this.dispatch(t,this._compress,l,i)}getBlobData(t,n,i,r){this._bufferedBytes+=i[Qn],this._state=hL,t.arrayBuffer().then(o=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(Ih,this,s,r);return}this._bufferedBytes-=i[Qn];let a=co(o);n?this.dispatch(a,n,i,r):(this._state=yr,this.sendFrame(e.frame(a,i),r),this.dequeue())}).catch(o=>{process.nextTick(gL,this,o,r)})}dispatch(t,n,i,r){if(!n){this.sendFrame(e.frame(t,i),r);return}let o=this._extensions[Tx.extensionName];this._bufferedBytes+=i[Qn],this._state=mL,o.compress(t,i.fin,(a,s)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");Ih(this,d,r);return}this._bufferedBytes-=i[Qn],this._state=yr,i.readOnly=!1,this.sendFrame(e.frame(s,i),r),this.dequeue()})}dequeue(){for(;this._state===yr&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Qn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Qn],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};Ax.exports=Ph;function Ih(e,t,n){typeof n=="function"&&n(t);for(let i=0;i<e._queue.length;i++){let r=e._queue[i],o=r[r.length-1];typeof o=="function"&&o(t)}}function gL(e,t,n){Ih(e,t,n),e.onerror(t)}});var qx=tt((Oce,jx)=>{"use strict";var{kForOnEventAttribute:nd,kListener:Rh}=ai(),Ex=Symbol("kCode"),Px=Symbol("kData"),Ix=Symbol("kError"),Ox=Symbol("kMessage"),Rx=Symbol("kReason"),va=Symbol("kTarget"),$x=Symbol("kType"),Mx=Symbol("kWasClean"),di=class{constructor(t){this[va]=null,this[$x]=t}get target(){return this[va]}get type(){return this[$x]}};Object.defineProperty(di.prototype,"target",{enumerable:!0});Object.defineProperty(di.prototype,"type",{enumerable:!0});var po=class extends di{constructor(t,n={}){super(t),this[Ex]=n.code===void 0?0:n.code,this[Rx]=n.reason===void 0?"":n.reason,this[Mx]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[Ex]}get reason(){return this[Rx]}get wasClean(){return this[Mx]}};Object.defineProperty(po.prototype,"code",{enumerable:!0});Object.defineProperty(po.prototype,"reason",{enumerable:!0});Object.defineProperty(po.prototype,"wasClean",{enumerable:!0});var Sa=class extends di{constructor(t,n={}){super(t),this[Ix]=n.error===void 0?null:n.error,this[Ox]=n.message===void 0?"":n.message}get error(){return this[Ix]}get message(){return this[Ox]}};Object.defineProperty(Sa.prototype,"error",{enumerable:!0});Object.defineProperty(Sa.prototype,"message",{enumerable:!0});var rd=class extends di{constructor(t,n={}){super(t),this[Px]=n.data===void 0?null:n.data}get data(){return this[Px]}};Object.defineProperty(rd.prototype,"data",{enumerable:!0});var yL={addEventListener(e,t,n={}){for(let r of this.listeners(e))if(!n[nd]&&r[Rh]===t&&!r[nd])return;let i;if(e==="message")i=function(o,a){let s=new rd("message",{data:a?o:o.toString()});s[va]=this,rc(t,this,s)};else if(e==="close")i=function(o,a){let s=new po("close",{code:o,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[va]=this,rc(t,this,s)};else if(e==="error")i=function(o){let a=new Sa("error",{error:o,message:o.message});a[va]=this,rc(t,this,a)};else if(e==="open")i=function(){let o=new di("open");o[va]=this,rc(t,this,o)};else return;i[nd]=!!n[nd],i[Rh]=t,n.once?this.once(e,i):this.on(e,i)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[Rh]===t&&!n[nd]){this.removeListener(e,n);break}}};jx.exports={CloseEvent:po,ErrorEvent:Sa,Event:di,EventTarget:yL,MessageEvent:rd};function rc(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}});var $h=tt((Rce,Nx)=>{"use strict";var{tokenChars:id}=ya();function Ur(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function _L(e){let t=Object.create(null),n=Object.create(null),i=!1,r=!1,o=!1,a,s,d=-1,l=-1,u=-1,c=0;for(;c<e.length;c++)if(l=e.charCodeAt(c),a===void 0)if(u===-1&&id[l]===1)d===-1&&(d=c);else if(c!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);l===44?(Ur(t,f,n),n=Object.create(null)):a=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(s===void 0)if(u===-1&&id[l]===1)d===-1&&(d=c);else if(l===32||l===9)u===-1&&d!==-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c),Ur(n,e.slice(d,u),!0),l===44&&(Ur(t,a,n),n=Object.create(null),a=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)s=e.slice(d,c),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(r){if(id[l]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);d===-1?d=c:i||(i=!0),r=!1}else if(o)if(id[l]===1)d===-1&&(d=c);else if(l===34&&d!==-1)o=!1,u=c;else if(l===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(l===34&&e.charCodeAt(c-1)===61)o=!0;else if(u===-1&&id[l]===1)d===-1&&(d=c);else if(d!==-1&&(l===32||l===9))u===-1&&(u=c);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${c}`);u===-1&&(u=c);let f=e.slice(d,u);i&&(f=f.replace(/\\/g,""),i=!1),Ur(n,s,f),l===44&&(Ur(t,a,n),n=Object.create(null),a=void 0),s=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);if(d===-1||o||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=c);let p=e.slice(d,u);return a===void 0?Ur(t,p,n):(s===void 0?Ur(n,p,!0):i?Ur(n,s,p.replace(/\\/g,"")):Ur(n,s,p),Ur(t,a,n)),t}function bL(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(i=>[t].concat(Object.keys(i).map(r=>{let o=i[r];return Array.isArray(o)||(o=[o]),o.map(a=>a===!0?r:`${r}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Nx.exports={format:bL,parse:_L}});var sc=tt((jce,Vx)=>{"use strict";var vL=He("events"),SL=He("https"),wL=He("http"),Lx=He("net"),kL=He("tls"),{randomBytes:xL,createHash:TL}=He("crypto"),{Duplex:$ce,Readable:Mce}=He("stream"),{URL:Mh}=He("url"),Pi=td(),CL=Eh(),AL=Oh(),{isBlob:EL}=ya(),{BINARY_TYPES:Fx,EMPTY_BUFFER:ic,GUID:PL,kForOnEventAttribute:jh,kListener:IL,kStatusCode:OL,kWebSocket:Wt,NOOP:Ux}=ai(),{EventTarget:{addEventListener:RL,removeEventListener:$L}}=qx(),{format:ML,parse:jL}=$h(),{toBuffer:qL}=Xs(),NL=30*1e3,Gx=Symbol("kAborted"),qh=[8,13],li=["CONNECTING","OPEN","CLOSING","CLOSED"],FL=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pt=class e extends vL{constructor(t,n,i){super(),this._binaryType=Fx[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ic,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(i=n,n=[]):n=[n]),zx(this,t,n,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Fx.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,i){let r=new CL({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),o=new AL(t,this._extensions,i.generateMask);this._receiver=r,this._sender=o,this._socket=t,r[Wt]=this,o[Wt]=this,t[Wt]=this,r.on("conclude",UL),r.on("drain",GL),r.on("error",zL),r.on("message",JL),r.on("ping",KL),r.on("pong",BL),o.onerror=WL,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Bx),t.on("data",ac),t.on("end",Wx),t.on("error",Hx),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Pi.extensionName]&&this._extensions[Pi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){qn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Kx(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Nh(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||ic,n,i)}pong(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=n=void 0):typeof n=="function"&&(i=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Nh(this,t,i);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||ic,n,i)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(i=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Nh(this,t,i);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Pi.extensionName]||(r.compress=!1),this._sender.send(t||ic,r,i)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){qn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(pt,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt.prototype,"CONNECTING",{enumerable:!0,value:li.indexOf("CONNECTING")});Object.defineProperty(pt,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt.prototype,"OPEN",{enumerable:!0,value:li.indexOf("OPEN")});Object.defineProperty(pt,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt.prototype,"CLOSING",{enumerable:!0,value:li.indexOf("CLOSING")});Object.defineProperty(pt,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});Object.defineProperty(pt.prototype,"CLOSED",{enumerable:!0,value:li.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(pt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(pt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[jh])return t[IL];return null},set(t){for(let n of this.listeners(e))if(n[jh]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[jh]:!0})}})});pt.prototype.addEventListener=RL;pt.prototype.removeEventListener=$L;Vx.exports=pt;function zx(e,t,n,i){let r={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:qh[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=r.autoPong,!qh.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${qh.join(", ")})`);let o;if(t instanceof Mh)o=t;else try{o=new Mh(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}o.protocol==="http:"?o.protocol="ws:":o.protocol==="https:"&&(o.protocol="wss:"),e._url=o.href;let a=o.protocol==="wss:",s=o.protocol==="ws+unix:",d;if(o.protocol!=="ws:"&&!a&&!s?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!o.pathname?d="The URL's pathname is empty":o.hash&&(d="The URL contains a fragment identifier"),d){let g=new SyntaxError(d);if(e._redirects===0)throw g;oc(e,g);return}let l=a?443:80,u=xL(16).toString("base64"),c=a?SL.request:wL.request,p=new Set,f;if(r.createConnection=r.createConnection||(a?LL:DL),r.defaultPort=r.defaultPort||l,r.port=o.port||l,r.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},r.path=o.pathname+o.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(f=new Pi(r.perMessageDeflate!==!0?r.perMessageDeflate:{},!1,r.maxPayload),r.headers["Sec-WebSocket-Extensions"]=ML({[Pi.extensionName]:f.offer()})),n.length){for(let g of n){if(typeof g!="string"||!FL.test(g)||p.has(g))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(g)}r.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(o.username||o.password)&&(r.auth=`${o.username}:${o.password}`),s){let g=r.path.split(":");r.socketPath=g[0],r.path=g[1]}let h;if(r.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=a,e._originalHostOrSocketPath=s?r.socketPath:o.host;let g=i&&i.headers;if(i={...i,headers:{}},g)for(let[_,y]of Object.entries(g))i.headers[_.toLowerCase()]=y}else if(e.listenerCount("redirect")===0){let g=s?e._originalIpc?r.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:o.host===e._originalHostOrSocketPath;(!g||e._originalSecure&&!a)&&(delete r.headers.authorization,delete r.headers.cookie,g||delete r.headers.host,r.auth=void 0)}r.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),h=e._req=c(r),e._redirects&&e.emit("redirect",e.url,h)}else h=e._req=c(r);r.timeout&&h.on("timeout",()=>{qn(e,h,"Opening handshake has timed out")}),h.on("error",g=>{h===null||h[Gx]||(h=e._req=null,oc(e,g))}),h.on("response",g=>{let _=g.headers.location,y=g.statusCode;if(_&&r.followRedirects&&y>=300&&y<400){if(++e._redirects>r.maxRedirects){qn(e,h,"Maximum redirects exceeded");return}h.abort();let b;try{b=new Mh(_,t)}catch{let w=new SyntaxError(`Invalid URL: ${_}`);oc(e,w);return}zx(e,b,n,i)}else e.emit("unexpected-response",h,g)||qn(e,h,`Unexpected server response: ${g.statusCode}`)}),h.on("upgrade",(g,_,y)=>{if(e.emit("upgrade",g),e.readyState!==pt.CONNECTING)return;h=e._req=null;let b=g.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){qn(e,_,"Invalid Upgrade header");return}let v=TL("sha1").update(u+PL).digest("base64");if(g.headers["sec-websocket-accept"]!==v){qn(e,_,"Invalid Sec-WebSocket-Accept header");return}let w=g.headers["sec-websocket-protocol"],A;if(w!==void 0?p.size?p.has(w)||(A="Server sent an invalid subprotocol"):A="Server sent a subprotocol but none was requested":p.size&&(A="Server sent no subprotocol"),A){qn(e,_,A);return}w&&(e._protocol=w);let C=g.headers["sec-websocket-extensions"];if(C!==void 0){if(!f){qn(e,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let S;try{S=jL(C)}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}let k=Object.keys(S);if(k.length!==1||k[0]!==Pi.extensionName){qn(e,_,"Server indicated an extension that was not requested");return}try{f.accept(S[Pi.extensionName])}catch{qn(e,_,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Pi.extensionName]=f}e.setSocket(_,y,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(h,e):h.end()}function oc(e,t){e._readyState=pt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function DL(e){return e.path=e.socketPath,Lx.connect(e)}function LL(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Lx.isIP(e.host)?"":e.host),kL.connect(e)}function qn(e,t,n){e._readyState=pt.CLOSING;let i=new Error(n);Error.captureStackTrace(i,qn),t.setHeader?(t[Gx]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(oc,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function Nh(e,t,n){if(t){let i=EL(t)?t.size:qL(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(n){let i=new Error(`WebSocket is not open: readyState ${e.readyState} (${li[e.readyState]})`);process.nextTick(n,i)}}function UL(e,t){let n=this[Wt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[Wt]!==void 0&&(n._socket.removeListener("data",ac),process.nextTick(Jx,n._socket),e===1005?n.close():n.close(e,t))}function GL(){let e=this[Wt];e.isPaused||e._socket.resume()}function zL(e){let t=this[Wt];t._socket[Wt]!==void 0&&(t._socket.removeListener("data",ac),process.nextTick(Jx,t._socket),t.close(e[OL])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function Dx(){this[Wt].emitClose()}function JL(e,t){this[Wt].emit("message",e,t)}function KL(e){let t=this[Wt];t._autoPong&&t.pong(e,!this._isServer,Ux),t.emit("ping",e)}function BL(e){this[Wt].emit("pong",e)}function Jx(e){e.resume()}function WL(e){let t=this[Wt];t.readyState!==pt.CLOSED&&(t.readyState===pt.OPEN&&(t._readyState=pt.CLOSING,Kx(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Kx(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),NL)}function Bx(){let e=this[Wt];this.removeListener("close",Bx),this.removeListener("data",ac),this.removeListener("end",Wx),e._readyState=pt.CLOSING;let t;!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null&&e._receiver.write(t),e._receiver.end(),this[Wt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Dx),e._receiver.on("finish",Dx))}function ac(e){this[Wt]._receiver.write(e)||this.pause()}function Wx(){let e=this[Wt];e._readyState=pt.CLOSING,e._receiver.end(),this.end()}function Hx(){let e=this[Wt];this.removeListener("error",Hx),this.on("error",Ux),e&&(e._readyState=pt.CLOSING,this.destroy())}});var Xx=tt((Nce,Yx)=>{"use strict";var qce=sc(),{Duplex:HL}=He("stream");function Zx(e){e.emit("close")}function VL(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Qx(e){this.removeListener("error",Qx),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function ZL(e,t){let n=!0,i=new HL({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(o,a){let s=!a&&i._readableState.objectMode?o.toString():o;i.push(s)||e.pause()}),e.once("error",function(o){i.destroyed||(n=!1,i.destroy(o))}),e.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(r,o){if(e.readyState===e.CLOSED){o(r),process.nextTick(Zx,i);return}let a=!1;e.once("error",function(d){a=!0,o(d)}),e.once("close",function(){a||o(r),process.nextTick(Zx,i)}),n&&e.terminate()},i._final=function(r){if(e.readyState===e.CONNECTING){e.once("open",function(){i._final(r)});return}e._socket!==null&&(e._socket._writableState.finished?(r(),i._readableState.endEmitted&&i.destroy()):(e._socket.once("finish",function(){r()}),e.close()))},i._read=function(){e.isPaused&&e.resume()},i._write=function(r,o,a){if(e.readyState===e.CONNECTING){e.once("open",function(){i._write(r,o,a)});return}e.send(r,a)},i.on("end",VL),i.on("error",Qx),i}Yx.exports=ZL});var t0=tt((Fce,e0)=>{"use strict";var{tokenChars:QL}=ya();function YL(e){let t=new Set,n=-1,i=-1,r=0;for(r;r<e.length;r++){let a=e.charCodeAt(r);if(i===-1&&QL[a]===1)n===-1&&(n=r);else if(r!==0&&(a===32||a===9))i===-1&&n!==-1&&(i=r);else if(a===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${r}`);i===-1&&(i=r);let s=e.slice(n,i);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),n=i=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(n===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let o=e.slice(n,r);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}e0.exports={parse:YL}});var d0=tt((Lce,s0)=>{"use strict";var XL=He("events"),dc=He("http"),{Duplex:Dce}=He("stream"),{createHash:eU}=He("crypto"),n0=$h(),mo=td(),tU=t0(),nU=sc(),{GUID:rU,kWebSocket:iU}=ai(),oU=/^[+/0-9A-Za-z]{22}==$/,r0=0,i0=1,a0=2,Fh=class extends XL{constructor(t,n){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:nU,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=dc.createServer((i,r)=>{let o=dc.STATUS_CODES[426];r.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),r.end(o)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=aU(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,o,a)=>{this.handleUpgrade(r,o,a,i)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=r0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===a0){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(od,this);return}if(t&&this.once("close",t),this._state!==i0)if(this._state=i0,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(od,this):process.nextTick(od,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{od(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,i,r){n.on("error",o0);let o=t.headers["sec-websocket-key"],a=t.headers.upgrade,s=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ho(this,t,n,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){ho(this,t,n,400,"Invalid Upgrade header");return}if(o===void 0||!oU.test(o)){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){ho(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){ad(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=tU.parse(d)}catch{ho(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&u!==void 0){let p=new mo(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=n0.parse(u);f[mo.extensionName]&&(p.accept(f[mo.extensionName]),c[mo.extensionName]=p)}catch{ho(this,t,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:t.headers[`${s===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,h,g,_)=>{if(!f)return ad(n,h||401,g,_);this.completeUpgrade(c,o,l,t,n,i,r)});return}if(!this.options.verifyClient(p))return ad(n,401)}this.completeUpgrade(c,o,l,t,n,i,r)}completeUpgrade(t,n,i,r,o,a,s){if(!o.readable||!o.writable)return o.destroy();if(o[iU])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>r0)return ad(o,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${eU("sha1").update(n+rU).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(i.size){let c=this.options.handleProtocols?this.options.handleProtocols(i,r):i.values().next().value;c&&(l.push(`Sec-WebSocket-Protocol: ${c}`),u._protocol=c)}if(t[mo.extensionName]){let c=t[mo.extensionName].params,p=n0.format({[mo.extensionName]:[c]});l.push(`Sec-WebSocket-Extensions: ${p}`),u._extensions=t}this.emit("headers",l,r),o.write(l.concat(`\r
5
- `).join(`\r
6
- `)),o.removeListener("error",o0),u.setSocket(o,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(od,this)})),s(u,r)}};s0.exports=Fh;function aU(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let i of Object.keys(t))e.removeListener(i,t[i])}}function od(e){e._state=a0,e.emit("close")}function o0(){this.destroy()}function ad(e,t,n,i){n=n||dc.STATUS_CODES[t],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...i},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${dc.STATUS_CODES[t]}\r
7
- `+Object.keys(i).map(r=>`${r}: ${i[r]}`).join(`\r
8
- `)+`\r
9
- \r
10
- `+n)}function ho(e,t,n,i,r,o){if(e.listenerCount("wsClientError")){let a=new Error(r);Error.captureStackTrace(a,ho),e.emit("wsClientError",a,n,t)}else ad(n,i,r,o)}});var sU,dU,lU,Dh,uU,l0=q(()=>{sU=oa(Xx(),1),dU=oa(Eh(),1),lU=oa(Oh(),1),Dh=oa(sc(),1),uU=oa(d0(),1)});function pe(e){return e!==void 0&&Be(e)?e:void 0}function nn(e){return Array.isArray(e)?e:void 0}function Q(e){return typeof e=="string"&&e.trim()!==""?e.trim():void 0}function mt(e){return typeof e=="number"&&Number.isInteger(e)?e:void 0}var ht=q(()=>{"use strict";Pt()});var Gr,u0=q(()=>{Gr={_generated:"GENERATED by scripts/naming_dual_emit_codegen.mjs from scripts/naming_canonical_key_map.json (N2.2 dual-emit, D46) - DO NOT EDIT; run: node scripts/naming_dual_emit_codegen.mjs --write",events:[["codex.agent_turn_narration_only_no_reply","harness.agent_turn_narration_only_no_reply"],["codex.cost_cap_402_seen","harness.cost_cap_402_seen"],["codex.edge_blocked_captured","harness.edge_blocked_captured"],["codex.empty_turn_auto_retry_suppressed_cost_cap","harness.empty_turn_auto_retry_suppressed_cost_cap"],["codex.empty_turn_loop_guard_tripped","harness.empty_turn_loop_guard_tripped"],["codex.error_without_http_status_captured","harness.error_without_http_status_captured"],["codex.mid_stream_stall_auto_resume_flagged","harness.mid_stream_stall_auto_resume_flagged"],["codex.mid_stream_stall_fresh_session_resume","harness.mid_stream_stall_fresh_session_resume"],["codex.mid_stream_stall_fresh_session_resume_failed","harness.mid_stream_stall_fresh_session_resume_failed"],["codex.mid_stream_stall_fresh_session_resume_flagged","harness.mid_stream_stall_fresh_session_resume_flagged"],["codex.mid_stream_stall_resume_suppressed_rate_limit","harness.mid_stream_stall_resume_suppressed_rate_limit"],["codex.mid_stream_stall_second_stall_after_resume","harness.mid_stream_stall_second_stall_after_resume"],["codex.pre_first_byte_stall_auto_retry_flagged","harness.pre_first_byte_stall_auto_retry_flagged"],["codex.pre_first_byte_stall_retry_suppressed_cost_cap","harness.pre_first_byte_stall_retry_suppressed_cost_cap"],["codex.provider_outage_flagged_captured","harness.provider_outage_flagged_captured"],["codex.reasoning_loop_breaker_tripped","harness.reasoning_loop_breaker_tripped"],["codex.tool_fatal_captured","harness.tool_fatal_captured"],["codex.turn_completed","job.turn_completed"],["codex.turn_completed_with_protocol_failure","job.turn_completed_with_protocol_failure"],["codex.turn_completed_with_unsupported_tool_call_ignored","job.turn_completed_with_unsupported_tool_call_ignored"],["codex.turn_completed_without_assistant_output","job.turn_completed_without_assistant_output"],["codex.turn_demoted_late_upstream_error","job.turn_demoted_late_upstream_error"],["codex.turn_forward_failed","job.turn_forward_failed"],["codex.upstream_error_captured","harness.upstream_error_captured"],["codex.upstream_rejection_captured","harness.upstream_rejection_captured"],["codex.upstream_turn_error_captured","harness.upstream_turn_error_captured"],["kandan.chat_event","linzumi.chat_event"],["kandan.chat_event_abandoned","linzumi.chat_event_abandoned"],["kandan.chat_event_failed","linzumi.chat_event_failed"],["kandan.chat_event_failure_cleared","linzumi.chat_event_failure_cleared"],["kandan.child_thread_event_failed","linzumi.child_thread_event_failed"],["kandan.child_thread_event_skipped_missing_thread_binding","linzumi.child_thread_event_skipped_missing_thread_binding"],["kandan.child_thread_upsert_failed","linzumi.child_thread_upsert_failed"],["kandan.child_thread_upsert_skipped_missing_thread_binding","linzumi.child_thread_upsert_skipped_missing_thread_binding"],["kandan.claude_code_interrupt_state_push_failed","linzumi.claude_code_interrupt_state_push_failed"],["kandan.claude_code_stop_state_push_failed","linzumi.claude_code_stop_state_push_failed"],["kandan.claude_code_typing_heartbeat_failed","linzumi.claude_code_typing_heartbeat_failed"],["kandan.claude_code_typing_start_wait_timeout","linzumi.claude_code_typing_start_wait_timeout"],["kandan.claude_code_typing_stop_failed","linzumi.claude_code_typing_stop_failed"],["kandan.claude_code_user_input_abort_publish_failed","linzumi.claude_code_user_input_abort_publish_failed"],["kandan.claude_code_user_question_completed_publish_failed","linzumi.claude_code_user_question_completed_publish_failed"],["kandan.codex_command_output_forwarded","linzumi.codex_command_output_forwarded"],["kandan.codex_delta_forwarded","linzumi.codex_delta_forwarded"],["kandan.codex_file_change_forwarded","linzumi.codex_file_change_forwarded"],["kandan.codex_notification_push_failed","linzumi.codex_notification_push_failed"],["kandan.codex_output_forwarded","linzumi.codex_output_forwarded"],["kandan.codex_reasoning_delta_forwarded","linzumi.codex_reasoning_delta_forwarded"],["kandan.codex_web_search_progress_forwarded","linzumi.codex_web_search_progress_forwarded"],["kandan.connection_force_reconnect","linzumi.connection_force_reconnect"],["kandan.connection_force_reconnect_dispatched","linzumi.connection_force_reconnect_dispatched"],["kandan.connection_hard_reset","linzumi.connection_hard_reset"],["kandan.connection_hard_reset_exhausted","linzumi.connection_hard_reset_exhausted"],["kandan.connection_recovered","linzumi.connection_recovered"],["kandan.connection_stale","linzumi.connection_stale"],["kandan.connection_unrecoverable","linzumi.connection_unrecoverable"],["kandan.control","linzumi.control"],["kandan.control_ack_withheld_on_failure","linzumi.control_ack_withheld_on_failure"],["kandan.control_epoch_changed","linzumi.control_epoch_changed"],["kandan.control_handler_threw","linzumi.control_handler_threw"],["kandan.control_ignored","linzumi.control_ignored"],["kandan.control_response_push_failed","linzumi.control_response_push_failed"],["kandan.failed_seq_overflow","linzumi.failed_seq_overflow"],["kandan.forward_port_revoked_push_failed","linzumi.forward_port_revoked_push_failed"],["kandan.forward_response","linzumi.forward_response"],["kandan.forward_response_push_failed","linzumi.forward_response_push_failed"],["kandan.forward_tunnel_error","linzumi.forward_tunnel_error"],["kandan.forward_tunnel_open_failed","linzumi.forward_tunnel_open_failed"],["kandan.heartbeat_push_failed","linzumi.heartbeat_push_failed"],["kandan.local_editor_initial_status_failed","linzumi.local_editor_initial_status_failed"],["kandan.local_editor_status_push_failed","linzumi.local_editor_status_push_failed"],["kandan.message_duplicate_ignored","linzumi.message_duplicate_ignored"],["kandan.message_ignored","linzumi.message_ignored"],["kandan.message_queued","linzumi.message_queued"],["kandan.message_spawn_on_miss","linzumi.message_spawn_on_miss"],["kandan.message_spawn_on_miss_failed","linzumi.message_spawn_on_miss_failed"],["kandan.message_state_refresh_failed","linzumi.message_state_refresh_failed"],["kandan.optional_push_failed","linzumi.optional_push_failed"],["kandan.post_stop_queue_drain_failed","linzumi.post_stop_queue_drain_failed"],["kandan.queue_drain_blocked","linzumi.queue_drain_blocked"],["kandan.queue_drain_dead_worker_fail_publish_failed","linzumi.queue_drain_dead_worker_fail_publish_failed"],["kandan.queue_drain_dead_worker_rebuild","linzumi.queue_drain_dead_worker_rebuild"],["kandan.queue_drain_dead_worker_rebuild_exhausted","linzumi.queue_drain_dead_worker_rebuild_exhausted"],["kandan.queue_drain_dead_worker_rebuild_failed","linzumi.queue_drain_dead_worker_rebuild_failed"],["kandan.reconnect_handling_failed","linzumi.reconnect_handling_failed"],["kandan.reconnect_thread_context_fetch_failed","linzumi.reconnect_thread_context_fetch_failed"],["kandan.reconnect_thread_cwd_failed_state_push_failed","linzumi.reconnect_thread_cwd_failed_state_push_failed"],["kandan.reconnect_thread_failed","linzumi.reconnect_thread_failed"],["kandan.reconnect_thread_processing_state_push_failed","linzumi.reconnect_thread_processing_state_push_failed"],["kandan.reconnect_thread_queue_closed_state_push_failed","linzumi.reconnect_thread_queue_closed_state_push_failed"],["kandan.reconnect_thread_queue_failed_state_push_failed","linzumi.reconnect_thread_queue_failed_state_push_failed"],["kandan.reconnect_thread_queue_state_push_failed","linzumi.reconnect_thread_queue_state_push_failed"],["kandan.reconnect_thread_rehydrate_forced","linzumi.reconnect_thread_rehydrate_forced"],["kandan.reconnect_thread_rehydrated","linzumi.reconnect_thread_rehydrated"],["kandan.reconnect_thread_rehydrated_state_push_failed","linzumi.reconnect_thread_rehydrated_state_push_failed"],["kandan.reconnect_thread_rehydration_failed","linzumi.reconnect_thread_rehydration_failed"],["kandan.reconnect_thread_rehydration_ir_emitted","linzumi.reconnect_thread_rehydration_ir_emitted"],["kandan.reconnect_thread_rehydration_items_failed","linzumi.reconnect_thread_rehydration_items_failed"],["kandan.reconnect_thread_resume_failed","linzumi.reconnect_thread_resume_failed"],["kandan.reconnect_thread_seq_already_applied","linzumi.reconnect_thread_seq_already_applied"],["kandan.reconnect_thread_transcript_fetch_failed","linzumi.reconnect_thread_transcript_fetch_failed"],["kandan.reconnect_thread_unarchive_failed","linzumi.reconnect_thread_unarchive_failed"],["kandan.reconnect_thread_unarchive_resumed","linzumi.reconnect_thread_unarchive_resumed"],["kandan.reconnect_thread_unarchive_started","linzumi.reconnect_thread_unarchive_started"],["kandan.reconnect_thread_unavailable_state_push_failed","linzumi.reconnect_thread_unavailable_state_push_failed"],["kandan.reconnected","linzumi.reconnected"],["kandan.roster_seeded","linzumi.roster_seeded"],["kandan.session_app_server_lost_push_failed","linzumi.session_app_server_lost_push_failed"],["kandan.session_settings_publish_failed","linzumi.session_settings_publish_failed"],["kandan.start_instance_claude_code_attachment_failed_state_push_failed","linzumi.start_instance_claude_code_attachment_failed_state_push_failed"],["kandan.start_instance_codex_app_server_unavailable","linzumi.start_instance_codex_app_server_unavailable"],["kandan.start_instance_cwd_failed_state_push_failed","linzumi.start_instance_cwd_failed_state_push_failed"],["kandan.start_instance_cwd_rejected","linzumi.start_instance_cwd_rejected"],["kandan.start_instance_failed","linzumi.start_instance_failed"],["kandan.start_instance_processing_state_push_failed","linzumi.start_instance_processing_state_push_failed"],["kandan.start_instance_skipped_known_session","linzumi.start_instance_skipped_known_session"],["kandan.start_instance_stale_skipped","linzumi.start_instance_stale_skipped"],["kandan.start_instance_unavailable_state_push_failed","linzumi.start_instance_unavailable_state_push_failed"],["kandan.start_instance_wafer_state_push_failed","linzumi.start_instance_wafer_state_push_failed"],["kandan.start_turn_replay_skipped","linzumi.start_turn_replay_skipped"],["kandan.steer_duplicate_ignored","linzumi.steer_duplicate_ignored"],["kandan.steer_parked_as_own_turn","linzumi.steer_parked_as_own_turn"],["kandan.thread_bind_from_historical_reply_failed","linzumi.thread_bind_from_historical_reply_failed"],["kandan.thread_bound_from_historical_reply","linzumi.thread_bound_from_historical_reply"],["kandan.thread_sessions_reannounce_failed","linzumi.thread_sessions_reannounce_failed"],["kandan.thread_sessions_reannounced","linzumi.thread_sessions_reannounced"],["kandan.tui_input_mirrored","linzumi.tui_input_mirrored"],["kandan.typing_heartbeat_failed","linzumi.typing_heartbeat_failed"],["kandan.typing_stop_after_completion_failed","linzumi.typing_stop_after_completion_failed"]],keys:[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],keyPrimaryLegacy:[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],values:[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]],topic:{legacyPrefix:"local_codex_runner:",canonicalPrefix:"commander:"},originator:{legacy:"kandan-local-codex-runner",canonical:"linzumi-commander"}}});function m0(e){let t=new Set(e);for(let n of e){let i=f0.get(n);i!==void 0&&t.add(i);let r=p0.get(n);r!==void 0&&t.add(r)}return t}var fU,pU,f0,p0,mU,hU,Bce,c0,Lh=q(()=>{"use strict";u0();fU=new Map(Gr.events),pU=new Map(Gr.events.map(([e,t])=>[t,e])),f0=new Map(Gr.keys),p0=new Map(Gr.keyPrimaryLegacy),mU=new Map(Gr.values),hU=new Map(Gr.values.map(([e,t])=>[t,e])),Bce={eventCanonicalByLegacy:fU,eventLegacyByCanonical:pU,keyCanonicalByLegacy:f0,keyPrimaryLegacyByCanonical:p0,valueCanonicalByLegacy:mU,valueLegacyByCanonical:hU,originator:Gr.originator,topic:Gr.topic};c0=new Map;for(let[e,t]of Gr.keys){let n=c0.get(t)??[];n.push(e),c0.set(t,n)}});import{appendFileSync as yU,openSync as Zce}from"node:fs";import{homedir as h0}from"node:os";import{dirname as _U,join as g0,resolve as bU,sep as vU}from"node:path";import{mkdirSync as SU}from"node:fs";function kU(e){if(process.env.VITEST===void 0)return;let t=g0(h0(),".linzumi"),n=bU(e);if(n===t||n.startsWith(`${t}${vU}`))throw new Error(`test-mode log isolation violated: refusing to open ${e} inside the real ~/.linzumi (point the logger at a temp path; the harness defaults LINZUMI_RUNNER_LOG_FILE / LINZUMI_CLI_AUDIT_LOG for exactly this - see plans/2026-07-10-cli-test-hygiene-spec.md item 2)`)}function rt(e,t,n={}){let i=n.logFile??xU();kU(i);try{SU(_U(i),{recursive:!0}),yU(i,`${JSON.stringify({ts:new Date().toISOString(),event:e,...n.sessionId===void 0?{}:{sessionId:n.sessionId},...Uh(t)})}
11
- `,"utf8")}catch(r){console.warn("cli.audit_write_failed",{event:e,code:r instanceof Error&&"code"in r&&typeof r.code=="string"?r.code:"audit_write_error"});return}}function xU(){let e=process.env.LINZUMI_CLI_AUDIT_LOG?.trim();return e===void 0||e===""?g0(h0(),".linzumi","logs","command-events.jsonl"):e}function Uh(e){return _0(e)}function Gh(e,t){return AU(t)?go:typeof e=="string"?b0(e):Array.isArray(e)?t==="args"?TU(e):e.map(n=>Gh(n,void 0)):e!==null&&typeof e=="object"?_0(e):e}function _0(e){let t=typeof e.name=="string"?e.name.toLowerCase():void 0,n=t==="authorization"||t==="cookie"||t==="x-linzumi-agent-turn"||t==="set-cookie";return Object.fromEntries(Object.entries(e).filter(([i])=>i!=="runner_console").map(([i,r])=>[i,n&&i==="value"?go:Gh(r,i)]))}function TU(e){let t=!1;return e.map(n=>{if(typeof n!="string")return t=!1,Gh(n,void 0);if(t)return t=!1,go;let[i,r]=CU(n);return wU.has(i)?r===void 0?(t=!0,n):`${i}=${go}`:b0(n)})}function CU(e){let t=e.indexOf("=");return t===-1?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function AU(e){return e===void 0?!1:/^(authorization|cookie|set-cookie|password|login[_-]?url|turnCapability|topicWakeTurnCapability|topic_wake_turn_capability|x-linzumi-agent-turn|mcpAuthFileContents|LINZUMI_CLOUD_MCP_AUTH_JSON)$/i.test(e)||/(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$/i.test(e)}function b0(e){return EU(e).replace(/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,go)}function EU(e){let t;try{t=new URL(e)}catch{return PU(e)}for(let n of[...t.searchParams.keys()])y0.has(n.toLowerCase())&&t.searchParams.set(n,go);return t.toString()}function PU(e){let t=e.indexOf("?"),n=e.indexOf("#");if(t===-1||n!==-1&&n<t)return e;let i=e.slice(0,t),r=n===-1?e.slice(t+1):e.slice(t+1,n),o=n===-1?"":e.slice(n),a=new URLSearchParams(r),s=!1;for(let d of[...a.keys()])y0.has(d.toLowerCase())&&(a.set(d,go),s=!0);switch(s){case!0:return`${i}?${a.toString()}${o}`;case!1:return e}}var go,y0,wU,Ii=q(()=>{"use strict";Lh();go="<SENSITIVE_DATA>",y0=m0(new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"])),wU=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"])});function lc(e){let t=e.channelSession,n=t.linzumiAgentSession===!0,i=n?"read-only":t.sandbox,r=IU(t);return{cwd:e.cwd,...t.model===void 0?{}:{model:t.model},...r===void 0?{}:{config:r},...e.fast===!0?{serviceTier:"fast"}:{},...t.codexEnvironmentId===void 0?{}:{environmentId:t.codexEnvironmentId},approvalPolicy:n?"never":v0(t.approvalPolicy,i,{sandboxedNeverDefault:t.sandboxedApprovalNeverDefault}),...i===void 0?{}:{sandbox:i}}}function zh(e){let t=e.channelSession,n=t.linzumiAgentSession===!0,i=n?"read-only":t.sandbox;return{cwd:e.cwd,...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{effort:t.reasoningEffort},...e.fast===!0?{serviceTier:"fast"}:{},...t.codexEnvironmentId===void 0?{}:{environmentId:t.codexEnvironmentId},approvalPolicy:n?"never":v0(t.approvalPolicy,i,{sandboxedNeverDefault:t.sandboxedApprovalNeverDefault}),...i===void 0?{}:{sandboxPolicy:$U(i,e.cwd)}}}function IU(e){let t=e.reasoningEffort===void 0?{}:{model_reasoning_effort:e.reasoningEffort};return e.linzumiAgentSession!==!0?e.reasoningEffort===void 0?void 0:t:{...t,web_search:"disabled",tools:{view_image:!1},features:{apps:!1,shell_tool:!1,unified_exec:!1,multi_agent:!1,code_mode:!1,image_generation:!1,browser_use:!1,browser_use_external:!1,computer_use:!1,remote_plugin:!1,tool_suggest:!1,workspace_dependencies:!1}}}function OU(e,t,n){let i=n?.sandboxedNeverDefault===!0&&t==="workspace-write";switch(e){case void 0:case"default":return i?"never":"on-request";case"never":return t==="danger-full-access"||i?"never":"on-request";case"on-request":case"on-failure":return e;default:return console.warn(`linzumi approval-policy clamp: unknown Codex approval policy ${e}; clamping to most-restrictive approval (on-request)`),"on-request"}}function v0(e,t,n){let i=OU(e,t,n);return i==="never"&&t==="danger-full-access"?RU:i==="on-failure"?"on-request":i}function $U(e,t){switch(e){case"danger-full-access":return{type:"dangerFullAccess"};case"read-only":return{type:"readOnly",networkAccess:!1};case"workspace-write":return{type:"workspaceWrite",writableRoots:[t],networkAccess:!1,excludeTmpdirEnvVar:!1,excludeSlashTmp:!1};default:throw new Error(`unsupported Codex sandbox mode: ${e}`)}}var RU,uc=q(()=>{"use strict";RU={granular:{sandbox_approval:!1,rules:!1,skill_approval:!1,request_permissions:!1,mcp_elicitations:!0}}});import{stripVTControlCharacters as NU}from"node:util";function S0(e){let t=NU(e),n=t.match(/https:\/\/[^\s\u0000-\u001f\u007f]+/u)?.[0],i=t.match(/\b[A-Z0-9]{4,}(?:-[A-Z0-9]{4,})+\b/u)?.[0];return n===void 0||i===void 0?void 0:{verificationUrl:n,userCode:i}}function Jh(e){return e==="final_answer"?"final_answer":"commentary"}function Kh(e){let t=FU(e),n=pe(e.item);if(!(t===void 0||t===""))return{itemKey:Q(e.itemId)??Q(e.item_id)??Q(pe(e.item)?.id)??"assistant-message",turnId:Q(e.turnId)??Q(e.turn_id)??Q(pe(e.turn)?.id),delta:t,phase:Jh(e.phase??n?.phase)}}function Bh(e){let t=w0(e);if(!(t===void 0||t===""))return{itemKey:Q(e.itemId)??Q(e.item_id)??Q(pe(e.item)?.id)??"reasoning",turnId:Q(e.turnId)??Q(e.turn_id)??Q(pe(e.turn)?.id),delta:t}}function FU(e){return w0(e)}function DU(e){return e>=55296&&e<=56319}function LU(e){return e>=56320&&e<=57343}function Wh(e,t){let n=Math.min(Math.max(0,t),e.length),i=n>0&&n<e.length&&DU(e.charCodeAt(n-1))&&LU(e.charCodeAt(n))?n-1:n;return e.slice(0,i)}function w0(e){let t=e.delta;return typeof t=="string"?t:Be(t)?Q(t.text)??Q(t.content)??Q(t.delta)??Q(t.message):Q(e.text)??Q(e.content)??Q(e.message)}var ui=q(()=>{"use strict";Pt();ht();uc()});function k0(e){return JSON.stringify(e)}var x0=q(()=>{"use strict";Pt();ht()});import{mkdirSync as UU,appendFileSync as GU}from"node:fs";import{dirname as zU}from"node:path";function Hh(){return T0()!==void 0}function ld(e){let t=T0();if(t===void 0)return;let n=KU(t),i=BU(e),r={schemaVersion:1,provider:e.provider,captureKind:e.captureKind,ordinal:n.nextOrdinal,offsetMs:Math.max(0,Date.now()-n.startedAtMs),...i.rawText===void 0?{}:{rawText:i.rawText},...i.rawValue===void 0?{}:{rawValue:i.rawValue},...e.captureMetadata===void 0?{}:{captureMetadata:dd(e.captureMetadata)},...i.transforms.length===0?e.transforms===void 0?{}:{transforms:e.transforms}:{transforms:[...e.transforms??[],...i.transforms]}};n.nextOrdinal+=1,GU(t,`${k0(r)}
12
- `,"utf8")}function T0(){let e=process.env.LINZUMI_AGENT_REPLAY_RECORD_FILE?.trim();return e===void 0||e===""?void 0:e}function KU(e){return sd!==void 0&&sd.path===e||(UU(zU(e),{recursive:!0}),sd={path:e,startedAtMs:Date.now(),nextOrdinal:0}),sd}function BU(e){if(process.env.LINZUMI_AGENT_REPLAY_EXACT_RAW==="1")return{rawText:e.rawText,rawValue:e.rawValue,transforms:[]};let t=[],n=e.rawValue===void 0?void 0:dd(e.rawValue,"$.rawValue",t);return{rawText:WU(e.rawText,t),rawValue:n,transforms:t}}function WU(e,t){if(e!==void 0)try{let n=JSON.parse(e);return JSON.stringify(dd(n,"$.rawText",t))}catch{return e}}function dd(e,t="$",n=[]){if(Array.isArray(e))return e.map((r,o)=>dd(r,`${t}[${o}]`,n));if(!Be(e))return e;let i=Object.entries(e).map(([r,o])=>{let a=`${t}.${r}`;return JU.test(r)?(n.push({type:"credential_redaction",path:a}),[r,"[REDACTED]"]):[r,o===void 0?void 0:dd(o,a,n)]});return Object.fromEntries(i)}var sd,JU,cc=q(()=>{"use strict";x0();Pt();JU=/(^|[_-])(token|secret|api[_-]?key|authorization|cookie|private[_-]?key|login[_-]?url)([_-]|$)/iu});import{spawnSync as E0}from"node:child_process";import{existsSync as P0}from"node:fs";import{homedir as HU}from"node:os";import{basename as VU,posix as I0,win32 as ZU}from"node:path";function ud(e){return e==="win32"?ZU:I0}function QU(e,t){let n=VU(e).includes("fish")?`printf '%s%s%s' '${fc}' (string join ':' $PATH) '${Zh}'`:`printf '%s%s%s' '${fc}' "$PATH" '${Zh}'`;switch(t){case"interactive_login":return["-l","-i","-c",n];case"interactive":return["-i","-c",n];case"login":return["-l","-c",n]}}function YU(e,t){let n=E0(e,[...t],{encoding:"utf8",timeout:5e3,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"]});return{stdout:typeof n.stdout=="string"?n.stdout:void 0,error:n.error}}function wa(e){return{env:e?.env??process.env,platform:e?.platform??process.platform,homeDir:e?.homeDir??HU(),fileExists:e?.fileExists??P0,runLoginShell:e?.runLoginShell}}function XU(e){if(e===void 0)return;let t=e.lastIndexOf(fc),n=e.lastIndexOf(Zh);if(t===-1||n===-1||n<=t)return;let i=e.slice(t+fc.length,n).trim();return i===""?void 0:i}function Qh(e){let t=wa(e);if(t.platform==="win32")return;let n=e===void 0;if(e!==void 0&&e.runLoginShell===void 0||n&&process.env.VITEST!==void 0)return;if(n&&A0)return C0;let i=t.env.SHELL?.trim(),r=t.runLoginShell??YU,o=[];if(i!==void 0&&i!=="")for(let s of["interactive_login","interactive","login"]){let d=r(i,QU(i,s)),l=XU(d.stdout);if(l!==void 0)for(let u of l.split(":"))u!==""&&o.push(u)}let a=o.length===0?void 0:mc(o).join(":");return n&&(C0=a,A0=!0),a}function O0(e){let t=wa(e);if(t.platform==="win32")return[];let n=t.homeDir,i=I0.join,r=t.env.VOLTA_HOME?.trim(),o=t.env.BUN_INSTALL?.trim(),a=t.env.npm_config_prefix?.trim(),s=t.env.N_PREFIX?.trim();return mc([i(n,".local","bin"),i(n,".volta","bin"),r===void 0||r===""?void 0:i(r,"bin"),i(n,".bun","bin"),o===void 0||o===""?void 0:i(o,"bin"),i(n,".npm-global","bin"),a===void 0||a===""?void 0:i(a,"bin"),s===void 0||s===""?void 0:i(s,"bin"),i(n,".claude","local"),"/opt/homebrew/bin","/usr/local/bin"].filter(d=>d!==void 0))}function pc(e,t){return e===void 0?[]:e.split(ud(t).delimiter).filter(n=>n!=="")}function mc(e){return Array.from(new Set(e))}function R0(e){let t=wa(e);return mc([...pc(t.env.PATH,t.platform),...pc(Qh(e),t.platform),...O0(e)])}function $0(e){let t=e===void 0;if(t&&process.env.VITEST!==void 0)return process.env.PATH??"";if(t&&Vh!==void 0)return Vh;let n=wa(e),i=R0(e).join(ud(n.platform).delimiter);i!==""&&(n.env.PATH=i);let r=Qh(e);return r!==void 0&&r!==""&&(n.env[M0]=r),t&&(Vh=i),i}function Yh(e,t){let n=wa(t);if(e.includes("/")||e.includes("\\"))return n.fileExists(e)?e:void 0;let i=n.platform==="win32"?[`${e}.exe`,`${e}.cmd`,e]:[e],r=ud(n.platform).join;for(let o of R0(t))for(let a of i){let s=r(o,a);if(n.fileExists(s))return s}}function nG(e){return mc([...pc(e.jobPath,e.platform),...pc(e.loginShellPath,e.platform),...e.installDirs]).join(ud(e.platform).delimiter)}function Xh(e,t){if(e[eG]==="1"||t===void 0&&process.env.VITEST!==void 0)return e;let i=wa(t);if(i.platform==="win32")return e;let r=e[M0]?.trim(),o=r!==void 0&&r!==""?r:Qh(t),a=nG({jobPath:e.PATH,loginShellPath:o,installDirs:O0(t),platform:i.platform});return a===""||a===e.PATH?e:{...e,PATH:a}}function iG(e,t,n){let i=E0(e,["export","json"],{cwd:t,env:n,encoding:"utf8",timeout:rG,killSignal:"SIGKILL",stdio:["ignore","pipe","pipe"]});return{stdout:typeof i.stdout=="string"?i.stdout:void 0,stderr:typeof i.stderr=="string"?i.stderr:void 0,status:i.status,error:i.error}}function oG(e,t,n){let i=ud(n),r=e;for(let o=0;o<64;o+=1){if(t(i.join(r,".envrc")))return r;let a=i.dirname(r);if(a===r)return;r=a}}function eg(e,t,n){try{if(t[tG]!=="1")return t;let i=n?.platform??process.platform;if(i==="win32")return t;let r=n?.fileExists??P0,o=n?.log??(()=>{}),a=oG(e,r,i);if(a===void 0)return t;let s=Yh("direnv",{env:t,platform:i,fileExists:r});if(s===void 0)return o("direnv.unavailable",{cwd:e,envrc_dir:a}),t;let l=(n?.runDirenvExport??iG)(s,e,t);if(l.error!==void 0||l.status!==0)return o("direnv.export_failed",{cwd:e,envrc_dir:a,status:l.status??null,error:l.error?.message??null,stderr_head:l.stderr?.slice(0,300)??null}),t;let u=l.stdout?.trim()??"";if(u==="")return t;let c=JSON.parse(u);if(c===null||typeof c!="object"||Array.isArray(c))return o("direnv.export_failed",{cwd:e,envrc_dir:a,status:0,error:"direnv export json did not produce an object",stderr_head:null}),t;let p={...t},f=0;for(let[h,g]of Object.entries(c))g===null?(delete p[h],f+=1):typeof g=="string"&&(p[h]=g,f+=1);return f===0?t:(o("direnv.export_applied",{cwd:e,envrc_dir:a,vars:f}),p)}catch(i){return n?.log?.("direnv.export_failed",{cwd:e,envrc_dir:null,status:null,error:i instanceof Error?i.message:String(i),stderr_head:null}),t}}var fc,Zh,C0,A0,Vh,eG,tG,M0,rG,hc=q(()=>{"use strict";fc="__LINZUMI_LOGIN_PATH_BEGIN__",Zh="__LINZUMI_LOGIN_PATH_END__";A0=!1;eG="LINZUMI_DISABLE_JOB_PATH_PARITY",tG="LINZUMI_DIRENV",M0="LINZUMI_LOGIN_SHELL_PATH";rG=3e3});function j0(e){return{name:"linzumi",command:e.command??"linzumi",args:[...e.argsPrefix??[],"mcp","server","--api-url",e.kandanUrl,...e.authFilePath===void 0?[]:["--auth-file",e.authFilePath],...e.delegationAuthFilePath===void 0?[]:["--delegation-auth-file",e.delegationAuthFilePath],...e.ownerUsername===void 0?[]:["--owner-username",e.ownerUsername],...e.cwd===void 0?[]:["--cwd",e.cwd],...e.threadId===void 0?[]:["--thread-id",e.threadId],"--mode",e.operatingMode??"text",...e.toolScope===void 0||e.toolScope==="all"?[]:["--tool-scope",e.toolScope],...e.agentSession===!0?["--agent-session"]:[],...e.askUserQuestionTool===!0?["--ask-user-question-tool"]:[],...e.multiAgentJobs===!0?["--multi-agent-jobs"]:[]],env:{...e.accessToken===void 0?{}:{LINZUMI_MCP_ACCESS_TOKEN:e.accessToken},...e.devServices===void 0?{}:{LINZUMI_DEV_SERVICES_SCOPE:e.devServices.scope,LINZUMI_DEV_SERVICES_OWNER_PID:String(e.devServices.ownerPid)},ELECTRON_RUN_AS_NODE:"1"}}}function tg(e,t){return["-c",`mcp_servers.${e.name}.command=${JSON.stringify(e.command)}`,"-c",`mcp_servers.${e.name}.args=${aG(e.args)}`,...Object.entries(e.env).flatMap(([n,i])=>["-c",`mcp_servers.${e.name}.env.${n}=${JSON.stringify(i)}`]),...t.neverEquivalentGranularApprovalPolicy?["-c",`mcp_servers.${e.name}.default_tools_approval_mode="approve"`]:[],...e.args.includes("--ask-user-question-tool")?["-c",`mcp_servers.${e.name}.tool_timeout_sec=${q0}`]:[]]}function aG(e){return`[${e.map(t=>JSON.stringify(t)).join(", ")}]`}var q0,sG,gc=q(()=>{"use strict";ht();q0=2147483,sG=q0*1e3-5*6e4});function N0(){return["-c",'mcp_oauth_credentials_store="file"',"-c",'cli_auth_credentials_store="file"']}var xfe,F0=q(()=>{"use strict";xfe=["# Managed by Linzumi - do not edit by hand.","# This isolated CODEX_HOME keeps Linzumi-spawned codex processes off the","# user's ~/.codex config and the macOS Keychain. See codexHome.ts.",'mcp_oauth_credentials_store = "file"','cli_auth_credentials_store = "file"',""].join(`
13
- `)});import{spawnSync as dG}from"node:child_process";import{homedir as lG}from"node:os";import{dirname as Pfe,join as uG}from"node:path";function D0(){return uG(lG(),".linzumi","protected-dev-listeners")}function rg(e=Date.now()){let t=new Set;for(let n of cG.listenersBySource.values())if(!(e-n.updatedAtMs>ng))for(let i of n.listeners)t.add(i.pid);return t}function fG(e){return e.split(`
14
- `).map(t=>t.trim().match(/^(\d+)\s+(\d+)$/)).filter(t=>t!==null).map(t=>({pid:Number(t[1]),pgid:Number(t[2])}))}function ig(e){try{let t=dG("ps",["-axo","pid=,pgid="],{encoding:"utf8",timeout:5e3,killSignal:"SIGKILL"});return t.error!==void 0||t.status!==0?void 0:fG(t.stdout).filter(n=>n.pgid===e).map(n=>n.pid)}catch{return}}function cd(e,t,n=process.kill,i=ig,r=rg()){if(r.size>0){let o=i(e);if(o!==void 0){let a=o.filter(s=>r.has(s));if(a.length>0){let s=[],d=new Set(o.filter(l=>!r.has(l)));d.add(e);for(let l of d)try{n(l,t)}catch(u){pG(u)!=="ESRCH"&&s.push({pid:l,error:u})}return{mode:"individual",sparedPids:a,failures:s}}}}return n(-e,t),{mode:"group",sparedPids:[],failures:[]}}function pG(e){if(e!==null&&typeof e=="object"&&"code"in e){let t=e.code;return typeof t=="string"?t:void 0}}var ng,cG,fd=q(()=>{"use strict";ng=5*6e4,cG={listenersBySource:new Map,lastMirrorPayloadJson:void 0,lastMirrorWriteMs:0,mirrorPathOverride:void 0}});function U0(e,t=process.kill){return yo.children.add(e),hG(),{unregister:()=>{yo.children.delete(e)}}}function og(e=process.kill,t="exit"){let n=[...yo.children];yo.children.clear();for(let i of n)mG(i,e,t);return n.length}function mG(e,t,n){try{e.stop()}catch(i){yc(e,n,"stop",i)}if(e.pid!==void 0){if(e.ownProcessGroup)try{let i=cd(e.pid,L0,t);i.sparedPids.length>0&&gG(e,n,i.sparedPids);for(let r of i.failures)yc(e,n,`member_kill:${r.pid}`,r.error);return}catch(i){if(ag(i)==="ESRCH")return;yc(e,n,"group_kill",i)}try{t(e.pid,L0)}catch(i){if(ag(i)==="ESRCH")return;yc(e,n,"pid_kill",i)}}}function hG(){if(yo.handlersInstalled)return;yo.handlersInstalled=!0;let e=()=>{og(process.kill,"process_exit")};process.on("exit",e);let t=process.listenerCount("uncaughtException")===0,n=process.listenerCount("unhandledRejection")===0,i=o=>{og(process.kill,"uncaught_exception"),process.stderr.write(`linzumi runner uncaughtException: ${o instanceof Error?o.stack??o.message:String(o)}
15
- `),process.exit(1)},r=o=>{og(process.kill,"unhandled_rejection"),process.stderr.write(`linzumi runner unhandledRejection: ${o instanceof Error?o.stack??o.message:String(o)}
16
- `),process.exit(1)};t&&process.on("uncaughtException",i),n&&process.on("unhandledRejection",r),yo.removeHandlers=()=>{process.off("exit",e),t&&process.off("uncaughtException",i),n&&process.off("unhandledRejection",r)}}function gG(e,t,n){try{rt("process.reap_spared_listeners",{purpose:e.kind,pid:e.pid??null,reason:t,sparedPids:[...n]})}catch{}}function yc(e,t,n,i){rt("process.reap_failed",{purpose:e.kind,pid:e.pid??null,ownProcessGroup:e.ownProcessGroup,reason:t,stage:n,code:ag(i)??null,message:i instanceof Error?i.message:String(i)})}function ag(e){if(e!==null&&typeof e=="object"&&"code"in e){let t=e.code;return typeof t=="string"?t:void 0}}var yo,L0,G0=q(()=>{"use strict";fd();Ii();yo={children:new Set,handlersInstalled:!1,removeHandlers:void 0},L0="SIGKILL"});function yG(e){return JSON.stringify(e)}function _G(){return`
17
- const { spawn, spawnSync } = require('node:child_process');
18
- const fs = require('node:fs');
19
- const config = JSON.parse(process.argv[process.argv.length - 1]);
20
- const originalParentPid = process.ppid;
21
- const child = spawn(config.command, config.args, { stdio: 'inherit' });
22
- let done = false;
23
- // Dev-server exemption (keep in sync with devServerReapExemption.ts
24
- // readProtectedPidsFromDir - the freshness bound is textually substituted
25
- // from protectedListenerFreshnessMs at program build): union of every FRESH
26
- // mirror file's pids. Any failure is reported and returns an empty set,
27
- // restoring the classic whole-group kill.
28
- function reportProtectedMirrorReadFailure(stage, path, error) {
29
- const message = error && error.message ? error.message : String(error);
30
- process.stderr.write('protected listener mirror read failed: stage=' + stage + ' path=' + path + ' message=' + message + String.fromCharCode(10));
31
- }
32
- function protectedPids() {
33
- const out = new Set();
34
- const dir = config.protectedPidsDir;
35
- if (typeof dir !== 'string' || dir === '') return out;
36
- let names;
37
- try { names = fs.readdirSync(dir); } catch (error) {
38
- if (!error || error.code !== 'ENOENT') reportProtectedMirrorReadFailure('read_directory', dir, error);
39
- return out;
40
- }
41
- const now = Date.now();
42
- for (const name of names) {
43
- if (!name.endsWith('.json')) continue;
44
- const path = dir + '/' + name;
45
- try {
46
- const parsed = JSON.parse(fs.readFileSync(path, 'utf8'));
47
- if (!parsed || typeof parsed.updatedAtMs !== 'number' || !Array.isArray(parsed.pids)) {
48
- reportProtectedMirrorReadFailure('shape', path, new Error('mirror requires numeric updatedAtMs and pids array'));
49
- continue;
50
- }
51
- if (now - parsed.updatedAtMs > ${ng}) continue;
52
- for (const pid of parsed.pids) {
53
- if (Number.isInteger(pid) && pid > 1) out.add(pid);
54
- }
55
- } catch (error) { reportProtectedMirrorReadFailure('read_or_parse', path, error); }
56
- }
57
- return out;
58
- }
59
- // Group kill that spares protected listener pids: enumerate this group's
60
- // members (the wrapper leads its own group) and signal each one except the
61
- // spared listeners and the wrapper itself (the wrapper exits via its own
62
- // child-exit/parent-death paths). Any enumeration failure, or no protected
63
- // member in the group, falls back to the atomic kill(-pgid).
64
- function groupKillExcept(signal) {
65
- const spare = protectedPids();
66
- if (spare.size > 0) {
67
- try {
68
- const result = spawnSync('ps', ['-axo', 'pid=,pgid='], { encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL' });
69
- if (result.error === undefined && result.status === 0) {
70
- const members = [];
71
- let sparedAny = false;
72
- for (const line of result.stdout.split('\\n')) {
73
- const match = line.trim().match(/^(\\d+)\\s+(\\d+)$/);
74
- if (!match || Number(match[2]) !== process.pid) continue;
75
- const pid = Number(match[1]);
76
- if (pid === process.pid) continue;
77
- if (spare.has(pid)) { sparedAny = true; continue; }
78
- members.push(pid);
79
- }
80
- if (sparedAny) {
81
- for (const pid of members) { try { process.kill(pid, signal); } catch (_e) {} }
82
- return;
83
- }
84
- }
85
- } catch (_e) {}
86
- }
87
- process.kill(-process.pid, signal);
88
- }
89
- function shutdown(signal) {
90
- if (done) return;
91
- done = true;
92
- try { groupKillExcept(signal); }
93
- catch (_e) { try { child.kill(signal); } catch (_e2) {} }
94
- }
95
- process.on('SIGINT', () => shutdown('SIGINT'));
96
- process.on('SIGTERM', () => shutdown('SIGTERM'));
97
- process.on('SIGHUP', () => shutdown('SIGTERM'));
98
- child.on('exit', (code, signal) => {
99
- clearInterval(watchdog);
100
- // The child is gone; the wrapper must follow it down rather than linger as an
101
- // orphan. On the forwarded-signal path (shutdown() above caught SIGINT/SIGTERM
102
- // /SIGHUP and propagated it to the child), the wrapper still has its own
103
- // handler installed for that signal, so a bare process.kill(self, signal)
104
- // would just re-enter shutdown() - a no-op once done is set - and the wrapper
105
- // would never exit. Remove the handlers first so the signal's DEFAULT
106
- // disposition (terminate) applies, re-raise to mirror the child's death
107
- // signal, then exit() as a belt-and-suspenders fallback in case re-raising
108
- // does not terminate (e.g. a signal with no default-terminate disposition).
109
- process.removeAllListeners('SIGINT');
110
- process.removeAllListeners('SIGTERM');
111
- process.removeAllListeners('SIGHUP');
112
- if (signal) { try { process.kill(process.pid, signal); } catch (_e) {} }
113
- process.exit(signal ? 1 : code == null ? 0 : code);
114
- });
115
- child.on('error', (err) => {
116
- process.stderr.write('engine watchdog spawn failed: ' + (err && err.message) + '\\n');
117
- process.exit(1);
118
- });
119
- const watchdog = setInterval(() => {
120
- // Inlined parentDeathWatchdogShouldReap (keep in sync): reap PURELY on a ppid
121
- // change from boot - covers reparent-to-subreaper AND reparent-to-init. NO
122
- // \`=== 1\` arm: a runner that is PID 1 captures originalParentPid === 1, so
123
- // such an arm would false-fire on the first poll and kill a healthy codex.
124
- if (process.ppid !== originalParentPid) {
125
- try { child.kill('SIGKILL'); } catch (_e) {}
126
- try { groupKillExcept('SIGKILL'); } catch (_e) {}
127
- process.exit(0);
128
- }
129
- }, config.pollIntervalMs);
130
- `.trim()}function z0(e,t){return{command:e,args:["-e",_G(),yG(t)]}}var J0=q(()=>{"use strict";fd()});var K0=q(()=>{"use strict"});import{spawn as SG}from"node:child_process";import{randomUUID as wG}from"node:crypto";import{createServer as kG}from"node:net";function CG(e){let t=e;if(typeof t.ping=="function"&&t.readyState===WebSocket.OPEN)try{t.ping()}catch{}}async function EG(){return new Promise((e,t)=>{let n=kG();n.on("error",i=>t(i)),n.listen(0,"127.0.0.1",()=>{let i=n.address();if(typeof i=="object"&&i!==null){let r=i.port;n.close(o=>{o!==void 0?t(o):e(r)})}else n.close(),t(new Error("failed to allocate loopback port"))})})}async function sg(e,t,n={}){return Z0(e,t,n,1)}async function Z0(e,t,n,i){let o=`ws://127.0.0.1:${await EG()}`,a=lg(o,n);i===1&&GG();let s="",d=OG(),l=z0(process.execPath,{command:e,args:a,pollIntervalMs:xG,protectedPidsDir:D0()});rt("process.spawn",{command:e,args:a,cwd:t,purpose:"codex.app_server"});let u=SG(l.command,[...l.args],{cwd:t,env:RG(n.env,n.inheritEnv??!0,t),stdio:d,detached:!0});B0(u,"stdout"),B0(u,"stderr",g=>{s=PG(`${s}${g}`)});let c=U0({stop:()=>W0(u),pid:u.pid,ownProcessGroup:!0,kind:"codex.app_server"});u.once("exit",()=>c.unregister());let p=()=>{c.unregister(),W0(u)},f,h=()=>(c.unregister(),f??=MG(u),f);rt("process.spawned",{command:e,args:a,cwd:t,pid:u.pid,purpose:"codex.app_server"}),u.once("exit",(g,_)=>{rt("process.exit",{command:e,args:a,cwd:t,pid:u.pid,code:g,signal:_,purpose:"codex.app_server"})});try{await rz(o,u)}catch(g){if(p(),IG(g,s,i))return rt("process.spawn.retry",{command:e,cwd:t,attempt:i,reason:"loopback_bind_in_use",purpose:"codex.app_server"}),Z0(e,t,n,i+1);throw g}return{url:o,process:u,stop:p,stopAndWait:h}}function PG(e){return e.length>12e3?e.slice(e.length-12e3):e}function IG(e,t,n){let r=e instanceof Error?e.message:String(e);return n<3&&r.includes("codex app-server exited before readyz")&&t.includes("EADDRINUSE")&&t.includes("listen")}function OG(){return["ignore","pipe","pipe"]}function B0(e,t,n=void 0){let i=e[t];i!==null&&i.on("data",r=>{let o=r.toString();n?.(o),rt("process.output",{pid:e.pid,purpose:"codex.app_server",stream:t,chars:o.length,output:o})})}function RG(e,t,n){let i=t?{...process.env}:{};for(let r of AG)delete i[r];if(e!==void 0)for(let[r,o]of Object.entries(e))o===void 0?delete i[r]:i[r]=o;return t&&(i=Xh(i),i=eg(n,i,{log:(r,o)=>rt(r,o)}),i=Xh(i)),i}function W0(e,t=process.kill){if(e.pid!==void 0)try{let n=cd(e.pid,"SIGINT",t);n.sparedPids.length>0&&rt("process.group_signal_spared_listeners",{pid:e.pid,signal:"SIGINT",sparedPids:[...n.sparedPids],purpose:"codex.app_server"});return}catch(n){Q0(e.pid,"SIGINT",n)}e.kill("SIGINT")}function $G(e){try{return process.kill(-e,0),!0}catch(t){return dg(t)!=="ESRCH"}}function MG(e,t={}){let n=e.pid;if(n===void 0)return Promise.reject(new Error("cannot reap owned Codex app-server without a process id"));let i=t.sigintGraceMs??5e3,r=t.sigkillWaitMs??5e3,o=t.killProcess??process.kill,a=t.listGroupPids??ig,s=t.processGroupExists??$G,d=t.protectedPids??rg;return new Promise((l,u)=>{let c=e.exitCode!==null||e.signalCode!==null,p=!1,f,h,g,_=()=>{f!==void 0&&clearTimeout(f),h!==void 0&&clearTimeout(h),g!==void 0&&clearTimeout(g)},y=S=>{if(!p)switch(p=!0,_(),e.off("exit",C),S){case"reaped":l();break;case"abandoned":u(new Error(`owned Codex app-server process group ${n} could not be confirmed reaped`));break}},b=()=>{let S=a(n);if(S===void 0)return;let k=d();return S.filter(T=>!k.has(T))},v=()=>{let S=b(),k=S===void 0?!s(n):S.length===0;return c&&k?(y("reaped"),!0):!1},w=()=>{p||g!==void 0||(g=setTimeout(()=>{g=void 0,v()||w()},10),g.unref?.())},A=S=>{try{let k=cd(n,S,o,a,d());k.sparedPids.length>0&&rt("process.group_signal_spared_listeners",{pid:n,signal:S,sparedPids:[...k.sparedPids],purpose:"codex.app_server"})}catch(k){if(dg(k)!=="ESRCH"){Q0(n,S,k);try{e.kill(S)}catch{}}}},C=()=>{c=!0,v()||w()};e.once("exit",C),A("SIGINT"),!v()&&(f=setTimeout(()=>{p||(A("SIGKILL"),v()||w(),h=setTimeout(()=>y("abandoned"),r),h.unref?.())},i),f.unref?.())})}function Q0(e,t,n){let i=dg(n),r=n instanceof Error?n.message:String(n);rt(i==="EPERM"?"process.group_signal_denied":i==="ESRCH"?"process.group_signal_missing":"process.group_signal_failed",{pid:e,signal:t,code:i,message:r,fallback:"child_signal",purpose:"codex.app_server"}),i==="EPERM"&&process.stderr.write(`codex app-server process-group ${t} denied for pid ${e}; falling back to direct child ${t}
131
- `)}function dg(e){if(e!==null&&typeof e=="object"&&"code"in e){let t=e.code;return typeof t=="string"?t:void 0}}function lg(e,t={}){return["app-server",...KG(t),"--listen",e]}function DG(e){return FG.find(t=>t===e)}function LG(e){let t=e?.trim();if(e===void 0||t===void 0||t==="")return{state:"unset"};if(!/^[0-9]+$/.test(t))return{state:"invalid",raw:e};let n=Number(t);return!Number.isSafeInteger(n)||n<ug||n>cg?{state:"invalid",raw:e}:{state:"applied",timeoutMs:n}}function X0(e=process.env){let t=LG(e[Y0]);if(t.state==="unset")return t;let n=DG(e[NG]?.trim())??"env";return{...t,source:n}}function UG(e=process.env){let t=X0(e);return t.state==="applied"?t.timeoutMs:void 0}function GG(e=process.env,t=n=>{process.stderr.write(`${n}
132
- `)}){let n=X0(e);if(n.state!=="unset"){if(n.state==="invalid"){let i=zG();t(`ERROR: ${Y0}='${n.raw}' is invalid; stream-idle-timeout stays OFF. Accepted: ${i}.`),rt("codex.stream_idle_timeout_config_invalid",{level:"error",raw:n.raw,source:n.source,acceptedFormat:i,minMs:ug,maxMs:cg});return}rt("codex.stream_idle_timeout_config_applied",{level:"info",timeoutMs:n.timeoutMs,source:n.source})}}function zG(){return`a plain positive integer between ${ug} and ${cg} (milliseconds)`}function tT(){let e=eT;return["-c",`model_providers.${e}.name="OpenAI"`,"-c",`model_providers.${e}.wire_api="responses"`,"-c",`model_providers.${e}.requires_openai_auth=true`,"-c",`model_providers.${e}.supports_websockets=true`]}function JG(e){let t=eT;return[...tT(),"-c",`model_providers.${t}.stream_idle_timeout_ms=${e}`,"-c",`model_provider="${t}"`]}function KG(e,t=process.env){let n=UG(t);return[...jG,...e.nativeQuestionBridge==="durable"?qG:[],...N0(),...e.model===void 0?[]:["-c",`model=${JSON.stringify(e.model)}`],...e.reasoningEffort===void 0?[]:["-c",`model_reasoning_effort=${JSON.stringify(e.reasoningEffort)}`],...e.fast===!0?["-c",`service_tier=${JSON.stringify("fast")}`]:[],...(e.mcpServers??[]).flatMap(i=>tg(i,{neverEquivalentGranularApprovalPolicy:e.neverEquivalentGranularApprovalPolicy===!0})),...e.modelProvider===void 0?n===void 0?tT():JG(n):BG(e.modelProvider,n)]}function BG(e,t){return["-c",`model_providers.${e.id}.name=${JSON.stringify(e.name)}`,"-c",`model_providers.${e.id}.base_url=${JSON.stringify(e.baseUrl)}`,"-c",`model_providers.${e.id}.env_key=${JSON.stringify(e.envKey)}`,"-c",`model_providers.${e.id}.wire_api=${JSON.stringify(e.wireApi)}`,...Object.entries(e.httpHeaders??{}).flatMap(([n,i])=>["-c",`model_providers.${e.id}.http_headers.${n}=${JSON.stringify(i)}`]),...Object.entries(e.envHttpHeaders??{}).flatMap(([n,i])=>["-c",`model_providers.${e.id}.env_http_headers.${n}=${JSON.stringify(i)}`]),...t===void 0?[]:["-c",`model_providers.${e.id}.stream_idle_timeout_ms=${t}`],"-c",`model_provider=${JSON.stringify(e.id)}`]}async function _c(e,t=i=>new Dh.default(i),n=2e3){let i=await QG(e,t,n),r=wG(),o=new Map,a=new Set,s=new Set,d=[],l=new Set,u={nextId:1,closeError:void 0},c=g=>{let _=new Error(g);o.forEach(y=>y.reject(_)),o.clear()},p=setInterval(()=>CG(i),TG);p.unref?.();let f=g=>{if(clearInterval(p),c(g),u.closeError===void 0){u.closeError=new Error(g);for(let _ of l)V0(_,u.closeError);l.clear()}};return i.addEventListener("close",()=>f("codex app-server websocket closed")),i.addEventListener("error",()=>f("codex app-server websocket closed")),i.addEventListener("message",g=>{let _=String(g.data),y=ZG(_);if(y===void 0){WG(_,r);return}if(pd({direction:"codex_to_commander",captureKind:VG(y),message:y,rawText:_,connectionId:r}),"id"in y&&("result"in y||"error"in y)){let b=o.get(y.id);b!==void 0&&(o.delete(y.id),b.resolve(y));return}if("id"in y&&typeof y.method=="string"){XG(i,y,s,r);return}if(!("id"in y)&&typeof y.method=="string"){let b=y;a.size===0?d.push(b):a.forEach(v=>H0(v,b))}}),await tz(i,o,r),{request:(g,_)=>{let y=u.nextId;return u.nextId+=1,nT(i,o,_===void 0?{jsonrpc:"2.0",id:y,method:g}:{jsonrpc:"2.0",id:y,method:g,params:_},r)},notify:(g,_)=>{let y=_===void 0?{jsonrpc:"2.0",method:g}:{jsonrpc:"2.0",method:g,params:_};pd({direction:"commander_to_codex",captureKind:"outgoing",message:y,rawText:JSON.stringify(y),connectionId:r}),i.send(JSON.stringify(y))},onNotification:g=>{a.add(g),d.splice(0).forEach(_=>H0(g,_))},onRequest:g=>{s.add(g)},onClose:g=>{if(u.closeError!==void 0){V0(g,u.closeError);return}l.add(g)},isClosed:()=>u.closeError!==void 0,close:()=>{clearInterval(p),i.close()}}}function pd(e){Hh()&&ld({provider:"codex-app-server",captureKind:e.captureKind,rawText:e.rawText,rawValue:{message:e.message},captureMetadata:{direction:e.direction,capturedAtMs:Date.now(),capturePid:process.pid,connectionId:e.connectionId,...HG(e.message),...e.extraMetadata??{}}})}function WG(e,t){Hh()&&ld({provider:"codex-app-server",captureKind:"incoming",rawText:e,captureMetadata:{direction:"codex_to_commander",capturedAtMs:Date.now(),capturePid:process.pid,connectionId:t,malformed:!0}})}function HG(e){return!("params"in e)||!Be(e.params)?{}:yh(e.params)}function VG(e){return"id"in e&&("result"in e||"error"in e)?"response":"id"in e&&typeof e.method=="string"?"request":"notification"}function ZG(e){let t=String(e);try{let n=JSON.parse(t);if(!Be(n))throw new Error("codex app-server sent non-object JSON-RPC message");return n}catch(n){rt("codex.app_server_frame_malformed",{purpose:"codex.app_server",message:n instanceof Error?n.message:String(n),payload:Wh(t,512),payloadChars:t.length});return}}function H0(e,t){try{e(t)}catch(n){rt("codex.notification_callback_failed",{purpose:"codex.app_server",method:t.method,message:n instanceof Error?n.message:String(n)})}}function V0(e,t){try{e(t)}catch(n){rt("codex.close_callback_failed",{purpose:"codex.app_server",message:n instanceof Error?n.message:String(n)})}}async function QG(e,t,n=2e3){let i=Date.now()+n,r;for(;Date.now()<=i;){let o=t(e);try{return await nz(o,Math.max(1,i-Date.now())),o}catch(a){r=a instanceof Error?a:new Error(String(a)),YG(o)}}throw r??new Error("websocket open failed")}function YG(e){let t=()=>{e.removeEventListener("error",n),e.removeEventListener("close",i)},n=()=>t(),i=()=>t();e.addEventListener("error",n,{once:!0}),e.addEventListener("close",i,{once:!0});try{e.close()}catch(r){t(),console.warn(`codex_app_server_failed_open_close_threw error_name=${r instanceof Error?r.name:"NonErrorThrow"}`)}}async function XG(e,t,n,i){let r=o=>ez(e,o,t.method,i);try{if(n.size===0){r({jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`unhandled Codex app-server request: ${t.method}`}});return}for(let o of n){let a=await o(t);if(a!==void 0){r({jsonrpc:"2.0",id:t.id,result:a});return}}r({jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`unhandled Codex app-server request: ${t.method}`}})}catch(o){r({jsonrpc:"2.0",id:t.id,error:{code:-32e3,message:o instanceof Error?o.message:String(o)}})}}function ez(e,t,n,i){let r=JSON.stringify(t);pd({direction:"commander_to_codex",captureKind:"response",message:t,rawText:r,connectionId:i,extraMetadata:{requestMethod:n}}),e.send(r)}async function tz(e,t,n){let i=await nT(e,t,{jsonrpc:"2.0",id:"initialize",method:"initialize",params:{clientInfo:{name:"kandan-local-codex-runner",version:"0.0.1"},capabilities:{experimentalApi:!0}}},n);if("error"in i)throw new Error(`codex initialize failed: ${i.error.message}`);let r={jsonrpc:"2.0",method:"initialized"};pd({direction:"commander_to_codex",captureKind:"outgoing",message:r,rawText:JSON.stringify(r),connectionId:n}),e.send(JSON.stringify(r))}function nT(e,t,n,i){return e.readyState!==WebSocket.OPEN?Promise.reject(new Error("codex app-server websocket is not open")):new Promise((r,o)=>{t.set(n.id,{resolve:r,reject:o}),pd({direction:"commander_to_codex",captureKind:"request",message:n,rawText:JSON.stringify(n),connectionId:i}),e.send(JSON.stringify(n))})}function nz(e,t){return new Promise((n,i)=>{let r,o=()=>{r!==void 0&&clearTimeout(r),e.removeEventListener("open",a),e.removeEventListener("error",s)},a=()=>{o(),n()},s=()=>{o(),i(new Error("websocket open failed"))};e.addEventListener("open",a,{once:!0}),e.addEventListener("error",s,{once:!0}),r=setTimeout(()=>{o(),i(new Error("websocket open timed out"))},t),r.unref?.()})}function rz(e,t,n=1e4){let i=iz(e),r=Date.now()+n;return new Promise((o,a)=>{let s=!1,d,l=f=>{s||(s=!0,d!==void 0&&clearTimeout(d),t.off("exit",u),f==="ready"?o():a(f))},u=(f,h)=>{l(new Error(`codex app-server exited before readyz: ${f??h??"unknown"}`))},c=()=>{d=setTimeout(p,50)},p=async()=>{if(Date.now()>r){l(new Error("timed out waiting for codex app-server readyz"));return}try{(await fetch(i)).ok?l("ready"):c()}catch{c()}};t.once("exit",u),p()})}function iz(e){let t=new URL(e);return t.protocol=t.protocol==="wss:"?"https:":"http:",t.pathname="/readyz",t.search="",t.hash="",t.toString()}var xG,TG,AG,jG,qG,Y0,NG,ug,cg,FG,eT,fg=q(()=>{"use strict";l0();Pt();ht();Ii();ui();cc();hc();gc();F0();fd();G0();J0();K0();xG=2e3,TG=(()=>{let e=process.env.LINZUMI_CODEX_WS_KEEPALIVE_MS;if(e===void 0)return 2e4;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:2e4})();AG=["LINZUMI_MCP_ACCESS_TOKEN","LINZUMI_MCP_OWNER_USERNAME"];jG=["-c","features.apps=false"],qG=["-c","features.default_mode_request_user_input=true"],Y0="LINZUMI_CODEX_STREAM_IDLE_TIMEOUT_MS",NG="LINZUMI_CODEX_STREAM_IDLE_TIMEOUT_SOURCE",ug=5e3,cg=6e5,FG=["flag","env","server_default"];eT="openai-linzumi"});function bc(e){let t=new URL(e);switch(t.protocol){case"ws:":t.protocol="http:";break;case"wss:":t.protocol="https:";break;case"http:":case"https:":break;default:throw new Error("--api-url must be ws://, wss://, http://, or https://")}return t.pathname="",t.search="",t.hash="",t.toString().replace(/\/$/,"")}var tpe,pg=q(()=>{"use strict";Ii();tpe=300*1e3});function md(e){let t=e.fetchImpl??fetch,n=bc(e.kandanUrl),i=e.authMode==="personal-agent-delegation"?"/api/v2/personal-agent-mcp":"/api/v2/local-runner-mcp",r=e.operatingMode??"text",o=async(a,s,d,l={})=>{let u=new URL(s,n),c={...d,operating_mode:r},p={method:a,headers:{authorization:`Bearer ${e.accessToken}`,...e.topicWakeTurnCapability===void 0?{}:{"x-linzumi-agent-turn":e.topicWakeTurnCapability}},...l.signal===void 0?{}:{signal:l.signal}};if(a==="GET")for(let[b,v]of Object.entries(c))v!=null&&u.searchParams.set(b,String(v));else p.headers={...p.headers,"content-type":"application/json"},p.body=JSON.stringify(c);let f=await t(u,p),h=await f.json(),g=Be(h)?h:void 0;if(g===void 0)throw new Error(`Linzumi MCP API returned non-object JSON from ${s}`);if(f.ok&&g.ok===!0)return g;let _=typeof g.error=="string"?g.error:`HTTP ${f.status}`,y=typeof g.detail=="string"?g.detail:void 0;throw new Error(`Linzumi MCP API ${s} failed: ${_}${y===void 0?"":` detail=${y}`}`)};return{validateAuth:()=>o("GET",`${i}/validate`,{}),issueOnboardingDiscoveryToken:a=>o("POST",`${i}/onboarding-discovery-token`,a),getMessage:a=>o("GET",`${i}/message`,a),getThread:a=>o("GET",`${i}/thread`,a),getThreadTranscript:a=>o("GET",`${i}/thread-transcript`,a),getChannel:a=>o("GET",`${i}/channel`,a),searchWorkspace:a=>o("GET",`${i}/search`,a),askWorkspace:a=>o("POST",`${i}/ask`,a),aboutMe:a=>o("GET",`${i}/about-me`,a),webSearch:a=>o("GET",`${i}/web-search`,a),fetchUrl:a=>o("GET",`${i}/fetch-url`,a),listUiTargets:a=>o("GET",`${i}/ui-targets`,a),openUi:a=>o("POST",`${i}/open-ui`,a),getCodingJobMetadata:a=>o("GET",`${i}/coding-job-metadata`,a),listProjects:a=>o("GET",`${i}/projects`,a),getProjectTasks:a=>o("GET",`${i}/project-tasks`,a),createProjectTask:a=>o("POST",`${i}/project-tasks/create`,a),updateProjectTask:a=>o("POST",`${i}/project-tasks/update`,a),deleteProjectTask:a=>o("POST",`${i}/project-tasks/delete`,a),addProjectTaskDependency:a=>o("POST",`${i}/project-tasks/add-dependency`,a),removeProjectTaskDependency:a=>o("POST",`${i}/project-tasks/remove-dependency`,a),getCallTranscript:a=>o("GET",`${i}/call-transcript`,a),renameCodingJob:a=>o("POST",`${i}/coding-job-title`,a),upsertCodingJobPlan:(a,s)=>o("POST",`${i}/coding-job-plan`,a,s),replaceCodingJobPlanSteps:a=>o("POST",`${i}/coding-job-plan/steps`,a),updateCodingJobPlanStep:a=>o("POST",`${i}/coding-job-plan/step`,a),linkCodingJobPullRequest:a=>o("POST",`${i}/coding-job-primary-pr`,a),listVaultSecrets:a=>o("GET",`${i}/vault-secrets`,a),noteProjectDirectory:a=>o("POST",`${i}/discovered-project`,a),noteAgentConversation:a=>o("POST",`${i}/discovered-conversation`,a),noteOnboardingDiscoveryStatus:a=>o("POST",`${i}/discovery-status`,a),sendChannelMessage:a=>o("POST",`${i}/channel-message`,a),editMessage:a=>o("POST",`${i}/message/edit`,a),agentReply:a=>o("POST",`${i}/agent-reply`,a),scheduleWake:a=>o("POST",`${i}/scheduled-wakes`,a),cancelWake:a=>o("POST",`${i}/scheduled-wakes/cancel`,a),declineDocumentAction:a=>o("POST",`${i}/agent/decline-document-action`,a),completeTopicWakeNoAction:a=>o("POST",`${i}/agent/complete-topic-wake-no-action`,a),recordTopicWakeToolAttempt:()=>o("POST",`${i}/agent/topic-wake-tool-attempt`,{}),agentTurnProgress:a=>o("POST",`${i}/agent-turn-progress`,a),agentDocumentTool:a=>o("POST",`${i}/agent/document-tool`,a),agentTopicTool:a=>o("POST",`${i}/agent/topic-tool`,a),agentListCodingJobs:a=>o("GET",`${i}/agent/coding-jobs`,a),agentStartCodingJob:a=>o("POST",`${i}/agent/start-coding-job`,a),agentSpawnChildJob:a=>o("POST",`${i}/agent/spawn-child-job`,a),agentArchiveChildJob:a=>o("POST",`${i}/agent/archive-child-job`,a),agentUnarchiveChildJob:a=>o("POST",`${i}/agent/unarchive-child-job`,a),agentInterruptCodingJob:a=>o("POST",`${i}/agent/interrupt-coding-job`,a),agentSendCodingJobMessage:a=>o("POST",`${i}/agent/send-coding-job-message`,a),agentDiscoverCodingJobs:a=>o("GET",`${i}/agent/discover-coding-jobs`,a),agentReadCodingJobThread:a=>o("GET",`${i}/agent/coding-job-thread`,a),agentResolveJobApproval:a=>o("POST",`${i}/agent/resolve-job-approval`,a),agentArchiveCodingJob:a=>o("POST",`${i}/agent/archive-coding-job`,a),agentUnarchiveCodingJob:a=>o("POST",`${i}/agent/unarchive-coding-job`,a),agentSetThreadStatus:a=>o("POST",`${i}/agent/set-thread-status`,a),agentCreateChannel:a=>o("POST",`${i}/agent/create-channel`,a),agentRenameChannel:a=>o("POST",`${i}/agent/rename-channel`,a),agentArchiveChannel:a=>o("POST",`${i}/agent/archive-channel`,a),agentUnarchiveChannel:a=>o("POST",`${i}/agent/unarchive-channel`,a),agentAddReaction:a=>o("POST",`${i}/agent/add-reaction`,a),agentRemoveReaction:a=>o("POST",`${i}/agent/remove-reaction`,a),agentPinMessage:a=>o("POST",`${i}/agent/pin-message`,a),agentUnpinMessage:a=>o("POST",`${i}/agent/unpin-message`,a),prepareMessageUploads:a=>o("POST",`${i}/message-uploads/prepare`,a),attachMessageFiles:a=>o("POST",`${i}/message-files/attach`,a),prepareCustomEmoji:a=>o("POST",`${i}/custom-emoji/prepare`,a),renameCustomEmoji:a=>o("POST",`${i}/custom-emoji/rename`,a),sendThreadReply:a=>o("POST",`${i}/thread-reply`,a),sendDm:a=>o("POST",`${i}/dm`,a),dmOwner:a=>o("POST",`${i}/dm-owner`,a),getVaultValues:a=>o("POST",`${i}/vault-values`,a)}}var rT=q(()=>{"use strict";pg();Pt()});function iT(e){if(typeof e!="object"||e===null||Array.isArray(e))return{TAG:"Error",_0:"topic_quiet_auth_file_invalid"};let t=e.topicWakeTurnCapability;if(t===void 0)return{TAG:"Ok",_0:"none"};if(t===null||Array.isArray(t))return{TAG:"Error",_0:"topic_quiet_capability_invalid"};switch(typeof t){case"string":return t.trim()!==""&&Buffer.byteLength(t,"utf8")<=4096?{TAG:"Ok",_0:"available"}:{TAG:"Error",_0:"topic_quiet_capability_invalid"};case"object":let n=t.custody,i=0;if(typeof n=="string"){if(n==="claimed")return{TAG:"Ok",_0:"claimed"};i=1}else i=1;if(i===1){let r=t.custody,o=0;if(typeof r=="string"){if(r==="attempt_pending")return{TAG:"Ok",_0:"attempt_pending"};o=2}else o=2;if(o===2){let a=t.custody,s=0;if(typeof a=="string"){if(a==="attempt_acknowledged")return{TAG:"Ok",_0:"attempt_acknowledged"};s=3}else s=3;if(s===3){let d=t.custody,l=0;if(typeof d=="string"){if(d==="attempt_failed")return{TAG:"Ok",_0:"attempt_failed"};l=4}else l=4;if(l===4)return t.custody==="quiet_acknowledged"?{TAG:"Ok",_0:"quiet_acknowledged"}:{TAG:"Error",_0:"topic_quiet_capability_invalid"}}}}break;default:return{TAG:"Error",_0:"topic_quiet_capability_invalid"}}}function oT(e,t){return e==="quiet_acknowledged"?!0:t?!1:e!=="attempt_pending"&&e!=="attempt_failed"}var aT=q(()=>{});var sT,dT,vc=q(()=>{aT();sT=iT,dT=oT});import{existsSync as sz,closeSync as bpe,fsyncSync as vpe,lstatSync as Spe,mkdirSync as wpe,openSync as kpe,readFileSync as lT,renameSync as xpe,rmSync as Tpe,writeFileSync as Cpe}from"node:fs";import{homedir as dz}from"node:os";import{dirname as Ppe,join as lz}from"node:path";function uT(e){let t=sT(JSON.parse(lT(e,"utf8")));switch(t.TAG){case"Ok":return t._0;case"Error":throw new Error(t._0)}}function uz(){return lz(dz(),".linzumi","auth.json")}function hd(e,t=uz()){if(!sz(t))return;let n=cz(lT(t,"utf8")),i=bc(e),r=n.local_codex_runner?.[i];if(!(r===void 0||r.access_token.trim()==="")&&!(r.expires_at!==void 0&&Date.parse(r.expires_at)<=Date.now()))return{accessToken:r.access_token,kandanBaseUrl:i,issuedAt:r.issued_at,expiresAt:r.expires_at}}function cz(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Kandan auth cache must contain a JSON object");let n=t,i=n.local_codex_runner,r=n.personal_agent_delegation;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error("Kandan auth cache local_codex_runner must be an object");if(r!==void 0&&(typeof r!="object"||r===null||Array.isArray(r)))throw new Error("Kandan auth cache personal_agent_delegation must be an object");return{version:1,local_codex_runner:pz(i),personal_agent_delegation:fz(r)}}function fz(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e.access_token,n=e.issued_at,i=e.expires_at;if(!(typeof t!="string"||typeof n!="string"))return{access_token:t,issued_at:n,expires_at:typeof i=="string"?i:void 0}}function pz(e){if(!(typeof e!="object"||e===null||Array.isArray(e)))return Object.fromEntries(Object.entries(e).flatMap(([t,n])=>{if(typeof n!="object"||n===null||Array.isArray(n))return[];let i=n.access_token,r=n.issued_at,o=n.expires_at;return typeof i!="string"||typeof r!="string"?[]:[[t,{access_token:i,issued_at:r,expires_at:typeof o=="string"?o:void 0}]]}))}var cT=q(()=>{"use strict";pg();vc()});function mg(e,t){return t.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)==null?{TAG:"Error",_0:"progress_provider_turn_id_invalid"}:e!==void 0?e===t?{TAG:"Ok",_0:e}:{TAG:"Error",_0:"progress_provider_turn_rebind_refused"}:{TAG:"Ok",_0:t}}function fT(e,t,n){if(typeof n!="object"||n===null||Array.isArray(n))return{TAG:"Error",_0:"progress_provider_identity_missing"};let i=n.threadId;if(typeof i!="string")return{TAG:"Error",_0:"progress_provider_identity_missing"};let r=n.turnId;return typeof r=="string"?i===e?mg(t,r):{TAG:"Error",_0:"progress_provider_thread_mismatch"}:{TAG:"Error",_0:"progress_provider_identity_missing"}}function pT(e,t){return e>=0&&t>=0&&t<=(65536-e|0)?{TAG:"Ok",_0:e+t|0}:{TAG:"Error",_0:"progress_pre_response_budget_exhausted"}}var mT=q(()=>{});var hT,gT,yT,_T=q(()=>{mT();hT=mg,gT=fT,yT=pT});var hg=q(()=>{ii();Me();nt()});var vT,ST,gg,wT=q(()=>{vT=[["codexThreadId","harness_session_id"],["codex_thread_id","harness_session_id"],["kandanThreadId","thread_id"],["kandan_preview_ticket","linzumi_preview_ticket"],["kandan_thread_id","thread_id"],["linzumiThreadId","thread_id"],["linzumi_thread_id","thread_id"],["local_codex_runner","commander"],["runnerId","commander_id"],["runner_config","commander_config"],["runner_id","commander_id"]],ST=[["commander","local_codex_runner"],["commander_config","runner_config"],["commander_id","runner_id"],["harness_session_id","codex_thread_id"],["linzumi_preview_ticket","kandan_preview_ticket"],["thread_id","kandan_thread_id"]],gg=[["engine_boot_reconnect","harness_boot_reconnect"],["engine_for_runner_event_type","harness_for_commander_event_type"],["engine_rejected_steer","harness_rejected_steer"],["engine_unavailable","harness_unavailable"],["join_engine","join_harness"],["kandan-local-codex-runner","linzumi-commander"],["local_codex_runner","commander"],["original_engine","original_harness"],["resume_engine","resume_harness"]]});function yg(e){let t={};return e.forEach(n=>{t[n[0]]=n[1]}),t}function gz(e){let t={};return e.forEach(n=>{t[n[1]]=n[0]}),t}function kT(e){let t=e.slice();return e.forEach(n=>{let i=yz[n];i!==void 0&&!t.includes(i)&&t.push(i);let r=_z[n];if(r!==void 0&&!t.includes(r)){t.push(r);return}}),t}var yz,_z,Mpe,jpe,_g=q(()=>{wT();yz=yg(vT),_z=yg(ST),Mpe=yg(gg),jpe=gz(gg)});var Npe,Fpe,Dpe,Lpe,bg=q(()=>{Bt();Mu();nt();_g();Npe=kT(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"]),Fpe=new RegExp("^(authorization|cookie|set-cookie|password|login[_-]?url|turnCapability|topicWakeTurnCapability|topic_wake_turn_capability|x-linzumi-agent-turn|mcpAuthFileContents|LINZUMI_CLOUD_MCP_AUTH_JSON)$","i"),Dpe=new RegExp("(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$","i"),Lpe=new RegExp("\\beyJ[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b","g")});var AT=q(()=>{Bt();hg();en();bg()});var ET=q(()=>{AT()});var Tt=q(()=>{Et()});var xa=q(()=>{});var kc=q(()=>{xa();Bt();Me();Jt();Tt()});var Ca=q(()=>{Bt();Jt();Tt();kc()});var xc=q(()=>{Ca()});var OT=q(()=>{});var RT=q(()=>{Et();Ru();nt()});function qa(e){let t=0;for(;;){let n=t,i=e[n];if(i===void 0)return'"'+e+'"';switch(i){case'"':case`
133
- `:return JSON.stringify(e);default:t=n+1|0;continue}}}function Pz(e){return e===""?[]:JSON.parse(e.split('"]["').join('","'))}function Iz(e){return"["+qa(e)+"]"}function Oz(e){let t=e.length;return t!==1?t!==0?e.map(Iz).join(""):"":"["+qa(e[0])+"]"}function Mz(e){return e.type===Yn?!0:e.type===_r?Yn in e.has:!1}function jz(e,t){return(e&t)!==0}function Ec(e){let t=ot[typeof e];if(t&16)return Yn;if(!(t&64))return t&2?'"'+e+'"':t&1024?e+"n":t&4096?"Function":e.toString();if(e===null)return Ia;if(Array.isArray(e)){let r="[";for(let o=0,a=e.length;o<a;++o)o!==0&&(r=r+", "),r=r+Ec(e[o]);return r+"]"}if(e.constructor!==Object)return Object.prototype.toString.call(e);let n=Object.keys(e),i="{ ";for(let r=0,o=n.length;r<o;++r){let a=n[r],s=e[a];i=i+a+": "+Ec(s)+"; "}return i+"}"}function Ot(e){let t=e.type,n=e.to,i=e.const,r=e.name;if(r!==void 0)return r;if(i!==void 0)return Ec(i);let o=e.format,a=e.anyOf;if(a!==void 0)return a.map(Ot).join(" | ");if(o!==void 0){if(o!=="compactColumns")return o;let s=e.additionalItems;if(n===void 0)return s!==void 0&&s!=="strip"&&s!=="strict"?Ot(s)+"[]":"unknown[][]";let d=n.properties;return d===void 0?"unknown[][]":"["+Object.keys(d).map(u=>{let c=d[u];return Ot(c)+"[]"}).join(", ")+"]"}switch(t){case"nan":return"NaN";case"object":let s=e.additionalItems,d=e.properties,l=Object.keys(d);return l.length===0?typeof s===Ft?"{ [key: string]: "+Ot(s)+"; }":"{}":"{ "+l.map(u=>u+": "+Ot(d[u])+";").join(" ")+" }";default:if(e.b)return t;switch(t){case"instance":return e.class.name;case"array":let u=e.additionalItems,c=e.items;if(typeof u!==Ft)return"["+c.map(Ot).join(", ")+"]";let p=Ot(u);return(u.type===_r?"("+p+")":p)+"[]";default:return t}}}function jc(e){if(e&&e.s===Og)return e;throw e}function LT(e){let t=e.path;return(t===""?"":"Failed at "+t+": ")+e.reason}function jt(e,t){let n=new jg;return n.type=e,n.seq=DT++,t&&(zr[Oa]=n,Nn(n,bo,zr)),n}function UT(e){return e}function ji(e,t,n){if(Sg[e])return Sg[e];let i=jt(t,!0);return n(i),Sg[e]=i,i}function $i(e,t){let n=br(e),i=n;for(;i.to;){let r=br(i.to);i.to=r,i=r}return t(i),n}function Jr(e,t){let n=e.g.e,i=n.length;return n[i]=t,"e["+i+"]"}function Cd(e,t){let n=ot[t.type],i=t.const;return n&16?"void 0":n&2?qa(i):n&1024?i+"n":n&28672?Jr(e,t.const):i}function So(e,t){let n='"'+t+'"',i=e[n];if(i!==void 0)return i;let r=qa(t);return e[n]=r,r}function un(){return this.i}function qz(){return this.b.v()}function Nz(){return this.prev.v()}function Tn(e){let t=e.v+1;return e.v=t,"v"+t}function Pc(e,t){e.hd=e.hd===""?t:e.hd+","+t}function Fz(){let e=this,t=Tn(e.g);return e.cp="let "+t+"="+e.i+";",e.i=t,e.v=un,t}function Ag(){let e=this,t=e.p;if(t.fz)return e.v=un,e.i;let n=Tn(e.g);return Pc(t,n+"="+e.i),e.v=un,e.i=n,n}function Ic(){let e=this;if(e.fz)return e.v=un,e.i="("+e.i+")",e.i;let t=Tn(e.g);if(e.prev!==void 0){let i=e.i;i===""?e.cp="let "+t+";"+e.cp:e.cp=e.cp+("let "+t+"="+i+";")}else{let i=e.i;i===""?Pc(e,t):Pc(e,t+"="+i)}return e.v=un,e.i=t,t}function Dz(e,t,n,i){return{v:un,i:"i",s:e,e:t,f:0,cp:"",hd:"",path:"",g:{v:-1,o:n,e:[],d:i}}}function ko(e,t,n){let i=e.path,r="Can't decode "+Ot(t)+" to "+Ot(n)+". Use S.to to define a custom decoder",o={code:"unsupported_decode",path:i,reason:r,from:t,to:n};throw new vo(o)}function bd(e,t,n){return Jr(e,i=>{let r=t(i);throw new vo(r)})+"("+n+")"}function GT(e,t,n,i,r,o,a){let s=a!==void 0?a:"Expected "+Ot(e)+", received "+(r?Ec(i):Ot(t));if(o!==void 0){let l={};for(let u=0,c=o.length;u<c;++u){let p=o[u],f=p.reason.split(`
134
- `).join(`
135
- `),h=p.path,_=`
136
- - `+(h===""?"":"At "+h+": ")+f;l[_]||(l[_]=1,s=s+_)}}let d={code:"invalid_input",path:n,reason:s,expected:e,received:t,unionErrors:o};return r&&(d.input=i),d}function Ng(e,t,n,i){return r=>{let o=t!==void 0?t:"",a=i!==void 0?i:!0,s=e!==void 0?e:r.e,d=r.prev,l=d!==void 0?d.s:r.s,u=o===""?r.path:r.path+o;return c=>GT(s,l,u,c,a,void 0,n)}}function Ht(e){let t=e.e.errorMessage,n;if(t!==void 0){let i=t.type;n=i!==void 0?i:t._}else n=void 0;return Ng(void 0,void 0,n,void 0)(e)}function zT(e,t){let n=t!==void 0?t:e.e;return bd(e,Ng(n,void 0,void 0,void 0)(e),e.v())}function Lz(e,t){let n=e.vc,i=n.length;if(i===1){let a=n[0];return a.c(t)+"||"+bd(e,a.f(e),t)+";"}let r="",o=0;for(;o<i;){let a=n[o],s=a.f,d=a.c(t);for(o=o+1|0;o<i&&n[o].f===s;)d=d+"&&"+n[o].c(t),o=o+1|0;r=r+(d+"||"+bd(e,s(e),t)+";")}return r}function JT(e){return e.t===!0?e.prev.t!==!0?e.cp==="":!1:!0}function Kr(e,t){let n=e,i="";for(;n!==void 0;){let r=n;n=r.prev;let o="";if(r.vc)if(t!==void 0&&JT(r)){let s=n.v(),d=r.vc,l="";for(let u=0,c=d.length;u<c;++u){let p=d[u],f=p.c(s);p.f===Ht?l=l?l+"&&"+f:f:r.e.noValidation!==!0&&(o=o+(f+"||"+bd(r,p.f(r),s)+";"))}l&&(t.contents?t.contents=l+"&&"+t.contents:t.contents=l)}else r.e.noValidation!==!0&&(o=Lz(r,n.v()));r.hd!==""&&(o=o+("let "+r.hd+";")),r.fz=!0,o=r.cp+o,i=o+i}return i}function Xn(e,t,n,i){let r=i!==void 0?i:e.e;return{v:Ic,i:t,s:n,e:r,prev:e,f:0,d:e.d,cp:"",hd:"",t:!0,path:e.path,g:e.g}}function qe(e,t,n,i){let r=t!==void 0?t:e.s,o=i!==void 0?i:e.e,a=e.v!==un,s={v:a?Nz:un,i:e.i,s:r,e:o,prev:e,f:e.f,d:e.d,cp:"",hd:"",vc:n,t:e.t,path:e.path,g:e.g};if(a){let d=e.v.bind(e);e.v=()=>{let l=d();return s.i=l,s.v=un,l}}return s}function Fg(e,t){let n=e.vc;n!==void 0?n.push(t):e.vc=[t]}function vd(e,t){let n=t.e.inputRefiner,i;if(n!==void 0){let s=n(t);if(s.length!==0)if(t.prev!==void 0){for(let l=0,u=s.length;l<u;++l)Fg(t,s[l]);i=void 0}else i=s;else i=void 0}else i=void 0;let r=e.e.refiner,o;if(r!==void 0){let s=r(e);o=s.length!==0?s:void 0}else o=void 0;let a=i!==void 0?o!==void 0?qe(e,void 0,i.concat(o),void 0):qe(e,void 0,i,void 0):o!==void 0?qe(e,void 0,o,void 0):e;return a.io=!0,a}function KT(e,t,n){if(!t.vc)return;let r="["+So(e.g,n)+"]";t.vc.forEach(o=>Fg(e,{c:a=>o.c(a+r),f:o.f})),t.vc=void 0}function BT(e,t){let n=e.s.additionalItems,i;i=n!==void 0&&n!=="strip"&&n!=="strict"?n:it;let r=e.e.additionalItems,o;return o=r!==void 0&&r!=="strip"&&r!=="strict"?r:it,{p:e,v:Fz,i:e.v()+"["+t+"]",s:i,e:o,f:e.f,cp:"",hd:"",path:"",g:e.g}}function Oi(e,t,n){return Xn(e,Cd(e,t),t,n)}function WT(e,t){let n=Xn(e,t,e.s,void 0);return n.f=1,n}function Br(e,t,n){e.s.type===fi?e.s.items.push(n.s):(n.o||e.s.required.push(t),e.s.properties[t]=n.s),n.f&1&&n.v(),e.cp=e.cp+Kr(n,void 0),e.d[t]=n}function HT(e,t,n){return e.v()+"["+t+"]="+n.i}function pi(e){let t=e.v!==un,n={b:e,v:t?qz:un,i:e.i,s:e.s,io:e.io,e:e.e,f:0,d:e.d,cp:"",hd:"",u:!1,t:!1,path:e.path,g:e.g};if(t){let i=e.v.bind(e);e.v=()=>{let r=i();return n.i=r,n.v=un,r}}return n}function Uz(e,t){throw new vo({code:"invalid_operation",path:e.path,reason:t})}function Dg(e,t,n,i){if(e.path===""&&n===void 0)return Kr(e,void 0);{let r=d=>{let l=t.path,u=l===""?"":qa(l)+"+";return d+".path="+u+(n!==void 0?`'["'+`+n+`+'"]'+`:"")+d+".path"},o=Kr(e,void 0);if(o===""&&!(e.f&1))return o+(i!==void 0?i():"");let a=Tn(e.g),s=r(a)+";throw "+a;return e.f&1&&(e.i=e.i+".catch("+a+"=>{"+s+"})"),"try{"+o+(i!==void 0?i():"")+"}catch("+a+"){"+s+"}"}}function VT(e){return e}function wg(e){return e+"<=2147483647&&"+e+">=-2147483648&&"+e+"%1===0"}function Ra(e){return t=>"typeof "+t+'==="'+e+'"'}function Ea(e){return"Number.isNaN("+e+")"}function Oc(e){return"Array.isArray("+e+")"}function ZT(e){return Ra(Ft)(e)+"&&"+e}function Gz(e,t){return n=>n+" instanceof "+Jr(e,t)}function zz(e){let t=ot[e.s.type];if(t&1){let r=[{c:Ra(Ri),f:Ht}],o=e.e.format,a=0;return o==="int32"?r.push({c:wg,f:Ht}):a=1,a===1&&(e.g.o&2||r.push({c:s=>"!"+Ea(s),f:Ht})),qe(e,e.e,r,void 0)}if(!(t&2))return t&4?e.s.format!==e.e.format&&e.e.format==="int32"?qe(e,e.e,[{c:wg,f:Ht}],void 0):e:ko(e,e.s,e.e);let n=Tn(e.g),i=Xn(e,n,e.e,void 0);return i.v=un,i.cp="let "+n+"=+"+e.v()+";",i.vc=[{c:r=>{let o=e.e.format;return o!==void 0&&o==="int32"?wg(n):"!"+Ea(n)},f:Ht}],i}function Lg(){return ji(Ri,Ri,e=>{e.decoder=zz})}function Jz(e){return Xn(e,'""+'+e.i,Na(),void 0)}function Kz(e){let t=ot[e.s.type];if(t&1)return qe(e,e.e,[{c:Ra(Pa),f:Ht}],void 0);if(!(t&3132&&Wr in e.s))return t&1036?Jz(e):t&2?e:ko(e,e.s,e.e);let n=""+e.s.const,i=jt(Pa,!1);return i.const=n,Xn(e,'"'+n+'"',i,void 0)}function Na(){return ji(Pa,Pa,e=>{e.decoder=Kz})}function Bz(e){let t=ot[e.s.type];if(t&1)return qe(e,e.e,[{c:Ra(Ac),f:Ht}],void 0);if(!(t&2))return t&8?e:ko(e,e.s,e.e);let n=Tn(e.g),i=Xn(e,n,e.e,void 0);i.v=un;let r=e.v();return i.cp="let "+n+";("+i.i+"="+r+'==="true")||'+r+'==="false"||'+zT(e,void 0)+";",i}function QT(){return ji(Ac,Ac,e=>{e.decoder=Bz})}function YT(e,t){e[ot[t]&768?xd:t]=!0}function $a(e){let t=e.e;if(t.noValidation&&!e.u)return Oi(e,t,void 0);if(Wr in e.s)return e.s.const===t.const?e:Oi(e,t,void 0);let n=ot[t.type];if(!(ot[e.s.type]&2&&n&3132))return n&2048?qe(e,t,[{c:Ea,f:Ht}],void 0):qe(e,t,[{c:o=>o+"==="+Cd(e,t),f:Ht}],void 0);let i=jt(Pa,!1);i.const=""+t.const;let r=Oi(e,i,i);return r.vc=[{c:o=>o+'==="'+i.const+'"',f:Ht}],Oi(r,t,t)}function qi(){return ji(Yn,Yn,e=>{e.const=void 0,e.decoder=$a})}function Ad(){return ji(Ia,Ia,e=>{e.const=null,e.decoder=$a})}function XT(){return ji(xg,xg,e=>{e.const=NaN,e.decoder=$a})}function Ug(e){if(e===null)return Ad();let t=typeof e;if(t===Yn)return qi();if(t===Ri&&Number.isNaN(e))return XT();if(t===Ft){let i=jt($g,!0);return i.class=e.constructor,i.const=e,i.decoder=$a,i}let n=jt(t,!0);return n.const=e,n.decoder=$a,n}function kt(e){let t=e,n,i=0;for(;!t.io||t.e.to;){let r=n;n=void 0;let o=t;if(i=i+1|0,i>50)throw new Error("Loop count exceeded 100");if(o.e.$defs&&(o.g.d?Object.assign(o.g.d,o.e.$defs):o.g.d=o.e.$defs),o.f&1){let a=o.v(),s=pi(o),d=kt(s),l=Kr(d,void 0);t=s.i!==d.i||l!==""?Xn(o,a+".then("+a+"=>{"+l+"return "+d.i+"})",d.s,d.e):qe(o,d.s,void 0,d.e),t.f=t.f|1,t.io=!0}else if(o.io){let a=o.e.to,d=o.e.parser;t=d!==void 0?d(o):qe(t,void 0,void 0,a)}else{let a=o.s.encoder;a&&a!==r&&o.s!==o.e&&o.e.type!==xd&&(t=a(o,o.e)),o!==t?n=a:(t=o.e.decoder(o),t.io||(t=vd(t,t)))}}return t}function Mi(e){for(;;){let t=e,n=t.to;if(n===void 0)return t;e=n}}function ci(e){if(bo in e)return e[bo];let t,n=e;for(;n;){let r=br(n),o=r.to,a=t;a!==void 0?r.to=a:delete r.to;let s=r.parser,d=r.serializer;d!==void 0?r.parser=d:delete r.parser,s!==void 0?r.serializer=s:delete r.serializer;let l=r.refiner,u=r.inputRefiner;u!==void 0?r.refiner=u:delete r.refiner,l!==void 0?r.inputRefiner=l:delete r.inputRefiner;let c=r.fromDefault,p=r.default;p!==void 0?r.fromDefault=p:delete r.fromDefault,c!==void 0?r.default=c:delete r.default;let f=r.items;f!==void 0&&(r.items=f.map(ci));let h=r.properties;if(h!==void 0){let y={},b=Object.keys(h);for(let v=0,w=b.length;v<w;++v){let A=b[v];y[A]=ci(h[A])}r.properties=y}typeof r.additionalItems===Ft&&(r.additionalItems=ci(r.additionalItems));let g=r.anyOf;if(g!==void 0){let y={},b=[];for(let v=0,w=g.length;v<w;++v){let A=g[v],C=ci(A);b.push(C),YT(y,C.type)}r.has=y,r.anyOf=b}let _=r.$defs;if(_!==void 0){let y={};for(let b=0,v=Object.keys(_).length;b<v;++b){let w=Object.keys(_)[b];y[w]=ci(_[w])}r.$defs=y}t=r,n=o}let i=t;return zr[Oa]=i,Nn(e,bo,zr),zr[Oa]=e,Nn(i,bo,zr),i}function eC(e){try{return kt(e)}catch(t){let n=jc(t),i=e.p;throw n.path=(i!==void 0?i.path:"")+(e.path+"[]"+n.path),n}}function tC(e,t,n,i){let r=Dz(Wr in e?it:e,t,n,i),o=kt(r),a=Kr(o,void 0),s=jz(o.f,1);t.isAsync=s;let d=o.t===!0;if(t.hasTransform=d,a===""&&(o===r||o.i===r.i)&&!(n&1))return VT;let l=o.i;n&1&&!s&&!i&&(l="Promise.resolve("+l+")");let u="i=>{"+a+"return "+l+"}",c=r.g.e,p=new Function("e","s","return "+u)(c,Og);return p.embedded=r.g.e,p}function Rc(e,t){let n=arguments,i=0,r,o="",a=0,s;for(;r===void 0;){let l=n[i];if(l)if(typeof l===Ri){let u=l|_d.f;r=u,o=o+"-"+u}else{let u=l.seq;u>a&&(a=u,s=l),o=o+u+"-",i=i+1|0}else{let u=_d.f;r=u,o=o+"-"+u}}let d=s;if(d!==void 0){let l=o;if(l in d)return d[l];let u=n[i-1|0];for(let p=i-2|0;p>=0;--p){let f=u;u=$i(n[p],h=>{h.to=f})}let c=tC(u,u,r,0);return zr[Oa]=c,Nn(d,l,zr),c}throw new Error("[Sury] No schema provided for decoder.")}function Wz(e){let t=qe(e,void 0,void 0,Gg());return t.cp=zT(e,void 0)+";",t}function Gg(){return ji(Tg,Tg,e=>{e.decoder=Wz})}function Hz(e){let t=e.e.to;return Xn(e,"{"+wo+":"+Mi(e.e).properties[wo].const+"}",t,t)}function Ma(e,t){return{v:Ic,i:"",s:t.type===fi?{type:fi,decoder:Pd,additionalItems:"strict",items:[]}:{type:Ft,decoder:Fa,additionalItems:"strict",required:[],properties:{}},e:e.e,prev:e,f:0,d:{},cp:"",hd:"",t:!0,path:e.path,g:e.g}}function zg(e){return qc(e,qi())}function Fa(e){let t=e.u,n=e.e,i=ot[e.s.type],r;if(i&65){let u=i&64,c;if(u)c=e.s;else{let f=jt(Ft,!1);f.properties=Pg,f.additionalItems=it,c=f}let p=[];u||(p.push({c:ZT,f:Ht}),n.additionalItems!=="strip"&&p.push({c:f=>"!"+Oc(f),f:Ht})),r=p.length!==0?qe(e,c,p,void 0):qe(e,c,void 0,void 0)}else r=ko(e,e.s,n);let o=n.additionalItems,a;a=o==="strip"||o==="strict"?void 0:o;let s=r.s.additionalItems,d;d=s!=="strip"&&s!=="strict";let l;if(a!==void 0)if(a===it)l=r;else if(d){let u=r.v(),c=Tn(r.g),p=BT(r,c),f=eC(p),h=f.t,g=h?Xn(r,"{}",n,void 0):qe(r,n,void 0,void 0),_=Dg(f,r,c,h?()=>HT(g,c,f):void 0);if((h||_!=="")&&(g.cp=g.cp+("for(let "+c+" in "+u+"){"+_+"}")),f.f&1){let y=Tn(g.g),b=Tn(g.g),v=Tn(g.g),w=Tn(g.g),A=g.v();l=WT(g,"new Promise(("+y+","+b+")=>{let "+w+"=Object.keys("+A+").length;for(let "+c+" in "+A+"){"+A+"["+c+"].then("+v+"=>{"+A+"["+c+"]="+v+";if("+w+"--===1){"+y+"("+A+")}},"+b+")}})")}else l=g}else{let u=Ma(r,n),c=Object.keys(r.s.properties);for(let p=0,f=c.length;p<f;++p){let h=c[p],g=Sd(r,h);g.e=a,g.io=!1,g.u=t,Br(u,h,kt(g))}l=ja(u)}else{let u=n.properties,c=Object.keys(u),p=c.length,f=Ma(r,n),h=n.additionalItems,g;g=h==="strip"||h==="strict"?h==="strip"?d||Object.keys(r.s.properties).length!==p:!1:!0;let _=r.s.additionalItems,y;y=_==="strip"||_==="strict"?!1:_.name===_o;for(let v=0;v<p;++v){let w=c[v],A=u[w],C=Sd(r,w);C.e=A,C.io=!1,C.u=t,y&&A.type===_r&&A.has[Yn]&&(C.i="("+C.i+"??null)");let S=kt(C);t&&Wr in A&&KT(r,S,w),Br(f,w,S),g||(g=S.t)}let b=!1;if(n.additionalItems==="strict"){let v=r.s.additionalItems,w;w=v!=="strip"&&v!=="strict",b=w}if(b){let v=Tn(f.g);if(Pc(r,v),f.cp=f.cp+("for("+v+" in "+r.v()+"){if("),c.length!==0)for(let w=0,A=c.length;w<A;++w){let C=c[w];w!==0&&(f.cp=f.cp+"&&"),f.cp=f.cp+(v+"!=="+So(r.g,C))}else f.cp=f.cp+"true";f.cp=f.cp+("){"+bd(r,w=>({code:"unrecognized_keys",path:f.path,reason:'Unrecognized key "'+w+'"',keys:[w]}),v)+"}}")}if(g)l=ja(f);else{let v=qe(r,void 0,void 0,void 0);v.cp=f.cp,v.d=f.d,l=v}}return vd(l,r)}function Vz(){let e=Ug(0),t={};return t[wo]=e,{type:Ft,serializer:n=>{let i=n.e.to;return Oi(n,i,i)},decoder:Fa,additionalItems:"strip",required:[wo],properties:t}}function Pd(e){let t=e.u,n=e.e,i=ot[e.s.type],r=n.items,o=r.length,a;if(i&129){let u=i&128,c=u?e.s:Id(it),p=[];u||p.push({c:Oc,f:Ht});let f=c.additionalItems,h;if(h=f==="strip"||f==="strict"?c.items.length===o:!1,!h){let g=n.additionalItems;(g==="strip"||g==="strict")&&(g==="strip"?p.push({c:_=>_+".length>="+o,f:Ht}):p.push({c:_=>_+".length==="+o,f:Ht}))}a=p.length!==0?qe(e,c,p,void 0):qe(e,c,void 0,void 0)}else a=ko(e,e.s,n);let s=n.additionalItems,d,l=0;if(s==="strip"||s==="strict")l=1;else if(s===it)d=a;else{let u=a.v(),c=Tn(a.g),p=BT(a,c),f=eC(p),h=f.t,g=h?Xn(a,"new Array("+u+".length)",n,void 0):qe(a,n,void 0,void 0),_=Dg(f,a,c,h?()=>HT(g,c,f):void 0);(h||_!=="")&&(g.cp=g.cp+("for(let "+c+"="+o+";"+c+"<"+u+".length;++"+c+"){"+_+"}")),d=f.f&1?WT(g,"Promise.all("+g.i+")"):g}if(l===1){let u=Ma(a,n),c=n.additionalItems,p;if(c==="strip"||c==="strict")if(c==="strip"){let f=a.s.additionalItems;p=f==="strip"||f==="strict"?a.s.items.length!==o:!0}else p=!1;else p=!0;for(let f=0;f<o;++f){let h=r[f],g=f.toString(),_=Sd(a,g);_.e=h,_.io=!1,_.u=t;let y=kt(_);t&&Wr in h&&KT(a,y,g),Br(u,g,y),p||(p=y.t)}if(p)d=ja(u);else{let f=qe(a,void 0,void 0,void 0);f.cp=u.cp,f.d=u.d,d=f}}return vd(d,a)}function Zz(e,t){let n=e.s.anyOf;return t.type===_r&&oC(t)===void 0&&rC(t.anyOf,n)||!Qz(n,t)?e:iC(e,t)}function nC(e){let t=e.e,n=t.anyOf,i=ot[e.s.type],r=oC(t);if(e.s===t&&r===void 0&&n.every(Tc)||i&256&&rC(n,e.s.anyOf)&&r===void 0||e.io&&e.e===e.s)return e;(i&256||e.s.encoder===void 0&&i&512)&&(e.s=it);let o="";if(!(i&769)){let M=kg(e.s),J=!1,Z=!1,z=n.length,X=0;for(;o===""&&X<z;){let ee=n[X];kg(ee)===M?o=M:ee.type===Ia?J=!0:ee.type===Yn&&(Z=!0),X=X+1|0}o===""&&(i&16&&J?o=Ia:i&32&&Z&&(o=Yn))}let a=o,s=e.i,d=M=>Jr(e,function(){let J=arguments,Z=GT(t,it,e.path,J[0],!0,J.length>1?Array.from(J).slice(1):void 0,void 0);throw new vo(Z)})+"("+e.v()+M+")",l=qe(e,void 0,void 0,void 0),u=[],c={contents:""},p=(M,J)=>{let Z=M[0],z=M[1],X="",ee="",B=!1,$={contents:""},K="",F={},x=2,I=M.length-1|0;for(;x<=I;){let N=pi(z);N.u=!0,N.t=z.t,N.io=!1,N.e=M[x];let W=x===I,re=x===2,me=re&&W,be=!me,Ce=!1,j="",L={contents:""};try{let se=kt(N);if(u.push(se.s),j=Kr(se,L),se.t){l.t=!0,se.f&1&&(l.f=l.f|1);let Se=Z.v();se.i!==Se&&(j=j+(Se+"="+se.i))}}catch(se){let Se=Jr(N,jc(se));K=K+","+Se,J&&me?(c.contents=Se,Ce=!0):W?(be=!1,j=J?"throw "+Se:d(K)):Ce=!0}let H=L.contents,ie=j;if(!Ce&&H)if(ie){let se=F[H];se!==void 0?typeof se=="string"?F[H]=[se,ie]:se.push(ie):F[H]=ie}else $.contents=$.contents?$.contents+"||"+H:H;if(!Ce&&(!H||W)){let se=Object.keys(F);for(let Se=0,At=se.length;Se<At;++Se){let sn=se[Se];X=X+(B?"else if":"if")+("("+sn+"){");let vt=F[sn];if(typeof vt=="string")X=X+vt+"}";else{let ut="";for(let wn=0,Qt=vt.length;wn<Qt;++wn){let io=vt[wn],Fr="e"+wn;X=X+("try{"+io+"}catch("+Fr+"){"),ut=ut+","+Fr}X=X+d(ut)+"}".repeat(vt.length)+"}"}B=!0}F={}}if(!Ce&&!H)if(ie)if($.contents&&(X=X+(B?"else if":"if")+("(!("+$.contents+")){"),ee="}"+ee,$.contents="",B=!1),W&&(J||!be||re))X=X+((B?"else{":"")+ie),ee=(B?"}":"")+ee;else{let se="e"+(x-2|0);X=X+((B?"else{":"")+"try{"+ie+"}catch("+se+"){"),ee=(B?"}":"")+"}"+ee,K=K+","+se,B=!1}else $.contents="",x=I,be=!1;if(W){if($.contents)X||K?X=X+(B?"else if":"if")+("(!("+$.contents+")){"+d(K)+"}"):Fg(z,{c:se=>"("+$.contents+")",f:Ht});else if(be){let se=d(K);X=X+(B?"else{"+se+"}":se)}}x=x+1}return X+ee},f="",h="",g="",_=!1,y=n.length-1|0,b={},v=[],w=t.refiner,A=t.inputRefiner,C={contents:void 0},S={contents:void 0},k=(M,J,Z)=>{if(J===void 0)return M;let z=X=>{let ee=Z.contents;if(ee!==void 0)return ee;let B=J(X);return Z.contents=B,B};return M!==void 0?X=>{let ee=M(X),B=z(X);for(let $=0,K=B.length;$<K;++$)ee.push(B[$]);return ee}:z},T=M=>{let J=k(M.refiner,w,C);J!==void 0&&(M.refiner=J);let Z=k(M.inputRefiner,A,S);if(Z!==void 0){M.inputRefiner=Z;return}},E;if(Wr in e.s){let M=[],J=[];for(let Z=0;Z<=y;++Z){let z=n[Z];Wr in z&&z.const===e.s.const?M.push(z):J.push(z)}E=M.concat(J)}else E=n;for(let M=0;M<=y;++M){let J=r!==void 0?$i(E[M],ee=>{T(ee),ee.to=r}):E[M],Z=J.type,z=ot[Z],X=kg(J);if((a===""||a===X)&&!(z&16&&"fromDefault"in t)){let ee=b[X];if(ee!==void 0)z&64&&wo in J.properties?ee.splice(ee.length-1|0,0,J):z&2096||ee.push(J);else{let B=pi(e),$;if(z&37633)$=it;else{let I=jt(J.type,!1);I.encoder=J.encoder,z&8192?I.class=J.class:z&64?(I.properties=Pg,I.additionalItems=it):z&128?(I.additionalItems=it,I.items=Mc):z&2096&&(I.const=J.const),I.decoder=N=>ot[N.s.type]&1?qe(N,N.e,[{c:W=>{let re=ot[J.type];if(re&64)return ZT(W)+"&&!"+Oc(W);if(re&128)return Oc(W);if(re&8192)return Gz(N,J.class)(W);if(!(re&4))return re&2048?Ea(W):re&48?W+"==="+Cd(N,J):re&17418?Ra(J.type)(W):"";let me=Ra(Ri)(W);return N.g.o&2?me:me+"&&!"+Ea(W)},f:Ht}],void 0):J.decoder(N),$=I}B.e=$;let K;try{K=kt(B)}catch{B.vc=void 0,K=B}MT(z,b)?v.unshift(X):v.push(X),b[X]=[B,K,J];let F=!0,x=K;for(;x!==void 0&&F;){let I=x;x=I.prev,F=!(I.vc&&JT(I))}if(F){for(let I=0,N=v.length;I<N;++I){let W=v[I];if(!_){let re=b[W],me=re[1],be=p(re,!0),Ce=Kr(me,void 0)+be,j=c.contents;if(j)if(c.contents="",Ce){let L="e"+(M+I|0);f=f+("try{"+Ce+"throw "+j+"}catch("+L+"){"),h="}"+h,g=g+","+L}else g=g+","+j;else if(Ce){let L="e"+(M+I|0);f=f+("try{"+Ce+"}catch("+L+"){"),h="}"+h,g=g+","+L}else _=!0}}b={},v=[]}}}}let P=b,R=v;if(!_){let M=!1,J="";for(let X=0,ee=R.length;X<ee;++X){let B=P[R[X]],$=B[1],K=B[2],F=p(B,!1),x={contents:""},I=Kr($,x)+F,N=x.contents;I||MT(ot[K.type],P)?(f=f+(M?"else if":"if")+("("+N+"){"+I+"}"),M=!0):J=J?J+"||"+N:N}let Z=d(g),z;J?z=(M?"else if":"if")+("(!("+J+")){"+Z+"}"):z=M?"else{"+Z+"}":h===""?Z+";":Z,f=f+z}l.cp=l.cp+f+h,e.i!==l.i&&(l.i=e.i);let O=l.f&1?(l.i="Promise.resolve("+l.i+")",l.v=Ic,l):l.v===un&&e.cp===""&&l.cp===""&&s==="i"?(e.hd="",e.v=Ic,e.i=s,e):l;return O.s=u.length?mi(u):Gg(),O.e=r!==void 0?(O.io=!0,Mi(r)):t,O}function rC(e,t){return t.every((n,i)=>{let r=e[i];return r!==void 0&&!(ot[n.type]&9152)&&n.type===r.type&&n.const===r.const?n.to===void 0:!1})}function iC(e,t){return qe(e,it,void 0,$i(e.s,n=>{n.to=t}))}function Qz(e,t){return!(ot[Mi(t).type]&512)&&!(t.type===_r&&t.anyOf.some(n=>ot[n.type]&512))?!e.some(n=>n.to!==void 0||n.parser!==void 0?!0:ot[n.type]&512):!1}function oC(e){if(e.parser!==void 0)return;let n=e.to;if(n!==void 0)return n}function Sd(e,t){let n=e.d,i;if(n!==void 0)i=n;else{let u={};e.d=u,i=u}let r=i[t];if(r!==void 0)return pi(r);let o=e.s.type===Ft?e.s.properties[t]:e.s.items[t],a;if(o!==void 0)a=o;else{let u=e.s.additionalItems;a=u==="strip"||u==="strict"?ko(e,e.s,e.e):e.s.type===Ft&&u.type!==xd&&!(ot[u.type]&512)&&!Mz(u)?zg(u):u}let d="["+So(e.g,t)+"]",l={p:e,v:Ag,i:Wr in a?Cd(e,a):e.v()+d,s:a,e:a,f:0,cp:"",hd:"",path:e.path+d,g:e.g};return i[t]=l,l}function ja(e){let t=e.s.type===fi,n="",i="",r,o=Object.keys(e.d);for(let l=0,u=o.length;l<u;++l){let c=o[l],p=e.d[c];if(p.f&1&&(i=i+p.i+","),p.o){let f=r;r=h=>(f!==void 0?f(h):"")+("if("+p.v()+"!==void 0){"+h+"["+So(e.g,c)+"]="+p.i+"}")}else n=n+(t?p.i:So(e.g,c)+":"+p.i)+","}if(e.i=t?"["+n+"]":"{"+n+"}",i){let l=pi(e);l.io=!0;let u=kt(l),c=Kr(u,void 0);return c===""&&i===u.i+","?e.i=u.i:e.i="Promise.all(["+i+"]).then((["+i+"])=>{"+c+"return "+u.i+"})",e.f=e.f|1,e.s=u.s,e.e=u.e,e.io=!0,e}let a=r;if(a===void 0)return e;let s=a(e.v()),d=qe(e,void 0,void 0,void 0);return d.cp=d.cp+s,d}function mi(e){let t=e.length;if(t===1)return e[0];if(t!==0){let n={},i=new Set;for(let o=0,a=e.length;o<a;++o){let s=e[o];s.type===_r&&s.to===void 0?(s.anyOf.forEach(d=>{i.add(d)}),Object.assign(n,s.has)):(i.add(s),YT(n,s.type))}let r=jt(_r,!1);return r.anyOf=Array.from(i),r.decoder=nC,r.encoder=Zz,r.has=n,r}throw new Error("[Sury] S.union requires at least one item")}function MT(e,t){return e&8320&&Ft in t?!0:e&2048?Ri in t:!1}function kg(e){return ot[e.type]&8192?e.class.name:e.type}function Tc(e){for(;;){let t=e,n=!1,i=!1,r=!1;if(t.to===void 0&&t.parser===void 0&&!(ot[t.type]&512)){let a=t.anyOf;r=a!==void 0?a.every(Tc):!0}if(r){let a=t.items;i=a!==void 0?a.every(Tc):!0}if(i){let a=t.properties;n=a!==void 0?Object.values(a).every(Tc):!0}if(!n)return!1;let o=t.additionalItems;if(o===void 0||o==="strip"||o==="strict")return!0;e=o}}function Id(e){let t=jt(fi,e[bo]===e);return t.additionalItems=e,t.items=Mc,t.decoder=Pd,t}function qc(e,t){let n=t!==void 0?t:qi(),i=Mi(e);switch(i.type){case"undefined":return mi([n,jT(e)]);case"union":let o=i.has,a=i.anyOf;return $i(e,s=>{let d=Ez(o),l=[];for(let u=0,c=a.length;u<c;++u){let p=a[u],f=Mi(p),h=f.type,g;if(h==="undefined")d[n.type]=!0,l.push(n),g=jT(p);else{let _=f.properties;if(_!==void 0){let y=_[wo];g=y!==void 0?$i(p,b=>{let v={},w={...y};w.const=y.const+1,v[wo]=w,b.properties=v}):p}else g=p}l.push(g)}l.length===a.length&&(d[n.type]=!0,l.push(n)),s.anyOf=l,s.has=d});default:return mi([e,n])}}function jT(e){return $i(e,t=>{t.to=Vz(),t.parser=Hz})}function Nc(e){let t=jt(Ft,e[bo]===e);return t.properties=Pg,t.additionalItems=e,t.decoder=Fa,t}function qT(e){let t=e.e,n=t.$ref,i=e.g.d,r=n.slice(8),o=i[r],a=e.g.o,s=e.s.seq===t.seq?o:e.s,d=s.seq+"-"+o.seq+"--"+a,l="",u=o[d];if(u!==void 0){let g=Ve(u);l=g===0?Jr(e,o)+('["'+d+'"]'):Jr(e,g)}else{let g=Ke(o.hasTransform,!1),_=Ke(o.isAsync,!1),y=!0,b=0;for(;y;){y=!1,o.hasTransform===void 0&&(o.hasTransform=g),o.isAsync===void 0&&(o.isAsync=_),$T[Oa]=0,Nn(o,d,$T);let v=tC(s,o,a,i);zr[Oa]=v,Nn(o,d,zr),b=v;let w=o.hasTransform,A=o.isAsync;(w!==g||A!==_)&&(g=w,_=A,delete o[d],y=!0)}l=Jr(e,b)}let c=o.hasTransform===!0,p=o.isAsync,f="",h;if(c||p){let g=Tn(e.g);f="let "+g+";";let _=Xn(e,g,t,t);_.v=un,_.cp=g+"="+l+"("+e.i+");",p&&(_.f=_.f|1),h=_}else{let g=qe(e,t,void 0,t);g.cp=l+"("+e.i+");",h=g}return h.prev=void 0,h.cp=f+Dg(h,e,void 0,void 0),h.fz=void 0,h.prev=e,h}function aC(e,t){return Rc(it,t)(e)}function Xz(e,t){return $i(e,n=>{let i=t(n),r=n.refiner;r!==void 0?n.refiner=o=>{let a=r(o),s=i(o);for(let d=0,l=s.length;d<l;++d)a.push(s[d]);return a}:n.refiner=i})}function sC(e,t,n,i){let r=n!==void 0?n:"Refinement failed",o=i!==void 0?Oz(i):"";return Xz(e,a=>(s=>{let d=Jr(s,t);return[{c:l=>d+"("+l+")",f:Ng(void 0,o,r,void 0)}]}))}function Jg(){let e=br(Ad());return e.to=qi(),e}function dC(e,t){return $i(e,n=>{let i=n.anyOf;if(i!==void 0){let o=[],a=[];for(let p=0,f=i.length;p<f;++p){let h=i[p],g=Mi(h);g.type!=="undefined"&&(o.push(g),a.push(h))}let s=o.length,d;if(s!==1)if(s!==0)d=mi(o);else{let p="Can't set default for "+Ot(n);throw new Error("[Sury] "+p)}else d=o[0];let l=a.length!==1?mi(a):a[0];if(t.TAG==="Value"){let p=t._0;try{Rc(it,d)(p)}catch(f){let h=jc(f),g="Invalid default for "+Ot(n)+": "+h.message;throw new Error("[Sury] "+g)}try{n.default=Rc(ci(l),void 0)(p)}catch{}}n.parser=p=>{let f=p.e.to,h=p.v(),g;return g=t.TAG==="Value"?Cd(p,Ug(t._0)):Jr(p,t._0)+"()",Xn(p,h+"===void 0?"+g+":"+h,f,f)};let u=br(d),c=u.decoder;u.serializer=p=>{let f=ci(l);return qe(c(p),f,void 0,f)},u.decoder=UT,n.to=u;return}let r="Can't set default for "+Ot(n);throw new Error("[Sury] "+r)})}function Eg(e,t){let n=ot[t.type];if(n&46)return kt(qe(e,it,void 0,t));if(n&2064){let r=br(Ad());return r.to=t,kt(qe(e,it,void 0,r))}if(n&128){let r=Id(it),o=kt(qe(e,it,void 0,r));return o.s.additionalItems=xn(),o.e=t,o.io=!1,o}if(n&64){let r=Nc(it),o=kt(qe(e,it,void 0,r));return o.s.additionalItems=xn(),o.e=t,o.io=!1,o}if(n&768)return e;let i=br(Na());return i.to=t,kt(qe(e,it,void 0,i))}function Aa(e){let t=ot[e.type],n=!0;if(!(t&46||e.$ref===xn().$ref||t&256&&e.anyOf.every(Aa))){let r=!1;if(t&128){let o=e.additionalItems,a;a=o==="strip"||o==="strict"?!0:Aa(o),r=a}n=r&&e.items.every(Aa)}if(n)return!0;let i=!1;if(t&64){let r=e.additionalItems,o;o=r==="strip"||r==="strict"?!0:Aa(r),i=o}return i?Object.values(e.properties).every(Aa):!1}function NT(e){let t=ot[e.s.type];if(Aa(e.s))return e;if(t&2064)return Oi(e,Ad(),void 0);if(t&128){let n=jt(fi,!1);n.items=e.s.items.map(o=>xn()),n.decoder=Pd;let i=e.s.additionalItems,r;return r=i==="strip"||i==="strict"?i:xn(),n.additionalItems=r,n.to=e.e.to,kt(qe(e,void 0,void 0,n))}if(t&64){let n=e.s.additionalItems;if(!(n==="strip"||n==="strict")){let o=Nc(xn());return o.to=e.e.to,kt(qe(e,void 0,void 0,o))}let i=Ma(e,e.s);i.e=xn(),e.e.to&&(i.e=br(i.e),i.e.to=e.e.to);let r=Object.keys(e.s.properties);for(let o=0,a=r.length;o<a;++o){let s=r[o],d=Sd(e,s);if(d.io=!1,d.s.type===_r&&d.s.has[Yn]){d.e=mi([qi(),xn()]);let l=kt(d);l.o=!0,Br(i,s,l)}else d.e=xn(),Br(i,s,kt(d))}return ja(i)}if(t&512)return qT(e);if(t&256&&!(Yn in e.s.has))return kt(iC(e,e.e));if(t&1)return e.e.to&&!e.e.parser?(e.s=xn(),Eg(e,e.e)):e.e.noValidation?(e.s=xn(),e):qT(e);try{let n=br(Na());return n.to=e.e,e.e=n,kt(e)}catch{return ko(e,e.s,xn())}}function xn(){return ji(_o,Cg,e=>{let t=jt(Cg,!0);t.$ref=Yz+_o,t.name=_o,t.decoder=NT,t.encoder=Eg,e.$ref=t.$ref,e.name=_o,e.decoder=NT,e.encoder=Eg;let n=[Na(),QT(),Lg(),Ad(),Nc(t),Id(t)],i={};n.forEach(a=>{i[a.type]=!0});let r=jt(_r,!0);r.anyOf=n,r.has=i,r.decoder=nC,r.name=_o,r.type=_r;let o={};o[_o]=r,e.$defs=o})}function e2(e){return e[Rg]}function kd(e,t,n){let i=br(Mi(e));return i.from=t,n!==void 0&&(i.fromFlattened=n),new Proxy(i,{get:(r,o)=>{if(o===Rg)return r;let a=r.items,s=r.properties,d=s!==void 0?s[o]:a!==void 0?a[o]:void 0;if(d===void 0){let l='Cannot read property "'+o+'" of '+Ot(r);throw new Error("[Sury] "+l)}return kd(d,r.from.concat(o),r.fromFlattened)}})}function lC(e,t,n){let i=Ma(e,t);i.io=!0;let r=t.items;if(r!==void 0)for(let o=0,a=r.length;o<a;++o){let s=o.toString();Br(i,s,n(s,r[o]))}else{let o=t.properties;if(o!==void 0){let a=Object.keys(o);for(let s=0,d=a.length;s<d;++s){let l=a[s];Br(i,l,n(l,o[l]))}}else{let a="Don't know where the value is coming from: "+Ot(t);throw new Error("[Sury] "+a)}}return ja(i)}function uC(e,t){let n=t.from,i=t.fromFlattened,r=i!==void 0?pi(FT(e.fv[i],t.from,0)):n!==void 0?pi(FT(e,n,0)):Wr in t?Oi(e,t,void 0):lC(e,t,(o,a)=>uC(e,a));return r.prev=void 0,r.e=t,r}function cC(e,t){let n=t.e,i=n.from;if(i!==void 0){let a=n.fromFlattened,s;if(a!==void 0){e.flattened===void 0&&(e.flattened=[]);let d=e.flattened[a];if(d!==void 0)s=d;else{let l={};e.flattened[a]=l,s=l}}else s=e;for(let d=0,l=i.length;d<l;++d){let u=i[d],c=s.properties,p;if(c!==void 0)p=c;else{let g={};s.properties=g,p=g}let f=p[u],h;if(f!==void 0)h=f;else{let g={};p[u]=g,h=g}s=h}s.val=t;return}let r=t.d;if(r===void 0)return;let o=Object.keys(r);for(let a=0,s=o.length;a<s;++a)cC(e,r[o[a]])}function Cc(e,t,n,i){let r=0;if(t!==void 0){let o=t.val;if(o!==void 0){let a=pi(o);return a.t=!0,a.s=n,a.e=n,kt(a)}r=1}else r=1;if(r===1){if(Wr in n){let c=Oi(e,n,n);return c.prev=void 0,c.p=e,c.v=Ag,c.io=!0,kt(c)}let o=t===void 0?Mi(n):n,a=Ma(e,o);a.e=o,a.io=!0,a.prev=void 0,a.p=e,a.v=Ag;let s=o.flattened,d=o.items,l=0,u=0;if(d!==void 0&&(t!==void 0||typeof o.additionalItems!==Ft))for(let c=0,p=d.length;c<p;++c){let f=c.toString(),h;if(t!==void 0){let _=t.properties;h=_!==void 0?_[f]:void 0}else h=void 0;let g=So(e.g,f);Br(a,f,Cc(e,h,d[c],i+("["+g+"]")))}else u=3;if(u===3){let c=o.properties;if(c!==void 0&&(t!==void 0||typeof o.additionalItems!==Ft)){if(s!==void 0&&t!==void 0){let f=t.flattened;f!==void 0&&f.forEach((h,g)=>{let y=Cc(e,h,ci(s[g]),i).d,b=Object.keys(y);for(let v=0,w=b.length;v<w;++v){let A=b[v];Br(a,A,y[A])}})}let p=Object.keys(c);for(let f=0,h=p.length;f<h;++f){let g=p[f];if(!(g in a.d)){let _;if(t!==void 0){let b=t.properties;_=b!==void 0?b[g]:void 0}else _=void 0;let y=So(e.g,g);Br(a,g,Cc(e,_,c[g],i+("["+y+"]")))}}}else l=2}if(l===2){let c=n.from,p=c!==void 0?i+c.map(h=>'["'+h+'"]').join(""):i,f=p===""?"":" at "+p;Uz(e,"Missing input for "+Ot(n)+f)}return ja(a)}}function FT(e,t,n){for(;;){let i=n,r=e,o=t[i];if(o===void 0)return r;n=i+1|0,e=r.d[o]}}function $c(e,t){if(typeof e!==Ft||e===null)return Ug(e);let n=t(e);if(n!==void 0)return n;if(Array.isArray(e)){for(let d=0,l=e.length;d<l;++d){let u=$c(e[d],t);e[d]=u}let s=jt(fi,!1);return s.items=e,s.additionalItems="strict",s.decoder=Pd,s}let i=e.constructor;if(i&&i!==Object){let s=jt($g,!0);return s.class=i,s.const=e,s.decoder=$a,s}let r=Object.keys(e),o=r.length;for(let s=0;s<o;++s){let d=r[s],l=$c(e[d],t);e[d]=l}let a=jt(Ft,!1);return a.required=r,a.properties=e,a.additionalItems=_d.a,a.decoder=Fa,a}function t2(e){let t={};cC(t,e);let n=e.e.to,i=Cc(e,t,n,"");return i.t=!0,i.prev=e,i}function Rd(e){return $c(e,t=>{if(t["~standard"])return t})}function fC(e){let t=this,n="~"+e,i=t[n];if(i!==void 0)return Ve(i);let r={},o=[],a=jt(Ft,!1);a.required=o,a.properties=r,a.additionalItems=_d.a,a.decoder=Fa;let s=t.f(e,a)[Rg],d=(f,h)=>{let g=qa(f);if(f in r)throw new Error("[Sury] "+("The field "+g+" defined twice"));return o.push(f),r[f]=h,kd(h,s.from.concat(f),s.fromFlattened)},p={field:d,f:d,fieldOr:(f,h,g)=>{let _=qc(h,void 0);return d(f,dC(_,{TAG:"Value",_0:g}))},tag:(f,h)=>{d(f,Rd(h))},nested:fC,flatten:f=>{if(f.type==="object"){let _=f.to,y=f.properties;if(_){let w="Unsupported nested flatten for transformed object schema "+Ot(f);throw new Error("[Sury] "+w)}let b=Object.keys(y),v={};for(let w=0,A=b.length;w<A;++w){let C=b[w];v[C]=d(C,y[C])}return v}let g="Can't flatten "+Ot(f)+" schema";throw new Error("[Sury] "+g)}};return t[n]=p,p}function pC(e){let t=br($c(e,e2));return t.serializer=t2,t}function mC(e){let t=e.e.flattened;if(t!==void 0){let r=[];for(let o=0,a=t.length;o<a;++o){let s=t[o],d=s.to,l;if(d!==void 0){let u=pi(e);u.e=s,u.io=!0,l=kt(u)}else{let u=lC(e,s,(c,p)=>Sd(e,c));u.e=s,u.prev=void 0,l=vd(u,u)}r.push(l),e.cp=e.cp+Kr(l,void 0)}e.fv=r}let n=e.e.to,i=uC(e,n);return i.t=!0,i.prev=e,vd(i,e)}function hC(e){let t,n={},i=u=>{if(u.type==="object"){let f=u.properties,h=Object.keys(f);for(let _=0,y=h.length;_<y;++_){let b=h[_],v=f[b],w=n[b];if(w!==void 0){if(w!==v)throw new Error("[Sury] "+('The field "'+b+'" defined twice with incompatible schemas'))}else n[b]=v}let g=t||(t=[]);return kd(u,Mc,g.push(u)-1|0)}let p="The '"+Ot(u)+"' schema can't be flattened";throw new Error("[Sury] "+p)},r=(u,c)=>{if(u in n)throw new Error("[Sury] "+('The field "'+u+'" defined twice with incompatible schemas'));return n[u]=c,kd(c,[u],void 0)},d=e({field:r,f:r,fieldOr:(u,c,p)=>{let f=qc(c,void 0);return r(u,dC(f,{TAG:"Value",_0:p}))},tag:(u,c)=>{r(u,Rd(c))},nested:fC,flatten:i}),l=jt(Ft,!1);return l.required=Object.keys(n),l.properties=n,l.additionalItems=_d.a,l.decoder=Fa,l.parser=mC,l.to=pC(d),t!==void 0&&(l.flattened=t),l}function gC(e){let t=[],n=(s,d)=>{let l=s.toString();if(t[s])throw new Error("[Sury] "+("The item ["+l+"] is defined multiple times"));return t[s]=d,kd(d,[s.toString()],void 0)},o=e({item:n,tag:(s,d)=>{n(s,Rd(d))}});for(let s=0,d=t.length;s<d;++s)t[s]||(t[s]=qi());let a=jt(fi,!1);return a.items=t,a.additionalItems="strict",a.decoder=Pd,a.parser=mC,a.to=pC(o),a}function n2(e){return e}function i2(e){return Rd(e(r2))}function _C(e){return mi(e.map(yC))}function bC(e){return qc(e,Jg())}function vC(e){return mi([e,qi(),Jg()])}var Pg,Mc,Ez,Ig,Og,Rg,Pa,Ri,Rz,Ac,$z,Ia,Yn,xg,$g,fi,Ft,_r,Tg,xd,Cg,Mg,Wr,ot,vo,Nn,Td,DT,jg,qg,_d,zr,$T,Oa,bo,Sg,it,br,_o,wo,Yz,r2,yC,SC,wC,kC,xC,TC=q(()=>{OT();RT();Me();nt();en();Pg={},Mc=[],Ez=(e=>({...e}));Ig="sury",Og=Symbol(Ig),Rg=Symbol(Ig+":item"),Pa="string",Ri="number",Rz="bigint",Ac="boolean",$z="symbol",Ia="null",Yn="undefined",xg="nan",$g="instance",fi="array",Ft="object",_r="union",Tg="never",xd="unknown",Cg="ref",Mg=mh("Sury.Exn"),Wr="const";ot={[xd]:1,[Pa]:2,[Ri]:4,[Ac]:8,[Yn]:16,[Ia]:32,[Ft]:64,[fi]:128,[_r]:256,[Cg]:512,[Rz]:1024,[xg]:2048,function:4096,[$g]:8192,[Tg]:32768,[$z]:16384};vo=class extends Error{constructor(t){super();for(let n in t)this[n]=t[n]}},Nn=Object.defineProperty,Td=vo.prototype;Nn(Td,"message",{get(){return LT(this)}});Nn(Td,"name",{value:"SuryError"});Nn(Td,"s",{value:Og});Nn(Td,"_1",{get(){return this}});Nn(Td,"RE_EXN_ID",{value:Mg});DT=1,jg=function(){},qg=Object.create(null);Nn(qg,"with",{get(){return(e,...t)=>e(this,...t)}});jg.prototype=qg;_d={m:LT,d:void 0,a:"strip",f:0},zr={},$T={configurable:!0},Oa="value",bo="r";Sg={};it=jt(xd,!0);it.decoder=UT;br=(e=>{let t=new jg;for(let n in e)t[n]=e[n];return t.seq=DT++,t});VT.embedded=Mc;_o="JSON";wo="BS_PRIVATE_NESTED_SOME_NONE";Nn(qg,"~standard",{get:function(){let e=this;return{version:1,vendor:Ig,validate:t=>{try{return{value:Rc(it,e)(t)}}catch(n){let i=jc(n);return{issues:[{message:i.reason,path:i.path===""?void 0:Pz(i.path)}]}}}}}});Yz="#/$defs/";r2={m:n2};yC=Rd;SC=yC,wC=Nc,kC=mi,xC=i2});var Le,xo,Da,CC,Cn,AC,EC,hn,Kg,PC,To,IC,Co,OC,Hr,Ao,RC,Eo=q(()=>{TC();Le=Na(),xo=Lg(),Da=xn(),CC=Mg,Cn=SC,AC=Id,EC=wC,hn=zg,Kg=bC,PC=vC,To=kC,IC=_C,Co=sC,OC=aC,Hr=xC,Ao=hC,RC=gC});function Ni(e,t){return e.TAG==="Ok"?t(e._0):e}var er=q(()=>{Qm()});function a2(e){return{path:e.path,summary:e.message}}function $d(e,t){try{return{TAG:"Ok",_0:OC(e,t)}}catch(n){let i=Kt(n);if(i.RE_EXN_ID===CC)return{TAG:"Error",_0:a2(i._1)};throw i}}var Md=q(()=>{Eo();en()});function Bg(e,t){if(e===void 0)return;let n=$d(e,l2);return n.TAG==="Ok"?n._0:(console.warn("message_author branch=invalid_read seq="+t.toString()+" reason="+n._0.summary),{kind:"unavailable",author_kind:"unknown",reason:"invalid_source"})}function Wg(e){switch(e.kind){case"agent":return":agent/"+e.agent_id+"/"+e.via_user_id+" ("+JSON.stringify(e.display_name)+")";case"human":return":human/"+e.user_id+" ("+JSON.stringify(e.display_name)+")";case"service":return":service/"+e.user_id+" ("+JSON.stringify(e.display_name)+")";case"external":return":external/"+e.user_id+" ("+JSON.stringify(e.display_name)+")";case"system":return":system";case"unavailable":return":unavailable/"+e.author_kind+"/"+e.reason}}function MC(e,t){return e!==void 0?"Linzumi message author="+Wg(e)+`:
137
-
138
- `+t:t}var jd,$C,Dc,d2,l2,Hg=q(()=>{Eo();er();Md();jd=Co(Le,e=>e.trim()!=="","empty author field",void 0),$C=Co(jd,e=>new RegExp("^[A-Za-z0-9+/]+={0,2}$").test(e),"expected unbroken base64 entity reference",void 0),Dc=Co($C,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:User:[1-9][0-9]*$").test(t)},"expected encoded User identity",void 0),d2=Co($C,e=>{let t=Buffer.from(e,"base64").toString("utf8");return new RegExp("^1:CodingJob:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$").test(t)},"expected encoded CodingJob identity",void 0),l2=To([Ao(e=>(e.tag("kind","agent"),{kind:"agent",agent_id:e.f("agent_id",d2),via_user_id:e.f("via_user_id",Dc),display_name:e.f("display_name",jd)})),Ao(e=>(e.tag("kind","human"),{kind:"human",user_id:e.f("user_id",Dc),display_name:e.f("display_name",jd)})),Ao(e=>(e.tag("kind","service"),{kind:"service",user_id:e.f("user_id",Dc),display_name:e.f("display_name",jd)})),Ao(e=>(e.tag("kind","external"),{kind:"external",user_id:e.f("user_id",Dc),display_name:e.f("display_name",jd)})),Ao(e=>(e.tag("kind","system"),{kind:"system"})),Ao(e=>(e.tag("kind","unavailable"),{kind:"unavailable",author_kind:e.f("author_kind",Co(Le,t=>["agent","system","unknown"].includes(t),"unknown unavailable author kind",void 0)),reason:e.f("reason",Co(Le,t=>["not_visible","invalid_source"].includes(t),"unknown unavailable author reason",void 0))}))])});var Lc,qC,Ua=q(()=>{Hg();Lc=Bg,qC=MC});var Vg=q(()=>{Me();nt()});var FC=q(()=>{Ru();nt()});var zc=q(()=>{FC();Bt();Me();Jt();nt();Tt();en()});var c2,f2,p2,m2,bhe,Qg=q(()=>{Eo();er();Md();Tt();c2=To([Cn("openai"),Cn("wafer")]),f2=Hr(e=>({sourceSeq:e.m(xo),provider:e.m(c2),model:e.m(Le)})),p2=To([Cn("catalog_unavailable"),Cn("offered"),Cn("delisted"),Cn("unverified")]),m2=Hr(e=>({selection:e.m(f2),baseUrl:e.m(Le),token:e.m(Le),catalogStatus:e.m(hn(p2))})),bhe=Hr(e=>({source:e.m(m2),turn:e.m(EC(Da))}))});var UC=q(()=>{Me();Jt();Tt();zc();Qg()});var GC=q(()=>{Me();er();Vg();Jt();Tt();UC()});var Yg=q(()=>{Et()});var Ehe,Phe,Ihe,BC=q(()=>{Yg();Et();Bt();Me();er();Tt();en();Ehe=1800*1e3,Phe=new RegExp("[^A-Za-z0-9._-]+","g"),Ihe=new RegExp("^[-.]+|[-.]+$","g")});var WC=q(()=>{Et();Bt();Me();er();Tt();BC()});var HC=q(()=>{xa();Me();er();hg();Jt();nt();Tt();en();GC();WC()});var Xg=q(()=>{HC()});var ey=q(()=>{"use strict";Ua();Xg();vc();ht();Pt()});var ty=q(()=>{});var ZC=q(()=>{xa();ty();Bt();Me();Jt();nt();Tt()});function QC(e){return JSON.stringify(e)}var A2,E2,gge,yge,_ge,bge,YC=q(()=>{Yg();xa();Bt();nt();ZC();A2="file",E2=["mcp_oauth_credentials_store","cli_auth_credentials_store"],gge=E2.flatMap(e=>["-c",e+'="'+A2+'"']);yge=["-c","model_providers.openai-linzumi.name="+QC("OpenAI"),"-c","model_providers.openai-linzumi.wire_api="+QC("responses"),"-c","model_providers.openai-linzumi.requires_openai_auth=true","-c","model_providers.openai-linzumi.supports_websockets=true"],_ge=new RegExp("\\bsession\\b.+\\bis archived\\b","i"),bge=new RegExp("^thread not found(?:\\s*:|\\b)","i")});var XC=q(()=>{Et();Me();nt();Tt();YC();Hg()});var eA=q(()=>{XC()});var tA=q(()=>{});var ry=q(()=>{});var rA=q(()=>{Me();Tt();kc();tA();ry()});var iA=q(()=>{rA()});var iy=q(()=>{"use strict"});function q2(e){let t=new Map;return{report:i=>{let r=i.key??i.message,o=i.audience??"user",a=e.nowMs(),s=t.get(r),d=s===void 0?{key:r,severity:i.severity,message:i.message,audience:o,count:1,firstAtMs:a,lastAtMs:a}:{...s,severity:i.severity,message:i.message,audience:o,count:s.count+1,lastAtMs:a};t.delete(r),t.set(r,d);for(let l of t.keys()){if(t.size<=j2)break;t.delete(l)}return e.writeAuditEvent(oA,{severity:d.severity,audience:d.audience,key:d.key,message:d.message,count:d.count}),e.tuiActive()?(d.audience==="user"&&e.reportConsoleEvent(oA,{severity:d.severity,key:d.key,message:d.message,count:d.count}),d):(d.count===1&&e.writeStderr(`${N2(d.severity)}${d.message}
139
- `),d)},notices:()=>Array.from(t.values()),reset:()=>t.clear()}}function N2(e){switch(e){case"warning":return"WARNING: ";case"error":return"ERROR: ";case"info":return""}}function oy(e){return F2.report(e)}var j2,oA,aA,F2,ay=q(()=>{"use strict";Ii();j2=50,oA="runner.notice";aA={tuiActive:()=>!1,reportConsoleEvent:()=>{}},F2=q2({tuiActive:()=>aA.tuiActive(),writeAuditEvent:(e,t)=>rt(e,t),reportConsoleEvent:(e,t)=>aA.reportConsoleEvent(e,t),writeStderr:e=>{process.stderr.write(e)},nowMs:Date.now})});var sA=q(()=>{"use strict";ht();Pt()});var dA=q(()=>{"use strict"});function Bc(e){return`<linzumi_context>
140
- <linzumi_thread_id>${Kc(e.threadId)}</linzumi_thread_id>
141
- <linzumi_creator_user_id>${Kc(e.creatorUserId)}</linzumi_creator_user_id>
142
- <linzumi_creator_username>${Kc(e.creatorUsername)}</linzumi_creator_username>
143
- <linzumi_conversation_url>${Kc(e.conversationUrl)}</linzumi_conversation_url>
144
- </linzumi_context>
145
-
146
- <linzumi_pr_footer_instruction>
147
- For any GitHub pull request you open from this session, include this Markdown footer link in the PR description: [Continue this on Linzumi](${e.conversationUrl})
148
- </linzumi_pr_footer_instruction>`}function Kc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}var Nd=q(()=>{"use strict";ht()});var lA=q(()=>{"use strict";Ua();dA();Nd()});var uA=q(()=>{"use strict";ui();Pt();ht()});function Fd(e,t){return e.catch(n=>t(Kt(n)))}var Dd=q(()=>{en()});var Hc=q(()=>{Bt()});var uy=q(()=>{Et();Bt();Me();Tt();en();Hc();Ca()});var fA=q(()=>{Et();Ca()});var sye,pA=q(()=>{Et();Bt();Me();Dd();Jt();nt();Tt();en();uy();Hc();Ca();fA();sye=1440*60*1e3});var K2,dye,Vc=q(()=>{Eo();K2=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],dye=IC(K2)});var mA=q(()=>{});var yye,hA=q(()=>{Et();Me();er();Jt();nt();mA();yye=Object.fromEntries([["granular",Object.fromEntries([["sandbox_approval",!1],["rules",!1],["skill_approval",!1],["request_permissions",!1],["mcp_elicitations",!0]])]])});var za=q(()=>{Me();Vc();uy()});var xye,Tye,Cye,Ud=q(()=>{Et();Me();Jt();Tt();hA();za();xye=new RegExp("^https?:\\/\\/","i"),Tye=new RegExp("^data:","i"),Cye=new RegExp("^file:\\/\\/","i")});var fy=q(()=>{Et();Bt();Me();nt();Tt();Ud()});var vA=q(()=>{});var y_e,__e,b_e,v_e,S_e,w_e,k_e,x_e,T_e,C_e,A_e,E_e,P_e,I_e,O_e,R_e,$_e,M_e,j_e,q_e,py=q(()=>{Et();ty();Me();Mu();Jt();nt();Vc();Tt();vA();Ud();za();fy();y_e=new RegExp("<[^>]*>","g"),__e=new RegExp(`data:[^"' )]+`,"g"),b_e=new RegExp("\\s+","g"),v_e=new RegExp("(?:<!doctype\\s+html|<html(?:\\s|>))","i"),S_e=new RegExp("cloudflare|cf-ray|\\bblocked\\b|access denied|\\bchallenge\\b|attention required","i"),w_e=new RegExp("cloudflare|cf-ray","i"),k_e=new RegExp("\\bblocked\\b|access denied","i"),x_e=new RegExp("attention required","i"),T_e=new RegExp("@font-face","i"),C_e=new RegExp("unexpected status (401|403)\\b","i"),A_e=new RegExp("\\b(401|403)\\s+(?:unauthorized|forbidden)\\b","i"),E_e=new RegExp("^(?:model_request_rejected|invalid_request_error|invalid_request|request_rejected|content_policy_violation|content_filter|input_validation_error)$","i"),P_e=new RegExp("\\bmodel request was rejected\\b|\\bmodel_request_rejected\\b","i"),I_e=new RegExp("^provider_outage$","i"),O_e=new RegExp("rejecting requests|experiencing an outage|provider outage","i"),R_e=new RegExp("\\bapply_patch\\b[^]*\\bincompatible\\b|\\bin-flight tool future\\b[^]*\\bfail","i"),$_e=new RegExp("\\btools::router\\b[^]*\\bfatal\\b|\\bresponse\\.failed\\b","i"),M_e=new RegExp("(tool.*fatal|fatal.*tool|response[._]failed|tool_failure)","i"),j_e=new RegExp("upstream model stream stalled","i"),q_e=new RegExp("\\(HTTP (\\d{3})\\)")});var L_e,my=q(()=>{ii();Me();nt();en();Ud();za();fy();py();L_e=10*6e4});var z_e,kA=q(()=>{Et();Me();nt();Ku();en();my();za();z_e=10*6e4});function hy(e,t){return{message:t,budgetExempt:!1,preserveForRestart:e!==void 0?e:!1}}function AA(e,t){let n=t-e.maxLivePressureAgeMs;return e.activeAckStartedAtMs.some(i=>i<=n)}function Qc(e){return e.replace(hJ,"?").slice(0,128)}function EA(e,t){return dn(e.activeAckStartedAtMs,0,(n,i)=>Math.max(n,t-i))}function gJ(e,t,n,i,r){e.pressureShedCount.contents=e.pressureShedCount.contents+1|0;let o=r!==void 0?r.TAG==="ItemStream"?["item",Qc(r.itemKey),St(r.turnId,Qc)]:["turn",void 0,Qc(r._0)]:["none",void 0,void 0],a;return a=t==="AckPressure"?"ack_pressure":"queue_age",{event:"commander_push.pressure_shed",branch:a,shedCount:e.pressureShedCount.contents,ageMs:n,budgetMs:e.maxLivePressureAgeMs,threadKey:Qc(i),streamKind:o[0],itemKey:o[1],turnId:o[2]}}function PA(e,t,n,i,r,o){let a=o(),s=gJ(e,t,n,i,r);try{e.onPressureShed(s)}catch{let l=s.branch,u=s.shedCount,c=s.ageMs,p=s.budgetMs,f=s.threadKey,h=s.streamKind,g=s.itemKey,_=s.turnId,y={event:"commander_push.pressure_shed_fallback",branch:l,shedCount:u,ageMs:c,budgetMs:p,threadKey:f,streamKind:h,itemKey:g,turnId:_};try{e.onPressureShedFallback(y)}catch{}}return a}function CA(e){let t=e.now(),n=t-e.maxLivePressureAgeMs,i=AA(e,t),r=[];e.live.activeThreads.forEach(o=>{let a=e.live.pendingByThread.get(o);if(a===void 0)return;let s=a.filter(l=>{let u=l.enqueuedAtMs<=n;if(!i&&!u)return!0;let c=i?"AckPressure":"QueueAge",p;return p=c==="AckPressure"?EA(e,t):t-l.enqueuedAtMs,PA(e,c,p,l.threadKey,l.streamIdentity,()=>aa(l.supersede,f=>f())),!1});s.length!==0?(e.live.pendingByThread.set(o,s),r.push(o)):e.live.pendingByThread.delete(o)}),e.live.activeThreads.splice(0,e.live.activeThreads.length,...r)}function IA(e){let t=e.activeThreads.shift();if(t===void 0)return{TAG:"Ok",_0:void 0};let n=e.pendingByThread.get(t);if(n===void 0)return{TAG:"Error",_0:"Commander push admission lost an active thread"};let i=n.shift();return i!==void 0?(n.length!==0?e.activeThreads.push(t):e.pendingByThread.delete(t),{TAG:"Ok",_0:i}):(e.pendingByThread.delete(t),{TAG:"Error",_0:"Commander push admission thread queue was empty"})}function yJ(e){for(;;){let t=IA(e.live);if(t.TAG!=="Ok")return{TAG:"Error",_0:t._0};let n=t._0;if(n===void 0)return{TAG:"Ok",_0:void 0};let i=e.now(),r=AA(e,i),o=n.enqueuedAtMs+e.maxLivePressureAgeMs<=i;if(!r&&!o)return{TAG:"Ok",_0:n};let a=r?"AckPressure":"QueueAge",s;s=a==="AckPressure"?EA(e,i):i-n.enqueuedAtMs,PA(e,a,s,n.threadKey,n.streamIdentity,()=>aa(n.supersede,d=>d()))}}function _J(e){for(;;){let t=e.priority.activeThreads.length!==0,n=e.live.activeThreads.length!==0,i=e.maxInFlight===1?!0:e.liveInFlight.contents<(e.maxInFlight-1|0),r=n&&i,o=e.consecutivePriority.contents<8,a=0;if(t)a=r&&!o?1:2;else if(r)a=1;else return e.consecutivePriority.contents=0,{TAG:"Ok",_0:void 0};switch(a){case 1:e.consecutivePriority.contents=0;let s=yJ(e);if(s.TAG!=="Ok")return{TAG:"Error",_0:s._0};let d=s._0;if(d!==void 0)return{TAG:"Ok",_0:d};continue;case 2:return e.consecutivePriority.contents=e.consecutivePriority.contents+1|0,IA(e.priority)}}}function bJ(e,t,n,i,r,o){let a=t!==void 0?t:2e3,s=n!==void 0?n:b=>performance.now(),d=i!==void 0?i:(b,v)=>{let w=setTimeout(v,b);return w.unref(),()=>{clearTimeout(w)}},l=r!==void 0?r:b=>{console.warn("commander_push.pressure_shed",b)},u=o!==void 0?o:b=>{console.warn("commander_push.pressure_shed_fallback",b)},c=e>0,p=a>0&&isFinite(a)&&Number.isSafeInteger(a);if(!c)return{TAG:"Error",_0:"Commander push admission maxInFlight must be a positive integer"};if(!p)return{TAG:"Error",_0:"Commander push admission maxLivePressureAgeMs must be positive and finite"};let f={maxInFlight:e,priority:{pendingByThread:new Map,activeThreads:[]},live:{pendingByThread:new Map,activeThreads:[]},inFlight:{contents:0},liveInFlight:{contents:0},consecutivePriority:{contents:0},pumpScheduled:{contents:!1},schedulePump:()=>{},armPressureCheck:b=>{},recomputePressureCheck:()=>{},maxLivePressureAgeMs:a,now:s,schedulePressureCheck:d,activeAckStartedAtMs:[],cancelPressureCheck:{contents:void 0},pressureCheckDeadlineMs:{contents:void 0},onPressureShed:l,onPressureShedFallback:u,pressureShedCount:{contents:0}},h=b=>{let v=f.pressureCheckDeadlineMs.contents;if(v!==void 0){if(v<=b)return;aa(f.cancelPressureCheck.contents,C=>C()),f.pressureCheckDeadlineMs.contents=b;let A=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,CA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=A;return}aa(f.cancelPressureCheck.contents,A=>A()),f.pressureCheckDeadlineMs.contents=b;let w=f.schedulePressureCheck(Math.max(1,b-f.now()),()=>{f.cancelPressureCheck.contents=void 0,f.pressureCheckDeadlineMs.contents=void 0,CA(f),f.schedulePump(),f.recomputePressureCheck()});f.cancelPressureCheck.contents=w},g=()=>{let b={contents:void 0};f.live.pendingByThread.forEach(w=>{w.forEach(A=>{let C=A.enqueuedAtMs+f.maxLivePressureAgeMs,S=b.contents;b.contents=S!==void 0?Math.min(S,C):C})});let v=b.contents;if(v!==void 0)return h(dn(f.activeAckStartedAtMs,v,(w,A)=>Math.min(w,A+f.maxLivePressureAgeMs)))},_=()=>{for(;;){if(f.pumpScheduled.contents=!1,f.inFlight.contents>=f.maxInFlight)return;let b=_J(f);if(b.TAG==="Ok"){let w=b._0;if(w===void 0)return;let A=f.now();f.inFlight.contents=f.inFlight.contents+1|0,f.activeAckStartedAtMs.push(A),f.live.activeThreads.length!==0&&h(A+f.maxLivePressureAgeMs),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents+1|0),Fd(w.task(),C=>{let S=ri(C),k=S!==void 0?Ke(Dr(Ve(S)),"unknown admission task error"):"unknown admission task error";return w.fail(hy(void 0,k)),Promise.resolve()}).finally(()=>{f.inFlight.contents=f.inFlight.contents-1|0;let C=f.activeAckStartedAtMs.indexOf(A);C!==-1&&f.activeAckStartedAtMs.splice(C,1),w.replaceableLive&&(f.liveInFlight.contents=f.liveInFlight.contents-1|0),f.schedulePump()});continue}let v=b._0;f.priority.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(hy(void 0,v)))}),f.live.pendingByThread.forEach(w=>{w.forEach(A=>A.fail(hy(void 0,v)))}),f.priority.pendingByThread.clear(),f.live.pendingByThread.clear(),f.priority.activeThreads.splice(0,f.priority.activeThreads.length),f.live.activeThreads.splice(0,f.live.activeThreads.length);return}},y=()=>{if(!f.pumpScheduled.contents){f.pumpScheduled.contents=!0,queueMicrotask(_);return}};return f.schedulePump=y,f.armPressureCheck=h,f.recomputePressureCheck=g,{TAG:"Ok",_0:f}}function vJ(e){let t=St(e[xA],i=>i.trim());if(t===void 0)return{TAG:"Ok",_0:16};if(t==="")return{TAG:"Ok",_0:16};let n=Number(t);return Number.isSafeInteger(n)&&n>=2?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:xA+" must be an integer of at least 2"}}function SJ(e){let t=St(e[TA],i=>i.trim());if(t===void 0)return{TAG:"Ok",_0:2e3};if(t==="")return{TAG:"Ok",_0:2e3};let n=Number(t);return Number.isSafeInteger(n)&&n>0?{TAG:"Ok",_0:n|0}:{TAG:"Error",_0:TA+" must be a positive integer"}}var xA,TA,hJ,J_e,OA=q(()=>{Et();ii();Me();er();Dd();nt();xA="LINZUMI_COMMANDER_PUSH_MAX_INFLIGHT",TA="LINZUMI_COMMANDER_PUSH_PRESSURE_BUDGET_MS";hJ=new RegExp("[^\\x20-\\x7E]","g");J_e=Ni(vJ(process.env),e=>Ni(SJ(process.env),t=>bJ(e,t,void 0,void 0,void 0,void 0)))});var RA=q(()=>{});var K_e,$A=q(()=>{Eo();Md();K_e=RC(e=>({joinRef:e.item(0,Kg(Le)),ref:e.item(1,Kg(Le)),topic:e.item(2,Le),event:e.item(3,Le),payload:e.item(4,Da)}))});var X_e,MA,ebe,tbe,nbe,rbe,jA=q(()=>{xa();Et();ii();Bt();Me();er();Dd();Jt();nt();Tt();RA();en();bg();$A();_g();X_e=new RegExp("/$"),MA="[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]",ebe=new RegExp(MA),tbe=new RegExp(MA,"g"),nbe=new RegExp("^npm install -g @linzumi\\/cli(@[0-9A-Za-z^~.-]{1,32})?$"),rbe=new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]{1,32})?$")});var qA=q(()=>{Et();Me()});var PJ,ibe,obe,IJ,OJ,abe,sbe,NA=q(()=>{Eo();Me();Md();PJ=Hr(e=>({decision:e.m(Le),label:e.m(Le),description:e.m(hn(Le))})),ibe=Hr(e=>({decision:e.m(Le)})),obe=Hr(e=>({status:e.m(Le),response:e.m(Da)})),IJ=Cn("terminal"),OJ=To([Cn("interrupted"),Cn("processed"),Cn("failed"),Cn("ignored"),Cn("stop_failed")]),abe=Hr(e=>({disposition:e.m(IJ),thread_id:e.m(Le),seq:e.m(xo),status:e.m(OJ),reason:e.m(PC(Le))})),sbe=Hr(e=>({approval_request_id:e.m(Le),approval_kind:e.m(Le),approval_summary:e.m(Le),approval_reason:e.m(hn(Le)),approval_port:e.m(hn(xo)),approval_pid:e.m(hn(xo)),approval_command:e.m(hn(Le)),approval_cwd:e.m(hn(Le)),approval_process_name:e.m(hn(Le)),approval_process_icon_key:e.m(hn(Le)),approval_process_icon_path:e.m(hn(Le)),approval_choices:e.m(hn(AC(PJ))),approval_allowed_actor_slug:e.m(hn(Le)),approval_allowed_actor_user_id:e.m(hn(xo))}))});var Gbe,FA=q(()=>{Et();ii();Bt();Me();er();Dd();pA();Vg();Jt();nt();Vc();Tt();kc();en();my();kA();OA();Ud();jA();za();py();qA();Ca();NA();Gbe=new RegExp("^item-\\d+$")});var DA=q(()=>{FA()});var MJ,Kbe,jJ,Bbe,Gd=q(()=>{"use strict";MJ=["deterministic","transient_upstream","transient_local","rate_limited","needs_approval","needs_decision","route_outage"],Kbe=new Set(MJ),jJ={runner_updating:"transient_local",stillborn_worker:"transient_local",infra_turn_kill:"transient_local",resume_transient:"transient_local",start_stage_transient:"transient_local",resume_torn_tail:"transient_local",resurrection_interrupted:"transient_local",dead_letter_exhausted:"transient_local",dead_letter_withheld:"needs_decision",dead_letter_permanent:"deterministic",resume_cwd_not_allowed:"deterministic",cwd_stillbirth_circuit_open:"deterministic",engine_unavailable:"deterministic",provider_binding_rejected:"deterministic",project_untrusted:"deterministic",attachment_download_failed:"transient_local",claude_input_queue_closed:"transient_local",claude_dispatch_wedged:"transient_local"},Bbe=Object.keys(jJ)});var qJ,Ybe,gy=q(()=>{"use strict";cc();Lh();Ii();Pt();qJ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,Ybe=new RegExp(qJ.source,"g")});var LA=q(()=>{ry()});var Yc=q(()=>{"use strict";ht();LA()});var UA=q(()=>{Hc()});var uve,GA=q(()=>{"use strict";Pt();ht();uve=1024*1024});var kve,yy=q(()=>{"use strict";Pt();UA();xc();GA();kve=1440*60*1e3});var Tve,zA=q(()=>{"use strict";Tve=10*6e4});var _y=q(()=>{"use strict";ui();ht();Pt()});var JA=q(()=>{"use strict"});var by=q(()=>{"use strict";JA();ui()});var Xc=q(()=>{"use strict";by();ui();ht();Gd();Yc();_y()});var CSe,KA=q(()=>{"use strict";ht();_y();Xc();CSe=10*6e4});var BA,awe,WA=q(()=>{"use strict";ui();ey();DA();xc();ht();Gd();iy();gy();Pt();Yc();yy();zA();KA();Xc();BA=new Map([["function_call","function_call_output"],["custom_tool_call","custom_tool_call_output"]]),awe=new Set([...BA.keys(),...BA.values()])});import{execFile as YJ}from"node:child_process";import{promisify as XJ}from"node:util";var uwe,cwe,fwe,zd,pwe,HA=q(()=>{"use strict";uwe=XJ(YJ),cwe=200*1024*1024,fwe=4320*60*1e3,zd=String.raw`\bgit\s+(?:-[Cc]\s+\S+\s+|-\S+\s+)*`,pwe=[new RegExp(`${zd}restore\\b`),new RegExp(`${zd}checkout\\b[^\\n;|&]*(\\s--(\\s|$)|\\s-f\\b|\\s\\.(\\s|$))`),new RegExp(`${zd}reset\\b[^\\n;|&]*--(hard|merge|keep)\\b`),new RegExp(`${zd}clean\\b`),new RegExp(`${zd}stash\\s+(drop|clear|pop)\\b`),/\brm\s+(-[A-Za-z]*f[A-Za-z]*)\b/]});var Sy=q(()=>{"use strict";Ua()});var VA=q(()=>{Qg()});var ZA=q(()=>{"use strict";Ua();ht();Nd();Pt()});function YA(e){return Math.ceil(e.length/4)}function wy(e){if(!Be(e))return;let t=mt(e.ir_version),n=nn(e.nodes);if(!(t===void 0||n===void 0))return{irVersion:t,threadTitle:Q(e.thread_title),nodes:n.flatMap(tK),hasMore:e.has_more===!0,cursor:mt(e.cursor),budget:nK(e.budget)}}function tK(e){if(!Be(e))return[];let t=Q(e.kind),n=mt(e.seq),i=Q(e.body)??"";return t===void 0||n===void 0?[]:[{kind:t,seq:n,at:Q(e.at),engine:Q(e.engine)??"none",body:i,structured:pe(e.structured),actor:pe(e.actor),messageAuthor:Lc(e.message_author,n),attachments:nn(e.attachments)??[],sourceSeq:mt(e.source_seq),streamKey:Q(e.stream_key)}]}function nK(e){if(!Be(e))return;let t=mt(e.context_window),n=mt(e.max_emission_tokens);if(!(t===void 0||n===void 0||n<=0))return{model:Q(e.model),contextWindow:t,maxEmissionTokens:n}}function rK(e,t){let n=t>0?t:QA,i=e.filter(s=>s.kind!=="reasoning"),r=e.length-i.length,o=[],a=0;for(let s=i.length-1;s>=0;s-=1){let d=i[s];if(d===void 0)continue;let l=YA(XA(d,n));if(o.length>0&&a+l>n)break;a+=l,o.unshift(d)}return{tail:o,omittedNodeCount:i.length-o.length,redactedReasoningCount:r,artifacts:iK(e)}}function iK(e){let t=new Set,n=new Set,i=0;for(let r of e){if(r.kind==="error"&&(i+=1),r.kind==="file_change")for(let o of oK(r.structured))t.add(o);if(r.kind==="command_execution"){let o=Q(r.structured?.command)?.trim();o!==void 0&&o!==""&&n.add(o.split(`
149
- `,1)[0]??o)}}return{filesTouched:[...t].slice(0,100),commandsRun:[...n].slice(0,100),errorCount:i}}function oK(e){if(e===void 0)return[];let t=Q(e.path),i=(nn(e.paths)??nn(e.files)??[]).flatMap(r=>{let o=Q(r);if(o!==void 0)return[o];let a=Be(r)?Q(r.path):void 0;return a===void 0?[]:[a]});return t===void 0?i:[t,...i]}function ky(e){let t=e.budget?.maxEmissionTokens??QA,n=rK(e.nodes,t),i=cK({resumeFailure:e.resumeFailure,threadTitle:e.threadTitle,linzumiContext:e.linzumiContext,budgeted:n,transcriptEmpty:n.tail.length===0}),r=[Vr(i,"commentary")],o=0;for(let s of n.tail)o+=1,r.push(...aK(s,t,o));let a=r.reduce((s,d)=>s+YA(JSON.stringify(d)),0);return{items:r,emittedNodeCount:n.tail.length,omittedNodeCount:n.omittedNodeCount,redactedReasoningCount:n.redactedReasoningCount,emittedTokenEstimate:a,maxEmissionTokens:t}}function aK(e,t,n){let i=XA(e,t);switch(e.kind){case"user_message":return[{type:"message",role:"user",content:[{type:"input_text",text:qC(e.messageAuthor,uK(e,i))}]}];case"assistant_message":return[Vr(i,lK(e))];case"command_execution":return sK(e,i,n);case"tool_call":return dK(e,i,n);case"reasoning":return[];case"file_change":return[Vr(`[file change]
150
- ${i}`,"commentary")];case"terminal_input":return[Vr(`[terminal input]
151
- ${i}`,"commentary")];case"tool_result":return[Vr(`[tool result]
152
- ${i}`,"commentary")];case"approval_request":return[Vr(`[approval] ${i}`,"commentary")];case"agent_status":return[Vr(`[status] ${i}`,"commentary")];case"system_notice":return[Vr(`[notice] ${i}`,"commentary")];case"error":return[Vr(`[error] ${i}`,"commentary")];default:return[Vr(`[${e.kind}] ${i}`,"commentary")]}}function sK(e,t,n){let i=eE(e,n),r=Q(e.structured?.command),o=Q(e.structured?.cwd),a=mt(e.structured?.exit_code),s=Q(e.structured?.output)??t;return[{type:"function_call",name:"shell",call_id:i,arguments:JSON.stringify({command:r??pK(t),...o===void 0||o===""?{}:{cwd:o}})},{type:"function_call_output",call_id:i,output:a===void 0?s:`exit_code=${a}
153
- ${s}`}]}function dK(e,t,n){let i=eE(e,n);return[{type:"function_call",name:fK(Q(e.structured?.title)??"linzumi_replayed_tool"),call_id:i,arguments:JSON.stringify({replayed:!0})},{type:"function_call_output",call_id:i,output:t===""?"[result not recorded]":t}]}function Vr(e,t){return{type:"message",role:"assistant",content:[{type:"output_text",text:e}],phase:t}}function lK(e){return Q(e.structured?.phase)==="commentary"?"commentary":"final_answer"}function uK(e,t){return e.attachments.length===0?t:`${t}
154
- [${e.attachments.length} attachment(s) in the original message]`}function XA(e,t){let n=Math.max(1e3,t*4),i=e.body;return i.length<=n?i:`[...truncated...]
155
- ${i.slice(i.length-n)}`}function cK(e){let t=e.resumeFailure.trim(),{artifacts:n}=e.budgeted,i=["Rebuilt Linzumi coding session","","This session was rebuilt after an interrupted durable engine session: the previous engine session for this Linzumi thread could not be resumed"+(t===""?".":` (${mK(t,400)}).`),e.transcriptEmpty?"The durable server-side transcript could not be fetched or is empty - ask the user for any missing context instead of guessing.":"You are continuing the SAME task in the SAME Linzumi thread. The transcript below is replayed from the durable server-side record. Re-derive any local state (files, branches, running processes) from the workspace itself; do not assume in-memory state survived.",...e.threadTitle===void 0||e.threadTitle.trim()===""?[]:["",`Thread: ${e.threadTitle.trim()}`],...e.linzumiContext===void 0?[]:["",Bc(e.linzumiContext)]],r=[...e.budgeted.omittedNodeCount>0?[`${e.budgeted.omittedNodeCount} older transcript entries were omitted to fit the emission budget.`]:[],...e.budgeted.redactedReasoningCount>0?[`${e.budgeted.redactedReasoningCount} reasoning entries were redacted (provider-private; never replayed).`]:[],...n.filesTouched.length>0?[`Files touched: ${n.filesTouched.join(", ")}`]:[],...n.commandsRun.length>0?[`Commands run: ${n.commandsRun.join("; ")}`]:[],...n.errorCount>0?[`${n.errorCount} error entries in the full history.`]:[]];return[...i,...r.length===0?[]:["",...r]].join(`
156
- `)}function eE(e,t){return`linzumi_replay_${e.seq}_${t}`}function fK(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64);return t===""?"linzumi_replayed_tool":t}function pK(e){return e.split(`
157
- `,1)[0]??e}function mK(e,t){return e.length<=t?e:`[...truncated...]${e.slice(e.length-t)}`}var QA,xy=q(()=>{"use strict";Ua();ht();Nd();Pt();QA=76800});var tE=q(()=>{"use strict";ht()});var nE=q(()=>{"use strict";ht();Gd()});var rE=q(()=>{"use strict"});var iE=q(()=>{Me();Jt();Tt()});var oE=q(()=>{iE()});var aE=q(()=>{"use strict";Sy();oE()});var ef,sE=q(()=>{ef={default:{maxLadderMs:9e5},wafer:{maxLadderMs:36e5}}});var Hwe,Vwe,dE=q(()=>{"use strict";sE();Hwe={maxRecoveryRungs:4,maxLadderMs:ef.default.maxLadderMs,maxRateLimitHoldMs:30*6e4},Vwe={default:ef.default,wafer:ef.wafer}});var lE=q(()=>{"use strict"});var Xwe,uE=q(()=>{"use strict";Pt();Xwe=10*6e4});var Ty=q(()=>{"use strict";Ii()});var Cy=q(()=>{"use strict";Ty();Ty()});var cE=q(()=>{"use strict";Cy()});function vK(e){let t=e.toLowerCase();switch(!0){case t.endsWith(".app"):return e.slice(0,-4);case t.endsWith(".exe"):return e.slice(0,-4);case t.endsWith(".cmd"):case t.endsWith(".bat"):return e.slice(0,-4);default:return e}}function SK(e){return vK(e.trim().replaceAll("\\","/").toLowerCase())}var bK,fE,hke,pE=q(()=>{"use strict";bK=[{appName:"Bun",iconKey:"bun",names:["bun","bunx"]},{appName:"Node.js",iconKey:"nodejs",names:["node","nodejs","node.exe"]},{appName:"npm",iconKey:"npm",names:["npm","npm-cli.js","npx"]},{appName:"pnpm",iconKey:"pnpm",names:["pnpm","pnpx"]},{appName:"Yarn",iconKey:"yarn",names:["yarn","yarnpkg","yarn.js"]},{appName:"Corepack",iconKey:"corepack",names:["corepack"]},{appName:"Deno",iconKey:"deno",names:["deno"]},{appName:"Vite",iconKey:"vite",names:["vite","vite-node"]},{appName:"Vitest",iconKey:"vitest",names:["vitest"]},{appName:"Next.js",iconKey:"nextjs",names:["next","next-server"]},{appName:"Nuxt",iconKey:"nuxt",names:["nuxt","nuxi"]},{appName:"Astro",iconKey:"astro",names:["astro"]},{appName:"SvelteKit",iconKey:"svelte",names:["svelte-kit","sveltekit"]},{appName:"Remix",iconKey:"remix",names:["remix"]},{appName:"Expo",iconKey:"expo",names:["expo","expo-cli"]},{appName:"React Native",iconKey:"react",names:["react-native"]},{appName:"Metro",iconKey:"metro",names:["metro","metro-inspector-proxy"]},{appName:"Webpack",iconKey:"webpack",names:["webpack","webpack-dev-server","webpack-cli"]},{appName:"Parcel",iconKey:"parcel",names:["parcel"]},{appName:"Rollup",iconKey:"rollup",names:["rollup"]},{appName:"esbuild",iconKey:"esbuild",names:["esbuild"]},{appName:"SWC",iconKey:"swc",names:["swc"]},{appName:"TypeScript",iconKey:"typescript",names:["tsc","tsserver","tsx","ts-node","typescript-language-server"]},{appName:"ESLint",iconKey:"eslint",names:["eslint","eslint_d"]},{appName:"Prettier",iconKey:"prettier",names:["prettier"]},{appName:"Biome",iconKey:"biome",names:["biome"]},{appName:"Storybook",iconKey:"storybook",names:["storybook","start-storybook"]},{appName:"Playwright",iconKey:"playwright",names:["playwright"]},{appName:"Cypress",iconKey:"cypress",names:["cypress"]},{appName:"Jest",iconKey:"jest",names:["jest"]},{appName:"Python",iconKey:"python",names:["python","python2","python3","python3.9","python3.10","python3.11","python3.12","python3.13","pypy","pypy3"]},{appName:"pip",iconKey:"python",names:["pip","pip2","pip3"]},{appName:"pipx",iconKey:"python",names:["pipx"]},{appName:"uv",iconKey:"python",names:["uv","uvx"]},{appName:"Poetry",iconKey:"poetry",names:["poetry"]},{appName:"Pipenv",iconKey:"python",names:["pipenv"]},{appName:"Conda",iconKey:"conda",names:["conda","mamba","micromamba"]},{appName:"Django",iconKey:"django",names:["django-admin","django-admin.py","manage.py"]},{appName:"Flask",iconKey:"flask",names:["flask"]},{appName:"Uvicorn",iconKey:"uvicorn",names:["uvicorn"]},{appName:"Gunicorn",iconKey:"gunicorn",names:["gunicorn"]},{appName:"Hypercorn",iconKey:"python",names:["hypercorn"]},{appName:"Celery",iconKey:"celery",names:["celery"]},{appName:"Jupyter",iconKey:"jupyter",names:["jupyter","jupyter-lab","jupyter-notebook","ipython"]},{appName:"Ruby",iconKey:"ruby",names:["ruby","erb","irb"]},{appName:"Bundler",iconKey:"ruby",names:["bundle","bundler"]},{appName:"Rails",iconKey:"rails",names:["rails","bin/rails"]},{appName:"Rack",iconKey:"ruby",names:["rackup"]},{appName:"Puma",iconKey:"puma",names:["puma"]},{appName:"Sidekiq",iconKey:"sidekiq",names:["sidekiq"]},{appName:"RSpec",iconKey:"ruby",names:["rspec"]},{appName:"Go",iconKey:"go",names:["go","gofmt","gopls","air"]},{appName:"Delve",iconKey:"go",names:["dlv"]},{appName:"Rust",iconKey:"rust",names:["rustc","rustup","cargo","rust-analyzer"]},{appName:"Java",iconKey:"java",names:["java","javac","jar","jshell","jwebserver"]},{appName:"Gradle",iconKey:"gradle",names:["gradle","gradlew"]},{appName:"Maven",iconKey:"maven",names:["mvn","mvnw"]},{appName:"Spring Boot",iconKey:"spring",names:["spring","spring-boot"]},{appName:"Kotlin",iconKey:"kotlin",names:["kotlin","kotlinc","kotlin-language-server"]},{appName:"Scala",iconKey:"scala",names:["scala","scalac","sbt","metals"]},{appName:"Clojure",iconKey:"clojure",names:["clojure","clj","lein","boot"]},{appName:"PHP",iconKey:"php",names:["php","php-fpm","php-cgi","composer"]},{appName:"Laravel",iconKey:"laravel",names:["artisan","laravel"]},{appName:"Symfony",iconKey:"symfony",names:["symfony"]},{appName:"Elixir",iconKey:"elixir",names:["elixir","iex","mix"]},{appName:"Erlang",iconKey:"erlang",names:["erl","beam.smp","beam","epmd","rebar3"]},{appName:"Phoenix",iconKey:"phoenix",names:["phx.server","phoenix"]},{appName:"PostgreSQL",iconKey:"postgresql",names:["postgres","postmaster","pg_ctl","psql","pg_isready"]},{appName:"Redis",iconKey:"redis",names:["redis-server","redis-cli","redis-sentinel"]},{appName:"MySQL",iconKey:"mysql",names:["mysql","mysqld","mysqladmin"]},{appName:"MariaDB",iconKey:"mariadb",names:["mariadb","mariadbd","mariadb-admin"]},{appName:"SQLite",iconKey:"sqlite",names:["sqlite3","sqlite"]},{appName:"MongoDB",iconKey:"mongodb",names:["mongod","mongosh","mongo"]},{appName:"Elasticsearch",iconKey:"elasticsearch",names:["elasticsearch"]},{appName:"OpenSearch",iconKey:"opensearch",names:["opensearch"]},{appName:"Solr",iconKey:"solr",names:["solr"]},{appName:"Kafka",iconKey:"kafka",names:["kafka-server-start","kafka-console-consumer","kafka-console-producer"]},{appName:"ZooKeeper",iconKey:"zookeeper",names:["zookeeper-server-start","zkserver"]},{appName:"RabbitMQ",iconKey:"rabbitmq",names:["rabbitmq-server","rabbitmqctl"]},{appName:"NATS",iconKey:"nats",names:["nats-server","nats"]},{appName:"Docker",iconKey:"docker",names:["docker","dockerd","docker-compose","docker-proxy","com.docker.backend"]},{appName:"Podman",iconKey:"podman",names:["podman","podman-compose"]},{appName:"Kubernetes",iconKey:"kubernetes",names:["kubectl","kube-apiserver","kubelet","minikube","kind"]},{appName:"Helm",iconKey:"helm",names:["helm"]},{appName:"Tilt",iconKey:"tilt",names:["tilt"]},{appName:"nginx",iconKey:"nginx",names:["nginx"]},{appName:"Caddy",iconKey:"caddy",names:["caddy"]},{appName:"Apache HTTP Server",iconKey:"apache",names:["httpd","apache2","apachectl"]},{appName:"HAProxy",iconKey:"haproxy",names:["haproxy"]},{appName:"Traefik",iconKey:"traefik",names:["traefik"]},{appName:"Envoy",iconKey:"envoy",names:["envoy"]},{appName:"Tailscale",iconKey:"tailscale",names:["tailscale","tailscaled"]},{appName:"Cloudflare Tunnel",iconKey:"cloudflare",names:["cloudflared"]},{appName:"ngrok",iconKey:"ngrok",names:["ngrok"]},{appName:"localtunnel",iconKey:"terminal",names:["lt","localtunnel"]},{appName:"SSH",iconKey:"ssh",names:["ssh","sshd","scp","sftp"]},{appName:"Git",iconKey:"git",names:["git","git-lfs","git-upload-pack","git-receive-pack"]},{appName:"GitHub CLI",iconKey:"github",names:["gh"]},{appName:"GitLab CLI",iconKey:"gitlab",names:["glab"]},{appName:"Subversion",iconKey:"subversion",names:["svn"]},{appName:"Mercurial",iconKey:"mercurial",names:["hg"]},{appName:"AWS CLI",iconKey:"aws",names:["aws","aws-vault","sam"]},{appName:"Azure CLI",iconKey:"azure",names:["az"]},{appName:"Google Cloud CLI",iconKey:"google-cloud",names:["gcloud","gsutil","bq"]},{appName:"Terraform",iconKey:"terraform",names:["terraform"]},{appName:"OpenTofu",iconKey:"opentofu",names:["tofu"]},{appName:"Ansible",iconKey:"ansible",names:["ansible","ansible-playbook"]},{appName:"Pulumi",iconKey:"pulumi",names:["pulumi"]},{appName:"Nomad",iconKey:"nomad",names:["nomad"]},{appName:"Vault",iconKey:"vault",names:["vault"]},{appName:"Consul",iconKey:"consul",names:["consul"]},{appName:"Make",iconKey:"make",names:["make","gmake"]},{appName:"CMake",iconKey:"cmake",names:["cmake","ctest","cpack"]},{appName:"Ninja",iconKey:"ninja",names:["ninja"]},{appName:"Bazel",iconKey:"bazel",names:["bazel","bazelisk"]},{appName:"Buck",iconKey:"buck",names:["buck","buck2"]},{appName:"Clang",iconKey:"clang",names:["clang","clang++","clangd"]},{appName:"GCC",iconKey:"gcc",names:["gcc","g++","cc","c++"]},{appName:"LLDB",iconKey:"terminal",names:["lldb"]},{appName:"GDB",iconKey:"terminal",names:["gdb"]},{appName:"Swift",iconKey:"swift",names:["swift","swiftc","sourcekit-lsp"]},{appName:"Xcode",iconKey:"xcode",names:["xcodebuild","xcrun","simctl"]},{appName:"Zig",iconKey:"zig",names:["zig"]},{appName:"Lua",iconKey:"lua",names:["lua","luajit","lua-language-server"]},{appName:"Perl",iconKey:"perl",names:["perl"]},{appName:"R",iconKey:"r",names:["r","rscript","rserver","rsession"]},{appName:"Julia",iconKey:"julia",names:["julia"]},{appName:"Haskell",iconKey:"haskell",names:["ghc","ghci","cabal","stack","haskell-language-server-wrapper"]},{appName:"OCaml",iconKey:"ocaml",names:["ocaml","ocamlc","dune","opam"]},{appName:"F#",iconKey:"fsharp",names:["fsharpi","fsautocomplete"]},{appName:".NET",iconKey:"dotnet",names:["dotnet","csharp-ls","omnisharp"]},{appName:"PowerShell",iconKey:"powershell",names:["pwsh","powershell"]},{appName:"Bash",iconKey:"terminal",names:["bash"]},{appName:"Zsh",iconKey:"terminal",names:["zsh"]},{appName:"fish",iconKey:"terminal",names:["fish"]},{appName:"tmux",iconKey:"terminal",names:["tmux"]},{appName:"GNU Screen",iconKey:"terminal",names:["screen"]},{appName:"direnv",iconKey:"terminal",names:["direnv"]},{appName:"Nix",iconKey:"nix",names:["nix","nix-shell","nix-daemon","nix-build","nix develop"]},{appName:"Homebrew",iconKey:"homebrew",names:["brew"]},{appName:"mise",iconKey:"terminal",names:["mise"]},{appName:"asdf",iconKey:"terminal",names:["asdf"]},{appName:"Volta",iconKey:"volta",names:["volta"]},{appName:"fnm",iconKey:"nodejs",names:["fnm"]},{appName:"nvm",iconKey:"nodejs",names:["nvm"]},{appName:"curl",iconKey:"terminal",names:["curl"]},{appName:"HTTPie",iconKey:"httpie",names:["http","https","httpie"]},{appName:"wget",iconKey:"terminal",names:["wget"]},{appName:"jq",iconKey:"terminal",names:["jq"]},{appName:"ripgrep",iconKey:"terminal",names:["rg","ripgrep"]},{appName:"fd",iconKey:"terminal",names:["fd"]},{appName:"fzf",iconKey:"terminal",names:["fzf"]},{appName:"bat",iconKey:"terminal",names:["bat"]},{appName:"eza",iconKey:"terminal",names:["eza","exa"]},{appName:"htop",iconKey:"terminal",names:["htop","top","btop"]},{appName:"Vim",iconKey:"vim",names:["vim","view","vimdiff"]},{appName:"Neovim",iconKey:"neovim",names:["nvim","nvim-qt"]},{appName:"Emacs",iconKey:"emacs",names:["emacs","emacsclient"]},{appName:"Visual Studio Code",iconKey:"vscode",names:["code","code-insiders","vscode","visual studio code","visual studio code - insiders"]},{appName:"code-server",iconKey:"vscode",names:["code-server"]},{appName:"Cursor",iconKey:"cursor",names:["cursor"]},{appName:"Zed",iconKey:"zed",names:["zed"]},{appName:"Sublime Text",iconKey:"sublime-text",names:["subl","sublime_text","sublime text"]},{appName:"Atom",iconKey:"atom",names:["atom"]},{appName:"IntelliJ IDEA",iconKey:"intellij-idea",names:["idea","idea.sh","intellij idea","idea64.exe"]},{appName:"WebStorm",iconKey:"webstorm",names:["webstorm","webstorm.sh"]},{appName:"PyCharm",iconKey:"pycharm",names:["pycharm","pycharm.sh"]},{appName:"RubyMine",iconKey:"rubymine",names:["rubymine","rubymine.sh"]},{appName:"GoLand",iconKey:"goland",names:["goland","goland.sh"]},{appName:"CLion",iconKey:"clion",names:["clion","clion.sh"]},{appName:"DataGrip",iconKey:"datagrip",names:["datagrip","datagrip.sh"]},{appName:"Rider",iconKey:"rider",names:["rider","rider.sh"]},{appName:"Android Studio",iconKey:"android-studio",names:["studio","studio.sh","android studio"]},{appName:"Xcode",iconKey:"xcode",names:["xcode","xcode.app"]},{appName:"Postman",iconKey:"postman",names:["postman"]},{appName:"Insomnia",iconKey:"insomnia",names:["insomnia"]},{appName:"Hoppscotch",iconKey:"hoppscotch",names:["hoppscotch"]},{appName:"TablePlus",iconKey:"tableplus",names:["tableplus"]},{appName:"DBeaver",iconKey:"dbeaver",names:["dbeaver"]},{appName:"RedisInsight",iconKey:"redis",names:["redisinsight"]},{appName:"Prisma",iconKey:"prisma",names:["prisma"]},{appName:"Drizzle Kit",iconKey:"drizzle",names:["drizzle-kit"]},{appName:"Supabase",iconKey:"supabase",names:["supabase"]},{appName:"Firebase",iconKey:"firebase",names:["firebase"]},{appName:"Vercel",iconKey:"vercel",names:["vercel"]},{appName:"Netlify",iconKey:"netlify",names:["netlify","ntl"]},{appName:"Fly.io",iconKey:"fly",names:["fly","flyctl"]},{appName:"Heroku",iconKey:"heroku",names:["heroku"]},{appName:"Stripe CLI",iconKey:"stripe",names:["stripe"]},{appName:"Twilio CLI",iconKey:"twilio",names:["twilio"]},{appName:"Mailpit",iconKey:"mail",names:["mailpit"]},{appName:"MailHog",iconKey:"mail",names:["mailhog"]},{appName:"OpenSSL",iconKey:"openssl",names:["openssl"]},{appName:"mkcert",iconKey:"certificate",names:["mkcert"]},{appName:"mkdocs",iconKey:"markdown",names:["mkdocs"]},{appName:"Hugo",iconKey:"hugo",names:["hugo"]},{appName:"Jekyll",iconKey:"jekyll",names:["jekyll"]},{appName:"Eleventy",iconKey:"eleventy",names:["eleventy","11ty"]},{appName:"Docusaurus",iconKey:"docusaurus",names:["docusaurus"]},{appName:"Trunk",iconKey:"rust",names:["trunk"]},{appName:"wasm-pack",iconKey:"webassembly",names:["wasm-pack"]},{appName:"wasmtime",iconKey:"webassembly",names:["wasmtime"]},{appName:"Language Server",iconKey:"language-server",names:["lua-language-server","yaml-language-server","vscode-json-language-server","docker-langserver","bash-language-server","marksman","taplo"]}],fE=new Map;for(let e of bK)for(let t of e.names)fE.set(SK(t),{appName:e.appName,iconKey:e.iconKey});hke=fE.size});var mE=q(()=>{"use strict"});async function _E(e){let t=[],n=new Set,i=new Set,r=[],o=null;for(let s=0;s<Ay;s+=1){let d=await e.request("model/list",{cursor:o,limit:wK,includeHidden:!1}),l=xK(d,"model/list"),u=nn(l.data);if(u===void 0)throw wr("model/list response did not include data");for(let f of u){let h=pe(f),g=Q(h?.model)?.trim(),_=Q(h?.displayName)?.trim(),y=nn(h?.supportedReasoningEfforts),b=Q(h?.defaultReasoningEffort)?.trim();if(h===void 0||g===void 0||!Jd(g)||_===void 0||!Jd(_)||h.hidden!==!1||y===void 0||b===void 0||!Jd(b)||typeof h.isDefault!="boolean")throw wr("model/list included invalid visible model metadata");if(n.has(g))throw wr(`model/list repeated model ${g}`);let v=y.map(w=>{let A=pe(w),C=Q(A?.reasoningEffort)?.trim();if(C===void 0||!Jd(C))throw wr(`model/list ${g} included invalid reasoning effort metadata`);return C});if(new Set(v).size!==v.length||!v.includes(b))throw wr(`model/list ${g} included inconsistent reasoning effort metadata`);if(n.add(g),t.push({id:g,displayName:_,reasoningEfforts:v,defaultReasoningEffort:b}),h.isDefault&&r.push(g),t.length>hE)throw wr(`model/list exceeded ${hE} visible models`)}let c=l.nextCursor;if(c===null)break;let p=Q(c)?.trim();if(p===void 0||!Jd(p))throw wr("model/list included invalid pagination cursor");if(i.has(p))throw wr(`model/list repeated pagination cursor ${p}`);if(i.add(p),o=p,s===Ay-1)throw wr(`model/list exceeded ${Ay} pagination pages`)}if(t.length===0)return{type:"empty"};if(r.length!==1)throw wr("model/list did not advertise exactly one valid default model");let[a]=r;if(a===void 0)throw wr("model/list did not advertise exactly one valid default model");return{type:"ready",catalog:{defaultModel:a,models:t}}}function xK(e,t){if("error"in e)throw new Error(`${t} failed: ${e.error.message}`);let n=pe(e.result);if(n===void 0)throw new Error(`${t} response did not include an object result`);return n}function TK(){let e=process.env.LINZUMI_CODEX_START_REQUEST_TIMEOUT_MS?.trim();if(e===void 0||e==="")return gE;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:gE}function CK(e,t,n=TK()){return AK(e,t,n,(i,r)=>new Ey(i,r))}function AK(e,t,n,i){return n>0?new Promise((r,o)=>{let a=setTimeout(()=>{o(i(e,n))},n);a.unref?.(),t.then(s=>{clearTimeout(a),r(s)},s=>{clearTimeout(a),o(s)})}):t}function Kd(e,t,n){return CK(t,e.request(t,n))}async function yE(e,t,n,i,r,o){o("kandan.reconnect_thread_unarchive_started",{codex_thread_id:t,discovered_by:i,message:r});try{let a=await Kd(e,"thread/unarchive",{threadId:t});if("error"in a)throw new Error(`thread/unarchive failed: ${a.error.message}`);let s=await Kd(e,"thread/resume",n);if("error"in s)throw new Error(`thread/resume after unarchive failed: ${s.error.message}`);return o("kandan.reconnect_thread_unarchive_resumed",{codex_thread_id:t,discovered_by:i}),{mode:"resumed"}}catch(a){let s=a instanceof Error?a.message:String(a);throw o("kandan.reconnect_thread_unarchive_failed",{codex_thread_id:t,discovered_by:i,archive_error:r,message:s}),new Error(i==="forced_inject_not_found"?`thread/inject_items failed: ${r}; archive recovery failed: ${s}`:s)}}async function bE(e){let{codex:t,codexThreadId:n,rehydration:i}=e,r={threadId:n,...e.resumeOverrides},o;if(i.forceRehydrate===!0)o="the server marked the durable engine session dead after an acknowledged-but-unexecuted turn";else{let s=await Kd(t,"thread/resume",r);if(!("error"in s))return{mode:"resumed"};if(OK(s.error.message))throw i.log("linzumi.agent_thread_resume_failed_unrecoverable",{codex_thread_id:n,message:s.error.message,rehydrating:!1}),new Error(s.error.message);if(EK(s.error.message))return await yE(t,n,r,"resume_archived",s.error.message,i.log);if(e.rebuildWhen==="missing-rollout-only"&&!IK(s.error.message))throw i.log("linzumi.agent_thread_resume_failed_unrecoverable",{codex_thread_id:n,message:s.error.message,rehydrating:!1}),new Error(s.error.message);o=s.error.message}i.log(i.forceRehydrate===!0?"kandan.reconnect_thread_rehydrate_forced":"kandan.reconnect_thread_resume_failed",{codex_thread_id:n,message:o,forced:i.forceRehydrate===!0,rehydrating:!0});let a;try{let s;try{s=await i.buildRehydrationItems?.(o)}catch(u){i.log("kandan.reconnect_thread_rehydration_items_failed",{codex_thread_id:n,message:u instanceof Error?u.message:String(u)}),s=void 0}let d=s!==void 0&&s.length>0?[...s]:[{type:"agentMessage",text:await i.buildRehydrationText(o)}],l=await Kd(t,"thread/inject_items",{threadId:n,items:d});if("error"in l){if(i.forceRehydrate===!0&&PK(l.error.message))return await yE(t,n,r,"forced_inject_not_found",l.error.message,i.log);a=`thread/inject_items failed: ${l.error.message}`}else{let u=await Kd(t,"thread/resume",r);"error"in u&&(a=`rehydrated thread/resume failed: ${u.error.message}`)}}catch(s){a=s instanceof Error?s.message:String(s)}if(a!==void 0)throw i.log("kandan.reconnect_thread_rehydration_failed",{codex_thread_id:n,resume_failure:o,rehydration_failure:a}),new Error(`could not resume this thread's engine session (${o}) and rebuilding a fresh session from the thread transcript also failed (${a})`);return i.log("kandan.reconnect_thread_rehydrated",{codex_thread_id:n,resume_failure:o}),{mode:"rehydrated",resumeFailure:o}}var hE,wK,Ay,kK,tr,wr,Jd,gE,Ey,EK,PK,IK,OK,Py=q(()=>{"use strict";ET();xc();ey();Xg();eA();iA();iy();hc();ay();sA();Hu();uc();lA();ui();uA();WA();yy();Xc();Yc();ht();HA();Sy();VA();Nd();gc();ZA();xy();tE();nE();rE();aE();gy();Gd();dE();Pt();lE();fd();uE();Cy();cE();pE();mE();hE=100,wK=100,Ay=20,kK=255,tr=class extends Error{constructor(t){super(t),this.name="NativeModelCatalogInvalidResponseError"}},wr=e=>new tr(e),Jd=e=>e!==""&&e.length<=kK;gE=12e4;Ey=class extends Error{constructor(t,n){super(`Codex ${t} did not reply within ${n}ms (start request timed out)`),this.name="CodexStartRequestTimeoutError"}};EK=e=>/\bsession\b.+\bis archived\b/i.test(e),PK=e=>/^thread not found(?:\s*:|\b)/i.test(e.trim()),IK=e=>/\bno rollout found\b/i.test(e)||/\bsession not found\b[\s\S]*\brollout\b/i.test(e),OK=e=>/\balready has an active writer\b/i.test(e)});var vE=q(()=>{});var $K,ITe,SE=q(()=>{ii();Me();er();Tt();en();$K="LINZUMI_REMOTE_CODEX_HARNESS_CONFIG_B64",ITe=$K+" is required"});var qTe,wE=q(()=>{vE();Et();ii();Bt();Me();Jt();Ku();en();zc();SE();qTe=new RegExp("[\\x00-\\x1f\\x7f-\\x9f]")});var kE=q(()=>{wE()});var xE=q(()=>{zc()});var TE=q(()=>{"use strict"});function CE(e){return typeof e!="string"||e===""?e:qK.reduce((t,n)=>n.source.startsWith("\\beyJ")?t.replace(n,"<redacted>"):t.replace(n,"$1<redacted>"),e)}var qK,HTe,VTe,AE=q(()=>{"use strict";qK=[/(--token[=\s]+)\S+/gi,/(bearer\s+)[^\s,;"'\]\}]+/gi,/((?:access[_-]?token|api[_-]?key|auth[_-]?token|authorization|secret|password|refresh[_-]?token|session[_-]?token|jwt|token)["']?\s*[:=]\s*["']?)[^\s,;"'\]\}]+/gi,/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g];HTe=64*1024,VTe=16*1024});var EE=q(()=>{"use strict"});var PE=q(()=>{"use strict";ht()});var rF={};tD(rF,{AbortError:()=>En,DirectConnectError:()=>or,DirectConnectTransport:()=>_b,EXIT_REASONS:()=>L4,HOOK_EVENTS:()=>im,InMemorySessionStore:()=>h_,SYSTEM_PROMPT_DYNAMIC_BOUNDARY:()=>U4,createSdkMcpServer:()=>wie,deleteSession:()=>rle,filterEscalatingDefaultMode:()=>Gde,foldSessionSummary:()=>ZO,forkSession:()=>ile,getSessionInfo:()=>ele,getSessionMessages:()=>Yde,getSubagentMessages:()=>dle,importSessionToStore:()=>ole,listSessions:()=>Xde,listSubagents:()=>sle,parseDirectConnectUrl:()=>Tie,query:()=>Zde,renameSession:()=>tle,resolveSettings:()=>Jde,startup:()=>Qde,tagSession:()=>nle,tool:()=>Sie});import{createRequire as NK}from"node:module";import{execFile as S4}from"child_process";import{randomUUID as zb}from"crypto";import{createReadStream as w4,realpathSync as k4}from"fs";import{copyFile as x4,mkdir as Iy,readdir as T4,readFile as KO,rm as C4,writeFile as BO}from"fs/promises";import{createRequire as A4}from"module";import{homedir as p_,tmpdir as E4}from"os";import{dirname as OE,isAbsolute as WO,join as Un,relative as HO,resolve as Il,sep as Jb}from"path";import{createInterface as P4}from"readline";import{fileURLToPath as I4}from"url";import{setMaxListeners as O4}from"events";import{realpathSync as $4}from"fs";import{dirname as RE,resolve as Oy,sep as $E}from"path";import{spawn as N4}from"child_process";import{existsSync as F4}from"fs";import{createInterface as D4}from"readline";import{homedir as A6}from"os";import{join as E6}from"path";import{randomUUID as NH}from"crypto";import{join as hP}from"path";import{AsyncLocalStorage as FH}from"async_hooks";import{appendFile as DH,copyFile as LH,mkdir as UH,open as gP,readdir as yP,readFile as _P,stat as GH,unlink as zH,writeFile as zy}from"fs/promises";import{randomBytes as JH}from"crypto";import{chmod as KH,copyFile as BH,rename as WH,unlink as Jy,writeFile as HH}from"fs/promises";import{realpathSync as qP}from"fs";import{cwd as s8}from"process";import{randomUUID as M_}from"crypto";import{createHash as d8}from"crypto";import{appendFile as JP,mkdir as j8,rename as KP,stat as q8,symlink as N8,unlink as j_}from"fs/promises";import{dirname as q_,join as hv,resolve as F8}from"path";import*as xe from"fs";import{appendFile as B8,chmod as W8,copyFile as H8,link as V8,lstat as Z8,mkdir as Q8,open as BP,readdir as Y8,readFile as WP,readlink as X8,realpath as eZ,rename as tZ,rmdir as nZ,rm as rZ,stat as iZ,symlink as oZ,unlink as aZ}from"fs/promises";import*as Pn from"path";import{existsSync as JZ}from"fs";import{readFile as e7}from"fs/promises";import{once as nI}from"events";import{createWriteStream as t7}from"fs";import{open as u$,readdir as J_,realpath as n7,stat as r7}from"fs/promises";import{join as Ll}from"path";import{execFile as i7}from"child_process";import{promisify as o7}from"util";import{execFileSync as a7}from"child_process";import{lstatSync as s7}from"fs";import{join as d7}from"path";import{readdir as _v,stat as W7}from"fs/promises";import{basename as H7,join as bv}from"path";import{constants as aI}from"fs";import{open as rQ,readdir as b$,rm as sI,stat as iQ}from"fs/promises";import{join as as}from"path";import{randomUUID as bf}from"crypto";import{join as B_}from"path";import{readdir as yQ,readFile as dI}from"fs/promises";import{join as W_}from"path";import{createHash as wQ}from"crypto";import{userInfo as kQ}from"os";import{resolve as Aie}from"path";import{join as ds}from"path";import{dirname as Eie}from"path";import xt from"node:path";import rN from"node:os";import Sb from"node:process";import{join as Hie}from"path";import{readFile as Vie}from"fs/promises";import{release as lN}from"os";import{dirname as Voe,join as Qi,resolve as kl}from"path";import{join as rae}from"path";import{userInfo as gae}from"os";import{isAbsolute as rO}from"path";import{execFile as Tde}from"child_process";import{existsSync as Cde}from"fs";function GK(e){return this[e]}function BK(e,t){this[e]=KK.bind(null,t)}function m_(e=R4){let t=new AbortController;return O4(e,t.signal),t}function cs(e){return process.platform==="darwin"?e.normalize("NFC"):e}function Of(e){return/^[\\/]{2}/.test(e)}function xf(e){if(process.platform==="win32"||!e.startsWith("/"))return!1;let t=[];for(let n of e.split("/"))if(!(n===""||n===".")){if(n===".."){t.pop();continue}if(t.push(n),t.length===2&&t[0].toLowerCase()==="net")return!0}return!1}function Rf(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function VO(e){return e.startsWith("\\\\?\\UNC\\")?"\\\\"+e.slice(8):e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":"?e.slice(4):e}function M4(e){if(/^\\\\\?\\volume\{/i.test(e))return ME(e);let t=VO(e);return t!==e&&ME(t)?!0:Of(t)&&!Rf(t)}function ME(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function jE(e){try{return VO($4.native(e))}catch{return null}}function j4(e,t){let n=Oy(t).toLowerCase(),i=Oy(e).toLowerCase();if(RE(i)===n||i.startsWith(n+$E))return!0;let r=jE(t)?.toLowerCase();if(r==null)return!1;let o=jE(RE(Oy(e)))?.toLowerCase();return o==null?!0:o===r||o.startsWith(r+$E)}function rm(e,t,n){return new Promise((i,r)=>{if(t?.aborted){n?.throwOnAbort||n?.abortError?r(n.abortError?.()??Error("aborted")):i();return}let o=setTimeout((s,d,l)=>{s?.removeEventListener("abort",d),l()},e,t,a,i);function a(){clearTimeout(o),n?.throwOnAbort||n?.abortError?r(n.abortError?.()??Error("aborted")):i()}t?.addEventListener("abort",a,{once:!0}),n?.unref&&o.unref()})}function q4(e,t){e(Error(t))}function qo(e,t,n){let i,r=new Promise((o,a)=>{i=setTimeout(q4,t,a,n)});return Promise.race([e,r]).finally(()=>{i!==void 0&&clearTimeout(i)})}function Kb(e,t){if(e.type!=="user"||e.isMeta===!0||e.isCompactSummary===!0)return;let n=e.message;if(!n)return;let i=n.content,r=[];if(typeof i=="string")r.push(i);else if(Array.isArray(i)){for(let o of i)if(!(!o||typeof o!="object")){if(o.type==="tool_result")return;o.type==="text"&&typeof o.text=="string"&&r.push(o.text)}}for(let o of r){let a=o.replaceAll(`
158
- `," ").trim();if(!a)continue;let s=z4.exec(a);if(s){t.commandFallback||(t.commandFallback=s[1]);continue}let d=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(a);if(d)return`! ${d[1].trim()}`;if(!G4.test(a))return a.length>200&&(a=a.slice(0,200).trim()+"\u2026"),a}}function ZO(e,t,n,i){let r=i?.mtime??e?.mtime??0,o=e!==void 0?{sessionId:e.sessionId,mtime:r,data:{...e.data}}:{sessionId:t.sessionId,mtime:r,data:{}},a=o.data;for(let s of n){let d=W4(s.timestamp);if(a.isSidechain===void 0&&(a.isSidechain=s.isSidechain===!0),a.createdAt===void 0&&d!==void 0&&(a.createdAt=d),a.cwd===void 0){let l=s.cwd;typeof l=="string"&&l&&(a.cwd=l)}H4(a,s);for(let[l,u]of Object.entries(J4)){let c=s[l];typeof c=="string"&&(a[u]=c)}if(s.type==="tag"){let l=s.tag;typeof l=="string"&&l?a.tag=l:delete a.tag}if(s.type==="relocated"){let l=s.relocatedCwd;typeof l=="string"&&l&&(a.cwd=l)}}return o}function K4(e,t){let n=e.data;if(n.isSidechain===!0)return null;let i=Fi(n.firstPromptLocked===!0?n.firstPrompt:n.commandFallback)||void 0,r=Fi(n.customTitle)||Fi(n.aiTitle)||void 0,o=r||Fi(n.lastPrompt)||Fi(n.summaryHint)||i;return o?{sessionId:e.sessionId,summary:o,lastModified:e.mtime,fileSize:void 0,customTitle:r,firstPrompt:i,gitBranch:Fi(n.gitBranch)||void 0,cwd:Fi(n.cwd)||t||void 0,tag:Fi(n.tag)||void 0,createdAt:B4(n.createdAt)}:null}function Fi(e){return typeof e=="string"?e:void 0}function B4(e){return typeof e=="number"?e:void 0}function W4(e){if(typeof e!="string")return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function H4(e,t){if(e.firstPromptLocked)return;let n={commandFallback:e.commandFallback??""},i=Kb(t,n);n.commandFallback&&!e.commandFallback&&(e.commandFallback=n.commandFallback),i!==void 0&&(e.firstPrompt=i,e.firstPromptLocked=!0)}function QO(){return process.versions.bun!==void 0}function cn(e){if(!e)return!1;if(typeof e=="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function lu(){let e=new Set;return{subscribe(t){let n=V4(t);return e.add(n),()=>{e.delete(n)}},emit(...t){let n;for(let i of e)try{i(...t)}catch(r){(n??=[]).push(r)}if(n)throw n.length===1?n[0]:AggregateError(n,"Signal listener(s) threw")},clear(){e.clear()}}}function nW(e){var t=eW.call(e,Bd),n=e[Bd];try{e[Bd]=void 0;var i=!0}catch{}var r=tW.call(e);return i&&(t?e[Bd]=n:delete e[Bd]),r}function aW(e){return oW.call(e)}function uW(e){return e==null?e===void 0?lW:dW:NE&&NE in Object(e)?rW(e):sW(e)}function cW(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function gW(e){if(!Qr(e))return!1;var t=Ho(e);return t==pW||t==mW||t==fW||t==hW}function _W(e){return!!FE&&FE in e}function wW(e){if(e!=null){try{return SW.call(e)}catch{}try{return e+""}catch{}}return""}function IW(e){if(!Qr(e)||bW(e))return!1;var t=Bb(e)?PW:xW;return t.test(Vo(e))}function RW(e,t){return e?.[t]}function MW(e,t){var n=$W(e,t);return OW(n)?n:void 0}function qW(){this.__data__=Ol?Ol(null):{},this.size=0}function FW(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function zW(e){var t=this.__data__;if(Ol){var n=t[e];return n===LW?void 0:n}return GW.call(t,e)?t[e]:void 0}function WW(e){var t=this.__data__;return Ol?t[e]!==void 0:BW.call(t,e)}function ZW(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ol&&t===void 0?VW:t,this}function js(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function YW(){this.__data__=[],this.size=0}function e6(e,t){return e===t||e!==e&&t!==t}function t6(e,t){for(var n=e.length;n--;)if(uu(e[n][0],t))return n;return-1}function i6(e){var t=this.__data__,n=om(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():r6.call(t,n,1),--this.size,!0}function a6(e){var t=this.__data__,n=om(t,e);return n<0?void 0:t[n][1]}function d6(e){return om(this.__data__,e)>-1}function u6(e,t){var n=this.__data__,i=om(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}function qs(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function p6(){this.size=0,this.__data__={hash:new DE,map:new(Rl||am),string:new DE}}function h6(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function y6(e,t){var n=e.__data__;return g6(t)?n[typeof t=="string"?"string":"hash"]:n.map}function _6(e){var t=sm(this,e).delete(e);return this.size-=t?1:0,t}function v6(e){return sm(this,e).get(e)}function w6(e){return sm(this,e).has(e)}function x6(e,t){var n=sm(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}function Ns(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Wb(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(C6);var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=e.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(Wb.Cache||dm),n}function ue(e,t,n,i,r){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!r)throw TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n}function U(e,t,n,i){if(n==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)}function $l(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}function __(e){return typeof e!="object"?{}:e??{}}function UE(e){if(!e)return!0;for(let t in e)return!1;return!0}function O6(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function j6(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function N6(){if(typeof navigator>"u"||!navigator)return null;let e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:t,pattern:n}of e){let i=n.exec(navigator.userAgent);if(i){let r=i[1]||0,o=i[2]||0,a=i[3]||0;return{browser:t,version:`${r}.${o}.${a}`}}}return null}function F6(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function nR(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function rR(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return nR({start(){},async pull(n){let{done:i,value:r}=await t.next();i?n.close():n.enqueue(r)},async cancel(){await t.return?.()}})}function Vb(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let n=await t.read();return n?.done&&t.releaseLock(),n}catch(n){throw t.releaseLock(),n}},async return(){let n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function D6(e){if(e===null||typeof e!="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}function U6(e){return Object.entries(e).filter(([t,n])=>typeof n<"u").map(([t,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(t)}=`;throw new ve(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function oR(e){if(!e)return;let t;try{t=new URL(e)}catch(i){throw new Qe(`Invalid token endpoint base URL "${e}": ${i}`)}if(t.protocol==="https:")return;let n=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(!(t.protocol==="http:"&&(n==="localhost"||n==="127.0.0.1"||n==="::1")))throw new Qe(`Refusing to send credential over non-https token endpoint "${e}"`)}async function aR(e,t){let n=await H6(e),i;try{i=JSON.parse(n)}catch{throw new Qe(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,ar(n),t)}if(!i.access_token)throw new Qe(`Token endpoint response missing access_token: ${JSON.stringify(ar(i))}`,e.status,ar(i),t);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new Qe(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,e.status,ar(i),t);return i}function ar(e){if(e==null)return e;if(typeof e=="string"){let t;try{t=JSON.parse(e)}catch{return e.length<=$y?e:e.slice(0,$y)+`... <${e.length-$y} more chars>`}return JSON.stringify(ar(t))}if(typeof e=="object"&&!Array.isArray(e)){let t={};for(let[n,i]of Object.entries(e))W6.has(n)&&(t[n]=i);return t}return null}async function sR(e,t=n=>console.warn(`anthropic-sdk: ${n}`)){if(typeof process>"u"||process.platform==="win32")return;let n=await import("node:fs"),i=e,r;try{i=await n.promises.realpath(e),r=await n.promises.stat(i)}catch{return}let o=r.mode&511;if(o&18)throw new Qe(`Credentials file at ${i} is group/world-writable (mode 0o${o.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${i}\`.`);if(o&36)throw new Qe(`Credentials file at ${i} is group/world-readable (mode 0o${o.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);typeof process.getuid=="function"&&r.uid!==process.getuid()&&t(`credentials file at ${i} is owned by uid ${r.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function dR(e,t){let n=await import("node:fs"),i=(await import("node:path")).dirname(e);await n.promises.mkdir(i,{recursive:!0,mode:448});let r=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let o=await n.promises.open(r,"w",384);try{await o.writeFile(JSON.stringify(t,null,2)),await o.sync()}finally{await o.close()}await n.promises.rename(r,e)}catch(o){throw await n.promises.unlink(r).catch(()=>{}),o}try{let o=await n.promises.open(i,"r");try{await o.sync()}finally{await o.close()}}catch{}}async function H6(e){if(!e.body)return"";let t=e.body.getReader(),n=[],i=0;for(;;){let{done:o,value:a}=await t.read();if(o)break;if(i+a.length>KE){let s=KE-i;s>0&&n.push(a.subarray(0,s)),await t.cancel();break}n.push(a),i+=a.length}let r;if(n.length===1)r=n[0];else{r=new Uint8Array(n.reduce((a,s)=>a+s.length,0));let o=0;for(let a of n)r.set(a,o),o+=a.length}return new TextDecoder("utf-8").decode(r)}function No(){return Math.floor(Date.now()/1e3)}function V6(e){let t=0;for(let r of e)t+=r.length;let n=new Uint8Array(t),i=0;for(let r of e)n.set(r,i),i+=r.length;return n}function Qb(e){let t;return(BE??(t=new globalThis.TextEncoder,BE=t.encode.bind(t)))(e)}function HE(e){let t;return(WE??(t=new globalThis.TextDecoder,WE=t.decode.bind(t)))(e)}function ml(){}function tf(e,t,n){return!t||zf[e]>zf[n]?ml:t[e].bind(t)}function Vt(e){let t=e.logger,n=e.logLevel??"off";if(!t)return Z6;let i=ZE.get(t);if(i&&i[0]===n)return i[1];let r={error:tf("error",t,n),warn:tf("warn",t,n),info:tf("info",t,n),debug:tf("debug",t,n)};return ZE.set(t,[n,r]),r}function uR(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!Q6.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}function QE(e){if(!e)throw new ve("Identity token file path is empty");return async()=>{let t=await import("node:fs"),n;try{n=await t.promises.readFile(e,"utf-8")}catch(r){throw new ve(`Failed to read identity token file at ${e}: ${r}`)}let i=n.trim();if(!i)throw new ve(`Identity token file at ${e} is empty`);return i}}function tH(e){if(!e)throw new ve("Identity token value is empty");return()=>e}function nH(e){return async()=>{oR(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new Qe(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let n={grant_type:G6,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};e.serviceAccountId&&(n.service_account_id=e.serviceAccountId),e.workspaceId&&(n.workspace_id=e.workspaceId);let i=`${e.baseURL}${iR}`,r;try{r=await e.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${Gf},${J6}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Bi} oidcFederationProvider`},body:JSON.stringify(n)})}catch(d){throw new Qe(`Failed to reach token endpoint ${i}: ${d}`)}let o=r.headers.get("Request-Id");if(!r.ok){let d=await r.text().catch(()=>""),l=ar(d),u="";throw r.status===401&&(u=` Ensure your federation rule matches your identity token. ${e.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`),new Qe(`Token exchange failed with status ${r.status}${o?` (request-id ${o})`:""}: ${l}${u}`,r.status,l,o)}let a=await aR(r,o),s=Number(a.expires_in);if(!Number.isFinite(s))throw new Qe(`Token endpoint response missing required fields: ${JSON.stringify(ar(a))}`,r.status,ar(a),o);return{token:a.access_token,expiresAt:No()+s}}}function rH(e){return async t=>{let n=await import("node:fs");await sR(e.credentialsPath,e.onSafetyWarning);let i;try{i=await n.promises.readFile(e.credentialsPath,"utf-8")}catch(_){throw new Qe(`Credentials file not found at ${e.credentialsPath}: ${_}`)}let r;try{r=JSON.parse(i)}catch(_){throw new Qe(`Credentials file at ${e.credentialsPath} is not valid JSON: ${_}`)}let o=r.access_token;if(!o)throw new Qe(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let a=r.expires_at;if(!t?.forceRefresh&&(a==null||No()<a-Zb))return{token:o,expiresAt:a??null};let s=r.refresh_token;if(!e.clientId||!s)throw new Qe(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${s?"set":"empty"})`);oR(e.baseURL);let d={grant_type:z6,refresh_token:s,client_id:e.clientId},l=`${e.baseURL}${iR}`,u;try{u=await e.fetch(l,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":Gf,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Bi} userOAuthProvider`},body:JSON.stringify(d)})}catch(_){throw new Qe(`User OAuth refresh failed to reach token endpoint: ${_}`)}let c=u.headers.get("Request-Id");if(!u.ok){let _=await u.text().catch(()=>"");throw new Qe(`User OAuth refresh failed (HTTP ${u.status}): ${ar(_)}`,u.status,ar(_),c)}let p=await aR(u,c),f=Number(p.expires_in);if(!Number.isFinite(f))throw new Qe(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(ar(p))}`,u.status,ar(p),c);let h=No()+f,g=p.refresh_token||s;return await dR(e.credentialsPath,{...r,version:lR,type:"oauth_token",access_token:p.access_token,expires_at:h,refresh_token:g}),{token:p.access_token,expiresAt:h}}}function fR(e,t){let n=e.authentication.credentials_path??null,i=(e.base_url||t.baseURL).replace(/\/+$/,""),r=oH(e,n,i,t),o={};return e.workspace_id&&e.authentication.type==="user_oauth"&&(o["anthropic-workspace-id"]=e.workspace_id),{provider:r,extraHeaders:o,baseURL:e.base_url||void 0}}async function iH(e,t){let n=await Y6(t);if(!n)return null;let{config:i,fromFile:r}=n,o=i.authentication.credentials_path||!r?i:{...i,authentication:{...i.authentication,credentials_path:await X6(i,t)??void 0}};return fR(o,e)}function oH(e,t,n,i){switch(e.authentication.type){case"oidc_federation":{let r=e.authentication,o=aH(r);if(!o)throw new Qe("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!r.federation_rule_id)throw new Qe("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!e.organization_id)throw new Qe("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let a=nH({identityTokenProvider:o,federationRuleId:r.federation_rule_id,organizationId:e.organization_id,serviceAccountId:r.service_account_id,workspaceId:e.workspace_id,baseURL:n,fetch:i.fetch,userAgent:i.userAgent});return t?sH(a,t,i.onCacheWriteError,i.onSafetyWarning):a}case"user_oauth":{if(!t)throw new Qe("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return rH({credentialsPath:t,clientId:e.authentication.client_id,baseURL:n,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let r=e.authentication.type;throw new Qe(`authentication.type "${r}" is not a known authentication type`)}}}function aH(e){if(e.identity_token){let i=e.identity_token.source;if(i!=="file")throw new Qe(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new Qe('identity_token.source "file" requires a non-empty path');return QE(e.identity_token.path)}let t=Ze("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return QE(t);let n=Ze("ANTHROPIC_IDENTITY_TOKEN");return n?tH(n):null}function sH(e,t,n,i){return async r=>{let o=await import("node:fs");await sR(t,i);let a;try{let d=await o.promises.readFile(t,"utf-8");a=JSON.parse(d);let l=a?.access_token;if(l&&!r?.forceRefresh){let u=a?.expires_at;if(u==null||No()<u-Zb)return{token:l,expiresAt:u??null}}}catch(d){d?.code!=="ENOENT"&&!(d instanceof SyntaxError)&&n?.(d)}let s=await e(r);try{await dR(t,{...a??{},version:lR,type:"oauth_token",access_token:s.token,expires_at:s.expiresAt})}catch(d){n?.(d)}return s}}function dH(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function lH(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}async function*uH(e,t){if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ve("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ve("Attempted to iterate over a response with no body");let n=new v_,i=new Lo,r=Vb(e.body);for await(let o of cH(r))for(let a of i.decode(o)){let s=n.decode(a);s&&(yield s)}for(let o of i.flush()){let a=n.decode(o);a&&(yield a)}}async function*cH(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let i=n instanceof ArrayBuffer?new Uint8Array(n):typeof n=="string"?Qb(n):n,r=new Uint8Array(t.length+i.length);r.set(t),r.set(i,t.length),t=r;let o;for(;(o=lH(t))!==-1;)yield t.slice(0,o),t=t.slice(o)}t.length>0&&(yield t)}function fH(e,t){let n=e.indexOf(t);return n!==-1?[e.substring(0,n),t,e.substring(n+t.length)]:[e,"",""]}async function pR(e,t){let{response:n,requestLogID:i,retryOfRequestLogID:r,startTime:o}=t,a=await(async()=>{if(t.options.stream)return Vt(e).debug("response",n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller):Uo.fromSSEResponse(n,t.controller);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let s=n.headers.get("content-type")?.split(";")[0]?.trim();if(s?.includes("application/json")||s?.endsWith("+json")){if(n.headers.get("content-length")==="0")return;let d=await n.json();return mR(d,n)}return await n.text()})();return Vt(e).debug(`[${i}] response parsed`,$o({retryOfRequestLogID:r,url:n.url,status:n.status,body:a,durationMs:Date.now()-o})),a}function mR(e,t){return!e||typeof e!="object"||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get("request-id"),enumerable:!1})}function os(e,t,n){return hR(),new File(e,t??"unknown_file",n)}function Tf(e,t){let n=typeof e=="object"&&e!==null&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"";return t?n.split(/[\\/]/).pop()||void 0:n}function pH(e){let t=typeof e=="function"?e:e.fetch,n=YE.get(t);if(n)return n;let i=(async()=>{try{let r="Response"in t?t.Response:(await t("data:,")).constructor,o=new FormData;return o.toString()!==await new r(o).text()}catch{return!0}})();return YE.set(t,i),i}async function _H(e,t,n){if(hR(),e=await e,t||(t=Tf(e,!0)),gH(e))return e instanceof File&&t==null&&n==null?e:os([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...n});if(yH(e)){let r=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),os(await k_(r),t,n)}let i=await k_(e);if(!n?.type){let r=i.find(o=>typeof o=="object"&&"type"in o&&o.type);typeof r=="string"&&(n={...n,type:r})}return os(i,t,n)}async function k_(e){let t=[];if(typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(yR(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(gR(e))for await(let n of e)t.push(...await k_(n));else{let n=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${n?`; constructor: ${n}`:""}${bH(e)}`)}return t}function bH(e){return typeof e!="object"||e===null?"":`; props: [${Object.getOwnPropertyNames(e).map(t=>`"${t}"`).join(", ")}]`}function*vH(e){if(!e)return;if(_R in e){let{values:i,nulls:r}=e;yield*i.entries();for(let o of r)yield[o,null];return}let t=!1,n;e instanceof Headers?n=e.entries():LE(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let i of n){let r=i[0];if(typeof r!="string")throw TypeError("expected header name to be a string");let o=LE(i[1])?i[1]:[i[1]],a=!1;for(let s of o)s!==void 0&&(t&&!a&&(a=!0,yield[r,null]),yield[r,s])}}function bR(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}function Cf(e){return typeof e=="object"&&e!==null&&xl in e}function vR(e,t){let n=new Set;if(e)for(let i of e)Cf(i)&&n.add(i[xl]);if(t){for(let i of t)if(Cf(i)&&n.add(i[xl]),Array.isArray(i.content))for(let r of i.content)Cf(r)&&n.add(r[xl])}return Array.from(n)}function SR(e,t){let n=vR(e,t);return n.length===0?{}:{"x-stainless-helper":n.join(", ")}}function wH(e){return Cf(e)?{"x-stainless-helper":e[xl]}:{}}function kR(e){return e?.output_format??e?.output_config?.format}function eP(e,t,n){let i=kR(t);return!t||!("parse"in(i??{}))?{...e,content:e.content.map(r=>{if(r.type==="text"){let o=Object.defineProperty({...r},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(o,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return r}),parsed_output:null}:xR(e,t,n)}function xR(e,t,n){let i=null,r=e.content.map(o=>{if(o.type==="text"){let a=kH(t,o.text);i===null&&(i=a);let s=Object.defineProperty({...o},"parsed_output",{value:a,enumerable:!1});return Object.defineProperty(s,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),a},enumerable:!1})}return o});return{...e,content:r,parsed_output:i}}function kH(e,t){let n=kR(e);if(n?.type!=="json_schema")return null;try{return"parse"in n?n.parse(t):JSON.parse(t)}catch(i){throw new ve(`Failed to parse structured output: ${i}`)}}function iP(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}function aP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}async function PH(e,t=e.messages.at(-1),n){if(!t||t.role!=="assistant"||!t.content||typeof t.content=="string")return null;let i=t.content.filter(r=>r.type==="tool_use");return i.length===0?null:{role:"user",content:await Promise.all(i.map(async r=>{let o=e.tools.find(a=>("name"in a?a.name:a.mcp_server_name)===r.name);if(!o||!("run"in o))return{type:"tool_result",tool_use_id:r.id,content:`Error: Tool '${r.name}' not found`,is_error:!0};try{let a=r.input;"parse"in o&&o.parse&&(a=o.parse(a));let s=await o.run(a,{toolUseBlock:r,signal:n?.signal});return{type:"tool_result",tool_use_id:r.id,content:s}}catch(a){return{type:"tool_result",tool_use_id:r.id,content:a instanceof tp?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}function dP(e){if(!e.output_format)return e;if(e.output_config?.format)throw new ve("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:t,...n}=e;return{...n,output_config:{...e.output_config,format:t}}}function CR(e){return e?.output_config?.format}function lP(e,t,n){let i=CR(t);return!t||!("parse"in(i??{}))?{...e,content:e.content.map(r=>r.type==="text"?Object.defineProperty({...r},"parsed_output",{value:null,enumerable:!1}):r),parsed_output:null}:AR(e,t,n)}function AR(e,t,n){let i=null,r=e.content.map(o=>{if(o.type==="text"){let a=OH(t,o.text);return i===null&&(i=a),Object.defineProperty({...o},"parsed_output",{value:a,enumerable:!1})}return o});return{...e,content:r,parsed_output:i}}function OH(e,t){let n=CR(e);if(n?.type!=="json_schema")return null;try{return"parse"in n?n.parse(t):JSON.parse(t)}catch(i){throw new ve(`Failed to parse structured output: ${i}`)}}function pP(e){return e.type==="tool_use"||e.type==="server_tool_use"}function lm(e){return e}function cu(e){return e instanceof Error?e:Error(String(e))}function Ef(e){return e instanceof Error?e.message:String(e)}function yn(e){if(e&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return e.code}function Ds(e){return yn(e)==="ENOENT"}function PR(e){return yn(e)==="EISDIR"}function qH(e){let t=yn(e);return t==="ENOENT"||t==="EACCES"||t==="EPERM"||t==="ENOTDIR"||t==="ELOOP"||t==="ENAMETOOLONG"||t==="EROFS"}function XH(e,t){if(process.platform!=="win32")return!1;let n=yn(e);return n!==void 0&&ZH.has(n)&&t<QH-1}async function eV(e,t,n=WH){let i=!1;for(let r=0;;r++)try{return await n(e,t),i}catch(o){if(XH(o,r)){i=!0,await rm(YH);continue}throw o}}async function nV(e,t,n){let i=`${e}.tmp.${JH(4).toString("hex")}`;try{await HH(i,t,{encoding:"utf8",mode:n});try{await eV(i,e)}catch(r){let o=yn(r);if(o!==void 0&&VH.has(o)){try{await BH(i,e),n!==void 0&&await KH(e,n).catch(()=>{})}catch(a){throw tV.has(yn(a)??"")&&await Jy(e).catch(()=>{}),a}await Jy(i).catch(()=>{})}else throw r}}catch(r){throw await Jy(i).catch(()=>{}),r}}function Ky(e,t,n){if(!Number.isInteger(n)||n<0)throw RangeError(`${e}: ${t} must be a non-negative integer, got ${n}`)}async function bP(e,t,n){if(n===0)return Buffer.alloc(0);let i=Buffer.alloc(n),r=0;for(;r<n;){let{bytesRead:o}=await e.read(i,r,n-r,t+r);if(o===0)break;r+=o}return r===n?i:Buffer.from(i.subarray(0,r))}function up(){return rV.getStore()??new E_}function IR(){if(Wa)return Wa;if(!cn(process.env.DEBUG_CLAUDE_AGENT_SDK))return Fo=null,Wa=Promise.resolve(),Wa;let e=hP(Fs(),"debug");return Fo=hP(e,`sdk-${NH()}.txt`),process.stderr.write(`SDK debug logs: ${Fo}
159
- `),Wa=up().mkdir(e).catch(()=>{}),Wa}function iV(){return IR(),Fo??null}function ir(e){if(Fo===null)return;let t=`${new Date().toISOString()} ${e}
160
- `;IR().then(()=>{Fo&&up().append(Fo,t).catch(()=>{})})}function oV(){this.__data__=new am,this.size=0}function sV(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function lV(e){return this.__data__.get(e)}function cV(e){return this.__data__.has(e)}function mV(e,t){var n=this.__data__;if(n instanceof am){var i=n.__data__;if(!Rl||i.length<pV-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new dm(i)}return n.set(e,t),this.size=n.size,this}function Ls(e){var t=this.__data__=new am(e);this.size=t.size}function yV(e,t,n){t=="__proto__"&&cp?cp(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function vV(e,t,n){var i=e[t];(!(bV.call(e,t)&&uu(i,n))||n===void 0&&!(t in e))&&tv(e,t,n)}function SV(e,t,n,i){var r=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],d=i?i(n[s],e[s],s,n,e):void 0;d===void 0&&(d=e[s]),r?tv(n,s,d):OR(n,s,d)}return n}function kV(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}function TV(e){return e!=null&&typeof e=="object"}function AV(e){return Yi(e)&&Ho(e)==CV}function RV(){return!1}function DV(e,t){var n=typeof e;return t=t??NV,!!t&&(n=="number"||n!="symbol"&&FV.test(e))&&e>-1&&e%1==0&&e<t}function UV(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=LV}function f9(e){return Yi(e)&&nv(e.length)&&!!at[Ho(e)]}function m9(e){return function(t){return e(t)}}function S9(e,t){var n=ur(e),i=!n&&Fl(e),r=!n&&!i&&Dl(e),o=!n&&!i&&!r&&rv(e),a=n||i||r||o,s=a?xV(e.length,String):[],d=s.length;for(var l in e)(t||v9.call(e,l))&&!(a&&(l=="length"||r&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||um(l,d)))&&s.push(l);return s}function k9(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||w9;return e===n}function x9(e,t){return function(n){return e(t(n))}}function P9(e){if(!iv(e))return C9(e);var t=[];for(var n in Object(e))E9.call(e,n)&&n!="constructor"&&t.push(n);return t}function O9(e){return e!=null&&nv(e.length)&&!Bb(e)}function R9(e){return cm(e)?jR(e):I9(e)}function $9(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function N9(e){if(!Qr(e))return M9(e);var t=iv(e),n=[];for(var i in e)i=="constructor"&&(t||!q9.call(e,i))||n.push(i);return n}function D9(e){return cm(e)?jR(e,!0):F9(e)}function U9(e,t){if(t)return e.slice();var n=e.length,i=CP?CP(n):new e.constructor(n);return e.copy(i),i}function G9(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}function J9(e,t){for(var n=-1,i=e==null?0:e.length,r=0,o=[];++n<i;){var a=e[n];t(a,n,e)&&(o[r++]=a)}return o}function B9(){return[]}function Z9(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e}function t3(e,t,n){var i=t(e);return ur(e)?i:av(i,n(e))}function n3(e){return GR(e,NR,UR)}function r3(e){return GR(e,ov,e3)}function g3(e){var t=new e.constructor(e.byteLength);return new fp(t).set(new fp(e)),t}function _3(e,t){var n=t?y3(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function w3(e){return typeof e.constructor=="function"&&!iv(e)?S3(sv(e)):{}}function T3(e){return this.__data__.set(e,x3),this}function A3(e){return this.__data__.has(e)}function pp(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new dm;++t<n;)this.add(e[t])}function I3(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function R3(e,t){return e.has(t)}function q3(e,t,n,i,r,o){var a=n&M3,s=e.length,d=t.length;if(s!=d&&!(a&&d>s))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var c=-1,p=!0,f=n&j3?new P3:void 0;for(o.set(e,t),o.set(t,e);++c<s;){var h=e[c],g=t[c];if(i)var _=a?i(g,h,c,t,e,o):i(h,g,c,e,t,o);if(_!==void 0){if(_)continue;p=!1;break}if(f){if(!O3(t,function(y,b){if(!$3(f,b)&&(h===y||r(h,y,n,i,o)))return f.push(b)})){p=!1;break}}else if(!(h===g||r(h,g,n,i,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function N3(e){var t=-1,n=Array(e.size);return e.forEach(function(i,r){n[++t]=[r,i]}),n}function D3(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}function e5(e,t,n,i,r,o,a){switch(n){case X3:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Y3:return!(e.byteLength!=t.byteLength||!o(new fp(e),new fp(t)));case z3:case J3:case W3:return uu(+e,+t);case K3:return e.name==t.name&&e.message==t.message;case H3:case Z3:return e==t+"";case B3:var s=F3;case V3:var d=i&U3;if(s||(s=L3),e.size!=t.size&&!d)return!1;var l=a.get(e);if(l)return l==t;i|=G3,a.set(e,t);var u=zR(s(e),s(t),i,r,o,a);return a.delete(e),u;case Q3:if(Wy)return Wy.call(e)==Wy.call(t)}return!1}function o5(e,t,n,i,r,o){var a=n&n5,s=EP(e),d=s.length,l=EP(t),u=l.length;if(d!=u&&!a)return!1;for(var c=d;c--;){var p=s[c];if(!(a?p in t:i5.call(t,p)))return!1}var f=o.get(e),h=o.get(t);if(f&&h)return f==t&&h==e;var g=!0;o.set(e,t),o.set(t,e);for(var _=a;++c<d;){p=s[c];var y=e[p],b=t[p];if(i)var v=a?i(b,y,p,t,e,o):i(y,b,p,e,t,o);if(!(v===void 0?y===b||r(y,b,n,i,o):v)){g=!1;break}_||(_=p=="constructor")}if(g&&!_){var w=e.constructor,A=t.constructor;w!=A&&"constructor"in e&&"constructor"in t&&!(typeof w=="function"&&w instanceof w&&typeof A=="function"&&A instanceof A)&&(g=!1)}return o.delete(e),o.delete(t),g}function l5(e,t,n,i,r,o){var a=ur(e),s=ur(t),d=a?DP:MP(e),l=s?DP:MP(t);d=d==FP?yf:d,l=l==FP?yf:l;var u=d==yf,c=l==yf,p=d==l;if(p&&Dl(e)){if(!Dl(t))return!1;a=!0,u=!1}if(p&&!u)return o||(o=new Tl),a||rv(e)?zR(e,t,n,i,r,o):t5(e,t,d,n,i,r,o);if(!(n&s5)){var f=u&&LP.call(e,"__wrapped__"),h=c&&LP.call(t,"__wrapped__");if(f||h){var g=f?e.value():e,_=h?t.value():t;return o||(o=new Tl),r(g,_,n,i,o)}}return p?(o||(o=new Tl),a5(e,t,n,i,r,o)):!1}function JR(e,t,n,i,r){return e===t?!0:e==null||t==null||!Yi(e)&&!Yi(t)?e!==e&&t!==t:u5(e,t,n,i,JR,r)}function p5(e,t,n,i){var r=n.length,o=r,a=!i;if(e==null)return!o;for(e=Object(e);r--;){var s=n[r];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++r<o;){s=n[r];var d=s[0],l=e[d],u=s[1];if(a&&s[2]){if(l===void 0&&!(d in e))return!1}else{var c=new Tl;if(i)var p=i(l,u,d,e,t,c);if(!(p===void 0?KR(u,l,c5|f5,i,c):p))return!1}}return!0}function h5(e){return e===e&&!Qr(e)}function g5(e){for(var t=NR(e),n=t.length;n--;){var i=t[n],r=e[i];t[n]=[i,r,BR(r)]}return t}function _5(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function b5(e){var t=y5(e);return t.length==1&&t[0][2]?WR(t[0][0],t[0][1]):function(n){return n===e||m5(n,e,t)}}function w5(e){return typeof e=="symbol"||Yi(e)&&Ho(e)==S5}function T5(e,t){if(ur(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||dv(e)?!0:x5.test(e)||!k5.test(e)||t!=null&&e in Object(t)}function A5(e){var t=rn(e,function(i){return n.size===C5&&n.clear(),i}),n=t.cache;return t}function $5(e,t){for(var n=-1,i=e==null?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}function VR(e){if(typeof e=="string")return e;if(ur(e))return HR(e,VR)+"";if(dv(e))return GP?GP.call(e):"";var t=e+"";return t=="0"&&1/e==-M5?"-0":t}function q5(e){return e==null?"":j5(e)}function F5(e,t){return ur(e)?e:lv(e,t)?[e]:R5(N5(e))}function L5(e){if(typeof e=="string"||dv(e))return e;var t=e+"";return t=="0"&&1/e==-D5?"-0":t}function U5(e,t){t=fm(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[fu(t[n++])];return n&&n==i?e:void 0}function G5(e,t,n){var i=e==null?void 0:uv(e,t);return i===void 0?n:i}function J5(e,t){return e!=null&&t in Object(e)}function B5(e,t,n){t=fm(t,e);for(var i=-1,r=t.length,o=!1;++i<r;){var a=fu(t[i]);if(!(o=e!=null&&n(e,a)))break;e=e[a]}return o||++i!=r?o:(r=e==null?0:e.length,!!r&&nv(r)&&um(a,r)&&(ur(e)||Fl(e)))}function H5(e,t){return e!=null&&W5(e,t,K5)}function Q5(e,t){return lv(e)&&BR(t)?WR(fu(e),t):function(n){var i=z5(n,e);return i===void 0&&i===t?ZR(n,e):KR(t,i,V5|Z5)}}function X5(e){return e}function e8(e){return function(t){return t?.[e]}}function n8(e){return function(t){return uv(t,e)}}function i8(e){return lv(e)?t8(fu(e)):r8(e)}function a8(e){return typeof e=="function"?e:e==null?cv:typeof e=="object"?ur(e)?Y5(e[0],e[1]):v5(e):o8(e)}function l8(e,t){let n=Buffer.from(t.replace(/-/g,""),"hex"),i=d8("sha1").update(n).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let r=i.subarray(0,16).toString("hex");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function c8(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?l8(e,u8):null}function f8(){return fv}function p8(e){fv=e}function m8(e){return mp.has(e)?mp.get(e):void 0}function h8(e,t){mp.set(e,t)}function S8(e){return pv.get(e)}function w8(e,t){pv.set(e,t)}function mv(){fv=null,mp.clear(),pv.clear(),v8=void 0,g8=void 0,y8=void 0,_8=void 0,b8=void 0}function x8(){return k8}function T8(){return{sent:new Set,rejected:new Set}}function A8(){let e="";if(typeof process<"u"&&typeof process.cwd=="function"&&typeof qP=="function"){let t=s8();try{e=zP(qP(t))}catch{e=zP(t)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),sessionLogicalStartTime:void 0,lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],initialMainLoopModel:void 0,resolvedOrgDefault:void 0,modelStrings:null,isInteractive:!1,thinkingDisplayExplicit:!1,permissionPromptToolName:void 0,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,startupPolicySnapshot:void 0,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:c8()??M_(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:{direct:null,proxied:null},foundryDeploymentCapabilities:new Map,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,sessionCreatedTeams:new Set,surfacedHookSpawnFailures:new Set,bareMcpServerMatchersWarned:new Set,inheritedTeamName:void 0,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,fableCreditsRequired:!1,fableConsentSessionFallback:!1,fableBridgeDialogTimedOut:!1,fableConsentDialogInteracted:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:C8,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,sessionApprovedMcpServers:[],activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:T8(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}function XR(){return P8()?.sessionId??E8.sessionId}function zP(e){return process.platform==="darwin"?e.normalize("NFC"):e}function D8({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:i=1/0,immediateMode:r=!1}){let o=[],a=0,s=null,d=null;function l(){s&&(clearTimeout(s),s=null)}function u(h){try{e(h)}catch{}}function c(){d&&(u(d.join("")),d=null),o.length!==0&&(u(o.join("")),o=[],a=0,l())}function p(){s||(s=setTimeout(c,t))}function f(){if(d){d.push(...o),o=[],a=0,l();return}let h=o;o=[],a=0,l(),d=h,setImmediate(()=>{let g=d;d=null,g&&u(g.join(""))})}return{write(h){if(r){u(h);return}o.push(h),a+=h.length,p(),(o.length>=n||a>=i)&&f()},flush:c,dispose(){c()}}}function L8(e){return typeof e=="function"?e:Symbol.asyncDispose in e?()=>e[Symbol.asyncDispose]():()=>e[Symbol.dispose]()}function e$(e){return U8.register(e)}function z8(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push("mcp"),t.push(n[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);o&&o[1]&&t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);i&&i[1]&&t.push(i[1].trim().toLowerCase()),e.toLowerCase().includes("1p event:")&&t.push("1p");let r=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(r&&r[1]){let o=r[1].trim().toLowerCase();o.length<30&&!o.includes(" ")&&t.push(o)}return Array.from(new Set(t))}function J8(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(n=>t.exclude.includes(n)):e.some(n=>t.include.includes(n)):!0}function K8(e,t){if(!t)return!0;let n=z8(e);return J8(n,t)}function sZ(e,t){if(Of(t)&&!Rf(t)||xf(t))return;let n=Pn.resolve(t),i=Pn.parse(n).root,r=i,o=n.slice(i.length).split(/[\\/]+/).filter(Boolean),a=0,s=64;for(;o.length>0&&a<s;){let d=Pn.join(r,o[0]);if(xf(d))return o.length===1?d:Pn.join(d,...o.slice(1));let l;try{l=e.lstatSync(d)}catch{return}if(!l.isSymbolicLink()){o.shift(),r=d;continue}a++;let u;try{u=e.readlinkSync(d)}catch{return}let c=Pn.isAbsolute(u)?u:Pn.resolve(r,u);if(Of(c)&&!Rf(c)||xf(c))return o.shift(),o.length===0?c:Pn.join(c,...o);o.shift();let p=Pn.parse(c).root||Pn.sep;r=p,o=[...c.slice(p.length).split(/[\\/]+/).filter(Boolean),...o]}}function t$(e,t){if(Of(t)&&!Rf(t)||xf(t))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let n=sZ(e,t);if(n!==void 0)return{resolvedPath:n,isSymlink:!0,isCanonical:!1};try{let i=e.realpathSync(t);return{resolvedPath:i,isSymlink:i!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function Kn(){return lZ}function uZ(e,t){e.destroyed||e.write(t)}function cZ(e){uZ(process.stderr,e)}function fZ(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pZ(e,t,n=t+"s"){return e===1?t:n}function hZ(e){return HP&&HP(e)?e:e.replace(mZ,"")}function gZ(e,t){let n=e.indexOf(t);return n===-1?e:e.slice(0,n)}function SZ(e){return vZ.map(t=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function wZ(e){QP??=SZ(!0);for(let t of QP)e=e.replace(t.re,(n,i)=>{if(typeof i!="string")return"[REDACTED]";let r=i.length>=2&&(i[0]==='"'||i[0]==="'")&&i.at(-1)===i[0]?i[0]:"",o=n.lastIndexOf(i);return`${n.slice(0,o)}${r}[REDACTED]${r}${n.slice(o+i.length)}`});return e}function pm(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}function YP(e){return M4(e)?null:F8(e)}function CZ(e){if(!r$()||typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=TZ();return K8(e,t)}async function PZ(e,t,n=EZ){if(ll<0?ll=await q8(e).then(i=>i.size).catch(()=>0):ll+=t,!(ll<=n||Vy)){Vy=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await KP(e,i)}catch(r){Ds(r)||(await j_(i).catch(()=>{}),await KP(e,i).catch(()=>j_(e).catch(()=>{})))}ll=0}finally{Vy=!1}}}function a$(e){return F_=hv(e,`${XR()}.txt`),F_}async function IZ(e,t,n,i){e&&await j8(t,{recursive:!0}).catch(()=>{});let r=n;try{await JP(n,i)}catch(o){if(!PR(o))throw o;r=a$(n),await JP(r,i)}await PZ(r,Buffer.byteLength(i)).catch(s$),$Z()}function s$(){}function OZ(){Xa.shift()}function RZ(){if(!dl){let e=null;dl=D8({writeFn:t=>{if(bl){Xa.push(t),bl();return}let n=D_(),i=q_(n),r=e!==i;e=i,Xa.push(t),Hy=Hy.then(IZ.bind(null,r,i,n,t)).catch(s$).then(OZ)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:r$()}),e$(async()=>{dl?.dispose(),await Hy}),!XP&&process.on("exit",XP=()=>{bl=()=>{if(Xa.length===0)return;let t=Xa.join("");Xa.length=0;let n=D_();try{Kn().mkdirSync(q_(n))}catch{}try{Kn().appendFileSync(n,t)}catch(i){if(PR(i))try{Kn().appendFileSync(a$(n),t)}catch{}}},dl?.flush(),bl()})}return dl}function ze(e,{level:t}={level:"debug"}){if(N_[t]<N_[kZ()]||!CZ(e))return;AZ&&e.includes(`
161
- `)&&(e=qt(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${wZ(e.trim())}
162
- `;if(i$()){cZ(n);return}let i=RZ();i.write(n),bl&&i.flush()}function D_(){return o$()??F_??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??hv(Fs(),"debug",`${XR()}.txt`)}function jZ(){return MZ}function qt(e,t,n){let i=[];try{let a=gt(i,_t`JSON.stringify(${e})`,0);return JSON.stringify(e,t,n)}catch(a){var r=a,o=1}finally{yt(i,r,o)}}function qZ(e){return JSON.parse(e)}function gs(e,t){let n=[];try{let o=gt(n,_t`structuredClone(${e})`,0);return structuredClone(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}}function NZ(e){let t=e.trim();return t.startsWith("{")&&t.endsWith("}")}function FZ(e,t){let n={...e};if(t){let i=t.enabled===!0&&t.failIfUnavailable===void 0?{...t,failIfUnavailable:!0}:t,r=n.settings;if(r&&!NZ(r))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let o={sandbox:i};if(r)try{o={...$r(r),sandbox:i}}catch{}n.settings=qt(o)}return n}function LZ(){for(let e of gp)if(!e.killed)if(process.platform==="win32")try{e.stdin.end()}catch{}else e.kill("SIGTERM")}function UZ(e){gp.add(e),!eI&&(eI=!0,process.on("exit",LZ))}function GZ(e){return![".js",".mjs",".tsx",".ts",".jsx"].some(t=>e.endsWith(t))}function zZ(e,t){return F4(e)?t?`Claude Code native binary at ${e} exists but failed to launch. This usually means the binary does not match this system's libc \u2014 e.g. spawning a musl-linked binary on a glibc Linux host fails because the musl dynamic loader (/lib/ld-musl-*) is missing. Specify a matching binary with options.pathToClaudeCodeExecutable.`:`Claude Code executable at ${e} exists but failed to launch.`:t?`Claude Code native binary not found at ${e}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${e}. Is options.pathToClaudeCodeExecutable set?`}function KZ(){if(process.platform!=="linux")return!1;let e=typeof process.report?.getReport=="function"?process.report.getReport():null;return e!=null&&e.header?.glibcVersionRuntime===void 0}function BZ(e,t=process.platform,n=process.arch,i=JZ,r=KZ()){let o=t==="win32"?".exe":"",a=(t==="android"?[`${Ha}-linux-${n}-android`]:t==="linux"?r?[`${Ha}-linux-${n}-musl`,`${Ha}-linux-${n}`]:[`${Ha}-linux-${n}`,`${Ha}-linux-${n}-musl`]:[`${Ha}-${t}-${n}`]).map(s=>`${s}/claude${o}`);for(let s of a)try{let d=e(s);if(i(d))return d}catch{}return null}function WZ(){return{eventQueue:[],sink:null}}function mm(e,t){let n=HZ;if(n.sink===null){n.eventQueue.push({eventName:e,metadata:t,async:!1});return}n.sink.logEvent(e,t)}function d$(e,t){mm("tengu_feature_ok",{feature_name:lm(e),...t})}function l$(e,t,n){mm("tengu_feature_bad",{...n,feature_name:lm(e),error_code:t})}function VZ(e,t,n){mm("tengu_feature_sad",{...n,feature_name:lm(e),error_code:t})}async function kr(e,t,n){try{let i=await t();return d$(e),i}catch(i){throw l$(e,n?.(i)??"error"),i}}function QZ(e){let t=e.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,"");return t=t.replace(/[\u200B-\u200F]/g,"").replace(/[\u202A-\u202E]/g,"").replace(/[\u2066-\u2069]/g,"").replace(/[\uFEFF]/g,"").replace(/[\uE000-\uF8FF]/g,""),t}function YZ(e){let t=hZ(e);for(let n=0;n<10;n++){let i=QZ(t);if(i===t)return t;t=i}return t}function XZ(e){let t=e,n="",i=0,r=10;for(;t!==n&&i<r;)n=t,t=t.normalize("NFKC"),t=YZ(t),i++;if(i>=r)throw Error(`Unicode sanitization reached maximum iterations (${r}) for input: ${e.slice(0,100)}`);return t}function Al(e){if(typeof e=="string")return XZ(e);if(Array.isArray(e))return e.map(Al);if(e!==null&&typeof e=="object"){let t={};for(let[n,i]of Object.entries(e))t[Al(n)]=Al(i);return t}return e}function l7(){return process.platform==="win32"}function rI(e){try{return s7(e,{throwIfNoEntry:!1})===void 0}catch{return!1}}function f7(e){let t=e.toLowerCase().replace(/.*[\\/]/,"").replace(/[. ]+$/,""),n=t.lastIndexOf(".");return n>0&&c7.has(t.slice(n))}function p7(e,t=!1){let n=Va.get(e);if(n!==void 0)if(n!==null){if(!rI(n))return n;Va.delete(e)}else{if(!t)return n;Va.delete(e)}let i=process.env.SYSTEMROOT||"C:\\Windows",r=d7(i,"System32","where.exe");try{let o=a7(r,[e],{stdio:"pipe",encoding:"utf8",timeout:u7,windowsHide:!0,env:process.env}).trim().split(/\r?\n/).filter(Boolean),a=process.cwd(),s=!1;for(let d of o)if(!rI(d)){if(j4(d,a)){s=!0;continue}if(f7(d))return Va.set(e,d),d}return o.length>0&&!s&&Va.set(e,null),null}catch(o){return m7(o)&&Va.set(e,null),null}}function m7(e){if(e===null||typeof e!="object")return!1;let t="status"in e?e.status:void 0,n="signal"in e?e.signal:void 0,i="code"in e?e.code:void 0;return t===1&&!n&&!i}function h7(e,t=!1){return!l7()||e.includes("/")||e.includes("\\")?e:p7(e,t)}async function pu(e){let t=h7("git");if(t===null)return[];try{let{stdout:n}=await g7(t,["worktree","list","--porcelain"],{cwd:e,timeout:5e3,windowsHide:!0});return n?n.split(`
163
- `).filter(i=>i.startsWith("worktree ")).map(i=>cs(i.slice(9))):[]}catch{return[]}}function y7(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function b7(e,t){let n=El(e,"entrypoint")??Gn(t,"entrypoint");if(n&&_7.has(n))return!0;let i=e.split(`
164
- `).find(o=>o.includes('"parentUuid":'))??e,r=El(i,"sessionKind");return r==="daemon"||r==="daemon-worker"}function Rt(e){return typeof e!="string"?null:v7.test(e)?e:null}function c$(e){if(!e.includes("\\"))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function El(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let i of n){let r=e.indexOf(i);if(r<0)continue;let o=r+i.length,a=o;for(;a<e.length;){if(e[a]==="\\"){a+=2;continue}if(e[a]==='"')return c$(e.slice(o,a));a++}}}function Gn(e,t){let n=[`"${t}":"`,`"${t}": "`],i,r=-1;for(let o of n){let a=0;for(;;){let s=e.indexOf(o,a);if(s<0)break;let d=s+o.length,l=d;for(;l<e.length;){if(e[l]==="\\"){l+=2;continue}if(e[l]==='"'){s>r&&(i=c$(e.slice(d,l)),r=s);break}l++}a=l+1}}return i}function S7(e,t,n){let i=`"type":"${t}"`,r=`"${n}":`,o=e.length;for(;o>0;){let a=e.lastIndexOf(`
165
- `,o-1),s=e.slice(a+1,o);if(o=a,s.includes(i)&&s.includes(r))try{let d=JSON.parse(s);if(typeof d=="object"&&d!==null&&d.type===t){let l=d[n];if(typeof l=="string")return l}}catch{}if(a<0)break}}async function K_(e,t){return w7(e,t,"w")}async function w7(e,t,n){let i=t7(e,{mode:384,flags:n});try{for(let r of t)i.write(JSON.stringify(r)+`
166
- `)||await nI(i,"drain");i.end(),await nI(i,"finish")}catch(r){throw i.destroy(),r}}function f$(e){let t=0,n={commandFallback:""};for(;t<e.length;){let i=e.indexOf(`
167
- `,t),r=i>=0?e.slice(t,i):e.slice(t);if(t=i>=0?i+1:e.length,!(!r.includes('"type":"user"')&&!r.includes('"type": "user"'))&&!r.includes('"tool_result"')&&!(r.includes('"isMeta":true')||r.includes('"isMeta": true'))&&!(r.includes('"isCompactSummary":true')||r.includes('"isCompactSummary": true')))try{let o=JSON.parse(r),a=Kb(o,n);if(a!==void 0)return a}catch{continue}}return n.commandFallback}function k7(e){let t={commandFallback:""};for(let n of e){if(typeof n!="object"||n===null)continue;let i=Kb(n,t);if(i!==void 0)return i}return t.commandFallback}async function p$(e){try{let t=await u$(e,"r");try{let n=await t.stat(),i=Buffer.allocUnsafe(vi),r=await t.read(i,0,vi,0);if(r.bytesRead===0)return null;let o=i.toString("utf8",0,r.bytesRead),a=Math.max(0,n.size-vi),s=o;if(a>0){let d=await t.read(i,0,vi,a);s=i.toString("utf8",0,d.bytesRead)}return{mtime:n.mtime.getTime(),size:n.size,head:o,tail:s}}finally{await t.close()}}catch{return null}}function x7(e){return Math.abs(y7(e)).toString(36)}function mu(e){let t=e.replace(/[^a-zA-Z0-9]/g,"-");return t.length<=Ul?t:`${t.slice(0,Ul)}-${x7(e)}`}function no(){return Ll(Fs(),"projects")}function T7(e){return Ll(no(),mu(e))}async function hu(e){try{return cs(await n7(e))}catch{return cs(e)}}async function Cr(e){let t=T7(e),n=[];try{await J_(t),n.push(t)}catch{}let i=mu(e);if(i.length<=Ul)return n;let r=i.slice(0,Ul)+"-",o=no();try{for(let a of await J_(o,{withFileTypes:!0})){if(!a.isDirectory()||!a.name.startsWith(r))continue;let s=Ll(o,a.name);s!==t&&n.push(s)}}catch{}return n}async function hm(e,t){let n=`${e}.jsonl`;async function i(a,s){let d=Ll(a,n);try{let l=await r7(d);if(l.size>0)return{filePath:d,projectPath:s,fileSize:l.size}}catch{}}if(t){let a=await hu(t);for(let d of await Cr(a)){let l=await i(d,a);if(l)return l}let s;try{s=await pu(a)}catch{s=[]}for(let d of s)if(d!==a)for(let l of await Cr(d)){let u=await i(l,d);if(u)return u}return}let r=no(),o;try{o=await J_(r)}catch{return}for(let a of o){let s=await i(Ll(r,a),void 0);if(s)return s}}function P7(){return E7??=Buffer.from('"compact_boundary"')}function m$(e){try{let t=JSON.parse(e);return t.type!=="system"||t.subtype!=="compact_boundary"?null:{hasPreservedSegment:!!(t.compactMetadata?.preservedSegment||t.compactMetadata?.preservedMessages)}}catch{return null}}function Do(e,t,n,i){let r=i-n;if(!(r<=0)){if(e.len+r>e.buf.length){let o=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+r),e.cap));e.buf.copy(o,0,0,e.len),e.buf=o}t.copy(e.buf,e.len,n,i),e.len+=r}}function _p(e,t,n,i){return i-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}function $7(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let i=e.carryBuf,r=t.indexOf(Gl);if(r===-1||r>=n)return 0;let o=r+1;if(_p(i,bp,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=o,e.lastSnapSrc=null;else{if(e.carryLen<bp.length)return 0;if(_p(i,I7,0,e.carryLen)){let a=m$(i.toString("utf-8",0,e.carryLen)+t.toString("utf-8",0,r));a?.hasPreservedSegment?e.hasPreservedSegment=!0:a&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null)}Do(e.out,i,0,e.carryLen),Do(e.out,t,0,o)}return e.bufFileOff+=e.carryLen+o,e.carryLen=0,o}function M7(e,t,n){let i=t.indexOf(n),r=0,o=0,a=-1,s=-1,d=t.indexOf(Gl);for(;d!==-1;){let l=d+1;if(i!==-1&&i<o&&(i=t.indexOf(n,o)),_p(t,bp,o,l))Do(e.out,t,r,o),a=o,s=l,r=l;else if(i>=o&&i<Math.min(o+R7,l)){let u=m$(t.toString("utf-8",o,d));u?.hasPreservedSegment?e.hasPreservedSegment=!0:u&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff+o,e.hasPreservedSegment=!1,e.lastSnapSrc=null,a=-1,e.straddleSnapCarryLen=0,r=o),i=t.indexOf(n,i+n.length)}o=l,d=t.indexOf(Gl,o)}return Do(e.out,t,r,o),{lastSnapStart:a,lastSnapEnd:s,trailStart:o}}function j7(e,t,n,i,r){i!==-1?(e.lastSnapLen=r-i,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),t.copy(e.lastSnapBuf,0,i,r),e.lastSnapSrc=e.lastSnapBuf):e.straddleSnapCarryLen>0&&(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf)}function q7(e,t,n){e.carryLen=t.length-n,e.carryLen>0&&((e.carryBuf===void 0||e.carryLen>e.carryBuf.length)&&(e.carryBuf=Buffer.allocUnsafe(e.carryLen)),t.copy(e.carryBuf,0,n,t.length))}function N7(e){if(e.carryLen>0){let t=e.carryBuf;_p(t,bp,0,e.carryLen)?(e.lastSnapSrc=t,e.lastSnapLen=e.carryLen):Do(e.out,t,0,e.carryLen)}e.lastSnapSrc&&(e.out.len>0&&e.out.buf[e.out.len-1]!==Gl&&Do(e.out,O7,0,1),Do(e.out,e.lastSnapSrc,0,e.lastSnapLen))}async function F7(e,t){let n=P7(),i=C7,r={out:{buf:Buffer.allocUnsafe(Math.min(t,8388608)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0},o=Buffer.allocUnsafe(i),a=await u$(e,"r");try{let s=0;for(;s<t;){let{bytesRead:d}=await a.read(o,0,Math.min(i,t-s),s);if(d===0)break;s+=d;let l=$7(r,o,d),u;if(r.carryLen>0){let p=r.carryLen+(d-l);u=Buffer.allocUnsafe(p),r.carryBuf.copy(u,0,0,r.carryLen),o.copy(u,r.carryLen,l,d)}else u=o.subarray(l,d);let c=M7(r,u,n);j7(r,u,o,c.lastSnapStart,c.lastSnapEnd),q7(r,u,c.trailStart),r.bufFileOff+=c.trailStart}N7(r)}finally{await a.close()}return{boundaryStartOffset:r.boundaryStartOffset,postBoundaryBuf:r.out.buf.subarray(0,r.out.len),hasPreservedSegment:r.hasPreservedSegment}}async function D7(e,t){try{return t>A7&&!cn(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP)?(await F7(e,t)).postBoundaryBuf:await e7(e)}catch{return null}}async function L7(e){let t=[];try{let r=gt(t,_t`parseTranscriptEntries(${e.length} bytes)`,0),o=[],a=10,s=e.length,d=0,l=iI;for(;d<s;){d>=l&&(await new Promise(f=>setImmediate(f)),l=d+iI);let u=e.indexOf(a,d);u===-1&&(u=s);let c=d;for(;c<u&&e[c]<=32;)c++;if(d=u+1,c>=u)continue;let p=e.toString("utf-8",c,u);try{let f=qZ(p),h=f.type;(h==="user"||h==="assistant"||h==="progress"||h==="system"||h==="attachment")&&typeof f.uuid=="string"&&o.push(f)}catch{}}return o}catch(r){var n=r,i=1}finally{yt(t,n,i)}}async function U7(e){let t=new Map;for(let f of e)t.set(f.uuid,f);let n=0;for(let f of t.values()){if(f.type!=="system"||f.subtype!=="compact_boundary")continue;let h=f.compactMetadata?.preservedMessages,g=f.compactMetadata?.preservedSegment;if(h){if(h.uuids.length===0||h.uuids.some(v=>!t.has(v)))continue;let _=h.anchorUuid;for(let v of h.uuids){let w=t.get(v);t.set(v,{...w,parentUuid:_}),_=v}let y=h.uuids[0],b=h.uuids.at(-1);for(let[v,w]of t)++n%oI===0&&await new Promise(A=>setImmediate(A)),w.parentUuid===h.anchorUuid&&v!==y&&t.set(v,{...w,parentUuid:b})}else if(g){let _=t.get(g.headUuid);_&&t.set(g.headUuid,{..._,parentUuid:g.anchorUuid});for(let[y,b]of t)++n%oI===0&&await new Promise(v=>setImmediate(v)),b.parentUuid===g.anchorUuid&&y!==g.headUuid&&t.set(y,{...b,parentUuid:g.tailUuid})}}let i=new Map;for(let f=0;f<e.length;f++)i.set(e[f].uuid,f);let r=new Set;for(let f of t.values())f.parentUuid&&r.add(f.parentUuid);let o=[...t.values()].filter(f=>!r.has(f.uuid)),a=[];for(let f of o){let h=f,g=new Set;for(;h&&!g.has(h.uuid);){if(g.add(h.uuid),h.type==="user"||h.type==="assistant"){a.push(h);break}h=h.parentUuid?t.get(h.parentUuid):void 0}}if(a.length===0)return[];let s=a.filter(f=>!f.isSidechain&&!f.teamName&&!f.isMeta),d=f=>f.reduce((h,g)=>(i.get(g.uuid)??-1)>(i.get(h.uuid)??-1)?g:h),l=s.length>0?d(s):d(a),u=[],c=new Set,p=t.get(l.uuid);for(;p&&!c.has(p.uuid);)c.add(p.uuid),u.push(p),p=p.parentUuid?t.get(p.parentUuid):void 0;return u.reverse(),await new Promise(f=>setImmediate(f)),z7(t,u,c)}function Qy(e){if(e.type!=="assistant")return;let t=e.message;if(typeof t!="object"||t===null)return;let n=t.id;return typeof n=="string"?n:void 0}function G7(e){if(e.type!=="user"||!e.parentUuid)return!1;let t=e.message;if(typeof t!="object"||t===null)return!1;let n=t.content;return Array.isArray(n)?n.some(i=>typeof i=="object"&&i!==null&&i.type==="tool_result"):!1}function z7(e,t,n){let i=t.filter(c=>c.type==="assistant");if(i.length===0)return t;let r=new Map;for(let c of i){let p=Qy(c);p&&r.set(p,c)}let o=new Map,a=new Map;for(let c of e.values()){let p=Qy(c);if(p){let f=o.get(p);f?f.push(c):o.set(p,[c])}else if(G7(c)){let f=c.parentUuid,h=a.get(f);h?h.push(c):a.set(f,[c])}}let s=new Set,d=new Map,l=0;for(let c of i){let p=Qy(c);if(!p||s.has(p))continue;s.add(p);let f=o.get(p)??[c],h=f.filter(v=>!n.has(v.uuid)),g=[];for(let v of f){let w=a.get(v.uuid);if(w)for(let A of w)n.has(A.uuid)||g.push(A)}if(h.length===0&&g.length===0)continue;let _=(v,w)=>(v.timestamp??"").localeCompare(w.timestamp??"");h.sort(_),g.sort(_);let y=r.get(p),b=[...h,...g];for(let v of b)n.add(v.uuid);l+=b.length,d.set(y.uuid,b)}if(l===0)return t;let u=[];for(let c of t){u.push(c);let p=d.get(c.uuid);p&&u.push(...p)}return u}function J7(e,t){if(!(e.type==="user"||e.type==="assistant")){if(!(e.type==="system"&&t))return!1}return!(e.isMeta||e.isSidechain||e.teamName)}function h$(e,t){return{type:e.type,uuid:e.uuid,session_id:e.sessionId,message:e.message,parent_tool_use_id:t??null,timestamp:e.timestamp}}function g$(e,t){let n=t?.offset??0;return t?.limit!==void 0&&t.limit>0?e.slice(n,n+t.limit):n>0?e.slice(n):e}async function K7(e,t){let n=[];for(let i of e){if(typeof i!="object"||i===null)continue;let r=i,o=r.type;(o==="user"||o==="assistant"||o==="progress"||o==="system"||o==="attachment")&&typeof r.uuid=="string"&&n.push(r)}return y$(n,t)}async function y$(e,t){let n=await U7(e),i=t?.includeSystemMessages??!1,r=n.filter(o=>J7(o,i)).map(o=>h$(o));return g$(r,t)}async function B7(e,t){if(!Rt(e))return[];let n=await hm(e,t?.dir);if(!n)return[];let i=await D7(n.filePath,n.fileSize);return i?y$(await L7(i),t):[]}function gm(e,t,n){let{head:i,tail:r,mtime:o,size:a}=t,s=i.indexOf(`
168
- `),d=s>=0?i.slice(0,s):i;if(d.includes('"isSidechain":true')||d.includes('"isSidechain": true'))return null;let l=Gn(r,"customTitle")||Gn(i,"customTitle")||Gn(r,"aiTitle")||Gn(i,"aiTitle")||void 0,u=f$(i)||void 0,c=El(i,"timestamp"),p;if(c){let b=Date.parse(c);Number.isNaN(b)||(p=b)}let f=l||Gn(r,"lastPrompt")||Gn(r,"summary")||u;if(!f)return null;let h=Gn(r,"gitBranch")||El(i,"gitBranch")||void 0,g=S7(r,"relocated","relocatedCwd")||El(i,"cwd")||n||void 0,_=r.split(`
169
- `).findLast(b=>b.includes('"type":"tag"')&&b.includes('"tag":"')),y=_&&Gn(_,"tag")||void 0;return{sessionId:e,summary:f,lastModified:o,fileSize:a,customTitle:l,firstPrompt:u,gitBranch:h,cwd:g,tag:y,createdAt:p}}async function vl(e,t,n){let i;try{i=await _v(e)}catch{return[]}return(await Promise.all(i.map(async r=>{if(!r.endsWith(".jsonl"))return null;let o=Rt(r.slice(0,-6));if(!o)return null;let a=bv(e,r);if(!t)return{sessionId:o,filePath:a,mtime:0,projectPath:n};try{let s=await W7(a);return{sessionId:o,filePath:a,mtime:s.mtime.getTime(),projectPath:n}}catch{return null}}))).filter(r=>r!==null)}async function _$(e,t){let n=await p$(e.filePath);if(!n||!t&&b7(n.head,n.tail))return null;let i=gm(e.sessionId,n,e.projectPath);return i?(e.mtime&&(i.lastModified=e.mtime),i):null}function Z7(e,t){return t.mtime!==e.mtime?t.mtime-e.mtime:t.sessionId<e.sessionId?-1:t.sessionId>e.sessionId?1:0}async function Q7(e,t,n,i){e.sort(Z7);let r=[],o=t&&t>0?t:1/0,a=0,s=new Set;for(let d=0;d<e.length&&r.length<o;){let l=Math.min(d+V7,e.length),u=e.slice(d,l),c=await Promise.all(u.map(p=>_$(p,i)));for(let p=0;p<c.length&&r.length<o;p++){d++;let f=c[p];if(f&&!s.has(f.sessionId)){if(s.add(f.sessionId),a<n){a++;continue}r.push(f)}}}return r}async function Y7(e,t){let n=await Promise.all(e.map(o=>_$(o,t))),i=new Map;for(let o of n){if(!o)continue;let a=i.get(o.sessionId);(!a||o.lastModified>a.lastModified)&&i.set(o.sessionId,o)}let r=[...i.values()];return r.sort((o,a)=>a.lastModified!==o.lastModified?a.lastModified-o.lastModified:a.sessionId<o.sessionId?-1:a.sessionId>o.sessionId?1:0),r}async function X7(e,t,n){let i=await hu(e),r;if(t)try{r=await pu(i)}catch{r=[]}else r=[];if(r.length<=1){let c=[];for(let p of await Cr(i))c.push(...await vl(p,n,i));return c}let o=no(),a=process.platform==="win32",s=r.map(c=>{let p=mu(c);return{path:c,prefix:a?p.toLowerCase():p}});s.sort((c,p)=>p.prefix.length-c.prefix.length);let d;try{d=await _v(o,{withFileTypes:!0})}catch{let c=[];for(let p of await Cr(i))c.push(...await vl(p,n,i));return c}let l=[],u=new Set;for(let c of await Cr(i)){let p=H7(c);u.add(a?p.toLowerCase():p),l.push(...await vl(c,n,i))}for(let c of d){if(!c.isDirectory())continue;let p=a?c.name.toLowerCase():c.name;if(!u.has(p)){for(let{path:f,prefix:h}of s)if(p===h||h.length>=Ul&&p.startsWith(h+"-")){u.add(p),l.push(...await vl(bv(o,c.name),n,f));break}}}return l}async function eQ(e){let t=no(),n;try{n=await _v(t,{withFileTypes:!0})}catch{return[]}return(await Promise.all(n.filter(i=>i.isDirectory()).map(i=>vl(bv(t,i.name),e)))).flat()}async function tQ(e){let{dir:t,limit:n,offset:i,includeWorktrees:r,includeProgrammatic:o}=e??{},a=i??0,s=o??!0,d=n!==void 0&&n>0||a>0,l=t?await X7(t,r??!0,d):await eQ(d);return d?Q7(l,n,a,s):Y7(l,s)}async function nQ(e,t={}){let n=Rt(e);if(!n)return;let i=await hm(n,t.dir);if(!i)return;let r=await p$(i.filePath);if(r)return gm(n,r,i.projectPath)??void 0}async function oQ(e,t,n={}){if(!Rt(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let i=qt({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
170
- `;await v$(e,i,n)}async function aQ(e,t,n={}){if(!Rt(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let r=Al(t).trim();if(!r)throw Error("tag must be non-empty (use null to clear)");t=r}let i=qt({type:"tag",tag:t??"",sessionId:e})+`
171
- `;await v$(e,i,n)}async function sQ(e,t={}){if(!Rt(e))throw Error(`Invalid sessionId: ${e}`);for(let n of await dQ(t)){let i=as(n,`${e}.jsonl`),r;try{({size:r}=await iQ(i))}catch(o){let a=yn(o);if(a==="ENOENT"||a==="ENOTDIR")continue;throw o}if(r!==0){await sI(i,{force:!0}),await sI(as(n,e),{recursive:!0,force:!0});return}}throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found in any project directory`)}async function dQ(e){if(e.dir){let n=await hu(e.dir),i=await Cr(n),r;try{r=await pu(n)}catch{r=[]}for(let o of r)o!==n&&i.push(...await Cr(o));return i}let t=no();try{return(await b$(t,{withFileTypes:!0})).filter(n=>n.isDirectory()||n.isSymbolicLink()).map(n=>as(t,n.name))}catch{return[]}}async function v$(e,t,n){let i=`${e}.jsonl`;if(n.dir){let a=await hu(n.dir);for(let d of await Cr(a))if(await Yy(as(d,i),t))return;let s;try{s=await pu(a)}catch{s=[]}for(let d of s)if(d!==a){for(let l of await Cr(d))if(await Yy(as(l,i),t))return}throw Error(`Session ${e} not found in project directory for ${n.dir}`)}let r=no(),o;try{o=await b$(r)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let a of o)if(await Yy(as(r,a,i),t))return;throw Error(`Session ${e} not found in any project directory`)}async function Yy(e,t){let n;try{n=await rQ(e,aI.O_WRONLY|aI.O_APPEND)}catch(i){let r=yn(i);if(r==="ENOENT"||r==="ENOTDIR")return!1;throw i}try{let{size:i}=await n.stat();if(i===0)return!1;let r=process.platform==="win32"?i:void 0,o=Buffer.from(t,"utf8"),a=0;for(;a<o.length;){let{bytesWritten:s}=await n.write(o,a,o.length-a,r);if(s<=0)throw new Er(`tryAppend: short write to ${e} stalled with ${o.length-a} bytes remaining`,"tryAppend: zero-progress short write");a+=s,r!==void 0&&(r+=s)}return!0}finally{await n.close()}}async function lQ(e,t){let n=`${e}.jsonl`;async function i(a){try{let s=await up().readBytes(B_(a,n));return s.length===0?null:{buf:s,projectDir:a}}catch{return null}}if(t){let a=await hu(t);for(let d of await Cr(a)){let l=await i(d);if(l)return l}let s;try{s=await pu(a)}catch{s=[]}for(let d of s)if(d!==a)for(let l of await Cr(d)){let u=await i(l);if(u)return u}return null}let r=no(),o;try{o=await up().list(r)}catch{return null}for(let a of o){let s=await i(B_(r,a));if(s)return s}return null}function cQ(e,t){let n=[],i=[],r,o=10,a=e.length,s=0;for(;s<a;){let d=e.indexOf(10,s);d===-1&&(d=a);let l=s;for(;l<d&&e[l]<=32;)l++;if(s=d+1,l>=d)continue;let u=e.toString("utf-8",l,d);try{r=S$($r(u),t,n,i)??r}catch{}}return{transcript:n,contentReplacements:i,relocatedCwd:r}}function fQ(e,t){let n=[],i=[],r;for(let o of e)typeof o!="object"||o===null||(r=S$(o,t,n,i)??r);return{transcript:n,contentReplacements:i,relocatedCwd:r}}function S$(e,t,n,i){if(uQ.has(e.type)&&typeof e.uuid=="string")n.push(e);else if(e.type==="content-replacement"&&e.sessionId===t&&Array.isArray(e.replacements))i.push(...e.replacements);else if(e.type==="relocated"&&e.sessionId===t&&typeof e.relocatedCwd=="string")return e.relocatedCwd}async function pQ(e,t={}){if(!Rt(e))throw new Er(`Invalid sessionId: ${e}`,"forkSession: invalid sessionId (not a UUID)");if(t.upToMessageId&&!Rt(t.upToMessageId))throw new Er(`Invalid upToMessageId: ${t.upToMessageId}`,"forkSession: invalid upToMessageId (not a UUID)");let n=await lQ(e,t.dir);if(!n)throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found`);let{entries:i,forkedSessionId:r}=mQ(n.buf,e,t);return await K_(B_(n.projectDir,`${r}.jsonl`),i),{sessionId:r}}function mQ(e,t,n){let i=cQ(e,t);return w$(i,t,n,()=>{let r=e.length,o=e.toString("utf-8",0,Math.min(r,vi)),a=e.toString("utf-8",Math.max(0,r-vi));return Gn(a,"customTitle")||Gn(o,"customTitle")||Gn(a,"aiTitle")||Gn(o,"aiTitle")||f$(o)})}function hQ(e,t,n){let i=fQ(e,t);return w$(i,t,n,()=>gQ(e))}function gQ(e){let t,n;for(let i of e){if(typeof i!="object"||i===null)continue;let r=i;typeof r.customTitle=="string"&&r.customTitle&&(t=r.customTitle),typeof r.aiTitle=="string"&&r.aiTitle&&(n=r.aiTitle)}return t||n||k7(e)||void 0}function w$(e,t,n,i){let r=e.transcript.filter(p=>!p.isSidechain);if(r.length===0)throw Error(`Session ${t} has no messages to fork`);if(n.upToMessageId){let p=r.findIndex(f=>f.uuid===n.upToMessageId);if(p===-1)throw Error(`Message ${n.upToMessageId} not found in session ${t}`);r=r.slice(0,p+1)}let o=new Map;for(let p of r)o.set(p.uuid,bf());let a=r.filter(p=>p.type!=="progress");if(a.length===0)throw Error(`Session ${t} has no messages to fork`);let s=new Map;for(let p of r)s.set(p.uuid,p);let d=bf(),l=new Date().toISOString(),u=[];for(let p=0;p<a.length;p++){let f=a[p],h=o.get(f.uuid),g=null,_=f.parentUuid;for(;_;){let A=s.get(_);if(!A)break;if(A.type!=="progress"){g=o.get(_)??null;break}_=A.parentUuid}let y=p===a.length-1?l:f.timestamp,b=f.logicalParentUuid==null?f.logicalParentUuid:o.get(f.logicalParentUuid)??null,v=f.type==="system"&&f.subtype==="model_refusal_fallback"?{neutralizedByFork:!0}:void 0,w={...f,...v,uuid:h,parentUuid:g,logicalParentUuid:b,sessionId:d,timestamp:y,isSidechain:!1,teamName:void 0,agentName:void 0,sessionKind:void 0,slug:void 0,sourceToolAssistantUUID:void 0,forkedFrom:{sessionId:t,messageUuid:f.uuid}};u.push(w)}e.contentReplacements.length>0&&u.push({type:"content-replacement",sessionId:d,replacements:e.contentReplacements,uuid:bf(),timestamp:l}),e.relocatedCwd&&u.push({type:"relocated",sessionId:d,relocatedCwd:e.relocatedCwd});let c=n.title?.trim();return c||(c=`${i()||"Forked session"} (fork)`),u.push({type:"custom-title",sessionId:d,customTitle:c,uuid:bf(),timestamp:l}),{entries:u,forkedSessionId:d}}async function k$(e,t){let n=await hm(e,t);if(!n)return null;let i=n.filePath.replace(/\.jsonl$/,"");return W_(i,"subagents")}async function x$(e){let t=[];async function n(i){let r;try{r=await yQ(i,{withFileTypes:!0})}catch{return}for(let o of r)if(o.isFile()&&o.name.startsWith("agent-")&&o.name.endsWith(".jsonl")){let a=o.name.slice(6,-6);t.push({agentId:a,filePath:W_(i,o.name)})}else o.isDirectory()&&await n(W_(i,o.name))}return await n(e),t}function _Q(e){let t=[],n=10,i=e.length,r=0;for(;r<i;){let o=e.indexOf(10,r);o===-1&&(o=i);let a=r;for(;a<o&&e[a]<=32;)a++;if(r=o+1,a>=o)continue;let s=e.toString("utf-8",a,o);try{let d=$r(s),l=d.type;(l==="user"||l==="assistant")&&typeof d.uuid=="string"&&t.push(d)}catch{}}return t}function bQ(e){if(e.length===0)return[];let t=new Map;for(let a of e)t.set(a.uuid,a);let n=e.findLast(a=>a.type==="user"||a.type==="assistant");if(!n)return[];let i=[],r=new Set,o=n;for(;o&&!r.has(o.uuid);)r.add(o.uuid),i.push(o),o=o.parentUuid?t.get(o.parentUuid):void 0;return i.reverse(),i}async function vQ(e,t){if(!Rt(e))return[];let n=await k$(e,t?.dir);return n?(await x$(n)).map(i=>i.agentId):[]}async function SQ(e,t,n){if(!Rt(e))return[];if(!t)return[];let i=await k$(e,n?.dir);if(!i)return[];let r=(await x$(i)).find(s=>s.agentId===t);if(!r)return[];let o;try{o=await dI(r.filePath)}catch{return[]}let a;try{let s=r.filePath.replace(/\.jsonl$/,".meta.json");a=$r(await dI(s,"utf-8")).toolUseId}catch{}return T$(o,n,a)}function T$(e,t,n){if(e.length===0)return[];let i=_Q(e),r=bQ(i).filter(o=>o.type==="user"||o.type==="assistant").map(o=>h$(o,n));return g$(r,t)}function C$(e,t){let n=0;for(let i of e)n+=+!!t(i);return n}function A$(e){return[...new Set(e)]}function xQ(){return"prod"}function OQ(){let e=process.env.CLAUDE_LOCAL_OAUTH_API_BASE?.replace(/\/$/,"")??"http://localhost:8000",t=process.env.CLAUDE_LOCAL_OAUTH_APPS_BASE?.replace(/\/$/,"")??"http://localhost:4000",n=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${t}/oauth/authorize`,CLAUDE_AI_ORIGIN:t,TOKEN_URL:`${e}/v1/oauth/token`,API_KEY_URL:`${e}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${e}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",DESIGN_CLIENT_ID:"00000000-0000-4000-8000-000000000000",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}function $Q(){let e=(()=>{switch(xQ()){case"local":return OQ();case"staging":return IQ??lI;case"prod":return lI}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let i=t.replace(/\/$/,"");if(!RQ.includes(i))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");e={...e,BASE_API_URL:i,CONSOLE_AUTHORIZE_URL:`${i}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${i}/oauth/authorize`,CLAUDE_AI_ORIGIN:i,TOKEN_URL:`${i}/v1/oauth/token`,API_KEY_URL:`${i}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${i}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${i}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${i}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${i}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;return n&&(e={...e,CLIENT_ID:n}),e}function jQ(e=""){let t=process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR,n=t!==void 0?!t:!process.env.CLAUDE_CONFIG_DIR,i=t!==void 0?t.normalize("NFC"):Fs(),r=n?"":`-${wQ("sha256").update(i).digest("hex").substring(0,8)}`;return`Claude Code${$Q().OAUTH_FILE_SUFFIX}${e}${r}`}function NQ(){if(process.platform==="win32")return"claude-code-user";let e;try{e=process.env.USER||kQ().username}catch{e="claude-code-user"}return qQ.test(e)?e:"claude-code-user"}function FQ(e,t){if(e==="bypassPermissions")return"canUseTool will not be invoked: permissionMode 'bypassPermissions' auto-approves every tool call (except explicit deny rules) before the callback is consulted. To gate every tool call, use a PreToolUse hook instead.";let n=t.filter(i=>i.length>0&&!i.includes("("));if(n.length!==0)return`canUseTool will not be invoked for: ${n.join(", ")}. Bare allowedTools entries auto-approve the whole tool before the callback is consulted. To gate every tool call, use a PreToolUse hook; or remove the bare names from allowedTools so they fall through to canUseTool. Allow rules from settings files can also shadow the callback but are not visible here.`}function DQ(e,t,n){if(!e)return;let i=FQ(t,n);i!==void 0&&process.emitWarning(i,{code:"CLAUDE_SDK_CAN_USE_TOOL_SHADOWED"})}function H_(){return UQ}function le(e,t){let n=H_(),i=V_({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===zl?void 0:zl].filter(r=>!!r)});e.common.issues.push(i)}function Ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,a)=>{let{message:s}=e;return o.code==="invalid_enum_value"?{message:s??a.defaultError}:typeof a.data>"u"?{message:s??i??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:s??n??a.defaultError}},description:r}}function I$(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iY(e){return new RegExp(`^${I$(e)}$`)}function oY(e){let t=`${P$}T${I$(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function aY(e,t){return!!((t==="v4"||!t)&&QQ.test(e)||(t==="v6"||!t)&&XQ.test(e))}function sY(e,t){if(!WQ.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function dY(e,t){return!!((t==="v4"||!t)&&YQ.test(e)||(t==="v6"||!t)&&eY.test(e))}function lY(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return o%a/10**r}function es(e){if(e instanceof Bn){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=lr.create(es(i))}return new Bn({...e._def,shape:()=>t})}else return e instanceof Xi?new Xi({...e._def,type:es(e.element)}):e instanceof lr?lr.create(es(e.unwrap())):e instanceof xi?xi.create(es(e.unwrap())):e instanceof ki?ki.create(e.items.map(t=>es(t))):e}function Q_(e,t){let n=Ji(e),i=Ji(t);if(e===t)return{valid:!0,data:e};if(n===fe.object&&i===fe.object){let r=Ne.objectKeys(t),o=Ne.objectKeys(e).filter(s=>r.indexOf(s)!==-1),a={...e,...t};for(let s of o){let d=Q_(e[s],t[s]);if(!d.valid)return{valid:!1};a[s]=d.data}return{valid:!0,data:a}}else if(n===fe.array&&i===fe.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],d=Q_(a,s);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return n===fe.date&&i===fe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function O$(e,t){return new Ts({values:e,typeName:oe.ZodEnum,...Ae(t)})}function D(e,t,n){function i(s,d){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(e),t(s,d);for(let u in a.prototype)u in s||Object.defineProperty(s,u,{value:a.prototype[u].bind(s)});s._zod.constr=a,s._zod.def=d}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function a(s){var d;let l=n?.Parent?new o:this;i(l,s),(d=l._zod).deferred??(d.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}function Sn(e){return e&&Object.assign(kp,e),kp}function cY(e){return e}function fY(e){return e}function pY(e){}function mY(e){throw Error()}function hY(e){}function vv(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function de(e,t="|"){return e.map(n=>Ee(n)).join(t)}function j$(e,t){return typeof t=="bigint"?t.toString():t}function ym(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error("cached value already set")}}}function Qo(e){return e==null}function _m(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function q$(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return o%a/10**r}function Je(e,t,n){Object.defineProperty(e,t,{get(){{let i=n();return e[t]=i,i}throw Error("cached value already set")},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Sv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gY(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function yY(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function _Y(e=10){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return t}function ts(e){return JSON.stringify(e)}function eu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tu(e){if(eu(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(eu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function bY(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Yo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mr(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ae(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function SY(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function Ee(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function D$(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function wY(e,t){let n={},i=e._zod.def;for(let r in t){if(!(r in i.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(n[r]=i.shape[r])}return Mr(e,{...e._zod.def,shape:n,checks:[]})}function kY(e,t){let n={...e._zod.def.shape},i=e._zod.def;for(let r in t){if(!(r in i.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&delete n[r]}return Mr(e,{...e._zod.def,shape:n,checks:[]})}function xY(e,t){if(!tu(t))throw Error("Invalid input to extend: expected a plain object");let n={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return Sv(this,"shape",i),i},checks:[]};return Mr(e,n)}function TY(e,t){return Mr(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Sv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function CY(e,t,n){let i=t._zod.def.shape,r={...i};if(n)for(let o in n){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);n[o]&&(r[o]=e?new e({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)r[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return Mr(t,{...t._zod.def,shape:r,checks:[]})}function AY(e,t,n){let i=t._zod.def.shape,r={...i};if(n)for(let o in n){if(!(o in r))throw Error(`Unrecognized key: "${o}"`);n[o]&&(r[o]=new e({type:"nonoptional",innerType:i[o]}))}else for(let o in i)r[o]=new e({type:"nonoptional",innerType:i[o]});return Mr(t,{...t._zod.def,shape:r,checks:[]})}function ss(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function sr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function wl(e){return typeof e=="string"?e:e?.message}function Ir(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=wl(e.inst?._zod.def?.error?.(e))??wl(t?.error?.(e))??wl(n.customError?.(e))??wl(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,!t?.reportInput&&delete i.input,i}function bm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function vm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function G$(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function EY(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function xv(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function Tv(e,t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>r({issues:s}));else if(a.code==="invalid_key")r({issues:a.issues});else if(a.code==="invalid_element")r({issues:a.issues});else if(a.path.length===0)i._errors.push(n(a));else{let s=i,d=0;for(;d<a.path.length;){let l=a.path[d];d!==a.path.length-1?s[l]=s[l]||{_errors:[]}:(s[l]=s[l]||{_errors:[]},s[l]._errors.push(n(a))),s=s[l],d++}}};return r(e),i}function J$(e,t){let n=t||function(o){return o.message},i={errors:[]},r=(o,a=[])=>{var s,d;for(let l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u},l.path));else if(l.code==="invalid_key")r({issues:l.issues},l.path);else if(l.code==="invalid_element")r({issues:l.issues},l.path);else{let u=[...a,...l.path];if(u.length===0){i.errors.push(n(l));continue}let c=i,p=0;for(;p<u.length;){let f=u[p],h=p===u.length-1;typeof f=="string"?(c.properties??(c.properties={}),(s=c.properties)[f]??(s[f]={errors:[]}),c=c.properties[f]):(c.items??(c.items=[]),(d=c.items)[f]??(d[f]={errors:[]}),c=c.items[f]),h&&c.errors.push(n(l)),p++}}};return r(e),i}function K$(e){let t=[];for(let n of e)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function B$(e){let t=[],n=[...e.issues].sort((i,r)=>i.path.length-r.path.length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${K$(i.path)}`);return t.join(`
172
- `)}function nM(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}function fM(e){return typeof e.precision=="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function pM(e){return new RegExp(`^${fM(e)}$`)}function mM(e){let t=fM({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${uM}T(?:${i})$`)}function mI(e,t,n){e.issues.length&&t.issues.push(...sr(n,e.issues))}function Mv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function u1(e){if(!Ov.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mv(n)}function p1(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}function hI(e,t,n){e.issues.length&&t.issues.push(...sr(n,e.issues)),t.value[n]=e.value}function vf(e,t,n){e.issues.length&&t.issues.push(...sr(n,e.issues)),t.value[n]=e.value}function gI(e,t,n,i){e.issues.length?i[n]===void 0?n in i?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...sr(n,e.issues)):e.value===void 0?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function yI(e,t,n,i){for(let r of e)if(r.issues.length===0)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(r=>r.issues.map(o=>Ir(o,i,Sn())))}),t}function tb(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tu(e)&&tu(t)){let n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let a=tb(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r[o]=a.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=t[i],a=tb(r,o);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _I(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),ss(e))return e;let i=tb(t.value,n.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}function Sf(e,t,n){e.issues.length&&t.issues.push(...sr(n,e.issues)),t.value[n]=e.value}function bI(e,t,n,i,r,o,a){e.issues.length&&(xp.has(typeof i)?n.issues.push(...sr(i,e.issues)):n.issues.push({origin:"map",code:"invalid_key",input:r,inst:o,issues:e.issues.map(s=>Ir(s,a,Sn()))})),t.issues.length&&(xp.has(typeof i)?n.issues.push(...sr(i,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map(s=>Ir(s,a,Sn()))})),n.value.set(e.value,t.value)}function vI(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function SI(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function wI(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function kI(e,t,n){return ss(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}function xI(e){return e.value=Object.freeze(e.value),e}function TI(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),t.issues.push(G$(r))}}function LY(){return{localeError:DY()}}function GY(){return{localeError:UY()}}function CI(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}function JY(){return{localeError:zY()}}function BY(){return{localeError:KY()}}function HY(){return{localeError:WY()}}function ZY(){return{localeError:VY()}}function B1(){return{localeError:YY()}}function tX(){return{localeError:eX()}}function rX(){return{localeError:nX()}}function oX(){return{localeError:iX()}}function sX(){return{localeError:aX()}}function lX(){return{localeError:dX()}}function cX(){return{localeError:uX()}}function pX(){return{localeError:fX()}}function hX(){return{localeError:mX()}}function yX(){return{localeError:gX()}}function bX(){return{localeError:_X()}}function SX(){return{localeError:vX()}}function kX(){return{localeError:wX()}}function TX(){return{localeError:xX()}}function AX(){return{localeError:CX()}}function PX(){return{localeError:EX()}}function OX(){return{localeError:IX()}}function $X(){return{localeError:RX()}}function jX(){return{localeError:MX()}}function NX(){return{localeError:qX()}}function DX(){return{localeError:FX()}}function UX(){return{localeError:LX()}}function AI(e,t,n,i){let r=Math.abs(e),o=r%10,a=r%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?n:i}function zX(){return{localeError:GX()}}function KX(){return{localeError:JX()}}function WX(){return{localeError:BX()}}function VX(){return{localeError:HX()}}function QX(){return{localeError:ZX()}}function eee(){return{localeError:XX()}}function nee(){return{localeError:tee()}}function iee(){return{localeError:ree()}}function aee(){return{localeError:oee()}}function dee(){return{localeError:see()}}function uee(){return{localeError:lee()}}function Jv(){return new nu}function V1(e,t){return new e({type:"string",...ae(t)})}function Z1(e,t){return new e({type:"string",coerce:!0,...ae(t)})}function Kv(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ae(t)})}function Pp(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ae(t)})}function Bv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ae(t)})}function Wv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ae(t)})}function Hv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ae(t)})}function Vv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ae(t)})}function Zv(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}function Qv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ae(t)})}function Yv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ae(t)})}function Xv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ae(t)})}function eS(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ae(t)})}function tS(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ae(t)})}function nS(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ae(t)})}function rS(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ae(t)})}function iS(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ae(t)})}function oS(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ae(t)})}function aS(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ae(t)})}function sS(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ae(t)})}function dS(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ae(t)})}function lS(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ae(t)})}function uS(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ae(t)})}function cS(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ae(t)})}function Y1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ae(t)})}function X1(e,t){return new e({type:"string",format:"date",check:"string_format",...ae(t)})}function ej(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ae(t)})}function tj(e,t){return new e({type:"string",format:"duration",check:"string_format",...ae(t)})}function nj(e,t){return new e({type:"number",checks:[],...ae(t)})}function rj(e,t){return new e({type:"number",coerce:!0,checks:[],...ae(t)})}function ij(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(t)})}function oj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...ae(t)})}function aj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...ae(t)})}function sj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...ae(t)})}function dj(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...ae(t)})}function lj(e,t){return new e({type:"boolean",...ae(t)})}function uj(e,t){return new e({type:"boolean",coerce:!0,...ae(t)})}function cj(e,t){return new e({type:"bigint",...ae(t)})}function fj(e,t){return new e({type:"bigint",coerce:!0,...ae(t)})}function pj(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...ae(t)})}function mj(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...ae(t)})}function hj(e,t){return new e({type:"symbol",...ae(t)})}function gj(e,t){return new e({type:"undefined",...ae(t)})}function yj(e,t){return new e({type:"null",...ae(t)})}function _j(e){return new e({type:"any"})}function Ip(e){return new e({type:"unknown"})}function bj(e,t){return new e({type:"never",...ae(t)})}function vj(e,t){return new e({type:"void",...ae(t)})}function Sj(e,t){return new e({type:"date",...ae(t)})}function wj(e,t){return new e({type:"date",coerce:!0,...ae(t)})}function kj(e,t){return new e({type:"nan",...ae(t)})}function Ko(e,t){return new Rv({check:"less_than",...ae(t),value:e,inclusive:!1})}function Ar(e,t){return new Rv({check:"less_than",...ae(t),value:e,inclusive:!0})}function Bo(e,t){return new $v({check:"greater_than",...ae(t),value:e,inclusive:!1})}function zn(e,t){return new $v({check:"greater_than",...ae(t),value:e,inclusive:!0})}function xj(e){return Bo(0,e)}function Tj(e){return Ko(0,e)}function Cj(e){return Ar(0,e)}function Aj(e){return zn(0,e)}function ru(e,t){return new TM({check:"multiple_of",...ae(t),value:e})}function xm(e,t){return new EM({check:"max_size",...ae(t),maximum:e})}function iu(e,t){return new PM({check:"min_size",...ae(t),minimum:e})}function fS(e,t){return new IM({check:"size_equals",...ae(t),size:e})}function Tm(e,t){return new OM({check:"max_length",...ae(t),maximum:e})}function Os(e,t){return new RM({check:"min_length",...ae(t),minimum:e})}function Cm(e,t){return new $M({check:"length_equals",...ae(t),length:e})}function pS(e,t){return new MM({check:"string_format",format:"regex",...ae(t),pattern:e})}function mS(e){return new jM({check:"string_format",format:"lowercase",...ae(e)})}function hS(e){return new qM({check:"string_format",format:"uppercase",...ae(e)})}function gS(e,t){return new NM({check:"string_format",format:"includes",...ae(t),includes:e})}function yS(e,t){return new FM({check:"string_format",format:"starts_with",...ae(t),prefix:e})}function _S(e,t){return new DM({check:"string_format",format:"ends_with",...ae(t),suffix:e})}function Ej(e,t,n){return new LM({check:"property",property:e,schema:t,...ae(n)})}function bS(e,t){return new UM({check:"mime_type",mime:e,...ae(t)})}function Xo(e){return new GM({check:"overwrite",tx:e})}function vS(e){return Xo(t=>t.normalize(e))}function SS(){return Xo(e=>e.trim())}function wS(){return Xo(e=>e.toLowerCase())}function kS(){return Xo(e=>e.toUpperCase())}function xS(e,t,n){return new e({type:"array",element:t,...ae(n)})}function cee(e,t,n){return new e({type:"union",options:t,...ae(n)})}function fee(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...ae(i)})}function pee(e,t,n){return new e({type:"intersection",left:t,right:n})}function Pj(e,t,n,i){let r=n instanceof Te;return new e({type:"tuple",items:t,rest:r?n:null,...ae(r?i:n)})}function mee(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...ae(i)})}function hee(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...ae(i)})}function gee(e,t,n){return new e({type:"set",valueType:t,...ae(n)})}function yee(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...ae(n)})}function _ee(e,t,n){return new e({type:"enum",entries:t,...ae(n)})}function bee(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...ae(n)})}function Ij(e,t){return new e({type:"file",...ae(t)})}function vee(e,t){return new e({type:"transform",transform:t})}function See(e,t){return new e({type:"optional",innerType:t})}function wee(e,t){return new e({type:"nullable",innerType:t})}function kee(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():n}})}function xee(e,t,n){return new e({type:"nonoptional",innerType:t,...ae(n)})}function Tee(e,t){return new e({type:"success",innerType:t})}function Cee(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function Aee(e,t,n){return new e({type:"pipe",in:t,out:n})}function Eee(e,t){return new e({type:"readonly",innerType:t})}function Pee(e,t,n){return new e({type:"template_literal",parts:t,...ae(n)})}function Iee(e,t){return new e({type:"lazy",getter:t})}function Oee(e,t){return new e({type:"promise",innerType:t})}function Oj(e,t,n){let i=ae(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function Rj(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ae(n)})}function $j(e,t){let n=ae(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),r=r.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),a=new Set(r),s=e.Pipe??Gv,d=e.Boolean??qv,l=e.String??_u,u=new(e.Transform??Uv)({type:"transform",transform:(p,f)=>{let h=p;return n.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:a.has(h)?!1:(f.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:f.value,inst:u}),{})},error:n.error}),c=new s({type:"pipe",in:new l({type:"string",error:n.error}),out:u,error:n.error});return new s({type:"pipe",in:c,out:new d({type:"boolean",error:n.error}),error:n.error})}function Mj(e,t,n,i={}){let r=ae(i),o={...ae(i),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}function jj(e){return new Op({type:"function",input:Array.isArray(e?.input)?Pj(km,e?.input):e?.input??xS(Fv,Ip(Ep)),output:e?.output??Ip(Ep)})}function TS(e,t){if(e instanceof nu){let i=new ou(t),r={};for(let s of e._idmap.entries()){let[d,l]=s;i.process(l)}let o={},a={registry:e,uri:t?.uri||(s=>s),defs:r};for(let s of e._idmap.entries()){let[d,l]=s;o[d]=i.emit(l,{...t,external:a})}if(Object.keys(r).length>0){let s=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[s]:r}}return{schemas:o}}let n=new ou(t);return n.process(e),n.emit(e,t)}function Lt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Lt(i.element,n);case"object":{for(let r in i.shape)if(Lt(i.shape[r],n))return!0;return!1}case"union":{for(let r of i.options)if(Lt(r,n))return!0;return!1}case"intersection":return Lt(i.left,n)||Lt(i.right,n);case"tuple":{for(let r of i.items)if(Lt(r,n))return!0;return!!(i.rest&&Lt(i.rest,n))}case"record":return Lt(i.keyType,n)||Lt(i.valueType,n);case"map":return Lt(i.keyType,n)||Lt(i.valueType,n);case"set":return Lt(i.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Lt(i.innerType,n);case"lazy":return Lt(i.getter(),n);case"default":return Lt(i.innerType,n);case"prefault":return Lt(i.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return Lt(i.in,n)||Lt(i.out,n);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${i.type}`)}function EI(e,t){let n={type:"object",get shape(){return Re.assignProp(this,"shape",{...e}),this.shape},...Re.normalizeParams(t)};return new Mee(n)}function Xr(e){return!!e._zod}function ns(e){let t=Object.values(e);if(t.length===0)return EI({});let n=t.every(Xr),i=t.every(r=>!Xr(r));if(n)return EI(e);if(i)return uY(e);throw Error("Mixed Zod versions detected in object shape.")}function Pl(e,t){return Xr(e)?Sm(e,t):e.safeParse(t)}async function e_(e,t){return Xr(e)?await wm(e,t):await e.safeParseAsync(t)}function bu(e){if(!e)return;let t;if(Xr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function ul(e){if(e){if(typeof e=="object"){let t=e,n=e;if(!t._def&&!n._zod){let i=Object.values(e);if(i.length>0&&i.every(r=>typeof r=="object"&&r!==null&&(r._def!==void 0||r._zod!==void 0||typeof r.parse=="function")))return ns(e)}}if(Xr(e)){let t=e._zod?.def;if(t&&(t.type==="object"||t.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function t_(e){if(e&&typeof e=="object"){if("message"in e&&typeof e.message=="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t=="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function jee(e){return e.description}function qee(e){if(Xr(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function qj(e){if(Xr(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}function Nj(e){return Y1(AS,e)}function Fj(e){return X1(ES,e)}function Dj(e){return ej(PS,e)}function Lj(e){return tj(IS,e)}function G(e){return V1(Am,e)}function Fee(e){return Kv(RS,e)}function Dee(e){return Pp(Rp,e)}function Lee(e){return Bv(wi,e)}function Uee(e){return Wv(wi,e)}function Gee(e){return Hv(wi,e)}function zee(e){return Vv(wi,e)}function Jee(e){return Zv($S,e)}function Kee(e){return Qv(MS,e)}function Bee(e){return Yv(jS,e)}function Wee(e){return Xv(qS,e)}function Hee(e){return eS(NS,e)}function Vee(e){return tS(FS,e)}function Zee(e){return nS(DS,e)}function Qee(e){return rS(LS,e)}function Yee(e){return iS(US,e)}function Xee(e){return oS(GS,e)}function ete(e){return aS(zS,e)}function tte(e){return sS(JS,e)}function nte(e){return dS(KS,e)}function rte(e){return lS(BS,e)}function ite(e){return uS(WS,e)}function ote(e){return cS(HS,e)}function ate(e,t,n={}){return Mj(Bj,e,t,n)}function Ge(e){return nj(Em,e)}function nb(e){return ij(Us,e)}function ste(e){return oj(Us,e)}function dte(e){return aj(Us,e)}function lte(e){return sj(Us,e)}function ute(e){return dj(Us,e)}function Ut(e){return lj(Pm,e)}function cte(e){return cj(Im,e)}function fte(e){return pj(VS,e)}function pte(e){return mj(VS,e)}function mte(e){return hj(Wj,e)}function hte(e){return gj(Hj,e)}function ZS(e){return yj(Vj,e)}function gte(){return _j(Zj)}function bt(){return Ip(Qj)}function Om(e){return bj(Yj,e)}function yte(e){return vj(Xj,e)}function _te(e){return Sj(QS,e)}function $e(e,t){return xS(eq,e,t)}function bte(e){let t=e._zod.def.shape;return ye(Object.keys(t))}function ce(e,t){let n={type:"object",get shape(){return Re.assignProp(this,"shape",{...e}),this.shape},...Re.normalizeParams(t)};return new Rm(n)}function vte(e,t){return new Rm({type:"object",get shape(){return Re.assignProp(this,"shape",{...e}),this.shape},catchall:Om(),...Re.normalizeParams(t)})}function _n(e,t){return new Rm({type:"object",get shape(){return Re.assignProp(this,"shape",{...e}),this.shape},catchall:bt(),...Re.normalizeParams(t)})}function Xe(e,t){return new YS({type:"union",options:e,...Re.normalizeParams(t)})}function XS(e,t,n){return new tq({type:"union",options:t,discriminator:e,...Re.normalizeParams(n)})}function $m(e,t){return new nq({type:"intersection",left:e,right:t})}function Ste(e,t,n){let i=t instanceof Te,r=i?n:t;return new rq({type:"tuple",items:e,rest:i?t:null,...Re.normalizeParams(r)})}function Ye(e,t,n){return new ew({type:"record",keyType:e,valueType:t,...Re.normalizeParams(n)})}function wte(e,t,n){return new ew({type:"record",keyType:Xe([e,Om()]),valueType:t,...Re.normalizeParams(n)})}function kte(e,t,n){return new iq({type:"map",keyType:e,valueType:t,...Re.normalizeParams(n)})}function xte(e,t){return new oq({type:"set",valueType:e,...Re.normalizeParams(t)})}function $n(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new au({type:"enum",entries:n,...Re.normalizeParams(t)})}function Tte(e,t){return new au({type:"enum",entries:e,...Re.normalizeParams(t)})}function ye(e,t){return new aq({type:"literal",values:Array.isArray(e)?e:[e],...Re.normalizeParams(t)})}function Cte(e){return Ij(sq,e)}function nw(e){return new tw({type:"transform",transform:e})}function st(e){return new rw({type:"optional",innerType:e})}function $p(e){return new dq({type:"nullable",innerType:e})}function Ate(e){return st($p(e))}function uq(e,t){return new lq({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function fq(e,t){return new cq({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}function pq(e,t){return new iw({type:"nonoptional",innerType:e,...Re.normalizeParams(t)})}function Ete(e){return new mq({type:"success",innerType:e})}function gq(e,t){return new hq({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function Pte(e){return kj(yq,e)}function Mp(e,t){return new ow({type:"pipe",in:e,out:t})}function bq(e){return new _q({type:"readonly",innerType:e})}function Ite(e,t){return new vq({type:"template_literal",parts:e,...Re.normalizeParams(t)})}function wq(e){return new Sq({type:"lazy",getter:e})}function Ote(e){return new kq({type:"promise",innerType:e})}function xq(e,t){let n=new $t({check:"custom",...Re.normalizeParams(t)});return n._zod.check=e,n}function Tq(e,t){return Oj(Mm,e??(()=>!0),t)}function Cq(e,t={}){return Rj(Mm,e,t)}function Aq(e,t){let n=xq(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Re.issue(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(Re.issue(o))}},e(i.value,i)),t);return n}function Rte(e,t={error:`Input not instance of ${e.name}`}){let n=new Mm({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...Re.normalizeParams(t)});return n._zod.bag.Class=e,n}function Mte(e){let t=wq(()=>Xe([G(e),Ge(),Ut(),ZS(),$e(t),Ye(G(),t)]));return t}function aw(e,t){return Mp(nw(e),t)}function qte(e){Sn({customError:e})}function Nte(){return Sn().customError}function Fte(e){return Z1(Am,e)}function Dte(e){return rj(Em,e)}function Lte(e){return uj(Pm,e)}function Ute(e){return fj(Im,e)}function Gte(e){return wj(QS,e)}function yre(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function _re(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}function Ro(e){return e==="completed"||e==="failed"||e==="cancelled"}function Bq(e,t,n,i){i?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function We(e,t,n,i,r){e[t]=n,Bq(e,t,i,r)}function Rn(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Wq(t,e.currentPath):t.join("/")}}function Cre(e,t){let n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==oe.ZodAny&&(n.items=Ue(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&We(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&We(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(We(n,"minItems",e.exactLength.value,e.exactLength.message,t),We(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}function Are(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let i of e.checks)switch(i.kind){case"min":t.target==="jsonSchema7"?i.inclusive?We(n,"minimum",i.value,i.message,t):We(n,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(n.exclusiveMinimum=!0),We(n,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?We(n,"maximum",i.value,i.message,t):We(n,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(n.exclusiveMaximum=!0),We(n,"maximum",i.value,i.message,t));break;case"multipleOf":We(n,"multipleOf",i.value,i.message,t);break}return n}function Ere(){return{type:"boolean"}}function Hq(e,t){return Ue(e.type._def,t)}function Vq(e,t,n){let i=n??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((r,o)=>Vq(e,t,r))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ire(e,t)}}function Ore(e,t){return{...Ue(e.innerType._def,t),default:e.defaultValue()}}function Rre(e,t){return t.effectStrategy==="input"?Ue(e.schema._def,t):Rn(t)}function $re(e){return{type:"string",enum:Array.from(e.values)}}function jre(e,t){let n=[Ue(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ue(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return n.forEach(o=>{if(Mre(o))r.push(...o.allOf),o.unevaluatedProperties===void 0&&(i=void 0);else{let a=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:s,...d}=o;a=d}else i=void 0;r.push(a)}}),r.length?{allOf:r,...i}:void 0}function qre(e,t){let n=typeof e.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[e.value]}:{type:n==="bigint"?"integer":n,const:e.value}}function Zq(e,t){let n={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":We(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,t);break;case"max":We(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Tr(n,"email",i.message,t);break;case"format:idn-email":Tr(n,"idn-email",i.message,t);break;case"pattern:zod":gn(n,xr.email,i.message,t);break}break;case"url":Tr(n,"uri",i.message,t);break;case"uuid":Tr(n,"uuid",i.message,t);break;case"regex":gn(n,i.regex,i.message,t);break;case"cuid":gn(n,xr.cuid,i.message,t);break;case"cuid2":gn(n,xr.cuid2,i.message,t);break;case"startsWith":gn(n,RegExp(`^${r_(i.value,t)}`),i.message,t);break;case"endsWith":gn(n,RegExp(`${r_(i.value,t)}$`),i.message,t);break;case"datetime":Tr(n,"date-time",i.message,t);break;case"date":Tr(n,"date",i.message,t);break;case"time":Tr(n,"time",i.message,t);break;case"duration":Tr(n,"duration",i.message,t);break;case"length":We(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,i.value):i.value,i.message,t),We(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,i.value):i.value,i.message,t);break;case"includes":{gn(n,RegExp(r_(i.value,t)),i.message,t);break}case"ip":{i.version!=="v6"&&Tr(n,"ipv4",i.message,t),i.version!=="v4"&&Tr(n,"ipv6",i.message,t);break}case"base64url":gn(n,xr.base64url,i.message,t);break;case"jwt":gn(n,xr.jwt,i.message,t);break;case"cidr":{i.version!=="v6"&&gn(n,xr.ipv4Cidr,i.message,t),i.version!=="v4"&&gn(n,xr.ipv6Cidr,i.message,t);break}case"emoji":gn(n,xr.emoji(),i.message,t);break;case"ulid":{gn(n,xr.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Tr(n,"binary",i.message,t);break}case"contentEncoding:base64":{We(n,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{gn(n,xr.base64,i.message,t);break}}break}case"nanoid":gn(n,xr.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function r_(e,t){return t.patternStrategy==="escape"?Fre(e):e}function Fre(e){let t="";for(let n=0;n<e.length;n++)Nre.has(e[n])||(t+="\\"),t+=e[n];return t}function Tr(e,t,n,i){e.format||e.anyOf?.some(r=>r.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&i.errorMessages&&{errorMessage:{format:n}}})):We(e,"format",t,n,i)}function gn(e,t,n,i){e.pattern||e.allOf?.some(r=>r.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:OI(t,i),...n&&i.errorMessages&&{errorMessage:{pattern:n}}})):We(e,"pattern",OI(t,i),n,i)}function OI(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=n.i?e.source.toLowerCase():e.source,r="",o=!1,a=!1,s=!1;for(let d=0;d<i.length;d++){if(o){r+=i[d],o=!1;continue}if(n.i){if(a){if(i[d].match(/[a-z]/)){s?(r+=i[d],r+=`${i[d-2]}-${i[d]}`.toUpperCase(),s=!1):i[d+1]==="-"&&i[d+2]?.match(/[a-z]/)?(r+=i[d],s=!0):r+=`${i[d]}${i[d].toUpperCase()}`;continue}}else if(i[d].match(/[a-z]/)){r+=`[${i[d]}${i[d].toUpperCase()}]`;continue}}if(n.m){if(i[d]==="^"){r+=`(^|(?<=[\r
173
- ]))`;continue}else if(i[d]==="$"){r+=`($|(?=[\r
174
- ]))`;continue}}if(n.s&&i[d]==="."){r+=a?`${i[d]}\r
175
- `:`[${i[d]}\r
176
- ]`;continue}r+=i[d],i[d]==="\\"?o=!0:a&&i[d]==="]"?a=!1:!a&&i[d]==="["&&(a=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return r}function Qq(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===oe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,r)=>({...i,[r]:Ue(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??Rn(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:"object",additionalProperties:Ue(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(e.keyType?._def.typeName===oe.ZodString&&e.keyType._def.checks?.length){let{type:i,...r}=Zq(e.keyType._def,t);return{...n,propertyNames:r}}else{if(e.keyType?._def.typeName===oe.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===oe.ZodBranded&&e.keyType._def.type._def.typeName===oe.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...r}=Hq(e.keyType._def,t);return{...n,propertyNames:r}}}return n}function Dre(e,t){if(t.mapStrategy==="record")return Qq(e,t);let n=Ue(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Rn(t),i=Ue(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Rn(t);return{type:"array",maxItems:125,items:{type:"array",items:[n,i],minItems:2,maxItems:2}}}function Lre(e){let t=e.values,n=Object.keys(e.values).filter(r=>typeof t[t[r]]!="number").map(r=>t[r]),i=Array.from(new Set(n.map(r=>typeof r)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}function Ure(e){return e.target==="openAi"?void 0:{not:Rn({...e,currentPath:[...e.currentPath,"not"]})}}function Gre(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}function zre(e,t){if(t.target==="openApi3")return RI(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(i=>i._def.typeName in Lp&&(!i._def.checks||!i._def.checks.length))){let i=n.reduce((r,o)=>{let a=Lp[o._def.typeName];return a&&!r.includes(a)?[...r,a]:r},[]);return{type:i.length>1?i:i[0]}}else if(n.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=n.reduce((r,o)=>{let a=typeof o._def.value;switch(a){case"string":case"number":case"boolean":return[...r,a];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(i.length===n.length){let r=i.filter((o,a,s)=>s.indexOf(o)===a);return{type:r.length>1?r:r[0],enum:n.reduce((o,a)=>o.includes(a._def.value)?o:[...o,a._def.value],[])}}}else if(n.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((i,r)=>[...i,...r._def.values.filter(o=>!i.includes(o))],[])};return RI(e,t)}function Jre(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Lp[e.innerType._def.typeName],nullable:!0}:{type:[Lp[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let i=Ue(e.innerType._def,{...t,currentPath:[...t.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let n=Ue(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Kre(e,t){let n={type:"number"};if(!e.checks)return n;for(let i of e.checks)switch(i.kind){case"int":n.type="integer",Bq(n,"type",i.message,t);break;case"min":t.target==="jsonSchema7"?i.inclusive?We(n,"minimum",i.value,i.message,t):We(n,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(n.exclusiveMinimum=!0),We(n,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?We(n,"maximum",i.value,i.message,t):We(n,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(n.exclusiveMaximum=!0),We(n,"maximum",i.value,i.message,t));break;case"multipleOf":We(n,"multipleOf",i.value,i.message,t);break}return n}function Bre(e,t){let n=t.target==="openAi",i={type:"object",properties:{}},r=[],o=e.shape();for(let s in o){let d=o[s];if(d===void 0||d._def===void 0)continue;let l=Hre(d);l&&n&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),l=!1);let u=Ue(d._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});u!==void 0&&(i.properties[s]=u,!l&&r.push(s))}r.length&&(i.required=r);let a=Wre(e,t);return a!==void 0&&(i.additionalProperties=a),i}function Wre(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ue(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Hre(e){try{return e.isOptional()}catch{return!0}}function Qre(e,t){return Ue(e.type._def,t)}function Yre(e,t){let n={type:"array",uniqueItems:!0,items:Ue(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&We(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&We(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function Xre(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,i)=>Ue(n._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((n,i)=>i===void 0?n:[...n,i],[]),additionalItems:Ue(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,i)=>Ue(n._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((n,i)=>i===void 0?n:[...n,i],[])}}function eie(e){return{not:Rn(e)}}function tie(e){return Rn(e)}function Ue(e,t,n=!1){let i=t.seen.get(e);if(t.override){let s=t.override?.(e,t,i,n);if(s!==kre)return s}if(i&&!n){let s=iie(i,t);if(s!==void 0)return s}let r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);let o=rie(e,e.typeName,t),a=typeof o=="function"?Ue(o(),t):o;if(a&&oie(e,t,a),t.postProcess){let s=t.postProcess(a,e,t);return r.jsonSchema=a,s}return r.jsonSchema=a,a}function sie(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function $I(e,t){return Xr(e)?TS(e,{target:sie(t?.target),io:t?.pipeStrategy??"input"}):aie(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function MI(e){let t=bu(e)?.method;if(!t)throw Error("Schema is missing a method literal");let n=qj(t);if(typeof n!="string")throw Error("Schema method literal must be a string");return n}function jI(e,t){let n=Pl(e,t);if(!n.success)throw n.error;return n.data}function qI(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function lie(e,t){let n={...e};for(let i in t){let r=i,o=t[r];if(o===void 0)continue;let a=n[r];qI(a)&&qI(o)?n[r]={...a,...o}:n[r]=o}return n}function fie(){let e=new uie.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return cie.default(e),e}function pie(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function mie(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function NI(e){return!!e&&typeof e=="object"&&Yq in e}function hie(e){return e[Yq]?.complete}function yie(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!gie.test(e)){let n=e.split("").filter(i=>!/[A-Za-z0-9._-]/.test(i)).filter((i,r,o)=>o.indexOf(i)===r);return t.push(`Tool name contains invalid characters: ${n.map(i=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function _ie(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let n of t)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function DI(e){let t=yie(e);return _ie(e,t.warnings),t.isValid}function Xq(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function eN(e){return"_def"in e||"_zod"in e||Xq(e)}function yb(e){return typeof e!="object"||e===null||eN(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(Xq)}function LI(e){if(e){if(yb(e))return ns(e);if(!eN(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function vie(e){let t=bu(e);return t?Object.entries(t).map(([n,i])=>{let r=jee(i),o=qee(i);return{name:n,description:r,required:!o}}):[]}function Gi(e){let t=bu(e)?.method;if(!t)throw Error("Schema is missing a method literal");let n=qj(t);if(typeof n=="string")return n;throw Error("Schema method literal must be a string")}function UI(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}function Sie(e,t,n,i,r){let o={};return r?.searchHint&&(o["anthropic/searchHint"]=r.searchHint),r?.alwaysLoad&&(o["anthropic/alwaysLoad"]=!0),{name:e,description:t,inputSchema:n,handler:i,annotations:r?.annotations,_meta:Object.keys(o).length>0?o:void 0}}function wie(e){let t=new gb({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});return e.tools&&e.tools.forEach(n=>{for(let i of Object.values(n.inputSchema)){if(!kie(i))continue;let r=i.description;r&&!Si.has(i)&&Si.add(i,{description:r})}t.registerTool(n.name,{description:n.description,inputSchema:n.inputSchema,annotations:n.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...n._meta}:n._meta},n.handler)}),{type:"sdk",name:e.name,instance:t}}function kie(e){return typeof e=="object"&&e!==null&&"_zod"in e}function Y(e){let t;return()=>t??=e()}function Tie(e){if(e.startsWith("cc://")){let i=e.slice(5),r=new URL(`http://${i}`),o=r.pathname.slice(1)||void 0;return{serverUrl:`http://${r.host}`,authToken:o}}if(e.startsWith("cc+unix://"))throw new or("Unix socket connect (cc+unix://) is not supported by the SDK transport");let t=/^https?:\/\//i.test(e)?e:`http://${e}`,n=new URL(t);return{serverUrl:`${n.protocol}//${n.host}`,authToken:void 0}}async function Cie(e){let t={"content-type":"application/json"};e.authToken&&(t.authorization=`Bearer ${e.authToken}`);let n={};e.cwd&&(n.cwd=e.cwd),e.sessionKey&&(n.session_key=e.sessionKey),e.permissionMode&&(n.permission_mode=e.permissionMode);let i;try{i=await fetch(`${e.serverUrl}/sessions`,{method:"POST",headers:t,body:qt(n)})}catch(o){throw new or(`Failed to connect to server at ${e.serverUrl}: ${o instanceof Error?o.message:String(o)}`,"session_create_failed")}if(!i.ok){let o=await i.text().catch(()=>"");throw new or(`Failed to create session: ${i.status} ${i.statusText}${o?` \u2014 ${o}`:""}`,"session_create_failed")}let r=xie().safeParse(await i.json());if(!r.success)throw new or(`Invalid session response: ${r.error.message}`,"session_create_invalid_response");return{sessionId:r.data.session_id,wsUrl:r.data.ws_url,workDir:r.data.work_dir}}async function zI(e,t,n){let i={};n&&(i.authorization=`Bearer ${n}`);try{await fetch(`${e}/sessions/${t}`,{method:"DELETE",headers:i})}catch{}}function tN(){}async function Pie(e,t){let n=Kn();try{await n.appendFile(e,t)}catch{await n.mkdir(Eie(e)).catch(tN),await n.appendFile(e,t)}}function vb(e,t,n){let i=Oie();if(!i)return;let r={timestamp:new Date().toISOString(),level:e,event:t,data:n??{}},o=qt(r)+`
177
- `;bb=bb.then(Pie.bind(null,i,o)).catch(tN),!JI&&(JI=!0,e$(Iie))}function Iie(){return bb}function Oie(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}function Rie(e,t,n){let i=e.statSync(t);if(i.isDirectory())throw Object.assign(Error("EISDIR: illegal operation on a directory, read"),{code:"EISDIR",errno:-21,syscall:"read",path:t});if(!i.isFile())throw Object.assign(Error("Not a regular file (device, FIFO, or socket)"),{code:"ERR_NOT_REGULAR_FILE",path:t});if(n!==void 0&&i.size>n)throw Object.assign(Error("File exceeds maxBytes limit"),{code:"ERR_FILE_TOO_LARGE",path:t,size:i.size,maxBytes:n})}function $ie(e){let{buffer:t,bytesRead:n}=Kn().readSync(e,{length:4096});return n===0?"utf8":n>=2&&t[0]===255&&t[1]===254?"utf16le":(n>=3&&t[0]===239&&t[1]===187&&t[2]===191,"utf8")}function Mie(e){let t=0,n=0;for(let i=0;i<e.length;i++)e[i]===`
178
- `&&(i>0&&e[i-1]==="\r"?t++:n++);return t>n?"CRLF":"LF"}function jie(e,t){let n=Kn(),{resolvedPath:i,isSymlink:r}=t$(n,e);r&&ze(`Reading through symlink: ${e} -> ${i}`),Rie(n,i,t);let o=$ie(i),a=n.readFileSync(i,{encoding:o}),s=Mie(a.slice(0,4096));return{content:a.replaceAll(`\r
179
- `,`
180
- `),encoding:o,lineEndings:s}}function Fm(e,t){return jie(e,t).content}function nN(e){return e.startsWith("\uFEFF")?e.slice(1):e}function Die(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Sb.platform==="darwin"?qie(e):Sb.platform==="win32"?Nie(e):Fie(e)}function Lie(){return process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC?"essential-traffic":process.env.DISABLE_TELEMETRY||cn(process.env.DO_NOT_TRACK)?"no-telemetry":"default"}function Uie(){return Lie()==="essential-traffic"}function zie(e){i_.length>=Gie&&i_.shift(),i_.push(e)}function iN(e){let t=cu(e);try{if(cn(process.env.CLAUDE_CODE_USE_BEDROCK)||cn(process.env.CLAUDE_CODE_USE_VERTEX)||cn(process.env.CLAUDE_CODE_USE_FOUNDRY)||cn(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||cn(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||Uie())return;let n={error:t.stack||t.message,timestamp:new Date().toISOString()};if(zie(n),ZI===null){Jie.push({type:"error",error:t});return}ZI.logError(t)}catch{}}function Bie(e,t,n=100){let i=new xb({max:n}),r=(...o)=>{let a=t(...o),s=i.get(a);if(s!==void 0)return s;let d=e(...o);return i.set(a,d),d};return r.cache={clear:()=>i.clear(),size:()=>i.size,delete:o=>i.delete(o),get:o=>i.peek(o),has:o=>i.has(o)},r}function dN(e,t){try{return{ok:!0,value:JSON.parse(nN(e))}}catch(n){return t&&iN(jH(n,`safeParseJSON: invalid JSON (${n instanceof Error?n.constructor.name:typeof n}, ${e.length} bytes)`)),{ok:!1}}}function Zie(e,t,n){(n!==void 0&&!uu(e[t],n)||n===void 0&&!(t in e))&&tv(e,t,n)}function Qie(e){return function(t,n,i){for(var r=-1,o=Object(t),a=i(t),s=a.length;s--;){var d=a[e?s:++r];if(n(o[d],d,o)===!1)break}return t}}function toe(e){return Yi(e)&&cm(e)}function doe(e){if(!Yi(e)||Ho(e)!=roe)return!1;var t=sv(e);if(t===null)return!0;var n=aoe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&uN.call(n)==soe}function uoe(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function coe(e){return wV(e,ov(e))}function poe(e,t,n,i,r,o,a){var s=Cb(e,n),d=Cb(t,n),l=a.get(d);if(l){Tb(e,n,l);return}var u=o?o(s,d,n+"",e,t,a):void 0,c=u===void 0;if(c){var p=ur(d),f=!p&&Dl(d),h=!p&&!f&&rv(d);u=d,p||f||h?ur(s)?u=s:noe(s)?u=z9(s):f?(c=!1,u=DR(d,!0)):h?(c=!1,u=b3(d,!0)):u=[]:loe(d)||Fl(d)?(u=s,Fl(s)?u=foe(s):(!Qr(s)||Bb(s))&&(u=k3(d))):c=!1}c&&(a.set(d,u),r(u,d,i,o,a),a.delete(d)),Tb(e,n,u)}function cN(e,t,n,i,r){e!==t&&eoe(t,function(o,a){if(r||(r=new Tl),Qr(o))moe(e,t,a,n,cN,i,r);else{var s=i?i(Cb(e,a),o,a+"",e,t,r):void 0;s===void 0&&(s=o),Tb(e,a,s)}},ov)}function goe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _oe(e,t,n){return t=XI(t===void 0?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=XI(i.length-t,0),a=Array(o);++r<o;)a[r]=i[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=i[r];return s[t]=n(a),yoe(e,this,s)}}function boe(e){return function(){return e}}function Coe(e){var t=0,n=0;return function(){var i=Toe(),r=xoe-(i-n);if(n=i,r>0){if(++t>=koe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Poe(e,t){return pN(fN(e,t,cv),e+"")}function Ooe(e,t,n){if(!Qr(n))return!1;var i=typeof t;return(i=="number"?cm(n)&&um(t,n.length):i=="string"&&t in n)?uu(n[t],e):!1}function $oe(e){return Ioe(function(t,n){var i=-1,r=n.length,o=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(r--,o):void 0,a&&Roe(n[0],n[1],a)&&(o=r<3?void 0:o,r=1),t=Object(t);++i<r;){var s=n[i];s&&e(t,s,i,o)}return t})}function qoe(e,t,n,i){if(!Qr(e))return e;t=fm(t,e);for(var r=-1,o=t.length,a=o-1,s=e;s!=null&&++r<o;){var d=fu(t[r]),l=n;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(r!=a){var u=s[d];l=i?i(u,d,s):void 0,l===void 0&&(l=Qr(u)?u:um(t[r+1])?[]:{})}OR(s,d,l),s=s[d]}return e}function Foe(e,t,n){for(var i=-1,r=t.length,o={};++i<r;){var a=t[i],s=uv(e,a);n(s,a)&&Noe(o,fm(a,e),s)}return o}function Doe(e,t){return mN(e,t,function(n,i){return ZR(e,i)})}function Uoe(e){return ur(e)||Fl(e)||!!(eO&&e&&e[eO])}function hN(e,t,n,i,r){var o=-1,a=e.length;for(n||(n=Goe),r||(r=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?hN(s,t-1,n,i,r):av(r,s):i||(r[r.length]=s)}return r}function Joe(e){var t=e==null?0:e.length;return t?zoe(e,1):[]}function Boe(e){return pN(fN(e,void 0,Koe),e+"")}function Qoe(e){if(typeof e!="function")throw TypeError(Zoe);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Xoe(e,t){if(e==null)return{};var n=HR(i3(e),function(i){return[i]});return t=QR(t),mN(e,n,function(i,r){return t(i,r[0])})}function tae(e,t){return eae(e,Yoe(QR(t)))}function lae(){return void 0??rae(Fs(),aae)}function uae(){try{let e=Fm(lae()),t=$r(nN(e));return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function fae(e){if(!e?.env)return e;let t=nae(e.env,(n,i)=>cae.has(i.toUpperCase()));return{...e,env:t}}function pae(){if(!void 0&&sae!==!0)return null;if(a_)return a_;let e=uae();return e?(a_=e,mv(),e):null}function mae(){let e=pae();return e===dae||void 0?e:fae(e)}function bN(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=WK("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function vae(){let e="";try{e=gae().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${tO}.plist`,label:"per-user managed preferences"}),t.push({path:`/Library/Managed Preferences/${tO}.plist`,label:"device-level managed preferences"}),t}function Rae(){let e=m.object({type:m.literal("command").describe("Shell command hook type"),command:m.string().describe("Shell command to execute"),args:m.array(m.string()).optional().describe("Argument list for exec form. When present, `command` is resolved as an executable and spawned directly with these arguments \u2014 no shell. Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:fl(),shell:m.enum(Oae).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:m.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:m.string().optional().describe("Custom status message to display in spinner while hook runs"),once:m.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:m.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:m.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:m.string().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:m.string().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".')}),t=m.object({type:m.literal("prompt").describe("LLM prompt hook type"),prompt:m.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:fl(),timeout:m.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:m.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:m.boolean().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:m.string().optional().describe("Custom status message to display in spinner while hook runs"),once:m.boolean().optional().describe("If true, hook runs once and is removed after execution")}),n=m.object({type:m.literal("mcp_tool").describe("MCP tool hook type"),server:m.string().describe("Name of an already-configured MCP server to invoke"),tool:m.string().describe("Name of the tool on that server to call"),input:m.record(m.string(),m.unknown()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:fl(),timeout:m.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:m.string().optional().describe("Custom status message to display in spinner while hook runs"),once:m.boolean().optional().describe("If true, hook runs once and is removed after execution")}),i=m.object({type:m.literal("http").describe("HTTP hook type"),url:m.string().url().describe("URL to POST the hook input JSON to"),if:fl(),timeout:m.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:m.record(m.string(),m.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:m.array(m.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:m.string().optional().describe("Custom status message to display in spinner while hook runs"),once:m.boolean().optional().describe("If true, hook runs once and is removed after execution")}),r=m.object({type:m.literal("agent").describe("Agentic verifier hook type"),prompt:m.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:fl(),timeout:m.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:m.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:m.string().optional().describe("Custom status message to display in spinner while hook runs"),once:m.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:i,AgentHookSchema:r,McpToolHookSchema:n}}function Hae(e){return TN.has(e.toLowerCase())?!1:Wae.test(e)?!0:Bae.test(e)}function gse(e){let t=m.record(m.string(),m.unknown()).safeParse(e);if(!t.success)return;let n=Object.create(null);for(let[i,r]of Object.entries(t.data)){let o=hse().safeParse(r);pse.test(i)&&o.success&&(n[i]=o.data)}return Object.keys(n).length>0?n:void 0}function Cse(e){let t=xse();return e.flatMap((n,i)=>{let r=t.safeParse(n);if(r.success)return[r.data];let o=Tse().safeParse(n).data?.name,a=r.error.issues.map(s=>`${s.path.join(".")}: ${s.message}`).join(", ");return o?(ze(`Stubbing unparseable marketplace plugin entry (${o}): ${a}`,{level:"warn"}),[{name:o,source:{source:"unsupported"},strict:!0}]):(ze(`Dropping unparseable marketplace plugin entry (index ${i}): ${a}`,{level:"warn"}),[])})}function MN(){return jse.filter(e=>Um[e].buildGate())}function qse(e){let t={};for(let n of e)t={...t,...Um[n].shape()};return t}function Nse(e){let t={};for(let n of e)t={...t,...Um[n].permissionsShape?.()};return t}function Fse(e){let t=[];for(let n of e)t.push(...Um[n].permissionModes?.()??[]);return t}function jN(e){let t=e.split("__"),[n,i,...r]=t;if(n!=="mcp"||!i)return null;let o=r.length>0?r.join("__"):void 0;return{serverName:i,toolName:o}}function Qa(e){return Object.hasOwn(sO,e)?sO[e]:e}function dO(e){return e.includes("*")}function Dse(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function Lse(e){let t=Use(e,"(");if(t===-1)return{toolName:Qa(e)};let n=Gse(e,")");if(n===-1||n<=t)return{toolName:Qa(e)};if(n!==e.length-1)return{toolName:Qa(e)};let i=e.substring(0,t),r=e.substring(t+1,n);if(!i)return{toolName:Qa(e)};if(r===""||r==="*")return{toolName:Qa(i)};let o=Dse(r);return{toolName:Qa(i),ruleContent:o}}function Use(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let i=0,r=n-1;for(;r>=0&&e[r]==="\\";)i++,r--;if(i%2===0)return n}return-1}function Gse(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let i=0,r=n-1;for(;r>=0&&e[r]==="\\";)i++,r--;if(i%2===0)return n}return-1}function zse(e){return Kp.filePatternTools.includes(e)}function Jse(e){return Kp.bashPrefixTools.includes(e)}function Kse(e){return Object.hasOwn(Kp.customValidation,e)?Kp.customValidation[e]:void 0}function NN(e,t){let n=0,i=t-1;for(;i>=0&&e[i]==="\\";)n++,i--;return n%2!==0}function d_(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&!NN(e,i)&&n++;return n}function Bse(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"&&!NN(e,t))return!0;return!1}function lO(e){if(!dO(e))return null;let t=jN(e);return t&&!dO(t.serverName)?null:{valid:!1,error:`Wildcard tool name "${e}" is not supported in allow rules`,suggestion:"An allow pattern must name the scope it widens \u2014 globs are permitted only in the tool position after a literal mcp__<server>__ prefix. Deny and ask rules accept wildcards anywhere",examples:["mcp__puppeteer__*","mcp__github__get_*"]}}function FN(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let n=d_(e,"("),i=d_(e,")");if(n!==i)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(Bse(e)){let s=e.substring(0,e.indexOf("("));return s?{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${s}" without parentheses`,examples:[`${s}`,`${s}(some-pattern)`]}:{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"}}let r=Lse(e),o=jN(r.toolName);if(o){if(r.ruleContent!==void 0||d_(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${r.toolName}" without parentheses, or use "mcp__${o.serverName}__*" for all tools`,examples:[`mcp__${o.serverName}`,`mcp__${o.serverName}__*`,o.toolName&&o.toolName!=="*"?`mcp__${o.serverName}__${o.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let s=lO(r.toolName);if(s)return s}return{valid:!0}}if(!r.toolName||r.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let s=lO(r.toolName);if(s)return s}if(!r.toolName.includes("_")&&r.toolName[0]!==r.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${fZ(String(r.toolName))}"`};let a=Kse(r.toolName);if(a&&r.ruleContent!==void 0){let s=a(r.ruleContent);if(!s.valid)return s}if(Jse(r.toolName)&&r.ruleContent!==void 0){let s=r.ruleContent;if(s.includes(":*")&&!s.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(s===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}return zse(r.toolName)&&r.ruleContent!==void 0&&r.ruleContent.includes(":*")?{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${r.toolName}(*.ts) - matches .ts files`,`${r.toolName}(src/**) - matches all files in src`,`${r.toolName}(**/*.test.ts) - matches test files`]}:{valid:!0}}function DN(e){return m.string().superRefine((t,n)=>{let i=FN(t,e);if(!i.valid){let r=i.error;i.suggestion&&(r+=`. ${i.suggestion}`),i.examples&&i.examples.length>0&&(r+=`. Examples: ${i.examples.join(", ")}`),n.addIssue({code:m.ZodIssueCode.custom,message:r,params:{received:t}})}})}function LN(e){return m.object({allow:m.array(Wse()).optional().describe("List of permission rules for allowed operations"),deny:m.array(uO()).optional().describe("List of permission rules for denied operations"),ask:m.array(uO()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:m.enum([...Pw,...Fse(e)]).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:m.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...Nse(e),additionalDirectories:m.array(m.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}function Yse(e){return m.object({$schema:m.string().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:m.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:m.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:m.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:m.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:m.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),policyHelper:Zse().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...cn(process.env.CLAUDE_CODE_ENABLE_XAA)&&{xaaIdp:m.object({issuer:m.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:m.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:m.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:m.object({type:m.literal("command"),command:m.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:m.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:m.object({enabled:m.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:m.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 120). Re-fires every interval until you take a break."),breakThresholdMinutes:m.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 15)"),message:m.string().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks \u2014 just a friendly heads-up."),quietHours:m.object({enabled:m.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:m.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:m.string().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:m.number().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),skillListingMaxDescChars:m.number().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:m.number().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:m.boolean().optional().describe("When set to true in either admin-only Windows source \u2014 the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json \u2014 WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:Hse().optional().describe("Environment variables to set for Claude Code sessions"),attribution:m.object({commit:m.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:m.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:m.boolean().optional().describe("Whether to append the claude.ai session link to commits and PRs created from web or Remote Control sessions (default: true). Set to false to omit the Claude-Session trailer and PR-body link.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:m.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),includeGitInstructions:m.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:LN(e).optional().describe("Tool usage permissions configuration"),model:m.string().optional().describe("Override the default model used by Claude Code"),fallbackModel:m.array(m.string()).optional().describe('Fallback model(s) tried in order when the primary model is overloaded or unavailable. Each element accepts a model name or alias; "default" expands to the default model. CLI --fallback-model takes precedence.'),availableModels:m.array(m.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),enforceAvailableModels:m.boolean().optional().describe("When true and availableModels is a non-empty array, the Default model selection is also constrained: if the default model for the user tier is not in availableModels, Default resolves to the first allowed availableModels entry instead. Has no effect when availableModels is unset or an empty array. Typically set in managed settings by enterprise administrators."),modelOverrides:m.record(m.string(),m.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:m.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:m.array(m.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:m.array(m.string()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:m.boolean().optional().describe("When true in any settings source, claude.ai MCP cloud connectors are not auto-fetched or connected. Only gates auto-fetched connectors \u2014 a claudeai-proxy server passed explicitly (e.g. via --mcp-config or the SDK mcpServers option) still follows the normal MCP config trust flow. Any-source-true wins: a project can opt out, but a project-level false cannot override a user-level true."),skillOverrides:m.record(m.string(),m.enum(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),disableBundledSkills:m.boolean().optional().describe("Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely; built-in slash commands stay typable but are hidden from the model. Plugins, .claude/skills/, and .claude/commands/ are unaffected. Equivalent to CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1."),allowedMcpServers:m.array(Rw()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:m.array($w()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:zp().optional().describe("Custom commands to run before/after tool executions"),worktree:m.object({symlinkDirectories:m.array(m.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:m.array(m.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos \u2014 only the listed paths are written to disk."),baseRef:m.enum(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:m.enum(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:m.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:m.boolean().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:m.boolean().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:m.boolean().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:m.boolean().optional().describe("Disable the Artifact tool (also via CLAUDE_CODE_DISABLE_ARTIFACT)."),enableArtifact:m.boolean().optional().describe("Enable or disable the Artifact tool for this user. Unset defaults to enabled once the feature is available."),enableWorkflows:m.boolean().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowKeywordTriggerEnabled:m.boolean().optional().describe('Enable the "ultracode" keyword trigger: including the keyword in a prompt opts that turn into the Workflow tool. Set to false to disable the trigger. Default: true.'),disableSkillShellExecution:m.boolean().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:m.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),respondToBashCommands:m.boolean().optional().describe("Whether Claude responds after an input-box ! bash command runs. Set to false to add the command output to context without a response. Default: true."),allowManagedHooksOnly:m.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:m.array(m.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:m.array(m.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:m.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:m.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:m.boolean().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:m.preprocess(t=>Array.isArray(t)?t.filter(n=>cO.includes(n)):t,m.union([m.boolean(),m.array(m.enum(cO))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control \u2014 plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:m.object({type:m.literal("command"),command:m.string(),padding:m.number().optional(),refreshInterval:m.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:m.boolean().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:m.string().optional().describe('URL template for PR links in the footer link badges and inline messages. The detected git PR is rendered as the first footer-link badge. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),footerLinksRegexes:m.array(Qse().catch(fO)).transform(t=>t.filter(n=>n!==fO)).optional().catch(void 0).describe("Extra clickable footer badges that appear when a regex matches turn output (tool results and assistant responses). Read from user, flag, and managed settings only; ignored in project .claude/settings.json and local .claude/settings.local.json. At most 5 badges render; the oldest is displaced by newer matches and /clear removes them. Use to surface IDs printed by project CLIs as session links."),subagentStatusLine:m.object({type:m.literal("command"),command:m.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:m.record(m.string(),m.union([m.array(m.string()),m.boolean(),m.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json \u2014 setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:m.record(m.string(),Vse()).check(t=>{for(let[n,i]of Object.entries(t.value))i.source.source==="settings"&&i.source.name!==n&&t.issues.push({code:"custom",input:i.source.name,path:[n,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${n}" but source.name "${i.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:m.array(Jp()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only \u2014 it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:m.array(Jp()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),disableSideloadFlags:m.boolean().optional().describe("When true (and set in managed settings), rejects the --plugin-dir, --plugin-url, --agents, and non-sdk --mcp-config CLI flags at startup. Closes the CLI-flag bypass of strictKnownMarketplaces. Pair with allowedMcpServers for per-server MCP control; this setting does not gate other MCP entry points (SDK setMcpServers, claude mcp add, .mcp.json). Also blocks surfaces that spawn the CLI with these flags internally (see settings documentation). Only honored from managed settings; ignored in user/project/local settings."),pluginSuggestionMarketplaces:m.array(m.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips). No marketplace-declared suggestions surface without this allowlist; the built-in first-party frontend-design tip is unaffected. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored. The official marketplace is exempt from the source requirement: allowlisting its name alone suffices, since that name can only register from the official Anthropic source."),forceLoginMethod:m.enum(["claudeai","console","gateway"]).optional().catch(void 0).describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing, "gateway" for the Cloud gateway OIDC device flow'),forceLoginGatewayUrl:m.string().url().optional().catch(void 0).describe('@internal Cloud gateway URL to pre-fill and auto-connect to during login. Typically set in local managed settings alongside forceLoginMethod: "gateway" so users never type the URL. Hidden from public SDK types until Cloud gateway is documented.'),parentSettingsBehavior:m.enum(["first-wins","merge"]).optional().describe(`Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" (default): parent is dropped \u2014 admin tiers are the only policy source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),forceLoginOrgUUID:m.union([m.string(),m.array(m.string())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:m.boolean().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:m.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:m.string().optional().describe("Controls the output style for assistant responses"),viewMode:m.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:m.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:m.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:wN().optional(),feedbackSurveyRate:m.number().min(0).max(1).optional().describe("Probability (0\u20131) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:m.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:m.object({mode:m.enum(["append","replace"]),verbs:m.array(m.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:m.object({excludeDefault:m.boolean().optional(),tips:m.array(m.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:m.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:m.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:m.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:m.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),ultracode:m.boolean().optional().catch(void 0).describe("Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. Session-scoped \u2014 typically provided via --settings or the apply_flag_settings control request; interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model."),autoCompactWindow:m.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:m.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:m.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:m.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:m.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),awaySummaryEnabled:m.boolean().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:m.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:m.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:m.array(m.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:m.record(m.string(),m.object({mcpServers:m.record(m.string(),m.record(m.string(),m.union([m.string(),m.number(),m.boolean(),m.array(m.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:m.record(m.string(),m.union([m.string(),m.number(),m.boolean(),m.array(m.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(m.undefined())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:m.object({defaultEnvironmentId:m.string().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:m.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:m.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:m.string().optional().describe("Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup with instructions to update. Only enforced from managed (policy) settings."),requiredMaximumVersion:m.string().optional().describe("Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. Only enforced from managed (policy) settings."),plansDirectory:m.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:m.enum(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),voice:m.object({enabled:m.boolean().optional(),mode:m.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:m.boolean().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:m.boolean().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:m.array(m.object({marketplace:m.string(),plugin:m.string()})).optional().describe("Managed-org allowlist of channel plugins. When set, replaces the default Anthropic allowlist \u2014 admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:m.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:m.boolean().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),totalTokensReminder:m.enum(["off","infinite","fixed","countdown","padded-countdown"]).optional().describe("@internal Emit a <total_tokens>N tokens left</total_tokens> block in the system prompt and after each tool result. 'infinite' uses the literal value Infinite, 'fixed' uses 5000000, 'countdown' uses the live remaining context-window tokens, 'padded-countdown' counts down from totalTokensReminderBudget by per-agent cumulative context spend (monotonic across compaction and /clear). Defaults to off. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:m.number().int().positive().optional().describe("@internal Starting budget (tokens) for totalTokensReminder 'padded-countdown' mode. Defaults to 15000000. Server-controlled via GrowthBook; env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET overrides."),autoMemoryEnabled:m.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:m.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:m.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:m.boolean().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:m.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:m.boolean().optional().describe("@internal Whether the user has accepted the multi-agent workflow usage warning. Until set, auto permission mode prompts before running a workflow."),disableAutoMode:m.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:m.array(m.object({id:m.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:m.string().describe("Display name for the SSH connection"),sshHost:m.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:m.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:m.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:m.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:m.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:m.array(m.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:m.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:m.union([m.enum(Eae),m.string().startsWith("custom:").transform(t=>t)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:m.enum(Tae).optional().catch(void 0).describe("Key binding mode for the prompt input"),verbose:m.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:m.enum(xae).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:m.boolean().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:m.boolean().optional().describe("@internal Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:m.boolean().optional().describe("When safety measures flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoScrollEnabled:m.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:m.boolean().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:m.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:m.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:m.boolean().optional().describe("Stamp each assistant message with its arrival time"),terminalProgressBarEnabled:m.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:m.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:m.enum(Cae).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:m.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:m.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:m.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:m.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:m.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:m.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...qse(e)}).passthrough()}function mO(e,t,n){return m.array(t.catch(i=>(n({path:`${e}[]`,message:`Invalid entry was ignored: ${i.issues[0]?.message??"failed validation"}`}),pO))).transform(i=>i.filter(r=>r!==pO)).optional()}function UN(e){let t=Gm(),n={};for(let[o,a]of Object.entries(t.shape))n[o]=a.catch(s=>{e({path:o,message:`${s.issues[0]?.message??"Failed schema validation"}. This field was ignored.`})});n.allowedMcpServers=mO("allowedMcpServers",Rw(),e).catch(()=>(e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[])),n.deniedMcpServers=mO("deniedMcpServers",$w(),e).catch(()=>{e({path:"deniedMcpServers",message:'"deniedMcpServers" was present but invalid and was dropped; its entries cannot be enforced until it is fixed.'})}),n.allowManagedMcpServersOnly=t.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),n.enforceAvailableModels=t.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),n.availableModels=m.array(m.unknown()).transform((o,a)=>{let s=[];for(let d of o)typeof d=="string"?s.push(d):e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(d)}); the entry was ignored.`});return s}).optional().catch(()=>(e({path:"availableModels",message:'"availableModels" was present but invalid; enforcing an empty allowlist (only the default model is available) until it is fixed.'}),[])),n.forceLoginOrgUUID=t.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let i=Object.freeze({mode:"deny"}),r=(o,a)=>m.array(a.catch(s=>(e({path:`sandbox.credentials.${o}[]`,message:`Invalid entry was ignored: ${s.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),i))).transform(s=>s.filter(d=>d!==i)).optional();return n.sandbox=wN().extend({credentials:m.object({files:r("files",vN()),envVars:r("envVars",SN()),allowPlaintextInject:m.boolean().optional().catch(o=>{e({path:"sandbox.credentials.allowPlaintextInject",message:`${o.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was ignored; plaintext credential injection stays disabled until it is fixed.`})})}).optional().catch(o=>{e({path:"sandbox.credentials",message:`${o.issues[0]?.message??"Failed schema validation"}. The credentials block was dropped; no credential protection is applied until it is fixed.`})})}).optional().catch(o=>{e({path:"sandbox",message:`${o.issues[0]?.message??"Failed schema validation"}. This field was ignored.`})}),m.object(n).passthrough().transform(o=>{for(let a of Object.keys(o))o[a]===void 0&&delete o[a];return o})}function tde(e){let t=Xse.find(i=>i.matches(e));if(!t)return null;let n={...t.tip};return e.code==="invalid_value"&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(i=>`"${i}"`).join(", ")}`),!n.docLink&&e.path&&(n.docLink=ede[gZ(e.path,".")]),n}function hO(e){return e.code==="invalid_type"}function gO(e){return e.code==="invalid_value"}function nde(e){return e.code==="unrecognized_keys"}function yO(e){return e.code==="too_small"}function us(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}function _O(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Bp(e,t){return e.issues.map(n=>{let i=n.path.map(String).join("."),r=n.message,o,a,s,d,l;if(gO(n))a=n.values.map(c=>String(c)),s=a.join(" | "),d=void 0,l=void 0;else if(hO(n)){s=n.expected;let c=_O(n.message);d=c??us(n.input),l=c??us(n.input)}else yO(n)?s=String(n.minimum):n.code==="custom"&&"params"in n&&(d=n.params.received,l=d);let u=tde({path:i,code:n.code,expected:s,received:d,enumValues:a,message:n.message,value:d});if(gO(n))o=a?.map(c=>`"${c}"`).join(", "),r=`Invalid value. Expected one of: ${o}`;else if(hO(n)){let c=_O(n.message)??us(n.input);n.expected==="object"&&c==="null"&&i===""?r="Invalid or malformed JSON":r=`Expected ${n.expected}, but received ${c}`}else if(nde(n)){let c=n.keys.join(", ");r=`Unrecognized ${pZ(n.keys.length,"field")}: ${c}`}else yO(n)&&(r=`Number must be greater than or equal to ${n.minimum}`,o=String(n.minimum));return{file:t,path:i,message:r,expected:o,invalidValue:l,suggestion:u?.suggestion,docLink:u?.docLink}})}function rde(e,t){if(!e||typeof e!="object")return[];let n=e;if(!n.permissions||typeof n.permissions!="object")return[];let i=n.permissions,r=[];for(let o of["allow","deny","ask"]){let a=i[o];Array.isArray(a)&&(i[o]=a.filter(s=>{if(typeof s!="string")return r.push({file:t,path:`permissions.${o}`,message:`Non-string value in ${o} array was removed`,severity:"warning",invalidValue:s}),!1;let d=FN(s,o);if(!d.valid){let l=`Invalid permission rule "${s}" was skipped: ${d.error}`;return d.suggestion&&(l+=`. ${d.suggestion}`),r.push({file:t,path:`permissions.${o}`,message:l,severity:"warning",invalidValue:s}),!1}return!0}))}return r}function ode(e,t){if(!e||typeof e!="object")return[];let n=e;if(!("hooks"in n))return[];if(n.hooks===null||typeof n.hooks!="object"||Array.isArray(n.hooks)){let o=us(n.hooks);return delete n.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${o}. This field was ignored.`,severity:"warning",invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"}]}let i=n.hooks,r=[];for(let o of Object.keys(i)){if(!ide.has(o)){delete i[o],r.push({file:t,path:`hooks.${o}`,message:`Unknown hook event "${o}" was ignored. Valid events: ${im.join(", ")}`,severity:"warning",invalidValue:o,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(i[o])){let a=us(i[o]);delete i[o],r.push({file:t,path:`hooks.${o}`,message:`Hook event "${o}" must be an array of matchers; received ${a}. This entry was ignored.`,severity:"warning",invalidValue:a,docLink:"https://code.claude.com/docs/en/hooks"})}}return r.length>0&&Object.keys(i).length===0&&delete n.hooks,r}function sde(e,t){if(!e||typeof e!="object")return[];let n=e,i=[];for(let{key:r,schema:o}of ade){if(!(r in n))continue;if(!Array.isArray(n[r])){let d=n[r];delete n[r],i.push({file:t,path:r,message:`"${r}" must be an array; received ${us(d)}. This field was ignored.`,severity:"warning",invalidValue:d});continue}let a=n[r],s=[];for(let d=0;d<a.length;d++){let l=o().safeParse(a[d]);l.success?s.push(a[d]):i.push({file:t,path:`${r}[${d}]`,message:`Invalid entry was ignored: ${l.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:a[d]})}s.length<a.length&&(n[r]=s)}return i}function du(e,t,n){return[...rde(e,t),...ode(e,t),...n?.skipMcpServerEntryFilter?[]:sde(e,t)]}function Mw(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),hae.filter(n=>t.has(n))}function dde(){return Qi(su(),"managed-settings.json")}function GN(e){if(Lm()==="wsl"&&e.wslInherits?.()){let t=l_(Gp);if(t.settings)return t;let n=l_(su());return{settings:n.settings,errors:[...t.errors,...n.errors]}}return l_(su())}function l_(e){let t=[],n={},i=!1,{settings:r,errors:o}=Wp(Qi(e,"managed-settings.json"),void 0,!0);t.push(...o),r&&Object.keys(r).length>0&&(n=Hi(n,r,Vi),i=!0);let a=Qi(e,"managed-settings.d");try{let l=Kn().readdirSync(a).filter(u=>(u.isFile()||u.isSymbolicLink())&&u.name.endsWith(".json")&&!u.name.startsWith(".")).map(u=>u.name).sort();for(let u of l){let{settings:c,errors:p}=Wp(Qi(a,u),void 0,!0);t.push(...p),c&&Object.keys(c).length>0&&(n=Hi(n,c,Vi),i=!0)}}catch(l){let u=yn(l);u!=="ENOENT"&&u!=="ENOTDIR"&&ze(`managed-settings.d read failed: ${l}`,{level:"error"})}let{wslInheritsWindowsSettings:s,...d}=n;return{settings:i&&Object.keys(d).length>0?n:null,errors:t}}function lde(e,t){Ds(e)?ze(`Broken symlink or missing file encountered for settings.json at path: ${t}`):ze(`settings file read failed at ${t}: ${e}`,{level:"error"})}function Wp(e,t,n){let i=S8(e);if(i)return{settings:i.settings?gs(i.settings):null,errors:i.errors};let r=fde(e,t,n);return w8(e,r),{settings:r.settings?gs(r.settings):null,errors:r.errors}}function zN(e){if(!e.mdm)return{settings:null,errors:[]};let t=e.mdm();return{settings:Object.keys(t.settings).length>0?t.settings:null,errors:t.errors}}function jw(e,t){let n=gs(e),i=du(n,t,{skipMcpServerEntryFilter:!0}),r=[],o=UN(a=>r.push({file:t,path:a.path,message:a.message,severity:"warning"})).safeParse(n);return o.success?{settings:Object.keys(o.data).length>0?o.data:null,errors:[...i,...r]}:{settings:null,errors:[...i,...Bp(o.error,t)]}}function JN(e){let t=e?.remote?e.remote():mae();return!t||Object.keys(t).length===0?{settings:null,errors:[]}:jw(t,"remote managed settings")}function ude(e){let t=e.parentManaged;return!t||Object.keys(t).length===0?{settings:null,errors:[]}:jw(t,"parent managed settings")}function KN(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let n=gs(t),i=du(n,"SDK inline settings"),r=Gm().safeParse(n);return r.success?{settings:r.data,errors:i}:{settings:null,errors:[...i,...Bp(r.error,"SDK inline settings")]}}function fde(e,t,n){try{let i;if(t!==void 0)i=t;else{let{resolvedPath:s}=t$(Kn(),e);i=Fm(s,cde)}if(i.trim()==="")return{settings:{},errors:[]};let r=gs(Dm(i,!1));if(n){let s=du(r,e,{skipMcpServerEntryFilter:!0}),d=[],l=UN(u=>d.push({file:e,path:u.path,message:u.message,severity:"warning"})).safeParse(r);return l.success?{settings:l.data,errors:[...s,...d]}:{settings:null,errors:[...s,...Bp(l.error,e)]}}let o=du(r,e),a=Gm().safeParse(r);if(!a.success){let s=Bp(a.error,e);return{settings:null,errors:[...o,...s]}}return{settings:a.data,errors:o}}catch(i){return lde(i,e),Ds(i)?{settings:null,errors:[]}:{settings:null,errors:[{file:e,path:"",message:`Settings file could not be read: ${i instanceof Error?i.message:String(i)}`,severity:"fatal"}]}}}function bO(e,t){switch(e){case"userSettings":return kl(Fs());case"policySettings":case"projectSettings":case"localSettings":return kl(t.cwd);case"flagSettings":return t.flagPath?Voe(kl(t.flagPath)):kl(t.cwd)}}function pde(e){return e.coworkPlugins||cn(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?"cowork_settings.json":"settings.json"}function Hp(e,t){switch(e){case"userSettings":return Qi(bO(e,t),pde(t));case"projectSettings":case"localSettings":return Qi(bO(e,t),mde(e));case"policySettings":return dde();case"flagSettings":return t.flagPath}}function mde(e){switch(e){case"projectSettings":return Qi(".claude","settings.json");case"localSettings":return Qi(".claude","settings.local.json")}}function BN(e,t){let n=m8(e);if(n!==void 0)return n;let i=_de(e,t);return h8(e,i),i}function hde(e){return!e||e.parentSettingsBehavior==="merge"}function gde(e,t){let n={};e.allowManagedHooksOnly===!0&&(n.allowManagedHooksOnly=!0),e.allowManagedMcpServersOnly===!0&&(n.allowManagedMcpServersOnly=!0),e.disableClaudeAiConnectors===!0&&(n.disableClaudeAiConnectors=!0),e.allowManagedPermissionRulesOnly===!0&&(n.allowManagedPermissionRulesOnly=!0);let i=e.strictPluginOnlyCustomization;if((i===!0||Array.isArray(i)&&i.length>0)&&(n.strictPluginOnlyCustomization=i),e.deniedMcpServers&&(n.deniedMcpServers=e.deniedMcpServers),t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID&&(n.forceLoginOrgUUID=e.forceLoginOrgUUID),t.allowedMcpServers===void 0&&e.allowedMcpServers&&(n.allowedMcpServers=e.allowedMcpServers),t.availableModels===void 0&&e.availableModels&&(n.availableModels=e.availableModels),e.enforceAvailableModels===!0&&(n.enforceAvailableModels=!0),e.permissions){let r=o_(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable"&&(r.disableBypassPermissionsMode="disable"),t.allowManagedPermissionRulesOnly!==!0){let{allow:o,additionalDirectories:a}=e.permissions;o&&t.sandbox?.network?.allowManagedDomainsOnly!==!0&&(r.allow=o),a&&(r.additionalDirectories=a)}Object.keys(r).length>0&&(n.permissions=r)}if(e.sandbox){let{network:r,filesystem:o,credentials:a}=e.sandbox,s={};if(e.sandbox.enabled===!0&&(s.enabled=!0),e.sandbox.failIfUnavailable===!0&&(s.failIfUnavailable=!0),e.sandbox.allowUnsandboxedCommands===!1&&(s.allowUnsandboxedCommands=!1),e.sandbox.autoAllowBashIfSandboxed===!1&&(s.autoAllowBashIfSandboxed=!1),r){let d=o_(r,["deniedDomains"]);r.allowManagedDomainsOnly===!0&&(d.allowManagedDomainsOnly=!0),t.sandbox?.network?.allowManagedDomainsOnly!==!0&&r.allowedDomains&&(d.allowedDomains=r.allowedDomains),Object.keys(d).length>0&&(s.network=d)}if(o){let d=o_(o,["denyRead","denyWrite"]);o.allowManagedReadPathsOnly===!0&&(d.allowManagedReadPathsOnly=!0),t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&o.allowRead&&(d.allowRead=o.allowRead),Object.keys(d).length>0&&(s.filesystem=d)}if(a){let d=(a.files??[]).filter(c=>c.mode==="deny"),l=(a.envVars??[]).filter(c=>c.mode==="deny"),u={...d.length>0&&{files:d},...l.length>0&&{envVars:l}};a.allowPlaintextInject===!1&&(u.allowPlaintextInject=!1),Object.keys(u).length>0&&(s.credentials=u)}Object.keys(s).length>0&&(n.sandbox=s)}return n}function yde(e){if(e.helper?.())return"helper";if(JN(e).settings)return"remote";if(zN(e).settings)return Lm()==="macos"?"plist":"hklm";if((e.file?.()??GN(e)).settings)return"file";if(WN(e).parentSlice)return"parent";let t=e.hkcu?.();return t&&Object.keys(t.settings).length>0?"hkcu":null}function WN(e){let t=[],{settings:n,errors:i}=JN(e);t.push(...i);let{settings:r,errors:o}=zN(e);t.push(...o);let{settings:a,errors:s}=e.file?.()??GN(e);t.push(...s);let{settings:d,errors:l}=ude(e);t.push(...l);let u=[n,r,a].filter(g=>g!==null),c=u[0]??null,p={allowManagedPermissionRulesOnly:u.some(g=>g.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:u.find(g=>g.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:u.find(g=>g.allowedMcpServers!==void 0)?.allowedMcpServers,availableModels:u[0]?.availableModels,sandbox:{network:{allowManagedDomainsOnly:u.some(g=>g.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:u.some(g=>g.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},f=d&&hde(c)?gde(d,p):null,h=f&&Object.keys(f).length>0?f:null;return{tiers:u,admin:c,parentSlice:h,errors:t}}function HN(e){let t=e.helper?.();if(t)return{settings:t,errors:e.helperWarnings?.()??[]};let{tiers:n,admin:i,parentSlice:r,errors:o}=WN(e);if(!i&&!r){let s=e.hkcu?.();return s&&Object.keys(s.settings).length>0?{settings:s.settings,errors:[...o,...s.errors]}:{settings:null,errors:[...o,...s?.errors??[]]}}let a=Hi({},r??{},i??{},Vi);return n.some(s=>s.forceRemoteSettingsRefresh===!0)&&(a.forceRemoteSettingsRefresh=!0),{settings:a,errors:o}}function _de(e,t){if(e==="policySettings")return HN(t).settings;let n=Hp(e,t),{settings:i}=n?Wp(n,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:r}=KN(t);if(r)return Hi(i||{},r,Vi)}return i}function bde(e,t){return A$([...e,...t])}function Vi(e,t,n){if(Array.isArray(e)&&Array.isArray(t))return n==="fallbackModel"?t:bde(e,t)}function vde(e){if(u_)return{settings:{},errors:[]};let t=Date.now();vb("info","settings_load_started"),u_=!0;try{let n=x8(),i={};n&&(i=Hi(i,n,Vi));let r=[],o=new Set,a=new Set,s=null;for(let d of Mw(e)){if(d==="policySettings"){let{settings:u,errors:c}=HN(e);s=u,u&&(i=Hi(i,u,Vi));for(let p of c){let f=`${p.file}:${p.path}:${p.message}`;o.has(f)||(o.add(f),r.push(p))}continue}let l=Hp(d,e);if(l){let u=kl(l);if(!a.has(u)){a.add(u);let{settings:c,errors:p}=Wp(l,d==="flagSettings"?e.flagExpectedContent:void 0);for(let f of p){let h=`${f.file}:${f.path}:${f.message}`;o.has(h)||(o.add(h),r.push(f))}c&&(i=Hi(i,c,Vi))}}if(d==="flagSettings"){let{settings:u,errors:c}=KN(e);for(let p of c){let f=`${p.file}:${p.path}:${p.message}`;o.has(f)||(o.add(f),r.push(p))}u&&(i=Hi(i,u,Vi))}}return s&&(s.availableModels!==void 0&&(i.availableModels=[...s.availableModels]),s.enforceAvailableModels!==void 0&&(i.enforceAvailableModels=s.enforceAvailableModels)),vb("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:a.size,error_count:r.length}),{settings:i,errors:r}}finally{u_=!1}}function Sde(e){let t=f8();if(t!==null)return t;let n=vde(e);return p8(n),n}function wde(e){let{settings:t}=Sde(e);return t||{}}function kde(e){mv();let t=[];for(let n of Mw(e)){let i=BN(n,e);i&&Object.keys(i).length>0&&t.push({source:n,settings:i})}return{effective:wde(e),sources:t}}function xde(e,t){let n=Mw(t);for(let i=n.length-1;i>=0;i--){let r=n[i];if(BN(r,t)?.[e]!==void 0)return r}return null}function pl(e,t){return new Promise(n=>{try{Tde(e,t,{encoding:"utf-8",timeout:bae,windowsHide:!0},(i,r)=>{n({stdout:r??"",code:i?1:0})})}catch{n({stdout:"",code:1})}})}function Ede(){return(async()=>{if(process.platform==="darwin"){let e=vae(),t=(await Promise.all(e.map(async({path:n,label:i})=>{if(!Cde(n))return{stdout:"",label:i,ok:!1};let{stdout:r,code:o}=await pl(yae,[..._ae,n]);return{stdout:r,label:i,ok:o===0&&!!r}}))).find(n=>n.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let e=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[t,n]=await Promise.all([pl(e,["query",Ab,"/v",is]),pl(e,["query",Eb,"/v",is])]);return{plistStdouts:null,hklmStdout:t.code===0?t.stdout:null,hkcuStdout:n.code===0?n.stdout:null}}if(bN()){let[e,t]=await Promise.all([pl(nO,["query",Ab,"/v",is]),pl(nO,["query",Eb,"/v",is])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function Pde(){return Ade}function Ide(){Vp||(Vp=(async()=>{let e=Date.now(),t=Pde()??Ede(),{mdm:n,hkcu:i,wslInherits:r}=jde(await t);VN=n,ZN=i,QN=r;let o=Date.now()-e;if(ze(`MDM settings load completed in ${o}ms`),Object.keys(n.settings).length>0){ze(`MDM settings found: ${Object.keys(n.settings).join(", ")}`);try{vb("info","mdm_settings_loaded",{duration_ms:o,key_count:Object.keys(n.settings).length,error_count:n.errors.length})}catch{}}})())}async function Ode(){Vp||Ide(),await Vp}function Rde(){return VN??Ki}function $de(){return ZN??Ki}function Mde(){return QN}function c_(e,t){let n=Dm(e,!1);if(!n||typeof n!="object")return{settings:{},errors:[]};let{settings:i,errors:r}=jw(n,t);return{settings:i??{},errors:r}}function vO(e,t="Settings"){let n=e.split(/\r?\n/),i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`^\\s+${i}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let o of n){let a=o.match(r);if(a&&a[1])return a[1].trimEnd()}return null}function jde(e){let t=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:a,label:s}=e.plistStdouts[0],d=c_(a,s),{wslInheritsWindowsSettings:l,...u}=d.settings;if(Object.keys(u).length>0)return{mdm:d,hkcu:Ki,wslInherits:!1};t.push(...d.errors)}let n=null;if(e.hklmStdout){let a=vO(e.hklmStdout);a&&(n=c_(a,`Registry: ${Ab}\\${is}`))}n&&t.push(...n.errors);let i=t.length>0?{settings:{},errors:t}:Ki,r=bN(),o=!1;if(r&&(o=n?.settings.wslInheritsWindowsSettings===!0||Nde(),!o))return{mdm:i,hkcu:Ki,wslInherits:!1};if(n){let{wslInheritsWindowsSettings:a,...s}=n.settings;if(Object.keys(s).length>0)return{mdm:n,hkcu:Ki,wslInherits:o}}if(qde(o))return{mdm:i,hkcu:Ki,wslInherits:o};if(e.hkcuStdout){let a=vO(e.hkcuStdout);if(a){let s=c_(a,`Registry: ${Eb}\\${is}`);if(!r||s.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:d,...l}=s.settings;return{mdm:i,hkcu:{settings:l,errors:s.errors},wslInherits:o}}if(s.errors.length>0)return{mdm:i,hkcu:{settings:{},errors:s.errors},wslInherits:o}}}return{mdm:i,hkcu:Ki,wslInherits:o}}function qde(e){return e&&wO(Gp)?!0:wO(su())}function SO(e){let t=gs(Dm(Fm(e),!1));if(!t||typeof t!="object")return!1;du(t,e);let{wslInheritsWindowsSettings:n,...i}=t;return Object.keys(i).length>0}function Nde(){function e(t){try{let n=Dm(Fm(t),!1);return!!n&&typeof n=="object"&&"wslInheritsWindowsSettings"in n&&n.wslInheritsWindowsSettings===!0}catch{return!1}}if(e(ds(Gp,"managed-settings.json")))return!0;try{let t=ds(Gp,"managed-settings.d");for(let n of Kn().readdirSync(t))if((n.isFile()||n.isSymbolicLink())&&n.name.endsWith(".json")&&!n.name.startsWith(".")&&e(ds(t,n.name)))return!0}catch{}return!1}function wO(e){try{if(SO(ds(e,"managed-settings.json")))return!0}catch{}try{let t=ds(e,"managed-settings.d"),n=Kn().readdirSync(t);for(let i of n)if(!(!(i.isFile()||i.isSymbolicLink())||!i.name.endsWith(".json")||i.name.startsWith(".")))try{if(SO(ds(t,i.name)))return!0}catch{}}catch{}return!1}function Gde(e){let t=e.effective.permissions?.defaultMode;if(!t||!Lde.has(t))return e.effective;for(let n=e.sources.length-1;n>=0;n--){let i=e.sources[n];if(i.settings.permissions?.defaultMode!==void 0){if(Ude.has(i.source)){let{defaultMode:r,...o}=e.effective.permissions??{};return{...e.effective,permissions:o}}return e.effective}}return e.effective}async function zde(e={}){await Ode();let t={cwd:Aie(e.cwd??Kn().cwd()),allowedSources:(e.settingSources??Dde).map(n=>Fde[n]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Rde,hkcu:$de,wslInherits:Mde,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}};try{let{effective:n,sources:i}=kde(t),r=yde(t)??void 0,o=i.map(({source:s,settings:d})=>({source:kO[s],settings:d,path:s==="policySettings"?void 0:Hp(s,t),...s==="policySettings"&&{policyOrigin:r}})),a={};for(let s of Object.keys(n)){let d=xde(s,t);d&&(a[s]={source:kO[d],path:d==="policySettings"?void 0:Hp(d,t),...d==="policySettings"&&{policyOrigin:r}})}return{effective:n,provenance:a,sources:o}}finally{mv()}}async function Jde(e){return zde(e)}async function Kde(e,t){try{await x4(e,t)}catch(n){if(!Ds(n))throw n}}async function Bde(e,t){if(!e)return;let n=e;try{let i=$r(e);i?.claudeAiOauth?.refreshToken&&(delete i.claudeAiOauth.refreshToken,n=qt(i))}catch{}await BO(t,n,{mode:384})}function Wde(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=jQ(MQ);return new Promise(t=>{S4("security",["find-generic-password","-a",NQ(),"-w","-s",e],{encoding:"utf-8",timeout:5e3,windowsHide:!0},(n,i)=>t(n?void 0:i.trim()||void 0))})}async function YN(e,t,n,i,r=6e4){if(!Rt(t))return;let o=mr(n),a=await qo(e.load({projectKey:o,sessionId:t}),r,`SessionStore.load() timed out after ${r}ms for session ${t}`);if(!a||a.length===0)return;let s=Un(E4(),`claude-resume-${zb()}`);try{let d=Un(s,"projects",o);await Iy(d,{recursive:!0});let l=Un(d,`${t}.jsonl`);await K_(l,a);let u=i?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,c=u??Un(p_(),".claude"),p;try{p=await KO(Un(c,".credentials.json"),"utf-8")}catch(f){if(!Ds(f))throw f}if(!u&&!(i??process.env).ANTHROPIC_API_KEY&&!(i??process.env).CLAUDE_CODE_OAUTH_TOKEN&&(p=await Wde()??p),await Bde(p,Un(s,".credentials.json")),await Kde(Un(u??p_(),".claude.json"),Un(s,".claude.json")),e.listSubkeys){let f=Un(d,t),h=await qo(e.listSubkeys({projectKey:o,sessionId:t}),r,`SessionStore.listSubkeys() timed out after ${r}ms for session ${t}`);for(let g of h){let _=Il(f,g+".jsonl");if(!g||WO(g)||g.split(/[\\/]/).includes("..")||!_.startsWith(f+Jb)){ze(`[SessionStore] skipping unsafe subpath from listSubkeys: ${g}`,{level:"warn"});continue}let y=await qo(e.load({projectKey:o,sessionId:t,subpath:g}),r,`SessionStore.load() timed out after ${r}ms for session ${t} subpath ${g}`);if(!y||y.length===0)continue;let b=[],v=[];for(let w of y)Mb(w)?b.push(w):v.push(w);if(v.length>0&&(await Iy(OE(_),{recursive:!0}),await K_(_,v)),b.length>0){let w=b.at(-1),A=Il(f,g+".meta.json");await Iy(OE(A),{recursive:!0});let{type:C,...S}=w;await BO(A,qt(S),{mode:384})}}}return s}catch(d){throw await Zp(s),d}}function Rb(e,t,n,i){let{systemPrompt:r,settings:o,managedSettings:a,settingSources:s,sandbox:d,...l}=e??{},u,c,p;r===void 0?u="":typeof r=="string"||Array.isArray(r)?u=r:r.type==="preset"&&(c=r.append,p=r.excludeDynamicSections),process.env.CLAUDE_AGENT_SDK_VERSION="0.3.199";let{abortController:f=m_(),additionalDirectories:h=[],agent:g,agents:_,allowedTools:y=[],betas:b,canUseTool:v,continue:w,cwd:A,debug:C,debugFile:S,disallowedTools:k=[],tools:T,env:E,executable:P=QO()?"bun":"node",executableArgs:R=[],extraArgs:O={},fallbackModel:M,enableFileCheckpointing:J,toolConfig:Z,forkSession:z,hooks:X,includeHookEvents:ee,includePartialMessages:B,forwardSubagentText:$,onElicitation:K,onUserDialog:F,supportedDialogKinds:x,persistSession:I,sessionStore:N,sessionStoreFlush:W,thinking:re,effort:me,maxThinkingTokens:be,maxTurns:Ce,maxBudgetUsd:j,taskBudget:L,mcpServers:H,model:ie,outputFormat:se,permissionMode:Se="default",allowDangerouslySkipPermissions:At=!1,permissionPromptToolName:sn,plugins:Zt,getOAuthToken:vt,getHostAuthToken:ut,workload:wn,resume:Qt,resumeSessionAt:io,sessionId:Fr,skills:ra,stderr:Pu,strictMcpConfig:Iu}=l;if(N&&I===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(x!==void 0&&x.length>0&&!F)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");if(N&&w&&!Qt&&!N.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(N&&J)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");N&&l.spawnClaudeCodeProcess&&ze("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"}),DQ(!!v,Se,y);let Ws=l.pathToClaudeCodeExecutable;if(!Ws){let jn=I4(import.meta.url),hr=A4(jn),oo=BZ(ia=>hr.resolve(ia));if(!oo)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);Ws=oo}let Qw=se?.type==="json_schema"?se.schema:void 0,pn=E?{...E}:{...process.env};pn.CLAUDE_CODE_ENTRYPOINT||(pn.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),pn.CLAUDE_AGENT_SDK_VERSION||(pn.CLAUDE_AGENT_SDK_VERSION="0.3.199"),J&&(pn.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),vt&&(pn.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1"),ut&&(pn.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1"),Z?.askUserQuestion?.previewFormat&&(pn.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=Z.askUserQuestion.previewFormat);let Wm={};if(tI.propagation.inject(tI.context.active(),Wm),"traceparent"in Wm)for(let jn of["TRACEPARENT","TRACESTATE"])jn in(E??{})||delete pn[jn];for(let[jn,hr]of Object.entries(Wm)){let oo=jn.toUpperCase();oo in(E??{})||(pn[oo]=hr)}let Yw={},Xw=new Map;if(H)for(let[jn,hr]of Object.entries(H))hr.type==="sdk"&&hr.instance?Xw.set(jn,hr.instance):Yw[jn]=hr;let Hs;if(re)switch(re.type){case"adaptive":Hs={type:"adaptive",display:re.display};break;case"enabled":Hs={type:"enabled",budgetTokens:re.budgetTokens,display:re.display};break;case"disabled":Hs={type:"disabled"};break}else be!==void 0&&(Hs=be===0?{type:"disabled"}:{type:"enabled",budgetTokens:be});n&&(pn.CLAUDE_CONFIG_DIR=n,process.platform==="win32"&&(pn.CLAUDE_SECURESTORAGE_CONFIG_DIR=E?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??E?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""));let ek=new L_({abortController:f,additionalDirectories:h,agent:g,betas:b,cwd:A,debug:C,debugFile:S,executable:P,executableArgs:R,extraArgs:wn?{...O,workload:wn}:O,pathToClaudeCodeExecutable:Ws,env:pn,forkSession:z,stderr:Pu,thinkingConfig:Hs,effort:me,maxTurns:Ce,maxBudgetUsd:j,taskBudget:L,model:ie,fallbackModel:M,jsonSchema:Qw,permissionMode:Se,allowDangerouslySkipPermissions:At,permissionPromptToolName:sn,continueConversation:N?void 0:w,resume:Qt,resumeSessionAt:io,sessionId:Fr,settings:typeof o=="object"?qt(o):o,managedSettings:a?qt(a):void 0,settingSources:s,skills:ra,allowedTools:y,disallowedTools:k,tools:T,mcpServers:Yw,strictMcpConfig:Iu,canUseTool:!!v,hooks:!!X,includeHookEvents:ee,includePartialMessages:B,persistSession:I,sessionMirror:!!N,plugins:Zt,sandbox:d,spawnClaudeCodeProcess:l.spawnClaudeCodeProcess,deferSpawn:i}),VF={systemPrompt:u,appendSystemPrompt:c,planModeInstructions:l.planModeInstructions,appendSubagentSystemPrompt:l.appendSubagentSystemPrompt,toolAliases:l.toolAliases,excludeDynamicSections:p,agents:_,title:l.title,skills:ra,webSearchIsolationExemptMcpServers:l.webSearchIsolationExemptMcpServers,promptSuggestions:l.promptSuggestions,agentProgressSummaries:l.agentProgressSummaries,forwardSubagentText:$,supportedDialogKinds:x},Hm=new G_(ek,t,v,X,f,Xw,Qw,VF,K,vt,ut,F);if(N){let jn=()=>Un(pn.CLAUDE_CONFIG_DIR??Un(p_(),".claude"),"projects"),hr=W==="eager",oo=new z_(async(ia,Vm)=>{let Vs=AO(ia,jn());Vs?await N.append(Vs,Vm):ze(`[SessionStore] dropping mirror frame: filePath ${ia} is not under ${jn()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(ia,Vm)=>{let Vs=AO(ia,jn());Vs&&Hm.reportMirrorError(Vs,Vm.message)},hr?0:gv,hr?0:yv);Hm.setTranscriptMirrorBatcher(oo)}return{queryInstance:Hm,transport:ek,abortController:f,processEnv:pn}}function $b(e,t,n,i){typeof n=="string"?t.write(qt({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:n}]},parent_tool_use_id:null})+`
181
- `):e.streamInput(n).catch(r=>i.abort(r))}async function Zp(e){for(let t=0;;t++)try{return await C4(e,{recursive:!0,force:!0})}catch(n){if(t>=4||!Hde.has(yn(n)??""))return;await rm((t+1)*100)}}function Vde(e,t){e.waitForExit().catch(()=>{}).finally(()=>Zp(t))}function Zde({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore){let{queryInstance:o,transport:a,abortController:s,processEnv:d}=Rb({...t},typeof e=="string",void 0,!0),l=Il(t.cwd??"."),u=t.sessionStore,c=t.loadTimeoutMs??6e4,p=t.resume;return(async()=>{if(p||(p=(await qo(u.listSessions(mr(l)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((f,h)=>h.mtime-f.mtime)[0]?.sessionId),!!p)return YN(u,p,l,t.env,t.loadTimeoutMs)})().then(f=>{if(f){a.updateResume(p);let h={CLAUDE_CONFIG_DIR:f};if(process.platform==="win32"){let g=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";h.CLAUDE_SECURESTORAGE_CONFIG_DIR=g,d.CLAUDE_SECURESTORAGE_CONFIG_DIR=g}a.updateEnv(h),d.CLAUDE_CONFIG_DIR=f,o.addCleanupCallback(()=>Vde(a,f))}o.isClosed()||a.spawn()}).catch(f=>{let h=cu(f);a.spawnAbort(h),o.setError(h)}),$b(o,a,e,s),o}let{queryInstance:n,transport:i,abortController:r}=Rb(t,typeof e=="string");return $b(n,i,e,r),n}async function Qde({options:e,initializeTimeoutMs:t=6e4}={}){let n,i=e?.resume;if((i||e?.continue)&&e?.sessionStore){let s=Il(e.cwd??".");if(!i){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let d=e.loadTimeoutMs??6e4;i=(await qo(e.sessionStore.listSessions(mr(s)),d,`SessionStore.listSessions() timed out after ${d}ms`)).slice().sort((l,u)=>u.mtime-l.mtime)[0]?.sessionId}i&&(n=await YN(e.sessionStore,i,s,e.env,e.loadTimeoutMs))}let r,o,a;try{let s=function(){p||(p=!0,c.close())},d=Rb(n&&i&&i!==e?.resume?{...e,resume:i}:e,!1,n);r=d.queryInstance;let{transport:l,abortController:u}=d;o=l;let c=d.queryInstance;if(n){let f=n;c.addCleanupCallback(()=>{a=l.waitForExit().catch(()=>{}).then(()=>Zp(f))})}await qo(c.initializationResult(),t,`Subprocess initialization did not complete within ${t}ms \u2014 check authentication and network connectivity`);let p=!1;return{query(f){if(p)throw Error("WarmQuery.query() can only be called once");p=!0;try{$b(c,l,f,u)}catch(h){throw c.close(),h}return typeof f=="string"&&c.setIsSingleUserTurn(!0),c},close:s,async[Symbol.asyncDispose](){p=!0,c.close(),await a}}}catch(s){if(r?.close(),n&&!a){let d=o;a=(d?d.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>Zp(n))}throw await a,s}}async function Yde(e,t){return t?.sessionStore?cle(t.sessionStore,e,t):B7(e,t)}async function Xde(e){return e?.sessionStore?lle(e.sessionStore,e):tQ(e)}async function ele(e,t){return t?.sessionStore?fle(t.sessionStore,e,t):nQ(e,t)}async function tle(e,t,n){return n?.sessionStore?ple(n.sessionStore,e,t,n.dir):oQ(e,t,n)}async function nle(e,t,n){return n?.sessionStore?mle(n.sessionStore,e,t,n.dir):aQ(e,t,n)}async function rle(e,t){if(!Rt(e))throw new Er(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=mr(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return sQ(e,t)}async function ile(e,t){return t?.sessionStore?hle(t.sessionStore,e,t):pQ(e,t)}async function ole(e,t,n){if(!Rt(e))throw new Er(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let i=await hm(e,n?.dir);if(!i)throw Error(`Session ${e} not found`);let r=mr(n?.dir),o=n?.batchSize&&n.batchSize>0?n.batchSize:gv;if(await xO(i.filePath,{projectKey:r,sessionId:e},t,o),n?.includeSubagents===!1)return;let a=i.filePath.replace(/\.jsonl$/,""),s=Un(a,"subagents");for(let d of await ale(s)){let l=HO(a,d).split(Jb);l[l.length-1]=l.at(-1).replace(/\.jsonl$/,"");let u={projectKey:r,sessionId:e,subpath:l.join("/")};await xO(d,u,t,o);let c=d.replace(/\.jsonl$/,".meta.json");try{let p=$r(await KO(c,"utf8"));await t.append(u,[{type:"agent_metadata",...p}])}catch(p){if(!Ds(p))throw p}}}async function xO(e,t,n,i){let r=P4({input:w4(e,{encoding:"utf8"}),crlfDelay:1/0}),o=[],a=0;for await(let s of r)s&&(o.push($r(s)),a+=s.length,(o.length>=i||a>=yv)&&(await n.append(t,o),o=[],a=0));o.length>0&&await n.append(t,o)}async function ale(e){let t=[];async function n(i){let r;try{r=await T4(i,{withFileTypes:!0})}catch{return}for(let o of r){let a=Un(i,o.name);o.isDirectory()?await n(a):o.isFile()&&o.name.endsWith(".jsonl")&&t.push(a)}}return await n(e),t}async function sle(e,t){return t?.sessionStore?gle(t.sessionStore,e,t.dir):vQ(e,t)}async function dle(e,t,n){return n?.sessionStore?yle(n.sessionStore,e,t,n):SQ(e,t,n)}function XN(e){let t=Il(e??"."),n;try{n=k4(t)}catch{n=t}return cs(n)}function mr(e){return mu(XN(e))}function eF(e){return e.map(t=>qt(t)).join(`
182
- `)+`
183
- `}function TO(e,t,n){return t!==void 0&&t>0?e.slice(n,n+t):n>0?e.slice(n):e}function Mb(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function lle(e,t){let n=XN(t.dir),i=mu(n),r=t.offset??0,o=t.limit;if(e.listSessionSummaries){let d=await e.listSessionSummaries(i),l=e.listSessions?new Map((await e.listSessions(i)).map(f=>[f.sessionId,f])):void 0,u=[];for(let f of d){let h=l?.get(f.sessionId);if(l&&!h)continue;let g=h!==void 0&&f.mtime<h.mtime;u.push({sessionId:f.sessionId,mtime:g?h.mtime:f.mtime,info:g?void 0:K4(f,n)})}if(l){let f=new Set(d.map(h=>h.sessionId));for(let[h,g]of l)f.has(h)||u.push({sessionId:h,mtime:g.mtime})}else ze("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");u.sort((f,h)=>h.mtime-f.mtime);let c=TO(u,o,r),p=c.filter(f=>f.info===void 0);if(p.length>0){let f=await CO(e,p,t.dir,n),h=new Map(f.map(g=>[g.sessionId,g]));for(let g of c)g.info===void 0&&(g.info=h.get(g.sessionId)??null)}return c.flatMap(f=>f.info?[f.info]:[])}if(!e.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let a=(await e.listSessions(i)).slice().sort((d,l)=>l.mtime-d.mtime),s=TO(a,o,r);return CO(e,s,t.dir,n)}async function CO(e,t,n,i){return(await Promise.allSettled(t.map(async r=>{let o=await nF(e,r.sessionId,n);if(!o)return null;let a=gm(r.sessionId,tF(o,r.mtime),i);return a?{...a,lastModified:r.mtime}:null}))).flatMap((r,o)=>{let a=t[o];return r.status==="fulfilled"?r.value?[r.value]:[]:[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function tF(e,t){let n=Buffer.from(e,"utf-8"),i=n.length,r=n.subarray(0,vi).toString("utf-8"),o=i>vi?n.subarray(i-vi).toString("utf-8"):r;return{mtime:t,size:i,head:r,tail:o}}function ule(e){let t=e.trimEnd(),n=t.slice(t.lastIndexOf(`
184
- `)+1);try{let i=$r(n);if(typeof i=="object"&&i!==null&&"timestamp"in i&&typeof i.timestamp=="string"){let r=Date.parse(i.timestamp);if(!Number.isNaN(r))return r}}catch{}return Date.now()}async function nF(e,t,n){let i=mr(n),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?null:eF(r)}async function cle(e,t,n){if(!Rt(t))return[];let i=mr(n.dir),r=await e.load({projectKey:i,sessionId:t});return!r||r.length===0?[]:K7(r,{limit:n.limit,offset:n.offset,includeSystemMessages:n.includeSystemMessages})}async function fle(e,t,n){if(!Rt(t))return;let i=await nF(e,t,n.dir);if(!i)return;let r=tF(i,ule(i));return gm(t,r)??void 0}async function ple(e,t,n,i){if(!Rt(t))throw new Er(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let r=mr(i);await e.append({projectKey:r,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:zb(),timestamp:new Date().toISOString()}])}async function mle(e,t,n,i){if(!Rt(t))throw new Er(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let o=Al(n).trim();if(!o)throw Error("tag must be non-empty (use null to clear)");n=o}let r=mr(i);await e.append({projectKey:r,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:zb(),timestamp:new Date().toISOString()}])}async function hle(e,t,n){if(!Rt(t))throw new Er(`Invalid sessionId: ${t}`,"forkSession: invalid sessionId (must be a UUID)");if(n.upToMessageId&&!Rt(n.upToMessageId))throw new Er(`Invalid upToMessageId: ${n.upToMessageId}`,"forkSession: invalid upToMessageId (must be a UUID)");let i=mr(n.dir),r=await e.load({projectKey:i,sessionId:t});if(!r||r.length===0)throw Error(`Session ${t} not found`);let{entries:o,forkedSessionId:a}=hQ(r,t,n);return await e.append({projectKey:i,sessionId:a},o),{sessionId:a}}async function gle(e,t,n){if(!Rt(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let i=mr(n),r=await e.listSubkeys({projectKey:i,sessionId:t}),o=new Set;for(let a of r){if(!a.startsWith("subagents/"))continue;let s=a.split("/").at(-1);s.startsWith("agent-")&&o.add(s.slice(6))}return[...o]}async function yle(e,t,n,i){if(!Rt(t))return[];if(!n)return[];let r=mr(i.dir),o=`subagents/agent-${n}`;if(e.listSubkeys){let u=await e.listSubkeys({projectKey:r,sessionId:t}),c=`agent-${n}`,p=u.find(f=>f.startsWith("subagents/")&&f.split("/").at(-1)===c);if(!p)return[];o=p}let a=await e.load({projectKey:r,sessionId:t,subpath:o});if(!a||a.length===0)return[];let s=a.findLast(Mb),d=typeof s?.toolUseId=="string"?s.toolUseId:void 0,l=a.filter(u=>!Mb(u));return l.length===0?[]:T$(Buffer.from(eF(l)),{limit:i.limit,offset:i.offset},d)}function AO(e,t){let n=HO(t,e),i=n.split(Jb);if(i[0]===".."||WO(n)||i.length<2)return null;let r=i[0],o=i[1];if(i.length===2&&o.endsWith(".jsonl"))return{projectKey:r,sessionId:o.replace(/\.jsonl$/,"")};if(i.length>=4){let a=i.slice(2),s=a.length-1;return a[s]=a.at(-1).replace(/\.jsonl$/,""),{projectKey:r,sessionId:o,subpath:a.join("/")}}return null}var FK,DK,f_,LK,UK,zK,JK,jb,V,KK,ei,WK,HK,VK,gt,yt,ZK,QK,YK,EO,XK,$s,eB,qb,tB,Ms,nB,rB,PO,Qp,iB,IO,oB,OO,aB,Yp,RO,Nb,Fb,$O,Db,MO,jO,sB,qO,dB,lB,uB,cB,fB,pB,mB,hB,gB,yB,_B,bB,vB,SB,wB,kB,xB,TB,Pf,IE,Pe,Fe,to,Xp,CB,NO,FO,If,AB,Rr,EB,PB,DO,IB,em,tm,Lb,nm,Ub,OB,LO,RB,$B,MB,jB,qB,NB,FB,DB,LB,UB,GB,zB,JB,KB,BB,Gb,WB,HB,VB,ZB,UO,GO,QB,YB,XB,e4,t4,zO,n4,r4,i4,o4,a4,s4,d4,l4,u4,c4,f4,p4,m4,h4,g4,y4,JO,_4,b4,v4,R4,cCe,im,L4,U4,G4,z4,J4,h_,En,qE,V4,Z4,YO,Q4,Y4,ti,X4,Zr,XO,eW,tW,Bd,rW,iW,oW,sW,dW,lW,NE,Ho,Qr,fW,pW,mW,hW,Bb,yW,Ry,FE,bW,vW,SW,Vo,kW,xW,TW,CW,AW,EW,PW,OW,$W,Zo,jW,Ol,NW,DW,LW,UW,GW,JW,KW,BW,HW,VW,QW,DE,XW,uu,om,n6,r6,o6,s6,l6,c6,am,f6,Rl,m6,g6,sm,b6,S6,k6,T6,dm,C6,rn,Fs,bCe,eR,g_,ve,bn,Jn,fs,$f,Mf,jf,qf,Nf,Ff,Df,Lf,Uf,P6,I6,y_,LE,R6,tR,$6,Bi,M6,q6,GE,zE,JE,Hb,L6,G6,z6,iR,Gf,J6,K6,Zb,B6,KE,$y,W6,Qe,b_,Ze,BE,WE,zf,VE,Z6,ZE,$o,lR,Q6,Y6,X6,Yb,eH,cR,Dn,Ln,Lo,Wd,Uo,v_,hl,Jf,nf,Kf,S_,Go,fn,hR,gR,Xb,YE,mH,hH,w_,yR,gH,yH,dt,_R,ne,XE,SH,he,Bf,xl,Wf,Hf,Vf,Zf,Ml,Qf,Yf,ps,Xf,ep,wR,xH,Ya,TH,CH,TR,nr,Di,Ja,Hd,rf,Vd,Zd,of,Qd,hi,Yd,af,sf,Po,df,lf,Xd,My,tP,uf,jy,qy,Ny,nP,rP,x_,tp,AH,EH,el,Ka,Io,Dt,An,Fn,bi,Li,tl,oP,T_,np,sP,IH,zo,rp,ip,ms,op,jl,ap,ql,In,sp,rr,Ui,Ba,nl,cf,rl,il,ff,ol,gi,al,pf,mf,Oo,hf,gf,sl,Fy,uP,Dy,Ly,Uy,Gy,cP,fP,C_,dp,Nl,mP,RH,lp,A_,ev,Af,ER,$H,MH,Ct,hs,Er,jH,VH,ZH,QH,YH,CCe,tV,E_,rV,Fo,Wa,aV,dV,uV,fV,pV,hV,Tl,gV,cp,tv,_V,bV,OR,wV,xV,Yi,CV,vP,RR,EV,PV,IV,Fl,OV,ur,gl,$V,$R,SP,MV,wP,jV,qV,Dl,NV,FV,um,LV,nv,GV,zV,JV,KV,BV,WV,HV,VV,ZV,QV,YV,XV,e9,t9,n9,r9,i9,o9,a9,s9,d9,l9,u9,c9,at,p9,h9,yl,MR,Cl,g9,By,y9,P_,kP,_9,rv,b9,v9,jR,w9,iv,qR,T9,C9,A9,E9,I9,cm,NR,M9,j9,q9,F9,ov,_l,FR,xP,L9,TP,CP,DR,z9,K9,LR,W9,H9,AP,V9,UR,av,Q9,sv,Y9,X9,e3,GR,EP,i3,o3,I_,a3,O_,s3,R_,d3,$_,PP,l3,IP,OP,RP,$P,u3,c3,f3,p3,m3,Mo,MP,h3,fp,y3,b3,jP,v3,S3,k3,x3,C3,E3,P3,O3,$3,M3,j3,zR,F3,L3,U3,G3,z3,J3,K3,B3,W3,H3,V3,Z3,Q3,Y3,X3,NP,Wy,t5,n5,r5,i5,a5,s5,FP,DP,yf,d5,LP,u5,KR,c5,f5,m5,BR,y5,WR,v5,S5,dv,k5,x5,lv,C5,E5,P5,I5,O5,R5,HR,M5,UP,GP,j5,N5,fm,D5,fu,uv,z5,K5,W5,ZR,V5,Z5,Y5,cv,t8,r8,o8,QR,YR,RCe,$Ce,u8,fv,mp,g8,y8,_8,b8,v8,pv,k8,C8,E8,P8,I8,MCe,O8,jCe,R8,qCe,$8,NCe,M8,FCe,hp,U8,UCe,G8,_f,dZ,lZ,mZ,HP,zCe,yZ,VP,n$,_Z,ZP,bZ,vZ,QP,N_,kZ,xZ,r$,TZ,i$,o$,AZ,EZ,dl,Hy,Xa,bl,XP,ll,Vy,F_,$Z,JCe,MZ,_t,$r,DZ,gp,eI,L_,Ha,yp,HZ,U_,Zy,G_,gv,yv,ZZ,z_,tI,Va,u7,c7,g7,vi,_7,v7,Ul,C7,A7,E7,bp,I7,Gl,O7,R7,iI,oI,V7,uQ,TQ,E$,CQ,AQ,EQ,yAe,PQ,_Ae,lI,IQ,RQ,MQ,qQ,Ne,uI,fe,Ji,te,dr,LQ,zl,UQ,V_,vn,ke,Sl,On,cI,fI,ys,vp,ge,cr,pI,Ie,GQ,zQ,JQ,KQ,BQ,WQ,HQ,VQ,ZQ,Xy,QQ,YQ,XQ,eY,tY,nY,P$,rY,_s,Jl,Kl,Bl,Wl,Hl,bs,vs,Vl,Zi,Yr,Zl,Xi,Bn,Ss,yi,Z_,ws,ki,Y_,Ql,Yl,X_,ks,xs,Ts,Cs,Jo,Pr,lr,xi,As,Es,Xl,Sp,wp,Ps,bAe,oe,vAe,SAe,wAe,kAe,xAe,TAe,CAe,AAe,EAe,PAe,IAe,OAe,RAe,$Ae,uY,MAe,jAe,qAe,NAe,FAe,DAe,LAe,UAe,GAe,zAe,JAe,KAe,BAe,WAe,HAe,VAe,ZAe,QAe,YAe,R$,$$,M$,eo,kp,Re,wv,N$,vY,xp,F$,L$,U$,eb,z$,kv,gu,Cv,Tp,Av,Cp,Ev,Sm,Pv,wm,Iv,W$,H$,V$,Z$,Q$,Y$,X$,PY,eM,Is,IY,OY,RY,tM,$Y,MY,jY,qY,NY,rM,iM,oM,aM,sM,Ov,dM,FY,lM,uM,cM,hM,gM,yM,_M,bM,vM,SM,wM,kM,$t,xM,Rv,$v,TM,CM,AM,EM,PM,IM,OM,RM,$M,yu,MM,jM,qM,NM,FM,DM,LM,UM,GM,Ap,zM,Te,_u,et,JM,KM,BM,WM,HM,VM,ZM,QM,YM,XM,e1,t1,n1,r1,i1,o1,a1,s1,d1,l1,c1,f1,m1,h1,jv,g1,qv,Nv,y1,_1,b1,v1,S1,Ep,w1,k1,x1,Fv,Dv,Lv,T1,C1,km,A1,E1,P1,I1,O1,R1,Uv,$1,M1,j1,q1,N1,F1,D1,L1,Gv,U1,G1,z1,J1,K1,zv,DY,UY,zY,KY,WY,VY,QY,YY,XY,eX,nX,iX,aX,dX,uX,fX,mX,gX,_X,vX,wX,xX,CX,EX,IX,RX,MX,qX,FX,LX,GX,JX,BX,HX,ZX,YX,XX,tee,ree,oee,see,lee,W1,H1,nu,Si,Q1,Op,ou,Ree,$ee,Mee,m,CS,AS,ES,PS,IS,Uj,Nee,vu,Gj,zj,Jj,Kj,Oe,OS,Am,lt,RS,Rp,wi,$S,MS,jS,qS,NS,FS,DS,LS,US,GS,zS,JS,KS,BS,WS,HS,Bj,Em,Us,Pm,Im,VS,Wj,Hj,Vj,Zj,Qj,Yj,Xj,QS,eq,Rm,YS,tq,nq,rq,ew,iq,oq,au,aq,sq,tw,rw,dq,lq,cq,iw,mq,hq,yq,ow,_q,vq,Sq,kq,Mm,$te,jte,Eq,zte,Pq,Iq,Jte,jo,jm,Gt,Oq,Rq,XAe,Kte,Bte,sw,Wn,Su,Wte,on,fr,pr,an,qm,$q,PI,Mq,Hte,dw,wf,we,lw,Vte,eEe,tEe,uw,Zte,cw,Qte,wu,Rs,jq,Yte,Xte,ene,tne,nne,rne,qq,ine,one,Nq,fw,ane,sne,pw,dne,ku,xu,lne,Tu,Nm,une,jp,mw,hw,gw,nEe,yw,_w,bw,cne,Fq,Dq,vw,Lq,Cu,Gs,Uq,fne,rb,pne,ib,mne,Sw,hne,ob,gne,yne,_ne,bne,vne,Sne,wne,kne,xne,Tne,ab,Cne,Ane,sb,ww,kw,xw,Ene,Pne,Ine,Tw,One,Rne,$ne,Mne,jne,Gq,db,qne,Cw,rEe,Nne,qp,Fne,iEe,Np,Dne,zq,Lne,Une,Gne,zne,Jne,Kne,Bne,Fp,Wne,Hne,Vne,Aw,Jq,Zne,Qne,Yne,Xne,ere,tre,nre,rre,ire,ore,are,sre,dre,lre,ure,cre,fre,pre,Dp,mre,hre,gre,lb,bre,vre,Sre,Kq,wre,oEe,aEe,sEe,dEe,lEe,uEe,_e,ub,kre,II,xre,Tre,Wq,Pre,Ire,Mre,n_,xr,Nre,Lp,RI,Vre,Zre,nie,rie,iie,oie,aie,die,cb,uie,cie,fb,pb,mb,Yq,FI,gie,hb,gb,bie,cl,GI,xie,or,_b,bb,JI,KI,mEe,hEe,BI,WI,HI,VI,Wi,Ew,rs,qie,Nie,Fie,bEe,Gie,i_,Jie,ZI,vEe,Za,oN,wb,aN,Up,QI,Kie,zi,sN,ls,kb,xb,Wie,YI,Dm,Lm,TEe,CEe,AEe,su,EEe,Tb,Yie,Xie,eoe,noe,roe,ioe,ooe,uN,aoe,soe,loe,Cb,foe,moe,hoe,yoe,XI,fN,voe,Soe,woe,koe,xoe,Toe,Aoe,Eoe,pN,Ioe,Roe,Moe,joe,Hi,Noe,mN,Loe,eO,Goe,zoe,Koe,Woe,Hoe,o_,Zoe,Yoe,eae,nae,gN,yN,_N,iae,oae,OEe,aae,a_,sae,dae,cae,hae,tO,Ab,Eb,is,yae,_ae,bae,nO,Gp,Sae,wae,vN,SN,kae,wN,xae,Tae,Cae,Aae,Eae,MEe,Pw,Pae,Iae,jEe,qEe,Oae,fl,$ae,Mae,zp,NEe,FEe,zs,ro,jae,qae,kN,xN,Nae,Fae,Dae,Lae,Uae,Gae,Iw,zae,Pb,DEe,Jae,Kae,TN,Bae,Wae,Or,Wo,iO,Ib,Ob,CN,Ow,Vae,LEe,Zae,Qae,Yae,Xae,ese,AN,tse,nse,rse,ise,EN,ose,oO,ase,sse,PN,dse,lse,aO,use,cse,IN,fse,ON,pse,mse,hse,yse,_se,bse,vse,Jp,s_,RN,Sse,wse,kse,xse,Tse,UEe,$N,Ase,Ese,Pse,Ise,Ose,Rse,$se,GEe,Mse,zEe,jse,kf,Um,sO,qN,JEe,KEe,Kp,uO,Wse,Hse,BEe,Vse,Rw,$w,Zse,cO,fO,Qse,Gm,pO,_i,Xse,ede,WEe,ide,ade,cde,u_,Ade,Ki,VN,ZN,QN,Vp,Fde,kO,Dde,Lde,Ude,Hde,iF=q(()=>{FK=Object.create,{getPrototypeOf:DK,defineProperty:f_,getOwnPropertyNames:LK}=Object,UK=Object.prototype.hasOwnProperty;jb=(e,t,n)=>{var i=e!=null&&typeof e=="object";if(i){var r=t?zK??=new WeakMap:JK??=new WeakMap,o=r.get(e);if(o)return o}n=e!=null?FK(DK(e)):{};let a=t||!e||!e.__esModule?f_(n,"default",{value:e,enumerable:!0}):n;for(let s of LK(e))UK.call(a,s)||f_(a,s,{get:GK.bind(e,s),enumerable:!0});return i&&r.set(e,a),a},V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),KK=e=>e;ei=(e,t)=>{for(var n in t)f_(e,n,{get:t[n],enumerable:!0,configurable:!0,set:BK.bind(t,n)})},WK=NK(import.meta.url),HK=Symbol.dispose||Symbol.for("Symbol.dispose"),VK=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),gt=(e,t,n)=>{if(t!=null){if(typeof t!="object"&&typeof t!="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(n&&(i=t[VK]),i===void 0&&(i=t[HK]),typeof i!="function")throw TypeError("Object not disposable");e.push([n,i,t])}else n&&e.push([n]);return t},yt=(e,t,n)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(a,s,d,l){return l=Error(d),l.name="SuppressedError",l.error=a,l.suppressed=s,l},r=a=>t=n?new i(a,t,"An error was suppressed during disposal"):(n=!0,a),o=a=>{for(;a=e.pop();)try{var s=a[1]&&a[1].call(a[2]);if(a[0])return Promise.resolve(s).then(o,d=>(r(d),o()))}catch(d){r(d)}if(n)throw t};return o()},ZK=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e._globalThis=void 0,e._globalThis=typeof globalThis=="object"?globalThis:global}),QK=V(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(ZK(),e)}),YK=V(e=>{var t=e&&e.__createBinding||(Object.create?function(i,r,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return r[o]}})}:function(i,r,o,a){a===void 0&&(a=o),i[a]=r[o]}),n=e&&e.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(QK(),e)}),EO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="1.9.0"}),XK=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isCompatible=e._makeCompatibilityCheck=void 0;var t=EO(),n=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(r){let o=new Set([r]),a=new Set,s=r.match(n);if(!s)return()=>!1;let d={major:+s[1],minor:+s[2],patch:+s[3],prerelease:s[4]};if(d.prerelease!=null)return function(c){return c===r};function l(c){return a.add(c),!1}function u(c){return o.add(c),!0}return function(c){if(o.has(c))return!0;if(a.has(c))return!1;let p=c.match(n);if(!p)return l(c);let f={major:+p[1],minor:+p[2],patch:+p[3],prerelease:p[4]};return f.prerelease!=null||d.major!==f.major?l(c):d.major===0?d.minor===f.minor&&d.patch<=f.patch?u(c):l(c):d.minor<=f.minor?u(c):l(c)}}e._makeCompatibilityCheck=i,e.isCompatible=i(t.VERSION)}),$s=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unregisterGlobal=e.getGlobal=e.registerGlobal=void 0;var t=YK(),n=EO(),i=XK(),r=n.VERSION.split(".")[0],o=Symbol.for(`opentelemetry.js.api.${r}`),a=t._globalThis;function s(u,c,p,f=!1){var h;let g=a[o]=(h=a[o])!==null&&h!==void 0?h:{version:n.VERSION};if(!f&&g[u]){let _=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${u}`);return p.error(_.stack||_.message),!1}if(g.version!==n.VERSION){let _=Error(`@opentelemetry/api: Registration of version v${g.version} for ${u} does not match previously registered API v${n.VERSION}`);return p.error(_.stack||_.message),!1}return g[u]=c,p.debug(`@opentelemetry/api: Registered a global for ${u} v${n.VERSION}.`),!0}e.registerGlobal=s;function d(u){var c,p;let f=(c=a[o])===null||c===void 0?void 0:c.version;if(!(!f||!(0,i.isCompatible)(f)))return(p=a[o])===null||p===void 0?void 0:p[u]}e.getGlobal=d;function l(u,c){c.debug(`@opentelemetry/api: Unregistering a global for ${u} v${n.VERSION}.`);let p=a[o];p&&delete p[u]}e.unregisterGlobal=l}),eB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagComponentLogger=void 0;var t=$s();class n{constructor(o){this._namespace=o.namespace||"DiagComponentLogger"}debug(...o){return i("debug",this._namespace,o)}error(...o){return i("error",this._namespace,o)}info(...o){return i("info",this._namespace,o)}warn(...o){return i("warn",this._namespace,o)}verbose(...o){return i("verbose",this._namespace,o)}}e.DiagComponentLogger=n;function i(r,o,a){let s=(0,t.getGlobal)("diag");if(s)return a.unshift(o),s[r](...a)}}),qb=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagLogLevel=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.ERROR=30]="ERROR",n[n.WARN=50]="WARN",n[n.INFO=60]="INFO",n[n.DEBUG=70]="DEBUG",n[n.VERBOSE=80]="VERBOSE",n[n.ALL=9999]="ALL"})(t=e.DiagLogLevel||(e.DiagLogLevel={}))}),tB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLogLevelDiagLogger=void 0;var t=qb();function n(i,r){i<t.DiagLogLevel.NONE?i=t.DiagLogLevel.NONE:i>t.DiagLogLevel.ALL&&(i=t.DiagLogLevel.ALL),r=r||{};function o(a,s){let d=r[a];return typeof d=="function"&&i>=s?d.bind(r):function(){}}return{error:o("error",t.DiagLogLevel.ERROR),warn:o("warn",t.DiagLogLevel.WARN),info:o("info",t.DiagLogLevel.INFO),debug:o("debug",t.DiagLogLevel.DEBUG),verbose:o("verbose",t.DiagLogLevel.VERBOSE)}}e.createLogLevelDiagLogger=n}),Ms=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagAPI=void 0;var t=eB(),n=tB(),i=qb(),r=$s(),o="diag";class a{constructor(){function d(c){return function(...p){let f=(0,r.getGlobal)("diag");if(f)return f[c](...p)}}let l=this,u=(c,p={logLevel:i.DiagLogLevel.INFO})=>{var f,h,g;if(c===l){let b=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return l.error((f=b.stack)!==null&&f!==void 0?f:b.message),!1}typeof p=="number"&&(p={logLevel:p});let _=(0,r.getGlobal)("diag"),y=(0,n.createLogLevelDiagLogger)((h=p.logLevel)!==null&&h!==void 0?h:i.DiagLogLevel.INFO,c);if(_&&!p.suppressOverrideMessage){let b=(g=Error().stack)!==null&&g!==void 0?g:"<failed to generate stacktrace>";_.warn(`Current logger will be overwritten from ${b}`),y.warn(`Current logger will overwrite one already registered from ${b}`)}return(0,r.registerGlobal)("diag",y,l,!0)};l.setLogger=u,l.disable=()=>{(0,r.unregisterGlobal)(o,l)},l.createComponentLogger=c=>new t.DiagComponentLogger(c),l.verbose=d("verbose"),l.debug=d("debug"),l.info=d("info"),l.warn=d("warn"),l.error=d("error")}static instance(){return this._instance||(this._instance=new a),this._instance}}e.DiagAPI=a}),nB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaggageImpl=void 0;class t{constructor(i){this._entries=i?new Map(i):new Map}getEntry(i){let r=this._entries.get(i);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries()).map(([i,r])=>[i,r])}setEntry(i,r){let o=new t(this._entries);return o._entries.set(i,r),o}removeEntry(i){let r=new t(this._entries);return r._entries.delete(i),r}removeEntries(...i){let r=new t(this._entries);for(let o of i)r._entries.delete(o);return r}clear(){return new t}}e.BaggageImpl=t}),rB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataSymbol=void 0,e.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")}),PO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.baggageEntryMetadataFromString=e.createBaggage=void 0;var t=Ms(),n=nB(),i=rB(),r=t.DiagAPI.instance();function o(s={}){return new n.BaggageImpl(new Map(Object.entries(s)))}e.createBaggage=o;function a(s){return typeof s!="string"&&(r.error(`Cannot create baggage metadata from unknown type: ${typeof s}`),s=""),{__TYPE__:i.baggageEntryMetadataSymbol,toString(){return s}}}e.baggageEntryMetadataFromString=a}),Qp=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ROOT_CONTEXT=e.createContextKey=void 0;function t(i){return Symbol.for(i)}e.createContextKey=t;class n{constructor(r){let o=this;o._currentContext=r?new Map(r):new Map,o.getValue=a=>o._currentContext.get(a),o.setValue=(a,s)=>{let d=new n(o._currentContext);return d._currentContext.set(a,s),d},o.deleteValue=a=>{let s=new n(o._currentContext);return s._currentContext.delete(a),s}}}e.ROOT_CONTEXT=new n}),iB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagConsoleLogger=void 0;var t=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class n{constructor(){function r(o){return function(...a){if(console){let s=console[o];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,a)}}}for(let o=0;o<t.length;o++)this[t[o].n]=r(t[o].c)}}e.DiagConsoleLogger=n}),IO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createNoopMeter=e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=e.NOOP_OBSERVABLE_GAUGE_METRIC=e.NOOP_OBSERVABLE_COUNTER_METRIC=e.NOOP_UP_DOWN_COUNTER_METRIC=e.NOOP_HISTOGRAM_METRIC=e.NOOP_GAUGE_METRIC=e.NOOP_COUNTER_METRIC=e.NOOP_METER=e.NoopObservableUpDownCounterMetric=e.NoopObservableGaugeMetric=e.NoopObservableCounterMetric=e.NoopObservableMetric=e.NoopHistogramMetric=e.NoopGaugeMetric=e.NoopUpDownCounterMetric=e.NoopCounterMetric=e.NoopMetric=e.NoopMeter=void 0;class t{constructor(){}createGauge(f,h){return e.NOOP_GAUGE_METRIC}createHistogram(f,h){return e.NOOP_HISTOGRAM_METRIC}createCounter(f,h){return e.NOOP_COUNTER_METRIC}createUpDownCounter(f,h){return e.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(f,h){return e.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(f,h){return e.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(f,h){return e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(f,h){}removeBatchObservableCallback(f){}}e.NoopMeter=t;class n{}e.NoopMetric=n;class i extends n{add(f,h){}}e.NoopCounterMetric=i;class r extends n{add(f,h){}}e.NoopUpDownCounterMetric=r;class o extends n{record(f,h){}}e.NoopGaugeMetric=o;class a extends n{record(f,h){}}e.NoopHistogramMetric=a;class s{addCallback(f){}removeCallback(f){}}e.NoopObservableMetric=s;class d extends s{}e.NoopObservableCounterMetric=d;class l extends s{}e.NoopObservableGaugeMetric=l;class u extends s{}e.NoopObservableUpDownCounterMetric=u,e.NOOP_METER=new t,e.NOOP_COUNTER_METRIC=new i,e.NOOP_GAUGE_METRIC=new o,e.NOOP_HISTOGRAM_METRIC=new a,e.NOOP_UP_DOWN_COUNTER_METRIC=new r,e.NOOP_OBSERVABLE_COUNTER_METRIC=new d,e.NOOP_OBSERVABLE_GAUGE_METRIC=new l,e.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new u;function c(){return e.NOOP_METER}e.createNoopMeter=c}),oB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueType=void 0;var t;(function(n){n[n.INT=0]="INT",n[n.DOUBLE=1]="DOUBLE"})(t=e.ValueType||(e.ValueType={}))}),OO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultTextMapSetter=e.defaultTextMapGetter=void 0,e.defaultTextMapGetter={get(t,n){if(t!=null)return t[n]},keys(t){return t==null?[]:Object.keys(t)}},e.defaultTextMapSetter={set(t,n,i){t!=null&&(t[n]=i)}}}),aB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopContextManager=void 0;var t=Qp();class n{active(){return t.ROOT_CONTEXT}with(r,o,a,...s){return o.call(a,...s)}bind(r,o){return o}enable(){return this}disable(){return this}}e.NoopContextManager=n}),Yp=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContextAPI=void 0;var t=aB(),n=$s(),i=Ms(),r="context",o=new t.NoopContextManager;class a{constructor(){}static getInstance(){return this._instance||(this._instance=new a),this._instance}setGlobalContextManager(d){return(0,n.registerGlobal)(r,d,i.DiagAPI.instance())}active(){return this._getContextManager().active()}with(d,l,u,...c){return this._getContextManager().with(d,l,u,...c)}bind(d,l){return this._getContextManager().bind(d,l)}_getContextManager(){return(0,n.getGlobal)(r)||o}disable(){this._getContextManager().disable(),(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.ContextAPI=a}),RO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceFlags=void 0;var t;(function(n){n[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED"})(t=e.TraceFlags||(e.TraceFlags={}))}),Nb=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=void 0;var t=RO();e.INVALID_SPANID="0000000000000000",e.INVALID_TRACEID="00000000000000000000000000000000",e.INVALID_SPAN_CONTEXT={traceId:e.INVALID_TRACEID,spanId:e.INVALID_SPANID,traceFlags:t.TraceFlags.NONE}}),Fb=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NonRecordingSpan=void 0;var t=Nb();class n{constructor(r=t.INVALID_SPAN_CONTEXT){this._spanContext=r}spanContext(){return this._spanContext}setAttribute(r,o){return this}setAttributes(r){return this}addEvent(r,o){return this}addLink(r){return this}addLinks(r){return this}setStatus(r){return this}updateName(r){return this}end(r){}isRecording(){return!1}recordException(r,o){}}e.NonRecordingSpan=n}),$O=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSpanContext=e.setSpanContext=e.deleteSpan=e.setSpan=e.getActiveSpan=e.getSpan=void 0;var t=Qp(),n=Fb(),i=Yp(),r=(0,t.createContextKey)("OpenTelemetry Context Key SPAN");function o(c){return c.getValue(r)||void 0}e.getSpan=o;function a(){return o(i.ContextAPI.getInstance().active())}e.getActiveSpan=a;function s(c,p){return c.setValue(r,p)}e.setSpan=s;function d(c){return c.deleteValue(r)}e.deleteSpan=d;function l(c,p){return s(c,new n.NonRecordingSpan(p))}e.setSpanContext=l;function u(c){var p;return(p=o(c))===null||p===void 0?void 0:p.spanContext()}e.getSpanContext=u}),Db=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wrapSpanContext=e.isSpanContextValid=e.isValidSpanId=e.isValidTraceId=void 0;var t=Nb(),n=Fb(),i=/^([0-9a-f]{32})$/i,r=/^[0-9a-f]{16}$/i;function o(l){return i.test(l)&&l!==t.INVALID_TRACEID}e.isValidTraceId=o;function a(l){return r.test(l)&&l!==t.INVALID_SPANID}e.isValidSpanId=a;function s(l){return o(l.traceId)&&a(l.spanId)}e.isSpanContextValid=s;function d(l){return new n.NonRecordingSpan(l)}e.wrapSpanContext=d}),MO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracer=void 0;var t=Yp(),n=$O(),i=Fb(),r=Db(),o=t.ContextAPI.getInstance();class a{startSpan(l,u,c=o.active()){if(u?.root)return new i.NonRecordingSpan;let p=c&&(0,n.getSpanContext)(c);return s(p)&&(0,r.isSpanContextValid)(p)?new i.NonRecordingSpan(p):new i.NonRecordingSpan}startActiveSpan(l,u,c,p){let f,h,g;if(arguments.length<2)return;arguments.length===2?g=u:arguments.length===3?(f=u,g=c):(f=u,h=c,g=p);let _=h??o.active(),y=this.startSpan(l,f,_),b=(0,n.setSpan)(_,y);return o.with(b,g,void 0,y)}}e.NoopTracer=a;function s(d){return typeof d=="object"&&typeof d.spanId=="string"&&typeof d.traceId=="string"&&typeof d.traceFlags=="number"}}),jO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracer=void 0;var t=MO(),n=new t.NoopTracer;class i{constructor(o,a,s,d){this._provider=o,this.name=a,this.version=s,this.options=d}startSpan(o,a,s){return this._getTracer().startSpan(o,a,s)}startActiveSpan(o,a,s,d){let l=this._getTracer();return Reflect.apply(l.startActiveSpan,l,arguments)}_getTracer(){if(this._delegate)return this._delegate;let o=this._provider.getDelegateTracer(this.name,this.version,this.options);return o?(this._delegate=o,this._delegate):n}}e.ProxyTracer=i}),sB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTracerProvider=void 0;var t=MO();class n{getTracer(r,o,a){return new t.NoopTracer}}e.NoopTracerProvider=n}),qO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProxyTracerProvider=void 0;var t=jO(),n=sB(),i=new n.NoopTracerProvider;class r{getTracer(a,s,d){var l;return(l=this.getDelegateTracer(a,s,d))!==null&&l!==void 0?l:new t.ProxyTracer(this,a,s,d)}getDelegate(){var a;return(a=this._delegate)!==null&&a!==void 0?a:i}setDelegate(a){this._delegate=a}getDelegateTracer(a,s,d){var l;return(l=this._delegate)===null||l===void 0?void 0:l.getTracer(a,s,d)}}e.ProxyTracerProvider=r}),dB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SamplingDecision=void 0;var t;(function(n){n[n.NOT_RECORD=0]="NOT_RECORD",n[n.RECORD=1]="RECORD",n[n.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(t=e.SamplingDecision||(e.SamplingDecision={}))}),lB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanKind=void 0;var t;(function(n){n[n.INTERNAL=0]="INTERNAL",n[n.SERVER=1]="SERVER",n[n.CLIENT=2]="CLIENT",n[n.PRODUCER=3]="PRODUCER",n[n.CONSUMER=4]="CONSUMER"})(t=e.SpanKind||(e.SpanKind={}))}),uB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SpanStatusCode=void 0;var t;(function(n){n[n.UNSET=0]="UNSET",n[n.OK=1]="OK",n[n.ERROR=2]="ERROR"})(t=e.SpanStatusCode||(e.SpanStatusCode={}))}),cB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateValue=e.validateKey=void 0;var t="[_0-9a-z-*/]",n=`[a-z]${t}{0,255}`,i=`[a-z0-9]${t}{0,240}@[a-z]${t}{0,13}`,r=new RegExp(`^(?:${n}|${i})$`),o=/^[ -~]{0,255}[!-~]$/,a=/,|=/;function s(l){return r.test(l)}e.validateKey=s;function d(l){return o.test(l)&&!a.test(l)}e.validateValue=d}),fB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceStateImpl=void 0;var t=cB(),n=32,i=512,r=",",o="=";class a{constructor(d){this._internalState=new Map,d&&this._parse(d)}set(d,l){let u=this._clone();return u._internalState.has(d)&&u._internalState.delete(d),u._internalState.set(d,l),u}unset(d){let l=this._clone();return l._internalState.delete(d),l}get(d){return this._internalState.get(d)}serialize(){return this._keys().reduce((d,l)=>(d.push(l+o+this.get(l)),d),[]).join(r)}_parse(d){d.length>i||(this._internalState=d.split(r).reverse().reduce((l,u)=>{let c=u.trim(),p=c.indexOf(o);if(p!==-1){let f=c.slice(0,p),h=c.slice(p+1,u.length);(0,t.validateKey)(f)&&(0,t.validateValue)(h)&&l.set(f,h)}return l},new Map),this._internalState.size>n&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,n))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let d=new a;return d._internalState=new Map(this._internalState),d}}e.TraceStateImpl=a}),pB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createTraceState=void 0;var t=fB();function n(i){return new t.TraceStateImpl(i)}e.createTraceState=n}),mB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.context=void 0;var t=Yp();e.context=t.ContextAPI.getInstance()}),hB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.diag=void 0;var t=Ms();e.diag=t.DiagAPI.instance()}),gB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NOOP_METER_PROVIDER=e.NoopMeterProvider=void 0;var t=IO();class n{getMeter(r,o,a){return t.NOOP_METER}}e.NoopMeterProvider=n,e.NOOP_METER_PROVIDER=new n}),yB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsAPI=void 0;var t=gB(),n=$s(),i=Ms(),r="metrics";class o{constructor(){}static getInstance(){return this._instance||(this._instance=new o),this._instance}setGlobalMeterProvider(s){return(0,n.registerGlobal)(r,s,i.DiagAPI.instance())}getMeterProvider(){return(0,n.getGlobal)(r)||t.NOOP_METER_PROVIDER}getMeter(s,d,l){return this.getMeterProvider().getMeter(s,d,l)}disable(){(0,n.unregisterGlobal)(r,i.DiagAPI.instance())}}e.MetricsAPI=o}),_B=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.metrics=void 0;var t=yB();e.metrics=t.MetricsAPI.getInstance()}),bB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoopTextMapPropagator=void 0;class t{inject(i,r){}extract(i,r){return i}fields(){return[]}}e.NoopTextMapPropagator=t}),vB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.deleteBaggage=e.setBaggage=e.getActiveBaggage=e.getBaggage=void 0;var t=Yp(),n=Qp(),i=(0,n.createContextKey)("OpenTelemetry Baggage Key");function r(d){return d.getValue(i)||void 0}e.getBaggage=r;function o(){return r(t.ContextAPI.getInstance().active())}e.getActiveBaggage=o;function a(d,l){return d.setValue(i,l)}e.setBaggage=a;function s(d){return d.deleteValue(i)}e.deleteBaggage=s}),SB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PropagationAPI=void 0;var t=$s(),n=bB(),i=OO(),r=vB(),o=PO(),a=Ms(),s="propagation",d=new n.NoopTextMapPropagator;class l{constructor(){this.createBaggage=o.createBaggage,this.getBaggage=r.getBaggage,this.getActiveBaggage=r.getActiveBaggage,this.setBaggage=r.setBaggage,this.deleteBaggage=r.deleteBaggage}static getInstance(){return this._instance||(this._instance=new l),this._instance}setGlobalPropagator(c){return(0,t.registerGlobal)(s,c,a.DiagAPI.instance())}inject(c,p,f=i.defaultTextMapSetter){return this._getGlobalPropagator().inject(c,p,f)}extract(c,p,f=i.defaultTextMapGetter){return this._getGlobalPropagator().extract(c,p,f)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,t.unregisterGlobal)(s,a.DiagAPI.instance())}_getGlobalPropagator(){return(0,t.getGlobal)(s)||d}}e.PropagationAPI=l}),wB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.propagation=void 0;var t=SB();e.propagation=t.PropagationAPI.getInstance()}),kB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TraceAPI=void 0;var t=$s(),n=qO(),i=Db(),r=$O(),o=Ms(),a="trace";class s{constructor(){this._proxyTracerProvider=new n.ProxyTracerProvider,this.wrapSpanContext=i.wrapSpanContext,this.isSpanContextValid=i.isSpanContextValid,this.deleteSpan=r.deleteSpan,this.getSpan=r.getSpan,this.getActiveSpan=r.getActiveSpan,this.getSpanContext=r.getSpanContext,this.setSpan=r.setSpan,this.setSpanContext=r.setSpanContext}static getInstance(){return this._instance||(this._instance=new s),this._instance}setGlobalTracerProvider(l){let u=(0,t.registerGlobal)(a,this._proxyTracerProvider,o.DiagAPI.instance());return u&&this._proxyTracerProvider.setDelegate(l),u}getTracerProvider(){return(0,t.getGlobal)(a)||this._proxyTracerProvider}getTracer(l,u){return this.getTracerProvider().getTracer(l,u)}disable(){(0,t.unregisterGlobal)(a,o.DiagAPI.instance()),this._proxyTracerProvider=new n.ProxyTracerProvider}}e.TraceAPI=s}),xB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=void 0;var t=kB();e.trace=t.TraceAPI.getInstance()}),TB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.trace=e.propagation=e.metrics=e.diag=e.context=e.INVALID_SPAN_CONTEXT=e.INVALID_TRACEID=e.INVALID_SPANID=e.isValidSpanId=e.isValidTraceId=e.isSpanContextValid=e.createTraceState=e.TraceFlags=e.SpanStatusCode=e.SpanKind=e.SamplingDecision=e.ProxyTracerProvider=e.ProxyTracer=e.defaultTextMapSetter=e.defaultTextMapGetter=e.ValueType=e.createNoopMeter=e.DiagLogLevel=e.DiagConsoleLogger=e.ROOT_CONTEXT=e.createContextKey=e.baggageEntryMetadataFromString=void 0;var t=PO();Object.defineProperty(e,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return t.baggageEntryMetadataFromString}});var n=Qp();Object.defineProperty(e,"createContextKey",{enumerable:!0,get:function(){return n.createContextKey}}),Object.defineProperty(e,"ROOT_CONTEXT",{enumerable:!0,get:function(){return n.ROOT_CONTEXT}});var i=iB();Object.defineProperty(e,"DiagConsoleLogger",{enumerable:!0,get:function(){return i.DiagConsoleLogger}});var r=qb();Object.defineProperty(e,"DiagLogLevel",{enumerable:!0,get:function(){return r.DiagLogLevel}});var o=IO();Object.defineProperty(e,"createNoopMeter",{enumerable:!0,get:function(){return o.createNoopMeter}});var a=oB();Object.defineProperty(e,"ValueType",{enumerable:!0,get:function(){return a.ValueType}});var s=OO();Object.defineProperty(e,"defaultTextMapGetter",{enumerable:!0,get:function(){return s.defaultTextMapGetter}}),Object.defineProperty(e,"defaultTextMapSetter",{enumerable:!0,get:function(){return s.defaultTextMapSetter}});var d=jO();Object.defineProperty(e,"ProxyTracer",{enumerable:!0,get:function(){return d.ProxyTracer}});var l=qO();Object.defineProperty(e,"ProxyTracerProvider",{enumerable:!0,get:function(){return l.ProxyTracerProvider}});var u=dB();Object.defineProperty(e,"SamplingDecision",{enumerable:!0,get:function(){return u.SamplingDecision}});var c=lB();Object.defineProperty(e,"SpanKind",{enumerable:!0,get:function(){return c.SpanKind}});var p=uB();Object.defineProperty(e,"SpanStatusCode",{enumerable:!0,get:function(){return p.SpanStatusCode}});var f=RO();Object.defineProperty(e,"TraceFlags",{enumerable:!0,get:function(){return f.TraceFlags}});var h=pB();Object.defineProperty(e,"createTraceState",{enumerable:!0,get:function(){return h.createTraceState}});var g=Db();Object.defineProperty(e,"isSpanContextValid",{enumerable:!0,get:function(){return g.isSpanContextValid}}),Object.defineProperty(e,"isValidTraceId",{enumerable:!0,get:function(){return g.isValidTraceId}}),Object.defineProperty(e,"isValidSpanId",{enumerable:!0,get:function(){return g.isValidSpanId}});var _=Nb();Object.defineProperty(e,"INVALID_SPANID",{enumerable:!0,get:function(){return _.INVALID_SPANID}}),Object.defineProperty(e,"INVALID_TRACEID",{enumerable:!0,get:function(){return _.INVALID_TRACEID}}),Object.defineProperty(e,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return _.INVALID_SPAN_CONTEXT}});var y=mB();Object.defineProperty(e,"context",{enumerable:!0,get:function(){return y.context}});var b=hB();Object.defineProperty(e,"diag",{enumerable:!0,get:function(){return b.diag}});var v=_B();Object.defineProperty(e,"metrics",{enumerable:!0,get:function(){return v.metrics}});var w=wB();Object.defineProperty(e,"propagation",{enumerable:!0,get:function(){return w.propagation}});var A=xB();Object.defineProperty(e,"trace",{enumerable:!0,get:function(){return A.trace}}),e.default={context:y.context,diag:b.diag,metrics:v.metrics,propagation:w.propagation,trace:A.trace}}),Pf=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(b){if(super(),!e.IDENTIFIER.test(b))throw Error("CodeGen: name must be a valid identifier");this.str=b}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class i extends t{constructor(b){super(),this._items=typeof b=="string"?[b]:b}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let b=this._items[0];return b===""||b==='""'}get str(){var b;return(b=this._str)!==null&&b!==void 0?b:this._str=this._items.reduce((v,w)=>`${v}${w}`,"")}get names(){var b;return(b=this._names)!==null&&b!==void 0?b:this._names=this._items.reduce((v,w)=>(w instanceof n&&(v[w.str]=(v[w.str]||0)+1),v),{})}}e._Code=i,e.nil=new i("");function r(y,...b){let v=[y[0]],w=0;for(;w<b.length;)s(v,b[w]),v.push(y[++w]);return new i(v)}e._=r;var o=new i("+");function a(y,...b){let v=[f(y[0])],w=0;for(;w<b.length;)v.push(o),s(v,b[w]),v.push(o,f(y[++w]));return d(v),new i(v)}e.str=a;function s(y,b){b instanceof i?y.push(...b._items):b instanceof n?y.push(b):y.push(c(b))}e.addCodeArg=s;function d(y){let b=1;for(;b<y.length-1;){if(y[b]===o){let v=l(y[b-1],y[b+1]);if(v!==void 0){y.splice(b-1,3,v);continue}y[b++]="+"}b++}}function l(y,b){if(b==='""')return y;if(y==='""')return b;if(typeof y=="string")return b instanceof n||y[y.length-1]!=='"'?void 0:typeof b!="string"?`${y.slice(0,-1)}${b}"`:b[0]==='"'?y.slice(0,-1)+b.slice(1):void 0;if(typeof b=="string"&&b[0]==='"'&&!(y instanceof n))return`"${y}${b.slice(1)}`}function u(y,b){return b.emptyStr()?y:y.emptyStr()?b:a`${y}${b}`}e.strConcat=u;function c(y){return typeof y=="number"||typeof y=="boolean"||y===null?y:f(Array.isArray(y)?y.join(","):y)}function p(y){return new i(f(y))}e.stringify=p;function f(y){return JSON.stringify(y).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=f;function h(y){return typeof y=="string"&&e.IDENTIFIER.test(y)?new i(`.${y}`):r`[${y}]`}e.getProperty=h;function g(y){if(typeof y=="string"&&e.IDENTIFIER.test(y))return new i(`${y}`);throw Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`)}e.getEsmExportName=g;function _(y){return new i(y.toString())}e.regexpCode=_}),IE=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Pf();class n extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var i;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(i||(e.UsedValueState=i={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class r{constructor({prefixes:l,parent:u}={}){this._names={},this._prefixes=l,this._parent=u}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){let u=this._names[l]||this._nameGroup(l);return`${l}${u.index++}`}_nameGroup(l){var u,c;if(!((c=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||c===void 0)&&c.has(l)||this._prefixes&&!this._prefixes.has(l))throw Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=r;class o extends t.Name{constructor(l,u){super(u),this.prefix=l}setValue(l,{property:u,itemIndex:c}){this.value=l,this.scopePath=t._`.${new t.Name(u)}[${c}]`}}e.ValueScopeName=o;var a=t._`\n`;class s extends r{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?a:t.nil}}get(){return this._scope}name(l){return new o(l,this._newName(l))}value(l,u){var c;if(u.ref===void 0)throw Error("CodeGen: ref must be passed in value");let p=this.toName(l),{prefix:f}=p,h=(c=u.key)!==null&&c!==void 0?c:u.ref,g=this._values[f];if(g){let b=g.get(h);if(b)return b}else g=this._values[f]=new Map;g.set(h,p);let _=this._scope[f]||(this._scope[f]=[]),y=_.length;return _[y]=u.ref,p.setValue(u,{property:f,itemIndex:y}),p}getValue(l,u){let c=this._values[l];if(c)return c.get(u)}scopeRefs(l,u=this._values){return this._reduceValues(u,c=>{if(c.scopePath===void 0)throw Error(`CodeGen: name "${c}" has no value`);return t._`${l}${c.scopePath}`})}scopeCode(l=this._values,u,c){return this._reduceValues(l,p=>{if(p.value===void 0)throw Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,c)}_reduceValues(l,u,c={},p){let f=t.nil;for(let h in l){let g=l[h];if(!g)continue;let _=c[h]=c[h]||new Map;g.forEach(y=>{if(_.has(y))return;_.set(y,i.Started);let b=u(y);if(b){let v=this.opts.es5?e.varKinds.var:e.varKinds.const;f=t._`${f}${v} ${y} = ${b};${this.opts._n}`}else if(b=p?.(y))f=t._`${f}${b}${this.opts._n}`;else throw new n(y);_.set(y,i.Completed)})}return f}}e.ValueScope=s}),Pe=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Pf(),n=IE(),i=Pf();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return i.Name}});var r=IE();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(x,I){return this}}class a extends o{constructor(x,I,N){super(),this.varKind=x,this.name=I,this.rhs=N}render({es5:x,_n:I}){let N=x?n.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${W};`+I}optimizeNames(x,I){if(x[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,x,I)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class s extends o{constructor(x,I,N){super(),this.lhs=x,this.rhs=I,this.sideEffects=N}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,I){if(!(this.lhs instanceof t.Name&&!x[this.lhs.str]&&!this.sideEffects))return this.rhs=M(this.rhs,x,I),this}get names(){let x=this.lhs instanceof t.Name?{}:{...this.lhs.names};return O(x,this.rhs)}}class d extends s{constructor(x,I,N,W){super(x,N,W),this.op=I}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}}class l extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}}class u extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}}class c extends o{constructor(x){super(),this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}}class p extends o{constructor(x){super(),this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,I){return this.code=M(this.code,x,I),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends o{constructor(x=[]){super(),this.nodes=x}render(x){return this.nodes.reduce((I,N)=>I+N.render(x),"")}optimizeNodes(){let{nodes:x}=this,I=x.length;for(;I--;){let N=x[I].optimizeNodes();Array.isArray(N)?x.splice(I,1,...N):N?x[I]=N:x.splice(I,1)}return x.length>0?this:void 0}optimizeNames(x,I){let{nodes:N}=this,W=N.length;for(;W--;){let re=N[W];re.optimizeNames(x,I)||(J(x,re.names),N.splice(W,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((x,I)=>R(x,I.names),{})}}class h extends f{render(x){return"{"+x._n+super.render(x)+"}"+x._n}}class g extends f{}class _ extends h{}_.kind="else";class y extends h{constructor(x,I){super(I),this.condition=x}render(x){let I=`if(${this.condition})`+super.render(x);return this.else&&(I+="else "+this.else.render(x)),I}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let I=this.else;if(I){let N=I.optimizeNodes();I=this.else=Array.isArray(N)?new _(N):N}if(I)return x===!1?I instanceof y?I:I.nodes:this.nodes.length?this:new y(Z(x),I instanceof y?[I]:I.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,I){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(x,I),!!(super.optimizeNames(x,I)||this.else))return this.condition=M(this.condition,x,I),this}get names(){let x=super.names;return O(x,this.condition),this.else&&R(x,this.else.names),x}}y.kind="if";class b extends h{}b.kind="for";class v extends b{constructor(x){super(),this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,I){if(super.optimizeNames(x,I))return this.iteration=M(this.iteration,x,I),this}get names(){return R(super.names,this.iteration.names)}}class w extends b{constructor(x,I,N,W){super(),this.varKind=x,this.name=I,this.from=N,this.to=W}render(x){let I=x.es5?n.varKinds.var:this.varKind,{name:N,from:W,to:re}=this;return`for(${I} ${N}=${W}; ${N}<${re}; ${N}++)`+super.render(x)}get names(){let x=O(super.names,this.from);return O(x,this.to)}}class A extends b{constructor(x,I,N,W){super(),this.loop=x,this.varKind=I,this.name=N,this.iterable=W}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,I){if(super.optimizeNames(x,I))return this.iterable=M(this.iterable,x,I),this}get names(){return R(super.names,this.iterable.names)}}class C extends h{constructor(x,I,N){super(),this.name=x,this.args=I,this.async=N}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}}C.kind="func";class S extends f{render(x){return"return "+super.render(x)}}S.kind="return";class k extends h{render(x){let I="try"+super.render(x);return this.catch&&(I+=this.catch.render(x)),this.finally&&(I+=this.finally.render(x)),I}optimizeNodes(){var x,I;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(I=this.finally)===null||I===void 0||I.optimizeNodes(),this}optimizeNames(x,I){var N,W;return super.optimizeNames(x,I),(N=this.catch)===null||N===void 0||N.optimizeNames(x,I),(W=this.finally)===null||W===void 0||W.optimizeNames(x,I),this}get names(){let x=super.names;return this.catch&&R(x,this.catch.names),this.finally&&R(x,this.finally.names),x}}class T extends h{constructor(x){super(),this.error=x}render(x){return`catch(${this.error})`+super.render(x)}}T.kind="catch";class E extends h{render(x){return"finally"+super.render(x)}}E.kind="finally";class P{constructor(x,I={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...I,_n:I.lines?`
185
- `:""},this._extScope=x,this._scope=new n.Scope({parent:x}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(x){return this._scope.name(x)}scopeName(x){return this._extScope.name(x)}scopeValue(x,I){let N=this._extScope.value(x,I);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(x,I){return this._extScope.getValue(x,I)}scopeRefs(x){return this._extScope.scopeRefs(x,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(x,I,N,W){let re=this._scope.toName(I);return N!==void 0&&W&&(this._constants[re.str]=N),this._leafNode(new a(x,re,N)),re}const(x,I,N){return this._def(n.varKinds.const,x,I,N)}let(x,I,N){return this._def(n.varKinds.let,x,I,N)}var(x,I,N){return this._def(n.varKinds.var,x,I,N)}assign(x,I,N){return this._leafNode(new s(x,I,N))}add(x,I){return this._leafNode(new d(x,e.operators.ADD,I))}code(x){return typeof x=="function"?x():x!==t.nil&&this._leafNode(new p(x)),this}object(...x){let I=["{"];for(let[N,W]of x)I.length>1&&I.push(","),I.push(N),(N!==W||this.opts.es5)&&(I.push(":"),(0,t.addCodeArg)(I,W));return I.push("}"),new t._Code(I)}if(x,I,N){if(this._blockNode(new y(x)),I&&N)this.code(I).else().code(N).endIf();else if(I)this.code(I).endIf();else if(N)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(x){return this._elseNode(new y(x))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(y,_)}_for(x,I){return this._blockNode(x),I&&this.code(I).endFor(),this}for(x,I){return this._for(new v(x),I)}forRange(x,I,N,W,re=this.opts.es5?n.varKinds.var:n.varKinds.let){let me=this._scope.toName(x);return this._for(new w(re,me,I,N),()=>W(me))}forOf(x,I,N,W=n.varKinds.const){let re=this._scope.toName(x);if(this.opts.es5){let me=I instanceof t.Name?I:this.var("_arr",I);return this.forRange("_i",0,t._`${me}.length`,be=>{this.var(re,t._`${me}[${be}]`),N(re)})}return this._for(new A("of",W,re,I),()=>N(re))}forIn(x,I,N,W=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(x,t._`Object.keys(${I})`,N);let re=this._scope.toName(x);return this._for(new A("in",W,re,I),()=>N(re))}endFor(){return this._endBlockNode(b)}label(x){return this._leafNode(new l(x))}break(x){return this._leafNode(new u(x))}return(x){let I=new S;if(this._blockNode(I),this.code(x),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(x,I,N){if(!I&&!N)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new k;if(this._blockNode(W),this.code(x),I){let re=this.name("e");this._currNode=W.catch=new T(re),I(re)}return N&&(this._currNode=W.finally=new E,this.code(N)),this._endBlockNode(T,E)}throw(x){return this._leafNode(new c(x))}block(x,I){return this._blockStarts.push(this._nodes.length),x&&this.code(x).endBlock(I),this}endBlock(x){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let N=this._nodes.length-I;if(N<0||x!==void 0&&N!==x)throw Error(`CodeGen: wrong number of nodes: ${N} vs ${x} expected`);return this._nodes.length=I,this}func(x,I=t.nil,N,W){return this._blockNode(new C(x,I,N)),W&&this.code(W).endFunc(),this}endFunc(){return this._endBlockNode(C)}optimize(x=1){for(;x-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(x){return this._currNode.nodes.push(x),this}_blockNode(x){this._currNode.nodes.push(x),this._nodes.push(x)}_endBlockNode(x,I){let N=this._currNode;if(N instanceof x||I&&N instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${x.kind}/${I.kind}`:x.kind}"`)}_elseNode(x){let I=this._currNode;if(!(I instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=x,this}get _root(){return this._nodes[0]}get _currNode(){let x=this._nodes;return x[x.length-1]}set _currNode(x){let I=this._nodes;I[I.length-1]=x}}e.CodeGen=P;function R(F,x){for(let I in x)F[I]=(F[I]||0)+(x[I]||0);return F}function O(F,x){return x instanceof t._CodeOrName?R(F,x.names):F}function M(F,x,I){if(F instanceof t.Name)return N(F);if(!W(F))return F;return new t._Code(F._items.reduce((re,me)=>(me instanceof t.Name&&(me=N(me)),me instanceof t._Code?re.push(...me._items):re.push(me),re),[]));function N(re){let me=I[re.str];return me===void 0||x[re.str]!==1?re:(delete x[re.str],me)}function W(re){return re instanceof t._Code&&re._items.some(me=>me instanceof t.Name&&x[me.str]===1&&I[me.str]!==void 0)}}function J(F,x){for(let I in x)F[I]=(F[I]||0)-(x[I]||0)}function Z(F){return typeof F=="boolean"||typeof F=="number"||F===null?!F:t._`!${K(F)}`}e.not=Z;var z=$(e.operators.AND);function X(...F){return F.reduce(z)}e.and=X;var ee=$(e.operators.OR);function B(...F){return F.reduce(ee)}e.or=B;function $(F){return(x,I)=>x===t.nil?I:I===t.nil?x:t._`${K(x)} ${F} ${K(I)}`}function K(F){return F instanceof t.Name?F:t._`(${F})`}}),Fe=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Pe(),n=Pf();function i(C){let S={};for(let k of C)S[k]=!0;return S}e.toHash=i;function r(C,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(o(C,S),!a(S,C.self.RULES.all))}e.alwaysValidSchema=r;function o(C,S=C.schema){let{opts:k,self:T}=C;if(!k.strictSchema||typeof S=="boolean")return;let E=T.RULES.keywords;for(let P in S)E[P]||A(C,`unknown keyword: "${P}"`)}e.checkUnknownRules=o;function a(C,S){if(typeof C=="boolean")return!C;for(let k in C)if(S[k])return!0;return!1}e.schemaHasRules=a;function s(C,S){if(typeof C=="boolean")return!C;for(let k in C)if(k!=="$ref"&&S.all[k])return!0;return!1}e.schemaHasRulesButRef=s;function d({topSchemaRef:C,schemaPath:S},k,T,E){if(!E){if(typeof k=="number"||typeof k=="boolean")return k;if(typeof k=="string")return t._`${k}`}return t._`${C}${S}${(0,t.getProperty)(T)}`}e.schemaRefOrVal=d;function l(C){return p(decodeURIComponent(C))}e.unescapeFragment=l;function u(C){return encodeURIComponent(c(C))}e.escapeFragment=u;function c(C){return typeof C=="number"?`${C}`:C.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=c;function p(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function f(C,S){if(Array.isArray(C))for(let k of C)S(k);else S(C)}e.eachItem=f;function h({mergeNames:C,mergeToName:S,mergeValues:k,resultToName:T}){return(E,P,R,O)=>{let M=R===void 0?P:R instanceof t.Name?(P instanceof t.Name?C(E,P,R):S(E,P,R),R):P instanceof t.Name?(S(E,R,P),P):k(P,R);return O===t.Name&&!(M instanceof t.Name)?T(E,M):M}}e.mergeEvaluated={props:h({mergeNames:(C,S,k)=>C.if(t._`${k} !== true && ${S} !== undefined`,()=>{C.if(t._`${S} === true`,()=>C.assign(k,!0),()=>C.assign(k,t._`${k} || {}`).code(t._`Object.assign(${k}, ${S})`))}),mergeToName:(C,S,k)=>C.if(t._`${k} !== true`,()=>{S===!0?C.assign(k,!0):(C.assign(k,t._`${k} || {}`),_(C,k,S))}),mergeValues:(C,S)=>C===!0?!0:{...C,...S},resultToName:g}),items:h({mergeNames:(C,S,k)=>C.if(t._`${k} !== true && ${S} !== undefined`,()=>C.assign(k,t._`${S} === true ? true : ${k} > ${S} ? ${k} : ${S}`)),mergeToName:(C,S,k)=>C.if(t._`${k} !== true`,()=>C.assign(k,S===!0?!0:t._`${k} > ${S} ? ${k} : ${S}`)),mergeValues:(C,S)=>C===!0?!0:Math.max(C,S),resultToName:(C,S)=>C.var("items",S)})};function g(C,S){if(S===!0)return C.var("props",!0);let k=C.var("props",t._`{}`);return S!==void 0&&_(C,k,S),k}e.evaluatedPropsToName=g;function _(C,S,k){Object.keys(k).forEach(T=>C.assign(t._`${S}${(0,t.getProperty)(T)}`,!0))}e.setEvaluated=_;var y={};function b(C,S){return C.scopeValue("func",{ref:S,code:y[S.code]||(y[S.code]=new n._Code(S.code))})}e.useFunc=b;var v;(function(C){C[C.Num=0]="Num",C[C.Str=1]="Str"})(v||(e.Type=v={}));function w(C,S,k){if(C instanceof t.Name){let T=S===v.Num;return k?T?t._`"[" + ${C} + "]"`:t._`"['" + ${C} + "']"`:T?t._`"/" + ${C}`:t._`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return k?(0,t.getProperty)(C).toString():"/"+c(C)}e.getErrorPath=w;function A(C,S,k=C.opts.strictSchema){if(k){if(S=`strict mode: ${S}`,k===!0)throw Error(S);C.self.logger.warn(S)}}e.checkStrictMode=A}),to=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=n}),Xp=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Pe(),n=Fe(),i=to();e.keywordError={message:({keyword:_})=>t.str`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:y})=>y?t.str`"${_}" keyword must be ${y} ($data)`:t.str`"${_}" keyword is invalid ($data)`};function r(_,y=e.keywordError,b,v){let{it:w}=_,{gen:A,compositeRule:C,allErrors:S}=w,k=c(_,y,b);v??(C||S)?d(A,k):l(w,t._`[${k}]`)}e.reportError=r;function o(_,y=e.keywordError,b){let{it:v}=_,{gen:w,compositeRule:A,allErrors:C}=v,S=c(_,y,b);d(w,S),!(A||C)&&l(v,i.default.vErrors)}e.reportExtraError=o;function a(_,y){_.assign(i.default.errors,y),_.if(t._`${i.default.vErrors} !== null`,()=>_.if(y,()=>_.assign(t._`${i.default.vErrors}.length`,y),()=>_.assign(i.default.vErrors,null)))}e.resetErrorsCount=a;function s({gen:_,keyword:y,schemaValue:b,data:v,errsCount:w,it:A}){if(w===void 0)throw Error("ajv implementation error");let C=_.name("err");_.forRange("i",w,i.default.errors,S=>{_.const(C,t._`${i.default.vErrors}[${S}]`),_.if(t._`${C}.instancePath === undefined`,()=>_.assign(t._`${C}.instancePath`,(0,t.strConcat)(i.default.instancePath,A.errorPath))),_.assign(t._`${C}.schemaPath`,t.str`${A.errSchemaPath}/${y}`),A.opts.verbose&&(_.assign(t._`${C}.schema`,b),_.assign(t._`${C}.data`,v))})}e.extendErrors=s;function d(_,y){let b=_.const("err",y);_.if(t._`${i.default.vErrors} === null`,()=>_.assign(i.default.vErrors,t._`[${b}]`),t._`${i.default.vErrors}.push(${b})`),_.code(t._`${i.default.errors}++`)}function l(_,y){let{gen:b,validateName:v,schemaEnv:w}=_;w.$async?b.throw(t._`new ${_.ValidationError}(${y})`):(b.assign(t._`${v}.errors`,y),b.return(!1))}var u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function c(_,y,b){let{createErrors:v}=_.it;return v===!1?t._`{}`:p(_,y,b)}function p(_,y,b={}){let{gen:v,it:w}=_,A=[f(w,b),h(_,b)];return g(_,y,A),v.object(...A)}function f({errorPath:_},{instancePath:y}){let b=y?t.str`${_}${(0,n.getErrorPath)(y,n.Type.Str)}`:_;return[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,b)]}function h({keyword:_,it:{errSchemaPath:y}},{schemaPath:b,parentSchema:v}){let w=v?y:t.str`${y}/${_}`;return b&&(w=t.str`${w}${(0,n.getErrorPath)(b,n.Type.Str)}`),[u.schemaPath,w]}function g(_,{params:y,message:b},v){let{keyword:w,data:A,schemaValue:C,it:S}=_,{opts:k,propertyName:T,topSchemaRef:E,schemaPath:P}=S;v.push([u.keyword,w],[u.params,typeof y=="function"?y(_):y||t._`{}`]),k.messages&&v.push([u.message,typeof b=="function"?b(_):b]),k.verbose&&v.push([u.schema,C],[u.parentSchema,t._`${E}${P}`],[i.default.data,A]),T&&v.push([u.propertyName,T])}}),CB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=Xp(),n=Pe(),i=to(),r={message:"boolean schema is false"};function o(d){let{gen:l,schema:u,validateName:c}=d;u===!1?s(d,!1):typeof u=="object"&&u.$async===!0?l.return(i.default.data):(l.assign(n._`${c}.errors`,null),l.return(!0))}e.topBoolOrEmptySchema=o;function a(d,l){let{gen:u,schema:c}=d;c===!1?(u.var(l,!1),s(d)):u.var(l,!0)}e.boolOrEmptySchema=a;function s(d,l){let{gen:u,data:c}=d,p={gen:u,keyword:"false schema",data:c,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:d};(0,t.reportError)(p,r,void 0,l)}}),NO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=["string","number","integer","boolean","null","object","array"],n=new Set(t);function i(o){return typeof o=="string"&&n.has(o)}e.isJSONType=i;function r(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r}),FO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:r,self:o},a){let s=o.RULES.types[a];return s&&s!==!0&&n(r,s)}e.schemaHasRulesForType=t;function n(r,o){return o.rules.some(a=>i(r,a))}e.shouldUseGroup=n;function i(r,o){var a;return r[o.keyword]!==void 0||((a=o.definition.implements)===null||a===void 0?void 0:a.some(s=>r[s]!==void 0))}e.shouldUseRule=i}),If=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=NO(),n=FO(),i=Xp(),r=Pe(),o=Fe(),a;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(a||(e.DataType=a={}));function s(v){let w=d(v.type);if(w.includes("null")){if(v.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!w.length&&v.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');v.nullable===!0&&w.push("null")}return w}e.getSchemaTypes=s;function d(v){let w=Array.isArray(v)?v:v?[v]:[];if(w.every(t.isJSONType))return w;throw Error("type must be JSONType or JSONType[]: "+w.join(","))}e.getJSONTypes=d;function l(v,w){let{gen:A,data:C,opts:S}=v,k=c(w,S.coerceTypes),T=w.length>0&&!(k.length===0&&w.length===1&&(0,n.schemaHasRulesForType)(v,w[0]));if(T){let E=g(w,C,S.strictNumbers,a.Wrong);A.if(E,()=>{k.length?p(v,w,k):y(v)})}return T}e.coerceAndCheckDataType=l;var u=new Set(["string","number","integer","boolean","null"]);function c(v,w){return w?v.filter(A=>u.has(A)||w==="array"&&A==="array"):[]}function p(v,w,A){let{gen:C,data:S,opts:k}=v,T=C.let("dataType",r._`typeof ${S}`),E=C.let("coerced",r._`undefined`);k.coerceTypes==="array"&&C.if(r._`${T} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>C.assign(S,r._`${S}[0]`).assign(T,r._`typeof ${S}`).if(g(w,S,k.strictNumbers),()=>C.assign(E,S))),C.if(r._`${E} !== undefined`);for(let R of A)(u.has(R)||R==="array"&&k.coerceTypes==="array")&&P(R);C.else(),y(v),C.endIf(),C.if(r._`${E} !== undefined`,()=>{C.assign(S,E),f(v,E)});function P(R){switch(R){case"string":C.elseIf(r._`${T} == "number" || ${T} == "boolean"`).assign(E,r._`"" + ${S}`).elseIf(r._`${S} === null`).assign(E,r._`""`);return;case"number":C.elseIf(r._`${T} == "boolean" || ${S} === null
186
- || (${T} == "string" && ${S} && ${S} == +${S})`).assign(E,r._`+${S}`);return;case"integer":C.elseIf(r._`${T} === "boolean" || ${S} === null
187
- || (${T} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(E,r._`+${S}`);return;case"boolean":C.elseIf(r._`${S} === "false" || ${S} === 0 || ${S} === null`).assign(E,!1).elseIf(r._`${S} === "true" || ${S} === 1`).assign(E,!0);return;case"null":C.elseIf(r._`${S} === "" || ${S} === 0 || ${S} === false`),C.assign(E,null);return;case"array":C.elseIf(r._`${T} === "string" || ${T} === "number"
188
- || ${T} === "boolean" || ${S} === null`).assign(E,r._`[${S}]`)}}}function f({gen:v,parentData:w,parentDataProperty:A},C){v.if(r._`${w} !== undefined`,()=>v.assign(r._`${w}[${A}]`,C))}function h(v,w,A,C=a.Correct){let S=C===a.Correct?r.operators.EQ:r.operators.NEQ,k;switch(v){case"null":return r._`${w} ${S} null`;case"array":k=r._`Array.isArray(${w})`;break;case"object":k=r._`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":k=T(r._`!(${w} % 1) && !isNaN(${w})`);break;case"number":k=T();break;default:return r._`typeof ${w} ${S} ${v}`}return C===a.Correct?k:(0,r.not)(k);function T(E=r.nil){return(0,r.and)(r._`typeof ${w} == "number"`,E,A?r._`isFinite(${w})`:r.nil)}}e.checkDataType=h;function g(v,w,A,C){if(v.length===1)return h(v[0],w,A,C);let S,k=(0,o.toHash)(v);if(k.array&&k.object){let T=r._`typeof ${w} != "object"`;S=k.null?T:r._`!${w} || ${T}`,delete k.null,delete k.array,delete k.object}else S=r.nil;k.number&&delete k.integer;for(let T in k)S=(0,r.and)(S,h(T,w,A,C));return S}e.checkDataTypes=g;var _={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:w})=>typeof v=="string"?r._`{type: ${v}}`:r._`{type: ${w}}`};function y(v){let w=b(v);(0,i.reportError)(w,_)}e.reportTypeError=y;function b(v){let{gen:w,data:A,schema:C}=v,S=(0,o.schemaRefOrVal)(v,C,"type");return{gen:w,keyword:"type",data:A,schema:C.type,schemaCode:S,schemaValue:S,parentSchema:C,params:{},it:v}}}),AB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=Pe(),n=Fe();function i(o,a){let{properties:s,items:d}=o.schema;if(a==="object"&&s)for(let l in s)r(o,l,s[l].default);else a==="array"&&Array.isArray(d)&&d.forEach((l,u)=>r(o,u,l.default))}e.assignDefaults=i;function r(o,a,s){let{gen:d,compositeRule:l,data:u,opts:c}=o;if(s===void 0)return;let p=t._`${u}${(0,t.getProperty)(a)}`;if(l){(0,n.checkStrictMode)(o,`default is ignored for: ${p}`);return}let f=t._`${p} === undefined`;c.useDefaults==="empty"&&(f=t._`${f} || ${p} === null || ${p} === ""`),d.if(f,t._`${p} = ${(0,t.stringify)(s)}`)}}),Rr=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=Pe(),n=Fe(),i=to(),r=Fe();function o(v,w){let{gen:A,data:C,it:S}=v;A.if(c(A,C,w,S.opts.ownProperties),()=>{v.setParams({missingProperty:t._`${w}`},!0),v.error()})}e.checkReportMissingProp=o;function a({gen:v,data:w,it:{opts:A}},C,S){return(0,t.or)(...C.map(k=>(0,t.and)(c(v,w,k,A.ownProperties),t._`${S} = ${k}`)))}e.checkMissingProp=a;function s(v,w){v.setParams({missingProperty:w},!0),v.error()}e.reportMissingProp=s;function d(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=d;function l(v,w,A){return t._`${d(v)}.call(${w}, ${A})`}e.isOwnProperty=l;function u(v,w,A,C){let S=t._`${w}${(0,t.getProperty)(A)} !== undefined`;return C?t._`${S} && ${l(v,w,A)}`:S}e.propertyInData=u;function c(v,w,A,C){let S=t._`${w}${(0,t.getProperty)(A)} === undefined`;return C?(0,t.or)(S,(0,t.not)(l(v,w,A))):S}e.noPropertyInData=c;function p(v){return v?Object.keys(v).filter(w=>w!=="__proto__"):[]}e.allSchemaProperties=p;function f(v,w){return p(w).filter(A=>!(0,n.alwaysValidSchema)(v,w[A]))}e.schemaProperties=f;function h({schemaCode:v,data:w,it:{gen:A,topSchemaRef:C,schemaPath:S,errorPath:k},it:T},E,P,R){let O=R?t._`${v}, ${w}, ${C}${S}`:w,M=[[i.default.instancePath,(0,t.strConcat)(i.default.instancePath,k)],[i.default.parentData,T.parentData],[i.default.parentDataProperty,T.parentDataProperty],[i.default.rootData,i.default.rootData]];T.opts.dynamicRef&&M.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let J=t._`${O}, ${A.object(...M)}`;return P!==t.nil?t._`${E}.call(${P}, ${J})`:t._`${E}(${J})`}e.callValidateCode=h;var g=t._`new RegExp`;function _({gen:v,it:{opts:w}},A){let C=w.unicodeRegExp?"u":"",{regExp:S}=w.code,k=S(A,C);return v.scopeValue("pattern",{key:k.toString(),ref:k,code:t._`${S.code==="new RegExp"?g:(0,r.useFunc)(v,S)}(${A}, ${C})`})}e.usePattern=_;function y(v){let{gen:w,data:A,keyword:C,it:S}=v,k=w.name("valid");if(S.allErrors){let E=w.let("valid",!0);return T(()=>w.assign(E,!1)),E}return w.var(k,!0),T(()=>w.break()),k;function T(E){let P=w.const("len",t._`${A}.length`);w.forRange("i",0,P,R=>{v.subschema({keyword:C,dataProp:R,dataPropType:n.Type.Num},k),w.if((0,t.not)(k),E)})}}e.validateArray=y;function b(v){let{gen:w,schema:A,keyword:C,it:S}=v;if(!Array.isArray(A))throw Error("ajv implementation error");if(A.some(E=>(0,n.alwaysValidSchema)(S,E))&&!S.opts.unevaluated)return;let k=w.let("valid",!1),T=w.name("_valid");w.block(()=>A.forEach((E,P)=>{let R=v.subschema({keyword:C,schemaProp:P,compositeRule:!0},T);w.assign(k,t._`${k} || ${T}`),!v.mergeValidEvaluated(R,T)&&w.if((0,t.not)(k))})),v.result(k,()=>v.reset(),()=>v.error(!0))}e.validateUnion=b}),EB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=Pe(),n=to(),i=Rr(),r=Xp();function o(f,h){let{gen:g,keyword:_,schema:y,parentSchema:b,it:v}=f,w=h.macro.call(v.self,y,b,v),A=u(g,_,w);v.opts.validateSchema!==!1&&v.self.validateSchema(w,!0);let C=g.name("valid");f.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${_}`,topSchemaRef:A,compositeRule:!0},C),f.pass(C,()=>f.error(!0))}e.macroKeywordCode=o;function a(f,h){var g;let{gen:_,keyword:y,schema:b,parentSchema:v,$data:w,it:A}=f;l(A,h);let C=!w&&h.compile?h.compile.call(A.self,b,v,A):h.validate,S=u(_,y,C),k=_.let("valid");f.block$data(k,T),f.ok((g=h.valid)!==null&&g!==void 0?g:k);function T(){if(h.errors===!1)R(),h.modifying&&s(f),O(()=>f.error());else{let M=h.async?E():P();h.modifying&&s(f),O(()=>d(f,M))}}function E(){let M=_.let("ruleErrs",null);return _.try(()=>R(t._`await `),J=>_.assign(k,!1).if(t._`${J} instanceof ${A.ValidationError}`,()=>_.assign(M,t._`${J}.errors`),()=>_.throw(J))),M}function P(){let M=t._`${S}.errors`;return _.assign(M,null),R(t.nil),M}function R(M=h.async?t._`await `:t.nil){let J=A.opts.passContext?n.default.this:n.default.self,Z=!("compile"in h&&!w||h.schema===!1);_.assign(k,t._`${M}${(0,i.callValidateCode)(f,S,J,Z)}`,h.modifying)}function O(M){var J;_.if((0,t.not)((J=h.valid)!==null&&J!==void 0?J:k),M)}}e.funcKeywordCode=a;function s(f){let{gen:h,data:g,it:_}=f;h.if(_.parentData,()=>h.assign(g,t._`${_.parentData}[${_.parentDataProperty}]`))}function d(f,h){let{gen:g}=f;g.if(t._`Array.isArray(${h})`,()=>{g.assign(n.default.vErrors,t._`${n.default.vErrors} === null ? ${h} : ${n.default.vErrors}.concat(${h})`).assign(n.default.errors,t._`${n.default.vErrors}.length`),(0,r.extendErrors)(f)},()=>f.error())}function l({schemaEnv:f},h){if(h.async&&!f.$async)throw Error("async keyword in sync schema")}function u(f,h,g){if(g===void 0)throw Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof g=="function"?{ref:g}:{ref:g,code:(0,t.stringify)(g)})}function c(f,h,g=!1){return!h.length||h.some(_=>_==="array"?Array.isArray(f):_==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==_||g&&typeof f>"u")}e.validSchemaType=c;function p({schema:f,opts:h,self:g,errSchemaPath:_},y,b){if(Array.isArray(y.keyword)?!y.keyword.includes(b):y.keyword!==b)throw Error("ajv implementation error");let v=y.dependencies;if(v?.some(w=>!Object.prototype.hasOwnProperty.call(f,w)))throw Error(`parent schema must have dependencies of ${b}: ${v.join(",")}`);if(y.validateSchema&&!y.validateSchema(f[b])){let w=`keyword "${b}" value is invalid at path "${_}": `+g.errorsText(y.validateSchema.errors);if(h.validateSchema==="log")g.logger.error(w);else throw Error(w)}}e.validateKeywordUsage=p}),PB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=Pe(),n=Fe();function i(a,{keyword:s,schemaProp:d,schema:l,schemaPath:u,errSchemaPath:c,topSchemaRef:p}){if(s!==void 0&&l!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){let f=a.schema[s];return d===void 0?{schema:f,schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}`,errSchemaPath:`${a.errSchemaPath}/${s}`}:{schema:f[d],schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}${(0,t.getProperty)(d)}`,errSchemaPath:`${a.errSchemaPath}/${s}/${(0,n.escapeFragment)(d)}`}}if(l!==void 0){if(u===void 0||c===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:u,topSchemaRef:p,errSchemaPath:c}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=i;function r(a,s,{dataProp:d,dataPropType:l,data:u,dataTypes:c,propertyName:p}){if(u!==void 0&&d!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=s;if(d!==void 0){let{errorPath:g,dataPathArr:_,opts:y}=s,b=f.let("data",t._`${s.data}${(0,t.getProperty)(d)}`,!0);h(b),a.errorPath=t.str`${g}${(0,n.getErrorPath)(d,l,y.jsPropertySyntax)}`,a.parentDataProperty=t._`${d}`,a.dataPathArr=[..._,a.parentDataProperty]}if(u!==void 0){let g=u instanceof t.Name?u:f.let("data",u,!0);h(g),p!==void 0&&(a.propertyName=p)}c&&(a.dataTypes=c);function h(g){a.data=g,a.dataLevel=s.dataLevel+1,a.dataTypes=[],s.definedProperties=new Set,a.parentData=s.data,a.dataNames=[...s.dataNames,g]}}e.extendSubschemaData=r;function o(a,{jtdDiscriminator:s,jtdMetadata:d,compositeRule:l,createErrors:u,allErrors:c}){l!==void 0&&(a.compositeRule=l),u!==void 0&&(a.createErrors=u),c!==void 0&&(a.allErrors=c),a.jtdDiscriminator=s,a.jtdMetadata=d}e.extendSubschemaMode=o}),DO=V((e,t)=>{t.exports=function n(i,r){if(i===r)return!0;if(i&&r&&typeof i=="object"&&typeof r=="object"){if(i.constructor!==r.constructor)return!1;var o,a,s;if(Array.isArray(i)){if(o=i.length,o!=r.length)return!1;for(a=o;a--!==0;)if(!n(i[a],r[a]))return!1;return!0}if(i.constructor===RegExp)return i.source===r.source&&i.flags===r.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===r.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===r.toString();if(s=Object.keys(i),o=s.length,o!==Object.keys(r).length)return!1;for(a=o;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=o;a--!==0;){var d=s[a];if(!n(i[d],r[d]))return!1}return!0}return i!==i&&r!==r}}),IB=V((e,t)=>{var n=t.exports=function(o,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var d=typeof s=="function"?s:s.pre||function(){},l=s.post||function(){};i(a,d,l,o,"",o)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function i(o,a,s,d,l,u,c,p,f,h){if(d&&typeof d=="object"&&!Array.isArray(d)){a(d,l,u,c,p,f,h);for(var g in d){var _=d[g];if(Array.isArray(_)){if(g in n.arrayKeywords)for(var y=0;y<_.length;y++)i(o,a,s,_[y],l+"/"+g+"/"+y,u,l,g,d,y)}else if(g in n.propsKeywords){if(_&&typeof _=="object")for(var b in _)i(o,a,s,_[b],l+"/"+g+"/"+r(b),u,l,g,d,b)}else(g in n.keywords||o.allKeys&&!(g in n.skipKeywords))&&i(o,a,s,_,l+"/"+g,u,l,g,d)}s(d,l,u,c,p,f,h)}}function r(o){return o.replace(/~/g,"~0").replace(/\//g,"~1")}}),em=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Fe(),n=DO(),i=IB(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(_,y=!0){return typeof _=="boolean"?!0:y===!0?!s(_):y?d(_)<=y:!1}e.inlineRef=o;var a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(_){for(let y in _){if(a.has(y))return!0;let b=_[y];if(Array.isArray(b)&&b.some(s)||typeof b=="object"&&s(b))return!0}return!1}function d(_){let y=0;for(let b in _){if(b==="$ref")return 1/0;if(y++,!r.has(b)&&(typeof _[b]=="object"&&(0,t.eachItem)(_[b],v=>y+=d(v)),y===1/0))return 1/0}return y}function l(_,y="",b){b!==!1&&(y=p(y));let v=_.parse(y);return u(_,v)}e.getFullPath=l;function u(_,y){return _.serialize(y).split("#")[0]+"#"}e._getFullPath=u;var c=/#\/?$/;function p(_){return _?_.replace(c,""):""}e.normalizeId=p;function f(_,y,b){return b=p(b),_.resolve(y,b)}e.resolveUrl=f;var h=/^[a-z_][-a-z0-9._]*$/i;function g(_,y){if(typeof _=="boolean")return{};let{schemaId:b,uriResolver:v}=this.opts,w=p(_[b]||y),A={"":w},C=l(v,w,!1),S={},k=new Set;return i(_,{allKeys:!0},(P,R,O,M)=>{if(M===void 0)return;let J=C+R,Z=A[M];typeof P[b]=="string"&&(Z=z.call(this,P[b])),X.call(this,P.$anchor),X.call(this,P.$dynamicAnchor),A[R]=Z;function z(ee){let B=this.opts.uriResolver.resolve;if(ee=p(Z?B(Z,ee):ee),k.has(ee))throw E(ee);k.add(ee);let $=this.refs[ee];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?T(P,$.schema,ee):ee!==p(J)&&(ee[0]==="#"?(T(P,S[ee],ee),S[ee]=P):this.refs[ee]=J),ee}function X(ee){if(typeof ee=="string"){if(!h.test(ee))throw Error(`invalid anchor "${ee}"`);z.call(this,`#${ee}`)}}}),S;function T(P,R,O){if(R!==void 0&&!n(P,R))throw E(O)}function E(P){return Error(`reference "${P}" resolves to more than one schema`)}}e.getSchemaRefs=g}),tm=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=CB(),n=If(),i=FO(),r=If(),o=AB(),a=EB(),s=PB(),d=Pe(),l=to(),u=em(),c=Fe(),p=Xp();function f(j){if(C(j)&&(k(j),A(j))){y(j);return}h(j,()=>(0,t.topBoolOrEmptySchema)(j))}e.validateFunctionCode=f;function h({gen:j,validateName:L,schema:H,schemaEnv:ie,opts:se},Se){se.code.es5?j.func(L,d._`${l.default.data}, ${l.default.valCxt}`,ie.$async,()=>{j.code(d._`"use strict"; ${v(H,se)}`),_(j,se),j.code(Se)}):j.func(L,d._`${l.default.data}, ${g(se)}`,ie.$async,()=>j.code(v(H,se)).code(Se))}function g(j){return d._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${j.dynamicRef?d._`, ${l.default.dynamicAnchors}={}`:d.nil}}={}`}function _(j,L){j.if(l.default.valCxt,()=>{j.var(l.default.instancePath,d._`${l.default.valCxt}.${l.default.instancePath}`),j.var(l.default.parentData,d._`${l.default.valCxt}.${l.default.parentData}`),j.var(l.default.parentDataProperty,d._`${l.default.valCxt}.${l.default.parentDataProperty}`),j.var(l.default.rootData,d._`${l.default.valCxt}.${l.default.rootData}`),L.dynamicRef&&j.var(l.default.dynamicAnchors,d._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{j.var(l.default.instancePath,d._`""`),j.var(l.default.parentData,d._`undefined`),j.var(l.default.parentDataProperty,d._`undefined`),j.var(l.default.rootData,l.default.data),L.dynamicRef&&j.var(l.default.dynamicAnchors,d._`{}`)})}function y(j){let{schema:L,opts:H,gen:ie}=j;h(j,()=>{H.$comment&&L.$comment&&M(j),P(j),ie.let(l.default.vErrors,null),ie.let(l.default.errors,0),H.unevaluated&&b(j),T(j),J(j)})}function b(j){let{gen:L,validateName:H}=j;j.evaluated=L.const("evaluated",d._`${H}.evaluated`),L.if(d._`${j.evaluated}.dynamicProps`,()=>L.assign(d._`${j.evaluated}.props`,d._`undefined`)),L.if(d._`${j.evaluated}.dynamicItems`,()=>L.assign(d._`${j.evaluated}.items`,d._`undefined`))}function v(j,L){let H=typeof j=="object"&&j[L.schemaId];return H&&(L.code.source||L.code.process)?d._`/*# sourceURL=${H} */`:d.nil}function w(j,L){if(C(j)&&(k(j),A(j))){S(j,L);return}(0,t.boolOrEmptySchema)(j,L)}function A({schema:j,self:L}){if(typeof j=="boolean")return!j;for(let H in j)if(L.RULES.all[H])return!0;return!1}function C(j){return typeof j.schema!="boolean"}function S(j,L){let{schema:H,gen:ie,opts:se}=j;se.$comment&&H.$comment&&M(j),R(j),O(j);let Se=ie.const("_errs",l.default.errors);T(j,Se),ie.var(L,d._`${Se} === ${l.default.errors}`)}function k(j){(0,c.checkUnknownRules)(j),E(j)}function T(j,L){if(j.opts.jtd)return z(j,[],!1,L);let H=(0,n.getSchemaTypes)(j.schema),ie=(0,n.coerceAndCheckDataType)(j,H);z(j,H,!ie,L)}function E(j){let{schema:L,errSchemaPath:H,opts:ie,self:se}=j;L.$ref&&ie.ignoreKeywordsWithRef&&(0,c.schemaHasRulesButRef)(L,se.RULES)&&se.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function P(j){let{schema:L,opts:H}=j;L.default!==void 0&&H.useDefaults&&H.strictSchema&&(0,c.checkStrictMode)(j,"default is ignored in the schema root")}function R(j){let L=j.schema[j.opts.schemaId];L&&(j.baseId=(0,u.resolveUrl)(j.opts.uriResolver,j.baseId,L))}function O(j){if(j.schema.$async&&!j.schemaEnv.$async)throw Error("async schema in sync schema")}function M({gen:j,schemaEnv:L,schema:H,errSchemaPath:ie,opts:se}){let Se=H.$comment;if(se.$comment===!0)j.code(d._`${l.default.self}.logger.log(${Se})`);else if(typeof se.$comment=="function"){let At=d.str`${ie}/$comment`,sn=j.scopeValue("root",{ref:L.root});j.code(d._`${l.default.self}.opts.$comment(${Se}, ${At}, ${sn}.schema)`)}}function J(j){let{gen:L,schemaEnv:H,validateName:ie,ValidationError:se,opts:Se}=j;H.$async?L.if(d._`${l.default.errors} === 0`,()=>L.return(l.default.data),()=>L.throw(d._`new ${se}(${l.default.vErrors})`)):(L.assign(d._`${ie}.errors`,l.default.vErrors),Se.unevaluated&&Z(j),L.return(d._`${l.default.errors} === 0`))}function Z({gen:j,evaluated:L,props:H,items:ie}){H instanceof d.Name&&j.assign(d._`${L}.props`,H),ie instanceof d.Name&&j.assign(d._`${L}.items`,ie)}function z(j,L,H,ie){let{gen:se,schema:Se,data:At,allErrors:sn,opts:Zt,self:vt}=j,{RULES:ut}=vt;if(Se.$ref&&(Zt.ignoreKeywordsWithRef||!(0,c.schemaHasRulesButRef)(Se,ut))){se.block(()=>re(j,"$ref",ut.all.$ref.definition));return}Zt.jtd||ee(j,L),se.block(()=>{for(let Qt of ut.rules)wn(Qt);wn(ut.post)});function wn(Qt){(0,i.shouldUseGroup)(Se,Qt)&&(Qt.type?(se.if((0,r.checkDataType)(Qt.type,At,Zt.strictNumbers)),X(j,Qt),L.length===1&&L[0]===Qt.type&&H&&(se.else(),(0,r.reportTypeError)(j)),se.endIf()):X(j,Qt),sn||se.if(d._`${l.default.errors} === ${ie||0}`))}}function X(j,L){let{gen:H,schema:ie,opts:{useDefaults:se}}=j;se&&(0,o.assignDefaults)(j,L.type),H.block(()=>{for(let Se of L.rules)(0,i.shouldUseRule)(ie,Se)&&re(j,Se.keyword,Se.definition,L.type)})}function ee(j,L){j.schemaEnv.meta||!j.opts.strictTypes||(B(j,L),!j.opts.allowUnionTypes&&$(j,L),K(j,j.dataTypes))}function B(j,L){if(L.length){if(!j.dataTypes.length){j.dataTypes=L;return}L.forEach(H=>{x(j.dataTypes,H)||N(j,`type "${H}" not allowed by context "${j.dataTypes.join(",")}"`)}),I(j,L)}}function $(j,L){L.length>1&&!(L.length===2&&L.includes("null"))&&N(j,"use allowUnionTypes to allow union type keyword")}function K(j,L){let H=j.self.RULES.all;for(let ie in H){let se=H[ie];if(typeof se=="object"&&(0,i.shouldUseRule)(j.schema,se)){let{type:Se}=se.definition;Se.length&&!Se.some(At=>F(L,At))&&N(j,`missing type "${Se.join(",")}" for keyword "${ie}"`)}}}function F(j,L){return j.includes(L)||L==="number"&&j.includes("integer")}function x(j,L){return j.includes(L)||L==="integer"&&j.includes("number")}function I(j,L){let H=[];for(let ie of j.dataTypes)x(L,ie)?H.push(ie):L.includes("integer")&&ie==="number"&&H.push("integer");j.dataTypes=H}function N(j,L){let H=j.schemaEnv.baseId+j.errSchemaPath;L+=` at "${H}" (strictTypes)`,(0,c.checkStrictMode)(j,L,j.opts.strictTypes)}class W{constructor(L,H,ie){if((0,a.validateKeywordUsage)(L,H,ie),this.gen=L.gen,this.allErrors=L.allErrors,this.keyword=ie,this.data=L.data,this.schema=L.schema[ie],this.$data=H.$data&&L.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,c.schemaRefOrVal)(L,this.schema,ie,this.$data),this.schemaType=H.schemaType,this.parentSchema=L.schema,this.params={},this.it=L,this.def=H,this.$data)this.schemaCode=L.gen.const("vSchema",Ce(this.$data,L));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,H.schemaType,H.allowUndefined))throw Error(`${ie} value must be ${JSON.stringify(H.schemaType)}`);("code"in H?H.trackErrors:H.errors!==!1)&&(this.errsCount=L.gen.const("_errs",l.default.errors))}result(L,H,ie){this.failResult((0,d.not)(L),H,ie)}failResult(L,H,ie){this.gen.if(L),ie?ie():this.error(),H?(this.gen.else(),H(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(L,H){this.failResult((0,d.not)(L),void 0,H)}fail(L){if(L===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(L),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(L){if(!this.$data)return this.fail(L);let{schemaCode:H}=this;this.fail(d._`${H} !== undefined && (${(0,d.or)(this.invalid$data(),L)})`)}error(L,H,ie){if(H){this.setParams(H),this._error(L,ie),this.setParams({});return}this._error(L,ie)}_error(L,H){(L?p.reportExtraError:p.reportError)(this,this.def.error,H)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(L){this.allErrors||this.gen.if(L)}setParams(L,H){H?Object.assign(this.params,L):this.params=L}block$data(L,H,ie=d.nil){this.gen.block(()=>{this.check$data(L,ie),H()})}check$data(L=d.nil,H=d.nil){if(!this.$data)return;let{gen:ie,schemaCode:se,schemaType:Se,def:At}=this;ie.if((0,d.or)(d._`${se} === undefined`,H)),L!==d.nil&&ie.assign(L,!0),(Se.length||At.validateSchema)&&(ie.elseIf(this.invalid$data()),this.$dataError(),L!==d.nil&&ie.assign(L,!1)),ie.else()}invalid$data(){let{gen:L,schemaCode:H,schemaType:ie,def:se,it:Se}=this;return(0,d.or)(At(),sn());function At(){if(ie.length){if(!(H instanceof d.Name))throw Error("ajv implementation error");let Zt=Array.isArray(ie)?ie:[ie];return d._`${(0,r.checkDataTypes)(Zt,H,Se.opts.strictNumbers,r.DataType.Wrong)}`}return d.nil}function sn(){if(se.validateSchema){let Zt=L.scopeValue("validate$data",{ref:se.validateSchema});return d._`!${Zt}(${H})`}return d.nil}}subschema(L,H){let ie=(0,s.getSubschema)(this.it,L);(0,s.extendSubschemaData)(ie,this.it,L),(0,s.extendSubschemaMode)(ie,L);let se={...this.it,...ie,items:void 0,props:void 0};return w(se,H),se}mergeEvaluated(L,H){let{it:ie,gen:se}=this;ie.opts.unevaluated&&(ie.props!==!0&&L.props!==void 0&&(ie.props=c.mergeEvaluated.props(se,L.props,ie.props,H)),ie.items!==!0&&L.items!==void 0&&(ie.items=c.mergeEvaluated.items(se,L.items,ie.items,H)))}mergeValidEvaluated(L,H){let{it:ie,gen:se}=this;if(ie.opts.unevaluated&&(ie.props!==!0||ie.items!==!0))return se.if(H,()=>this.mergeEvaluated(L,d.Name)),!0}}e.KeywordCxt=W;function re(j,L,H,ie){let se=new W(j,H,L);"code"in H?H.code(se,ie):se.$data&&H.validate?(0,a.funcKeywordCode)(se,H):"macro"in H?(0,a.macroKeywordCode)(se,H):(H.compile||H.validate)&&(0,a.funcKeywordCode)(se,H)}var me=/^\/(?:[^~]|~0|~1)*$/,be=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ce(j,{dataLevel:L,dataNames:H,dataPathArr:ie}){let se,Se;if(j==="")return l.default.rootData;if(j[0]==="/"){if(!me.test(j))throw Error(`Invalid JSON-pointer: ${j}`);se=j,Se=l.default.rootData}else{let vt=be.exec(j);if(!vt)throw Error(`Invalid JSON-pointer: ${j}`);let ut=+vt[1];if(se=vt[2],se==="#"){if(ut>=L)throw Error(Zt("property/index",ut));return ie[L-ut]}if(ut>L)throw Error(Zt("data",ut));if(Se=H[L-ut],!se)return Se}let At=Se,sn=se.split("/");for(let vt of sn)vt&&(Se=d._`${Se}${(0,d.getProperty)((0,c.unescapeJsonPointer)(vt))}`,At=d._`${At} && ${Se}`);return At;function Zt(vt,ut){return`Cannot access ${vt} ${ut} levels up, current level is ${L}`}}e.getData=Ce}),Lb=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});class t extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}e.default=t}),nm=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=em();class n extends Error{constructor(r,o,a,s){super(s||`can't resolve reference ${a} from id ${o}`),this.missingRef=(0,t.resolveUrl)(r,o,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(r,this.missingRef))}}e.default=n}),Ub=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=Pe(),n=Lb(),i=to(),r=em(),o=Fe(),a=tm();class s{constructor(b){var v;this.refs={},this.dynamicAnchors={};let w;typeof b.schema=="object"&&(w=b.schema),this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(v=b.baseId)!==null&&v!==void 0?v:(0,r.normalizeId)(w?.[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=w?.$async,this.refs={}}}e.SchemaEnv=s;function d(y){let b=c.call(this,y);if(b)return b;let v=(0,r.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:w,lines:A}=this.opts.code,{ownProperties:C}=this.opts,S=new t.CodeGen(this.scope,{es5:w,lines:A,ownProperties:C}),k;y.$async&&(k=S.scopeValue("Error",{ref:n.default,code:t._`require("ajv/dist/runtime/validation_error").default`}));let T=S.scopeName("validate");y.validateName=T;let E={gen:S,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:S.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,t.stringify)(y.schema)}:{ref:y.schema}),validateName:T,ValidationError:k,schema:y.schema,schemaEnv:y,rootId:v,baseId:y.baseId||v,schemaPath:t.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},P;try{this._compilations.add(y),(0,a.validateFunctionCode)(E),S.optimize(this.opts.code.optimize);let R=S.toString();P=`${S.scopeRefs(i.default.scope)}return ${R}`,this.opts.code.process&&(P=this.opts.code.process(P,y));let O=Function(`${i.default.self}`,`${i.default.scope}`,P)(this,this.scope.get());if(this.scope.value(T,{ref:O}),O.errors=null,O.schema=y.schema,O.schemaEnv=y,y.$async&&(O.$async=!0),this.opts.code.source===!0&&(O.source={validateName:T,validateCode:R,scopeValues:S._values}),this.opts.unevaluated){let{props:M,items:J}=E;O.evaluated={props:M instanceof t.Name?void 0:M,items:J instanceof t.Name?void 0:J,dynamicProps:M instanceof t.Name,dynamicItems:J instanceof t.Name},O.source&&(O.source.evaluated=(0,t.stringify)(O.evaluated))}return y.validate=O,y}catch(R){throw delete y.validate,delete y.validateName,P&&this.logger.error("Error compiling schema, function code:",P),R}finally{this._compilations.delete(y)}}e.compileSchema=d;function l(y,b,v){var w;v=(0,r.resolveUrl)(this.opts.uriResolver,b,v);let A=y.refs[v];if(A)return A;let C=f.call(this,y,v);if(C===void 0){let S=(w=y.localRefs)===null||w===void 0?void 0:w[v],{schemaId:k}=this.opts;S&&(C=new s({schema:S,schemaId:k,root:y,baseId:b}))}if(C!==void 0)return y.refs[v]=u.call(this,C)}e.resolveRef=l;function u(y){return(0,r.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:d.call(this,y)}function c(y){for(let b of this._compilations)if(p(b,y))return b}e.getCompilingSchema=c;function p(y,b){return y.schema===b.schema&&y.root===b.root&&y.baseId===b.baseId}function f(y,b){let v;for(;typeof(v=this.refs[b])=="string";)b=v;return v||this.schemas[b]||h.call(this,y,b)}function h(y,b){let v=this.opts.uriResolver.parse(b),w=(0,r._getFullPath)(this.opts.uriResolver,v),A=(0,r.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&w===A)return _.call(this,v,y);let C=(0,r.normalizeId)(w),S=this.refs[C]||this.schemas[C];if(typeof S=="string"){let k=h.call(this,y,S);return typeof k?.schema!="object"?void 0:_.call(this,v,k)}if(typeof S?.schema=="object"){if(S.validate||d.call(this,S),C===(0,r.normalizeId)(b)){let{schema:k}=S,{schemaId:T}=this.opts,E=k[T];return E&&(A=(0,r.resolveUrl)(this.opts.uriResolver,A,E)),new s({schema:k,schemaId:T,root:y,baseId:A})}return _.call(this,v,S)}}e.resolveSchema=h;var g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _(y,{baseId:b,schema:v,root:w}){var A;if(((A=y.fragment)===null||A===void 0?void 0:A[0])!=="/")return;for(let k of y.fragment.slice(1).split("/")){if(typeof v=="boolean")return;let T=v[(0,o.unescapeFragment)(k)];if(T===void 0)return;v=T;let E=typeof v=="object"&&v[this.opts.schemaId];!g.has(k)&&E&&(b=(0,r.resolveUrl)(this.opts.uriResolver,b,E))}let C;if(typeof v!="boolean"&&v.$ref&&!(0,o.schemaHasRulesButRef)(v,this.RULES)){let k=(0,r.resolveUrl)(this.opts.uriResolver,b,v.$ref);C=h.call(this,w,k)}let{schemaId:S}=this.opts;if(C=C||new s({schema:v,schemaId:S,root:w,baseId:b}),C.schema!==C.root.schema)return C}}),OB=V((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),LO=V((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(S){let k="",T=0,E=0;for(E=0;E<S.length;E++)if(T=S[E].charCodeAt(0),T!==48){if(!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";k+=S[E];break}for(E+=1;E<S.length;E++){if(T=S[E].charCodeAt(0),!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";k+=S[E]}return k}var d=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(S){return S.length=0,!0}function u(S,k,T){if(S.length){let E=s(S);if(E!=="")k.push(E);else return T.error=!0,!1;S.length=0}return!0}function c(S){let k=0,T={error:!1,address:"",zone:""},E=[],P=[],R=!1,O=!1,M=u;for(let J=0;J<S.length;J++){let Z=S[J];if(!(Z==="["||Z==="]"))if(Z===":"){if(R===!0&&(O=!0),!M(P,E,T))break;if(++k>7){T.error=!0;break}J>0&&S[J-1]===":"&&(R=!0),E.push(":");continue}else if(Z==="%"){if(!M(P,E,T))break;M=l}else{P.push(Z);continue}}return P.length&&(M===l?T.zone=P.join(""):O?E.push(P.join("")):E.push(s(P))),T.address=E.join(""),T}function p(S){if(f(S,":")<2)return{host:S,isIPV6:!1};let k=c(S);if(k.error)return{host:S,isIPV6:!1};{let{address:T,address:E}=k;return k.zone&&(T+="%"+k.zone,E+="%25"+k.zone),{host:T,isIPV6:!0,escapedHost:E}}}function f(S,k){let T=0;for(let E=0;E<S.length;E++)S[E]===k&&T++;return T}function h(S){let k=S,T=[],E=-1,P=0;for(;P=k.length;){if(P===1){if(k===".")break;if(k==="/"){T.push("/");break}else{T.push(k);break}}else if(P===2){if(k[0]==="."){if(k[1]===".")break;if(k[1]==="/"){k=k.slice(2);continue}}else if(k[0]==="/"&&(k[1]==="."||k[1]==="/")){T.push("/");break}}else if(P===3&&k==="/.."){T.length!==0&&T.pop(),T.push("/");break}if(k[0]==="."){if(k[1]==="."){if(k[2]==="/"){k=k.slice(3);continue}}else if(k[1]==="/"){k=k.slice(2);continue}}else if(k[0]==="/"&&k[1]==="."){if(k[2]==="/"){k=k.slice(2);continue}else if(k[2]==="."&&k[3]==="/"){k=k.slice(3),T.length!==0&&T.pop();continue}}if((E=k.indexOf("/",1))===-1){T.push(k);break}else T.push(k.slice(0,E)),k=k.slice(E)}return T.join("")}var g={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},_=/[@/?#:]/g,y=/[@/?#]/g;function b(S,k){let T=k?y:_;return T.lastIndex=0,S.replace(T,E=>g[E])}function v(S,k=!1){if(S.indexOf("%")===-1)return S;let T="";for(let E=0;E<S.length;E++){if(S[E]==="%"&&E+2<S.length){let P=S.slice(E+1,E+3);if(r(P)){let R=P.toUpperCase(),O=String.fromCharCode(parseInt(R,16));k&&o(O)?T+=O:T+="%"+R,E+=2;continue}}T+=S[E]}return T}function w(S){let k="";for(let T=0;T<S.length;T++){if(S[T]==="%"&&T+2<S.length){let E=S.slice(T+1,T+3);if(r(E)){let P=E.toUpperCase(),R=String.fromCharCode(parseInt(P,16));R!=="."&&o(R)?k+=R:k+="%"+P,T+=2;continue}}a(S[T])?k+=S[T]:k+=escape(S[T])}return k}function A(S){let k="";for(let T=0;T<S.length;T++){if(S[T]==="%"&&T+2<S.length){let E=S.slice(T+1,T+3);if(r(E)){k+="%"+E.toUpperCase(),T+=2;continue}}k+=escape(S[T])}return k}function C(S){let k=[];if(S.userinfo!==void 0&&(k.push(S.userinfo),k.push("@")),S.host!==void 0){let T=unescape(S.host);if(!i(T)){let E=p(T);E.isIPV6===!0?T=`[${E.escapedHost}]`:T=b(T,!1)}k.push(T)}return(typeof S.port=="number"||typeof S.port=="string")&&(k.push(":"),k.push(String(S.port))),k.length?k.join(""):void 0}t.exports={nonSimpleDomain:d,recomposeAuthority:C,reescapeHostDelimiters:b,normalizePercentEncoding:v,normalizePathEncoding:w,escapePreservingEscapes:A,removeDotSegments:h,isIPv4:i,isUUID:n,normalizeIPv6:p,stringArrayToHexStripped:s}}),RB=V((e,t)=>{var{isUUID:n}=LO(),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function o(S){return r.indexOf(S)!==-1}function a(S){return S.secure===!0?!0:S.secure===!1?!1:S.scheme?S.scheme.length===3&&(S.scheme[0]==="w"||S.scheme[0]==="W")&&(S.scheme[1]==="s"||S.scheme[1]==="S")&&(S.scheme[2]==="s"||S.scheme[2]==="S"):!1}function s(S){return S.host||(S.error=S.error||"HTTP URIs must have a host."),S}function d(S){let k=String(S.scheme).toLowerCase()==="https";return(S.port===(k?443:80)||S.port==="")&&(S.port=void 0),S.path||(S.path="/"),S}function l(S){return S.secure=a(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S}function u(S){if((S.port===(a(S)?443:80)||S.port==="")&&(S.port=void 0),typeof S.secure=="boolean"&&(S.scheme=S.secure?"wss":"ws",S.secure=void 0),S.resourceName){let[k,T]=S.resourceName.split("?");S.path=k&&k!=="/"?k:void 0,S.query=T,S.resourceName=void 0}return S.fragment=void 0,S}function c(S,k){if(!S.path)return S.error="URN can not be parsed",S;let T=S.path.match(i);if(T){let E=k.scheme||S.scheme||"urn";S.nid=T[1].toLowerCase(),S.nss=T[2];let P=`${E}:${k.nid||S.nid}`,R=C(P);S.path=void 0,R&&(S=R.parse(S,k))}else S.error=S.error||"URN can not be parsed.";return S}function p(S,k){if(S.nid===void 0)throw Error("URN without nid cannot be serialized");let T=k.scheme||S.scheme||"urn",E=S.nid.toLowerCase(),P=`${T}:${k.nid||E}`,R=C(P);R&&(S=R.serialize(S,k));let O=S,M=S.nss;return O.path=`${E||k.nid}:${M}`,k.skipEscape=!0,O}function f(S,k){let T=S;return T.uuid=T.nss,T.nss=void 0,!k.tolerant&&(!T.uuid||!n(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function h(S){let k=S;return k.nss=(S.uuid||"").toLowerCase(),k}var g={scheme:"http",domainHost:!0,parse:s,serialize:d},_={scheme:"https",domainHost:g.domainHost,parse:s,serialize:d},y={scheme:"ws",domainHost:!0,parse:l,serialize:u},b={scheme:"wss",domainHost:y.domainHost,parse:y.parse,serialize:y.serialize},v={scheme:"urn",parse:c,serialize:p,skipNormalize:!0},w={scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0},A={http:g,https:_,ws:y,wss:b,urn:v,"urn:uuid":w};Object.setPrototypeOf(A,null);function C(S){return S&&(A[S]||A[S.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:A,isValidSchemeName:o,getSchemeHandler:C}}),$B=V((e,t)=>{var{normalizeIPv6:n,removeDotSegments:i,recomposeAuthority:r,normalizePercentEncoding:o,normalizePathEncoding:a,escapePreservingEscapes:s,reescapeHostDelimiters:d,isIPv4:l,nonSimpleDomain:u}=LO(),{SCHEMES:c,getSchemeHandler:p}=RB();function f(E,P){return typeof E=="string"?E=C(E,P):typeof E=="object"&&(E=A(y(E,P),P)),E}function h(E,P,R){let O=R?Object.assign({scheme:"null"},R):{scheme:"null"},M=g(A(E,O),A(P,O),O,!0);return O.skipEscape=!0,y(M,O)}function g(E,P,R,O){let M={};return O||(E=A(y(E,R),R),P=A(y(P,R),R)),R=R||{},!R.tolerant&&P.scheme?(M.scheme=P.scheme,M.userinfo=P.userinfo,M.host=P.host,M.port=P.port,M.path=i(P.path||""),M.query=P.query):(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0?(M.userinfo=P.userinfo,M.host=P.host,M.port=P.port,M.path=i(P.path||""),M.query=P.query):(P.path?(P.path[0]==="/"?M.path=i(P.path):((E.userinfo!==void 0||E.host!==void 0||E.port!==void 0)&&!E.path?M.path="/"+P.path:E.path?M.path=E.path.slice(0,E.path.lastIndexOf("/")+1)+P.path:M.path=P.path,M.path=i(M.path)),M.query=P.query):(M.path=E.path,P.query!==void 0?M.query=P.query:M.query=E.query),M.userinfo=E.userinfo,M.host=E.host,M.port=E.port),M.scheme=E.scheme),M.fragment=P.fragment,M}function _(E,P,R){let O=k(E,R),M=k(P,R);return O!==void 0&&M!==void 0&&O.toLowerCase()===M.toLowerCase()}function y(E,P){let R={host:E.host,scheme:E.scheme,userinfo:E.userinfo,port:E.port,path:E.path,query:E.query,nid:E.nid,nss:E.nss,uuid:E.uuid,fragment:E.fragment,reference:E.reference,resourceName:E.resourceName,secure:E.secure,error:""},O=Object.assign({},P),M=[],J=p(O.scheme||R.scheme);J&&J.serialize&&J.serialize(R,O),R.path!==void 0&&(O.skipEscape?R.path=o(R.path):(R.path=s(R.path),R.scheme!==void 0&&(R.path=R.path.split("%3A").join(":")))),O.reference!=="suffix"&&R.scheme&&M.push(R.scheme,":");let Z=r(R);if(Z!==void 0&&(O.reference!=="suffix"&&M.push("//"),M.push(Z),R.path&&R.path[0]!=="/"&&M.push("/")),R.path!==void 0){let z=R.path;!O.absolutePath&&(!J||!J.absolutePath)&&(z=i(z)),Z===void 0&&z[0]==="/"&&z[1]==="/"&&(z="/%2F"+z.slice(2)),M.push(z)}return R.query!==void 0&&M.push("?",R.query),R.fragment!==void 0&&M.push("#",R.fragment),M.join("")}var b=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v(E,P){if(P[2]!==void 0&&E.path&&E.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof E.port=="number"&&(E.port<0||E.port>65535))return"URI port is malformed."}function w(E,P){let R=Object.assign({},P),O={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},M=!1,J=!1;R.reference==="suffix"&&(R.scheme?E=R.scheme+":"+E:E="//"+E);let Z=E.match(b);if(Z){O.scheme=Z[1],O.userinfo=Z[3],O.host=Z[4],O.port=parseInt(Z[5],10),O.path=Z[6]||"",O.query=Z[7],O.fragment=Z[8],isNaN(O.port)&&(O.port=Z[5]);let z=v(O,Z);if(z!==void 0&&(O.error=O.error||z,M=!0),O.host)if(l(O.host)===!1){let ee=n(O.host);O.host=ee.host.toLowerCase(),J=ee.isIPV6}else J=!0;O.scheme===void 0&&O.userinfo===void 0&&O.host===void 0&&O.port===void 0&&O.query===void 0&&!O.path?O.reference="same-document":O.scheme===void 0?O.reference="relative":O.fragment===void 0?O.reference="absolute":O.reference="uri",R.reference&&R.reference!=="suffix"&&R.reference!==O.reference&&(O.error=O.error||"URI is not a "+R.reference+" reference.");let X=p(R.scheme||O.scheme);if(!R.unicodeSupport&&(!X||!X.unicodeSupport)&&O.host&&(R.domainHost||X&&X.domainHost)&&J===!1&&u(O.host))try{O.host=URL.domainToASCII(O.host.toLowerCase())}catch(ee){O.error=O.error||"Host's domain name can not be converted to ASCII: "+ee}if((!X||X&&!X.skipNormalize)&&(E.indexOf("%")!==-1&&(O.scheme!==void 0&&(O.scheme=unescape(O.scheme)),O.host!==void 0&&(O.host=d(unescape(O.host),J))),O.path&&(O.path=a(O.path)),O.fragment))try{O.fragment=encodeURI(decodeURIComponent(O.fragment))}catch{O.error=O.error||"URI malformed"}X&&X.parse&&X.parse(O,R)}else O.error=O.error||"URI can not be parsed.";return{parsed:O,malformedAuthorityOrPort:M}}function A(E,P){return w(E,P).parsed}function C(E,P){return S(E,P).normalized}function S(E,P){let{parsed:R,malformedAuthorityOrPort:O}=w(E,P);return{normalized:O?E:y(R,P),malformedAuthorityOrPort:O}}function k(E,P){if(typeof E=="string"){let{normalized:R,malformedAuthorityOrPort:O}=S(E,P);return O?void 0:R}if(typeof E=="object")return y(E,P)}var T={SCHEMES:c,normalize:f,resolve:h,resolveComponent:g,equal:_,serialize:y,parse:A};t.exports=T,t.exports.default=T,t.exports.fastUri=T}),MB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$B();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),jB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=tm();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Pe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});var i=Lb(),r=nm(),o=NO(),a=Ub(),s=Pe(),d=em(),l=If(),u=Fe(),c=OB(),p=MB(),f=(B,$)=>new RegExp(B,$);f.code="new RegExp";var h=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},b=200;function v(B){var $,K,F,x,I,N,W,re,me,be,Ce,j,L,H,ie,se,Se,At,sn,Zt,vt,ut,wn,Qt,io;let Fr=B.strict,ra=($=B.code)===null||$===void 0?void 0:$.optimize,Pu=ra===!0||ra===void 0?1:ra||0,Iu=(F=(K=B.code)===null||K===void 0?void 0:K.regExp)!==null&&F!==void 0?F:f,Ws=(x=B.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(N=(I=B.strictSchema)!==null&&I!==void 0?I:Fr)!==null&&N!==void 0?N:!0,strictNumbers:(re=(W=B.strictNumbers)!==null&&W!==void 0?W:Fr)!==null&&re!==void 0?re:!0,strictTypes:(be=(me=B.strictTypes)!==null&&me!==void 0?me:Fr)!==null&&be!==void 0?be:"log",strictTuples:(j=(Ce=B.strictTuples)!==null&&Ce!==void 0?Ce:Fr)!==null&&j!==void 0?j:"log",strictRequired:(H=(L=B.strictRequired)!==null&&L!==void 0?L:Fr)!==null&&H!==void 0?H:!1,code:B.code?{...B.code,optimize:Pu,regExp:Iu}:{optimize:Pu,regExp:Iu},loopRequired:(ie=B.loopRequired)!==null&&ie!==void 0?ie:b,loopEnum:(se=B.loopEnum)!==null&&se!==void 0?se:b,meta:(Se=B.meta)!==null&&Se!==void 0?Se:!0,messages:(At=B.messages)!==null&&At!==void 0?At:!0,inlineRefs:(sn=B.inlineRefs)!==null&&sn!==void 0?sn:!0,schemaId:(Zt=B.schemaId)!==null&&Zt!==void 0?Zt:"$id",addUsedSchema:(vt=B.addUsedSchema)!==null&&vt!==void 0?vt:!0,validateSchema:(ut=B.validateSchema)!==null&&ut!==void 0?ut:!0,validateFormats:(wn=B.validateFormats)!==null&&wn!==void 0?wn:!0,unicodeRegExp:(Qt=B.unicodeRegExp)!==null&&Qt!==void 0?Qt:!0,int32range:(io=B.int32range)!==null&&io!==void 0?io:!0,uriResolver:Ws}}class w{constructor($={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...v($)};let{es5:K,lines:F}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:K,lines:F}),this.logger=R($.logger);let x=$.validateFormats;$.validateFormats=!1,this.RULES=(0,o.getRules)(),A.call(this,_,$,"NOT SUPPORTED"),A.call(this,y,$,"DEPRECATED","warn"),this._metaOpts=E.call(this),$.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&T.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),S.call(this),$.validateFormats=x}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:K,schemaId:F}=this.opts,x=c;F==="id"&&(x={...c},x.id=x.$id,delete x.$id),K&&$&&this.addMetaSchema(x,x[F],!1)}defaultMeta(){let{meta:$,schemaId:K}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[K]||$:void 0}validate($,K){let F;if(typeof $=="string"){if(F=this.getSchema($),!F)throw Error(`no schema with key or ref "${$}"`)}else F=this.compile($);let x=F(K);return"$async"in F||(this.errors=F.errors),x}compile($,K){let F=this._addSchema($,K);return F.validate||this._compileSchemaEnv(F)}compileAsync($,K){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:F}=this.opts;return x.call(this,$,K);async function x(be,Ce){await I.call(this,be.$schema);let j=this._addSchema(be,Ce);return j.validate||N.call(this,j)}async function I(be){be&&!this.getSchema(be)&&await x.call(this,{$ref:be},!0)}async function N(be){try{return this._compileSchemaEnv(be)}catch(Ce){if(!(Ce instanceof r.default))throw Ce;return W.call(this,Ce),await re.call(this,Ce.missingSchema),N.call(this,be)}}function W({missingSchema:be,missingRef:Ce}){if(this.refs[be])throw Error(`AnySchema ${be} is loaded but ${Ce} cannot be resolved`)}async function re(be){let Ce=await me.call(this,be);this.refs[be]||await I.call(this,Ce.$schema),this.refs[be]||this.addSchema(Ce,be,K)}async function me(be){let Ce=this._loading[be];if(Ce)return Ce;try{return await(this._loading[be]=F(be))}finally{delete this._loading[be]}}}addSchema($,K,F,x=this.opts.validateSchema){if(Array.isArray($)){for(let N of $)this.addSchema(N,void 0,F,x);return this}let I;if(typeof $=="object"){let{schemaId:N}=this.opts;if(I=$[N],I!==void 0&&typeof I!="string")throw Error(`schema ${N} must be string`)}return K=(0,d.normalizeId)(K||I),this._checkUnique(K),this.schemas[K]=this._addSchema($,F,K,x,!0),this}addMetaSchema($,K,F=this.opts.validateSchema){return this.addSchema($,K,!0,F),this}validateSchema($,K){if(typeof $=="boolean")return!0;let F;if(F=$.$schema,F!==void 0&&typeof F!="string")throw Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let x=this.validate(F,$);if(!x&&K){let I="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(I);else throw Error(I)}return x}getSchema($){let K;for(;typeof(K=C.call(this,$))=="string";)$=K;if(K===void 0){let{schemaId:F}=this.opts,x=new a.SchemaEnv({schema:{},schemaId:F});if(K=a.resolveSchema.call(this,x,$),!K)return;this.refs[$]=K}return K.validate||this._compileSchemaEnv(K)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let K=C.call(this,$);return typeof K=="object"&&this._cache.delete(K.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{let K=$;this._cache.delete(K);let F=$[this.opts.schemaId];return F&&(F=(0,d.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let K of $)this.addKeyword(K);return this}addKeyword($,K){let F;if(typeof $=="string")F=$,typeof K=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),K.keyword=F);else if(typeof $=="object"&&K===void 0){if(K=$,F=K.keyword,Array.isArray(F)&&!F.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(M.call(this,F,K),!K)return(0,u.eachItem)(F,I=>J.call(this,I)),this;z.call(this,K);let x={...K,type:(0,l.getJSONTypes)(K.type),schemaType:(0,l.getJSONTypes)(K.schemaType)};return(0,u.eachItem)(F,x.type.length===0?I=>J.call(this,I,x):I=>x.type.forEach(N=>J.call(this,I,x,N))),this}getKeyword($){let K=this.RULES.all[$];return typeof K=="object"?K.definition:!!K}removeKeyword($){let{RULES:K}=this;delete K.keywords[$],delete K.all[$];for(let F of K.rules){let x=F.rules.findIndex(I=>I.keyword===$);x>=0&&F.rules.splice(x,1)}return this}addFormat($,K){return typeof K=="string"&&(K=new RegExp(K)),this.formats[$]=K,this}errorsText($=this.errors,{separator:K=", ",dataVar:F="data"}={}){return!$||$.length===0?"No errors":$.map(x=>`${F}${x.instancePath} ${x.message}`).reduce((x,I)=>x+K+I)}$dataMetaSchema($,K){let F=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let x of K){let I=x.split("/").slice(1),N=$;for(let W of I)N=N[W];for(let W in F){let re=F[W];if(typeof re!="object")continue;let{$data:me}=re.definition,be=N[W];me&&be&&(N[W]=ee(be))}}return $}_removeAllSchemas($,K){for(let F in $){let x=$[F];(!K||K.test(F))&&(typeof x=="string"?delete $[F]:x&&!x.meta&&(this._cache.delete(x.schema),delete $[F]))}}_addSchema($,K,F,x=this.opts.validateSchema,I=this.opts.addUsedSchema){let N,{schemaId:W}=this.opts;if(typeof $=="object")N=$[W];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof $!="boolean")throw Error("schema must be object or boolean")}let re=this._cache.get($);if(re!==void 0)return re;F=(0,d.normalizeId)(N||F);let me=d.getSchemaRefs.call(this,$,F);return re=new a.SchemaEnv({schema:$,schemaId:W,meta:K,baseId:F,localRefs:me}),this._cache.set(re.schema,re),I&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=re),x&&this.validateSchema($,!0),re}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):a.compileSchema.call(this,$),!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let K=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,$)}finally{this.opts=K}}}w.ValidationError=i.default,w.MissingRefError=r.default,e.default=w;function A(B,$,K,F="error"){for(let x in B){let I=x;I in $&&this.logger[F](`${K}: option ${x}. ${B[I]}`)}}function C(B){return B=(0,d.normalizeId)(B),this.schemas[B]||this.refs[B]}function S(){let B=this.opts.schemas;if(B)if(Array.isArray(B))this.addSchema(B);else for(let $ in B)this.addSchema(B[$],$)}function k(){for(let B in this.opts.formats){let $=this.opts.formats[B];$&&this.addFormat(B,$)}}function T(B){if(Array.isArray(B)){this.addVocabulary(B);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let $ in B){let K=B[$];K.keyword||(K.keyword=$),this.addKeyword(K)}}function E(){let B={...this.opts};for(let $ of h)delete B[$];return B}var P={log(){},warn(){},error(){}};function R(B){if(B===!1)return P;if(B===void 0)return console;if(B.log&&B.warn&&B.error)return B;throw Error("logger must implement log, warn and error methods")}var O=/^[a-z_$][a-z0-9_$:-]*$/i;function M(B,$){let{RULES:K}=this;if((0,u.eachItem)(B,F=>{if(K.keywords[F])throw Error(`Keyword ${F} is already defined`);if(!O.test(F))throw Error(`Keyword ${F} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw Error('$data keyword must have "code" or "validate" function')}function J(B,$,K){var F;let x=$?.post;if(K&&x)throw Error('keyword with "post" flag cannot have "type"');let{RULES:I}=this,N=x?I.post:I.rules.find(({type:re})=>re===K);if(N||(N={type:K,rules:[]},I.rules.push(N)),I.keywords[B]=!0,!$)return;let W={keyword:B,definition:{...$,type:(0,l.getJSONTypes)($.type),schemaType:(0,l.getJSONTypes)($.schemaType)}};$.before?Z.call(this,N,W,$.before):N.rules.push(W),I.all[B]=W,(F=$.implements)===null||F===void 0||F.forEach(re=>this.addKeyword(re))}function Z(B,$,K){let F=B.rules.findIndex(x=>x.keyword===K);F>=0?B.rules.splice(F,0,$):(B.rules.push($),this.logger.warn(`rule ${K} is not defined`))}function z(B){let{metaSchema:$}=B;$!==void 0&&(B.$data&&this.opts.$data&&($=ee($)),B.validateSchema=this.compile($,!0))}var X={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ee(B){return{anyOf:[B,X]}}}),qB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),NB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=nm(),n=Rr(),i=Pe(),r=to(),o=Ub(),a=Fe(),s={keyword:"$ref",schemaType:"string",code(u){let{gen:c,schema:p,it:f}=u,{baseId:h,schemaEnv:g,validateName:_,opts:y,self:b}=f,{root:v}=g;if((p==="#"||p==="#/")&&h===v.baseId)return A();let w=o.resolveRef.call(b,v,h,p);if(w===void 0)throw new t.default(f.opts.uriResolver,h,p);if(w instanceof o.SchemaEnv)return C(w);return S(w);function A(){if(g===v)return l(u,_,g,g.$async);let k=c.scopeValue("root",{ref:v});return l(u,i._`${k}.validate`,v,v.$async)}function C(k){let T=d(u,k);l(u,T,k,k.$async)}function S(k){let T=c.scopeValue("schema",y.code.source===!0?{ref:k,code:(0,i.stringify)(k)}:{ref:k}),E=c.name("valid"),P=u.subschema({schema:k,dataTypes:[],schemaPath:i.nil,topSchemaRef:T,errSchemaPath:p},E);u.mergeEvaluated(P),u.ok(E)}}};function d(u,c){let{gen:p}=u;return c.validate?p.scopeValue("validate",{ref:c.validate}):i._`${p.scopeValue("wrapper",{ref:c})}.validate`}e.getValidate=d;function l(u,c,p,f){let{gen:h,it:g}=u,{allErrors:_,schemaEnv:y,opts:b}=g,v=b.passContext?r.default.this:i.nil;f?w():A();function w(){if(!y.$async)throw Error("async schema referenced by sync schema");let k=h.let("valid");h.try(()=>{h.code(i._`await ${(0,n.callValidateCode)(u,c,v)}`),S(c),!_&&h.assign(k,!0)},T=>{h.if(i._`!(${T} instanceof ${g.ValidationError})`,()=>h.throw(T)),C(T),!_&&h.assign(k,!1)}),u.ok(k)}function A(){u.result((0,n.callValidateCode)(u,c,v),()=>S(c),()=>C(c))}function C(k){let T=i._`${k}.errors`;h.assign(r.default.vErrors,i._`${r.default.vErrors} === null ? ${T} : ${r.default.vErrors}.concat(${T})`),h.assign(r.default.errors,i._`${r.default.vErrors}.length`)}function S(k){var T;if(!g.opts.unevaluated)return;let E=(T=p?.validate)===null||T===void 0?void 0:T.evaluated;if(g.props!==!0)if(E&&!E.dynamicProps)E.props!==void 0&&(g.props=a.mergeEvaluated.props(h,E.props,g.props));else{let P=h.var("props",i._`${k}.evaluated.props`);g.props=a.mergeEvaluated.props(h,P,g.props,i.Name)}if(g.items!==!0)if(E&&!E.dynamicItems)E.items!==void 0&&(g.items=a.mergeEvaluated.items(h,E.items,g.items));else{let P=h.var("items",i._`${k}.evaluated.items`);g.items=a.mergeEvaluated.items(h,P,g.items,i.Name)}}}e.callRef=l,e.default=s}),FB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qB(),n=NB(),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,n.default];e.default=i}),DB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=t.operators,i={maximum:{okStr:"<=",ok:n.LTE,fail:n.GT},minimum:{okStr:">=",ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},r={message:({keyword:a,schemaCode:s})=>t.str`must be ${i[a].okStr} ${s}`,params:({keyword:a,schemaCode:s})=>t._`{comparison: ${i[a].okStr}, limit: ${s}}`},o={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:r,code(a){let{keyword:s,data:d,schemaCode:l}=a;a.fail$data(t._`${d} ${i[s].fail} ${l} || isNaN(${d})`)}};e.default=o}),LB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n={message:({schemaCode:r})=>t.str`must be multiple of ${r}`,params:({schemaCode:r})=>t._`{multipleOf: ${r}}`},i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:n,code(r){let{gen:o,data:a,schemaCode:s,it:d}=r,l=d.opts.multipleOfPrecision,u=o.let("res"),c=l?t._`Math.abs(Math.round(${u}) - ${u}) > 1e-${l}`:t._`${u} !== parseInt(${u})`;r.fail$data(t._`(${s} === 0 || (${u} = ${a}/${s}, ${c}))`)}};e.default=i}),UB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(n){let i=n.length,r=0,o=0,a;for(;o<i;)r++,a=n.charCodeAt(o++),a>=55296&&a<=56319&&o<i&&(a=n.charCodeAt(o),(a&64512)===56320&&o++);return r}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),GB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i=UB(),r={message({keyword:a,schemaCode:s}){let d=a==="maxLength"?"more":"fewer";return t.str`must NOT have ${d} than ${s} characters`},params:({schemaCode:a})=>t._`{limit: ${a}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:r,code(a){let{keyword:s,data:d,schemaCode:l,it:u}=a,c=s==="maxLength"?t.operators.GT:t.operators.LT,p=u.opts.unicode===!1?t._`${d}.length`:t._`${(0,n.useFunc)(a.gen,i.default)}(${d})`;a.fail$data(t._`${p} ${c} ${l}`)}};e.default=o}),zB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rr(),n=Fe(),i=Pe(),r={message:({schemaCode:a})=>i.str`must match pattern "${a}"`,params:({schemaCode:a})=>i._`{pattern: ${a}}`},o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:r,code(a){let{gen:s,data:d,$data:l,schema:u,schemaCode:c,it:p}=a,f=p.opts.unicodeRegExp?"u":"";if(l){let{regExp:h}=p.opts.code,g=h.code==="new RegExp"?i._`new RegExp`:(0,n.useFunc)(s,h),_=s.let("valid");s.try(()=>s.assign(_,i._`${g}(${c}, ${f}).test(${d})`),()=>s.assign(_,!1)),a.fail$data(i._`!${_}`)}else{let h=(0,t.usePattern)(a,u);a.fail$data(i._`!${h}.test(${d})`)}}};e.default=o}),JB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n={message({keyword:r,schemaCode:o}){let a=r==="maxProperties"?"more":"fewer";return t.str`must NOT have ${a} than ${o} properties`},params:({schemaCode:r})=>t._`{limit: ${r}}`},i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:n,code(r){let{keyword:o,data:a,schemaCode:s}=r,d=o==="maxProperties"?t.operators.GT:t.operators.LT;r.fail$data(t._`Object.keys(${a}).length ${d} ${s}`)}};e.default=i}),KB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rr(),n=Pe(),i=Fe(),r={message:({params:{missingProperty:a}})=>n.str`must have required property '${a}'`,params:({params:{missingProperty:a}})=>n._`{missingProperty: ${a}}`},o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:r,code(a){let{gen:s,schema:d,schemaCode:l,data:u,$data:c,it:p}=a,{opts:f}=p;if(!c&&d.length===0)return;let h=d.length>=f.loopRequired;if(p.allErrors?g():_(),f.strictRequired){let v=a.parentSchema.properties,{definedProperties:w}=a.it;for(let A of d)if(v?.[A]===void 0&&!w.has(A)){let C=p.schemaEnv.baseId+p.errSchemaPath,S=`required property "${A}" is not defined at "${C}" (strictRequired)`;(0,i.checkStrictMode)(p,S,p.opts.strictRequired)}}function g(){if(h||c)a.block$data(n.nil,y);else for(let v of d)(0,t.checkReportMissingProp)(a,v)}function _(){let v=s.let("missing");if(h||c){let w=s.let("valid",!0);a.block$data(w,()=>b(v,w)),a.ok(w)}else s.if((0,t.checkMissingProp)(a,d,v)),(0,t.reportMissingProp)(a,v),s.else()}function y(){s.forOf("prop",l,v=>{a.setParams({missingProperty:v}),s.if((0,t.noPropertyInData)(s,u,v,f.ownProperties),()=>a.error())})}function b(v,w){a.setParams({missingProperty:v}),s.forOf(v,l,()=>{s.assign(w,(0,t.propertyInData)(s,u,v,f.ownProperties)),s.if((0,n.not)(w),()=>{a.error(),s.break()})},n.nil)}}};e.default=o}),BB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n={message({keyword:r,schemaCode:o}){let a=r==="maxItems"?"more":"fewer";return t.str`must NOT have ${a} than ${o} items`},params:({schemaCode:r})=>t._`{limit: ${r}}`},i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:n,code(r){let{keyword:o,data:a,schemaCode:s}=r,d=o==="maxItems"?t.operators.GT:t.operators.LT;r.fail$data(t._`${a}.length ${d} ${s}`)}};e.default=i}),Gb=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=DO();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),WB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=If(),n=Pe(),i=Fe(),r=Gb(),o={message:({params:{i:s,j:d}})=>n.str`must NOT have duplicate items (items ## ${d} and ${s} are identical)`,params:({params:{i:s,j:d}})=>n._`{i: ${s}, j: ${d}}`},a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:o,code(s){let{gen:d,data:l,$data:u,schema:c,parentSchema:p,schemaCode:f,it:h}=s;if(!u&&!c)return;let g=d.let("valid"),_=p.items?(0,t.getSchemaTypes)(p.items):[];s.block$data(g,y,n._`${f} === false`),s.ok(g);function y(){let A=d.let("i",n._`${l}.length`),C=d.let("j");s.setParams({i:A,j:C}),d.assign(g,!0),d.if(n._`${A} > 1`,()=>(b()?v:w)(A,C))}function b(){return _.length>0&&!_.some(A=>A==="object"||A==="array")}function v(A,C){let S=d.name("item"),k=(0,t.checkDataTypes)(_,S,h.opts.strictNumbers,t.DataType.Wrong),T=d.const("indices",n._`{}`);d.for(n._`;${A}--;`,()=>{d.let(S,n._`${l}[${A}]`),d.if(k,n._`continue`),_.length>1&&d.if(n._`typeof ${S} == "string"`,n._`${S} += "_"`),d.if(n._`typeof ${T}[${S}] == "number"`,()=>{d.assign(C,n._`${T}[${S}]`),s.error(),d.assign(g,!1).break()}).code(n._`${T}[${S}] = ${A}`)})}function w(A,C){let S=(0,i.useFunc)(d,r.default),k=d.name("outer");d.label(k).for(n._`;${A}--;`,()=>d.for(n._`${C} = ${A}; ${C}--;`,()=>d.if(n._`${S}(${l}[${A}], ${l}[${C}])`,()=>{s.error(),d.assign(g,!1).break(k)})))}}};e.default=a}),HB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i=Gb(),r={message:"must be equal to constant",params:({schemaCode:a})=>t._`{allowedValue: ${a}}`},o={keyword:"const",$data:!0,error:r,code(a){let{gen:s,data:d,$data:l,schemaCode:u,schema:c}=a;l||c&&typeof c=="object"?a.fail$data(t._`!${(0,n.useFunc)(s,i.default)}(${d}, ${u})`):a.fail(t._`${c} !== ${d}`)}};e.default=o}),VB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i=Gb(),r={message:"must be equal to one of the allowed values",params:({schemaCode:a})=>t._`{allowedValues: ${a}}`},o={keyword:"enum",schemaType:"array",$data:!0,error:r,code(a){let{gen:s,data:d,$data:l,schema:u,schemaCode:c,it:p}=a;if(!l&&u.length===0)throw Error("enum must have non-empty array");let f=u.length>=p.opts.loopEnum,h,g=()=>h??(h=(0,n.useFunc)(s,i.default)),_;if(f||l)_=s.let("valid"),a.block$data(_,y);else{if(!Array.isArray(u))throw Error("ajv implementation error");let v=s.const("vSchema",c);_=(0,t.or)(...u.map((w,A)=>b(v,A)))}a.pass(_);function y(){s.assign(_,!1),s.forOf("v",c,v=>s.if(t._`${g()}(${d}, ${v})`,()=>s.assign(_,!0).break()))}function b(v,w){let A=u[w];return typeof A=="object"&&A!==null?t._`${g()}(${d}, ${v}[${w}])`:t._`${d} === ${A}`}}};e.default=o}),ZB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=DB(),n=LB(),i=GB(),r=zB(),o=JB(),a=KB(),s=BB(),d=WB(),l=HB(),u=VB(),c=[t.default,n.default,i.default,r.default,o.default,a.default,s.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,u.default];e.default=c}),UO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=Pe(),n=Fe(),i={message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:i,code(a){let{parentSchema:s,it:d}=a,{items:l}=s;if(!Array.isArray(l)){(0,n.checkStrictMode)(d,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(a,l)}};function o(a,s){let{gen:d,schema:l,data:u,keyword:c,it:p}=a;p.items=!0;let f=d.const("len",t._`${u}.length`);if(l===!1)a.setParams({len:s.length}),a.pass(t._`${f} <= ${s.length}`);else if(typeof l=="object"&&!(0,n.alwaysValidSchema)(p,l)){let g=d.var("valid",t._`${f} <= ${s.length}`);d.if((0,t.not)(g),()=>h(g)),a.ok(g)}function h(g){d.forRange("i",s.length,f,_=>{a.subschema({keyword:c,dataProp:_,dataPropType:n.Type.Num},g),!p.allErrors&&d.if((0,t.not)(g),()=>d.break())})}}e.validateAdditionalItems=o,e.default=r}),GO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=Pe(),n=Fe(),i=Rr(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:s,it:d}=a;if(Array.isArray(s))return o(a,"additionalItems",s);d.items=!0,!(0,n.alwaysValidSchema)(d,s)&&a.ok((0,i.validateArray)(a))}};function o(a,s,d=a.schema){let{gen:l,parentSchema:u,data:c,keyword:p,it:f}=a;_(u),f.opts.unevaluated&&d.length&&f.items!==!0&&(f.items=n.mergeEvaluated.items(l,d.length,f.items));let h=l.name("valid"),g=l.const("len",t._`${c}.length`);d.forEach((y,b)=>{(0,n.alwaysValidSchema)(f,y)||(l.if(t._`${g} > ${b}`,()=>a.subschema({keyword:p,schemaProp:b,dataProp:b},h)),a.ok(h))});function _(y){let{opts:b,errSchemaPath:v}=f,w=d.length,A=w===y.minItems&&(w===y.maxItems||y[s]===!1);if(b.strictTuples&&!A){let C=`"${p}" is ${w}-tuple, but minItems or maxItems/${s} are not specified or different at path "${v}"`;(0,n.checkStrictMode)(f,C,b.strictTuples)}}}e.validateTuple=o,e.default=r}),QB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GO(),n={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:i=>(0,t.validateTuple)(i,"items")};e.default=n}),YB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i=Rr(),r=UO(),o={message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:o,code(s){let{schema:d,parentSchema:l,it:u}=s,{prefixItems:c}=l;u.items=!0,!(0,n.alwaysValidSchema)(u,d)&&(c?(0,r.validateAdditionalItems)(s,c):s.ok((0,i.validateArray)(s)))}};e.default=a}),XB=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i={message:({params:{min:o,max:a}})=>a===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${a} valid item(s)`,params:({params:{min:o,max:a}})=>a===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${a}}`},r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:i,code(o){let{gen:a,schema:s,parentSchema:d,data:l,it:u}=o,c,p,{minContains:f,maxContains:h}=d;u.opts.next?(c=f===void 0?1:f,p=h):c=1;let g=a.const("len",t._`${l}.length`);if(o.setParams({min:c,max:p}),p===void 0&&c===0){(0,n.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&c>p){(0,n.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,n.alwaysValidSchema)(u,s)){let w=t._`${g} >= ${c}`;p!==void 0&&(w=t._`${w} && ${g} <= ${p}`),o.pass(w);return}u.items=!0;let _=a.name("valid");p===void 0&&c===1?b(_,()=>a.if(_,()=>a.break())):c===0?(a.let(_,!0),p!==void 0&&a.if(t._`${l}.length > 0`,y)):(a.let(_,!1),y()),o.result(_,()=>o.reset());function y(){let w=a.name("_valid"),A=a.let("count",0);b(w,()=>a.if(w,()=>v(A)))}function b(w,A){a.forRange("i",0,g,C=>{o.subschema({keyword:"contains",dataProp:C,dataPropType:n.Type.Num,compositeRule:!0},w),A()})}function v(w){a.code(t._`${w}++`),p===void 0?a.if(t._`${w} >= ${c}`,()=>a.assign(_,!0).break()):(a.if(t._`${w} > ${p}`,()=>a.assign(_,!1).break()),c===1?a.assign(_,!0):a.if(t._`${w} >= ${c}`,()=>a.assign(_,!0)))}}};e.default=r}),e4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=Pe(),n=Fe(),i=Rr();e.error={message:({params:{property:d,depsCount:l,deps:u}})=>{let c=l===1?"property":"properties";return t.str`must have ${c} ${u} when property ${d} is present`},params:({params:{property:d,depsCount:l,deps:u,missingProperty:c}})=>t._`{property: ${d},
189
- missingProperty: ${c},
190
- depsCount: ${l},
191
- deps: ${u}}`};var r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){let[l,u]=o(d);a(d,l),s(d,u)}};function o({schema:d}){let l={},u={};for(let c in d){if(c==="__proto__")continue;let p=Array.isArray(d[c])?l:u;p[c]=d[c]}return[l,u]}function a(d,l=d.schema){let{gen:u,data:c,it:p}=d;if(Object.keys(l).length===0)return;let f=u.let("missing");for(let h in l){let g=l[h];if(g.length===0)continue;let _=(0,i.propertyInData)(u,c,h,p.opts.ownProperties);d.setParams({property:h,depsCount:g.length,deps:g.join(", ")}),p.allErrors?u.if(_,()=>{for(let y of g)(0,i.checkReportMissingProp)(d,y)}):(u.if(t._`${_} && (${(0,i.checkMissingProp)(d,g,f)})`),(0,i.reportMissingProp)(d,f),u.else())}}e.validatePropertyDeps=a;function s(d,l=d.schema){let{gen:u,data:c,keyword:p,it:f}=d,h=u.name("valid");for(let g in l)(0,n.alwaysValidSchema)(f,l[g])||(u.if((0,i.propertyInData)(u,c,g,f.opts.ownProperties),()=>{let _=d.subschema({keyword:p,schemaProp:g},h);d.mergeValidEvaluated(_,h)},()=>u.var(h,!0)),d.ok(h))}e.validateSchemaDeps=s,e.default=r}),t4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i={message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i,code(o){let{gen:a,schema:s,data:d,it:l}=o;if((0,n.alwaysValidSchema)(l,s))return;let u=a.name("valid");a.forIn("key",d,c=>{o.setParams({propertyName:c}),o.subschema({keyword:"propertyNames",data:c,dataTypes:["string"],propertyName:c,compositeRule:!0},u),a.if((0,t.not)(u),()=>{o.error(!0),!l.allErrors&&a.break()})}),o.ok(u)}};e.default=r}),zO=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rr(),n=Pe(),i=to(),r=Fe(),o={message:"must NOT have additional properties",params:({params:s})=>n._`{additionalProperty: ${s.additionalProperty}}`},a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:o,code(s){let{gen:d,schema:l,parentSchema:u,data:c,errsCount:p,it:f}=s;if(!p)throw Error("ajv implementation error");let{allErrors:h,opts:g}=f;if(f.props=!0,g.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,l))return;let _=(0,t.allSchemaProperties)(u.properties),y=(0,t.allSchemaProperties)(u.patternProperties);b(),s.ok(n._`${p} === ${i.default.errors}`);function b(){d.forIn("key",c,S=>{!_.length&&!y.length?A(S):d.if(v(S),()=>A(S))})}function v(S){let k;if(_.length>8){let T=(0,r.schemaRefOrVal)(f,u.properties,"properties");k=(0,t.isOwnProperty)(d,T,S)}else _.length?k=(0,n.or)(..._.map(T=>n._`${S} === ${T}`)):k=n.nil;return y.length&&(k=(0,n.or)(k,...y.map(T=>n._`${(0,t.usePattern)(s,T)}.test(${S})`))),(0,n.not)(k)}function w(S){d.code(n._`delete ${c}[${S}]`)}function A(S){if(g.removeAdditional==="all"||g.removeAdditional&&l===!1){w(S);return}if(l===!1){s.setParams({additionalProperty:S}),s.error(),!h&&d.break();return}if(typeof l=="object"&&!(0,r.alwaysValidSchema)(f,l)){let k=d.name("valid");g.removeAdditional==="failing"?(C(S,k,!1),d.if((0,n.not)(k),()=>{s.reset(),w(S)})):(C(S,k),!h&&d.if((0,n.not)(k),()=>d.break()))}}function C(S,k,T){let E={keyword:"additionalProperties",dataProp:S,dataPropType:r.Type.Str};T===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(E,k)}}};e.default=a}),n4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tm(),n=Rr(),i=Fe(),r=zO(),o={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,parentSchema:l,data:u,it:c}=a;c.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(c,r.default,"additionalProperties"));let p=(0,n.allSchemaProperties)(d);for(let y of p)c.definedProperties.add(y);c.opts.unevaluated&&p.length&&c.props!==!0&&(c.props=i.mergeEvaluated.props(s,(0,i.toHash)(p),c.props));let f=p.filter(y=>!(0,i.alwaysValidSchema)(c,d[y]));if(f.length===0)return;let h=s.name("valid");for(let y of f)g(y)?_(y):(s.if((0,n.propertyInData)(s,u,y,c.opts.ownProperties)),_(y),!c.allErrors&&s.else().var(h,!0),s.endIf()),a.it.definedProperties.add(y),a.ok(h);function g(y){return c.opts.useDefaults&&!c.compositeRule&&d[y].default!==void 0}function _(y){a.subschema({keyword:"properties",schemaProp:y,dataProp:y},h)}}};e.default=o}),r4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rr(),n=Pe(),i=Fe(),r=Fe(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:d,data:l,parentSchema:u,it:c}=a,{opts:p}=c,f=(0,t.allSchemaProperties)(d),h=f.filter(A=>(0,i.alwaysValidSchema)(c,d[A]));if(f.length===0||h.length===f.length&&(!c.opts.unevaluated||c.props===!0))return;let g=p.strictSchema&&!p.allowMatchingProperties&&u.properties,_=s.name("valid");c.props!==!0&&!(c.props instanceof n.Name)&&(c.props=(0,r.evaluatedPropsToName)(s,c.props));let{props:y}=c;b();function b(){for(let A of f)g&&v(A),c.allErrors?w(A):(s.var(_,!0),w(A),s.if(_))}function v(A){for(let C in g)new RegExp(A).test(C)&&(0,i.checkStrictMode)(c,`property ${C} matches pattern ${A} (use allowMatchingProperties)`)}function w(A){s.forIn("key",l,C=>{s.if(n._`${(0,t.usePattern)(a,A)}.test(${C})`,()=>{let S=h.includes(A);S||a.subschema({keyword:"patternProperties",schemaProp:A,dataProp:C,dataPropType:r.Type.Str},_),c.opts.unevaluated&&y!==!0?s.assign(n._`${y}[${C}]`,!0):!S&&!c.allErrors&&s.if((0,n.not)(_),()=>s.break())})})}}};e.default=o}),i4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fe(),n={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(i){let{gen:r,schema:o,it:a}=i;if((0,t.alwaysValidSchema)(a,o)){i.fail();return}let s=r.name("valid");i.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),i.failResult(s,()=>i.reset(),()=>i.error())},error:{message:"must NOT be valid"}};e.default=n}),o4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rr(),n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:t.validateUnion,error:{message:"must match a schema in anyOf"}};e.default=n}),a4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i={message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:i,code(o){let{gen:a,schema:s,parentSchema:d,it:l}=o;if(!Array.isArray(s))throw Error("ajv implementation error");if(l.opts.discriminator&&d.discriminator)return;let u=s,c=a.let("valid",!1),p=a.let("passing",null),f=a.name("_valid");o.setParams({passing:p}),a.block(h),o.result(c,()=>o.reset(),()=>o.error(!0));function h(){u.forEach((g,_)=>{let y;(0,n.alwaysValidSchema)(l,g)?a.var(f,!0):y=o.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},f),_>0&&a.if(t._`${f} && ${c}`).assign(c,!1).assign(p,t._`[${p}, ${_}]`).else(),a.if(f,()=>{a.assign(c,!0),a.assign(p,_),y&&o.mergeEvaluated(y,t.Name)})})}}};e.default=r}),s4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fe(),n={keyword:"allOf",schemaType:"array",code(i){let{gen:r,schema:o,it:a}=i;if(!Array.isArray(o))throw Error("ajv implementation error");let s=r.name("valid");o.forEach((d,l)=>{if((0,t.alwaysValidSchema)(a,d))return;let u=i.subschema({keyword:"allOf",schemaProp:l},s);i.ok(s),i.mergeEvaluated(u)})}};e.default=n}),d4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=Fe(),i={message:({params:a})=>t.str`must match "${a.ifClause}" schema`,params:({params:a})=>t._`{failingKeyword: ${a.ifClause}}`},r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:i,code(a){let{gen:s,parentSchema:d,it:l}=a;d.then===void 0&&d.else===void 0&&(0,n.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let u=o(l,"then"),c=o(l,"else");if(!u&&!c)return;let p=s.let("valid",!0),f=s.name("_valid");if(h(),a.reset(),u&&c){let _=s.let("ifClause");a.setParams({ifClause:_}),s.if(f,g("then",_),g("else",_))}else u?s.if(f,g("then")):s.if((0,t.not)(f),g("else"));a.pass(p,()=>a.error(!0));function h(){let _=a.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);a.mergeEvaluated(_)}function g(_,y){return()=>{let b=a.subschema({keyword:_},f);s.assign(p,f),a.mergeValidEvaluated(b,p),y?s.assign(y,t._`${_}`):a.setParams({ifClause:_})}}}};function o(a,s){let d=a.schema[s];return d!==void 0&&!(0,n.alwaysValidSchema)(a,d)}e.default=r}),l4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fe(),n={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:i,parentSchema:r,it:o}){r.if===void 0&&(0,t.checkStrictMode)(o,`"${i}" without "if" is ignored`)}};e.default=n}),u4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UO(),n=QB(),i=GO(),r=YB(),o=XB(),a=e4(),s=t4(),d=zO(),l=n4(),u=r4(),c=i4(),p=o4(),f=a4(),h=s4(),g=d4(),_=l4();function y(b=!1){let v=[c.default,p.default,f.default,h.default,g.default,_.default,s.default,d.default,a.default,l.default,u.default];return b?v.push(n.default,r.default):v.push(t.default,i.default),v.push(o.default),v}e.default=y}),c4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n={message:({schemaCode:r})=>t.str`must match format "${r}"`,params:({schemaCode:r})=>t._`{format: ${r}}`},i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:n,code(r,o){let{gen:a,data:s,$data:d,schema:l,schemaCode:u,it:c}=r,{opts:p,errSchemaPath:f,schemaEnv:h,self:g}=c;if(!p.validateFormats)return;d?_():y();function _(){let b=a.scopeValue("formats",{ref:g.formats,code:p.code.formats}),v=a.const("fDef",t._`${b}[${u}]`),w=a.let("fType"),A=a.let("format");a.if(t._`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>a.assign(w,t._`${v}.type || "string"`).assign(A,t._`${v}.validate`),()=>a.assign(w,t._`"string"`).assign(A,v)),r.fail$data((0,t.or)(C(),S()));function C(){return p.strictSchema===!1?t.nil:t._`${u} && !${A}`}function S(){let k=h.$async?t._`(${v}.async ? await ${A}(${s}) : ${A}(${s}))`:t._`${A}(${s})`,T=t._`(typeof ${A} == "function" ? ${k} : ${A}.test(${s}))`;return t._`${A} && ${A} !== true && ${w} === ${o} && !${T}`}}function y(){let b=g.formats[l];if(!b){C();return}if(b===!0)return;let[v,w,A]=S(b);v===o&&r.pass(k());function C(){if(p.strictSchema===!1){g.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function S(T){let E=T instanceof RegExp?(0,t.regexpCode)(T):p.code.formats?t._`${p.code.formats}${(0,t.getProperty)(l)}`:void 0,P=a.scopeValue("formats",{key:l,ref:T,code:E});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,t._`${P}.validate`]:["string",T,P]}function k(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!h.$async)throw Error("async format in sync schema");return t._`await ${A}(${s})`}return typeof w=="function"?t._`${A}(${s})`:t._`${A}.test(${s})`}}}};e.default=i}),f4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=c4(),n=[t.default];e.default=n}),p4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),m4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=FB(),n=ZB(),i=u4(),r=f4(),o=p4(),a=[t.default,n.default,(0,i.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];e.default=a}),h4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(n){n.Tag="tag",n.Mapping="mapping"})(t||(e.DiscrError=t={}))}),g4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Pe(),n=h4(),i=Ub(),r=nm(),o=Fe(),a={message:({params:{discrError:d,tagName:l}})=>d===n.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:d,tag:l,tagName:u}})=>t._`{error: ${d}, tag: ${u}, tagValue: ${l}}`},s={keyword:"discriminator",type:"object",schemaType:"object",error:a,code(d){let{gen:l,data:u,schema:c,parentSchema:p,it:f}=d,{oneOf:h}=p;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let g=c.propertyName;if(typeof g!="string")throw Error("discriminator: requires propertyName");if(c.mapping)throw Error("discriminator: mapping is not supported");if(!h)throw Error("discriminator: requires oneOf keyword");let _=l.let("valid",!1),y=l.const("tag",t._`${u}${(0,t.getProperty)(g)}`);l.if(t._`typeof ${y} == "string"`,()=>b(),()=>d.error(!1,{discrError:n.DiscrError.Tag,tag:y,tagName:g})),d.ok(_);function b(){let A=w();l.if(!1);for(let C in A)l.elseIf(t._`${y} === ${C}`),l.assign(_,v(A[C]));l.else(),d.error(!1,{discrError:n.DiscrError.Mapping,tag:y,tagName:g}),l.endIf()}function v(A){let C=l.name("valid"),S=d.subschema({keyword:"oneOf",schemaProp:A},C);return d.mergeEvaluated(S,t.Name),C}function w(){var A;let C={},S=T(p),k=!0;for(let R=0;R<h.length;R++){let O=h[R];if(O?.$ref&&!(0,o.schemaHasRulesButRef)(O,f.self.RULES)){let J=O.$ref;if(O=i.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,J),O instanceof i.SchemaEnv&&(O=O.schema),O===void 0)throw new r.default(f.opts.uriResolver,f.baseId,J)}let M=(A=O?.properties)===null||A===void 0?void 0:A[g];if(typeof M!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);k=k&&(S||T(O)),E(M,R)}if(!k)throw Error(`discriminator: "${g}" must be required`);return C;function T({required:R}){return Array.isArray(R)&&R.includes(g)}function E(R,O){if(R.const)P(R.const,O);else if(R.enum)for(let M of R.enum)P(M,O);else throw Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}function P(R,O){if(typeof R!="string"||R in C)throw Error(`discriminator: "${g}" values must be unique strings`);C[R]=O}}}};e.default=s}),y4=V((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),JO=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=jB(),i=m4(),r=g4(),o=y4(),a=["/properties"],s="http://json-schema.org/draft-07/schema";class d extends n.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let h=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(h,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}e.Ajv=d,t.exports=e=d,t.exports.Ajv=d,Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var l=tm();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Pe();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var c=Lb();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return c.default}});var p=nm();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),_4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(P,R){return{validate:P,compare:R}}e.fullFormats={date:t(o,a),time:t(d(!0),l),"date-time":t(p(!0),f),"iso-time":t(d(),u),"iso-date-time":t(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:"number",validate:C},int64:{type:"number",validate:S},float:{type:"number",validate:k},double:{type:"number",validate:k},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(P){return P%4===0&&(P%100!==0||P%400===0)}var i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(P){let R=i.exec(P);if(!R)return!1;let O=+R[1],M=+R[2],J=+R[3];return M>=1&&M<=12&&J>=1&&J<=(M===2&&n(O)?29:r[M])}function a(P,R){if(P&&R)return P>R?1:P<R?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function d(P){return function(R){let O=s.exec(R);if(!O)return!1;let M=+O[1],J=+O[2],Z=+O[3],z=O[4],X=O[5]==="-"?-1:1,ee=+(O[6]||0),B=+(O[7]||0);if(ee>23||B>59||P&&!z)return!1;if(M<=23&&J<=59&&Z<60)return!0;let $=J-B*X,K=M-ee*X-($<0?1:0);return(K===23||K===-1)&&($===59||$===-1)&&Z<61}}function l(P,R){if(!(P&&R))return;let O=new Date("2020-01-01T"+P).valueOf(),M=new Date("2020-01-01T"+R).valueOf();if(O&&M)return O-M}function u(P,R){if(!(P&&R))return;let O=s.exec(P),M=s.exec(R);if(O&&M)return P=O[1]+O[2]+O[3],R=M[1]+M[2]+M[3],P>R?1:P<R?-1:0}var c=/t|\s/i;function p(P){let R=d(P);return function(O){let M=O.split(c);return M.length===2&&o(M[0])&&R(M[1])}}function f(P,R){if(!(P&&R))return;let O=new Date(P).valueOf(),M=new Date(R).valueOf();if(O&&M)return O-M}function h(P,R){if(!(P&&R))return;let[O,M]=P.split(c),[J,Z]=R.split(c),z=a(O,J);if(z!==void 0)return z||l(M,Z)}var g=/\/|:/,_=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function y(P){return g.test(P)&&_.test(P)}var b=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(P){return b.lastIndex=0,b.test(P)}var w=-2147483648,A=2147483647;function C(P){return Number.isInteger(P)&&P<=A&&P>=w}function S(P){return Number.isInteger(P)}function k(){return!0}var T=/[^\\]\\Z/;function E(P){if(T.test(P))return!1;try{return new RegExp(P),!0}catch{return!1}}}),b4=V(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=JO(),n=Pe(),i=n.operators,r={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:s,schemaCode:d})=>n.str`should be ${r[s].okStr} ${d}`,params:({keyword:s,schemaCode:d})=>n._`{comparison: ${r[s].okStr}, limit: ${d}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:o,code(s){let{gen:d,data:l,schemaCode:u,keyword:c,it:p}=s,{opts:f,self:h}=p;if(!f.validateFormats)return;let g=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");g.$data?_():y();function _(){let v=d.scopeValue("formats",{ref:h.formats,code:f.code.formats}),w=d.const("fmt",n._`${v}[${g.schemaCode}]`);s.fail$data((0,n.or)(n._`typeof ${w} != "object"`,n._`${w} instanceof RegExp`,n._`typeof ${w}.compare != "function"`,b(w)))}function y(){let v=g.schema,w=h.formats[v];if(!w||w===!0)return;if(typeof w!="object"||w instanceof RegExp||typeof w.compare!="function")throw Error(`"${c}": format "${v}" does not define "compare" function`);let A=d.scopeValue("formats",{key:v,ref:w,code:f.code.formats?n._`${f.code.formats}${(0,n.getProperty)(v)}`:void 0});s.fail$data(b(A))}function b(v){return n._`${v}.compare(${l}, ${u}) ${r[c].fail} 0`}},dependencies:["format"]};var a=s=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a}),v4=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=_4(),i=b4(),r=Pe(),o=new r.Name("fullFormats"),a=new r.Name("fastFormats"),s=(l,u={keywords:!0})=>{if(Array.isArray(u))return d(l,u,n.fullFormats,o),l;let[c,p]=u.mode==="fast"?[n.fastFormats,a]:[n.fullFormats,o],f=u.formats||n.formatNames;return d(l,f,c,p),u.keywords&&(0,i.default)(l),l};s.get=(l,u="full")=>{let c=(u==="fast"?n.fastFormats:n.fullFormats)[l];if(!c)throw Error(`Unknown format "${l}"`);return c};function d(l,u,c,p){var f,h;(f=(h=l.opts.code).formats)!==null&&f!==void 0||(h.formats=r._`require("ajv-formats/dist/formats").${p}`);for(let g of u)l.addFormat(g,c[g])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),R4=50;cCe=new FinalizationRegistry(({parentSignalRef:e,handler:t})=>{e.deref()?.removeEventListener("abort",t)});im=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","MessageDisplay"],L4=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],U4="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__",G4=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,z4=/<command-name>(.*?)<\/command-name>/;J4={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};h_=class{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString(t){let n=[t.projectKey,t.sessionId];return t.subpath&&n.push(t.subpath),n.join("/")}async append(t,n){let i=this.keyToString(t),r=this.store.get(i)??[];r.push(...n),this.store.set(i,r);let o=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=o,this.mtimes.set(i,o),t.subpath===void 0){let a=`${t.projectKey}/${t.sessionId}`,s=ZO(this.summaries.get(a),t,n,{mtime:o});this.summaries.set(a,s)}}async load(t){let n=this.keyToString(t);return this.store.get(n)??null}async listSessions(t){let n=[],i=t+"/";for(let[r]of this.store)if(r.startsWith(i)){let o=r.slice(i.length);o.includes("/")||n.push({sessionId:o,mtime:this.mtimes.get(r)??0})}return n}async listSessionSummaries(t){let n=[],i=t+"/";for(let[r,o]of this.summaries)r.startsWith(i)&&n.push(o);return n}async delete(t){let n=this.keyToString(t);if(this.store.delete(n),this.mtimes.delete(n),t.subpath===void 0){this.summaries.delete(`${t.projectKey}/${t.sessionId}`);let i=`${t.projectKey}/${t.sessionId}/`;for(let r of this.store.keys())r.startsWith(i)&&(this.store.delete(r),this.mtimes.delete(r))}}async listSubkeys(t){let n=`${t.projectKey}/${t.sessionId}/`,i=[];for(let r of this.store.keys())r.startsWith(n)&&i.push(r.slice(n.length));return i}getEntries(t){return this.store.get(this.keyToString(t))??[]}get size(){let t=0;for(let n of this.store.keys()){let i=n.indexOf("/");i!==-1&&!n.slice(i+1).includes("/")&&t++}return t}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}},En=class extends Error{};qE=globalThis.process?.getBuiltinModule?.("async_hooks"),V4=qE?e=>qE.AsyncResource.bind(e):e=>e;Z4=typeof global=="object"&&global&&global.Object===Object&&global,YO=Z4,Q4=typeof self=="object"&&self&&self.Object===Object&&self,Y4=YO||Q4||Function("return this")(),ti=Y4,X4=ti.Symbol,Zr=X4,XO=Object.prototype,eW=XO.hasOwnProperty,tW=XO.toString,Bd=Zr?Zr.toStringTag:void 0;rW=nW,iW=Object.prototype,oW=iW.toString;sW=aW,dW="[object Null]",lW="[object Undefined]",NE=Zr?Zr.toStringTag:void 0;Ho=uW;Qr=cW,fW="[object AsyncFunction]",pW="[object Function]",mW="[object GeneratorFunction]",hW="[object Proxy]";Bb=gW,yW=ti["__core-js_shared__"],Ry=yW,FE=(function(){var e=/[^.]+$/.exec(Ry&&Ry.keys&&Ry.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();bW=_W,vW=Function.prototype,SW=vW.toString;Vo=wW,kW=/[\\^$.*+?()[\]{}|]/g,xW=/^\[object .+?Constructor\]$/,TW=Function.prototype,CW=Object.prototype,AW=TW.toString,EW=CW.hasOwnProperty,PW=RegExp("^"+AW.call(EW).replace(kW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");OW=IW;$W=RW;Zo=MW,jW=Zo(Object,"create"),Ol=jW;NW=qW;DW=FW,LW="__lodash_hash_undefined__",UW=Object.prototype,GW=UW.hasOwnProperty;JW=zW,KW=Object.prototype,BW=KW.hasOwnProperty;HW=WW,VW="__lodash_hash_undefined__";QW=ZW;js.prototype.clear=NW;js.prototype.delete=DW;js.prototype.get=JW;js.prototype.has=HW;js.prototype.set=QW;DE=js;XW=YW;uu=e6;om=t6,n6=Array.prototype,r6=n6.splice;o6=i6;s6=a6;l6=d6;c6=u6;qs.prototype.clear=XW;qs.prototype.delete=o6;qs.prototype.get=s6;qs.prototype.has=l6;qs.prototype.set=c6;am=qs,f6=Zo(ti,"Map"),Rl=f6;m6=p6;g6=h6;sm=y6;b6=_6;S6=v6;k6=w6;T6=x6;Ns.prototype.clear=m6;Ns.prototype.delete=b6;Ns.prototype.get=S6;Ns.prototype.has=k6;Ns.prototype.set=T6;dm=Ns,C6="Expected a function";Wb.Cache=dm;rn=Wb,Fs=rn(()=>(process.env.CLAUDE_CONFIG_DIR??E6(A6(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR),bCe=rn(()=>cn(process.env.CLAUDE_CODE_SUPERVISED));eR=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return eR=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^n()&15>>+i/4).toString(16))};g_=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},ve=class extends Error{},bn=class e extends ve{constructor(t,n,i,r,o){super(`${e.makeMessage(t,n,i)}`),this.status=t,this.headers=r,this.requestID=r?.get("request-id"),this.error=n,this.type=o??null}static makeMessage(t,n,i){let r=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,n,i,r){if(!t||!r)return new fs({message:i,cause:g_(n)});let o=n,a=o?.error?.type;return t===400?new Mf(t,o,i,r,a):t===401?new jf(t,o,i,r,a):t===403?new qf(t,o,i,r,a):t===404?new Nf(t,o,i,r,a):t===409?new Ff(t,o,i,r,a):t===422?new Df(t,o,i,r,a):t===429?new Lf(t,o,i,r,a):t>=500?new Uf(t,o,i,r,a):new e(t,o,i,r,a)}},Jn=class extends bn{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}},fs=class extends bn{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}},$f=class extends fs{constructor({message:t}={}){super({message:t??"Request timed out."})}},Mf=class extends bn{},jf=class extends bn{},qf=class extends bn{},Nf=class extends bn{},Ff=class extends bn{},Df=class extends bn{},Lf=class extends bn{},Uf=class extends bn{},P6=/^[a-z][a-z0-9+.-]*:/i,I6=e=>P6.test(e),y_=e=>(y_=Array.isArray,y_(e)),LE=y_;R6=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new ve(`${e} must be an integer`);if(t<0)throw new ve(`${e} must be a positive integer`);return t},tR=e=>{try{return JSON.parse(e)}catch{return}},$6=e=>new Promise(t=>setTimeout(t,e)),Bi="0.94.0",M6=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";q6=()=>{let e=j6();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Bi,"X-Stainless-OS":zE(Deno.build.os),"X-Stainless-Arch":GE(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Bi,"X-Stainless-OS":zE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":GE(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=N6();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Bi,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};GE=e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown",zE=e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),Hb=()=>JE??(JE=q6());L6=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});G6="urn:ietf:params:oauth:grant-type:jwt-bearer",z6="refresh_token",iR="/v1/oauth/token",Gf="oauth-2025-04-20",J6="oidc-federation-2026-04-01",K6=120,Zb=30,B6=5,KE=1048576;$y=2e3,W6=new Set(["error","error_description","error_uri"]);Qe=class extends ve{constructor(t,n=null,i=null,r=null){super(t),this.statusCode=n,this.body=i,this.requestId=r}};b_=class{constructor(t,n){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=t,this.onAdvisoryRefreshError=n}async getToken(){let t=this.nextForce;this.nextForce=!1;let n=this.cached;if(t||n==null)return(await this.refresh(t)).token;if(n.expiresAt==null)return n.token;let i=n.expiresAt-No();return i>K6?n.token:i>Zb?(this.backgroundRefresh(),n.token):(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(t=!1){return this.pendingRefresh&&!t?this.pendingRefresh:this.doRefresh(t)}backgroundRefresh(){this.pendingRefresh||No()-this.lastAdvisoryError<B6||this.doRefresh().catch(t=>{this.lastAdvisoryError=No(),this.onAdvisoryRefreshError?.(t)})}doRefresh(t=!1){return this.pendingRefresh=this.provider(t?{forceRefresh:!0}:void 0).then(n=>(this.cached=n,this.pendingRefresh=null,n),n=>{throw this.pendingRefresh=null,n}),this.pendingRefresh}},Ze=e=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0};zf={off:0,error:200,warn:300,info:400,debug:500},VE=(e,t,n)=>{if(e){if(O6(zf,e))return e;Vt(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(zf))}`)}};Z6={error:ml,warn:ml,info:ml,debug:ml},ZE=new WeakMap;$o=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),lR="1.0",Q6=/^[A-Za-z0-9_.-]+$/;Y6=async e=>{var t,n;let i=await Yb();if(i===null)return null;let r=e??await cR();if(r===null)return null;uR(r);let o=await import("node:fs"),a=(await import("node:path")).join(i,"configs",`${r}.json`),s;try{s=await o.promises.readFile(a,"utf-8")}catch(u){if(u?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${u}`);s=null}if(s===null){let u=Ze("ANTHROPIC_ORGANIZATION_ID"),c=Ze("ANTHROPIC_IDENTITY_TOKEN_FILE"),p=Ze("ANTHROPIC_FEDERATION_RULE_ID");return p&&u?{fromFile:!1,config:{organization_id:u,workspace_id:Ze("ANTHROPIC_WORKSPACE_ID"),base_url:Ze("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:p,service_account_id:Ze("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:c?{source:"file",path:c}:void 0,scope:Ze("ANTHROPIC_SCOPE")}}}:null}let d;try{d=JSON.parse(s)}catch(u){throw Error(`failed to parse config file ${a}: ${u}`)}if(!d.authentication)throw Error(`config file ${a} is missing "authentication"`);let l=d.authentication.type;if(l!=="oidc_federation"&&l!=="user_oauth")throw Error(`authentication.type "${l}" is not a known authentication type`);if(d.organization_id??(d.organization_id=Ze("ANTHROPIC_ORGANIZATION_ID")),d.workspace_id??(d.workspace_id=Ze("ANTHROPIC_WORKSPACE_ID")),d.base_url??(d.base_url=Ze("ANTHROPIC_BASE_URL")),(t=d.authentication).scope??(t.scope=Ze("ANTHROPIC_SCOPE")),d.authentication.type==="oidc_federation"){if(!d.authentication.identity_token){let u=Ze("ANTHROPIC_IDENTITY_TOKEN_FILE");u&&(d.authentication.identity_token={source:"file",path:u})}d.authentication.federation_rule_id||(d.authentication.federation_rule_id=Ze("ANTHROPIC_FEDERATION_RULE_ID")??""),(n=d.authentication).service_account_id??(n.service_account_id=Ze("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:d,fromFile:!0}},X6=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await Yb();if(!n)return null;let i=t??await cR();return i?(uR(i),(await import("node:path")).join(n,"credentials",`${i}.json`)):null},Yb=async()=>{if(!eH())return null;let e=await import("node:path"),t=Ze("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Hb()["X-Stainless-OS"]==="Windows"){let r=Ze("APPDATA");if(r)return e.join(r,"Anthropic");let o=Ze("USERPROFILE");return o?e.join(o,"AppData","Roaming","Anthropic"):null}let n=Ze("XDG_CONFIG_HOME");if(n)return e.join(n,"anthropic");let i=Ze("HOME");return i?e.join(i,".config","anthropic"):null},eH=()=>{let e=Hb()["X-Stainless-Runtime"];return e==="node"||e==="deno"},cR=async()=>{let e=await Yb();if(!e)return null;let t=Ze("ANTHROPIC_PROFILE");if(t)return t;let n=await import("node:fs"),i=(await import("node:path")).join(e,"active_config");try{return(await n.promises.readFile(i,"utf-8")).trim()||"default"}catch(r){if(r?.code!=="ENOENT")throw Error(`failed to read ${i}: ${r}`);return"default"}};Lo=class{constructor(){Dn.set(this,void 0),Ln.set(this,void 0),ue(this,Dn,new Uint8Array,"f"),ue(this,Ln,null,"f")}decode(t){if(t==null)return[];let n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?Qb(t):t;ue(this,Dn,V6([U(this,Dn,"f"),n]),"f");let i=[],r;for(;(r=dH(U(this,Dn,"f"),U(this,Ln,"f")))!=null;){if(r.carriage&&U(this,Ln,"f")==null){ue(this,Ln,r.index,"f");continue}if(U(this,Ln,"f")!=null&&(r.index!==U(this,Ln,"f")+1||r.carriage)){i.push(HE(U(this,Dn,"f").subarray(0,U(this,Ln,"f")-1))),ue(this,Dn,U(this,Dn,"f").subarray(U(this,Ln,"f")),"f"),ue(this,Ln,null,"f");continue}let o=U(this,Ln,"f")!==null?r.preceding-1:r.preceding,a=HE(U(this,Dn,"f").subarray(0,o));i.push(a),ue(this,Dn,U(this,Dn,"f").subarray(r.index),"f"),ue(this,Ln,null,"f")}return i}flush(){return U(this,Dn,"f").length?this.decode(`
192
- `):[]}};Dn=new WeakMap,Ln=new WeakMap;Lo.NEWLINE_CHARS=new Set([`
193
- `,"\r"]);Lo.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Uo=class e{constructor(t,n,i){this.iterator=t,Wd.set(this,void 0),this.controller=n,ue(this,Wd,i,"f")}static fromSSEResponse(t,n,i){let r=!1,o=i?Vt(i):console;async function*a(){if(r)throw new ve("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let s=!1;try{for await(let d of uH(t,n)){if(d.event==="completion")try{yield JSON.parse(d.data)}catch(l){throw o.error("Could not parse message into JSON:",d.data),o.error("From chunk:",d.raw),l}if(d.event==="message_start"||d.event==="message_delta"||d.event==="message_stop"||d.event==="content_block_start"||d.event==="content_block_delta"||d.event==="content_block_stop"||d.event==="message"||d.event==="user.message"||d.event==="user.interrupt"||d.event==="user.tool_confirmation"||d.event==="user.custom_tool_result"||d.event==="agent.message"||d.event==="agent.thinking"||d.event==="agent.tool_use"||d.event==="agent.tool_result"||d.event==="agent.mcp_tool_use"||d.event==="agent.mcp_tool_result"||d.event==="agent.custom_tool_use"||d.event==="agent.thread_context_compacted"||d.event==="session.status_running"||d.event==="session.status_idle"||d.event==="session.status_rescheduled"||d.event==="session.status_terminated"||d.event==="session.error"||d.event==="session.deleted"||d.event==="span.model_request_start"||d.event==="span.model_request_end")try{yield JSON.parse(d.data)}catch(l){throw o.error("Could not parse message into JSON:",d.data),o.error("From chunk:",d.raw),l}if(d.event!=="ping"&&d.event==="error"){let l=tR(d.data)??d.data,u=l?.error?.type;throw new bn(void 0,l,void 0,t.headers,u)}}s=!0}catch(d){if($l(d))return;throw d}finally{s||n.abort()}}return new e(a,n,i)}static fromReadableStream(t,n,i){let r=!1;async function*o(){let s=new Lo,d=Vb(t);for await(let l of d)for(let u of s.decode(l))yield u;for(let l of s.flush())yield l}async function*a(){if(r)throw new ve("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let s=!1;try{for await(let d of o())s||d&&(yield JSON.parse(d));s=!0}catch(d){if($l(d))return;throw d}finally{s||n.abort()}}return new e(a,n,i)}[(Wd=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],i=this.iterator(),r=o=>({next:()=>{if(o.length===0){let a=i.next();t.push(a),n.push(a)}return o.shift()}});return[new e(()=>r(t),this.controller,U(this,Wd,"f")),new e(()=>r(n),this.controller,U(this,Wd,"f"))]}toReadableStream(){let t=this,n;return nR({async start(){n=t[Symbol.asyncIterator]()},async pull(i){try{let{value:r,done:o}=await n.next();if(o)return i.close();let a=Qb(JSON.stringify(r)+`
194
- `);i.enqueue(a)}catch(r){i.error(r)}},async cancel(){await n.return?.()}})}};v_=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
195
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(t),t.startsWith(":"))return null;let[n,i,r]=fH(t,":");return r.startsWith(" ")&&(r=r.substring(1)),n==="event"?this.event=r:n==="data"&&this.data.push(r),null}};Jf=class e extends Promise{constructor(t,n,i=pR){super(r=>{r(null)}),this.responsePromise=n,this.parseResponse=i,hl.set(this,void 0),ue(this,hl,t,"f")}_thenUnwrap(t){return new e(U(this,hl,"f"),this.responsePromise,async(n,i)=>mR(t(await this.parseResponse(n,i),i),i.response))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){let[t,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:n,request_id:n.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(U(this,hl,"f"),t))),this.parsedPromise}then(t,n){return this.parse().then(t,n)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}};hl=new WeakMap;Kf=class{constructor(t,n,i,r){nf.set(this,void 0),ue(this,nf,t,"f"),this.options=r,this.response=n,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let t=this.nextPageRequestOptions();if(!t)throw new ve("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await U(this,nf,"f").requestAPIList(this.constructor,t)}async*iterPages(){let t=this;for(yield t;t.hasNextPage();)t=await t.getNextPage(),yield t}async*[(nf=new WeakMap,Symbol.asyncIterator)](){for await(let t of this.iterPages())for(let n of t.getPaginatedItems())yield n}},S_=class extends Jf{constructor(t,n,i){super(t,n,async(r,o)=>new i(r,o.response,await pR(r,o),o.options))}async*[Symbol.asyncIterator](){let t=await this;for await(let n of t)yield n}},Go=class extends Kf{constructor(t,n,i,r){super(t,n,i,r),this.data=i.data||[],this.has_more=i.has_more||!1,this.first_id=i.first_id||null,this.last_id=i.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let n=this.first_id;return n?{...this.options,query:{...__(this.options.query),before_id:n}}:null}let t=this.last_id;return t?{...this.options,query:{...__(this.options.query),after_id:t}}:null}},fn=class extends Kf{constructor(t,n,i,r){super(t,n,i,r),this.data=i.data||[],this.next_page=i.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let t=this.next_page;return t?{...this.options,query:{...__(this.options.query),page:t}}:null}},hR=()=>{if(typeof File>"u"){let{process:e}=globalThis,t=typeof e?.versions?.node=="string"&&parseInt(e.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};gR=e=>e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function",Xb=async(e,t,n=!0)=>({...e,body:await mH(e.body,t,n)}),YE=new WeakMap;mH=async(e,t,n=!0)=>{if(!await pH(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let i=new FormData;return await Promise.all(Object.entries(e||{}).map(([r,o])=>w_(i,r,o,n))),i},hH=e=>e instanceof Blob&&"name"in e,w_=async(e,t,n,i)=>{if(n!==void 0){if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")e.append(t,String(n));else if(n instanceof Response){let r={},o=n.headers.get("Content-Type");o&&(r={type:o}),e.append(t,os([await n.blob()],Tf(n,i),r))}else if(gR(n))e.append(t,os([await new Response(rR(n)).blob()],Tf(n,i)));else if(hH(n))e.append(t,os([n],Tf(n,i),{type:n.type}));else if(Array.isArray(n))await Promise.all(n.map(r=>w_(e,t+"[]",r,i)));else if(typeof n=="object")await Promise.all(Object.entries(n).map(([r,o])=>w_(e,`${t}[${r}]`,o,i)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}},yR=e=>e!=null&&typeof e=="object"&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.text=="function"&&typeof e.slice=="function"&&typeof e.arrayBuffer=="function",gH=e=>e!=null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.lastModified=="number"&&yR(e),yH=e=>e!=null&&typeof e=="object"&&typeof e.url=="string"&&typeof e.blob=="function";dt=class{constructor(t){this._client=t}},_R=Symbol.for("brand.privateNullableHeaders");ne=e=>{let t=new Headers,n=new Set;for(let i of e){let r=new Set;for(let[o,a]of vH(i)){let s=o.toLowerCase();r.has(s)||(t.delete(o),r.add(s)),a===null?(t.delete(o),n.add(s)):(t.append(o,a),n.delete(s))}}return{[_R]:!0,values:t,nulls:n}};XE=Object.freeze(Object.create(null)),SH=(e=bR)=>function(t,...n){if(t.length===1)return t[0];let i=!1,r=[],o=t.reduce((l,u,c)=>{/[?#]/.test(u)&&(i=!0);let p=n[c],f=(i?encodeURIComponent:e)(""+p);return c!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??XE)??XE)?.toString)&&(f=p+"",r.push({start:l.length+u.length,length:f.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+u+(c===n.length?"":f)},""),a=o.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,d;for(;(d=s.exec(a))!==null;)r.push({start:d.index,length:d[0].length,error:`Value "${d[0]}" can't be safely passed as a path parameter`});if(r.sort((l,u)=>l.start-u.start),r.length>0){let l=0,u=r.reduce((c,p)=>{let f=" ".repeat(p.start-l),h="^".repeat(p.length);return l=p.start+p.length,c+f+h},"");throw new ve(`Path parameters result in path with invalid segments:
196
- ${r.map(c=>c.error).join(`
197
- `)}
198
- ${o}
199
- ${u}`)}return o},he=SH(bR),Bf=class extends dt{create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/environments?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/environments/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/environments/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/environments?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/environments/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}archive(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/environments/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},xl=Symbol("anthropic.sdk.stainlessHelper");Wf=class extends dt{list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/files?beta=true",Go,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/files/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},i?.headers])})}download(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/files/${t}/content?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},i?.headers]),__binaryResponse:!0})}retrieveMetadata(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/files/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},i?.headers])})}upload(t,n){let{betas:i,...r}=t;return this._client.post("/v1/files?beta=true",Xb({body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},wH(r.file),n?.headers])},this._client))}},Hf=class extends dt{retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/models/${t}?beta=true`,{...i,headers:ne([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/models?beta=true",Go,{query:r,...n,headers:ne([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}},Vf=class extends dt{create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/user_profiles?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/user_profiles/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/user_profiles/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/user_profiles?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}createEnrollmentURL(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/user_profiles/${t}/enrollment_url?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},i?.headers])})}},Zf=class extends dt{list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/agents/${t}/versions?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},Ml=class extends dt{constructor(){super(...arguments),this.versions=new Zf(this._client)}create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/agents?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r,...o}=n??{};return this._client.get(he`/v1/agents/${t}?beta=true`,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/agents/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/agents?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/agents/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}};Ml.Versions=Zf;Qf=class extends dt{create(t,n,i){let{view:r,betas:o,...a}=n;return this._client.post(he`/v1/memory_stores/${t}/memories?beta=true`,{query:{view:r},body:a,...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}retrieve(t,n,i){let{memory_store_id:r,betas:o,...a}=n;return this._client.get(he`/v1/memory_stores/${r}/memories/${t}?beta=true`,{query:a,...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{memory_store_id:r,view:o,betas:a,...s}=n;return this._client.post(he`/v1/memory_stores/${r}/memories/${t}?beta=true`,{query:{view:o},body:s,...i,headers:ne([{"anthropic-beta":[...a??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/memory_stores/${t}/memories?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}delete(t,n,i){let{memory_store_id:r,expected_content_sha256:o,betas:a}=n;return this._client.delete(he`/v1/memory_stores/${r}/memories/${t}?beta=true`,{query:{expected_content_sha256:o},...i,headers:ne([{"anthropic-beta":[...a??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},Yf=class extends dt{retrieve(t,n,i){let{memory_store_id:r,betas:o,...a}=n;return this._client.get(he`/v1/memory_stores/${r}/memory_versions/${t}?beta=true`,{query:a,...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/memory_stores/${t}/memory_versions?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}redact(t,n,i){let{memory_store_id:r,betas:o}=n;return this._client.post(he`/v1/memory_stores/${r}/memory_versions/${t}/redact?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},ps=class extends dt{constructor(){super(...arguments),this.memories=new Qf(this._client),this.memoryVersions=new Yf(this._client)}create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/memory_stores?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/memory_stores/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/memory_stores/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/memory_stores?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/memory_stores/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}archive(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/memory_stores/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}};ps.Memories=Qf;ps.MemoryVersions=Yf;Xf=class e{constructor(t,n){this.iterator=t,this.controller=n}async*decoder(){let t=new Lo;for await(let n of this.iterator)for(let i of t.decode(n))yield JSON.parse(i);for(let n of t.flush())yield JSON.parse(n)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(t,n){if(!t.body)throw n.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ve("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ve("Attempted to iterate over a response with no body");return new e(Vb(t.body),n)}},ep=class extends dt{create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/messages/batches?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/messages/batches/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Go,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/messages/batches/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},i?.headers])})}cancel(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/messages/batches/${t}/cancel?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},i?.headers])})}async results(t,n={},i){let r=await this.retrieve(t);if(!r.results_url)throw new ve(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:o}=n??{};return this._client.get(r.results_url,{...i,headers:ne([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},i?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,s)=>Xf.fromResponse(s.response,s.controller))}},wR={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};xH=e=>{let t=0,n=[];for(;t<e.length;){let i=e[t];if(i==="\\"){t++;continue}if(i==="{"){n.push({type:"brace",value:"{"}),t++;continue}if(i==="}"){n.push({type:"brace",value:"}"}),t++;continue}if(i==="["){n.push({type:"paren",value:"["}),t++;continue}if(i==="]"){n.push({type:"paren",value:"]"}),t++;continue}if(i===":"){n.push({type:"separator",value:":"}),t++;continue}if(i===","){n.push({type:"delimiter",value:","}),t++;continue}if(i==='"'){let a="",s=!1;for(i=e[++t];i!=='"';){if(t===e.length){s=!0;break}if(i==="\\"){if(t++,t===e.length){s=!0;break}a+=i+e[t],i=e[++t]}else a+=i,i=e[++t]}i=e[++t],!s&&n.push({type:"string",value:a});continue}if(i&&/\s/.test(i)){t++;continue}let r=/[0-9]/;if(i&&r.test(i)||i==="-"||i==="."){let a="";for(i==="-"&&(a+=i,i=e[++t]);i&&r.test(i)||i===".";)a+=i,i=e[++t];n.push({type:"number",value:a});continue}let o=/[a-z]/i;if(i&&o.test(i)){let a="";for(;i&&o.test(i)&&t!==e.length;)a+=i,i=e[++t];if(a=="true"||a=="false"||a==="null")n.push({type:"name",value:a});else{t++;continue}continue}t++}return n},Ya=e=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case"separator":return e=e.slice(0,e.length-1),Ya(e);case"number":let n=t.value[t.value.length-1];if(n==="."||n==="-")return e=e.slice(0,e.length-1),Ya(e);case"string":let i=e[e.length-2];if(i?.type==="delimiter")return e=e.slice(0,e.length-1),Ya(e);if(i?.type==="brace"&&i.value==="{")return e=e.slice(0,e.length-1),Ya(e);break;case"delimiter":return e=e.slice(0,e.length-1),Ya(e)}return e},TH=e=>{let t=[];return e.map(n=>{n.type==="brace"&&(n.value==="{"?t.push("}"):t.splice(t.lastIndexOf("}"),1)),n.type==="paren"&&(n.value==="["?t.push("]"):t.splice(t.lastIndexOf("]"),1))}),t.length>0&&t.reverse().map(n=>{n==="}"?e.push({type:"brace",value:"}"}):n==="]"&&e.push({type:"paren",value:"]"})}),e},CH=e=>{let t="";return e.map(n=>{n.type==="string"?t+='"'+n.value+'"':t+=n.value}),t},TR=e=>JSON.parse(CH(TH(Ya(xH(e))))),rP="__json_buf";x_=class e{constructor(t,n){nr.add(this),this.messages=[],this.receivedMessages=[],Di.set(this,void 0),Ja.set(this,null),this.controller=new AbortController,Hd.set(this,void 0),rf.set(this,()=>{}),Vd.set(this,()=>{}),Zd.set(this,void 0),of.set(this,()=>{}),Qd.set(this,()=>{}),hi.set(this,{}),Yd.set(this,!1),af.set(this,!1),sf.set(this,!1),Po.set(this,!1),df.set(this,void 0),lf.set(this,void 0),Xd.set(this,void 0),uf.set(this,i=>{if(ue(this,af,!0,"f"),$l(i)&&(i=new Jn),i instanceof Jn)return ue(this,sf,!0,"f"),this._emit("abort",i);if(i instanceof ve)return this._emit("error",i);if(i instanceof Error){let r=new ve(i.message);return r.cause=i,this._emit("error",r)}return this._emit("error",new ve(String(i)))}),ue(this,Hd,new Promise((i,r)=>{ue(this,rf,i,"f"),ue(this,Vd,r,"f")}),"f"),ue(this,Zd,new Promise((i,r)=>{ue(this,of,i,"f"),ue(this,Qd,r,"f")}),"f"),U(this,Hd,"f").catch(()=>{}),U(this,Zd,"f").catch(()=>{}),ue(this,Ja,t,"f"),ue(this,Xd,n?.logger??console,"f")}get response(){return U(this,df,"f")}get request_id(){return U(this,lf,"f")}async withResponse(){ue(this,Po,!0,"f");let t=await U(this,Hd,"f");if(!t)throw Error("Could not resolve a `Response` object");return{data:this,response:t,request_id:t.headers.get("request-id")}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,i,{logger:r}={}){let o=new e(n,{logger:r});for(let a of n.messages)o._addMessageParam(a);return ue(o,Ja,{...n,stream:!0},"f"),o._run(()=>o._createMessage(t,{...n,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},U(this,uf,"f"))}_addMessageParam(t){this.messages.push(t)}_addMessage(t,n=!0){this.receivedMessages.push(t),n&&this._emit("message",t)}async _createMessage(t,n,i){let r=i?.signal,o;r&&(r.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o));try{U(this,nr,"m",jy).call(this);let{response:a,data:s}=await t.create({...n,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(a);for await(let d of s)U(this,nr,"m",qy).call(this,d);if(s.controller.signal?.aborted)throw new Jn;U(this,nr,"m",Ny).call(this)}finally{r&&o&&r.removeEventListener("abort",o)}}_connected(t){this.ended||(ue(this,df,t,"f"),ue(this,lf,t?.headers.get("request-id"),"f"),U(this,rf,"f").call(this,t),this._emit("connect"))}get ended(){return U(this,Yd,"f")}get errored(){return U(this,af,"f")}get aborted(){return U(this,sf,"f")}abort(){this.controller.abort()}on(t,n){return(U(this,hi,"f")[t]||(U(this,hi,"f")[t]=[])).push({listener:n}),this}off(t,n){let i=U(this,hi,"f")[t];if(!i)return this;let r=i.findIndex(o=>o.listener===n);return r>=0&&i.splice(r,1),this}once(t,n){return(U(this,hi,"f")[t]||(U(this,hi,"f")[t]=[])).push({listener:n,once:!0}),this}emitted(t){return new Promise((n,i)=>{ue(this,Po,!0,"f"),t!=="error"&&this.once("error",i),this.once(t,n)})}async done(){ue(this,Po,!0,"f"),await U(this,Zd,"f")}get currentMessage(){return U(this,Di,"f")}async finalMessage(){return await this.done(),U(this,nr,"m",My).call(this)}async finalText(){return await this.done(),U(this,nr,"m",tP).call(this)}_emit(t,...n){if(U(this,Yd,"f"))return;t==="end"&&(ue(this,Yd,!0,"f"),U(this,of,"f").call(this));let i=U(this,hi,"f")[t];if(i&&(U(this,hi,"f")[t]=i.filter(r=>!r.once),i.forEach(({listener:r})=>r(...n))),t==="abort"){let r=n[0];!U(this,Po,"f")&&!i?.length&&Promise.reject(r),U(this,Vd,"f").call(this,r),U(this,Qd,"f").call(this,r),this._emit("end");return}if(t==="error"){let r=n[0];!U(this,Po,"f")&&!i?.length&&Promise.reject(r),U(this,Vd,"f").call(this,r),U(this,Qd,"f").call(this,r),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",U(this,nr,"m",My).call(this))}async _fromReadableStream(t,n){let i=n?.signal,r;i&&(i.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),i.addEventListener("abort",r));try{U(this,nr,"m",jy).call(this),this._connected(null);let o=Uo.fromReadableStream(t,this.controller);for await(let a of o)U(this,nr,"m",qy).call(this,a);if(o.controller.signal?.aborted)throw new Jn;U(this,nr,"m",Ny).call(this)}finally{i&&r&&i.removeEventListener("abort",r)}}[(Di=new WeakMap,Ja=new WeakMap,Hd=new WeakMap,rf=new WeakMap,Vd=new WeakMap,Zd=new WeakMap,of=new WeakMap,Qd=new WeakMap,hi=new WeakMap,Yd=new WeakMap,af=new WeakMap,sf=new WeakMap,Po=new WeakMap,df=new WeakMap,lf=new WeakMap,Xd=new WeakMap,uf=new WeakMap,nr=new WeakSet,My=function(){if(this.receivedMessages.length===0)throw new ve("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},tP=function(){if(this.receivedMessages.length===0)throw new ve("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(t.length===0)throw new ve("stream ended without producing a content block with type=text");return t.join(" ")},jy=function(){this.ended||ue(this,Di,void 0,"f")},qy=function(t){if(this.ended)return;let n=U(this,nr,"m",nP).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let i=n.content.at(-1);switch(t.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",t.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",t.delta.citation,i.citations??[]);break}case"input_json_delta":{iP(i)&&i.input&&this._emit("inputJson",t.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",t.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}case"compaction_delta":{i.type==="compaction"&&i.content&&this._emit("compaction",i.content);break}default:t.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(eP(n,U(this,Ja,"f"),{logger:U(this,Xd,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ue(this,Di,n,"f");break}case"content_block_start":case"message_delta":break}},Ny=function(){if(this.ended)throw new ve("stream has ended, this shouldn't happen");let t=U(this,Di,"f");if(!t)throw new ve("request ended without sending any chunks");return ue(this,Di,void 0,"f"),eP(t,U(this,Ja,"f"),{logger:U(this,Xd,"f")})},nP=function(t){let n=U(this,Di,"f");if(t.type==="message_start"){if(n)throw new ve(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new ve(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":return n.container=t.delta.container,n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,n.usage.output_tokens=t.usage.output_tokens,n.context_management=t.context_management,t.usage.input_tokens!=null&&(n.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(n.usage.server_tool_use=t.usage.server_tool_use),t.usage.iterations!=null&&(n.usage.iterations=t.usage.iterations),n;case"content_block_start":return n.content.push(t.content_block),n;case"content_block_delta":{let i=n.content.at(t.index);switch(t.delta.type){case"text_delta":{i?.type==="text"&&(n.content[t.index]={...i,text:(i.text||"")+t.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[t.index]={...i,citations:[...i.citations??[],t.delta.citation]});break}case"input_json_delta":{if(i&&iP(i)){let r=i[rP]||"";r+=t.delta.partial_json;let o={...i};if(Object.defineProperty(o,rP,{value:r,enumerable:!1,writable:!0}),r)try{o.input=TR(r)}catch(a){let s=new ve(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${a}. JSON: ${r}`);U(this,uf,"f").call(this,s)}n.content[t.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[t.index]={...i,thinking:i.thinking+t.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[t.index]={...i,signature:t.delta.signature});break}case"compaction_delta":{i?.type==="compaction"&&(n.content[t.index]={...i,content:(i.content||"")+t.delta.content});break}default:t.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let t=[],n=[],i=!1;return this.on("streamEvent",r=>{let o=n.shift();o?o.resolve(r):t.push(r)}),this.on("end",()=>{i=!0;for(let r of n)r.resolve(void 0);n.length=0}),this.on("abort",r=>{i=!0;for(let o of n)o.reject(r);n.length=0}),this.on("error",r=>{i=!0;for(let o of n)o.reject(r);n.length=0}),{next:async()=>t.length?{value:t.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((r,o)=>n.push({resolve:r,reject:o})).then(r=>r?{value:r,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Uo(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}},tp=class extends Error{constructor(t){let n=typeof t=="string"?t:t.map(i=>i.type==="text"?i.text:`[${i.type}]`).join(" ");super(n),this.name="ToolError",this.content=t}},AH=1e5,EH=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
200
- 1. Task Overview
201
- The user's core request and success criteria
202
- Any clarifications or constraints they specified
203
- 2. Current State
204
- What has been completed so far
205
- Files created, modified, or analyzed (with paths if relevant)
206
- Key outputs or artifacts produced
207
- 3. Important Discoveries
208
- Technical constraints or requirements uncovered
209
- Decisions made and their rationale
210
- Errors encountered and how they were resolved
211
- What approaches were tried that didn't work (and why)
212
- 4. Next Steps
213
- Specific actions needed to complete the task
214
- Any blockers or open questions to resolve
215
- Priority order if multiple steps remain
216
- 5. Context to Preserve
217
- User preferences or style requirements
218
- Domain-specific details that aren't obvious
219
- Any promises made to the user
220
- Be concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
221
- Wrap your summary in <summary></summary> tags.`;np=class{constructor(t,n,i){el.add(this),this.client=t,Ka.set(this,!1),Io.set(this,!1),Dt.set(this,void 0),An.set(this,void 0),Fn.set(this,void 0),bi.set(this,void 0),Li.set(this,void 0),tl.set(this,0),ue(this,Dt,{params:{...n,messages:structuredClone(n.messages)}},"f");let r=["BetaToolRunner",...vR(n.tools,n.messages)].join(", ");ue(this,An,{...i,headers:ne([{"x-stainless-helper":r},i?.headers])},"f"),ue(this,Li,aP(),"f"),n.compactionControl?.enabled&&console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(Ka=new WeakMap,Io=new WeakMap,Dt=new WeakMap,An=new WeakMap,Fn=new WeakMap,bi=new WeakMap,Li=new WeakMap,tl=new WeakMap,el=new WeakSet,oP=async function(){let t=U(this,Dt,"f").params.compactionControl;if(!t||!t.enabled)return!1;let n=0;if(U(this,Fn,"f")!==void 0)try{let d=await U(this,Fn,"f");n=d.usage.input_tokens+(d.usage.cache_creation_input_tokens??0)+(d.usage.cache_read_input_tokens??0)+d.usage.output_tokens}catch{return!1}let i=t.contextTokenThreshold??AH;if(n<i)return!1;let r=t.model??U(this,Dt,"f").params.model,o=t.summaryPrompt??EH,a=U(this,Dt,"f").params.messages;if(a[a.length-1].role==="assistant"){let d=a[a.length-1];if(Array.isArray(d.content)){let l=d.content.filter(u=>u.type!=="tool_use");l.length===0?a.pop():d.content=l}}let s=await this.client.beta.messages.create({model:r,messages:[...a,{role:"user",content:[{type:"text",text:o}]}],max_tokens:U(this,Dt,"f").params.max_tokens},{signal:U(this,An,"f").signal,headers:ne([U(this,An,"f").headers,{"x-stainless-helper":"compaction"}])});if(s.content[0]?.type!=="text")throw new ve("Expected text response for compaction");return U(this,Dt,"f").params.messages=[{role:"user",content:s.content}],!0},Symbol.asyncIterator)](){var t;if(U(this,Ka,"f"))throw new ve("Cannot iterate over a consumed stream");ue(this,Ka,!0,"f"),ue(this,Io,!0,"f"),ue(this,bi,void 0,"f");try{for(;;){let n;try{if(U(this,Dt,"f").params.max_iterations&&U(this,tl,"f")>=U(this,Dt,"f").params.max_iterations)break;ue(this,Io,!1,"f"),ue(this,bi,void 0,"f"),ue(this,tl,(t=U(this,tl,"f"),t++,t),"f"),ue(this,Fn,void 0,"f");let{max_iterations:i,compactionControl:r,...o}=U(this,Dt,"f").params;if(o.stream?(n=this.client.beta.messages.stream({...o},U(this,An,"f")),ue(this,Fn,n.finalMessage(),"f"),U(this,Fn,"f").catch(()=>{}),yield n):(ue(this,Fn,this.client.beta.messages.create({...o,stream:!1},U(this,An,"f")),"f"),yield U(this,Fn,"f")),!await U(this,el,"m",oP).call(this)){if(!U(this,Io,"f")){let{role:s,content:d}=await U(this,Fn,"f");U(this,Dt,"f").params.messages.push({role:s,content:d})}let a=await U(this,el,"m",T_).call(this,U(this,Dt,"f").params.messages.at(-1));if(a)U(this,Dt,"f").params.messages.push(a);else if(!U(this,Io,"f"))break}}finally{n&&n.abort()}}if(!U(this,Fn,"f"))throw new ve("ToolRunner concluded without a message from the server");U(this,Li,"f").resolve(await U(this,Fn,"f"))}catch(n){throw ue(this,Ka,!1,"f"),U(this,Li,"f").promise.catch(()=>{}),U(this,Li,"f").reject(n),ue(this,Li,aP(),"f"),n}}setMessagesParams(t){typeof t=="function"?U(this,Dt,"f").params=t(U(this,Dt,"f").params):U(this,Dt,"f").params=t,ue(this,Io,!0,"f"),ue(this,bi,void 0,"f")}setRequestOptions(t){typeof t=="function"?ue(this,An,t(U(this,An,"f")),"f"):ue(this,An,{...U(this,An,"f"),...t},"f")}async generateToolResponse(t=U(this,An,"f").signal){let n=await U(this,Fn,"f")??this.params.messages.at(-1);return n?U(this,el,"m",T_).call(this,n,t):null}done(){return U(this,Li,"f").promise}async runUntilDone(){if(!U(this,Ka,"f"))for await(let t of this);return this.done()}get params(){return U(this,Dt,"f").params}pushMessages(...t){this.setMessagesParams(n=>({...n,messages:[...n.messages,...t]}))}then(t,n){return this.runUntilDone().then(t,n)}};T_=async function(e,t=U(this,An,"f").signal){return U(this,bi,"f")!==void 0?U(this,bi,"f"):(ue(this,bi,PH(U(this,Dt,"f").params,e,{...U(this,An,"f"),signal:t}),"f"),U(this,bi,"f"))};sP={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},IH=["claude-mythos-preview","claude-opus-4-6"],zo=class extends dt{constructor(){super(...arguments),this.batches=new ep(this._client)}create(t,n){let i=dP(t),{betas:r,...o}=i;o.model in sP&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${sP[o.model]}
222
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),IH.includes(o.model)&&o.thinking&&o.thinking.type==="enabled"&&console.warn(`Using Claude with ${o.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let a=this._client._options.timeout;if(!o.stream&&a==null){let d=wR[o.model]??void 0;a=this._client.calculateNonstreamingTimeout(o.max_tokens,d)}let s=SR(o.tools,o.messages);return this._client.post("/v1/messages?beta=true",{body:o,timeout:a??6e5,...n,headers:ne([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},s,n?.headers]),stream:i.stream??!1})}parse(t,n){return n={...n,headers:ne([{"anthropic-beta":[...t.betas??[],"structured-outputs-2025-12-15"].toString()},n?.headers])},this.create(t,n).then(i=>xR(i,t,{logger:this._client.logger??console}))}stream(t,n){return x_.createMessage(this,t,n)}countTokens(t,n){let i=dP(t),{betas:r,...o}=i;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...n,headers:ne([{"anthropic-beta":[...r??[],"token-counting-2024-11-01"].toString()},n?.headers])})}toolRunner(t,n){return new np(this._client,t,n)}};zo.Batches=ep;zo.BetaToolRunner=np;zo.ToolError=tp;rp=class extends dt{list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/sessions/${t}/events?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}send(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/sessions/${t}/events?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}stream(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/sessions/${t}/events/stream?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers]),stream:!0})}},ip=class extends dt{retrieve(t,n,i){let{session_id:r,betas:o}=n;return this._client.get(he`/v1/sessions/${r}/resources/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{session_id:r,betas:o,...a}=n;return this._client.post(he`/v1/sessions/${r}/resources/${t}?beta=true`,{body:a,...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/sessions/${t}/resources?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}delete(t,n,i){let{session_id:r,betas:o}=n;return this._client.delete(he`/v1/sessions/${r}/resources/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}add(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/sessions/${t}/resources?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},ms=class extends dt{constructor(){super(...arguments),this.events=new rp(this._client),this.resources=new ip(this._client)}create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/sessions?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/sessions/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/sessions/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/sessions?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/sessions/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}archive(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/sessions/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}};ms.Events=rp;ms.Resources=ip;op=class extends dt{create(t,n={},i){let{betas:r,...o}=n??{};return this._client.post(he`/v1/skills/${t}/versions?beta=true`,Xb({body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},i?.headers])},this._client))}retrieve(t,n,i){let{skill_id:r,betas:o}=n;return this._client.get(he`/v1/skills/${r}/versions/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},i?.headers])})}list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/skills/${t}/versions?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},i?.headers])})}delete(t,n,i){let{skill_id:r,betas:o}=n;return this._client.delete(he`/v1/skills/${r}/versions/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},i?.headers])})}},jl=class extends dt{constructor(){super(...arguments),this.versions=new op(this._client)}create(t={},n){let{betas:i,...r}=t??{};return this._client.post("/v1/skills?beta=true",Xb({body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])},this._client,!1))}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/skills/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/skills?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/skills/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},i?.headers])})}};jl.Versions=op;ap=class extends dt{create(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/vaults/${t}/credentials?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}retrieve(t,n,i){let{vault_id:r,betas:o}=n;return this._client.get(he`/v1/vaults/${r}/credentials/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{vault_id:r,betas:o,...a}=n;return this._client.post(he`/v1/vaults/${r}/credentials/${t}?beta=true`,{body:a,...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t,n={},i){let{betas:r,...o}=n??{};return this._client.getAPIList(he`/v1/vaults/${t}/credentials?beta=true`,fn,{query:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}delete(t,n,i){let{vault_id:r,betas:o}=n;return this._client.delete(he`/v1/vaults/${r}/credentials/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}archive(t,n,i){let{vault_id:r,betas:o}=n;return this._client.post(he`/v1/vaults/${r}/credentials/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}},ql=class extends dt{constructor(){super(...arguments),this.credentials=new ap(this._client)}create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/vaults?beta=true",{body:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/vaults/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}update(t,n,i){let{betas:r,...o}=n;return this._client.post(he`/v1/vaults/${t}?beta=true`,{body:o,...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/vaults?beta=true",fn,{query:r,...n,headers:ne([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(t,n={},i){let{betas:r}=n??{};return this._client.delete(he`/v1/vaults/${t}?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}archive(t,n={},i){let{betas:r}=n??{};return this._client.post(he`/v1/vaults/${t}/archive?beta=true`,{...i,headers:ne([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}};ql.Credentials=ap;In=class extends dt{constructor(){super(...arguments),this.models=new Hf(this._client),this.messages=new zo(this._client),this.agents=new Ml(this._client),this.environments=new Bf(this._client),this.sessions=new ms(this._client),this.vaults=new ql(this._client),this.memoryStores=new ps(this._client),this.files=new Wf(this._client),this.skills=new jl(this._client),this.userProfiles=new Vf(this._client)}};In.Models=Hf;In.Messages=zo;In.Agents=Ml;In.Environments=Bf;In.Sessions=ms;In.Vaults=ql;In.MemoryStores=ps;In.Files=Wf;In.Skills=jl;In.UserProfiles=Vf;sp=class extends dt{create(t,n){let{betas:i,...r}=t;return this._client.post("/v1/complete",{body:r,timeout:this._client._options.timeout??6e5,...n,headers:ne([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers]),stream:t.stream??!1})}};fP="__json_buf";C_=class e{constructor(t,n){rr.add(this),this.messages=[],this.receivedMessages=[],Ui.set(this,void 0),Ba.set(this,null),this.controller=new AbortController,nl.set(this,void 0),cf.set(this,()=>{}),rl.set(this,()=>{}),il.set(this,void 0),ff.set(this,()=>{}),ol.set(this,()=>{}),gi.set(this,{}),al.set(this,!1),pf.set(this,!1),mf.set(this,!1),Oo.set(this,!1),hf.set(this,void 0),gf.set(this,void 0),sl.set(this,void 0),Dy.set(this,i=>{if(ue(this,pf,!0,"f"),$l(i)&&(i=new Jn),i instanceof Jn)return ue(this,mf,!0,"f"),this._emit("abort",i);if(i instanceof ve)return this._emit("error",i);if(i instanceof Error){let r=new ve(i.message);return r.cause=i,this._emit("error",r)}return this._emit("error",new ve(String(i)))}),ue(this,nl,new Promise((i,r)=>{ue(this,cf,i,"f"),ue(this,rl,r,"f")}),"f"),ue(this,il,new Promise((i,r)=>{ue(this,ff,i,"f"),ue(this,ol,r,"f")}),"f"),U(this,nl,"f").catch(()=>{}),U(this,il,"f").catch(()=>{}),ue(this,Ba,t,"f"),ue(this,sl,n?.logger??console,"f")}get response(){return U(this,hf,"f")}get request_id(){return U(this,gf,"f")}async withResponse(){ue(this,Oo,!0,"f");let t=await U(this,nl,"f");if(!t)throw Error("Could not resolve a `Response` object");return{data:this,response:t,request_id:t.headers.get("request-id")}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,i,{logger:r}={}){let o=new e(n,{logger:r});for(let a of n.messages)o._addMessageParam(a);return ue(o,Ba,{...n,stream:!0},"f"),o._run(()=>o._createMessage(t,{...n,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},U(this,Dy,"f"))}_addMessageParam(t){this.messages.push(t)}_addMessage(t,n=!0){this.receivedMessages.push(t),n&&this._emit("message",t)}async _createMessage(t,n,i){let r=i?.signal,o;r&&(r.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o));try{U(this,rr,"m",Ly).call(this);let{response:a,data:s}=await t.create({...n,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(a);for await(let d of s)U(this,rr,"m",Uy).call(this,d);if(s.controller.signal?.aborted)throw new Jn;U(this,rr,"m",Gy).call(this)}finally{r&&o&&r.removeEventListener("abort",o)}}_connected(t){this.ended||(ue(this,hf,t,"f"),ue(this,gf,t?.headers.get("request-id"),"f"),U(this,cf,"f").call(this,t),this._emit("connect"))}get ended(){return U(this,al,"f")}get errored(){return U(this,pf,"f")}get aborted(){return U(this,mf,"f")}abort(){this.controller.abort()}on(t,n){return(U(this,gi,"f")[t]||(U(this,gi,"f")[t]=[])).push({listener:n}),this}off(t,n){let i=U(this,gi,"f")[t];if(!i)return this;let r=i.findIndex(o=>o.listener===n);return r>=0&&i.splice(r,1),this}once(t,n){return(U(this,gi,"f")[t]||(U(this,gi,"f")[t]=[])).push({listener:n,once:!0}),this}emitted(t){return new Promise((n,i)=>{ue(this,Oo,!0,"f"),t!=="error"&&this.once("error",i),this.once(t,n)})}async done(){ue(this,Oo,!0,"f"),await U(this,il,"f")}get currentMessage(){return U(this,Ui,"f")}async finalMessage(){return await this.done(),U(this,rr,"m",Fy).call(this)}async finalText(){return await this.done(),U(this,rr,"m",uP).call(this)}_emit(t,...n){if(U(this,al,"f"))return;t==="end"&&(ue(this,al,!0,"f"),U(this,ff,"f").call(this));let i=U(this,gi,"f")[t];if(i&&(U(this,gi,"f")[t]=i.filter(r=>!r.once),i.forEach(({listener:r})=>r(...n))),t==="abort"){let r=n[0];!U(this,Oo,"f")&&!i?.length&&Promise.reject(r),U(this,rl,"f").call(this,r),U(this,ol,"f").call(this,r),this._emit("end");return}if(t==="error"){let r=n[0];!U(this,Oo,"f")&&!i?.length&&Promise.reject(r),U(this,rl,"f").call(this,r),U(this,ol,"f").call(this,r),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",U(this,rr,"m",Fy).call(this))}async _fromReadableStream(t,n){let i=n?.signal,r;i&&(i.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),i.addEventListener("abort",r));try{U(this,rr,"m",Ly).call(this),this._connected(null);let o=Uo.fromReadableStream(t,this.controller);for await(let a of o)U(this,rr,"m",Uy).call(this,a);if(o.controller.signal?.aborted)throw new Jn;U(this,rr,"m",Gy).call(this)}finally{i&&r&&i.removeEventListener("abort",r)}}[(Ui=new WeakMap,Ba=new WeakMap,nl=new WeakMap,cf=new WeakMap,rl=new WeakMap,il=new WeakMap,ff=new WeakMap,ol=new WeakMap,gi=new WeakMap,al=new WeakMap,pf=new WeakMap,mf=new WeakMap,Oo=new WeakMap,hf=new WeakMap,gf=new WeakMap,sl=new WeakMap,Dy=new WeakMap,rr=new WeakSet,Fy=function(){if(this.receivedMessages.length===0)throw new ve("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},uP=function(){if(this.receivedMessages.length===0)throw new ve("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(t.length===0)throw new ve("stream ended without producing a content block with type=text");return t.join(" ")},Ly=function(){this.ended||ue(this,Ui,void 0,"f")},Uy=function(t){if(this.ended)return;let n=U(this,rr,"m",cP).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let i=n.content.at(-1);switch(t.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",t.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",t.delta.citation,i.citations??[]);break}case"input_json_delta":{pP(i)&&i.input&&this._emit("inputJson",t.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",t.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(lP(n,U(this,Ba,"f"),{logger:U(this,sl,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{ue(this,Ui,n,"f");break}case"content_block_start":case"message_delta":break}},Gy=function(){if(this.ended)throw new ve("stream has ended, this shouldn't happen");let t=U(this,Ui,"f");if(!t)throw new ve("request ended without sending any chunks");return ue(this,Ui,void 0,"f"),lP(t,U(this,Ba,"f"),{logger:U(this,sl,"f")})},cP=function(t){let n=U(this,Ui,"f");if(t.type==="message_start"){if(n)throw new ve(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new ve(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":return n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,n.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(n.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(n.usage.server_tool_use=t.usage.server_tool_use),n;case"content_block_start":return n.content.push({...t.content_block}),n;case"content_block_delta":{let i=n.content.at(t.index);switch(t.delta.type){case"text_delta":{i?.type==="text"&&(n.content[t.index]={...i,text:(i.text||"")+t.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[t.index]={...i,citations:[...i.citations??[],t.delta.citation]});break}case"input_json_delta":{if(i&&pP(i)){let r=i[fP]||"";r+=t.delta.partial_json;let o={...i};Object.defineProperty(o,fP,{value:r,enumerable:!1,writable:!0}),r&&(o.input=TR(r)),n.content[t.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[t.index]={...i,thinking:i.thinking+t.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[t.index]={...i,signature:t.delta.signature});break}default:t.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let t=[],n=[],i=!1;return this.on("streamEvent",r=>{let o=n.shift();o?o.resolve(r):t.push(r)}),this.on("end",()=>{i=!0;for(let r of n)r.resolve(void 0);n.length=0}),this.on("abort",r=>{i=!0;for(let o of n)o.reject(r);n.length=0}),this.on("error",r=>{i=!0;for(let o of n)o.reject(r);n.length=0}),{next:async()=>t.length?{value:t.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((r,o)=>n.push({resolve:r,reject:o})).then(r=>r?{value:r,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Uo(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}},dp=class extends dt{create(t,n){return this._client.post("/v1/messages/batches",{body:t,...n})}retrieve(t,n){return this._client.get(he`/v1/messages/batches/${t}`,n)}list(t={},n){return this._client.getAPIList("/v1/messages/batches",Go,{query:t,...n})}delete(t,n){return this._client.delete(he`/v1/messages/batches/${t}`,n)}cancel(t,n){return this._client.post(he`/v1/messages/batches/${t}/cancel`,n)}async results(t,n){let i=await this.retrieve(t);if(!i.results_url)throw new ve(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);return this._client.get(i.results_url,{...n,headers:ne([{Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((r,o)=>Xf.fromResponse(o.response,o.controller))}},Nl=class extends dt{constructor(){super(...arguments),this.batches=new dp(this._client)}create(t,n){t.model in mP&&console.warn(`The model '${t.model}' is deprecated and will reach end-of-life on ${mP[t.model]}
223
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),RH.includes(t.model)&&t.thinking&&t.thinking.type==="enabled"&&console.warn(`Using Claude with ${t.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!t.stream&&i==null){let o=wR[t.model]??void 0;i=this._client.calculateNonstreamingTimeout(t.max_tokens,o)}let r=SR(t.tools,t.messages);return this._client.post("/v1/messages",{body:t,timeout:i??6e5,...n,headers:ne([r,n?.headers]),stream:t.stream??!1})}parse(t,n){return this.create(t,n).then(i=>AR(i,t,{logger:this._client.logger??console}))}stream(t,n){return C_.createMessage(this,t,n,{logger:this._client.logger??console})}countTokens(t,n){return this._client.post("/v1/messages/count_tokens",{body:t,...n})}},mP={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},RH=["claude-mythos-preview","claude-opus-4-6"];Nl.Batches=dp;lp=class extends dt{retrieve(t,n={},i){let{betas:r}=n??{};return this._client.get(he`/v1/models/${t}`,{...i,headers:ne([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers])})}list(t={},n){let{betas:i,...r}=t??{};return this._client.getAPIList("/v1/models",Go,{query:r,...n,headers:ne([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}},$H="\\n\\nHuman:",MH="\\n\\nAssistant:",Ct=class{get credentials(){return this._authState.provider}constructor({baseURL:t=Ze("ANTHROPIC_BASE_URL"),apiKey:n,authToken:i,...r}={}){if(A_.add(this),this._requestAuthFlags=new WeakMap,Af.set(this,void 0),n===void 0&&(n=r.profile!=null?null:Ze("ANTHROPIC_API_KEY")??null),i===void 0&&(i=r.profile!=null?null:Ze("ANTHROPIC_AUTH_TOKEN")??null),r.profile!=null&&(r.credentials!=null||r.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let o={apiKey:n,authToken:i,...r,baseURL:t||"https://api.anthropic.com"};if(!o.dangerouslyAllowBrowser&&M6())throw new ve(`It looks like you're running in a browser-like environment.
224
-
225
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
226
- If you understand the risks and have appropriate mitigations in place,
227
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
228
-
229
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
230
- `);this.baseURL=o.baseURL,this._baseURLIsExplicit=r.__baseURLIsExplicit??!!t,this.timeout=o.timeout??ev.DEFAULT_TIMEOUT,this.logger=o.logger??console;let a="warn";this.logLevel=a,this.logLevel=VE(o.logLevel,"ClientOptions.logLevel",this)??VE(Ze("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??F6(),ue(this,Af,L6,"f");let s=Ze("ANTHROPIC_CUSTOM_HEADERS");if(s){let l={};for(let u of s.split(`
231
- `)){let c=u.indexOf(":");c>=0&&(l[u.substring(0,c).trim()]=u.substring(c+1).trim())}o.defaultHeaders={...l,...o.defaultHeaders}}let d=r.__auth;if(delete o.__auth,delete o.__baseURLIsExplicit,this._options=o,this.apiKey=typeof n=="string"?n:null,this.authToken=i,d)this._authState=d,!this._baseURLIsExplicit&&d.baseURL&&(this.baseURL=d.baseURL);else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let l=o.credentials??null;if(l)this._authState.provider=l,this._authState.tokenCache=this._makeTokenCache(l);else if(o.config!=null){let u=fR(o.config,this._credentialResolverOptions());this._authState.provider=u.provider,this._authState.tokenCache=this._makeTokenCache(u.provider),this._authState.extraHeaders=u.extraHeaders,this._applyCredentialBaseURL(u.baseURL)}else o.profile!=null?this._authState.resolution=this._resolveDefaultCredentials(o.profile):this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(t){if(!t)return;let n=t.replace(/\/+$/,"");this._authState.baseURL=n,!this._baseURLIsExplicit&&(this.baseURL=n)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:t=>{Vt(this).debug("credential cache write failed (best-effort)",t)},onSafetyWarning:t=>{Vt(this).warn(t)}}}_makeTokenCache(t){return new b_(t,n=>{Vt(this).debug("advisory token refresh failed; serving cached token",n)})}withOptions(t){let n="credentials"in t||"config"in t||"profile"in t,i="apiKey"in t||"authToken"in t||n,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...n?{credentials:void 0,config:void 0,profile:void 0}:{},...t,__auth:i?void 0:this._authState,__baseURLIsExplicit:"baseURL"in t?!0:this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(t){try{let n=await iH(this._credentialResolverOptions(),t);if(n)this._authState.provider=n.provider,this._authState.tokenCache=this._makeTokenCache(n.provider),this._authState.extraHeaders=n.extraHeaders,this._applyCredentialBaseURL(n.baseURL);else if(t!=null)throw new ve(`Profile "${t}" could not be resolved (no <config_dir>/configs/${t}.json found).`)}catch(n){this._authState.error=n}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:n}){if(!(t.get("x-api-key")||t.get("authorization"))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution)&&!(this.apiKey&&t.get("x-api-key"))&&!n.has("x-api-key")&&!(this.authToken&&t.get("authorization"))&&!n.has("authorization"))throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}}_authFlags(t){let n=this._requestAuthFlags.get(t);return n||(n={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(t,n)),n}async authHeaders(t){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if(this._authState.tokenCache&&this.apiKey==null){let n=await this._authState.tokenCache.getToken();return this._authFlags(t).usedTokenCache=!0,ne([{Authorization:`Bearer ${n}`}])}return ne([await this.apiKeyAuth(t),await this.bearerAuth(t)])}}async apiKeyAuth(t){if(this.apiKey!=null)return ne([{"X-Api-Key":this.apiKey}])}async bearerAuth(t){if(this.authToken!=null)return ne([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(t){return U6(t)}getUserAgent(){return`${this.constructor.name}/JS ${Bi}`}defaultIdempotencyKey(){return`stainless-node-retry-${eR()}`}makeStatusError(t,n,i,r){return bn.generate(t,n,i,r)}buildURL(t,n,i){let r=!U(this,A_,"m",ER).call(this)&&i||this.baseURL,o=I6(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),a=this.defaultQuery(),s=Object.fromEntries(o.searchParams);return(!UE(a)||!UE(s))&&(n={...s,...a,...n}),typeof n=="object"&&n&&!Array.isArray(n)&&(o.search=this.stringifyQuery(n)),o.toString()}_calculateNonstreamingTimeout(t){if(3600*t/128e3>600)throw new ve("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 6e5}async prepareOptions(t){}async prepareRequest(t,{url:n,options:i}){if(this._authState.tokenCache&&this.apiKey==null){let r=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[o,a]of Object.entries(this._authState.extraHeaders))r.has(o)||r.set(o,a);r.get("anthropic-beta")?.split(",").map(o=>o.trim())?.includes(Gf)||r.append("anthropic-beta",Gf),t.headers=r}}get(t,n){return this.methodRequest("get",t,n)}post(t,n){return this.methodRequest("post",t,n)}patch(t,n){return this.methodRequest("patch",t,n)}put(t,n){return this.methodRequest("put",t,n)}delete(t,n){return this.methodRequest("delete",t,n)}methodRequest(t,n,i){return this.request(Promise.resolve(i).then(r=>({method:t,path:n,...r})))}request(t,n=null){return new Jf(this,this.makeRequest(t,n,void 0))}async makeRequest(t,n,i){let r=await t,o=r.maxRetries??this.maxRetries;n==null&&(n=o,this._requestAuthFlags.delete(r)),await this.prepareOptions(r);let{req:a,url:s,timeout:d}=await this.buildRequest(r,{retryCount:o-n});await this.prepareRequest(a,{url:s,options:r});let l="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),u=i===void 0?"":`, retryOf: ${i}`,c=Date.now();if(Vt(this).debug(`[${l}] sending request`,$o({retryOfRequestLogID:i,method:r.method,url:s,options:r,headers:a.headers})),r.signal?.aborted)throw new Jn;let p=new AbortController,f=await this.fetchWithTimeout(s,a,d,p).catch(g_),h=Date.now();if(f instanceof globalThis.Error){let y=`retrying, ${n} attempts remaining`;if(r.signal?.aborted)throw new Jn;let b=$l(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(n)return Vt(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${y}`),Vt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${y})`,$o({retryOfRequestLogID:i,url:s,durationMs:h-c,message:f.message})),this.retryRequest(r,n,i??l);throw Vt(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Vt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,$o({retryOfRequestLogID:i,url:s,durationMs:h-c,message:f.message})),b?new $f:new fs({cause:f})}let g=[...f.headers.entries()].filter(([y])=>y==="request-id").map(([y,b])=>", "+y+": "+JSON.stringify(b)).join(""),_=`[${l}${u}${g}] ${a.method} ${s} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${h-c}ms`;if(!f.ok){let y=await this.shouldRetry(f,r);if(n&&y){let C=`retrying, ${n} attempts remaining`;return await D6(f.body),Vt(this).info(`${_} - ${C}`),Vt(this).debug(`[${l}] response error (${C})`,$o({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-c})),this.retryRequest(r,n,i??l,f.headers)}let b=y?"error; no more retries left":"error; not retryable";Vt(this).info(`${_} - ${b}`);let v=await f.text().catch(C=>g_(C).message),w=tR(v),A=w?void 0:v;throw Vt(this).debug(`[${l}] response error (${b})`,$o({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,message:A,durationMs:Date.now()-c})),this.makeStatusError(f.status,w,A,f.headers)}return Vt(this).info(_),Vt(this).debug(`[${l}] response start`,$o({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:h-c})),{response:f,options:r,controller:p,requestLogID:l,retryOfRequestLogID:i,startTime:c}}getAPIList(t,n,i){return this.requestAPIList(n,i&&"then"in i?i.then(r=>({method:"get",path:t,...r})):{method:"get",path:t,...i})}requestAPIList(t,n){let i=this.makeRequest(n,null,void 0);return new S_(this,i,t)}async fetchWithTimeout(t,n,i,r){let{signal:o,method:a,...s}=n||{},d=this._makeAbort(r);o&&o.addEventListener("abort",d,{once:!0});let l=setTimeout(d,i),u=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:r.signal,...u?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,t,c)}finally{clearTimeout(l)}}async shouldRetry(t,n){let i=this._authFlags(n);if(t.status===401&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=t.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,n,i,r){let o,a=r?.get("retry-after-ms");if(a){let d=parseFloat(a);Number.isNaN(d)||(o=d)}let s=r?.get("retry-after");if(s&&!o){let d=parseFloat(s);Number.isNaN(d)?o=Date.parse(s)-Date.now():o=d*1e3}if(o===void 0){let d=t.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(n,d)}return await $6(o),this.makeRequest(t,n-1,i)}calculateDefaultRetryTimeoutMillis(t,n){let i=n-t,r=Math.min(.5*Math.pow(2,i),8),o=1-Math.random()*.25;return r*o*1e3}calculateNonstreamingTimeout(t,n){if(36e5*t/128e3>6e5||n!=null&&t>n)throw new ve("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(t,{retryCount:n=0}={}){let i={...t},{method:r,path:o,query:a,defaultBaseURL:s}=i;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let d=this.buildURL(o,a,s);"timeout"in i&&R6("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:l,body:u}=this.buildBody({options:i}),c=await this.buildHeaders({options:t,method:r,bodyHeaders:l,retryCount:n});return{req:{method:r,headers:c,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...i.fetchOptions??{}},url:d,timeout:i.timeout}}async buildHeaders({options:t,method:n,bodyHeaders:i,retryCount:r}){let o={};this.idempotencyHeader&&n!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=t.idempotencyKey);let a=ne([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{},...Hb(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(t),this._options.defaultHeaders,i,t.headers]);return this.validateHeaders(a),a.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:n}}){if(!t)return{bodyHeaders:void 0,body:void 0};let i=ne([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&i.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:rR(t)}:typeof t=="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:U(this,Af,"f").call(this,{body:t,headers:i})}};ev=Ct,Af=new WeakMap,A_=new WeakSet,ER=function(){return this.baseURL!=="https://api.anthropic.com"};Ct.Anthropic=ev;Ct.HUMAN_PROMPT=$H;Ct.AI_PROMPT=MH;Ct.DEFAULT_TIMEOUT=6e5;Ct.AnthropicError=ve;Ct.APIError=bn;Ct.APIConnectionError=fs;Ct.APIConnectionTimeoutError=$f;Ct.APIUserAbortError=Jn;Ct.NotFoundError=Nf;Ct.ConflictError=Ff;Ct.RateLimitError=Lf;Ct.BadRequestError=Mf;Ct.AuthenticationError=jf;Ct.InternalServerError=Uf;Ct.PermissionDeniedError=qf;Ct.UnprocessableEntityError=Df;Ct.toFile=_H;hs=class extends Ct{constructor(){super(...arguments),this.completions=new sp(this),this.messages=new Nl(this),this.models=new lp(this),this.beta=new In(this)}};hs.Completions=sp;hs.Messages=Nl;hs.Models=lp;hs.Beta=In;Er=class extends Error{telemetryMessage;constructor(t,n){super(t),this.name="TelemetrySafeError",this.telemetryMessage=n??t}},jH=(e,t)=>e!==null&&typeof e=="object"&&!("telemetryMessage"in e)?Object.assign(e,{telemetryMessage:t}):e;VH=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),ZH=new Set(["EPERM","EBUSY","EACCES"]),QH=4,YH=50,CCe=new Int32Array(new SharedArrayBuffer(4));tV=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);E_=class{read(t){return _P(t,"utf8")}readBytes(t){return _P(t)}write(t,n,i){return zy(t,n,{encoding:"utf8",mode:i})}async mkdir(t){try{await UH(t,{recursive:!0})}catch(n){if(yn(n)!=="EEXIST")throw n}}atomicWrite(t,n,i){return nV(t,n,i)}delete(t){return zH(t)}list(t){return yP(t)}append(t,n,i){return DH(t,n,{encoding:"utf8",mode:i})}writeExclusive(t,n,i){return zy(t,n,{encoding:"utf8",flag:"wx",mode:i})}writeBytes(t,n){return zy(t,n)}copy(t,n){return LH(t,n)}async stat(t){return{mtimeMs:(await GH(t)).mtimeMs}}async listEntries(t){return(await yP(t,{withFileTypes:!0})).map(n=>({name:n.name,isDirectory:n.isDirectory(),isFile:n.isFile()}))}async readRange(t,n,i){Ky("readRange","offset",n),Ky("readRange","length",i);let r=await gP(t,"r");try{return await bP(r,n,i)}finally{await r.close()}}async readTail(t,n){Ky("readTail","maxBytes",n);let i=await gP(t,"r");try{let{size:r}=await i.stat(),o=Math.min(n,r);return await bP(i,r-o,o)}finally{await i.close()}}};rV=new FH;Wa=null;aV=oV;dV=sV;uV=lV;fV=cV,pV=200;hV=mV;Ls.prototype.clear=aV;Ls.prototype.delete=dV;Ls.prototype.get=uV;Ls.prototype.has=fV;Ls.prototype.set=hV;Tl=Ls,gV=(function(){try{var e=Zo(Object,"defineProperty");return e({},"",{}),e}catch{}})(),cp=gV;tv=yV,_V=Object.prototype,bV=_V.hasOwnProperty;OR=vV;wV=SV;xV=kV;Yi=TV,CV="[object Arguments]";vP=AV,RR=Object.prototype,EV=RR.hasOwnProperty,PV=RR.propertyIsEnumerable,IV=vP((function(){return arguments})())?vP:function(e){return Yi(e)&&EV.call(e,"callee")&&!PV.call(e,"callee")},Fl=IV,OV=Array.isArray,ur=OV,gl={};ei(gl,{default:()=>Dl});$V=RV,$R=typeof gl=="object"&&gl&&!gl.nodeType&&gl,SP=$R&&typeof wd=="object"&&wd&&!wd.nodeType&&wd,MV=SP&&SP.exports===$R,wP=MV?ti.Buffer:void 0,jV=wP?wP.isBuffer:void 0,qV=jV||$V,Dl=qV,NV=9007199254740991,FV=/^(?:0|[1-9]\d*)$/;um=DV,LV=9007199254740991;nv=UV,GV="[object Arguments]",zV="[object Array]",JV="[object Boolean]",KV="[object Date]",BV="[object Error]",WV="[object Function]",HV="[object Map]",VV="[object Number]",ZV="[object Object]",QV="[object RegExp]",YV="[object Set]",XV="[object String]",e9="[object WeakMap]",t9="[object ArrayBuffer]",n9="[object DataView]",r9="[object Float32Array]",i9="[object Float64Array]",o9="[object Int8Array]",a9="[object Int16Array]",s9="[object Int32Array]",d9="[object Uint8Array]",l9="[object Uint8ClampedArray]",u9="[object Uint16Array]",c9="[object Uint32Array]",at={};at[r9]=at[i9]=at[o9]=at[a9]=at[s9]=at[d9]=at[l9]=at[u9]=at[c9]=!0;at[GV]=at[zV]=at[t9]=at[JV]=at[n9]=at[KV]=at[BV]=at[WV]=at[HV]=at[VV]=at[ZV]=at[QV]=at[YV]=at[XV]=at[e9]=!1;p9=f9;h9=m9,yl={};ei(yl,{default:()=>P_});MR=typeof yl=="object"&&yl&&!yl.nodeType&&yl,Cl=MR&&typeof Ed=="object"&&Ed&&!Ed.nodeType&&Ed,g9=Cl&&Cl.exports===MR,By=g9&&YO.process,y9=(function(){try{var e=Cl&&Cl.require&&Cl.require("util").types;return e||By&&By.binding&&By.binding("util")}catch{}})(),P_=y9,kP=P_&&P_.isTypedArray,_9=kP?h9(kP):p9,rv=_9,b9=Object.prototype,v9=b9.hasOwnProperty;jR=S9,w9=Object.prototype;iv=k9;qR=x9,T9=qR(Object.keys,Object),C9=T9,A9=Object.prototype,E9=A9.hasOwnProperty;I9=P9;cm=O9;NR=R9;M9=$9,j9=Object.prototype,q9=j9.hasOwnProperty;F9=N9;ov=D9,_l={};ei(_l,{default:()=>DR});FR=typeof _l=="object"&&_l&&!_l.nodeType&&_l,xP=FR&&typeof Od=="object"&&Od&&!Od.nodeType&&Od,L9=xP&&xP.exports===FR,TP=L9?ti.Buffer:void 0,CP=TP?TP.allocUnsafe:void 0;DR=U9;z9=G9;K9=J9;LR=B9,W9=Object.prototype,H9=W9.propertyIsEnumerable,AP=Object.getOwnPropertySymbols,V9=AP?function(e){return e==null?[]:(e=Object(e),K9(AP(e),function(t){return H9.call(e,t)}))}:LR,UR=V9;av=Z9,Q9=qR(Object.getPrototypeOf,Object),sv=Q9,Y9=Object.getOwnPropertySymbols,X9=Y9?function(e){for(var t=[];e;)av(t,UR(e)),e=sv(e);return t}:LR,e3=X9;GR=t3;EP=n3;i3=r3,o3=Zo(ti,"DataView"),I_=o3,a3=Zo(ti,"Promise"),O_=a3,s3=Zo(ti,"Set"),R_=s3,d3=Zo(ti,"WeakMap"),$_=d3,PP="[object Map]",l3="[object Object]",IP="[object Promise]",OP="[object Set]",RP="[object WeakMap]",$P="[object DataView]",u3=Vo(I_),c3=Vo(Rl),f3=Vo(O_),p3=Vo(R_),m3=Vo($_),Mo=Ho;(I_&&Mo(new I_(new ArrayBuffer(1)))!=$P||Rl&&Mo(new Rl)!=PP||O_&&Mo(O_.resolve())!=IP||R_&&Mo(new R_)!=OP||$_&&Mo(new $_)!=RP)&&(Mo=function(e){var t=Ho(e),n=t==l3?e.constructor:void 0,i=n?Vo(n):"";if(i)switch(i){case u3:return $P;case c3:return PP;case f3:return IP;case p3:return OP;case m3:return RP}return t});MP=Mo,h3=ti.Uint8Array,fp=h3;y3=g3;b3=_3,jP=Object.create,v3=(function(){function e(){}return function(t){if(!Qr(t))return{};if(jP)return jP(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})(),S3=v3;k3=w3,x3="__lodash_hash_undefined__";C3=T3;E3=A3;pp.prototype.add=pp.prototype.push=C3;pp.prototype.has=E3;P3=pp;O3=I3;$3=R3,M3=1,j3=2;zR=q3;F3=N3;L3=D3,U3=1,G3=2,z3="[object Boolean]",J3="[object Date]",K3="[object Error]",B3="[object Map]",W3="[object Number]",H3="[object RegExp]",V3="[object Set]",Z3="[object String]",Q3="[object Symbol]",Y3="[object ArrayBuffer]",X3="[object DataView]",NP=Zr?Zr.prototype:void 0,Wy=NP?NP.valueOf:void 0;t5=e5,n5=1,r5=Object.prototype,i5=r5.hasOwnProperty;a5=o5,s5=1,FP="[object Arguments]",DP="[object Array]",yf="[object Object]",d5=Object.prototype,LP=d5.hasOwnProperty;u5=l5;KR=JR,c5=1,f5=2;m5=p5;BR=h5;y5=g5;WR=_5;v5=b5,S5="[object Symbol]";dv=w5,k5=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,x5=/^\w*$/;lv=T5,C5=500;E5=A5,P5=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I5=/\\(\\)?/g,O5=E5(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(P5,function(n,i,r,o){t.push(r?o.replace(I5,"$1"):i||n)}),t}),R5=O5;HR=$5,M5=1/0,UP=Zr?Zr.prototype:void 0,GP=UP?UP.toString:void 0;j5=VR;N5=q5;fm=F5,D5=1/0;fu=L5;uv=U5;z5=G5;K5=J5;W5=B5;ZR=H5,V5=1,Z5=2;Y5=Q5;cv=X5;t8=e8;r8=n8;o8=i8;QR=a8,YR="[\\w-]{1,63}",RCe=new RegExp(`^${YR}$`),$Ce=new RegExp(`^a(?:${YR}-)?[0-9a-f]{16}$`);u8="3ab19d7e-9f35-45c2-926e-75e271cc60b3";fv=null;mp=new Map;pv=new Map;C8={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};E8=A8(),P8=()=>{};I8=lu(),MCe=I8.subscribe;O8=lu(),jCe=O8.subscribe,R8=lu(),qCe=R8.subscribe,$8=lu(),NCe=$8.subscribe,M8=lu(),FCe=M8.subscribe;hp=class{#r=new Set;register(t){let n=L8(t);this.#r.add(n);let i=()=>{this.#r.delete(n)};return Object.assign(i,{[Symbol.dispose]:i})}async drain(){let t=Array.from(this.#r);this.#r.clear(),await Promise.all(t.map(async n=>n()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#r.size}},U8=new hp;UCe=new hp,G8=rn(e=>{if(!e||e.trim()==="")return null;let t=e.split(",").map(o=>o.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(o=>o.startsWith("!")),i=t.some(o=>!o.startsWith("!"));if(n&&i)return null;let r=t.map(o=>o.replace(/^!/,"").toLowerCase());return{include:n?[]:r,exclude:n?r:[],isExclusive:n}});_f="\u2192";dZ={cwd(){return process.cwd()},existsSync(e){let t=[];try{let r=gt(t,_t`fs.existsSync(${e})`,0);return xe.existsSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},async stat(e){return iZ(e)},async lstat(e){return Z8(e)},async readdir(e){return Y8(e,{withFileTypes:!0})},async unlink(e){return aZ(e)},async rmdir(e){return nZ(e)},async rm(e,t){return rZ(e,t)},async mkdir(e,t){try{await Q8(e,{recursive:!0,...t})}catch(n){if(yn(n)!=="EEXIST")throw n}},async readFile(e,t){return WP(e,{encoding:t.encoding})},async rename(e,t){return tZ(e,t)},async realpath(e){return cs(await eZ(e))},async readlink(e){return X8(e)},async copyFile(e,t){return H8(e,t)},async appendFile(e,t,n){if(n?.mode!==void 0)try{let i=await BP(e,"ax",n.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(yn(i)!=="EEXIST")throw i}return B8(e,t)},async symlink(e,t,n){return oZ(e,t,n)},async link(e,t){return V8(e,t)},async chmod(e,t){return W8(e,t)},statSync(e){let t=[];try{let r=gt(t,_t`fs.statSync(${e})`,0);return xe.statSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},lstatSync(e){let t=[];try{let r=gt(t,_t`fs.lstatSync(${e})`,0);return xe.lstatSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},readFileSync(e,t){let n=[];try{let o=gt(n,_t`fs.readFileSync(${e})`,0);return xe.readFileSync(e,{encoding:t.encoding})}catch(o){var i=o,r=1}finally{yt(n,i,r)}},readFileBytesSync(e){let t=[];try{let r=gt(t,_t`fs.readFileBytesSync(${e})`,0);return xe.readFileSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},readSync(e,t){let n=[];try{let o=gt(n,_t`fs.readSync(${e}, ${t.length} bytes)`,0),a;try{a=xe.openSync(e,"r");let s=Buffer.alloc(t.length),d=xe.readSync(a,s,0,t.length,0);return{buffer:s,bytesRead:d}}finally{a&&xe.closeSync(a)}}catch(o){var i=o,r=1}finally{yt(n,i,r)}},appendFileSync(e,t,n){let i=[];try{let a=gt(i,_t`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(n?.mode!==void 0)try{let s=xe.openSync(e,"ax",n.mode);try{xe.appendFileSync(s,t)}finally{xe.closeSync(s)}return}catch(s){if(yn(s)!=="EEXIST")throw s}xe.appendFileSync(e,t)}catch(a){var r=a,o=1}finally{yt(i,r,o)}},copyFileSync(e,t){let n=[];try{let o=gt(n,_t`fs.copyFileSync(${e} ${_f} ${t})`,0);xe.copyFileSync(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}},unlinkSync(e){let t=[];try{let r=gt(t,_t`fs.unlinkSync(${e})`,0);xe.unlinkSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},renameSync(e,t){let n=[];try{let o=gt(n,_t`fs.renameSync(${e} ${_f} ${t})`,0);xe.renameSync(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}},linkSync(e,t){let n=[];try{let o=gt(n,_t`fs.linkSync(${e} ${_f} ${t})`,0);xe.linkSync(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}},symlinkSync(e,t,n){let i=[];try{let a=gt(i,_t`fs.symlinkSync(${e} ${_f} ${t})`,0);xe.symlinkSync(e,t,n)}catch(a){var r=a,o=1}finally{yt(i,r,o)}},readlinkSync(e){let t=[];try{let r=gt(t,_t`fs.readlinkSync(${e})`,0);return xe.readlinkSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},realpathSync(e){let t=[];try{let r=gt(t,_t`fs.realpathSync(${e})`,0);return cs(xe.realpathSync(e))}catch(r){var n=r,i=1}finally{yt(t,n,i)}},mkdirSync(e,t){let n=[];try{let o=gt(n,_t`fs.mkdirSync(${e})`,0),a={recursive:!0};t?.mode!==void 0&&(a.mode=t.mode);try{xe.mkdirSync(e,a)}catch(s){if(yn(s)!=="EEXIST")throw s}}catch(o){var i=o,r=1}finally{yt(n,i,r)}},readdirSync(e){let t=[];try{let r=gt(t,_t`fs.readdirSync(${e})`,0);return xe.readdirSync(e,{withFileTypes:!0})}catch(r){var n=r,i=1}finally{yt(t,n,i)}},readdirStringSync(e){let t=[];try{let r=gt(t,_t`fs.readdirStringSync(${e})`,0);return xe.readdirSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},isDirEmptySync(e){let t=[];try{let r=gt(t,_t`fs.isDirEmptySync(${e})`,0);return this.readdirSync(e).length===0}catch(r){var n=r,i=1}finally{yt(t,n,i)}},rmdirSync(e){let t=[];try{let r=gt(t,_t`fs.rmdirSync(${e})`,0);xe.rmdirSync(e)}catch(r){var n=r,i=1}finally{yt(t,n,i)}},rmSync(e,t){let n=[];try{let o=gt(n,_t`fs.rmSync(${e})`,0);xe.rmSync(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}},createWriteStream(e){return xe.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return WP(e);let n=await BP(e,"r");try{let{size:i}=await n.stat(),r=Math.min(i,t),o=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:s}=await n.read(o,a,r-a,a);if(s===0)break;a+=s}return a<r?o.subarray(0,a):o}finally{await n.close()}}},lZ=dZ;mZ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,HP=typeof String.prototype.isWellFormed=="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,zCe=typeof String.prototype.toWellFormed=="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;yZ=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,VP="[^\\s,;&}\\])]+",n$="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",_Z=`[^\\s-]{0,4}${n$}['"\`]?`,ZP=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${VP})|${_Z}|${VP}`,bZ=["sk","ant","api"].join("-"),vZ=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${yZ.source})[\\w.-]*["']?\\s*[=:]\\s*(${ZP})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${ZP})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${bZ}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:n$,flags:"i",confidence:"high"}],QP=null;N_={verbose:0,debug:1,info:2,warn:3,error:4},kZ=rn(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(N_,e)?e:"debug"}),xZ=!1;r$=rn(()=>{let e=pm();return xZ||cn(process.env.DEBUG)||cn(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||i$()||e.some(t=>t.startsWith("--debug="))||o$()!==null}),TZ=rn(()=>{let e=pm().find(n=>n.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return G8(t)}),i$=rn(()=>{let e=pm();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),o$=rn(()=>{let e=pm();for(let t=0;t<e.length;t++){let n=e[t];if(n.startsWith("--debug-file="))return YP(n.substring(13));if(n==="--debug-file"&&t+1<e.length)return YP(e[t+1])}return null});AZ=!1,EZ=10485760,dl=null,Hy=Promise.resolve(),Xa=[],bl=null,XP=null,ll=-1,Vy=!1,F_=null;$Z=rn(async()=>{try{let e=D_(),t=q_(e),n=hv(t,"latest");await j_(n).catch(()=>{}),await N8(e,n)}catch{}}),JCe=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),MZ={[Symbol.dispose](){}};_t=jZ;$r=(e,t)=>{let n=[];try{let o=gt(n,_t`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(o){var i=o,r=1}finally{yt(n,i,r)}};DZ=2e3,gp=new Set,eI=!1;L_=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=m_();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(t){this.options=t,this.abortController=t.abortController||m_(),t.deferSpawn?(this.spawnPromise=new Promise((n,i)=>{this.spawnResolve=n,this.spawnReject=i}),this.spawnPromise.catch(()=>{})):this.initialize()}spawn(){try{this.initialize()}catch(n){throw this.spawnAbort(cu(n)),n}let t=this.pendingWrites;this.pendingWrites=[],this.spawnResolve&&(this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0);for(let n of t)this.write(n);this.pendingEndInput&&(this.pendingEndInput=!1,this.processStdin?.end())}spawnAbort(t){this.spawnReject&&(this.spawnReject(t),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[])}updateEnv(t){this.options.env?Object.assign(this.options.env,t):this.options.env={...t}}updateResume(t){this.options.resume=t}getDefaultExecutable(){return QO()?"bun":"node"}spawnLocalProcess(t){let{command:n,args:i,cwd:r,env:o,signal:a}=t,s=cn(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",d=N4(n,i,{cwd:r,stdio:["pipe","pipe",s],signal:a,env:o,windowsHide:!0});return(cn(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)&&d.stderr.on("data",l=>{let u=l.toString();ir(u),this.options.stderr&&this.options.stderr(u)}),{stdin:d.stdin,stdout:d.stdout,get killed(){return d.killed},get exitCode(){return d.exitCode},kill:d.kill.bind(d),on:d.on.bind(d),once:d.once.bind(d),off:d.off.bind(d)}}initialize(){try{let{additionalDirectories:t=[],agent:n,betas:i,cwd:r,executable:o=this.getDefaultExecutable(),executableArgs:a=[],extraArgs:s={},pathToClaudeCodeExecutable:d,env:l={...process.env},thinkingConfig:u,maxTurns:c,maxBudgetUsd:p,taskBudget:f,model:h,fallbackModel:g,jsonSchema:_,permissionMode:y,allowDangerouslySkipPermissions:b,permissionPromptToolName:v,continueConversation:w,resume:A,settingSources:C,skills:S,disallowedTools:k=[],tools:T,mcpServers:E,strictMcpConfig:P,canUseTool:R,includePartialMessages:O,plugins:M,sandbox:J}=this.options,{allowedTools:Z=[]}=this.options;if(S!==void 0){let x=S==="all"?["Skill"]:S.map(N=>`Skill(${N})`),I=new Set(Z);Z=[...Z,...x.filter(N=>!I.has(N))]}let z=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(u){switch(u.type){case"enabled":u.budgetTokens===void 0?z.push("--thinking","adaptive"):z.push("--max-thinking-tokens",u.budgetTokens.toString());break;case"disabled":z.push("--thinking","disabled");break;case"adaptive":z.push("--thinking","adaptive");break}u.type!=="disabled"&&u.display&&z.push("--thinking-display",u.display)}if(this.options.effort&&z.push("--effort",this.options.effort),c&&z.push("--max-turns",c.toString()),p!==void 0&&z.push("--max-budget-usd",p.toString()),f&&z.push("--task-budget",f.total.toString()),h&&z.push("--model",h),n&&z.push("--agent",n),i&&i.length>0&&z.push("--betas",i.join(",")),_&&z.push("--json-schema",qt(_)),this.options.debugFile?z.push("--debug-file",this.options.debugFile):this.options.debug&&z.push("--debug"),!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let x=iV();x&&z.push("--debug-file",x)}if(R){if(v)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");z.push("--permission-prompt-tool","stdio")}else v&&z.push("--permission-prompt-tool",v);if(w&&z.push("--continue"),A&&z.push("--resume",A),this.options.channels&&this.options.channels.length>0&&z.push("--channels",...this.options.channels),Z.length>0&&z.push("--allowedTools",Z.join(",")),k.length>0&&z.push("--disallowedTools",k.join(",")),T!==void 0&&(Array.isArray(T)?T.length===0?z.push("--tools",""):z.push("--tools",T.join(",")):z.push("--tools","default")),E&&Object.keys(E).length>0&&z.push("--mcp-config",qt({mcpServers:E})),C!==void 0&&z.push(`--setting-sources=${C.join(",")}`),P&&z.push("--strict-mcp-config"),y&&z.push("--permission-mode",y),b&&z.push("--allow-dangerously-skip-permissions"),g){if(h&&g===h)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");z.push("--fallback-model",g)}this.options.includeHookEvents&&z.push("--include-hook-events"),O&&z.push("--include-partial-messages"),this.options.sessionMirror&&z.push("--session-mirror");for(let x of t)z.push("--add-dir",x);if(M&&M.length>0)for(let x of M)if(x.type==="local")z.push(x.skipMcpDiscovery?"--plugin-dir-no-mcp":"--plugin-dir",x.path);else throw Error(`Unsupported plugin type: ${x.type}`);this.options.forkSession&&z.push("--fork-session"),this.options.resumeSessionAt&&z.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&z.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&z.push("--no-session-persistence"),this.options.managedSettings&&z.push("--managed-settings",this.options.managedSettings);let X={...s??{}};this.options.settings&&(X.settings=this.options.settings);let ee=FZ(X,J);for(let[x,I]of Object.entries(ee))I===null?z.push(`--${x}`):z.push(`--${x}`,I);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,cn(l.DEBUG_CLAUDE_AGENT_SDK)?l.DEBUG="1":delete l.DEBUG;let B=GZ(d),$=B?d:o,K=B?[...a,...z]:[...a,d,...z],F={command:$,args:K,cwd:r,env:l,signal:this.forwardedAbort.signal};this.options.spawnClaudeCodeProcess?(ir(`Spawning Claude Code (custom): ${$} ${K.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(F)):(ir(`Spawning Claude Code: ${$} ${K.join(" ")}`),this.process=this.spawnLocalProcess(F)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,UZ(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted&&this.close(),this.process.on("error",x=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new En("Claude Code process aborted by user");else if(qH(x)){let I=zZ(d,B);this.exitError=ReferenceError(I),ir(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${x.message}`),ir(this.exitError.message)}),this.process.on("exit",(x,I)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new En("Claude Code process aborted by user");else{let N=this.getProcessExitError(x,I);N&&(this.exitError=N,ir(N.message))}}),this.ready=!this.abortController.signal.aborted}catch(t){throw this.ready=!1,t}}getProcessExitError(t,n){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);if(n)return Error(`Claude Code process terminated by signal ${n}`)}write(t){if(this.abortController.signal.aborted)throw new En("Operation aborted");if(this.spawnResolve){this.pendingWrites.push(t);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){ir("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);ir(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{this.processStdin.write(t)||ir("[ProcessTransport] Write buffer full, data queued")}catch(n){throw this.ready=!1,Error(`Failed to write to process stdin: ${Ef(n)}`)}}[Symbol.dispose](){this.close()}close(){this.spawnAbort(this.abortController.signal.aborted?new En("Claude Code process aborted by user"):Error("Query closed before spawn")),this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:i}of this.exitListeners)this.process?.off("exit",i);this.exitListeners=[];let t=()=>{this.abortController.signal.aborted&&this.forwardedAbort.abort(this.abortController.signal.reason)},n=this.process;n&&!n.killed&&n.exitCode===null?(setTimeout((i,r)=>{if(i.exitCode!==null){r();return}if(process.platform==="win32"){setTimeout((o,a)=>{o.exitCode===null&&o.kill("SIGKILL"),a()},5e3,i,r).unref();return}i.kill("SIGTERM"),setTimeout(o=>{o.exitCode===null&&o.kill("SIGKILL")},5e3,i).unref(),r()},DZ,n,t).unref(),n.once("exit",()=>gp.delete(n))):n&&(gp.delete(n),t()),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise&&(await this.spawnPromise,this.spawnPromise=void 0),!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let t=D4({input:this.processStdout}),n=this.process?(()=>{let i=this.process,r=()=>t.close();return i.on("error",r),()=>i.off("error",r)})():void 0;this.exitError&&t.close();try{for await(let i of t)if(i.trim()){let r;try{r=$r(i)}catch{ir(`Non-JSON stdout: ${i}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(i){throw i}finally{n?.(),t.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let n=(i,r)=>{let o=this.getProcessExitError(i,r);t(o)};return this.process.on("exit",n),this.exitListeners.push({callback:t,handler:n}),()=>{this.process&&this.process.off("exit",n);let i=this.exitListeners.findIndex(r=>r.handler===n);i!==-1&&this.exitListeners.splice(i,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((t,n)=>{let i=(o,a)=>{if(this.abortController.signal.aborted){n(new En("Operation aborted"));return}let s=this.getProcessExitError(o,a);s?n(s):t()};this.process.once("exit",i);let r=o=>{this.process.off("exit",i),n(o)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}};Ha="@anthropic-ai/claude-agent-sdk";yp=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((t,n)=>{this.readResolve=t,this.readReject=n})}enqueue(t){if(this.readResolve){let n=this.readResolve;this.readResolve=void 0,this.readReject=void 0,n({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let n=this.readReject;this.readResolve=void 0,this.readReject=void 0,n(t)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}};HZ=WZ();U_=class{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},Zy=Symbol("suppressControlResponse"),G_=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new yp;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(t){this.isSingleUserTurn=t}setTranscriptMirrorBatcher(t){this.transcriptMirrorBatcher=t}reportMirrorError(t,n){let i={type:"system",subtype:"mirror_error",error:n,key:t,uuid:M_(),session_id:t.sessionId};this.inputStream.enqueue(i)}addCleanupCallback(t){this.cleanupPerformed?t():this.cleanupCallbacks.push(t)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(t,n,i,r,o,a=new Map,s,d,l,u,c,p){this.transport=t,this.isSingleUserTurn=n,this.canUseTool=i,this.hooks=r,this.abortController=o,this.jsonSchema=s,this.initConfig=d,this.onElicitation=l,this.getOAuthToken=u,this.getHostAuthToken=c,this.onUserDialog=p;for(let[f,h]of a)this.connectSdkMcpServer(f,h);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}async backgroundTasks(t){return(await this.request({subtype:"background_tasks",tool_use_id:t})).response.backgrounded??!0}close(){this.cleanup()}cleanup(t){return this.cleanupPromise?this.cleanupPromise:(this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(t),this.cleanupPromise)}async performCleanup(t){for(let n of this.cleanupCallbacks)try{n()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let i of this.cancelControllers.values())i.abort();this.cancelControllers.clear(),this.transport.close();let n=t??Error("Query closed before response received");for(let{reject:i}of this.pendingControlResponses.values())i(n);this.pendingControlResponses.clear();for(let{reject:i}of this.pendingMcpResponses.values())i(n);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let i of this.sdkMcpTransports.values())i.close().catch(()=>{});this.sdkMcpTransports.clear(),t?this.inputStream.error(t):this.inputStream.done()}catch{}if(this.transport.waitForExit){let n=new AbortController;try{await Promise.race([this.transport.waitForExit(),rm(2e3,n.signal)])}catch{}finally{n.abort()}}}next(...[t]){return this.sdkMessages.next(t)}async return(t){return await this.cleanup(),this.sdkMessages.return(t)}async throw(t){return await this.cleanup(),this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let n=this.pendingControlResponses.get(t.response.request_id);n&&n.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else{if(t.type==="keep_alive")continue;if(t.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(t.filePath,t.entries);continue}}if(t.type==="system"&&(t.subtype==="post_turn_summary"||t.subtype==="task_summary")){this.inputStream.enqueue(t);continue}if(t.type==="active_goal"){this.inputStream.enqueue(t);continue}t.type==="result"?(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.lastErrorResultText=t.is_error?t.subtype==="success"?t.result:t.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(ze("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())):t.type==="system"&&t.subtype==="session_state_changed"||(this.lastErrorResultText=void 0),this.inputStream.enqueue(t)}this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(t){if(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.lastErrorResultText!==void 0&&!(t instanceof En)){let n=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);ze(`[Query.readMessages] Replacing exit error with result text. Original: ${Ef(t)}`),this.inputStream.error(n),this.cleanup(n);return}this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){if(this.cancelControllers.has(t.request_id)){ze(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${t.request_id} (${t.request.subtype}) \u2014 skipping`);return}let n=new AbortController;this.cancelControllers.set(t.request_id,n);try{let i=await this.processControlRequest(t,n.signal);if(this.cleanupPerformed||i===Zy)return;let r={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:i}};await Promise.resolve(this.transport.write(qt(r)+`
232
- `))}catch(i){if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"error",request_id:t.request_id,error:Ef(i)}};try{await Promise.resolve(this.transport.write(qt(r)+`
233
- `))}catch(o){ze(`[Query.handleControlRequest] Error-response write failed: ${Ef(o)}`,{level:"error"})}}finally{this.cancelControllers.delete(t.request_id)}}handleControlCancelRequest(t){let n=this.cancelControllers.get(t.request_id);n&&(n.abort(),this.cancelControllers.delete(t.request_id))}async processControlRequest(t,n){if(t.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let i=await this.canUseTool(t.request.tool_name,t.request.input,{signal:n,suggestions:t.request.permission_suggestions,blockedPath:t.request.blocked_path,decisionReason:t.request.decision_reason,title:t.request.title,displayName:t.request.display_name,description:t.request.description,toolUseID:t.request.tool_use_id,agentID:t.request.agent_id,requestId:t.request_id});return i===null?Zy:{...i,toolUseID:t.request.tool_use_id}}else{if(t.request.subtype==="hook_callback")return await this.handleHookCallbacks(t.request.callback_id,t.request.input,t.request.tool_use_id,n);if(t.request.subtype==="mcp_message"){let i=t.request,r=this.sdkMcpTransports.get(i.server_name);if(!r)throw Error(`SDK MCP server not found: ${i.server_name}`);return"method"in i.message&&"id"in i.message&&i.message.id!==null?{mcp_response:await this.handleMcpControlRequest(i.server_name,i,r)}:(r.onmessage&&r.onmessage(i.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}else if(t.request.subtype==="elicitation"){let i=t.request;return this.onElicitation?await this.onElicitation({serverName:i.mcp_server_name,message:i.message,mode:i.mode,url:i.url,elicitationId:i.elicitation_id,requestedSchema:i.requested_schema,title:i.title,displayName:i.display_name,description:i.description},{signal:n}):{action:"decline"}}else{if(t.request.subtype==="request_user_dialog")return this.onUserDialog?await this.onUserDialog({dialogKind:t.request.dialog_kind,payload:t.request.payload,toolUseID:t.request.tool_use_id},{signal:n}):(ze(`[Query] No onUserDialog handler for request_user_dialog (kind=${t.request.dialog_kind}) \u2014 staying silent so a capable client (or the worker's park deadline) settles it`),mm("tengu_request_user_dialog_response_ignored",{shape:lm("auto_cancel")}),Zy);if(t.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:n})??null}}else if(t.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:n})??null}}}}throw Error("Unsupported control request subtype: "+t.request.subtype)}async*readSdkMessages(){try{for await(let t of this.inputStream)yield t}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[i,r]of Object.entries(this.hooks))r.length>0&&(this.initHooksPayload[i]=r.map(o=>{let a=[];for(let s of o.hooks){let d=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(d,s),a.push(d)}return{matcher:o.matcher,hookCallbackIds:a,timeout:o.timeout}}))}let t=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,n={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:t,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt=="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds};return(await this.request(n)).response}async interrupt(){return kr("sdk_interrupt",async()=>{await this.request({subtype:"interrupt"})})}async setPermissionMode(t){await this.request({subtype:"set_permission_mode",mode:t})}async setMcpPermissionModeOverride(t,n){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:t,mode:n})).response??{}}async setModel(t){await this.request({subtype:"set_model",model:t})}async setMaxThinkingTokens(t,n){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:t,thinking_display:n})}async applyFlagSettings(t){return kr("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:t})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(t,n){return kr("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:t,dry_run:n?.dryRun})).response)}async cancelAsyncMessage(t){return(await this.request({subtype:"cancel_async_message",message_uuid:t})).response.cancelled}async seedReadState(t,n){await this.request({subtype:"seed_read_state",path:t,mtime:n})}async enableRemoteControl(t,n){return(await this.request({subtype:"remote_control",enabled:t,...n!==void 0&&{name:n}})).response}async submitFeedback(t,n){return(await this.request({subtype:"submit_feedback",description:t,surface:n?.surface})).response}async generateSessionTitle(t,n){return kr("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:t,persist:n?.persist})).response.title)}async askSideQuestion(t){return kr("sdk_side_question",async()=>{let n=(await this.request({subtype:"side_question",question:t})).response;return n.response===null?null:{response:n.response,synthetic:n.synthetic??!1}})}async launchUltrareview(t,n){return(await this.request({subtype:"ultrareview_launch",args:t,confirm:n?.confirm??!1})).response}async messageRated(t){await this.request({subtype:"message_rated",messageUuid:t.messageUuid,sentiment:t.sentiment,surface:t.surface,cleared:t.cleared??!1})}processPendingPermissionRequests(t){for(let n of t)n.request.subtype==="can_use_tool"&&this.handleControlRequest(n).catch(()=>{})}processPendingUserDialogRequests(t){for(let n of t)n.request.subtype==="request_user_dialog"&&this.handleControlRequest(n).catch(()=>{})}request(t){let n=Math.random().toString(36).substring(2,15),i={request_id:n,type:"control_request",request:t},r=t.subtype==="initialize";return new Promise((o,a)=>{this.pendingControlResponses.set(n,{handler:s=>{this.pendingControlResponses.delete(n),s.subtype==="success"?o(s):a(Error(s.error)),!r&&(s.pending_permission_requests||s.pending_user_dialog_requests)?ze(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${t.subtype})`):(s.pending_permission_requests&&this.processPendingPermissionRequests(s.pending_permission_requests),s.pending_user_dialog_requests&&this.processPendingUserDialogRequests(s.pending_user_dialog_requests))},reject:a}),Promise.resolve(this.transport.write(qt(i)+`
234
- `)).catch(s=>{this.pendingControlResponses.delete(n),a(s)})})}initializationResult(){return this.initialization}reinitialize(){return kr("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(t){await this.request({subtype:"mcp_reconnect",serverName:t})}async toggleMcpServer(t,n){return kr("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:t,enabled:n})})}async enableChannel(t){return kr("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:t})})}async mcpAuthenticate(t,n){return(await this.request({subtype:"mcp_authenticate",serverName:t,redirectUri:n})).response}async mcpClearAuth(t){return(await this.request({subtype:"mcp_clear_auth",serverName:t})).response}async mcpSubmitOAuthCallbackUrl(t,n){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:t,callbackUrl:n})).response}async claudeAuthenticate(t){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:t})).response}async claudeOAuthCallback(t,n){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:t,state:n})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(t,n){try{return(await this.request({subtype:"read_file",path:t,max_bytes:n?.maxBytes,encoding:n?.encoding})).response}catch{return null}}async reloadPlugins(){return kr("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return kr("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(t){return kr("sdk_mcp_set_servers",async()=>{let n={},i={};for(let[s,d]of Object.entries(t))d.type==="sdk"&&"instance"in d?n[s]=d.instance:i[s]=d;let r=new Set(this.sdkMcpServerInstances.keys()),o=new Set(Object.keys(n));for(let s of r)o.has(s)||await this.disconnectSdkMcpServer(s);for(let[s,d]of Object.entries(n))r.has(s)||this.connectSdkMcpServer(s,d);let a={};for(let s of Object.keys(n))a[s]={type:"sdk",name:s};return(await this.request({subtype:"mcp_set_servers",servers:{...i,...a}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(t){ze("[Query.streamInput] Starting to process input stream");try{let n=0;for await(let i of t){if(n++,ze(`[Query.streamInput] Processing message ${n}: ${i.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(qt(i)+`
235
- `))}ze(`[Query.streamInput] Finished processing ${n} messages from input stream`),n>0&&this.hasBidirectionalNeeds()&&(ze("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult()),ze("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(n){if(!(n instanceof En))throw n}}waitForFirstResult(){return this.firstResultReceived?(ze("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve()):new Promise(t=>{if(this.abortController?.signal.aborted){t();return}this.abortController?.signal.addEventListener("abort",()=>t(),{once:!0}),this.firstResultReceivedResolve=t})}handleHookCallbacks(t,n,i,r){let o=this.hookCallbacks.get(t);if(!o)throw Error(`No hook callback found for ID: ${t}`);return o(n,i,{signal:r})}connectSdkMcpServer(t,n){let i=new U_(r=>this.sendMcpServerMessageToCli(t,r));this.sdkMcpTransports.set(t,i),this.sdkMcpServerInstances.set(t,n),n.connect(i).catch(r=>{this.sdkMcpTransports.get(t)===i&&this.sdkMcpTransports.delete(t),this.sdkMcpServerInstances.get(t)===n&&this.sdkMcpServerInstances.delete(t),ze(`[Query.connectSdkMcpServer] Failed to connect MCP server '${t}': ${r}`,{level:"error"})})}async disconnectSdkMcpServer(t){let n=this.sdkMcpTransports.get(t);n&&(await n.close(),this.sdkMcpTransports.delete(t)),this.sdkMcpServerInstances.delete(t)}sendMcpServerMessageToCli(t,n){if("id"in n&&n.id!==null&&n.id!==void 0){let r=`${t}:${n.id}`,o=this.pendingMcpResponses.get(r);if(o){o.resolve(n),this.pendingMcpResponses.delete(r);return}}let i={type:"control_request",request_id:M_(),request:{subtype:"mcp_message",server_name:t,message:n}};Promise.resolve(this.transport.write(qt(i)+`
236
- `)).catch(r=>{ze(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(t,n,i){let r="id"in n.message?n.message.id:null,o=`${t}:${r}`;return new Promise((a,s)=>{let d=()=>{this.pendingMcpResponses.delete(o)},l=c=>{d(),a(c)},u=c=>{d(),s(c)};if(this.pendingMcpResponses.set(o,{resolve:l,reject:u}),i.onmessage)i.onmessage(n.message);else{d(),s(Error("No message handler registered"));return}})}},gv=500,yv=1048576,ZZ=[200,800],z_=class{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(t,n=6e4,i,r=gv,o=yv,a=ZZ){this.send=t,this.sendTimeoutMs=n,this.onError=i,this.maxPendingEntries=r,this.maxPendingBytes=o,this.backoffMs=a}enqueue(t,n){let i=qt(n).length;this.pending.push({filePath:t,entries:n,bytes:i}),this.pendingEntries+=n.length,this.pendingBytes+=i,(this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)&&(this.flushPromise=this.drain(),this.flushPromise.catch(()=>{}))}async flush(){let t=this.drain();this.flushPromise=t,await t,this.flushPromise===t&&(this.flushPromise=null)}async drain(){let t=this.flushPromise,n=this.pending.splice(0);this.pendingEntries=0,this.pendingBytes=0,t&&await t,n.length!==0&&await this.doFlush(n)}async doFlush(t){let n=new Map;for(let r of t){let o=n.get(r.filePath);o?o.push(...r.entries):n.set(r.filePath,r.entries.slice())}let i=this.backoffMs.length+1;for(let[r,o]of n){let a=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${r}`,s,d=1;for(;d<=i;d++)try{await qo(this.send(r,o),this.sendTimeoutMs,a),s=void 0;break}catch(l){if(s=cu(l),s.message===a)break;let u=this.backoffMs[d-1];if(u===void 0)break;await rm(u)}if(s){ze(`[TranscriptMirrorBatcher] flush failed for ${r} after ${d} attempt(s): ${s}`,{level:"error"});try{this.onError?.(r,s)}catch(l){ze(`[TranscriptMirrorBatcher] onError callback threw: ${l}`,{level:"error"})}}}}},tI=jb(TB(),1);Va=new Map,u7=5e3;c7=new Set([".com",".exe",".bat",".cmd"]);g7=o7(i7);vi=65536,_7=new Set(["sdk-cli","sdk-ts","sdk-py"]);v7=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Ul=200;C7=1048576,A7=5242880;bp=Buffer.from('{"type":"attribution-snapshot"'),I7=Buffer.from('{"type":"system"'),Gl=10,O7=Buffer.from([Gl]),R7=256;iI=524288,oI=8192;V7=32;uQ=new Set(["user","assistant","attachment","system","progress"]);TQ="user:inference",E$="user:profile",CQ="org:create_api_key",AQ=[CQ,E$],EQ=[E$,TQ,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],yAe=A$([...AQ,...EQ]),PQ=["user:design:read","user:design:write"],_Ae=[...PQ,"user:projects:read","user:projects:write"],lI={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",DESIGN_CLIENT_ID:"59637612-477b-4836-a601-b0589eda7704",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"},IQ=void 0;RQ=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];MQ="-credentials";qQ=/^[a-zA-Z0-9._-]+$/;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw Error()}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let a of r)o[a]=a;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of o)a[s]=r[s];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(o){return r[o]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let o=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&o.push(a);return o},e.find=(r,o)=>{for(let a of r)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Ne||(Ne={}));(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(uI||(uI={}));fe=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ji=e=>{switch(typeof e){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return Number.isNaN(e)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(e)?fe.array:e===null?fe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?fe.promise:typeof Map<"u"&&e instanceof Map?fe.map:typeof Set<"u"&&e instanceof Set?fe.set:typeof Date<"u"&&e instanceof Date?fe.date:fe.object;default:return fe.unknown}},te=Ne.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"]),dr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let s=i,d=0;for(;d<a.path.length;){let l=a.path[d];d!==a.path.length-1?s[l]=s[l]||{_errors:[]}:(s[l]=s[l]||{_errors:[]},s[l]._errors.push(n(a))),s=s[l],d++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},i=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];n[o]=n[o]||[],n[o].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};dr.create=e=>new dr(e);LQ=(e,t)=>{let n;switch(e.code){case te.invalid_type:e.received===fe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case te.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case te.invalid_union:n="Invalid input";break;case te.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case te.invalid_enum_value:n=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case te.invalid_arguments:n="Invalid function arguments";break;case te.invalid_return_type:n="Invalid function return type";break;case te.invalid_date:n="Invalid date";break;case te.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ne.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case te.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case te.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case te.custom:n="Invalid input";break;case te.invalid_intersection_types:n="Intersection results could not be merged";break;case te.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case te.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ne.assertNever(e)}return{message:n}},zl=LQ,UQ=zl;V_=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],a={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let s="",d=i.filter(l=>!!l).slice().reverse();for(let l of d)s=l(a,{data:t,defaultError:s}).message;return{...r,path:o,message:s}};vn=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return ke;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let o=await r.key,a=await r.value;i.push({key:o,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:a}=r;if(o.status==="aborted"||a.status==="aborted")return ke;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[o.value]=a.value)}return{status:t.value,value:i}}},ke=Object.freeze({status:"aborted"}),Sl=e=>({status:"dirty",value:e}),On=e=>({status:"valid",value:e}),cI=e=>e.status==="aborted",fI=e=>e.status==="dirty",ys=e=>e.status==="valid",vp=e=>typeof Promise<"u"&&e instanceof Promise;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));cr=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pI=(e,t)=>{if(ys(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new dr(e.common.issues);return this._error=n,this._error}}};Ie=class{get description(){return this._def.description}_getType(t){return Ji(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ji(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new vn,ctx:{common:t.parent.common,data:t.data,parsedType:Ji(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(vp(n))throw Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ji(t)},r=this._parseSync({data:t,path:i.path,parent:i});return pI(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ji(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return ys(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ys(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ji(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(vp(r)?r:Promise.resolve(r));return pI(i,o)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,o)=>{let a=t(r),s=()=>o.addIssue({code:te.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Pr({schema:this,typeName:oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:n=>this["~validate"](n)}}optional(){return lr.create(this,this._def)}nullable(){return xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xi.create(this)}promise(){return Jo.create(this,this._def)}or(t){return Ss.create([this,t],this._def)}and(t){return ws.create(this,t,this._def)}transform(t){return new Pr({...Ae(this._def),schema:this,typeName:oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new As({...Ae(this._def),innerType:this,defaultValue:n,typeName:oe.ZodDefault})}brand(){return new Sp({typeName:oe.ZodBranded,type:this,...Ae(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Es({...Ae(this._def),innerType:this,catchValue:n,typeName:oe.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return wp.create(this,t)}readonly(){return Ps.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},GQ=/^c[^\s-]{8,}$/i,zQ=/^[0-9a-z]+$/,JQ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KQ=/^[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,BQ=/^[a-z0-9_-]{21}$/i,WQ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,HQ=/^[-+]?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)?)??$/,VQ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ZQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",QQ=/^(?:(?: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])$/,YQ=/^(?:(?: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])$/,XQ=/^(([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]))$/,eY=/^(([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])$/,tY=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nY=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,P$="((\\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])))",rY=new RegExp(`^${P$}$`);_s=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==fe.string){let r=this._getOrReturnCtx(t);return le(r,{code:te.invalid_type,expected:fe.string,received:r.parsedType}),ke}let n=new vn,i;for(let r of this._def.checks)if(r.kind==="min")t.data.length<r.value&&(i=this._getOrReturnCtx(t,i),le(i,{code:te.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")t.data.length>r.value&&(i=this._getOrReturnCtx(t,i),le(i,{code:te.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){let o=t.data.length>r.value,a=t.data.length<r.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?le(i,{code:te.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&le(i,{code:te.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")VQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"email",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Xy||(Xy=new RegExp(ZQ,"u")),Xy.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"emoji",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")KQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"uuid",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")BQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"nanoid",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")GQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"cuid",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")zQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"cuid2",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")JQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"ulid",code:te.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),le(i,{validation:"url",code:te.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,!r.regex.test(t.data)&&(i=this._getOrReturnCtx(t,i),le(i,{validation:"regex",code:te.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?t.data=t.data.trim():r.kind==="includes"?t.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?t.data=t.data.toLowerCase():r.kind==="toUpperCase"?t.data=t.data.toUpperCase():r.kind==="startsWith"?t.data.startsWith(r.value)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?t.data.endsWith(r.value)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?oY(r).test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?rY.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?iY(r).test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{code:te.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?HQ.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"duration",code:te.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?aY(t.data,r.version)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"ip",code:te.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?sY(t.data,r.alg)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"jwt",code:te.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?dY(t.data,r.version)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"cidr",code:te.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?tY.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"base64",code:te.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?nY.test(t.data)||(i=this._getOrReturnCtx(t,i),le(i,{validation:"base64url",code:te.invalid_string,message:r.message}),n.dirty()):Ne.assertNever(r);return{status:n.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:te.invalid_string,...ge.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ge.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...ge.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ge.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ge.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ge.errToObj(n)})}nonempty(t){return this.min(1,ge.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};_s.create=e=>new _s({checks:[],typeName:oe.ZodString,coerce:e?.coerce??!1,...Ae(e)});Jl=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==fe.number){let r=this._getOrReturnCtx(t);return le(r,{code:te.invalid_type,expected:fe.number,received:r.parsedType}),ke}let n,i=new vn;for(let r of this._def.checks)r.kind==="int"?Ne.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),le(n,{code:te.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?lY(t.data,r.value)!==0&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),le(n,{code:te.not_finite,message:r.message}),i.dirty()):Ne.assertNever(r);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:ge.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ne.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Jl.create=e=>new Jl({checks:[],typeName:oe.ZodNumber,coerce:e?.coerce||!1,...Ae(e)});Kl=class e extends Ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==fe.bigint)return this._getInvalidInput(t);let n,i=new vn;for(let r of this._def.checks)r.kind==="min"?(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),le(n,{code:te.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Ne.assertNever(r);return{status:i.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.bigint,received:n.parsedType}),ke}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:ge.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Kl.create=e=>new Kl({checks:[],typeName:oe.ZodBigInt,coerce:e?.coerce??!1,...Ae(e)});Bl=class extends Ie{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==fe.boolean){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.boolean,received:n.parsedType}),ke}return On(t.data)}};Bl.create=e=>new Bl({typeName:oe.ZodBoolean,coerce:e?.coerce||!1,...Ae(e)});Wl=class e extends Ie{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==fe.date){let r=this._getOrReturnCtx(t);return le(r,{code:te.invalid_type,expected:fe.date,received:r.parsedType}),ke}if(Number.isNaN(t.data.getTime())){let r=this._getOrReturnCtx(t);return le(r,{code:te.invalid_date}),ke}let n=new vn,i;for(let r of this._def.checks)r.kind==="min"?t.data.getTime()<r.value&&(i=this._getOrReturnCtx(t,i),le(i,{code:te.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?t.data.getTime()>r.value&&(i=this._getOrReturnCtx(t,i),le(i,{code:te.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):Ne.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ge.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ge.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Wl.create=e=>new Wl({checks:[],coerce:e?.coerce||!1,typeName:oe.ZodDate,...Ae(e)});Hl=class extends Ie{_parse(t){if(this._getType(t)!==fe.symbol){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.symbol,received:n.parsedType}),ke}return On(t.data)}};Hl.create=e=>new Hl({typeName:oe.ZodSymbol,...Ae(e)});bs=class extends Ie{_parse(t){if(this._getType(t)!==fe.undefined){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.undefined,received:n.parsedType}),ke}return On(t.data)}};bs.create=e=>new bs({typeName:oe.ZodUndefined,...Ae(e)});vs=class extends Ie{_parse(t){if(this._getType(t)!==fe.null){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.null,received:n.parsedType}),ke}return On(t.data)}};vs.create=e=>new vs({typeName:oe.ZodNull,...Ae(e)});Vl=class extends Ie{constructor(){super(...arguments),this._any=!0}_parse(t){return On(t.data)}};Vl.create=e=>new Vl({typeName:oe.ZodAny,...Ae(e)});Zi=class extends Ie{constructor(){super(...arguments),this._unknown=!0}_parse(t){return On(t.data)}};Zi.create=e=>new Zi({typeName:oe.ZodUnknown,...Ae(e)});Yr=class extends Ie{_parse(t){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.never,received:n.parsedType}),ke}};Yr.create=e=>new Yr({typeName:oe.ZodNever,...Ae(e)});Zl=class extends Ie{_parse(t){if(this._getType(t)!==fe.undefined){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.void,received:n.parsedType}),ke}return On(t.data)}};Zl.create=e=>new Zl({typeName:oe.ZodVoid,...Ae(e)});Xi=class e extends Ie{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==fe.array)return le(n,{code:te.invalid_type,expected:fe.array,received:n.parsedType}),ke;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,s=n.data.length<r.exactLength.value;(a||s)&&(le(n,{code:a?te.too_big:te.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(le(n,{code:te.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(le(n,{code:te.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>r.type._parseAsync(new cr(n,a,n.path,s)))).then(a=>vn.mergeArray(i,a));let o=[...n.data].map((a,s)=>r.type._parseSync(new cr(n,a,n.path,s)));return vn.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ge.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ge.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:ge.toString(n)}})}nonempty(t){return this.min(1,t)}};Xi.create=(e,t)=>new Xi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oe.ZodArray,...Ae(t)});Bn=class e extends Ie{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ne.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==fe.object){let d=this._getOrReturnCtx(t);return le(d,{code:te.invalid_type,expected:fe.object,received:d.parsedType}),ke}let{status:n,ctx:i}=this._processInputParams(t),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Yr&&this._def.unknownKeys==="strip"))for(let d in i.data)o.includes(d)||a.push(d);let s=[];for(let d of o){let l=r[d],u=i.data[d];s.push({key:{status:"valid",value:d},value:l._parse(new cr(i,u,i.path,d)),alwaysSet:d in i.data})}if(this._def.catchall instanceof Yr){let d=this._def.unknownKeys;if(d==="passthrough")for(let l of a)s.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(d==="strict")a.length>0&&(le(i,{code:te.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let l of a){let u=i.data[l];s.push({key:{status:"valid",value:l},value:d._parse(new cr(i,u,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let d=[];for(let l of s){let u=await l.key,c=await l.value;d.push({key:u,value:c,alwaysSet:l.alwaysSet})}return d}).then(d=>vn.mergeObjectSync(n,d)):vn.mergeObjectSync(n,s)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:ge.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:oe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ne.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of Ne.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return es(this)}partial(t){let n={};for(let i of Ne.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of Ne.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof lr;)r=r._def.innerType;n[i]=r}return new e({...this._def,shape:()=>n})}keyof(){return O$(Ne.objectKeys(this.shape))}};Bn.create=(e,t)=>new Bn({shape:()=>e,unknownKeys:"strip",catchall:Yr.create(),typeName:oe.ZodObject,...Ae(t)});Bn.strictCreate=(e,t)=>new Bn({shape:()=>e,unknownKeys:"strict",catchall:Yr.create(),typeName:oe.ZodObject,...Ae(t)});Bn.lazycreate=(e,t)=>new Bn({shape:e,unknownKeys:"strip",catchall:Yr.create(),typeName:oe.ZodObject,...Ae(t)});Ss=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new dr(s.ctx.common.issues));return le(n,{code:te.invalid_union,unionErrors:a}),ke}if(n.common.async)return Promise.all(i.map(async o=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let o,a=[];for(let d of i){let l={...n,common:{...n.common,issues:[]},parent:null},u=d._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(d=>new dr(d));return le(n,{code:te.invalid_union,unionErrors:s}),ke}}get options(){return this._def.options}};Ss.create=(e,t)=>new Ss({options:e,typeName:oe.ZodUnion,...Ae(t)});yi=e=>e instanceof ks?yi(e.schema):e instanceof Pr?yi(e.innerType()):e instanceof xs?[e.value]:e instanceof Ts?e.options:e instanceof Cs?Ne.objectValues(e.enum):e instanceof As?yi(e._def.innerType):e instanceof bs?[void 0]:e instanceof vs?[null]:e instanceof lr?[void 0,...yi(e.unwrap())]:e instanceof xi?[null,...yi(e.unwrap())]:e instanceof Sp||e instanceof Ps?yi(e.unwrap()):e instanceof Es?yi(e._def.innerType):[],Z_=class e extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.object)return le(n,{code:te.invalid_type,expected:fe.object,received:n.parsedType}),ke;let i=this.discriminator,r=n.data[i],o=this.optionsMap.get(r);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(le(n,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ke)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let o of n){let a=yi(o.shape[t]);if(!a.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);r.set(s,o)}}return new e({typeName:oe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ae(i)})}};ws=class extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,a)=>{if(cI(o)||cI(a))return ke;let s=Q_(o.value,a.value);return s.valid?((fI(o)||fI(a))&&n.dirty(),{status:n.value,value:s.data}):(le(i,{code:te.invalid_intersection_types}),ke)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>r(o,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};ws.create=(e,t,n)=>new ws({left:e,right:t,typeName:oe.ZodIntersection,...Ae(n)});ki=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==fe.array)return le(i,{code:te.invalid_type,expected:fe.array,received:i.parsedType}),ke;if(i.data.length<this._def.items.length)return le(i,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ke;!this._def.rest&&i.data.length>this._def.items.length&&(le(i,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let r=[...i.data].map((o,a)=>{let s=this._def.items[a]||this._def.rest;return s?s._parse(new cr(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(r).then(o=>vn.mergeArray(n,o)):vn.mergeArray(n,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ki.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ki({items:e,typeName:oe.ZodTuple,rest:null,...Ae(t)})};Y_=class e extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==fe.object)return le(i,{code:te.invalid_type,expected:fe.object,received:i.parsedType}),ke;let r=[],o=this._def.keyType,a=this._def.valueType;for(let s in i.data)r.push({key:o._parse(new cr(i,s,i.path,s)),value:a._parse(new cr(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?vn.mergeObjectAsync(n,r):vn.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ie?new e({keyType:t,valueType:n,typeName:oe.ZodRecord,...Ae(i)}):new e({keyType:_s.create(),valueType:t,typeName:oe.ZodRecord,...Ae(n)})}},Ql=class extends Ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==fe.map)return le(i,{code:te.invalid_type,expected:fe.map,received:i.parsedType}),ke;let r=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([s,d],l)=>({key:r._parse(new cr(i,s,i.path,[l,"key"])),value:o._parse(new cr(i,d,i.path,[l,"value"]))}));if(i.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let d of a){let l=await d.key,u=await d.value;if(l.status==="aborted"||u.status==="aborted")return ke;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let d of a){let{key:l,value:u}=d;if(l.status==="aborted"||u.status==="aborted")return ke;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}}}};Ql.create=(e,t,n)=>new Ql({valueType:t,keyType:e,typeName:oe.ZodMap,...Ae(n)});Yl=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==fe.set)return le(i,{code:te.invalid_type,expected:fe.set,received:i.parsedType}),ke;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(le(i,{code:te.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(le(i,{code:te.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function a(d){let l=new Set;for(let u of d){if(u.status==="aborted")return ke;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let s=[...i.data.values()].map((d,l)=>o._parse(new cr(i,d,i.path,l)));return i.common.async?Promise.all(s).then(d=>a(d)):a(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:ge.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ge.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Yl.create=(e,t)=>new Yl({valueType:e,minSize:null,maxSize:null,typeName:oe.ZodSet,...Ae(t)});X_=class e extends Ie{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.function)return le(n,{code:te.invalid_type,expected:fe.function,received:n.parsedType}),ke;function i(s,d){return V_({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H_(),zl].filter(l=>!!l),issueData:{code:te.invalid_arguments,argumentsError:d}})}function r(s,d){return V_({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,H_(),zl].filter(l=>!!l),issueData:{code:te.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Jo){let s=this;return On(async function(...d){let l=new dr([]),u=await s._def.args.parseAsync(d,o).catch(p=>{throw l.addIssue(i(d,p)),l}),c=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(c,o).catch(p=>{throw l.addIssue(r(c,p)),l})})}else{let s=this;return On(function(...d){let l=s._def.args.safeParse(d,o);if(!l.success)throw new dr([i(d,l.error)]);let u=Reflect.apply(a,this,l.data),c=s._def.returns.safeParse(u,o);if(!c.success)throw new dr([r(u,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ki.create(t).rest(Zi.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||ki.create([]).rest(Zi.create()),returns:n||Zi.create(),typeName:oe.ZodFunction,...Ae(i)})}},ks=class extends Ie{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ks.create=(e,t)=>new ks({getter:e,typeName:oe.ZodLazy,...Ae(t)});xs=class extends Ie{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return le(n,{received:n.data,code:te.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:t.data}}get value(){return this._def.value}};xs.create=(e,t)=>new xs({value:e,typeName:oe.ZodLiteral,...Ae(t)});Ts=class e extends Ie{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return le(n,{expected:Ne.joinValues(i),received:n.parsedType,code:te.invalid_type}),ke}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return le(n,{received:n.data,code:te.invalid_enum_value,options:i}),ke}return On(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};Ts.create=O$;Cs=class extends Ie{_parse(t){let n=Ne.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==fe.string&&i.parsedType!==fe.number){let r=Ne.objectValues(n);return le(i,{expected:Ne.joinValues(r),received:i.parsedType,code:te.invalid_type}),ke}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ne.objectValues(n);return le(i,{received:i.data,code:te.invalid_enum_value,options:r}),ke}return On(t.data)}get enum(){return this._def.values}};Cs.create=(e,t)=>new Cs({values:e,typeName:oe.ZodNativeEnum,...Ae(t)});Jo=class extends Ie{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.promise&&n.common.async===!1)return le(n,{code:te.invalid_type,expected:fe.promise,received:n.parsedType}),ke;let i=n.parsedType===fe.promise?n.data:Promise.resolve(n.data);return On(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Jo.create=(e,t)=>new Jo({type:e,typeName:oe.ZodPromise,...Ae(t)});Pr=class extends Ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,o={addIssue:a=>{le(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let a=r.transform(i.data,o);if(i.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return ke;let d=await this._def.schema._parseAsync({data:s,path:i.path,parent:i});return d.status==="aborted"?ke:d.status==="dirty"||n.value==="dirty"?Sl(d.value):d});{if(n.value==="aborted")return ke;let s=this._def.schema._parseSync({data:a,path:i.path,parent:i});return s.status==="aborted"?ke:s.status==="dirty"||n.value==="dirty"?Sl(s.value):s}}if(r.type==="refinement"){let a=s=>{let d=r.refinement(s,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ys(a))return ke;let s=r.transform(a.value,o);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>ys(a)?Promise.resolve(r.transform(a.value,o)).then(s=>({status:n.value,value:s})):ke);Ne.assertNever(r)}};Pr.create=(e,t,n)=>new Pr({schema:e,typeName:oe.ZodEffects,effect:t,...Ae(n)});Pr.createWithPreprocess=(e,t,n)=>new Pr({schema:t,effect:{type:"preprocess",transform:e},typeName:oe.ZodEffects,...Ae(n)});lr=class extends Ie{_parse(t){return this._getType(t)===fe.undefined?On(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};lr.create=(e,t)=>new lr({innerType:e,typeName:oe.ZodOptional,...Ae(t)});xi=class extends Ie{_parse(t){return this._getType(t)===fe.null?On(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xi.create=(e,t)=>new xi({innerType:e,typeName:oe.ZodNullable,...Ae(t)});As=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===fe.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};As.create=(e,t)=>new As({innerType:e,typeName:oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ae(t)});Es=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return vp(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dr(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new dr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Es.create=(e,t)=>new Es({innerType:e,typeName:oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ae(t)});Xl=class extends Ie{_parse(t){if(this._getType(t)!==fe.nan){let n=this._getOrReturnCtx(t);return le(n,{code:te.invalid_type,expected:fe.nan,received:n.parsedType}),ke}return{status:"valid",value:t.data}}};Xl.create=e=>new Xl({typeName:oe.ZodNaN,...Ae(e)});Sp=class extends Ie{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},wp=class e extends Ie{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ke:r.status==="dirty"?(n.dirty(),Sl(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ke:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:oe.ZodPipeline})}},Ps=class extends Ie{_parse(t){let n=this._def.innerType._parse(t),i=r=>(ys(r)&&(r.value=Object.freeze(r.value)),r);return vp(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};Ps.create=(e,t)=>new Ps({innerType:e,typeName:oe.ZodReadonly,...Ae(t)});bAe={object:Bn.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(oe||(oe={}));vAe=_s.create,SAe=Jl.create,wAe=Xl.create,kAe=Kl.create,xAe=Bl.create,TAe=Wl.create,CAe=Hl.create,AAe=bs.create,EAe=vs.create,PAe=Vl.create,IAe=Zi.create,OAe=Yr.create,RAe=Zl.create,$Ae=Xi.create,uY=Bn.create,MAe=Bn.strictCreate,jAe=Ss.create,qAe=Z_.create,NAe=ws.create,FAe=ki.create,DAe=Y_.create,LAe=Ql.create,UAe=Yl.create,GAe=X_.create,zAe=ks.create,JAe=xs.create,KAe=Ts.create,BAe=Cs.create,WAe=Jo.create,HAe=Pr.create,VAe=lr.create,ZAe=xi.create,QAe=Pr.createWithPreprocess,YAe=wp.create,R$={};ei(R$,{version:()=>zM,util:()=>Re,treeifyError:()=>J$,toJSONSchema:()=>TS,toDotPath:()=>K$,safeParseAsync:()=>wm,safeParse:()=>Sm,registry:()=>Jv,regexes:()=>Iv,prettifyError:()=>B$,parseAsync:()=>Cp,parse:()=>Tp,locales:()=>zv,isValidJWT:()=>p1,isValidBase64URL:()=>u1,isValidBase64:()=>Mv,globalRegistry:()=>Si,globalConfig:()=>kp,function:()=>jj,formatError:()=>Tv,flattenError:()=>xv,config:()=>Sn,clone:()=>Mr,_xid:()=>nS,_void:()=>vj,_uuidv7:()=>Vv,_uuidv6:()=>Hv,_uuidv4:()=>Wv,_uuid:()=>Bv,_url:()=>Zv,_uppercase:()=>hS,_unknown:()=>Ip,_union:()=>cee,_undefined:()=>gj,_ulid:()=>tS,_uint64:()=>mj,_uint32:()=>dj,_tuple:()=>Pj,_trim:()=>SS,_transform:()=>vee,_toUpperCase:()=>kS,_toLowerCase:()=>wS,_templateLiteral:()=>Pee,_symbol:()=>hj,_success:()=>Tee,_stringbool:()=>$j,_stringFormat:()=>Mj,_string:()=>V1,_startsWith:()=>yS,_size:()=>fS,_set:()=>gee,_safeParseAsync:()=>Pv,_safeParse:()=>Ev,_regex:()=>pS,_refine:()=>Rj,_record:()=>mee,_readonly:()=>Eee,_property:()=>Ej,_promise:()=>Oee,_positive:()=>xj,_pipe:()=>Aee,_parseAsync:()=>Av,_parse:()=>Cv,_overwrite:()=>Xo,_optional:()=>See,_number:()=>nj,_nullable:()=>wee,_null:()=>yj,_normalize:()=>vS,_nonpositive:()=>Cj,_nonoptional:()=>xee,_nonnegative:()=>Aj,_never:()=>bj,_negative:()=>Tj,_nativeEnum:()=>_ee,_nanoid:()=>Yv,_nan:()=>kj,_multipleOf:()=>ru,_minSize:()=>iu,_minLength:()=>Os,_min:()=>zn,_mime:()=>bS,_maxSize:()=>xm,_maxLength:()=>Tm,_max:()=>Ar,_map:()=>hee,_lte:()=>Ar,_lt:()=>Ko,_lowercase:()=>mS,_literal:()=>bee,_length:()=>Cm,_lazy:()=>Iee,_ksuid:()=>rS,_jwt:()=>cS,_isoTime:()=>ej,_isoDuration:()=>tj,_isoDateTime:()=>Y1,_isoDate:()=>X1,_ipv6:()=>oS,_ipv4:()=>iS,_intersection:()=>pee,_int64:()=>pj,_int32:()=>sj,_int:()=>ij,_includes:()=>gS,_guid:()=>Pp,_gte:()=>zn,_gt:()=>Bo,_float64:()=>aj,_float32:()=>oj,_file:()=>Ij,_enum:()=>yee,_endsWith:()=>_S,_emoji:()=>Qv,_email:()=>Kv,_e164:()=>uS,_discriminatedUnion:()=>fee,_default:()=>kee,_date:()=>Sj,_custom:()=>Oj,_cuid2:()=>eS,_cuid:()=>Xv,_coercedString:()=>Z1,_coercedNumber:()=>rj,_coercedDate:()=>wj,_coercedBoolean:()=>uj,_coercedBigint:()=>fj,_cidrv6:()=>sS,_cidrv4:()=>aS,_catch:()=>Cee,_boolean:()=>lj,_bigint:()=>cj,_base64url:()=>lS,_base64:()=>dS,_array:()=>xS,_any:()=>_j,TimePrecision:()=>Q1,NEVER:()=>$$,JSONSchemaGenerator:()=>ou,JSONSchema:()=>Ree,Doc:()=>Ap,$output:()=>W1,$input:()=>H1,$constructor:()=>D,$brand:()=>M$,$ZodXID:()=>XM,$ZodVoid:()=>k1,$ZodUnknown:()=>Ep,$ZodUnion:()=>Lv,$ZodUndefined:()=>b1,$ZodUUID:()=>KM,$ZodURL:()=>WM,$ZodULID:()=>YM,$ZodType:()=>Te,$ZodTuple:()=>km,$ZodTransform:()=>Uv,$ZodTemplateLiteral:()=>G1,$ZodSymbol:()=>_1,$ZodSuccess:()=>F1,$ZodStringFormat:()=>et,$ZodString:()=>_u,$ZodSet:()=>P1,$ZodRegistry:()=>nu,$ZodRecord:()=>A1,$ZodRealError:()=>gu,$ZodReadonly:()=>U1,$ZodPromise:()=>z1,$ZodPrefault:()=>q1,$ZodPipe:()=>Gv,$ZodOptional:()=>$1,$ZodObject:()=>Dv,$ZodNumberFormat:()=>g1,$ZodNumber:()=>jv,$ZodNullable:()=>M1,$ZodNull:()=>v1,$ZodNonOptional:()=>N1,$ZodNever:()=>w1,$ZodNanoID:()=>VM,$ZodNaN:()=>L1,$ZodMap:()=>E1,$ZodLiteral:()=>O1,$ZodLazy:()=>J1,$ZodKSUID:()=>e1,$ZodJWT:()=>m1,$ZodIntersection:()=>C1,$ZodISOTime:()=>r1,$ZodISODuration:()=>i1,$ZodISODateTime:()=>t1,$ZodISODate:()=>n1,$ZodIPv6:()=>a1,$ZodIPv4:()=>o1,$ZodGUID:()=>JM,$ZodFunction:()=>Op,$ZodFile:()=>R1,$ZodError:()=>kv,$ZodEnum:()=>I1,$ZodEmoji:()=>HM,$ZodEmail:()=>BM,$ZodE164:()=>f1,$ZodDiscriminatedUnion:()=>T1,$ZodDefault:()=>j1,$ZodDate:()=>x1,$ZodCustomStringFormat:()=>h1,$ZodCustom:()=>K1,$ZodCheckUpperCase:()=>qM,$ZodCheckStringFormat:()=>yu,$ZodCheckStartsWith:()=>FM,$ZodCheckSizeEquals:()=>IM,$ZodCheckRegex:()=>MM,$ZodCheckProperty:()=>LM,$ZodCheckOverwrite:()=>GM,$ZodCheckNumberFormat:()=>CM,$ZodCheckMultipleOf:()=>TM,$ZodCheckMinSize:()=>PM,$ZodCheckMinLength:()=>RM,$ZodCheckMimeType:()=>UM,$ZodCheckMaxSize:()=>EM,$ZodCheckMaxLength:()=>OM,$ZodCheckLowerCase:()=>jM,$ZodCheckLessThan:()=>Rv,$ZodCheckLengthEquals:()=>$M,$ZodCheckIncludes:()=>NM,$ZodCheckGreaterThan:()=>$v,$ZodCheckEndsWith:()=>DM,$ZodCheckBigIntFormat:()=>AM,$ZodCheck:()=>$t,$ZodCatch:()=>D1,$ZodCUID2:()=>QM,$ZodCUID:()=>ZM,$ZodCIDRv6:()=>d1,$ZodCIDRv4:()=>s1,$ZodBoolean:()=>qv,$ZodBigIntFormat:()=>y1,$ZodBigInt:()=>Nv,$ZodBase64URL:()=>c1,$ZodBase64:()=>l1,$ZodAsyncError:()=>eo,$ZodArray:()=>Fv,$ZodAny:()=>S1});$$=Object.freeze({status:"aborted"});M$=Symbol("zod_brand"),eo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},kp={};Re={};ei(Re,{unwrapMessage:()=>wl,stringifyPrimitive:()=>Ee,required:()=>AY,randomString:()=>_Y,propertyKeyTypes:()=>xp,promiseAllObject:()=>yY,primitiveTypes:()=>F$,prefixIssues:()=>sr,pick:()=>wY,partial:()=>CY,optionalKeys:()=>D$,omit:()=>kY,numKeys:()=>bY,nullish:()=>Qo,normalizeParams:()=>ae,merge:()=>TY,jsonStringifyReplacer:()=>j$,joinValues:()=>de,issue:()=>G$,isPlainObject:()=>tu,isObject:()=>eu,getSizableOrigin:()=>bm,getParsedType:()=>vY,getLengthableOrigin:()=>vm,getEnumValues:()=>vv,getElementAtPath:()=>gY,floatSafeRemainder:()=>q$,finalizeIssue:()=>Ir,extend:()=>xY,escapeRegex:()=>Yo,esc:()=>ts,defineLazy:()=>Je,createTransparentProxy:()=>SY,clone:()=>Mr,cleanRegex:()=>_m,cleanEnum:()=>EY,captureStackTrace:()=>wv,cached:()=>ym,assignProp:()=>Sv,assertNotEqual:()=>fY,assertNever:()=>mY,assertIs:()=>pY,assertEqual:()=>cY,assert:()=>hY,allowsEval:()=>N$,aborted:()=>ss,NUMBER_FORMAT_RANGES:()=>L$,Class:()=>eb,BIGINT_FORMAT_RANGES:()=>U$});wv=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};N$=ym(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});vY=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw Error(`Unknown data type: ${t}`)}},xp=new Set(["string","number","symbol"]),F$=new Set(["string","number","bigint","boolean","symbol","undefined"]);L$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},U$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};eb=class{constructor(...t){}},z$=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,j$,2)},enumerable:!0})},kv=D("$ZodError",z$),gu=D("$ZodError",z$,{Parent:Error});Cv=e=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new eo;if(a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>Ir(d,o,Sn())));throw wv(s,r?.callee),s}return a.value},Tp=Cv(gu),Av=e=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??e)(a.issues.map(d=>Ir(d,o,Sn())));throw wv(s,r?.callee),s}return a.value},Cp=Av(gu),Ev=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new eo;return o.issues.length?{success:!1,error:new(e??kv)(o.issues.map(a=>Ir(a,r,Sn())))}:{success:!0,data:o.value}},Sm=Ev(gu),Pv=e=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Ir(a,r,Sn())))}:{success:!0,data:o.value}},wm=Pv(gu),Iv={};ei(Iv,{xid:()=>Z$,uuid7:()=>RY,uuid6:()=>OY,uuid4:()=>IY,uuid:()=>Is,uppercase:()=>kM,unicodeEmail:()=>jY,undefined:()=>SM,ulid:()=>V$,time:()=>pM,string:()=>hM,rfc5322Email:()=>MY,number:()=>_M,null:()=>vM,nanoid:()=>Y$,lowercase:()=>wM,ksuid:()=>Q$,ipv6:()=>iM,ipv4:()=>rM,integer:()=>yM,html5Email:()=>$Y,hostname:()=>dM,guid:()=>eM,extendedDuration:()=>PY,emoji:()=>nM,email:()=>tM,e164:()=>lM,duration:()=>X$,domain:()=>FY,datetime:()=>mM,date:()=>cM,cuid2:()=>H$,cuid:()=>W$,cidrv6:()=>aM,cidrv4:()=>oM,browserEmail:()=>qY,boolean:()=>bM,bigint:()=>gM,base64url:()=>Ov,base64:()=>sM,_emoji:()=>NY});W$=/^[cC][^\s-]{8,}$/,H$=/^[0-9a-z]+$/,V$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z$=/^[0-9a-vA-V]{20}$/,Q$=/^[A-Za-z0-9]{27}$/,Y$=/^[a-zA-Z0-9_-]{21}$/,X$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,PY=/^[-+]?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)?)??$/,eM=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Is=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,IY=Is(4),OY=Is(6),RY=Is(7),tM=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$Y=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,MY=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jY=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qY=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,NY="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";rM=/^(?:(?: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])$/,iM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,oM=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,aM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sM=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ov=/^[A-Za-z0-9_-]*$/,dM=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,FY=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,lM=/^\+(?:[0-9]){6,14}[0-9]$/,uM="(?:(?:\\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])))",cM=new RegExp(`^${uM}$`);hM=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gM=/^\d+n?$/,yM=/^\d+$/,_M=/^-?\d+(?:\.\d+)?/i,bM=/true|false/i,vM=/null/i,SM=/undefined/i,wM=/^[^A-Z]*$/,kM=/^[^a-z]*$/,$t=D("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xM={number:"number",bigint:"bigint",object:"date"},Rv=D("$ZodCheckLessThan",(e,t)=>{$t.init(e,t);let n=xM[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$v=D("$ZodCheckGreaterThan",(e,t)=>{$t.init(e,t);let n=xM[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TM=D("$ZodCheckMultipleOf",(e,t)=>{$t.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):q$(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),CM=D("$ZodCheckNumberFormat",(e,t)=>{$t.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=L$[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=r,s.maximum=o,n&&(s.pattern=yM)}),e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),AM=D("$ZodCheckBigIntFormat",(e,t)=>{$t.init(e,t);let[n,i]=U$[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),EM=D("$ZodCheckMaxSize",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:bm(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),PM=D("$ZodCheckMinSize",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:bm(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),IM=D("$ZodCheckSizeEquals",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.size!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,r=i.size;if(r===t.size)return;let o=r>t.size;n.issues.push({origin:bm(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),OM=D("$ZodCheckMaxLength",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let r=vm(i);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),RM=D("$ZodCheckMinLength",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let r=vm(i);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),$M=D("$ZodCheckLengthEquals",(e,t)=>{$t.init(e,t),e._zod.when=n=>{let i=n.value;return!Qo(i)&&i.length!==void 0},e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,r=i.length;if(r===t.length)return;let o=vm(i),a=r>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yu=D("$ZodCheckStringFormat",(e,t)=>{var n,i;$t.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),MM=D("$ZodCheckRegex",(e,t)=>{yu.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),jM=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wM),yu.init(e,t)}),qM=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kM),yu.init(e,t)}),NM=D("$ZodCheckIncludes",(e,t)=>{$t.init(e,t);let n=Yo(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),FM=D("$ZodCheckStartsWith",(e,t)=>{$t.init(e,t);let n=new RegExp(`^${Yo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),DM=D("$ZodCheckEndsWith",(e,t)=>{$t.init(e,t);let n=new RegExp(`.*${Yo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});LM=D("$ZodCheckProperty",(e,t)=>{$t.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>mI(r,n,t.property));mI(i,n,t.property)}}),UM=D("$ZodCheckMimeType",(e,t)=>{$t.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e})}}),GM=D("$ZodCheckOverwrite",(e,t)=>{$t.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}}),Ap=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
237
- `).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),r=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of r)this.content.push(o)}compile(){let t=Function,n=this?.args,i=[...(this?.content??[""]).map(r=>` ${r}`)];return new t(...n,i.join(`
238
- `))}},zM={major:4,minor:0,patch:0},Te=D("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zM;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(o,a,s)=>{let d=ss(o),l;for(let u of a){if(u._zod.when){if(!u._zod.when(o))continue}else if(d)continue;let c=o.issues.length,p=u._zod.check(o);if(p instanceof Promise&&s?.async===!1)throw new eo;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,o.issues.length!==c&&(d||(d=ss(o,c)))});else{if(o.issues.length===c)continue;d||(d=ss(o,c))}}return l?l.then(()=>o):o};e._zod.run=(o,a)=>{let s=e._zod.parse(o,a);if(s instanceof Promise){if(a.async===!1)throw new eo;return s.then(d=>r(d,i,a))}return r(s,i,a)}}e["~standard"]={validate:r=>{try{let o=Sm(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return wm(e,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),_u=D("$ZodString",(e,t)=>{Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hM(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),et=D("$ZodStringFormat",(e,t)=>{yu.init(e,t),_u.init(e,t)}),JM=D("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=eM),et.init(e,t)}),KM=D("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Is(n))}else t.pattern??(t.pattern=Is());et.init(e,t)}),BM=D("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tM),et.init(e,t)}),WM=D("$ZodURL",(e,t)=>{et.init(e,t),e._zod.check=n=>{try{let i=n.value,r=new URL(i),o=r.href;t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(r.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:dM.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!i.endsWith("/")&&o.endsWith("/")?n.value=o.slice(0,-1):n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),HM=D("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nM()),et.init(e,t)}),VM=D("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Y$),et.init(e,t)}),ZM=D("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=W$),et.init(e,t)}),QM=D("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=H$),et.init(e,t)}),YM=D("$ZodULID",(e,t)=>{t.pattern??(t.pattern=V$),et.init(e,t)}),XM=D("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Z$),et.init(e,t)}),e1=D("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Q$),et.init(e,t)}),t1=D("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mM(t)),et.init(e,t)}),n1=D("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=cM),et.init(e,t)}),r1=D("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pM(t)),et.init(e,t)}),i1=D("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=X$),et.init(e,t)}),o1=D("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rM),et.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format="ipv4"})}),a1=D("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=iM),et.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),s1=D("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=oM),et.init(e,t)}),d1=D("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=aM),et.init(e,t),e._zod.check=n=>{let[i,r]=n.value.split("/");try{if(!r)throw Error();let o=Number(r);if(`${o}`!==r||o<0||o>128)throw Error();new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});l1=D("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=sM),et.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Mv(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});c1=D("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ov),et.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{u1(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),f1=D("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lM),et.init(e,t)});m1=D("$ZodJWT",(e,t)=>{et.init(e,t),e._zod.check=n=>{p1(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),h1=D("$ZodCustomStringFormat",(e,t)=>{et.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),jv=D("$ZodNumber",(e,t)=>{Te.init(e,t),e._zod.pattern=e._zod.bag.pattern??_M,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}}),g1=D("$ZodNumber",(e,t)=>{CM.init(e,t),jv.init(e,t)}),qv=D("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=bM,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Nv=D("$ZodBigInt",(e,t)=>{Te.init(e,t),e._zod.pattern=gM,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),y1=D("$ZodBigInt",(e,t)=>{AM.init(e,t),Nv.init(e,t)}),_1=D("$ZodSymbol",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),b1=D("$ZodUndefined",(e,t)=>{Te.init(e,t),e._zod.pattern=SM,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),v1=D("$ZodNull",(e,t)=>{Te.init(e,t),e._zod.pattern=vM,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),S1=D("$ZodAny",(e,t)=>{Te.init(e,t),e._zod.parse=n=>n}),Ep=D("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=n=>n}),w1=D("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),k1=D("$ZodVoid",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),x1=D("$ZodDate",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});Fv=D("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let a=0;a<r.length;a++){let s=r[a],d=t.element._zod.run({value:s,issues:[]},i);d instanceof Promise?o.push(d.then(l=>hI(l,n,a))):hI(d,n,a)}return o.length?Promise.all(o).then(()=>n):n}});Dv=D("$ZodObject",(e,t)=>{Te.init(e,t);let n=ym(()=>{let u=Object.keys(t.shape);for(let p of u)if(!(t.shape[p]instanceof Te))throw Error(`Invalid element at key "${p}": expected a Zod schema`);let c=D$(t.shape);return{shape:t.shape,keys:u,keySet:new Set(u),numKeys:u.length,optionalKeys:new Set(c)}});Je(e._zod,"propValues",()=>{let u=t.shape,c={};for(let p in u){let f=u[p]._zod;if(f.values){c[p]??(c[p]=new Set);for(let h of f.values)c[p].add(h)}}return c});let i=u=>{let c=new Ap(["shape","payload","ctx"]),p=n.value,f=y=>{let b=ts(y);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};c.write("const input = payload.value;");let h=Object.create(null),g=0;for(let y of p.keys)h[y]=`key_${g++}`;c.write("const newResult = {}");for(let y of p.keys)if(p.optionalKeys.has(y)){let b=h[y];c.write(`const ${b} = ${f(y)};`);let v=ts(y);c.write(`
239
- if (${b}.issues.length) {
240
- if (input[${v}] === undefined) {
241
- if (${v} in input) {
242
- newResult[${v}] = undefined;
243
- }
244
- } else {
245
- payload.issues = payload.issues.concat(
246
- ${b}.issues.map((iss) => ({
247
- ...iss,
248
- path: iss.path ? [${v}, ...iss.path] : [${v}],
249
- }))
250
- );
251
- }
252
- } else if (${b}.value === undefined) {
253
- if (${v} in input) newResult[${v}] = undefined;
254
- } else {
255
- newResult[${v}] = ${b}.value;
256
- }
257
- `)}else{let b=h[y];c.write(`const ${b} = ${f(y)};`),c.write(`
258
- if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
259
- ...iss,
260
- path: iss.path ? [${ts(y)}, ...iss.path] : [${ts(y)}]
261
- })));`),c.write(`newResult[${ts(y)}] = ${b}.value`)}c.write("payload.value = newResult;"),c.write("return payload;");let _=c.compile();return(y,b)=>_(u,y,b)},r,o=eu,a=!kp.jitless,s=a&&N$.value,d=t.catchall,l;e._zod.parse=(u,c)=>{l??(l=n.value);let p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;let f=[];if(a&&s&&c?.async===!1&&c.jitless!==!0)r||(r=i(t.shape)),u=r(u,c);else{u.value={};let b=l.shape;for(let v of l.keys){let w=b[v],A=w._zod.run({value:p[v],issues:[]},c),C=w._zod.optin==="optional"&&w._zod.optout==="optional";A instanceof Promise?f.push(A.then(S=>C?gI(S,u,v,p):vf(S,u,v))):C?gI(A,u,v,p):vf(A,u,v)}}if(!d)return f.length?Promise.all(f).then(()=>u):u;let h=[],g=l.keySet,_=d._zod,y=_.def.type;for(let b of Object.keys(p)){if(g.has(b))continue;if(y==="never"){h.push(b);continue}let v=_.run({value:p[b],issues:[]},c);v instanceof Promise?f.push(v.then(w=>vf(w,u,b))):vf(v,u,b)}return h.length&&u.issues.push({code:"unrecognized_keys",keys:h,input:p,inst:e}),f.length?Promise.all(f).then(()=>u):u}});Lv=D("$ZodUnion",(e,t)=>{Te.init(e,t),Je(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Je(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Je(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Je(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>_m(i.source)).join("|")})$`)}}),e._zod.parse=(n,i)=>{let r=!1,o=[];for(let a of t.options){let s=a._zod.run({value:n.value,issues:[]},i);if(s instanceof Promise)o.push(s),r=!0;else{if(s.issues.length===0)return s;o.push(s)}}return r?Promise.all(o).then(a=>yI(a,n,e,i)):yI(o,n,e,i)}}),T1=D("$ZodDiscriminatedUnion",(e,t)=>{Lv.init(e,t);let n=e._zod.parse;Je(e._zod,"propValues",()=>{let r={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,d]of Object.entries(a)){r[s]||(r[s]=new Set);for(let l of d)r[s].add(l)}}return r});let i=ym(()=>{let r=t.options,o=new Map;for(let a of r){let s=a._zod.propValues[t.discriminator];if(!s||s.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let d of s){if(o.has(d))throw Error(`Duplicate discriminator value "${String(d)}"`);o.set(d,a)}}return o});e._zod.parse=(r,o)=>{let a=r.value;if(!eu(a))return r.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),r;let s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(r,o):t.unionFallback?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[t.discriminator],inst:e}),r)}}),C1=D("$ZodIntersection",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value,o=t.left._zod.run({value:r,issues:[]},i),a=t.right._zod.run({value:r,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([s,d])=>_I(n,s,d)):_I(n,o,a)}});km=D("$ZodTuple",(e,t)=>{Te.init(e,t);let n=t.items,i=n.length-[...n].reverse().findIndex(r=>r._zod.optin!=="optional");e._zod.parse=(r,o)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let s=[];if(!t.rest){let l=a.length>n.length,u=a.length<i-1;if(l||u)return r.issues.push({input:a,inst:e,origin:"array",...l?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length}}),r}let d=-1;for(let l of n){if(d++,d>=a.length&&d>=i)continue;let u=l._zod.run({value:a[d],issues:[]},o);u instanceof Promise?s.push(u.then(c=>Sf(c,r,d))):Sf(u,r,d)}if(t.rest){let l=a.slice(n.length);for(let u of l){d++;let c=t.rest._zod.run({value:u,issues:[]},o);c instanceof Promise?s.push(c.then(p=>Sf(p,r,d))):Sf(c,r,d)}}return s.length?Promise.all(s).then(()=>r):r}});A1=D("$ZodRecord",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!tu(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;let o=[];if(t.keyType._zod.values){let a=t.keyType._zod.values;n.value={};for(let d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){let l=t.valueType._zod.run({value:r[d],issues:[]},i);l instanceof Promise?o.push(l.then(u=>{u.issues.length&&n.issues.push(...sr(d,u.issues)),n.value[d]=u.value})):(l.issues.length&&n.issues.push(...sr(d,l.issues)),n.value[d]=l.value)}let s;for(let d in r)a.has(d)||(s=s??[],s.push(d));s&&s.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s})}else{n.value={};for(let a of Reflect.ownKeys(r)){if(a==="__proto__")continue;let s=t.keyType._zod.run({value:a,issues:[]},i);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(l=>Ir(l,i,Sn())),input:a,path:[a],inst:e}),n.value[s.value]=s.value;continue}let d=t.valueType._zod.run({value:r[a],issues:[]},i);d instanceof Promise?o.push(d.then(l=>{l.issues.length&&n.issues.push(...sr(a,l.issues)),n.value[s.value]=l.value})):(d.issues.length&&n.issues.push(...sr(a,d.issues)),n.value[s.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}}),E1=D("$ZodMap",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;let o=[];n.value=new Map;for(let[a,s]of r){let d=t.keyType._zod.run({value:a,issues:[]},i),l=t.valueType._zod.run({value:s,issues:[]},i);d instanceof Promise||l instanceof Promise?o.push(Promise.all([d,l]).then(([u,c])=>{bI(u,c,n,a,r,e,i)})):bI(d,l,n,a,r,e,i)}return o.length?Promise.all(o).then(()=>n):n}});P1=D("$ZodSet",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];n.value=new Set;for(let a of r){let s=t.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(d=>vI(d,n))):vI(s,n)}return o.length?Promise.all(o).then(()=>n):n}});I1=D("$ZodEnum",(e,t)=>{Te.init(e,t);let n=vv(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(i=>xp.has(typeof i)).map(i=>typeof i=="string"?Yo(i):i.toString()).join("|")})$`),e._zod.parse=(i,r)=>{let o=i.value;return e._zod.values.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),O1=D("$ZodLiteral",(e,t)=>{Te.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Yo(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),R1=D("$ZodFile",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),Uv=D("$ZodTransform",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=t.transform(n.value,n);if(i.async)return(r instanceof Promise?r:Promise.resolve(r)).then(o=>(n.value=o,n));if(r instanceof Promise)throw new eo;return n.value=r,n}}),$1=D("$ZodOptional",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Je(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Je(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${_m(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,i):n.value===void 0?n:t.innerType._zod.run(n,i)}),M1=D("$ZodNullable",(e,t)=>{Te.init(e,t),Je(e._zod,"optin",()=>t.innerType._zod.optin),Je(e._zod,"optout",()=>t.innerType._zod.optout),Je(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${_m(n.source)}|null)$`):void 0}),Je(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),j1=D("$ZodDefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>SI(o,t)):SI(r,t)}});q1=D("$ZodPrefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),N1=D("$ZodNonOptional",(e,t)=>{Te.init(e,t),Je(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>wI(o,e)):wI(r,e)}});F1=D("$ZodSuccess",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.issues.length===0,n)):(n.value=r.issues.length===0,n)}}),D1=D("$ZodCatch",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Je(e._zod,"optout",()=>t.innerType._zod.optout),Je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>Ir(a,i,Sn()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(o=>Ir(o,i,Sn()))},input:n.value}),n.issues=[]),n)}}),L1=D("$ZodNaN",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),Gv=D("$ZodPipe",(e,t)=>{Te.init(e,t),Je(e._zod,"values",()=>t.in._zod.values),Je(e._zod,"optin",()=>t.in._zod.optin),Je(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,i)=>{let r=t.in._zod.run(n,i);return r instanceof Promise?r.then(o=>kI(o,t,i)):kI(r,t,i)}});U1=D("$ZodReadonly",(e,t)=>{Te.init(e,t),Je(e._zod,"propValues",()=>t.innerType._zod.propValues),Je(e._zod,"values",()=>t.innerType._zod.values),Je(e._zod,"optin",()=>t.innerType._zod.optin),Je(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,i)=>{let r=t.innerType._zod.run(n,i);return r instanceof Promise?r.then(xI):xI(r)}});G1=D("$ZodTemplateLiteral",(e,t)=>{Te.init(e,t);let n=[];for(let i of t.parts)if(i instanceof Te){if(!i._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let r=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!r)throw Error(`Invalid template literal part: ${i._zod.traits}`);let o=r.startsWith("^")?1:0,a=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(o,a))}else if(i===null||F$.has(typeof i))n.push(Yo(`${i}`));else throw Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(i,r)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"template_literal",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),i)}),z1=D("$ZodPromise",(e,t)=>{Te.init(e,t),e._zod.parse=(n,i)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},i))}),J1=D("$ZodLazy",(e,t)=>{Te.init(e,t),Je(e._zod,"innerType",()=>t.getter()),Je(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),Je(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),Je(e._zod,"optin",()=>e._zod.innerType._zod.optin),Je(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(n,i)=>e._zod.innerType._zod.run(n,i)}),K1=D("$ZodCustom",(e,t)=>{$t.init(e,t),Te.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{let i=n.value,r=t.fn(i);if(r instanceof Promise)return r.then(o=>TI(o,n,i,e));TI(r,n,i,e)}});zv={};ei(zv,{zhTW:()=>uee,zhCN:()=>dee,vi:()=>aee,ur:()=>iee,ua:()=>nee,tr:()=>eee,th:()=>QX,ta:()=>VX,sv:()=>WX,sl:()=>KX,ru:()=>zX,pt:()=>UX,ps:()=>NX,pl:()=>DX,ota:()=>jX,no:()=>$X,nl:()=>OX,ms:()=>PX,mk:()=>AX,ko:()=>TX,kh:()=>kX,ja:()=>SX,it:()=>bX,id:()=>yX,hu:()=>hX,he:()=>pX,frCA:()=>cX,fr:()=>lX,fi:()=>sX,fa:()=>oX,es:()=>rX,eo:()=>tX,en:()=>B1,de:()=>ZY,cs:()=>HY,ca:()=>BY,be:()=>JY,az:()=>GY,ar:()=>LY});DY=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return r=>{switch(r.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${r.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Ee(r.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${r.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${r.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${r.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${i[o.format]??r.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${r.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${r.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${r.keys.length>1?"\u0629":""}: ${de(r.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${r.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};UY=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Ee(r.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${r.origin??"d\u0259y\u0259r"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${i[o.format]??r.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${r.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${r.keys.length>1?"lar":""}: ${de(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${r.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};zY=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0456\u045E";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${r.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Ee(r.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),d=CI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.maximum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),d=CI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${o}${r.minimum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${r.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${r.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${de(r.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${r.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};KY=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Valor inv\xE0lid: s'esperava ${Ee(r.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${de(r.values," o ")}`;case"too_big":{let o=r.inclusive?"com a m\xE0xim":"menys de",a=t(r.origin);return a?`Massa gran: s'esperava que ${r.origin??"el valor"} contingu\xE9s ${o} ${r.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(r.origin);return a?`Massa petit: s'esperava que ${r.origin} contingu\xE9s ${o} ${r.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${i[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${r.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${r.origin}`;default:return"Entrada inv\xE0lida"}}};WY=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return r=>{switch(r.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${r.expected}, obdr\u017Eeno ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Ee(r.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED m\xEDt ${o}${r.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${r.origin??"hodnota"} mus\xED b\xFDt ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${i[o.format]??r.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${r.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${de(r.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${r.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${r.origin}`;default:return"Neplatn\xFD vstup"}}};VY=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return r=>{switch(r.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Ee(r.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${r.origin??"Wert"} ${o}${r.maximum.toString()} ist`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${o}${r.minimum.toString()} ist`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${de(r.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${r.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${r.origin}`;default:return"Ung\xFCltige Eingabe"}}};QY=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},YY=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${QY(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ee(i.values[0])}`:`Invalid option: expected one of ${de(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${r}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`Too small: expected ${i.origin} to have ${r}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Invalid string: must start with "${r.prefix}"`:r.format==="ends_with"?`Invalid string: must end with "${r.suffix}"`:r.format==="includes"?`Invalid string: must include "${r.includes}"`:r.format==="regex"?`Invalid string: must match pattern ${r.pattern}`:`Invalid ${n[r.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${de(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};XY=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},eX=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(i){return e[i]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return i=>{switch(i.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${i.expected}, ricevi\u011Dis ${XY(i.input)}`;case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${Ee(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${de(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${r}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${n[r.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${de(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};nX=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(r))return"arreglo";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype)return r.constructor.name}}return o},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${r.expected}, recibido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: se esperaba ${Ee(r.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Demasiado grande: se esperaba que ${r.origin??"valor"} tuviera ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${r.origin??"valor"} fuera ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Demasiado peque\xF1o: se esperaba que ${r.origin} tuviera ${o}${r.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${r.origin} fuera ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${i[o.format]??r.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Llave${r.keys.length>1?"s":""} desconocida${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${r.origin}`;default:return"Entrada inv\xE1lida"}}};iX=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(r))return"\u0622\u0631\u0627\u06CC\u0647";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return r=>{switch(r.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${r.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${n(r.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return r.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Ee(r.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${de(r.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${r.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${i[o.format]??r.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${r.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${r.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${de(r.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${r.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${r.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};aX=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return r=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Ee(r.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${o}${r.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${o}${r.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${i[o.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${de(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};dX=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return r=>{switch(r.code){case"invalid_type":return`Entr\xE9e invalide : ${r.expected} attendu, ${n(r.input)} re\xE7u`;case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : ${Ee(r.values[0])} attendu`:`Option invalide : une valeur parmi ${de(r.values,"|")} attendue`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Trop grand : ${r.origin??"valeur"} doit ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${r.origin??"valeur"} doit \xEAtre ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Trop petit : ${r.origin} doit ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : ${r.origin} doit \xEAtre ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${de(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};uX=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return r=>{switch(r.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${r.expected}, re\xE7u ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entr\xE9e invalide : attendu ${Ee(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u2264":"<",a=t(r.origin);return a?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${o}${r.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u2265":">",a=t(r.origin);return a?`Trop petit : attendu que ${r.origin} ait ${o}${r.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${r.origin} soit ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${i[o.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${r.divisor}`;case"unrecognized_keys":return`Cl\xE9${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${de(r.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${r.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entr\xE9e invalide"}}};fX=()=>{let e={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return r=>{switch(r.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${r.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${Ee(r.values[0])}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${r.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${r.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${r.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.minimum.toString()} ${a.unit}`:`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${r.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${o.prefix}"`:o.format==="ends_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${o.suffix}"`:o.format==="includes"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${o.includes}"`:o.format==="regex"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${o.pattern}`:`${i[o.format]??r.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${r.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${r.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${r.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${de(r.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${r.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};mX=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(r))return"t\xF6mb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return r=>{switch(r.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${r.expected}, a kapott \xE9rt\xE9k ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Ee(r.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`T\xFAl nagy: ${r.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${r.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${r.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} m\xE9rete t\xFAl kicsi ${o}${r.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${r.origin} t\xFAl kicsi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${i[o.format]??r.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${r.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${r.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${r.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};gX=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${Ee(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: diharapkan ${r.origin} memiliki ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${i[o.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};_X=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input non valido: atteso ${Ee(r.values[0])}`:`Opzione non valida: atteso uno tra ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Troppo grande: ${r.origin??"valore"} deve avere ${o}${r.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Troppo piccolo: ${r.origin} deve avere ${o}${r.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${r.origin} deve essere ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${de(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};vX=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(r))return"\u914D\u5217";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return r=>{switch(r.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${r.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${n(r.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return r.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Ee(r.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${de(r.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=r.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(r.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${a.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${r.origin??"\u5024"}\u306F${r.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=r.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(r.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${a.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${r.origin}\u306F${r.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${i[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${r.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${r.keys.length>1?"\u7FA4":""}: ${de(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${r.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};wX=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(r))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(r===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return r=>{switch(r.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Ee(r.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r.origin} ${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${r.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${de(r.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${r.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};xX=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return r=>{switch(r.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${r.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${n(r.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return r.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Ee(r.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${de(r.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=r.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),d=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()}${d} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${r.maximum.toString()} ${o}${a}`}case"too_small":{let o=r.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(r.origin),d=s?.unit??"\uC694\uC18C";return s?`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()}${d} ${o}${a}`:`${r.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${r.minimum.toString()} ${o}${a}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${i[o.format]??r.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${r.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${de(r.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${r.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${r.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};CX=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(r))return"\u043D\u0438\u0437\u0430";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return r=>{switch(r.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${Ee(r.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${r.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${de(r.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${r.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${r.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};EX=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${Ee(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Terlalu besar: dijangka ${r.origin??"nilai"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Terlalu kecil: dijangka ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${i[o.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${de(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};IX=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return r=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${Ee(r.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${r.origin??"waarde"} ${o}${r.maximum.toString()} is`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${r.origin} ${o}${r.minimum.toString()} is`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${i[o.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};RX=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${Ee(r.values[0])}`:`Ugyldig valg: forventet en av ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til \xE5 ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${r.origin} til \xE5 ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${i[o.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${de(r.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};MX=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return r=>{switch(r.code){case"invalid_type":return`F\xE2sit giren: umulan ${r.expected}, al\u0131nan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`F\xE2sit giren: umulan ${Ee(r.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${r.origin??"value"}, ${o}${r.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${r.origin}, ${o}${r.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=r;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${i[o.format]??r.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${r.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${r.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};qX=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(r))return"\u0627\u0631\u06D0";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return r=>{switch(r.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${r.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${n(r.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return r.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Ee(r.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${de(r.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${r.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${r.maximum.toString()} \u0648\u064A`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${r.origin} \u0628\u0627\u06CC\u062F ${o}${r.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${i[o.format]??r.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${r.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${r.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${de(r.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${r.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${r.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};FX=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return r=>{switch(r.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Ee(r.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${r.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${r.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${i[o.format]??r.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${r.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${r.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};LX=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inv\xE1lida: esperado ${Ee(r.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${o}${r.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Muito pequeno: esperado que ${r.origin} tivesse ${o}${r.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${i[o.format]??r.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${de(r.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${r.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${r.origin}`;default:return"Campo inv\xE1lido"}}};GX=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${r.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Ee(r.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);if(a){let s=Number(r.maximum),d=AI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.maximum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);if(a){let s=Number(r.minimum),d=AI(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${r.minimum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${r.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${r.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0438":""}: ${de(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${r.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};JX=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return r=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Ee(r.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} imelo ${o}${r.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${r.origin??"vrednost"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${r.origin} imelo ${o}${r.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${i[o.format]??r.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${de(r.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};BX=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return r=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Ee(r.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${r.origin??"v\xE4rdet"} att ha ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${r.origin??"v\xE4rdet"} att ha ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${i[o.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${de(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${r.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};HX=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(r))return"\u0B85\u0BA3\u0BBF";if(r===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Ee(r.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${de(r.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${r.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r.origin} ${o}${r.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${r.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${r.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${de(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${r.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};ZX=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(r))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(r===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return r=>{switch(r.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${r.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Ee(r.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(r.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${r.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${i[o.format]??r.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${r.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${de(r.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${r.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};YX=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},XX=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(i){return e[i]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${i.expected}, al\u0131nan ${YX(i.input)}`;case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Ee(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${de(i.values,"|")}`;case"too_big":{let r=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${r}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${r}${i.maximum.toString()}`}case"too_small":{let r=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${r}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${r}${i.minimum.toString()}`}case"invalid_format":{let r=i;return r.format==="starts_with"?`Ge\xE7ersiz metin: "${r.prefix}" ile ba\u015Flamal\u0131`:r.format==="ends_with"?`Ge\xE7ersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Ge\xE7ersiz metin: "${r.includes}" i\xE7ermeli`:r.format==="regex"?`Ge\xE7ersiz metin: ${r.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[r.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${de(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};tee=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(r))return"\u043C\u0430\u0441\u0438\u0432";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return r=>{switch(r.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${r.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Ee(r.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${r.origin} \u0431\u0443\u0434\u0435 ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${r.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${r.keys.length>1?"\u0456":""}: ${de(r.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${r.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${r.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};ree=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(r))return"\u0622\u0631\u06D2";if(r===null)return"\u0646\u0644";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return r=>{switch(r.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${r.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${n(r.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return r.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Ee(r.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${de(r.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${r.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${r.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${r.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u06D2 ${o}${r.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${r.origin} \u06A9\u0627 ${o}${r.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${r.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${r.keys.length>1?"\u0632":""}: ${de(r.keys,"\u060C ")}`;case"invalid_key":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${r.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};oee=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(r))return"m\u1EA3ng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return r=>{switch(r.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${r.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Ee(r.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${o}${r.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${r.origin??"gi\xE1 tr\u1ECB"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${a.verb} ${o}${r.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${i[o.format]??r.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${r.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${de(r.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${r.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};see=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(r))return"\u6570\u7EC4";if(r===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return r=>{switch(r.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${r.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Ee(r.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${r.origin??"\u503C"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${i[o.format]??r.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${r.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${de(r.keys,", ")}`;case"invalid_key":return`${r.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${r.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};lee=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(r){return e[r]??null}let n=r=>{let o=typeof r;switch(o){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return o},i={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return r=>{switch(r.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${r.expected}\uFF0C\u4F46\u6536\u5230 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Ee(r.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${de(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=t(r.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${r.origin??"\u503C"} \u61C9\u70BA ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=t(r.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${r.origin} \u61C9\u70BA ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${i[o.format]??r.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${r.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${r.keys.length>1?"\u5011":""}\uFF1A${de(r.keys,"\u3001")}`;case"invalid_key":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${r.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};W1=Symbol("ZodOutput"),H1=Symbol("ZodInput"),nu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let i=n[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let i={...this.get(n)??{}};return delete i.id,{...i,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};Si=Jv();Q1={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};Op=class{constructor(t){this._def=t,this.def=t}implement(t){if(typeof t!="function")throw Error("implement() must be called with a function");let n=(...i)=>{let r=this._def.input?Tp(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=t(...r);return this._def.output?Tp(this._def.output,o,void 0,{callee:n}):o};return n}implementAsync(t){if(typeof t!="function")throw Error("implement() must be called with a function");let n=async(...i)=>{let r=this._def.input?await Cp(this._def.input,i,void 0,{callee:n}):i;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=await t(...r);return this._def.output?Cp(this._def.output,o,void 0,{callee:n}):o};return n}input(...t){let n=this.constructor;return Array.isArray(t[0])?new n({type:"function",input:new km({type:"tuple",items:t[0],rest:t[1]}),output:this._def.output}):new n({type:"function",input:t[0],output:this._def.output})}output(t){return new this.constructor({type:"function",input:this._def.input,output:t})}};ou=class{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??Si,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var i;let r=t._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(t);if(a)return a.count++,n.schemaPath.includes(t)&&(a.cycle=n.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,s);let d=t._zod.toJSONSchema?.();if(d)s.schema=d;else{let u={...n,schemaPath:[...n.schemaPath,t],path:n.path},c=t._zod.parent;if(c)s.ref=c,this.process(c,u),this.seen.get(c).isParent=!0;else{let p=s.schema;switch(r.type){case"string":{let f=p;f.type="string";let{minimum:h,maximum:g,format:_,patterns:y,contentEncoding:b}=t._zod.bag;if(typeof h=="number"&&(f.minLength=h),typeof g=="number"&&(f.maxLength=g),_&&(f.format=o[_]??_,f.format===""&&delete f.format),b&&(f.contentEncoding=b),y&&y.size>0){let v=[...y];v.length===1?f.pattern=v[0].source:v.length>1&&(s.schema.allOf=[...v.map(w=>({...this.target==="draft-7"?{type:"string"}:{},pattern:w.source}))])}break}case"number":{let f=p,{minimum:h,maximum:g,format:_,multipleOf:y,exclusiveMaximum:b,exclusiveMinimum:v}=t._zod.bag;typeof _=="string"&&_.includes("int")?f.type="integer":f.type="number",typeof v=="number"&&(f.exclusiveMinimum=v),typeof h=="number"&&(f.minimum=h,typeof v=="number"&&(v>=h?delete f.minimum:delete f.exclusiveMinimum)),typeof b=="number"&&(f.exclusiveMaximum=b),typeof g=="number"&&(f.maximum=g,typeof b=="number"&&(b<=g?delete f.maximum:delete f.exclusiveMaximum)),typeof y=="number"&&(f.multipleOf=y);break}case"boolean":{let f=p;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{p.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let f=p,{minimum:h,maximum:g}=t._zod.bag;typeof h=="number"&&(f.minItems=h),typeof g=="number"&&(f.maxItems=g),f.type="array",f.items=this.process(r.element,{...u,path:[...u.path,"items"]});break}case"object":{let f=p;f.type="object",f.properties={};let h=r.shape;for(let y in h)f.properties[y]=this.process(h[y],{...u,path:[...u.path,"properties",y]});let g=new Set(Object.keys(h)),_=new Set([...g].filter(y=>{let b=r.shape[y]._zod;return this.io==="input"?b.optin===void 0:b.optout===void 0}));_.size>0&&(f.required=Array.from(_)),r.catchall?._zod.def.type==="never"?f.additionalProperties=!1:r.catchall?r.catchall&&(f.additionalProperties=this.process(r.catchall,{...u,path:[...u.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{let f=p;f.anyOf=r.options.map((h,g)=>this.process(h,{...u,path:[...u.path,"anyOf",g]}));break}case"intersection":{let f=p,h=this.process(r.left,{...u,path:[...u.path,"allOf",0]}),g=this.process(r.right,{...u,path:[...u.path,"allOf",1]}),_=b=>"allOf"in b&&Object.keys(b).length===1,y=[..._(h)?h.allOf:[h],..._(g)?g.allOf:[g]];f.allOf=y;break}case"tuple":{let f=p;f.type="array";let h=r.items.map((y,b)=>this.process(y,{...u,path:[...u.path,"prefixItems",b]}));if(this.target==="draft-2020-12"?f.prefixItems=h:f.items=h,r.rest){let y=this.process(r.rest,{...u,path:[...u.path,"items"]});this.target==="draft-2020-12"?f.items=y:f.additionalItems=y}r.rest&&(f.items=this.process(r.rest,{...u,path:[...u.path,"items"]}));let{minimum:g,maximum:_}=t._zod.bag;typeof g=="number"&&(f.minItems=g),typeof _=="number"&&(f.maxItems=_);break}case"record":{let f=p;f.type="object",f.propertyNames=this.process(r.keyType,{...u,path:[...u.path,"propertyNames"]}),f.additionalProperties=this.process(r.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let f=p,h=vv(r.entries);h.every(g=>typeof g=="number")&&(f.type="number"),h.every(g=>typeof g=="string")&&(f.type="string"),f.enum=h;break}case"literal":{let f=p,h=[];for(let g of r.values)if(g===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(g))}else h.push(g);if(h.length!==0)if(h.length===1){let g=h[0];f.type=g===null?"null":typeof g,f.const=g}else h.every(g=>typeof g=="number")&&(f.type="number"),h.every(g=>typeof g=="string")&&(f.type="string"),h.every(g=>typeof g=="boolean")&&(f.type="string"),h.every(g=>g===null)&&(f.type="null"),f.enum=h;break}case"file":{let f=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:_,mime:y}=t._zod.bag;g!==void 0&&(h.minLength=g),_!==void 0&&(h.maxLength=_),y?y.length===1?(h.contentMediaType=y[0],Object.assign(f,h)):f.anyOf=y.map(b=>({...h,contentMediaType:b})):Object.assign(f,h);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let f=this.process(r.innerType,u);p.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(r.innerType,u),s.ref=r.innerType;break}case"success":{let f=p;f.type="boolean";break}case"default":{this.process(r.innerType,u),s.ref=r.innerType,p.default=JSON.parse(JSON.stringify(r.defaultValue));break}case"prefault":{this.process(r.innerType,u),s.ref=r.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break}case"catch":{this.process(r.innerType,u),s.ref=r.innerType;let f;try{f=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}p.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let f=p,h=t._zod.pattern;if(!h)throw Error("Pattern not found in template literal");f.type="string",f.pattern=h.source;break}case"pipe":{let f=this.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;this.process(f,u),s.ref=f;break}case"readonly":{this.process(r.innerType,u),s.ref=r.innerType,p.readOnly=!0;break}case"promise":{this.process(r.innerType,u),s.ref=r.innerType;break}case"optional":{this.process(r.innerType,u),s.ref=r.innerType;break}case"lazy":{let f=t._zod.innerType;this.process(f,u),s.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(t);return l&&Object.assign(s.schema,l),this.io==="input"&&Lt(t)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(t).schema}emit(t,n){let i={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},r=this.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let c=this.target==="draft-2020-12"?"$defs":"definitions";if(i.external){let h=i.external.registry.get(u[0])?.id;if(h)return{ref:i.external.uri(h)};let g=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=g,{defId:g,ref:`${i.external.uri("__shared")}#/${c}/${g}`}}if(u[1]===r)return{ref:"#"};let p=`#/${c}/`,f=u[1].schema.id??`__schema${this.counter++}`;return{defId:f,ref:p+f}},a=u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:p,defId:f}=o(u);c.def={...c.schema},f&&(c.defId=f);let h=c.schema;for(let g in h)delete h[g];h.$ref=p};for(let u of this.seen.entries()){let c=u[1];if(t===u[0]){a(u);continue}if(i.external){let p=i.external.registry.get(u[0])?.id;if(t!==u[0]&&p){a(u);continue}}if(this.metadataRegistry.get(u[0])?.id){a(u);continue}if(c.cycle){if(i.cycles==="throw")throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
262
-
263
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);i.cycles==="ref"&&a(u);continue}if(c.count>1&&i.reused==="ref"){a(u);continue}}let s=(u,c)=>{let p=this.seen.get(u),f=p.def??p.schema,h={...f};if(p.ref===null)return;let g=p.ref;if(p.ref=null,g){s(g,c);let _=this.seen.get(g).schema;_.$ref&&c.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(_)):(Object.assign(f,_),Object.assign(f,h))}p.isParent||this.override({zodSchema:u,jsonSchema:f,path:p.path??[]})};for(let u of[...this.seen.entries()].reverse())s(u[0],{target:this.target});let d={};this.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?d.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(d,r.def);let l=i.external?.defs??{};for(let u of this.seen.entries()){let c=u[1];c.def&&c.defId&&(l[c.defId]=c.def)}!i.external&&Object.keys(l).length>0&&(this.target==="draft-2020-12"?d.$defs=l:d.definitions=l);try{return JSON.parse(JSON.stringify(d))}catch{throw Error("Error converting schema to JSON.")}}};Ree={},$ee=D("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");Te.init(e,t),e.def=t,e.parse=(n,i)=>Tp(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Sm(e,n,i),e.parseAsync=async(n,i)=>Cp(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>wm(e,n,i),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>Mr(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e)}),Mee=D("ZodMiniObject",(e,t)=>{Dv.init(e,t),$ee.init(e,t),Re.defineLazy(e,"shape",()=>t.shape)});m={};ei(m,{xid:()=>Zee,void:()=>yte,uuidv7:()=>zee,uuidv6:()=>Gee,uuidv4:()=>Uee,uuid:()=>Lee,url:()=>Jee,uppercase:()=>hS,unknown:()=>bt,union:()=>Xe,undefined:()=>hte,ulid:()=>Vee,uint64:()=>pte,uint32:()=>ute,tuple:()=>Ste,trim:()=>SS,treeifyError:()=>J$,transform:()=>nw,toUpperCase:()=>kS,toLowerCase:()=>wS,toJSONSchema:()=>TS,templateLiteral:()=>Ite,symbol:()=>mte,superRefine:()=>Aq,success:()=>Ete,stringbool:()=>$te,stringFormat:()=>ate,string:()=>G,strictObject:()=>vte,startsWith:()=>yS,size:()=>fS,setErrorMap:()=>qte,set:()=>xte,safeParseAsync:()=>Kj,safeParse:()=>Jj,registry:()=>Jv,regexes:()=>Iv,regex:()=>pS,refine:()=>Cq,record:()=>Ye,readonly:()=>bq,property:()=>Ej,promise:()=>Ote,prettifyError:()=>B$,preprocess:()=>aw,prefault:()=>fq,positive:()=>xj,pipe:()=>Mp,partialRecord:()=>wte,parseAsync:()=>zj,parse:()=>Gj,overwrite:()=>Xo,optional:()=>st,object:()=>ce,number:()=>Ge,nullish:()=>Ate,nullable:()=>$p,null:()=>ZS,normalize:()=>vS,nonpositive:()=>Cj,nonoptional:()=>pq,nonnegative:()=>Aj,never:()=>Om,negative:()=>Tj,nativeEnum:()=>Tte,nanoid:()=>Bee,nan:()=>Pte,multipleOf:()=>ru,minSize:()=>iu,minLength:()=>Os,mime:()=>bS,maxSize:()=>xm,maxLength:()=>Tm,map:()=>kte,lte:()=>Ar,lt:()=>Ko,lowercase:()=>mS,looseObject:()=>_n,locales:()=>zv,literal:()=>ye,length:()=>Cm,lazy:()=>wq,ksuid:()=>Qee,keyof:()=>bte,jwt:()=>ote,json:()=>Mte,iso:()=>CS,ipv6:()=>Xee,ipv4:()=>Yee,intersection:()=>$m,int64:()=>fte,int32:()=>lte,int:()=>nb,instanceof:()=>Rte,includes:()=>gS,guid:()=>Dee,gte:()=>zn,gt:()=>Bo,globalRegistry:()=>Si,getErrorMap:()=>Nte,function:()=>jj,formatError:()=>Tv,float64:()=>dte,float32:()=>ste,flattenError:()=>xv,file:()=>Cte,enum:()=>$n,endsWith:()=>_S,emoji:()=>Kee,email:()=>Fee,e164:()=>ite,discriminatedUnion:()=>XS,date:()=>_te,custom:()=>Tq,cuid2:()=>Hee,cuid:()=>Wee,core:()=>R$,config:()=>Sn,coerce:()=>Eq,clone:()=>Mr,cidrv6:()=>tte,cidrv4:()=>ete,check:()=>xq,catch:()=>gq,boolean:()=>Ut,bigint:()=>cte,base64url:()=>rte,base64:()=>nte,array:()=>$e,any:()=>gte,_default:()=>uq,_ZodString:()=>OS,ZodXID:()=>DS,ZodVoid:()=>Xj,ZodUnknown:()=>Qj,ZodUnion:()=>YS,ZodUndefined:()=>Hj,ZodUUID:()=>wi,ZodURL:()=>$S,ZodULID:()=>FS,ZodType:()=>Oe,ZodTuple:()=>rq,ZodTransform:()=>tw,ZodTemplateLiteral:()=>vq,ZodSymbol:()=>Wj,ZodSuccess:()=>mq,ZodStringFormat:()=>lt,ZodString:()=>Am,ZodSet:()=>oq,ZodRecord:()=>ew,ZodRealError:()=>vu,ZodReadonly:()=>_q,ZodPromise:()=>kq,ZodPrefault:()=>cq,ZodPipe:()=>ow,ZodOptional:()=>rw,ZodObject:()=>Rm,ZodNumberFormat:()=>Us,ZodNumber:()=>Em,ZodNullable:()=>dq,ZodNull:()=>Vj,ZodNonOptional:()=>iw,ZodNever:()=>Yj,ZodNanoID:()=>jS,ZodNaN:()=>yq,ZodMap:()=>iq,ZodLiteral:()=>aq,ZodLazy:()=>Sq,ZodKSUID:()=>LS,ZodJWT:()=>HS,ZodIssueCode:()=>jte,ZodIntersection:()=>nq,ZodISOTime:()=>PS,ZodISODuration:()=>IS,ZodISODateTime:()=>AS,ZodISODate:()=>ES,ZodIPv6:()=>GS,ZodIPv4:()=>US,ZodGUID:()=>Rp,ZodFile:()=>sq,ZodError:()=>Nee,ZodEnum:()=>au,ZodEmoji:()=>MS,ZodEmail:()=>RS,ZodE164:()=>WS,ZodDiscriminatedUnion:()=>tq,ZodDefault:()=>lq,ZodDate:()=>QS,ZodCustomStringFormat:()=>Bj,ZodCustom:()=>Mm,ZodCatch:()=>hq,ZodCUID2:()=>NS,ZodCUID:()=>qS,ZodCIDRv6:()=>JS,ZodCIDRv4:()=>zS,ZodBoolean:()=>Pm,ZodBigIntFormat:()=>VS,ZodBigInt:()=>Im,ZodBase64URL:()=>BS,ZodBase64:()=>KS,ZodArray:()=>eq,ZodAny:()=>Zj,TimePrecision:()=>Q1,NEVER:()=>$$,$output:()=>W1,$input:()=>H1,$brand:()=>M$});CS={};ei(CS,{time:()=>Dj,duration:()=>Lj,datetime:()=>Nj,date:()=>Fj,ZodISOTime:()=>PS,ZodISODuration:()=>IS,ZodISODateTime:()=>AS,ZodISODate:()=>ES});AS=D("ZodISODateTime",(e,t)=>{t1.init(e,t),lt.init(e,t)});ES=D("ZodISODate",(e,t)=>{n1.init(e,t),lt.init(e,t)});PS=D("ZodISOTime",(e,t)=>{r1.init(e,t),lt.init(e,t)});IS=D("ZodISODuration",(e,t)=>{i1.init(e,t),lt.init(e,t)});Uj=(e,t)=>{kv.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Tv(e,n)},flatten:{value:n=>xv(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Nee=D("ZodError",Uj),vu=D("ZodError",Uj,{Parent:Error}),Gj=Cv(vu),zj=Av(vu),Jj=Ev(vu),Kj=Pv(vu),Oe=D("ZodType",(e,t)=>(Te.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(n,i)=>Mr(e,n,i),e.brand=()=>e,e.register=(n,i)=>(n.add(e,i),e),e.parse=(n,i)=>Gj(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Jj(e,n,i),e.parseAsync=async(n,i)=>zj(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>Kj(e,n,i),e.spa=e.safeParseAsync,e.refine=(n,i)=>e.check(Cq(n,i)),e.superRefine=n=>e.check(Aq(n)),e.overwrite=n=>e.check(Xo(n)),e.optional=()=>st(e),e.nullable=()=>$p(e),e.nullish=()=>st($p(e)),e.nonoptional=n=>pq(e,n),e.array=()=>$e(e),e.or=n=>Xe([e,n]),e.and=n=>$m(e,n),e.transform=n=>Mp(e,nw(n)),e.default=n=>uq(e,n),e.prefault=n=>fq(e,n),e.catch=n=>gq(e,n),e.pipe=n=>Mp(e,n),e.readonly=()=>bq(e),e.describe=n=>{let i=e.clone();return Si.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return Si.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Si.get(e);let i=e.clone();return Si.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),OS=D("_ZodString",(e,t)=>{_u.init(e,t),Oe.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(pS(...i)),e.includes=(...i)=>e.check(gS(...i)),e.startsWith=(...i)=>e.check(yS(...i)),e.endsWith=(...i)=>e.check(_S(...i)),e.min=(...i)=>e.check(Os(...i)),e.max=(...i)=>e.check(Tm(...i)),e.length=(...i)=>e.check(Cm(...i)),e.nonempty=(...i)=>e.check(Os(1,...i)),e.lowercase=i=>e.check(mS(i)),e.uppercase=i=>e.check(hS(i)),e.trim=()=>e.check(SS()),e.normalize=(...i)=>e.check(vS(...i)),e.toLowerCase=()=>e.check(wS()),e.toUpperCase=()=>e.check(kS())}),Am=D("ZodString",(e,t)=>{_u.init(e,t),OS.init(e,t),e.email=n=>e.check(Kv(RS,n)),e.url=n=>e.check(Zv($S,n)),e.jwt=n=>e.check(cS(HS,n)),e.emoji=n=>e.check(Qv(MS,n)),e.guid=n=>e.check(Pp(Rp,n)),e.uuid=n=>e.check(Bv(wi,n)),e.uuidv4=n=>e.check(Wv(wi,n)),e.uuidv6=n=>e.check(Hv(wi,n)),e.uuidv7=n=>e.check(Vv(wi,n)),e.nanoid=n=>e.check(Yv(jS,n)),e.guid=n=>e.check(Pp(Rp,n)),e.cuid=n=>e.check(Xv(qS,n)),e.cuid2=n=>e.check(eS(NS,n)),e.ulid=n=>e.check(tS(FS,n)),e.base64=n=>e.check(dS(KS,n)),e.base64url=n=>e.check(lS(BS,n)),e.xid=n=>e.check(nS(DS,n)),e.ksuid=n=>e.check(rS(LS,n)),e.ipv4=n=>e.check(iS(US,n)),e.ipv6=n=>e.check(oS(GS,n)),e.cidrv4=n=>e.check(aS(zS,n)),e.cidrv6=n=>e.check(sS(JS,n)),e.e164=n=>e.check(uS(WS,n)),e.datetime=n=>e.check(Nj(n)),e.date=n=>e.check(Fj(n)),e.time=n=>e.check(Dj(n)),e.duration=n=>e.check(Lj(n))});lt=D("ZodStringFormat",(e,t)=>{et.init(e,t),OS.init(e,t)}),RS=D("ZodEmail",(e,t)=>{BM.init(e,t),lt.init(e,t)});Rp=D("ZodGUID",(e,t)=>{JM.init(e,t),lt.init(e,t)});wi=D("ZodUUID",(e,t)=>{KM.init(e,t),lt.init(e,t)});$S=D("ZodURL",(e,t)=>{WM.init(e,t),lt.init(e,t)});MS=D("ZodEmoji",(e,t)=>{HM.init(e,t),lt.init(e,t)});jS=D("ZodNanoID",(e,t)=>{VM.init(e,t),lt.init(e,t)});qS=D("ZodCUID",(e,t)=>{ZM.init(e,t),lt.init(e,t)});NS=D("ZodCUID2",(e,t)=>{QM.init(e,t),lt.init(e,t)});FS=D("ZodULID",(e,t)=>{YM.init(e,t),lt.init(e,t)});DS=D("ZodXID",(e,t)=>{XM.init(e,t),lt.init(e,t)});LS=D("ZodKSUID",(e,t)=>{e1.init(e,t),lt.init(e,t)});US=D("ZodIPv4",(e,t)=>{o1.init(e,t),lt.init(e,t)});GS=D("ZodIPv6",(e,t)=>{a1.init(e,t),lt.init(e,t)});zS=D("ZodCIDRv4",(e,t)=>{s1.init(e,t),lt.init(e,t)});JS=D("ZodCIDRv6",(e,t)=>{d1.init(e,t),lt.init(e,t)});KS=D("ZodBase64",(e,t)=>{l1.init(e,t),lt.init(e,t)});BS=D("ZodBase64URL",(e,t)=>{c1.init(e,t),lt.init(e,t)});WS=D("ZodE164",(e,t)=>{f1.init(e,t),lt.init(e,t)});HS=D("ZodJWT",(e,t)=>{m1.init(e,t),lt.init(e,t)});Bj=D("ZodCustomStringFormat",(e,t)=>{h1.init(e,t),lt.init(e,t)});Em=D("ZodNumber",(e,t)=>{jv.init(e,t),Oe.init(e,t),e.gt=(i,r)=>e.check(Bo(i,r)),e.gte=(i,r)=>e.check(zn(i,r)),e.min=(i,r)=>e.check(zn(i,r)),e.lt=(i,r)=>e.check(Ko(i,r)),e.lte=(i,r)=>e.check(Ar(i,r)),e.max=(i,r)=>e.check(Ar(i,r)),e.int=i=>e.check(nb(i)),e.safe=i=>e.check(nb(i)),e.positive=i=>e.check(Bo(0,i)),e.nonnegative=i=>e.check(zn(0,i)),e.negative=i=>e.check(Ko(0,i)),e.nonpositive=i=>e.check(Ar(0,i)),e.multipleOf=(i,r)=>e.check(ru(i,r)),e.step=(i,r)=>e.check(ru(i,r)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});Us=D("ZodNumberFormat",(e,t)=>{g1.init(e,t),Em.init(e,t)});Pm=D("ZodBoolean",(e,t)=>{qv.init(e,t),Oe.init(e,t)});Im=D("ZodBigInt",(e,t)=>{Nv.init(e,t),Oe.init(e,t),e.gte=(i,r)=>e.check(zn(i,r)),e.min=(i,r)=>e.check(zn(i,r)),e.gt=(i,r)=>e.check(Bo(i,r)),e.gte=(i,r)=>e.check(zn(i,r)),e.min=(i,r)=>e.check(zn(i,r)),e.lt=(i,r)=>e.check(Ko(i,r)),e.lte=(i,r)=>e.check(Ar(i,r)),e.max=(i,r)=>e.check(Ar(i,r)),e.positive=i=>e.check(Bo(BigInt(0),i)),e.negative=i=>e.check(Ko(BigInt(0),i)),e.nonpositive=i=>e.check(Ar(BigInt(0),i)),e.nonnegative=i=>e.check(zn(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(ru(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});VS=D("ZodBigIntFormat",(e,t)=>{y1.init(e,t),Im.init(e,t)});Wj=D("ZodSymbol",(e,t)=>{_1.init(e,t),Oe.init(e,t)});Hj=D("ZodUndefined",(e,t)=>{b1.init(e,t),Oe.init(e,t)});Vj=D("ZodNull",(e,t)=>{v1.init(e,t),Oe.init(e,t)});Zj=D("ZodAny",(e,t)=>{S1.init(e,t),Oe.init(e,t)});Qj=D("ZodUnknown",(e,t)=>{Ep.init(e,t),Oe.init(e,t)});Yj=D("ZodNever",(e,t)=>{w1.init(e,t),Oe.init(e,t)});Xj=D("ZodVoid",(e,t)=>{k1.init(e,t),Oe.init(e,t)});QS=D("ZodDate",(e,t)=>{x1.init(e,t),Oe.init(e,t),e.min=(i,r)=>e.check(zn(i,r)),e.max=(i,r)=>e.check(Ar(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});eq=D("ZodArray",(e,t)=>{Fv.init(e,t),Oe.init(e,t),e.element=t.element,e.min=(n,i)=>e.check(Os(n,i)),e.nonempty=n=>e.check(Os(1,n)),e.max=(n,i)=>e.check(Tm(n,i)),e.length=(n,i)=>e.check(Cm(n,i)),e.unwrap=()=>e.element});Rm=D("ZodObject",(e,t)=>{Dv.init(e,t),Oe.init(e,t),Re.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>$n(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:bt()}),e.loose=()=>e.clone({...e._zod.def,catchall:bt()}),e.strict=()=>e.clone({...e._zod.def,catchall:Om()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Re.extend(e,n),e.merge=n=>Re.merge(e,n),e.pick=n=>Re.pick(e,n),e.omit=n=>Re.omit(e,n),e.partial=(...n)=>Re.partial(rw,e,n[0]),e.required=(...n)=>Re.required(iw,e,n[0])});YS=D("ZodUnion",(e,t)=>{Lv.init(e,t),Oe.init(e,t),e.options=t.options});tq=D("ZodDiscriminatedUnion",(e,t)=>{YS.init(e,t),T1.init(e,t)});nq=D("ZodIntersection",(e,t)=>{C1.init(e,t),Oe.init(e,t)});rq=D("ZodTuple",(e,t)=>{km.init(e,t),Oe.init(e,t),e.rest=n=>e.clone({...e._zod.def,rest:n})});ew=D("ZodRecord",(e,t)=>{A1.init(e,t),Oe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});iq=D("ZodMap",(e,t)=>{E1.init(e,t),Oe.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});oq=D("ZodSet",(e,t)=>{P1.init(e,t),Oe.init(e,t),e.min=(...n)=>e.check(iu(...n)),e.nonempty=n=>e.check(iu(1,n)),e.max=(...n)=>e.check(xm(...n)),e.size=(...n)=>e.check(fS(...n))});au=D("ZodEnum",(e,t)=>{I1.init(e,t),Oe.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new au({...t,checks:[],...Re.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw Error(`Key ${a} not found in enum`);return new au({...t,checks:[],...Re.normalizeParams(r),entries:o})}});aq=D("ZodLiteral",(e,t)=>{O1.init(e,t),Oe.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});sq=D("ZodFile",(e,t)=>{R1.init(e,t),Oe.init(e,t),e.min=(n,i)=>e.check(iu(n,i)),e.max=(n,i)=>e.check(xm(n,i)),e.mime=(n,i)=>e.check(bS(Array.isArray(n)?n:[n],i))});tw=D("ZodTransform",(e,t)=>{Uv.init(e,t),Oe.init(e,t),e._zod.parse=(n,i)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(Re.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),a.continue??(a.continue=!0),n.issues.push(Re.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});rw=D("ZodOptional",(e,t)=>{$1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});dq=D("ZodNullable",(e,t)=>{M1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});lq=D("ZodDefault",(e,t)=>{j1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});cq=D("ZodPrefault",(e,t)=>{q1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});iw=D("ZodNonOptional",(e,t)=>{N1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});mq=D("ZodSuccess",(e,t)=>{F1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});hq=D("ZodCatch",(e,t)=>{D1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});yq=D("ZodNaN",(e,t)=>{L1.init(e,t),Oe.init(e,t)});ow=D("ZodPipe",(e,t)=>{Gv.init(e,t),Oe.init(e,t),e.in=t.in,e.out=t.out});_q=D("ZodReadonly",(e,t)=>{U1.init(e,t),Oe.init(e,t)});vq=D("ZodTemplateLiteral",(e,t)=>{G1.init(e,t),Oe.init(e,t)});Sq=D("ZodLazy",(e,t)=>{J1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.getter()});kq=D("ZodPromise",(e,t)=>{z1.init(e,t),Oe.init(e,t),e.unwrap=()=>e._zod.def.innerType});Mm=D("ZodCustom",(e,t)=>{K1.init(e,t),Oe.init(e,t)});$te=(...e)=>$j({Pipe:ow,Boolean:Pm,String:Am,Transform:tw},...e);jte={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Eq={};ei(Eq,{string:()=>Fte,number:()=>Dte,date:()=>Gte,boolean:()=>Lte,bigint:()=>Ute});Sn(B1());zte=m,Pq=zte,Iq="2025-11-25",Jte=[Iq,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],jo="io.modelcontextprotocol/related-task",jm="2.0",Gt=Tq(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Oq=Xe([G(),Ge().int()]),Rq=G(),XAe=_n({ttl:Ge().optional(),pollInterval:Ge().optional()}),Kte=ce({ttl:Ge().optional()}),Bte=ce({taskId:G()}),sw=_n({progressToken:Oq.optional(),[jo]:Bte.optional()}),Wn=ce({_meta:sw.optional()}),Su=Wn.extend({task:Kte.optional()}),Wte=e=>Su.safeParse(e).success,on=ce({method:G(),params:Wn.loose().optional()}),fr=ce({_meta:sw.optional()}),pr=ce({method:G(),params:fr.loose().optional()}),an=_n({_meta:sw.optional()}),qm=Xe([G(),Ge().int()]),$q=ce({jsonrpc:ye(jm),id:qm,...on.shape}).strict(),PI=e=>$q.safeParse(e).success,Mq=ce({jsonrpc:ye(jm),...pr.shape}).strict(),Hte=e=>Mq.safeParse(e).success,dw=ce({jsonrpc:ye(jm),id:qm,result:an}).strict(),wf=e=>dw.safeParse(e).success;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(we||(we={}));lw=ce({jsonrpc:ye(jm),id:qm.optional(),error:ce({code:Ge().int(),message:G(),data:bt().optional()})}).strict(),Vte=e=>lw.safeParse(e).success,eEe=Xe([$q,Mq,dw,lw]),tEe=Xe([dw,lw]),uw=an.strict(),Zte=fr.extend({requestId:qm.optional(),reason:G().optional()}),cw=pr.extend({method:ye("notifications/cancelled"),params:Zte}),Qte=ce({src:G(),mimeType:G().optional(),sizes:$e(G()).optional(),theme:$n(["light","dark"]).optional()}),wu=ce({icons:$e(Qte).optional()}),Rs=ce({name:G(),title:G().optional()}),jq=Rs.extend({...Rs.shape,...wu.shape,version:G(),websiteUrl:G().optional(),description:G().optional()}),Yte=$m(ce({applyDefaults:Ut().optional()}),Ye(G(),bt())),Xte=aw(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$m(ce({form:Yte.optional(),url:Gt.optional()}),Ye(G(),bt()).optional())),ene=_n({list:Gt.optional(),cancel:Gt.optional(),requests:_n({sampling:_n({createMessage:Gt.optional()}).optional(),elicitation:_n({create:Gt.optional()}).optional()}).optional()}),tne=_n({list:Gt.optional(),cancel:Gt.optional(),requests:_n({tools:_n({call:Gt.optional()}).optional()}).optional()}),nne=ce({experimental:Ye(G(),Gt).optional(),sampling:ce({context:Gt.optional(),tools:Gt.optional()}).optional(),elicitation:Xte.optional(),roots:ce({listChanged:Ut().optional()}).optional(),tasks:ene.optional(),extensions:Ye(G(),Gt).optional()}),rne=Wn.extend({protocolVersion:G(),capabilities:nne,clientInfo:jq}),qq=on.extend({method:ye("initialize"),params:rne}),ine=ce({experimental:Ye(G(),Gt).optional(),logging:Gt.optional(),completions:Gt.optional(),prompts:ce({listChanged:Ut().optional()}).optional(),resources:ce({subscribe:Ut().optional(),listChanged:Ut().optional()}).optional(),tools:ce({listChanged:Ut().optional()}).optional(),tasks:tne.optional(),extensions:Ye(G(),Gt).optional()}),one=an.extend({protocolVersion:G(),capabilities:ine,serverInfo:jq,instructions:G().optional()}),Nq=pr.extend({method:ye("notifications/initialized"),params:fr.optional()}),fw=on.extend({method:ye("ping"),params:Wn.optional()}),ane=ce({progress:Ge(),total:st(Ge()),message:st(G())}),sne=ce({...fr.shape,...ane.shape,progressToken:Oq}),pw=pr.extend({method:ye("notifications/progress"),params:sne}),dne=Wn.extend({cursor:Rq.optional()}),ku=on.extend({params:dne.optional()}),xu=an.extend({nextCursor:Rq.optional()}),lne=$n(["working","input_required","completed","failed","cancelled"]),Tu=ce({taskId:G(),status:lne,ttl:Xe([Ge(),ZS()]),createdAt:G(),lastUpdatedAt:G(),pollInterval:st(Ge()),statusMessage:st(G())}),Nm=an.extend({task:Tu}),une=fr.merge(Tu),jp=pr.extend({method:ye("notifications/tasks/status"),params:une}),mw=on.extend({method:ye("tasks/get"),params:Wn.extend({taskId:G()})}),hw=an.merge(Tu),gw=on.extend({method:ye("tasks/result"),params:Wn.extend({taskId:G()})}),nEe=an.loose(),yw=ku.extend({method:ye("tasks/list")}),_w=xu.extend({tasks:$e(Tu)}),bw=on.extend({method:ye("tasks/cancel"),params:Wn.extend({taskId:G()})}),cne=an.merge(Tu),Fq=ce({uri:G(),mimeType:st(G()),_meta:Ye(G(),bt()).optional()}),Dq=Fq.extend({text:G()}),vw=G().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Lq=Fq.extend({blob:vw}),Cu=$n(["user","assistant"]),Gs=ce({audience:$e(Cu).optional(),priority:Ge().min(0).max(1).optional(),lastModified:CS.datetime({offset:!0}).optional()}),Uq=ce({...Rs.shape,...wu.shape,uri:G(),description:st(G()),mimeType:st(G()),size:st(Ge()),annotations:Gs.optional(),_meta:st(_n({}))}),fne=ce({...Rs.shape,...wu.shape,uriTemplate:G(),description:st(G()),mimeType:st(G()),annotations:Gs.optional(),_meta:st(_n({}))}),rb=ku.extend({method:ye("resources/list")}),pne=xu.extend({resources:$e(Uq)}),ib=ku.extend({method:ye("resources/templates/list")}),mne=xu.extend({resourceTemplates:$e(fne)}),Sw=Wn.extend({uri:G()}),hne=Sw,ob=on.extend({method:ye("resources/read"),params:hne}),gne=an.extend({contents:$e(Xe([Dq,Lq]))}),yne=pr.extend({method:ye("notifications/resources/list_changed"),params:fr.optional()}),_ne=Sw,bne=on.extend({method:ye("resources/subscribe"),params:_ne}),vne=Sw,Sne=on.extend({method:ye("resources/unsubscribe"),params:vne}),wne=fr.extend({uri:G()}),kne=pr.extend({method:ye("notifications/resources/updated"),params:wne}),xne=ce({name:G(),description:st(G()),required:st(Ut())}),Tne=ce({...Rs.shape,...wu.shape,description:st(G()),arguments:st($e(xne)),_meta:st(_n({}))}),ab=ku.extend({method:ye("prompts/list")}),Cne=xu.extend({prompts:$e(Tne)}),Ane=Wn.extend({name:G(),arguments:Ye(G(),G()).optional()}),sb=on.extend({method:ye("prompts/get"),params:Ane}),ww=ce({type:ye("text"),text:G(),annotations:Gs.optional(),_meta:Ye(G(),bt()).optional()}),kw=ce({type:ye("image"),data:vw,mimeType:G(),annotations:Gs.optional(),_meta:Ye(G(),bt()).optional()}),xw=ce({type:ye("audio"),data:vw,mimeType:G(),annotations:Gs.optional(),_meta:Ye(G(),bt()).optional()}),Ene=ce({type:ye("tool_use"),name:G(),id:G(),input:Ye(G(),bt()),_meta:Ye(G(),bt()).optional()}),Pne=ce({type:ye("resource"),resource:Xe([Dq,Lq]),annotations:Gs.optional(),_meta:Ye(G(),bt()).optional()}),Ine=Uq.extend({type:ye("resource_link")}),Tw=Xe([ww,kw,xw,Ine,Pne]),One=ce({role:Cu,content:Tw}),Rne=an.extend({description:G().optional(),messages:$e(One)}),$ne=pr.extend({method:ye("notifications/prompts/list_changed"),params:fr.optional()}),Mne=ce({title:G().optional(),readOnlyHint:Ut().optional(),destructiveHint:Ut().optional(),idempotentHint:Ut().optional(),openWorldHint:Ut().optional()}),jne=ce({taskSupport:$n(["required","optional","forbidden"]).optional()}),Gq=ce({...Rs.shape,...wu.shape,description:G().optional(),inputSchema:ce({type:ye("object"),properties:Ye(G(),Gt).optional(),required:$e(G()).optional()}).catchall(bt()),outputSchema:ce({type:ye("object"),properties:Ye(G(),Gt).optional(),required:$e(G()).optional()}).catchall(bt()).optional(),annotations:Mne.optional(),execution:jne.optional(),_meta:Ye(G(),bt()).optional()}),db=ku.extend({method:ye("tools/list")}),qne=xu.extend({tools:$e(Gq)}),Cw=an.extend({content:$e(Tw).default([]),structuredContent:Ye(G(),bt()).optional(),isError:Ut().optional()}),rEe=Cw.or(an.extend({toolResult:bt()})),Nne=Su.extend({name:G(),arguments:Ye(G(),bt()).optional()}),qp=on.extend({method:ye("tools/call"),params:Nne}),Fne=pr.extend({method:ye("notifications/tools/list_changed"),params:fr.optional()}),iEe=ce({autoRefresh:Ut().default(!0),debounceMs:Ge().int().nonnegative().default(300)}),Np=$n(["debug","info","notice","warning","error","critical","alert","emergency"]),Dne=Wn.extend({level:Np}),zq=on.extend({method:ye("logging/setLevel"),params:Dne}),Lne=fr.extend({level:Np,logger:G().optional(),data:bt()}),Une=pr.extend({method:ye("notifications/message"),params:Lne}),Gne=ce({name:G().optional()}),zne=ce({hints:$e(Gne).optional(),costPriority:Ge().min(0).max(1).optional(),speedPriority:Ge().min(0).max(1).optional(),intelligencePriority:Ge().min(0).max(1).optional()}),Jne=ce({mode:$n(["auto","required","none"]).optional()}),Kne=ce({type:ye("tool_result"),toolUseId:G().describe("The unique identifier for the corresponding tool call."),content:$e(Tw).default([]),structuredContent:ce({}).loose().optional(),isError:Ut().optional(),_meta:Ye(G(),bt()).optional()}),Bne=XS("type",[ww,kw,xw]),Fp=XS("type",[ww,kw,xw,Ene,Kne]),Wne=ce({role:Cu,content:Xe([Fp,$e(Fp)]),_meta:Ye(G(),bt()).optional()}),Hne=Su.extend({messages:$e(Wne),modelPreferences:zne.optional(),systemPrompt:G().optional(),includeContext:$n(["none","thisServer","allServers"]).optional(),temperature:Ge().optional(),maxTokens:Ge().int(),stopSequences:$e(G()).optional(),metadata:Gt.optional(),tools:$e(Gq).optional(),toolChoice:Jne.optional()}),Vne=on.extend({method:ye("sampling/createMessage"),params:Hne}),Aw=an.extend({model:G(),stopReason:st($n(["endTurn","stopSequence","maxTokens"]).or(G())),role:Cu,content:Bne}),Jq=an.extend({model:G(),stopReason:st($n(["endTurn","stopSequence","maxTokens","toolUse"]).or(G())),role:Cu,content:Xe([Fp,$e(Fp)])}),Zne=ce({type:ye("boolean"),title:G().optional(),description:G().optional(),default:Ut().optional()}),Qne=ce({type:ye("string"),title:G().optional(),description:G().optional(),minLength:Ge().optional(),maxLength:Ge().optional(),format:$n(["email","uri","date","date-time"]).optional(),default:G().optional()}),Yne=ce({type:$n(["number","integer"]),title:G().optional(),description:G().optional(),minimum:Ge().optional(),maximum:Ge().optional(),default:Ge().optional()}),Xne=ce({type:ye("string"),title:G().optional(),description:G().optional(),enum:$e(G()),default:G().optional()}),ere=ce({type:ye("string"),title:G().optional(),description:G().optional(),oneOf:$e(ce({const:G(),title:G()})),default:G().optional()}),tre=ce({type:ye("string"),title:G().optional(),description:G().optional(),enum:$e(G()),enumNames:$e(G()).optional(),default:G().optional()}),nre=Xe([Xne,ere]),rre=ce({type:ye("array"),title:G().optional(),description:G().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:ce({type:ye("string"),enum:$e(G())}),default:$e(G()).optional()}),ire=ce({type:ye("array"),title:G().optional(),description:G().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:ce({anyOf:$e(ce({const:G(),title:G()}))}),default:$e(G()).optional()}),ore=Xe([rre,ire]),are=Xe([tre,nre,ore]),sre=Xe([are,Zne,Qne,Yne]),dre=Su.extend({mode:ye("form").optional(),message:G(),requestedSchema:ce({type:ye("object"),properties:Ye(G(),sre),required:$e(G()).optional()})}),lre=Su.extend({mode:ye("url"),message:G(),elicitationId:G(),url:G().url()}),ure=Xe([dre,lre]),cre=on.extend({method:ye("elicitation/create"),params:ure}),fre=fr.extend({elicitationId:G()}),pre=pr.extend({method:ye("notifications/elicitation/complete"),params:fre}),Dp=an.extend({action:$n(["accept","decline","cancel"]),content:aw(e=>e===null?void 0:e,Ye(G(),Xe([G(),Ge(),Ut(),$e(G())])).optional())}),mre=ce({type:ye("ref/resource"),uri:G()}),hre=ce({type:ye("ref/prompt"),name:G()}),gre=Wn.extend({ref:Xe([hre,mre]),argument:ce({name:G(),value:G()}),context:ce({arguments:Ye(G(),G()).optional()}).optional()}),lb=on.extend({method:ye("completion/complete"),params:gre});bre=an.extend({completion:_n({values:$e(G()).max(100),total:st(Ge().int()),hasMore:st(Ut())})}),vre=ce({uri:G().startsWith("file://"),name:G().optional(),_meta:Ye(G(),bt()).optional()}),Sre=on.extend({method:ye("roots/list"),params:Wn.optional()}),Kq=an.extend({roots:$e(vre)}),wre=pr.extend({method:ye("notifications/roots/list_changed"),params:fr.optional()}),oEe=Xe([fw,qq,lb,zq,sb,ab,rb,ib,ob,bne,Sne,qp,db,mw,gw,yw,bw]),aEe=Xe([cw,pw,Nq,wre,jp]),sEe=Xe([uw,Aw,Jq,Dp,Kq,hw,_w,Nm]),dEe=Xe([fw,Vne,cre,Sre,mw,gw,yw,bw]),lEe=Xe([cw,pw,Une,kne,yne,Fne,$ne,jp,pre]),uEe=Xe([uw,one,bre,Rne,Cne,pne,mne,gne,Cw,qne,hw,_w,Nm]),_e=class e extends Error{constructor(t,n,i){super(`MCP error ${t}: ${n}`),this.code=t,this.data=i,this.name="McpError"}static fromError(t,n,i){if(t===we.UrlElicitationRequired&&i){let r=i;if(r.elicitations)return new ub(r.elicitations,n)}return new e(t,n,i)}},ub=class extends _e{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(we.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};kre=Symbol("Let zodToJsonSchema decide on which parser to use"),II={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},xre=e=>typeof e=="string"?{...II,name:e}:{...II,...e},Tre=e=>{let t=xre(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};Wq=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};Pre=(e,t)=>Ue(e.innerType._def,t);Ire=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let i of e.checks)switch(i.kind){case"min":We(n,"minimum",i.value,i.message,t);break;case"max":We(n,"maximum",i.value,i.message,t);break}return n};Mre=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;n_=void 0,xr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(n_===void 0&&(n_=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n_),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};Nre=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");Lp={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};RI=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,r)=>Ue(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return n.length?{anyOf:n}:void 0};Vre=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Ue(e.innerType._def,t);let n=Ue(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Rn(t)},n]}:Rn(t)},Zre=(e,t)=>{if(t.pipeStrategy==="input")return Ue(e.in._def,t);if(t.pipeStrategy==="output")return Ue(e.out._def,t);let n=Ue(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=Ue(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,i].filter(r=>r!==void 0)}};nie=(e,t)=>Ue(e.innerType._def,t),rie=(e,t,n)=>{switch(t){case oe.ZodString:return Zq(e,n);case oe.ZodNumber:return Kre(e,n);case oe.ZodObject:return Bre(e,n);case oe.ZodBigInt:return Are(e,n);case oe.ZodBoolean:return Ere();case oe.ZodDate:return Vq(e,n);case oe.ZodUndefined:return eie(n);case oe.ZodNull:return Gre(n);case oe.ZodArray:return Cre(e,n);case oe.ZodUnion:case oe.ZodDiscriminatedUnion:return zre(e,n);case oe.ZodIntersection:return jre(e,n);case oe.ZodTuple:return Xre(e,n);case oe.ZodRecord:return Qq(e,n);case oe.ZodLiteral:return qre(e,n);case oe.ZodEnum:return $re(e);case oe.ZodNativeEnum:return Lre(e);case oe.ZodNullable:return Jre(e,n);case oe.ZodOptional:return Vre(e,n);case oe.ZodMap:return Dre(e,n);case oe.ZodSet:return Yre(e,n);case oe.ZodLazy:return()=>e.getter()._def;case oe.ZodPromise:return Qre(e,n);case oe.ZodNaN:case oe.ZodNever:return Ure(n);case oe.ZodEffects:return Rre(e,n);case oe.ZodAny:return Rn(n);case oe.ZodUnknown:return tie(n);case oe.ZodDefault:return Ore(e,n);case oe.ZodBranded:return Hq(e,n);case oe.ZodReadonly:return nie(e,n);case oe.ZodCatch:return Pre(e,n);case oe.ZodPipeline:return Zre(e,n);case oe.ZodFunction:case oe.ZodVoid:case oe.ZodSymbol:return;default:return(i=>{})(t)}};iie=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Wq(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,i)=>t.currentPath[i]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Rn(t)):t.$refStrategy==="seen"?Rn(t):void 0}},oie=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),aie=(e,t)=>{let n=Tre(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((d,[l,u])=>({...d,[l]:Ue(u._def,{...n,currentPath:[...n.basePath,n.definitionPath,l]},!0)??Rn(n)}),{}):void 0,r=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=Ue(e._def,r===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??Rn(n),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(o.title=a),n.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[n.openAiAnyTypeName]||(i[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let s=r===void 0?i?{...o,[n.definitionPath]:i}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...i,[r]:o}};return n.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};die=6e4,cb=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(cw,n=>{this._oncancel(n)}),this.setNotificationHandler(pw,n=>{this._onprogress(n)}),this.setRequestHandler(fw,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(mw,async(n,i)=>{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new _e(we.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(gw,async(n,i)=>{let r=async()=>{let o=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(s.type==="response"||s.type==="error"){let d=s.message,l=d.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),s.type==="response")u(d);else{let c=d,p=new _e(c.error.code,c.error.message,c.error.data);u(p)}else{let c=s.type==="response"?"Response":"Error";this._onerror(Error(`${c} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:i.requestId})}}let a=await this._taskStore.getTask(o,i.sessionId);if(!a)throw new _e(we.InvalidParams,`Task not found: ${o}`);if(!Ro(a.status))return await this._waitForTaskUpdate(o,i.signal),await r();if(Ro(a.status)){let s=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[jo]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(yw,async(n,i)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(n.params?.cursor,i.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new _e(we.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(bw,async(n,i)=>{try{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new _e(we.InvalidParams,`Task not found: ${n.params.taskId}`);if(Ro(r.status))throw new _e(we.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(n.params.taskId);let o=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!o)throw new _e(we.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof _e?r:new _e(we.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){t.params.requestId&&this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,i,r,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(t){let n=this._timeoutInfo.get(t);if(!n)return!1;let i=Date.now()-n.startTime;if(n.maxTotalTimeout&&i>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),_e.fromError(we.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:i});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){let n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{r?.(o,a),wf(o)||Vte(o)?this._onresponse(o):PI(o)?this._onrequest(o,a):Hte(o)?this._onnotification(o):this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let n=_e.fromError(we.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){let n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,n){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,o=t.params?._meta?.[jo]?.taskId;if(i===void 0){let u={jsonrpc:"2.0",id:t.id,error:{code:we.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},r?.sessionId).catch(c=>this._onerror(Error(`Failed to enqueue error response: ${c}`))):r?.send(u).catch(c=>this._onerror(Error(`Failed to send an error response: ${c}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Wte(t.params)?t.params.task:void 0,d=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,l={signal:a.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async u=>{if(a.signal.aborted)return;let c={relatedRequestId:t.id};o&&(c.relatedTask={taskId:o}),await this.notification(u,c)},sendRequest:async(u,c,p)=>{if(a.signal.aborted)throw new _e(we.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let h=f.relatedTask?.taskId??o;return h&&d&&await d.updateTaskStatus(h,"input_required"),await this.request(u,c,f)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,l)).then(async u=>{if(a.signal.aborted)return;let c={result:u,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:c,timestamp:Date.now()},r?.sessionId):await r?.send(c)},async u=>{if(a.signal.aborted)return;let c={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(u.code)?u.code:we.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:c,timestamp:Date.now()},r?.sessionId):await r?.send(c)}).catch(u=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===a&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:n,...i}=t.params,r=Number(n),o=this._progressHandlers.get(r);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(d);return}o(i)}_onresponse(t){let n=Number(t.id),i=this._requestResolvers.get(n);if(i){if(this._requestResolvers.delete(n),wf(t))i(t);else{let a=new _e(t.error.code,t.error.message,t.error.data);i(a)}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let o=!1;if(wf(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,n))}}if(o||this._progressHandlers.delete(n),wf(t))r(t);else{let a=_e.fromError(t.error.code,t.error.message,t.error.data);r(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,i){let{task:r}=i??{};if(!r){try{yield{type:"result",result:await this.request(t,n,i)}}catch(a){yield{type:"error",error:a instanceof _e?a:new _e(we.InternalError,String(a))}}return}let o;try{let a=await this.request(t,Nm,i);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new _e(we.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:s},Ro(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)}:s.status==="failed"?yield{type:"error",error:new _e(we.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new _e(we.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)};return}let d=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,d)),i?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof _e?a:new _e(we.InternalError,String(a))}}}request(t,n,i){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:d}=i??{};return new Promise((l,u)=>{let c=b=>{u(b)};if(!this._transport){c(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(b){c(b);return}i?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};i?.onprogress&&(this._progressHandlers.set(p,i.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),d&&(f.params={...f.params,_meta:{...f.params?._meta||{},[jo]:d}});let h=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(w=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let v=b instanceof _e?b:new _e(we.RequestTimeout,String(b));u(v)};this._responseHandlers.set(p,b=>{if(!i?.signal?.aborted){if(b instanceof Error)return u(b);try{let v=Pl(n,b.result);v.success?l(v.data):u(v.error)}catch(v){u(v)}}}),i?.signal?.addEventListener("abort",()=>{h(i?.signal?.reason)});let g=i?.timeout??die,_=()=>h(_e.fromError(we.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,i?.maxTotalTimeout,_,i?.resetTimeoutOnProgress??!1);let y=d?.taskId;if(y){let b=v=>{let w=this._responseHandlers.get(p);w?w(v):this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch(v=>{this._cleanupTimeout(p),u(v)})}else this._transport.send(f,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},hw,n)}async getTaskResult(t,n,i){return this.request({method:"tasks/result",params:t},n,i)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},_w,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},cne,n)}async notification(t,n){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(t.method);let i=n?.relatedTask?.taskId;if(i){let o={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[jo]:n.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:o,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let o={...t,jsonrpc:"2.0"};n?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[jo]:n.relatedTask}}}),this._transport?.send(o,n).catch(a=>this._onerror(a))});return}let r={...t,jsonrpc:"2.0"};n?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[jo]:n.relatedTask}}}),await this._transport.send(r,n)}setRequestHandler(t,n){let i=MI(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(r,o)=>{let a=jI(t,r);return Promise.resolve(n(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){let i=MI(t);this._notificationHandlers.set(i,r=>{let o=jI(t,r);return Promise.resolve(n(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,i){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,i,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,n);for(let r of i)if(r.type==="request"&&PI(r.message)){let o=r.message.id,a=this._requestResolvers.get(o);a?(a(new _e(we.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){let i=this._options?.defaultTaskPollInterval??1e3;try{let r=await this._taskStore?.getTask(t);r?.pollInterval&&(i=r.pollInterval)}catch{}return new Promise((r,o)=>{if(n.aborted){o(new _e(we.InvalidRequest,"Request cancelled"));return}let a=setTimeout(r,i);n.addEventListener("abort",()=>{clearTimeout(a),o(new _e(we.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){let i=this._taskStore;if(!i)throw Error("No task store configured");return{createTask:async r=>{if(!t)throw Error("No request provided");return await i.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{let o=await i.getTask(r,n);if(!o)throw new _e(we.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,a)=>{await i.storeTaskResult(r,o,a,n);let s=await i.getTask(r,n);if(s){let d=jp.parse({method:"notifications/tasks/status",params:s});await this.notification(d),Ro(s.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>i.getTaskResult(r,n),updateTaskStatus:async(r,o,a)=>{let s=await i.getTask(r,n);if(!s)throw new _e(we.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Ro(s.status))throw new _e(we.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(r,o,a,n);let d=await i.getTask(r,n);if(d){let l=jp.parse({method:"notifications/tasks/status",params:d});await this.notification(l),Ro(d.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>i.listTasks(r,n)}}};uie=jb(JO(),1),cie=jb(v4(),1);fb=class{constructor(t){this._ajv=t??fie()}getValidator(t){let n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}},pb=class{constructor(t){this._server=t}requestStream(t,n,i){return this._server.requestStream(t,n,i)}createMessageStream(t,n){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages[t.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(u=>u.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,d=s?Array.isArray(s.content)?s.content:[s.content]:[],l=d.some(u=>u.type==="tool_use");if(a){if(o.some(u=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!l)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(d.filter(p=>p.type==="tool_use").map(p=>p.id)),c=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==c.size||![...u].every(p=>c.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Aw,n)}elicitInputStream(t,n){let i=this._server.getClientCapabilities(),r=t.mode??"form";switch(r){case"url":{if(!i?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=r==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Dp,n)}async getTask(t,n){return this._server.getTask({taskId:t},n)}async getTaskResult(t,n,i){return this._server.getTaskResult({taskId:t},n,i)}async listTasks(t,n){return this._server.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._server.cancelTask({taskId:t},n)}};mb=class extends cb{constructor(t,n){super(n),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Np.options.map((i,r)=>[i,r])),this.isMessageIgnored=(i,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new fb,this.setRequestHandler(qq,i=>this._oninitialize(i)),this.setNotificationHandler(Nq,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(zq,async(i,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=i.params,s=Np.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new pb(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=lie(this._capabilities,t)}setRequestHandler(t,n){let i=bu(t)?.method;if(!i)throw Error("Schema is missing a method literal");let r;if(Xr(i)){let o=i;r=o._zod?.def?.value??o.value}else{let o=i;r=o._def?.value??o.value}if(typeof r!="string")throw Error("Schema method literal must be a string");if(r==="tools/call"){let o=async(a,s)=>{let d=Pl(qp,a);if(!d.success){let p=d.error instanceof Error?d.error.message:String(d.error);throw new _e(we.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=d.data,u=await Promise.resolve(n(a,s));if(l.task){let p=Pl(Nm,u);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new _e(we.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}let c=Pl(Cw,u);if(!c.success){let p=c.error instanceof Error?c.error.message:String(c.error);throw new _e(we.InvalidParams,`Invalid tools/call result: ${p}`)}return c.data};return super.setRequestHandler(t,o)}return super.setRequestHandler(t,n)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){mie(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&pie(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let n=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Jte.includes(n)?n:Iq,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},uw)}async createMessage(t,n){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],r=Array.isArray(i.content)?i.content:[i.content],o=r.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],d=s.some(l=>l.type==="tool_use");if(o){if(r.some(l=>l.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!d)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(d){let l=new Set(s.filter(c=>c.type==="tool_use").map(c=>c.id)),u=new Set(r.filter(c=>c.type==="tool_result").map(c=>c.toolUseId));if(l.size!==u.size||![...l].every(c=>u.has(c)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Jq,n):this.request({method:"sampling/createMessage",params:t},Aw,n)}async elicitInput(t,n){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Dp,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},r=await this.request({method:"elicitation/create",params:i},Dp,n);if(r.action==="accept"&&r.content&&i.requestedSchema)try{let o=this._jsonSchemaValidator.getValidator(i.requestedSchema)(r.content);if(!o.valid)throw new _e(we.InvalidParams,`Elicitation response content does not match requested schema: ${o.errorMessage}`)}catch(o){throw o instanceof _e?o:new _e(we.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return r}}}createElicitationCompletionNotifier(t,n){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},n)}async listRoots(t,n){return this.request({method:"roots/list",params:t},Kq,n)}async sendLoggingMessage(t,n){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,n))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},Yq=Symbol.for("mcp.completable");(function(e){e.Completable="McpCompletable"})(FI||(FI={}));gie=/^[A-Za-z0-9._-]{1,128}$/;hb=class{constructor(t){this._mcpServer=t}registerToolTask(t,n,i){let r={taskSupport:"required",...n.execution};if(r.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,r,n._meta,i)}},gb=class{constructor(t,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new mb(t,n)}get experimental(){return this._experimental||(this._experimental={tasks:new hb(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Gi(db)),this.server.assertCanSetRequestHandler(Gi(qp)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(db,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,n])=>{let i={name:t,title:n.title,description:n.description,inputSchema:(()=>{let r=ul(n.inputSchema);return r?$I(r,{strictUnions:!0,pipeStrategy:"input"}):bie})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let r=ul(n.outputSchema);r&&(i.outputSchema=$I(r,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(qp,async(t,n)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new _e(we.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new _e(we.InvalidParams,`Tool ${t.params.name} disabled`);let r=!!t.params.task,o=i.execution?.taskSupport,a="createTask"in i.handler;if((o==="required"||o==="optional")&&!a)throw new _e(we.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new _e(we.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&a)return await this.handleAutomaticTaskPolling(i,t,n);let s=await this.validateToolInput(i,t.params.arguments,t.params.name),d=await this.executeToolHandler(i,s,n);return r||await this.validateToolOutput(i,d,t.params.name),d}catch(i){if(i instanceof _e&&i.code===we.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,n,i){if(!t.inputSchema)return;let r=ul(t.inputSchema)??t.inputSchema,o=await e_(r,n);if(!o.success){let a="error"in o?o.error:"Unknown error",s=t_(a);throw new _e(we.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${s}`)}return o.data}async validateToolOutput(t,n,i){if(!t.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new _e(we.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let r=ul(t.outputSchema),o=await e_(r,n.structuredContent);if(!o.success){let a="error"in o?o.error:"Unknown error",s=t_(a);throw new _e(we.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${s}`)}}async executeToolHandler(t,n,i){let r=t.handler;if("createTask"in r){if(!i.taskStore)throw Error("No task store provided.");let o={...i,taskStore:i.taskStore};return t.inputSchema?await Promise.resolve(r.createTask(n,o)):await Promise.resolve(r.createTask(o))}return t.inputSchema?await Promise.resolve(r(n,i)):await Promise.resolve(r(i))}async handleAutomaticTaskPolling(t,n,i){if(!i.taskStore)throw Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(t,n.params.arguments,n.params.name),o=t.handler,a={...i,taskStore:i.taskStore},s=r?await Promise.resolve(o.createTask(r,a)):await Promise.resolve(o.createTask(a)),d=s.task.taskId,l=s.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(p=>setTimeout(p,u));let c=await i.taskStore.getTask(d);if(!c)throw new _e(we.InternalError,`Task ${d} not found during polling`);l=c}return await i.taskStore.getTaskResult(d)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Gi(lb)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(lb,async t=>{switch(t.params.ref.type){case"ref/prompt":return yre(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return _re(t),this.handleResourceCompletion(t,t.params.ref);default:throw new _e(we.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,n){let i=this._registeredPrompts[n.name];if(!i)throw new _e(we.InvalidParams,`Prompt ${n.name} not found`);if(!i.enabled)throw new _e(we.InvalidParams,`Prompt ${n.name} disabled`);if(!i.argsSchema)return cl;let r=bu(i.argsSchema)?.[t.params.argument.name];if(!NI(r))return cl;let o=hie(r);if(!o)return cl;let a=await o(t.params.argument.value,t.params.context);return UI(a)}async handleResourceCompletion(t,n){let i=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===n.uri);if(!i){if(this._registeredResources[n.uri])return cl;throw new _e(we.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let r=i.resourceTemplate.completeCallback(t.params.argument.name);if(!r)return cl;let o=await r(t.params.argument.value,t.params.context);return UI(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Gi(rb)),this.server.assertCanSetRequestHandler(Gi(ib)),this.server.assertCanSetRequestHandler(Gi(ob)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(rb,async(t,n)=>{let i=Object.entries(this._registeredResources).filter(([o,a])=>a.enabled).map(([o,a])=>({uri:o,name:a.name,...a.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let a=await o.resourceTemplate.listCallback(n);for(let s of a.resources)r.push({...o.metadata,...s})}return{resources:[...i,...r]}}),this.server.setRequestHandler(ib,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,n])=>({name:t,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(ob,async(t,n)=>{let i=new URL(t.params.uri),r=this._registeredResources[i.toString()];if(r){if(!r.enabled)throw new _e(we.InvalidParams,`Resource ${i} disabled`);return r.readCallback(i,n)}for(let o of Object.values(this._registeredResourceTemplates)){let a=o.resourceTemplate.uriTemplate.match(i.toString());if(a)return o.readCallback(i,a,n)}throw new _e(we.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Gi(ab)),this.server.assertCanSetRequestHandler(Gi(sb)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ab,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,n])=>({name:t,title:n.title,description:n.description,arguments:n.argsSchema?vie(n.argsSchema):void 0}))})),this.server.setRequestHandler(sb,async(t,n)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new _e(we.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new _e(we.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let r=ul(i.argsSchema),o=await e_(r,t.params.arguments);if(!o.success){let d="error"in o?o.error:"Unknown error",l=t_(d);throw new _e(we.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${l}`)}let a=o.data,s=i.callback;return await Promise.resolve(s(a,n))}else{let r=i.callback;return await Promise.resolve(r(n))}}),this._promptHandlersInitialized=!0)}resource(t,n,...i){let r;typeof i[0]=="object"&&(r=i.shift());let o=i[0];if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let a=this._createRegisteredResourceTemplate(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(t,n,i,r){if(typeof n=="string"){if(this._registeredResources[n])throw Error(`Resource ${n} is already registered`);let o=this._createRegisteredResource(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,n,i,r,o){let a={name:t,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:s=>{typeof s.uri<"u"&&s.uri!==i&&(delete this._registeredResources[i],s.uri&&(this._registeredResources[s.uri]=a)),typeof s.name<"u"&&(a.name=s.name),typeof s.title<"u"&&(a.title=s.title),typeof s.metadata<"u"&&(a.metadata=s.metadata),typeof s.callback<"u"&&(a.readCallback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=a,a}_createRegisteredResourceTemplate(t,n,i,r,o){let a={resourceTemplate:i,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=a)),typeof d.title<"u"&&(a.title=d.title),typeof d.template<"u"&&(a.resourceTemplate=d.template),typeof d.metadata<"u"&&(a.metadata=d.metadata),typeof d.callback<"u"&&(a.readCallback=d.callback),typeof d.enabled<"u"&&(a.enabled=d.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=a;let s=i.uriTemplate.variableNames;return Array.isArray(s)&&s.some(d=>!!i.completeCallback(d))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(t,n,i,r,o){let a={title:n,description:i,argsSchema:r===void 0?void 0:ns(r),callback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:s=>{typeof s.name<"u"&&s.name!==t&&(delete this._registeredPrompts[t],s.name&&(this._registeredPrompts[s.name]=a)),typeof s.title<"u"&&(a.title=s.title),typeof s.description<"u"&&(a.description=s.description),typeof s.argsSchema<"u"&&(a.argsSchema=ns(s.argsSchema)),typeof s.callback<"u"&&(a.callback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=a,r&&Object.values(r).some(s=>{let d=s instanceof lr?s._def?.innerType:s;return NI(d)})&&this.setCompletionRequestHandler(),a}_createRegisteredTool(t,n,i,r,o,a,s,d,l){DI(t);let u={title:n,description:i,inputSchema:LI(r),outputSchema:LI(o),annotations:a,execution:s,_meta:d,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==t&&(typeof c.name=="string"&&DI(c.name),delete this._registeredTools[t],c.name&&(this._registeredTools[c.name]=u)),typeof c.title<"u"&&(u.title=c.title),typeof c.description<"u"&&(u.description=c.description),typeof c.paramsSchema<"u"&&(u.inputSchema=ns(c.paramsSchema)),typeof c.outputSchema<"u"&&(u.outputSchema=ns(c.outputSchema)),typeof c.callback<"u"&&(u.handler=c.callback),typeof c.annotations<"u"&&(u.annotations=c.annotations),typeof c._meta<"u"&&(u._meta=c._meta),typeof c.enabled<"u"&&(u.enabled=c.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(t,...n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let i,r,o,a;if(typeof n[0]=="string"&&(i=n.shift()),n.length>1){let d=n[0];if(yb(d))r=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!yb(n[0])&&(a=n.shift());else if(typeof d=="object"&&d!==null){if(Object.values(d).some(l=>typeof l=="object"&&l!==null))throw Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);a=n.shift()}}let s=n[0];return this._createRegisteredTool(t,void 0,i,r,o,a,{taskSupport:"forbidden"},void 0,s)}registerTool(t,n,i){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let{title:r,description:o,inputSchema:a,outputSchema:s,annotations:d,_meta:l}=n;return this._createRegisteredTool(t,r,o,a,s,d,{taskSupport:"forbidden"},l,i)}prompt(t,...n){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let i;typeof n[0]=="string"&&(i=n.shift());let r;n.length>1&&(r=n.shift());let o=n[0],a=this._createRegisteredPrompt(t,void 0,i,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(t,n,i){if(this._registeredPrompts[t])throw Error(`Prompt ${t} is already registered`);let{title:r,description:o,argsSchema:a}=n,s=this._createRegisteredPrompt(t,r,o,a,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,n){return this.server.sendLoggingMessage(t,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},bie={type:"object",properties:{}};cl={completion:{values:[],hasMore:!1}};GI=15e3,xie=Y(()=>m.object({session_id:m.string(),ws_url:m.string(),work_dir:m.string().optional(),session_key:m.string().optional()})),or=class extends Error{code;constructor(t,n){super(t),this.name="DirectConnectError",this.code=n}},_b=class{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new yp;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(t){this.options=t,this.abortController=t.abortController??new AbortController,this.readyPromise=new Promise((n,i)=>{this.readyResolve=n,this.readyReject=i}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new En("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new En("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let t;try{let o=await Cie(this.options);this.sessionId=o.sessionId,this.workDir=o.workDir,t=o.wsUrl}catch(o){let a=cu(o);if(!(a instanceof En)){let s=a instanceof or&&a.code?a.code:"session_create_failed";this.emitTelemetry("bad",s)}this.failInit(a);return}if(this.closed){this.options.deleteSessionOnClose&&this.sessionId&&zI(this.options.serverUrl,this.sessionId,this.options.authToken);return}let n={};this.options.authToken&&(n.authorization=`Bearer ${this.options.authToken}`);let i=new WebSocket(t,{headers:n});this.ws=i;let r=setTimeout((o,a)=>{if(!o.readyState){a.close();let s=new or(`WebSocket connection timeout after ${GI}ms`);o.exitError=s,o.readyReject?.(s),o.emitTelemetry("bad","connect_timeout")}},GI,this,i);i.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,ir(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),i.addEventListener("message",o=>{let a=typeof o.data=="string"?o.data:"";if(a.indexOf(`
264
- `)===-1){a&&this.partialChunks.push(a);return}let s=this.partialChunks.join("")+a;this.partialChunks.length=0;let d=s.split(`
265
- `),l=d.pop()??"";l&&this.partialChunks.push(l);for(let u of d){if(!u)continue;let c;try{c=$r(u)}catch(p){ir(`DirectConnect: dropped malformed JSON line (${u.length} bytes): ${p}`);continue}this.messages.enqueue(c)}}),i.addEventListener("error",()=>{clearTimeout(r);let o=new or("WebSocket connection error");this.exitError=o,this.readyReject?.(o),this.messages.done(),!this.readyState&&this.emitTelemetry("bad","ws_error")}),i.addEventListener("close",o=>{let a=this.readyState;this.readyState=!1,this.closed=!0;let s=o.code!==1e3&&o.code!==1001;s&&!this.exitError&&(this.exitError=new or(`WebSocket closed abnormally: ${o.code} ${o.reason}`)),this.messages.done(),a&&s&&!this.abortController.signal.aborted&&this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(t,n){this.telemetryEmitted||(this.telemetryEmitted=!0,t==="ok"?d$("transport_direct_connect"):t==="bad"?l$("transport_direct_connect",n??"unknown"):VZ("transport_direct_connect",n??"unknown"))}failInit(t){this.exitError=t,this.closed=!0,this.readyReject?.(t),this.messages.done()}async write(t){if(this.abortController.signal.aborted)throw new En("Operation aborted");if(this.readyState||await this.readyPromise,!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new or("Transport is not ready for writing");this.ws.send(t)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}[Symbol.dispose](){this.close()}close(){this.closed||(this.closed=!0,this.readyState=!1,this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0),this.abortController.signal.aborted||this.abortController.abort(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.close(1e3,"Normal closure"),this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId&&zI(this.options.serverUrl,this.sessionId,this.options.authToken))}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}};bb=Promise.resolve(),JI=!1;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(KI||(KI={}));mEe=Array(20).fill(0).map((e,t)=>" ".repeat(t)),hEe={" ":{"\n":Array(200).fill(0).map((e,t)=>`
266
- `+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
267
- `+" ".repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
268
- `+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
269
- `+" ".repeat(t))}};(function(e){e.DEFAULT={allowTrailingComma:!1}})(BI||(BI={}));(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(WI||(WI={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(HI||(HI={}));(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(VI||(VI={}));Wi=rN.homedir(),Ew=rN.tmpdir(),{env:rs}=Sb,qie=e=>{let t=xt.join(Wi,"Library");return{data:xt.join(t,"Application Support",e),config:xt.join(t,"Preferences",e),cache:xt.join(t,"Caches",e),log:xt.join(t,"Logs",e),temp:xt.join(Ew,e)}},Nie=e=>{let t=rs.APPDATA||xt.join(Wi,"AppData","Roaming"),n=rs.LOCALAPPDATA||xt.join(Wi,"AppData","Local");return{data:xt.join(n,e,"Data"),config:xt.join(t,e,"Config"),cache:xt.join(n,e,"Cache"),log:xt.join(n,e,"Log"),temp:xt.join(Ew,e)}},Fie=e=>{let t=xt.basename(Wi);return{data:xt.join(rs.XDG_DATA_HOME||xt.join(Wi,".local","share"),e),config:xt.join(rs.XDG_CONFIG_HOME||xt.join(Wi,".config"),e),cache:xt.join(rs.XDG_CACHE_HOME||xt.join(Wi,".cache"),e),log:xt.join(rs.XDG_STATE_HOME||xt.join(Wi,".local","state"),e),temp:xt.join(Ew,t,e)}};bEe=Die("claude-cli");Gie=100,i_=[];Jie=[],ZI=null,vEe=rn(()=>process.argv.includes("--hard-fail"));Za=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,oN=new Set,wb=typeof process=="object"&&process?process:{},aN=(e,t,n,i)=>{typeof wb.emitWarning=="function"?wb.emitWarning(e,t,n,i):console.error(`[${n}] ${t}: ${e}`)},Up=globalThis.AbortController,QI=globalThis.AbortSignal;if(typeof Up>"u"){QI=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Up=class{constructor(){t()}signal=new QI;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let e=wb.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,aN("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Kie=e=>!oN.has(e),zi=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),sN=e=>zi(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ls:null:null,ls=class extends Array{constructor(t){super(t),this.fill(0)}},kb=class e{heap;length;static#r=!1;static create(t){let n=sN(t);if(!n)return[];e.#r=!0;let i=new e(t,n);return e.#r=!1,i}constructor(t,n){if(!e.#r)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},xb=class e{#r;#c;#h;#g;#I;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#y;#i;#n;#e;#l;#f;#d;#a;#_;#s;#b;#v;#p;#S;#C;#u;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#p,sizes:t.#b,keyMap:t.#i,keyList:t.#n,valList:t.#e,next:t.#l,prev:t.#f,get head(){return t.#d},get tail(){return t.#a},free:t.#_,isBackgroundFetch:n=>t.#t(n),backgroundFetch:(n,i,r,o)=>t.#M(n,i,r,o),moveToTail:n=>t.#P(n),indexes:n=>t.#w(n),rindexes:n=>t.#k(n),isStale:n=>t.#m(n)}}get max(){return this.#r}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#o}get fetchMethod(){return this.#I}get memoMethod(){return this.#O}get dispose(){return this.#h}get disposeAfter(){return this.#g}constructor(t){let{max:n=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:d,dispose:l,disposeAfter:u,noDisposeOnSet:c,noUpdateTTL:p,maxSize:f=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:A,ignoreFetchAbort:C}=t;if(n!==0&&!zi(n))throw TypeError("max option must be a nonnegative integer");let S=n?sN(n):Array;if(!S)throw Error("invalid max value: "+n);if(this.#r=n,this.#c=f,this.maxEntrySize=h||this.#c,this.sizeCalculation=g,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw TypeError("memoMethod must be a function if defined");if(this.#O=y,_!==void 0&&typeof _!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#I=_,this.#C=!!_,this.#i=new Map,this.#n=Array(n).fill(void 0),this.#e=Array(n).fill(void 0),this.#l=new S(n),this.#f=new S(n),this.#d=0,this.#a=0,this.#_=kb.create(n),this.#o=0,this.#y=0,typeof l=="function"&&(this.#h=l),typeof u=="function"?(this.#g=u,this.#s=[]):(this.#g=void 0,this.#s=void 0),this.#S=!!this.#h,this.#u=!!this.#g,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#c!==0&&!zi(this.#c))throw TypeError("maxSize must be a positive integer if specified");if(!zi(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#U()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=zi(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!zi(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#r===0&&this.ttl===0&&this.#c===0)throw TypeError("At least one of max, maxSize, or ttl is required");!this.ttlAutopurge&&!this.#r&&!this.#c&&Kie("LRU_CACHE_UNBOUNDED")&&(oN.add("LRU_CACHE_UNBOUNDED"),aN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",e))}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#j(){let t=new ls(this.#r),n=new ls(this.#r);this.#p=t,this.#v=n,this.#q=(o,a,s=Za.now())=>{if(n[o]=a!==0?s:0,t[o]=a,a!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#m(o)&&this.#x(this.#n[o],"expire")},a+1);d.unref&&d.unref()}},this.#A=o=>{n[o]=t[o]!==0?Za.now():0},this.#T=(o,a)=>{if(t[a]){let s=t[a],d=n[a];if(!s||!d)return;o.ttl=s,o.start=d,o.now=i||r();let l=o.now-d;o.remainingTTL=s-l}};let i=0,r=()=>{let o=Za.now();if(this.ttlResolution>0){i=o;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return o};this.getRemainingTTL=o=>{let a=this.#i.get(o);if(a===void 0)return 0;let s=t[a],d=n[a];if(!s||!d)return 1/0;let l=(i||r())-d;return s-l},this.#m=o=>{let a=n[o],s=t[o];return!!s&&!!a&&(i||r())-a>s}}#A=()=>{};#T=()=>{};#q=()=>{};#m=()=>!1;#U(){let t=new ls(this.#r);this.#y=0,this.#b=t,this.#E=n=>{this.#y-=t[n],t[n]=0},this.#N=(n,i,r,o)=>{if(this.#t(i))return 0;if(!zi(r))if(o){if(typeof o!="function")throw TypeError("sizeCalculation must be a function");if(r=o(i,n),!zi(r))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#R=(n,i,r)=>{if(t[n]=i,this.#c){let o=this.#c-t[n];for(;this.#y>o;)this.#$(!0)}this.#y+=t[n],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y)}}#E=t=>{};#R=(t,n,i)=>{};#N=(t,n,i,r)=>{if(i||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#a;!(!this.#F(n)||((t||!this.#m(n))&&(yield n),n===this.#d));)n=this.#f[n]}*#k({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#d;!(!this.#F(n)||((t||!this.#m(n))&&(yield n),n===this.#a));)n=this.#l[n]}#F(t){return t!==void 0&&this.#i.get(this.#n[t])===t}*entries(){for(let t of this.#w())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*rentries(){for(let t of this.#k())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*keys(){for(let t of this.#w()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*rkeys(){for(let t of this.#k()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*values(){for(let t of this.#w())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}*rvalues(){for(let t of this.#k())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,n={}){for(let i of this.#w()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#n[i],this))return this.get(this.#n[i],n)}}forEach(t,n=this){for(let i of this.#w()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}rforEach(t,n=this){for(let i of this.#k()){let r=this.#e[i],o=this.#t(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(n,o,this.#n[i],this)}}purgeStale(){let t=!1;for(let n of this.#k({allowStale:!0}))this.#m(n)&&(this.#x(this.#n[n],"expire"),t=!0);return t}info(t){let n=this.#i.get(t);if(n===void 0)return;let i=this.#e[n],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#p&&this.#v){let a=this.#p[n],s=this.#v[n];if(a&&s){let d=a-(Za.now()-s);o.ttl=d,o.start=Date.now()}}return this.#b&&(o.size=this.#b[n]),o}dump(){let t=[];for(let n of this.#w({allowStale:!0})){let i=this.#n[n],r=this.#e[n],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let a={value:o};if(this.#p&&this.#v){a.ttl=this.#p[n];let s=Za.now()-this.#v[n];a.start=Math.floor(Date.now()-s)}this.#b&&(a.size=this.#b[n]),t.unshift([i,a])}return t}load(t){this.clear();for(let[n,i]of t){if(i.start){let r=Date.now()-i.start;i.start=Za.now()-r}this.set(n,i.value,i)}}set(t,n,i={}){if(n===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:d}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,u=this.#N(t,n,i.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#x(t,"set"),this;let c=this.#o===0?void 0:this.#i.get(t);if(c===void 0)c=this.#o===0?this.#a:this.#_.length!==0?this.#_.pop():this.#o===this.#r?this.#$(!1):this.#o,this.#n[c]=t,this.#e[c]=n,this.#i.set(t,c),this.#l[this.#a]=c,this.#f[c]=this.#a,this.#a=c,this.#o++,this.#R(c,u,d),d&&(d.set="add"),l=!1;else{this.#P(c);let p=this.#e[c];if(n!==p){if(this.#C&&this.#t(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;f!==void 0&&!a&&(this.#S&&this.#h?.(f,t,"set"),this.#u&&this.#s?.push([f,t,"set"]))}else a||(this.#S&&this.#h?.(p,t,"set"),this.#u&&this.#s?.push([p,t,"set"]));if(this.#E(c),this.#R(c,u,d),this.#e[c]=n,d){d.set="replace";let f=p&&this.#t(p)?p.__staleWhileFetching:p;f!==void 0&&(d.oldValue=f)}}else d&&(d.set="update")}if(r!==0&&!this.#p&&this.#j(),this.#p&&(l||this.#q(c,r,o),d&&this.#T(d,c)),!a&&this.#u&&this.#s){let p=this.#s,f;for(;f=p?.shift();)this.#g?.(...f)}return this}pop(){try{for(;this.#o;){let t=this.#e[this.#d];if(this.#$(!0),this.#t(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#u&&this.#s){let t=this.#s,n;for(;n=t?.shift();)this.#g?.(...n)}}}#$(t){let n=this.#d,i=this.#n[n],r=this.#e[n];return this.#C&&this.#t(r)?r.__abortController.abort(Error("evicted")):(this.#S||this.#u)&&(this.#S&&this.#h?.(r,i,"evict"),this.#u&&this.#s?.push([r,i,"evict"])),this.#E(n),t&&(this.#n[n]=void 0,this.#e[n]=void 0,this.#_.push(n)),this.#o===1?(this.#d=this.#a=0,this.#_.length=0):this.#d=this.#l[n],this.#i.delete(i),this.#o--,n}has(t,n={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=n,o=this.#i.get(t);if(o!==void 0){let a=this.#e[o];if(this.#t(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#m(o))r&&(r.has="stale",this.#T(r,o));else return i&&this.#A(o),r&&(r.has="hit",this.#T(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,n={}){let{allowStale:i=this.allowStale}=n,r=this.#i.get(t);if(r===void 0||!i&&this.#m(r))return;let o=this.#e[r];return this.#t(o)?o.__staleWhileFetching:o}#M(t,n,i,r){let o=n===void 0?void 0:this.#e[n];if(this.#t(o))return o;let a=new Up,{signal:s}=i;s?.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let d={signal:a.signal,options:i,context:r},l=(g,_=!1)=>{let{aborted:y}=a.signal,b=i.ignoreFetchAbort&&g!==void 0;if(i.status&&(y&&!_?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),y&&!b&&!_)return c(a.signal.reason);let v=f;return this.#e[n]===f&&(g===void 0?v.__staleWhileFetching?this.#e[n]=v.__staleWhileFetching:this.#x(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,g,d.options))),g},u=g=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=g),c(g)),c=g=>{let{aborted:_}=a.signal,y=_&&i.allowStaleOnFetchAbort,b=y||i.allowStaleOnFetchRejection,v=b||i.noDeleteOnFetchRejection,w=f;if(this.#e[n]===f&&(!v||w.__staleWhileFetching===void 0?this.#x(t,"fetch"):y||(this.#e[n]=w.__staleWhileFetching)),b)return i.status&&w.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw g},p=(g,_)=>{let y=this.#I?.(t,o,d);y&&y instanceof Promise&&y.then(b=>g(b===void 0?void 0:b),_),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(g(void 0),i.allowStaleOnFetchAbort&&(g=b=>l(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(p).then(l,u),h=Object.assign(f,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return n===void 0?(this.set(t,h,{...d.options,status:void 0}),n=this.#i.get(t)):this.#e[n]=h,h}#t(t){if(!this.#C)return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof Up}async fetch(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:d=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:g,forceRefresh:_=!1,status:y,signal:b}=n;if(!this.#C)return y&&(y.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:y});let v={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:s,size:d,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:h,ignoreFetchAbort:f,status:y,signal:b},w=this.#i.get(t);if(w===void 0){y&&(y.fetch="miss");let A=this.#M(t,w,v,g);return A.__returned=A}else{let A=this.#e[w];if(this.#t(A)){let T=i&&A.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",T&&(y.returnedStale=!0)),T?A.__staleWhileFetching:A.__returned=A}let C=this.#m(w);if(!_&&!C)return y&&(y.fetch="hit"),this.#P(w),r&&this.#A(w),y&&this.#T(y,w),A;let S=this.#M(t,w,v,g),k=S.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=C?"stale":"refresh",k&&C&&(y.returnedStale=!0)),k?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,n={}){let i=await this.fetch(t,n);if(i===void 0)throw Error("fetch() returned undefined");return i}memo(t,n={}){let i=this.#O;if(!i)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=n,s=this.get(t,a);if(!o&&s!==void 0)return s;let d=i(t,s,{options:a,context:r});return this.set(t,d,a),d}get(t,n={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=n,s=this.#i.get(t);if(s!==void 0){let d=this.#e[s],l=this.#t(d);return a&&this.#T(a,s),this.#m(s)?(a&&(a.get="stale"),l?(a&&i&&d.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?d.__staleWhileFetching:void 0):(o||this.#x(t,"expire"),a&&i&&(a.returnedStale=!0),i?d:void 0)):(a&&(a.get="hit"),l?d.__staleWhileFetching:(this.#P(s),r&&this.#A(s),d))}else a&&(a.get="miss")}#D(t,n){this.#f[n]=t,this.#l[t]=n}#P(t){t!==this.#a&&(t===this.#d?this.#d=this.#l[t]:this.#D(this.#f[t],this.#l[t]),this.#D(this.#a,t),this.#a=t)}delete(t){return this.#x(t,"delete")}#x(t,n){let i=!1;if(this.#o!==0){let r=this.#i.get(t);if(r!==void 0)if(i=!0,this.#o===1)this.#L(n);else{this.#E(r);let o=this.#e[r];if(this.#t(o)?o.__abortController.abort(Error("deleted")):(this.#S||this.#u)&&(this.#S&&this.#h?.(o,t,n),this.#u&&this.#s?.push([o,t,n])),this.#i.delete(t),this.#n[r]=void 0,this.#e[r]=void 0,r===this.#a)this.#a=this.#f[r];else if(r===this.#d)this.#d=this.#l[r];else{let a=this.#f[r];this.#l[a]=this.#l[r];let s=this.#l[r];this.#f[s]=this.#f[r]}this.#o--,this.#_.push(r)}}if(this.#u&&this.#s?.length){let r=this.#s,o;for(;o=r?.shift();)this.#g?.(...o)}return i}clear(){return this.#L("delete")}#L(t){for(let n of this.#k({allowStale:!0})){let i=this.#e[n];if(this.#t(i))i.__abortController.abort(Error("deleted"));else{let r=this.#n[n];this.#S&&this.#h?.(i,r,t),this.#u&&this.#s?.push([i,r,t])}}if(this.#i.clear(),this.#e.fill(void 0),this.#n.fill(void 0),this.#p&&this.#v&&(this.#p.fill(0),this.#v.fill(0)),this.#b&&this.#b.fill(0),this.#d=0,this.#a=0,this.#_.length=0,this.#y=0,this.#o=0,this.#u&&this.#s){let n=this.#s,i;for(;i=n?.shift();)this.#g?.(...i)}}};Wie=8192;YI=Bie(dN,e=>e,50),Dm=Object.assign(function(e,t=!0){if(!e)return null;let n=e.length>Wie?dN(e,t):YI(e,t);return n.ok?n.value:null},{cache:YI.cache}),Lm=rn(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){if(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)return"wsl";try{let e=Kn().readFileSync("/proc/version",{encoding:"utf8"});if(e.toLowerCase().includes("microsoft")||e.toLowerCase().includes("wsl"))return"wsl"}catch(e){ze(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"})}return"linux"}return"unknown"}catch(e){return iN(e),"unknown"}}),TEe=rn(()=>{if(process.platform==="linux")try{let e=Kn().readFileSync("/proc/version",{encoding:"utf8"}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes("microsoft")?"1":void 0}catch(e){ze(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}}),CEe=rn(async()=>{if(process.platform!=="linux")return;let e={linuxKernel:lN()};try{let t=await Vie("/etc/os-release","utf8");for(let n of t.split(`
270
- `)){let i=n.match(/^(ID|VERSION_ID)=(.*)$/);if(i&&i[1]&&i[2]){let r=i[2].replace(/^"|"$/g,"");i[1]==="ID"?e.linuxDistroId=r:e.linuxDistroVersion=r}}}catch{}return e}),AEe=rn(()=>{if(process.platform!=="darwin")return;let e=lN().match(/^(\d+)\./);if(!(!e||!e[1]))return parseInt(e[1],10)-9}),su=rn(function(){switch(Lm()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),EEe=rn(function(){return Hie(su(),"managed-settings.d")});Tb=Zie;Yie=Qie,Xie=Yie(),eoe=Xie;noe=toe,roe="[object Object]",ioe=Function.prototype,ooe=Object.prototype,uN=ioe.toString,aoe=ooe.hasOwnProperty,soe=uN.call(Object);loe=doe;Cb=uoe;foe=coe;moe=poe;hoe=cN;yoe=goe,XI=Math.max;fN=_oe;voe=boe,Soe=cp?function(e,t){return cp(e,"toString",{configurable:!0,enumerable:!1,value:voe(t),writable:!0})}:cv,woe=Soe,koe=800,xoe=16,Toe=Date.now;Aoe=Coe,Eoe=Aoe(woe),pN=Eoe;Ioe=Poe;Roe=Ooe;Moe=$oe,joe=Moe(function(e,t,n,i){hoe(e,t,n,i)}),Hi=joe;Noe=qoe;mN=Foe;Loe=Doe,eO=Zr?Zr.isConcatSpreadable:void 0;Goe=Uoe;zoe=hN;Koe=Joe;Woe=Boe,Hoe=Woe(function(e,t){return e==null?{}:Loe(e,t)}),o_=Hoe,Zoe="Expected a function";Yoe=Qoe;eae=Xoe;nae=tae,gN=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","CLOUD_ML_REGION"],yN=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL"],_N=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_AWS_API_KEY","ANTHROPIC_BEDROCK_MANTLE_API_KEY"],iae=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],oae=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL"],OEe=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...gN,...yN,..._N,...iae,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...oae,"ANTHROPIC_BEDROCK_SERVICE_TIER","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK"]),aae="remote-settings.json",a_=null,dae=null;cae=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...gN,...yN,"CLAUDE_CODE_CUSTOM_OAUTH_URL",..._N,"ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE"].map(e=>e.toUpperCase()));hae=["userSettings","projectSettings","localSettings","flagSettings","policySettings"],tO="com.anthropic.claudecode",Ab="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Eb="HKCU\\SOFTWARE\\Policies\\ClaudeCode",is="Settings",yae="/usr/bin/plutil",_ae=["-convert","json","-o","-","--"],bae=5e3,nO="/mnt/c/Windows/System32/reg.exe",Gp="/mnt/c/Program Files/ClaudeCode";Sae=Y(()=>m.object({allowedDomains:m.array(m.string()).optional(),deniedDomains:m.array(m.string()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),allowManagedDomainsOnly:m.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:m.array(m.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:m.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:m.boolean().optional(),allowMachLookup:m.array(m.string().refine(e=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:m.number().optional(),socksProxyPort:m.number().optional(),tlsTerminate:m.object({caCertPath:m.string().min(1).optional(),caKeyPath:m.string().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),wae=Y(()=>m.object({allowWrite:m.array(m.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:m.array(m.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:m.array(m.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:m.array(m.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:m.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),vN=Y(()=>m.object({path:m.string().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:m.literal("deny").describe("Access mode for this path. Only `deny` is supported.")})),SN=Y(()=>m.object({name:m.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores").describe("Environment variable name."),mode:m.enum(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the host proxy swaps sentinel\u2192real on egress to `injectHosts`."),injectHosts:m.array(m.string()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to `network.allowedDomains` \u2014 the credential is injected at every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")})),kae=Y(()=>m.object({files:m.array(vN()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox."),envVars:m.array(SN()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:m.boolean().optional().describe("Allow sentinel\u2192real substitution on the plain-HTTP proxy path. Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),wN=Y(()=>m.object({enabled:m.boolean().optional(),failIfUnavailable:m.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:m.boolean().optional(),allowUnsandboxedCommands:m.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:Sae(),filesystem:wae(),credentials:kae(),ignoreViolations:m.record(m.string(),m.array(m.string())).optional(),enableWeakerNestedSandbox:m.boolean().optional(),enableWeakerNetworkIsolation:m.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** \u2014 opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:m.boolean().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. **Removes code-execution isolation** \u2014 sandboxed commands can launch other applications unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. Only honored from user, managed/policy, or CLI (--settings) settings \u2014 project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:m.array(m.string()).optional(),ripgrep:m.object({command:m.string(),args:m.array(m.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:m.preprocess(e=>typeof e=="string"&&rO(e)?e:void 0,m.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:m.preprocess(e=>typeof e=="string"&&rO(e)?e:void 0,m.string()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough()),xae=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],Tae=["normal","vim"],Cae=["auto","tmux","iterm2","in-process"],Aae=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],Eae=["auto",...Aae],MEe=Lm()==="macos"?"\u23FA":"\u25CF",Pw=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],Pae=[...Pw,"bubble"],Iae=Pae,jEe=Y(()=>Pq.enum(Iae)),qEe=Y(()=>Pq.enum(Pw)),Oae=["bash","powershell"],fl=Y(()=>m.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));$ae=Y(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:i,McpToolHookSchema:r}=Rae();return m.discriminatedUnion("type",[e,t,n,i,r])}),Mae=Y(()=>m.object({matcher:m.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:m.array($ae()).describe("List of hooks to execute when the matcher matches")})),zp=Y(()=>m.partialRecord(m.enum(im),m.array(Mae()))),NEe=Y(()=>m.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),FEe=Y(()=>m.enum(["stdio","sse","sse-ide","http","ws","sdk"])),zs=Y(()=>m.literal("comms").optional().catch(void 0)),ro=Y(()=>m.number().int().positive()),jae=Y(()=>m.object({type:m.literal("stdio").optional(),command:m.string().min(1,"Command cannot be empty"),args:m.array(m.string()).default([]),env:m.record(m.string(),m.string()).optional(),timeout:ro().optional(),alwaysLoad:m.boolean().optional(),role:zs()})),qae=Y(()=>m.boolean()),kN=Y(()=>m.object({clientId:m.string().optional(),callbackPort:m.number().int().positive().optional(),authServerMetadataUrl:m.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:m.string().min(1).optional(),xaa:qae().optional()})),xN=Y(()=>m.object({name:m.string(),permission_policy:m.enum(["always_allow","always_ask","always_deny"]).optional()})),Nae=Y(()=>m.object({type:m.literal("sse"),url:m.string(),headers:m.record(m.string(),m.string()).optional(),headersHelper:m.string().optional(),oauth:kN().optional(),timeout:ro().optional(),tools:m.array(xN()).optional(),alwaysLoad:m.boolean().optional(),role:zs(),toolPermissions:m.record(m.string(),Iw()).optional()})),Fae=Y(()=>m.object({type:m.literal("sse-ide"),url:m.string(),ideName:m.string(),ideRunningInWindows:m.boolean().optional(),timeout:ro().optional(),alwaysLoad:m.boolean().optional(),role:zs()})),Dae=Y(()=>m.object({type:m.literal("ws-ide"),url:m.string(),ideName:m.string(),authToken:m.string().optional(),ideRunningInWindows:m.boolean().optional(),timeout:ro().optional(),alwaysLoad:m.boolean().optional(),role:zs()})),Lae=Y(()=>m.object({type:m.enum(["http","streamable-http"]).transform(()=>"http"),url:m.string(),headers:m.record(m.string(),m.string()).optional(),headersHelper:m.string().optional(),oauth:kN().optional(),timeout:ro().optional(),tools:m.array(xN()).optional(),alwaysLoad:m.boolean().optional(),role:zs(),toolPermissions:m.record(m.string(),Iw()).optional()})),Uae=Y(()=>m.object({type:m.literal("ws"),url:m.string(),headers:m.record(m.string(),m.string()).optional(),headersHelper:m.string().optional(),timeout:ro().optional(),alwaysLoad:m.boolean().optional(),role:zs()})),Gae=Y(()=>m.object({type:m.literal("sdk"),name:m.string(),timeout:ro().optional(),alwaysLoad:m.boolean().optional()})),Iw=Y(()=>m.enum(["allow","ask","blocked"])),zae=Y(()=>m.object({type:m.literal("claudeai-proxy"),url:m.string(),id:m.string(),displayName:m.string().optional(),iconUrl:m.string().optional(),timeout:ro().optional(),alwaysLoad:m.boolean().optional(),toolPermissions:m.record(m.string(),Iw()).optional(),stateless:m.boolean().optional(),cachedInitResponse:m.record(m.string(),m.unknown()).nullish()})),Pb=Y(()=>m.union([jae(),Nae(),Fae(),Dae(),Lae(),Uae(),Gae(),zae()])),DEe=Y(()=>m.object({mcpServers:m.record(m.string(),Pb())})),Jae=new Set(["claude-community","claude-plugins-community"]),Kae=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins"]),TN=new Set([...Kae,...Jae]),Bae=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Wae=/[^\u0020-\u007E]/;Or=Y(()=>m.string().startsWith("./")),Wo=Y(()=>Or().endsWith(".json")),iO=Y(()=>m.union([Or().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),m.string().url().refine(e=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),Ib=Y(()=>Or().endsWith(".md")),Ob=Y(()=>m.union([Ib(),Or()])),CN=Y(()=>m.string().min(1,"Marketplace must have a name").refine(e=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(e=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(e=>!Hae(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(e=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(e=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine(e=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Ow=Y(()=>m.object({name:m.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:m.string().optional().describe("Contact email for support or feedback"),url:m.string().optional().describe("Website, GitHub profile, or organization URL")})),Vae=Y(()=>m.object({$schema:m.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:m.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:m.string().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:m.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:m.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Ow().optional().describe("Information about the plugin creator or maintainer"),homepage:m.string().url().optional().describe("Plugin homepage or documentation URL"),repository:m.string().optional().describe("Source code repository URL"),license:m.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:m.array(m.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:m.boolean().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:m.array(Ese()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),LEe=Y(()=>m.object({description:m.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:m.lazy(()=>zp()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),Zae=Y(()=>m.object({hooks:m.union([Wo().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),m.lazy(()=>zp()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),m.array(m.union([Wo().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),m.lazy(()=>zp()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),Qae=Y(()=>m.object({source:Ob().optional().describe("Path to command markdown file, relative to plugin root"),content:m.string().optional().describe("Inline markdown content for the command"),description:m.string().optional().describe("Command description override"),argumentHint:m.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:m.string().optional().describe("Default model for this command"),allowedTools:m.array(m.string()).optional().describe("Tools allowed when command runs")}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),Yae=Y(()=>m.object({commands:m.union([Ob().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both."),m.array(Ob().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),m.record(m.string(),Qae()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" \u2192 "/plugin:about")')])})),Xae=Y(()=>m.object({agents:m.union([Ib().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both."),m.array(Ib().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),ese=Y(()=>m.object({skills:m.union([Or().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan)."),m.array(Or().describe("Path to a skill directory, relative to the plugin root.")).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),AN=Y(()=>m.object({outputStyles:m.union([Or().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both."),m.array(Or().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),tse=Y(()=>m.string().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),nse=16,rse=Y(()=>m.object({id:tse(),remote:m.string().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:m.string().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),ise=Y(()=>m.object({syntaxHighlighting:m.object({hljsLanguages:m.array(rse()).max(nse)}).strict()})),EN=Y(()=>m.object({themes:m.union([Or().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both."),m.array(Or().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded \u2014 list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),ose=Y(()=>m.object({})),oO=Y(()=>m.string().min(1)),ase=Y(()=>m.string().min(2).refine(e=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),sse=Y(()=>m.object({mcpServers:m.union([Wo().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),iO().describe("Path or URL to MCPB file containing MCP server configuration"),m.record(m.string(),Pb()).describe("MCP server configurations keyed by server name"),m.array(m.union([Wo().describe("Path to MCP servers configuration file"),iO().describe("Path or URL to MCPB file"),m.record(m.string(),Pb()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),PN=Y(()=>m.object({type:m.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:m.string().describe("Human-readable label shown in the config dialog"),description:m.string().describe("Help text shown beneath the field in the config dialog"),required:m.boolean().optional().describe("If true, validation fails when this field is empty"),default:m.union([m.string(),m.number(),m.boolean(),m.array(m.string())]).optional().describe("Default value used when the user provides nothing"),multiple:m.boolean().optional().describe("For string type: allow an array of strings"),sensitive:m.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:m.number().optional().describe("Minimum value (number type only)"),max:m.number().optional().describe("Maximum value (number type only)")}).strict()),dse=Y(()=>m.object({userConfig:m.record(m.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) \u2014 they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),PN()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),lse=Y(()=>m.object({channels:m.array(m.object({server:m.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:m.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:m.record(m.string(),PN()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),aO=Y(()=>m.strictObject({command:m.string().min(1).refine(e=>!(e.includes(" ")&&!e.startsWith("/")),{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:m.array(oO()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:m.record(ase(),oO()).refine(e=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:m.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:m.record(m.string(),m.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:m.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:m.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:m.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:m.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:m.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:m.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:m.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:m.boolean().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),use=Y(()=>m.strictObject({name:m.string().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:m.string().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd \u2014 prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:m.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:m.union([m.literal("always"),m.string().startsWith("on-skill-invoke:").refine(e=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),cse=Y(()=>m.array(use()).refine(e=>new Set(e.map(t=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),IN=Y(()=>m.object({monitors:m.union([Wo().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),cse()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),fse=Y(()=>m.object({lspServers:m.union([Wo().describe("Path to .lsp.json configuration file relative to plugin root"),m.record(m.string(),aO()).describe("LSP server configurations keyed by server name"),m.array(m.union([Wo().describe("Path to LSP configuration file"),m.record(m.string(),aO()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),ON=Y(()=>m.string().refine(e=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine(e=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,n=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||n.test(e)},"Invalid npm package name format")),pse=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,mse=/^[0-9a-f]{64}$/,hse=Y(()=>m.object({sha256:m.string().regex(mse)}));yse=Y(()=>m.object({binaries:m.unknown().transform(gse).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),_se=Y(()=>m.object({settings:m.record(m.string(),m.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),bse=Y(()=>m.object({experimental:m.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,m.object({...EN().partial().shape,...ise().partial().shape,...IN().partial().shape,...AN().partial().shape,evals:m.union([m.string(),m.array(m.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),vse=Y(()=>m.object({...Vae().shape,...Zae().partial().shape,...Yae().partial().shape,...Xae().partial().shape,...ese().partial().shape,...AN().partial().shape,...EN().partial().shape,...ose().shape,...lse().partial().shape,...sse().partial().shape,...fse().partial().shape,...IN().partial().shape,..._se().partial().shape,...dse().partial().shape,...yse().partial().shape,...bse().partial().shape})),Jp=Y(()=>m.discriminatedUnion("source",[m.object({source:m.literal("url"),url:m.string().url().describe("Direct URL to marketplace.json file"),headers:m.record(m.string(),m.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),m.object({source:m.literal("github"),repo:m.string().describe("GitHub repository in owner/repo format"),ref:m.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:m.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:m.array(m.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:m.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),m.object({source:m.literal("git"),url:m.string().describe("Full git repository URL"),ref:m.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:m.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:m.array(m.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:m.boolean().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),m.object({source:m.literal("npm"),package:ON().describe("NPM package containing marketplace.json")}),m.object({source:m.literal("file"),path:m.string().describe("Local file path to marketplace.json")}),m.object({source:m.literal("directory"),path:m.string().describe("Local directory containing .claude-plugin/marketplace.json")}),m.object({source:m.literal("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),m.object({source:m.literal("hostPattern"),hostPattern:m.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),m.object({source:m.literal("pathPattern"),pathPattern:m.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),m.object({source:m.literal("settings"),name:CN().refine(e=>!TN.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection \u2014 validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:m.array(Sse()).describe("Plugin entries declared inline in settings.json"),owner:Ow().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),s_=Y(()=>m.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),RN=Y(()=>m.union([m.preprocess(e=>e==="."?"./":e,Or()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),m.object({source:m.literal("npm"),package:ON().or(m.string().refine(e=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:m.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:m.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),m.object({source:m.literal("url"),url:m.string().describe("Full git repository URL (https:// or git@)"),ref:m.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:s_().optional().describe("Specific commit SHA to use")}),m.object({source:m.literal("github"),repo:m.string().describe("GitHub repository in owner/repo format"),ref:m.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:s_().optional().describe("Specific commit SHA to use")}),m.object({source:m.literal("git-subdir"),url:m.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:m.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:m.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:s_().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),m.object({source:m.literal("unsupported")}).describe('Placeholder for source types this Claude Code version does not recognize. Never authored by hand \u2014 PluginMarketplaceSchema rewrites unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with a clear "update Claude Code" message.')])),Sse=Y(()=>m.object({name:m.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:RN().describe("Where to fetch the plugin from. Must be a remote source \u2014 relative paths have no marketplace repository to resolve against."),description:m.string().optional(),version:m.string().optional(),strict:m.boolean().optional()}).refine(e=>typeof e.source!="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine(e=>typeof e.source=="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url)."})),wse=Y(()=>m.object({cli:m.array(m.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) \u2014 exact match against commands run this session.'),hosts:m.array(m.string().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) \u2014 exact, case-insensitive match against hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path.'),filesRead:m.array(m.string().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) \u2014 the plugin is relevant when a file Claude has read this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive.'),manifestDeps:m.array(m.object({file:m.string().max(256),pattern:m.string().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: `file` matches the manifest filename (package.json, go.mod, requirements.txt, \u2026); `pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:m.array(m.string().max(256)).max(10).optional().describe(`Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) \u2014 the plugin is relevant when the session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),kse=Y(()=>m.object({topic:m.string().max(64).optional().describe('What the user is working with when this plugin is relevant \u2014 fills "Working with {topic}?". Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:wse().optional().describe("Matchers that determine when the plugin is relevant.")})),xse=Y(()=>vse().partial().extend({name:m.string().min(1,"Plugin name cannot be empty").refine(e=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:RN().describe("Where to fetch the plugin from"),category:m.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:m.array(m.string()).optional().describe("Tags for searchability and discovery"),strict:m.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:m.preprocess(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,kse().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),Tse=Y(()=>m.object({name:m.string().min(1).refine(e=>!e.includes(" "))}));UEe=Y(()=>m.object({$schema:m.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:CN(),version:m.string().optional().describe("Marketplace manifest version"),description:m.string().optional().describe("Human-readable description of this marketplace"),owner:Ow().describe("Marketplace maintainer or curator information"),plugins:m.array(m.unknown()).transform(Cse).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:m.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:m.object({pluginRoot:m.string().optional().describe("Base path for relative plugin sources"),version:m.string().optional().describe("Marketplace version"),description:m.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:m.array(m.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies \u2014 no transitive trust."),renames:m.record(m.string(),m.string().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name \u2192 current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),$N=Y(()=>m.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),Ase=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,Ese=Y(()=>m.union([m.string().regex(Ase,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(e=>e.replace(/@\^[^@]*$/,"")),m.object({name:m.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:m.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),Pse=Y(()=>m.object({version:m.string().describe("Currently installed version"),installedAt:m.string().describe("ISO 8601 timestamp of installation"),lastUpdated:m.string().optional().describe("ISO 8601 timestamp of last update"),installPath:m.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:m.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:m.string().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:m.boolean().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs).")})),Ise=Y(()=>m.object({version:m.literal(1).describe("Schema version 1"),plugins:m.record($N(),Pse()).describe("Map of plugin IDs to their installation metadata")})),Ose=Y(()=>m.enum(["managed","user","project","local"])),Rse=Y(()=>m.object({scope:Ose().describe("Installation scope"),projectPath:m.string().optional().describe("Project path (required for project/local scopes)"),installPath:m.string().describe("Absolute path to the versioned plugin directory"),version:m.string().optional().describe("Currently installed version"),installedAt:m.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:m.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:m.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:m.string().optional().describe("Tag-derived semver this install resolved to"),auto:m.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),$se=Y(()=>m.object({version:m.literal(2).describe("Schema version 2"),plugins:m.record($N(),m.array(Rse())).describe("Map of plugin IDs to arrays of installation entries")})),GEe=Y(()=>m.union([Ise(),$se()])),Mse=Y(()=>m.object({source:Jp().describe("Where to fetch the marketplace from"),installLocation:m.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:m.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:m.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),zEe=Y(()=>m.record(m.string(),Mse())),jse=["autoMode","deepLink","voice","briefView","screenReader"],kf={},Um={autoMode:{buildGate:()=>!1,shape:()=>kf,permissionsShape:()=>kf,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:m.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>kf},briefView:{buildGate:()=>!0,shape:()=>({defaultView:m.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>kf}};sO={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};qN="workspace",JEe=`mcp__${qN}__bash`,KEe=`mcp__${qN}__web_fetch`;Kp={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:e=>e.includes("*")||e.includes("?")?{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]}:{valid:!0},WebFetch:e=>e.includes("://")||e.startsWith("http")?{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]}:e.startsWith("domain:")?{valid:!0}:{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]}}};uO=Y(()=>DN()),Wse=Y(()=>DN("allow"));Hse=Y(()=>m.record(m.string(),m.coerce.string()));BEe=Y(()=>LN(MN())),Vse=Y(()=>m.object({source:Jp().describe("Where to fetch the marketplace from"),installLocation:m.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:m.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Rw=Y(()=>m.object({serverName:m.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:m.array(m.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:m.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(e=>C$([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),$w=Y(()=>m.object({serverName:m.string().min(1,"Server name must be non-empty").refine(e=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine(e=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:m.array(m.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:m.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(e=>C$([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),Zse=Y(()=>m.object({path:m.string().describe("Absolute path to the helper executable"),timeoutMs:m.number().int().min(1e3).optional(),refreshIntervalMs:m.union([m.literal(0),m.number().int().min(6e4)]).optional()})),cO=["skills","agents","hooks","mcp"],fO=Object.freeze({type:"invalid-entry-stripped"}),Qse=Y(()=>m.union([m.object({type:m.literal("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:m.string().describe("Regex matched against turn output (tool results and assistant text)"),url:m.string().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:m.string().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),m.object({type:m.string().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));Gm=Y(()=>Yse(MN())),pO=Object.freeze({serverName:"invalid-entry-stripped"});_i="https://code.claude.com/docs/en",Xse=[{matches:e=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${_i}/iam#permission-modes`}},{matches:e=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:e=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:e=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${_i}/settings#environment-variables`}},{matches:e=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:e=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${_i}/hooks`}},{matches:e=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${_i}/hooks#exec-form-and-shell-form`}},{matches:e=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:e=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:e=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${_i}/settings`}},{matches:e=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:e=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${_i}/iam#working-directories`}}],ede={permissions:`${_i}/iam#configuring-permissions`,env:`${_i}/settings#environment-variables`,hooks:`${_i}/hooks`};WEe=Y(()=>Gm().strict());ide=new Set(im);ade=[{key:"allowedMcpServers",schema:Rw},{key:"deniedMcpServers",schema:$w}];cde=2097152;u_=!1;Ade=null;Ki=Object.freeze({settings:{},errors:[]}),VN=null,ZN=null,QN=!1,Vp=null;Fde={user:"userSettings",project:"projectSettings",local:"localSettings"},kO={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},Dde=["user","project","local"],Lde=new Set(["bypassPermissions","auto","acceptEdits"]),Ude=new Set(["project"]);process.env.NoDefaultCurrentDirectoryInExePath="1";Hde=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"])});import{existsSync as _le,readFileSync as ble}from"node:fs";import{homedir as oF}from"node:os";import{join as jr,posix as Fw,win32 as vle}from"node:path";function Sle(){return["user","project","local"]}function wle(e){return[Fw.join(e,".local","bin"),Fw.join(e,".claude","local")]}function aF(e){return e instanceof Error&&e.message.includes("Native CLI binary for")&&e.message.includes("not found")}function kle(e){let t=e.env.LINZUMI_CLAUDE_CODE_EXECUTABLE?.trim();if(t!==void 0&&t!=="")return e.fileExists(t)?t:void 0;let n=e.platform==="win32",i=e.env.PATH??"",r=n?";":":",o=n?vle.join:Fw.join,a=n?["claude.exe","claude.cmd","claude"]:["claude"],s=[...i.split(r),...!n&&e.homeDir!==void 0?wle(e.homeDir):[]];for(let d of s)if(d!=="")for(let l of a){let u=o(d,l);if(e.fileExists(u))return u}}function lF(e,t,n){let i=dF;dF=e,!(i!==void 0&&(i.kind==="sdk"?e.kind==="sdk":e.kind==="fallback"&&i.executable===e.executable))&&(e.kind==="sdk"&&i===void 0||n({severity:e.kind==="fallback"?"warning":"info",key:xle,message:t()}))}async function*Cle(){}async function Ale(e,t){let n;try{return await Promise.race([e.supportedModels(),new Promise((i,r)=>{n=setTimeout(()=>r(new Error("Claude model discovery timed out")),t),n.unref?.()})])}finally{n!==void 0&&clearTimeout(n)}}async function Ele(e,t=Tle){let n=e.query(Cle()),i;try{i=await Ale(n,t)}finally{await n.return(void 0)}if(i.length===0)return{type:"empty"};let r=[],o=new Set;for(let a of i){let s=a.value.trim(),d=a.displayName.trim(),l=(a.supportedEffortLevels??[]).map(u=>u.trim());if(s===""||s.length>qw||d===""||d.length>qw||o.has(s)||l.some(u=>u===""||u.length>qw)||new Set(l).size!==l.length||a.supportsEffort===!0&&l.length===0||a.supportsEffort===!1&&l.length>0)throw new tr("Claude supportedModels included invalid model metadata");if(o.add(s),r.push({id:s,displayName:d,reasoningEfforts:l}),r.length>uF)throw new tr(`Claude supportedModels exceeded ${uF} models`)}if(!o.has("default"))throw new tr("Claude supportedModels did not advertise the runtime default model");return{type:"ready",catalog:{defaultModel:"default",models:r}}}async function cF(e){try{return await Ele(e)}catch(t){let n=t instanceof tr?"invalid_response":"discovery_failed";return rt("claude_code.model_catalog_discovery_failed",{failure_code:n}),{type:"failed",failureCode:n}}}function fF(e){return e===void 0?{}:{pathToClaudeCodeExecutable:e}}function Ple(e){return e!==void 0?e:($0(),process.env)}function Ile(e){return e instanceof Error&&e.message.includes("initialization did not complete within")}function Rle(e){return CE(e).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,"<redacted>").replace(/(\/\/[^\s/:@]+):[^\s@]+@/g,"$1:<redacted>@")}function pF(e,t){let n=e instanceof Error?e.message:String(e),i=t.map(({executable:o,stderrTail:a})=>a===""?`${o}: (no stderr output from the claude subprocess)`:`${o}: stderr tail: ${a}`),r=t.length===0?"no claude subprocess was spawned":i.join(" | ");return Rle(`${n} [probed ${r}]`.replace(/\s+/g," ").trim())}async function mF(e,t){let n=[],i=t?.reportNotice??oy,r=o=>{let a={executable:o,stderrTail:""};return n.push(a),s=>{a.stderrTail=`${a.stderrTail}${s}`.slice(-Ole)}};try{let o=Ple(t?.env),a=t?.platform??process.platform,s=t?.fileExists??_le,d=e.claudeBin===void 0?void 0:Yh(e.claudeBin,{env:o,platform:a,fileExists:s});if(e.claudeBin!==void 0&&d===void 0)return i({severity:"error",key:"claude_code.claude_bin_missing",message:`--claude-bin ${e.claudeBin} does not exist (checked the given path and the runner's search PATH). Claude Code stays disabled; fix the path or remove the flag.`}),{status:"binary_missing",transient:!1};if(d===void 0&&!$le(o,{cwd:e.cwd,homeDir:oF(),platform:a,fileExists:s,readTextFile:Lle}))return{status:"not_logged_in",transient:!1};let l=t?.startup??(await Promise.resolve().then(()=>(iF(),rF))).startup,u={cwd:e.cwd,persistSession:!1,settingSources:Sle(),tools:[],env:o},c=15e3,p;try{p=await l({options:{...u,...fF(d),stderr:r(d??"the SDK-bundled claude")},initializeTimeoutMs:c})}catch(f){let h=d??kle({env:o,platform:a,fileExists:s,homeDir:oF()});if(h===void 0||h===d)throw f;return lF({kind:"fallback",executable:h},()=>aF(f)?`claude agent SDK native binary is missing; retrying the availability probe with the user-installed claude executable at ${h}`:`claude agent SDK startup failed (${pF(f,n)}); retrying the availability probe with the user-installed claude executable at ${h}`,i),p=await l({options:{...u,...fF(h),stderr:r(h)},initializeTimeoutMs:c}),sF=h,e.onAuthenticated?.(),{status:"logged_in",transient:!1,fallbackExecutable:h,modelCatalogDiscovery:await cF(p)}}return sF=d,e.onAuthenticated?.(),d===void 0&&lF({kind:"sdk"},()=>"claude agent SDK startup recovered; the availability probe is using the SDK's own claude executable again",i),{status:"logged_in",transient:!1,modelCatalogDiscovery:await cF(p)}}catch(o){let a=aF(o),s=e.claudeBin===void 0?a?`The claude agent SDK's platform-native package (@anthropic-ai/claude-agent-sdk-${t?.platform??process.platform}-${process.arch}) is missing from this install, and no user-installed claude executable was found (checked PATH, ~/.local/bin, ~/.claude/local). Restart the runner on the current CLI (it rebuilds the worker-entry mirror with the native package at boot), or install Claude Code and pass --claude-bin "$(command -v claude)" when starting the runner.`:'If `claude` works in your terminal, pass --claude-bin "$(command -v claude)" when starting the runner, or set LINZUMI_CLAUDE_CODE_EXECUTABLE to the binary\'s absolute path.':`--claude-bin ${e.claudeBin} was found but Claude Code failed to start (an auth or startup error, not a missing binary). Check \`claude\` runs and is logged in, then restart the runner.`,d=pF(o,n),l=Ile(o)?" The startup PROBE hit its deadline - this is a liveness verdict about the probe, not proof the binary is broken; the runner re-probes on credential changes without a restart (#2989).":"";return i({severity:"error",key:"claude_code.availability_probe_failed",message:`claude code availability probe failed: ${d}
271
- Claude Code sessions stay disabled for this runner (Codex is unaffected).${l} ${s}`}),{status:a?"binary_missing":"probe_failed",transient:!a,detail:d}}}function $le(e,t){let n=e.CLAUDE_CONFIG_DIR??jr(t.homeDir,".claude");return Mle(e)||jle(e)||qle(n,t)||Nle(n,t)||Dle(t)}function Nw(e){return e!==void 0&&e.trim()!==""}function Au(e){let t=e?.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function Mle(e){return Nw(e.ANTHROPIC_API_KEY)||Nw(e.ANTHROPIC_AUTH_TOKEN)||Nw(e.CLAUDE_CODE_OAUTH_TOKEN)}function jle(e){return Au(e.CLAUDE_CODE_USE_BEDROCK)||Au(e.CLAUDE_CODE_USE_VERTEX)||Au(e.CLAUDE_CODE_USE_FOUNDRY)||Au(e.CLAUDE_CODE_USE_ANTHROPIC_AWS)||Au(e.CLAUDE_CODE_USE_MANTLE)}function qle(e,t){return t.fileExists(jr(e,".credentials.json"))||t.fileExists(jr(e,".claude.json"))||t.fileExists(jr(t.homeDir,".claude.json"))}function Nle(e,t){return[jr(e,"settings.json"),jr(e,"settings.local.json"),jr(t.cwd,".claude","settings.json"),jr(t.cwd,".claude","settings.local.json")].some(n=>Fle(n,t))}function Fle(e,t){let n=t.readTextFile(e);if(n===void 0)return!1;try{let i=pe(JSON.parse(n));return Ule(Q(i?.apiKeyHelper))!==void 0}catch{return!1}}function Dle(e){return e.platform!=="darwin"?!1:[jr(e.homeDir,"Library","Application Support","claude-cli-nodejs"),jr(e.homeDir,"Library","Application Support","Claude"),jr(e.homeDir,"Library","Preferences","claude-cli-nodejs")].some(t=>e.fileExists(t))}function Lle(e){try{return ble(e,"utf8")}catch(t){let n=t instanceof Error&&"code"in t&&typeof t.code=="string"?t.code:"unknown";n!=="ENOENT"&&rt("runner.claude_auth_hint_read_failed",{path:e,code:n});return}}function Ule(e){if(e===void 0)return;let t=e.trim();return t.length===0?void 0:t}var sF,dF,xle,uF,qw,Tle,Ole,hF=q(()=>{"use strict";kE();xE();hc();Ii();ht();TE();Hu();AE();ay();cc();EE();by();PE();Py();xle="claude_code.probe_executable_fallback";uF=100,qw=255,Tle=1e4;Ole=600});function gF(e){let t;try{t=JSON.parse(Buffer.from(e,"base64").toString("utf8"))}catch{throw new Error("invalid guest cloud turn config payload (not base64 JSON)")}if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("invalid guest cloud turn config payload");let n=t;for(let[i,r]of[["codexVersion",n.codexVersion],["sandbox",n.sandbox],["approvalPolicy",n.approvalPolicy],["kandanUrl",n.kandanUrl],["cwd",n.cwd]])if(typeof r!="string"||r==="")throw new Error(`invalid guest cloud turn config payload (${i} missing)`);if(!Array.isArray(n.input))throw new Error("invalid guest cloud turn config payload (input)");if(typeof n.appServerPort!="number"||!Number.isInteger(n.appServerPort))throw new Error("invalid guest cloud turn config payload (appServerPort)");return n}var Dw,yF=q(()=>{"use strict";Dw={mcpAuthFileContents:"LINZUMI_CLOUD_MCP_AUTH_JSON",llmProxyToken:"LINZUMI_CLOUD_LLM_PROXY_TOKEN"}});var _F=q(()=>{"use strict";Wu()});var ea,Gle,bF=q(()=>{"use strict";hh();Wu();_F();ea="/home/agent",Gle=`${ea}/.linzumi-provisioned`});var Lw,KPe,BPe,WPe,vF=q(()=>{"use strict";Lw="/dev/shm/linzumi",KPe=`${Lw}/codex`,BPe=`${Lw}/mcp-auth.json`,WPe=`${Lw}/codex.env`});function Jw(e){if(!zle.test(e))throw new Error(`invalid cloud turn nonce: ${JSON.stringify(e.slice(0,80))}`)}var YPe,SF,Uw,Gw,zm,wF,zw,kF,zle,xF=q(()=>{"use strict";bF();vF();YPe=`${ea}/cloud-supervisor.mjs`,SF=`${ea}/mcp-server.mjs`,Uw=`${ea}/.secrets`,Gw=`${Uw}/mcp-auth.json`,zm=`${ea}/.codex`,wF=`${zm}/linzumi-thread-map.json`,zw=`${ea}/.turn-heartbeats`,kF=5e3,zle=/^[A-Za-z0-9-]{8,64}$/});import{spawn as Hw}from"node:child_process";import{randomUUID as Jle}from"node:crypto";import{createConnection as Kle,createServer as Ble}from"node:net";import{appendFileSync as Wle,rmSync as ta,writeFileSync as Eu,mkdirSync as Bs,mkdtempSync as Vw,chmodSync as Js,existsSync as Ks,readFileSync as na,readdirSync as Hle,statSync as Vle,unlinkSync as Zle}from"node:fs";import{dirname as PF,join as ni}from"node:path";function tue(e){let t=e[CF];if(t===void 0)return eue;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0||n>Km)throw new Error(`${CF} must be an integer number of milliseconds between 1 and ${Km}, got ${JSON.stringify(t)}`);return n}function nue(e){let t=e[TF];if(t===void 0)return Xle;let n=Number(t);if(t.trim()===""||!Number.isSafeInteger(n)||n<=0)throw new Error(`${TF} must be a positive integer number of milliseconds, got ${JSON.stringify(t)}`);return n}function rue(e,t,n){if(e.method!=="thread/tokenUsage/updated")return;let i=pe(e.params)??{};if(Q(i.threadId)!==t||Q(i.turnId)!==n)return;let r=mt(pe(pe(i.tokenUsage)?.total)?.totalTokens),o=mt(pe(pe(i.tokenUsage)?.last)?.totalTokens);if(!(r===void 0||r<0))return{totalTokens:r,priorCallTotalTokens:o!==void 0&&o>=0&&o<=r?r-o:void 0}}function qr(e){return e.replace(/\bsmk_[A-Za-z0-9._-]+/g,"smk_[REDACTED]").replace(/\b(sk|lz|tok|bearer)[-_][A-Za-z0-9._-]{8,}/gi,"$1_[REDACTED]")}function iue(e,t){let n=t.now??Date.now,i=Buffer.alloc(0),r=null,o=null,a=s=>{let d=Buffer.isBuffer(s)?s:Buffer.from(s,"utf8");i=Buffer.concat([i,d]);let l=Kw*2;i.byteLength>l&&(i=i.subarray(i.byteLength-l))};return e.stdout?.on("data",a),e.stderr?.on("data",a),e.once("exit",(s,d)=>{r=s,o=d??null}),{evidence:s=>{let d=Buffer.from(qr(i.toString("utf8")),"utf8"),l=d.byteLength<=Kw?d:d.subarray(d.byteLength-Kw);return{marker:"guest_turn_failure_evidence",empty_output:i.byteLength===0,output_tail:l.toString("utf8"),exit_code:r,signal:o,duration_ms:Math.max(0,n()-t.startedAtMs),model_call_count:s}}}}function oue(e){Bm=e;try{Bs(PF(e),{recursive:!0}),Eu(e,"")}catch{Bm=void 0}}function Mn(e){let t=`${JSON.stringify(e)}
272
- `;if(process.stdout.write(t),Bm!==void 0)try{Wle(Bm,t)}catch{}}function Jm(e,t,n,i){Mn({phase:"exit",ok:e,reason:qr(t),turnMs:n,...i===void 0?{}:{evidence:i}})}function aue(e){return{id:e.id,name:e.name,baseUrl:e.baseUrl,envKey:e.envKey,wireApi:e.wireApi,...e.httpHeaders===void 0?{}:{httpHeaders:{...e.httpHeaders}},...e.envHttpHeaders===void 0?{}:{envHttpHeaders:{...e.envHttpHeaders}}}}function sue(e){if(e.sandbox!=="read-only")throw new Error(`guest cloud turn requires sandbox "read-only", got ${JSON.stringify(e.sandbox)}`);if(e.approvalPolicy!=="never")throw new Error(`guest cloud turn requires approvalPolicy "never", got ${JSON.stringify(e.approvalPolicy)}`)}function due(e,t=zm){let n=j0({command:"node",argsPrefix:[SF],kandanUrl:e.kandanUrl,authFilePath:Gw,ownerUsername:e.ownerUsername,operatingMode:"text",cwd:e.cwd,threadId:e.threadId,agentSession:!0});return lg(`ws://127.0.0.1:${e.appServerPort}`,{model:e.model,reasoningEffort:e.reasoningEffort,mcpServers:[n],neverEquivalentGranularApprovalPolicy:!0,...e.modelProvider===void 0?{}:{modelProvider:aue(e.modelProvider)},env:{CODEX_HOME:t,...IF(e)}})}function IF(e){let t=process.env[Dw.llmProxyToken];return e.modelProvider===void 0||t===void 0||t===""?{}:{[e.modelProvider.envKey]:t}}function lue(e,t){let n=process.env[Dw.mcpAuthFileContents];if(n===void 0||n==="")throw new Error("guest cloud turn missing MCP auth-cache (LINZUMI_CLOUD_MCP_AUTH_JSON)");Bs(e,{recursive:!0,mode:448}),Js(e,448),Eu(t,n,{mode:384}),Js(t,384)}function uue(e){try{ta(e,{recursive:!0,force:!0})}catch{}}async function pue(e){if(e.config.threadId===void 0||e.config.threadId==="")throw new Error("guest thread rehydration requires the durable Linzumi thread id");let t=hd(e.config.kandanUrl,e.mcpAuthPath);if(t===void 0)throw new Error("guest thread rehydration requires an agent token in the MCP auth file");let n=md({kandanUrl:e.config.kandanUrl,accessToken:t.accessToken,operatingMode:"text"}),i=[],r,o,a;for(let d=0;d<fue;d+=1){let l=await n.getThreadTranscript({thread_id:e.config.threadId,...a===void 0?{}:{cursor:a}}),u=wy(l);if(u===void 0)throw new Error(`guest thread rehydration received a malformed durable transcript page ${d}`);if(i=[...u.nodes,...i],r=r??u.budget,o=o??u.threadTitle,!u.hasMore||u.cursor===void 0)break;a=u.cursor}if(i.length===0)throw new Error("guest thread rehydration durable transcript was empty");let s=ky({nodes:i,budget:r,resumeFailure:e.resumeFailure,threadTitle:o,linzumiContext:void 0});if(s.items.length===0)throw new Error("guest thread rehydration compiled zero injection items");return s.items}async function mue(e){if(e.config.threadId===void 0||e.config.threadId==="")throw new Error("guest session rebuild notice requires a Linzumi thread id");let t=hd(e.config.kandanUrl,e.mcpAuthPath);if(t===void 0)throw new Error("guest session rebuild notice requires an agent token in the MCP auth file");await md({kandanUrl:e.config.kandanUrl,accessToken:t.accessToken,operatingMode:"voice"}).sendThreadReply({thread_id:e.config.threadId,body:AF,client_message_id:e.notice.noticeId,payload:{structured:{kind:"agent_status_event",item_id:e.notice.noticeId,transcript_unit_id:`agent_status_event:${e.notice.noticeId}`,stream_state:"completed",event_kind:"status",title:"Rebuilt the agent session",body:AF,severity:"info",agent_provider:"codex",raw_provider_metadata:{provider_session_key:e.notice.threadId,resume_failure:e.notice.resumeFailure}}}})}function OF(e){try{let t=JSON.parse(na(e,"utf8"));if(typeof t!="object"||t===null||Array.isArray(t))return{};let n={};for(let[i,r]of Object.entries(t))typeof r=="string"&&r!==""&&(n[i]=r);return n}catch{return{}}}function hue(e,t,n){try{let i=OF(e);delete i[t];let r=Object.entries(i),o=r.slice(Math.max(0,r.length-(cue-1)));o.push([t,n]),Bs(PF(e),{recursive:!0}),Eu(e,JSON.stringify(Object.fromEntries(o)))}catch{}}function RF(e){let t=pe(pe(e)?.item);if(t===void 0||Q(t.type)!=="agentMessage")return"";let n=Q(t.text);return n!==void 0&&n!==""?n:(nn(t.content)??[]).map(o=>{let a=pe(o);if(a===void 0)return;let s=Q(a.type);if(!(s!=="text"&&s!=="output_text"&&s!=="input_text"))return Q(a.text)??Q(a.content)}).filter(o=>o!==void 0&&o!=="").join(`
273
-
274
- `)}function _ue(e){let t=pe(pe(e)?.item);if(t===void 0)return!1;let n=Q(t.type);if(n!=="mcpToolCall"&&n!=="dynamicToolCall"&&n!=="collabAgentToolCall"||Q(t.status)!=="completed"||t.error!==void 0&&t.error!==null||t.success===!1)return!1;let i=Q(t.tool)??"",r=i.split("__").pop()??i;if(r==="linzumi_complete_topic_wake_no_action"){let o=pe(t.result),a=pe(o?.structuredContent);return o?.isError!==!0&&a?.ok===!0&&a?.completed_without_action===!0}return r==="linzumi_agent_reply"||r==="linzumi_decline_document_action"}function vue(e){return/already_replied|no_active_asker_binding/i.test(e)}async function Sue(e){let t=e.body.trim();if(t==="")return"skipped";let n=hd(e.kandanUrl,e.mcpAuthPath);if(n===void 0)throw new Error("reply relay: no agent token in the guest MCP auth file");let i=async(o,a)=>{let s=new AbortController,d=setTimeout(()=>s.abort(),bue);try{return await fetch(o,{...a,signal:s.signal})}finally{clearTimeout(d)}},r=md({kandanUrl:e.kandanUrl,accessToken:n.accessToken,operatingMode:"text",fetchImpl:i});try{return await r.agentReply({body:t}),"posted"}catch(o){let a=o instanceof Error?o.message:String(o);if(vue(a))return"already";throw new Error(`reply relay failed: ${a}`)}}function Cue(e){return/\bHTTP 4\d\d\b/.test(e)||/\b(forbidden|not_agent_session|no_active_asker_binding|invalid_agent_turn_progress_request|body_required|already_replied)\b/i.test(e)}function Aue(e){return async t=>{let n=hd(e.kandanUrl,e.mcpAuthPath);if(n===void 0)throw new Error("turn progress: no agent token in the guest MCP auth file");let i=async(o,a)=>{let s=new AbortController,d=setTimeout(()=>s.abort(),kue);try{return await fetch(o,{...a,signal:s.signal})}finally{clearTimeout(d)}};return md({kandanUrl:e.kandanUrl,accessToken:n.accessToken,operatingMode:"text",fetchImpl:i}).agentTurnProgress(t)}}function Eue(e){let t=Date.now,n=e.flushIntervalMs??wue,i=e.log??Mn,r=e.post??Aue({kandanUrl:e.kandanUrl,mcpAuthPath:e.mcpAuthPath}),o=new Map,a,s=0,d=!1,l=0,u=0,c,p,f=!1,h=!1,g=(S,k,T)=>{let E=`${T}:${S}`,P=o.get(E);if(P!==void 0)return P;let R={providerTurnId:T,itemId:S,kind:k,phase:"commentary",text:"",snapshotIndex:0,state:"streaming",dirty:!1,lastFlushMs:0,ackedState:void 0};return o.set(E,R),R},_=S=>S.state==="streaming"?S.lastFlushMs+n:0,y=async(S,k)=>{let T=k.text,E=k.state;k.dirty=!1,k.snapshotIndex+=1,k.lastFlushMs=t();try{return await r({stream_key:`${e.streamKeyPrefix}:${k.itemId}`,item_id:k.itemId,turn_id:k.providerTurnId,kind:k.kind,...k.kind==="codex_assistant_message"?{phase:k.phase}:{},body:T,stream_state:E,snapshot_index:k.snapshotIndex,...e.sourceSeq===void 0?{}:{source_seq:e.sourceSeq}}),u+=1,l=0,k.ackedState=E,!0}catch(P){l+=1;let R=P instanceof Error?P.message:String(P);return Cue(R)?(h=!0,d=!0,i({phase:"progress",outcome:"permanent_reject",message:qr(R)}),!1):(i({phase:"progress",outcome:"post_failed",consecutive_failures:l,message:qr(R)}),l>=xue&&(d=!0,i({phase:"progress",outcome:"disabled"})),!1)}},b=async()=>{for(;;){if(d)return;let S=t(),k,T=!1;for(let[E,P]of o){if(!P.dirty||P.text===""||P.state!=="streaming"&&!f)continue;let R=_(P);R<=S?(await y(E,P),T=!0):k=k===void 0?R:Math.min(k,R)}if(!T){k!==void 0&&(clearTimeout(p),p=setTimeout(v,Math.max(10,k-t())),p.unref?.());return}}};function v(){d||f||a===void 0||c!==void 0||(c=b().catch(S=>{i({phase:"progress",outcome:"pump_error",message:qr(String(S))})}).finally(()=>{c=void 0}))}return{onNotification:S=>{try{if(!["item/agentMessage/delta","item/reasoning/textDelta","item/completed"].includes(S.method)){i({phase:"progress",outcome:"notification_not_owned_by_progress",method:S.method,expected_provider_thread_id:e.providerThreadId,active_provider_turn_id:a??null});return}if(f||h){i({phase:"progress",outcome:"notification_after_admission_closed",method:S.method});return}let k=pe(S.params)??{},T=gT(e.providerThreadId,a,k);if(T.TAG==="Error"){i({phase:"progress",outcome:T._0,method:S.method,expected_provider_thread_id:e.providerThreadId,active_provider_turn_id:a??null,received_provider_thread_id:qr(Q(k.threadId)??"").slice(0,128),received_provider_turn_id:qr(Q(k.turnId)??"").slice(0,128),item_id:Q(k.itemId)??Q(pe(k.item)?.id)??null});return}if(a===void 0){let E=yT(s,Buffer.byteLength(JSON.stringify(S)));if(E.TAG==="Error"){i({phase:"progress",outcome:E._0,expected_provider_thread_id:e.providerThreadId,received_provider_turn_id:T._0,item_id:Q(k.itemId)??Q(pe(k.item)?.id)??null}),o.clear(),d=!0,h=!0;return}s=E._0}if(S.method==="item/agentMessage/delta"){let E=Kh(k);if(E!==void 0){let P=g(E.itemKey,"codex_assistant_message",T._0);P.phase=E.phase,P.text+=E.delta,P.dirty=!0,v()}else i({phase:"progress",outcome:"assistant_delta_shape_invalid",method:S.method});return}if(S.method==="item/reasoning/textDelta"){let E=Bh(k);if(E!==void 0){let P=g(E.itemKey,"codex_reasoning",T._0);P.text+=E.delta,P.dirty=!0,v()}else i({phase:"progress",outcome:"reasoning_delta_shape_invalid",method:S.method});return}if(S.method==="item/completed"){let E=pe(k.item),P=Q(E?.type),R=Q(E?.id);if(R===void 0){i({phase:"progress",outcome:"completed_item_id_missing"});return}if(P==="agentMessage"){let O=RF(S.params),M=g(R,"codex_assistant_message",T._0);M.phase=Jh(E?.phase),O!==""&&(M.text=O),M.state="completed",M.dirty=!0,v()}else if(P==="reasoning"){let O=o.get(`${T._0}:${R}`);O!==void 0?(O.state="completed",O.dirty=!0,v()):i({phase:"progress",outcome:"reasoning_completion_without_item",item_id:R})}}}catch(k){i({phase:"progress",outcome:"notification_error",message:qr(k instanceof Error?k.message:String(k))})}},bindTurn:S=>{let k=hT(a,S);if(k.TAG==="Error"||f||h){i({phase:"progress",outcome:k.TAG==="Error"?k._0:"bind_after_admission_closed",expected_provider_thread_id:e.providerThreadId,active_provider_turn_id:a??null,received_provider_turn_id:qr(S).slice(0,128)}),o.clear(),d=!0,h=!0;return}a=k._0,s=0;for(let[T,E]of o)E.providerTurnId!==a&&(i({phase:"progress",outcome:"staged_foreign_turn_discarded",expected_provider_thread_id:e.providerThreadId,active_provider_turn_id:a,received_provider_turn_id:E.providerTurnId,item_id:E.itemId}),o.delete(T));o.size>0&&v()},finish:async S=>{try{if(a===void 0){f=!0,i({phase:"progress",outcome:"finish_without_provider_turn"});return}let k=t()+(e.finishDeadlineMs??Tue),T=()=>new Promise(P=>setTimeout(P,Math.max(0,k-t())).unref?.());f=!0,clearTimeout(p),c!==void 0&&await Promise.race([c,T()]);for(let P of o.values())P.state==="streaming"&&P.text!==""&&(P.state=S);let E=250;for(;;){let P=[...o.entries()].filter(([,O])=>O.text!==""&&O.state!==O.ackedState);if(P.length===0||h||t()>=k)break;let R=!1;for(let[O,M]of P){if(h||t()>=k)break;await y(O,M)||(R=!0)}R&&!h&&t()<k&&await new Promise(O=>setTimeout(O,E))}i({phase:"progress",outcome:"finished",frames_posted:u,disabled:d})}catch(k){i({phase:"progress",outcome:"finish_error",message:qr(k instanceof Error?k.message:String(k))})}finally{o.clear(),s=0}}}}function Pue(e){if(e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval")return{decision:"decline"}}async function Iue(e,t,n){for(;;){if(n.exitCode!==null&&n.exitCode!==void 0)throw new Error(`codex app-server exited before it accepted a connection (code ${n.exitCode})`);try{return await _c(e)}catch(i){if(Date.now()>=t)throw i;await new Promise(r=>setTimeout(r,Yle))}}}function Rue(e,t){try{for(let n of Hle(e))try{let i=ni(e,n);t-Vle(i).mtimeMs>Oue&&Zle(i)}catch{}}catch{}}function $ue(e,t,n=kF){Jw(t);let i=ni(e,`${t}.beat`),r=()=>{try{Eu(i,`${Date.now()}
275
- `)}catch{}};try{Bs(e,{recursive:!0})}catch{}Rue(e,Date.now()),r();let o=setInterval(r,n);return o.unref?.(),()=>{clearInterval(o);try{ta(i,{force:!0})}catch{}}}function Mue(e,t,n){try{Jw(t),Bs(e,{recursive:!0}),Eu(ni(e,`${t}.exit`),`${JSON.stringify({phase:"exit",ok:n.ok,reason:qr(n.reason),turnMs:n.turnMs,...n.evidence===void 0?{}:{evidence:n.evidence}})}
276
- `)}catch{}}function jue(e){if(!(typeof e!="object"||e===null))return e[$F]}async function que(e,t={}){let n=t.now??Date.now,i=t.secretsDir??Uw,r=t.mcpAuthPath??Gw,o=t.codexHome??zm,a=t.threadMapPath??wF,s=t.modelCallLivenessWindowMs??nue(process.env),d=t.activeLoopBudgetMs??tue(process.env),l=t.activeLoopEvidenceLimit??20;if(!Number.isSafeInteger(s)||s<=0)throw new Error(`guest model-call liveness window must be a positive integer number of milliseconds, got ${JSON.stringify(s)}`);if(!Number.isSafeInteger(d)||d<=0||d>Km)throw new Error(`guest active-loop budget must be an integer number of milliseconds between 1 and ${Km}, got ${JSON.stringify(d)}`);if(!Number.isSafeInteger(l)||l<=0)throw new Error(`guest active-loop evidence limit must be a positive integer, got ${JSON.stringify(l)}`);let u=n();sue(e);let c=e.turnNonce!==void 0&&e.turnNonce!==""?$ue(t.heartbeatDir??zw,e.turnNonce,t.heartbeatIntervalMs):void 0,p,f,h=0,g,_=()=>{if(g!==void 0)return g;if(f!==void 0)return g=f.evidence(h),Mn({phase:"guest_turn_failure_evidence",...g}),g},y=()=>{try{p?.pid!==void 0&&p.kill("SIGINT")}catch{}};try{lue(i,r);let b=due(e,o),v=`ws://127.0.0.1:${e.appServerPort}`;t.spawnCodex===void 0&&Bs(o,{recursive:!0,mode:448}),p=t.spawnCodex?t.spawnCodex(b):Hw("codex",b,{cwd:e.cwd,env:{PATH:process.env.PATH??"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",...process.env.HOME===void 0?{}:{HOME:process.env.HOME},CODEX_HOME:o,...IF(e)},stdio:["ignore","pipe","pipe"],detached:!1}),f=iue(p,{startedAtMs:u,now:n});let w=await Iue(v,u+Qle,p);try{w.onRequest?.(W=>Pue(W.method));let A=e.codexThreadId,C;if(A!==void 0&&A!==""){let W=OF(a)[A];if(W!==void 0){let re=lc({cwd:e.cwd,channelSession:{model:e.model,reasoningEffort:e.reasoningEffort,approvalPolicy:e.approvalPolicy,sandbox:e.sandbox,linzumiAgentSession:!0}}),me=await bE({codex:w,codexThreadId:W,resumeOverrides:re,rebuildWhen:"missing-rollout-only",rehydration:{log:(be,Ce)=>Mn({phase:be,...Ce}),buildRehydrationItems:async be=>{let Ce=t.buildRehydrationItems===void 0?await pue({config:e,mcpAuthPath:r,resumeFailure:be}):await t.buildRehydrationItems();if(Ce.length===0)throw new Error("guest thread rehydration requires non-empty durable transcript items");return Ce},buildRehydrationText:async()=>{throw new Error("guest thread rehydration may not fall back to a non-transcript seed")}}});if(C=W,me.mode==="rehydrated"){let be={noticeId:`guest-codex-rebuilt-${Jle()}`,threadId:W,resumeFailure:me.resumeFailure};await(t.onSessionRebuilt===void 0?mue({config:e,mcpAuthPath:r,notice:be}):t.onSessionRebuilt(be))}if(me.mode==="resumed"?Mn({phase:"thread",mode:"resumed"}):Mn({phase:"thread",mode:"rehydrated",threadId:W}),C!==W)throw new Error("guest continuity invariant lost mapped thread id")}}if(C===void 0){let W=await w.request("thread/start",{cwd:e.cwd,serviceName:"kandan-cloud-agent",personality:"pragmatic",...lc({cwd:e.cwd,channelSession:{model:e.model,reasoningEffort:e.reasoningEffort,approvalPolicy:e.approvalPolicy,sandbox:e.sandbox,linzumiAgentSession:!0}})});if("error"in W)throw new Error(`thread/start failed: ${W.error.message}`);let re=Q(pe(pe(W.result)?.thread)?.id);if(re===void 0)throw new Error("thread/start response did not include thread.id");C=re,A!==void 0&&A!==""&&hue(a,A,C),Mn({phase:"thread",mode:"started"})}let S="",k=!1,T=!1,E=!1,P,R=-1,O=new Set,M,J,Z=[],z=Eue({providerThreadId:C,kandanUrl:e.kandanUrl,mcpAuthPath:r,streamKeyPrefix:e.turnNonce!==void 0&&e.turnNonce!==""?`cloud:${e.turnNonce}`:`cloud:${u}`,...e.sourceSeq===void 0?{}:{sourceSeq:e.sourceSeq},post:t.progressPost,flushIntervalMs:t.progressFlushIntervalMs,now:n}),X,ee=new Promise((W,re)=>{X={resolve:W,reject:re}}),B=()=>{M!==void 0&&(clearTimeout(M),M=void 0)},$=()=>{J!==void 0&&(clearTimeout(J),J=void 0)},K=()=>{B(),M=setTimeout(()=>{M=void 0,E||X?.reject(new Ww(s))},s),M.unref?.()},F=W=>{if(E){Mn({phase:"codex-exit",benign:!0});return}setTimeout(()=>{E||X?.reject(W())},t.postTerminalGraceMs??yue).unref?.()};w.onNotification(W=>{if(Mn({phase:"notification",method:W.method}),z.onNotification(W),P!==void 0){let me=rue(W,C,P);me!==void 0&&me.totalTokens>R&&(R=me.totalTokens,me.priorCallTotalTokens!==void 0&&!O.has(me.priorCallTotalTokens)&&(O.add(me.priorCallTotalTokens),h+=1),K())}if(W.method==="item/completed"){let me=RF(W.params);me!==""&&(S=me);let be=pe(W.params),Ce=P!==void 0&&Q(be?.threadId)===C&&Q(be?.turnId)===P,j=pe(be?.item);Ce&&_ue(W.params)&&((Q(j?.tool)??"").split("__").pop()==="linzumi_complete_topic_wake_no_action"?T=!0:k=!0);let L=Q(j?.type),H;switch(Ce?L:void 0){case"agentMessage":me!==""&&(H={kind:"narration"});break;case"mcpToolCall":case"dynamicToolCall":case"collabAgentToolCall":{H={kind:"tool_call",tool_type:L};break}case"commandExecution":{H={kind:"tool_call",tool_type:L};break}}H!==void 0&&(Z.push(H),Z.length>l&&Z.shift())}if(!gue.has(W.method))return;E=!0,B(),$();let re=W.method==="turn/completed";X?.resolve({ok:re,reason:W.method==="turn/completed"?"turn completed":`turn terminal: ${W.method}`,turnMs:n()-u})}),w.onClose?.(W=>F(()=>new Error(`codex connection closed before a turn terminal: ${W?.message??"connection closed"}`))),p?.once("exit",W=>F(()=>new Error(`codex app-server process exited mid-turn (code ${W})`)));let x=await w.request("turn/start",{threadId:C,input:e.input,...zh({cwd:e.cwd,channelSession:{model:e.model,reasoningEffort:e.reasoningEffort,approvalPolicy:e.approvalPolicy,sandbox:e.sandbox,linzumiAgentSession:!0}})}).catch(async W=>{throw await z.finish("failed"),W});if("error"in x)throw await z.finish("failed"),new Error(`turn/start failed: ${x.error.message}`);if(P=Q(pe(pe(x.result)?.turn)?.id),P===void 0)throw await z.finish("failed"),new Error("turn/start response did not include turn.id");z.bindTurn(P),K(),J=setTimeout(()=>{J=void 0,E||(Mn({phase:"active-loop-budget-exceeded",code:"active_loop_budget_exceeded",budget_ms:d,evidence_limit:l,evidence:Z}),y(),X?.reject(new Bw(d)))},d),J.unref?.();let I;try{I=await ee}catch(W){throw B(),$(),await z.finish("failed"),W}let N=I;if(I.ok){let W=t.relayReply??Sue;try{let re=uT(r);if(!dT(re,T))throw new Error("topic_quiet_failed_or_unresolved_attempt");let me=T?"skipped":await W({kandanUrl:e.kandanUrl,mcpAuthPath:r,body:S});Mn({phase:"reply",relay:me,reply_tool_call_seen:k,quiet_tool_call_seen:T,captured_chars:S.length}),me==="skipped"&&!k&&!T&&(N={ok:!1,reason:"turn completed but no reply was posted: codex produced no visible output to relay and never called linzumi_agent_reply",turnMs:I.turnMs})}catch(re){let me=re instanceof Error?re.message:String(re);Mn({phase:"reply",relay:"failed",reason:me}),N={ok:!1,reason:me,turnMs:I.turnMs}}}if(await z.finish(N.ok?"completed":"failed"),B(),$(),!N.ok){let W=_();return{...N,...W===void 0?{}:{evidence:W}}}return N}finally{w.close()}}catch(b){let v=b instanceof Error?b:new Error(String(b)),w=_();throw w!==void 0&&Object.defineProperty(v,$F,{value:w,enumerable:!1}),v}finally{c?.(),y(),uue(i)}}async function MF(e=process.argv,t={}){let n=e[2];if(n==="--selftest")return Mn({phase:"selftest",ok:!0,node:process.version}),0;if(n===void 0||n==="")return Jm(!1,"missing turn config argv[2]",0),1;let i;try{i=gF(n)}catch(s){return Jm(!1,`config decode failed: ${s instanceof Error?s.message:String(s)}`,0),1}let r=t.heartbeatDir??zw;oue(ni(r,"last-turn.debug.jsonl")),Mn({phase:"boot",turn_nonce:i.turnNonce??null,node:process.version});let o=t.runTurn??que,a=s=>{i.turnNonce!==void 0&&i.turnNonce!==""&&Mue(r,i.turnNonce,s)};try{let s=await o(i);return a(s),Jm(s.ok,s.reason,s.turnMs,s.evidence),s.ok?0:1}catch(s){let d=s instanceof Error?s.message:String(s),l=jue(s);return a({ok:!1,reason:d,turnMs:0,evidence:l}),Jm(!1,d,0,l),1}}function qF(e){switch(e.type){case"ready":return{status:"ready",defaultModel:e.catalog.defaultModel,models:e.catalog.models};case"empty":return{status:"empty"}}}async function NF(e,t={startServer:sg,connect:_c}){let n=e.accessTokenAuth;if(n!==void 0&&(n.accessToken.trim()===""||n.chatgptAccountId.trim()===""))throw new Error("saved-account metadata access token or account identity missing");let i=await t.startServer(e.executable,e.authHome,{inheritEnv:!1,env:{PATH:e.env.PATH,HOME:e.authHome,CODEX_HOME:e.authHome}}),r,o;try{r=await t.connect(i.url);let a=r,s=async()=>{if(n!==void 0){if(a.onRequest===void 0)throw new Error("saved-account metadata client cannot refuse provider requests");a.onRequest(l=>{throw console.warn(`saved_account_metadata_provider_request_refused branch=${l.method==="account/chatgptAuthTokens/refresh"?"token_refresh":"unsupported_request"}`),new Error("metadata-only discovery refuses provider requests")});let d=await a.request("account/login/start",{type:"chatgptAuthTokens",accessToken:n.accessToken,chatgptAccountId:n.chatgptAccountId,...n.chatgptPlanType===void 0?{}:{chatgptPlanType:n.chatgptPlanType}});if("error"in d||pe(d.result)?.type!=="chatgptAuthTokens")throw new Error("saved-account metadata external authentication rejected")}return _E(a)};return qF(await Promise.race([s(),new Promise((d,l)=>{o=setTimeout(()=>l(new Error("hosted Codex model discovery timed out")),Fue),o.unref?.()})]))}finally{o!==void 0&&clearTimeout(o);try{r?.close()}finally{await i.stopAndWait()}}}function FF(e,t){let n=Kk(e,gh);switch(n.TAG){case"Ok":return;case"Error":throw t(n._0),new Error("hosted Codex runtime refused")}}async function DF(e,t){let n,i,r;try{n=await sg(e.executable,e.authHome,{inheritEnv:!1,env:{PATH:e.env.PATH,HOME:e.authHome,CODEX_HOME:e.authHome,NO_COLOR:"1"}}),i=await _c(n.url);let o=i,a=async()=>{if(e.accessTokenAuth!==void 0){if(o.onRequest===void 0)throw new Error("metadata quota request refusal handler missing");o.onRequest(()=>{throw t("hosted_auth_quota_provider_request_refused reason=metadata_only"),new Error("metadata quota refuses provider requests")});let u=await o.request("account/login/start",{type:"chatgptAuthTokens",...e.accessTokenAuth});if("error"in u||pe(u.result)?.type!=="chatgptAuthTokens")throw new Error("metadata quota external authentication rejected")}let d=await o.request("account/rateLimits/read");if("error"in d)throw new Error("hosted quota request failed");let l=pe(d.result);if(l===void 0)throw new Error("hosted quota response invalid");return Yk(rx(l),Date.now())},s=await Promise.race([a(),new Promise((d,l)=>{r=setTimeout(()=>l(new Error("hosted quota request timed out")),15e3)})]);switch(s.status){case"captured":return s.quotaWindow;case"unavailable":t(`hosted_auth_quota_unavailable reason=${s.reason}`);return;default:throw new Error("quota capture observation invalid")}}catch{t("hosted_auth_quota_unavailable reason=probe_failed");return}finally{switch(r!==void 0&&clearTimeout(r),(await Qk(()=>i?.close(),async()=>{await n?.stopAndWait()},t)).TAG){case"Ok":break;case"Error":throw new Error("hosted quota cleanup could not be confirmed")}}}async function LF(e,t={probe:mF,warn:console.warn}){if(e.accessToken!==void 0&&e.accessToken.trim()==="")throw new Error("saved-account Claude metadata access token missing");let n=await t.probe({cwd:e.authHome,claudeBin:e.executable},{env:{PATH:e.env.PATH,HOME:e.authHome,CLAUDE_CONFIG_DIR:e.authHome,...e.accessToken===void 0?{}:{CLAUDE_CODE_OAUTH_TOKEN:e.accessToken}},reportNotice:i=>t.warn(`hosted_claude_model_catalog_notice severity=${i.severity} key=${i.key}`)});if(n.status!=="logged_in"||n.modelCatalogDiscovery===void 0)return t.warn(`hosted_claude_model_catalog_unavailable status=${n.status} catalog_present=${n.modelCatalogDiscovery!==void 0}`),{status:"failed",failureCode:"discovery_failed"};switch(n.modelCatalogDiscovery.type){case"ready":case"empty":return qF(n.modelCatalogDiscovery);case"failed":return{status:"failed",failureCode:n.modelCatalogDiscovery.failureCode}}}async function UF(e){try{let t=e.deps.discoverModelCatalog;if(t!==void 0)return await t({harness:e.harness,authHome:e.authHome,executable:e.executable,env:e.env});switch(e.harness){case"codex":return await NF(e);case"claude_code":return await LF(e)}}catch(t){let n=t instanceof tr?"invalid_response":"discovery_failed";return(e.deps.warn??console.warn)(`hosted_model_catalog_discovery_failed harness=${e.harness} failure_code=${n} error_name=${t instanceof Error?t.name:"NonErrorThrow"}`),{status:"failed",failureCode:n}}}function Hn(e,t){let n=e[t]?.trim();if(n===void 0||n==="")throw new Error(`missing required hosted authorization environment: ${t}`);return n}async function Nr(e,t,n){let i=await fetch(e,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Error(`hosted authorization callback failed with HTTP ${i.status}`)}async function GF(e=process.env,t={}){let n=Hn(e,"LINZUMI_HOSTED_AUTH_CALLBACK_URL"),i=Hn(e,"LINZUMI_HOSTED_AUTH_CALLBACK_TOKEN"),r=Hn(e,"LINZUMI_HOSTED_AUTH_ROOT"),o=Hn(e,"LINZUMI_HOSTED_AUTH_EXPIRES_AT"),a=Hn(e,"LINZUMI_HOSTED_AUTH_HARNESS");if(a!=="codex"&&a!=="claude_code")throw new Error("saved-account metadata harness invalid");if(Zw(o)<=0)throw new Error("saved-account metadata request expired");a==="codex"&&FF(e.LINZUMI_HOSTED_AUTH_CODEX_BIN?.trim()||"codex",t.warn??console.warn);let s=Vw(ni(r,"catalog-"));Js(s,448);try{let d=await fetch(n,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({event:"redeem"}),signal:AbortSignal.timeout(15e3)});if(!d.ok)throw new Error("saved-account metadata credential refused");let l=pe(await d.json()),u=Q(l?.accessToken);if(l===void 0||l.harness!==a||u===void 0||u.trim()==="")throw new Error("saved-account metadata credential shape invalid");let c=a==="codex"?new Set(["harness","accessToken","accountId"]):new Set(["harness","accessToken"]);if(Object.keys(l).some(g=>!c.has(g)))throw new Error("saved-account metadata credential contains unsupported fields");let p;try{switch(a){case"codex":{let g=Q(l.accountId);if(g===void 0||g.trim()==="")throw new tr("saved-account metadata identity missing");p=await(t.discoverCodex??NF)({authHome:s,executable:e.LINZUMI_HOSTED_AUTH_CODEX_BIN?.trim()||"codex",env:e,accessTokenAuth:{accessToken:u,chatgptAccountId:g}});break}case"claude_code":p=await(t.discoverClaude??LF)({authHome:s,executable:e.LINZUMI_HOSTED_AUTH_CLAUDE_BIN?.trim()||"claude",env:e,accessToken:u});break}}catch(g){let _=g instanceof tr?"invalid_response":"discovery_failed";(t.warn??console.warn)(`saved_account_metadata_discovery_failed harness=${a} reason=${_}`),p={status:"failed",failureCode:_}}let f;if(a==="codex"){let g=Q(l.accountId);g===void 0||g.trim()===""?(t.warn??console.warn)("saved_account_quota_unavailable reason=account_identity_missing"):f=await(t.readQuota??DF)({authHome:s,executable:e.LINZUMI_HOSTED_AUTH_CODEX_BIN?.trim()||"codex",env:e,accessTokenAuth:{accessToken:u,chatgptAccountId:g}},t.warn??console.warn)}if(!(await fetch(n,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({event:"completed",modelCatalog:p,...f===void 0?{}:{quotaWindow:f}}),signal:AbortSignal.timeout(15e3)})).ok)throw new Error("saved-account metadata completion refused")}catch{throw new Error("saved-account metadata worker failed")}finally{ta(s,{recursive:!0,force:!0})}}function Due(e){return S0(e)}function Zw(e,t=Date.now){let n=Date.parse(e);if(!Number.isFinite(n))throw new Error("invalid hosted authorization expiry");return Math.min(Nue,Math.max(0,n-t()))}function zF(e){try{let t=pe(JSON.parse(e)),n=pe(t?.tokens),i=Q(n?.account_id)?.trim(),r=Q(n?.id_token)?.trim();if(i===void 0||i===""||r===void 0)return;let o=r.split(".")[1];if(o===void 0)return;let a=pe(JSON.parse(Buffer.from(o,"base64url").toString("utf8"))),s=Q(a?.email)?.trim();if(s===void 0||s==="")return;let d=Q(a?.["https://api.openai.com/auth"])??Q(a?.plan_type);return{providerIdentity:i,email:s,...d===void 0?{}:{plan:d}}}catch{return}}function JF(e,t){try{let n=pe(JSON.parse(e)),i=pe(JSON.parse(t)),r=pe(i?.oauthAccount);if(n===void 0||r===void 0)return;let o=Q(r.accountUuid)?.trim()??Q(r.organizationUuid)?.trim(),a=Q(r.emailAddress)?.trim()??Q(r.email)?.trim();if(o===void 0||o===""||a===void 0||a==="")return;let s=pe(n.claudeAiOauth),d=Q(s?.subscriptionType)??Q(r.subscriptionType);return{credential:JSON.stringify({credentials:n,oauthAccount:r}),providerIdentity:o,email:a,...d===void 0?{}:{plan:d}}}catch{return}}function EF(e,t){if(!Ks(e))return{status:"failed",reason:"credential_missing"};try{let n=na(e,"utf8"),i=zF(n);return n.trim()===""||i===void 0?{status:"failed",reason:"credential_invalid"}:i.providerIdentity!==t?{status:"failed",reason:"provider_identity_changed"}:{status:"ready",credential:n,metadata:i}}catch{return{status:"failed",reason:"credential_unreadable"}}}function Lue(e,t,n){if(!Ks(e)||!Ks(t))return{status:"failed",reason:"credential_missing"};try{let i=JF(na(e,"utf8"),na(t,"utf8"));return i===void 0?{status:"failed",reason:"credential_invalid"}:i.providerIdentity!==n?{status:"failed",reason:"provider_identity_changed"}:{status:"ready",metadata:i}}catch{return{status:"failed",reason:"credential_unreadable"}}}async function Uue(e=process.stdin){return new Promise((t,n)=>{let i="",r=()=>{e.removeListener("data",a),e.removeListener("end",s),e.removeListener("error",d)},o=()=>{let l=i.split(/\r?\n/u,1)[0]?.trim()??"";if(r(),l===""||Buffer.byteLength(l,"utf8")>4096){n(new Error("invalid hosted authorization code input"));return}t(l)},a=l=>{if(i+=l.toString(),Buffer.byteLength(i,"utf8")>4097){r(),n(new Error("invalid hosted authorization code input"));return}i.includes(`
277
- `)&&o()},s=()=>o(),d=()=>{r(),n(new Error("hosted authorization code input failed"))};e.on("data",a),e.once("end",s),e.once("error",d)})}async function KF(e=process.env,t=process.stdin){let n=Hn(e,"LINZUMI_HOSTED_AUTH_CODE_SOCKET"),i=await Uue(t);await new Promise((r,o)=>{let a=Kle(n);a.once("error",()=>o(new Error("hosted authorization code socket unavailable"))),a.once("connect",()=>a.end(`${i}
278
- `)),a.once("close",s=>{s||r()})})}async function Gue(e,t){ta(e,{force:!0});let n=!1,i=!1,r=Ble(o=>{let a="";o.on("data",s=>{if(n||i)return;if(a+=s.toString(),Buffer.byteLength(a,"utf8")>4097){i=!0,o.destroy(),t.kill("SIGTERM");return}if(!a.includes(`
279
- `))return;let d=a.split(/\r?\n/u,1)[0]?.trim()??"";if(d===""||t.stdin===null){i=!0,o.destroy(),t.kill("SIGTERM");return}t.stdin.write(`${d}
280
- `,l=>{if(l!=null){i=!0,t.kill("SIGTERM"),o.destroy();return}n=!0,o.end()})})});return await new Promise((o,a)=>{r.once("error",a),r.listen(e,o)}),Js(e,384),{delivered:()=>n,close:async()=>{await new Promise(o=>r.close(()=>o())),ta(e,{force:!0})}}}async function BF(e=process.env,t={}){let n=Hn(e,"LINZUMI_HOSTED_AUTH_CALLBACK_URL"),i=Hn(e,"LINZUMI_HOSTED_AUTH_CALLBACK_TOKEN"),r=Hn(e,"LINZUMI_HOSTED_AUTH_ROOT"),o=Hn(e,"LINZUMI_HOSTED_AUTH_EXPIRES_AT"),a=Hn(e,"LINZUMI_HOSTED_AUTH_HARNESS"),s=Hn(e,"LINZUMI_HOSTED_AUTH_WORKER_ID");if(a==="claude_code"){let c=Hn(e,"LINZUMI_HOSTED_AUTH_CODE_SOCKET");await zue({env:e,callbackUrl:n,callbackToken:i,authRoot:r,expiresAt:o,workerId:s,codeSocketPath:c,deps:t});return}if(a!=="codex")throw new Error("unsupported hosted authorization harness");let d=Zw(o),l=e.LINZUMI_HOSTED_AUTH_CODEX_BIN?.trim()||"codex";FF(l,t.warn??console.warn);let u=Vw(ni(r,"codex-home-"));Js(u,448);try{let c=Hw(l,["login","--device-auth"],{cwd:u,env:{PATH:e.PATH,HOME:u,CODEX_HOME:u,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]}),p="",f,h=E=>{if(p=`${p}${E.toString()}`.slice(-16384),f!==void 0)return;let P=Due(p);P!==void 0&&(f=Nr(n,i,{event:"state",status:"waiting_for_user",verificationUrl:P.verificationUrl,userCode:P.userCode,workerId:s}))};c.stdout?.on("data",h),c.stderr?.on("data",h);let g=!1,_,y=setTimeout(()=>{g=!0,c.kill("SIGTERM"),_=setTimeout(()=>{c.kill("SIGKILL")},t.sigtermGraceMs??jF),_.unref?.()},d);y.unref?.();let b=await new Promise((E,P)=>{c.once("error",P),c.once("exit",E)}).finally(()=>{clearTimeout(y),_!==void 0&&clearTimeout(_)});await f;let v=ni(u,"auth.json");if(g||b!==0||!Ks(v)){await Nr(n,i,{event:"state",status:"failed"});return}let w=na(v,"utf8"),A=zF(w);if(w.trim()===""||A===void 0){await Nr(n,i,{event:"state",status:"failed"});return}let C=await UF({harness:"codex",authHome:u,executable:l,env:e,deps:t}),S=EF(v,A.providerIdentity);if(S.status==="failed"){(t.warn??console.warn)(`hosted_auth_credential_revalidation_failed harness=codex worker_id=${s} reason=${S.reason}`),await Nr(n,i,{event:"state",status:"failed"});return}let k=await(t.readQuota??DF)({authHome:u,executable:l,env:e},t.warn??console.warn),T=EF(v,A.providerIdentity);if(T.status==="failed"){(t.warn??console.warn)(`hosted_auth_credential_revalidation_failed harness=codex worker_id=${s} reason=${T.reason}`),await Nr(n,i,{event:"state",status:"failed"});return}await Nr(n,i,{event:"completed",providerIdentity:T.metadata.providerIdentity,email:T.metadata.email,...T.metadata.plan===void 0?{}:{plan:T.metadata.plan},modelCatalog:C,...k===void 0?{}:{quotaWindow:k},credential:T.credential})}finally{ta(u,{recursive:!0,force:!0})}}async function zue(e){let t=Zw(e.expiresAt),n=e.env.LINZUMI_HOSTED_AUTH_CLAUDE_BIN?.trim()||"claude",i=Vw(ni(e.authRoot,"claude-home-"));Js(i,448);let r;try{let o=Hw(n,["auth","login","--claudeai"],{cwd:i,env:{PATH:e.env.PATH,HOME:i,CLAUDE_CONFIG_DIR:i,BROWSER:"false",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]});r=await Gue(e.codeSocketPath,o);let a="",s,d=!1,l=v=>{if(a=`${a}${v.toString()}`.slice(-16384),s===void 0){let w=a.match(/https:\/\/[^\s\u0000-\u001f\u007f]+/u)?.[0];w!==void 0&&(s=Nr(e.callbackUrl,e.callbackToken,{event:"state",status:"waiting_for_user",verificationUrl:w,workerId:e.workerId}))}/Invalid code\./u.test(a)&&(d=!0)};o.stdout?.on("data",l),o.stderr?.on("data",l);let u=!1,c,p=setTimeout(()=>{u=!0,o.kill("SIGTERM"),c=setTimeout(()=>o.kill("SIGKILL"),e.deps.sigtermGraceMs??jF),c.unref?.()},t);p.unref?.();let f=await new Promise((v,w)=>{o.once("error",w),o.once("exit",v)}).finally(()=>{clearTimeout(p),c!==void 0&&clearTimeout(c)});await s;let h=ni(i,".credentials.json"),g=ni(i,".claude.json");if(u||d||f!==0||!r.delivered()||!Ks(h)||!Ks(g)){await Nr(e.callbackUrl,e.callbackToken,{event:"state",status:"failed"});return}let _=JF(na(h,"utf8"),na(g,"utf8"));if(_===void 0){await Nr(e.callbackUrl,e.callbackToken,{event:"state",status:"failed"});return}let y=await UF({harness:"claude_code",authHome:i,executable:n,env:e.env,deps:e.deps}),b=Lue(h,g,_.providerIdentity);if(b.status==="failed"){(e.deps.warn??console.warn)(`hosted_auth_credential_revalidation_failed harness=claude_code worker_id=${e.workerId} reason=${b.reason}`),await Nr(e.callbackUrl,e.callbackToken,{event:"state",status:"failed"});return}await Nr(e.callbackUrl,e.callbackToken,{event:"completed",providerIdentity:b.metadata.providerIdentity,email:b.metadata.email,...b.metadata.plan===void 0?{}:{plan:b.metadata.plan},modelCatalog:y,credential:b.metadata.credential})}finally{r!==void 0&&await r.close(),ta(i,{recursive:!0,force:!0})}}var Qle,Yle,Xle,TF,eue,CF,Km,Bw,Ww,Kw,Bm,cue,fue,AF,gue,yue,bue,wue,kue,xue,Tue,Oue,$F,Nue,jF,Fue,WF=q(()=>{"use strict";hh();Wu();Xk();ix();fg();fg();gc();rT();cT();vc();_T();Py();hF();ui();ht();uc();ht();xy();yF();xF();Qle=3e4,Yle=200,Xle=18e4,TF="LINZUMI_GUEST_MODEL_CALL_LIVENESS_MS",eue=15*6e4,CF="LINZUMI_GUEST_ACTIVE_LOOP_BUDGET_MS",Km=2147483647;Bw=class extends Error{code="active_loop_budget_exceeded";budgetMs;constructor(t){super(`active_loop_budget_exceeded: guest turn exceeded the ${t}ms wall-clock budget; killed the guest turn`),this.name="GuestActiveLoopBudgetExceeded",this.budgetMs=t}};Ww=class extends Error{code="guest_turn_liveness_failure";windowMs;constructor(t){super(`guest_turn_liveness_failure: zero upstream model calls for ${t}ms; killed the guest turn`),this.name="GuestTurnLivenessFailure",this.windowMs=t}};Kw=64*1024;cue=64,fue=20,AF="My engine session for this thread was lost, so I rebuilt it from this thread's saved history at reduced fidelity. Tell me if I lost something important.";gue=new Set(["turn/completed","turn/failed","turn/aborted"]),yue=2e3;bue=15e3;wue=900,kue=1e4,xue=3,Tue=8e3;Oue=360*60*1e3;$F="guestTurnFailureEvidence";Nue=600*1e3,jF=2e3,Fue=15e3});WF();function HF(e){let t=!1,n=()=>{t||(t=!0,process.exit(e))};try{process.stdout.write("",n)}catch{n()}setTimeout(n,1e3).unref?.()}var Jue=process.argv[2]==="--hosted-coding-account-model-catalog"?GF().then(()=>0):process.argv[2]==="--hosted-coding-account-auth"?BF().then(()=>0):process.argv[2]==="--hosted-coding-account-auth-submit"?KF().then(()=>0):MF(process.argv);Jue.then(e=>{HF(e)}).catch(e=>{process.stdout.write(`${JSON.stringify({phase:"exit",ok:!1,reason:e instanceof Error?e.message:String(e),turnMs:0})}
281
- `),HF(1)});