@anthropic-ai/claude-agent-sdk 0.3.195 → 0.3.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bridge.mjs +64 -64
- package/browser-sdk.js +3 -3
- package/manifest.json +19 -19
- package/manifest.zst.json +23 -23
- package/package.json +10 -10
- package/sdk-tools.d.ts +82 -0
- package/sdk.d.ts +22 -7
- package/sdk.mjs +48 -47
package/browser-sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
|
|
2
2
|
|
|
3
|
-
// Version: 0.3.
|
|
3
|
+
// Version: 0.3.197
|
|
4
4
|
var Z8=Object.create;var{getPrototypeOf:K8,defineProperty:fa,getOwnPropertyNames:S_,getOwnPropertyDescriptor:V8}=Object,x_=Object.prototype.hasOwnProperty;function k_(e){return this[e]}var W8,G8,M_=(e,t,r)=>{var i=e!=null&&typeof e==="object";if(i){var n=t?W8??=new WeakMap:G8??=new WeakMap,o=n.get(e);if(o)return o}r=e!=null?Z8(K8(e)):{};let s=t||!e||!e.__esModule?fa(r,"default",{value:e,enumerable:!0}):r;for(let h of S_(e))if(!x_.call(s,h))fa(s,h,{get:k_.bind(e,h),enumerable:!0});if(i)n.set(e,s);return s},xt=(e)=>{var t=(w_??=new WeakMap).get(e),r;if(t)return t;if(t=fa({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var i of S_(e))if(!x_.call(t,i))fa(t,i,{get:k_.bind(e,i),enumerable:!(r=V8(e,i))||r.enumerable})}return w_.set(e,t),t},w_,Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J8=(e)=>e;function X8(e,t){this[e]=J8.bind(null,t)}var vn=(e,t)=>{for(var r in t)fa(e,r,{get:t[r],enumerable:!0,configurable:!0,set:X8.bind(t,r)})};var ha=(e,t)=>()=>(e&&(t=e(e=0)),t);var $i=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Y8=Symbol.dispose||Symbol.for("Symbol.dispose"),Q8=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Bt=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(r)i=t[Q8];if(i===void 0)i=t[Y8];if(typeof i!=="function")throw TypeError("Object not disposable");e.push([r,i,t])}else if(r)e.push([r]);return t},Ht=(e,t,r)=>{var i=typeof SuppressedError==="function"?SuppressedError:function(s,h,b,v){return v=Error(b),v.name="SuppressedError",v.error=s,v.suppressed=h,v},n=(s)=>t=r?new i(s,t,"An error was suppressed during disposal"):(r=!0,s),o=(s)=>{while(s=e.pop())try{var h=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(h).then(o,(b)=>(n(b),o()))}catch(b){n(b)}if(r)throw t};return o()};var Er={};vn(Er,{transcode:()=>G$,resolveObjectURL:()=>K$,kStringMaxLength:()=>h1,kMaxLength:()=>ga,isUtf8:()=>V$,isAscii:()=>W$,default:()=>J$,constants:()=>_$,btoa:()=>g$,atob:()=>y$,INSPECT_MAX_BYTES:()=>f1,File:()=>v$,Buffer:()=>fe,Blob:()=>b$});function d$(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");if(r===-1)r=t;var i=r===t?0:4-r%4;return[r,i]}function f$(e,t){return(e+t)*3/4-t}function h$(e){var t,r=d$(e),i=r[0],n=r[1],o=new Uint8Array(f$(i,n)),s=0,h=n>0?i-4:i,b;for(b=0;b<h;b+=4)t=_n[e.charCodeAt(b)]<<18|_n[e.charCodeAt(b+1)]<<12|_n[e.charCodeAt(b+2)]<<6|_n[e.charCodeAt(b+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;if(n===2)t=_n[e.charCodeAt(b)]<<2|_n[e.charCodeAt(b+1)]>>4,o[s++]=t&255;if(n===1)t=_n[e.charCodeAt(b)]<<10|_n[e.charCodeAt(b+1)]<<4|_n[e.charCodeAt(b+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255;return o}function p$(e){return Vn[e>>18&63]+Vn[e>>12&63]+Vn[e>>6&63]+Vn[e&63]}function m$(e,t,r){var i,n=[];for(var o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(p$(i));return n.join("")}function s1(e){var t,r=e.length,i=r%3,n=[],o=16383;for(var s=0,h=r-i;s<h;s+=o)n.push(m$(e,s,s+o>h?h:s+o));if(i===1)t=e[r-1],n.push(Vn[t>>2]+Vn[t<<4&63]+"==");else if(i===2)t=(e[r-2]<<8)+e[r-1],n.push(Vn[t>>10]+Vn[t>>4&63]+Vn[t<<2&63]+"=");return n.join("")}function Mc(e,t,r,i,n){var o,s,h=n*8-i-1,b=(1<<h)-1,v=b>>1,_=-7,g=r?n-1:0,S=r?-1:1,x=e[t+g];g+=S,o=x&(1<<-_)-1,x>>=-_,_+=h;for(;_>0;o=o*256+e[t+g],g+=S,_-=8);s=o&(1<<-_)-1,o>>=-_,_+=i;for(;_>0;s=s*256+e[t+g],g+=S,_-=8);if(o===0)o=1-v;else if(o===b)return s?NaN:(x?-1:1)*(1/0);else s=s+Math.pow(2,i),o=o-v;return(x?-1:1)*s*Math.pow(2,o-i)}function d1(e,t,r,i,n,o){var s,h,b,v=o*8-n-1,_=(1<<v)-1,g=_>>1,S=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,M=i?1:-1,$=t<0||t===0&&1/t<0?1:0;if(t=Math.abs(t),isNaN(t)||t===1/0)h=isNaN(t)?1:0,s=_;else{if(s=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-s))<1)s--,b*=2;if(s+g>=1)t+=S/b;else t+=S*Math.pow(2,1-g);if(t*b>=2)s++,b/=2;if(s+g>=_)h=0,s=_;else if(s+g>=1)h=(t*b-1)*Math.pow(2,n),s=s+g;else h=t*Math.pow(2,g-1)*Math.pow(2,n),s=0}for(;n>=8;e[r+x]=h&255,x+=M,h/=256,n-=8);s=s<<n|h,v+=n;for(;v>0;e[r+x]=s&255,x+=M,s/=256,v-=8);e[r+x-M]|=$*128}function ni(e){if(e>ga)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,fe.prototype),t}function om(e,t,r){return class extends r{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function fe(e,t,r){if(typeof e==="number"){if(typeof t==="string")throw TypeError('The "string" argument must be of type string. Received type number');return sm(e)}return p1(e,t,r)}function p1(e,t,r){if(typeof e==="string")return k$(e,t);if(ArrayBuffer.isView(e))return M$(e);if(e==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Wn(e,ArrayBuffer)||e&&Wn(e.buffer,ArrayBuffer))return nm(e,t,r);if(typeof SharedArrayBuffer<"u"&&(Wn(e,SharedArrayBuffer)||e&&Wn(e.buffer,SharedArrayBuffer)))return nm(e,t,r);if(typeof e==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return fe.from(i,t,r);let n=E$(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==="function")return fe.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function m1(e){if(typeof e!=="number")throw TypeError('"size" argument must be of type number');else if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function x$(e,t,r){if(m1(e),e<=0)return ni(e);if(t!==void 0)return typeof r==="string"?ni(e).fill(t,r):ni(e).fill(t);return ni(e)}function sm(e){return m1(e),ni(e<0?0:am(e)|0)}function k$(e,t){if(typeof t!=="string"||t==="")t="utf8";if(!fe.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=g1(e,t)|0,i=ni(r),n=i.write(e,t);if(n!==r)i=i.slice(0,n);return i}function rm(e){let t=e.length<0?0:am(e.length)|0,r=ni(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function M$(e){if(Wn(e,Uint8Array)){let t=new Uint8Array(e);return nm(t.buffer,t.byteOffset,t.byteLength)}return rm(e)}function nm(e,t,r){if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');let i;if(t===void 0&&r===void 0)i=new Uint8Array(e);else if(r===void 0)i=new Uint8Array(e,t);else i=new Uint8Array(e,t,r);return Object.setPrototypeOf(i,fe.prototype),i}function E$(e){if(fe.isBuffer(e)){let t=am(e.length)|0,r=ni(t);if(r.length===0)return r;return e.copy(r,0,0,t),r}if(e.length!==void 0){if(typeof e.length!=="number"||Number.isNaN(e.length))return ni(0);return rm(e)}if(e.type==="Buffer"&&Array.isArray(e.data))return rm(e.data)}function am(e){if(e>=ga)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ga.toString(16)+" bytes");return e|0}function g1(e,t){if(fe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Wn(e,ArrayBuffer))return e.byteLength;if(typeof e!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return im(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return M1(e).length;default:if(n)return i?-1:im(e).length;t=(""+t).toLowerCase(),n=!0}}function $$(e,t,r){let i=!1;if(t===void 0||t<0)t=0;if(t>this.length)return"";if(r===void 0||r>this.length)r=this.length;if(r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";if(!e)e="utf8";while(!0)switch(e){case"hex":return z$(this,t,r);case"utf8":case"utf-8":return v1(this,t,r);case"ascii":return D$(this,t,r);case"latin1":case"binary":return N$(this,t,r);case"base64":return C$(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j$(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function lo(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function y1(e,t,r,i,n){if(e.length===0)return-1;if(typeof r==="string")i=r,r=0;else if(r>2147483647)r=2147483647;else if(r<-2147483648)r=-2147483648;if(r=+r,Number.isNaN(r))r=n?0:e.length-1;if(r<0)r=e.length+r;if(r>=e.length)if(n)return-1;else r=e.length-1;else if(r<0)if(n)r=0;else return-1;if(typeof t==="string")t=fe.from(t,i);if(fe.isBuffer(t)){if(t.length===0)return-1;return u1(e,t,r,i,n)}else if(typeof t==="number"){if(t=t&255,typeof Uint8Array.prototype.indexOf==="function")if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return u1(e,[t],r,i,n)}throw TypeError("val must be string, number or Buffer")}function u1(e,t,r,i,n){let o=1,s=e.length,h=t.length;if(i!==void 0){if(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le"){if(e.length<2||t.length<2)return-1;o=2,s/=2,h/=2,r/=2}}function b(_,g){if(o===1)return _[g];else return _.readUInt16BE(g*o)}let v;if(n){let _=-1;for(v=r;v<s;v++)if(b(e,v)===b(t,_===-1?0:v-_)){if(_===-1)_=v;if(v-_+1===h)return _*o}else{if(_!==-1)v-=v-_;_=-1}}else{if(r+h>s)r=s-h;for(v=r;v>=0;v--){let _=!0;for(let g=0;g<h;g++)if(b(e,v+g)!==b(t,g)){_=!1;break}if(_)return v}}return-1}function I$(e,t,r,i){r=Number(r)||0;let n=e.length-r;if(!i)i=n;else if(i=Number(i),i>n)i=n;let o=t.length;if(i>o/2)i=o/2;let s;for(s=0;s<i;++s){let h=parseInt(t.substr(s*2,2),16);if(Number.isNaN(h))return s;e[r+s]=h}return s}function P$(e,t,r,i){return Ec(im(t,e.length-r),e,r,i)}function T$(e,t,r,i){return Ec(F$(t),e,r,i)}function A$(e,t,r,i){return Ec(M1(t),e,r,i)}function R$(e,t,r,i){return Ec(B$(t,e.length-r),e,r,i)}function C$(e,t,r){if(t===0&&r===e.length)return s1(e);else return s1(e.slice(t,r))}function v1(e,t,r){r=Math.min(e.length,r);let i=[],n=t;while(n<r){let o=e[n],s=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=r){let b,v,_,g;switch(h){case 1:if(o<128)s=o;break;case 2:if(b=e[n+1],(b&192)===128){if(g=(o&31)<<6|b&63,g>127)s=g}break;case 3:if(b=e[n+1],v=e[n+2],(b&192)===128&&(v&192)===128){if(g=(o&15)<<12|(b&63)<<6|v&63,g>2047&&(g<55296||g>57343))s=g}break;case 4:if(b=e[n+1],v=e[n+2],_=e[n+3],(b&192)===128&&(v&192)===128&&(_&192)===128){if(g=(o&15)<<18|(b&63)<<12|(v&63)<<6|_&63,g>65535&&g<1114112)s=g}}}if(s===null)s=65533,h=1;else if(s>65535)s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023;i.push(s),n+=h}return O$(i)}function O$(e){let t=e.length;if(t<=l1)return String.fromCharCode.apply(String,e);let r="",i=0;while(i<t)r+=String.fromCharCode.apply(String,e.slice(i,i+=l1));return r}function D$(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function N$(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function z$(e,t,r){let i=e.length;if(!t||t<0)t=0;if(!r||r<0||r>i)r=i;let n="";for(let o=t;o<r;++o)n+=H$[e[o]];return n}function j$(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function Mr(e,t,r){if(e%1!==0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function Jr(e,t,r,i,n,o){if(!fe.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function b1(e,t,r,i,n){k1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function _1(e,t,r,i,n){k1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}function w1(e,t,r,i,n,o){if(r+i>e.length)throw RangeError("Index out of range");if(r<0)throw RangeError("Index out of range")}function S1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)w1(e,t,r,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return d1(e,t,r,i,23,4),r+4}function x1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)w1(e,t,r,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return d1(e,t,r,i,52,8),r+8}function c1(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function U$(e,t,r){if(ts(t,"offset"),e[t]===void 0||e[t+r]===void 0)ya(t,e.length-(r+1))}function k1(e,t,r,i,n,o){if(e>r||e<t){let s=typeof t==="bigint"?"n":"",h;if(o>3)if(t===0||t===BigInt(0))h=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`;else h=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`;else h=`>= ${t}${s} and <= ${r}${s}`;throw new tm("value",h,e)}U$(i,n,o)}function ts(e,t){if(typeof e!=="number")throw new S$(t,"number",e)}function ya(e,t,r){if(Math.floor(e)!==e)throw ts(e,r),new tm(r||"offset","an integer",e);if(t<0)throw new w$;throw new tm(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}function q$(e){if(e=e.split("=")[0],e=e.trim().replace(L$,""),e.length<2)return"";while(e.length%4!==0)e=e+"=";return e}function im(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(s+1===i){if((t-=3)>-1)o.push(239,191,189);continue}n=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);n=r;continue}r=(n-55296<<10|r-56320)+65536}else if(n){if((t-=3)>-1)o.push(239,191,189)}if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return o}function F$(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function B$(e,t){let r,i,n,o=[];for(let s=0;s<e.length;++s){if((t-=2)<0)break;r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i)}return o}function M1(e){return h$(q$(e))}function Ec(e,t,r,i){let n;for(n=0;n<i;++n){if(n+r>=t.length||n>=e.length)break;t[n+r]=e[n]}return n}function Wn(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ti(e){return typeof BigInt>"u"?Z$:e}function Z$(){throw Error("BigInt not supported")}function um(e){return()=>{throw Error(e+" is not implemented for node:buffer browser polyfill")}}var Vn,_n,em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uo,o1,a1,f1=50,ga=2147483647,h1=536870888,g$,y$,v$,b$,_$,w$,S$,tm,l1=4096,L$,H$,K$,V$,W$=(e)=>{for(let t of e)if(t.charCodeAt(0)>127)return!1;return!0},G$,J$;var $r=ha(()=>{Vn=[],_n=[];for(uo=0,o1=em.length;uo<o1;++uo)Vn[uo]=em[uo],_n[em.charCodeAt(uo)]=uo;_n[45]=62;_n[95]=63;a1=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,g$=globalThis.btoa,y$=globalThis.atob,v$=globalThis.File,b$=globalThis.Blob,_$={MAX_LENGTH:ga,MAX_STRING_LENGTH:h1};w$=om("ERR_BUFFER_OUT_OF_BOUNDS",function(e){if(e)return`${e} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S$=om("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),tm=om("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;if(Number.isInteger(r)&&Math.abs(r)>4294967296)n=c1(String(r));else if(typeof r==="bigint"){if(n=String(r),r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))n=c1(n);n+="n"}return i+=` It must be ${t}. Received ${n}`,i},RangeError);Object.defineProperty(fe.prototype,"parent",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.buffer}});Object.defineProperty(fe.prototype,"offset",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.byteOffset}});fe.poolSize=8192;fe.from=function(e,t,r){return p1(e,t,r)};Object.setPrototypeOf(fe.prototype,Uint8Array.prototype);Object.setPrototypeOf(fe,Uint8Array);fe.alloc=function(e,t,r){return x$(e,t,r)};fe.allocUnsafe=function(e){return sm(e)};fe.allocUnsafeSlow=function(e){return sm(e)};fe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==fe.prototype};fe.compare=function(e,t){if(Wn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(Wn(t,Uint8Array))t=fe.from(t,t.offset,t.byteLength);if(!fe.isBuffer(e)||!fe.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}if(r<i)return-1;if(i<r)return 1;return 0};fe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};fe.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return fe.alloc(0);let r;if(t===void 0){t=0;for(r=0;r<e.length;++r)t+=e[r].length}let i=fe.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){let o=e[r];if(Wn(o,Uint8Array))if(n+o.length>i.length){if(!fe.isBuffer(o))o=fe.from(o);o.copy(i,n)}else Uint8Array.prototype.set.call(i,o,n);else if(!fe.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');else o.copy(i,n);n+=o.length}return i};fe.byteLength=g1;fe.prototype._isBuffer=!0;fe.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)lo(this,t,t+1);return this};fe.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)lo(this,t,t+3),lo(this,t+1,t+2);return this};fe.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)lo(this,t,t+7),lo(this,t+1,t+6),lo(this,t+2,t+5),lo(this,t+3,t+4);return this};fe.prototype.toString=function(){let e=this.length;if(e===0)return"";if(arguments.length===0)return v1(this,0,e);return $$.apply(this,arguments)};fe.prototype.toLocaleString=fe.prototype.toString;fe.prototype.equals=function(e){if(!fe.isBuffer(e))throw TypeError("Argument must be a Buffer");if(this===e)return!0;return fe.compare(this,e)===0};fe.prototype.inspect=function(){let e="",t=f1;if(e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t)e+=" ... ";return"<Buffer "+e+">"};if(a1)fe.prototype[a1]=fe.prototype.inspect;fe.prototype.compare=function(e,t,r,i,n){if(Wn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(!fe.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0)t=0;if(r===void 0)r=e?e.length:0;if(i===void 0)i=0;if(n===void 0)n=this.length;if(t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;let o=n-i,s=r-t,h=Math.min(o,s),b=this.slice(i,n),v=e.slice(t,r);for(let _=0;_<h;++_)if(b[_]!==v[_]){o=b[_],s=v[_];break}if(o<s)return-1;if(s<o)return 1;return 0};fe.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};fe.prototype.indexOf=function(e,t,r){return y1(this,e,t,r,!0)};fe.prototype.lastIndexOf=function(e,t,r){return y1(this,e,t,r,!1)};fe.prototype.write=function(e,t,r,i){if(t===void 0)i="utf8",r=this.length,t=0;else if(r===void 0&&typeof t==="string")i=t,r=this.length,t=0;else if(isFinite(t))if(t=t>>>0,isFinite(r)){if(r=r>>>0,i===void 0)i="utf8"}else i=r,r=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let n=this.length-t;if(r===void 0||r>n)r=n;if(e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!i)i="utf8";let o=!1;for(;;)switch(i){case"hex":return I$(this,e,t,r);case"utf8":case"utf-8":return P$(this,e,t,r);case"ascii":case"latin1":case"binary":return T$(this,e,t,r);case"base64":return A$(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R$(this,e,t,r);default:if(o)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};fe.prototype.slice=function(e,t){let r=this.length;if(e=~~e,t=t===void 0?r:~~t,e<0){if(e+=r,e<0)e=0}else if(e>r)e=r;if(t<0){if(t+=r,t<0)t=0}else if(t>r)t=r;if(t<e)t=e;let i=this.subarray(e,t);return Object.setPrototypeOf(i,fe.prototype),i};fe.prototype.readUintLE=fe.prototype.readUIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Mr(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;return i};fe.prototype.readUintBE=fe.prototype.readUIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Mr(e,t,this.length);let i=this[e+--t],n=1;while(t>0&&(n*=256))i+=this[e+--t]*n;return i};fe.prototype.readUint8=fe.prototype.readUInt8=function(e,t){if(e=e>>>0,!t)Mr(e,1,this.length);return this[e]};fe.prototype.readUint16LE=fe.prototype.readUInt16LE=function(e,t){if(e=e>>>0,!t)Mr(e,2,this.length);return this[e]|this[e+1]<<8};fe.prototype.readUint16BE=fe.prototype.readUInt16BE=function(e,t){if(e=e>>>0,!t)Mr(e,2,this.length);return this[e]<<8|this[e+1]};fe.prototype.readUint32LE=fe.prototype.readUInt32LE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};fe.prototype.readUint32BE=fe.prototype.readUInt32BE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};fe.prototype.readBigUInt64LE=Ti(function(e){e=e>>>0,ts(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)ya(e,this.length-8);let i=t+this[++e]*256+this[++e]*65536+this[++e]*16777216,n=this[++e]+this[++e]*256+this[++e]*65536+r*16777216;return BigInt(i)+(BigInt(n)<<BigInt(32))});fe.prototype.readBigUInt64BE=Ti(function(e){e=e>>>0,ts(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)ya(e,this.length-8);let i=t*16777216+this[++e]*65536+this[++e]*256+this[++e],n=this[++e]*16777216+this[++e]*65536+this[++e]*256+r;return(BigInt(i)<<BigInt(32))+BigInt(n)});fe.prototype.readIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Mr(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;if(n*=128,i>=n)i-=Math.pow(2,8*t);return i};fe.prototype.readIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Mr(e,t,this.length);let i=t,n=1,o=this[e+--i];while(i>0&&(n*=256))o+=this[e+--i]*n;if(n*=128,o>=n)o-=Math.pow(2,8*t);return o};fe.prototype.readInt8=function(e,t){if(e=e>>>0,!t)Mr(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};fe.prototype.readInt16LE=function(e,t){if(e=e>>>0,!t)Mr(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt16BE=function(e,t){if(e=e>>>0,!t)Mr(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt32LE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};fe.prototype.readInt32BE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};fe.prototype.readBigInt64LE=Ti(function(e){e=e>>>0,ts(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)ya(e,this.length-8);let i=this[e+4]+this[e+5]*256+this[e+6]*65536+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*65536+this[++e]*16777216)});fe.prototype.readBigInt64BE=Ti(function(e){e=e>>>0,ts(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)ya(e,this.length-8);let i=(t<<24)+this[++e]*65536+this[++e]*256+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*16777216+this[++e]*65536+this[++e]*256+r)});fe.prototype.readFloatLE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return Mc(this,e,!0,23,4)};fe.prototype.readFloatBE=function(e,t){if(e=e>>>0,!t)Mr(e,4,this.length);return Mc(this,e,!1,23,4)};fe.prototype.readDoubleLE=function(e,t){if(e=e>>>0,!t)Mr(e,8,this.length);return Mc(this,e,!0,52,8)};fe.prototype.readDoubleBE=function(e,t){if(e=e>>>0,!t)Mr(e,8,this.length);return Mc(this,e,!1,52,8)};fe.prototype.writeUintLE=fe.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Jr(this,e,t,r,s,0)}let n=1,o=0;this[t]=e&255;while(++o<r&&(n*=256))this[t+o]=e/n&255;return t+r};fe.prototype.writeUintBE=fe.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Jr(this,e,t,r,s,0)}let n=r-1,o=1;this[t+n]=e&255;while(--n>=0&&(o*=256))this[t+n]=e/o&255;return t+r};fe.prototype.writeUint8=fe.prototype.writeUInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,1,255,0);return this[t]=e&255,t+1};fe.prototype.writeUint16LE=fe.prototype.writeUInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,2,65535,0);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeUint16BE=fe.prototype.writeUInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,2,65535,0);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeUint32LE=fe.prototype.writeUInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,4,4294967295,0);return this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};fe.prototype.writeUint32BE=fe.prototype.writeUInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,4,4294967295,0);return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigUInt64LE=Ti(function(e,t=0){return b1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeBigUInt64BE=Ti(function(e,t=0){return _1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Jr(this,e,t,r,h-1,-h)}let n=0,o=1,s=0;this[t]=e&255;while(++n<r&&(o*=256)){if(e<0&&s===0&&this[t+n-1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Jr(this,e,t,r,h-1,-h)}let n=r-1,o=1,s=0;this[t+n]=e&255;while(--n>=0&&(o*=256)){if(e<0&&s===0&&this[t+n+1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,1,127,-128);if(e<0)e=255+e+1;return this[t]=e&255,t+1};fe.prototype.writeInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,2,32767,-32768);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,2,32767,-32768);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,4,2147483647,-2147483648);return this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};fe.prototype.writeInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Jr(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigInt64LE=Ti(function(e,t=0){return b1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeBigInt64BE=Ti(function(e,t=0){return _1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeFloatLE=function(e,t,r){return S1(this,e,t,!0,r)};fe.prototype.writeFloatBE=function(e,t,r){return S1(this,e,t,!1,r)};fe.prototype.writeDoubleLE=function(e,t,r){return x1(this,e,t,!0,r)};fe.prototype.writeDoubleBE=function(e,t,r){return x1(this,e,t,!1,r)};fe.prototype.copy=function(e,t,r,i){if(!fe.isBuffer(e))throw TypeError("argument should be a Buffer");if(!r)r=0;if(!i&&i!==0)i=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(i>0&&i<r)i=r;if(i===r)return 0;if(e.length===0||this.length===0)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(e.length-t<i-r)i=e.length-t+r;let n=i-r;if(this===e&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(t,r,i);else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return n};fe.prototype.fill=function(e,t,r,i){if(typeof e==="string"){if(typeof t==="string")i=t,t=0,r=this.length;else if(typeof r==="string")i=r,r=this.length;if(i!==void 0&&typeof i!=="string")throw TypeError("encoding must be a string");if(typeof i==="string"&&!fe.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);if(i==="utf8"&&o<128||i==="latin1")e=o}}else if(typeof e==="number")e=e&255;else if(typeof e==="boolean")e=Number(e);if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t=t>>>0,r=r===void 0?this.length:r>>>0,!e)e=0;let n;if(typeof e==="number")for(n=t;n<r;++n)this[n]=e;else{let o=fe.isBuffer(e)?e:fe.from(e,i),s=o.length;if(s===0)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%s]}return this};L$=/[^+/0-9A-Za-z-_]/g;H$=function(){let e=Array(256);for(let t=0;t<16;++t){let r=t*16;for(let i=0;i<16;++i)e[r+i]="0123456789abcdef"[t]+"0123456789abcdef"[i]}return e}();K$=um("resolveObjectURL"),V$=um("isUtf8"),G$=um("transcode"),J$=fe});var D1={};vn(D1,{types:()=>sI,promisify:()=>A1,log:()=>I1,isUndefined:()=>rs,isSymbol:()=>uI,isString:()=>Rc,isRegExp:()=>$c,isPrimitive:()=>lI,isObject:()=>ns,isNumber:()=>$1,isNullOrUndefined:()=>aI,isNull:()=>Ac,isFunction:()=>Pc,isError:()=>Ic,isDate:()=>fm,isBuffer:()=>cI,isBoolean:()=>pm,isArray:()=>E1,inspect:()=>co,inherits:()=>P1,format:()=>hm,deprecate:()=>Y$,default:()=>hI,debuglog:()=>Q$,callbackifyOnRejected:()=>ym,callbackify:()=>R1,_extend:()=>gm,TextEncoder:()=>C1,TextDecoder:()=>O1});function hm(e,...t){if(!Rc(e)){var r=[e];for(var i=0;i<t.length;i++)r.push(co(t[i]));return r.join(" ")}var i=0,n=t.length,o=String(e).replace(X$,function(h){if(h==="%%")return"%";if(i>=n)return h;switch(h){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(b){return"[Circular]"}default:return h}});for(var s=t[i];i<n;s=t[++i])if(Ac(s)||!ns(s))o+=" "+s;else o+=" "+co(s);return o}function Y$(e,t){if(typeof process>"u"||process?.noDeprecation===!0)return e;var r=!1;function i(...n){if(!r){if(process.throwDeprecation)throw Error(t);else if(process.traceDeprecation)console.trace(t);else console.error(t);r=!0}return e.apply(this,...n)}return i}function eI(e,t){var r=co.styles[t];if(r)return"\x1B["+co.colors[r][0]+"m"+e+"\x1B["+co.colors[r][1]+"m";else return e}function tI(e,t){return e}function rI(e){var t={};return e.forEach(function(r,i){t[r]=!0}),t}function Tc(e,t,r){if(e.customInspect&&t&&Pc(t.inspect)&&t.inspect!==co&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);if(!Rc(i))i=Tc(e,i,r);return i}var n=nI(e,t);if(n)return n;var o=Object.keys(t),s=rI(o);if(e.showHidden)o=Object.getOwnPropertyNames(t);if(Ic(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return lm(t);if(o.length===0){if(Pc(t)){var h=t.name?": "+t.name:"";return e.stylize("[Function"+h+"]","special")}if($c(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(fm(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ic(t))return lm(t)}var b="",v=!1,_=["{","}"];if(E1(t))v=!0,_=["[","]"];if(Pc(t)){var g=t.name?": "+t.name:"";b=" [Function"+g+"]"}if($c(t))b=" "+RegExp.prototype.toString.call(t);if(fm(t))b=" "+Date.prototype.toUTCString.call(t);if(Ic(t))b=" "+lm(t);if(o.length===0&&(!v||t.length==0))return _[0]+b+_[1];if(r<0)if($c(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");else return e.stylize("[Object]","special");e.seen.push(t);var S;if(v)S=iI(e,t,r,s,o);else S=o.map(function(x){return dm(e,t,r,s,x,v)});return e.seen.pop(),oI(S,b,_)}function nI(e,t){if(rs(t))return e.stylize("undefined","undefined");if(Rc(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if($1(t))return e.stylize(""+t,"number");if(pm(t))return e.stylize(""+t,"boolean");if(Ac(t))return e.stylize("null","null")}function lm(e){return"["+Error.prototype.toString.call(e)+"]"}function iI(e,t,r,i,n){var o=[];for(var s=0,h=t.length;s<h;++s)if(T1(t,String(s)))o.push(dm(e,t,r,i,String(s),!0));else o.push("");return n.forEach(function(b){if(!b.match(/^\d+$/))o.push(dm(e,t,r,i,b,!0))}),o}function dm(e,t,r,i,n,o){var s,h,b;if(b=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]},b.get)if(b.set)h=e.stylize("[Getter/Setter]","special");else h=e.stylize("[Getter]","special");else if(b.set)h=e.stylize("[Setter]","special");if(!T1(i,n))s="["+n+"]";if(!h)if(e.seen.indexOf(b.value)<0){if(Ac(r))h=Tc(e,b.value,null);else h=Tc(e,b.value,r-1);if(h.indexOf(`
|
|
5
5
|
`)>-1)if(o)h=h.split(`
|
|
6
6
|
`).map(function(v){return" "+v}).join(`
|
|
@@ -23,7 +23,7 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
|
|
|
23
23
|
|| ${s} === "boolean" || ${n} === null`).assign(h,ht._`[${n}]`)}}}function iz({gen:e,parentData:t,parentDataProperty:r},i){e.if(ht._`${t} !== undefined`,()=>e.assign(ht._`${t}[${r}]`,i))}function kb(e,t,r,i=ra.Correct){let n=i===ra.Correct?ht.operators.EQ:ht.operators.NEQ,o;switch(e){case"null":return ht._`${t} ${n} null`;case"array":o=ht._`Array.isArray(${t})`;break;case"object":o=ht._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(ht._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return ht._`typeof ${t} ${n} ${e}`}return i===ra.Correct?o:(0,ht.not)(o);function s(h=ht.nil){return(0,ht.and)(ht._`typeof ${t} == "number"`,h,r?ht._`isFinite(${t})`:ht.nil)}}Gk.checkDataType=kb;function Mb(e,t,r,i){if(e.length===1)return kb(e[0],t,r,i);let n,o=(0,Kk.toHash)(e);if(o.array&&o.object){let s=ht._`typeof ${t} != "object"`;n=o.null?s:ht._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=ht.nil;if(o.number)delete o.integer;for(let s in o)n=(0,ht.and)(n,kb(s,t,r,i));return n}Gk.checkDataTypes=Mb;var oz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?ht._`{type: ${e}}`:ht._`{type: ${t}}`};function Eb(e){let t=sz(e);(0,QN.reportError)(t,oz)}Gk.reportTypeError=Eb;function sz(e){let{gen:t,data:r,schema:i}=e,n=(0,Kk.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var eM=Je((Yk)=>{Object.defineProperty(Yk,"__esModule",{value:!0});Yk.assignDefaults=void 0;var na=mt(),hz=kt();function pz(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)Xk(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>Xk(e,o,n.default))}Yk.assignDefaults=pz;function Xk(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let h=na._`${o}${(0,na.getProperty)(t)}`;if(n){(0,hz.checkStrictMode)(e,`default is ignored for: ${h}`);return}let b=na._`${h} === undefined`;if(s.useDefaults==="empty")b=na._`${b} || ${h} === null || ${h} === ""`;i.if(b,na._`${h} = ${(0,na.stringify)(r)}`)}});var An=Je((nM)=>{Object.defineProperty(nM,"__esModule",{value:!0});nM.validateUnion=nM.validateArray=nM.usePattern=nM.callValidateCode=nM.schemaProperties=nM.allSchemaProperties=nM.noPropertyInData=nM.propertyInData=nM.isOwnProperty=nM.hasPropFunc=nM.reportMissingProp=nM.checkMissingProp=nM.checkReportMissingProp=void 0;var Ft=mt(),$b=kt(),no=ki(),mz=kt();function gz(e,t){let{gen:r,data:i,it:n}=e;r.if(Pb(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Ft._`${t}`},!0),e.error()})}nM.checkReportMissingProp=gz;function yz({gen:e,data:t,it:{opts:r}},i,n){return(0,Ft.or)(...i.map((o)=>(0,Ft.and)(Pb(e,t,o,r.ownProperties),Ft._`${n} = ${o}`)))}nM.checkMissingProp=yz;function vz(e,t){e.setParams({missingProperty:t},!0),e.error()}nM.reportMissingProp=vz;function tM(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Ft._`Object.prototype.hasOwnProperty`})}nM.hasPropFunc=tM;function Ib(e,t,r){return Ft._`${tM(e)}.call(${t}, ${r})`}nM.isOwnProperty=Ib;function bz(e,t,r,i){let n=Ft._`${t}${(0,Ft.getProperty)(r)} !== undefined`;return i?Ft._`${n} && ${Ib(e,t,r)}`:n}nM.propertyInData=bz;function Pb(e,t,r,i){let n=Ft._`${t}${(0,Ft.getProperty)(r)} === undefined`;return i?(0,Ft.or)(n,(0,Ft.not)(Ib(e,t,r))):n}nM.noPropertyInData=Pb;function rM(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}nM.allSchemaProperties=rM;function _z(e,t){return rM(t).filter((r)=>!(0,$b.alwaysValidSchema)(e,t[r]))}nM.schemaProperties=_z;function wz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},h,b,v){let _=v?Ft._`${e}, ${t}, ${i}${n}`:t,g=[[no.default.instancePath,(0,Ft.strConcat)(no.default.instancePath,o)],[no.default.parentData,s.parentData],[no.default.parentDataProperty,s.parentDataProperty],[no.default.rootData,no.default.rootData]];if(s.opts.dynamicRef)g.push([no.default.dynamicAnchors,no.default.dynamicAnchors]);let S=Ft._`${_}, ${r.object(...g)}`;return b!==Ft.nil?Ft._`${h}.call(${b}, ${S})`:Ft._`${h}(${S})`}nM.callValidateCode=wz;var Sz=Ft._`new RegExp`;function xz({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Ft._`${n.code==="new RegExp"?Sz:(0,mz.useFunc)(e,n)}(${r}, ${i})`})}nM.usePattern=xz;function kz(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let h=t.let("valid",!0);return s(()=>t.assign(h,!1)),h}return t.var(o,!0),s(()=>t.break()),o;function s(h){let b=t.const("len",Ft._`${r}.length`);t.forRange("i",0,b,(v)=>{e.subschema({keyword:i,dataProp:v,dataPropType:$b.Type.Num},o),t.if((0,Ft.not)(o),h)})}}nM.validateArray=kz;function Mz(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((b)=>(0,$b.alwaysValidSchema)(n,b))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),h=t.name("_valid");t.block(()=>r.forEach((b,v)=>{let _=e.subschema({keyword:i,schemaProp:v,compositeRule:!0},h);if(t.assign(s,Ft._`${s} || ${h}`),!e.mergeValidEvaluated(_,h))t.if((0,Ft.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}nM.validateUnion=Mz});var lM=Je((aM)=>{Object.defineProperty(aM,"__esModule",{value:!0});aM.validateKeywordUsage=aM.validSchemaType=aM.funcKeywordCode=aM.macroKeywordCode=void 0;var Gr=mt(),Zo=ki(),jz=An(),Uz=tc();function Lz(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,h=t.macro.call(s.self,n,o,s),b=sM(r,i,h);if(s.opts.validateSchema!==!1)s.self.validateSchema(h,!0);let v=r.name("valid");e.subschema({schema:h,schemaPath:Gr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:b,compositeRule:!0},v),e.pass(v,()=>e.error(!0))}aM.macroKeywordCode=Lz;function qz(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:h,it:b}=e;Bz(b,t);let v=!h&&t.compile?t.compile.call(b.self,o,s,b):t.validate,_=sM(i,n,v),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if($(),t.modifying)oM(e);I(()=>e.error())}else{let P=t.async?x():M();if(t.modifying)oM(e);I(()=>Fz(e,P))}}function x(){let P=i.let("ruleErrs",null);return i.try(()=>$(Gr._`await `),(T)=>i.assign(g,!1).if(Gr._`${T} instanceof ${b.ValidationError}`,()=>i.assign(P,Gr._`${T}.errors`),()=>i.throw(T))),P}function M(){let P=Gr._`${_}.errors`;return i.assign(P,null),$(Gr.nil),P}function $(P=t.async?Gr._`await `:Gr.nil){let T=b.opts.passContext?Zo.default.this:Zo.default.self,R=!(("compile"in t)&&!h||t.schema===!1);i.assign(g,Gr._`${P}${(0,jz.callValidateCode)(e,_,T,R)}`,t.modifying)}function I(P){var T;i.if((0,Gr.not)((T=t.valid)!==null&&T!==void 0?T:g),P)}}aM.funcKeywordCode=qz;function oM(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,Gr._`${i.parentData}[${i.parentDataProperty}]`))}function Fz(e,t){let{gen:r}=e;r.if(Gr._`Array.isArray(${t})`,()=>{r.assign(Zo.default.vErrors,Gr._`${Zo.default.vErrors} === null ? ${t} : ${Zo.default.vErrors}.concat(${t})`).assign(Zo.default.errors,Gr._`${Zo.default.vErrors}.length`),(0,Uz.extendErrors)(e)},()=>e.error())}function Bz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function sM(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Gr.stringify)(r)})}function Hz(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}aM.validSchemaType=Hz;function Zz({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((h)=>!Object.prototype.hasOwnProperty.call(e,h)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let b=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(b);else throw Error(b)}}}aM.validateKeywordUsage=Zz});var hM=Je((dM)=>{Object.defineProperty(dM,"__esModule",{value:!0});dM.extendSubschemaMode=dM.extendSubschemaData=dM.getSubschema=void 0;var ei=mt(),cM=kt();function Gz(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let h=e.schema[t];return r===void 0?{schema:h,schemaPath:ei._`${e.schemaPath}${(0,ei.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:h[r],schemaPath:ei._`${e.schemaPath}${(0,ei.getProperty)(t)}${(0,ei.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,cM.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}dM.getSubschema=Gz;function Jz(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:h}=t;if(r!==void 0){let{errorPath:v,dataPathArr:_,opts:g}=t,S=h.let("data",ei._`${t.data}${(0,ei.getProperty)(r)}`,!0);b(S),e.errorPath=ei.str`${v}${(0,cM.getErrorPath)(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=ei._`${r}`,e.dataPathArr=[..._,e.parentDataProperty]}if(n!==void 0){let v=n instanceof ei.Name?n:h.let("data",n,!0);if(b(v),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function b(v){e.data=v,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,v]}}dM.extendSubschemaData=Jz;function Xz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}dM.extendSubschemaMode=Xz});var Tb=Je((Sae,pM)=>{pM.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var gM=Je((xae,mM)=>{var io=mM.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};kp(t,i,n,e,"",e)};io.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};io.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};io.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};io.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 kp(e,t,r,i,n,o,s,h,b,v){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,h,b,v);for(var _ in i){var g=i[_];if(Array.isArray(g)){if(_ in io.arrayKeywords)for(var S=0;S<g.length;S++)kp(e,t,r,g[S],n+"/"+_+"/"+S,o,n,_,i,S)}else if(_ in io.propsKeywords){if(g&&typeof g=="object")for(var x in g)kp(e,t,r,g[x],n+"/"+_+"/"+ej(x),o,n,_,i,x)}else if(_ in io.keywords||e.allKeys&&!(_ in io.skipKeywords))kp(e,t,r,g,n+"/"+_,o,n,_,i)}r(i,n,o,s,h,b,v)}}function ej(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var nc=Je((_M)=>{Object.defineProperty(_M,"__esModule",{value:!0});_M.getSchemaRefs=_M.resolveUrl=_M.normalizeId=_M._getFullPath=_M.getFullPath=_M.inlineRef=void 0;var tj=kt(),rj=Tb(),nj=gM(),ij=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function oj(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Ab(e);if(!t)return!1;return yM(e)<=t}_M.inlineRef=oj;var sj=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ab(e){for(let t in e){if(sj.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ab))return!0;if(typeof r=="object"&&Ab(r))return!0}return!1}function yM(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,ij.has(r))continue;if(typeof e[r]=="object")(0,tj.eachItem)(e[r],(i)=>t+=yM(i));if(t===1/0)return 1/0}return t}function vM(e,t="",r){if(r!==!1)t=ia(t);let i=e.parse(t);return bM(e,i)}_M.getFullPath=vM;function bM(e,t){return e.serialize(t).split("#")[0]+"#"}_M._getFullPath=bM;var aj=/#\/?$/;function ia(e){return e?e.replace(aj,""):""}_M.normalizeId=ia;function uj(e,t,r){return r=ia(r),e.resolve(t,r)}_M.resolveUrl=uj;var lj=/^[a-z_][-a-z0-9._]*$/i;function cj(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=ia(e[r]||t),o={"":n},s=vM(i,n,!1),h={},b=new Set;return nj(e,{allKeys:!0},(g,S,x,M)=>{if(M===void 0)return;let $=s+S,I=o[M];if(typeof g[r]=="string")I=P.call(this,g[r]);T.call(this,g.$anchor),T.call(this,g.$dynamicAnchor),o[S]=I;function P(R){let C=this.opts.uriResolver.resolve;if(R=ia(I?C(I,R):R),b.has(R))throw _(R);b.add(R);let N=this.refs[R];if(typeof N=="string")N=this.refs[N];if(typeof N=="object")v(g,N.schema,R);else if(R!==ia($))if(R[0]==="#")v(g,h[R],R),h[R]=g;else this.refs[R]=$;return R}function T(R){if(typeof R=="string"){if(!lj.test(R))throw Error(`invalid anchor "${R}"`);P.call(this,`#${R}`)}}}),h;function v(g,S,x){if(S!==void 0&&!rj(g,S))throw _(x)}function _(g){return Error(`reference "${g}" resolves to more than one schema`)}}_M.getSchemaRefs=cj});var sc=Je((NM)=>{Object.defineProperty(NM,"__esModule",{value:!0});NM.getData=NM.KeywordCxt=NM.validateFunctionCode=void 0;var EM=Uk(),SM=rc(),Cb=xb(),Mp=rc(),gj=eM(),oc=lM(),Rb=hM(),rt=mt(),lt=ki(),yj=nc(),Mi=kt(),ic=tc();function vj(e){if(PM(e)){if(TM(e),IM(e)){wj(e);return}}$M(e,()=>(0,EM.topBoolOrEmptySchema)(e))}NM.validateFunctionCode=vj;function $M({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,rt._`${lt.default.data}, ${lt.default.valCxt}`,i.$async,()=>{e.code(rt._`"use strict"; ${xM(r,n)}`),_j(e,n),e.code(o)});else e.func(t,rt._`${lt.default.data}, ${bj(n)}`,i.$async,()=>e.code(xM(r,n)).code(o))}function bj(e){return rt._`{${lt.default.instancePath}="", ${lt.default.parentData}, ${lt.default.parentDataProperty}, ${lt.default.rootData}=${lt.default.data}${e.dynamicRef?rt._`, ${lt.default.dynamicAnchors}={}`:rt.nil}}={}`}function _j(e,t){e.if(lt.default.valCxt,()=>{if(e.var(lt.default.instancePath,rt._`${lt.default.valCxt}.${lt.default.instancePath}`),e.var(lt.default.parentData,rt._`${lt.default.valCxt}.${lt.default.parentData}`),e.var(lt.default.parentDataProperty,rt._`${lt.default.valCxt}.${lt.default.parentDataProperty}`),e.var(lt.default.rootData,rt._`${lt.default.valCxt}.${lt.default.rootData}`),t.dynamicRef)e.var(lt.default.dynamicAnchors,rt._`${lt.default.valCxt}.${lt.default.dynamicAnchors}`)},()=>{if(e.var(lt.default.instancePath,rt._`""`),e.var(lt.default.parentData,rt._`undefined`),e.var(lt.default.parentDataProperty,rt._`undefined`),e.var(lt.default.rootData,lt.default.data),t.dynamicRef)e.var(lt.default.dynamicAnchors,rt._`{}`)})}function wj(e){let{schema:t,opts:r,gen:i}=e;$M(e,()=>{if(r.$comment&&t.$comment)RM(e);if(Ej(e),i.let(lt.default.vErrors,null),i.let(lt.default.errors,0),r.unevaluated)Sj(e);AM(e),Pj(e)});return}function Sj(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",rt._`${r}.evaluated`),t.if(rt._`${e.evaluated}.dynamicProps`,()=>t.assign(rt._`${e.evaluated}.props`,rt._`undefined`)),t.if(rt._`${e.evaluated}.dynamicItems`,()=>t.assign(rt._`${e.evaluated}.items`,rt._`undefined`))}function xM(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?rt._`/*# sourceURL=${r} */`:rt.nil}function xj(e,t){if(PM(e)){if(TM(e),IM(e)){kj(e,t);return}}(0,EM.boolOrEmptySchema)(e,t)}function IM({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function PM(e){return typeof e.schema!="boolean"}function kj(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)RM(e);$j(e),Ij(e);let o=i.const("_errs",lt.default.errors);AM(e,o),i.var(t,rt._`${o} === ${lt.default.errors}`)}function TM(e){(0,Mi.checkUnknownRules)(e),Mj(e)}function AM(e,t){if(e.opts.jtd)return kM(e,[],!1,t);let r=(0,SM.getSchemaTypes)(e.schema),i=(0,SM.coerceAndCheckDataType)(e,r);kM(e,r,!i,t)}function Mj(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&(0,Mi.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Ej(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,Mi.checkStrictMode)(e,"default is ignored in the schema root")}function $j(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,yj.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function Ij(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function RM({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(rt._`${lt.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=rt.str`${i}/$comment`,h=e.scopeValue("root",{ref:t.root});e.code(rt._`${lt.default.self}.opts.$comment(${o}, ${s}, ${h}.schema)`)}}function Pj(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(rt._`${lt.default.errors} === 0`,()=>t.return(lt.default.data),()=>t.throw(rt._`new ${n}(${lt.default.vErrors})`));else{if(t.assign(rt._`${i}.errors`,lt.default.vErrors),o.unevaluated)Tj(e);t.return(rt._`${lt.default.errors} === 0`)}}function Tj({gen:e,evaluated:t,props:r,items:i}){if(r instanceof rt.Name)e.assign(rt._`${t}.props`,r);if(i instanceof rt.Name)e.assign(rt._`${t}.items`,i)}function kM(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:h,opts:b,self:v}=e,{RULES:_}=v;if(o.$ref&&(b.ignoreKeywordsWithRef||!(0,Mi.schemaHasRulesButRef)(o,_))){n.block(()=>OM(e,"$ref",_.all.$ref.definition));return}if(!b.jtd)Aj(e,t);n.block(()=>{for(let S of _.rules)g(S);g(_.post)});function g(S){if(!(0,Cb.shouldUseGroup)(o,S))return;if(S.type){if(n.if((0,Mp.checkDataType)(S.type,s,b.strictNumbers)),MM(e,S),t.length===1&&t[0]===S.type&&r)n.else(),(0,Mp.reportTypeError)(e);n.endIf()}else MM(e,S);if(!h)n.if(rt._`${lt.default.errors} === ${i||0}`)}}function MM(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)(0,gj.assignDefaults)(e,t.type);r.block(()=>{for(let o of t.rules)if((0,Cb.shouldUseRule)(i,o))OM(e,o.keyword,o.definition,t.type)})}function Aj(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Rj(e,t),!e.opts.allowUnionTypes)Cj(e,t);Oj(e,e.dataTypes)}function Rj(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!CM(e.dataTypes,r))Ob(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Nj(e,t)}function Cj(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Ob(e,"use allowUnionTypes to allow union type keyword")}function Oj(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Cb.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>Dj(t,s)))Ob(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Dj(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function CM(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Nj(e,t){let r=[];for(let i of e.dataTypes)if(CM(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function Ob(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Mi.checkStrictMode)(e,t,e.opts.strictTypes)}class Db{constructor(e,t,r){if((0,oc.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Mi.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",DM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,oc.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",lt.default.errors)}result(e,t,r){this.failResult((0,rt.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,rt.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(rt._`${t} !== undefined && (${(0,rt.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?ic.reportExtraError:ic.reportError)(this,this.def.error,t)}$dataError(){(0,ic.reportError)(this,this.def.$dataError||ic.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,ic.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=rt.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=rt.nil,t=rt.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if((0,rt.or)(rt._`${i} === undefined`,t)),e!==rt.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==rt.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return(0,rt.or)(o(),s());function o(){if(r.length){if(!(t instanceof rt.Name))throw Error("ajv implementation error");let h=Array.isArray(r)?r:[r];return rt._`${(0,Mp.checkDataTypes)(h,t,n.opts.strictNumbers,Mp.DataType.Wrong)}`}return rt.nil}function s(){if(i.validateSchema){let h=e.scopeValue("validate$data",{ref:i.validateSchema});return rt._`!${h}(${t})`}return rt.nil}}subschema(e,t){let r=(0,Rb.getSubschema)(this.it,e);(0,Rb.extendSubschemaData)(r,this.it,e),(0,Rb.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return xj(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Mi.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Mi.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,rt.Name)),!0}}NM.KeywordCxt=Db;function OM(e,t,r,i){let n=new Db(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)(0,oc.funcKeywordCode)(n,r);else if("macro"in r)(0,oc.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,oc.funcKeywordCode)(n,r)}var zj=/^\/(?:[^~]|~0|~1)*$/,jj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function DM(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return lt.default.rootData;if(e[0]==="/"){if(!zj.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=lt.default.rootData}else{let v=jj.exec(e);if(!v)throw Error(`Invalid JSON-pointer: ${e}`);let _=+v[1];if(n=v[2],n==="#"){if(_>=t)throw Error(b("property/index",_));return i[t-_]}if(_>t)throw Error(b("data",_));if(o=r[t-_],!n)return o}let s=o,h=n.split("/");for(let v of h)if(v)o=rt._`${o}${(0,rt.getProperty)((0,Mi.unescapeJsonPointer)(v))}`,s=rt._`${s} && ${o}`;return s;function b(v,_){return`Cannot access ${v} ${_} levels up, current level is ${t}`}}NM.getData=DM});var Ep=Je((UM)=>{Object.defineProperty(UM,"__esModule",{value:!0});class jM extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}UM.default=jM});var ac=Je((qM)=>{Object.defineProperty(qM,"__esModule",{value:!0});var Nb=nc();class LM extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Nb.resolveUrl)(e,t,r),this.missingSchema=(0,Nb.normalizeId)((0,Nb.getFullPath)(e,this.missingRef))}}qM.default=LM});var Ip=Je((HM)=>{Object.defineProperty(HM,"__esModule",{value:!0});HM.resolveSchema=HM.getCompilingSchema=HM.resolveRef=HM.compileSchema=HM.SchemaEnv=void 0;var Fn=mt(),Bj=Ep(),Ko=ki(),Bn=nc(),FM=kt(),Hj=sc();class uc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Bn.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}HM.SchemaEnv=uc;function jb(e){let t=BM.call(this,e);if(t)return t;let r=(0,Bn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Fn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),h;if(e.$async)h=s.scopeValue("Error",{ref:Bj.default,code:Fn._`require("ajv/dist/runtime/validation_error").default`});let b=s.scopeName("validate");e.validateName=b;let v={gen:s,allErrors:this.opts.allErrors,data:Ko.default.data,parentData:Ko.default.parentData,parentDataProperty:Ko.default.parentDataProperty,dataNames:[Ko.default.data],dataPathArr:[Fn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Fn.stringify)(e.schema)}:{ref:e.schema}),validateName:b,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Fn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Fn._`""`,opts:this.opts,self:this},_;try{this._compilations.add(e),(0,Hj.validateFunctionCode)(v),s.optimize(this.opts.code.optimize);let g=s.toString();if(_=`${s.scopeRefs(Ko.default.scope)}return ${g}`,this.opts.code.process)_=this.opts.code.process(_,e);let x=Function(`${Ko.default.self}`,`${Ko.default.scope}`,_)(this,this.scope.get());if(this.scope.value(b,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:b,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:M,items:$}=v;if(x.evaluated={props:M instanceof Fn.Name?void 0:M,items:$ instanceof Fn.Name?void 0:$,dynamicProps:M instanceof Fn.Name,dynamicItems:$ instanceof Fn.Name},x.source)x.source.evaluated=(0,Fn.stringify)(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw g}finally{this._compilations.delete(e)}}HM.compileSchema=jb;function Zj(e,t,r){var i;r=(0,Bn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=Wj.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:h}=this.opts;if(s)o=new uc({schema:s,schemaId:h,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=Kj.call(this,o)}HM.resolveRef=Zj;function Kj(e){if((0,Bn.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:jb.call(this,e)}function BM(e){for(let t of this._compilations)if(Vj(t,e))return t}HM.getCompilingSchema=BM;function Vj(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Wj(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||$p.call(this,e,t)}function $p(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Bn._getFullPath)(this.opts.uriResolver,r),n=(0,Bn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return zb.call(this,r,e);let o=(0,Bn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let h=$p.call(this,e,s);if(typeof(h===null||h===void 0?void 0:h.schema)!=="object")return;return zb.call(this,r,h)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)jb.call(this,s);if(o===(0,Bn.normalizeId)(t)){let{schema:h}=s,{schemaId:b}=this.opts,v=h[b];if(v)n=(0,Bn.resolveUrl)(this.opts.uriResolver,n,v);return new uc({schema:h,schemaId:b,root:e,baseId:n})}return zb.call(this,r,s)}HM.resolveSchema=$p;var Gj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function zb(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let h of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let b=r[(0,FM.unescapeFragment)(h)];if(b===void 0)return;r=b;let v=typeof r==="object"&&r[this.opts.schemaId];if(!Gj.has(h)&&v)t=(0,Bn.resolveUrl)(this.opts.uriResolver,t,v)}let o;if(typeof r!="boolean"&&r.$ref&&!(0,FM.schemaHasRulesButRef)(r,this.RULES)){let h=(0,Bn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=$p.call(this,i,h)}let{schemaId:s}=this.opts;if(o=o||new uc({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var KM=Je((Pae,eU)=>{eU.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}});var qb=Je((Tae,YM)=>{var tU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),WM=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),Ub=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),GM=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),rU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Lb(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var nU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function VM(e){return e.length=0,!0}function iU(e,t,r){if(e.length){let i=Lb(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function oU(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,h=iU;for(let b=0;b<e.length;b++){let v=e[b];if(v==="["||v==="]")continue;if(v===":"){if(o===!0)s=!0;if(!h(n,i,r))break;if(++t>7){r.error=!0;break}if(b>0&&e[b-1]===":")o=!0;i.push(":");continue}else if(v==="%"){if(!h(n,i,r))break;h=VM}else{n.push(v);continue}}if(n.length)if(h===VM)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(Lb(n));return r.address=i.join(""),r}function JM(e){if(sU(e,":")<2)return{host:e,isIPV6:!1};let t=oU(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function sU(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function aU(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var uU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},lU=/[@/?#:]/g,cU=/[@/?#]/g;function XM(e,t){let r=t?cU:lU;return r.lastIndex=0,e.replace(r,(i)=>uU[i])}function dU(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Ub(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&GM(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function fU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Ub(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&GM(o))t+=o;else t+="%"+n;r+=2;continue}}if(rU(e[r]))t+=e[r];else t+=escape(e[r])}return t}function hU(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Ub(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function pU(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!WM(r)){let i=JM(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=XM(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}YM.exports={nonSimpleDomain:nU,recomposeAuthority:pU,reescapeHostDelimiters:XM,normalizePercentEncoding:dU,normalizePathEncoding:fU,escapePreservingEscapes:hU,removeDotSegments:aU,isIPv4:WM,isUUID:tU,normalizeIPv6:JM,stringArrayToHexStripped:Lb}});var n4=Je((Aae,r4)=>{var{isUUID:mU}=qb(),gU=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,yU=["http","https","ws","wss","urn","urn:uuid"];function vU(e){return yU.indexOf(e)!==-1}function Fb(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function QM(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function e4(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function bU(e){return e.secure=Fb(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function _U(e){if(e.port===(Fb(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function wU(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(gU);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=Bb(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function SU(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=Bb(n);if(o)e=o.serialize(e,t);let s=e,h=e.nss;return s.path=`${i||t.nid}:${h}`,t.skipEscape=!0,s}function xU(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!mU(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function kU(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var t4={scheme:"http",domainHost:!0,parse:QM,serialize:e4},MU={scheme:"https",domainHost:t4.domainHost,parse:QM,serialize:e4},Pp={scheme:"ws",domainHost:!0,parse:bU,serialize:_U},EU={scheme:"wss",domainHost:Pp.domainHost,parse:Pp.parse,serialize:Pp.serialize},$U={scheme:"urn",parse:wU,serialize:SU,skipNormalize:!0},IU={scheme:"urn:uuid",parse:xU,serialize:kU,skipNormalize:!0},Tp={http:t4,https:MU,ws:Pp,wss:EU,urn:$U,"urn:uuid":IU};Object.setPrototypeOf(Tp,null);function Bb(e){return e&&(Tp[e]||Tp[e.toLowerCase()])||void 0}r4.exports={wsIsSecure:Fb,SCHEMES:Tp,isValidSchemeName:vU,getSchemeHandler:Bb}});var l4=Je((Rae,Ap)=>{var{normalizeIPv6:PU,removeDotSegments:lc,recomposeAuthority:TU,normalizePercentEncoding:AU,normalizePathEncoding:RU,escapePreservingEscapes:CU,reescapeHostDelimiters:OU,isIPv4:DU,nonSimpleDomain:NU}=qb(),{SCHEMES:zU,getSchemeHandler:o4}=n4();function jU(e,t){if(typeof e==="string")e=BU(e,t);else if(typeof e==="object")e=oa(Vo(e,t),t);return e}function UU(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=s4(oa(e,i),oa(t,i),i,!0);return i.skipEscape=!0,Vo(n,i)}function s4(e,t,r,i){let n={};if(!i)e=oa(Vo(e,r),r),t=oa(Vo(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=lc(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=lc(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=lc(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=lc(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function LU(e,t,r){let i=i4(e,r),n=i4(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function Vo(e,t){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:""},i=Object.assign({},t),n=[],o=o4(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=CU(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=AU(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=TU(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let h=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))h=lc(h);if(s===void 0&&h[0]==="/"&&h[1]==="/")h="/%2F"+h.slice(2);n.push(h)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var qU=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function FU(e,t){if(t[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.";return}function a4(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(qU);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let h=FU(i,s);if(h!==void 0)i.error=i.error||h,n=!0;if(i.host)if(DU(i.host)===!1){let _=PU(i.host);i.host=_.host.toLowerCase(),o=_.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let b=o4(r.scheme||i.scheme);if(!r.unicodeSupport&&(!b||!b.unicodeSupport)){if(i.host&&(r.domainHost||b&&b.domainHost)&&o===!1&&NU(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(v){i.error=i.error||"Host's domain name can not be converted to ASCII: "+v}}if(!b||b&&!b.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=OU(unescape(i.host),o)}if(i.path)i.path=RU(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(b&&b.parse)b.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function oa(e,t){return a4(e,t).parsed}function BU(e,t){return u4(e,t).normalized}function u4(e,t){let{parsed:r,malformedAuthorityOrPort:i}=a4(e,t);return{normalized:i?e:Vo(r,t),malformedAuthorityOrPort:i}}function i4(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=u4(e,t);return i?void 0:r}if(typeof e==="object")return Vo(e,t)}var Hb={SCHEMES:zU,normalize:jU,resolve:UU,resolveComponent:s4,equal:LU,serialize:Vo,parse:oa};Ap.exports=Hb;Ap.exports.default=Hb;Ap.exports.fastUri=Hb});var f4=Je((d4)=>{Object.defineProperty(d4,"__esModule",{value:!0});var c4=l4();c4.code='require("ajv/dist/runtime/uri").default';d4.default=c4});var _4=Je((Ei)=>{Object.defineProperty(Ei,"__esModule",{value:!0});Ei.CodeGen=Ei.Name=Ei.nil=Ei.stringify=Ei.str=Ei._=Ei.KeywordCxt=void 0;var ZU=sc();Object.defineProperty(Ei,"KeywordCxt",{enumerable:!0,get:function(){return ZU.KeywordCxt}});var sa=mt();Object.defineProperty(Ei,"_",{enumerable:!0,get:function(){return sa._}});Object.defineProperty(Ei,"str",{enumerable:!0,get:function(){return sa.str}});Object.defineProperty(Ei,"stringify",{enumerable:!0,get:function(){return sa.stringify}});Object.defineProperty(Ei,"nil",{enumerable:!0,get:function(){return sa.nil}});Object.defineProperty(Ei,"Name",{enumerable:!0,get:function(){return sa.Name}});Object.defineProperty(Ei,"CodeGen",{enumerable:!0,get:function(){return sa.CodeGen}});var KU=Ep(),y4=ac(),VU=Sb(),cc=Ip(),WU=mt(),dc=nc(),Rp=rc(),Kb=kt(),h4=KM(),GU=f4(),v4=(e,t)=>new RegExp(e,t);v4.code="new RegExp";var JU=["removeAdditional","useDefaults","coerceTypes"],XU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),YU={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."},QU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},p4=200;function eL(e){var t,r,i,n,o,s,h,b,v,_,g,S,x,M,$,I,P,T,R,C,N,B,ie,le,ue;let q=e.strict,ee=(t=e.code)===null||t===void 0?void 0:t.optimize,a=ee===!0||ee===void 0?1:ee||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:v4,f=(n=e.uriResolver)!==null&&n!==void 0?n:GU.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:q)!==null&&s!==void 0?s:!0,strictNumbers:(b=(h=e.strictNumbers)!==null&&h!==void 0?h:q)!==null&&b!==void 0?b:!0,strictTypes:(_=(v=e.strictTypes)!==null&&v!==void 0?v:q)!==null&&_!==void 0?_:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:q)!==null&&S!==void 0?S:"log",strictRequired:(M=(x=e.strictRequired)!==null&&x!==void 0?x:q)!==null&&M!==void 0?M:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:($=e.loopRequired)!==null&&$!==void 0?$:p4,loopEnum:(I=e.loopEnum)!==null&&I!==void 0?I:p4,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:(T=e.messages)!==null&&T!==void 0?T:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=e.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(ie=e.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(le=e.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ue=e.int32range)!==null&&ue!==void 0?ue:!0,uriResolver:f}}class Cp{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...eL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new WU.ValueScope({scope:{},prefixes:XU,es5:t,lines:r}),this.logger=sL(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,VU.getRules)(),m4.call(this,YU,e,"NOT SUPPORTED"),m4.call(this,QU,e,"DEPRECATED","warn"),this._metaOpts=iL.call(this),e.formats)rL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)nL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);tL.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=h4;if(r==="id")i={...h4},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(v,_){await n.call(this,v.$schema);let g=this._addSchema(v,_);return g.validate||o.call(this,g)}async function n(v){if(v&&!this.getSchema(v))await i.call(this,{$ref:v},!0)}async function o(v){try{return this._compileSchemaEnv(v)}catch(_){if(!(_ instanceof y4.default))throw _;return s.call(this,_),await h.call(this,_.missingSchema),o.call(this,v)}}function s({missingSchema:v,missingRef:_}){if(this.refs[v])throw Error(`AnySchema ${v} is loaded but ${_} cannot be resolved`)}async function h(v){let _=await b.call(this,v);if(!this.refs[v])await n.call(this,_.$schema);if(!this.refs[v])this.addSchema(_,v,t)}async function b(v){let _=this._loading[v];if(_)return _;try{return await(this._loading[v]=r(v))}finally{delete this._loading[v]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=(0,dc.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=g4.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new cc.SchemaEnv({schema:{},schemaId:r});if(t=cc.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=g4.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,dc.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(uL.call(this,r,t),!t)return(0,Kb.eachItem)(r,(n)=>Zb.call(this,n)),this;cL.call(this,t);let i={...t,type:(0,Rp.getJSONTypes)(t.type),schemaType:(0,Rp.getJSONTypes)(t.schemaType)};return(0,Kb.eachItem)(r,i.type.length===0?(n)=>Zb.call(this,n,i):(n)=>i.type.forEach((o)=>Zb.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let h=r[s];if(typeof h!="object")continue;let{$data:b}=h.definition,v=o[s];if(b&&v)o[s]=b4(v)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let h=this._cache.get(e);if(h!==void 0)return h;r=(0,dc.normalizeId)(o||r);let b=dc.getSchemaRefs.call(this,e,r);if(h=new cc.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:b}),this._cache.set(h.schema,h),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=h}if(i)this.validateSchema(e,!0);return h}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else cc.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{cc.compileSchema.call(this,e)}finally{this.opts=t}}}Cp.ValidationError=KU.default;Cp.MissingRefError=y4.default;Ei.default=Cp;function m4(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function g4(e){return e=(0,dc.normalizeId)(e),this.schemas[e]||this.refs[e]}function tL(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function rL(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function nL(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function iL(){let e={...this.opts};for(let t of JU)delete e[t];return e}var oL={log(){},warn(){},error(){}};function sL(e){if(e===!1)return oL;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var aL=/^[a-z_$][a-z0-9_$:-]*$/i;function uL(e,t){let{RULES:r}=this;if((0,Kb.eachItem)(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!aL.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Zb(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:b})=>b===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let h={keyword:e,definition:{...t,type:(0,Rp.getJSONTypes)(t.type),schemaType:(0,Rp.getJSONTypes)(t.schemaType)}};if(t.before)lL.call(this,s,h,t.before);else s.rules.push(h);o.all[e]=h,(i=t.implements)===null||i===void 0||i.forEach((b)=>this.addKeyword(b))}function lL(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function cL(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=b4(t);e.validateSchema=this.compile(t,!0)}var dL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function b4(e){return{anyOf:[e,dL]}}});var S4=Je((w4)=>{Object.defineProperty(w4,"__esModule",{value:!0});var pL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};w4.default=pL});var I4=Je((E4)=>{Object.defineProperty(E4,"__esModule",{value:!0});E4.callRef=E4.getValidate=void 0;var gL=ac(),x4=An(),sn=mt(),aa=ki(),k4=Ip(),Op=kt(),yL={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:h,self:b}=i,{root:v}=o;if((r==="#"||r==="#/")&&n===v.baseId)return g();let _=k4.resolveRef.call(b,v,n,r);if(_===void 0)throw new gL.default(i.opts.uriResolver,n,r);if(_ instanceof k4.SchemaEnv)return S(_);return x(_);function g(){if(o===v)return Dp(e,s,o,o.$async);let M=t.scopeValue("root",{ref:v});return Dp(e,sn._`${M}.validate`,v,v.$async)}function S(M){let $=M4(e,M);Dp(e,$,M,M.$async)}function x(M){let $=t.scopeValue("schema",h.code.source===!0?{ref:M,code:(0,sn.stringify)(M)}:{ref:M}),I=t.name("valid"),P=e.subschema({schema:M,dataTypes:[],schemaPath:sn.nil,topSchemaRef:$,errSchemaPath:r},I);e.mergeEvaluated(P),e.ok(I)}}};function M4(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):sn._`${r.scopeValue("wrapper",{ref:t})}.validate`}E4.getValidate=M4;function Dp(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:h,opts:b}=o,v=b.passContext?aa.default.this:sn.nil;if(i)_();else g();function _(){if(!h.$async)throw Error("async schema referenced by sync schema");let M=n.let("valid");n.try(()=>{if(n.code(sn._`await ${(0,x4.callValidateCode)(e,t,v)}`),x(t),!s)n.assign(M,!0)},($)=>{if(n.if(sn._`!(${$} instanceof ${o.ValidationError})`,()=>n.throw($)),S($),!s)n.assign(M,!1)}),e.ok(M)}function g(){e.result((0,x4.callValidateCode)(e,t,v),()=>x(t),()=>S(t))}function S(M){let $=sn._`${M}.errors`;n.assign(aa.default.vErrors,sn._`${aa.default.vErrors} === null ? ${$} : ${aa.default.vErrors}.concat(${$})`),n.assign(aa.default.errors,sn._`${aa.default.vErrors}.length`)}function x(M){var $;if(!o.opts.unevaluated)return;let I=($=r===null||r===void 0?void 0:r.validate)===null||$===void 0?void 0:$.evaluated;if(o.props!==!0)if(I&&!I.dynamicProps){if(I.props!==void 0)o.props=Op.mergeEvaluated.props(n,I.props,o.props)}else{let P=n.var("props",sn._`${M}.evaluated.props`);o.props=Op.mergeEvaluated.props(n,P,o.props,sn.Name)}if(o.items!==!0)if(I&&!I.dynamicItems){if(I.items!==void 0)o.items=Op.mergeEvaluated.items(n,I.items,o.items)}else{let P=n.var("items",sn._`${M}.evaluated.items`);o.items=Op.mergeEvaluated.items(n,P,o.items,sn.Name)}}}E4.callRef=Dp;E4.default=yL});var T4=Je((P4)=>{Object.defineProperty(P4,"__esModule",{value:!0});var _L=S4(),wL=I4(),SL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_L.default,wL.default];P4.default=SL});var R4=Je((A4)=>{Object.defineProperty(A4,"__esModule",{value:!0});var Np=mt(),oo=Np.operators,zp={maximum:{okStr:"<=",ok:oo.LTE,fail:oo.GT},minimum:{okStr:">=",ok:oo.GTE,fail:oo.LT},exclusiveMaximum:{okStr:"<",ok:oo.LT,fail:oo.GTE},exclusiveMinimum:{okStr:">",ok:oo.GT,fail:oo.LTE}},kL={message:({keyword:e,schemaCode:t})=>Np.str`must be ${zp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Np._`{comparison: ${zp[e].okStr}, limit: ${t}}`},ML={keyword:Object.keys(zp),type:"number",schemaType:"number",$data:!0,error:kL,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(Np._`${r} ${zp[t].fail} ${i} || isNaN(${r})`)}};A4.default=ML});var O4=Je((C4)=>{Object.defineProperty(C4,"__esModule",{value:!0});var fc=mt(),$L={message:({schemaCode:e})=>fc.str`must be multiple of ${e}`,params:({schemaCode:e})=>fc._`{multipleOf: ${e}}`},IL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:$L,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),h=o?fc._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:fc._`${s} !== parseInt(${s})`;e.fail$data(fc._`(${i} === 0 || (${s} = ${r}/${i}, ${h}))`)}};C4.default=IL});var z4=Je((N4)=>{Object.defineProperty(N4,"__esModule",{value:!0});function D4(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}N4.default=D4;D4.code='require("ajv/dist/runtime/ucs2length").default'});var U4=Je((j4)=>{Object.defineProperty(j4,"__esModule",{value:!0});var Wo=mt(),AL=kt(),RL=z4(),CL={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Wo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Wo._`{limit: ${e}}`},OL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:CL,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Wo.operators.GT:Wo.operators.LT,s=n.opts.unicode===!1?Wo._`${r}.length`:Wo._`${(0,AL.useFunc)(e.gen,RL.default)}(${r})`;e.fail$data(Wo._`${s} ${o} ${i}`)}};j4.default=OL});var q4=Je((L4)=>{Object.defineProperty(L4,"__esModule",{value:!0});var NL=An(),zL=kt(),ua=mt(),jL={message:({schemaCode:e})=>ua.str`must match pattern "${e}"`,params:({schemaCode:e})=>ua._`{pattern: ${e}}`},UL={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jL,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,h=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:b}=s.opts.code,v=b.code==="new RegExp"?ua._`new RegExp`:(0,zL.useFunc)(t,b),_=t.let("valid");t.try(()=>t.assign(_,ua._`${v}(${o}, ${h}).test(${r})`),()=>t.assign(_,!1)),e.fail$data(ua._`!${_}`)}else{let b=(0,NL.usePattern)(e,n);e.fail$data(ua._`!${b}.test(${r})`)}}};L4.default=UL});var B4=Je((F4)=>{Object.defineProperty(F4,"__esModule",{value:!0});var hc=mt(),qL={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return hc.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>hc._`{limit: ${e}}`},FL={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:qL,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?hc.operators.GT:hc.operators.LT;e.fail$data(hc._`Object.keys(${r}).length ${n} ${i}`)}};F4.default=FL});var Z4=Je((H4)=>{Object.defineProperty(H4,"__esModule",{value:!0});var pc=An(),mc=mt(),HL=kt(),ZL={message:({params:{missingProperty:e}})=>mc.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>mc._`{missingProperty: ${e}}`},KL={keyword:"required",type:"object",schemaType:"array",$data:!0,error:ZL,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:h}=s;if(!o&&r.length===0)return;let b=r.length>=h.loopRequired;if(s.allErrors)v();else _();if(h.strictRequired){let x=e.parentSchema.properties,{definedProperties:M}=e.it;for(let $ of r)if((x===null||x===void 0?void 0:x[$])===void 0&&!M.has($)){let I=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${$}" is not defined at "${I}" (strictRequired)`;(0,HL.checkStrictMode)(s,P,s.opts.strictRequired)}}function v(){if(b||o)e.block$data(mc.nil,g);else for(let x of r)(0,pc.checkReportMissingProp)(e,x)}function _(){let x=t.let("missing");if(b||o){let M=t.let("valid",!0);e.block$data(M,()=>S(x,M)),e.ok(M)}else t.if((0,pc.checkMissingProp)(e,r,x)),(0,pc.reportMissingProp)(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if((0,pc.noPropertyInData)(t,n,x,h.ownProperties),()=>e.error())})}function S(x,M){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(M,(0,pc.propertyInData)(t,n,x,h.ownProperties)),t.if((0,mc.not)(M),()=>{e.error(),t.break()})},mc.nil)}}};H4.default=KL});var V4=Je((K4)=>{Object.defineProperty(K4,"__esModule",{value:!0});var gc=mt(),WL={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return gc.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>gc._`{limit: ${e}}`},GL={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:WL,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?gc.operators.GT:gc.operators.LT;e.fail$data(gc._`${r}.length ${n} ${i}`)}};K4.default=GL});var jp=Je((G4)=>{Object.defineProperty(G4,"__esModule",{value:!0});var W4=Tb();W4.code='require("ajv/dist/runtime/equal").default';G4.default=W4});var X4=Je((J4)=>{Object.defineProperty(J4,"__esModule",{value:!0});var Vb=rc(),Cr=mt(),YL=kt(),QL=jp(),eq={message:({params:{i:e,j:t}})=>Cr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Cr._`{i: ${e}, j: ${t}}`},tq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:eq,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:h}=e;if(!i&&!n)return;let b=t.let("valid"),v=o.items?(0,Vb.getSchemaTypes)(o.items):[];e.block$data(b,_,Cr._`${s} === false`),e.ok(b);function _(){let M=t.let("i",Cr._`${r}.length`),$=t.let("j");e.setParams({i:M,j:$}),t.assign(b,!0),t.if(Cr._`${M} > 1`,()=>(g()?S:x)(M,$))}function g(){return v.length>0&&!v.some((M)=>M==="object"||M==="array")}function S(M,$){let I=t.name("item"),P=(0,Vb.checkDataTypes)(v,I,h.opts.strictNumbers,Vb.DataType.Wrong),T=t.const("indices",Cr._`{}`);t.for(Cr._`;${M}--;`,()=>{if(t.let(I,Cr._`${r}[${M}]`),t.if(P,Cr._`continue`),v.length>1)t.if(Cr._`typeof ${I} == "string"`,Cr._`${I} += "_"`);t.if(Cr._`typeof ${T}[${I}] == "number"`,()=>{t.assign($,Cr._`${T}[${I}]`),e.error(),t.assign(b,!1).break()}).code(Cr._`${T}[${I}] = ${M}`)})}function x(M,$){let I=(0,YL.useFunc)(t,QL.default),P=t.name("outer");t.label(P).for(Cr._`;${M}--;`,()=>t.for(Cr._`${$} = ${M}; ${$}--;`,()=>t.if(Cr._`${I}(${r}[${M}], ${r}[${$}])`,()=>{e.error(),t.assign(b,!1).break(P)})))}}};J4.default=tq});var Q4=Je((Y4)=>{Object.defineProperty(Y4,"__esModule",{value:!0});var Wb=mt(),nq=kt(),iq=jp(),oq={message:"must be equal to constant",params:({schemaCode:e})=>Wb._`{allowedValue: ${e}}`},sq={keyword:"const",$data:!0,error:oq,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(Wb._`!${(0,nq.useFunc)(t,iq.default)}(${r}, ${n})`);else e.fail(Wb._`${o} !== ${r}`)}};Y4.default=sq});var t3=Je((e3)=>{Object.defineProperty(e3,"__esModule",{value:!0});var yc=mt(),uq=kt(),lq=jp(),cq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>yc._`{allowedValues: ${e}}`},dq={keyword:"enum",schemaType:"array",$data:!0,error:cq,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let h=n.length>=s.opts.loopEnum,b,v=()=>b!==null&&b!==void 0?b:b=(0,uq.useFunc)(t,lq.default),_;if(h||i)_=t.let("valid"),e.block$data(_,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);_=(0,yc.or)(...n.map((M,$)=>S(x,$)))}e.pass(_);function g(){t.assign(_,!1),t.forOf("v",o,(x)=>t.if(yc._`${v()}(${r}, ${x})`,()=>t.assign(_,!0).break()))}function S(x,M){let $=n[M];return typeof $==="object"&&$!==null?yc._`${v()}(${r}, ${x}[${M}])`:yc._`${r} === ${$}`}}};e3.default=dq});var n3=Je((r3)=>{Object.defineProperty(r3,"__esModule",{value:!0});var hq=R4(),pq=O4(),mq=U4(),gq=q4(),yq=B4(),vq=Z4(),bq=V4(),_q=X4(),wq=Q4(),Sq=t3(),xq=[hq.default,pq.default,mq.default,gq.default,yq.default,vq.default,bq.default,_q.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},wq.default,Sq.default];r3.default=xq});var Jb=Je((o3)=>{Object.defineProperty(o3,"__esModule",{value:!0});o3.validateAdditionalItems=void 0;var Go=mt(),Gb=kt(),Mq={message:({params:{len:e}})=>Go.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Go._`{limit: ${e}}`},Eq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Mq,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,Gb.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}i3(e,i)}};function i3(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let h=r.const("len",Go._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(Go._`${h} <= ${t.length}`);else if(typeof i=="object"&&!(0,Gb.alwaysValidSchema)(s,i)){let v=r.var("valid",Go._`${h} <= ${t.length}`);r.if((0,Go.not)(v),()=>b(v)),e.ok(v)}function b(v){r.forRange("i",t.length,h,(_)=>{if(e.subschema({keyword:o,dataProp:_,dataPropType:Gb.Type.Num},v),!s.allErrors)r.if((0,Go.not)(v),()=>r.break())})}}o3.validateAdditionalItems=i3;o3.default=Eq});var Xb=Je((l3)=>{Object.defineProperty(l3,"__esModule",{value:!0});l3.validateTuple=void 0;var a3=mt(),Up=kt(),Iq=An(),Pq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return u3(e,"additionalItems",t);if(r.items=!0,(0,Up.alwaysValidSchema)(r,t))return;e.ok((0,Iq.validateArray)(e))}};function u3(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:h}=e;if(_(n),h.opts.unevaluated&&r.length&&h.items!==!0)h.items=Up.mergeEvaluated.items(i,r.length,h.items);let b=i.name("valid"),v=i.const("len",a3._`${o}.length`);r.forEach((g,S)=>{if((0,Up.alwaysValidSchema)(h,g))return;i.if(a3._`${v} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},b)),e.ok(b)});function _(g){let{opts:S,errSchemaPath:x}=h,M=r.length,$=M===g.minItems&&(M===g.maxItems||g[t]===!1);if(S.strictTuples&&!$){let I=`"${s}" is ${M}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;(0,Up.checkStrictMode)(h,I,S.strictTuples)}}}l3.validateTuple=u3;l3.default=Pq});var f3=Je((d3)=>{Object.defineProperty(d3,"__esModule",{value:!0});var Aq=Xb(),Rq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,Aq.validateTuple)(e,"items")};d3.default=Rq});var m3=Je((p3)=>{Object.defineProperty(p3,"__esModule",{value:!0});var h3=mt(),Oq=kt(),Dq=An(),Nq=Jb(),zq={message:({params:{len:e}})=>h3.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>h3._`{limit: ${e}}`},jq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:zq,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,(0,Oq.alwaysValidSchema)(i,t))return;if(n)(0,Nq.validateAdditionalItems)(e,n);else e.ok((0,Dq.validateArray)(e))}};p3.default=jq});var y3=Je((g3)=>{Object.defineProperty(g3,"__esModule",{value:!0});var Rn=mt(),Lp=kt(),Lq={message:({params:{min:e,max:t}})=>t===void 0?Rn.str`must contain at least ${e} valid item(s)`:Rn.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Rn._`{minContains: ${e}}`:Rn._`{minContains: ${e}, maxContains: ${t}}`},qq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Lq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,h,{minContains:b,maxContains:v}=i;if(o.opts.next)s=b===void 0?1:b,h=v;else s=1;let _=t.const("len",Rn._`${n}.length`);if(e.setParams({min:s,max:h}),h===void 0&&s===0){(0,Lp.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&s>h){(0,Lp.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Lp.alwaysValidSchema)(o,r)){let $=Rn._`${_} >= ${s}`;if(h!==void 0)$=Rn._`${$} && ${_} <= ${h}`;e.pass($);return}o.items=!0;let g=t.name("valid");if(h===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),h!==void 0)t.if(Rn._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let $=t.name("_valid"),I=t.let("count",0);x($,()=>t.if($,()=>M(I)))}function x($,I){t.forRange("i",0,_,(P)=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:Lp.Type.Num,compositeRule:!0},$),I()})}function M($){if(t.code(Rn._`${$}++`),h===void 0)t.if(Rn._`${$} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(Rn._`${$} > ${h}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(Rn._`${$} >= ${s}`,()=>t.assign(g,!0))}}};g3.default=qq});var x3=Je((_3)=>{Object.defineProperty(_3,"__esModule",{value:!0});_3.validateSchemaDeps=_3.validatePropertyDeps=_3.error=void 0;var Yb=mt(),Bq=kt(),vc=An();_3.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return Yb.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>Yb._`{property: ${e},
|
|
24
24
|
missingProperty: ${i},
|
|
25
25
|
depsCount: ${t},
|
|
26
|
-
deps: ${r}}`};var Hq={keyword:"dependencies",type:"object",schemaType:"object",error:_3.error,code(e){let[t,r]=Zq(e);v3(e,t),b3(e,r)}};function Zq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function v3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let b=(0,vc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(b,()=>{for(let v of h)(0,vc.checkReportMissingProp)(e,v)});else r.if(Yb._`${b} && (${(0,vc.checkMissingProp)(e,h,o)})`),(0,vc.reportMissingProp)(e,o),r.else()}}_3.validatePropertyDeps=v3;function b3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Bq.alwaysValidSchema)(o,t[h]))continue;r.if((0,vc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let b=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(b,s)},()=>r.var(s,!0)),e.ok(s)}}_3.validateSchemaDeps=b3;_3.default=Hq});var E3=Je((M3)=>{Object.defineProperty(M3,"__esModule",{value:!0});var k3=mt(),Wq=kt(),Gq={message:"property name must be valid",params:({params:e})=>k3._`{propertyName: ${e.propertyName}}`},Jq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Gq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Wq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,k3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};M3.default=Jq});var Qb=Je(($3)=>{Object.defineProperty($3,"__esModule",{value:!0});var qp=An(),Hn=mt(),Yq=ki(),Fp=kt(),Qq={message:"must NOT have additional properties",params:({params:e})=>Hn._`{additionalProperty: ${e.additionalProperty}}`},eF={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Qq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:b}=s;if(s.props=!0,b.removeAdditional!=="all"&&(0,Fp.alwaysValidSchema)(s,r))return;let v=(0,qp.allSchemaProperties)(i.properties),_=(0,qp.allSchemaProperties)(i.patternProperties);g(),e.ok(Hn._`${o} === ${Yq.default.errors}`);function g(){t.forIn("key",n,(I)=>{if(!v.length&&!_.length)M(I);else t.if(S(I),()=>M(I))})}function S(I){let P;if(v.length>8){let T=(0,Fp.schemaRefOrVal)(s,i.properties,"properties");P=(0,qp.isOwnProperty)(t,T,I)}else if(v.length)P=(0,Hn.or)(...v.map((T)=>Hn._`${I} === ${T}`));else P=Hn.nil;if(_.length)P=(0,Hn.or)(P,..._.map((T)=>Hn._`${(0,qp.usePattern)(e,T)}.test(${I})`));return(0,Hn.not)(P)}function x(I){t.code(Hn._`delete ${n}[${I}]`)}function M(I){if(b.removeAdditional==="all"||b.removeAdditional&&r===!1){x(I);return}if(r===!1){if(e.setParams({additionalProperty:I}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Fp.alwaysValidSchema)(s,r)){let P=t.name("valid");if(b.removeAdditional==="failing")$(I,P,!1),t.if((0,Hn.not)(P),()=>{e.reset(),x(I)});else if($(I,P),!h)t.if((0,Hn.not)(P),()=>t.break())}}function $(I,P,T){let R={keyword:"additionalProperties",dataProp:I,dataPropType:Fp.Type.Str};if(T===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,P)}}};$3.default=eF});var A3=Je((T3)=>{Object.defineProperty(T3,"__esModule",{value:!0});var rF=sc(),I3=An(),e_=kt(),P3=Qb(),nF={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)P3.default.code(new rF.KeywordCxt(o,P3.default,"additionalProperties"));let s=(0,I3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=e_.mergeEvaluated.props(t,(0,e_.toHash)(s),o.props);let h=s.filter((g)=>!(0,e_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let b=t.name("valid");for(let g of h){if(v(g))_(g);else{if(t.if((0,I3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(b,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(b)}function v(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},b)}}};T3.default=nF});var N3=Je((D3)=>{Object.defineProperty(D3,"__esModule",{value:!0});var R3=An(),Bp=mt(),C3=kt(),O3=kt(),oF={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,R3.allSchemaProperties)(r),b=h.filter(($)=>(0,C3.alwaysValidSchema)(o,r[$]));if(h.length===0||b.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let v=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Bp.Name))o.props=(0,O3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let $ of h){if(v)x($);if(o.allErrors)M($);else t.var(_,!0),M($),t.if(_)}}function x($){for(let I in v)if(new RegExp($).test(I))(0,C3.checkStrictMode)(o,`property ${I} matches pattern ${$} (use allowMatchingProperties)`)}function M($){t.forIn("key",i,(I)=>{t.if(Bp._`${(0,R3.usePattern)(e,$)}.test(${I})`,()=>{let P=b.includes($);if(!P)e.subschema({keyword:"patternProperties",schemaProp:$,dataProp:I,dataPropType:O3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Bp._`${g}[${I}]`,!0);else if(!P&&!o.allErrors)t.if((0,Bp.not)(_),()=>t.break())})})}}};D3.default=oF});var j3=Je((z3)=>{Object.defineProperty(z3,"__esModule",{value:!0});var aF=kt(),uF={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,aF.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};z3.default=uF});var L3=Je((U3)=>{Object.defineProperty(U3,"__esModule",{value:!0});var cF=An(),dF={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cF.validateUnion,error:{message:"must match a schema in anyOf"}};U3.default=dF});var F3=Je((q3)=>{Object.defineProperty(q3,"__esModule",{value:!0});var Hp=mt(),hF=kt(),pF={message:"must match exactly one schema in oneOf",params:({params:e})=>Hp._`{passingSchemas: ${e.passing}}`},mF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pF,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),b=t.name("_valid");e.setParams({passing:h}),t.block(v),e.result(s,()=>e.reset(),()=>e.error(!0));function v(){o.forEach((_,g)=>{let S;if((0,hF.alwaysValidSchema)(n,_))t.var(b,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},b);if(g>0)t.if(Hp._`${b} && ${s}`).assign(s,!1).assign(h,Hp._`[${h}, ${g}]`).else();t.if(b,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Hp.Name)})})}}};q3.default=mF});var H3=Je((B3)=>{Object.defineProperty(B3,"__esModule",{value:!0});var yF=kt(),vF={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,yF.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};B3.default=vF});var W3=Je((V3)=>{Object.defineProperty(V3,"__esModule",{value:!0});var Zp=mt(),K3=kt(),_F={message:({params:e})=>Zp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Zp._`{failingKeyword: ${e.ifClause}}`},wF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_F,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,K3.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=Z3(i,"then"),o=Z3(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(b(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,v("then",_),v("else",_))}else if(n)t.if(h,v("then"));else t.if((0,Zp.not)(h),v("else"));e.pass(s,()=>e.error(!0));function b(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function v(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Zp._`${_}`);else e.setParams({ifClause:_})}}}};function Z3(e,t){let r=e.schema[t];return r!==void 0&&!(0,K3.alwaysValidSchema)(e,r)}V3.default=wF});var J3=Je((G3)=>{Object.defineProperty(G3,"__esModule",{value:!0});var xF=kt(),kF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,xF.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};G3.default=kF});var Y3=Je((X3)=>{Object.defineProperty(X3,"__esModule",{value:!0});var EF=Jb(),$F=f3(),IF=Xb(),PF=m3(),TF=y3(),AF=x3(),RF=E3(),CF=Qb(),OF=A3(),DF=N3(),NF=j3(),zF=L3(),jF=F3(),UF=H3(),LF=W3(),qF=J3();function FF(e=!1){let t=[NF.default,zF.default,jF.default,UF.default,LF.default,qF.default,RF.default,CF.default,AF.default,OF.default,DF.default];if(e)t.push($F.default,PF.default);else t.push(EF.default,IF.default);return t.push(TF.default),t}X3.default=FF});var e8=Je((Q3)=>{Object.defineProperty(Q3,"__esModule",{value:!0});var nr=mt(),HF={message:({schemaCode:e})=>nr.str`must match format "${e}"`,params:({schemaCode:e})=>nr._`{format: ${e}}`},ZF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HF,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:b,errSchemaPath:v,schemaEnv:_,self:g}=h;if(!b.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:b.code.formats}),$=r.const("fDef",nr._`${M}[${s}]`),I=r.let("fType"),P=r.let("format");r.if(nr._`typeof ${$} == "object" && !(${$} instanceof RegExp)`,()=>r.assign(I,nr._`${$}.type || "string"`).assign(P,nr._`${$}.validate`),()=>r.assign(I,nr._`"string"`).assign(P,$)),e.fail$data((0,nr.or)(T(),R()));function T(){if(b.strictSchema===!1)return nr.nil;return nr._`${s} && !${P}`}function R(){let C=_.$async?nr._`(${$}.async ? await ${P}(${i}) : ${P}(${i}))`:nr._`${P}(${i})`,N=nr._`(typeof ${P} == "function" ? ${C} : ${P}.test(${i}))`;return nr._`${P} && ${P} !== true && ${I} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){T();return}if(M===!0)return;let[$,I,P]=R(M);if($===t)e.pass(C());function T(){if(b.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${v}"`}}function R(N){let B=N instanceof RegExp?(0,nr.regexpCode)(N):b.code.formats?nr._`${b.code.formats}${(0,nr.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,nr._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return nr._`await ${P}(${i})`}return typeof I=="function"?nr._`${P}(${i})`:nr._`${P}.test(${i})`}}}};Q3.default=ZF});var r8=Je((t8)=>{Object.defineProperty(t8,"__esModule",{value:!0});var VF=e8(),WF=[VF.default];t8.default=WF});var o8=Je((n8)=>{Object.defineProperty(n8,"__esModule",{value:!0});n8.contentVocabulary=n8.metadataVocabulary=void 0;n8.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];n8.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var u8=Je((a8)=>{Object.defineProperty(a8,"__esModule",{value:!0});var XF=T4(),YF=n3(),QF=Y3(),eB=r8(),s8=o8(),tB=[XF.default,YF.default,(0,QF.default)(),eB.default,s8.metadataVocabulary,s8.contentVocabulary];a8.default=tB});var f8=Je((c8)=>{Object.defineProperty(c8,"__esModule",{value:!0});c8.DiscrError=void 0;var l8;(function(e){e.Tag="tag",e.Mapping="mapping"})(l8||(c8.DiscrError=l8={}))});var m8=Je((p8)=>{Object.defineProperty(p8,"__esModule",{value:!0});var la=mt(),t_=f8(),h8=Ip(),nB=ac(),iB=kt(),oB={message:({params:{discrError:e,tagName:t}})=>e===t_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>la._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},sB={keyword:"discriminator",type:"object",schemaType:"object",error:oB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let b=t.let("valid",!1),v=t.const("tag",la._`${r}${(0,la.getProperty)(h)}`);t.if(la._`typeof ${v} == "string"`,()=>_(),()=>e.error(!1,{discrError:t_.DiscrError.Tag,tag:v,tagName:h})),e.ok(b);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(la._`${v} === ${M}`),t.assign(b,g(x[M]));t.else(),e.error(!1,{discrError:t_.DiscrError.Mapping,tag:v,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),$=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated($,la.Name),M}function S(){var x;let M={},$=P(n),I=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,iB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=h8.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof h8.SchemaEnv)N=N.schema;if(N===void 0)throw new nB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);I=I&&($||P(N)),T(B,C)}if(!I)throw Error(`discriminator: "${h}" must be required`);return M;function P({required:C}){return Array.isArray(C)&&C.includes(h)}function T(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};p8.default=sB});var g8=Je((Eue,uB)=>{uB.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}});var n_=Je((an,r_)=>{Object.defineProperty(an,"__esModule",{value:!0});an.MissingRefError=an.ValidationError=an.CodeGen=an.Name=an.nil=an.stringify=an.str=an._=an.KeywordCxt=an.Ajv=void 0;var lB=_4(),cB=u8(),dB=m8(),y8=g8(),fB=["/properties"],Kp="http://json-schema.org/draft-07/schema";class bc extends lB.default{_addVocabularies(){if(super._addVocabularies(),cB.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(dB.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(y8,fB):y8;this.addMetaSchema(e,Kp,!1),this.refs["http://json-schema.org/schema"]=Kp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kp)?Kp:void 0)}}an.Ajv=bc;r_.exports=an=bc;r_.exports.Ajv=bc;Object.defineProperty(an,"__esModule",{value:!0});an.default=bc;var hB=sc();Object.defineProperty(an,"KeywordCxt",{enumerable:!0,get:function(){return hB.KeywordCxt}});var ca=mt();Object.defineProperty(an,"_",{enumerable:!0,get:function(){return ca._}});Object.defineProperty(an,"str",{enumerable:!0,get:function(){return ca.str}});Object.defineProperty(an,"stringify",{enumerable:!0,get:function(){return ca.stringify}});Object.defineProperty(an,"nil",{enumerable:!0,get:function(){return ca.nil}});Object.defineProperty(an,"Name",{enumerable:!0,get:function(){return ca.Name}});Object.defineProperty(an,"CodeGen",{enumerable:!0,get:function(){return ca.CodeGen}});var pB=Ep();Object.defineProperty(an,"ValidationError",{enumerable:!0,get:function(){return pB.default}});var mB=ac();Object.defineProperty(an,"MissingRefError",{enumerable:!0,get:function(){return mB.default}})});var $8=Je((M8)=>{Object.defineProperty(M8,"__esModule",{value:!0});M8.formatNames=M8.fastFormats=M8.fullFormats=void 0;function ti(e,t){return{validate:e,compare:t}}M8.fullFormats={date:ti(w8,a_),time:ti(o_(!0),u_),"date-time":ti(v8(!0),x8),"iso-time":ti(o_(),S8),"iso-date-time":ti(v8(),k8),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xB,"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:TB,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:kB,int32:{type:"number",validate:$B},int64:{type:"number",validate:IB},float:{type:"number",validate:_8},double:{type:"number",validate:_8},password:!0,binary:!0};M8.fastFormats={...M8.fullFormats,date:ti(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a_),time:ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u_),"date-time":ti(/^\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,x8),"iso-time":ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,S8),"iso-date-time":ti(/^\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,k8),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};M8.formatNames=Object.keys(M8.fullFormats);function vB(e){return e%4===0&&(e%100!==0||e%400===0)}var bB=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_B=[0,31,28,31,30,31,30,31,31,30,31,30,31];function w8(e){let t=bB.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&vB(r)?29:_B[i])}function a_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var i_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function o_(e){return function(r){let i=i_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],b=i[5]==="-"?-1:1,v=+(i[6]||0),_=+(i[7]||0);if(v>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*b,S=n-v*b-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function u_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function S8(e,t){if(!(e&&t))return;let r=i_.exec(e),i=i_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var s_=/t|\s/i;function v8(e){let t=o_(e);return function(i){let n=i.split(s_);return n.length===2&&w8(n[0])&&t(n[1])}}function x8(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function k8(e,t){if(!(e&&t))return;let[r,i]=e.split(s_),[n,o]=t.split(s_),s=a_(r,n);if(s===void 0)return;return s||u_(i,o)}var wB=/\/|:/,SB=/^(?:[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 xB(e){return wB.test(e)&&SB.test(e)}var b8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function kB(e){return b8.lastIndex=0,b8.test(e)}var MB=-2147483648,EB=2147483647;function $B(e){return Number.isInteger(e)&&e<=EB&&e>=MB}function IB(e){return Number.isInteger(e)}function _8(){return!0}var PB=/[^\\]\\Z/;function TB(e){if(PB.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var P8=Je((I8)=>{Object.defineProperty(I8,"__esModule",{value:!0});I8.formatLimitDefinition=void 0;var RB=n_(),Zn=mt(),so=Zn.operators,Vp={formatMaximum:{okStr:"<=",ok:so.LTE,fail:so.GT},formatMinimum:{okStr:">=",ok:so.GTE,fail:so.LT},formatExclusiveMaximum:{okStr:"<",ok:so.LT,fail:so.GTE},formatExclusiveMinimum:{okStr:">",ok:so.GT,fail:so.LTE}},CB={message:({keyword:e,schemaCode:t})=>Zn.str`should be ${Vp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Zn._`{comparison: ${Vp[e].okStr}, limit: ${t}}`};I8.formatLimitDefinition={keyword:Object.keys(Vp),type:"string",schemaType:"string",$data:!0,error:CB,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let b=new RB.KeywordCxt(o,h.RULES.all.format.definition,"format");if(b.$data)v();else _();function v(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Zn._`${S}[${b.schemaCode}]`);e.fail$data((0,Zn.or)(Zn._`typeof ${x} != "object"`,Zn._`${x} instanceof RegExp`,Zn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=b.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Zn._`${s.code.formats}${(0,Zn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Zn._`${S}.compare(${r}, ${i}) ${Vp[n].fail} 0`}},dependencies:["format"]};var OB=(e)=>(e.addKeyword(I8.formatLimitDefinition),e);I8.default=OB});var C8=Je((_c,R8)=>{Object.defineProperty(_c,"__esModule",{value:!0});var da=$8(),NB=P8(),d_=mt(),T8=new d_.Name("fullFormats"),zB=new d_.Name("fastFormats"),f_=(e,t={keywords:!0})=>{if(Array.isArray(t))return A8(e,t,da.fullFormats,T8),e;let[r,i]=t.mode==="fast"?[da.fastFormats,zB]:[da.fullFormats,T8],n=t.formats||da.formatNames;if(A8(e,n,r,i),t.keywords)(0,NB.default)(e);return e};f_.get=(e,t="full")=>{let i=(t==="fast"?da.fastFormats:da.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function A8(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=d_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}R8.exports=_c=f_;Object.defineProperty(_c,"__esModule",{value:!0});_c.default=f_});class Kn extends Error{}function E_(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,b,v)=>{h?.removeEventListener("abort",b),v()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{closeSync:wQ,writeFileSync:SQ,fsyncSync:xQ,openSync:kQ}=(()=>({}));function tE(){this.__data__=[],this.size=0}var $_=tE;function rE(e,t){return e===t||e!==e&&t!==t}var I_=rE;function nE(e,t){var r=e.length;while(r--)if(I_(e[r][0],t))return r;return-1}var Ii=nE;var iE=Array.prototype,oE=iE.splice;function sE(e){var t=this.__data__,r=Ii(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else oE.call(t,r,1);return--this.size,!0}var P_=sE;function aE(e){var t=this.__data__,r=Ii(t,e);return r<0?void 0:t[r][1]}var T_=aE;function uE(e){return Ii(this.__data__,e)>-1}var A_=uE;function lE(e,t){var r=this.__data__,i=Ii(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var R_=lE;function Jo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Jo.prototype.clear=$_;Jo.prototype.delete=P_;Jo.prototype.get=T_;Jo.prototype.has=A_;Jo.prototype.set=R_;var C_=Jo;var cE=typeof global=="object"&&global&&global.Object===Object&&global,O_=cE;var dE=typeof self=="object"&&self&&self.Object===Object&&self,fE=O_||dE||Function("return this")(),Xo=fE;var hE=Xo.Symbol,Yo=hE;var D_=Object.prototype,pE=D_.hasOwnProperty,mE=D_.toString,pa=Yo?Yo.toStringTag:void 0;function gE(e){var t=pE.call(e,pa),r=e[pa];try{e[pa]=void 0;var i=!0}catch(o){}var n=mE.call(e);if(i)if(t)e[pa]=r;else delete e[pa];return n}var N_=gE;var yE=Object.prototype,vE=yE.toString;function bE(e){return vE.call(e)}var z_=bE;var _E="[object Null]",wE="[object Undefined]",j_=Yo?Yo.toStringTag:void 0;function SE(e){if(e==null)return e===void 0?wE:_E;return j_&&j_ in Object(e)?N_(e):z_(e)}var U_=SE;function xE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Sc=xE;var kE="[object AsyncFunction]",ME="[object Function]",EE="[object GeneratorFunction]",$E="[object Proxy]";function IE(e){if(!Sc(e))return!1;var t=U_(e);return t==ME||t==EE||t==kE||t==$E}var L_=IE;var PE=Xo["__core-js_shared__"],xc=PE;var q_=function(){var e=/[^.]+$/.exec(xc&&xc.keys&&xc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function TE(e){return!!q_&&q_ in e}var F_=TE;var AE=Function.prototype,RE=AE.toString;function CE(e){if(e!=null){try{return RE.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var B_=CE;var OE=/[\\^$.*+?()[\]{}|]/g,DE=/^\[object .+?Constructor\]$/,NE=Function.prototype,zE=Object.prototype,jE=NE.toString,UE=zE.hasOwnProperty,LE=RegExp("^"+jE.call(UE).replace(OE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qE(e){if(!Sc(e)||F_(e))return!1;var t=L_(e)?LE:DE;return t.test(B_(e))}var H_=qE;function FE(e,t){return e==null?void 0:e[t]}var Z_=FE;function BE(e,t){var r=Z_(e,t);return H_(r)?r:void 0}var kc=BE;var HE=kc(Xo,"Map"),K_=HE;var ZE=kc(Object,"create"),ri=ZE;function KE(){this.__data__=ri?ri(null):{},this.size=0}var V_=KE;function VE(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var W_=VE;var WE="__lodash_hash_undefined__",GE=Object.prototype,JE=GE.hasOwnProperty;function XE(e){var t=this.__data__;if(ri){var r=t[e];return r===WE?void 0:r}return JE.call(t,e)?t[e]:void 0}var G_=XE;var YE=Object.prototype,QE=YE.hasOwnProperty;function e$(e){var t=this.__data__;return ri?t[e]!==void 0:QE.call(t,e)}var J_=e$;var t$="__lodash_hash_undefined__";function r$(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ri&&t===void 0?t$:t,this}var X_=r$;function Qo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Qo.prototype.clear=V_;Qo.prototype.delete=W_;Qo.prototype.get=G_;Qo.prototype.has=J_;Qo.prototype.set=X_;var Xp=Qo;function n$(){this.size=0,this.__data__={hash:new Xp,map:new(K_||C_),string:new Xp}}var Y_=n$;function i$(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Q_=i$;function o$(e,t){var r=e.__data__;return Q_(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Pi=o$;function s$(e){var t=Pi(this,e).delete(e);return this.size-=t?1:0,t}var e1=s$;function a$(e){return Pi(this,e).get(e)}var t1=a$;function u$(e){return Pi(this,e).has(e)}var r1=u$;function l$(e,t){var r=Pi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var n1=l$;function es(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}es.prototype.clear=Y_;es.prototype.delete=e1;es.prototype.get=t1;es.prototype.has=r1;es.prototype.set=n1;var Yp=es;var{realpathSync:Fw}=(()=>({}));var c$="Expected a function";function Qp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(c$);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Qp.Cache||Yp),r}Qp.Cache=Yp;var bn=Qp;var i1=function(){return"/"};var ma=()=>globalThis.crypto.randomUUID();Hr();Hr();var zw="[\\w-]{1,63}",i9=new RegExp(`^${zw}$`),QZ=new RegExp(`^a(?:${zw}-)?[0-9a-f]{16}$`);function jw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Dm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var o9="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Uw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?jw(e,o9):null}var Lw=globalThis.process?.getBuiltinModule?.("async_hooks"),Nm=Lw?(e)=>Lw.AsyncResource.bind(e):(e)=>e;function mo(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 Oi(){let e=new Set;return{subscribe(t){let r=Nm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function qw(){return{sent:new Set,rejected:new Set}}var a9={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function u9(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof Fw==="function"){let r=i1();try{e=Bw(Fw(r))}catch{e=Bw(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),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,modelStrings:null,isInteractive:!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:Uw()??ma(),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,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:a9,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:qw(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var l9=u9(),c9=()=>{return};function zm(){return c9()?.sessionId??l9.sessionId}var d9=Oi(),NK=d9.subscribe;function Bw(e){return process.platform==="darwin"?e.normalize("NFC"):e}var f9=Oi(),zK=f9.subscribe;var h9=Oi(),jK=h9.subscribe;var p9=Oi();var UK=p9.subscribe;var m9=Oi();var LK=m9.subscribe;var{appendFile:S2,mkdir:HA,rename:x2,stat:ZA,symlink:KA,unlink:$0}=(()=>({}));Cn();function Xw({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,b=null;function v(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(b)_(b.join("")),b=null;if(o.length===0)return;_(o.join("")),o=[],s=0,v()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(b){b.push(...o),o=[],s=0,v();return}let M=o;o=[],s=0,v(),b=M,setImmediate(()=>{let $=b;if(b=null,$)_($.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:ZK}=(()=>({}));var Fc=function(){return"/"};Cn();function Qw(e){return process.platform==="darwin"?e.normalize("NFC"):e}function eS(e){return/^[\\/]{2}/.test(e)}function tS(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function v9(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function rS(e){if(/^\\\\\?\\volume\{/i.test(e))return Yw(e);let t=v9(e);if(t!==e&&Yw(t))return!0;return eS(t)&&!tS(t)}function Yw(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function b9(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class nS{#e=new Set;register(e){let t=b9(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var _9=new nS;function iS(e){return _9.register(e)}var oS=bn((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function w9(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function S9(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function sS(e,t){if(!t)return!0;let r=w9(e);return S9(r,t)}Cn();var aS=bn(()=>(process.env.CLAUDE_CONFIG_DIR??Xn(Fc(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR);var rV=bn(()=>mo(process.env.CLAUDE_CODE_SUPERVISED));function Ve(e,t,r,i,n){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function oe(e,t,r,i){if(r==="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 r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)}var Fm=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Fm=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^r()&15>>+i/4).toString(16))};function ai(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Pa=(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}:{});if(e.stack)t.stack=e.stack;if(e.cause&&!t.cause)t.cause=e.cause;if(e.name)t.name=e.name;return t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};class Xe extends Error{}class br extends Xe{constructor(e,t,r,i,n){super(`${br.makeMessage(e,t,r)}`);this.status=e,this.headers=i,this.requestID=i?.get("request-id"),this.error=t,this.type=n??null}static makeMessage(e,t,r){let i=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;if(e&&i)return`${e} ${i}`;if(e)return`${e} status code (no body)`;if(i)return i;return"(no status code or body)"}static generate(e,t,r,i){if(!e||!i)return new vo({message:r,cause:Pa(t)});let n=t,o=n?.error?.type;if(e===400)return new Aa(e,n,r,i,o);if(e===401)return new Ra(e,n,r,i,o);if(e===403)return new Ca(e,n,r,i,o);if(e===404)return new Oa(e,n,r,i,o);if(e===409)return new Da(e,n,r,i,o);if(e===422)return new Na(e,n,r,i,o);if(e===429)return new za(e,n,r,i,o);if(e>=500)return new ja(e,n,r,i,o);return new br(e,n,r,i,o)}}class Tr extends br{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class vo extends br{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}}class Ta extends vo{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Aa extends br{}class Ra extends br{}class Ca extends br{}class Oa extends br{}class Da extends br{}class Na extends br{}class za extends br{}class ja extends br{}var k9=/^[a-z][a-z0-9+.-]*:/i,uS=(e)=>k9.test(e),Bm=(e)=>(Bm=Array.isArray,Bm(e)),Hm=Bm;function Bc(e){if(typeof e!=="object")return{};return e??{}}function Zm(e){if(!e)return!0;for(let t in e)return!1;return!0}function lS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var cS=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new Xe(`${e} must be an integer`);if(t<0)throw new Xe(`${e} must be a positive integer`);return t};var Hc=(e)=>{try{return JSON.parse(e)}catch(t){return}};var dS=(e)=>new Promise((t)=>setTimeout(t,e));var Sn="0.94.0";var mS=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function M9(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var E9=()=>{let e=M9();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":hS(Deno.build.os),"X-Stainless-Arch":fS(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":Sn,"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":Sn,"X-Stainless-OS":hS(globalThis.process.platform??"unknown"),"X-Stainless-Arch":fS(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=$9();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function $9(){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:r}of e){let i=r.exec(navigator.userAgent);if(i){let n=i[1]||0,o=i[2]||0,s=i[3]||0;return{browser:t,version:`${n}.${o}.${s}`}}}return null}var fS=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},hS=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},pS,Ua=()=>pS??(pS=E9());function gS(){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 Km(...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 Zc(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Km({start(){},async pull(r){let{done:i,value:n}=await t.next();if(i)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function La(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function yS(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var vS=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});function bS(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new Xe(`Cannot stringify type ${typeof r}; 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("&")}var wS="urn:ietf:params:oauth:grant-type:jwt-bearer",SS="refresh_token",Kc="/v1/oauth/token",bo="oauth-2025-04-20",xS="oidc-federation-2026-04-01",kS=120,ss=30,MS=5,_S=1048576;function Vc(e){if(!e)return;let t;try{t=new URL(e)}catch(i){throw new At(`Invalid token endpoint base URL "${e}": ${i}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new At(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Wc(e,t){let r=await A9(e),i;try{i=JSON.parse(r)}catch{throw new At(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,Yr(r),t)}if(!i.access_token)throw new At(`Token endpoint response missing access_token: ${JSON.stringify(Yr(i))}`,e.status,Yr(i),t);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new At(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,e.status,Yr(i),t);return i}var Vm=2000,T9=new Set(["error","error_description","error_uri"]);function Yr(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=Vm)return e;return e.slice(0,Vm)+`... <${e.length-Vm} more chars>`}return JSON.stringify(Yr(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,i]of Object.entries(e))if(T9.has(r))t[r]=i;return t}return null}async function Gc(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),i=e,n;try{i=await r.promises.realpath(e),n=await r.promises.stat(i)}catch{return}let o=n.mode&511;if(o&18)throw new At(`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 At(`Credentials file at ${i} is group/world-readable (mode 0o${o.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${i} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Jc(e,t){let r=await import("node:fs"),n=(await Promise.resolve().then(() => (Cn(),yo))).dirname(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let o=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(o,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(o,e)}catch(s){throw await r.promises.unlink(o).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function A9(e){if(!e.body)return"";let t=e.body.getReader(),r=[],i=0;for(;;){let{done:o,value:s}=await t.read();if(o)break;if(i+s.length>_S){let h=_S-i;if(h>0)r.push(s.subarray(0,h));await t.cancel();break}r.push(s),i+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,h)=>s+h.length,0));let o=0;for(let s of r)n.set(s,o),o+=s.length}return new TextDecoder("utf-8").decode(n)}class At extends Xe{constructor(e,t=null,r=null,i=null){super(e);this.statusCode=t,this.body=r,this.requestId=i}}function On(){return Math.floor(Date.now()/1000)}class Wm{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let r=t.expiresAt-On();if(r>kS)return t.token;if(r>ss)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(On()-this.lastAdvisoryError<MS)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=On(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var Pt=(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;return};function IS(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),i=0;for(let n of e)r.set(n,i),i+=n.length;return r}var ES;function as(e){let t;return(ES??(t=new globalThis.TextEncoder,ES=t.encode.bind(t)))(e)}var $S;function Gm(e){let t;return($S??(t=new globalThis.TextDecoder,$S=t.decode.bind(t)))(e)}var Yc={off:0,error:200,warn:300,info:400,debug:500},Jm=(e,t,r)=>{if(!e)return;if(lS(Yc,e))return e;tr(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Yc))}`);return};function qa(){}function Xc(e,t,r){if(!t||Yc[e]>Yc[r])return qa;else return t[e].bind(t)}var R9={error:qa,warn:qa,info:qa,debug:qa},PS=new WeakMap;function tr(e){let t=e.logger,r=e.logLevel??"off";if(!t)return R9;let i=PS.get(t);if(i&&i[0]===r)return i[1];let n={error:Xc("error",t,r),warn:Xc("warn",t,r),info:Xc("info",t,r),debug:Xc("debug",t,r)};return PS.set(t,[r,n]),n}var ui=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Qc="1.0",C9=/^[A-Za-z0-9_.-]+$/;function TS(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(!C9.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var AS=async(e)=>{var t,r;let i=await Xm();if(i===null)return null;let n=e??await CS();if(n===null)return null;TS(n);let o=await import("node:fs"),h=(await Promise.resolve().then(() => (Cn(),yo))).join(i,"configs",`${n}.json`),b;try{b=await o.promises.readFile(h,"utf-8")}catch(g){if(g?.code!=="ENOENT")throw Error(`failed to read config file ${h}: ${g}`);b=null}if(b===null){let g=Pt("ANTHROPIC_ORGANIZATION_ID"),S=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE"),x=Pt("ANTHROPIC_FEDERATION_RULE_ID");if(x&&g)return{fromFile:!1,config:{organization_id:g,workspace_id:Pt("ANTHROPIC_WORKSPACE_ID"),base_url:Pt("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:x,service_account_id:Pt("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:S?{source:"file",path:S}:void 0,scope:Pt("ANTHROPIC_SCOPE")}}};return null}let v;try{v=JSON.parse(b)}catch(g){throw Error(`failed to parse config file ${h}: ${g}`)}if(!v.authentication)throw Error(`config file ${h} is missing "authentication"`);let _=v.authentication.type;if(_!=="oidc_federation"&&_!=="user_oauth")throw Error(`authentication.type "${_}" is not a known authentication type`);if(v.organization_id??(v.organization_id=Pt("ANTHROPIC_ORGANIZATION_ID")),v.workspace_id??(v.workspace_id=Pt("ANTHROPIC_WORKSPACE_ID")),v.base_url??(v.base_url=Pt("ANTHROPIC_BASE_URL")),(t=v.authentication).scope??(t.scope=Pt("ANTHROPIC_SCOPE")),v.authentication.type==="oidc_federation"){if(!v.authentication.identity_token){let g=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(g)v.authentication.identity_token={source:"file",path:g}}if(!v.authentication.federation_rule_id)v.authentication.federation_rule_id=Pt("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=v.authentication).service_account_id??(r.service_account_id=Pt("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:v,fromFile:!0}};var RS=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await Xm();if(!r)return null;let i=t??await CS();if(!i)return null;return TS(i),(await Promise.resolve().then(() => (Cn(),yo))).join(r,"credentials",`${i}.json`)},Xm=async()=>{if(!O9())return null;let e=await Promise.resolve().then(() => (Cn(),yo)),t=Pt("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Ua()["X-Stainless-OS"]==="Windows"){let o=Pt("APPDATA");if(o)return e.join(o,"Anthropic");let s=Pt("USERPROFILE");if(s)return e.join(s,"AppData","Roaming","Anthropic");return null}let i=Pt("XDG_CONFIG_HOME");if(i)return e.join(i,"anthropic");let n=Pt("HOME");if(n)return e.join(n,".config","anthropic");return null},O9=()=>{let e=Ua()["X-Stainless-Runtime"];return e==="node"||e==="deno"},CS=async()=>{let e=await Xm();if(!e)return null;let t=Pt("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),n=(await Promise.resolve().then(() => (Cn(),yo))).join(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(o){if(o?.code!=="ENOENT")throw Error(`failed to read ${n}: ${o}`);return"default"}};function Ym(e){if(!e)throw new Xe("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new Xe(`Failed to read identity token file at ${e}: ${n}`)}let i=r.trim();if(!i)throw new Xe(`Identity token file at ${e} is empty`);return i}}function OS(e){if(!e)throw new Xe("Identity token value is empty");return()=>e}function DS(e){return async()=>{Vc(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new At(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:wS,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let i=`${e.baseURL}${Kc}`,n;try{n=await e.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${bo},${xS}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Sn} oidcFederationProvider`},body:JSON.stringify(r)})}catch(b){throw new At(`Failed to reach token endpoint ${i}: ${b}`)}let o=n.headers.get("Request-Id");if(!n.ok){let b=await n.text().catch(()=>""),v=Yr(b),_="";if(n.status===401)_=` 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.`;throw new At(`Token exchange failed with status ${n.status}${o?` (request-id ${o})`:""}: ${v}${_}`,n.status,v,o)}let s=await Wc(n,o),h=Number(s.expires_in);if(!Number.isFinite(h))throw new At(`Token endpoint response missing required fields: ${JSON.stringify(Yr(s))}`,n.status,Yr(s),o);return{token:s.access_token,expiresAt:On()+h}}}function NS(e){return async(t)=>{let r=await import("node:fs");await Gc(e.credentialsPath,e.onSafetyWarning);let i;try{i=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(I){throw new At(`Credentials file not found at ${e.credentialsPath}: ${I}`)}let n;try{n=JSON.parse(i)}catch(I){throw new At(`Credentials file at ${e.credentialsPath} is not valid JSON: ${I}`)}let o=n.access_token;if(!o)throw new At(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||On()<s-ss))return{token:o,expiresAt:s??null};let h=n.refresh_token;if(!e.clientId||!h)throw new At(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${h?"set":"empty"})`);Vc(e.baseURL);let b={grant_type:SS,refresh_token:h,client_id:e.clientId},v=`${e.baseURL}${Kc}`,_;try{_=await e.fetch(v,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":bo,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Sn} userOAuthProvider`},body:JSON.stringify(b)})}catch(I){throw new At(`User OAuth refresh failed to reach token endpoint: ${I}`)}let g=_.headers.get("Request-Id");if(!_.ok){let I=await _.text().catch(()=>"");throw new At(`User OAuth refresh failed (HTTP ${_.status}): ${Yr(I)}`,_.status,Yr(I),g)}let S=await Wc(_,g),x=Number(S.expires_in);if(!Number.isFinite(x))throw new At(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Yr(S))}`,_.status,Yr(S),g);let M=On()+x,$=S.refresh_token||h;return await Jc(e.credentialsPath,{...n,version:Qc,type:"oauth_token",access_token:S.access_token,expires_at:M,refresh_token:$}),{token:S.access_token,expiresAt:M}}}function Qm(e,t){let r=e.authentication.credentials_path??null,i=(e.base_url||t.baseURL).replace(/\/+$/,""),n=D9(e,r,i,t),o={};if(e.workspace_id&&e.authentication.type==="user_oauth")o["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:o,baseURL:e.base_url||void 0}}async function zS(e,t){let r=await AS(t);if(!r)return null;let{config:i,fromFile:n}=r,o=i.authentication.credentials_path||!n?i:{...i,authentication:{...i.authentication,credentials_path:await RS(i,t)??void 0}};return Qm(o,e)}function D9(e,t,r,i){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,o=N9(n);if(!o)throw new At("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new At("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 At("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=DS({identityTokenProvider:o,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent});if(t)return z9(s,t,i.onCacheWriteError,i.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new At("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return NS({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let n=e.authentication.type;throw new At(`authentication.type "${n}" is not a known authentication type`)}}}function N9(e){if(e.identity_token){let i=e.identity_token.source;if(i!=="file")throw new At(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new At('identity_token.source "file" requires a non-empty path');return Ym(e.identity_token.path)}let t=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return Ym(t);let r=Pt("ANTHROPIC_IDENTITY_TOKEN");if(r)return OS(r);return null}function z9(e,t,r,i){return async(n)=>{let o=await import("node:fs");await Gc(t,i);let s;try{let b=await o.promises.readFile(t,"utf-8");s=JSON.parse(b);let v=s?.access_token;if(v&&!n?.forceRefresh){let _=s?.expires_at;if(_==null||On()<_-ss)return{token:v,expiresAt:_??null}}}catch(b){if(b?.code!=="ENOENT"&&!(b instanceof SyntaxError))r?.(b)}let h=await e(n);try{await Jc(t,{...s??{},version:Qc,type:"oauth_token",access_token:h.token,expires_at:h.expiresAt})}catch(b){r?.(b)}return h}}var cn,dn;class Ni{constructor(){cn.set(this,void 0),dn.set(this,void 0),Ve(this,cn,new Uint8Array,"f"),Ve(this,dn,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?as(e):e;Ve(this,cn,IS([oe(this,cn,"f"),t]),"f");let r=[],i;while((i=j9(oe(this,cn,"f"),oe(this,dn,"f")))!=null){if(i.carriage&&oe(this,dn,"f")==null){Ve(this,dn,i.index,"f");continue}if(oe(this,dn,"f")!=null&&(i.index!==oe(this,dn,"f")+1||i.carriage)){r.push(Gm(oe(this,cn,"f").subarray(0,oe(this,dn,"f")-1))),Ve(this,cn,oe(this,cn,"f").subarray(oe(this,dn,"f")),"f"),Ve(this,dn,null,"f");continue}let n=oe(this,dn,"f")!==null?i.preceding-1:i.preceding,o=Gm(oe(this,cn,"f").subarray(0,n));r.push(o),Ve(this,cn,oe(this,cn,"f").subarray(i.index),"f"),Ve(this,dn,null,"f")}return r}flush(){if(!oe(this,cn,"f").length)return[];return this.decode(`
|
|
26
|
+
deps: ${r}}`};var Hq={keyword:"dependencies",type:"object",schemaType:"object",error:_3.error,code(e){let[t,r]=Zq(e);v3(e,t),b3(e,r)}};function Zq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function v3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let b=(0,vc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(b,()=>{for(let v of h)(0,vc.checkReportMissingProp)(e,v)});else r.if(Yb._`${b} && (${(0,vc.checkMissingProp)(e,h,o)})`),(0,vc.reportMissingProp)(e,o),r.else()}}_3.validatePropertyDeps=v3;function b3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Bq.alwaysValidSchema)(o,t[h]))continue;r.if((0,vc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let b=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(b,s)},()=>r.var(s,!0)),e.ok(s)}}_3.validateSchemaDeps=b3;_3.default=Hq});var E3=Je((M3)=>{Object.defineProperty(M3,"__esModule",{value:!0});var k3=mt(),Wq=kt(),Gq={message:"property name must be valid",params:({params:e})=>k3._`{propertyName: ${e.propertyName}}`},Jq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Gq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Wq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,k3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};M3.default=Jq});var Qb=Je(($3)=>{Object.defineProperty($3,"__esModule",{value:!0});var qp=An(),Hn=mt(),Yq=ki(),Fp=kt(),Qq={message:"must NOT have additional properties",params:({params:e})=>Hn._`{additionalProperty: ${e.additionalProperty}}`},eF={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Qq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:b}=s;if(s.props=!0,b.removeAdditional!=="all"&&(0,Fp.alwaysValidSchema)(s,r))return;let v=(0,qp.allSchemaProperties)(i.properties),_=(0,qp.allSchemaProperties)(i.patternProperties);g(),e.ok(Hn._`${o} === ${Yq.default.errors}`);function g(){t.forIn("key",n,(I)=>{if(!v.length&&!_.length)M(I);else t.if(S(I),()=>M(I))})}function S(I){let P;if(v.length>8){let T=(0,Fp.schemaRefOrVal)(s,i.properties,"properties");P=(0,qp.isOwnProperty)(t,T,I)}else if(v.length)P=(0,Hn.or)(...v.map((T)=>Hn._`${I} === ${T}`));else P=Hn.nil;if(_.length)P=(0,Hn.or)(P,..._.map((T)=>Hn._`${(0,qp.usePattern)(e,T)}.test(${I})`));return(0,Hn.not)(P)}function x(I){t.code(Hn._`delete ${n}[${I}]`)}function M(I){if(b.removeAdditional==="all"||b.removeAdditional&&r===!1){x(I);return}if(r===!1){if(e.setParams({additionalProperty:I}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Fp.alwaysValidSchema)(s,r)){let P=t.name("valid");if(b.removeAdditional==="failing")$(I,P,!1),t.if((0,Hn.not)(P),()=>{e.reset(),x(I)});else if($(I,P),!h)t.if((0,Hn.not)(P),()=>t.break())}}function $(I,P,T){let R={keyword:"additionalProperties",dataProp:I,dataPropType:Fp.Type.Str};if(T===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,P)}}};$3.default=eF});var A3=Je((T3)=>{Object.defineProperty(T3,"__esModule",{value:!0});var rF=sc(),I3=An(),e_=kt(),P3=Qb(),nF={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)P3.default.code(new rF.KeywordCxt(o,P3.default,"additionalProperties"));let s=(0,I3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=e_.mergeEvaluated.props(t,(0,e_.toHash)(s),o.props);let h=s.filter((g)=>!(0,e_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let b=t.name("valid");for(let g of h){if(v(g))_(g);else{if(t.if((0,I3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(b,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(b)}function v(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},b)}}};T3.default=nF});var N3=Je((D3)=>{Object.defineProperty(D3,"__esModule",{value:!0});var R3=An(),Bp=mt(),C3=kt(),O3=kt(),oF={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,R3.allSchemaProperties)(r),b=h.filter(($)=>(0,C3.alwaysValidSchema)(o,r[$]));if(h.length===0||b.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let v=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Bp.Name))o.props=(0,O3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let $ of h){if(v)x($);if(o.allErrors)M($);else t.var(_,!0),M($),t.if(_)}}function x($){for(let I in v)if(new RegExp($).test(I))(0,C3.checkStrictMode)(o,`property ${I} matches pattern ${$} (use allowMatchingProperties)`)}function M($){t.forIn("key",i,(I)=>{t.if(Bp._`${(0,R3.usePattern)(e,$)}.test(${I})`,()=>{let P=b.includes($);if(!P)e.subschema({keyword:"patternProperties",schemaProp:$,dataProp:I,dataPropType:O3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Bp._`${g}[${I}]`,!0);else if(!P&&!o.allErrors)t.if((0,Bp.not)(_),()=>t.break())})})}}};D3.default=oF});var j3=Je((z3)=>{Object.defineProperty(z3,"__esModule",{value:!0});var aF=kt(),uF={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,aF.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};z3.default=uF});var L3=Je((U3)=>{Object.defineProperty(U3,"__esModule",{value:!0});var cF=An(),dF={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cF.validateUnion,error:{message:"must match a schema in anyOf"}};U3.default=dF});var F3=Je((q3)=>{Object.defineProperty(q3,"__esModule",{value:!0});var Hp=mt(),hF=kt(),pF={message:"must match exactly one schema in oneOf",params:({params:e})=>Hp._`{passingSchemas: ${e.passing}}`},mF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pF,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),b=t.name("_valid");e.setParams({passing:h}),t.block(v),e.result(s,()=>e.reset(),()=>e.error(!0));function v(){o.forEach((_,g)=>{let S;if((0,hF.alwaysValidSchema)(n,_))t.var(b,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},b);if(g>0)t.if(Hp._`${b} && ${s}`).assign(s,!1).assign(h,Hp._`[${h}, ${g}]`).else();t.if(b,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Hp.Name)})})}}};q3.default=mF});var H3=Je((B3)=>{Object.defineProperty(B3,"__esModule",{value:!0});var yF=kt(),vF={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,yF.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};B3.default=vF});var W3=Je((V3)=>{Object.defineProperty(V3,"__esModule",{value:!0});var Zp=mt(),K3=kt(),_F={message:({params:e})=>Zp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Zp._`{failingKeyword: ${e.ifClause}}`},wF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_F,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,K3.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=Z3(i,"then"),o=Z3(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(b(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,v("then",_),v("else",_))}else if(n)t.if(h,v("then"));else t.if((0,Zp.not)(h),v("else"));e.pass(s,()=>e.error(!0));function b(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function v(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Zp._`${_}`);else e.setParams({ifClause:_})}}}};function Z3(e,t){let r=e.schema[t];return r!==void 0&&!(0,K3.alwaysValidSchema)(e,r)}V3.default=wF});var J3=Je((G3)=>{Object.defineProperty(G3,"__esModule",{value:!0});var xF=kt(),kF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,xF.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};G3.default=kF});var Y3=Je((X3)=>{Object.defineProperty(X3,"__esModule",{value:!0});var EF=Jb(),$F=f3(),IF=Xb(),PF=m3(),TF=y3(),AF=x3(),RF=E3(),CF=Qb(),OF=A3(),DF=N3(),NF=j3(),zF=L3(),jF=F3(),UF=H3(),LF=W3(),qF=J3();function FF(e=!1){let t=[NF.default,zF.default,jF.default,UF.default,LF.default,qF.default,RF.default,CF.default,AF.default,OF.default,DF.default];if(e)t.push($F.default,PF.default);else t.push(EF.default,IF.default);return t.push(TF.default),t}X3.default=FF});var e8=Je((Q3)=>{Object.defineProperty(Q3,"__esModule",{value:!0});var nr=mt(),HF={message:({schemaCode:e})=>nr.str`must match format "${e}"`,params:({schemaCode:e})=>nr._`{format: ${e}}`},ZF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HF,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:b,errSchemaPath:v,schemaEnv:_,self:g}=h;if(!b.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:b.code.formats}),$=r.const("fDef",nr._`${M}[${s}]`),I=r.let("fType"),P=r.let("format");r.if(nr._`typeof ${$} == "object" && !(${$} instanceof RegExp)`,()=>r.assign(I,nr._`${$}.type || "string"`).assign(P,nr._`${$}.validate`),()=>r.assign(I,nr._`"string"`).assign(P,$)),e.fail$data((0,nr.or)(T(),R()));function T(){if(b.strictSchema===!1)return nr.nil;return nr._`${s} && !${P}`}function R(){let C=_.$async?nr._`(${$}.async ? await ${P}(${i}) : ${P}(${i}))`:nr._`${P}(${i})`,N=nr._`(typeof ${P} == "function" ? ${C} : ${P}.test(${i}))`;return nr._`${P} && ${P} !== true && ${I} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){T();return}if(M===!0)return;let[$,I,P]=R(M);if($===t)e.pass(C());function T(){if(b.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${v}"`}}function R(N){let B=N instanceof RegExp?(0,nr.regexpCode)(N):b.code.formats?nr._`${b.code.formats}${(0,nr.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,nr._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return nr._`await ${P}(${i})`}return typeof I=="function"?nr._`${P}(${i})`:nr._`${P}.test(${i})`}}}};Q3.default=ZF});var r8=Je((t8)=>{Object.defineProperty(t8,"__esModule",{value:!0});var VF=e8(),WF=[VF.default];t8.default=WF});var o8=Je((n8)=>{Object.defineProperty(n8,"__esModule",{value:!0});n8.contentVocabulary=n8.metadataVocabulary=void 0;n8.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];n8.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var u8=Je((a8)=>{Object.defineProperty(a8,"__esModule",{value:!0});var XF=T4(),YF=n3(),QF=Y3(),eB=r8(),s8=o8(),tB=[XF.default,YF.default,(0,QF.default)(),eB.default,s8.metadataVocabulary,s8.contentVocabulary];a8.default=tB});var f8=Je((c8)=>{Object.defineProperty(c8,"__esModule",{value:!0});c8.DiscrError=void 0;var l8;(function(e){e.Tag="tag",e.Mapping="mapping"})(l8||(c8.DiscrError=l8={}))});var m8=Je((p8)=>{Object.defineProperty(p8,"__esModule",{value:!0});var la=mt(),t_=f8(),h8=Ip(),nB=ac(),iB=kt(),oB={message:({params:{discrError:e,tagName:t}})=>e===t_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>la._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},sB={keyword:"discriminator",type:"object",schemaType:"object",error:oB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let b=t.let("valid",!1),v=t.const("tag",la._`${r}${(0,la.getProperty)(h)}`);t.if(la._`typeof ${v} == "string"`,()=>_(),()=>e.error(!1,{discrError:t_.DiscrError.Tag,tag:v,tagName:h})),e.ok(b);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(la._`${v} === ${M}`),t.assign(b,g(x[M]));t.else(),e.error(!1,{discrError:t_.DiscrError.Mapping,tag:v,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),$=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated($,la.Name),M}function S(){var x;let M={},$=P(n),I=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,iB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=h8.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof h8.SchemaEnv)N=N.schema;if(N===void 0)throw new nB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);I=I&&($||P(N)),T(B,C)}if(!I)throw Error(`discriminator: "${h}" must be required`);return M;function P({required:C}){return Array.isArray(C)&&C.includes(h)}function T(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};p8.default=sB});var g8=Je((Eue,uB)=>{uB.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}});var n_=Je((an,r_)=>{Object.defineProperty(an,"__esModule",{value:!0});an.MissingRefError=an.ValidationError=an.CodeGen=an.Name=an.nil=an.stringify=an.str=an._=an.KeywordCxt=an.Ajv=void 0;var lB=_4(),cB=u8(),dB=m8(),y8=g8(),fB=["/properties"],Kp="http://json-schema.org/draft-07/schema";class bc extends lB.default{_addVocabularies(){if(super._addVocabularies(),cB.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(dB.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(y8,fB):y8;this.addMetaSchema(e,Kp,!1),this.refs["http://json-schema.org/schema"]=Kp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kp)?Kp:void 0)}}an.Ajv=bc;r_.exports=an=bc;r_.exports.Ajv=bc;Object.defineProperty(an,"__esModule",{value:!0});an.default=bc;var hB=sc();Object.defineProperty(an,"KeywordCxt",{enumerable:!0,get:function(){return hB.KeywordCxt}});var ca=mt();Object.defineProperty(an,"_",{enumerable:!0,get:function(){return ca._}});Object.defineProperty(an,"str",{enumerable:!0,get:function(){return ca.str}});Object.defineProperty(an,"stringify",{enumerable:!0,get:function(){return ca.stringify}});Object.defineProperty(an,"nil",{enumerable:!0,get:function(){return ca.nil}});Object.defineProperty(an,"Name",{enumerable:!0,get:function(){return ca.Name}});Object.defineProperty(an,"CodeGen",{enumerable:!0,get:function(){return ca.CodeGen}});var pB=Ep();Object.defineProperty(an,"ValidationError",{enumerable:!0,get:function(){return pB.default}});var mB=ac();Object.defineProperty(an,"MissingRefError",{enumerable:!0,get:function(){return mB.default}})});var $8=Je((M8)=>{Object.defineProperty(M8,"__esModule",{value:!0});M8.formatNames=M8.fastFormats=M8.fullFormats=void 0;function ti(e,t){return{validate:e,compare:t}}M8.fullFormats={date:ti(w8,a_),time:ti(o_(!0),u_),"date-time":ti(v8(!0),x8),"iso-time":ti(o_(),S8),"iso-date-time":ti(v8(),k8),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xB,"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:TB,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:kB,int32:{type:"number",validate:$B},int64:{type:"number",validate:IB},float:{type:"number",validate:_8},double:{type:"number",validate:_8},password:!0,binary:!0};M8.fastFormats={...M8.fullFormats,date:ti(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a_),time:ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u_),"date-time":ti(/^\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,x8),"iso-time":ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,S8),"iso-date-time":ti(/^\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,k8),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};M8.formatNames=Object.keys(M8.fullFormats);function vB(e){return e%4===0&&(e%100!==0||e%400===0)}var bB=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_B=[0,31,28,31,30,31,30,31,31,30,31,30,31];function w8(e){let t=bB.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&vB(r)?29:_B[i])}function a_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var i_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function o_(e){return function(r){let i=i_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],b=i[5]==="-"?-1:1,v=+(i[6]||0),_=+(i[7]||0);if(v>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*b,S=n-v*b-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function u_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function S8(e,t){if(!(e&&t))return;let r=i_.exec(e),i=i_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var s_=/t|\s/i;function v8(e){let t=o_(e);return function(i){let n=i.split(s_);return n.length===2&&w8(n[0])&&t(n[1])}}function x8(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function k8(e,t){if(!(e&&t))return;let[r,i]=e.split(s_),[n,o]=t.split(s_),s=a_(r,n);if(s===void 0)return;return s||u_(i,o)}var wB=/\/|:/,SB=/^(?:[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 xB(e){return wB.test(e)&&SB.test(e)}var b8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function kB(e){return b8.lastIndex=0,b8.test(e)}var MB=-2147483648,EB=2147483647;function $B(e){return Number.isInteger(e)&&e<=EB&&e>=MB}function IB(e){return Number.isInteger(e)}function _8(){return!0}var PB=/[^\\]\\Z/;function TB(e){if(PB.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var P8=Je((I8)=>{Object.defineProperty(I8,"__esModule",{value:!0});I8.formatLimitDefinition=void 0;var RB=n_(),Zn=mt(),so=Zn.operators,Vp={formatMaximum:{okStr:"<=",ok:so.LTE,fail:so.GT},formatMinimum:{okStr:">=",ok:so.GTE,fail:so.LT},formatExclusiveMaximum:{okStr:"<",ok:so.LT,fail:so.GTE},formatExclusiveMinimum:{okStr:">",ok:so.GT,fail:so.LTE}},CB={message:({keyword:e,schemaCode:t})=>Zn.str`should be ${Vp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Zn._`{comparison: ${Vp[e].okStr}, limit: ${t}}`};I8.formatLimitDefinition={keyword:Object.keys(Vp),type:"string",schemaType:"string",$data:!0,error:CB,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let b=new RB.KeywordCxt(o,h.RULES.all.format.definition,"format");if(b.$data)v();else _();function v(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Zn._`${S}[${b.schemaCode}]`);e.fail$data((0,Zn.or)(Zn._`typeof ${x} != "object"`,Zn._`${x} instanceof RegExp`,Zn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=b.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Zn._`${s.code.formats}${(0,Zn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Zn._`${S}.compare(${r}, ${i}) ${Vp[n].fail} 0`}},dependencies:["format"]};var OB=(e)=>(e.addKeyword(I8.formatLimitDefinition),e);I8.default=OB});var C8=Je((_c,R8)=>{Object.defineProperty(_c,"__esModule",{value:!0});var da=$8(),NB=P8(),d_=mt(),T8=new d_.Name("fullFormats"),zB=new d_.Name("fastFormats"),f_=(e,t={keywords:!0})=>{if(Array.isArray(t))return A8(e,t,da.fullFormats,T8),e;let[r,i]=t.mode==="fast"?[da.fastFormats,zB]:[da.fullFormats,T8],n=t.formats||da.formatNames;if(A8(e,n,r,i),t.keywords)(0,NB.default)(e);return e};f_.get=(e,t="full")=>{let i=(t==="fast"?da.fastFormats:da.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function A8(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=d_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}R8.exports=_c=f_;Object.defineProperty(_c,"__esModule",{value:!0});_c.default=f_});class Kn extends Error{}function E_(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,b,v)=>{h?.removeEventListener("abort",b),v()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{closeSync:wQ,writeFileSync:SQ,fsyncSync:xQ,openSync:kQ}=(()=>({}));function tE(){this.__data__=[],this.size=0}var $_=tE;function rE(e,t){return e===t||e!==e&&t!==t}var I_=rE;function nE(e,t){var r=e.length;while(r--)if(I_(e[r][0],t))return r;return-1}var Ii=nE;var iE=Array.prototype,oE=iE.splice;function sE(e){var t=this.__data__,r=Ii(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else oE.call(t,r,1);return--this.size,!0}var P_=sE;function aE(e){var t=this.__data__,r=Ii(t,e);return r<0?void 0:t[r][1]}var T_=aE;function uE(e){return Ii(this.__data__,e)>-1}var A_=uE;function lE(e,t){var r=this.__data__,i=Ii(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var R_=lE;function Jo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Jo.prototype.clear=$_;Jo.prototype.delete=P_;Jo.prototype.get=T_;Jo.prototype.has=A_;Jo.prototype.set=R_;var C_=Jo;var cE=typeof global=="object"&&global&&global.Object===Object&&global,O_=cE;var dE=typeof self=="object"&&self&&self.Object===Object&&self,fE=O_||dE||Function("return this")(),Xo=fE;var hE=Xo.Symbol,Yo=hE;var D_=Object.prototype,pE=D_.hasOwnProperty,mE=D_.toString,pa=Yo?Yo.toStringTag:void 0;function gE(e){var t=pE.call(e,pa),r=e[pa];try{e[pa]=void 0;var i=!0}catch(o){}var n=mE.call(e);if(i)if(t)e[pa]=r;else delete e[pa];return n}var N_=gE;var yE=Object.prototype,vE=yE.toString;function bE(e){return vE.call(e)}var z_=bE;var _E="[object Null]",wE="[object Undefined]",j_=Yo?Yo.toStringTag:void 0;function SE(e){if(e==null)return e===void 0?wE:_E;return j_&&j_ in Object(e)?N_(e):z_(e)}var U_=SE;function xE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Sc=xE;var kE="[object AsyncFunction]",ME="[object Function]",EE="[object GeneratorFunction]",$E="[object Proxy]";function IE(e){if(!Sc(e))return!1;var t=U_(e);return t==ME||t==EE||t==kE||t==$E}var L_=IE;var PE=Xo["__core-js_shared__"],xc=PE;var q_=function(){var e=/[^.]+$/.exec(xc&&xc.keys&&xc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function TE(e){return!!q_&&q_ in e}var F_=TE;var AE=Function.prototype,RE=AE.toString;function CE(e){if(e!=null){try{return RE.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var B_=CE;var OE=/[\\^$.*+?()[\]{}|]/g,DE=/^\[object .+?Constructor\]$/,NE=Function.prototype,zE=Object.prototype,jE=NE.toString,UE=zE.hasOwnProperty,LE=RegExp("^"+jE.call(UE).replace(OE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qE(e){if(!Sc(e)||F_(e))return!1;var t=L_(e)?LE:DE;return t.test(B_(e))}var H_=qE;function FE(e,t){return e==null?void 0:e[t]}var Z_=FE;function BE(e,t){var r=Z_(e,t);return H_(r)?r:void 0}var kc=BE;var HE=kc(Xo,"Map"),K_=HE;var ZE=kc(Object,"create"),ri=ZE;function KE(){this.__data__=ri?ri(null):{},this.size=0}var V_=KE;function VE(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var W_=VE;var WE="__lodash_hash_undefined__",GE=Object.prototype,JE=GE.hasOwnProperty;function XE(e){var t=this.__data__;if(ri){var r=t[e];return r===WE?void 0:r}return JE.call(t,e)?t[e]:void 0}var G_=XE;var YE=Object.prototype,QE=YE.hasOwnProperty;function e$(e){var t=this.__data__;return ri?t[e]!==void 0:QE.call(t,e)}var J_=e$;var t$="__lodash_hash_undefined__";function r$(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ri&&t===void 0?t$:t,this}var X_=r$;function Qo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Qo.prototype.clear=V_;Qo.prototype.delete=W_;Qo.prototype.get=G_;Qo.prototype.has=J_;Qo.prototype.set=X_;var Xp=Qo;function n$(){this.size=0,this.__data__={hash:new Xp,map:new(K_||C_),string:new Xp}}var Y_=n$;function i$(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Q_=i$;function o$(e,t){var r=e.__data__;return Q_(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Pi=o$;function s$(e){var t=Pi(this,e).delete(e);return this.size-=t?1:0,t}var e1=s$;function a$(e){return Pi(this,e).get(e)}var t1=a$;function u$(e){return Pi(this,e).has(e)}var r1=u$;function l$(e,t){var r=Pi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var n1=l$;function es(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}es.prototype.clear=Y_;es.prototype.delete=e1;es.prototype.get=t1;es.prototype.has=r1;es.prototype.set=n1;var Yp=es;var{realpathSync:Fw}=(()=>({}));var c$="Expected a function";function Qp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(c$);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Qp.Cache||Yp),r}Qp.Cache=Yp;var bn=Qp;var i1=function(){return"/"};var ma=()=>globalThis.crypto.randomUUID();Hr();Hr();var zw="[\\w-]{1,63}",i9=new RegExp(`^${zw}$`),QZ=new RegExp(`^a(?:${zw}-)?[0-9a-f]{16}$`);function jw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Dm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var o9="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Uw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?jw(e,o9):null}var Lw=globalThis.process?.getBuiltinModule?.("async_hooks"),Nm=Lw?(e)=>Lw.AsyncResource.bind(e):(e)=>e;function mo(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 Oi(){let e=new Set;return{subscribe(t){let r=Nm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function qw(){return{sent:new Set,rejected:new Set}}var a9={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function u9(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof Fw==="function"){let r=i1();try{e=Bw(Fw(r))}catch{e=Bw(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),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,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:Uw()??ma(),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,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:a9,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:qw(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var l9=u9(),c9=()=>{return};function zm(){return c9()?.sessionId??l9.sessionId}var d9=Oi(),NK=d9.subscribe;function Bw(e){return process.platform==="darwin"?e.normalize("NFC"):e}var f9=Oi(),zK=f9.subscribe;var h9=Oi(),jK=h9.subscribe;var p9=Oi();var UK=p9.subscribe;var m9=Oi();var LK=m9.subscribe;var{appendFile:S2,mkdir:HA,rename:x2,stat:ZA,symlink:KA,unlink:$0}=(()=>({}));Cn();function Xw({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,b=null;function v(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(b)_(b.join("")),b=null;if(o.length===0)return;_(o.join("")),o=[],s=0,v()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(b){b.push(...o),o=[],s=0,v();return}let M=o;o=[],s=0,v(),b=M,setImmediate(()=>{let $=b;if(b=null,$)_($.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:ZK}=(()=>({}));var Fc=function(){return"/"};Cn();function Qw(e){return process.platform==="darwin"?e.normalize("NFC"):e}function eS(e){return/^[\\/]{2}/.test(e)}function tS(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function v9(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function rS(e){if(/^\\\\\?\\volume\{/i.test(e))return Yw(e);let t=v9(e);if(t!==e&&Yw(t))return!0;return eS(t)&&!tS(t)}function Yw(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)||e.includes("/")}function b9(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class nS{#e=new Set;register(e){let t=b9(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var _9=new nS;function iS(e){return _9.register(e)}var oS=bn((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function w9(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function S9(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function sS(e,t){if(!t)return!0;let r=w9(e);return S9(r,t)}Cn();var aS=bn(()=>(process.env.CLAUDE_CONFIG_DIR??Xn(Fc(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR);var rV=bn(()=>mo(process.env.CLAUDE_CODE_SUPERVISED));function Ve(e,t,r,i,n){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function oe(e,t,r,i){if(r==="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 r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)}var Fm=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Fm=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^r()&15>>+i/4).toString(16))};function ai(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Pa=(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}:{});if(e.stack)t.stack=e.stack;if(e.cause&&!t.cause)t.cause=e.cause;if(e.name)t.name=e.name;return t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};class Xe extends Error{}class br extends Xe{constructor(e,t,r,i,n){super(`${br.makeMessage(e,t,r)}`);this.status=e,this.headers=i,this.requestID=i?.get("request-id"),this.error=t,this.type=n??null}static makeMessage(e,t,r){let i=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;if(e&&i)return`${e} ${i}`;if(e)return`${e} status code (no body)`;if(i)return i;return"(no status code or body)"}static generate(e,t,r,i){if(!e||!i)return new vo({message:r,cause:Pa(t)});let n=t,o=n?.error?.type;if(e===400)return new Aa(e,n,r,i,o);if(e===401)return new Ra(e,n,r,i,o);if(e===403)return new Ca(e,n,r,i,o);if(e===404)return new Oa(e,n,r,i,o);if(e===409)return new Da(e,n,r,i,o);if(e===422)return new Na(e,n,r,i,o);if(e===429)return new za(e,n,r,i,o);if(e>=500)return new ja(e,n,r,i,o);return new br(e,n,r,i,o)}}class Tr extends br{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class vo extends br{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}}class Ta extends vo{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Aa extends br{}class Ra extends br{}class Ca extends br{}class Oa extends br{}class Da extends br{}class Na extends br{}class za extends br{}class ja extends br{}var k9=/^[a-z][a-z0-9+.-]*:/i,uS=(e)=>k9.test(e),Bm=(e)=>(Bm=Array.isArray,Bm(e)),Hm=Bm;function Bc(e){if(typeof e!=="object")return{};return e??{}}function Zm(e){if(!e)return!0;for(let t in e)return!1;return!0}function lS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var cS=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new Xe(`${e} must be an integer`);if(t<0)throw new Xe(`${e} must be a positive integer`);return t};var Hc=(e)=>{try{return JSON.parse(e)}catch(t){return}};var dS=(e)=>new Promise((t)=>setTimeout(t,e));var Sn="0.94.0";var mS=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function M9(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var E9=()=>{let e=M9();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":hS(Deno.build.os),"X-Stainless-Arch":fS(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":Sn,"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":Sn,"X-Stainless-OS":hS(globalThis.process.platform??"unknown"),"X-Stainless-Arch":fS(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=$9();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Sn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function $9(){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:r}of e){let i=r.exec(navigator.userAgent);if(i){let n=i[1]||0,o=i[2]||0,s=i[3]||0;return{browser:t,version:`${n}.${o}.${s}`}}}return null}var fS=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},hS=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},pS,Ua=()=>pS??(pS=E9());function gS(){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 Km(...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 Zc(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Km({start(){},async pull(r){let{done:i,value:n}=await t.next();if(i)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function La(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function yS(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var vS=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});function bS(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new Xe(`Cannot stringify type ${typeof r}; 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("&")}var wS="urn:ietf:params:oauth:grant-type:jwt-bearer",SS="refresh_token",Kc="/v1/oauth/token",bo="oauth-2025-04-20",xS="oidc-federation-2026-04-01",kS=120,ss=30,MS=5,_S=1048576;function Vc(e){if(!e)return;let t;try{t=new URL(e)}catch(i){throw new At(`Invalid token endpoint base URL "${e}": ${i}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new At(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Wc(e,t){let r=await A9(e),i;try{i=JSON.parse(r)}catch{throw new At(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,Yr(r),t)}if(!i.access_token)throw new At(`Token endpoint response missing access_token: ${JSON.stringify(Yr(i))}`,e.status,Yr(i),t);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new At(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,e.status,Yr(i),t);return i}var Vm=2000,T9=new Set(["error","error_description","error_uri"]);function Yr(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=Vm)return e;return e.slice(0,Vm)+`... <${e.length-Vm} more chars>`}return JSON.stringify(Yr(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,i]of Object.entries(e))if(T9.has(r))t[r]=i;return t}return null}async function Gc(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),i=e,n;try{i=await r.promises.realpath(e),n=await r.promises.stat(i)}catch{return}let o=n.mode&511;if(o&18)throw new At(`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 At(`Credentials file at ${i} is group/world-readable (mode 0o${o.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${i} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Jc(e,t){let r=await import("node:fs"),n=(await Promise.resolve().then(() => (Cn(),yo))).dirname(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let o=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(o,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(o,e)}catch(s){throw await r.promises.unlink(o).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function A9(e){if(!e.body)return"";let t=e.body.getReader(),r=[],i=0;for(;;){let{done:o,value:s}=await t.read();if(o)break;if(i+s.length>_S){let h=_S-i;if(h>0)r.push(s.subarray(0,h));await t.cancel();break}r.push(s),i+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,h)=>s+h.length,0));let o=0;for(let s of r)n.set(s,o),o+=s.length}return new TextDecoder("utf-8").decode(n)}class At extends Xe{constructor(e,t=null,r=null,i=null){super(e);this.statusCode=t,this.body=r,this.requestId=i}}function On(){return Math.floor(Date.now()/1000)}class Wm{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let r=t.expiresAt-On();if(r>kS)return t.token;if(r>ss)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(On()-this.lastAdvisoryError<MS)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=On(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var Pt=(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;return};function IS(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),i=0;for(let n of e)r.set(n,i),i+=n.length;return r}var ES;function as(e){let t;return(ES??(t=new globalThis.TextEncoder,ES=t.encode.bind(t)))(e)}var $S;function Gm(e){let t;return($S??(t=new globalThis.TextDecoder,$S=t.decode.bind(t)))(e)}var Yc={off:0,error:200,warn:300,info:400,debug:500},Jm=(e,t,r)=>{if(!e)return;if(lS(Yc,e))return e;tr(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Yc))}`);return};function qa(){}function Xc(e,t,r){if(!t||Yc[e]>Yc[r])return qa;else return t[e].bind(t)}var R9={error:qa,warn:qa,info:qa,debug:qa},PS=new WeakMap;function tr(e){let t=e.logger,r=e.logLevel??"off";if(!t)return R9;let i=PS.get(t);if(i&&i[0]===r)return i[1];let n={error:Xc("error",t,r),warn:Xc("warn",t,r),info:Xc("info",t,r),debug:Xc("debug",t,r)};return PS.set(t,[r,n]),n}var ui=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,r])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Qc="1.0",C9=/^[A-Za-z0-9_.-]+$/;function TS(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(!C9.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var AS=async(e)=>{var t,r;let i=await Xm();if(i===null)return null;let n=e??await CS();if(n===null)return null;TS(n);let o=await import("node:fs"),h=(await Promise.resolve().then(() => (Cn(),yo))).join(i,"configs",`${n}.json`),b;try{b=await o.promises.readFile(h,"utf-8")}catch(g){if(g?.code!=="ENOENT")throw Error(`failed to read config file ${h}: ${g}`);b=null}if(b===null){let g=Pt("ANTHROPIC_ORGANIZATION_ID"),S=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE"),x=Pt("ANTHROPIC_FEDERATION_RULE_ID");if(x&&g)return{fromFile:!1,config:{organization_id:g,workspace_id:Pt("ANTHROPIC_WORKSPACE_ID"),base_url:Pt("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:x,service_account_id:Pt("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:S?{source:"file",path:S}:void 0,scope:Pt("ANTHROPIC_SCOPE")}}};return null}let v;try{v=JSON.parse(b)}catch(g){throw Error(`failed to parse config file ${h}: ${g}`)}if(!v.authentication)throw Error(`config file ${h} is missing "authentication"`);let _=v.authentication.type;if(_!=="oidc_federation"&&_!=="user_oauth")throw Error(`authentication.type "${_}" is not a known authentication type`);if(v.organization_id??(v.organization_id=Pt("ANTHROPIC_ORGANIZATION_ID")),v.workspace_id??(v.workspace_id=Pt("ANTHROPIC_WORKSPACE_ID")),v.base_url??(v.base_url=Pt("ANTHROPIC_BASE_URL")),(t=v.authentication).scope??(t.scope=Pt("ANTHROPIC_SCOPE")),v.authentication.type==="oidc_federation"){if(!v.authentication.identity_token){let g=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(g)v.authentication.identity_token={source:"file",path:g}}if(!v.authentication.federation_rule_id)v.authentication.federation_rule_id=Pt("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=v.authentication).service_account_id??(r.service_account_id=Pt("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:v,fromFile:!0}};var RS=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await Xm();if(!r)return null;let i=t??await CS();if(!i)return null;return TS(i),(await Promise.resolve().then(() => (Cn(),yo))).join(r,"credentials",`${i}.json`)},Xm=async()=>{if(!O9())return null;let e=await Promise.resolve().then(() => (Cn(),yo)),t=Pt("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Ua()["X-Stainless-OS"]==="Windows"){let o=Pt("APPDATA");if(o)return e.join(o,"Anthropic");let s=Pt("USERPROFILE");if(s)return e.join(s,"AppData","Roaming","Anthropic");return null}let i=Pt("XDG_CONFIG_HOME");if(i)return e.join(i,"anthropic");let n=Pt("HOME");if(n)return e.join(n,".config","anthropic");return null},O9=()=>{let e=Ua()["X-Stainless-Runtime"];return e==="node"||e==="deno"},CS=async()=>{let e=await Xm();if(!e)return null;let t=Pt("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),n=(await Promise.resolve().then(() => (Cn(),yo))).join(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(o){if(o?.code!=="ENOENT")throw Error(`failed to read ${n}: ${o}`);return"default"}};function Ym(e){if(!e)throw new Xe("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new Xe(`Failed to read identity token file at ${e}: ${n}`)}let i=r.trim();if(!i)throw new Xe(`Identity token file at ${e} is empty`);return i}}function OS(e){if(!e)throw new Xe("Identity token value is empty");return()=>e}function DS(e){return async()=>{Vc(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new At(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:wS,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let i=`${e.baseURL}${Kc}`,n;try{n=await e.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${bo},${xS}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Sn} oidcFederationProvider`},body:JSON.stringify(r)})}catch(b){throw new At(`Failed to reach token endpoint ${i}: ${b}`)}let o=n.headers.get("Request-Id");if(!n.ok){let b=await n.text().catch(()=>""),v=Yr(b),_="";if(n.status===401)_=` 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.`;throw new At(`Token exchange failed with status ${n.status}${o?` (request-id ${o})`:""}: ${v}${_}`,n.status,v,o)}let s=await Wc(n,o),h=Number(s.expires_in);if(!Number.isFinite(h))throw new At(`Token endpoint response missing required fields: ${JSON.stringify(Yr(s))}`,n.status,Yr(s),o);return{token:s.access_token,expiresAt:On()+h}}}function NS(e){return async(t)=>{let r=await import("node:fs");await Gc(e.credentialsPath,e.onSafetyWarning);let i;try{i=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(I){throw new At(`Credentials file not found at ${e.credentialsPath}: ${I}`)}let n;try{n=JSON.parse(i)}catch(I){throw new At(`Credentials file at ${e.credentialsPath} is not valid JSON: ${I}`)}let o=n.access_token;if(!o)throw new At(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||On()<s-ss))return{token:o,expiresAt:s??null};let h=n.refresh_token;if(!e.clientId||!h)throw new At(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${h?"set":"empty"})`);Vc(e.baseURL);let b={grant_type:SS,refresh_token:h,client_id:e.clientId},v=`${e.baseURL}${Kc}`,_;try{_=await e.fetch(v,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":bo,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Sn} userOAuthProvider`},body:JSON.stringify(b)})}catch(I){throw new At(`User OAuth refresh failed to reach token endpoint: ${I}`)}let g=_.headers.get("Request-Id");if(!_.ok){let I=await _.text().catch(()=>"");throw new At(`User OAuth refresh failed (HTTP ${_.status}): ${Yr(I)}`,_.status,Yr(I),g)}let S=await Wc(_,g),x=Number(S.expires_in);if(!Number.isFinite(x))throw new At(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Yr(S))}`,_.status,Yr(S),g);let M=On()+x,$=S.refresh_token||h;return await Jc(e.credentialsPath,{...n,version:Qc,type:"oauth_token",access_token:S.access_token,expires_at:M,refresh_token:$}),{token:S.access_token,expiresAt:M}}}function Qm(e,t){let r=e.authentication.credentials_path??null,i=(e.base_url||t.baseURL).replace(/\/+$/,""),n=D9(e,r,i,t),o={};if(e.workspace_id&&e.authentication.type==="user_oauth")o["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:o,baseURL:e.base_url||void 0}}async function zS(e,t){let r=await AS(t);if(!r)return null;let{config:i,fromFile:n}=r,o=i.authentication.credentials_path||!n?i:{...i,authentication:{...i.authentication,credentials_path:await RS(i,t)??void 0}};return Qm(o,e)}function D9(e,t,r,i){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,o=N9(n);if(!o)throw new At("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new At("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 At("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=DS({identityTokenProvider:o,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent});if(t)return z9(s,t,i.onCacheWriteError,i.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new At("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return NS({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let n=e.authentication.type;throw new At(`authentication.type "${n}" is not a known authentication type`)}}}function N9(e){if(e.identity_token){let i=e.identity_token.source;if(i!=="file")throw new At(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new At('identity_token.source "file" requires a non-empty path');return Ym(e.identity_token.path)}let t=Pt("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return Ym(t);let r=Pt("ANTHROPIC_IDENTITY_TOKEN");if(r)return OS(r);return null}function z9(e,t,r,i){return async(n)=>{let o=await import("node:fs");await Gc(t,i);let s;try{let b=await o.promises.readFile(t,"utf-8");s=JSON.parse(b);let v=s?.access_token;if(v&&!n?.forceRefresh){let _=s?.expires_at;if(_==null||On()<_-ss)return{token:v,expiresAt:_??null}}}catch(b){if(b?.code!=="ENOENT"&&!(b instanceof SyntaxError))r?.(b)}let h=await e(n);try{await Jc(t,{...s??{},version:Qc,type:"oauth_token",access_token:h.token,expires_at:h.expiresAt})}catch(b){r?.(b)}return h}}var cn,dn;class Ni{constructor(){cn.set(this,void 0),dn.set(this,void 0),Ve(this,cn,new Uint8Array,"f"),Ve(this,dn,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?as(e):e;Ve(this,cn,IS([oe(this,cn,"f"),t]),"f");let r=[],i;while((i=j9(oe(this,cn,"f"),oe(this,dn,"f")))!=null){if(i.carriage&&oe(this,dn,"f")==null){Ve(this,dn,i.index,"f");continue}if(oe(this,dn,"f")!=null&&(i.index!==oe(this,dn,"f")+1||i.carriage)){r.push(Gm(oe(this,cn,"f").subarray(0,oe(this,dn,"f")-1))),Ve(this,cn,oe(this,cn,"f").subarray(oe(this,dn,"f")),"f"),Ve(this,dn,null,"f");continue}let n=oe(this,dn,"f")!==null?i.preceding-1:i.preceding,o=Gm(oe(this,cn,"f").subarray(0,n));r.push(o),Ve(this,cn,oe(this,cn,"f").subarray(i.index),"f"),Ve(this,dn,null,"f")}return r}flush(){if(!oe(this,cn,"f").length)return[];return this.decode(`
|
|
27
27
|
`)}}cn=new WeakMap,dn=new WeakMap;Ni.NEWLINE_CHARS=new Set([`
|
|
28
28
|
`,"\r"]);Ni.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function j9(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 jS(e){for(let i=0;i<e.length-1;i++){if(e[i]===10&&e[i+1]===10)return i+2;if(e[i]===13&&e[i+1]===13)return i+2;if(e[i]===13&&e[i+1]===10&&i+3<e.length&&e[i+2]===13&&e[i+3]===10)return i+4}return-1}var Fa;class fn{constructor(e,t,r){this.iterator=e,Fa.set(this,void 0),this.controller=t,Ve(this,Fa,r,"f")}static fromSSEResponse(e,t,r){let i=!1,n=r?tr(r):console;async function*o(){if(i)throw new Xe("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let h of U9(e,t)){if(h.event==="completion")try{yield JSON.parse(h.data)}catch(b){throw n.error("Could not parse message into JSON:",h.data),n.error("From chunk:",h.raw),b}if(h.event==="message_start"||h.event==="message_delta"||h.event==="message_stop"||h.event==="content_block_start"||h.event==="content_block_delta"||h.event==="content_block_stop"||h.event==="message"||h.event==="user.message"||h.event==="user.interrupt"||h.event==="user.tool_confirmation"||h.event==="user.custom_tool_result"||h.event==="agent.message"||h.event==="agent.thinking"||h.event==="agent.tool_use"||h.event==="agent.tool_result"||h.event==="agent.mcp_tool_use"||h.event==="agent.mcp_tool_result"||h.event==="agent.custom_tool_use"||h.event==="agent.thread_context_compacted"||h.event==="session.status_running"||h.event==="session.status_idle"||h.event==="session.status_rescheduled"||h.event==="session.status_terminated"||h.event==="session.error"||h.event==="session.deleted"||h.event==="span.model_request_start"||h.event==="span.model_request_end")try{yield JSON.parse(h.data)}catch(b){throw n.error("Could not parse message into JSON:",h.data),n.error("From chunk:",h.raw),b}if(h.event==="ping")continue;if(h.event==="error"){let b=Hc(h.data)??h.data,v=b?.error?.type;throw new br(void 0,b,void 0,e.headers,v)}}s=!0}catch(h){if(ai(h))return;throw h}finally{if(!s)t.abort()}}return new fn(o,t,r)}static fromReadableStream(e,t,r){let i=!1;async function*n(){let s=new Ni,h=La(e);for await(let b of h)for(let v of s.decode(b))yield v;for(let b of s.flush())yield b}async function*o(){if(i)throw new Xe("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(let h of n()){if(s)continue;if(h)yield JSON.parse(h)}s=!0}catch(h){if(ai(h))return;throw h}finally{if(!s)t.abort()}}return new fn(o,t,r)}[(Fa=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),i=(n)=>({next:()=>{if(n.length===0){let o=r.next();e.push(o),t.push(o)}return n.shift()}});return[new fn(()=>i(e),this.controller,oe(this,Fa,"f")),new fn(()=>i(t),this.controller,oe(this,Fa,"f"))]}toReadableStream(){let e=this,t;return Km({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:i,done:n}=await t.next();if(n)return r.close();let o=as(JSON.stringify(i)+`
|
|
29
29
|
`);r.enqueue(o)}catch(i){r.error(i)}},async cancel(){await t.return?.()}})}}async function*U9(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new Xe("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new Xe("Attempted to iterate over a response with no body")}let r=new US,i=new Ni,n=La(e.body);for await(let o of L9(n))for(let s of i.decode(o)){let h=r.decode(s);if(h)yield h}for(let o of i.flush()){let s=r.decode(o);if(s)yield s}}async function*L9(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let i=r instanceof ArrayBuffer?new Uint8Array(r):typeof r==="string"?as(r):r,n=new Uint8Array(t.length+i.length);n.set(t),n.set(i,t.length),t=n;let o;while((o=jS(t))!==-1)yield t.slice(0,o),t=t.slice(o)}if(t.length>0)yield t}class US{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r"))e=e.substring(0,e.length-1);if(!e){if(!this.event&&!this.data.length)return null;let n={event:this.event,data:this.data.join(`
|
|
@@ -63,7 +63,7 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
63
63
|
|
|
64
64
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
65
65
|
`);this.baseURL=n.baseURL,this._baseURLIsExplicit=i.__baseURLIsExplicit??!!e,this.timeout=n.timeout??S0.DEFAULT_TIMEOUT,this.logger=n.logger??console;let o="warn";this.logLevel=o,this.logLevel=Jm(n.logLevel,"ClientOptions.logLevel",this)??Jm(Pt("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??o,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??gS(),Ve(this,wd,vS,"f");let s=Pt("ANTHROPIC_CUSTOM_HEADERS");if(s){let b={};for(let v of s.split(`
|
|
66
|
-
`)){let _=v.indexOf(":");if(_>=0)b[v.substring(0,_).trim()]=v.substring(_+1).trim()}n.defaultHeaders={...b,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let b=n.credentials??null;if(b)this._authState.provider=b,this._authState.tokenCache=this._makeTokenCache(b);else if(n.config!=null){let v=Qm(n.config,this._credentialResolverOptions());this._authState.provider=v.provider,this._authState.tokenCache=this._makeTokenCache(v.provider),this._authState.extraHeaders=v.extraHeaders,this._applyCredentialBaseURL(v.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{tr(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{tr(this).warn(e)}}}_makeTokenCache(e){return new Wm(e,(t)=>{tr(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...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,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await zS(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Xe(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;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(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,be([{Authorization:`Bearer ${t}`}])}return be([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return be([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return be([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return bS(e)}getUserAgent(){return`${this.constructor.name}/JS ${Sn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Fm()}`}makeStatusError(e,t,r,i){return br.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,w0,"m",d2).call(this)&&r||this.baseURL,n=uS(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Zm(o)||!Zm(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Xe("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 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(bo))i.append("anthropic-beta",bo);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new _o(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let b="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),v=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(tr(this).debug(`[${b}] sending request`,ui({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Tr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Pa),x=Date.now();if(S instanceof globalThis.Error){let I=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Tr;let P=ai(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return tr(this).info(`[${b}] connection ${P?"timed out":"failed"} - ${I}`),tr(this).debug(`[${b}] connection ${P?"timed out":"failed"} (${I})`,ui({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??b);if(tr(this).info(`[${b}] connection ${P?"timed out":"failed"} - error; no more retries left`),tr(this).debug(`[${b}] connection ${P?"timed out":"failed"} (error; no more retries left)`,ui({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),P)throw new Ta;throw new vo({cause:S})}let M=[...S.headers.entries()].filter(([I])=>I==="request-id").map(([I,P])=>", "+I+": "+JSON.stringify(P)).join(""),$=`[${b}${v}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let I=await this.shouldRetry(S,i);if(t&&I){let B=`retrying, ${t} attempts remaining`;return await yS(S.body),tr(this).info(`${$} - ${B}`),tr(this).debug(`[${b}] response error (${B})`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??b,S.headers)}let P=I?"error; no more retries left":"error; not retryable";tr(this).info(`${$} - ${P}`);let T=await S.text().catch((B)=>Pa(B).message),R=Hc(T),C=R?void 0:T;throw tr(this).debug(`[${b}] response error (${P})`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return tr(this).info($),tr(this).debug(`[${b}] response start`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:b,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new rd(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let b=setTimeout(h,r),v=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...v?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(b)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await dS(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Xe("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 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)cS("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:b,body:v}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:b,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&v instanceof globalThis.ReadableStream&&{duplex:"half"},...v&&{body:v},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=be([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Ua(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=be([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Zc(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,wd,"f").call(this,{body:e,headers:r})}}S0=Yt,wd=new WeakMap,w0=new WeakSet,d2=function(){return this.baseURL!=="https://api.anthropic.com"};Yt.Anthropic=S0;Yt.HUMAN_PROMPT=f2;Yt.AI_PROMPT=h2;Yt.DEFAULT_TIMEOUT=600000;Yt.AnthropicError=Xe;Yt.APIError=br;Yt.APIConnectionError=vo;Yt.APIConnectionTimeoutError=Ta;Yt.APIUserAbortError=Tr;Yt.NotFoundError=Oa;Yt.ConflictError=Da;Yt.RateLimitError=za;Yt.BadRequestError=Aa;Yt.AuthenticationError=Ra;Yt.InternalServerError=ja;Yt.PermissionDeniedError=Ca;Yt.UnprocessableEntityError=Na;Yt.toFile=nd;class Io extends Yt{constructor(){super(...arguments);this.completions=new ys(this),this.messages=new $o(this),this.models=new bs(this),this.beta=new Nr(this)}}Io.Completions=ys;Io.Messages=$o;Io.Models=bs;Io.Beta=Nr;function EA(e){return e}function Su(e){return EA(e)}function x0(e){return e instanceof Error?e:Error(String(e))}function Sd(e){return e instanceof Error?e.message:String(e)}function _s(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function p2(e){return _s(e)==="ENOENT"}function k0(e){return _s(e)==="EISDIR"}var ct=(()=>({}));var{lstat:$A,mkdir:IA,open:PA,readdir:TA,readFile:m2,rename:AA,rmdir:RA,rm:CA,stat:OA,unlink:DA}=(()=>({}));Cn();var xd="→";var NA={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=Bt(r,Wt`fs.existsSync(${e})`,0);return ct.existsSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},async stat(e){return OA(e)},async lstat(e){return $A(e)},async readdir(e){return TA(e,{withFileTypes:!0})},async unlink(e){return DA(e)},async rmdir(e){return RA(e)},async rm(e,t){return CA(e,t)},async mkdir(e,t){try{await IA(e,{recursive:!0,...t})}catch(r){if(_s(r)!=="EEXIST")throw r}},async readFile(e,t){return m2(e,{encoding:t.encoding})},async rename(e,t){return AA(e,t)},statSync(e){let r=[];try{const t=Bt(r,Wt`fs.statSync(${e})`,0);return ct.statSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},lstatSync(e){let r=[];try{const t=Bt(r,Wt`fs.lstatSync(${e})`,0);return ct.lstatSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readFileSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.readFileSync(${e})`,0);return ct.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=Bt(r,Wt`fs.readFileBytesSync(${e})`,0);return ct.readFileSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readSync(e,t){let n=[];try{const r=Bt(n,Wt`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=ct.openSync(e,"r");let b=Buffer.alloc(t.length),v=ct.readSync(i,b,0,t.length,0);return{buffer:b,bytesRead:v}}finally{if(i)ct.closeSync(i)}}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=Bt(n,Wt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let b=ct.openSync(e,"ax",r.mode);try{ct.appendFileSync(b,t)}finally{ct.closeSync(b)}return}catch(b){if(_s(b)!=="EEXIST")throw b}ct.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},copyFileSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.copyFileSync(${e} ${xd} ${t})`,0);ct.copyFileSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},unlinkSync(e){let r=[];try{const t=Bt(r,Wt`fs.unlinkSync(${e})`,0);ct.unlinkSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},renameSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.renameSync(${e} ${xd} ${t})`,0);ct.renameSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},linkSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.linkSync(${e} ${xd} ${t})`,0);ct.linkSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},symlinkSync(e,t,r){let n=[];try{const i=Bt(n,Wt`fs.symlinkSync(${e} ${xd} ${t})`,0);ct.symlinkSync(e,t,r)}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},readlinkSync(e){let r=[];try{const t=Bt(r,Wt`fs.readlinkSync(${e})`,0);return ct.readlinkSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},realpathSync(e){let r=[];try{const t=Bt(r,Wt`fs.realpathSync(${e})`,0);return Qw(ct.realpathSync(e))}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=Bt(n,Wt`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{ct.mkdirSync(e,i)}catch(b){if(_s(b)!=="EEXIST")throw b}}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},readdirSync(e){let r=[];try{const t=Bt(r,Wt`fs.readdirSync(${e})`,0);return ct.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readdirStringSync(e){let r=[];try{const t=Bt(r,Wt`fs.readdirStringSync(${e})`,0);return ct.readdirSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},isDirEmptySync(e){let i=[];try{const t=Bt(i,Wt`fs.isDirEmptySync(${e})`,0);let r=this.readdirSync(e);return r.length===0}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},rmdirSync(e){let r=[];try{const t=Bt(r,Wt`fs.rmdirSync(${e})`,0);ct.rmdirSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},rmSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.rmSync(${e})`,0);ct.rmSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},createWriteStream(e){return ct.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return m2(e);let r=await PA(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},zA=NA;function kd(){return zA}Cn();var{lstatSync:LY,readFileSync:qY,rmSync:FY,unlinkSync:BY,writeFileSync:HY}=(()=>({}));function jA(e,t){if(e.destroyed)return;e.write(t)}function g2(e){jA(process.stderr,e)}var JY=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,XY=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;var UA=/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,y2="[^\\s,;&}\\])]+",_2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",LA=`[^\\s-]{0,4}${_2}['"\`]?`,v2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${y2})|${LA}|${y2}`,qA=["sk","ant","api"].join("-"),FA=[{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:`(?:${UA.source})[\\w.-]*["']?\\s*[=:]\\s*(${v2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${v2})`,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})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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(${qA}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:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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:_2,flags:"i",confidence:"high"}];var b2=null;function BA(e){return FA.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function w2(e){b2??=BA(!0);for(let t of b2)e=e.replace(t.re,(r,i)=>{if(typeof i!=="string")return"[REDACTED]";let n=i.length>=2&&(i[0]==='"'||i[0]==="'")&&i.at(-1)===i[0]?i[0]:"",o=r.lastIndexOf(i);return`${r.slice(0,o)}${n}[REDACTED]${n}${r.slice(o+i.length)}`});return e}var I0={verbose:0,debug:1,info:2,warn:3,error:4},VA=bn(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(I0,e))return e;return"debug"}),WA=!1;function Ed(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var P0=bn(()=>{let e=Ed();return WA||mo(process.env.DEBUG)||mo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||M2()||e.some((t)=>t.startsWith("--debug="))||E2()!==null});var GA=bn(()=>{let e=Ed().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return oS(t)}),M2=bn(()=>{let e=Ed();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),E2=bn(()=>{let e=Ed();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return k2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return k2(e[t+1])}return null});function k2(e){return rS(e)?null:Di(e)}function JA(e){if(!P0())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=GA();return sS(e,t)}var XA=!1;var YA=10485760,Md=null,M0=Promise.resolve(),xu=-1,E0=!1,T0=null;async function $2(e,t,r=YA){if(xu<0)xu=await ZA(e).then((i)=>i.size).catch(()=>0);else xu+=t;if(xu<=r||E0)return;E0=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await x2(e,i)}catch(n){if(!p2(n))await $0(i).catch(()=>{}),await x2(e,i).catch(()=>$0(e).catch(()=>{}))}xu=0}finally{E0=!1}}function I2(e){return T0=Xn(e,`${zm()}.txt`),T0}async function QA(e,t,r,i){if(e)await HA(t,{recursive:!0}).catch(()=>{});let n=r;try{await S2(r,i)}catch(o){if(!k0(o))throw o;n=I2(r),await S2(n,i)}await $2(n,Buffer.byteLength(i)).catch(A0),T2()}function A0(){}function eR(){if(!Md){let e=null;Md=Xw({writeFn:(t)=>{let r=P2(),i=go(r),n=e!==i;if(e=i,P0()){if(n)try{kd().mkdirSync(i)}catch{}let o=r;try{kd().appendFileSync(r,t)}catch(s){if(!k0(s))throw s;o=I2(r),kd().appendFileSync(o,t)}$2(o,Buffer.byteLength(t)).catch(A0),T2();return}M0=M0.then(QA.bind(null,n,i,r,t)).catch(A0)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:P0()}),iS(async()=>{Md?.dispose(),await M0})}return Md}function zr(e,{level:t}={level:"debug"}){if(I0[t]<I0[VA()])return;if(!JA(e))return;if(XA&&e.includes(`
|
|
66
|
+
`)){let _=v.indexOf(":");if(_>=0)b[v.substring(0,_).trim()]=v.substring(_+1).trim()}n.defaultHeaders={...b,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let b=n.credentials??null;if(b)this._authState.provider=b,this._authState.tokenCache=this._makeTokenCache(b);else if(n.config!=null){let v=Qm(n.config,this._credentialResolverOptions());this._authState.provider=v.provider,this._authState.tokenCache=this._makeTokenCache(v.provider),this._authState.extraHeaders=v.extraHeaders,this._applyCredentialBaseURL(v.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{tr(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{tr(this).warn(e)}}}_makeTokenCache(e){return new Wm(e,(t)=>{tr(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...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,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await zS(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Xe(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;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(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,be([{Authorization:`Bearer ${t}`}])}return be([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return be([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return be([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return bS(e)}getUserAgent(){return`${this.constructor.name}/JS ${Sn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Fm()}`}makeStatusError(e,t,r,i){return br.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,w0,"m",d2).call(this)&&r||this.baseURL,n=uS(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Zm(o)||!Zm(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Xe("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 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(bo))i.append("anthropic-beta",bo);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new _o(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let b="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),v=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(tr(this).debug(`[${b}] sending request`,ui({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Tr;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Pa),x=Date.now();if(S instanceof globalThis.Error){let I=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Tr;let P=ai(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return tr(this).info(`[${b}] connection ${P?"timed out":"failed"} - ${I}`),tr(this).debug(`[${b}] connection ${P?"timed out":"failed"} (${I})`,ui({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??b);if(tr(this).info(`[${b}] connection ${P?"timed out":"failed"} - error; no more retries left`),tr(this).debug(`[${b}] connection ${P?"timed out":"failed"} (error; no more retries left)`,ui({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),P)throw new Ta;throw new vo({cause:S})}let M=[...S.headers.entries()].filter(([I])=>I==="request-id").map(([I,P])=>", "+I+": "+JSON.stringify(P)).join(""),$=`[${b}${v}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let I=await this.shouldRetry(S,i);if(t&&I){let B=`retrying, ${t} attempts remaining`;return await yS(S.body),tr(this).info(`${$} - ${B}`),tr(this).debug(`[${b}] response error (${B})`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??b,S.headers)}let P=I?"error; no more retries left":"error; not retryable";tr(this).info(`${$} - ${P}`);let T=await S.text().catch((B)=>Pa(B).message),R=Hc(T),C=R?void 0:T;throw tr(this).debug(`[${b}] response error (${P})`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return tr(this).info($),tr(this).debug(`[${b}] response start`,ui({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:b,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new rd(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let b=setTimeout(h,r),v=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...v?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(b)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await dS(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Xe("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 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)cS("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:b,body:v}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:b,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&v instanceof globalThis.ReadableStream&&{duplex:"half"},...v&&{body:v},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=be([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Ua(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=be([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Zc(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,wd,"f").call(this,{body:e,headers:r})}}S0=Yt,wd=new WeakMap,w0=new WeakSet,d2=function(){return this.baseURL!=="https://api.anthropic.com"};Yt.Anthropic=S0;Yt.HUMAN_PROMPT=f2;Yt.AI_PROMPT=h2;Yt.DEFAULT_TIMEOUT=600000;Yt.AnthropicError=Xe;Yt.APIError=br;Yt.APIConnectionError=vo;Yt.APIConnectionTimeoutError=Ta;Yt.APIUserAbortError=Tr;Yt.NotFoundError=Oa;Yt.ConflictError=Da;Yt.RateLimitError=za;Yt.BadRequestError=Aa;Yt.AuthenticationError=Ra;Yt.InternalServerError=ja;Yt.PermissionDeniedError=Ca;Yt.UnprocessableEntityError=Na;Yt.toFile=nd;class Io extends Yt{constructor(){super(...arguments);this.completions=new ys(this),this.messages=new $o(this),this.models=new bs(this),this.beta=new Nr(this)}}Io.Completions=ys;Io.Messages=$o;Io.Models=bs;Io.Beta=Nr;function EA(e){return e}function Su(e){return EA(e)}function x0(e){return e instanceof Error?e:Error(String(e))}function Sd(e){return e instanceof Error?e.message:String(e)}function _s(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function p2(e){return _s(e)==="ENOENT"}function k0(e){return _s(e)==="EISDIR"}var ct=(()=>({}));var{lstat:$A,mkdir:IA,open:PA,readdir:TA,readFile:m2,rename:AA,rmdir:RA,rm:CA,stat:OA,unlink:DA}=(()=>({}));Cn();var xd="→";var NA={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=Bt(r,Wt`fs.existsSync(${e})`,0);return ct.existsSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},async stat(e){return OA(e)},async lstat(e){return $A(e)},async readdir(e){return TA(e,{withFileTypes:!0})},async unlink(e){return DA(e)},async rmdir(e){return RA(e)},async rm(e,t){return CA(e,t)},async mkdir(e,t){try{await IA(e,{recursive:!0,...t})}catch(r){if(_s(r)!=="EEXIST")throw r}},async readFile(e,t){return m2(e,{encoding:t.encoding})},async rename(e,t){return AA(e,t)},statSync(e){let r=[];try{const t=Bt(r,Wt`fs.statSync(${e})`,0);return ct.statSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},lstatSync(e){let r=[];try{const t=Bt(r,Wt`fs.lstatSync(${e})`,0);return ct.lstatSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readFileSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.readFileSync(${e})`,0);return ct.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=Bt(r,Wt`fs.readFileBytesSync(${e})`,0);return ct.readFileSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readSync(e,t){let n=[];try{const r=Bt(n,Wt`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=ct.openSync(e,"r");let b=Buffer.alloc(t.length),v=ct.readSync(i,b,0,t.length,0);return{buffer:b,bytesRead:v}}finally{if(i)ct.closeSync(i)}}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=Bt(n,Wt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let b=ct.openSync(e,"ax",r.mode);try{ct.appendFileSync(b,t)}finally{ct.closeSync(b)}return}catch(b){if(_s(b)!=="EEXIST")throw b}ct.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},copyFileSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.copyFileSync(${e} ${xd} ${t})`,0);ct.copyFileSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},unlinkSync(e){let r=[];try{const t=Bt(r,Wt`fs.unlinkSync(${e})`,0);ct.unlinkSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},renameSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.renameSync(${e} ${xd} ${t})`,0);ct.renameSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},linkSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.linkSync(${e} ${xd} ${t})`,0);ct.linkSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},symlinkSync(e,t,r){let n=[];try{const i=Bt(n,Wt`fs.symlinkSync(${e} ${xd} ${t})`,0);ct.symlinkSync(e,t,r)}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},readlinkSync(e){let r=[];try{const t=Bt(r,Wt`fs.readlinkSync(${e})`,0);return ct.readlinkSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},realpathSync(e){let r=[];try{const t=Bt(r,Wt`fs.realpathSync(${e})`,0);return Qw(ct.realpathSync(e))}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=Bt(n,Wt`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{ct.mkdirSync(e,i)}catch(b){if(_s(b)!=="EEXIST")throw b}}catch(o){var s=o,h=1}finally{Ht(n,s,h)}},readdirSync(e){let r=[];try{const t=Bt(r,Wt`fs.readdirSync(${e})`,0);return ct.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},readdirStringSync(e){let r=[];try{const t=Bt(r,Wt`fs.readdirStringSync(${e})`,0);return ct.readdirSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},isDirEmptySync(e){let i=[];try{const t=Bt(i,Wt`fs.isDirEmptySync(${e})`,0);let r=this.readdirSync(e);return r.length===0}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},rmdirSync(e){let r=[];try{const t=Bt(r,Wt`fs.rmdirSync(${e})`,0);ct.rmdirSync(e)}catch(i){var n=i,o=1}finally{Ht(r,n,o)}},rmSync(e,t){let i=[];try{const r=Bt(i,Wt`fs.rmSync(${e})`,0);ct.rmSync(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}},createWriteStream(e){return ct.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return m2(e);let r=await PA(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},zA=NA;function kd(){return zA}Cn();var{lstatSync:LY,readFileSync:qY,rmSync:FY,unlinkSync:BY,writeFileSync:HY}=(()=>({}));function jA(e,t){if(e.destroyed)return;e.write(t)}function g2(e){jA(process.stderr,e)}var JY=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,XY=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;var UA=/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,y2="[^\\s,;&}\\])]+",_2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",LA=`[^\\s-]{0,4}${_2}['"\`]?`,v2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${y2})|${LA}|${y2}`,qA=["sk","ant","api"].join("-"),FA=[{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:`(?:${UA.source})[\\w.-]*["']?\\s*[=:]\\s*(${v2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${v2})`,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(${qA}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:_2,flags:"i",confidence:"high"}];var b2=null;function BA(e){return FA.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function w2(e){b2??=BA(!0);for(let t of b2)e=e.replace(t.re,(r,i)=>{if(typeof i!=="string")return"[REDACTED]";let n=i.length>=2&&(i[0]==='"'||i[0]==="'")&&i.at(-1)===i[0]?i[0]:"",o=r.lastIndexOf(i);return`${r.slice(0,o)}${n}[REDACTED]${n}${r.slice(o+i.length)}`});return e}var I0={verbose:0,debug:1,info:2,warn:3,error:4},VA=bn(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(I0,e))return e;return"debug"}),WA=!1;function Ed(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var P0=bn(()=>{let e=Ed();return WA||mo(process.env.DEBUG)||mo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||M2()||e.some((t)=>t.startsWith("--debug="))||E2()!==null});var GA=bn(()=>{let e=Ed().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return oS(t)}),M2=bn(()=>{let e=Ed();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),E2=bn(()=>{let e=Ed();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return k2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return k2(e[t+1])}return null});function k2(e){return rS(e)?null:Di(e)}function JA(e){if(!P0())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=GA();return sS(e,t)}var XA=!1;var YA=10485760,Md=null,M0=Promise.resolve(),xu=-1,E0=!1,T0=null;async function $2(e,t,r=YA){if(xu<0)xu=await ZA(e).then((i)=>i.size).catch(()=>0);else xu+=t;if(xu<=r||E0)return;E0=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await x2(e,i)}catch(n){if(!p2(n))await $0(i).catch(()=>{}),await x2(e,i).catch(()=>$0(e).catch(()=>{}))}xu=0}finally{E0=!1}}function I2(e){return T0=Xn(e,`${zm()}.txt`),T0}async function QA(e,t,r,i){if(e)await HA(t,{recursive:!0}).catch(()=>{});let n=r;try{await S2(r,i)}catch(o){if(!k0(o))throw o;n=I2(r),await S2(n,i)}await $2(n,Buffer.byteLength(i)).catch(A0),T2()}function A0(){}function eR(){if(!Md){let e=null;Md=Xw({writeFn:(t)=>{let r=P2(),i=go(r),n=e!==i;if(e=i,P0()){if(n)try{kd().mkdirSync(i)}catch{}let o=r;try{kd().appendFileSync(r,t)}catch(s){if(!k0(s))throw s;o=I2(r),kd().appendFileSync(o,t)}$2(o,Buffer.byteLength(t)).catch(A0),T2();return}M0=M0.then(QA.bind(null,n,i,r,t)).catch(A0)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:P0()}),iS(async()=>{Md?.dispose(),await M0})}return Md}function zr(e,{level:t}={level:"debug"}){if(I0[t]<I0[VA()])return;if(!JA(e))return;if(XA&&e.includes(`
|
|
67
67
|
`))e=pn(e);let i=`${new Date().toISOString()} [${t.toUpperCase()}] ${w2(e.trim())}
|
|
68
68
|
`;if(M2()){g2(i);return}eR().write(i)}function P2(){return E2()??T0??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Xn(aS(),"debug",`${zm()}.txt`)}var T2=bn(async()=>{try{let e=P2(),t=go(e),r=Xn(t,"latest");await $0(r).catch(()=>{}),await KA(e,r)}catch{}});var $Q=(()=>{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})();var tR={[Symbol.dispose](){}};function rR(){return tR}var Wt=rR;function pn(e,t,r){let n=[];try{const i=Bt(n,Wt`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var s=o,h=1}finally{Ht(n,s,h)}}var ws=(e,t)=>{let i=[];try{const r=Bt(i,Wt`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var o=n,s=1}finally{Ht(i,o,s)}};class Po{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}function nR(){return{eventQueue:[],sink:null}}var iR=nR();function ku(e,t){let r=iR;if(r.sink===null){r.eventQueue.push({eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function oR(e,t){ku("tengu_feature_ok",{feature_name:Su(e),...t})}function sR(e,t,r){ku("tengu_feature_bad",{...r,feature_name:Su(e),error_code:t})}async function Mn(e,t,r){try{let i=await t();return oR(e),i}catch(i){throw sR(e,r?.(i)??"error"),i}}class R0{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var A2=Symbol("suppressControlResponse");class C0{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Po;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(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:ma(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}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(e,t,r,i,n,o=new Map,s,h,b,v,_,g){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=i;this.abortController=n;this.jsonSchema=s;this.initConfig=h;this.onElicitation=b;this.getOAuthToken=v;this.getHostAuthToken=_;this.onUserDialog=g;for(let[S,x]of o)this.connectSdkMcpServer(S,x);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),E_(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.lastErrorResultText=e.is_error?e.subtype==="success"?e.result:e.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)zr("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof Kn)){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);zr(`[Query.readMessages] Replacing exit error with result text. Original: ${Sd(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){zr(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===A2)return;let i={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(pn(i)+`
|
|
69
69
|
`))}catch(r){if(this.cleanupPerformed)return;let i={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Sd(r)}};try{await Promise.resolve(this.transport.write(pn(i)+`
|