synara 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +96 -95
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,101 +1,101 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var hS=Object.create;var Gc=Object.defineProperty;var gS=Object.getOwnPropertyDescriptor;var vS=Object.getOwnPropertyNames;var _S=Object.getPrototypeOf,yS=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ho=(t,e)=>{for(var r in e)Gc(t,r,{get:e[r],enumerable:!0})},$S=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vS(e))!yS.call(t,o)&&o!==r&&Gc(t,o,{get:()=>e[o],enumerable:!(n=gS(e,o))||n.enumerable});return t};var de=(t,e,r)=>(r=t!=null?hS(_S(t)):{},$S(e||!t||!t.__esModule?Gc(r,"default",{value:t,enumerable:!0}):r,t));var Gt=x((wR,jh)=>{"use strict";var Eh=["nodebuffer","arraybuffer","fragments"],Oh=typeof Blob<"u";Oh&&Eh.push("blob");jh.exports={BINARY_TYPES:Eh,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Oh,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var go=x((zR,da)=>{"use strict";var{EMPTY_BUFFER:bS}=Gt(),Kc=Buffer[Symbol.species];function xS(t,e){if(t.length===0)return bS;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let i=t[o];r.set(i,n),n+=i.length}return n<e?new Kc(r.buffer,r.byteOffset,n):r}function Nh(t,e,r,n,o){for(let i=0;i<o;i++)r[n+i]=t[i]^e[i&3]}function Rh(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function kS(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Hc(t){if(Hc.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Kc(t):ArrayBuffer.isView(t)?e=new Kc(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Hc.readOnly=!1),e}da.exports={concat:xS,mask:Nh,toArrayBuffer:kS,toBuffer:Hc,unmask:Rh};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=require("bufferutil");da.exports.mask=function(e,r,n,o,i){i<48?Nh(e,r,n,o,i):t.mask(e,r,n,o,i)},da.exports.unmask=function(e,r){e.length<32?Rh(e,r):t.unmask(e,r)}}catch{}});var Ah=x((IR,Dh)=>{"use strict";var Ch=Symbol("kDone"),Xc=Symbol("kRun"),Yc=class{constructor(e){this[Ch]=()=>{this.pending--,this[Xc]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Xc]()}[Xc](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ch])}}};Dh.exports=Yc});var ln=x((TR,Lh)=>{"use strict";var vo=require("zlib"),Uh=go(),SS=Ah(),{kStatusCode:Zh}=Gt(),wS=Buffer[Symbol.species],zS=Buffer.from([0,0,255,255]),pa=Symbol("permessage-deflate"),Kt=Symbol("total-length"),cn=Symbol("callback"),mr=Symbol("buffers"),un=Symbol("error"),fa,Qc=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!fa){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;fa=new SS(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[cn];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),e}decompress(e,r,n){fa.add(o=>{this._decompress(e,r,(i,a)=>{o(),n(i,a)})})}compress(e,r,n){fa.add(o=>{this._compress(e,r,(i,a)=>{o(),n(i,a)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?vo.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=vo.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[pa]=this,this._inflate[Kt]=0,this._inflate[mr]=[],this._inflate.on("error",TS),this._inflate.on("data",Mh)}this._inflate[cn]=n,this._inflate.write(e),r&&this._inflate.write(zS),this._inflate.flush(()=>{let i=this._inflate[un];if(i){this._inflate.close(),this._inflate=null,n(i);return}let a=Uh.concat(this._inflate[mr],this._inflate[Kt]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Kt]=0,this._inflate[mr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(e,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?vo.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=vo.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[Kt]=0,this._deflate[mr]=[],this._deflate.on("data",IS)}this._deflate[cn]=n,this._deflate.write(e),this._deflate.flush(vo.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=Uh.concat(this._deflate[mr],this._deflate[Kt]);r&&(i=new wS(i.buffer,i.byteOffset,i.length-4)),this._deflate[cn]=null,this._deflate[Kt]=0,this._deflate[mr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};Lh.exports=Qc;function IS(t){this[mr].push(t),this[Kt]+=t.length}function Mh(t){if(this[Kt]+=t.length,this[pa]._maxPayload<1||this[Kt]<=this[pa]._maxPayload){this[mr].push(t);return}this[un]=new RangeError("Max payload size exceeded"),this[un].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[un][Zh]=1009,this.removeListener("data",Mh),this.reset()}function TS(t){if(this[pa]._inflate=null,this[un]){this[cn](this[un]);return}t[Zh]=1007,this[cn](t)}});var dn=x((PR,ma)=>{"use strict";var{isUtf8:qh}=require("buffer"),{hasBlob:PS}=Gt(),ES=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function OS(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function eu(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function jS(t){return PS&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}ma.exports={isBlob:jS,isValidStatusCode:OS,isValidUTF8:eu,tokenChars:ES};if(qh)ma.exports.isValidUTF8=function(t){return t.length<24?eu(t):qh(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=require("utf-8-validate");ma.exports.isValidUTF8=function(e){return e.length<32?eu(e):t(e)}}catch{}});var iu=x((ER,Kh)=>{"use strict";var{Writable:NS}=require("stream"),Fh=ln(),{BINARY_TYPES:RS,EMPTY_BUFFER:Vh,kStatusCode:CS,kWebSocket:DS}=Gt(),{concat:tu,toArrayBuffer:AS,unmask:US}=go(),{isValidStatusCode:ZS,isValidUTF8:Bh}=dn(),ha=Buffer[Symbol.species],mt=0,Jh=1,Wh=2,Gh=3,ru=4,nu=5,ga=6,ou=class extends NS{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||RS[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[DS]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=mt}_write(e,r,n){if(this._opcode===8&&this._state==mt)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new ha(n.buffer,n.byteOffset+e,n.length-e),new ha(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new ha(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case mt:this.getInfo(e);break;case Jh:this.getPayloadLength16(e);break;case Wh:this.getPayloadLength64(e);break;case Gh:this.getMask();break;case ru:this.getData(e);break;case nu:case ga:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[Fh.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(o);return}this._payloadLength===126?this._state=Jh:this._payloadLength===127?this._state=Wh:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=Gh:this._state=ru}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ru}getData(e){let r=Vh;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&US(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=nu,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[Fh.extensionName].decompress(e,this._fin,(o,i)=>{if(o)return r(o);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(i)}this.dataMessage(r),this._state===mt&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=mt;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=tu(n,r):this._binaryType==="arraybuffer"?o=AS(tu(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=mt):(this._state=ga,setImmediate(()=>{this.emit("message",o,!0),this._state=mt,this.startLoop(e)}))}else{let o=tu(n,r);if(!this._skipUTF8Validation&&!Bh(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(i);return}this._state===nu||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=mt):(this._state=ga,setImmediate(()=>{this.emit("message",o,!1),this._state=mt,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Vh),this.end();else{let n=e.readUInt16BE(0);if(!ZS(n)){let i=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let o=new ha(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Bh(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(i);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=mt;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=mt):(this._state=ga,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=mt,this.startLoop(r)}))}createError(e,r,n,o,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=i,a[CS]=o,a}};Kh.exports=ou});var cu=x((jR,Yh)=>{"use strict";var{Duplex:OR}=require("stream"),{randomFillSync:MS}=require("crypto"),Hh=ln(),{EMPTY_BUFFER:LS,kWebSocket:qS,NOOP:FS}=Gt(),{isBlob:fn,isValidStatusCode:VS}=dn(),{mask:Xh,toBuffer:Cr}=go(),ht=Symbol("kByteLength"),BS=Buffer.alloc(4),va=8*1024,Dr,pn=va,zt=0,JS=1,WS=2,au=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=zt,this.onerror=FS,this[qS]=void 0}static frame(e,r){let n,o=!1,i=2,a=!1;r.mask&&(n=r.maskBuffer||BS,r.generateMask?r.generateMask(n):(pn===va&&(Dr===void 0&&(Dr=Buffer.alloc(va)),MS(Dr,0,va),pn=0),n[0]=Dr[pn++],n[1]=Dr[pn++],n[2]=Dr[pn++],n[3]=Dr[pn++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let s;typeof e=="string"?(!r.mask||a)&&r[ht]!==void 0?s=r[ht]:(e=Buffer.from(e),s=e.length):(s=e.length,o=r.mask&&r.readOnly&&!a);let c=s;s>=65536?(i+=8,c=127):s>125&&(i+=2,c=126);let u=Buffer.allocUnsafe(o?s+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(s,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(s,4,6)),r.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],a?[u,e]:o?(Xh(e,n,u,i,s),[u]):(Xh(e,n,e,0,s),[u,e])):[u,e]}close(e,r,n,o){let i;if(e===void 0)i=LS;else{if(typeof e!="number"||!VS(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{let s=Buffer.byteLength(r);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+s),i.writeUInt16BE(e,0),typeof r=="string"?i.write(r,2):i.set(r,2)}}let a={[ht]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==zt?this.enqueue([this.dispatch,i,!1,a,o]):this.sendFrame(t.frame(i,a),o)}ping(e,r,n){let o,i;if(typeof e=="string"?(o=Buffer.byteLength(e),i=!1):fn(e)?(o=e.size,i=!1):(e=Cr(e),o=e.length,i=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[ht]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};fn(e)?this._state!==zt?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==zt?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}pong(e,r,n){let o,i;if(typeof e=="string"?(o=Buffer.byteLength(e),i=!1):fn(e)?(o=e.size,i=!1):(e=Cr(e),o=e.length,i=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[ht]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};fn(e)?this._state!==zt?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==zt?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let o=this._extensions[Hh.extensionName],i=r.binary?2:1,a=r.compress,s,c;typeof e=="string"?(s=Buffer.byteLength(e),c=!1):fn(e)?(s=e.size,c=!1):(e=Cr(e),s=e.length,c=Cr.readOnly),this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=o._threshold),this._compress=a):(a=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[ht]:s,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};fn(e)?this._state!==zt?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==zt?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,o){this._bufferedBytes+=n[ht],this._state=WS,e.arrayBuffer().then(i=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(su,this,s,o);return}this._bufferedBytes-=n[ht];let a=Cr(i);r?this.dispatch(a,r,n,o):(this._state=zt,this.sendFrame(t.frame(a,n),o),this.dequeue())}).catch(i=>{process.nextTick(GS,this,i,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let i=this._extensions[Hh.extensionName];this._bufferedBytes+=n[ht],this._state=JS,i.compress(e,n.fin,(a,s)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");su(this,c,o);return}this._bufferedBytes-=n[ht],this._state=zt,n.readOnly=!1,this.sendFrame(t.frame(s,n),o),this.dequeue()})}dequeue(){for(;this._state===zt&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ht],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ht],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Yh.exports=au;function su(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],i=o[o.length-1];typeof i=="function"&&i(e)}}function GS(t,e,r){su(t,e,r),t.onerror(e)}});var sg=x((NR,ag)=>{"use strict";var{kForOnEventAttribute:_o,kListener:uu}=Gt(),Qh=Symbol("kCode"),eg=Symbol("kData"),tg=Symbol("kError"),rg=Symbol("kMessage"),ng=Symbol("kReason"),mn=Symbol("kTarget"),og=Symbol("kType"),ig=Symbol("kWasClean"),Ht=class{constructor(e){this[mn]=null,this[og]=e}get target(){return this[mn]}get type(){return this[og]}};Object.defineProperty(Ht.prototype,"target",{enumerable:!0});Object.defineProperty(Ht.prototype,"type",{enumerable:!0});var Ar=class extends Ht{constructor(e,r={}){super(e),this[Qh]=r.code===void 0?0:r.code,this[ng]=r.reason===void 0?"":r.reason,this[ig]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Qh]}get reason(){return this[ng]}get wasClean(){return this[ig]}};Object.defineProperty(Ar.prototype,"code",{enumerable:!0});Object.defineProperty(Ar.prototype,"reason",{enumerable:!0});Object.defineProperty(Ar.prototype,"wasClean",{enumerable:!0});var hn=class extends Ht{constructor(e,r={}){super(e),this[tg]=r.error===void 0?null:r.error,this[rg]=r.message===void 0?"":r.message}get error(){return this[tg]}get message(){return this[rg]}};Object.defineProperty(hn.prototype,"error",{enumerable:!0});Object.defineProperty(hn.prototype,"message",{enumerable:!0});var yo=class extends Ht{constructor(e,r={}){super(e),this[eg]=r.data===void 0?null:r.data}get data(){return this[eg]}};Object.defineProperty(yo.prototype,"data",{enumerable:!0});var KS={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[_o]&&o[uu]===e&&!o[_o])return;let n;if(t==="message")n=function(i,a){let s=new yo("message",{data:a?i:i.toString()});s[mn]=this,_a(e,this,s)};else if(t==="close")n=function(i,a){let s=new Ar("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[mn]=this,_a(e,this,s)};else if(t==="error")n=function(i){let a=new hn("error",{error:i,message:i.message});a[mn]=this,_a(e,this,a)};else if(t==="open")n=function(){let i=new Ht("open");i[mn]=this,_a(e,this,i)};else return;n[_o]=!!r[_o],n[uu]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[uu]===e&&!r[_o]){this.removeListener(t,r);break}}};ag.exports={CloseEvent:Ar,ErrorEvent:hn,Event:Ht,EventTarget:KS,MessageEvent:yo};function _a(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var ya=x((RR,cg)=>{"use strict";var{tokenChars:$o}=dn();function At(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function HS(t){let e=Object.create(null),r=Object.create(null),n=!1,o=!1,i=!1,a,s,c=-1,u=-1,l=-1,d=0;for(;d<t.length;d++)if(u=t.charCodeAt(d),a===void 0)if(l===-1&&$o[u]===1)c===-1&&(c=d);else if(d!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let p=t.slice(c,l);u===44?(At(e,p,r),r=Object.create(null)):a=p,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(s===void 0)if(l===-1&&$o[u]===1)c===-1&&(c=d);else if(u===32||u===9)l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d),At(r,t.slice(c,l),!0),u===44&&(At(e,a,r),r=Object.create(null),a=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)s=t.slice(c,d),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(o){if($o[u]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),o=!1}else if(i)if($o[u]===1)c===-1&&(c=d);else if(u===34&&c!==-1)i=!1,l=d;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===34&&t.charCodeAt(d-1)===61)i=!0;else if(l===-1&&$o[u]===1)c===-1&&(c=d);else if(c!==-1&&(u===32||u===9))l===-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let p=t.slice(c,l);n&&(p=p.replace(/\\/g,""),n=!1),At(r,s,p),u===44&&(At(e,a,r),r=Object.create(null),a=void 0),s=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=d);let f=t.slice(c,l);return a===void 0?At(e,f,r):(s===void 0?At(r,f,!0):n?At(r,s,f.replace(/\\/g,"")):At(r,s,f),At(e,a,r)),e}function XS(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let i=n[o];return Array.isArray(i)||(i=[i]),i.map(a=>a===!0?o:`${o}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}cg.exports={format:XS,parse:HS}});var ka=x((AR,$g)=>{"use strict";var YS=require("events"),QS=require("https"),ew=require("http"),dg=require("net"),tw=require("tls"),{randomBytes:rw,createHash:nw}=require("crypto"),{Duplex:CR,Readable:DR}=require("stream"),{URL:lu}=require("url"),hr=ln(),ow=iu(),iw=cu(),{isBlob:aw}=dn(),{BINARY_TYPES:ug,CLOSE_TIMEOUT:sw,EMPTY_BUFFER:$a,GUID:cw,kForOnEventAttribute:du,kListener:uw,kStatusCode:lw,kWebSocket:Re,NOOP:fg}=Gt(),{EventTarget:{addEventListener:dw,removeEventListener:fw}}=sg(),{format:pw,parse:mw}=ya(),{toBuffer:hw}=go(),pg=Symbol("kAborted"),fu=[8,13],Xt=["CONNECTING","OPEN","CLOSING","CLOSED"],gw=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Se=class t extends YS{constructor(e,r,n){super(),this._binaryType=ug[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=$a,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),mg(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){ug.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new ow({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new iw(e,this._extensions,n.generateMask);this._receiver=o,this._sender=i,this._socket=e,o[Re]=this,i[Re]=this,e[Re]=this,o.on("conclude",yw),o.on("drain",$w),o.on("error",bw),o.on("message",xw),o.on("ping",kw),o.on("pong",Sw),i.onerror=ww,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",vg),e.on("data",xa),e.on("end",_g),e.on("error",yg),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[hr.extensionName]&&this._extensions[hr.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){at(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),gg(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){pu(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||$a,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){pu(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||$a,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){pu(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[hr.extensionName]||(o.compress=!1),this._sender.send(e||$a,o,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){at(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(Se,"CONNECTING",{enumerable:!0,value:Xt.indexOf("CONNECTING")});Object.defineProperty(Se.prototype,"CONNECTING",{enumerable:!0,value:Xt.indexOf("CONNECTING")});Object.defineProperty(Se,"OPEN",{enumerable:!0,value:Xt.indexOf("OPEN")});Object.defineProperty(Se.prototype,"OPEN",{enumerable:!0,value:Xt.indexOf("OPEN")});Object.defineProperty(Se,"CLOSING",{enumerable:!0,value:Xt.indexOf("CLOSING")});Object.defineProperty(Se.prototype,"CLOSING",{enumerable:!0,value:Xt.indexOf("CLOSING")});Object.defineProperty(Se,"CLOSED",{enumerable:!0,value:Xt.indexOf("CLOSED")});Object.defineProperty(Se.prototype,"CLOSED",{enumerable:!0,value:Xt.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(Se.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(Se.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[du])return e[uw];return null},set(e){for(let r of this.listeners(t))if(r[du]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[du]:!0})}})});Se.prototype.addEventListener=dw;Se.prototype.removeEventListener=fw;$g.exports=Se;function mg(t,e,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:sw,protocolVersion:fu[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!fu.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${fu.join(", ")})`);let i;if(e instanceof lu)i=e;else try{i=new lu(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),t._url=i.href;let a=i.protocol==="wss:",s=i.protocol==="ws+unix:",c;if(i.protocol!=="ws:"&&!a&&!s?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!i.pathname?c="The URL's pathname is empty":i.hash&&(c="The URL contains a fragment identifier"),c){let h=new SyntaxError(c);if(t._redirects===0)throw h;ba(t,h);return}let u=a?443:80,l=rw(16).toString("base64"),d=a?QS.request:ew.request,f=new Set,p;if(o.createConnection=o.createConnection||(a?_w:vw),o.defaultPort=o.defaultPort||u,o.port=i.port||u,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(p=new hr({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=pw({[hr.extensionName]:p.offer()})),r.length){for(let h of r){if(typeof h!="string"||!gw.test(h)||f.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),s){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let g;if(o.followRedirects){if(t._redirects===0){t._originalIpc=s,t._originalSecure=a,t._originalHostOrSocketPath=s?o.socketPath:i.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,w]of Object.entries(h))n.headers[y.toLowerCase()]=w}else if(t.listenerCount("redirect")===0){let h=s?t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:i.host===t._originalHostOrSocketPath;(!h||t._originalSecure&&!a)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),g=t._req=d(o),t._redirects&&t.emit("redirect",t.url,g)}else g=t._req=d(o);o.timeout&&g.on("timeout",()=>{at(t,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[pg]||(g=t._req=null,ba(t,h))}),g.on("response",h=>{let y=h.headers.location,w=h.statusCode;if(y&&o.followRedirects&&w>=300&&w<400){if(++t._redirects>o.maxRedirects){at(t,g,"Maximum redirects exceeded");return}g.abort();let P;try{P=new lu(y,e)}catch{let z=new SyntaxError(`Invalid URL: ${y}`);ba(t,z);return}mg(t,P,r,n)}else t.emit("unexpected-response",g,h)||at(t,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,w)=>{if(t.emit("upgrade",h),t.readyState!==Se.CONNECTING)return;g=t._req=null;let P=h.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){at(t,y,"Invalid Upgrade header");return}let j=nw("sha1").update(l+cw).digest("base64");if(h.headers["sec-websocket-accept"]!==j){at(t,y,"Invalid Sec-WebSocket-Accept header");return}let z=h.headers["sec-websocket-protocol"],N;if(z!==void 0?f.size?f.has(z)||(N="Server sent an invalid subprotocol"):N="Server sent a subprotocol but none was requested":f.size&&(N="Server sent no subprotocol"),N){at(t,y,N);return}z&&(t._protocol=z);let Ce=h.headers["sec-websocket-extensions"];if(Ce!==void 0){if(!p){at(t,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ce;try{ce=mw(Ce)}catch{at(t,y,"Invalid Sec-WebSocket-Extensions header");return}let $=Object.keys(ce);if($.length!==1||$[0]!==hr.extensionName){at(t,y,"Server indicated an extension that was not requested");return}try{p.accept(ce[hr.extensionName])}catch{at(t,y,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[hr.extensionName]=p}t.setSocket(y,w,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(g,t):g.end()}function ba(t,e){t._readyState=Se.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function vw(t){return t.path=t.socketPath,dg.connect(t)}function _w(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=dg.isIP(t.host)?"":t.host),tw.connect(t)}function at(t,e,r){t._readyState=Se.CLOSING;let n=new Error(r);Error.captureStackTrace(n,at),e.setHeader?(e[pg]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ba,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function pu(t,e,r){if(e){let n=aw(e)?e.size:hw(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Xt[t.readyState]})`);process.nextTick(r,n)}}function yw(t,e){let r=this[Re];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[Re]!==void 0&&(r._socket.removeListener("data",xa),process.nextTick(hg,r._socket),t===1005?r.close():r.close(t,e))}function $w(){let t=this[Re];t.isPaused||t._socket.resume()}function bw(t){let e=this[Re];e._socket[Re]!==void 0&&(e._socket.removeListener("data",xa),process.nextTick(hg,e._socket),e.close(t[lw])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function lg(){this[Re].emitClose()}function xw(t,e){this[Re].emit("message",t,e)}function kw(t){let e=this[Re];e._autoPong&&e.pong(t,!this._isServer,fg),e.emit("ping",t)}function Sw(t){this[Re].emit("pong",t)}function hg(t){t.resume()}function ww(t){let e=this[Re];e.readyState!==Se.CLOSED&&(e.readyState===Se.OPEN&&(e._readyState=Se.CLOSING,gg(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function gg(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function vg(){let t=this[Re];if(this.removeListener("close",vg),this.removeListener("data",xa),this.removeListener("end",_g),t._readyState=Se.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[Re]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",lg),t._receiver.on("finish",lg))}function xa(t){this[Re]._receiver.write(t)||this.pause()}function _g(){let t=this[Re];t._readyState=Se.CLOSING,t._receiver.end(),this.end()}function yg(){let t=this[Re];this.removeListener("error",yg),this.on("error",fg),t&&(t._readyState=Se.CLOSING,this.destroy())}});var Sg=x((ZR,kg)=>{"use strict";var UR=ka(),{Duplex:zw}=require("stream");function bg(t){t.emit("close")}function Iw(){!this.destroyed&&this._writableState.finished&&this.destroy()}function xg(t){this.removeListener("error",xg),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Tw(t,e){let r=!0,n=new zw({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(i,a){let s=!a&&n._readableState.objectMode?i.toString():i;n.push(s)||t.pause()}),t.once("error",function(i){n.destroyed||(r=!1,n.destroy(i))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,i){if(t.readyState===t.CLOSED){i(o),process.nextTick(bg,n);return}let a=!1;t.once("error",function(c){a=!0,i(c)}),t.once("close",function(){a||i(o),process.nextTick(bg,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(o,i,a){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,i,a)});return}t.send(o,a)},n.on("end",Iw),n.on("error",xg),n}kg.exports=Tw});var mu=x((MR,wg)=>{"use strict";var{tokenChars:Pw}=dn();function Ew(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){let a=t.charCodeAt(o);if(n===-1&&Pw[a]===1)r===-1&&(r=o);else if(o!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=o);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let s=t.slice(r,n);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);e.add(s),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let i=t.slice(r,o);if(e.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return e.add(i),e}wg.exports={parse:Ew}});var jg=x((qR,Og)=>{"use strict";var Ow=require("events"),Sa=require("http"),{Duplex:LR}=require("stream"),{createHash:jw}=require("crypto"),zg=ya(),Ur=ln(),Nw=mu(),Rw=ka(),{CLOSE_TIMEOUT:Cw,GUID:Dw,kWebSocket:Aw}=Gt(),Uw=/^[+/0-9A-Za-z]{22}==$/,Ig=0,Tg=1,Eg=2,hu=class extends Ow{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Cw,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Rw,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Sa.createServer((n,o)=>{let i=Sa.STATUS_CODES[426];o.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),o.end(i)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Zw(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,i,a)=>{this.handleUpgrade(o,i,a,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ig}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Eg){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(bo,this);return}if(e&&this.once("close",e),this._state!==Tg)if(this._state=Tg,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(bo,this):process.nextTick(bo,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{bo(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){r.on("error",Pg);let i=e.headers["sec-websocket-key"],a=e.headers.upgrade,s=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Zr(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){Zr(this,e,r,400,"Invalid Upgrade header");return}if(i===void 0||!Uw.test(i)){Zr(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){Zr(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){xo(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=Nw.parse(c)}catch{Zr(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&l!==void 0){let f=new Ur({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let p=zg.parse(l);p[Ur.extensionName]&&(f.accept(p[Ur.extensionName]),d[Ur.extensionName]=f)}catch{Zr(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:e.headers[`${s===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(p,g,h,y)=>{if(!p)return xo(r,g||401,h,y);this.completeUpgrade(d,i,u,e,r,n,o)});return}if(!this.options.verifyClient(f))return xo(r,401)}this.completeUpgrade(d,i,u,e,r,n,o)}completeUpgrade(e,r,n,o,i,a,s){if(!i.readable||!i.writable)return i.destroy();if(i[Aw])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ig)return xo(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${jw("sha1").update(r+Dw).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;d&&(u.push(`Sec-WebSocket-Protocol: ${d}`),l._protocol=d)}if(e[Ur.extensionName]){let d=e[Ur.extensionName].params,f=zg.format({[Ur.extensionName]:[d]});u.push(`Sec-WebSocket-Extensions: ${f}`),l._extensions=e}this.emit("headers",u,o),i.write(u.concat(`\r
2
+ "use strict";var gS=Object.create;var Yc=Object.defineProperty;var vS=Object.getOwnPropertyDescriptor;var _S=Object.getOwnPropertyNames;var yS=Object.getPrototypeOf,$S=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vo=(t,e)=>{for(var r in e)Yc(t,r,{get:e[r],enumerable:!0})},bS=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _S(e))!$S.call(t,o)&&o!==r&&Yc(t,o,{get:()=>e[o],enumerable:!(n=vS(e,o))||n.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?gS(yS(t)):{},bS(e||!t||!t.__esModule?Yc(r,"default",{value:t,enumerable:!0}):r,t));var Ht=x((IR,Ch)=>{"use strict";var Nh=["nodebuffer","arraybuffer","fragments"],Rh=typeof Blob<"u";Rh&&Nh.push("blob");Ch.exports={BINARY_TYPES:Nh,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Rh,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var _o=x((TR,ha)=>{"use strict";var{EMPTY_BUFFER:xS}=Ht(),Qc=Buffer[Symbol.species];function kS(t,e){if(t.length===0)return xS;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let i=t[o];r.set(i,n),n+=i.length}return n<e?new Qc(r.buffer,r.byteOffset,n):r}function Dh(t,e,r,n,o){for(let i=0;i<o;i++)r[n+i]=t[i]^e[i&3]}function Ah(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function SS(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function eu(t){if(eu.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Qc(t):ArrayBuffer.isView(t)?e=new Qc(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),eu.readOnly=!1),e}ha.exports={concat:kS,mask:Dh,toArrayBuffer:SS,toBuffer:eu,unmask:Ah};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=require("bufferutil");ha.exports.mask=function(e,r,n,o,i){i<48?Dh(e,r,n,o,i):t.mask(e,r,n,o,i)},ha.exports.unmask=function(e,r){e.length<32?Ah(e,r):t.unmask(e,r)}}catch{}});var Mh=x((PR,Zh)=>{"use strict";var Uh=Symbol("kDone"),tu=Symbol("kRun"),ru=class{constructor(e){this[Uh]=()=>{this.pending--,this[tu]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[tu]()}[tu](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Uh])}}};Zh.exports=ru});var pn=x((ER,Vh)=>{"use strict";var yo=require("zlib"),Lh=_o(),wS=Mh(),{kStatusCode:qh}=Ht(),zS=Buffer[Symbol.species],IS=Buffer.from([0,0,255,255]),va=Symbol("permessage-deflate"),Xt=Symbol("total-length"),dn=Symbol("callback"),gr=Symbol("buffers"),fn=Symbol("error"),ga,nu=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!ga){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ga=new wS(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[dn];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),e}decompress(e,r,n){ga.add(o=>{this._decompress(e,r,(i,a)=>{o(),n(i,a)})})}compress(e,r,n){ga.add(o=>{this._compress(e,r,(i,a)=>{o(),n(i,a)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?yo.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=yo.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[va]=this,this._inflate[Xt]=0,this._inflate[gr]=[],this._inflate.on("error",PS),this._inflate.on("data",Fh)}this._inflate[dn]=n,this._inflate.write(e),r&&this._inflate.write(IS),this._inflate.flush(()=>{let i=this._inflate[fn];if(i){this._inflate.close(),this._inflate=null,n(i);return}let a=Lh.concat(this._inflate[gr],this._inflate[Xt]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Xt]=0,this._inflate[gr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(e,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?yo.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=yo.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[Xt]=0,this._deflate[gr]=[],this._deflate.on("data",TS)}this._deflate[dn]=n,this._deflate.write(e),this._deflate.flush(yo.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=Lh.concat(this._deflate[gr],this._deflate[Xt]);r&&(i=new zS(i.buffer,i.byteOffset,i.length-4)),this._deflate[dn]=null,this._deflate[Xt]=0,this._deflate[gr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};Vh.exports=nu;function TS(t){this[gr].push(t),this[Xt]+=t.length}function Fh(t){if(this[Xt]+=t.length,this[va]._maxPayload<1||this[Xt]<=this[va]._maxPayload){this[gr].push(t);return}this[fn]=new RangeError("Max payload size exceeded"),this[fn].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[fn][qh]=1009,this.removeListener("data",Fh),this.reset()}function PS(t){if(this[va]._inflate=null,this[fn]){this[dn](this[fn]);return}t[qh]=1007,this[dn](t)}});var mn=x((OR,_a)=>{"use strict";var{isUtf8:Bh}=require("buffer"),{hasBlob:ES}=Ht(),OS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function jS(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function ou(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function NS(t){return ES&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}_a.exports={isBlob:NS,isValidStatusCode:jS,isValidUTF8:ou,tokenChars:OS};if(Bh)_a.exports.isValidUTF8=function(t){return t.length<24?ou(t):Bh(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=require("utf-8-validate");_a.exports.isValidUTF8=function(e){return e.length<32?ou(e):t(e)}}catch{}});var uu=x((jR,Yh)=>{"use strict";var{Writable:RS}=require("stream"),Jh=pn(),{BINARY_TYPES:CS,EMPTY_BUFFER:Wh,kStatusCode:DS,kWebSocket:AS}=Ht(),{concat:iu,toArrayBuffer:US,unmask:ZS}=_o(),{isValidStatusCode:MS,isValidUTF8:Gh}=mn(),ya=Buffer[Symbol.species],gt=0,Kh=1,Hh=2,Xh=3,au=4,su=5,$a=6,cu=class extends RS{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||CS[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[AS]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=gt}_write(e,r,n){if(this._opcode===8&&this._state==gt)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new ya(n.buffer,n.byteOffset+e,n.length-e),new ya(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new ya(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case gt:this.getInfo(e);break;case Kh:this.getPayloadLength16(e);break;case Hh:this.getPayloadLength64(e);break;case Xh:this.getMask();break;case au:this.getData(e);break;case su:case $a:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[Jh.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(o);return}this._payloadLength===126?this._state=Kh:this._payloadLength===127?this._state=Hh:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=Xh:this._state=au}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=au}getData(e){let r=Wh;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&ZS(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=su,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[Jh.extensionName].decompress(e,this._fin,(o,i)=>{if(o)return r(o);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(i)}this.dataMessage(r),this._state===gt&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=gt;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=iu(n,r):this._binaryType==="arraybuffer"?o=US(iu(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=gt):(this._state=$a,setImmediate(()=>{this.emit("message",o,!0),this._state=gt,this.startLoop(e)}))}else{let o=iu(n,r);if(!this._skipUTF8Validation&&!Gh(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(i);return}this._state===su||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=gt):(this._state=$a,setImmediate(()=>{this.emit("message",o,!1),this._state=gt,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Wh),this.end();else{let n=e.readUInt16BE(0);if(!MS(n)){let i=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let o=new ya(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Gh(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(i);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=gt;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=gt):(this._state=$a,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=gt,this.startLoop(r)}))}createError(e,r,n,o,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=i,a[DS]=o,a}};Yh.exports=cu});var fu=x((RR,tg)=>{"use strict";var{Duplex:NR}=require("stream"),{randomFillSync:LS}=require("crypto"),Qh=pn(),{EMPTY_BUFFER:qS,kWebSocket:FS,NOOP:VS}=Ht(),{isBlob:hn,isValidStatusCode:BS}=mn(),{mask:eg,toBuffer:Ar}=_o(),vt=Symbol("kByteLength"),JS=Buffer.alloc(4),ba=8*1024,Ur,gn=ba,Tt=0,WS=1,GS=2,lu=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Tt,this.onerror=VS,this[FS]=void 0}static frame(e,r){let n,o=!1,i=2,a=!1;r.mask&&(n=r.maskBuffer||JS,r.generateMask?r.generateMask(n):(gn===ba&&(Ur===void 0&&(Ur=Buffer.alloc(ba)),LS(Ur,0,ba),gn=0),n[0]=Ur[gn++],n[1]=Ur[gn++],n[2]=Ur[gn++],n[3]=Ur[gn++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let s;typeof e=="string"?(!r.mask||a)&&r[vt]!==void 0?s=r[vt]:(e=Buffer.from(e),s=e.length):(s=e.length,o=r.mask&&r.readOnly&&!a);let c=s;s>=65536?(i+=8,c=127):s>125&&(i+=2,c=126);let u=Buffer.allocUnsafe(o?s+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(s,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(s,4,6)),r.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],a?[u,e]:o?(eg(e,n,u,i,s),[u]):(eg(e,n,e,0,s),[u,e])):[u,e]}close(e,r,n,o){let i;if(e===void 0)i=qS;else{if(typeof e!="number"||!BS(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{let s=Buffer.byteLength(r);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+s),i.writeUInt16BE(e,0),typeof r=="string"?i.write(r,2):i.set(r,2)}}let a={[vt]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Tt?this.enqueue([this.dispatch,i,!1,a,o]):this.sendFrame(t.frame(i,a),o)}ping(e,r,n){let o,i;if(typeof e=="string"?(o=Buffer.byteLength(e),i=!1):hn(e)?(o=e.size,i=!1):(e=Ar(e),o=e.length,i=Ar.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[vt]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};hn(e)?this._state!==Tt?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==Tt?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}pong(e,r,n){let o,i;if(typeof e=="string"?(o=Buffer.byteLength(e),i=!1):hn(e)?(o=e.size,i=!1):(e=Ar(e),o=e.length,i=Ar.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[vt]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};hn(e)?this._state!==Tt?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==Tt?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let o=this._extensions[Qh.extensionName],i=r.binary?2:1,a=r.compress,s,c;typeof e=="string"?(s=Buffer.byteLength(e),c=!1):hn(e)?(s=e.size,c=!1):(e=Ar(e),s=e.length,c=Ar.readOnly),this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=s>=o._threshold),this._compress=a):(a=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[vt]:s,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};hn(e)?this._state!==Tt?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==Tt?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,o){this._bufferedBytes+=n[vt],this._state=GS,e.arrayBuffer().then(i=>{if(this._socket.destroyed){let s=new Error("The socket was closed while the blob was being read");process.nextTick(du,this,s,o);return}this._bufferedBytes-=n[vt];let a=Ar(i);r?this.dispatch(a,r,n,o):(this._state=Tt,this.sendFrame(t.frame(a,n),o),this.dequeue())}).catch(i=>{process.nextTick(KS,this,i,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let i=this._extensions[Qh.extensionName];this._bufferedBytes+=n[vt],this._state=WS,i.compress(e,n.fin,(a,s)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");du(this,c,o);return}this._bufferedBytes-=n[vt],this._state=Tt,n.readOnly=!1,this.sendFrame(t.frame(s,n),o),this.dequeue()})}dequeue(){for(;this._state===Tt&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][vt],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][vt],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};tg.exports=lu;function du(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],i=o[o.length-1];typeof i=="function"&&i(e)}}function KS(t,e,r){du(t,e,r),t.onerror(e)}});var lg=x((CR,ug)=>{"use strict";var{kForOnEventAttribute:$o,kListener:pu}=Ht(),rg=Symbol("kCode"),ng=Symbol("kData"),og=Symbol("kError"),ig=Symbol("kMessage"),ag=Symbol("kReason"),vn=Symbol("kTarget"),sg=Symbol("kType"),cg=Symbol("kWasClean"),Yt=class{constructor(e){this[vn]=null,this[sg]=e}get target(){return this[vn]}get type(){return this[sg]}};Object.defineProperty(Yt.prototype,"target",{enumerable:!0});Object.defineProperty(Yt.prototype,"type",{enumerable:!0});var Zr=class extends Yt{constructor(e,r={}){super(e),this[rg]=r.code===void 0?0:r.code,this[ag]=r.reason===void 0?"":r.reason,this[cg]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[rg]}get reason(){return this[ag]}get wasClean(){return this[cg]}};Object.defineProperty(Zr.prototype,"code",{enumerable:!0});Object.defineProperty(Zr.prototype,"reason",{enumerable:!0});Object.defineProperty(Zr.prototype,"wasClean",{enumerable:!0});var _n=class extends Yt{constructor(e,r={}){super(e),this[og]=r.error===void 0?null:r.error,this[ig]=r.message===void 0?"":r.message}get error(){return this[og]}get message(){return this[ig]}};Object.defineProperty(_n.prototype,"error",{enumerable:!0});Object.defineProperty(_n.prototype,"message",{enumerable:!0});var bo=class extends Yt{constructor(e,r={}){super(e),this[ng]=r.data===void 0?null:r.data}get data(){return this[ng]}};Object.defineProperty(bo.prototype,"data",{enumerable:!0});var HS={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[$o]&&o[pu]===e&&!o[$o])return;let n;if(t==="message")n=function(i,a){let s=new bo("message",{data:a?i:i.toString()});s[vn]=this,xa(e,this,s)};else if(t==="close")n=function(i,a){let s=new Zr("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[vn]=this,xa(e,this,s)};else if(t==="error")n=function(i){let a=new _n("error",{error:i,message:i.message});a[vn]=this,xa(e,this,a)};else if(t==="open")n=function(){let i=new Yt("open");i[vn]=this,xa(e,this,i)};else return;n[$o]=!!r[$o],n[pu]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[pu]===e&&!r[$o]){this.removeListener(t,r);break}}};ug.exports={CloseEvent:Zr,ErrorEvent:_n,Event:Yt,EventTarget:HS,MessageEvent:bo};function xa(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var ka=x((DR,dg)=>{"use strict";var{tokenChars:xo}=mn();function Mt(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function XS(t){let e=Object.create(null),r=Object.create(null),n=!1,o=!1,i=!1,a,s,c=-1,u=-1,l=-1,d=0;for(;d<t.length;d++)if(u=t.charCodeAt(d),a===void 0)if(l===-1&&xo[u]===1)c===-1&&(c=d);else if(d!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let f=t.slice(c,l);u===44?(Mt(e,f,r),r=Object.create(null)):a=f,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(s===void 0)if(l===-1&&xo[u]===1)c===-1&&(c=d);else if(u===32||u===9)l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d),Mt(r,t.slice(c,l),!0),u===44&&(Mt(e,a,r),r=Object.create(null),a=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)s=t.slice(c,d),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(o){if(xo[u]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),o=!1}else if(i)if(xo[u]===1)c===-1&&(c=d);else if(u===34&&c!==-1)i=!1,l=d;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===34&&t.charCodeAt(d-1)===61)i=!0;else if(l===-1&&xo[u]===1)c===-1&&(c=d);else if(c!==-1&&(u===32||u===9))l===-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let f=t.slice(c,l);n&&(f=f.replace(/\\/g,""),n=!1),Mt(r,s,f),u===44&&(Mt(e,a,r),r=Object.create(null),a=void 0),s=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=d);let p=t.slice(c,l);return a===void 0?Mt(e,p,r):(s===void 0?Mt(r,p,!0):n?Mt(r,s,p.replace(/\\/g,"")):Mt(r,s,p),Mt(e,a,r)),e}function YS(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let i=n[o];return Array.isArray(i)||(i=[i]),i.map(a=>a===!0?o:`${o}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}dg.exports={format:YS,parse:XS}});var Ia=x((ZR,kg)=>{"use strict";var QS=require("events"),ew=require("https"),tw=require("http"),mg=require("net"),rw=require("tls"),{randomBytes:nw,createHash:ow}=require("crypto"),{Duplex:AR,Readable:UR}=require("stream"),{URL:mu}=require("url"),vr=pn(),iw=uu(),aw=fu(),{isBlob:sw}=mn(),{BINARY_TYPES:fg,CLOSE_TIMEOUT:cw,EMPTY_BUFFER:Sa,GUID:uw,kForOnEventAttribute:hu,kListener:lw,kStatusCode:dw,kWebSocket:De,NOOP:hg}=Ht(),{EventTarget:{addEventListener:fw,removeEventListener:pw}}=lg(),{format:mw,parse:hw}=ka(),{toBuffer:gw}=_o(),gg=Symbol("kAborted"),gu=[8,13],Qt=["CONNECTING","OPEN","CLOSING","CLOSED"],vw=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Ie=class t extends QS{constructor(e,r,n){super(),this._binaryType=fg[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Sa,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),vg(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){fg.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new iw({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new aw(e,this._extensions,n.generateMask);this._receiver=o,this._sender=i,this._socket=e,o[De]=this,i[De]=this,e[De]=this,o.on("conclude",$w),o.on("drain",bw),o.on("error",xw),o.on("message",kw),o.on("ping",Sw),o.on("pong",ww),i.onerror=zw,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",$g),e.on("data",za),e.on("end",bg),e.on("error",xg),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[vr.extensionName]&&this._extensions[vr.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){ct(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),yg(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){vu(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Sa,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){vu(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Sa,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){vu(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[vr.extensionName]||(o.compress=!1),this._sender.send(e||Sa,o,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){ct(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(Ie,"CONNECTING",{enumerable:!0,value:Qt.indexOf("CONNECTING")});Object.defineProperty(Ie.prototype,"CONNECTING",{enumerable:!0,value:Qt.indexOf("CONNECTING")});Object.defineProperty(Ie,"OPEN",{enumerable:!0,value:Qt.indexOf("OPEN")});Object.defineProperty(Ie.prototype,"OPEN",{enumerable:!0,value:Qt.indexOf("OPEN")});Object.defineProperty(Ie,"CLOSING",{enumerable:!0,value:Qt.indexOf("CLOSING")});Object.defineProperty(Ie.prototype,"CLOSING",{enumerable:!0,value:Qt.indexOf("CLOSING")});Object.defineProperty(Ie,"CLOSED",{enumerable:!0,value:Qt.indexOf("CLOSED")});Object.defineProperty(Ie.prototype,"CLOSED",{enumerable:!0,value:Qt.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(Ie.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(Ie.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[hu])return e[lw];return null},set(e){for(let r of this.listeners(t))if(r[hu]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[hu]:!0})}})});Ie.prototype.addEventListener=fw;Ie.prototype.removeEventListener=pw;kg.exports=Ie;function vg(t,e,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:cw,protocolVersion:gu[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!gu.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${gu.join(", ")})`);let i;if(e instanceof mu)i=e;else try{i=new mu(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),t._url=i.href;let a=i.protocol==="wss:",s=i.protocol==="ws+unix:",c;if(i.protocol!=="ws:"&&!a&&!s?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!i.pathname?c="The URL's pathname is empty":i.hash&&(c="The URL contains a fragment identifier"),c){let h=new SyntaxError(c);if(t._redirects===0)throw h;wa(t,h);return}let u=a?443:80,l=nw(16).toString("base64"),d=a?ew.request:tw.request,p=new Set,f;if(o.createConnection=o.createConnection||(a?yw:_w),o.defaultPort=o.defaultPort||u,o.port=i.port||u,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new vr({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=mw({[vr.extensionName]:f.offer()})),r.length){for(let h of r){if(typeof h!="string"||!vw.test(h)||p.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),s){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let v;if(o.followRedirects){if(t._redirects===0){t._originalIpc=s,t._originalSecure=a,t._originalHostOrSocketPath=s?o.socketPath:i.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[$,w]of Object.entries(h))n.headers[$.toLowerCase()]=w}else if(t.listenerCount("redirect")===0){let h=s?t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:i.host===t._originalHostOrSocketPath;(!h||t._originalSecure&&!a)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),v=t._req=d(o),t._redirects&&t.emit("redirect",t.url,v)}else v=t._req=d(o);o.timeout&&v.on("timeout",()=>{ct(t,v,"Opening handshake has timed out")}),v.on("error",h=>{v===null||v[gg]||(v=t._req=null,wa(t,h))}),v.on("response",h=>{let $=h.headers.location,w=h.statusCode;if($&&o.followRedirects&&w>=300&&w<400){if(++t._redirects>o.maxRedirects){ct(t,v,"Maximum redirects exceeded");return}v.abort();let P;try{P=new mu($,e)}catch{let U=new SyntaxError(`Invalid URL: ${$}`);wa(t,U);return}vg(t,P,r,n)}else t.emit("unexpected-response",v,h)||ct(t,v,`Unexpected server response: ${h.statusCode}`)}),v.on("upgrade",(h,$,w)=>{if(t.emit("upgrade",h),t.readyState!==Ie.CONNECTING)return;v=t._req=null;let P=h.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){ct(t,$,"Invalid Upgrade header");return}let j=ow("sha1").update(l+uw).digest("base64");if(h.headers["sec-websocket-accept"]!==j){ct(t,$,"Invalid Sec-WebSocket-Accept header");return}let U=h.headers["sec-websocket-protocol"],z;if(U!==void 0?p.size?p.has(U)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":p.size&&(z="Server sent no subprotocol"),z){ct(t,$,z);return}U&&(t._protocol=U);let Ae=h.headers["sec-websocket-extensions"];if(Ae!==void 0){if(!f){ct(t,$,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Ne;try{Ne=hw(Ae)}catch{ct(t,$,"Invalid Sec-WebSocket-Extensions header");return}let ze=Object.keys(Ne);if(ze.length!==1||ze[0]!==vr.extensionName){ct(t,$,"Server indicated an extension that was not requested");return}try{f.accept(Ne[vr.extensionName])}catch{ct(t,$,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[vr.extensionName]=f}t.setSocket($,w,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(v,t):v.end()}function wa(t,e){t._readyState=Ie.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function _w(t){return t.path=t.socketPath,mg.connect(t)}function yw(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=mg.isIP(t.host)?"":t.host),rw.connect(t)}function ct(t,e,r){t._readyState=Ie.CLOSING;let n=new Error(r);Error.captureStackTrace(n,ct),e.setHeader?(e[gg]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(wa,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function vu(t,e,r){if(e){let n=sw(e)?e.size:gw(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Qt[t.readyState]})`);process.nextTick(r,n)}}function $w(t,e){let r=this[De];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[De]!==void 0&&(r._socket.removeListener("data",za),process.nextTick(_g,r._socket),t===1005?r.close():r.close(t,e))}function bw(){let t=this[De];t.isPaused||t._socket.resume()}function xw(t){let e=this[De];e._socket[De]!==void 0&&(e._socket.removeListener("data",za),process.nextTick(_g,e._socket),e.close(t[dw])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function pg(){this[De].emitClose()}function kw(t,e){this[De].emit("message",t,e)}function Sw(t){let e=this[De];e._autoPong&&e.pong(t,!this._isServer,hg),e.emit("ping",t)}function ww(t){this[De].emit("pong",t)}function _g(t){t.resume()}function zw(t){let e=this[De];e.readyState!==Ie.CLOSED&&(e.readyState===Ie.OPEN&&(e._readyState=Ie.CLOSING,yg(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function yg(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function $g(){let t=this[De];if(this.removeListener("close",$g),this.removeListener("data",za),this.removeListener("end",bg),t._readyState=Ie.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[De]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",pg),t._receiver.on("finish",pg))}function za(t){this[De]._receiver.write(t)||this.pause()}function bg(){let t=this[De];t._readyState=Ie.CLOSING,t._receiver.end(),this.end()}function xg(){let t=this[De];this.removeListener("error",xg),this.on("error",hg),t&&(t._readyState=Ie.CLOSING,this.destroy())}});var Ig=x((LR,zg)=>{"use strict";var MR=Ia(),{Duplex:Iw}=require("stream");function Sg(t){t.emit("close")}function Tw(){!this.destroyed&&this._writableState.finished&&this.destroy()}function wg(t){this.removeListener("error",wg),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Pw(t,e){let r=!0,n=new Iw({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(i,a){let s=!a&&n._readableState.objectMode?i.toString():i;n.push(s)||t.pause()}),t.once("error",function(i){n.destroyed||(r=!1,n.destroy(i))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,i){if(t.readyState===t.CLOSED){i(o),process.nextTick(Sg,n);return}let a=!1;t.once("error",function(c){a=!0,i(c)}),t.once("close",function(){a||i(o),process.nextTick(Sg,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(o,i,a){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,i,a)});return}t.send(o,a)},n.on("end",Tw),n.on("error",wg),n}zg.exports=Pw});var _u=x((qR,Tg)=>{"use strict";var{tokenChars:Ew}=mn();function Ow(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){let a=t.charCodeAt(o);if(n===-1&&Ew[a]===1)r===-1&&(r=o);else if(o!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=o);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let s=t.slice(r,n);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);e.add(s),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let i=t.slice(r,o);if(e.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return e.add(i),e}Tg.exports={parse:Ow}});var Cg=x((VR,Rg)=>{"use strict";var jw=require("events"),Ta=require("http"),{Duplex:FR}=require("stream"),{createHash:Nw}=require("crypto"),Pg=ka(),Mr=pn(),Rw=_u(),Cw=Ia(),{CLOSE_TIMEOUT:Dw,GUID:Aw,kWebSocket:Uw}=Ht(),Zw=/^[+/0-9A-Za-z]{22}==$/,Eg=0,Og=1,Ng=2,yu=class extends jw{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Dw,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Cw,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ta.createServer((n,o)=>{let i=Ta.STATUS_CODES[426];o.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),o.end(i)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Mw(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,i,a)=>{this.handleUpgrade(o,i,a,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Eg}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Ng){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(ko,this);return}if(e&&this.once("close",e),this._state!==Og)if(this._state=Og,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(ko,this):process.nextTick(ko,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{ko(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){r.on("error",jg);let i=e.headers["sec-websocket-key"],a=e.headers.upgrade,s=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Lr(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){Lr(this,e,r,400,"Invalid Upgrade header");return}if(i===void 0||!Zw.test(i)){Lr(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){Lr(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){So(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=Rw.parse(c)}catch{Lr(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&l!==void 0){let p=new Mr({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=Pg.parse(l);f[Mr.extensionName]&&(p.accept(f[Mr.extensionName]),d[Mr.extensionName]=p)}catch{Lr(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:e.headers[`${s===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,v,h,$)=>{if(!f)return So(r,v||401,h,$);this.completeUpgrade(d,i,u,e,r,n,o)});return}if(!this.options.verifyClient(p))return So(r,401)}this.completeUpgrade(d,i,u,e,r,n,o)}completeUpgrade(e,r,n,o,i,a,s){if(!i.readable||!i.writable)return i.destroy();if(i[Uw])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Eg)return So(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Nw("sha1").update(r+Aw).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;d&&(u.push(`Sec-WebSocket-Protocol: ${d}`),l._protocol=d)}if(e[Mr.extensionName]){let d=e[Mr.extensionName].params,p=Pg.format({[Mr.extensionName]:[d]});u.push(`Sec-WebSocket-Extensions: ${p}`),l._extensions=e}this.emit("headers",u,o),i.write(u.concat(`\r
3
3
  `).join(`\r
4
- `)),i.removeListener("error",Pg),l.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(bo,this)})),s(l,o)}};Og.exports=hu;function Zw(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function bo(t){t._state=Eg,t.emit("close")}function Pg(){this.destroy()}function xo(t,e,r,n){r=r||Sa.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Sa.STATUS_CODES[e]}\r
4
+ `)),i.removeListener("error",jg),l.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(ko,this)})),s(l,o)}};Rg.exports=yu;function Mw(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function ko(t){t._state=Ng,t.emit("close")}function jg(){this.destroy()}function So(t,e,r,n){r=r||Ta.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Ta.STATUS_CODES[e]}\r
5
5
  `+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
6
6
  `)+`\r
7
7
  \r
8
- `+r)}function Zr(t,e,r,n,o,i){if(t.listenerCount("wsClientError")){let a=new Error(o);Error.captureStackTrace(a,Zr),t.emit("wsClientError",a,r,e)}else xo(r,n,o,i)}});var Ci=x(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.regexpCode=ue.getEsmExportName=ue.getProperty=ue.safeStringify=ue.stringify=ue.strConcat=ue.addCodeArg=ue.str=ue._=ue.nil=ue._Code=ue.Name=ue.IDENTIFIER=ue._CodeOrName=void 0;var Ni=class{};ue._CodeOrName=Ni;ue.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Xr=class extends Ni{constructor(e){if(super(),!ue.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ue.Name=Xr;var xt=class extends Ni{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Xr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ue._Code=xt;ue.nil=new xt("");function O$(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Pp(r,e[n]),r.push(t[++n]);return new xt(r)}ue._=O$;var Tp=new xt("+");function j$(t,...e){let r=[Ri(t[0])],n=0;for(;n<e.length;)r.push(Tp),Pp(r,e[n]),r.push(Tp,Ri(t[++n]));return QP(r),new xt(r)}ue.str=j$;function Pp(t,e){e instanceof xt?t.push(...e._items):e instanceof Xr?t.push(e):t.push(rE(e))}ue.addCodeArg=Pp;function QP(t){let e=1;for(;e<t.length-1;){if(t[e]===Tp){let r=eE(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function eE(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Xr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Xr))return`"${t}${e.slice(1)}`}function tE(t,e){return e.emptyStr()?t:t.emptyStr()?e:j$`${t}${e}`}ue.strConcat=tE;function rE(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ri(Array.isArray(t)?t.join(","):t)}function nE(t){return new xt(Ri(t))}ue.stringify=nE;function Ri(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ue.safeStringify=Ri;function oE(t){return typeof t=="string"&&ue.IDENTIFIER.test(t)?new xt(`.${t}`):O$`[${t}]`}ue.getProperty=oE;function iE(t){if(typeof t=="string"&&ue.IDENTIFIER.test(t))return new xt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ue.getEsmExportName=iE;function aE(t){return new xt(t.toString())}ue.regexpCode=aE});var jp=x(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.ValueScope=nt.ValueScopeName=nt.Scope=nt.varKinds=nt.UsedValueState=void 0;var rt=Ci(),Ep=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},nc;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(nc||(nt.UsedValueState=nc={}));nt.varKinds={const:new rt.Name("const"),let:new rt.Name("let"),var:new rt.Name("var")};var oc=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof rt.Name?e:this.name(e)}name(e){return new rt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};nt.Scope=oc;var ic=class extends rt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,rt._)`.${new rt.Name(r)}[${n}]`}};nt.ValueScopeName=ic;var sE=(0,rt._)`\n`,Op=class extends oc{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?sE:rt.nil}}get(){return this._scope}name(e){return new ic(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,rt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=rt.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,nc.Started);let l=r(u);if(l){let d=this.opts.es5?nt.varKinds.var:nt.varKinds.const;i=(0,rt._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,rt._)`${i}${l}${this.opts._n}`;else throw new Ep(u);c.set(u,nc.Completed)})}return i}};nt.ValueScope=Op});var Q=x(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.or=te.and=te.not=te.CodeGen=te.operators=te.varKinds=te.ValueScopeName=te.ValueScope=te.Scope=te.Name=te.regexpCode=te.stringify=te.getProperty=te.nil=te.strConcat=te.str=te._=void 0;var ie=Ci(),jt=jp(),zr=Ci();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return zr._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return zr.str}});Object.defineProperty(te,"strConcat",{enumerable:!0,get:function(){return zr.strConcat}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return zr.nil}});Object.defineProperty(te,"getProperty",{enumerable:!0,get:function(){return zr.getProperty}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return zr.stringify}});Object.defineProperty(te,"regexpCode",{enumerable:!0,get:function(){return zr.regexpCode}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return zr.Name}});var uc=jp();Object.defineProperty(te,"Scope",{enumerable:!0,get:function(){return uc.Scope}});Object.defineProperty(te,"ValueScope",{enumerable:!0,get:function(){return uc.ValueScope}});Object.defineProperty(te,"ValueScopeName",{enumerable:!0,get:function(){return uc.ValueScopeName}});Object.defineProperty(te,"varKinds",{enumerable:!0,get:function(){return uc.varKinds}});te.operators={GT:new ie._Code(">"),GTE:new ie._Code(">="),LT:new ie._Code("<"),LTE:new ie._Code("<="),EQ:new ie._Code("==="),NEQ:new ie._Code("!=="),NOT:new ie._Code("!"),OR:new ie._Code("||"),AND:new ie._Code("&&"),ADD:new ie._Code("+")};var cr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Np=class extends cr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?jt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Wn(this.rhs,e,r)),this}get names(){return this.rhs instanceof ie._CodeOrName?this.rhs.names:{}}},ac=class extends cr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ie.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Wn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ie.Name?{}:{...this.lhs.names};return cc(e,this.rhs)}},Rp=class extends ac{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Cp=class extends cr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Dp=class extends cr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ap=class extends cr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Up=class extends cr{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Wn(this.code,e,r),this}get names(){return this.code instanceof ie._CodeOrName?this.code.names:{}}},Di=class extends cr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(cE(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>en(e,r.names),{})}},ur=class extends Di{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Zp=class extends Di{},Jn=class extends ur{};Jn.kind="else";var Yr=class t extends ur{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Jn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(N$(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Wn(this.condition,e,r),this}get names(){let e=super.names;return cc(e,this.condition),this.else&&en(e,this.else.names),e}};Yr.kind="if";var Qr=class extends ur{};Qr.kind="for";var Mp=class extends Qr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Wn(this.iteration,e,r),this}get names(){return en(super.names,this.iteration.names)}},Lp=class extends Qr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?jt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=cc(super.names,this.from);return cc(e,this.to)}},sc=class extends Qr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Wn(this.iterable,e,r),this}get names(){return en(super.names,this.iterable.names)}},Ai=class extends ur{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ai.kind="func";var Ui=class extends Di{render(e){return"return "+super.render(e)}};Ui.kind="return";var qp=class extends ur{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&en(e,this.catch.names),this.finally&&en(e,this.finally.names),e}},Zi=class extends ur{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Zi.kind="catch";var Mi=class extends ur{render(e){return"finally"+super.render(e)}};Mi.kind="finally";var Fp=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
9
- `:""},this._extScope=e,this._scope=new jt.Scope({parent:e}),this._nodes=[new Zp]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Np(e,i,n)),i}const(e,r,n){return this._def(jt.varKinds.const,e,r,n)}let(e,r,n){return this._def(jt.varKinds.let,e,r,n)}var(e,r,n){return this._def(jt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ac(e,r,n))}add(e,r){return this._leafNode(new Rp(e,te.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ie.nil&&this._leafNode(new Up(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ie.addCodeArg)(r,o));return r.push("}"),new ie._Code(r)}if(e,r,n){if(this._blockNode(new Yr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Yr(e))}else(){return this._elseNode(new Jn)}endIf(){return this._endBlockNode(Yr,Jn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Mp(e),r)}forRange(e,r,n,o,i=this.opts.es5?jt.varKinds.var:jt.varKinds.let){let a=this._scope.toName(e);return this._for(new Lp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=jt.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof ie.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ie._)`${a}.length`,s=>{this.var(i,(0,ie._)`${a}[${s}]`),n(i)})}return this._for(new sc("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?jt.varKinds.var:jt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ie._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new sc("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Qr)}label(e){return this._leafNode(new Cp(e))}break(e){return this._leafNode(new Dp(e))}return(e){let r=new Ui;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ui)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new qp;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Zi(i),r(i)}return n&&(this._currNode=o.finally=new Mi,this.code(n)),this._endBlockNode(Zi,Mi)}throw(e){return this._leafNode(new Ap(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ie.nil,n,o){return this._blockNode(new Ai(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Ai)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Yr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};te.CodeGen=Fp;function en(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function cc(t,e){return e instanceof ie._CodeOrName?en(t,e.names):t}function Wn(t,e,r){if(t instanceof ie.Name)return n(t);if(!o(t))return t;return new ie._Code(t._items.reduce((i,a)=>(a instanceof ie.Name&&(a=n(a)),a instanceof ie._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof ie._Code&&i._items.some(a=>a instanceof ie.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function cE(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function N$(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ie._)`!${Vp(t)}`}te.not=N$;var uE=R$(te.operators.AND);function lE(...t){return t.reduce(uE)}te.and=lE;var dE=R$(te.operators.OR);function fE(...t){return t.reduce(dE)}te.or=fE;function R$(t){return(e,r)=>e===ie.nil?r:r===ie.nil?e:(0,ie._)`${Vp(e)} ${t} ${Vp(r)}`}function Vp(t){return t instanceof ie.Name?t:(0,ie._)`(${t})`}});var ae=x(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.checkStrictMode=ne.getErrorPath=ne.Type=ne.useFunc=ne.setEvaluated=ne.evaluatedPropsToName=ne.mergeEvaluated=ne.eachItem=ne.unescapeJsonPointer=ne.escapeJsonPointer=ne.escapeFragment=ne.unescapeFragment=ne.schemaRefOrVal=ne.schemaHasRulesButRef=ne.schemaHasRules=ne.checkUnknownRules=ne.alwaysValidSchema=ne.toHash=void 0;var ye=Q(),pE=Ci();function mE(t){let e={};for(let r of t)e[r]=!0;return e}ne.toHash=mE;function hE(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(A$(t,e),!U$(e,t.self.RULES.all))}ne.alwaysValidSchema=hE;function A$(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||L$(t,`unknown keyword: "${i}"`)}ne.checkUnknownRules=A$;function U$(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ne.schemaHasRules=U$;function gE(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ne.schemaHasRulesButRef=gE;function vE({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ye._)`${r}`}return(0,ye._)`${t}${e}${(0,ye.getProperty)(n)}`}ne.schemaRefOrVal=vE;function _E(t){return Z$(decodeURIComponent(t))}ne.unescapeFragment=_E;function yE(t){return encodeURIComponent(Jp(t))}ne.escapeFragment=yE;function Jp(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ne.escapeJsonPointer=Jp;function Z$(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ne.unescapeJsonPointer=Z$;function $E(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ne.eachItem=$E;function C$({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof ye.Name?(i instanceof ye.Name?t(o,i,a):e(o,i,a),a):i instanceof ye.Name?(e(o,a,i),i):r(i,a);return s===ye.Name&&!(c instanceof ye.Name)?n(o,c):c}}ne.mergeEvaluated={props:C$({mergeNames:(t,e,r)=>t.if((0,ye._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ye._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ye._)`${r} || {}`).code((0,ye._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ye._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ye._)`${r} || {}`),Wp(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:M$}),items:C$({mergeNames:(t,e,r)=>t.if((0,ye._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ye._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ye._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ye._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function M$(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ye._)`{}`);return e!==void 0&&Wp(t,r,e),r}ne.evaluatedPropsToName=M$;function Wp(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ye._)`${e}${(0,ye.getProperty)(n)}`,!0))}ne.setEvaluated=Wp;var D$={};function bE(t,e){return t.scopeValue("func",{ref:e,code:D$[e.code]||(D$[e.code]=new pE._Code(e.code))})}ne.useFunc=bE;var Bp;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Bp||(ne.Type=Bp={}));function xE(t,e,r){if(t instanceof ye.Name){let n=e===Bp.Num;return r?n?(0,ye._)`"[" + ${t} + "]"`:(0,ye._)`"['" + ${t} + "']"`:n?(0,ye._)`"/" + ${t}`:(0,ye._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ye.getProperty)(t).toString():"/"+Jp(t)}ne.getErrorPath=xE;function L$(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ne.checkStrictMode=L$});var lr=x(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Ve=Q(),kE={data:new Ve.Name("data"),valCxt:new Ve.Name("valCxt"),instancePath:new Ve.Name("instancePath"),parentData:new Ve.Name("parentData"),parentDataProperty:new Ve.Name("parentDataProperty"),rootData:new Ve.Name("rootData"),dynamicAnchors:new Ve.Name("dynamicAnchors"),vErrors:new Ve.Name("vErrors"),errors:new Ve.Name("errors"),this:new Ve.Name("this"),self:new Ve.Name("self"),scope:new Ve.Name("scope"),json:new Ve.Name("json"),jsonPos:new Ve.Name("jsonPos"),jsonLen:new Ve.Name("jsonLen"),jsonPart:new Ve.Name("jsonPart")};Gp.default=kE});var Li=x(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.extendErrors=Be.resetErrorsCount=Be.reportExtraError=Be.reportError=Be.keyword$DataError=Be.keywordError=void 0;var se=Q(),lc=ae(),Ye=lr();Be.keywordError={message:({keyword:t})=>(0,se.str)`must pass "${t}" keyword validation`};Be.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,se.str)`"${t}" keyword must be ${e} ($data)`:(0,se.str)`"${t}" keyword is invalid ($data)`};function SE(t,e=Be.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=V$(t,e,r);n??(a||s)?q$(i,c):F$(o,(0,se._)`[${c}]`)}Be.reportError=SE;function wE(t,e=Be.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=V$(t,e,r);q$(o,s),i||a||F$(n,Ye.default.vErrors)}Be.reportExtraError=wE;function zE(t,e){t.assign(Ye.default.errors,e),t.if((0,se._)`${Ye.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,se._)`${Ye.default.vErrors}.length`,e),()=>t.assign(Ye.default.vErrors,null)))}Be.resetErrorsCount=zE;function IE({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,Ye.default.errors,s=>{t.const(a,(0,se._)`${Ye.default.vErrors}[${s}]`),t.if((0,se._)`${a}.instancePath === undefined`,()=>t.assign((0,se._)`${a}.instancePath`,(0,se.strConcat)(Ye.default.instancePath,i.errorPath))),t.assign((0,se._)`${a}.schemaPath`,(0,se.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,se._)`${a}.schema`,r),t.assign((0,se._)`${a}.data`,n))})}Be.extendErrors=IE;function q$(t,e){let r=t.const("err",e);t.if((0,se._)`${Ye.default.vErrors} === null`,()=>t.assign(Ye.default.vErrors,(0,se._)`[${r}]`),(0,se._)`${Ye.default.vErrors}.push(${r})`),t.code((0,se._)`${Ye.default.errors}++`)}function F$(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,se._)`new ${t.ValidationError}(${e})`):(r.assign((0,se._)`${n}.errors`,e),r.return(!1))}var tn={keyword:new se.Name("keyword"),schemaPath:new se.Name("schemaPath"),params:new se.Name("params"),propertyName:new se.Name("propertyName"),message:new se.Name("message"),schema:new se.Name("schema"),parentSchema:new se.Name("parentSchema")};function V$(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,se._)`{}`:TE(t,e,r)}function TE(t,e,r={}){let{gen:n,it:o}=t,i=[PE(o,r),EE(t,r)];return OE(t,e,i),n.object(...i)}function PE({errorPath:t},{instancePath:e}){let r=e?(0,se.str)`${t}${(0,lc.getErrorPath)(e,lc.Type.Str)}`:t;return[Ye.default.instancePath,(0,se.strConcat)(Ye.default.instancePath,r)]}function EE({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,se.str)`${e}/${t}`;return r&&(o=(0,se.str)`${o}${(0,lc.getErrorPath)(r,lc.Type.Str)}`),[tn.schemaPath,o]}function OE(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([tn.keyword,o],[tn.params,typeof e=="function"?e(t):e||(0,se._)`{}`]),c.messages&&n.push([tn.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([tn.schema,a],[tn.parentSchema,(0,se._)`${l}${d}`],[Ye.default.data,i]),u&&n.push([tn.propertyName,u])}});var J$=x(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.boolOrEmptySchema=Gn.topBoolOrEmptySchema=void 0;var jE=Li(),NE=Q(),RE=lr(),CE={message:"boolean schema is false"};function DE(t){let{gen:e,schema:r,validateName:n}=t;r===!1?B$(t,!1):typeof r=="object"&&r.$async===!0?e.return(RE.default.data):(e.assign((0,NE._)`${n}.errors`,null),e.return(!0))}Gn.topBoolOrEmptySchema=DE;function AE(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),B$(t)):r.var(e,!0)}Gn.boolOrEmptySchema=AE;function B$(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,jE.reportError)(o,CE,void 0,e)}});var Kp=x(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.getRules=Kn.isJSONType=void 0;var UE=["string","number","integer","boolean","null","object","array"],ZE=new Set(UE);function ME(t){return typeof t=="string"&&ZE.has(t)}Kn.isJSONType=ME;function LE(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Kn.getRules=LE});var Hp=x(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.shouldUseRule=Ir.shouldUseGroup=Ir.schemaHasRulesForType=void 0;function qE({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&W$(t,n)}Ir.schemaHasRulesForType=qE;function W$(t,e){return e.rules.some(r=>G$(t,r))}Ir.shouldUseGroup=W$;function G$(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Ir.shouldUseRule=G$});var qi=x(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.reportTypeError=Je.checkDataTypes=Je.checkDataType=Je.coerceAndCheckDataType=Je.getJSONTypes=Je.getSchemaTypes=Je.DataType=void 0;var FE=Kp(),VE=Hp(),BE=Li(),Y=Q(),K$=ae(),Hn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Hn||(Je.DataType=Hn={}));function JE(t){let e=H$(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Je.getSchemaTypes=JE;function H$(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(FE.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Je.getJSONTypes=H$;function WE(t,e){let{gen:r,data:n,opts:o}=t,i=GE(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,VE.schemaHasRulesForType)(t,e[0]));if(a){let s=Yp(e,n,o.strictNumbers,Hn.Wrong);r.if(s,()=>{i.length?KE(t,e,i):Qp(t)})}return a}Je.coerceAndCheckDataType=WE;var X$=new Set(["string","number","integer","boolean","null"]);function GE(t,e){return e?t.filter(r=>X$.has(r)||e==="array"&&r==="array"):[]}function KE(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,Y._)`typeof ${o}`),s=n.let("coerced",(0,Y._)`undefined`);i.coerceTypes==="array"&&n.if((0,Y._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Y._)`${o}[0]`).assign(a,(0,Y._)`typeof ${o}`).if(Yp(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,Y._)`${s} !== undefined`);for(let u of r)(X$.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Qp(t),n.endIf(),n.if((0,Y._)`${s} !== undefined`,()=>{n.assign(o,s),HE(t,s)});function c(u){switch(u){case"string":n.elseIf((0,Y._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,Y._)`"" + ${o}`).elseIf((0,Y._)`${o} === null`).assign(s,(0,Y._)`""`);return;case"number":n.elseIf((0,Y._)`${a} == "boolean" || ${o} === null
8
+ `+r)}function Lr(t,e,r,n,o,i){if(t.listenerCount("wsClientError")){let a=new Error(o);Error.captureStackTrace(a,Lr),t.emit("wsClientError",a,r,e)}else So(r,n,o,i)}});var Zi=x(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.regexpCode=ue.getEsmExportName=ue.getProperty=ue.safeStringify=ue.stringify=ue.strConcat=ue.addCodeArg=ue.str=ue._=ue.nil=ue._Code=ue.Name=ue.IDENTIFIER=ue._CodeOrName=void 0;var Ai=class{};ue._CodeOrName=Ai;ue.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Qr=class extends Ai{constructor(e){if(super(),!ue.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ue.Name=Qr;var St=class extends Ai{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Qr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ue._Code=St;ue.nil=new St("");function N$(t,...e){let r=[t[0]],n=0;for(;n<e.length;)jp(r,e[n]),r.push(t[++n]);return new St(r)}ue._=N$;var Op=new St("+");function R$(t,...e){let r=[Ui(t[0])],n=0;for(;n<e.length;)r.push(Op),jp(r,e[n]),r.push(Op,Ui(t[++n]));return eE(r),new St(r)}ue.str=R$;function jp(t,e){e instanceof St?t.push(...e._items):e instanceof Qr?t.push(e):t.push(nE(e))}ue.addCodeArg=jp;function eE(t){let e=1;for(;e<t.length-1;){if(t[e]===Op){let r=tE(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function tE(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Qr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Qr))return`"${t}${e.slice(1)}`}function rE(t,e){return e.emptyStr()?t:t.emptyStr()?e:R$`${t}${e}`}ue.strConcat=rE;function nE(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ui(Array.isArray(t)?t.join(","):t)}function oE(t){return new St(Ui(t))}ue.stringify=oE;function Ui(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ue.safeStringify=Ui;function iE(t){return typeof t=="string"&&ue.IDENTIFIER.test(t)?new St(`.${t}`):N$`[${t}]`}ue.getProperty=iE;function aE(t){if(typeof t=="string"&&ue.IDENTIFIER.test(t))return new St(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ue.getEsmExportName=aE;function sE(t){return new St(t.toString())}ue.regexpCode=sE});var Cp=x(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.ValueScope=it.ValueScopeName=it.Scope=it.varKinds=it.UsedValueState=void 0;var ot=Zi(),Np=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},sc;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(sc||(it.UsedValueState=sc={}));it.varKinds={const:new ot.Name("const"),let:new ot.Name("let"),var:new ot.Name("var")};var cc=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ot.Name?e:this.name(e)}name(e){return new ot.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};it.Scope=cc;var uc=class extends ot.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ot._)`.${new ot.Name(r)}[${n}]`}};it.ValueScopeName=uc;var cE=(0,ot._)`\n`,Rp=class extends cc{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cE:ot.nil}}get(){return this._scope}name(e){return new uc(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ot._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=ot.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,sc.Started);let l=r(u);if(l){let d=this.opts.es5?it.varKinds.var:it.varKinds.const;i=(0,ot._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,ot._)`${i}${l}${this.opts._n}`;else throw new Np(u);c.set(u,sc.Completed)})}return i}};it.ValueScope=Rp});var Q=x(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.or=te.and=te.not=te.CodeGen=te.operators=te.varKinds=te.ValueScopeName=te.ValueScope=te.Scope=te.Name=te.regexpCode=te.stringify=te.getProperty=te.nil=te.strConcat=te.str=te._=void 0;var ae=Zi(),Rt=Cp(),Tr=Zi();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return Tr._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return Tr.str}});Object.defineProperty(te,"strConcat",{enumerable:!0,get:function(){return Tr.strConcat}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return Tr.nil}});Object.defineProperty(te,"getProperty",{enumerable:!0,get:function(){return Tr.getProperty}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return Tr.stringify}});Object.defineProperty(te,"regexpCode",{enumerable:!0,get:function(){return Tr.regexpCode}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return Tr.Name}});var pc=Cp();Object.defineProperty(te,"Scope",{enumerable:!0,get:function(){return pc.Scope}});Object.defineProperty(te,"ValueScope",{enumerable:!0,get:function(){return pc.ValueScope}});Object.defineProperty(te,"ValueScopeName",{enumerable:!0,get:function(){return pc.ValueScopeName}});Object.defineProperty(te,"varKinds",{enumerable:!0,get:function(){return pc.varKinds}});te.operators={GT:new ae._Code(">"),GTE:new ae._Code(">="),LT:new ae._Code("<"),LTE:new ae._Code("<="),EQ:new ae._Code("==="),NEQ:new ae._Code("!=="),NOT:new ae._Code("!"),OR:new ae._Code("||"),AND:new ae._Code("&&"),ADD:new ae._Code("+")};var lr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Dp=class extends lr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Rt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Hn(this.rhs,e,r)),this}get names(){return this.rhs instanceof ae._CodeOrName?this.rhs.names:{}}},lc=class extends lr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ae.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Hn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ae.Name?{}:{...this.lhs.names};return fc(e,this.rhs)}},Ap=class extends lc{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Up=class extends lr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Zp=class extends lr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mp=class extends lr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Lp=class extends lr{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Hn(this.code,e,r),this}get names(){return this.code instanceof ae._CodeOrName?this.code.names:{}}},Mi=class extends lr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(uE(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rn(e,r.names),{})}},dr=class extends Mi{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},qp=class extends Mi{},Kn=class extends dr{};Kn.kind="else";var en=class t extends dr{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Kn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(C$(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Hn(this.condition,e,r),this}get names(){let e=super.names;return fc(e,this.condition),this.else&&rn(e,this.else.names),e}};en.kind="if";var tn=class extends dr{};tn.kind="for";var Fp=class extends tn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Hn(this.iteration,e,r),this}get names(){return rn(super.names,this.iteration.names)}},Vp=class extends tn{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Rt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=fc(super.names,this.from);return fc(e,this.to)}},dc=class extends tn{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Hn(this.iterable,e,r),this}get names(){return rn(super.names,this.iterable.names)}},Li=class extends dr{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Li.kind="func";var qi=class extends Mi{render(e){return"return "+super.render(e)}};qi.kind="return";var Bp=class extends dr{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rn(e,this.catch.names),this.finally&&rn(e,this.finally.names),e}},Fi=class extends dr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Fi.kind="catch";var Vi=class extends dr{render(e){return"finally"+super.render(e)}};Vi.kind="finally";var Jp=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
9
+ `:""},this._extScope=e,this._scope=new Rt.Scope({parent:e}),this._nodes=[new qp]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Dp(e,i,n)),i}const(e,r,n){return this._def(Rt.varKinds.const,e,r,n)}let(e,r,n){return this._def(Rt.varKinds.let,e,r,n)}var(e,r,n){return this._def(Rt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new lc(e,r,n))}add(e,r){return this._leafNode(new Ap(e,te.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ae.nil&&this._leafNode(new Lp(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ae.addCodeArg)(r,o));return r.push("}"),new ae._Code(r)}if(e,r,n){if(this._blockNode(new en(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new en(e))}else(){return this._elseNode(new Kn)}endIf(){return this._endBlockNode(en,Kn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Fp(e),r)}forRange(e,r,n,o,i=this.opts.es5?Rt.varKinds.var:Rt.varKinds.let){let a=this._scope.toName(e);return this._for(new Vp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=Rt.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof ae.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ae._)`${a}.length`,s=>{this.var(i,(0,ae._)`${a}[${s}]`),n(i)})}return this._for(new dc("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Rt.varKinds.var:Rt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ae._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new dc("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(tn)}label(e){return this._leafNode(new Up(e))}break(e){return this._leafNode(new Zp(e))}return(e){let r=new qi;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(qi)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Bp;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Fi(i),r(i)}return n&&(this._currNode=o.finally=new Vi,this.code(n)),this._endBlockNode(Fi,Vi)}throw(e){return this._leafNode(new Mp(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ae.nil,n,o){return this._blockNode(new Li(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Li)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof en))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};te.CodeGen=Jp;function rn(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function fc(t,e){return e instanceof ae._CodeOrName?rn(t,e.names):t}function Hn(t,e,r){if(t instanceof ae.Name)return n(t);if(!o(t))return t;return new ae._Code(t._items.reduce((i,a)=>(a instanceof ae.Name&&(a=n(a)),a instanceof ae._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof ae._Code&&i._items.some(a=>a instanceof ae.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function uE(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function C$(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ae._)`!${Wp(t)}`}te.not=C$;var lE=D$(te.operators.AND);function dE(...t){return t.reduce(lE)}te.and=dE;var fE=D$(te.operators.OR);function pE(...t){return t.reduce(fE)}te.or=pE;function D$(t){return(e,r)=>e===ae.nil?r:r===ae.nil?e:(0,ae._)`${Wp(e)} ${t} ${Wp(r)}`}function Wp(t){return t instanceof ae.Name?t:(0,ae._)`(${t})`}});var se=x(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.checkStrictMode=ne.getErrorPath=ne.Type=ne.useFunc=ne.setEvaluated=ne.evaluatedPropsToName=ne.mergeEvaluated=ne.eachItem=ne.unescapeJsonPointer=ne.escapeJsonPointer=ne.escapeFragment=ne.unescapeFragment=ne.schemaRefOrVal=ne.schemaHasRulesButRef=ne.schemaHasRules=ne.checkUnknownRules=ne.alwaysValidSchema=ne.toHash=void 0;var $e=Q(),mE=Zi();function hE(t){let e={};for(let r of t)e[r]=!0;return e}ne.toHash=hE;function gE(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Z$(t,e),!M$(e,t.self.RULES.all))}ne.alwaysValidSchema=gE;function Z$(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||F$(t,`unknown keyword: "${i}"`)}ne.checkUnknownRules=Z$;function M$(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ne.schemaHasRules=M$;function vE(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ne.schemaHasRulesButRef=vE;function _E({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,$e._)`${r}`}return(0,$e._)`${t}${e}${(0,$e.getProperty)(n)}`}ne.schemaRefOrVal=_E;function yE(t){return L$(decodeURIComponent(t))}ne.unescapeFragment=yE;function $E(t){return encodeURIComponent(Kp(t))}ne.escapeFragment=$E;function Kp(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ne.escapeJsonPointer=Kp;function L$(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ne.unescapeJsonPointer=L$;function bE(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ne.eachItem=bE;function A$({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof $e.Name?(i instanceof $e.Name?t(o,i,a):e(o,i,a),a):i instanceof $e.Name?(e(o,a,i),i):r(i,a);return s===$e.Name&&!(c instanceof $e.Name)?n(o,c):c}}ne.mergeEvaluated={props:A$({mergeNames:(t,e,r)=>t.if((0,$e._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,$e._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,$e._)`${r} || {}`).code((0,$e._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,$e._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,$e._)`${r} || {}`),Hp(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:q$}),items:A$({mergeNames:(t,e,r)=>t.if((0,$e._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,$e._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,$e._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,$e._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function q$(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,$e._)`{}`);return e!==void 0&&Hp(t,r,e),r}ne.evaluatedPropsToName=q$;function Hp(t,e,r){Object.keys(r).forEach(n=>t.assign((0,$e._)`${e}${(0,$e.getProperty)(n)}`,!0))}ne.setEvaluated=Hp;var U$={};function xE(t,e){return t.scopeValue("func",{ref:e,code:U$[e.code]||(U$[e.code]=new mE._Code(e.code))})}ne.useFunc=xE;var Gp;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Gp||(ne.Type=Gp={}));function kE(t,e,r){if(t instanceof $e.Name){let n=e===Gp.Num;return r?n?(0,$e._)`"[" + ${t} + "]"`:(0,$e._)`"['" + ${t} + "']"`:n?(0,$e._)`"/" + ${t}`:(0,$e._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,$e.getProperty)(t).toString():"/"+Kp(t)}ne.getErrorPath=kE;function F$(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ne.checkStrictMode=F$});var fr=x(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Je=Q(),SE={data:new Je.Name("data"),valCxt:new Je.Name("valCxt"),instancePath:new Je.Name("instancePath"),parentData:new Je.Name("parentData"),parentDataProperty:new Je.Name("parentDataProperty"),rootData:new Je.Name("rootData"),dynamicAnchors:new Je.Name("dynamicAnchors"),vErrors:new Je.Name("vErrors"),errors:new Je.Name("errors"),this:new Je.Name("this"),self:new Je.Name("self"),scope:new Je.Name("scope"),json:new Je.Name("json"),jsonPos:new Je.Name("jsonPos"),jsonLen:new Je.Name("jsonLen"),jsonPart:new Je.Name("jsonPart")};Xp.default=SE});var Bi=x(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.extendErrors=We.resetErrorsCount=We.reportExtraError=We.reportError=We.keyword$DataError=We.keywordError=void 0;var ce=Q(),mc=se(),et=fr();We.keywordError={message:({keyword:t})=>(0,ce.str)`must pass "${t}" keyword validation`};We.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ce.str)`"${t}" keyword must be ${e} ($data)`:(0,ce.str)`"${t}" keyword is invalid ($data)`};function wE(t,e=We.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=J$(t,e,r);n??(a||s)?V$(i,c):B$(o,(0,ce._)`[${c}]`)}We.reportError=wE;function zE(t,e=We.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=J$(t,e,r);V$(o,s),i||a||B$(n,et.default.vErrors)}We.reportExtraError=zE;function IE(t,e){t.assign(et.default.errors,e),t.if((0,ce._)`${et.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ce._)`${et.default.vErrors}.length`,e),()=>t.assign(et.default.vErrors,null)))}We.resetErrorsCount=IE;function TE({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,et.default.errors,s=>{t.const(a,(0,ce._)`${et.default.vErrors}[${s}]`),t.if((0,ce._)`${a}.instancePath === undefined`,()=>t.assign((0,ce._)`${a}.instancePath`,(0,ce.strConcat)(et.default.instancePath,i.errorPath))),t.assign((0,ce._)`${a}.schemaPath`,(0,ce.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,ce._)`${a}.schema`,r),t.assign((0,ce._)`${a}.data`,n))})}We.extendErrors=TE;function V$(t,e){let r=t.const("err",e);t.if((0,ce._)`${et.default.vErrors} === null`,()=>t.assign(et.default.vErrors,(0,ce._)`[${r}]`),(0,ce._)`${et.default.vErrors}.push(${r})`),t.code((0,ce._)`${et.default.errors}++`)}function B$(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,ce._)`new ${t.ValidationError}(${e})`):(r.assign((0,ce._)`${n}.errors`,e),r.return(!1))}var nn={keyword:new ce.Name("keyword"),schemaPath:new ce.Name("schemaPath"),params:new ce.Name("params"),propertyName:new ce.Name("propertyName"),message:new ce.Name("message"),schema:new ce.Name("schema"),parentSchema:new ce.Name("parentSchema")};function J$(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ce._)`{}`:PE(t,e,r)}function PE(t,e,r={}){let{gen:n,it:o}=t,i=[EE(o,r),OE(t,r)];return jE(t,e,i),n.object(...i)}function EE({errorPath:t},{instancePath:e}){let r=e?(0,ce.str)`${t}${(0,mc.getErrorPath)(e,mc.Type.Str)}`:t;return[et.default.instancePath,(0,ce.strConcat)(et.default.instancePath,r)]}function OE({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,ce.str)`${e}/${t}`;return r&&(o=(0,ce.str)`${o}${(0,mc.getErrorPath)(r,mc.Type.Str)}`),[nn.schemaPath,o]}function jE(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([nn.keyword,o],[nn.params,typeof e=="function"?e(t):e||(0,ce._)`{}`]),c.messages&&n.push([nn.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([nn.schema,a],[nn.parentSchema,(0,ce._)`${l}${d}`],[et.default.data,i]),u&&n.push([nn.propertyName,u])}});var G$=x(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.boolOrEmptySchema=Xn.topBoolOrEmptySchema=void 0;var NE=Bi(),RE=Q(),CE=fr(),DE={message:"boolean schema is false"};function AE(t){let{gen:e,schema:r,validateName:n}=t;r===!1?W$(t,!1):typeof r=="object"&&r.$async===!0?e.return(CE.default.data):(e.assign((0,RE._)`${n}.errors`,null),e.return(!0))}Xn.topBoolOrEmptySchema=AE;function UE(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),W$(t)):r.var(e,!0)}Xn.boolOrEmptySchema=UE;function W$(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,NE.reportError)(o,DE,void 0,e)}});var Yp=x(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.getRules=Yn.isJSONType=void 0;var ZE=["string","number","integer","boolean","null","object","array"],ME=new Set(ZE);function LE(t){return typeof t=="string"&&ME.has(t)}Yn.isJSONType=LE;function qE(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Yn.getRules=qE});var Qp=x(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.shouldUseRule=Pr.shouldUseGroup=Pr.schemaHasRulesForType=void 0;function FE({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&K$(t,n)}Pr.schemaHasRulesForType=FE;function K$(t,e){return e.rules.some(r=>H$(t,r))}Pr.shouldUseGroup=K$;function H$(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Pr.shouldUseRule=H$});var Ji=x(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.reportTypeError=Ge.checkDataTypes=Ge.checkDataType=Ge.coerceAndCheckDataType=Ge.getJSONTypes=Ge.getSchemaTypes=Ge.DataType=void 0;var VE=Yp(),BE=Qp(),JE=Bi(),Y=Q(),X$=se(),Qn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Qn||(Ge.DataType=Qn={}));function WE(t){let e=Y$(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ge.getSchemaTypes=WE;function Y$(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(VE.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ge.getJSONTypes=Y$;function GE(t,e){let{gen:r,data:n,opts:o}=t,i=KE(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,BE.schemaHasRulesForType)(t,e[0]));if(a){let s=tm(e,n,o.strictNumbers,Qn.Wrong);r.if(s,()=>{i.length?HE(t,e,i):rm(t)})}return a}Ge.coerceAndCheckDataType=GE;var Q$=new Set(["string","number","integer","boolean","null"]);function KE(t,e){return e?t.filter(r=>Q$.has(r)||e==="array"&&r==="array"):[]}function HE(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,Y._)`typeof ${o}`),s=n.let("coerced",(0,Y._)`undefined`);i.coerceTypes==="array"&&n.if((0,Y._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Y._)`${o}[0]`).assign(a,(0,Y._)`typeof ${o}`).if(tm(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,Y._)`${s} !== undefined`);for(let u of r)(Q$.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),rm(t),n.endIf(),n.if((0,Y._)`${s} !== undefined`,()=>{n.assign(o,s),XE(t,s)});function c(u){switch(u){case"string":n.elseIf((0,Y._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,Y._)`"" + ${o}`).elseIf((0,Y._)`${o} === null`).assign(s,(0,Y._)`""`);return;case"number":n.elseIf((0,Y._)`${a} == "boolean" || ${o} === null
10
10
  || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,Y._)`+${o}`);return;case"integer":n.elseIf((0,Y._)`${a} === "boolean" || ${o} === null
11
11
  || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,Y._)`+${o}`);return;case"boolean":n.elseIf((0,Y._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,Y._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,Y._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,Y._)`${a} === "string" || ${a} === "number"
12
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,Y._)`[${o}]`)}}}function HE({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Y._)`${e} !== undefined`,()=>t.assign((0,Y._)`${e}[${r}]`,n))}function Xp(t,e,r,n=Hn.Correct){let o=n===Hn.Correct?Y.operators.EQ:Y.operators.NEQ,i;switch(t){case"null":return(0,Y._)`${e} ${o} null`;case"array":i=(0,Y._)`Array.isArray(${e})`;break;case"object":i=(0,Y._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,Y._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,Y._)`typeof ${e} ${o} ${t}`}return n===Hn.Correct?i:(0,Y.not)(i);function a(s=Y.nil){return(0,Y.and)((0,Y._)`typeof ${e} == "number"`,s,r?(0,Y._)`isFinite(${e})`:Y.nil)}}Je.checkDataType=Xp;function Yp(t,e,r,n){if(t.length===1)return Xp(t[0],e,r,n);let o,i=(0,K$.toHash)(t);if(i.array&&i.object){let a=(0,Y._)`typeof ${e} != "object"`;o=i.null?a:(0,Y._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=Y.nil;i.number&&delete i.integer;for(let a in i)o=(0,Y.and)(o,Xp(a,e,r,n));return o}Je.checkDataTypes=Yp;var XE={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Y._)`{type: ${t}}`:(0,Y._)`{type: ${e}}`};function Qp(t){let e=YE(t);(0,BE.reportError)(e,XE)}Je.reportTypeError=Qp;function YE(t){let{gen:e,data:r,schema:n}=t,o=(0,K$.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Q$=x(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.assignDefaults=void 0;var Xn=Q(),QE=ae();function eO(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Y$(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Y$(t,i,o.default))}dc.assignDefaults=eO;function Y$(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,Xn._)`${i}${(0,Xn.getProperty)(e)}`;if(o){(0,QE.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,Xn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,Xn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,Xn._)`${s} = ${(0,Xn.stringify)(r)}`)}});var kt=x(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.validateUnion=me.validateArray=me.usePattern=me.callValidateCode=me.schemaProperties=me.allSchemaProperties=me.noPropertyInData=me.propertyInData=me.isOwnProperty=me.hasPropFunc=me.reportMissingProp=me.checkMissingProp=me.checkReportMissingProp=void 0;var xe=Q(),em=ae(),Tr=lr(),tO=ae();function rO(t,e){let{gen:r,data:n,it:o}=t;r.if(rm(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,xe._)`${e}`},!0),t.error()})}me.checkReportMissingProp=rO;function nO({gen:t,data:e,it:{opts:r}},n,o){return(0,xe.or)(...n.map(i=>(0,xe.and)(rm(t,e,i,r.ownProperties),(0,xe._)`${o} = ${i}`)))}me.checkMissingProp=nO;function oO(t,e){t.setParams({missingProperty:e},!0),t.error()}me.reportMissingProp=oO;function eb(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,xe._)`Object.prototype.hasOwnProperty`})}me.hasPropFunc=eb;function tm(t,e,r){return(0,xe._)`${eb(t)}.call(${e}, ${r})`}me.isOwnProperty=tm;function iO(t,e,r,n){let o=(0,xe._)`${e}${(0,xe.getProperty)(r)} !== undefined`;return n?(0,xe._)`${o} && ${tm(t,e,r)}`:o}me.propertyInData=iO;function rm(t,e,r,n){let o=(0,xe._)`${e}${(0,xe.getProperty)(r)} === undefined`;return n?(0,xe.or)(o,(0,xe.not)(tm(t,e,r))):o}me.noPropertyInData=rm;function tb(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}me.allSchemaProperties=tb;function aO(t,e){return tb(e).filter(r=>!(0,em.alwaysValidSchema)(t,e[r]))}me.schemaProperties=aO;function sO({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,xe._)`${t}, ${e}, ${n}${o}`:e,d=[[Tr.default.instancePath,(0,xe.strConcat)(Tr.default.instancePath,i)],[Tr.default.parentData,a.parentData],[Tr.default.parentDataProperty,a.parentDataProperty],[Tr.default.rootData,Tr.default.rootData]];a.opts.dynamicRef&&d.push([Tr.default.dynamicAnchors,Tr.default.dynamicAnchors]);let f=(0,xe._)`${l}, ${r.object(...d)}`;return c!==xe.nil?(0,xe._)`${s}.call(${c}, ${f})`:(0,xe._)`${s}(${f})`}me.callValidateCode=sO;var cO=(0,xe._)`new RegExp`;function uO({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,xe._)`${o.code==="new RegExp"?cO:(0,tO.useFunc)(t,o)}(${r}, ${n})`})}me.usePattern=uO;function lO(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,xe._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:em.Type.Num},i),e.if((0,xe.not)(i),s)})}}me.validateArray=lO;function dO(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,em.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,xe._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,xe.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}me.validateUnion=dO});var ob=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.validateKeywordUsage=Lt.validSchemaType=Lt.funcKeywordCode=Lt.macroKeywordCode=void 0;var Qe=Q(),rn=lr(),fO=kt(),pO=Li();function mO(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=nb(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:Qe.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Lt.macroKeywordCode=mO;function hO(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;vO(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=nb(n,o,u),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&rb(t),y(()=>t.error());else{let w=e.async?p():g();e.modifying&&rb(t),y(()=>gO(t,w))}}function p(){let w=n.let("ruleErrs",null);return n.try(()=>h((0,Qe._)`await `),P=>n.assign(d,!1).if((0,Qe._)`${P} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,Qe._)`${P}.errors`),()=>n.throw(P))),w}function g(){let w=(0,Qe._)`${l}.errors`;return n.assign(w,null),h(Qe.nil),w}function h(w=e.async?(0,Qe._)`await `:Qe.nil){let P=c.opts.passContext?rn.default.this:rn.default.self,j=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Qe._)`${w}${(0,fO.callValidateCode)(t,l,P,j)}`,e.modifying)}function y(w){var P;n.if((0,Qe.not)((P=e.valid)!==null&&P!==void 0?P:d),w)}}Lt.funcKeywordCode=hO;function rb(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Qe._)`${n.parentData}[${n.parentDataProperty}]`))}function gO(t,e){let{gen:r}=t;r.if((0,Qe._)`Array.isArray(${e})`,()=>{r.assign(rn.default.vErrors,(0,Qe._)`${rn.default.vErrors} === null ? ${e} : ${rn.default.vErrors}.concat(${e})`).assign(rn.default.errors,(0,Qe._)`${rn.default.vErrors}.length`),(0,pO.extendErrors)(t)},()=>t.error())}function vO({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function nb(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Qe.stringify)(r)})}function _O(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Lt.validSchemaType=_O;function yO({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Lt.validateKeywordUsage=yO});var ab=x(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.extendSubschemaMode=Pr.extendSubschemaData=Pr.getSubschema=void 0;var qt=Q(),ib=ae();function $O(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,qt._)`${t.schemaPath}${(0,qt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,qt._)`${t.schemaPath}${(0,qt.getProperty)(e)}${(0,qt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,ib.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Pr.getSubschema=$O;function bO(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,f=s.let("data",(0,qt._)`${e.data}${(0,qt.getProperty)(r)}`,!0);c(f),t.errorPath=(0,qt.str)`${u}${(0,ib.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,qt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof qt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Pr.extendSubschemaData=bO;function xO(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}Pr.extendSubschemaMode=xO});var nm=x((Aq,sb)=>{"use strict";sb.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var ub=x((Uq,cb)=>{"use strict";var Er=cb.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};fc(e,n,o,t,"",t)};Er.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Er.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Er.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Er.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 fc(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Er.arrayKeywords)for(var f=0;f<d.length;f++)fc(t,e,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in Er.propsKeywords){if(d&&typeof d=="object")for(var p in d)fc(t,e,r,d[p],o+"/"+l+"/"+kO(p),i,o,l,n,p)}else(l in Er.keywords||t.allKeys&&!(l in Er.skipKeywords))&&fc(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function kO(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Fi=x(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.getSchemaRefs=ot.resolveUrl=ot.normalizeId=ot._getFullPath=ot.getFullPath=ot.inlineRef=void 0;var SO=ae(),wO=nm(),zO=ub(),IO=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function TO(t,e=!0){return typeof t=="boolean"?!0:e===!0?!om(t):e?lb(t)<=e:!1}ot.inlineRef=TO;var PO=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function om(t){for(let e in t){if(PO.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(om)||typeof r=="object"&&om(r))return!0}return!1}function lb(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!IO.has(r)&&(typeof t[r]=="object"&&(0,SO.eachItem)(t[r],n=>e+=lb(n)),e===1/0))return 1/0}return e}function db(t,e="",r){r!==!1&&(e=Yn(e));let n=t.parse(e);return fb(t,n)}ot.getFullPath=db;function fb(t,e){return t.serialize(e).split("#")[0]+"#"}ot._getFullPath=fb;var EO=/#\/?$/;function Yn(t){return t?t.replace(EO,""):""}ot.normalizeId=Yn;function OO(t,e,r){return r=Yn(r),t.resolve(e,r)}ot.resolveUrl=OO;var jO=/^[a-z_][-a-z0-9._]*$/i;function NO(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Yn(t[r]||e),i={"":o},a=db(n,o,!1),s={},c=new Set;return zO(t,{allKeys:!0},(d,f,p,g)=>{if(g===void 0)return;let h=a+f,y=i[g];typeof d[r]=="string"&&(y=w.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),i[f]=y;function w(j){let z=this.opts.uriResolver.resolve;if(j=Yn(y?z(y,j):j),c.has(j))throw l(j);c.add(j);let N=this.refs[j];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?u(d,N.schema,j):j!==Yn(h)&&(j[0]==="#"?(u(d,s[j],j),s[j]=d):this.refs[j]=h),j}function P(j){if(typeof j=="string"){if(!jO.test(j))throw new Error(`invalid anchor "${j}"`);w.call(this,`#${j}`)}}}),s;function u(d,f,p){if(f!==void 0&&!wO(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ot.getSchemaRefs=NO});var Ji=x(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.getData=Or.KeywordCxt=Or.validateFunctionCode=void 0;var vb=J$(),pb=qi(),am=Hp(),pc=qi(),RO=Q$(),Bi=ob(),im=ab(),A=Q(),J=lr(),CO=Fi(),dr=ae(),Vi=Li();function DO(t){if($b(t)&&(bb(t),yb(t))){ZO(t);return}_b(t,()=>(0,vb.topBoolOrEmptySchema)(t))}Or.validateFunctionCode=DO;function _b({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,A._)`${J.default.data}, ${J.default.valCxt}`,n.$async,()=>{t.code((0,A._)`"use strict"; ${mb(r,o)}`),UO(t,o),t.code(i)}):t.func(e,(0,A._)`${J.default.data}, ${AO(o)}`,n.$async,()=>t.code(mb(r,o)).code(i))}function AO(t){return(0,A._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${t.dynamicRef?(0,A._)`, ${J.default.dynamicAnchors}={}`:A.nil}}={}`}function UO(t,e){t.if(J.default.valCxt,()=>{t.var(J.default.instancePath,(0,A._)`${J.default.valCxt}.${J.default.instancePath}`),t.var(J.default.parentData,(0,A._)`${J.default.valCxt}.${J.default.parentData}`),t.var(J.default.parentDataProperty,(0,A._)`${J.default.valCxt}.${J.default.parentDataProperty}`),t.var(J.default.rootData,(0,A._)`${J.default.valCxt}.${J.default.rootData}`),e.dynamicRef&&t.var(J.default.dynamicAnchors,(0,A._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{t.var(J.default.instancePath,(0,A._)`""`),t.var(J.default.parentData,(0,A._)`undefined`),t.var(J.default.parentDataProperty,(0,A._)`undefined`),t.var(J.default.rootData,J.default.data),e.dynamicRef&&t.var(J.default.dynamicAnchors,(0,A._)`{}`)})}function ZO(t){let{schema:e,opts:r,gen:n}=t;_b(t,()=>{r.$comment&&e.$comment&&kb(t),VO(t),n.let(J.default.vErrors,null),n.let(J.default.errors,0),r.unevaluated&&MO(t),xb(t),WO(t)})}function MO(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,A._)`${r}.evaluated`),e.if((0,A._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,A._)`${t.evaluated}.props`,(0,A._)`undefined`)),e.if((0,A._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,A._)`${t.evaluated}.items`,(0,A._)`undefined`))}function mb(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,A._)`/*# sourceURL=${r} */`:A.nil}function LO(t,e){if($b(t)&&(bb(t),yb(t))){qO(t,e);return}(0,vb.boolOrEmptySchema)(t,e)}function yb({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function $b(t){return typeof t.schema!="boolean"}function qO(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&kb(t),BO(t),JO(t);let i=n.const("_errs",J.default.errors);xb(t,i),n.var(e,(0,A._)`${i} === ${J.default.errors}`)}function bb(t){(0,dr.checkUnknownRules)(t),FO(t)}function xb(t,e){if(t.opts.jtd)return hb(t,[],!1,e);let r=(0,pb.getSchemaTypes)(t.schema),n=(0,pb.coerceAndCheckDataType)(t,r);hb(t,r,!n,e)}function FO(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,dr.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function VO(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,dr.checkStrictMode)(t,"default is ignored in the schema root")}function BO(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,CO.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function JO(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function kb({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,A._)`${J.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,A.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,A._)`${J.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function WO(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,A._)`${J.default.errors} === 0`,()=>e.return(J.default.data),()=>e.throw((0,A._)`new ${o}(${J.default.vErrors})`)):(e.assign((0,A._)`${n}.errors`,J.default.vErrors),i.unevaluated&&GO(t),e.return((0,A._)`${J.default.errors} === 0`))}function GO({gen:t,evaluated:e,props:r,items:n}){r instanceof A.Name&&t.assign((0,A._)`${e}.props`,r),n instanceof A.Name&&t.assign((0,A._)`${e}.items`,n)}function hb(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,dr.schemaHasRulesButRef)(i,l))){o.block(()=>wb(t,"$ref",l.all.$ref.definition));return}c.jtd||KO(t,e),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,am.shouldUseGroup)(i,f)&&(f.type?(o.if((0,pc.checkDataType)(f.type,a,c.strictNumbers)),gb(t,f),e.length===1&&e[0]===f.type&&r&&(o.else(),(0,pc.reportTypeError)(t)),o.endIf()):gb(t,f),s||o.if((0,A._)`${J.default.errors} === ${n||0}`))}}function gb(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,RO.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,am.shouldUseRule)(n,i)&&wb(t,i.keyword,i.definition,e.type)})}function KO(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(HO(t,e),t.opts.allowUnionTypes||XO(t,e),YO(t,t.dataTypes))}function HO(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Sb(t.dataTypes,r)||sm(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),e1(t,e)}}function XO(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&sm(t,"use allowUnionTypes to allow union type keyword")}function YO(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,am.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>QO(e,a))&&sm(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function QO(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Sb(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function e1(t,e){let r=[];for(let n of t.dataTypes)Sb(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function sm(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,dr.checkStrictMode)(t,e,t.opts.strictTypes)}var mc=class{constructor(e,r,n){if((0,Bi.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,dr.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",zb(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Bi.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",J.default.errors))}result(e,r,n){this.failResult((0,A.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,A.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,A._)`${r} !== undefined && (${(0,A.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Vi.reportExtraError:Vi.reportError)(this,this.def.error,r)}$dataError(){(0,Vi.reportError)(this,this.def.$dataError||Vi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Vi.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=A.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=A.nil,r=A.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,A.or)((0,A._)`${o} === undefined`,r)),e!==A.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==A.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,A.or)(a(),s());function a(){if(n.length){if(!(r instanceof A.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,A._)`${(0,pc.checkDataTypes)(c,r,i.opts.strictNumbers,pc.DataType.Wrong)}`}return A.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,A._)`!${c}(${r})`}return A.nil}}subschema(e,r){let n=(0,im.getSubschema)(this.it,e);(0,im.extendSubschemaData)(n,this.it,e),(0,im.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return LO(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=dr.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=dr.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,A.Name)),!0}};Or.KeywordCxt=mc;function wb(t,e,r,n){let o=new mc(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bi.funcKeywordCode)(o,r):"macro"in r?(0,Bi.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bi.funcKeywordCode)(o,r)}var t1=/^\/(?:[^~]|~0|~1)*$/,r1=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function zb(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return J.default.rootData;if(t[0]==="/"){if(!t1.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=J.default.rootData}else{let u=r1.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,A._)`${i}${(0,A.getProperty)((0,dr.unescapeJsonPointer)(u))}`,a=(0,A._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Or.getData=zb});var hc=x(um=>{"use strict";Object.defineProperty(um,"__esModule",{value:!0});var cm=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};um.default=cm});var Wi=x(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});var lm=Fi(),dm=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,lm.resolveUrl)(e,r,n),this.missingSchema=(0,lm.normalizeId)((0,lm.getFullPath)(e,this.missingRef))}};fm.default=dm});var vc=x(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.resolveSchema=St.getCompilingSchema=St.resolveRef=St.compileSchema=St.SchemaEnv=void 0;var Nt=Q(),n1=hc(),nn=lr(),Rt=Fi(),Ib=ae(),o1=Ji(),Qn=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Rt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};St.SchemaEnv=Qn;function mm(t){let e=Tb.call(this,t);if(e)return e;let r=(0,Rt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new Nt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:n1.default,code:(0,Nt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:nn.default.data,parentData:nn.default.parentData,parentDataProperty:nn.default.parentDataProperty,dataNames:[nn.default.data],dataPathArr:[Nt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Nt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Nt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Nt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,o1.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(nn.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${nn.default.self}`,`${nn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;p.evaluated={props:g instanceof Nt.Name?void 0:g,items:h instanceof Nt.Name?void 0:h,dynamicProps:g instanceof Nt.Name,dynamicItems:h instanceof Nt.Name},p.source&&(p.source.evaluated=(0,Nt.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}St.compileSchema=mm;function i1(t,e,r){var n;r=(0,Rt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=c1.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new Qn({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=a1.call(this,i)}St.resolveRef=i1;function a1(t){return(0,Rt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:mm.call(this,t)}function Tb(t){for(let e of this._compilations)if(s1(e,t))return e}St.getCompilingSchema=Tb;function s1(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function c1(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||gc.call(this,t,e)}function gc(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Rt._getFullPath)(this.opts.uriResolver,r),o=(0,Rt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return pm.call(this,r,t);let i=(0,Rt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=gc.call(this,t,a);return typeof s?.schema!="object"?void 0:pm.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||mm.call(this,a),i===(0,Rt.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,Rt.resolveUrl)(this.opts.uriResolver,o,u)),new Qn({schema:s,schemaId:c,root:t,baseId:o})}return pm.call(this,r,a)}}St.resolveSchema=gc;var u1=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function pm(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Ib.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!u1.has(s)&&u&&(e=(0,Rt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Ib.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Rt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=gc.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new Qn({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var Pb=x((Vq,l1)=>{l1.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 gm=x((Bq,Nb)=>{"use strict";var d1=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Ob=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);function hm(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var f1=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Eb(t){return t.length=0,!0}function p1(t,e,r){if(t.length){let n=hm(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function m1(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=p1;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Eb}else{o.push(u);continue}}return o.length&&(s===Eb?r.zone=o.join(""):a?n.push(o.join("")):n.push(hm(o))),r.address=n.join(""),r}function jb(t){if(h1(t,":")<2)return{host:t,isIPV6:!1};let e=m1(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function h1(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function g1(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function v1(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function _1(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Ob(r)){let n=jb(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Nb.exports={nonSimpleDomain:f1,recomposeAuthority:_1,normalizeComponentEncoding:v1,removeDotSegments:g1,isIPv4:Ob,isUUID:d1,normalizeIPv6:jb,stringArrayToHexStripped:hm}});var Ub=x((Jq,Ab)=>{"use strict";var{isUUID:y1}=gm(),$1=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,b1=["http","https","ws","wss","urn","urn:uuid"];function x1(t){return b1.indexOf(t)!==-1}function vm(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Rb(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Cb(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function k1(t){return t.secure=vm(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function S1(t){if((t.port===(vm(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function w1(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match($1);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=_m(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function z1(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=_m(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function I1(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!y1(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function T1(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Db={scheme:"http",domainHost:!0,parse:Rb,serialize:Cb},P1={scheme:"https",domainHost:Db.domainHost,parse:Rb,serialize:Cb},_c={scheme:"ws",domainHost:!0,parse:k1,serialize:S1},E1={scheme:"wss",domainHost:_c.domainHost,parse:_c.parse,serialize:_c.serialize},O1={scheme:"urn",parse:w1,serialize:z1,skipNormalize:!0},j1={scheme:"urn:uuid",parse:I1,serialize:T1,skipNormalize:!0},yc={http:Db,https:P1,ws:_c,wss:E1,urn:O1,"urn:uuid":j1};Object.setPrototypeOf(yc,null);function _m(t){return t&&(yc[t]||yc[t.toLowerCase()])||void 0}Ab.exports={wsIsSecure:vm,SCHEMES:yc,isValidSchemeName:x1,getSchemeHandler:_m}});var Lb=x((Wq,bc)=>{"use strict";var{normalizeIPv6:N1,removeDotSegments:Gi,recomposeAuthority:R1,normalizeComponentEncoding:$c,isIPv4:C1,nonSimpleDomain:D1}=gm(),{SCHEMES:A1,getSchemeHandler:Zb}=Ub();function U1(t,e){return typeof t=="string"?t=Ft(fr(t,e),e):typeof t=="object"&&(t=fr(Ft(t,e),e)),t}function Z1(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Mb(fr(t,n),fr(e,n),n,!0);return n.skipEscape=!0,Ft(o,n)}function Mb(t,e,r,n){let o={};return n||(t=fr(Ft(t,r),r),e=fr(Ft(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Gi(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Gi(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Gi(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Gi(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function M1(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ft($c(fr(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ft($c(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ft($c(fr(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ft($c(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ft(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=Zb(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=R1(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Gi(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var L1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function fr(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(L1);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(C1(n.host)===!1){let c=N1(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Zb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&D1(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var ym={SCHEMES:A1,normalize:U1,resolve:Z1,resolveComponent:Mb,equal:M1,serialize:Ft,parse:fr};bc.exports=ym;bc.exports.default=ym;bc.exports.fastUri=ym});var Fb=x($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});var qb=Lb();qb.code='require("ajv/dist/runtime/uri").default';$m.default=qb});var Xb=x(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.CodeGen=Ze.Name=Ze.nil=Ze.stringify=Ze.str=Ze._=Ze.KeywordCxt=void 0;var q1=Ji();Object.defineProperty(Ze,"KeywordCxt",{enumerable:!0,get:function(){return q1.KeywordCxt}});var eo=Q();Object.defineProperty(Ze,"_",{enumerable:!0,get:function(){return eo._}});Object.defineProperty(Ze,"str",{enumerable:!0,get:function(){return eo.str}});Object.defineProperty(Ze,"stringify",{enumerable:!0,get:function(){return eo.stringify}});Object.defineProperty(Ze,"nil",{enumerable:!0,get:function(){return eo.nil}});Object.defineProperty(Ze,"Name",{enumerable:!0,get:function(){return eo.Name}});Object.defineProperty(Ze,"CodeGen",{enumerable:!0,get:function(){return eo.CodeGen}});var F1=hc(),Gb=Wi(),V1=Kp(),Ki=vc(),B1=Q(),Hi=Fi(),xc=qi(),xm=ae(),Vb=Pb(),J1=Fb(),Kb=(t,e)=>new RegExp(t,e);Kb.code="new RegExp";var W1=["removeAdditional","useDefaults","coerceTypes"],G1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),K1={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."},H1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Bb=200;function X1(t){var e,r,n,o,i,a,s,c,u,l,d,f,p,g,h,y,w,P,j,z,N,Ce,ce,$,b;let C=t.strict,B=(e=t.code)===null||e===void 0?void 0:e.optimize,G=B===!0||B===void 0?1:B||0,Oe=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Kb,Ie=(o=t.uriResolver)!==null&&o!==void 0?o:J1.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:C)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:C)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:C)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:C)!==null&&f!==void 0?f:"log",strictRequired:(g=(p=t.strictRequired)!==null&&p!==void 0?p:C)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:G,regExp:Oe}:{optimize:G,regExp:Oe},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:Bb,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Bb,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(j=t.inlineRefs)!==null&&j!==void 0?j:!0,schemaId:(z=t.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(Ce=t.validateSchema)!==null&&Ce!==void 0?Ce:!0,validateFormats:(ce=t.validateFormats)!==null&&ce!==void 0?ce:!0,unicodeRegExp:($=t.unicodeRegExp)!==null&&$!==void 0?$:!0,int32range:(b=t.int32range)!==null&&b!==void 0?b:!0,uriResolver:Ie}}var Xi=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...X1(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new B1.ValueScope({scope:{},prefixes:G1,es5:r,lines:n}),this.logger=nj(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,V1.getRules)(),Jb.call(this,K1,e,"NOT SUPPORTED"),Jb.call(this,H1,e,"DEPRECATED","warn"),this._metaOpts=tj.call(this),e.formats&&Q1.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ej.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Y1.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Vb;n==="id"&&(o={...Vb},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||a.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Gb.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Hi.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=Wb.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ki.SchemaEnv({schema:{},schemaId:n});if(r=Ki.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}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 r=Wb.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Hi.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ij.call(this,n,r),!r)return(0,xm.eachItem)(n,i=>bm.call(this,i)),this;sj.call(this,r);let o={...r,type:(0,xc.getJSONTypes)(r.type),schemaType:(0,xc.getJSONTypes)(r.schemaType)};return(0,xm.eachItem)(n,o.type.length===0?i=>bm.call(this,i,o):i=>o.type.forEach(a=>bm.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Hb(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Hi.normalizeId)(a||n);let u=Hi.getSchemaRefs.call(this,e,n);return c=new Ki.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Ki.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ki.compileSchema.call(this,e)}finally{this.opts=r}}};Xi.ValidationError=F1.default;Xi.MissingRefError=Gb.default;Ze.default=Xi;function Jb(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function Wb(t){return t=(0,Hi.normalizeId)(t),this.schemas[t]||this.refs[t]}function Y1(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Q1(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function ej(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function tj(){let t={...this.opts};for(let e of W1)delete t[e];return t}var rj={log(){},warn(){},error(){}};function nj(t){if(t===!1)return rj;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var oj=/^[a-z_$][a-z0-9_$:-]*$/i;function ij(t,e){let{RULES:r}=this;if((0,xm.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!oj.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function bm(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,xc.getJSONTypes)(e.type),schemaType:(0,xc.getJSONTypes)(e.schemaType)}};e.before?aj.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function aj(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function sj(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Hb(e)),t.validateSchema=this.compile(e,!0))}var cj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hb(t){return{anyOf:[t,cj]}}});var Yb=x(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});var uj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};km.default=uj});var rx=x(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.callRef=on.getValidate=void 0;var lj=Wi(),Qb=kt(),it=Q(),to=lr(),ex=vc(),kc=ae(),dj={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=ex.resolveRef.call(c,u,o,r);if(l===void 0)throw new lj.default(n.opts.uriResolver,o,r);if(l instanceof ex.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return Sc(t,a,i,i.$async);let g=e.scopeValue("root",{ref:u});return Sc(t,(0,it._)`${g}.validate`,u,u.$async)}function f(g){let h=tx(t,g);Sc(t,h,g,g.$async)}function p(g){let h=e.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,it.stringify)(g)}:{ref:g}),y=e.name("valid"),w=t.subschema({schema:g,dataTypes:[],schemaPath:it.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(w),t.ok(y)}}};function tx(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,it._)`${r.scopeValue("wrapper",{ref:e})}.validate`}on.getValidate=tx;function Sc(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?to.default.this:it.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,it._)`await ${(0,Qb.callValidateCode)(t,e,u)}`),p(e),a||o.assign(g,!0)},h=>{o.if((0,it._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),a||o.assign(g,!1)}),t.ok(g)}function d(){t.result((0,Qb.callValidateCode)(t,e,u),()=>p(e),()=>f(e))}function f(g){let h=(0,it._)`${g}.errors`;o.assign(to.default.vErrors,(0,it._)`${to.default.vErrors} === null ? ${h} : ${to.default.vErrors}.concat(${h})`),o.assign(to.default.errors,(0,it._)`${to.default.vErrors}.length`)}function p(g){var h;if(!i.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=kc.mergeEvaluated.props(o,y.props,i.props));else{let w=o.var("props",(0,it._)`${g}.evaluated.props`);i.props=kc.mergeEvaluated.props(o,w,i.props,it.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=kc.mergeEvaluated.items(o,y.items,i.items));else{let w=o.var("items",(0,it._)`${g}.evaluated.items`);i.items=kc.mergeEvaluated.items(o,w,i.items,it.Name)}}}on.callRef=Sc;on.default=dj});var nx=x(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});var fj=Yb(),pj=rx(),mj=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",fj.default,pj.default];Sm.default=mj});var ox=x(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});var wc=Q(),jr=wc.operators,zc={maximum:{okStr:"<=",ok:jr.LTE,fail:jr.GT},minimum:{okStr:">=",ok:jr.GTE,fail:jr.LT},exclusiveMaximum:{okStr:"<",ok:jr.LT,fail:jr.GTE},exclusiveMinimum:{okStr:">",ok:jr.GT,fail:jr.LTE}},hj={message:({keyword:t,schemaCode:e})=>(0,wc.str)`must be ${zc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,wc._)`{comparison: ${zc[t].okStr}, limit: ${e}}`},gj={keyword:Object.keys(zc),type:"number",schemaType:"number",$data:!0,error:hj,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,wc._)`${r} ${zc[e].fail} ${n} || isNaN(${r})`)}};wm.default=gj});var ix=x(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Yi=Q(),vj={message:({schemaCode:t})=>(0,Yi.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Yi._)`{multipleOf: ${t}}`},_j={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:vj,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,Yi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Yi._)`${a} !== parseInt(${a})`;t.fail$data((0,Yi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};zm.default=_j});var sx=x(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});function ax(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Im.default=ax;ax.code='require("ajv/dist/runtime/ucs2length").default'});var cx=x(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});var an=Q(),yj=ae(),$j=sx(),bj={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,an.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,an._)`{limit: ${t}}`},xj={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:bj,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?an.operators.GT:an.operators.LT,a=o.opts.unicode===!1?(0,an._)`${r}.length`:(0,an._)`${(0,yj.useFunc)(t.gen,$j.default)}(${r})`;t.fail$data((0,an._)`${a} ${i} ${n}`)}};Tm.default=xj});var ux=x(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var kj=kt(),Sj=ae(),ro=Q(),wj={message:({schemaCode:t})=>(0,ro.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ro._)`{pattern: ${t}}`},zj={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:wj,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,ro._)`new RegExp`:(0,Sj.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,ro._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,ro._)`!${l}`)}else{let c=(0,kj.usePattern)(t,o);t.fail$data((0,ro._)`!${c}.test(${r})`)}}};Pm.default=zj});var lx=x(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});var Qi=Q(),Ij={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Qi.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Qi._)`{limit: ${t}}`},Tj={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ij,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Qi.operators.GT:Qi.operators.LT;t.fail$data((0,Qi._)`Object.keys(${r}).length ${o} ${n}`)}};Em.default=Tj});var dx=x(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});var ea=kt(),ta=Q(),Pj=ae(),Ej={message:({params:{missingProperty:t}})=>(0,ta.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ta._)`{missingProperty: ${t}}`},Oj={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Ej,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=t.parentSchema.properties,{definedProperties:g}=t.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let y=a.schemaEnv.baseId+a.errSchemaPath,w=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,Pj.checkStrictMode)(a,w,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(ta.nil,d);else for(let p of r)(0,ea.checkReportMissingProp)(t,p)}function l(){let p=e.let("missing");if(c||i){let g=e.let("valid",!0);t.block$data(g,()=>f(p,g)),t.ok(g)}else e.if((0,ea.checkMissingProp)(t,r,p)),(0,ea.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,ea.noPropertyInData)(e,o,p,s.ownProperties),()=>t.error())})}function f(p,g){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(g,(0,ea.propertyInData)(e,o,p,s.ownProperties)),e.if((0,ta.not)(g),()=>{t.error(),e.break()})},ta.nil)}}};Om.default=Oj});var fx=x(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var ra=Q(),jj={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ra.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ra._)`{limit: ${t}}`},Nj={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:jj,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?ra.operators.GT:ra.operators.LT;t.fail$data((0,ra._)`${r}.length ${o} ${n}`)}};jm.default=Nj});var Ic=x(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var px=nm();px.code='require("ajv/dist/runtime/equal").default';Nm.default=px});var mx=x(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});var Rm=qi(),Me=Q(),Rj=ae(),Cj=Ic(),Dj={message:({params:{i:t,j:e}})=>(0,Me.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Me._)`{i: ${t}, j: ${e}}`},Aj={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Dj,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Rm.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Me._)`${a} === false`),t.ok(c);function l(){let g=e.let("i",(0,Me._)`${r}.length`),h=e.let("j");t.setParams({i:g,j:h}),e.assign(c,!0),e.if((0,Me._)`${g} > 1`,()=>(d()?f:p)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function f(g,h){let y=e.name("item"),w=(0,Rm.checkDataTypes)(u,y,s.opts.strictNumbers,Rm.DataType.Wrong),P=e.const("indices",(0,Me._)`{}`);e.for((0,Me._)`;${g}--;`,()=>{e.let(y,(0,Me._)`${r}[${g}]`),e.if(w,(0,Me._)`continue`),u.length>1&&e.if((0,Me._)`typeof ${y} == "string"`,(0,Me._)`${y} += "_"`),e.if((0,Me._)`typeof ${P}[${y}] == "number"`,()=>{e.assign(h,(0,Me._)`${P}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,Me._)`${P}[${y}] = ${g}`)})}function p(g,h){let y=(0,Rj.useFunc)(e,Cj.default),w=e.name("outer");e.label(w).for((0,Me._)`;${g}--;`,()=>e.for((0,Me._)`${h} = ${g}; ${h}--;`,()=>e.if((0,Me._)`${y}(${r}[${g}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(w)})))}}};Cm.default=Aj});var hx=x(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});var Dm=Q(),Uj=ae(),Zj=Ic(),Mj={message:"must be equal to constant",params:({schemaCode:t})=>(0,Dm._)`{allowedValue: ${t}}`},Lj={keyword:"const",$data:!0,error:Mj,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,Dm._)`!${(0,Uj.useFunc)(e,Zj.default)}(${r}, ${o})`):t.fail((0,Dm._)`${i} !== ${r}`)}};Am.default=Lj});var gx=x(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});var na=Q(),qj=ae(),Fj=Ic(),Vj={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,na._)`{allowedValues: ${t}}`},Bj={keyword:"enum",schemaType:"array",$data:!0,error:Vj,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,qj.useFunc)(e,Fj.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=e.const("vSchema",i);l=(0,na.or)(...o.map((g,h)=>f(p,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,p=>e.if((0,na._)`${u()}(${r}, ${p})`,()=>e.assign(l,!0).break()))}function f(p,g){let h=o[g];return typeof h=="object"&&h!==null?(0,na._)`${u()}(${r}, ${p}[${g}])`:(0,na._)`${r} === ${h}`}}};Um.default=Bj});var vx=x(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});var Jj=ox(),Wj=ix(),Gj=cx(),Kj=ux(),Hj=lx(),Xj=dx(),Yj=fx(),Qj=mx(),eN=hx(),tN=gx(),rN=[Jj.default,Wj.default,Gj.default,Kj.default,Hj.default,Xj.default,Yj.default,Qj.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},eN.default,tN.default];Zm.default=rN});var Lm=x(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.validateAdditionalItems=void 0;var sn=Q(),Mm=ae(),nN={message:({params:{len:t}})=>(0,sn.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sn._)`{limit: ${t}}`},oN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:nN,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Mm.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}_x(t,n)}};function _x(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,sn._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,sn._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Mm.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,sn._)`${s} <= ${e.length}`);r.if((0,sn.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Mm.Type.Num},u),a.allErrors||r.if((0,sn.not)(u),()=>r.break())})}}oa.validateAdditionalItems=_x;oa.default=oN});var qm=x(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.validateTuple=void 0;var yx=Q(),Tc=ae(),iN=kt(),aN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return $x(t,"additionalItems",e);r.items=!0,!(0,Tc.alwaysValidSchema)(r,e)&&t.ok((0,iN.validateArray)(t))}};function $x(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Tc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,yx._)`${i}.length`);r.forEach((d,f)=>{(0,Tc.alwaysValidSchema)(s,d)||(n.if((0,yx._)`${u} > ${f}`,()=>t.subschema({keyword:a,schemaProp:f,dataProp:f},c)),t.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let y=`"${a}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Tc.checkStrictMode)(s,y,f.strictTuples)}}}ia.validateTuple=$x;ia.default=aN});var bx=x(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});var sN=qm(),cN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,sN.validateTuple)(t,"items")};Fm.default=cN});var kx=x(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});var xx=Q(),uN=ae(),lN=kt(),dN=Lm(),fN={message:({params:{len:t}})=>(0,xx.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xx._)`{limit: ${t}}`},pN={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:fN,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,uN.alwaysValidSchema)(n,e)&&(o?(0,dN.validateAdditionalItems)(t,o):t.ok((0,lN.validateArray)(t)))}};Vm.default=pN});var Sx=x(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});var wt=Q(),Pc=ae(),mN={message:({params:{min:t,max:e}})=>e===void 0?(0,wt.str)`must contain at least ${t} valid item(s)`:(0,wt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,wt._)`{minContains: ${t}}`:(0,wt._)`{minContains: ${t}, maxContains: ${e}}`},hN={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:mN,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,wt._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Pc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Pc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Pc.alwaysValidSchema)(i,r)){let h=(0,wt._)`${l} >= ${a}`;s!==void 0&&(h=(0,wt._)`${h} && ${l} <= ${s}`),t.pass(h);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?p(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,wt._)`${o}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),y=e.let("count",0);p(h,()=>e.if(h,()=>g(y)))}function p(h,y){e.forRange("i",0,l,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:Pc.Type.Num,compositeRule:!0},h),y()})}function g(h){e.code((0,wt._)`${h}++`),s===void 0?e.if((0,wt._)`${h} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,wt._)`${h} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,wt._)`${h} >= ${a}`,()=>e.assign(d,!0)))}}};Bm.default=hN});var Ix=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.validateSchemaDeps=Vt.validatePropertyDeps=Vt.error=void 0;var Jm=Q(),gN=ae(),aa=kt();Vt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Jm.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Jm._)`{property: ${t},
12
+ || ${a} === "boolean" || ${o} === null`).assign(s,(0,Y._)`[${o}]`)}}}function XE({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Y._)`${e} !== undefined`,()=>t.assign((0,Y._)`${e}[${r}]`,n))}function em(t,e,r,n=Qn.Correct){let o=n===Qn.Correct?Y.operators.EQ:Y.operators.NEQ,i;switch(t){case"null":return(0,Y._)`${e} ${o} null`;case"array":i=(0,Y._)`Array.isArray(${e})`;break;case"object":i=(0,Y._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,Y._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,Y._)`typeof ${e} ${o} ${t}`}return n===Qn.Correct?i:(0,Y.not)(i);function a(s=Y.nil){return(0,Y.and)((0,Y._)`typeof ${e} == "number"`,s,r?(0,Y._)`isFinite(${e})`:Y.nil)}}Ge.checkDataType=em;function tm(t,e,r,n){if(t.length===1)return em(t[0],e,r,n);let o,i=(0,X$.toHash)(t);if(i.array&&i.object){let a=(0,Y._)`typeof ${e} != "object"`;o=i.null?a:(0,Y._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=Y.nil;i.number&&delete i.integer;for(let a in i)o=(0,Y.and)(o,em(a,e,r,n));return o}Ge.checkDataTypes=tm;var YE={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Y._)`{type: ${t}}`:(0,Y._)`{type: ${e}}`};function rm(t){let e=QE(t);(0,JE.reportError)(e,YE)}Ge.reportTypeError=rm;function QE(t){let{gen:e,data:r,schema:n}=t,o=(0,X$.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var tb=x(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.assignDefaults=void 0;var eo=Q(),eO=se();function tO(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)eb(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>eb(t,i,o.default))}hc.assignDefaults=tO;function eb(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,eo._)`${i}${(0,eo.getProperty)(e)}`;if(o){(0,eO.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,eo._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,eo._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,eo._)`${s} = ${(0,eo.stringify)(r)}`)}});var wt=x(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.validateUnion=he.validateArray=he.usePattern=he.callValidateCode=he.schemaProperties=he.allSchemaProperties=he.noPropertyInData=he.propertyInData=he.isOwnProperty=he.hasPropFunc=he.reportMissingProp=he.checkMissingProp=he.checkReportMissingProp=void 0;var Se=Q(),nm=se(),Er=fr(),rO=se();function nO(t,e){let{gen:r,data:n,it:o}=t;r.if(im(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Se._)`${e}`},!0),t.error()})}he.checkReportMissingProp=nO;function oO({gen:t,data:e,it:{opts:r}},n,o){return(0,Se.or)(...n.map(i=>(0,Se.and)(im(t,e,i,r.ownProperties),(0,Se._)`${o} = ${i}`)))}he.checkMissingProp=oO;function iO(t,e){t.setParams({missingProperty:e},!0),t.error()}he.reportMissingProp=iO;function rb(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Se._)`Object.prototype.hasOwnProperty`})}he.hasPropFunc=rb;function om(t,e,r){return(0,Se._)`${rb(t)}.call(${e}, ${r})`}he.isOwnProperty=om;function aO(t,e,r,n){let o=(0,Se._)`${e}${(0,Se.getProperty)(r)} !== undefined`;return n?(0,Se._)`${o} && ${om(t,e,r)}`:o}he.propertyInData=aO;function im(t,e,r,n){let o=(0,Se._)`${e}${(0,Se.getProperty)(r)} === undefined`;return n?(0,Se.or)(o,(0,Se.not)(om(t,e,r))):o}he.noPropertyInData=im;function nb(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}he.allSchemaProperties=nb;function sO(t,e){return nb(e).filter(r=>!(0,nm.alwaysValidSchema)(t,e[r]))}he.schemaProperties=sO;function cO({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,Se._)`${t}, ${e}, ${n}${o}`:e,d=[[Er.default.instancePath,(0,Se.strConcat)(Er.default.instancePath,i)],[Er.default.parentData,a.parentData],[Er.default.parentDataProperty,a.parentDataProperty],[Er.default.rootData,Er.default.rootData]];a.opts.dynamicRef&&d.push([Er.default.dynamicAnchors,Er.default.dynamicAnchors]);let p=(0,Se._)`${l}, ${r.object(...d)}`;return c!==Se.nil?(0,Se._)`${s}.call(${c}, ${p})`:(0,Se._)`${s}(${p})`}he.callValidateCode=cO;var uO=(0,Se._)`new RegExp`;function lO({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Se._)`${o.code==="new RegExp"?uO:(0,rO.useFunc)(t,o)}(${r}, ${n})`})}he.usePattern=lO;function dO(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,Se._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:nm.Type.Num},i),e.if((0,Se.not)(i),s)})}}he.validateArray=dO;function fO(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,nm.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,Se._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,Se.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}he.validateUnion=fO});var ab=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.validateKeywordUsage=Vt.validSchemaType=Vt.funcKeywordCode=Vt.macroKeywordCode=void 0;var tt=Q(),on=fr(),pO=wt(),mO=Bi();function hO(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=ib(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:tt.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Vt.macroKeywordCode=hO;function gO(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;_O(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=ib(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&ob(t),$(()=>t.error());else{let w=e.async?f():v();e.modifying&&ob(t),$(()=>vO(t,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>h((0,tt._)`await `),P=>n.assign(d,!1).if((0,tt._)`${P} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,tt._)`${P}.errors`),()=>n.throw(P))),w}function v(){let w=(0,tt._)`${l}.errors`;return n.assign(w,null),h(tt.nil),w}function h(w=e.async?(0,tt._)`await `:tt.nil){let P=c.opts.passContext?on.default.this:on.default.self,j=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,tt._)`${w}${(0,pO.callValidateCode)(t,l,P,j)}`,e.modifying)}function $(w){var P;n.if((0,tt.not)((P=e.valid)!==null&&P!==void 0?P:d),w)}}Vt.funcKeywordCode=gO;function ob(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,tt._)`${n.parentData}[${n.parentDataProperty}]`))}function vO(t,e){let{gen:r}=t;r.if((0,tt._)`Array.isArray(${e})`,()=>{r.assign(on.default.vErrors,(0,tt._)`${on.default.vErrors} === null ? ${e} : ${on.default.vErrors}.concat(${e})`).assign(on.default.errors,(0,tt._)`${on.default.vErrors}.length`),(0,mO.extendErrors)(t)},()=>t.error())}function _O({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function ib(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,tt.stringify)(r)})}function yO(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Vt.validSchemaType=yO;function $O({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Vt.validateKeywordUsage=$O});var cb=x(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.extendSubschemaMode=Or.extendSubschemaData=Or.getSubschema=void 0;var Bt=Q(),sb=se();function bO(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,Bt._)`${t.schemaPath}${(0,Bt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,Bt._)`${t.schemaPath}${(0,Bt.getProperty)(e)}${(0,Bt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,sb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Or.getSubschema=bO;function xO(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=s.let("data",(0,Bt._)`${e.data}${(0,Bt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Bt.str)`${u}${(0,sb.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Bt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Or.extendSubschemaData=xO;function kO(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}Or.extendSubschemaMode=kO});var am=x((Zq,ub)=>{"use strict";ub.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var db=x((Mq,lb)=>{"use strict";var jr=lb.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};gc(e,n,o,t,"",t)};jr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};jr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};jr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};jr.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 gc(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in jr.arrayKeywords)for(var p=0;p<d.length;p++)gc(t,e,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in jr.propsKeywords){if(d&&typeof d=="object")for(var f in d)gc(t,e,r,d[f],o+"/"+l+"/"+SO(f),i,o,l,n,f)}else(l in jr.keywords||t.allKeys&&!(l in jr.skipKeywords))&&gc(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function SO(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Wi=x(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.getSchemaRefs=at.resolveUrl=at.normalizeId=at._getFullPath=at.getFullPath=at.inlineRef=void 0;var wO=se(),zO=am(),IO=db(),TO=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function PO(t,e=!0){return typeof t=="boolean"?!0:e===!0?!sm(t):e?fb(t)<=e:!1}at.inlineRef=PO;var EO=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function sm(t){for(let e in t){if(EO.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(sm)||typeof r=="object"&&sm(r))return!0}return!1}function fb(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!TO.has(r)&&(typeof t[r]=="object"&&(0,wO.eachItem)(t[r],n=>e+=fb(n)),e===1/0))return 1/0}return e}function pb(t,e="",r){r!==!1&&(e=to(e));let n=t.parse(e);return mb(t,n)}at.getFullPath=pb;function mb(t,e){return t.serialize(e).split("#")[0]+"#"}at._getFullPath=mb;var OO=/#\/?$/;function to(t){return t?t.replace(OO,""):""}at.normalizeId=to;function jO(t,e,r){return r=to(r),t.resolve(e,r)}at.resolveUrl=jO;var NO=/^[a-z_][-a-z0-9._]*$/i;function RO(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=to(t[r]||e),i={"":o},a=pb(n,o,!1),s={},c=new Set;return IO(t,{allKeys:!0},(d,p,f,v)=>{if(v===void 0)return;let h=a+p,$=i[v];typeof d[r]=="string"&&($=w.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),i[p]=$;function w(j){let U=this.opts.uriResolver.resolve;if(j=to($?U($,j):j),c.has(j))throw l(j);c.add(j);let z=this.refs[j];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,j):j!==to(h)&&(j[0]==="#"?(u(d,s[j],j),s[j]=d):this.refs[j]=h),j}function P(j){if(typeof j=="string"){if(!NO.test(j))throw new Error(`invalid anchor "${j}"`);w.call(this,`#${j}`)}}}),s;function u(d,p,f){if(p!==void 0&&!zO(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}at.getSchemaRefs=RO});var Hi=x(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.getData=Nr.KeywordCxt=Nr.validateFunctionCode=void 0;var yb=G$(),hb=Ji(),um=Qp(),vc=Ji(),CO=tb(),Ki=ab(),cm=cb(),A=Q(),J=fr(),DO=Wi(),pr=se(),Gi=Bi();function AO(t){if(xb(t)&&(kb(t),bb(t))){MO(t);return}$b(t,()=>(0,yb.topBoolOrEmptySchema)(t))}Nr.validateFunctionCode=AO;function $b({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,A._)`${J.default.data}, ${J.default.valCxt}`,n.$async,()=>{t.code((0,A._)`"use strict"; ${gb(r,o)}`),ZO(t,o),t.code(i)}):t.func(e,(0,A._)`${J.default.data}, ${UO(o)}`,n.$async,()=>t.code(gb(r,o)).code(i))}function UO(t){return(0,A._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${t.dynamicRef?(0,A._)`, ${J.default.dynamicAnchors}={}`:A.nil}}={}`}function ZO(t,e){t.if(J.default.valCxt,()=>{t.var(J.default.instancePath,(0,A._)`${J.default.valCxt}.${J.default.instancePath}`),t.var(J.default.parentData,(0,A._)`${J.default.valCxt}.${J.default.parentData}`),t.var(J.default.parentDataProperty,(0,A._)`${J.default.valCxt}.${J.default.parentDataProperty}`),t.var(J.default.rootData,(0,A._)`${J.default.valCxt}.${J.default.rootData}`),e.dynamicRef&&t.var(J.default.dynamicAnchors,(0,A._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{t.var(J.default.instancePath,(0,A._)`""`),t.var(J.default.parentData,(0,A._)`undefined`),t.var(J.default.parentDataProperty,(0,A._)`undefined`),t.var(J.default.rootData,J.default.data),e.dynamicRef&&t.var(J.default.dynamicAnchors,(0,A._)`{}`)})}function MO(t){let{schema:e,opts:r,gen:n}=t;$b(t,()=>{r.$comment&&e.$comment&&wb(t),BO(t),n.let(J.default.vErrors,null),n.let(J.default.errors,0),r.unevaluated&&LO(t),Sb(t),GO(t)})}function LO(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,A._)`${r}.evaluated`),e.if((0,A._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,A._)`${t.evaluated}.props`,(0,A._)`undefined`)),e.if((0,A._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,A._)`${t.evaluated}.items`,(0,A._)`undefined`))}function gb(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,A._)`/*# sourceURL=${r} */`:A.nil}function qO(t,e){if(xb(t)&&(kb(t),bb(t))){FO(t,e);return}(0,yb.boolOrEmptySchema)(t,e)}function bb({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function xb(t){return typeof t.schema!="boolean"}function FO(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&wb(t),JO(t),WO(t);let i=n.const("_errs",J.default.errors);Sb(t,i),n.var(e,(0,A._)`${i} === ${J.default.errors}`)}function kb(t){(0,pr.checkUnknownRules)(t),VO(t)}function Sb(t,e){if(t.opts.jtd)return vb(t,[],!1,e);let r=(0,hb.getSchemaTypes)(t.schema),n=(0,hb.coerceAndCheckDataType)(t,r);vb(t,r,!n,e)}function VO(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,pr.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function BO(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,pr.checkStrictMode)(t,"default is ignored in the schema root")}function JO(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,DO.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function WO(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function wb({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,A._)`${J.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,A.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,A._)`${J.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function GO(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,A._)`${J.default.errors} === 0`,()=>e.return(J.default.data),()=>e.throw((0,A._)`new ${o}(${J.default.vErrors})`)):(e.assign((0,A._)`${n}.errors`,J.default.vErrors),i.unevaluated&&KO(t),e.return((0,A._)`${J.default.errors} === 0`))}function KO({gen:t,evaluated:e,props:r,items:n}){r instanceof A.Name&&t.assign((0,A._)`${e}.props`,r),n instanceof A.Name&&t.assign((0,A._)`${e}.items`,n)}function vb(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,pr.schemaHasRulesButRef)(i,l))){o.block(()=>Ib(t,"$ref",l.all.$ref.definition));return}c.jtd||HO(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,um.shouldUseGroup)(i,p)&&(p.type?(o.if((0,vc.checkDataType)(p.type,a,c.strictNumbers)),_b(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,vc.reportTypeError)(t)),o.endIf()):_b(t,p),s||o.if((0,A._)`${J.default.errors} === ${n||0}`))}}function _b(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,CO.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,um.shouldUseRule)(n,i)&&Ib(t,i.keyword,i.definition,e.type)})}function HO(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(XO(t,e),t.opts.allowUnionTypes||YO(t,e),QO(t,t.dataTypes))}function XO(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{zb(t.dataTypes,r)||lm(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),t1(t,e)}}function YO(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&lm(t,"use allowUnionTypes to allow union type keyword")}function QO(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,um.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>e1(e,a))&&lm(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function e1(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function zb(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function t1(t,e){let r=[];for(let n of t.dataTypes)zb(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function lm(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,pr.checkStrictMode)(t,e,t.opts.strictTypes)}var _c=class{constructor(e,r,n){if((0,Ki.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,pr.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Tb(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Ki.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",J.default.errors))}result(e,r,n){this.failResult((0,A.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,A.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,A._)`${r} !== undefined && (${(0,A.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Gi.reportExtraError:Gi.reportError)(this,this.def.error,r)}$dataError(){(0,Gi.reportError)(this,this.def.$dataError||Gi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gi.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=A.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=A.nil,r=A.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,A.or)((0,A._)`${o} === undefined`,r)),e!==A.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==A.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,A.or)(a(),s());function a(){if(n.length){if(!(r instanceof A.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,A._)`${(0,vc.checkDataTypes)(c,r,i.opts.strictNumbers,vc.DataType.Wrong)}`}return A.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,A._)`!${c}(${r})`}return A.nil}}subschema(e,r){let n=(0,cm.getSubschema)(this.it,e);(0,cm.extendSubschemaData)(n,this.it,e),(0,cm.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return qO(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=pr.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=pr.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,A.Name)),!0}};Nr.KeywordCxt=_c;function Ib(t,e,r,n){let o=new _c(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Ki.funcKeywordCode)(o,r):"macro"in r?(0,Ki.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Ki.funcKeywordCode)(o,r)}var r1=/^\/(?:[^~]|~0|~1)*$/,n1=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Tb(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return J.default.rootData;if(t[0]==="/"){if(!r1.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=J.default.rootData}else{let u=n1.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,A._)`${i}${(0,A.getProperty)((0,pr.unescapeJsonPointer)(u))}`,a=(0,A._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Nr.getData=Tb});var yc=x(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});var dm=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};fm.default=dm});var Xi=x(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});var pm=Wi(),mm=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,pm.resolveUrl)(e,r,n),this.missingSchema=(0,pm.normalizeId)((0,pm.getFullPath)(e,this.missingRef))}};hm.default=mm});var bc=x(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.resolveSchema=zt.getCompilingSchema=zt.resolveRef=zt.compileSchema=zt.SchemaEnv=void 0;var Ct=Q(),o1=yc(),an=fr(),Dt=Wi(),Pb=se(),i1=Hi(),ro=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Dt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};zt.SchemaEnv=ro;function vm(t){let e=Eb.call(this,t);if(e)return e;let r=(0,Dt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new Ct.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:o1.default,code:(0,Ct._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:an.default.data,parentData:an.default.parentData,parentDataProperty:an.default.parentDataProperty,dataNames:[an.default.data],dataPathArr:[Ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ct.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ct.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ct._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,i1.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(an.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${an.default.self}`,`${an.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:v,items:h}=u;f.evaluated={props:v instanceof Ct.Name?void 0:v,items:h instanceof Ct.Name?void 0:h,dynamicProps:v instanceof Ct.Name,dynamicItems:h instanceof Ct.Name},f.source&&(f.source.evaluated=(0,Ct.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}zt.compileSchema=vm;function a1(t,e,r){var n;r=(0,Dt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=u1.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new ro({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=s1.call(this,i)}zt.resolveRef=a1;function s1(t){return(0,Dt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:vm.call(this,t)}function Eb(t){for(let e of this._compilations)if(c1(e,t))return e}zt.getCompilingSchema=Eb;function c1(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function u1(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||$c.call(this,t,e)}function $c(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Dt._getFullPath)(this.opts.uriResolver,r),o=(0,Dt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return gm.call(this,r,t);let i=(0,Dt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=$c.call(this,t,a);return typeof s?.schema!="object"?void 0:gm.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||vm.call(this,a),i===(0,Dt.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,Dt.resolveUrl)(this.opts.uriResolver,o,u)),new ro({schema:s,schemaId:c,root:t,baseId:o})}return gm.call(this,r,a)}}zt.resolveSchema=$c;var l1=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function gm(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Pb.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!l1.has(s)&&u&&(e=(0,Dt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Pb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Dt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=$c.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new ro({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var Ob=x((Jq,d1)=>{d1.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 ym=x((Wq,Cb)=>{"use strict";var f1=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Nb=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);function _m(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var p1=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function jb(t){return t.length=0,!0}function m1(t,e,r){if(t.length){let n=_m(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function h1(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=m1;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=jb}else{o.push(u);continue}}return o.length&&(s===jb?r.zone=o.join(""):a?n.push(o.join("")):n.push(_m(o))),r.address=n.join(""),r}function Rb(t){if(g1(t,":")<2)return{host:t,isIPV6:!1};let e=h1(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function g1(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function v1(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function _1(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function y1(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Nb(r)){let n=Rb(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Cb.exports={nonSimpleDomain:p1,recomposeAuthority:y1,normalizeComponentEncoding:_1,removeDotSegments:v1,isIPv4:Nb,isUUID:f1,normalizeIPv6:Rb,stringArrayToHexStripped:_m}});var Mb=x((Gq,Zb)=>{"use strict";var{isUUID:$1}=ym(),b1=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,x1=["http","https","ws","wss","urn","urn:uuid"];function k1(t){return x1.indexOf(t)!==-1}function $m(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Db(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ab(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function S1(t){return t.secure=$m(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function w1(t){if((t.port===($m(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function z1(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(b1);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=bm(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function I1(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=bm(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function T1(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!$1(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function P1(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Ub={scheme:"http",domainHost:!0,parse:Db,serialize:Ab},E1={scheme:"https",domainHost:Ub.domainHost,parse:Db,serialize:Ab},xc={scheme:"ws",domainHost:!0,parse:S1,serialize:w1},O1={scheme:"wss",domainHost:xc.domainHost,parse:xc.parse,serialize:xc.serialize},j1={scheme:"urn",parse:z1,serialize:I1,skipNormalize:!0},N1={scheme:"urn:uuid",parse:T1,serialize:P1,skipNormalize:!0},kc={http:Ub,https:E1,ws:xc,wss:O1,urn:j1,"urn:uuid":N1};Object.setPrototypeOf(kc,null);function bm(t){return t&&(kc[t]||kc[t.toLowerCase()])||void 0}Zb.exports={wsIsSecure:$m,SCHEMES:kc,isValidSchemeName:k1,getSchemeHandler:bm}});var Fb=x((Kq,wc)=>{"use strict";var{normalizeIPv6:R1,removeDotSegments:Yi,recomposeAuthority:C1,normalizeComponentEncoding:Sc,isIPv4:D1,nonSimpleDomain:A1}=ym(),{SCHEMES:U1,getSchemeHandler:Lb}=Mb();function Z1(t,e){return typeof t=="string"?t=Jt(mr(t,e),e):typeof t=="object"&&(t=mr(Jt(t,e),e)),t}function M1(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=qb(mr(t,n),mr(e,n),n,!0);return n.skipEscape=!0,Jt(o,n)}function qb(t,e,r,n){let o={};return n||(t=mr(Jt(t,r),r),e=mr(Jt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Yi(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Yi(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Yi(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Yi(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function L1(t,e,r){return typeof t=="string"?(t=unescape(t),t=Jt(Sc(mr(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Jt(Sc(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Jt(Sc(mr(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Jt(Sc(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Jt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=Lb(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=C1(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Yi(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var q1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function mr(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(q1);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(D1(n.host)===!1){let c=R1(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Lb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&A1(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var xm={SCHEMES:U1,normalize:Z1,resolve:M1,resolveComponent:qb,equal:L1,serialize:Jt,parse:mr};wc.exports=xm;wc.exports.default=xm;wc.exports.fastUri=xm});var Bb=x(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});var Vb=Fb();Vb.code='require("ajv/dist/runtime/uri").default';km.default=Vb});var Qb=x(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.CodeGen=Le.Name=Le.nil=Le.stringify=Le.str=Le._=Le.KeywordCxt=void 0;var F1=Hi();Object.defineProperty(Le,"KeywordCxt",{enumerable:!0,get:function(){return F1.KeywordCxt}});var no=Q();Object.defineProperty(Le,"_",{enumerable:!0,get:function(){return no._}});Object.defineProperty(Le,"str",{enumerable:!0,get:function(){return no.str}});Object.defineProperty(Le,"stringify",{enumerable:!0,get:function(){return no.stringify}});Object.defineProperty(Le,"nil",{enumerable:!0,get:function(){return no.nil}});Object.defineProperty(Le,"Name",{enumerable:!0,get:function(){return no.Name}});Object.defineProperty(Le,"CodeGen",{enumerable:!0,get:function(){return no.CodeGen}});var V1=yc(),Hb=Xi(),B1=Yp(),Qi=bc(),J1=Q(),ea=Wi(),zc=Ji(),wm=se(),Jb=Ob(),W1=Bb(),Xb=(t,e)=>new RegExp(t,e);Xb.code="new RegExp";var G1=["removeAdditional","useDefaults","coerceTypes"],K1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),H1={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."},X1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Wb=200;function Y1(t){var e,r,n,o,i,a,s,c,u,l,d,p,f,v,h,$,w,P,j,U,z,Ae,Ne,ze,y;let b=t.strict,R=(e=t.code)===null||e===void 0?void 0:e.optimize,N=R===!0||R===void 0?1:R||0,oe=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Xb,G=(o=t.uriResolver)!==null&&o!==void 0?o:W1.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:b)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:b)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:b)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:b)!==null&&p!==void 0?p:"log",strictRequired:(v=(f=t.strictRequired)!==null&&f!==void 0?f:b)!==null&&v!==void 0?v:!1,code:t.code?{...t.code,optimize:N,regExp:oe}:{optimize:N,regExp:oe},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:Wb,loopEnum:($=t.loopEnum)!==null&&$!==void 0?$:Wb,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(j=t.inlineRefs)!==null&&j!==void 0?j:!0,schemaId:(U=t.schemaId)!==null&&U!==void 0?U:"$id",addUsedSchema:(z=t.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(Ae=t.validateSchema)!==null&&Ae!==void 0?Ae:!0,validateFormats:(Ne=t.validateFormats)!==null&&Ne!==void 0?Ne:!0,unicodeRegExp:(ze=t.unicodeRegExp)!==null&&ze!==void 0?ze:!0,int32range:(y=t.int32range)!==null&&y!==void 0?y:!0,uriResolver:G}}var ta=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Y1(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new J1.ValueScope({scope:{},prefixes:K1,es5:r,lines:n}),this.logger=oj(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,B1.getRules)(),Gb.call(this,H1,e,"NOT SUPPORTED"),Gb.call(this,X1,e,"DEPRECATED","warn"),this._metaOpts=rj.call(this),e.formats&&ej.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&tj.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Q1.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Jb;n==="id"&&(o={...Jb},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Hb.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ea.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=Kb.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Qi.SchemaEnv({schema:{},schemaId:n});if(r=Qi.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}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 r=Kb.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,ea.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(aj.call(this,n,r),!r)return(0,wm.eachItem)(n,i=>Sm.call(this,i)),this;cj.call(this,r);let o={...r,type:(0,zc.getJSONTypes)(r.type),schemaType:(0,zc.getJSONTypes)(r.schemaType)};return(0,wm.eachItem)(n,o.type.length===0?i=>Sm.call(this,i,o):i=>o.type.forEach(a=>Sm.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Yb(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,ea.normalizeId)(a||n);let u=ea.getSchemaRefs.call(this,e,n);return c=new Qi.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Qi.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Qi.compileSchema.call(this,e)}finally{this.opts=r}}};ta.ValidationError=V1.default;ta.MissingRefError=Hb.default;Le.default=ta;function Gb(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function Kb(t){return t=(0,ea.normalizeId)(t),this.schemas[t]||this.refs[t]}function Q1(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function ej(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function tj(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function rj(){let t={...this.opts};for(let e of G1)delete t[e];return t}var nj={log(){},warn(){},error(){}};function oj(t){if(t===!1)return nj;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var ij=/^[a-z_$][a-z0-9_$:-]*$/i;function aj(t,e){let{RULES:r}=this;if((0,wm.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!ij.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Sm(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,zc.getJSONTypes)(e.type),schemaType:(0,zc.getJSONTypes)(e.schemaType)}};e.before?sj.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function sj(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function cj(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Yb(e)),t.validateSchema=this.compile(e,!0))}var uj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Yb(t){return{anyOf:[t,uj]}}});var ex=x(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var lj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};zm.default=lj});var ox=x(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.callRef=sn.getValidate=void 0;var dj=Xi(),tx=wt(),st=Q(),oo=fr(),rx=bc(),Ic=se(),fj={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=rx.resolveRef.call(c,u,o,r);if(l===void 0)throw new dj.default(n.opts.uriResolver,o,r);if(l instanceof rx.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return Tc(t,a,i,i.$async);let v=e.scopeValue("root",{ref:u});return Tc(t,(0,st._)`${v}.validate`,u,u.$async)}function p(v){let h=nx(t,v);Tc(t,h,v,v.$async)}function f(v){let h=e.scopeValue("schema",s.code.source===!0?{ref:v,code:(0,st.stringify)(v)}:{ref:v}),$=e.name("valid"),w=t.subschema({schema:v,dataTypes:[],schemaPath:st.nil,topSchemaRef:h,errSchemaPath:r},$);t.mergeEvaluated(w),t.ok($)}}};function nx(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,st._)`${r.scopeValue("wrapper",{ref:e})}.validate`}sn.getValidate=nx;function Tc(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?oo.default.this:st.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let v=o.let("valid");o.try(()=>{o.code((0,st._)`await ${(0,tx.callValidateCode)(t,e,u)}`),f(e),a||o.assign(v,!0)},h=>{o.if((0,st._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),p(h),a||o.assign(v,!1)}),t.ok(v)}function d(){t.result((0,tx.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(v){let h=(0,st._)`${v}.errors`;o.assign(oo.default.vErrors,(0,st._)`${oo.default.vErrors} === null ? ${h} : ${oo.default.vErrors}.concat(${h})`),o.assign(oo.default.errors,(0,st._)`${oo.default.vErrors}.length`)}function f(v){var h;if(!i.opts.unevaluated)return;let $=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ic.mergeEvaluated.props(o,$.props,i.props));else{let w=o.var("props",(0,st._)`${v}.evaluated.props`);i.props=Ic.mergeEvaluated.props(o,w,i.props,st.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ic.mergeEvaluated.items(o,$.items,i.items));else{let w=o.var("items",(0,st._)`${v}.evaluated.items`);i.items=Ic.mergeEvaluated.items(o,w,i.items,st.Name)}}}sn.callRef=Tc;sn.default=fj});var ix=x(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});var pj=ex(),mj=ox(),hj=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",pj.default,mj.default];Im.default=hj});var ax=x(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});var Pc=Q(),Rr=Pc.operators,Ec={maximum:{okStr:"<=",ok:Rr.LTE,fail:Rr.GT},minimum:{okStr:">=",ok:Rr.GTE,fail:Rr.LT},exclusiveMaximum:{okStr:"<",ok:Rr.LT,fail:Rr.GTE},exclusiveMinimum:{okStr:">",ok:Rr.GT,fail:Rr.LTE}},gj={message:({keyword:t,schemaCode:e})=>(0,Pc.str)`must be ${Ec[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Pc._)`{comparison: ${Ec[t].okStr}, limit: ${e}}`},vj={keyword:Object.keys(Ec),type:"number",schemaType:"number",$data:!0,error:gj,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Pc._)`${r} ${Ec[e].fail} ${n} || isNaN(${r})`)}};Tm.default=vj});var sx=x(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var ra=Q(),_j={message:({schemaCode:t})=>(0,ra.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ra._)`{multipleOf: ${t}}`},yj={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:_j,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,ra._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ra._)`${a} !== parseInt(${a})`;t.fail$data((0,ra._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Pm.default=yj});var ux=x(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});function cx(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Em.default=cx;cx.code='require("ajv/dist/runtime/ucs2length").default'});var lx=x(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});var cn=Q(),$j=se(),bj=ux(),xj={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,cn.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,cn._)`{limit: ${t}}`},kj={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xj,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?cn.operators.GT:cn.operators.LT,a=o.opts.unicode===!1?(0,cn._)`${r}.length`:(0,cn._)`${(0,$j.useFunc)(t.gen,bj.default)}(${r})`;t.fail$data((0,cn._)`${a} ${i} ${n}`)}};Om.default=kj});var dx=x(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var Sj=wt(),wj=se(),io=Q(),zj={message:({schemaCode:t})=>(0,io.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,io._)`{pattern: ${t}}`},Ij={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zj,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,io._)`new RegExp`:(0,wj.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,io._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,io._)`!${l}`)}else{let c=(0,Sj.usePattern)(t,o);t.fail$data((0,io._)`!${c}.test(${r})`)}}};jm.default=Ij});var fx=x(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var na=Q(),Tj={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,na.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,na._)`{limit: ${t}}`},Pj={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Tj,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?na.operators.GT:na.operators.LT;t.fail$data((0,na._)`Object.keys(${r}).length ${o} ${n}`)}};Nm.default=Pj});var px=x(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});var oa=wt(),ia=Q(),Ej=se(),Oj={message:({params:{missingProperty:t}})=>(0,ia.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ia._)`{missingProperty: ${t}}`},jj={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Oj,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=t.parentSchema.properties,{definedProperties:v}=t.it;for(let h of r)if(f?.[h]===void 0&&!v.has(h)){let $=a.schemaEnv.baseId+a.errSchemaPath,w=`required property "${h}" is not defined at "${$}" (strictRequired)`;(0,Ej.checkStrictMode)(a,w,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(ia.nil,d);else for(let f of r)(0,oa.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||i){let v=e.let("valid",!0);t.block$data(v,()=>p(f,v)),t.ok(v)}else e.if((0,oa.checkMissingProp)(t,r,f)),(0,oa.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,oa.noPropertyInData)(e,o,f,s.ownProperties),()=>t.error())})}function p(f,v){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(v,(0,oa.propertyInData)(e,o,f,s.ownProperties)),e.if((0,ia.not)(v),()=>{t.error(),e.break()})},ia.nil)}}};Rm.default=jj});var mx=x(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});var aa=Q(),Nj={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,aa.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,aa._)`{limit: ${t}}`},Rj={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Nj,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?aa.operators.GT:aa.operators.LT;t.fail$data((0,aa._)`${r}.length ${o} ${n}`)}};Cm.default=Rj});var Oc=x(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var hx=am();hx.code='require("ajv/dist/runtime/equal").default';Dm.default=hx});var gx=x(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});var Am=Ji(),qe=Q(),Cj=se(),Dj=Oc(),Aj={message:({params:{i:t,j:e}})=>(0,qe.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,qe._)`{i: ${t}, j: ${e}}`},Uj={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Aj,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Am.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,qe._)`${a} === false`),t.ok(c);function l(){let v=e.let("i",(0,qe._)`${r}.length`),h=e.let("j");t.setParams({i:v,j:h}),e.assign(c,!0),e.if((0,qe._)`${v} > 1`,()=>(d()?p:f)(v,h))}function d(){return u.length>0&&!u.some(v=>v==="object"||v==="array")}function p(v,h){let $=e.name("item"),w=(0,Am.checkDataTypes)(u,$,s.opts.strictNumbers,Am.DataType.Wrong),P=e.const("indices",(0,qe._)`{}`);e.for((0,qe._)`;${v}--;`,()=>{e.let($,(0,qe._)`${r}[${v}]`),e.if(w,(0,qe._)`continue`),u.length>1&&e.if((0,qe._)`typeof ${$} == "string"`,(0,qe._)`${$} += "_"`),e.if((0,qe._)`typeof ${P}[${$}] == "number"`,()=>{e.assign(h,(0,qe._)`${P}[${$}]`),t.error(),e.assign(c,!1).break()}).code((0,qe._)`${P}[${$}] = ${v}`)})}function f(v,h){let $=(0,Cj.useFunc)(e,Dj.default),w=e.name("outer");e.label(w).for((0,qe._)`;${v}--;`,()=>e.for((0,qe._)`${h} = ${v}; ${h}--;`,()=>e.if((0,qe._)`${$}(${r}[${v}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(w)})))}}};Um.default=Uj});var vx=x(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});var Zm=Q(),Zj=se(),Mj=Oc(),Lj={message:"must be equal to constant",params:({schemaCode:t})=>(0,Zm._)`{allowedValue: ${t}}`},qj={keyword:"const",$data:!0,error:Lj,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,Zm._)`!${(0,Zj.useFunc)(e,Mj.default)}(${r}, ${o})`):t.fail((0,Zm._)`${i} !== ${r}`)}};Mm.default=qj});var _x=x(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});var sa=Q(),Fj=se(),Vj=Oc(),Bj={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,sa._)`{allowedValues: ${t}}`},Jj={keyword:"enum",schemaType:"array",$data:!0,error:Bj,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,Fj.useFunc)(e,Vj.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",i);l=(0,sa.or)(...o.map((v,h)=>p(f,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,f=>e.if((0,sa._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,v){let h=o[v];return typeof h=="object"&&h!==null?(0,sa._)`${u()}(${r}, ${f}[${v}])`:(0,sa._)`${r} === ${h}`}}};Lm.default=Jj});var yx=x(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});var Wj=ax(),Gj=sx(),Kj=lx(),Hj=dx(),Xj=fx(),Yj=px(),Qj=mx(),eN=gx(),tN=vx(),rN=_x(),nN=[Wj.default,Gj.default,Kj.default,Hj.default,Xj.default,Yj.default,Qj.default,eN.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tN.default,rN.default];qm.default=nN});var Vm=x(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.validateAdditionalItems=void 0;var un=Q(),Fm=se(),oN={message:({params:{len:t}})=>(0,un.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,un._)`{limit: ${t}}`},iN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:oN,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Fm.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}$x(t,n)}};function $x(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,un._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,un._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Fm.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,un._)`${s} <= ${e.length}`);r.if((0,un.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Fm.Type.Num},u),a.allErrors||r.if((0,un.not)(u),()=>r.break())})}}ca.validateAdditionalItems=$x;ca.default=iN});var Bm=x(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.validateTuple=void 0;var bx=Q(),jc=se(),aN=wt(),sN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return xx(t,"additionalItems",e);r.items=!0,!(0,jc.alwaysValidSchema)(r,e)&&t.ok((0,aN.validateArray)(t))}};function xx(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=jc.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,bx._)`${i}.length`);r.forEach((d,p)=>{(0,jc.alwaysValidSchema)(s,d)||(n.if((0,bx._)`${u} > ${p}`,()=>t.subschema({keyword:a,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,v=r.length,h=v===d.minItems&&(v===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let $=`"${a}" is ${v}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,jc.checkStrictMode)(s,$,p.strictTuples)}}}ua.validateTuple=xx;ua.default=sN});var kx=x(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});var cN=Bm(),uN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,cN.validateTuple)(t,"items")};Jm.default=uN});var wx=x(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var Sx=Q(),lN=se(),dN=wt(),fN=Vm(),pN={message:({params:{len:t}})=>(0,Sx.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Sx._)`{limit: ${t}}`},mN={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:pN,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,lN.alwaysValidSchema)(n,e)&&(o?(0,fN.validateAdditionalItems)(t,o):t.ok((0,dN.validateArray)(t)))}};Wm.default=mN});var zx=x(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});var It=Q(),Nc=se(),hN={message:({params:{min:t,max:e}})=>e===void 0?(0,It.str)`must contain at least ${t} valid item(s)`:(0,It.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,It._)`{minContains: ${t}}`:(0,It._)`{minContains: ${t}, maxContains: ${e}}`},gN={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hN,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,It._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Nc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Nc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Nc.alwaysValidSchema)(i,r)){let h=(0,It._)`${l} >= ${a}`;s!==void 0&&(h=(0,It._)`${h} && ${l} <= ${s}`),t.pass(h);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?f(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,It._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),$=e.let("count",0);f(h,()=>e.if(h,()=>v($)))}function f(h,$){e.forRange("i",0,l,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:Nc.Type.Num,compositeRule:!0},h),$()})}function v(h){e.code((0,It._)`${h}++`),s===void 0?e.if((0,It._)`${h} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,It._)`${h} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,It._)`${h} >= ${a}`,()=>e.assign(d,!0)))}}};Gm.default=gN});var Px=x(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.validateSchemaDeps=Wt.validatePropertyDeps=Wt.error=void 0;var Km=Q(),vN=se(),la=wt();Wt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Km.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Km._)`{property: ${t},
13
13
  missingProperty: ${n},
14
14
  depsCount: ${e},
15
- deps: ${r}}`};var vN={keyword:"dependencies",type:"object",schemaType:"object",error:Vt.error,code(t){let[e,r]=_N(t);wx(t,e),zx(t,r)}};function _N({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function wx(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,aa.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,aa.checkReportMissingProp)(t,u)}):(r.if((0,Jm._)`${c} && (${(0,aa.checkMissingProp)(t,s,i)})`),(0,aa.reportMissingProp)(t,i),r.else())}}Vt.validatePropertyDeps=wx;function zx(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,gN.alwaysValidSchema)(i,e[s])||(r.if((0,aa.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}Vt.validateSchemaDeps=zx;Vt.default=vN});var Px=x(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var Tx=Q(),yN=ae(),$N={message:"property name must be valid",params:({params:t})=>(0,Tx._)`{propertyName: ${t.propertyName}}`},bN={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:$N,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,yN.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,Tx.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Wm.default=bN});var Km=x(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});var Ec=kt(),Ct=Q(),xN=lr(),Oc=ae(),kN={message:"must NOT have additional properties",params:({params:t})=>(0,Ct._)`{additionalProperty: ${t.additionalProperty}}`},SN={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:kN,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,Oc.alwaysValidSchema)(a,r))return;let u=(0,Ec.allSchemaProperties)(n.properties),l=(0,Ec.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ct._)`${i} === ${xN.default.errors}`);function d(){e.forIn("key",o,y=>{!u.length&&!l.length?g(y):e.if(f(y),()=>g(y))})}function f(y){let w;if(u.length>8){let P=(0,Oc.schemaRefOrVal)(a,n.properties,"properties");w=(0,Ec.isOwnProperty)(e,P,y)}else u.length?w=(0,Ct.or)(...u.map(P=>(0,Ct._)`${y} === ${P}`)):w=Ct.nil;return l.length&&(w=(0,Ct.or)(w,...l.map(P=>(0,Ct._)`${(0,Ec.usePattern)(t,P)}.test(${y})`))),(0,Ct.not)(w)}function p(y){e.code((0,Ct._)`delete ${o}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,Oc.alwaysValidSchema)(a,r)){let w=e.name("valid");c.removeAdditional==="failing"?(h(y,w,!1),e.if((0,Ct.not)(w),()=>{t.reset(),p(y)})):(h(y,w),s||e.if((0,Ct.not)(w),()=>e.break()))}}function h(y,w,P){let j={keyword:"additionalProperties",dataProp:y,dataPropType:Oc.Type.Str};P===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(j,w)}}};Gm.default=SN});var jx=x(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var wN=Ji(),Ex=kt(),Hm=ae(),Ox=Km(),zN={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Ox.default.code(new wN.KeywordCxt(i,Ox.default,"additionalProperties"));let a=(0,Ex.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Hm.mergeEvaluated.props(e,(0,Hm.toHash)(a),i.props));let s=a.filter(d=>!(0,Hm.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,Ex.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Xm.default=zN});var Dx=x(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var Nx=kt(),jc=Q(),Rx=ae(),Cx=ae(),IN={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,Nx.allSchemaProperties)(r),c=s.filter(h=>(0,Rx.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof jc.Name)&&(i.props=(0,Cx.evaluatedPropsToName)(e,i.props));let{props:d}=i;f();function f(){for(let h of s)u&&p(h),i.allErrors?g(h):(e.var(l,!0),g(h),e.if(l))}function p(h){for(let y in u)new RegExp(h).test(y)&&(0,Rx.checkStrictMode)(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){e.forIn("key",n,y=>{e.if((0,jc._)`${(0,Nx.usePattern)(t,h)}.test(${y})`,()=>{let w=c.includes(h);w||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Cx.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,jc._)`${d}[${y}]`,!0):!w&&!i.allErrors&&e.if((0,jc.not)(l),()=>e.break())})})}}};Ym.default=IN});var Ax=x(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var TN=ae(),PN={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,TN.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Qm.default=PN});var Ux=x(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var EN=kt(),ON={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:EN.validateUnion,error:{message:"must match a schema in anyOf"}};eh.default=ON});var Zx=x(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var Nc=Q(),jN=ae(),NN={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Nc._)`{passingSchemas: ${t.passing}}`},RN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:NN,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let f;(0,jN.alwaysValidSchema)(o,l)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Nc._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Nc._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),f&&t.mergeEvaluated(f,Nc.Name)})})}}};th.default=RN});var Mx=x(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});var CN=ae(),DN={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,CN.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};rh.default=DN});var Fx=x(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});var Rc=Q(),qx=ae(),AN={message:({params:t})=>(0,Rc.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Rc._)`{failingKeyword: ${t.ifClause}}`},UN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:AN,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,qx.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Lx(n,"then"),i=Lx(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,Rc.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let f=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(f,a),d?e.assign(d,(0,Rc._)`${l}`):t.setParams({ifClause:l})}}}};function Lx(t,e){let r=t.schema[e];return r!==void 0&&!(0,qx.alwaysValidSchema)(t,r)}nh.default=UN});var Vx=x(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var ZN=ae(),MN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,ZN.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};oh.default=MN});var Bx=x(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var LN=Lm(),qN=bx(),FN=qm(),VN=kx(),BN=Sx(),JN=Ix(),WN=Px(),GN=Km(),KN=jx(),HN=Dx(),XN=Ax(),YN=Ux(),QN=Zx(),e4=Mx(),t4=Fx(),r4=Vx();function n4(t=!1){let e=[XN.default,YN.default,QN.default,e4.default,t4.default,r4.default,WN.default,GN.default,JN.default,KN.default,HN.default];return t?e.push(qN.default,VN.default):e.push(LN.default,FN.default),e.push(BN.default),e}ih.default=n4});var Jx=x(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Pe=Q(),o4={message:({schemaCode:t})=>(0,Pe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Pe._)`{format: ${t}}`},i4={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:o4,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?f():p();function f(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Pe._)`${g}[${a}]`),y=r.let("fType"),w=r.let("format");r.if((0,Pe._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Pe._)`${h}.type || "string"`).assign(w,(0,Pe._)`${h}.validate`),()=>r.assign(y,(0,Pe._)`"string"`).assign(w,h)),t.fail$data((0,Pe.or)(P(),j()));function P(){return c.strictSchema===!1?Pe.nil:(0,Pe._)`${a} && !${w}`}function j(){let z=l.$async?(0,Pe._)`(${h}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,Pe._)`${w}(${n})`,N=(0,Pe._)`(typeof ${w} == "function" ? ${z} : ${w}.test(${n}))`;return(0,Pe._)`${w} && ${w} !== true && ${y} === ${e} && !${N}`}}function p(){let g=d.formats[i];if(!g){P();return}if(g===!0)return;let[h,y,w]=j(g);h===e&&t.pass(z());function P(){if(c.strictSchema===!1){d.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function j(N){let Ce=N instanceof RegExp?(0,Pe.regexpCode)(N):c.code.formats?(0,Pe._)`${c.code.formats}${(0,Pe.getProperty)(i)}`:void 0,ce=r.scopeValue("formats",{key:i,ref:N,code:Ce});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,Pe._)`${ce}.validate`]:["string",N,ce]}function z(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Pe._)`await ${w}(${n})`}return typeof y=="function"?(0,Pe._)`${w}(${n})`:(0,Pe._)`${w}.test(${n})`}}}};ah.default=i4});var Wx=x(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var a4=Jx(),s4=[a4.default];sh.default=s4});var Gx=x(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.contentVocabulary=no.metadataVocabulary=void 0;no.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];no.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Hx=x(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var c4=nx(),u4=vx(),l4=Bx(),d4=Wx(),Kx=Gx(),f4=[c4.default,u4.default,(0,l4.default)(),d4.default,Kx.metadataVocabulary,Kx.contentVocabulary];ch.default=f4});var Yx=x(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.DiscrError=void 0;var Xx;(function(t){t.Tag="tag",t.Mapping="mapping"})(Xx||(Cc.DiscrError=Xx={}))});var ek=x(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var oo=Q(),uh=Yx(),Qx=vc(),p4=Wi(),m4=ae(),h4={message:({params:{discrError:t,tagName:e}})=>t===uh.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,oo._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},g4={keyword:"discriminator",type:"object",schemaType:"object",error:h4,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,oo._)`${r}${(0,oo.getProperty)(s)}`);e.if((0,oo._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:uh.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let p=f();e.if(!1);for(let g in p)e.elseIf((0,oo._)`${u} === ${g}`),e.assign(c,d(p[g]));e.else(),t.error(!1,{discrError:uh.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(p){let g=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},g);return t.mergeEvaluated(h,oo.Name),g}function f(){var p;let g={},h=w(o),y=!0;for(let z=0;z<a.length;z++){let N=a[z];if(N?.$ref&&!(0,m4.schemaHasRulesButRef)(N,i.self.RULES)){let ce=N.$ref;if(N=Qx.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,ce),N instanceof Qx.SchemaEnv&&(N=N.schema),N===void 0)throw new p4.default(i.opts.uriResolver,i.baseId,ce)}let Ce=(p=N?.properties)===null||p===void 0?void 0:p[s];if(typeof Ce!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(h||w(N)),P(Ce,z)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return g;function w({required:z}){return Array.isArray(z)&&z.includes(s)}function P(z,N){if(z.const)j(z.const,N);else if(z.enum)for(let Ce of z.enum)j(Ce,N);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function j(z,N){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[z]=N}}}};lh.default=g4});var tk=x((C9,v4)=>{v4.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 fh=x((ke,dh)=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.MissingRefError=ke.ValidationError=ke.CodeGen=ke.Name=ke.nil=ke.stringify=ke.str=ke._=ke.KeywordCxt=ke.Ajv=void 0;var _4=Xb(),y4=Hx(),$4=ek(),rk=tk(),b4=["/properties"],Dc="http://json-schema.org/draft-07/schema",io=class extends _4.default{_addVocabularies(){super._addVocabularies(),y4.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword($4.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(rk,b4):rk;this.addMetaSchema(e,Dc,!1),this.refs["http://json-schema.org/schema"]=Dc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Dc)?Dc:void 0)}};ke.Ajv=io;dh.exports=ke=io;dh.exports.Ajv=io;Object.defineProperty(ke,"__esModule",{value:!0});ke.default=io;var x4=Ji();Object.defineProperty(ke,"KeywordCxt",{enumerable:!0,get:function(){return x4.KeywordCxt}});var ao=Q();Object.defineProperty(ke,"_",{enumerable:!0,get:function(){return ao._}});Object.defineProperty(ke,"str",{enumerable:!0,get:function(){return ao.str}});Object.defineProperty(ke,"stringify",{enumerable:!0,get:function(){return ao.stringify}});Object.defineProperty(ke,"nil",{enumerable:!0,get:function(){return ao.nil}});Object.defineProperty(ke,"Name",{enumerable:!0,get:function(){return ao.Name}});Object.defineProperty(ke,"CodeGen",{enumerable:!0,get:function(){return ao.CodeGen}});var k4=hc();Object.defineProperty(ke,"ValidationError",{enumerable:!0,get:function(){return k4.default}});var S4=Wi();Object.defineProperty(ke,"MissingRefError",{enumerable:!0,get:function(){return S4.default}})});var lk=x(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.formatNames=Jt.fastFormats=Jt.fullFormats=void 0;function Bt(t,e){return{validate:t,compare:e}}Jt.fullFormats={date:Bt(ak,gh),time:Bt(mh(!0),vh),"date-time":Bt(nk(!0),ck),"iso-time":Bt(mh(),sk),"iso-date-time":Bt(nk(),uk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:E4,"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:A4,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:O4,int32:{type:"number",validate:R4},int64:{type:"number",validate:C4},float:{type:"number",validate:ik},double:{type:"number",validate:ik},password:!0,binary:!0};Jt.fastFormats={...Jt.fullFormats,date:Bt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,gh),time:Bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vh),"date-time":Bt(/^\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,ck),"iso-time":Bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sk),"iso-date-time":Bt(/^\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,uk),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};Jt.formatNames=Object.keys(Jt.fullFormats);function w4(t){return t%4===0&&(t%100!==0||t%400===0)}var z4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,I4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ak(t){let e=z4.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&w4(r)?29:I4[n])}function gh(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ph=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function mh(t){return function(r){let n=ph.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function vh(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function sk(t,e){if(!(t&&e))return;let r=ph.exec(t),n=ph.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var hh=/t|\s/i;function nk(t){let e=mh(t);return function(n){let o=n.split(hh);return o.length===2&&ak(o[0])&&e(o[1])}}function ck(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function uk(t,e){if(!(t&&e))return;let[r,n]=t.split(hh),[o,i]=e.split(hh),a=gh(r,o);if(a!==void 0)return a||vh(n,i)}var T4=/\/|:/,P4=/^(?:[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 E4(t){return T4.test(t)&&P4.test(t)}var ok=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function O4(t){return ok.lastIndex=0,ok.test(t)}var j4=-(2**31),N4=2**31-1;function R4(t){return Number.isInteger(t)&&t<=N4&&t>=j4}function C4(t){return Number.isInteger(t)}function ik(){return!0}var D4=/[^\\]\\Z/;function A4(t){if(D4.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var dk=x(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.formatLimitDefinition=void 0;var U4=fh(),Dt=Q(),Nr=Dt.operators,Ac={formatMaximum:{okStr:"<=",ok:Nr.LTE,fail:Nr.GT},formatMinimum:{okStr:">=",ok:Nr.GTE,fail:Nr.LT},formatExclusiveMaximum:{okStr:"<",ok:Nr.LT,fail:Nr.GTE},formatExclusiveMinimum:{okStr:">",ok:Nr.GT,fail:Nr.LTE}},Z4={message:({keyword:t,schemaCode:e})=>(0,Dt.str)`should be ${Ac[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Dt._)`{comparison: ${Ac[t].okStr}, limit: ${e}}`};so.formatLimitDefinition={keyword:Object.keys(Ac),type:"string",schemaType:"string",$data:!0,error:Z4,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new U4.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=e.const("fmt",(0,Dt._)`${f}[${c.schemaCode}]`);t.fail$data((0,Dt.or)((0,Dt._)`typeof ${p} != "object"`,(0,Dt._)`${p} instanceof RegExp`,(0,Dt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let g=e.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,Dt._)`${a.code.formats}${(0,Dt.getProperty)(f)}`:void 0});t.fail$data(d(g))}function d(f){return(0,Dt._)`${f}.compare(${r}, ${n}) ${Ac[o].fail} 0`}},dependencies:["format"]};var M4=t=>(t.addKeyword(so.formatLimitDefinition),t);so.default=M4});var hk=x((sa,mk)=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var co=lk(),L4=dk(),_h=Q(),fk=new _h.Name("fullFormats"),q4=new _h.Name("fastFormats"),yh=(t,e={keywords:!0})=>{if(Array.isArray(e))return pk(t,e,co.fullFormats,fk),t;let[r,n]=e.mode==="fast"?[co.fastFormats,q4]:[co.fullFormats,fk],o=e.formats||co.formatNames;return pk(t,o,r,n),e.keywords&&(0,L4.default)(t),t};yh.get=(t,e="full")=>{let n=(e==="fast"?co.fastFormats:co.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function pk(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,_h._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}mk.exports=sa=yh;Object.defineProperty(sa,"__esModule",{value:!0});sa.default=yh});var Sk=x((K9,kk)=>{kk.exports=xk;xk.sync=J4;var $k=require("fs");function B4(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&t.substr(-o.length).toLowerCase()===o)return!0}return!1}function bk(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:B4(e,r)}function xk(t,e,r){$k.stat(t,function(n,o){r(n,n?!1:bk(o,t,e))})}function J4(t,e){return bk($k.statSync(t),t,e)}});var Pk=x((H9,Tk)=>{Tk.exports=zk;zk.sync=W4;var wk=require("fs");function zk(t,e,r){wk.stat(t,function(n,o){r(n,n?!1:Ik(o,e))})}function W4(t,e){return Ik(wk.statSync(t),e)}function Ik(t,e){return t.isFile()&&G4(t,e)}function G4(t,e){var r=t.mode,n=t.uid,o=t.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),a=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),s=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=s|c,d=r&u||r&c&&o===a||r&s&&n===i||r&l&&i===0;return d}});var Ok=x((Y9,Ek)=>{var X9=require("fs"),qc;process.platform==="win32"||global.TESTING_WINDOWS?qc=Sk():qc=Pk();Ek.exports=$h;$h.sync=K4;function $h(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){$h(t,e||{},function(i,a){i?o(i):n(a)})})}qc(t,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function K4(t,e){try{return qc.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Uk=x((Q9,Ak)=>{var uo=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",jk=require("path"),H4=uo?";":":",Nk=Ok(),Rk=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Ck=(t,e)=>{let r=e.colon||H4,n=t.match(/\//)||uo&&t.match(/\\/)?[""]:[...uo?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=uo?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=uo?o.split(r):[""];return uo&&t.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Dk=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Ck(t,e),a=[],s=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&a.length?l(a):d(Rk(t));let f=n[u],p=/^".*"$/.test(f)?f.slice(1,-1):f,g=jk.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(h,u,0))}),c=(u,l,d)=>new Promise((f,p)=>{if(d===o.length)return f(s(l+1));let g=o[d];Nk(u+g,{pathExt:i},(h,y)=>{if(!h&&y)if(e.all)a.push(u+g);else return f(u+g);return f(c(u,l,d+1))})});return r?s(0).then(u=>r(null,u),r):s(0)},X4=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Ck(t,e),i=[];for(let a=0;a<r.length;a++){let s=r[a],c=/^".*"$/.test(s)?s.slice(1,-1):s,u=jk.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let f=l+n[d];try{if(Nk.sync(f,{pathExt:o}))if(e.all)i.push(f);else return f}catch{}}}if(e.all&&i.length)return i;if(e.nothrow)return null;throw Rk(t)};Ak.exports=Dk;Dk.sync=X4});var Mk=x((eF,bh)=>{"use strict";var Zk=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bh.exports=Zk;bh.exports.default=Zk});var Vk=x((tF,Fk)=>{"use strict";var Lk=require("path"),Y4=Uk(),Q4=Mk();function qk(t,e){let r=t.options.env||process.env,n=process.cwd(),o=t.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(t.options.cwd)}catch{}let a;try{a=Y4.sync(t.command,{path:r[Q4({env:r})],pathExt:e?Lk.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Lk.resolve(o?t.options.cwd:"",a)),a}function eR(t){return qk(t)||qk(t,!0)}Fk.exports=eR});var Bk=x((rF,kh)=>{"use strict";var xh=/([()\][%!^"`<>&|;, *?])/g;function tR(t){return t=t.replace(xh,"^$1"),t}function rR(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(xh,"^$1"),e&&(t=t.replace(xh,"^$1")),t}kh.exports.command=tR;kh.exports.argument=rR});var Wk=x((nF,Jk)=>{"use strict";Jk.exports=/^#!(.*)/});var Kk=x((oF,Gk)=>{"use strict";var nR=Wk();Gk.exports=(t="")=>{let e=t.match(nR);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Xk=x((iF,Hk)=>{"use strict";var Sh=require("fs"),oR=Kk();function iR(t){let r=Buffer.alloc(150),n;try{n=Sh.openSync(t,"r"),Sh.readSync(n,r,0,150,0),Sh.closeSync(n)}catch{}return oR(r.toString())}Hk.exports=iR});var tS=x((aF,eS)=>{"use strict";var aR=require("path"),Yk=Vk(),Qk=Bk(),sR=Xk(),cR=process.platform==="win32",uR=/\.(?:com|exe)$/i,lR=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function dR(t){t.file=Yk(t);let e=t.file&&sR(t.file);return e?(t.args.unshift(t.file),t.command=e,Yk(t)):t.file}function fR(t){if(!cR)return t;let e=dR(t),r=!uR.test(e);if(t.options.forceShell||r){let n=lR.test(e);t.command=aR.normalize(t.command),t.command=Qk.command(t.command),t.args=t.args.map(i=>Qk.argument(i,n));let o=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${o}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function pR(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:fR(n)}eS.exports=pR});var oS=x((sF,nS)=>{"use strict";var wh=process.platform==="win32";function zh(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function mR(t,e){if(!wh)return;let r=t.emit;t.emit=function(n,o){if(n==="exit"){let i=rS(o,e);if(i)return r.call(t,"error",i)}return r.apply(t,arguments)}}function rS(t,e){return wh&&t===1&&!e.file?zh(e.original,"spawn"):null}function hR(t,e){return wh&&t===1&&!e.file?zh(e.original,"spawnSync"):null}nS.exports={hookChildProcess:mR,verifyENOENT:rS,verifyENOENTSync:hR,notFoundError:zh}});var sS=x((cF,lo)=>{"use strict";var iS=require("child_process"),Ih=tS(),Th=oS();function aS(t,e,r){let n=Ih(t,e,r),o=iS.spawn(n.command,n.args,n.options);return Th.hookChildProcess(o,n),o}function gR(t,e,r){let n=Ih(t,e,r),o=iS.spawnSync(n.command,n.args,n.options);return o.error=o.error||Th.verifyENOENTSync(o.status,n),o}lo.exports=aS;lo.exports.spawn=aS;lo.exports.sync=gR;lo.exports._parse=Ih;lo.exports._enoent=Th});var Mw=de(Sg(),1),Lw=de(ya(),1),qw=de(ln(),1),Fw=de(iu(),1),Vw=de(cu(),1),Bw=de(mu(),1),Ng=de(ka(),1),Jw=de(jg(),1);var Rg=Ng.default;var Ph=de(require("readline")),Te=de(require("fs")),Wt=de(require("path"));var Cg=(t=0)=>e=>`\x1B[${e+t}m`,Dg=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Ag=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,we={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},VR=Object.keys(we.modifier),Ww=Object.keys(we.color),Gw=Object.keys(we.bgColor),BR=[...Ww,...Gw];function Kw(){let t=new Map;for(let[e,r]of Object.entries(we)){for(let[n,o]of Object.entries(r))we[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=we[n],t.set(o[0],o[1]);Object.defineProperty(we,e,{value:r,enumerable:!1})}return Object.defineProperty(we,"codes",{value:t,enumerable:!1}),we.color.close="\x1B[39m",we.bgColor.close="\x1B[49m",we.color.ansi=Cg(),we.color.ansi256=Dg(),we.color.ansi16m=Ag(),we.bgColor.ansi=Cg(10),we.bgColor.ansi256=Dg(10),we.bgColor.ansi16m=Ag(10),Object.defineProperties(we,{rgbToAnsi256:{value(e,r,n){return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>we.rgbToAnsi256(...we.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>we.ansi256ToAnsi(we.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>we.ansi256ToAnsi(we.hexToAnsi256(e)),enumerable:!1}}),we}var Hw=Kw(),It=Hw;var za=de(require("node:process"),1),Zg=de(require("node:os"),1),gu=de(require("node:tty"),1);function gt(t,e=globalThis.Deno?globalThis.Deno.args:za.default.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}var{env:ze}=za.default,wa;gt("no-color")||gt("no-colors")||gt("color=false")||gt("color=never")?wa=0:(gt("color")||gt("colors")||gt("color=true")||gt("color=always"))&&(wa=1);function Xw(){if("FORCE_COLOR"in ze)return ze.FORCE_COLOR==="true"?1:ze.FORCE_COLOR==="false"?0:ze.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ze.FORCE_COLOR,10),3)}function Yw(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Qw(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let n=Xw();n!==void 0&&(wa=n);let o=r?wa:n;if(o===0)return 0;if(r){if(gt("color=16m")||gt("color=full")||gt("color=truecolor"))return 3;if(gt("color=256"))return 2}if("TF_BUILD"in ze&&"AGENT_NAME"in ze)return 1;if(t&&!e&&o===void 0)return 0;let i=o||0;if(ze.TERM==="dumb")return i;if(za.default.platform==="win32"){let a=Zg.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in ze)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in ze)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in ze)||ze.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in ze)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ze.TEAMCITY_VERSION)?1:0;if(ze.COLORTERM==="truecolor"||ze.TERM==="xterm-kitty"||ze.TERM==="xterm-ghostty"||ze.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ze){let a=Number.parseInt((ze.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ze.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ze.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ze.TERM)||"COLORTERM"in ze?1:i}function Ug(t,e={}){let r=Qw(t,{streamIsTTY:t&&t.isTTY,...e});return Yw(r)}var e0={stdout:Ug({isTTY:gu.default.isatty(1)}),stderr:Ug({isTTY:gu.default.isatty(2)})},Mg=e0;function Lg(t,e,r){let n=t.indexOf(e);if(n===-1)return t;let o=e.length,i=0,a="";do a+=t.slice(i,n)+e+r,i=n+o,n=t.indexOf(e,i);while(n!==-1);return a+=t.slice(i),a}function qg(t,e,r,n){let o=0,i="";do{let a=t[n-1]==="\r";i+=t.slice(o,a?n-1:n)+e+(a?`\r
15
+ deps: ${r}}`};var _N={keyword:"dependencies",type:"object",schemaType:"object",error:Wt.error,code(t){let[e,r]=yN(t);Ix(t,e),Tx(t,r)}};function yN({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Ix(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,la.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,la.checkReportMissingProp)(t,u)}):(r.if((0,Km._)`${c} && (${(0,la.checkMissingProp)(t,s,i)})`),(0,la.reportMissingProp)(t,i),r.else())}}Wt.validatePropertyDeps=Ix;function Tx(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,vN.alwaysValidSchema)(i,e[s])||(r.if((0,la.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}Wt.validateSchemaDeps=Tx;Wt.default=_N});var Ox=x(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});var Ex=Q(),$N=se(),bN={message:"property name must be valid",params:({params:t})=>(0,Ex._)`{propertyName: ${t.propertyName}}`},xN={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:bN,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,$N.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,Ex.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Hm.default=xN});var Ym=x(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var Rc=wt(),At=Q(),kN=fr(),Cc=se(),SN={message:"must NOT have additional properties",params:({params:t})=>(0,At._)`{additionalProperty: ${t.additionalProperty}}`},wN={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:SN,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,Cc.alwaysValidSchema)(a,r))return;let u=(0,Rc.allSchemaProperties)(n.properties),l=(0,Rc.allSchemaProperties)(n.patternProperties);d(),t.ok((0,At._)`${i} === ${kN.default.errors}`);function d(){e.forIn("key",o,$=>{!u.length&&!l.length?v($):e.if(p($),()=>v($))})}function p($){let w;if(u.length>8){let P=(0,Cc.schemaRefOrVal)(a,n.properties,"properties");w=(0,Rc.isOwnProperty)(e,P,$)}else u.length?w=(0,At.or)(...u.map(P=>(0,At._)`${$} === ${P}`)):w=At.nil;return l.length&&(w=(0,At.or)(w,...l.map(P=>(0,At._)`${(0,Rc.usePattern)(t,P)}.test(${$})`))),(0,At.not)(w)}function f($){e.code((0,At._)`delete ${o}[${$}]`)}function v($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f($);return}if(r===!1){t.setParams({additionalProperty:$}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,Cc.alwaysValidSchema)(a,r)){let w=e.name("valid");c.removeAdditional==="failing"?(h($,w,!1),e.if((0,At.not)(w),()=>{t.reset(),f($)})):(h($,w),s||e.if((0,At.not)(w),()=>e.break()))}}function h($,w,P){let j={keyword:"additionalProperties",dataProp:$,dataPropType:Cc.Type.Str};P===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(j,w)}}};Xm.default=wN});var Rx=x(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var zN=Hi(),jx=wt(),Qm=se(),Nx=Ym(),IN={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Nx.default.code(new zN.KeywordCxt(i,Nx.default,"additionalProperties"));let a=(0,jx.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Qm.mergeEvaluated.props(e,(0,Qm.toHash)(a),i.props));let s=a.filter(d=>!(0,Qm.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,jx.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};eh.default=IN});var Ux=x(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var Cx=wt(),Dc=Q(),Dx=se(),Ax=se(),TN={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,Cx.allSchemaProperties)(r),c=s.filter(h=>(0,Dx.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Dc.Name)&&(i.props=(0,Ax.evaluatedPropsToName)(e,i.props));let{props:d}=i;p();function p(){for(let h of s)u&&f(h),i.allErrors?v(h):(e.var(l,!0),v(h),e.if(l))}function f(h){for(let $ in u)new RegExp(h).test($)&&(0,Dx.checkStrictMode)(i,`property ${$} matches pattern ${h} (use allowMatchingProperties)`)}function v(h){e.forIn("key",n,$=>{e.if((0,Dc._)`${(0,Cx.usePattern)(t,h)}.test(${$})`,()=>{let w=c.includes(h);w||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:$,dataPropType:Ax.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Dc._)`${d}[${$}]`,!0):!w&&!i.allErrors&&e.if((0,Dc.not)(l),()=>e.break())})})}}};th.default=TN});var Zx=x(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});var PN=se(),EN={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,PN.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};rh.default=EN});var Mx=x(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});var ON=wt(),jN={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ON.validateUnion,error:{message:"must match a schema in anyOf"}};nh.default=jN});var Lx=x(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var Ac=Q(),NN=se(),RN={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ac._)`{passingSchemas: ${t.passing}}`},CN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RN,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let p;(0,NN.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Ac._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Ac._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),p&&t.mergeEvaluated(p,Ac.Name)})})}}};oh.default=CN});var qx=x(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var DN=se(),AN={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,DN.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};ih.default=AN});var Bx=x(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Uc=Q(),Vx=se(),UN={message:({params:t})=>(0,Uc.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Uc._)`{failingKeyword: ${t.ifClause}}`},ZN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:UN,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Vx.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Fx(n,"then"),i=Fx(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,Uc.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(p,a),d?e.assign(d,(0,Uc._)`${l}`):t.setParams({ifClause:l})}}}};function Fx(t,e){let r=t.schema[e];return r!==void 0&&!(0,Vx.alwaysValidSchema)(t,r)}ah.default=ZN});var Jx=x(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var MN=se(),LN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,MN.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};sh.default=LN});var Wx=x(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var qN=Vm(),FN=kx(),VN=Bm(),BN=wx(),JN=zx(),WN=Px(),GN=Ox(),KN=Ym(),HN=Rx(),XN=Ux(),YN=Zx(),QN=Mx(),e4=Lx(),t4=qx(),r4=Bx(),n4=Jx();function o4(t=!1){let e=[YN.default,QN.default,e4.default,t4.default,r4.default,n4.default,GN.default,KN.default,WN.default,HN.default,XN.default];return t?e.push(FN.default,BN.default):e.push(qN.default,VN.default),e.push(JN.default),e}ch.default=o4});var Gx=x(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});var Oe=Q(),i4={message:({schemaCode:t})=>(0,Oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Oe._)`{format: ${t}}`},a4={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:i4,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let v=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Oe._)`${v}[${a}]`),$=r.let("fType"),w=r.let("format");r.if((0,Oe._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign($,(0,Oe._)`${h}.type || "string"`).assign(w,(0,Oe._)`${h}.validate`),()=>r.assign($,(0,Oe._)`"string"`).assign(w,h)),t.fail$data((0,Oe.or)(P(),j()));function P(){return c.strictSchema===!1?Oe.nil:(0,Oe._)`${a} && !${w}`}function j(){let U=l.$async?(0,Oe._)`(${h}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,Oe._)`${w}(${n})`,z=(0,Oe._)`(typeof ${w} == "function" ? ${U} : ${w}.test(${n}))`;return(0,Oe._)`${w} && ${w} !== true && ${$} === ${e} && !${z}`}}function f(){let v=d.formats[i];if(!v){P();return}if(v===!0)return;let[h,$,w]=j(v);h===e&&t.pass(U());function P(){if(c.strictSchema===!1){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function j(z){let Ae=z instanceof RegExp?(0,Oe.regexpCode)(z):c.code.formats?(0,Oe._)`${c.code.formats}${(0,Oe.getProperty)(i)}`:void 0,Ne=r.scopeValue("formats",{key:i,ref:z,code:Ae});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,Oe._)`${Ne}.validate`]:["string",z,Ne]}function U(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Oe._)`await ${w}(${n})`}return typeof $=="function"?(0,Oe._)`${w}(${n})`:(0,Oe._)`${w}.test(${n})`}}}};uh.default=a4});var Kx=x(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var s4=Gx(),c4=[s4.default];lh.default=c4});var Hx=x(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.contentVocabulary=ao.metadataVocabulary=void 0;ao.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ao.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Yx=x(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var u4=ix(),l4=yx(),d4=Wx(),f4=Kx(),Xx=Hx(),p4=[u4.default,l4.default,(0,d4.default)(),f4.default,Xx.metadataVocabulary,Xx.contentVocabulary];dh.default=p4});var ek=x(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.DiscrError=void 0;var Qx;(function(t){t.Tag="tag",t.Mapping="mapping"})(Qx||(Zc.DiscrError=Qx={}))});var rk=x(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var so=Q(),fh=ek(),tk=bc(),m4=Xi(),h4=se(),g4={message:({params:{discrError:t,tagName:e}})=>t===fh.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,so._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},v4={keyword:"discriminator",type:"object",schemaType:"object",error:g4,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,so._)`${r}${(0,so.getProperty)(s)}`);e.if((0,so._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:fh.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let f=p();e.if(!1);for(let v in f)e.elseIf((0,so._)`${u} === ${v}`),e.assign(c,d(f[v]));e.else(),t.error(!1,{discrError:fh.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(f){let v=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},v);return t.mergeEvaluated(h,so.Name),v}function p(){var f;let v={},h=w(o),$=!0;for(let U=0;U<a.length;U++){let z=a[U];if(z?.$ref&&!(0,h4.schemaHasRulesButRef)(z,i.self.RULES)){let Ne=z.$ref;if(z=tk.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ne),z instanceof tk.SchemaEnv&&(z=z.schema),z===void 0)throw new m4.default(i.opts.uriResolver,i.baseId,Ne)}let Ae=(f=z?.properties)===null||f===void 0?void 0:f[s];if(typeof Ae!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(h||w(z)),P(Ae,U)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return v;function w({required:U}){return Array.isArray(U)&&U.includes(s)}function P(U,z){if(U.const)j(U.const,z);else if(U.enum)for(let Ae of U.enum)j(Ae,z);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function j(U,z){if(typeof U!="string"||U in v)throw new Error(`discriminator: "${s}" values must be unique strings`);v[U]=z}}}};ph.default=v4});var nk=x((A9,_4)=>{_4.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 hh=x((we,mh)=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.MissingRefError=we.ValidationError=we.CodeGen=we.Name=we.nil=we.stringify=we.str=we._=we.KeywordCxt=we.Ajv=void 0;var y4=Qb(),$4=Yx(),b4=rk(),ok=nk(),x4=["/properties"],Mc="http://json-schema.org/draft-07/schema",co=class extends y4.default{_addVocabularies(){super._addVocabularies(),$4.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(b4.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(ok,x4):ok;this.addMetaSchema(e,Mc,!1),this.refs["http://json-schema.org/schema"]=Mc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Mc)?Mc:void 0)}};we.Ajv=co;mh.exports=we=co;mh.exports.Ajv=co;Object.defineProperty(we,"__esModule",{value:!0});we.default=co;var k4=Hi();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return k4.KeywordCxt}});var uo=Q();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return uo._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return uo.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return uo.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return uo.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return uo.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return uo.CodeGen}});var S4=yc();Object.defineProperty(we,"ValidationError",{enumerable:!0,get:function(){return S4.default}});var w4=Xi();Object.defineProperty(we,"MissingRefError",{enumerable:!0,get:function(){return w4.default}})});var fk=x(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.formatNames=Kt.fastFormats=Kt.fullFormats=void 0;function Gt(t,e){return{validate:t,compare:e}}Kt.fullFormats={date:Gt(ck,yh),time:Gt(vh(!0),$h),"date-time":Gt(ik(!0),lk),"iso-time":Gt(vh(),uk),"iso-date-time":Gt(ik(),dk),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:O4,"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:U4,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:j4,int32:{type:"number",validate:C4},int64:{type:"number",validate:D4},float:{type:"number",validate:sk},double:{type:"number",validate:sk},password:!0,binary:!0};Kt.fastFormats={...Kt.fullFormats,date:Gt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,yh),time:Gt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,$h),"date-time":Gt(/^\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,lk),"iso-time":Gt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,uk),"iso-date-time":Gt(/^\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,dk),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};Kt.formatNames=Object.keys(Kt.fullFormats);function z4(t){return t%4===0&&(t%100!==0||t%400===0)}var I4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,T4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ck(t){let e=I4.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&z4(r)?29:T4[n])}function yh(t,e){if(t&&e)return t>e?1:t<e?-1:0}var gh=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function vh(t){return function(r){let n=gh.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function $h(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function uk(t,e){if(!(t&&e))return;let r=gh.exec(t),n=gh.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var _h=/t|\s/i;function ik(t){let e=vh(t);return function(n){let o=n.split(_h);return o.length===2&&ck(o[0])&&e(o[1])}}function lk(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function dk(t,e){if(!(t&&e))return;let[r,n]=t.split(_h),[o,i]=e.split(_h),a=yh(r,o);if(a!==void 0)return a||$h(n,i)}var P4=/\/|:/,E4=/^(?:[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 O4(t){return P4.test(t)&&E4.test(t)}var ak=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function j4(t){return ak.lastIndex=0,ak.test(t)}var N4=-(2**31),R4=2**31-1;function C4(t){return Number.isInteger(t)&&t<=R4&&t>=N4}function D4(t){return Number.isInteger(t)}function sk(){return!0}var A4=/[^\\]\\Z/;function U4(t){if(A4.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var pk=x(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.formatLimitDefinition=void 0;var Z4=hh(),Ut=Q(),Cr=Ut.operators,Lc={formatMaximum:{okStr:"<=",ok:Cr.LTE,fail:Cr.GT},formatMinimum:{okStr:">=",ok:Cr.GTE,fail:Cr.LT},formatExclusiveMaximum:{okStr:"<",ok:Cr.LT,fail:Cr.GTE},formatExclusiveMinimum:{okStr:">",ok:Cr.GT,fail:Cr.LTE}},M4={message:({keyword:t,schemaCode:e})=>(0,Ut.str)`should be ${Lc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ut._)`{comparison: ${Lc[t].okStr}, limit: ${e}}`};lo.formatLimitDefinition={keyword:Object.keys(Lc),type:"string",schemaType:"string",$data:!0,error:M4,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new Z4.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=e.const("fmt",(0,Ut._)`${p}[${c.schemaCode}]`);t.fail$data((0,Ut.or)((0,Ut._)`typeof ${f} != "object"`,(0,Ut._)`${f} instanceof RegExp`,(0,Ut._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let v=e.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,Ut._)`${a.code.formats}${(0,Ut.getProperty)(p)}`:void 0});t.fail$data(d(v))}function d(p){return(0,Ut._)`${p}.compare(${r}, ${n}) ${Lc[o].fail} 0`}},dependencies:["format"]};var L4=t=>(t.addKeyword(lo.formatLimitDefinition),t);lo.default=L4});var vk=x((da,gk)=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var fo=fk(),q4=pk(),bh=Q(),mk=new bh.Name("fullFormats"),F4=new bh.Name("fastFormats"),xh=(t,e={keywords:!0})=>{if(Array.isArray(e))return hk(t,e,fo.fullFormats,mk),t;let[r,n]=e.mode==="fast"?[fo.fastFormats,F4]:[fo.fullFormats,mk],o=e.formats||fo.formatNames;return hk(t,o,r,n),e.keywords&&(0,q4.default)(t),t};xh.get=(t,e="full")=>{let n=(e==="fast"?fo.fastFormats:fo.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function hk(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,bh._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}gk.exports=da=xh;Object.defineProperty(da,"__esModule",{value:!0});da.default=xh});var zk=x((X9,wk)=>{wk.exports=Sk;Sk.sync=W4;var xk=require("fs");function J4(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&t.substr(-o.length).toLowerCase()===o)return!0}return!1}function kk(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:J4(e,r)}function Sk(t,e,r){xk.stat(t,function(n,o){r(n,n?!1:kk(o,t,e))})}function W4(t,e){return kk(xk.statSync(t),t,e)}});var Ok=x((Y9,Ek)=>{Ek.exports=Tk;Tk.sync=G4;var Ik=require("fs");function Tk(t,e,r){Ik.stat(t,function(n,o){r(n,n?!1:Pk(o,e))})}function G4(t,e){return Pk(Ik.statSync(t),e)}function Pk(t,e){return t.isFile()&&K4(t,e)}function K4(t,e){var r=t.mode,n=t.uid,o=t.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),a=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),s=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=s|c,d=r&u||r&c&&o===a||r&s&&n===i||r&l&&i===0;return d}});var Nk=x((eF,jk)=>{var Q9=require("fs"),Jc;process.platform==="win32"||global.TESTING_WINDOWS?Jc=zk():Jc=Ok();jk.exports=kh;kh.sync=H4;function kh(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){kh(t,e||{},function(i,a){i?o(i):n(a)})})}Jc(t,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function H4(t,e){try{return Jc.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Mk=x((tF,Zk)=>{var po=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Rk=require("path"),X4=po?";":":",Ck=Nk(),Dk=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Ak=(t,e)=>{let r=e.colon||X4,n=t.match(/\//)||po&&t.match(/\\/)?[""]:[...po?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=po?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=po?o.split(r):[""];return po&&t.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Uk=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Ak(t,e),a=[],s=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&a.length?l(a):d(Dk(t));let p=n[u],f=/^".*"$/.test(p)?p.slice(1,-1):p,v=Rk.join(f,t),h=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+v:v;l(c(h,u,0))}),c=(u,l,d)=>new Promise((p,f)=>{if(d===o.length)return p(s(l+1));let v=o[d];Ck(u+v,{pathExt:i},(h,$)=>{if(!h&&$)if(e.all)a.push(u+v);else return p(u+v);return p(c(u,l,d+1))})});return r?s(0).then(u=>r(null,u),r):s(0)},Y4=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Ak(t,e),i=[];for(let a=0;a<r.length;a++){let s=r[a],c=/^".*"$/.test(s)?s.slice(1,-1):s,u=Rk.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let p=l+n[d];try{if(Ck.sync(p,{pathExt:o}))if(e.all)i.push(p);else return p}catch{}}}if(e.all&&i.length)return i;if(e.nothrow)return null;throw Dk(t)};Zk.exports=Uk;Uk.sync=Y4});var qk=x((rF,Sh)=>{"use strict";var Lk=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Sh.exports=Lk;Sh.exports.default=Lk});var Jk=x((nF,Bk)=>{"use strict";var Fk=require("path"),Q4=Mk(),eR=qk();function Vk(t,e){let r=t.options.env||process.env,n=process.cwd(),o=t.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(t.options.cwd)}catch{}let a;try{a=Q4.sync(t.command,{path:r[eR({env:r})],pathExt:e?Fk.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Fk.resolve(o?t.options.cwd:"",a)),a}function tR(t){return Vk(t)||Vk(t,!0)}Bk.exports=tR});var Wk=x((oF,zh)=>{"use strict";var wh=/([()\][%!^"`<>&|;, *?])/g;function rR(t){return t=t.replace(wh,"^$1"),t}function nR(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(wh,"^$1"),e&&(t=t.replace(wh,"^$1")),t}zh.exports.command=rR;zh.exports.argument=nR});var Kk=x((iF,Gk)=>{"use strict";Gk.exports=/^#!(.*)/});var Xk=x((aF,Hk)=>{"use strict";var oR=Kk();Hk.exports=(t="")=>{let e=t.match(oR);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Qk=x((sF,Yk)=>{"use strict";var Ih=require("fs"),iR=Xk();function aR(t){let r=Buffer.alloc(150),n;try{n=Ih.openSync(t,"r"),Ih.readSync(n,r,0,150,0),Ih.closeSync(n)}catch{}return iR(r.toString())}Yk.exports=aR});var nS=x((cF,rS)=>{"use strict";var sR=require("path"),eS=Jk(),tS=Wk(),cR=Qk(),uR=process.platform==="win32",lR=/\.(?:com|exe)$/i,dR=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function fR(t){t.file=eS(t);let e=t.file&&cR(t.file);return e?(t.args.unshift(t.file),t.command=e,eS(t)):t.file}function pR(t){if(!uR)return t;let e=fR(t),r=!lR.test(e);if(t.options.forceShell||r){let n=dR.test(e);t.command=sR.normalize(t.command),t.command=tS.command(t.command),t.args=t.args.map(i=>tS.argument(i,n));let o=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${o}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function mR(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:pR(n)}rS.exports=mR});var aS=x((uF,iS)=>{"use strict";var Th=process.platform==="win32";function Ph(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function hR(t,e){if(!Th)return;let r=t.emit;t.emit=function(n,o){if(n==="exit"){let i=oS(o,e);if(i)return r.call(t,"error",i)}return r.apply(t,arguments)}}function oS(t,e){return Th&&t===1&&!e.file?Ph(e.original,"spawn"):null}function gR(t,e){return Th&&t===1&&!e.file?Ph(e.original,"spawnSync"):null}iS.exports={hookChildProcess:hR,verifyENOENT:oS,verifyENOENTSync:gR,notFoundError:Ph}});var uS=x((lF,mo)=>{"use strict";var sS=require("child_process"),Eh=nS(),Oh=aS();function cS(t,e,r){let n=Eh(t,e,r),o=sS.spawn(n.command,n.args,n.options);return Oh.hookChildProcess(o,n),o}function vR(t,e,r){let n=Eh(t,e,r),o=sS.spawnSync(n.command,n.args,n.options);return o.error=o.error||Oh.verifyENOENTSync(o.status,n),o}mo.exports=cS;mo.exports.spawn=cS;mo.exports.sync=vR;mo.exports._parse=Eh;mo.exports._enoent=Oh});var Lw=fe(Ig(),1),qw=fe(ka(),1),Fw=fe(pn(),1),Vw=fe(uu(),1),Bw=fe(fu(),1),Jw=fe(_u(),1),Dg=fe(Ia(),1),Ww=fe(Cg(),1);var Ag=Dg.default;var jh=fe(require("readline")),Ee=fe(require("fs")),Zt=fe(require("path"));var Ug=(t=0)=>e=>`\x1B[${e+t}m`,Zg=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Mg=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Te={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},JR=Object.keys(Te.modifier),Gw=Object.keys(Te.color),Kw=Object.keys(Te.bgColor),WR=[...Gw,...Kw];function Hw(){let t=new Map;for(let[e,r]of Object.entries(Te)){for(let[n,o]of Object.entries(r))Te[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Te[n],t.set(o[0],o[1]);Object.defineProperty(Te,e,{value:r,enumerable:!1})}return Object.defineProperty(Te,"codes",{value:t,enumerable:!1}),Te.color.close="\x1B[39m",Te.bgColor.close="\x1B[49m",Te.color.ansi=Ug(),Te.color.ansi256=Zg(),Te.color.ansi16m=Mg(),Te.bgColor.ansi=Ug(10),Te.bgColor.ansi256=Zg(10),Te.bgColor.ansi16m=Mg(10),Object.defineProperties(Te,{rgbToAnsi256:{value(e,r,n){return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>Te.rgbToAnsi256(...Te.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Te.ansi256ToAnsi(Te.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Te.ansi256ToAnsi(Te.hexToAnsi256(e)),enumerable:!1}}),Te}var Xw=Hw(),Pt=Xw;var Ea=fe(require("node:process"),1),qg=fe(require("node:os"),1),$u=fe(require("node:tty"),1);function _t(t,e=globalThis.Deno?globalThis.Deno.args:Ea.default.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}var{env:Pe}=Ea.default,Pa;_t("no-color")||_t("no-colors")||_t("color=false")||_t("color=never")?Pa=0:(_t("color")||_t("colors")||_t("color=true")||_t("color=always"))&&(Pa=1);function Yw(){if("FORCE_COLOR"in Pe)return Pe.FORCE_COLOR==="true"?1:Pe.FORCE_COLOR==="false"?0:Pe.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Pe.FORCE_COLOR,10),3)}function Qw(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function e0(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let n=Yw();n!==void 0&&(Pa=n);let o=r?Pa:n;if(o===0)return 0;if(r){if(_t("color=16m")||_t("color=full")||_t("color=truecolor"))return 3;if(_t("color=256"))return 2}if("TF_BUILD"in Pe&&"AGENT_NAME"in Pe)return 1;if(t&&!e&&o===void 0)return 0;let i=o||0;if(Pe.TERM==="dumb")return i;if(Ea.default.platform==="win32"){let a=qg.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Pe)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Pe)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Pe)||Pe.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Pe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pe.TEAMCITY_VERSION)?1:0;if(Pe.COLORTERM==="truecolor"||Pe.TERM==="xterm-kitty"||Pe.TERM==="xterm-ghostty"||Pe.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Pe){let a=Number.parseInt((Pe.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pe.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Pe.TERM)||"COLORTERM"in Pe?1:i}function Lg(t,e={}){let r=e0(t,{streamIsTTY:t&&t.isTTY,...e});return Qw(r)}var t0={stdout:Lg({isTTY:$u.default.isatty(1)}),stderr:Lg({isTTY:$u.default.isatty(2)})},Fg=t0;function Vg(t,e,r){let n=t.indexOf(e);if(n===-1)return t;let o=e.length,i=0,a="";do a+=t.slice(i,n)+e+r,i=n+o,n=t.indexOf(e,i);while(n!==-1);return a+=t.slice(i),a}function Bg(t,e,r,n){let o=0,i="";do{let a=t[n-1]==="\r";i+=t.slice(o,a?n-1:n)+e+(a?`\r
16
16
  `:`
17
17
  `)+r,o=n+1,n=t.indexOf(`
18
- `,o)}while(n!==-1);return i+=t.slice(o),i}var{stdout:Fg,stderr:Vg}=Mg,vu=Symbol("GENERATOR"),gn=Symbol("STYLER"),ko=Symbol("IS_EMPTY"),Bg=["ansi","ansi","ansi256","ansi16m"],vn=Object.create(null),t0=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Fg?Fg.level:0;t.level=e.level===void 0?r:e.level};var r0=t=>{let e=(...r)=>r.join(" ");return t0(e,t),Object.setPrototypeOf(e,So.prototype),e};function So(t){return r0(t)}Object.setPrototypeOf(So.prototype,Function.prototype);for(let[t,e]of Object.entries(It))vn[t]={get(){let r=Ia(this,yu(e.open,e.close,this[gn]),this[ko]);return Object.defineProperty(this,t,{value:r}),r}};vn.visible={get(){let t=Ia(this,this[gn],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var _u=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?It[r].ansi16m(...n):e==="ansi256"?It[r].ansi256(It.rgbToAnsi256(...n)):It[r].ansi(It.rgbToAnsi(...n)):t==="hex"?_u("rgb",e,r,...It.hexToRgb(...n)):It[r][t](...n),n0=["rgb","hex","ansi256"];for(let t of n0){vn[t]={get(){let{level:r}=this;return function(...n){let o=yu(_u(t,Bg[r],"color",...n),It.color.close,this[gn]);return Ia(this,o,this[ko])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);vn[e]={get(){let{level:r}=this;return function(...n){let o=yu(_u(t,Bg[r],"bgColor",...n),It.bgColor.close,this[gn]);return Ia(this,o,this[ko])}}}}var o0=Object.defineProperties(()=>{},{...vn,level:{enumerable:!0,get(){return this[vu].level},set(t){this[vu].level=t}}}),yu=(t,e,r)=>{let n,o;return r===void 0?(n=t,o=e):(n=r.openAll+t,o=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:o,parent:r}},Ia=(t,e,r)=>{let n=(...o)=>i0(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,o0),n[vu]=t,n[gn]=e,n[ko]=r,n},i0=(t,e)=>{if(t.level<=0||!e)return t[ko]?"":e;let r=t[gn];if(r===void 0)return e;let{openAll:n,closeAll:o}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=Lg(e,r.close,r.open),r=r.parent;let i=e.indexOf(`
19
- `);return i!==-1&&(e=qg(e,o,n,i)),n+e+o};Object.defineProperties(So.prototype,vn);var a0=So(),YR=So({level:Vg?Vg.level:0});var v=a0;var Ta=require("child_process"),et=de(require("fs")),Pa=de(require("path")),Ea=process.cwd();async function $u(t,e){try{switch(t){case"read_file":return s0(e);case"write_file":return c0(e);case"edit_file":return u0(e);case"grep":return l0(e);case"glob":return d0(e);case"list_dir":return f0(e);case"bash":return p0(e);default:return{success:!1,output:`Unknown tool: ${t}`}}}catch(r){return{success:!1,output:r.message}}}function Oa(t){return Pa.resolve(Ea,t)}var Jg=100*1024;function s0(t){let e=Oa(t.path),r=et.statSync(e);if(r.size>Jg){let o=et.readFileSync(e,"utf-8").slice(0,Jg),i=et.readFileSync(e,"utf-8").split(`
18
+ `,o)}while(n!==-1);return i+=t.slice(o),i}var{stdout:Jg,stderr:Wg}=Fg,bu=Symbol("GENERATOR"),yn=Symbol("STYLER"),wo=Symbol("IS_EMPTY"),Gg=["ansi","ansi","ansi256","ansi16m"],$n=Object.create(null),r0=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Jg?Jg.level:0;t.level=e.level===void 0?r:e.level};var n0=t=>{let e=(...r)=>r.join(" ");return r0(e,t),Object.setPrototypeOf(e,zo.prototype),e};function zo(t){return n0(t)}Object.setPrototypeOf(zo.prototype,Function.prototype);for(let[t,e]of Object.entries(Pt))$n[t]={get(){let r=Oa(this,ku(e.open,e.close,this[yn]),this[wo]);return Object.defineProperty(this,t,{value:r}),r}};$n.visible={get(){let t=Oa(this,this[yn],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var xu=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?Pt[r].ansi16m(...n):e==="ansi256"?Pt[r].ansi256(Pt.rgbToAnsi256(...n)):Pt[r].ansi(Pt.rgbToAnsi(...n)):t==="hex"?xu("rgb",e,r,...Pt.hexToRgb(...n)):Pt[r][t](...n),o0=["rgb","hex","ansi256"];for(let t of o0){$n[t]={get(){let{level:r}=this;return function(...n){let o=ku(xu(t,Gg[r],"color",...n),Pt.color.close,this[yn]);return Oa(this,o,this[wo])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);$n[e]={get(){let{level:r}=this;return function(...n){let o=ku(xu(t,Gg[r],"bgColor",...n),Pt.bgColor.close,this[yn]);return Oa(this,o,this[wo])}}}}var i0=Object.defineProperties(()=>{},{...$n,level:{enumerable:!0,get(){return this[bu].level},set(t){this[bu].level=t}}}),ku=(t,e,r)=>{let n,o;return r===void 0?(n=t,o=e):(n=r.openAll+t,o=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:o,parent:r}},Oa=(t,e,r)=>{let n=(...o)=>a0(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,i0),n[bu]=t,n[yn]=e,n[wo]=r,n},a0=(t,e)=>{if(t.level<=0||!e)return t[wo]?"":e;let r=t[yn];if(r===void 0)return e;let{openAll:n,closeAll:o}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=Vg(e,r.close,r.open),r=r.parent;let i=e.indexOf(`
19
+ `);return i!==-1&&(e=Bg(e,o,n,i)),n+e+o};Object.defineProperties(zo.prototype,$n);var s0=zo(),eC=zo({level:Wg?Wg.level:0});var g=s0;var ja=require("child_process"),rt=fe(require("fs")),Na=fe(require("path")),Ra=process.cwd();async function Su(t,e){try{switch(t){case"read_file":return c0(e);case"write_file":return u0(e);case"edit_file":return l0(e);case"grep":return d0(e);case"glob":return f0(e);case"list_dir":return p0(e);case"bash":return m0(e);default:return{success:!1,output:`Unknown tool: ${t}`}}}catch(r){return{success:!1,output:r.message}}}function Ca(t){return Na.resolve(Ra,t)}var Kg=100*1024;function c0(t){let e=Ca(t.path),r=rt.statSync(e);if(r.size>Kg){let o=rt.readFileSync(e,"utf-8").slice(0,Kg),i=rt.readFileSync(e,"utf-8").split(`
20
20
  `).length,a=o.split(`
21
21
  `).length;return{success:!0,output:`${o}
22
22
 
23
- [FILE TRUNCATED: showing ${a}/${i} lines (${(r.size/1024).toFixed(0)}KB). Use grep to find specific sections.]`}}return{success:!0,output:et.readFileSync(e,"utf-8")}}function c0(t){let e=Oa(t.path);return et.mkdirSync(Pa.dirname(e),{recursive:!0}),et.writeFileSync(e,t.content,"utf-8"),{success:!0,output:`Written ${t.path} (${t.content.length} chars)`}}function u0(t){let e=Oa(t.path),r=et.readFileSync(e,"utf-8");if(!r.includes(t.old_str))return{success:!1,output:`old_str not found in ${t.path}`};let n=r.split(t.old_str).length-1;return n>1?{success:!1,output:`old_str found ${n} times in ${t.path}, must be unique`}:(et.writeFileSync(e,r.replace(t.old_str,t.new_str),"utf-8"),{success:!0,output:`Edited ${t.path}`})}function l0(t){let e=t.path||".",n=`grep -rn ${t.context_lines&&t.context_lines>0?`-C ${Math.min(t.context_lines,10)}`:""} --include='${t.include||"*"}' '${t.pattern}' ${e} 2>/dev/null | head -100`;return{success:!0,output:(0,Ta.execSync)(n,{cwd:Ea,encoding:"utf-8",timeout:1e4})||"(no matches)"}}function d0(t){let e=`find . -name '${t.pattern}' -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | head -100`;return{success:!0,output:(0,Ta.execSync)(e,{cwd:Ea,encoding:"utf-8",timeout:1e4})||"(no files found)"}}function f0(t){let e=Oa(t.path||".");return{success:!0,output:et.readdirSync(e,{withFileTypes:!0}).filter(o=>!o.name.startsWith(".")&&o.name!=="node_modules").map(o=>`${o.isDirectory()?"\u{1F4C1}":"\u{1F4C4}"} ${o.name}`).join(`
24
- `)||"(empty)"}}function p0(t){let e=t.command.trim();return[/\brm\s+-rf\s+[\/~]/,/\bmkfs\b/,/\bdd\s+if=/,/\b>\s*\/dev\/sd/,/\bchmod\s+-R\s+777\s+\//,/\bsudo\s+rm\b/].some(o=>o.test(e))?{success:!1,output:"Blocked: dangerous command detected"}:{success:!0,output:(0,Ta.execSync)(e,{cwd:Ea,encoding:"utf-8",timeout:t.timeout||3e4,maxBuffer:1024*1024})}}var wo=de(require("path")),Wg=de(require("fs")),Gg=de(require("readline"));var ja=process.cwd(),Na=new Set;function Kg(t){return Na.has(t)}function Hg(){Na.clear()}function m0(t){let e=wo.resolve(ja,t);return e.startsWith(ja+wo.sep)||e===ja}var h0=new Set(["read_file","grep","glob","list_dir"]);async function Xg(t,e,r){if(h0.has(t)){let n=e.path||e.pattern||".";if(m0(n))return"y"}return t!=="bash"&&Na.has(t)?"t":"ask"}async function bu(t,e,r){let n=t==="bash"?`Allow this action? [${v.cyan("y")}/${v.cyan("n")}]: `:`Allow this action? Use '${v.cyan("t")}' to trust (always allow) this tool for the session. [${v.cyan("y")}/${v.cyan("n")}/${v.cyan("t")}]: `,i=(await g0(`
25
- `+n)).trim().toLowerCase()[0]||"n";return i==="t"&&t!=="bash"?(Na.add(t),"t"):i==="y"?"y":"n"}function xu(t){try{let e=wo.resolve(ja,t);return Wg.readFileSync(e,"utf-8")}catch{return}}function g0(t){return new Promise(e=>{let r=Gg.createInterface({input:process.stdin,output:process.stdout,terminal:!0});r.on("SIGINT",()=>{r.close(),e("n")}),r.question(t,n=>{r.close(),e(n)})})}function Yg(t){let e=t.split(`
26
- `),r=[],n=!1,o="";for(let i of e){if(i.trimStart().startsWith("```")){n?(r.push(v.gray(" \u2514"+"\u2500".repeat(44))),n=!1,o=""):(o=i.trim().slice(3).trim(),r.push(v.gray(` \u250C\u2500 ${o||"code"} ${"\u2500".repeat(Math.max(0,40-(o||"code").length))}`)),n=!0);continue}if(n){r.push(v.green(" \u2502 ")+v.white(i));continue}let a=i.match(/^(#{1,3})\s+(.+)/);if(a){r.push(v.bold.cyan(a[2]));continue}if(/^\s*[-*]\s/.test(i)){r.push(i.replace(/^(\s*)[-*]\s/,"$1\u2022 ").replace(/`([^`]+)`/g,(s,c)=>v.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>v.bold(c)));continue}if(/^\s*\d+\.\s/.test(i)){r.push(i.replace(/`([^`]+)`/g,(s,c)=>v.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>v.bold(c)));continue}r.push(i.replace(/`([^`]+)`/g,(s,c)=>v.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>v.bold(c)).replace(/\*([^*]+)\*/g,(s,c)=>v.italic(c)))}return n&&r.push(v.gray(" \u2514"+"\u2500".repeat(44))),r.join(`
27
- `)}var Qg=de(require("fs")),Ra=de(require("path"));function v0(t){return t.replace(/\x1b\[[0-9;]*m/g,"")}function ev(){let t=process.stdout.columns||60,e=Math.min(t-4,62),r=v.gray,n=v.cyan,o=v.cyanBright.bold,i=v.white,a=n("\u2502"),s=(u,l)=>u+" ".repeat(Math.max(0,l-v0(u).length)),c=u=>` ${a} ${s(u,e-4)} ${a}`;console.log(""),console.log(n(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 ")),console.log(n(" \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")),console.log(o(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551")),console.log(n(" \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551")),console.log(o(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551")),console.log(n(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D")),console.log(""),console.log(` ${n("\u250C"+"\u2500".repeat(e-2)+"\u2510")}`),console.log(c(r("AI-powered coding assistant")+" ".repeat(Math.max(0,e-38))+r("v0.1.8"))),console.log(c("")),console.log(c(r("model ")+i("Kimi K2.5")+r(" context ")+i("256k"))),console.log(c(r("location ")+i(process.cwd()))),console.log(c("")),console.log(c(r("/help")+i(" commands")+r(" \\ + Enter")+i(" newline"))),console.log(c(r("Ctrl+C")+i(" cancel")+r(" Powered by Cloudflare"))),console.log(` ${n("\u2514"+"\u2500".repeat(e-2)+"\u2518")}`),console.log("")}function tv(t){console.log(v.white(t))}function Ca(t,e,r){let n="";r&&r.includes("||")&&(n=r.split("||")[1]||"");let o="",i=e.path||e.pattern||"",a=v.blue(i);switch(t){case"write_file":o=`I will write to file: ${a}`;break;case"edit_file":o=`I will edit the file: ${a}`;break;case"read_file":o=`I will read the file: ${a}`;break;case"bash":o=`I will run the following command: ${v.blue(e.command||"?")}`;break;case"web_search":o=`I will search the web for: ${v.blue(e.query||"?")}`;break;case"web_fetch":o=`I will fetch URL: ${v.blue(e.url||"?")}`;break;case"grep":o=`I will search for '${v.blue(e.pattern)}' in ${a||"."}`;break;case"glob":o=`I will find files matching: ${v.blue(e.pattern)}`;break;case"list_dir":o=`I will list directory: ${a||"."}`;break;default:o=`${t}`}console.log(v.yellow(`
28
- \u26A1 `)+o+v.gray(` (using tool: ${t})`)),n&&console.log(v.white(` Purpose: ${n}`))}function zo(t,e,r,n,o){let i=n!=null?v.gray(` ${(n/1e3).toFixed(1)}s`):"",a=r.length;if(!e){console.log(v.red(" \u2717 Failed")),console.log(v.gray(` Completed in${i}`)),r.trim()&&console.log(v.gray(` ${r.slice(0,200)}`));return}let s=o?.path||"";if(t==="bash"){let c=(o?.command||"").slice(0,60);if(console.log(v.greenBright(" \u2713 Successfully")+v.white(` ran: ${c}`)),console.log(v.gray(` Completed in${i}`)),r.trim()){let u=r.split(`
23
+ [FILE TRUNCATED: showing ${a}/${i} lines (${(r.size/1024).toFixed(0)}KB). Use grep to find specific sections.]`}}return{success:!0,output:rt.readFileSync(e,"utf-8")}}function u0(t){let e=Ca(t.path);return rt.mkdirSync(Na.dirname(e),{recursive:!0}),rt.writeFileSync(e,t.content,"utf-8"),{success:!0,output:`Written ${t.path} (${t.content.length} chars)`}}function l0(t){let e=Ca(t.path),r=rt.readFileSync(e,"utf-8");if(!r.includes(t.old_str))return{success:!1,output:`old_str not found in ${t.path}`};let n=r.split(t.old_str).length-1;return n>1?{success:!1,output:`old_str found ${n} times in ${t.path}, must be unique`}:(rt.writeFileSync(e,r.replace(t.old_str,t.new_str),"utf-8"),{success:!0,output:`Edited ${t.path}`})}function d0(t){let e=t.path||".",n=`grep -rn ${t.context_lines&&t.context_lines>0?`-C ${Math.min(t.context_lines,10)}`:""} --include='${t.include||"*"}' '${t.pattern}' ${e} 2>/dev/null | head -100`;return{success:!0,output:(0,ja.execSync)(n,{cwd:Ra,encoding:"utf-8",timeout:1e4})||"(no matches)"}}function f0(t){let e=`find . -name '${t.pattern}' -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | head -100`;return{success:!0,output:(0,ja.execSync)(e,{cwd:Ra,encoding:"utf-8",timeout:1e4})||"(no files found)"}}function p0(t){let e=Ca(t.path||".");return{success:!0,output:rt.readdirSync(e,{withFileTypes:!0}).filter(o=>!o.name.startsWith(".")&&o.name!=="node_modules").map(o=>`${o.isDirectory()?"\u{1F4C1}":"\u{1F4C4}"} ${o.name}`).join(`
24
+ `)||"(empty)"}}function m0(t){let e=t.command.trim();return[/\bmkfs\b/,/\bdd\s+if=/,/\b>\s*\/dev\/sd/,/\bchmod\s+-R\s+777\s+\/\s*$/,/\bsudo\s+rm\s+-rf\s+\/\s*$/].some(o=>o.test(e))?{success:!1,output:"Blocked: dangerous command detected"}:{success:!0,output:(0,ja.execSync)(e,{cwd:Ra,encoding:"utf-8",timeout:t.timeout||3e4,maxBuffer:1024*1024})}}var Io=fe(require("path")),Hg=fe(require("fs")),Xg=fe(require("readline"));var Da=process.cwd(),Aa=new Set;function Yg(t){return Aa.has(t)}function Qg(){Aa.clear()}function h0(t){let e=Io.resolve(Da,t);return e.startsWith(Da+Io.sep)||e===Da}var g0=new Set(["read_file","grep","glob","list_dir"]);async function ev(t,e,r){if(g0.has(t)){let n=e.path||e.pattern||".";if(h0(n))return"y"}return t!=="bash"&&Aa.has(t)?"t":"ask"}async function wu(t,e,r){let n=t==="bash"?`Allow this action? [${g.cyan("y")}/${g.cyan("n")}]: `:`Allow this action? Use '${g.cyan("t")}' to trust (always allow) this tool for the session. [${g.cyan("y")}/${g.cyan("n")}/${g.cyan("t")}]: `,i=(await v0(`
25
+ `+n)).trim().toLowerCase()[0]||"n";return i==="t"&&t!=="bash"?(Aa.add(t),"t"):i==="y"?"y":"n"}function To(t){try{let e=Io.resolve(Da,t);return Hg.readFileSync(e,"utf-8")}catch{return}}function v0(t){return new Promise(e=>{let r=Xg.createInterface({input:process.stdin,output:process.stdout,terminal:!0});r.on("SIGINT",()=>{r.close(),e("n")}),r.question(t,n=>{r.close(),e(n)})})}function tv(t){let e=t.split(`
26
+ `),r=[],n=!1,o="";for(let i of e){if(i.trimStart().startsWith("```")){n?(r.push(g.gray(" \u2514"+"\u2500".repeat(44))),n=!1,o=""):(o=i.trim().slice(3).trim(),r.push(g.gray(` \u250C\u2500 ${o||"code"} ${"\u2500".repeat(Math.max(0,40-(o||"code").length))}`)),n=!0);continue}if(n){r.push(g.green(" \u2502 ")+g.white(i));continue}let a=i.match(/^(#{1,3})\s+(.+)/);if(a){r.push(g.bold.cyan(a[2]));continue}if(/^\s*[-*]\s/.test(i)){r.push(i.replace(/^(\s*)[-*]\s/,"$1\u2022 ").replace(/`([^`]+)`/g,(s,c)=>g.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>g.bold(c)));continue}if(/^\s*\d+\.\s/.test(i)){r.push(i.replace(/`([^`]+)`/g,(s,c)=>g.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>g.bold(c)));continue}r.push(i.replace(/`([^`]+)`/g,(s,c)=>g.cyan(c)).replace(/\*\*([^*]+)\*\*/g,(s,c)=>g.bold(c)).replace(/\*([^*]+)\*/g,(s,c)=>g.italic(c)))}return n&&r.push(g.gray(" \u2514"+"\u2500".repeat(44))),r.join(`
27
+ `)}var rv=fe(require("fs")),Ua=fe(require("path"));function _0(t){return t.replace(/\x1b\[[0-9;]*m/g,"")}function nv(){let t=process.stdout.columns||60,e=Math.min(t-4,62),r=g.gray,n=g.cyan,o=g.cyanBright.bold,i=g.white,a=n("\u2502"),s=(l,d)=>l+" ".repeat(Math.max(0,d-_0(l).length)),c=l=>` ${a} ${s(l,e-4)} ${a}`;console.log(""),console.log(` ${n("\u250C"+"\u2500".repeat(e-2)+"\u2510")}`),console.log(c(""));let u=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557"," \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"];for(let l=0;l<u.length;l++){let p=(l%2===0?n:o)(u[l]),f=u[l].length,v=" ".repeat(Math.max(0,e-4-f));console.log(` ${a} ${p}${v} ${a}`)}console.log(c("")),console.log(c(r("AI-powered coding assistant")+" ".repeat(Math.max(0,e-38))+r("v0.2.0"))),console.log(c("")),console.log(c(r("model ")+i("Kimi K2.5")+r(" context ")+i("256k"))),console.log(c(r("location ")+i(process.cwd()))),console.log(c("")),console.log(c(r("/help")+i(" commands")+r(" \\ + Enter")+i(" newline"))),console.log(c(r("Ctrl+C")+i(" cancel")+r(" Powered by ")+g.hex("#F6821F")("Cloudflare"))),console.log(` ${n("\u2514"+"\u2500".repeat(e-2)+"\u2518")}`),console.log(g.gray(" Built by ")+g.cyan.bold("Bowen Liu")),console.log("")}function ov(t){console.log(g.white(t))}function Za(t,e,r){let n="";r&&r.includes("||")&&(n=r.split("||")[1]||"");let o="",i=e.path||e.pattern||"",a=g.blue(i);switch(t){case"write_file":o=`I will write to file: ${a}`;break;case"edit_file":o=`I will edit the file: ${a}`;break;case"read_file":o=`I will read the file: ${a}`;break;case"bash":o=`I will run the following command: ${g.blue(e.command||"?")}`;break;case"web_search":o=`I will search the web for: ${g.blue(e.query||"?")}`;break;case"web_fetch":o=`I will fetch URL: ${g.blue(e.url||"?")}`;break;case"grep":o=`I will search for '${g.blue(e.pattern)}' in ${a||"."}`;break;case"glob":o=`I will find files matching: ${g.blue(e.pattern)}`;break;case"list_dir":o=`I will list directory: ${a||"."}`;break;default:{let s=Object.values(e).find(u=>u&&typeof u=="string")||"";o=`I will ${s.startsWith("http")?"fetch":t.includes("search")?"search":"query"}: ${g.blue(s.slice(0,80))}`}}console.log(g.yellow(`
28
+ \u26A1 `)+o+g.gray(` (using tool: ${t})`)),n&&console.log(g.white(` Purpose: ${n}`))}function Po(t,e,r,n,o){let i=n!=null?g.gray(` ${(n/1e3).toFixed(1)}s`):"",a=r.length;if(!e){console.log(g.red(" \u2717 Failed")),console.log(g.gray(` Completed in${i}`)),r.trim()&&console.log(g.gray(` ${r.slice(0,200)}`));return}let s=o?.path||"";if(t==="bash"){let c=(o?.command||"").slice(0,60);if(console.log(g.greenBright(" \u2713 Successfully")+g.white(` ran: ${c}`)),console.log(g.gray(` Completed in${i}`)),r.trim()){let u=r.split(`
29
29
  `).slice(0,20).map(l=>` ${l}`).join(`
30
- `);console.log(v.white(u)),r.split(`
31
- `).length>20&&console.log(v.gray(` ... (${r.split(`
32
- `).length} lines)`))}}else if(t==="read_file"){let c=Ra.resolve(process.cwd(),o?.path||"");console.log(v.greenBright(" \u2713 Successfully")+v.white(` read ${a} bytes from ${c}`)),console.log(v.gray(` Completed in${i}`))}else if(t==="write_file"){let c=Ra.resolve(process.cwd(),o?.path||""),u=o?.path&&Qg.existsSync(c);console.log(v.greenBright(" \u2713 Successfully")+v.white(` wrote ${a} bytes to ${c}`)),console.log(v.gray(` Completed in${i}`))}else if(t==="edit_file"){let c=Ra.resolve(process.cwd(),o?.path||"");console.log(v.greenBright(" \u2713 Successfully")+v.white(` edited ${c}`)),console.log(v.gray(` Completed in${i}`))}else if(t==="grep"){let c=r.trim()?r.split(`
33
- `).length:0;if(console.log(v.green(` \u2713 Found ${c} matches`)),console.log(v.gray(` Completed in${i}`)),r.trim()){let u=r.split(`
34
- `).slice(0,10).map(l=>` ${v.gray(l)}`).join(`
35
- `);console.log(u),c>10&&console.log(v.gray(` ... (${c} lines)`))}}else t==="glob"?(console.log(v.green(` \u2713 Found ${r.trim()?r.split(`
36
- `).length:0} files`)),console.log(v.gray(` Completed in${i}`))):t==="list_dir"?(console.log(v.green(` \u2713 Listed ${r.trim()?r.split(`
37
- `).length:0} entries`)),console.log(v.gray(` Completed in${i}`))):(console.log(v.green(" \u2713 Done")),console.log(v.gray(` Completed in${i}`)))}function Io(t){console.log(v.red(` \u274C ${t}`))}function rv(t,e,r){let n=e?v.green("\u2713"):v.red("\u2717");if(t==="web_search"){let o=r.split(`
38
- `).find(i=>i.startsWith("["))||"";console.log(` ${n} ${v.gray(o.slice(0,120))}`)}else if(t==="web_fetch"){let o=r.split(`
39
- `)[0]?.slice(0,80)||"fetched";console.log(` ${n} ${v.gray(o)}`)}else console.log(` ${n}`)}function nv(t,e){console.log(v.cyan(`
30
+ `);console.log(g.white(u)),r.split(`
31
+ `).length>20&&console.log(g.gray(` ... (${r.split(`
32
+ `).length} lines)`))}}else if(t==="read_file"){let c=Ua.resolve(process.cwd(),o?.path||"");console.log(g.greenBright(" \u2713 Successfully")+g.white(` read ${a} bytes from ${c}`)),console.log(g.gray(` Completed in${i}`))}else if(t==="write_file"){let c=Ua.resolve(process.cwd(),o?.path||""),u=o?.path&&rv.existsSync(c);console.log(g.greenBright(" \u2713 Successfully")+g.white(` wrote ${a} bytes to ${c}`)),console.log(g.gray(` Completed in${i}`))}else if(t==="edit_file"){let c=Ua.resolve(process.cwd(),o?.path||"");console.log(g.greenBright(" \u2713 Successfully")+g.white(` edited ${c}`)),console.log(g.gray(` Completed in${i}`))}else if(t==="grep"){let c=r.trim()?r.split(`
33
+ `).length:0;if(console.log(g.green(` \u2713 Found ${c} matches`)),console.log(g.gray(` Completed in${i}`)),r.trim()){let u=r.split(`
34
+ `).slice(0,10).map(l=>` ${g.gray(l)}`).join(`
35
+ `);console.log(u),c>10&&console.log(g.gray(` ... (${c} lines)`))}}else t==="glob"?(console.log(g.green(` \u2713 Found ${r.trim()?r.split(`
36
+ `).length:0} files`)),console.log(g.gray(` Completed in${i}`))):t==="list_dir"?(console.log(g.green(` \u2713 Listed ${r.trim()?r.split(`
37
+ `).length:0} entries`)),console.log(g.gray(` Completed in${i}`))):(console.log(g.green(" \u2713 Done")),console.log(g.gray(` Completed in${i}`)))}function Eo(t){console.log(g.red(` \u274C ${t}`))}function iv(t,e,r){let n=e?g.green("\u2713"):g.red("\u2717");if(t==="web_search"){let o=r.split(`
38
+ `).find(i=>i.startsWith("["))||"";console.log(` ${n} ${g.gray(o.slice(0,120))}`)}else if(t==="web_fetch"){let o=r.split(`
39
+ `)[0]?.slice(0,80)||"fetched";console.log(` ${n} ${g.gray(o)}`)}else console.log(` ${n}`)}function zu(t,e){console.log(g.cyan(`
40
40
  \u2500\u2500 ${t} \u2500\u2500`));let r=e.split(`
41
- `);for(let n=0;n<r.length;n++){let o=v.gray(String(n+1).padStart(4)+" \u2502 ");console.log(o+v.green("+ "+r[n]))}console.log(v.cyan(` \u2500\u2500 end \u2500\u2500
42
- `))}function ku(t,e,r,n){console.log("");let o=t.split(`
41
+ `);for(let n=0;n<r.length;n++){let o=g.gray(String(n+1).padStart(4)+" \u2502 ");console.log(o+g.green("+ "+r[n]))}console.log(g.cyan(` \u2500\u2500 end \u2500\u2500
42
+ `))}function Oo(t,e,r,n){console.log("");let o=t.split(`
43
43
  `),i=e.split(`
44
- `),a=0;for(;a<o.length&&a<i.length&&o[a]===i[a];)a++;let s=0;for(;s<o.length-a&&s<i.length-a&&o[o.length-1-s]===i[i.length-1-s];)s++;let c=o.slice(a,o.length-s),u=i.slice(a,i.length-s),l=Math.max(0,a-3);for(let p=l;p<a;p++)console.log(v.gray(String(p+1).padStart(4)+" "+o[p]));for(let p=0;p<c.length;p++){let g=a+p+1;console.log(v.red(String(g).padStart(4)+" - "+c[p]))}for(let p=0;p<u.length;p++){let g=a+p+1;console.log(v.green(String(g).padStart(4)+" + "+u[p]))}let d=o.length-s,f=Math.min(o.length,d+3);for(let p=d;p<f;p++){let g=a+u.length+(p-d)+1;console.log(v.gray(String(g).padStart(4)+" "+o[p]))}console.log("")}var _n=de(require("fs")),Su=de(require("path")),iv=de(require("readline"));var y0=process.env.SYNAPSE_API||"https://api.synapse.cloudc.top",av=Su.join(process.env.HOME||"~",".synapse"),sv=Su.join(av,"token");function ov(t,e=!1){let r=iv.createInterface({input:process.stdin,output:process.stderr});return new Promise(n=>{r.question(t,o=>{r.close(),n(o.trim())})})}async function cv(){console.log(v.cyan.bold(`
44
+ `),a=0;for(;a<o.length&&a<i.length&&o[a]===i[a];)a++;let s=0;for(;s<o.length-a&&s<i.length-a&&o[o.length-1-s]===i[i.length-1-s];)s++;let c=o.slice(a,o.length-s),u=i.slice(a,i.length-s),l=Math.max(0,a-3);for(let f=l;f<a;f++)console.log(g.gray(String(f+1).padStart(4)+" "+o[f]));for(let f=0;f<c.length;f++){let v=a+f+1;console.log(g.red(String(v).padStart(4)+" - "+c[f]))}for(let f=0;f<u.length;f++){let v=a+f+1;console.log(g.green(String(v).padStart(4)+" + "+u[f]))}let d=o.length-s,p=Math.min(o.length,d+3);for(let f=d;f<p;f++){let v=a+u.length+(f-d)+1;console.log(g.gray(String(v).padStart(4)+" "+o[f]))}console.log("")}var bn=fe(require("fs")),Iu=fe(require("path")),sv=fe(require("readline"));var $0=process.env.SYNAPSE_API||"https://api.synapse.cloudc.top",cv=Iu.join(process.env.HOME||"~",".synapse"),uv=Iu.join(cv,"token");function av(t,e=!1){let r=sv.createInterface({input:process.stdin,output:process.stderr});return new Promise(n=>{r.question(t,o=>{r.close(),n(o.trim())})})}async function lv(){console.log(g.cyan.bold(`
45
45
  \u26A1 Synapse Login
46
- `));let t=await ov(" Username: "),e=await ov(" Password: ");try{let r=await fetch(`${y0}/api/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:e})}),n=await r.json();(!r.ok||!n.token)&&(console.log(v.red(`
47
- \u274C ${n.error||"Login failed"}`)),process.exit(1)),_n.mkdirSync(av,{recursive:!0}),_n.writeFileSync(sv,n.token,{mode:384}),console.log(v.green(`
48
- \u2713 Logged in. Token saved to ~/.synapse/token`))}catch(r){console.log(v.red(`
49
- \u274C Connection failed: ${r.message}`)),process.exit(1)}}function uv(){try{_n.unlinkSync(sv),console.log(v.green(" \u2713 Logged out."))}catch{console.log(v.gray(" Already logged out."))}}var oe;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(oe||(oe={}));var lv;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(lv||(lv={}));var E=oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=t=>{switch(typeof t){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(t)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(t)?E.array:t===null?E.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?E.promise:typeof Map<"u"&&t instanceof Map?E.map:typeof Set<"u"&&t instanceof Set?E.set:typeof Date<"u"&&t instanceof Date?E.date:E.object;default:return E.unknown}};var k=oe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var st=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};st.create=t=>new st(t);var $0=(t,e)=>{let r;switch(t.code){case k.invalid_type:t.received===E.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,oe.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${oe.joinValues(t.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oe.joinValues(t.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${oe.joinValues(t.options)}, received '${t.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:oe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case k.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case k.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=e.defaultError,oe.assertNever(t)}return{message:r}},gr=$0;var b0=gr;function To(){return b0}var Da=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function I(t,e){let r=To(),n=Da({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===gr?void 0:gr].filter(o=>!!o)});t.common.issues.push(n)}var Le=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return q;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return q;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},q=Object.freeze({status:"aborted"}),yn=t=>({status:"dirty",value:t}),We=t=>({status:"valid",value:t}),wu=t=>t.status==="aborted",zu=t=>t.status==="dirty",Mr=t=>t.status==="valid",Po=t=>typeof Promise<"u"&&t instanceof Promise;var R;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(R||(R={}));var vt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},dv=(t,e)=>{if(Mr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new st(t.common.issues);return this._error=r,this._error}}};function K(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var ee=class{get description(){return this._def.description}_getType(e){return Yt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Yt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:Yt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Po(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return dv(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Mr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Mr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Po(o)?o:Promise.resolve(o));return dv(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:k.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Pt({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Tt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _r.create(this)}promise(){return Lr.create(this,this._def)}or(e){return Sn.create([this,e],this._def)}and(e){return wn.create(this,e,this._def)}transform(e){return new Pt({...K(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new En({...K(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new Aa({typeName:Z.ZodBranded,type:this,...K(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new On({...K(this._def),innerType:this,catchValue:r,typeName:Z.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ua.create(this,e)}readonly(){return jn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},x0=/^c[^\s-]{8,}$/i,k0=/^[0-9a-z]+$/,S0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,z0=/^[a-z0-9_-]{21}$/i,I0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,P0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,E0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Iu,O0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,j0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,N0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,R0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,C0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",A0=new RegExp(`^${fv}$`);function pv(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function U0(t){return new RegExp(`^${pv(t)}$`)}function Z0(t){let e=`${fv}T${pv(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function M0(t,e){return!!((e==="v4"||!e)&&O0.test(t)||(e==="v6"||!e)&&N0.test(t))}function L0(t,e){if(!I0.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function q0(t,e){return!!((e==="v4"||!e)&&j0.test(t)||(e==="v6"||!e)&&R0.test(t))}var bn=class t extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.string,received:i.parsedType}),q}let n=new Le,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")P0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"email",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Iu||(Iu=new RegExp(E0,"u")),Iu.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"emoji",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")w0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"uuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")z0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"nanoid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")x0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")k0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cuid2",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")S0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"ulid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),I(o,{validation:"url",code:k.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"regex",code:k.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Z0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?A0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?U0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?T0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"duration",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?M0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"ip",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?L0(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"jwt",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?q0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cidr",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?C0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"base64",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?D0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"base64url",code:k.invalid_string,message:i.message}),n.dirty()):oe.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:k.invalid_string,...R.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...R.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...R.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...R.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...R.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...R.errToObj(r)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};bn.create=t=>new bn({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...K(t)});function F0(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var Eo=class t extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==E.number){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.number,received:i.parsedType}),q}let n,o=new Le;for(let i of this._def.checks)i.kind==="int"?oe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:k.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?F0(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_finite,message:i.message}),o.dirty()):oe.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,R.toString(r))}gt(e,r){return this.setLimit("min",e,!1,R.toString(r))}lte(e,r){return this.setLimit("max",e,!0,R.toString(r))}lt(e,r){return this.setLimit("max",e,!1,R.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&oe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Eo.create=t=>new Eo({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...K(t)});var Oo=class t extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==E.bigint)return this._getInvalidInput(e);let n,o=new Le;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):oe.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return I(r,{code:k.invalid_type,expected:E.bigint,received:r.parsedType}),q}gte(e,r){return this.setLimit("min",e,!0,R.toString(r))}gt(e,r){return this.setLimit("min",e,!1,R.toString(r))}lte(e,r){return this.setLimit("max",e,!0,R.toString(r))}lt(e,r){return this.setLimit("max",e,!1,R.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Oo.create=t=>new Oo({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...K(t)});var jo=class extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.boolean,received:n.parsedType}),q}return We(e.data)}};jo.create=t=>new jo({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...K(t)});var No=class t extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.date,received:i.parsedType}),q}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_date}),q}let n=new Le,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):oe.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};No.create=t=>new No({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...K(t)});var Ro=class extends ee{_parse(e){if(this._getType(e)!==E.symbol){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.symbol,received:n.parsedType}),q}return We(e.data)}};Ro.create=t=>new Ro({typeName:Z.ZodSymbol,...K(t)});var xn=class extends ee{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.undefined,received:n.parsedType}),q}return We(e.data)}};xn.create=t=>new xn({typeName:Z.ZodUndefined,...K(t)});var kn=class extends ee{_parse(e){if(this._getType(e)!==E.null){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.null,received:n.parsedType}),q}return We(e.data)}};kn.create=t=>new kn({typeName:Z.ZodNull,...K(t)});var Co=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return We(e.data)}};Co.create=t=>new Co({typeName:Z.ZodAny,...K(t)});var vr=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};vr.create=t=>new vr({typeName:Z.ZodUnknown,...K(t)});var Ut=class extends ee{_parse(e){let r=this._getOrReturnCtx(e);return I(r,{code:k.invalid_type,expected:E.never,received:r.parsedType}),q}};Ut.create=t=>new Ut({typeName:Z.ZodNever,...K(t)});var Do=class extends ee{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.void,received:n.parsedType}),q}return We(e.data)}};Do.create=t=>new Do({typeName:Z.ZodVoid,...K(t)});var _r=class t extends ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==E.array)return I(r,{code:k.invalid_type,expected:E.array,received:r.parsedType}),q;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(I(r,{code:a?k.too_big:k.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(I(r,{code:k.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(I(r,{code:k.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new vt(r,a,r.path,s)))).then(a=>Le.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new vt(r,a,r.path,s)));return Le.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:R.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:R.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:R.toString(r)}})}nonempty(e){return this.min(1,e)}};_r.create=(t,e)=>new _r({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...K(e)});function $n(t){if(t instanceof ct){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Tt.create($n(n))}return new ct({...t._def,shape:()=>e})}else return t instanceof _r?new _r({...t._def,type:$n(t.element)}):t instanceof Tt?Tt.create($n(t.unwrap())):t instanceof tr?tr.create($n(t.unwrap())):t instanceof er?er.create(t.items.map(e=>$n(e))):t}var ct=class t extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=oe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==E.object){let u=this._getOrReturnCtx(e);return I(u,{code:k.invalid_type,expected:E.object,received:u.parsedType}),q}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ut&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new vt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ut){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(I(o,{code:k.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new vt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Le.mergeObjectSync(n,u)):Le.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:R.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of oe.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of oe.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return $n(this)}partial(e){let r={};for(let n of oe.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of oe.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Tt;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return mv(oe.objectKeys(this.shape))}};ct.create=(t,e)=>new ct({shape:()=>t,unknownKeys:"strip",catchall:Ut.create(),typeName:Z.ZodObject,...K(e)});ct.strictCreate=(t,e)=>new ct({shape:()=>t,unknownKeys:"strict",catchall:Ut.create(),typeName:Z.ZodObject,...K(e)});ct.lazycreate=(t,e)=>new ct({shape:t,unknownKeys:"strip",catchall:Ut.create(),typeName:Z.ZodObject,...K(e)});var Sn=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new st(s.ctx.common.issues));return I(r,{code:k.invalid_union,unionErrors:a}),q}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new st(c));return I(r,{code:k.invalid_union,unionErrors:s}),q}}get options(){return this._def.options}};Sn.create=(t,e)=>new Sn({options:t,typeName:Z.ZodUnion,...K(e)});var Qt=t=>t instanceof zn?Qt(t.schema):t instanceof Pt?Qt(t.innerType()):t instanceof In?[t.value]:t instanceof Tn?t.options:t instanceof Pn?oe.objectValues(t.enum):t instanceof En?Qt(t._def.innerType):t instanceof xn?[void 0]:t instanceof kn?[null]:t instanceof Tt?[void 0,...Qt(t.unwrap())]:t instanceof tr?[null,...Qt(t.unwrap())]:t instanceof Aa||t instanceof jn?Qt(t.unwrap()):t instanceof On?Qt(t._def.innerType):[],Tu=class t extends ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return I(r,{code:k.invalid_type,expected:E.object,received:r.parsedType}),q;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(I(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=Qt(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...K(n)})}};function Pu(t,e){let r=Yt(t),n=Yt(e);if(t===e)return{valid:!0,data:t};if(r===E.object&&n===E.object){let o=oe.objectKeys(e),i=oe.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=Pu(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=Pu(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===E.date&&n===E.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var wn=class extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(wu(i)||wu(a))return q;let s=Pu(i.value,a.value);return s.valid?((zu(i)||zu(a))&&r.dirty(),{status:r.value,value:s.data}):(I(n,{code:k.invalid_intersection_types}),q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};wn.create=(t,e,r)=>new wn({left:t,right:e,typeName:Z.ZodIntersection,...K(r)});var er=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.array)return I(n,{code:k.invalid_type,expected:E.array,received:n.parsedType}),q;if(n.data.length<this._def.items.length)return I(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new vt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Le.mergeArray(r,a)):Le.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};er.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er({items:t,typeName:Z.ZodTuple,rest:null,...K(e)})};var Eu=class t extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.object)return I(n,{code:k.invalid_type,expected:E.object,received:n.parsedType}),q;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new vt(n,s,n.path,s)),value:a._parse(new vt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Le.mergeObjectAsync(r,o):Le.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ee?new t({keyType:e,valueType:r,typeName:Z.ZodRecord,...K(n)}):new t({keyType:bn.create(),valueType:e,typeName:Z.ZodRecord,...K(r)})}},Ao=class extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.map)return I(n,{code:k.invalid_type,expected:E.map,received:n.parsedType}),q;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new vt(n,s,n.path,[u,"key"])),value:i._parse(new vt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return q;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return q;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Ao.create=(t,e,r)=>new Ao({valueType:e,keyType:t,typeName:Z.ZodMap,...K(r)});var Uo=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.set)return I(n,{code:k.invalid_type,expected:E.set,received:n.parsedType}),q;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(I(n,{code:k.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(I(n,{code:k.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return q;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new vt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:R.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:R.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Uo.create=(t,e)=>new Uo({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...K(e)});var Ou=class t extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.function)return I(r,{code:k.invalid_type,expected:E.function,received:r.parsedType}),q;function n(s,c){return Da({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,To(),gr].filter(u=>!!u),issueData:{code:k.invalid_arguments,argumentsError:c}})}function o(s,c){return Da({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,To(),gr].filter(u=>!!u),issueData:{code:k.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Lr){let s=this;return We(async function(...c){let u=new st([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return We(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new st([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new st([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:er.create(e).rest(vr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||er.create([]).rest(vr.create()),returns:r||vr.create(),typeName:Z.ZodFunction,...K(n)})}},zn=class extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};zn.create=(t,e)=>new zn({getter:t,typeName:Z.ZodLazy,...K(e)});var In=class extends ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return I(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:e.data}}get value(){return this._def.value}};In.create=(t,e)=>new In({value:t,typeName:Z.ZodLiteral,...K(e)});function mv(t,e){return new Tn({values:t,typeName:Z.ZodEnum,...K(e)})}var Tn=class t extends ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return I(r,{expected:oe.joinValues(n),received:r.parsedType,code:k.invalid_type}),q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return I(r,{received:r.data,code:k.invalid_enum_value,options:n}),q}return We(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Tn.create=mv;var Pn=class extends ee{_parse(e){let r=oe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==E.string&&n.parsedType!==E.number){let o=oe.objectValues(r);return I(n,{expected:oe.joinValues(o),received:n.parsedType,code:k.invalid_type}),q}if(this._cache||(this._cache=new Set(oe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=oe.objectValues(r);return I(n,{received:n.data,code:k.invalid_enum_value,options:o}),q}return We(e.data)}get enum(){return this._def.values}};Pn.create=(t,e)=>new Pn({values:t,typeName:Z.ZodNativeEnum,...K(e)});var Lr=class extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.promise&&r.common.async===!1)return I(r,{code:k.invalid_type,expected:E.promise,received:r.parsedType}),q;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return We(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Lr.create=(t,e)=>new Lr({type:t,typeName:Z.ZodPromise,...K(e)});var Pt=class extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{I(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return q;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?q:c.status==="dirty"?yn(c.value):r.value==="dirty"?yn(c.value):c});{if(r.value==="aborted")return q;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?q:s.status==="dirty"?yn(s.value):r.value==="dirty"?yn(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?q:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?q:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Mr(a))return q;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Mr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):q);oe.assertNever(o)}};Pt.create=(t,e,r)=>new Pt({schema:t,typeName:Z.ZodEffects,effect:e,...K(r)});Pt.createWithPreprocess=(t,e,r)=>new Pt({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...K(r)});var Tt=class extends ee{_parse(e){return this._getType(e)===E.undefined?We(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tt.create=(t,e)=>new Tt({innerType:t,typeName:Z.ZodOptional,...K(e)});var tr=class extends ee{_parse(e){return this._getType(e)===E.null?We(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tr.create=(t,e)=>new tr({innerType:t,typeName:Z.ZodNullable,...K(e)});var En=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};En.create=(t,e)=>new En({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var On=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Po(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};On.create=(t,e)=>new On({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});var Zo=class extends ee{_parse(e){if(this._getType(e)!==E.nan){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.nan,received:n.parsedType}),q}return{status:"valid",value:e.data}}};Zo.create=t=>new Zo({typeName:Z.ZodNaN,...K(t)});var Aa=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ua=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?q:i.status==="dirty"?(r.dirty(),yn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?q:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Z.ZodPipeline})}},jn=class extends ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Mr(o)&&(o.value=Object.freeze(o.value)),o);return Po(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};jn.create=(t,e)=>new jn({innerType:t,typeName:Z.ZodReadonly,...K(e)});var wC={object:ct.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var zC=bn.create,IC=Eo.create,TC=Zo.create,PC=Oo.create,EC=jo.create,OC=No.create,jC=Ro.create,NC=xn.create,RC=kn.create,CC=Co.create,DC=vr.create,AC=Ut.create,UC=Do.create,ZC=_r.create,V0=ct.create,MC=ct.strictCreate,LC=Sn.create,qC=Tu.create,FC=wn.create,VC=er.create,BC=Eu.create,JC=Ao.create,WC=Uo.create,GC=Ou.create,KC=zn.create,HC=In.create,XC=Tn.create,YC=Pn.create,QC=Lr.create,eD=Pt.create,tD=Tt.create,rD=tr.create,nD=Pt.createWithPreprocess,oD=Ua.create;var hv=Object.freeze({status:"aborted"});function m(t,e,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in s||(s[f]=u[f].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var Zt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Za={};function je(t){return t&&Object.assign(Za,t),Za}var S={};ho(S,{BIGINT_FORMAT_RANGES:()=>Lu,Class:()=>Nu,NUMBER_FORMAT_RANGES:()=>Mu,aborted:()=>xr,allowsEval:()=>Du,assert:()=>X0,assertEqual:()=>W0,assertIs:()=>K0,assertNever:()=>H0,assertNotEqual:()=>G0,assignProp:()=>$r,base64ToUint8Array:()=>kv,base64urlToUint8Array:()=>cz,cached:()=>Rn,captureStackTrace:()=>La,cleanEnum:()=>sz,cleanRegex:()=>qo,clone:()=>Ge,cloneDef:()=>Q0,createTransparentProxy:()=>iz,defineLazy:()=>H,esc:()=>Ma,escapeRegex:()=>_t,extend:()=>yv,finalizeIssue:()=>tt,floatSafeRemainder:()=>Ru,getElementAtPath:()=>ez,getEnumValues:()=>Lo,getLengthableOrigin:()=>Bo,getParsedType:()=>oz,getSizableOrigin:()=>Vo,hexToUint8Array:()=>lz,isObject:()=>Fr,isPlainObject:()=>br,issue:()=>Cn,joinValues:()=>M,jsonStringifyReplacer:()=>Nn,merge:()=>az,mergeDefs:()=>rr,normalizeParams:()=>T,nullish:()=>yr,numKeys:()=>nz,objectClone:()=>Y0,omit:()=>_v,optionalKeys:()=>Zu,parsedType:()=>F,partial:()=>bv,pick:()=>vv,prefixIssues:()=>ut,primitiveTypes:()=>Uu,promiseAllObject:()=>tz,propertyKeyTypes:()=>Fo,randomString:()=>rz,required:()=>xv,safeExtend:()=>$v,shallowClone:()=>Au,slugify:()=>Cu,stringifyPrimitive:()=>L,uint8ArrayToBase64:()=>Sv,uint8ArrayToBase64url:()=>uz,uint8ArrayToHex:()=>dz,unwrapMessage:()=>Mo});function W0(t){return t}function G0(t){return t}function K0(t){}function H0(t){throw new Error("Unexpected value in exhaustive check")}function X0(t){}function Lo(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function M(t,e="|"){return t.map(r=>L(r)).join(e)}function Nn(t,e){return typeof e=="bigint"?e.toString():e}function Rn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function yr(t){return t==null}function qo(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Ru(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var gv=Symbol("evaluating");function H(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==gv)return n===void 0&&(n=gv,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Y0(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function $r(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rr(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Q0(t){return rr(t._zod.def)}function ez(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function tz(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function rz(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Ma(t){return JSON.stringify(t)}function Cu(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var La="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Fr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Du=Rn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function br(t){if(Fr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Fr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Au(t){return br(t)?{...t}:Array.isArray(t)?[...t]:t}function nz(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var oz=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Fo=new Set(["string","number","symbol"]),Uu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function _t(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ge(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function T(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function iz(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function L(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Zu(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Mu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Lu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function vv(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=rr(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=r.shape[s])}return $r(this,"shape",a),a},checks:[]});return Ge(t,i)}function _v(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=rr(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return $r(this,"shape",a),a},checks:[]});return Ge(t,i)}function yv(t,e){if(!br(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=rr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return $r(this,"shape",i),i}});return Ge(t,o)}function $v(t,e){if(!br(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=rr(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return $r(this,"shape",n),n}});return Ge(t,r)}function az(t,e){let r=rr(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return $r(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Ge(t,r)}function bv(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=rr(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return $r(this,"shape",c),c},checks:[]});return Ge(e,a)}function xv(t,e,r){let n=rr(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return $r(this,"shape",i),i}});return Ge(e,n)}function xr(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function ut(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Mo(t){return typeof t=="string"?t:t?.message}function tt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Mo(t.inst?._zod.def?.error?.(t))??Mo(e?.error?.(t))??Mo(r.customError?.(t))??Mo(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Vo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Bo(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function F(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Cn(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function sz(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function kv(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Sv(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function cz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return kv(e+r)}function uz(t){return Sv(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function lz(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function dz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Nu=class{constructor(...e){}};var wv=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Nn,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},qa=m("$ZodError",wv),Jo=m("$ZodError",wv,{Parent:Error});function Fa(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Va(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var Wo=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Zt;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>tt(c,i,je())));throw La(s,o?.callee),s}return a.value},Go=Wo(Jo),Ko=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>tt(c,i,je())));throw La(s,o?.callee),s}return a.value},Ho=Ko(Jo),Xo=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Zt;return i.issues.length?{success:!1,error:new(t??qa)(i.issues.map(a=>tt(a,o,je())))}:{success:!0,data:i.value}},Dn=Xo(Jo),Yo=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>tt(a,o,je())))}:{success:!0,data:i.value}},Qo=Yo(Jo),zv=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wo(t)(e,r,o)};var Iv=t=>(e,r,n)=>Wo(t)(e,r,n);var Tv=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ko(t)(e,r,o)};var Pv=t=>async(e,r,n)=>Ko(t)(e,r,n);var Ev=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xo(t)(e,r,o)};var Ov=t=>(e,r,n)=>Xo(t)(e,r,n);var jv=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yo(t)(e,r,o)};var Nv=t=>async(e,r,n)=>Yo(t)(e,r,n);var yt={};ho(yt,{base64:()=>nl,base64url:()=>Ba,bigint:()=>ul,boolean:()=>dl,browserEmail:()=>$z,cidrv4:()=>tl,cidrv6:()=>rl,cuid:()=>qu,cuid2:()=>Fu,date:()=>il,datetime:()=>sl,domain:()=>kz,duration:()=>Gu,e164:()=>ol,email:()=>Hu,emoji:()=>Xu,extendedDuration:()=>pz,guid:()=>Ku,hex:()=>Sz,hostname:()=>xz,html5Email:()=>vz,idnEmail:()=>yz,integer:()=>ll,ipv4:()=>Yu,ipv6:()=>Qu,ksuid:()=>Ju,lowercase:()=>ml,mac:()=>el,md5_base64:()=>zz,md5_base64url:()=>Iz,md5_hex:()=>wz,nanoid:()=>Wu,null:()=>fl,number:()=>Ja,rfc5322Email:()=>_z,sha1_base64:()=>Pz,sha1_base64url:()=>Ez,sha1_hex:()=>Tz,sha256_base64:()=>jz,sha256_base64url:()=>Nz,sha256_hex:()=>Oz,sha384_base64:()=>Cz,sha384_base64url:()=>Dz,sha384_hex:()=>Rz,sha512_base64:()=>Uz,sha512_base64url:()=>Zz,sha512_hex:()=>Az,string:()=>cl,time:()=>al,ulid:()=>Vu,undefined:()=>pl,unicodeEmail:()=>Rv,uppercase:()=>hl,uuid:()=>Vr,uuid4:()=>mz,uuid6:()=>hz,uuid7:()=>gz,xid:()=>Bu});var qu=/^[cC][^\s-]{8,}$/,Fu=/^[0-9a-z]+$/,Vu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bu=/^[0-9a-vA-V]{20}$/,Ju=/^[A-Za-z0-9]{27}$/,Wu=/^[a-zA-Z0-9_-]{21}$/,Gu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ku=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,mz=Vr(4),hz=Vr(6),gz=Vr(7),Hu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vz=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_z=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Rv=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yz=Rv,$z=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,bz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Xu(){return new RegExp(bz,"u")}var Yu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,el=t=>{let e=_t(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},tl=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ba=/^[A-Za-z0-9_-]*$/,xz=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,kz=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ol=/^\+[1-9]\d{6,14}$/,Cv="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",il=new RegExp(`^${Cv}$`);function Dv(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function al(t){return new RegExp(`^${Dv(t)}$`)}function sl(t){let e=Dv({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Cv}T(?:${n})$`)}var cl=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},ul=/^-?\d+n?$/,ll=/^-?\d+$/,Ja=/^-?\d+(?:\.\d+)?$/,dl=/^(?:true|false)$/i,fl=/^null$/i;var pl=/^undefined$/i;var ml=/^[^A-Z]*$/,hl=/^[^a-z]*$/,Sz=/^[0-9a-fA-F]*$/;function ei(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ti(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var wz=/^[0-9a-fA-F]{32}$/,zz=ei(22,"=="),Iz=ti(22),Tz=/^[0-9a-fA-F]{40}$/,Pz=ei(27,"="),Ez=ti(27),Oz=/^[0-9a-fA-F]{64}$/,jz=ei(43,"="),Nz=ti(43),Rz=/^[0-9a-fA-F]{96}$/,Cz=ei(64,""),Dz=ti(64),Az=/^[0-9a-fA-F]{128}$/,Uz=ei(86,"=="),Zz=ti(86);var he=m("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Uv={number:"number",bigint:"bigint",object:"date"},gl=m("$ZodCheckLessThan",(t,e)=>{he.init(t,e);let r=Uv[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),vl=m("$ZodCheckGreaterThan",(t,e)=>{he.init(t,e);let r=Uv[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Zv=m("$ZodCheckMultipleOf",(t,e)=>{he.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Ru(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Mv=m("$ZodCheckNumberFormat",(t,e)=>{he.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=Mu[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=ll)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Lv=m("$ZodCheckBigIntFormat",(t,e)=>{he.init(t,e);let[r,n]=Lu[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),qv=m("$ZodCheckMaxSize",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Vo(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Fv=m("$ZodCheckMinSize",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Vo(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Vv=m("$ZodCheckSizeEquals",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Vo(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Bv=m("$ZodCheckMaxLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=Bo(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Jv=m("$ZodCheckMinLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=Bo(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Wv=m("$ZodCheckLengthEquals",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!yr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=Bo(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ri=m("$ZodCheckStringFormat",(t,e)=>{var r,n;he.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Gv=m("$ZodCheckRegex",(t,e)=>{ri.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Kv=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ml),ri.init(t,e)}),Hv=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=hl),ri.init(t,e)}),Xv=m("$ZodCheckIncludes",(t,e)=>{he.init(t,e);let r=_t(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Yv=m("$ZodCheckStartsWith",(t,e)=>{he.init(t,e);let r=new RegExp(`^${_t(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Qv=m("$ZodCheckEndsWith",(t,e)=>{he.init(t,e);let r=new RegExp(`.*${_t(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Av(t,e,r){t.issues.length&&e.issues.push(...ut(r,t.issues))}var e_=m("$ZodCheckProperty",(t,e)=>{he.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Av(o,r,e.property));Av(n,r,e.property)}}),t_=m("$ZodCheckMimeType",(t,e)=>{he.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),r_=m("$ZodCheckOverwrite",(t,e)=>{he.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Wa=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
46
+ `));let t=await av(" Username: "),e=await av(" Password: ");try{let r=await fetch(`${$0}/api/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:e})}),n=await r.json();(!r.ok||!n.token)&&(console.log(g.red(`
47
+ \u274C ${n.error||"Login failed"}`)),process.exit(1)),bn.mkdirSync(cv,{recursive:!0}),bn.writeFileSync(uv,n.token,{mode:384}),console.log(g.green(`
48
+ \u2713 Logged in. Token saved to ~/.synapse/token`))}catch(r){console.log(g.red(`
49
+ \u274C Connection failed: ${r.message}`)),process.exit(1)}}function dv(){try{bn.unlinkSync(uv),console.log(g.green(" \u2713 Logged out."))}catch{console.log(g.gray(" Already logged out."))}}var ie;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ie||(ie={}));var fv;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(fv||(fv={}));var E=ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),er=t=>{switch(typeof t){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(t)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(t)?E.array:t===null?E.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?E.promise:typeof Map<"u"&&t instanceof Map?E.map:typeof Set<"u"&&t instanceof Set?E.set:typeof Date<"u"&&t instanceof Date?E.date:E.object;default:return E.unknown}};var k=ie.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var ut=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=t=>new ut(t);var b0=(t,e)=>{let r;switch(t.code){case k.invalid_type:t.received===E.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ie.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${ie.joinValues(t.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ie.joinValues(t.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${ie.joinValues(t.options)}, received '${t.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ie.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case k.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case k.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=e.defaultError,ie.assertNever(t)}return{message:r}},_r=b0;var x0=_r;function jo(){return x0}var Ma=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function I(t,e){let r=jo(),n=Ma({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===_r?void 0:_r].filter(o=>!!o)});t.common.issues.push(n)}var Fe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return F;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return F;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},F=Object.freeze({status:"aborted"}),xn=t=>({status:"dirty",value:t}),Ke=t=>({status:"valid",value:t}),Tu=t=>t.status==="aborted",Pu=t=>t.status==="dirty",qr=t=>t.status==="valid",No=t=>typeof Promise<"u"&&t instanceof Promise;var C;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(C||(C={}));var yt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pv=(t,e)=>{if(qr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(t.common.issues);return this._error=r,this._error}}};function K(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var ee=class{get description(){return this._def.description}_getType(e){return er(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Fe,ctx:{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(No(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},o=this._parseSync({data:e,path:n.path,parent:n});return pv(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return qr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>qr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(No(o)?o:Promise.resolve(o));return pv(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:k.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Ot({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Et.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $r.create(this)}promise(){return Fr.create(this,this._def)}or(e){return In.create([this,e],this._def)}and(e){return Tn.create(this,e,this._def)}transform(e){return new Ot({...K(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Nn({...K(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new La({typeName:M.ZodBranded,type:this,...K(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Rn({...K(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qa.create(this,e)}readonly(){return Cn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},k0=/^c[^\s-]{8,}$/i,S0=/^[0-9a-z]+$/,w0=/^[0-9A-HJKMNP-TV-Z]{26}$/i,z0=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,I0=/^[a-z0-9_-]{21}$/i,T0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,P0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,E0=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,O0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Eu,j0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,N0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,R0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C0=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D0=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,A0=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",U0=new RegExp(`^${mv}$`);function hv(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Z0(t){return new RegExp(`^${hv(t)}$`)}function M0(t){let e=`${mv}T${hv(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function L0(t,e){return!!((e==="v4"||!e)&&j0.test(t)||(e==="v6"||!e)&&R0.test(t))}function q0(t,e){if(!T0.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function F0(t,e){return!!((e==="v4"||!e)&&N0.test(t)||(e==="v6"||!e)&&C0.test(t))}var Sn=class t extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.string,received:i.parsedType}),F}let n=new Fe,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")E0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"email",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Eu||(Eu=new RegExp(O0,"u")),Eu.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"emoji",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")z0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"uuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")I0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"nanoid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")k0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")S0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cuid2",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")w0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"ulid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),I(o,{validation:"url",code:k.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"regex",code:k.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?M0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?U0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Z0(i).test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{code:k.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?P0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"duration",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?L0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"ip",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?q0(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"jwt",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?F0(e.data,i.version)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"cidr",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?D0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"base64",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?A0.test(e.data)||(o=this._getOrReturnCtx(e,o),I(o,{validation:"base64url",code:k.invalid_string,message:i.message}),n.dirty()):ie.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:k.invalid_string,...C.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...C.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...C.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...C.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...C.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...C.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...C.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...C.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...C.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...C.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...C.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...C.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...C.errToObj(r)})}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Sn.create=t=>new Sn({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...K(t)});function V0(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var Ro=class t extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==E.number){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.number,received:i.parsedType}),F}let n,o=new Fe;for(let i of this._def.checks)i.kind==="int"?ie.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:k.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?V0(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_finite,message:i.message}),o.dirty()):ie.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,C.toString(r))}gt(e,r){return this.setLimit("min",e,!1,C.toString(r))}lte(e,r){return this.setLimit("max",e,!0,C.toString(r))}lt(e,r){return this.setLimit("max",e,!1,C.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:C.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ie.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Ro.create=t=>new Ro({checks:[],typeName:M.ZodNumber,coerce:t?.coerce||!1,...K(t)});var Co=class t extends ee{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==E.bigint)return this._getInvalidInput(e);let n,o=new Fe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ie.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return I(r,{code:k.invalid_type,expected:E.bigint,received:r.parsedType}),F}gte(e,r){return this.setLimit("min",e,!0,C.toString(r))}gt(e,r){return this.setLimit("min",e,!1,C.toString(r))}lte(e,r){return this.setLimit("max",e,!0,C.toString(r))}lt(e,r){return this.setLimit("max",e,!1,C.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:C.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Co.create=t=>new Co({checks:[],typeName:M.ZodBigInt,coerce:t?.coerce??!1,...K(t)});var Do=class extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.boolean,received:n.parsedType}),F}return Ke(e.data)}};Do.create=t=>new Do({typeName:M.ZodBoolean,coerce:t?.coerce||!1,...K(t)});var Ao=class t extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_type,expected:E.date,received:i.parsedType}),F}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_date}),F}let n=new Fe,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),I(o,{code:k.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ie.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Ao.create=t=>new Ao({checks:[],coerce:t?.coerce||!1,typeName:M.ZodDate,...K(t)});var Uo=class extends ee{_parse(e){if(this._getType(e)!==E.symbol){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.symbol,received:n.parsedType}),F}return Ke(e.data)}};Uo.create=t=>new Uo({typeName:M.ZodSymbol,...K(t)});var wn=class extends ee{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.undefined,received:n.parsedType}),F}return Ke(e.data)}};wn.create=t=>new wn({typeName:M.ZodUndefined,...K(t)});var zn=class extends ee{_parse(e){if(this._getType(e)!==E.null){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.null,received:n.parsedType}),F}return Ke(e.data)}};zn.create=t=>new zn({typeName:M.ZodNull,...K(t)});var Zo=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Ke(e.data)}};Zo.create=t=>new Zo({typeName:M.ZodAny,...K(t)});var yr=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ke(e.data)}};yr.create=t=>new yr({typeName:M.ZodUnknown,...K(t)});var Lt=class extends ee{_parse(e){let r=this._getOrReturnCtx(e);return I(r,{code:k.invalid_type,expected:E.never,received:r.parsedType}),F}};Lt.create=t=>new Lt({typeName:M.ZodNever,...K(t)});var Mo=class extends ee{_parse(e){if(this._getType(e)!==E.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.void,received:n.parsedType}),F}return Ke(e.data)}};Mo.create=t=>new Mo({typeName:M.ZodVoid,...K(t)});var $r=class t extends ee{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==E.array)return I(r,{code:k.invalid_type,expected:E.array,received:r.parsedType}),F;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(I(r,{code:a?k.too_big:k.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(I(r,{code:k.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(I(r,{code:k.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new yt(r,a,r.path,s)))).then(a=>Fe.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new yt(r,a,r.path,s)));return Fe.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:C.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:C.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:C.toString(r)}})}nonempty(e){return this.min(1,e)}};$r.create=(t,e)=>new $r({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...K(e)});function kn(t){if(t instanceof lt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Et.create(kn(n))}return new lt({...t._def,shape:()=>e})}else return t instanceof $r?new $r({...t._def,type:kn(t.element)}):t instanceof Et?Et.create(kn(t.unwrap())):t instanceof nr?nr.create(kn(t.unwrap())):t instanceof rr?rr.create(t.items.map(e=>kn(e))):t}var lt=class t extends ee{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ie.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==E.object){let u=this._getOrReturnCtx(e);return I(u,{code:k.invalid_type,expected:E.object,received:u.parsedType}),F}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Lt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new yt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Lt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(I(o,{code:k.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new yt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Fe.mergeObjectSync(n,u)):Fe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:C.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ie.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ie.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return kn(this)}partial(e){let r={};for(let n of ie.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ie.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Et;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return gv(ie.objectKeys(this.shape))}};lt.create=(t,e)=>new lt({shape:()=>t,unknownKeys:"strip",catchall:Lt.create(),typeName:M.ZodObject,...K(e)});lt.strictCreate=(t,e)=>new lt({shape:()=>t,unknownKeys:"strict",catchall:Lt.create(),typeName:M.ZodObject,...K(e)});lt.lazycreate=(t,e)=>new lt({shape:t,unknownKeys:"strip",catchall:Lt.create(),typeName:M.ZodObject,...K(e)});var In=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new ut(s.ctx.common.issues));return I(r,{code:k.invalid_union,unionErrors:a}),F}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new ut(c));return I(r,{code:k.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};In.create=(t,e)=>new In({options:t,typeName:M.ZodUnion,...K(e)});var tr=t=>t instanceof Pn?tr(t.schema):t instanceof Ot?tr(t.innerType()):t instanceof En?[t.value]:t instanceof On?t.options:t instanceof jn?ie.objectValues(t.enum):t instanceof Nn?tr(t._def.innerType):t instanceof wn?[void 0]:t instanceof zn?[null]:t instanceof Et?[void 0,...tr(t.unwrap())]:t instanceof nr?[null,...tr(t.unwrap())]:t instanceof La||t instanceof Cn?tr(t.unwrap()):t instanceof Rn?tr(t._def.innerType):[],Ou=class t extends ee{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return I(r,{code:k.invalid_type,expected:E.object,received:r.parsedType}),F;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(I(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=tr(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:M.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...K(n)})}};function ju(t,e){let r=er(t),n=er(e);if(t===e)return{valid:!0,data:t};if(r===E.object&&n===E.object){let o=ie.objectKeys(e),i=ie.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=ju(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=ju(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===E.date&&n===E.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Tn=class extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Tu(i)||Tu(a))return F;let s=ju(i.value,a.value);return s.valid?((Pu(i)||Pu(a))&&r.dirty(),{status:r.value,value:s.data}):(I(n,{code:k.invalid_intersection_types}),F)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Tn.create=(t,e,r)=>new Tn({left:t,right:e,typeName:M.ZodIntersection,...K(r)});var rr=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.array)return I(n,{code:k.invalid_type,expected:E.array,received:n.parsedType}),F;if(n.data.length<this._def.items.length)return I(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new yt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Fe.mergeArray(r,a)):Fe.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};rr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rr({items:t,typeName:M.ZodTuple,rest:null,...K(e)})};var Nu=class t extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.object)return I(n,{code:k.invalid_type,expected:E.object,received:n.parsedType}),F;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new yt(n,s,n.path,s)),value:a._parse(new yt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Fe.mergeObjectAsync(r,o):Fe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ee?new t({keyType:e,valueType:r,typeName:M.ZodRecord,...K(n)}):new t({keyType:Sn.create(),valueType:e,typeName:M.ZodRecord,...K(r)})}},Lo=class extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.map)return I(n,{code:k.invalid_type,expected:E.map,received:n.parsedType}),F;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new yt(n,s,n.path,[u,"key"])),value:i._parse(new yt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Lo.create=(t,e,r)=>new Lo({valueType:e,keyType:t,typeName:M.ZodMap,...K(r)});var qo=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==E.set)return I(n,{code:k.invalid_type,expected:E.set,received:n.parsedType}),F;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(I(n,{code:k.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(I(n,{code:k.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return F;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new yt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:C.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:C.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};qo.create=(t,e)=>new qo({valueType:t,minSize:null,maxSize:null,typeName:M.ZodSet,...K(e)});var Ru=class t extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.function)return I(r,{code:k.invalid_type,expected:E.function,received:r.parsedType}),F;function n(s,c){return Ma({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jo(),_r].filter(u=>!!u),issueData:{code:k.invalid_arguments,argumentsError:c}})}function o(s,c){return Ma({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jo(),_r].filter(u=>!!u),issueData:{code:k.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Fr){let s=this;return Ke(async function(...c){let u=new ut([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Ke(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new ut([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new ut([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:rr.create(e).rest(yr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||rr.create([]).rest(yr.create()),returns:r||yr.create(),typeName:M.ZodFunction,...K(n)})}},Pn=class extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Pn.create=(t,e)=>new Pn({getter:t,typeName:M.ZodLazy,...K(e)});var En=class extends ee{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return I(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};En.create=(t,e)=>new En({value:t,typeName:M.ZodLiteral,...K(e)});function gv(t,e){return new On({values:t,typeName:M.ZodEnum,...K(e)})}var On=class t extends ee{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return I(r,{expected:ie.joinValues(n),received:r.parsedType,code:k.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return I(r,{received:r.data,code:k.invalid_enum_value,options:n}),F}return Ke(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};On.create=gv;var jn=class extends ee{_parse(e){let r=ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==E.string&&n.parsedType!==E.number){let o=ie.objectValues(r);return I(n,{expected:ie.joinValues(o),received:n.parsedType,code:k.invalid_type}),F}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ie.objectValues(r);return I(n,{received:n.data,code:k.invalid_enum_value,options:o}),F}return Ke(e.data)}get enum(){return this._def.values}};jn.create=(t,e)=>new jn({values:t,typeName:M.ZodNativeEnum,...K(e)});var Fr=class extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==E.promise&&r.common.async===!1)return I(r,{code:k.invalid_type,expected:E.promise,received:r.parsedType}),F;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Ke(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fr.create=(t,e)=>new Fr({type:t,typeName:M.ZodPromise,...K(e)});var Ot=class extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{I(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return F;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?F:c.status==="dirty"?xn(c.value):r.value==="dirty"?xn(c.value):c});{if(r.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?F:s.status==="dirty"?xn(s.value):r.value==="dirty"?xn(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?F:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?F:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!qr(a))return F;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>qr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):F);ie.assertNever(o)}};Ot.create=(t,e,r)=>new Ot({schema:t,typeName:M.ZodEffects,effect:e,...K(r)});Ot.createWithPreprocess=(t,e,r)=>new Ot({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...K(r)});var Et=class extends ee{_parse(e){return this._getType(e)===E.undefined?Ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Et.create=(t,e)=>new Et({innerType:t,typeName:M.ZodOptional,...K(e)});var nr=class extends ee{_parse(e){return this._getType(e)===E.null?Ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(t,e)=>new nr({innerType:t,typeName:M.ZodNullable,...K(e)});var Nn=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nn.create=(t,e)=>new Nn({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var Rn=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return No(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Rn.create=(t,e)=>new Rn({innerType:t,typeName:M.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});var Fo=class extends ee{_parse(e){if(this._getType(e)!==E.nan){let n=this._getOrReturnCtx(e);return I(n,{code:k.invalid_type,expected:E.nan,received:n.parsedType}),F}return{status:"valid",value:e.data}}};Fo.create=t=>new Fo({typeName:M.ZodNaN,...K(t)});var La=class extends ee{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},qa=class t extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?F:i.status==="dirty"?(r.dirty(),xn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?F:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:M.ZodPipeline})}},Cn=class extends ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(qr(o)&&(o.value=Object.freeze(o.value)),o);return No(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Cn.create=(t,e)=>new Cn({innerType:t,typeName:M.ZodReadonly,...K(e)});var IC={object:lt.lazycreate},M;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(M||(M={}));var TC=Sn.create,PC=Ro.create,EC=Fo.create,OC=Co.create,jC=Do.create,NC=Ao.create,RC=Uo.create,CC=wn.create,DC=zn.create,AC=Zo.create,UC=yr.create,ZC=Lt.create,MC=Mo.create,LC=$r.create,B0=lt.create,qC=lt.strictCreate,FC=In.create,VC=Ou.create,BC=Tn.create,JC=rr.create,WC=Nu.create,GC=Lo.create,KC=qo.create,HC=Ru.create,XC=Pn.create,YC=En.create,QC=On.create,eD=jn.create,tD=Fr.create,rD=Ot.create,nD=Et.create,oD=nr.create,iD=Ot.createWithPreprocess,aD=qa.create;var vv=Object.freeze({status:"aborted"});function m(t,e,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var qt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Vr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Fa={};function Re(t){return t&&Object.assign(Fa,t),Fa}var S={};vo(S,{BIGINT_FORMAT_RANGES:()=>Vu,Class:()=>Du,NUMBER_FORMAT_RANGES:()=>Fu,aborted:()=>Sr,allowsEval:()=>Zu,assert:()=>Y0,assertEqual:()=>G0,assertIs:()=>H0,assertNever:()=>X0,assertNotEqual:()=>K0,assignProp:()=>xr,base64ToUint8Array:()=>wv,base64urlToUint8Array:()=>uz,cached:()=>An,captureStackTrace:()=>Ba,cleanEnum:()=>cz,cleanRegex:()=>Jo,clone:()=>He,cloneDef:()=>ez,createTransparentProxy:()=>az,defineLazy:()=>H,esc:()=>Va,escapeRegex:()=>$t,extend:()=>bv,finalizeIssue:()=>nt,floatSafeRemainder:()=>Au,getElementAtPath:()=>tz,getEnumValues:()=>Bo,getLengthableOrigin:()=>Ko,getParsedType:()=>iz,getSizableOrigin:()=>Go,hexToUint8Array:()=>dz,isObject:()=>Br,isPlainObject:()=>kr,issue:()=>Un,joinValues:()=>L,jsonStringifyReplacer:()=>Dn,merge:()=>sz,mergeDefs:()=>or,normalizeParams:()=>T,nullish:()=>br,numKeys:()=>oz,objectClone:()=>Q0,omit:()=>$v,optionalKeys:()=>qu,parsedType:()=>V,partial:()=>kv,pick:()=>yv,prefixIssues:()=>dt,primitiveTypes:()=>Lu,promiseAllObject:()=>rz,propertyKeyTypes:()=>Wo,randomString:()=>nz,required:()=>Sv,safeExtend:()=>xv,shallowClone:()=>Mu,slugify:()=>Uu,stringifyPrimitive:()=>q,uint8ArrayToBase64:()=>zv,uint8ArrayToBase64url:()=>lz,uint8ArrayToHex:()=>fz,unwrapMessage:()=>Vo});function G0(t){return t}function K0(t){return t}function H0(t){}function X0(t){throw new Error("Unexpected value in exhaustive check")}function Y0(t){}function Bo(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function L(t,e="|"){return t.map(r=>q(r)).join(e)}function Dn(t,e){return typeof e=="bigint"?e.toString():e}function An(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function br(t){return t==null}function Jo(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Au(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var _v=Symbol("evaluating");function H(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==_v)return n===void 0&&(n=_v,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Q0(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function xr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function or(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function ez(t){return or(t._zod.def)}function tz(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function rz(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function nz(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Va(t){return JSON.stringify(t)}function Uu(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ba="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Br(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Zu=An(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function kr(t){if(Br(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Br(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mu(t){return kr(t)?{...t}:Array.isArray(t)?[...t]:t}function oz(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var iz=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Wo=new Set(["string","number","symbol"]),Lu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function $t(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function He(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function T(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function az(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function q(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function qu(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Fu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Vu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yv(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=or(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=r.shape[s])}return xr(this,"shape",a),a},checks:[]});return He(t,i)}function $v(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=or(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return xr(this,"shape",a),a},checks:[]});return He(t,i)}function bv(t,e){if(!kr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=or(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return xr(this,"shape",i),i}});return He(t,o)}function xv(t,e){if(!kr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=or(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return xr(this,"shape",n),n}});return He(t,r)}function sz(t,e){let r=or(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return xr(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return He(t,r)}function kv(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=or(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return xr(this,"shape",c),c},checks:[]});return He(e,a)}function Sv(t,e,r){let n=or(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return xr(this,"shape",i),i}});return He(e,n)}function Sr(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function dt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Vo(t){return typeof t=="string"?t:t?.message}function nt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Vo(t.inst?._zod.def?.error?.(t))??Vo(e?.error?.(t))??Vo(r.customError?.(t))??Vo(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Go(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ko(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function V(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Un(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function cz(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function wv(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function zv(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function uz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return wv(e+r)}function lz(t){return zv(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function dz(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function fz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Du=class{constructor(...e){}};var Iv=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Dn,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Ja=m("$ZodError",Iv),Ho=m("$ZodError",Iv,{Parent:Error});function Wa(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Ga(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var Xo=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new qt;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>nt(c,i,Re())));throw Ba(s,o?.callee),s}return a.value},Yo=Xo(Ho),Qo=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>nt(c,i,Re())));throw Ba(s,o?.callee),s}return a.value},ei=Qo(Ho),ti=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new qt;return i.issues.length?{success:!1,error:new(t??Ja)(i.issues.map(a=>nt(a,o,Re())))}:{success:!0,data:i.value}},Zn=ti(Ho),ri=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>nt(a,o,Re())))}:{success:!0,data:i.value}},ni=ri(Ho),Tv=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xo(t)(e,r,o)};var Pv=t=>(e,r,n)=>Xo(t)(e,r,n);var Ev=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qo(t)(e,r,o)};var Ov=t=>async(e,r,n)=>Qo(t)(e,r,n);var jv=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ti(t)(e,r,o)};var Nv=t=>(e,r,n)=>ti(t)(e,r,n);var Rv=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ri(t)(e,r,o)};var Cv=t=>async(e,r,n)=>ri(t)(e,r,n);var bt={};vo(bt,{base64:()=>al,base64url:()=>Ka,bigint:()=>fl,boolean:()=>ml,browserEmail:()=>bz,cidrv4:()=>ol,cidrv6:()=>il,cuid:()=>Bu,cuid2:()=>Ju,date:()=>cl,datetime:()=>ll,domain:()=>Sz,duration:()=>Xu,e164:()=>sl,email:()=>Qu,emoji:()=>el,extendedDuration:()=>mz,guid:()=>Yu,hex:()=>wz,hostname:()=>kz,html5Email:()=>_z,idnEmail:()=>$z,integer:()=>pl,ipv4:()=>tl,ipv6:()=>rl,ksuid:()=>Ku,lowercase:()=>vl,mac:()=>nl,md5_base64:()=>Iz,md5_base64url:()=>Tz,md5_hex:()=>zz,nanoid:()=>Hu,null:()=>hl,number:()=>Ha,rfc5322Email:()=>yz,sha1_base64:()=>Ez,sha1_base64url:()=>Oz,sha1_hex:()=>Pz,sha256_base64:()=>Nz,sha256_base64url:()=>Rz,sha256_hex:()=>jz,sha384_base64:()=>Dz,sha384_base64url:()=>Az,sha384_hex:()=>Cz,sha512_base64:()=>Zz,sha512_base64url:()=>Mz,sha512_hex:()=>Uz,string:()=>dl,time:()=>ul,ulid:()=>Wu,undefined:()=>gl,unicodeEmail:()=>Dv,uppercase:()=>_l,uuid:()=>Jr,uuid4:()=>hz,uuid6:()=>gz,uuid7:()=>vz,xid:()=>Gu});var Bu=/^[cC][^\s-]{8,}$/,Ju=/^[0-9a-z]+$/,Wu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gu=/^[0-9a-vA-V]{20}$/,Ku=/^[A-Za-z0-9]{27}$/,Hu=/^[a-zA-Z0-9_-]{21}$/,Xu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Yu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,hz=Jr(4),gz=Jr(6),vz=Jr(7),Qu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_z=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yz=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Dv=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,$z=Dv,bz=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,xz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function el(){return new RegExp(xz,"u")}var tl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nl=t=>{let e=$t(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},ol=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,il=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,al=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ka=/^[A-Za-z0-9_-]*$/,kz=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Sz=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,sl=/^\+[1-9]\d{6,14}$/,Av="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",cl=new RegExp(`^${Av}$`);function Uv(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ul(t){return new RegExp(`^${Uv(t)}$`)}function ll(t){let e=Uv({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Av}T(?:${n})$`)}var dl=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},fl=/^-?\d+n?$/,pl=/^-?\d+$/,Ha=/^-?\d+(?:\.\d+)?$/,ml=/^(?:true|false)$/i,hl=/^null$/i;var gl=/^undefined$/i;var vl=/^[^A-Z]*$/,_l=/^[^a-z]*$/,wz=/^[0-9a-fA-F]*$/;function oi(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ii(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var zz=/^[0-9a-fA-F]{32}$/,Iz=oi(22,"=="),Tz=ii(22),Pz=/^[0-9a-fA-F]{40}$/,Ez=oi(27,"="),Oz=ii(27),jz=/^[0-9a-fA-F]{64}$/,Nz=oi(43,"="),Rz=ii(43),Cz=/^[0-9a-fA-F]{96}$/,Dz=oi(64,""),Az=ii(64),Uz=/^[0-9a-fA-F]{128}$/,Zz=oi(86,"=="),Mz=ii(86);var ge=m("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Mv={number:"number",bigint:"bigint",object:"date"},yl=m("$ZodCheckLessThan",(t,e)=>{ge.init(t,e);let r=Mv[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),$l=m("$ZodCheckGreaterThan",(t,e)=>{ge.init(t,e);let r=Mv[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Lv=m("$ZodCheckMultipleOf",(t,e)=>{ge.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Au(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),qv=m("$ZodCheckNumberFormat",(t,e)=>{ge.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=Fu[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=pl)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Fv=m("$ZodCheckBigIntFormat",(t,e)=>{ge.init(t,e);let[r,n]=Vu[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),Vv=m("$ZodCheckMaxSize",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Go(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Bv=m("$ZodCheckMinSize",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Go(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Jv=m("$ZodCheckSizeEquals",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Go(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Wv=m("$ZodCheckMaxLength",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=Ko(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Gv=m("$ZodCheckMinLength",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=Ko(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Kv=m("$ZodCheckLengthEquals",(t,e)=>{var r;ge.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!br(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=Ko(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ai=m("$ZodCheckStringFormat",(t,e)=>{var r,n;ge.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Hv=m("$ZodCheckRegex",(t,e)=>{ai.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Xv=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=vl),ai.init(t,e)}),Yv=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=_l),ai.init(t,e)}),Qv=m("$ZodCheckIncludes",(t,e)=>{ge.init(t,e);let r=$t(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),e_=m("$ZodCheckStartsWith",(t,e)=>{ge.init(t,e);let r=new RegExp(`^${$t(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),t_=m("$ZodCheckEndsWith",(t,e)=>{ge.init(t,e);let r=new RegExp(`.*${$t(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Zv(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues))}var r_=m("$ZodCheckProperty",(t,e)=>{ge.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Zv(o,r,e.property));Zv(n,r,e.property)}}),n_=m("$ZodCheckMimeType",(t,e)=>{ge.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),o_=m("$ZodCheckOverwrite",(t,e)=>{ge.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Xa=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
50
50
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
51
- `))}};var o_={major:4,minor:3,patch:6};var W=m("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=o_;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=xr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new Zt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=xr(a,f)))});else{if(a.issues.length===f)continue;u||(u=xr(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(xr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new Zt;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new Zt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}H(t,"~standard",()=>({validate:o=>{try{let i=Dn(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Qo(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Br=m("$ZodString",(t,e)=>{W.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??cl(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),fe=m("$ZodStringFormat",(t,e)=>{ri.init(t,e),Br.init(t,e)}),yl=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Ku),fe.init(t,e)}),$l=m("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Vr(n))}else e.pattern??(e.pattern=Vr());fe.init(t,e)}),bl=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Hu),fe.init(t,e)}),xl=m("$ZodURL",(t,e)=>{fe.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),kl=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Xu()),fe.init(t,e)}),Sl=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Wu),fe.init(t,e)}),wl=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=qu),fe.init(t,e)}),zl=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Fu),fe.init(t,e)}),Il=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Vu),fe.init(t,e)}),Tl=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Bu),fe.init(t,e)}),Pl=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ju),fe.init(t,e)}),El=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=sl(e)),fe.init(t,e)}),Ol=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=il),fe.init(t,e)}),jl=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=al(e)),fe.init(t,e)}),Nl=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Gu),fe.init(t,e)}),Rl=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Yu),fe.init(t,e),t._zod.bag.format="ipv4"}),Cl=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Qu),fe.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Dl=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=el(e.delimiter)),fe.init(t,e),t._zod.bag.format="mac"}),Al=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=tl),fe.init(t,e)}),Ul=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=rl),fe.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function g_(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Zl=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=nl),fe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{g_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Mz(t){if(!Ba.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return g_(r)}var Ml=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ba),fe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Mz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ll=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=ol),fe.init(t,e)});function Lz(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var ql=m("$ZodJWT",(t,e)=>{fe.init(t,e),t._zod.check=r=>{Lz(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Fl=m("$ZodCustomStringFormat",(t,e)=>{fe.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),Qa=m("$ZodNumber",(t,e)=>{W.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ja,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),Vl=m("$ZodNumberFormat",(t,e)=>{Mv.init(t,e),Qa.init(t,e)}),ni=m("$ZodBoolean",(t,e)=>{W.init(t,e),t._zod.pattern=dl,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),es=m("$ZodBigInt",(t,e)=>{W.init(t,e),t._zod.pattern=ul,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Bl=m("$ZodBigIntFormat",(t,e)=>{Lv.init(t,e),es.init(t,e)}),Jl=m("$ZodSymbol",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Wl=m("$ZodUndefined",(t,e)=>{W.init(t,e),t._zod.pattern=pl,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Gl=m("$ZodNull",(t,e)=>{W.init(t,e),t._zod.pattern=fl,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Kl=m("$ZodAny",(t,e)=>{W.init(t,e),t._zod.parse=r=>r}),Hl=m("$ZodUnknown",(t,e)=>{W.init(t,e),t._zod.parse=r=>r}),Xl=m("$ZodNever",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Yl=m("$ZodVoid",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Ql=m("$ZodDate",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function i_(t,e,r){t.issues.length&&e.issues.push(...ut(r,t.issues)),e.value[r]=t.value}var ed=m("$ZodArray",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>i_(u,r,a))):i_(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ya(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...ut(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function v_(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Zu(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function __(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let f=c.run({value:e[d],issues:[]},n);f instanceof Promise?t.push(f.then(p=>Ya(p,r,d,e,l))):Ya(f,r,d,e,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var y_=m("$ZodObject",(t,e)=>{if(W.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=Rn(()=>v_(e));H(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Fr,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],g=p._zod.optout==="optional",h=p._zod.run({value:u[f],issues:[]},c);h instanceof Promise?l.push(h.then(y=>Ya(y,s,f,u,g))):Ya(h,s,f,u,g)}return i?__(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),$_=m("$ZodObjectJIT",(t,e)=>{y_.init(t,e);let r=t._zod.parse,n=Rn(()=>v_(e)),o=f=>{let p=new Wa(["shape","payload","ctx"]),g=n.value,h=j=>{let z=Ma(j);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),w=0;for(let j of g.keys)y[j]=`key_${w++}`;p.write("const newResult = {};");for(let j of g.keys){let z=y[j],N=Ma(j),ce=f[j]?._zod?.optout==="optional";p.write(`const ${z} = ${h(j)};`),ce?p.write(`
52
- if (${z}.issues.length) {
53
- if (${N} in input) {
54
- payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
51
+ `))}};var a_={major:4,minor:3,patch:6};var W=m("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=a_;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=Sr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new qt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=Sr(a,p)))});else{if(a.issues.length===p)continue;u||(u=Sr(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Sr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new qt;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new qt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}H(t,"~standard",()=>({validate:o=>{try{let i=Zn(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ni(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Wr=m("$ZodString",(t,e)=>{W.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??dl(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),pe=m("$ZodStringFormat",(t,e)=>{ai.init(t,e),Wr.init(t,e)}),xl=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Yu),pe.init(t,e)}),kl=m("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Jr(n))}else e.pattern??(e.pattern=Jr());pe.init(t,e)}),Sl=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Qu),pe.init(t,e)}),wl=m("$ZodURL",(t,e)=>{pe.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),zl=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=el()),pe.init(t,e)}),Il=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Hu),pe.init(t,e)}),Tl=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Bu),pe.init(t,e)}),Pl=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Ju),pe.init(t,e)}),El=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Wu),pe.init(t,e)}),Ol=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Gu),pe.init(t,e)}),jl=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ku),pe.init(t,e)}),Nl=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ll(e)),pe.init(t,e)}),Rl=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=cl),pe.init(t,e)}),Cl=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ul(e)),pe.init(t,e)}),Dl=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Xu),pe.init(t,e)}),Al=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=tl),pe.init(t,e),t._zod.bag.format="ipv4"}),Ul=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=rl),pe.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Zl=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=nl(e.delimiter)),pe.init(t,e),t._zod.bag.format="mac"}),Ml=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ol),pe.init(t,e)}),Ll=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=il),pe.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function __(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ql=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=al),pe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{__(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Lz(t){if(!Ka.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return __(r)}var Fl=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ka),pe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Lz(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Vl=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=sl),pe.init(t,e)});function qz(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Bl=m("$ZodJWT",(t,e)=>{pe.init(t,e),t._zod.check=r=>{qz(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Jl=m("$ZodCustomStringFormat",(t,e)=>{pe.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ns=m("$ZodNumber",(t,e)=>{W.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ha,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),Wl=m("$ZodNumberFormat",(t,e)=>{qv.init(t,e),ns.init(t,e)}),si=m("$ZodBoolean",(t,e)=>{W.init(t,e),t._zod.pattern=ml,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),os=m("$ZodBigInt",(t,e)=>{W.init(t,e),t._zod.pattern=fl,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Gl=m("$ZodBigIntFormat",(t,e)=>{Fv.init(t,e),os.init(t,e)}),Kl=m("$ZodSymbol",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Hl=m("$ZodUndefined",(t,e)=>{W.init(t,e),t._zod.pattern=gl,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Xl=m("$ZodNull",(t,e)=>{W.init(t,e),t._zod.pattern=hl,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Yl=m("$ZodAny",(t,e)=>{W.init(t,e),t._zod.parse=r=>r}),Ql=m("$ZodUnknown",(t,e)=>{W.init(t,e),t._zod.parse=r=>r}),ed=m("$ZodNever",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),td=m("$ZodVoid",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),rd=m("$ZodDate",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function s_(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues)),e.value[r]=t.value}var nd=m("$ZodArray",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>s_(u,r,a))):s_(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function rs(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...dt(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function y_(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=qu(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function $_(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},n);p instanceof Promise?t.push(p.then(f=>rs(f,r,d,e,l))):rs(p,r,d,e,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var b_=m("$ZodObject",(t,e)=>{if(W.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=An(()=>y_(e));H(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Br,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],v=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then($=>rs($,s,p,u,v))):rs(h,s,p,u,v)}return i?$_(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),x_=m("$ZodObjectJIT",(t,e)=>{b_.init(t,e);let r=t._zod.parse,n=An(()=>y_(e)),o=p=>{let f=new Xa(["shape","payload","ctx"]),v=n.value,h=j=>{let U=Va(j);return`shape[${U}]._zod.run({ value: input[${U}], issues: [] }, ctx)`};f.write("const input = payload.value;");let $=Object.create(null),w=0;for(let j of v.keys)$[j]=`key_${w++}`;f.write("const newResult = {};");for(let j of v.keys){let U=$[j],z=Va(j),Ne=p[j]?._zod?.optout==="optional";f.write(`const ${U} = ${h(j)};`),Ne?f.write(`
52
+ if (${U}.issues.length) {
53
+ if (${z} in input) {
54
+ payload.issues = payload.issues.concat(${U}.issues.map(iss => ({
55
55
  ...iss,
56
- path: iss.path ? [${N}, ...iss.path] : [${N}]
56
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
57
57
  })));
58
58
  }
59
59
  }
60
60
 
61
- if (${z}.value === undefined) {
62
- if (${N} in input) {
63
- newResult[${N}] = undefined;
61
+ if (${U}.value === undefined) {
62
+ if (${z} in input) {
63
+ newResult[${z}] = undefined;
64
64
  }
65
65
  } else {
66
- newResult[${N}] = ${z}.value;
66
+ newResult[${z}] = ${U}.value;
67
67
  }
68
68
 
69
- `):p.write(`
70
- if (${z}.issues.length) {
71
- payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
69
+ `):f.write(`
70
+ if (${U}.issues.length) {
71
+ payload.issues = payload.issues.concat(${U}.issues.map(iss => ({
72
72
  ...iss,
73
- path: iss.path ? [${N}, ...iss.path] : [${N}]
73
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
74
74
  })));
75
75
  }
76
76
 
77
- if (${z}.value === undefined) {
78
- if (${N} in input) {
79
- newResult[${N}] = undefined;
77
+ if (${U}.value === undefined) {
78
+ if (${z} in input) {
79
+ newResult[${z}] = undefined;
80
80
  }
81
81
  } else {
82
- newResult[${N}] = ${z}.value;
82
+ newResult[${z}] = ${U}.value;
83
83
  }
84
84
 
85
- `)}p.write("payload.value = newResult;"),p.write("return payload;");let P=p.compile();return(j,z)=>P(f,j,z)},i,a=Fr,s=!Za.jitless,u=s&&Du.value,l=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let g=f.value;return a(g)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(e.shape)),f=i(f,p),l?__([],g,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),f)}});function a_(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!xr(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>tt(a,n,je())))}),e)}var oi=m("$ZodUnion",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),H(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),H(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>qo(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>a_(c,o,t,i)):a_(s,o,t,i)}});function s_(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>tt(a,n,je())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var td=m("$ZodXor",(t,e)=>{oi.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>s_(c,o,t,i)):s_(s,o,t,i)}}),rd=m("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,oi.init(t,e);let r=t._zod.parse;H(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Rn(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!Fr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),nd=m("$ZodIntersection",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>c_(r,c,u)):c_(r,i,a)}});function _l(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(br(t)&&br(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=_l(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=_l(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function c_(t,e,r){let n=new Map,o;for(let s of e.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&t.issues.push({...o,keys:i}),xr(t))return t;let a=_l(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}var ts=m("$ZodTuple",(t,e)=>{W.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(f=>Ga(f,n,u))):Ga(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let f=e.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Ga(p,n,u))):Ga(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ga(t,e,r){t.issues.length&&e.issues.push(...ut(r,t.issues)),e.value[r]=t.value}var od=m("$ZodRecord",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!br(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...ut(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...ut(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Ja.test(s)&&c.issues.length){let d=e.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>tt(d,n,je())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...ut(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...ut(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),id=m("$ZodMap",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{u_(l,d,r,a,o,t,n)})):u_(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function u_(t,e,r,n,o,i,a){t.issues.length&&(Fo.has(typeof n)?r.issues.push(...ut(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>tt(s,a,je()))})),e.issues.length&&(Fo.has(typeof n)?r.issues.push(...ut(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>tt(s,a,je()))})),r.value.set(t.value,e.value)}var ad=m("$ZodSet",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>l_(c,r))):l_(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function l_(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var sd=m("$ZodEnum",(t,e)=>{W.init(t,e);let r=Lo(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>Fo.has(typeof o)).map(o=>typeof o=="string"?_t(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),cd=m("$ZodLiteral",(t,e)=>{if(W.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?_t(n):n?_t(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),ud=m("$ZodFile",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),ld=m("$ZodTransform",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Zt;return r.value=o,r}});function d_(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var rs=m("$ZodOptional",(t,e)=>{W.init(t,e),t._zod.optin="optional",t._zod.optout="optional",H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${qo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>d_(i,r.value)):d_(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),dd=m("$ZodExactOptional",(t,e)=>{rs.init(t,e),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),fd=m("$ZodNullable",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${qo(r.source)}|null)$`):void 0}),H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),pd=m("$ZodDefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>f_(i,e)):f_(o,e)}});function f_(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var md=m("$ZodPrefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),hd=m("$ZodNonOptional",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>p_(i,t)):p_(o,t)}});function p_(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var gd=m("$ZodSuccess",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),vd=m("$ZodCatch",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>tt(a,n,je()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>tt(i,n,je()))},input:r.value}),r.issues=[]),r)}}),_d=m("$ZodNaN",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),yd=m("$ZodPipe",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),H(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ka(a,e.in,n)):Ka(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ka(i,e.out,n)):Ka(o,e.out,n)}});function Ka(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var ii=m("$ZodCodec",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),H(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ha(a,e,n)):Ha(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ha(a,e,n)):Ha(i,e,n)}}});function Ha(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Xa(t,i,e.out,r)):Xa(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Xa(t,i,e.in,r)):Xa(t,o,e.in,r)}}function Xa(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var $d=m("$ZodReadonly",(t,e)=>{W.init(t,e),H(t._zod,"propValues",()=>e.innerType._zod.propValues),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"optin",()=>e.innerType?._zod?.optin),H(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(m_):m_(o)}});function m_(t){return t.value=Object.freeze(t.value),t}var bd=m("$ZodTemplateLiteral",(t,e)=>{W.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Uu.has(typeof n))r.push(_t(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),xd=m("$ZodFunction",(t,e)=>(W.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Go(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Go(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Ho(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Ho(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new ts({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),kd=m("$ZodPromise",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),Sd=m("$ZodLazy",(t,e)=>{W.init(t,e),H(t._zod,"innerType",()=>e.getter()),H(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),H(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),H(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),H(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),wd=m("$ZodCustom",(t,e)=>{he.init(t,e),W.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>h_(i,r,n,t));h_(o,r,n,t)}});function h_(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Cn(o))}}var Fz=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=F(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${L(o.values[0])}`:`Invalid option: expected one of ${M(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${M(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function zd(){return{localeError:Fz()}}var b_;var Td=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pd(){return new Td}(b_=globalThis).__zod_globalRegistry??(b_.__zod_globalRegistry=Pd());var Ke=globalThis.__zod_globalRegistry;function Ed(t,e){return new t({type:"string",...T(e)})}function ns(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function ai(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function os(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function is(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function as(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function ss(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function si(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function cs(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function us(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function ls(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function ds(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function fs(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function ps(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function ms(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function hs(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function gs(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function Od(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...T(e)})}function vs(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function _s(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function ys(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function $s(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function bs(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function xs(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}function jd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function Nd(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function Rd(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function Cd(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function Dd(t,e){return new t({type:"number",checks:[],...T(e)})}function Ad(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function Ud(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...T(e)})}function Zd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...T(e)})}function Md(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...T(e)})}function Ld(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...T(e)})}function qd(t,e){return new t({type:"boolean",...T(e)})}function Fd(t,e){return new t({type:"bigint",...T(e)})}function Vd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(e)})}function Bd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(e)})}function Jd(t,e){return new t({type:"symbol",...T(e)})}function Wd(t,e){return new t({type:"undefined",...T(e)})}function Gd(t,e){return new t({type:"null",...T(e)})}function Kd(t){return new t({type:"any"})}function Hd(t){return new t({type:"unknown"})}function Xd(t,e){return new t({type:"never",...T(e)})}function Yd(t,e){return new t({type:"void",...T(e)})}function Qd(t,e){return new t({type:"date",...T(e)})}function ef(t,e){return new t({type:"nan",...T(e)})}function nr(t,e){return new gl({check:"less_than",...T(e),value:t,inclusive:!1})}function lt(t,e){return new gl({check:"less_than",...T(e),value:t,inclusive:!0})}function or(t,e){return new vl({check:"greater_than",...T(e),value:t,inclusive:!1})}function He(t,e){return new vl({check:"greater_than",...T(e),value:t,inclusive:!0})}function tf(t){return or(0,t)}function rf(t){return nr(0,t)}function nf(t){return lt(0,t)}function of(t){return He(0,t)}function Jr(t,e){return new Zv({check:"multiple_of",...T(e),value:t})}function Wr(t,e){return new qv({check:"max_size",...T(e),maximum:t})}function ir(t,e){return new Fv({check:"min_size",...T(e),minimum:t})}function An(t,e){return new Vv({check:"size_equals",...T(e),size:t})}function Un(t,e){return new Bv({check:"max_length",...T(e),maximum:t})}function kr(t,e){return new Jv({check:"min_length",...T(e),minimum:t})}function Zn(t,e){return new Wv({check:"length_equals",...T(e),length:t})}function ci(t,e){return new Gv({check:"string_format",format:"regex",...T(e),pattern:t})}function ui(t){return new Kv({check:"string_format",format:"lowercase",...T(t)})}function li(t){return new Hv({check:"string_format",format:"uppercase",...T(t)})}function di(t,e){return new Xv({check:"string_format",format:"includes",...T(e),includes:t})}function fi(t,e){return new Yv({check:"string_format",format:"starts_with",...T(e),prefix:t})}function pi(t,e){return new Qv({check:"string_format",format:"ends_with",...T(e),suffix:t})}function af(t,e,r){return new e_({check:"property",property:t,schema:e,...T(r)})}function mi(t,e){return new t_({check:"mime_type",mime:t,...T(e)})}function Mt(t){return new r_({check:"overwrite",tx:t})}function hi(t){return Mt(e=>e.normalize(t))}function gi(){return Mt(t=>t.trim())}function vi(){return Mt(t=>t.toLowerCase())}function _i(){return Mt(t=>t.toUpperCase())}function ks(){return Mt(t=>Cu(t))}function x_(t,e,r){return new t({type:"array",element:e,...T(r)})}function sf(t,e){return new t({type:"file",...T(e)})}function cf(t,e,r){let n=T(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function uf(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function lf(t){let e=Wz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Cn(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Cn(o))}},t(r.value,r)));return e}function Wz(t,e){let r=new he({check:"custom",...T(e)});return r._zod.check=t,r}function df(t){let e=new he({check:"describe"});return e._zod.onattach=[r=>{let n=Ke.get(r)??{};Ke.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function ff(t){let e=new he({check:"meta"});return e._zod.onattach=[r=>{let n=Ke.get(r)??{};Ke.add(r,{...n,...t})}],e._zod.check=()=>{},e}function pf(t,e){let r=T(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=t.Codec??ii,c=t.Boolean??ni,u=t.String??Br,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,g)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:f,continue:!1}),{})}),reverseTransform:((p,g)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function Mn(t,e,r,n={}){let o=T(n),i={...T(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function Ss(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Ke,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function $e(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let f=a.schema,p=e.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(t,e,f,l)}let d=t._zod.parent;d&&(a.ref||(a.ref=d),$e(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Xe(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function ws(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of t.seen.entries()){let s=t.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(a[0])?.id,f=t.external.uri??(g=>g);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let a of t.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
85
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(j,U)=>P(p,j,U)},i,a=Br,s=!Fa.jitless,u=s&&Zu.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let v=p.value;return a(v)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(e.shape)),p=i(p,f),l?$_([],v,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:v,inst:t}),p)}});function c_(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Sr(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>nt(a,n,Re())))}),e)}var ci=m("$ZodUnion",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),H(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),H(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Jo(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>c_(c,o,t,i)):c_(s,o,t,i)}});function u_(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>nt(a,n,Re())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var od=m("$ZodXor",(t,e)=>{ci.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>u_(c,o,t,i)):u_(s,o,t,i)}}),id=m("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ci.init(t,e);let r=t._zod.parse;H(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=An(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!Br(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),ad=m("$ZodIntersection",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>l_(r,c,u)):l_(r,i,a)}});function bl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(kr(t)&&kr(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=bl(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=bl(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function l_(t,e,r){let n=new Map,o;for(let s of e.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&t.issues.push({...o,keys:i}),Sr(t))return t;let a=bl(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}var is=m("$ZodTuple",(t,e)=>{W.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Ya(p,n,u))):Ya(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let p=e.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Ya(f,n,u))):Ya(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ya(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues)),e.value[r]=t.value}var sd=m("$ZodRecord",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!kr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...dt(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...dt(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Ha.test(s)&&c.issues.length){let d=e.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>nt(d,n,Re())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...dt(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...dt(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),cd=m("$ZodMap",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{d_(l,d,r,a,o,t,n)})):d_(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function d_(t,e,r,n,o,i,a){t.issues.length&&(Wo.has(typeof n)?r.issues.push(...dt(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>nt(s,a,Re()))})),e.issues.length&&(Wo.has(typeof n)?r.issues.push(...dt(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>nt(s,a,Re()))})),r.value.set(t.value,e.value)}var ud=m("$ZodSet",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>f_(c,r))):f_(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function f_(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var ld=m("$ZodEnum",(t,e)=>{W.init(t,e);let r=Bo(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>Wo.has(typeof o)).map(o=>typeof o=="string"?$t(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),dd=m("$ZodLiteral",(t,e)=>{if(W.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?$t(n):n?$t(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),fd=m("$ZodFile",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),pd=m("$ZodTransform",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new qt;return r.value=o,r}});function p_(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var as=m("$ZodOptional",(t,e)=>{W.init(t,e),t._zod.optin="optional",t._zod.optout="optional",H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Jo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>p_(i,r.value)):p_(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),md=m("$ZodExactOptional",(t,e)=>{as.init(t,e),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),hd=m("$ZodNullable",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Jo(r.source)}|null)$`):void 0}),H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),gd=m("$ZodDefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>m_(i,e)):m_(o,e)}});function m_(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var vd=m("$ZodPrefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),_d=m("$ZodNonOptional",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>h_(i,t)):h_(o,t)}});function h_(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var yd=m("$ZodSuccess",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),$d=m("$ZodCatch",(t,e)=>{W.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>nt(a,n,Re()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>nt(i,n,Re()))},input:r.value}),r.issues=[]),r)}}),bd=m("$ZodNaN",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),xd=m("$ZodPipe",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),H(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Qa(a,e.in,n)):Qa(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Qa(i,e.out,n)):Qa(o,e.out,n)}});function Qa(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var ui=m("$ZodCodec",(t,e)=>{W.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),H(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>es(a,e,n)):es(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>es(a,e,n)):es(i,e,n)}}});function es(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>ts(t,i,e.out,r)):ts(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>ts(t,i,e.in,r)):ts(t,o,e.in,r)}}function ts(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var kd=m("$ZodReadonly",(t,e)=>{W.init(t,e),H(t._zod,"propValues",()=>e.innerType._zod.propValues),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"optin",()=>e.innerType?._zod?.optin),H(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(g_):g_(o)}});function g_(t){return t.value=Object.freeze(t.value),t}var Sd=m("$ZodTemplateLiteral",(t,e)=>{W.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Lu.has(typeof n))r.push($t(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),wd=m("$ZodFunction",(t,e)=>(W.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Yo(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Yo(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await ei(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await ei(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new is({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),zd=m("$ZodPromise",(t,e)=>{W.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),Id=m("$ZodLazy",(t,e)=>{W.init(t,e),H(t._zod,"innerType",()=>e.getter()),H(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),H(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),H(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),H(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),Td=m("$ZodCustom",(t,e)=>{ge.init(t,e),W.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>v_(i,r,n,t));v_(o,r,n,t)}});function v_(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Un(o))}}var Vz=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=V(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${q(o.values[0])}`:`Invalid option: expected one of ${L(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${L(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Pd(){return{localeError:Vz()}}var k_;var Od=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function jd(){return new Od}(k_=globalThis).__zod_globalRegistry??(k_.__zod_globalRegistry=jd());var Xe=globalThis.__zod_globalRegistry;function Nd(t,e){return new t({type:"string",...T(e)})}function ss(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function li(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function cs(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function us(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function ls(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function ds(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function di(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function fs(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function ps(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function ms(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function hs(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function gs(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function vs(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function _s(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function ys(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function $s(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function Rd(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...T(e)})}function bs(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function xs(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function ks(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function Ss(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function ws(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function zs(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}function Cd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function Dd(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function Ad(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function Ud(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function Zd(t,e){return new t({type:"number",checks:[],...T(e)})}function Md(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function Ld(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...T(e)})}function qd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...T(e)})}function Fd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...T(e)})}function Vd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...T(e)})}function Bd(t,e){return new t({type:"boolean",...T(e)})}function Jd(t,e){return new t({type:"bigint",...T(e)})}function Wd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(e)})}function Gd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(e)})}function Kd(t,e){return new t({type:"symbol",...T(e)})}function Hd(t,e){return new t({type:"undefined",...T(e)})}function Xd(t,e){return new t({type:"null",...T(e)})}function Yd(t){return new t({type:"any"})}function Qd(t){return new t({type:"unknown"})}function ef(t,e){return new t({type:"never",...T(e)})}function tf(t,e){return new t({type:"void",...T(e)})}function rf(t,e){return new t({type:"date",...T(e)})}function nf(t,e){return new t({type:"nan",...T(e)})}function ir(t,e){return new yl({check:"less_than",...T(e),value:t,inclusive:!1})}function ft(t,e){return new yl({check:"less_than",...T(e),value:t,inclusive:!0})}function ar(t,e){return new $l({check:"greater_than",...T(e),value:t,inclusive:!1})}function Ye(t,e){return new $l({check:"greater_than",...T(e),value:t,inclusive:!0})}function of(t){return ar(0,t)}function af(t){return ir(0,t)}function sf(t){return ft(0,t)}function cf(t){return Ye(0,t)}function Gr(t,e){return new Lv({check:"multiple_of",...T(e),value:t})}function Kr(t,e){return new Vv({check:"max_size",...T(e),maximum:t})}function sr(t,e){return new Bv({check:"min_size",...T(e),minimum:t})}function Mn(t,e){return new Jv({check:"size_equals",...T(e),size:t})}function Ln(t,e){return new Wv({check:"max_length",...T(e),maximum:t})}function wr(t,e){return new Gv({check:"min_length",...T(e),minimum:t})}function qn(t,e){return new Kv({check:"length_equals",...T(e),length:t})}function fi(t,e){return new Hv({check:"string_format",format:"regex",...T(e),pattern:t})}function pi(t){return new Xv({check:"string_format",format:"lowercase",...T(t)})}function mi(t){return new Yv({check:"string_format",format:"uppercase",...T(t)})}function hi(t,e){return new Qv({check:"string_format",format:"includes",...T(e),includes:t})}function gi(t,e){return new e_({check:"string_format",format:"starts_with",...T(e),prefix:t})}function vi(t,e){return new t_({check:"string_format",format:"ends_with",...T(e),suffix:t})}function uf(t,e,r){return new r_({check:"property",property:t,schema:e,...T(r)})}function _i(t,e){return new n_({check:"mime_type",mime:t,...T(e)})}function Ft(t){return new o_({check:"overwrite",tx:t})}function yi(t){return Ft(e=>e.normalize(t))}function $i(){return Ft(t=>t.trim())}function bi(){return Ft(t=>t.toLowerCase())}function xi(){return Ft(t=>t.toUpperCase())}function Is(){return Ft(t=>Uu(t))}function S_(t,e,r){return new t({type:"array",element:e,...T(r)})}function lf(t,e){return new t({type:"file",...T(e)})}function df(t,e,r){let n=T(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function ff(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function pf(t){let e=Gz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Un(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Un(o))}},t(r.value,r)));return e}function Gz(t,e){let r=new ge({check:"custom",...T(e)});return r._zod.check=t,r}function mf(t){let e=new ge({check:"describe"});return e._zod.onattach=[r=>{let n=Xe.get(r)??{};Xe.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function hf(t){let e=new ge({check:"meta"});return e._zod.onattach=[r=>{let n=Xe.get(r)??{};Xe.add(r,{...n,...t})}],e._zod.check=()=>{},e}function gf(t,e){let r=T(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=t.Codec??ui,c=t.Boolean??si,u=t.String??Wr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,v)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:v.value,inst:p,continue:!1}),{})}),reverseTransform:((f,v)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function Fn(t,e,r,n={}){let o=T(n),i={...T(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function Ts(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Xe,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function xe(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let p=a.schema,f=e.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(a.ref||(a.ref=d),xe(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Qe(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function Ps(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of t.seen.entries()){let s=t.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(a[0])?.id,p=t.external.uri??(v=>v);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let a of t.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
86
86
 
87
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function zs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let f=t.seen.get(l),p=f.schema;if(p.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref&&f.def)for(let h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=t.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:yi(e,"input",t.processors),output:yi(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Xe(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Xe(n.element,r);if(n.type==="set")return Xe(n.valueType,r);if(n.type==="lazy")return Xe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Xe(n.innerType,r);if(n.type==="intersection")return Xe(n.left,r)||Xe(n.right,r);if(n.type==="record"||n.type==="map")return Xe(n.keyType,r)||Xe(n.valueType,r);if(n.type==="pipe")return Xe(n.in,r)||Xe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Xe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Xe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Xe(o,r))return!0;return!!(n.rest&&Xe(n.rest,r))}return!1}var k_=(t,e={})=>r=>{let n=Ss({...r,processors:e});return $e(t,n),ws(n,t),zs(n,t)},yi=(t,e,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Ss({...o??{},target:i,io:e,processors:r});return $e(t,a),ws(a,t),zs(a,t)};var Gz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},S_=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Gz[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},w_=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},z_=(t,e,r,n)=>{r.type="boolean"},I_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},T_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},P_=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},E_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},O_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},j_=(t,e,r,n)=>{r.not={}},N_=(t,e,r,n)=>{},R_=(t,e,r,n)=>{},C_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},D_=(t,e,r,n)=>{let o=t._zod.def,i=Lo(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},A_=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},U_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Z_=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},M_=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},L_=(t,e,r,n)=>{r.type="boolean"},q_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},F_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},V_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},B_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},J_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},W_=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=$e(i.element,e,{...n,path:[...n.path,"items"]})},G_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=$e(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=$e(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},mf=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>$e(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},K_=(t,e,r,n)=>{let o=t._zod.def,i=$e(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=$e(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},H_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((f,p)=>$e(f,e,{...n,path:[...n.path,a,p]})),u=i.rest?$e(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},X_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=$e(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=$e(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=$e(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Y_=(t,e,r,n)=>{let o=t._zod.def,i=$e(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Q_=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ey=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ty=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},ry=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},ny=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;$e(i,e,n);let a=e.seen.get(t);a.ref=i},oy=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},iy=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},hf=(t,e,r,n)=>{let o=t._zod.def;$e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ay=(t,e,r,n)=>{let o=t._zod.innerType;$e(o,e,n);let i=e.seen.get(t);i.ref=o};function Ln(t){return!!t._zod}function Ot(t,e){return Ln(t)?Dn(t,e):t.safeParse(e)}function Is(t){if(!t)return;let e;if(Ln(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ly(t){if(Ln(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var $i={};ho($i,{ZodAny:()=>Ty,ZodArray:()=>jy,ZodBase64:()=>Zf,ZodBase64URL:()=>Mf,ZodBigInt:()=>Ds,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Cs,ZodCIDRv4:()=>Af,ZodCIDRv6:()=>Uf,ZodCUID:()=>Ef,ZodCUID2:()=>Of,ZodCatch:()=>Yy,ZodCodec:()=>Hf,ZodCustom:()=>qs,ZodCustomStringFormat:()=>xi,ZodDate:()=>Bf,ZodDefault:()=>Jy,ZodDiscriminatedUnion:()=>Ry,ZodE164:()=>Lf,ZodEmail:()=>If,ZodEmoji:()=>Tf,ZodEnum:()=>bi,ZodExactOptional:()=>Fy,ZodFile:()=>Ly,ZodFunction:()=>s$,ZodGUID:()=>Ps,ZodIPv4:()=>Cf,ZodIPv6:()=>Df,ZodIntersection:()=>Cy,ZodJWT:()=>qf,ZodKSUID:()=>Rf,ZodLazy:()=>o$,ZodLiteral:()=>My,ZodMAC:()=>Sy,ZodMap:()=>Uy,ZodNaN:()=>e$,ZodNanoID:()=>Pf,ZodNever:()=>Ey,ZodNonOptional:()=>Gf,ZodNull:()=>Iy,ZodNullable:()=>By,ZodNumber:()=>Rs,ZodNumberFormat:()=>qn,ZodObject:()=>Us,ZodOptional:()=>Wf,ZodPipe:()=>Kf,ZodPrefault:()=>Gy,ZodPromise:()=>a$,ZodReadonly:()=>t$,ZodRecord:()=>Ls,ZodSet:()=>Zy,ZodString:()=>js,ZodStringFormat:()=>ge,ZodSuccess:()=>Xy,ZodSymbol:()=>wy,ZodTemplateLiteral:()=>n$,ZodTransform:()=>qy,ZodTuple:()=>Dy,ZodType:()=>X,ZodULID:()=>jf,ZodURL:()=>Ns,ZodUUID:()=>ar,ZodUndefined:()=>zy,ZodUnion:()=>Zs,ZodUnknown:()=>Py,ZodVoid:()=>Oy,ZodXID:()=>Nf,ZodXor:()=>Ny,_ZodString:()=>zf,_default:()=>Wy,_function:()=>fT,any:()=>GI,array:()=>re,base64:()=>OI,base64url:()=>jI,bigint:()=>FI,boolean:()=>Ee,catch:()=>Qy,check:()=>pT,cidrv4:()=>PI,cidrv6:()=>EI,codec:()=>uT,cuid:()=>bI,cuid2:()=>xI,custom:()=>Xf,date:()=>HI,describe:()=>mT,discriminatedUnion:()=>Ms,e164:()=>NI,email:()=>dI,emoji:()=>yI,enum:()=>Fe,exactOptional:()=>Vy,file:()=>iT,float32:()=>ZI,float64:()=>MI,function:()=>fT,guid:()=>fI,hash:()=>UI,hex:()=>AI,hostname:()=>DI,httpUrl:()=>_I,instanceof:()=>gT,int:()=>wf,int32:()=>LI,int64:()=>VI,intersection:()=>ki,ipv4:()=>zI,ipv6:()=>TI,json:()=>_T,jwt:()=>RI,keyof:()=>XI,ksuid:()=>wI,lazy:()=>i$,literal:()=>D,looseObject:()=>qe,looseRecord:()=>tT,mac:()=>II,map:()=>rT,meta:()=>hT,nan:()=>cT,nanoid:()=>$I,nativeEnum:()=>oT,never:()=>Vf,nonoptional:()=>Hy,null:()=>As,nullable:()=>Es,nullish:()=>aT,number:()=>le,object:()=>O,optional:()=>be,partialRecord:()=>eT,pipe:()=>Os,prefault:()=>Ky,preprocess:()=>Fs,promise:()=>dT,readonly:()=>r$,record:()=>pe,refine:()=>c$,set:()=>nT,strictObject:()=>YI,string:()=>_,stringFormat:()=>CI,stringbool:()=>vT,success:()=>sT,superRefine:()=>u$,symbol:()=>JI,templateLiteral:()=>lT,transform:()=>Jf,tuple:()=>Ay,uint32:()=>qI,uint64:()=>BI,ulid:()=>kI,undefined:()=>WI,union:()=>_e,unknown:()=>ve,url:()=>vI,uuid:()=>pI,uuidv4:()=>mI,uuidv6:()=>hI,uuidv7:()=>gI,void:()=>KI,xid:()=>SI,xor:()=>QI});var Ts={};ho(Ts,{endsWith:()=>pi,gt:()=>or,gte:()=>He,includes:()=>di,length:()=>Zn,lowercase:()=>ui,lt:()=>nr,lte:()=>lt,maxLength:()=>Un,maxSize:()=>Wr,mime:()=>mi,minLength:()=>kr,minSize:()=>ir,multipleOf:()=>Jr,negative:()=>rf,nonnegative:()=>of,nonpositive:()=>nf,normalize:()=>hi,overwrite:()=>Mt,positive:()=>tf,property:()=>af,regex:()=>ci,size:()=>An,slugify:()=>ks,startsWith:()=>fi,toLowerCase:()=>vi,toUpperCase:()=>_i,trim:()=>gi,uppercase:()=>li});var Gr={};ho(Gr,{ZodISODate:()=>yf,ZodISODateTime:()=>vf,ZodISODuration:()=>kf,ZodISOTime:()=>bf,date:()=>$f,datetime:()=>_f,duration:()=>Sf,time:()=>xf});var vf=m("ZodISODateTime",(t,e)=>{El.init(t,e),ge.init(t,e)});function _f(t){return jd(vf,t)}var yf=m("ZodISODate",(t,e)=>{Ol.init(t,e),ge.init(t,e)});function $f(t){return Nd(yf,t)}var bf=m("ZodISOTime",(t,e)=>{jl.init(t,e),ge.init(t,e)});function xf(t){return Rd(bf,t)}var kf=m("ZodISODuration",(t,e)=>{Nl.init(t,e),ge.init(t,e)});function Sf(t){return Cd(kf,t)}var dy=(t,e)=>{qa.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Va(t,r)},flatten:{value:r=>Fa(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Nn,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Nn,2)}},isEmpty:{get(){return t.issues.length===0}}})},a6=m("ZodError",dy),dt=m("ZodError",dy,{Parent:Error});var fy=Wo(dt),py=Ko(dt),my=Xo(dt),hy=Yo(dt),gy=zv(dt),vy=Iv(dt),_y=Tv(dt),yy=Pv(dt),$y=Ev(dt),by=Ov(dt),xy=jv(dt),ky=Nv(dt);var X=m("ZodType",(t,e)=>(W.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:yi(t,"input"),output:yi(t,"output")}}),t.toJSONSchema=k_(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(S.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>Ge(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>fy(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>my(t,r,n),t.parseAsync=async(r,n)=>py(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>hy(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>gy(t,r,n),t.decode=(r,n)=>vy(t,r,n),t.encodeAsync=async(r,n)=>_y(t,r,n),t.decodeAsync=async(r,n)=>yy(t,r,n),t.safeEncode=(r,n)=>$y(t,r,n),t.safeDecode=(r,n)=>by(t,r,n),t.safeEncodeAsync=async(r,n)=>xy(t,r,n),t.safeDecodeAsync=async(r,n)=>ky(t,r,n),t.refine=(r,n)=>t.check(c$(r,n)),t.superRefine=r=>t.check(u$(r)),t.overwrite=r=>t.check(Mt(r)),t.optional=()=>be(t),t.exactOptional=()=>Vy(t),t.nullable=()=>Es(t),t.nullish=()=>be(Es(t)),t.nonoptional=r=>Hy(t,r),t.array=()=>re(t),t.or=r=>_e([t,r]),t.and=r=>ki(t,r),t.transform=r=>Os(t,Jf(r)),t.default=r=>Wy(t,r),t.prefault=r=>Ky(t,r),t.catch=r=>Qy(t,r),t.pipe=r=>Os(t,r),t.readonly=()=>r$(t),t.describe=r=>{let n=t.clone();return Ke.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ke.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ke.get(t);let n=t.clone();return Ke.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),zf=m("_ZodString",(t,e)=>{Br.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>S_(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(ci(...n)),t.includes=(...n)=>t.check(di(...n)),t.startsWith=(...n)=>t.check(fi(...n)),t.endsWith=(...n)=>t.check(pi(...n)),t.min=(...n)=>t.check(kr(...n)),t.max=(...n)=>t.check(Un(...n)),t.length=(...n)=>t.check(Zn(...n)),t.nonempty=(...n)=>t.check(kr(1,...n)),t.lowercase=n=>t.check(ui(n)),t.uppercase=n=>t.check(li(n)),t.trim=()=>t.check(gi()),t.normalize=(...n)=>t.check(hi(...n)),t.toLowerCase=()=>t.check(vi()),t.toUpperCase=()=>t.check(_i()),t.slugify=()=>t.check(ks())}),js=m("ZodString",(t,e)=>{Br.init(t,e),zf.init(t,e),t.email=r=>t.check(ns(If,r)),t.url=r=>t.check(si(Ns,r)),t.jwt=r=>t.check(xs(qf,r)),t.emoji=r=>t.check(cs(Tf,r)),t.guid=r=>t.check(ai(Ps,r)),t.uuid=r=>t.check(os(ar,r)),t.uuidv4=r=>t.check(is(ar,r)),t.uuidv6=r=>t.check(as(ar,r)),t.uuidv7=r=>t.check(ss(ar,r)),t.nanoid=r=>t.check(us(Pf,r)),t.guid=r=>t.check(ai(Ps,r)),t.cuid=r=>t.check(ls(Ef,r)),t.cuid2=r=>t.check(ds(Of,r)),t.ulid=r=>t.check(fs(jf,r)),t.base64=r=>t.check(ys(Zf,r)),t.base64url=r=>t.check($s(Mf,r)),t.xid=r=>t.check(ps(Nf,r)),t.ksuid=r=>t.check(ms(Rf,r)),t.ipv4=r=>t.check(hs(Cf,r)),t.ipv6=r=>t.check(gs(Df,r)),t.cidrv4=r=>t.check(vs(Af,r)),t.cidrv6=r=>t.check(_s(Uf,r)),t.e164=r=>t.check(bs(Lf,r)),t.datetime=r=>t.check(_f(r)),t.date=r=>t.check($f(r)),t.time=r=>t.check(xf(r)),t.duration=r=>t.check(Sf(r))});function _(t){return Ed(js,t)}var ge=m("ZodStringFormat",(t,e)=>{fe.init(t,e),zf.init(t,e)}),If=m("ZodEmail",(t,e)=>{bl.init(t,e),ge.init(t,e)});function dI(t){return ns(If,t)}var Ps=m("ZodGUID",(t,e)=>{yl.init(t,e),ge.init(t,e)});function fI(t){return ai(Ps,t)}var ar=m("ZodUUID",(t,e)=>{$l.init(t,e),ge.init(t,e)});function pI(t){return os(ar,t)}function mI(t){return is(ar,t)}function hI(t){return as(ar,t)}function gI(t){return ss(ar,t)}var Ns=m("ZodURL",(t,e)=>{xl.init(t,e),ge.init(t,e)});function vI(t){return si(Ns,t)}function _I(t){return si(Ns,{protocol:/^https?$/,hostname:yt.domain,...S.normalizeParams(t)})}var Tf=m("ZodEmoji",(t,e)=>{kl.init(t,e),ge.init(t,e)});function yI(t){return cs(Tf,t)}var Pf=m("ZodNanoID",(t,e)=>{Sl.init(t,e),ge.init(t,e)});function $I(t){return us(Pf,t)}var Ef=m("ZodCUID",(t,e)=>{wl.init(t,e),ge.init(t,e)});function bI(t){return ls(Ef,t)}var Of=m("ZodCUID2",(t,e)=>{zl.init(t,e),ge.init(t,e)});function xI(t){return ds(Of,t)}var jf=m("ZodULID",(t,e)=>{Il.init(t,e),ge.init(t,e)});function kI(t){return fs(jf,t)}var Nf=m("ZodXID",(t,e)=>{Tl.init(t,e),ge.init(t,e)});function SI(t){return ps(Nf,t)}var Rf=m("ZodKSUID",(t,e)=>{Pl.init(t,e),ge.init(t,e)});function wI(t){return ms(Rf,t)}var Cf=m("ZodIPv4",(t,e)=>{Rl.init(t,e),ge.init(t,e)});function zI(t){return hs(Cf,t)}var Sy=m("ZodMAC",(t,e)=>{Dl.init(t,e),ge.init(t,e)});function II(t){return Od(Sy,t)}var Df=m("ZodIPv6",(t,e)=>{Cl.init(t,e),ge.init(t,e)});function TI(t){return gs(Df,t)}var Af=m("ZodCIDRv4",(t,e)=>{Al.init(t,e),ge.init(t,e)});function PI(t){return vs(Af,t)}var Uf=m("ZodCIDRv6",(t,e)=>{Ul.init(t,e),ge.init(t,e)});function EI(t){return _s(Uf,t)}var Zf=m("ZodBase64",(t,e)=>{Zl.init(t,e),ge.init(t,e)});function OI(t){return ys(Zf,t)}var Mf=m("ZodBase64URL",(t,e)=>{Ml.init(t,e),ge.init(t,e)});function jI(t){return $s(Mf,t)}var Lf=m("ZodE164",(t,e)=>{Ll.init(t,e),ge.init(t,e)});function NI(t){return bs(Lf,t)}var qf=m("ZodJWT",(t,e)=>{ql.init(t,e),ge.init(t,e)});function RI(t){return xs(qf,t)}var xi=m("ZodCustomStringFormat",(t,e)=>{Fl.init(t,e),ge.init(t,e)});function CI(t,e,r={}){return Mn(xi,t,e,r)}function DI(t){return Mn(xi,"hostname",yt.hostname,t)}function AI(t){return Mn(xi,"hex",yt.hex,t)}function UI(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=yt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Mn(xi,n,o,e)}var Rs=m("ZodNumber",(t,e)=>{Qa.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>w_(t,n,o,i),t.gt=(n,o)=>t.check(or(n,o)),t.gte=(n,o)=>t.check(He(n,o)),t.min=(n,o)=>t.check(He(n,o)),t.lt=(n,o)=>t.check(nr(n,o)),t.lte=(n,o)=>t.check(lt(n,o)),t.max=(n,o)=>t.check(lt(n,o)),t.int=n=>t.check(wf(n)),t.safe=n=>t.check(wf(n)),t.positive=n=>t.check(or(0,n)),t.nonnegative=n=>t.check(He(0,n)),t.negative=n=>t.check(nr(0,n)),t.nonpositive=n=>t.check(lt(0,n)),t.multipleOf=(n,o)=>t.check(Jr(n,o)),t.step=(n,o)=>t.check(Jr(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function le(t){return Dd(Rs,t)}var qn=m("ZodNumberFormat",(t,e)=>{Vl.init(t,e),Rs.init(t,e)});function wf(t){return Ad(qn,t)}function ZI(t){return Ud(qn,t)}function MI(t){return Zd(qn,t)}function LI(t){return Md(qn,t)}function qI(t){return Ld(qn,t)}var Cs=m("ZodBoolean",(t,e)=>{ni.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>z_(t,r,n,o)});function Ee(t){return qd(Cs,t)}var Ds=m("ZodBigInt",(t,e)=>{es.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>I_(t,n,o,i),t.gte=(n,o)=>t.check(He(n,o)),t.min=(n,o)=>t.check(He(n,o)),t.gt=(n,o)=>t.check(or(n,o)),t.gte=(n,o)=>t.check(He(n,o)),t.min=(n,o)=>t.check(He(n,o)),t.lt=(n,o)=>t.check(nr(n,o)),t.lte=(n,o)=>t.check(lt(n,o)),t.max=(n,o)=>t.check(lt(n,o)),t.positive=n=>t.check(or(BigInt(0),n)),t.negative=n=>t.check(nr(BigInt(0),n)),t.nonpositive=n=>t.check(lt(BigInt(0),n)),t.nonnegative=n=>t.check(He(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Jr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function FI(t){return Fd(Ds,t)}var Ff=m("ZodBigIntFormat",(t,e)=>{Bl.init(t,e),Ds.init(t,e)});function VI(t){return Vd(Ff,t)}function BI(t){return Bd(Ff,t)}var wy=m("ZodSymbol",(t,e)=>{Jl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>T_(t,r,n,o)});function JI(t){return Jd(wy,t)}var zy=m("ZodUndefined",(t,e)=>{Wl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>E_(t,r,n,o)});function WI(t){return Wd(zy,t)}var Iy=m("ZodNull",(t,e)=>{Gl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>P_(t,r,n,o)});function As(t){return Gd(Iy,t)}var Ty=m("ZodAny",(t,e)=>{Kl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>N_(t,r,n,o)});function GI(){return Kd(Ty)}var Py=m("ZodUnknown",(t,e)=>{Hl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>R_(t,r,n,o)});function ve(){return Hd(Py)}var Ey=m("ZodNever",(t,e)=>{Xl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>j_(t,r,n,o)});function Vf(t){return Xd(Ey,t)}var Oy=m("ZodVoid",(t,e)=>{Yl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>O_(t,r,n,o)});function KI(t){return Yd(Oy,t)}var Bf=m("ZodDate",(t,e)=>{Ql.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>C_(t,n,o,i),t.min=(n,o)=>t.check(He(n,o)),t.max=(n,o)=>t.check(lt(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function HI(t){return Qd(Bf,t)}var jy=m("ZodArray",(t,e)=>{ed.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>W_(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(kr(r,n)),t.nonempty=r=>t.check(kr(1,r)),t.max=(r,n)=>t.check(Un(r,n)),t.length=(r,n)=>t.check(Zn(r,n)),t.unwrap=()=>t.element});function re(t,e){return x_(jy,t,e)}function XI(t){let e=t._zod.def.shape;return Fe(Object.keys(e))}var Us=m("ZodObject",(t,e)=>{$_.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>G_(t,r,n,o),S.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Fe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ve()}),t.loose=()=>t.clone({...t._zod.def,catchall:ve()}),t.strict=()=>t.clone({...t._zod.def,catchall:Vf()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>S.extend(t,r),t.safeExtend=r=>S.safeExtend(t,r),t.merge=r=>S.merge(t,r),t.pick=r=>S.pick(t,r),t.omit=r=>S.omit(t,r),t.partial=(...r)=>S.partial(Wf,t,r[0]),t.required=(...r)=>S.required(Gf,t,r[0])});function O(t,e){let r={type:"object",shape:t??{},...S.normalizeParams(e)};return new Us(r)}function YI(t,e){return new Us({type:"object",shape:t,catchall:Vf(),...S.normalizeParams(e)})}function qe(t,e){return new Us({type:"object",shape:t,catchall:ve(),...S.normalizeParams(e)})}var Zs=m("ZodUnion",(t,e)=>{oi.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>mf(t,r,n,o),t.options=e.options});function _e(t,e){return new Zs({type:"union",options:t,...S.normalizeParams(e)})}var Ny=m("ZodXor",(t,e)=>{Zs.init(t,e),td.init(t,e),t._zod.processJSONSchema=(r,n,o)=>mf(t,r,n,o),t.options=e.options});function QI(t,e){return new Ny({type:"union",options:t,inclusive:!1,...S.normalizeParams(e)})}var Ry=m("ZodDiscriminatedUnion",(t,e)=>{Zs.init(t,e),rd.init(t,e)});function Ms(t,e,r){return new Ry({type:"union",options:e,discriminator:t,...S.normalizeParams(r)})}var Cy=m("ZodIntersection",(t,e)=>{nd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>K_(t,r,n,o)});function ki(t,e){return new Cy({type:"intersection",left:t,right:e})}var Dy=m("ZodTuple",(t,e)=>{ts.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>H_(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Ay(t,e,r){let n=e instanceof W,o=n?r:e,i=n?e:null;return new Dy({type:"tuple",items:t,rest:i,...S.normalizeParams(o)})}var Ls=m("ZodRecord",(t,e)=>{od.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>X_(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function pe(t,e,r){return new Ls({type:"record",keyType:t,valueType:e,...S.normalizeParams(r)})}function eT(t,e,r){let n=Ge(t);return n._zod.values=void 0,new Ls({type:"record",keyType:n,valueType:e,...S.normalizeParams(r)})}function tT(t,e,r){return new Ls({type:"record",keyType:t,valueType:e,mode:"loose",...S.normalizeParams(r)})}var Uy=m("ZodMap",(t,e)=>{id.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>B_(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(ir(...r)),t.nonempty=r=>t.check(ir(1,r)),t.max=(...r)=>t.check(Wr(...r)),t.size=(...r)=>t.check(An(...r))});function rT(t,e,r){return new Uy({type:"map",keyType:t,valueType:e,...S.normalizeParams(r)})}var Zy=m("ZodSet",(t,e)=>{ad.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>J_(t,r,n,o),t.min=(...r)=>t.check(ir(...r)),t.nonempty=r=>t.check(ir(1,r)),t.max=(...r)=>t.check(Wr(...r)),t.size=(...r)=>t.check(An(...r))});function nT(t,e){return new Zy({type:"set",valueType:t,...S.normalizeParams(e)})}var bi=m("ZodEnum",(t,e)=>{sd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>D_(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new bi({...e,checks:[],...S.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new bi({...e,checks:[],...S.normalizeParams(o),entries:i})}});function Fe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new bi({type:"enum",entries:r,...S.normalizeParams(e)})}function oT(t,e){return new bi({type:"enum",entries:t,...S.normalizeParams(e)})}var My=m("ZodLiteral",(t,e)=>{cd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>A_(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function D(t,e){return new My({type:"literal",values:Array.isArray(t)?t:[t],...S.normalizeParams(e)})}var Ly=m("ZodFile",(t,e)=>{ud.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>M_(t,r,n,o),t.min=(r,n)=>t.check(ir(r,n)),t.max=(r,n)=>t.check(Wr(r,n)),t.mime=(r,n)=>t.check(mi(Array.isArray(r)?r:[r],n))});function iT(t){return sf(Ly,t)}var qy=m("ZodTransform",(t,e)=>{ld.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>V_(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(S.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(S.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Jf(t){return new qy({type:"transform",transform:t})}var Wf=m("ZodOptional",(t,e)=>{rs.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hf(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function be(t){return new Wf({type:"optional",innerType:t})}var Fy=m("ZodExactOptional",(t,e)=>{dd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hf(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Vy(t){return new Fy({type:"optional",innerType:t})}var By=m("ZodNullable",(t,e)=>{fd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Y_(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Es(t){return new By({type:"nullable",innerType:t})}function aT(t){return be(Es(t))}var Jy=m("ZodDefault",(t,e)=>{pd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ey(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Wy(t,e){return new Jy({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():S.shallowClone(e)}})}var Gy=m("ZodPrefault",(t,e)=>{md.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ty(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Ky(t,e){return new Gy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():S.shallowClone(e)}})}var Gf=m("ZodNonOptional",(t,e)=>{hd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Q_(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Hy(t,e){return new Gf({type:"nonoptional",innerType:t,...S.normalizeParams(e)})}var Xy=m("ZodSuccess",(t,e)=>{gd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>L_(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function sT(t){return new Xy({type:"success",innerType:t})}var Yy=m("ZodCatch",(t,e)=>{vd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ry(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Qy(t,e){return new Yy({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var e$=m("ZodNaN",(t,e)=>{_d.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>U_(t,r,n,o)});function cT(t){return ef(e$,t)}var Kf=m("ZodPipe",(t,e)=>{yd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ny(t,r,n,o),t.in=e.in,t.out=e.out});function Os(t,e){return new Kf({type:"pipe",in:t,out:e})}var Hf=m("ZodCodec",(t,e)=>{Kf.init(t,e),ii.init(t,e)});function uT(t,e,r){return new Hf({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var t$=m("ZodReadonly",(t,e)=>{$d.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>oy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function r$(t){return new t$({type:"readonly",innerType:t})}var n$=m("ZodTemplateLiteral",(t,e)=>{bd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Z_(t,r,n,o)});function lT(t,e){return new n$({type:"template_literal",parts:t,...S.normalizeParams(e)})}var o$=m("ZodLazy",(t,e)=>{Sd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ay(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function i$(t){return new o$({type:"lazy",getter:t})}var a$=m("ZodPromise",(t,e)=>{kd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>iy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function dT(t){return new a$({type:"promise",innerType:t})}var s$=m("ZodFunction",(t,e)=>{xd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>F_(t,r,n,o)});function fT(t){return new s$({type:"function",input:Array.isArray(t?.input)?Ay(t?.input):t?.input??re(ve()),output:t?.output??ve()})}var qs=m("ZodCustom",(t,e)=>{wd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>q_(t,r,n,o)});function pT(t){let e=new he({check:"custom"});return e._zod.check=t,e}function Xf(t,e){return cf(qs,t??(()=>!0),e)}function c$(t,e={}){return uf(qs,t,e)}function u$(t){return lf(t)}var mT=df,hT=ff;function gT(t,e={}){let r=new qs({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...S.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var vT=(...t)=>pf({Codec:Hf,Boolean:Cs,String:js},...t);function _T(t){let e=i$(()=>_e([_(t),le(),Ee(),As(),re(e),pe(_(),e)]));return e}function Fs(t,e){return Os(Jf(t),e)}var l$;l$||(l$={});var m6={...$i,...Ts,iso:Gr};je(zd());var Qf="2025-11-25";var d$=[Qf,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Sr="io.modelcontextprotocol/related-task",Bs="2.0",Ne=Xf(t=>t!==null&&(typeof t=="object"||typeof t=="function")),f$=_e([_(),le().int()]),p$=_(),N6=qe({ttl:le().optional(),pollInterval:le().optional()}),xT=O({ttl:le().optional()}),kT=O({taskId:_()}),ep=qe({progressToken:f$.optional(),[Sr]:kT.optional()}),ft=O({_meta:ep.optional()}),Si=ft.extend({task:xT.optional()}),m$=t=>Si.safeParse(t).success,De=O({method:_(),params:ft.loose().optional()}),$t=O({_meta:ep.optional()}),bt=O({method:_(),params:$t.loose().optional()}),Ae=qe({_meta:ep.optional()}),Js=_e([_(),le().int()]),h$=O({jsonrpc:D(Bs),id:Js,...De.shape}).strict(),tp=t=>h$.safeParse(t).success,g$=O({jsonrpc:D(Bs),...bt.shape}).strict(),v$=t=>g$.safeParse(t).success,rp=O({jsonrpc:D(Bs),id:Js,result:Ae}).strict(),wi=t=>rp.safeParse(t).success;var V;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(V||(V={}));var np=O({jsonrpc:D(Bs),id:Js.optional(),error:O({code:le().int(),message:_(),data:ve().optional()})}).strict();var _$=t=>np.safeParse(t).success;var y$=_e([h$,g$,rp,np]),R6=_e([rp,np]),Kr=Ae.strict(),ST=$t.extend({requestId:Js.optional(),reason:_().optional()}),Ws=bt.extend({method:D("notifications/cancelled"),params:ST}),wT=O({src:_(),mimeType:_().optional(),sizes:re(_()).optional(),theme:Fe(["light","dark"]).optional()}),zi=O({icons:re(wT).optional()}),Fn=O({name:_(),title:_().optional()}),$$=Fn.extend({...Fn.shape,...zi.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),zT=ki(O({applyDefaults:Ee().optional()}),pe(_(),ve())),IT=Fs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,ki(O({form:zT.optional(),url:Ne.optional()}),pe(_(),ve()).optional())),TT=qe({list:Ne.optional(),cancel:Ne.optional(),requests:qe({sampling:qe({createMessage:Ne.optional()}).optional(),elicitation:qe({create:Ne.optional()}).optional()}).optional()}),PT=qe({list:Ne.optional(),cancel:Ne.optional(),requests:qe({tools:qe({call:Ne.optional()}).optional()}).optional()}),ET=O({experimental:pe(_(),Ne).optional(),sampling:O({context:Ne.optional(),tools:Ne.optional()}).optional(),elicitation:IT.optional(),roots:O({listChanged:Ee().optional()}).optional(),tasks:TT.optional(),extensions:pe(_(),Ne).optional()}),OT=ft.extend({protocolVersion:_(),capabilities:ET,clientInfo:$$}),jT=De.extend({method:D("initialize"),params:OT});var NT=O({experimental:pe(_(),Ne).optional(),logging:Ne.optional(),completions:Ne.optional(),prompts:O({listChanged:Ee().optional()}).optional(),resources:O({subscribe:Ee().optional(),listChanged:Ee().optional()}).optional(),tools:O({listChanged:Ee().optional()}).optional(),tasks:PT.optional(),extensions:pe(_(),Ne).optional()}),op=Ae.extend({protocolVersion:_(),capabilities:NT,serverInfo:$$,instructions:_().optional()}),RT=bt.extend({method:D("notifications/initialized"),params:$t.optional()});var Gs=De.extend({method:D("ping"),params:ft.optional()}),CT=O({progress:le(),total:be(le()),message:be(_())}),DT=O({...$t.shape,...CT.shape,progressToken:f$}),Ks=bt.extend({method:D("notifications/progress"),params:DT}),AT=ft.extend({cursor:p$.optional()}),Ii=De.extend({params:AT.optional()}),Ti=Ae.extend({nextCursor:p$.optional()}),UT=Fe(["working","input_required","completed","failed","cancelled"]),Pi=O({taskId:_(),status:UT,ttl:_e([le(),As()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:be(le()),statusMessage:be(_())}),Hr=Ae.extend({task:Pi}),ZT=$t.merge(Pi),Ei=bt.extend({method:D("notifications/tasks/status"),params:ZT}),Hs=De.extend({method:D("tasks/get"),params:ft.extend({taskId:_()})}),Xs=Ae.merge(Pi),Ys=De.extend({method:D("tasks/result"),params:ft.extend({taskId:_()})}),C6=Ae.loose(),Qs=Ii.extend({method:D("tasks/list")}),ec=Ti.extend({tasks:re(Pi)}),tc=De.extend({method:D("tasks/cancel"),params:ft.extend({taskId:_()})}),b$=Ae.merge(Pi),x$=O({uri:_(),mimeType:be(_()),_meta:pe(_(),ve()).optional()}),k$=x$.extend({text:_()}),ip=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),S$=x$.extend({blob:ip}),Oi=Fe(["user","assistant"]),Vn=O({audience:re(Oi).optional(),priority:le().min(0).max(1).optional(),lastModified:Gr.datetime({offset:!0}).optional()}),w$=O({...Fn.shape,...zi.shape,uri:_(),description:be(_()),mimeType:be(_()),size:be(le()),annotations:Vn.optional(),_meta:be(qe({}))}),MT=O({...Fn.shape,...zi.shape,uriTemplate:_(),description:be(_()),mimeType:be(_()),annotations:Vn.optional(),_meta:be(qe({}))}),LT=Ii.extend({method:D("resources/list")}),ap=Ti.extend({resources:re(w$)}),qT=Ii.extend({method:D("resources/templates/list")}),sp=Ti.extend({resourceTemplates:re(MT)}),cp=ft.extend({uri:_()}),FT=cp,VT=De.extend({method:D("resources/read"),params:FT}),up=Ae.extend({contents:re(_e([k$,S$]))}),lp=bt.extend({method:D("notifications/resources/list_changed"),params:$t.optional()}),BT=cp,JT=De.extend({method:D("resources/subscribe"),params:BT}),WT=cp,GT=De.extend({method:D("resources/unsubscribe"),params:WT}),KT=$t.extend({uri:_()}),HT=bt.extend({method:D("notifications/resources/updated"),params:KT}),XT=O({name:_(),description:be(_()),required:be(Ee())}),YT=O({...Fn.shape,...zi.shape,description:be(_()),arguments:be(re(XT)),_meta:be(qe({}))}),QT=Ii.extend({method:D("prompts/list")}),dp=Ti.extend({prompts:re(YT)}),eP=ft.extend({name:_(),arguments:pe(_(),_()).optional()}),tP=De.extend({method:D("prompts/get"),params:eP}),fp=O({type:D("text"),text:_(),annotations:Vn.optional(),_meta:pe(_(),ve()).optional()}),pp=O({type:D("image"),data:ip,mimeType:_(),annotations:Vn.optional(),_meta:pe(_(),ve()).optional()}),mp=O({type:D("audio"),data:ip,mimeType:_(),annotations:Vn.optional(),_meta:pe(_(),ve()).optional()}),rP=O({type:D("tool_use"),name:_(),id:_(),input:pe(_(),ve()),_meta:pe(_(),ve()).optional()}),nP=O({type:D("resource"),resource:_e([k$,S$]),annotations:Vn.optional(),_meta:pe(_(),ve()).optional()}),oP=w$.extend({type:D("resource_link")}),hp=_e([fp,pp,mp,oP,nP]),iP=O({role:Oi,content:hp}),gp=Ae.extend({description:_().optional(),messages:re(iP)}),vp=bt.extend({method:D("notifications/prompts/list_changed"),params:$t.optional()}),aP=O({title:_().optional(),readOnlyHint:Ee().optional(),destructiveHint:Ee().optional(),idempotentHint:Ee().optional(),openWorldHint:Ee().optional()}),sP=O({taskSupport:Fe(["required","optional","forbidden"]).optional()}),z$=O({...Fn.shape,...zi.shape,description:_().optional(),inputSchema:O({type:D("object"),properties:pe(_(),Ne).optional(),required:re(_()).optional()}).catchall(ve()),outputSchema:O({type:D("object"),properties:pe(_(),Ne).optional(),required:re(_()).optional()}).catchall(ve()).optional(),annotations:aP.optional(),execution:sP.optional(),_meta:pe(_(),ve()).optional()}),cP=Ii.extend({method:D("tools/list")}),_p=Ti.extend({tools:re(z$)}),Bn=Ae.extend({content:re(hp).default([]),structuredContent:pe(_(),ve()).optional(),isError:Ee().optional()}),D6=Bn.or(Ae.extend({toolResult:ve()})),uP=Si.extend({name:_(),arguments:pe(_(),ve()).optional()}),lP=De.extend({method:D("tools/call"),params:uP}),yp=bt.extend({method:D("notifications/tools/list_changed"),params:$t.optional()}),I$=O({autoRefresh:Ee().default(!0),debounceMs:le().int().nonnegative().default(300)}),T$=Fe(["debug","info","notice","warning","error","critical","alert","emergency"]),dP=ft.extend({level:T$}),fP=De.extend({method:D("logging/setLevel"),params:dP}),pP=$t.extend({level:T$,logger:_().optional(),data:ve()}),mP=bt.extend({method:D("notifications/message"),params:pP}),hP=O({name:_().optional()}),gP=O({hints:re(hP).optional(),costPriority:le().min(0).max(1).optional(),speedPriority:le().min(0).max(1).optional(),intelligencePriority:le().min(0).max(1).optional()}),vP=O({mode:Fe(["auto","required","none"]).optional()}),_P=O({type:D("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:re(hp).default([]),structuredContent:O({}).loose().optional(),isError:Ee().optional(),_meta:pe(_(),ve()).optional()}),yP=Ms("type",[fp,pp,mp]),Vs=Ms("type",[fp,pp,mp,rP,_P]),$P=O({role:Oi,content:_e([Vs,re(Vs)]),_meta:pe(_(),ve()).optional()}),bP=Si.extend({messages:re($P),modelPreferences:gP.optional(),systemPrompt:_().optional(),includeContext:Fe(["none","thisServer","allServers"]).optional(),temperature:le().optional(),maxTokens:le().int(),stopSequences:re(_()).optional(),metadata:Ne.optional(),tools:re(z$).optional(),toolChoice:vP.optional()}),$p=De.extend({method:D("sampling/createMessage"),params:bP}),bp=Ae.extend({model:_(),stopReason:be(Fe(["endTurn","stopSequence","maxTokens"]).or(_())),role:Oi,content:yP}),xp=Ae.extend({model:_(),stopReason:be(Fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Oi,content:_e([Vs,re(Vs)])}),xP=O({type:D("boolean"),title:_().optional(),description:_().optional(),default:Ee().optional()}),kP=O({type:D("string"),title:_().optional(),description:_().optional(),minLength:le().optional(),maxLength:le().optional(),format:Fe(["email","uri","date","date-time"]).optional(),default:_().optional()}),SP=O({type:Fe(["number","integer"]),title:_().optional(),description:_().optional(),minimum:le().optional(),maximum:le().optional(),default:le().optional()}),wP=O({type:D("string"),title:_().optional(),description:_().optional(),enum:re(_()),default:_().optional()}),zP=O({type:D("string"),title:_().optional(),description:_().optional(),oneOf:re(O({const:_(),title:_()})),default:_().optional()}),IP=O({type:D("string"),title:_().optional(),description:_().optional(),enum:re(_()),enumNames:re(_()).optional(),default:_().optional()}),TP=_e([wP,zP]),PP=O({type:D("array"),title:_().optional(),description:_().optional(),minItems:le().optional(),maxItems:le().optional(),items:O({type:D("string"),enum:re(_())}),default:re(_()).optional()}),EP=O({type:D("array"),title:_().optional(),description:_().optional(),minItems:le().optional(),maxItems:le().optional(),items:O({anyOf:re(O({const:_(),title:_()}))}),default:re(_()).optional()}),OP=_e([PP,EP]),jP=_e([IP,TP,OP]),NP=_e([jP,xP,kP,SP]),RP=Si.extend({mode:D("form").optional(),message:_(),requestedSchema:O({type:D("object"),properties:pe(_(),NP),required:re(_()).optional()})}),CP=Si.extend({mode:D("url"),message:_(),elicitationId:_(),url:_().url()}),DP=_e([RP,CP]),kp=De.extend({method:D("elicitation/create"),params:DP}),AP=$t.extend({elicitationId:_()}),UP=bt.extend({method:D("notifications/elicitation/complete"),params:AP}),Sp=Ae.extend({action:Fe(["accept","decline","cancel"]),content:Fs(t=>t===null?void 0:t,pe(_(),_e([_(),le(),Ee(),re(_())])).optional())}),ZP=O({type:D("ref/resource"),uri:_()});var MP=O({type:D("ref/prompt"),name:_()}),LP=ft.extend({ref:_e([MP,ZP]),argument:O({name:_(),value:_()}),context:O({arguments:pe(_(),_()).optional()}).optional()}),qP=De.extend({method:D("completion/complete"),params:LP});var wp=Ae.extend({completion:qe({values:re(_()).max(100),total:be(le().int()),hasMore:be(Ee())})}),FP=O({uri:_().startsWith("file://"),name:_().optional(),_meta:pe(_(),ve()).optional()}),VP=De.extend({method:D("roots/list"),params:ft.optional()}),BP=Ae.extend({roots:re(FP)}),JP=bt.extend({method:D("notifications/roots/list_changed"),params:$t.optional()}),A6=_e([Gs,jT,qP,fP,tP,QT,LT,qT,VT,JT,GT,lP,cP,Hs,Ys,Qs,tc]),U6=_e([Ws,Ks,RT,JP,Ei]),Z6=_e([Kr,bp,xp,Sp,BP,Xs,ec,Hr]),M6=_e([Gs,$p,kp,VP,Hs,Ys,Qs,tc]),L6=_e([Ws,Ks,mP,HT,lp,yp,vp,Ei,UP]),q6=_e([Kr,op,wp,gp,dp,ap,sp,up,Bn,_p,Xs,ec,Hr]),U=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===V.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Yf(o.elicitations,r)}return new t(e,r,n)}},Yf=class extends U{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(V.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function wr(t){return t==="completed"||t==="failed"||t==="cancelled"}var xM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function zp(t){let r=Is(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ly(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ip(t,e){let r=Ot(t,e);if(!r.success)throw r.error;return r.data}var YP=6e4,rc=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ws,r=>{this._oncancel(r)}),this.setNotificationHandler(Ks,r=>{this._onprogress(r)}),this.setRequestHandler(Gs,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Hs,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new U(V.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ys,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,f=new U(d.error.code,d.error.message,d.error.data);l(f)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new U(V.InvalidParams,`Task not found: ${i}`);if(!wr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(wr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Sr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Qs,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new U(V.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(tc,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new U(V.InvalidParams,`Task not found: ${r.params.taskId}`);if(wr(o.status))throw new U(V.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new U(V.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof U?o:new U(V.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),U.fromError(V.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),wi(i)||_$(i)?this._onresponse(i):tp(i)?this._onrequest(i,a):v$(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=U.fromError(V.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[Sr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:V.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=m$(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(a.signal.aborted)throw new U(V.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:e.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let g=p.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:V.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),wi(e))n(e);else{let a=new U(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(wi(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),wi(e))o(e);else{let a=U.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof U?a:new U(V.InternalError,String(a))}}return}let i;try{let a=await this.request(e,Hr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new U(V.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},wr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new U(V.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new U(V.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof U?a:new U(V.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(P){d(P);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Sr]:c}});let g=P=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(P)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let j=P instanceof U?P:new U(V.RequestTimeout,String(P));l(j)};this._responseHandlers.set(f,P=>{if(!n?.signal?.aborted){if(P instanceof Error)return l(P);try{let j=Ot(r,P.result);j.success?u(j.data):l(j.error)}catch(j){l(j)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let h=n?.timeout??YP,y=()=>g(U.fromError(V.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let P=j=>{let z=this._responseHandlers.get(f);z?z(j):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,P),this._enqueueTaskMessage(w,{type:"request",message:p,timestamp:Date.now()}).catch(j=>{this._cleanupTimeout(f),l(j)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(P=>{this._cleanupTimeout(f),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Xs,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},ec,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},b$,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Sr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Sr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Sr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=zp(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Ip(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=zp(e);this._notificationHandlers.set(n,o=>{let i=Ip(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&tp(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new U(V.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new U(V.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new U(V.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new U(V.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Ei.parse({method:"notifications/tasks/status",params:s});await this.notification(c),wr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new U(V.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(wr(s.status))throw new U(V.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Ei.parse({method:"notifications/tasks/status",params:c});await this.notification(u),wr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function P$(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function E$(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];P$(a)&&P$(i)?r[o]={...a,...i}:r[o]=i}return r}var gk=de(fh(),1),vk=de(hk(),1);function F4(){let t=new gk.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,vk.default)(t),t}var Uc=class{constructor(e){this._ajv=e??F4()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Zc=class{constructor(e){this._client=e}async*callToolStream(e,r=Bn,n){let o=this._client,i={...n,task:n?.task??(o.isToolTask(e.name)?{}:void 0)},a=o.requestStream({method:"tools/call",params:e},r,i),s=o.getToolOutputValidator(e.name);for await(let c of a){if(c.type==="result"&&s){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new U(V.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=s(u.structuredContent);if(!l.valid){yield{type:"error",error:new U(V.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof U){yield{type:"error",error:l};return}yield{type:"error",error:new U(V.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function _k(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function yk(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Mc(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Mc(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&Mc(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&Mc(r,e)}}function V4(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Lc=class extends rc{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new Uc,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",yp,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",vp,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",lp,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Zc(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=E$(this._capabilities,e)}setRequestHandler(e,r){let o=Is(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Ln(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");let a=i;if(a==="elicitation/create"){let s=async(c,u)=>{let l=Ot(kp,c);if(!l.success){let P=l.error instanceof Error?l.error.message:String(l.error);throw new U(V.InvalidParams,`Invalid elicitation request: ${P}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:p}=V4(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new U(V.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!p)throw new U(V.InvalidParams,"Client does not support URL-mode elicitation requests");let g=await Promise.resolve(r(c,u));if(d.task){let P=Ot(Hr,g);if(!P.success){let j=P.error instanceof Error?P.error.message:String(P.error);throw new U(V.InvalidParams,`Invalid task creation result: ${j}`)}return P.data}let h=Ot(Sp,g);if(!h.success){let P=h.error instanceof Error?h.error.message:String(h.error);throw new U(V.InvalidParams,`Invalid elicitation result: ${P}`)}let y=h.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{Mc(w,y.content)}catch{}return y};return super.setRequestHandler(e,s)}if(a==="sampling/createMessage"){let s=async(c,u)=>{let l=Ot($p,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new U(V.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let y=Ot(Hr,f);if(!y.success){let w=y.error instanceof Error?y.error.message:String(y.error);throw new U(V.InvalidParams,`Invalid task creation result: ${w}`)}return y.data}let g=d.tools||d.toolChoice?xp:bp,h=Ot(g,f);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new U(V.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:Qf,capabilities:this._capabilities,clientInfo:this._clientInfo}},op,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!d$.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){_k(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&yk(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Kr,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},wp,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Kr,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},gp,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},dp,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ap,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},sp,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},up,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Kr,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Kr,r)}async callTool(e,r=Bn,n){if(this.isToolTaskRequired(e.name))throw new U(V.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new U(V.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let a=i(o.structuredContent);if(!a.valid)throw new U(V.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof U?a:new U(V.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return o}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},_p,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,o){let i=I$.safeParse(n);if(!i.success)throw new Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:s}=i.data,{onChanged:c}=n,u=async()=>{if(!a){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let f=d instanceof Error?d:new Error(String(d));c(f,null)}},l=()=>{if(s){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let f=setTimeout(u,s);this._listChangedDebounceTimers.set(e,f)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var uS=de(sS(),1),Bc=de(require("node:process"),1),lS=require("node:stream");var Fc=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
88
- `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),vR(r)}clear(){this._buffer=void 0}};function vR(t){return y$.parse(JSON.parse(t))}function cS(t){return JSON.stringify(t)+`
89
- `}var _R=Bc.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function yR(){let t={};for(let e of _R){let r=Bc.default.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var Vc=class{constructor(e){this._readBuffer=new Fc,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new lS.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,uS.default)(this._serverParams.command,this._serverParams.args??[],{env:{...yR(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Bc.default.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",n=>{r(n),this.onerror?.(n)}),this._process.on("spawn",()=>{e()}),this._process.on("close",n=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",n=>{this.onerror?.(n)}),this._process.stdout?.on("data",n=>{this._readBuffer.append(n),this.processReadBuffer()}),this._process.stdout?.on("error",n=>{this.onerror?.(n)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let r=new Promise(n=>{e.once("close",()=>{n()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let n=cS(e);this._process.stdin.write(n)?r():this._process.stdin.once("drain",r)})}};var fS=require("child_process"),Rr=de(require("fs")),ca=de(require("path"));var dS={"aws-docs":{description:"Search and read AWS official documentation",command:"uvx",args:["awslabs.aws-documentation-mcp-server@latest"],env:{FASTMCP_LOG_LEVEL:"ERROR",AWS_DOCUMENTATION_PARTITION:"aws"},autoApprove:["search_documentation","read_documentation","recommend","read_sections"]},"cloudflare-docs":{description:"Search Cloudflare official documentation (via Vectorize)",command:"npx",args:["-y","mcp-remote","https://docs.mcp.cloudflare.com/mcp"],autoApprove:["search_cloudflare_documentation"]}};function bR(){return dS}var Jc=class{servers=new Map;toolMap=new Map;toolDefs=[];registry;userConfig={};constructor(){this.registry=bR()}async init(){this.userConfig=this.loadUserConfig();let e=[];for(let[r,n]of Object.entries(this.userConfig))if(!n.disabled)try{let o=await this.connectServer(r,{...this.registry[r],...n});e.push(...o)}catch(o){console.error(` MCP [${r}]: failed \u2014 ${o.message}`)}return this.toolDefs=e,e}async enable(e){if(this.servers.has(e))return{ok:!1,error:`${e} is already connected`};let r=this.userConfig[e]||this.registry[e];if(!r)return{ok:!1,error:`Unknown server: ${e}. Available: ${this.listAvailable().join(", ")}`};let n=this.checkCommand(r.command);if(n)return{ok:!1,error:n};try{let o=await this.connectServer(e,r);return this.toolDefs.push(...o),this.userConfig[e]={...r,disabled:!1},this.saveUserConfig(),{ok:!0,tools:o}}catch(o){return{ok:!1,error:o.message}}}async disable(e){let r=this.servers.get(e);if(!r)return{ok:!1,error:`${e} is not connected`};try{await r.client.close()}catch{}for(let n of r.tools)this.toolMap.delete(n.name);return this.toolDefs=this.toolDefs.filter(n=>n.serverName!==e),this.servers.delete(e),this.userConfig[e]={...this.userConfig[e]||this.registry[e],disabled:!0},this.saveUserConfig(),{ok:!0}}listAll(){let e={...this.registry,...this.userConfig};return Object.entries(e).map(([r,n])=>({name:r,description:n.description||"",connected:this.servers.has(r)}))}listAvailable(){let e={...this.registry,...this.userConfig};return Object.keys(e).filter(r=>!this.servers.has(r))}getToolList(){return this.toolDefs}getInstructions(){let e={};for(let[r,n]of this.servers)n.instructions&&(e[r]=n.instructions);return e}getServerForTool(e){return this.toolMap.get(e)}isAutoApprove(e){let r=this.toolMap.get(e);return r?this.servers.get(r)?.config.autoApprove?.includes(e)??!1:!1}async callTool(e,r){let n=this.toolMap.get(e);if(!n)return{success:!1,output:`MCP tool not found: ${e}`};let o=this.servers.get(n);if(!o)return{success:!1,output:`MCP server not connected: ${n}`};let i=await o.client.callTool({name:e,arguments:r}),a=i.content.map(s=>s.type==="text"?s.text:JSON.stringify(s)).join(`
90
- `);return{success:!i.isError,output:a}}async shutdown(){for(let[,{client:e}]of this.servers)try{await e.close()}catch{}this.servers.clear(),this.toolMap.clear(),this.toolDefs=[]}async connectServer(e,r){let n={...process.env,...r.env?this.expandEnv(r.env):{}},o=new Vc({command:r.command,args:r.args,env:n,stderr:"ignore"}),i=new Lc({name:`synara-${e}`,version:"1.0.0"});await i.connect(o);let a=i._instructions||void 0,{tools:s}=await i.listTools(),c=new Set(r.disabledTools||[]),u=new Set(r.autoApprove||[]),l=s.filter(d=>!c.has(d.name)).map(d=>(this.toolMap.set(d.name,e),{name:d.name,description:d.description||"",inputSchema:d.inputSchema,serverName:e,autoApprove:u.has(d.name)}));return this.servers.set(e,{client:i,transport:o,config:r,tools:l,instructions:a}),l}loadUserConfig(){let e={},r=ca.join(process.env.HOME||"~",".synapse","settings","mcp.json");this.mergeFile(r,e);let n=ca.join(process.cwd(),".synapse","settings","mcp.json");return this.mergeFile(n,e),e}saveUserConfig(){let e=ca.join(process.env.HOME||"~",".synapse","settings");Rr.mkdirSync(e,{recursive:!0});let r=ca.join(e,"mcp.json");Rr.writeFileSync(r,JSON.stringify({mcpServers:this.userConfig},null,2),"utf-8")}mergeFile(e,r){try{if(!Rr.existsSync(e))return;let n=JSON.parse(Rr.readFileSync(e,"utf-8")),o=n.mcpServers||n;for(let[i,a]of Object.entries(o))r[i]=a}catch{}}expandEnv(e){let r={};for(let[n,o]of Object.entries(e))r[n]=o.replace(/\$\{(\w+)\}/g,(i,a)=>process.env[a]||"");return r}checkCommand(e){try{return(0,fS.execSync)(`which ${e}`,{stdio:"ignore"}),null}catch{return`'${e}' not found. ${{uvx:"Install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh",npx:"Install Node.js: https://nodejs.org/",python3:"Install Python 3: https://www.python.org/downloads/"}[e]||`Please install '${e}' and try again.`}`}}};var xR=process.env.SYNAPSE_CLI_WS||"wss://cli.synapse.cloudc.top",kR=Wt.join(process.env.HOME||"~",".synapse","token"),fo=[],pS=[],ua="idle",po=!1,mS=0,la=!1,pr=[],Wc=process.argv[2];(async()=>{Wc==="login"&&(await cv(),process.exit(0)),Wc==="logout"&&(await uv(),process.exit(0)),(Wc==="--help"||Wc==="-h")&&(console.log(`
91
- ${v.cyan.bold("\u26A1 Synara")} \u2014 AI coding assistant
87
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function Es(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=t.seen.get(l),f=p.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:ki(e,"input",t.processors),output:ki(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Qe(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Qe(n.element,r);if(n.type==="set")return Qe(n.valueType,r);if(n.type==="lazy")return Qe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Qe(n.innerType,r);if(n.type==="intersection")return Qe(n.left,r)||Qe(n.right,r);if(n.type==="record"||n.type==="map")return Qe(n.keyType,r)||Qe(n.valueType,r);if(n.type==="pipe")return Qe(n.in,r)||Qe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Qe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Qe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Qe(o,r))return!0;return!!(n.rest&&Qe(n.rest,r))}return!1}var w_=(t,e={})=>r=>{let n=Ts({...r,processors:e});return xe(t,n),Ps(n,t),Es(n,t)},ki=(t,e,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Ts({...o??{},target:i,io:e,processors:r});return xe(t,a),Ps(a,t),Es(a,t)};var Kz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},z_=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Kz[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},I_=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},T_=(t,e,r,n)=>{r.type="boolean"},P_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},E_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},O_=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},j_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},N_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},R_=(t,e,r,n)=>{r.not={}},C_=(t,e,r,n)=>{},D_=(t,e,r,n)=>{},A_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},U_=(t,e,r,n)=>{let o=t._zod.def,i=Bo(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Z_=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},M_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},L_=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},q_=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},F_=(t,e,r,n)=>{r.type="boolean"},V_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},B_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},J_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},W_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},G_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},K_=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=xe(i.element,e,{...n,path:[...n.path,"items"]})},H_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=xe(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=xe(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},vf=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>xe(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},X_=(t,e,r,n)=>{let o=t._zod.def,i=xe(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=xe(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},Y_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>xe(p,e,{...n,path:[...n.path,a,f]})),u=i.rest?xe(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Q_=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=xe(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=xe(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=xe(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},ey=(t,e,r,n)=>{let o=t._zod.def,i=xe(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},ty=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ry=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ny=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},oy=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},iy=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(i,e,n);let a=e.seen.get(t);a.ref=i},ay=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},sy=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},_f=(t,e,r,n)=>{let o=t._zod.def;xe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},cy=(t,e,r,n)=>{let o=t._zod.innerType;xe(o,e,n);let i=e.seen.get(t);i.ref=o};function Vn(t){return!!t._zod}function Nt(t,e){return Vn(t)?Zn(t,e):t.safeParse(e)}function Os(t){if(!t)return;let e;if(Vn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function fy(t){if(Vn(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Si={};vo(Si,{ZodAny:()=>Ey,ZodArray:()=>Ry,ZodBase64:()=>qf,ZodBase64URL:()=>Ff,ZodBigInt:()=>Ms,ZodBigIntFormat:()=>Jf,ZodBoolean:()=>Zs,ZodCIDRv4:()=>Mf,ZodCIDRv6:()=>Lf,ZodCUID:()=>Nf,ZodCUID2:()=>Rf,ZodCatch:()=>e$,ZodCodec:()=>Qf,ZodCustom:()=>Js,ZodCustomStringFormat:()=>zi,ZodDate:()=>Gf,ZodDefault:()=>Gy,ZodDiscriminatedUnion:()=>Dy,ZodE164:()=>Vf,ZodEmail:()=>Ef,ZodEmoji:()=>Of,ZodEnum:()=>wi,ZodExactOptional:()=>By,ZodFile:()=>Fy,ZodFunction:()=>u$,ZodGUID:()=>Ns,ZodIPv4:()=>Uf,ZodIPv6:()=>Zf,ZodIntersection:()=>Ay,ZodJWT:()=>Bf,ZodKSUID:()=>Af,ZodLazy:()=>a$,ZodLiteral:()=>qy,ZodMAC:()=>zy,ZodMap:()=>My,ZodNaN:()=>r$,ZodNanoID:()=>jf,ZodNever:()=>jy,ZodNonOptional:()=>Xf,ZodNull:()=>Py,ZodNullable:()=>Wy,ZodNumber:()=>Us,ZodNumberFormat:()=>Bn,ZodObject:()=>qs,ZodOptional:()=>Hf,ZodPipe:()=>Yf,ZodPrefault:()=>Hy,ZodPromise:()=>c$,ZodReadonly:()=>n$,ZodRecord:()=>Bs,ZodSet:()=>Ly,ZodString:()=>Ds,ZodStringFormat:()=>ve,ZodSuccess:()=>Qy,ZodSymbol:()=>Iy,ZodTemplateLiteral:()=>i$,ZodTransform:()=>Vy,ZodTuple:()=>Uy,ZodType:()=>X,ZodULID:()=>Cf,ZodURL:()=>As,ZodUUID:()=>cr,ZodUndefined:()=>Ty,ZodUnion:()=>Fs,ZodUnknown:()=>Oy,ZodVoid:()=>Ny,ZodXID:()=>Df,ZodXor:()=>Cy,_ZodString:()=>Pf,_default:()=>Ky,_function:()=>pT,any:()=>KI,array:()=>re,base64:()=>jI,base64url:()=>NI,bigint:()=>VI,boolean:()=>je,catch:()=>t$,check:()=>mT,cidrv4:()=>EI,cidrv6:()=>OI,codec:()=>lT,cuid:()=>xI,cuid2:()=>kI,custom:()=>ep,date:()=>XI,describe:()=>hT,discriminatedUnion:()=>Vs,e164:()=>RI,email:()=>fI,emoji:()=>$I,enum:()=>Be,exactOptional:()=>Jy,file:()=>aT,float32:()=>MI,float64:()=>LI,function:()=>pT,guid:()=>pI,hash:()=>ZI,hex:()=>UI,hostname:()=>AI,httpUrl:()=>yI,instanceof:()=>vT,int:()=>Tf,int32:()=>qI,int64:()=>BI,intersection:()=>Ii,ipv4:()=>II,ipv6:()=>PI,json:()=>yT,jwt:()=>CI,keyof:()=>YI,ksuid:()=>zI,lazy:()=>s$,literal:()=>D,looseObject:()=>Ve,looseRecord:()=>rT,mac:()=>TI,map:()=>nT,meta:()=>gT,nan:()=>uT,nanoid:()=>bI,nativeEnum:()=>iT,never:()=>Wf,nonoptional:()=>Yy,null:()=>Ls,nullable:()=>Rs,nullish:()=>sT,number:()=>de,object:()=>O,optional:()=>ke,partialRecord:()=>tT,pipe:()=>Cs,prefault:()=>Xy,preprocess:()=>Ws,promise:()=>fT,readonly:()=>o$,record:()=>me,refine:()=>l$,set:()=>oT,strictObject:()=>QI,string:()=>_,stringFormat:()=>DI,stringbool:()=>_T,success:()=>cT,superRefine:()=>d$,symbol:()=>WI,templateLiteral:()=>dT,transform:()=>Kf,tuple:()=>Zy,uint32:()=>FI,uint64:()=>JI,ulid:()=>SI,undefined:()=>GI,union:()=>ye,unknown:()=>_e,url:()=>_I,uuid:()=>mI,uuidv4:()=>hI,uuidv6:()=>gI,uuidv7:()=>vI,void:()=>HI,xid:()=>wI,xor:()=>eT});var js={};vo(js,{endsWith:()=>vi,gt:()=>ar,gte:()=>Ye,includes:()=>hi,length:()=>qn,lowercase:()=>pi,lt:()=>ir,lte:()=>ft,maxLength:()=>Ln,maxSize:()=>Kr,mime:()=>_i,minLength:()=>wr,minSize:()=>sr,multipleOf:()=>Gr,negative:()=>af,nonnegative:()=>cf,nonpositive:()=>sf,normalize:()=>yi,overwrite:()=>Ft,positive:()=>of,property:()=>uf,regex:()=>fi,size:()=>Mn,slugify:()=>Is,startsWith:()=>gi,toLowerCase:()=>bi,toUpperCase:()=>xi,trim:()=>$i,uppercase:()=>mi});var Hr={};vo(Hr,{ZodISODate:()=>xf,ZodISODateTime:()=>$f,ZodISODuration:()=>zf,ZodISOTime:()=>Sf,date:()=>kf,datetime:()=>bf,duration:()=>If,time:()=>wf});var $f=m("ZodISODateTime",(t,e)=>{Nl.init(t,e),ve.init(t,e)});function bf(t){return Cd($f,t)}var xf=m("ZodISODate",(t,e)=>{Rl.init(t,e),ve.init(t,e)});function kf(t){return Dd(xf,t)}var Sf=m("ZodISOTime",(t,e)=>{Cl.init(t,e),ve.init(t,e)});function wf(t){return Ad(Sf,t)}var zf=m("ZodISODuration",(t,e)=>{Dl.init(t,e),ve.init(t,e)});function If(t){return Ud(zf,t)}var py=(t,e)=>{Ja.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ga(t,r)},flatten:{value:r=>Wa(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Dn,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Dn,2)}},isEmpty:{get(){return t.issues.length===0}}})},c6=m("ZodError",py),pt=m("ZodError",py,{Parent:Error});var my=Xo(pt),hy=Qo(pt),gy=ti(pt),vy=ri(pt),_y=Tv(pt),yy=Pv(pt),$y=Ev(pt),by=Ov(pt),xy=jv(pt),ky=Nv(pt),Sy=Rv(pt),wy=Cv(pt);var X=m("ZodType",(t,e)=>(W.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:ki(t,"input"),output:ki(t,"output")}}),t.toJSONSchema=w_(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(S.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>He(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>my(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>gy(t,r,n),t.parseAsync=async(r,n)=>hy(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>vy(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>_y(t,r,n),t.decode=(r,n)=>yy(t,r,n),t.encodeAsync=async(r,n)=>$y(t,r,n),t.decodeAsync=async(r,n)=>by(t,r,n),t.safeEncode=(r,n)=>xy(t,r,n),t.safeDecode=(r,n)=>ky(t,r,n),t.safeEncodeAsync=async(r,n)=>Sy(t,r,n),t.safeDecodeAsync=async(r,n)=>wy(t,r,n),t.refine=(r,n)=>t.check(l$(r,n)),t.superRefine=r=>t.check(d$(r)),t.overwrite=r=>t.check(Ft(r)),t.optional=()=>ke(t),t.exactOptional=()=>Jy(t),t.nullable=()=>Rs(t),t.nullish=()=>ke(Rs(t)),t.nonoptional=r=>Yy(t,r),t.array=()=>re(t),t.or=r=>ye([t,r]),t.and=r=>Ii(t,r),t.transform=r=>Cs(t,Kf(r)),t.default=r=>Ky(t,r),t.prefault=r=>Xy(t,r),t.catch=r=>t$(t,r),t.pipe=r=>Cs(t,r),t.readonly=()=>o$(t),t.describe=r=>{let n=t.clone();return Xe.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Xe.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Xe.get(t);let n=t.clone();return Xe.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),Pf=m("_ZodString",(t,e)=>{Wr.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>z_(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(fi(...n)),t.includes=(...n)=>t.check(hi(...n)),t.startsWith=(...n)=>t.check(gi(...n)),t.endsWith=(...n)=>t.check(vi(...n)),t.min=(...n)=>t.check(wr(...n)),t.max=(...n)=>t.check(Ln(...n)),t.length=(...n)=>t.check(qn(...n)),t.nonempty=(...n)=>t.check(wr(1,...n)),t.lowercase=n=>t.check(pi(n)),t.uppercase=n=>t.check(mi(n)),t.trim=()=>t.check($i()),t.normalize=(...n)=>t.check(yi(...n)),t.toLowerCase=()=>t.check(bi()),t.toUpperCase=()=>t.check(xi()),t.slugify=()=>t.check(Is())}),Ds=m("ZodString",(t,e)=>{Wr.init(t,e),Pf.init(t,e),t.email=r=>t.check(ss(Ef,r)),t.url=r=>t.check(di(As,r)),t.jwt=r=>t.check(zs(Bf,r)),t.emoji=r=>t.check(fs(Of,r)),t.guid=r=>t.check(li(Ns,r)),t.uuid=r=>t.check(cs(cr,r)),t.uuidv4=r=>t.check(us(cr,r)),t.uuidv6=r=>t.check(ls(cr,r)),t.uuidv7=r=>t.check(ds(cr,r)),t.nanoid=r=>t.check(ps(jf,r)),t.guid=r=>t.check(li(Ns,r)),t.cuid=r=>t.check(ms(Nf,r)),t.cuid2=r=>t.check(hs(Rf,r)),t.ulid=r=>t.check(gs(Cf,r)),t.base64=r=>t.check(ks(qf,r)),t.base64url=r=>t.check(Ss(Ff,r)),t.xid=r=>t.check(vs(Df,r)),t.ksuid=r=>t.check(_s(Af,r)),t.ipv4=r=>t.check(ys(Uf,r)),t.ipv6=r=>t.check($s(Zf,r)),t.cidrv4=r=>t.check(bs(Mf,r)),t.cidrv6=r=>t.check(xs(Lf,r)),t.e164=r=>t.check(ws(Vf,r)),t.datetime=r=>t.check(bf(r)),t.date=r=>t.check(kf(r)),t.time=r=>t.check(wf(r)),t.duration=r=>t.check(If(r))});function _(t){return Nd(Ds,t)}var ve=m("ZodStringFormat",(t,e)=>{pe.init(t,e),Pf.init(t,e)}),Ef=m("ZodEmail",(t,e)=>{Sl.init(t,e),ve.init(t,e)});function fI(t){return ss(Ef,t)}var Ns=m("ZodGUID",(t,e)=>{xl.init(t,e),ve.init(t,e)});function pI(t){return li(Ns,t)}var cr=m("ZodUUID",(t,e)=>{kl.init(t,e),ve.init(t,e)});function mI(t){return cs(cr,t)}function hI(t){return us(cr,t)}function gI(t){return ls(cr,t)}function vI(t){return ds(cr,t)}var As=m("ZodURL",(t,e)=>{wl.init(t,e),ve.init(t,e)});function _I(t){return di(As,t)}function yI(t){return di(As,{protocol:/^https?$/,hostname:bt.domain,...S.normalizeParams(t)})}var Of=m("ZodEmoji",(t,e)=>{zl.init(t,e),ve.init(t,e)});function $I(t){return fs(Of,t)}var jf=m("ZodNanoID",(t,e)=>{Il.init(t,e),ve.init(t,e)});function bI(t){return ps(jf,t)}var Nf=m("ZodCUID",(t,e)=>{Tl.init(t,e),ve.init(t,e)});function xI(t){return ms(Nf,t)}var Rf=m("ZodCUID2",(t,e)=>{Pl.init(t,e),ve.init(t,e)});function kI(t){return hs(Rf,t)}var Cf=m("ZodULID",(t,e)=>{El.init(t,e),ve.init(t,e)});function SI(t){return gs(Cf,t)}var Df=m("ZodXID",(t,e)=>{Ol.init(t,e),ve.init(t,e)});function wI(t){return vs(Df,t)}var Af=m("ZodKSUID",(t,e)=>{jl.init(t,e),ve.init(t,e)});function zI(t){return _s(Af,t)}var Uf=m("ZodIPv4",(t,e)=>{Al.init(t,e),ve.init(t,e)});function II(t){return ys(Uf,t)}var zy=m("ZodMAC",(t,e)=>{Zl.init(t,e),ve.init(t,e)});function TI(t){return Rd(zy,t)}var Zf=m("ZodIPv6",(t,e)=>{Ul.init(t,e),ve.init(t,e)});function PI(t){return $s(Zf,t)}var Mf=m("ZodCIDRv4",(t,e)=>{Ml.init(t,e),ve.init(t,e)});function EI(t){return bs(Mf,t)}var Lf=m("ZodCIDRv6",(t,e)=>{Ll.init(t,e),ve.init(t,e)});function OI(t){return xs(Lf,t)}var qf=m("ZodBase64",(t,e)=>{ql.init(t,e),ve.init(t,e)});function jI(t){return ks(qf,t)}var Ff=m("ZodBase64URL",(t,e)=>{Fl.init(t,e),ve.init(t,e)});function NI(t){return Ss(Ff,t)}var Vf=m("ZodE164",(t,e)=>{Vl.init(t,e),ve.init(t,e)});function RI(t){return ws(Vf,t)}var Bf=m("ZodJWT",(t,e)=>{Bl.init(t,e),ve.init(t,e)});function CI(t){return zs(Bf,t)}var zi=m("ZodCustomStringFormat",(t,e)=>{Jl.init(t,e),ve.init(t,e)});function DI(t,e,r={}){return Fn(zi,t,e,r)}function AI(t){return Fn(zi,"hostname",bt.hostname,t)}function UI(t){return Fn(zi,"hex",bt.hex,t)}function ZI(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=bt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Fn(zi,n,o,e)}var Us=m("ZodNumber",(t,e)=>{ns.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>I_(t,n,o,i),t.gt=(n,o)=>t.check(ar(n,o)),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.lt=(n,o)=>t.check(ir(n,o)),t.lte=(n,o)=>t.check(ft(n,o)),t.max=(n,o)=>t.check(ft(n,o)),t.int=n=>t.check(Tf(n)),t.safe=n=>t.check(Tf(n)),t.positive=n=>t.check(ar(0,n)),t.nonnegative=n=>t.check(Ye(0,n)),t.negative=n=>t.check(ir(0,n)),t.nonpositive=n=>t.check(ft(0,n)),t.multipleOf=(n,o)=>t.check(Gr(n,o)),t.step=(n,o)=>t.check(Gr(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function de(t){return Zd(Us,t)}var Bn=m("ZodNumberFormat",(t,e)=>{Wl.init(t,e),Us.init(t,e)});function Tf(t){return Md(Bn,t)}function MI(t){return Ld(Bn,t)}function LI(t){return qd(Bn,t)}function qI(t){return Fd(Bn,t)}function FI(t){return Vd(Bn,t)}var Zs=m("ZodBoolean",(t,e)=>{si.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>T_(t,r,n,o)});function je(t){return Bd(Zs,t)}var Ms=m("ZodBigInt",(t,e)=>{os.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>P_(t,n,o,i),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.gt=(n,o)=>t.check(ar(n,o)),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.lt=(n,o)=>t.check(ir(n,o)),t.lte=(n,o)=>t.check(ft(n,o)),t.max=(n,o)=>t.check(ft(n,o)),t.positive=n=>t.check(ar(BigInt(0),n)),t.negative=n=>t.check(ir(BigInt(0),n)),t.nonpositive=n=>t.check(ft(BigInt(0),n)),t.nonnegative=n=>t.check(Ye(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Gr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function VI(t){return Jd(Ms,t)}var Jf=m("ZodBigIntFormat",(t,e)=>{Gl.init(t,e),Ms.init(t,e)});function BI(t){return Wd(Jf,t)}function JI(t){return Gd(Jf,t)}var Iy=m("ZodSymbol",(t,e)=>{Kl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>E_(t,r,n,o)});function WI(t){return Kd(Iy,t)}var Ty=m("ZodUndefined",(t,e)=>{Hl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>j_(t,r,n,o)});function GI(t){return Hd(Ty,t)}var Py=m("ZodNull",(t,e)=>{Xl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>O_(t,r,n,o)});function Ls(t){return Xd(Py,t)}var Ey=m("ZodAny",(t,e)=>{Yl.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>C_(t,r,n,o)});function KI(){return Yd(Ey)}var Oy=m("ZodUnknown",(t,e)=>{Ql.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>D_(t,r,n,o)});function _e(){return Qd(Oy)}var jy=m("ZodNever",(t,e)=>{ed.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>R_(t,r,n,o)});function Wf(t){return ef(jy,t)}var Ny=m("ZodVoid",(t,e)=>{td.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>N_(t,r,n,o)});function HI(t){return tf(Ny,t)}var Gf=m("ZodDate",(t,e)=>{rd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>A_(t,n,o,i),t.min=(n,o)=>t.check(Ye(n,o)),t.max=(n,o)=>t.check(ft(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function XI(t){return rf(Gf,t)}var Ry=m("ZodArray",(t,e)=>{nd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>K_(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(wr(r,n)),t.nonempty=r=>t.check(wr(1,r)),t.max=(r,n)=>t.check(Ln(r,n)),t.length=(r,n)=>t.check(qn(r,n)),t.unwrap=()=>t.element});function re(t,e){return S_(Ry,t,e)}function YI(t){let e=t._zod.def.shape;return Be(Object.keys(e))}var qs=m("ZodObject",(t,e)=>{x_.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>H_(t,r,n,o),S.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Be(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:_e()}),t.loose=()=>t.clone({...t._zod.def,catchall:_e()}),t.strict=()=>t.clone({...t._zod.def,catchall:Wf()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>S.extend(t,r),t.safeExtend=r=>S.safeExtend(t,r),t.merge=r=>S.merge(t,r),t.pick=r=>S.pick(t,r),t.omit=r=>S.omit(t,r),t.partial=(...r)=>S.partial(Hf,t,r[0]),t.required=(...r)=>S.required(Xf,t,r[0])});function O(t,e){let r={type:"object",shape:t??{},...S.normalizeParams(e)};return new qs(r)}function QI(t,e){return new qs({type:"object",shape:t,catchall:Wf(),...S.normalizeParams(e)})}function Ve(t,e){return new qs({type:"object",shape:t,catchall:_e(),...S.normalizeParams(e)})}var Fs=m("ZodUnion",(t,e)=>{ci.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vf(t,r,n,o),t.options=e.options});function ye(t,e){return new Fs({type:"union",options:t,...S.normalizeParams(e)})}var Cy=m("ZodXor",(t,e)=>{Fs.init(t,e),od.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vf(t,r,n,o),t.options=e.options});function eT(t,e){return new Cy({type:"union",options:t,inclusive:!1,...S.normalizeParams(e)})}var Dy=m("ZodDiscriminatedUnion",(t,e)=>{Fs.init(t,e),id.init(t,e)});function Vs(t,e,r){return new Dy({type:"union",options:e,discriminator:t,...S.normalizeParams(r)})}var Ay=m("ZodIntersection",(t,e)=>{ad.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>X_(t,r,n,o)});function Ii(t,e){return new Ay({type:"intersection",left:t,right:e})}var Uy=m("ZodTuple",(t,e)=>{is.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Y_(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Zy(t,e,r){let n=e instanceof W,o=n?r:e,i=n?e:null;return new Uy({type:"tuple",items:t,rest:i,...S.normalizeParams(o)})}var Bs=m("ZodRecord",(t,e)=>{sd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Q_(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function me(t,e,r){return new Bs({type:"record",keyType:t,valueType:e,...S.normalizeParams(r)})}function tT(t,e,r){let n=He(t);return n._zod.values=void 0,new Bs({type:"record",keyType:n,valueType:e,...S.normalizeParams(r)})}function rT(t,e,r){return new Bs({type:"record",keyType:t,valueType:e,mode:"loose",...S.normalizeParams(r)})}var My=m("ZodMap",(t,e)=>{cd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>W_(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(sr(...r)),t.nonempty=r=>t.check(sr(1,r)),t.max=(...r)=>t.check(Kr(...r)),t.size=(...r)=>t.check(Mn(...r))});function nT(t,e,r){return new My({type:"map",keyType:t,valueType:e,...S.normalizeParams(r)})}var Ly=m("ZodSet",(t,e)=>{ud.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>G_(t,r,n,o),t.min=(...r)=>t.check(sr(...r)),t.nonempty=r=>t.check(sr(1,r)),t.max=(...r)=>t.check(Kr(...r)),t.size=(...r)=>t.check(Mn(...r))});function oT(t,e){return new Ly({type:"set",valueType:t,...S.normalizeParams(e)})}var wi=m("ZodEnum",(t,e)=>{ld.init(t,e),X.init(t,e),t._zod.processJSONSchema=(n,o,i)=>U_(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new wi({...e,checks:[],...S.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new wi({...e,checks:[],...S.normalizeParams(o),entries:i})}});function Be(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new wi({type:"enum",entries:r,...S.normalizeParams(e)})}function iT(t,e){return new wi({type:"enum",entries:t,...S.normalizeParams(e)})}var qy=m("ZodLiteral",(t,e)=>{dd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Z_(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function D(t,e){return new qy({type:"literal",values:Array.isArray(t)?t:[t],...S.normalizeParams(e)})}var Fy=m("ZodFile",(t,e)=>{fd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>q_(t,r,n,o),t.min=(r,n)=>t.check(sr(r,n)),t.max=(r,n)=>t.check(Kr(r,n)),t.mime=(r,n)=>t.check(_i(Array.isArray(r)?r:[r],n))});function aT(t){return lf(Fy,t)}var Vy=m("ZodTransform",(t,e)=>{pd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>J_(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(S.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(S.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Kf(t){return new Vy({type:"transform",transform:t})}var Hf=m("ZodOptional",(t,e)=>{as.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>_f(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function ke(t){return new Hf({type:"optional",innerType:t})}var By=m("ZodExactOptional",(t,e)=>{md.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>_f(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Jy(t){return new By({type:"optional",innerType:t})}var Wy=m("ZodNullable",(t,e)=>{hd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ey(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Rs(t){return new Wy({type:"nullable",innerType:t})}function sT(t){return ke(Rs(t))}var Gy=m("ZodDefault",(t,e)=>{gd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ry(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Ky(t,e){return new Gy({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():S.shallowClone(e)}})}var Hy=m("ZodPrefault",(t,e)=>{vd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ny(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Xy(t,e){return new Hy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():S.shallowClone(e)}})}var Xf=m("ZodNonOptional",(t,e)=>{_d.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ty(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Yy(t,e){return new Xf({type:"nonoptional",innerType:t,...S.normalizeParams(e)})}var Qy=m("ZodSuccess",(t,e)=>{yd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>F_(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function cT(t){return new Qy({type:"success",innerType:t})}var e$=m("ZodCatch",(t,e)=>{$d.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>oy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function t$(t,e){return new e$({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var r$=m("ZodNaN",(t,e)=>{bd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>M_(t,r,n,o)});function uT(t){return nf(r$,t)}var Yf=m("ZodPipe",(t,e)=>{xd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>iy(t,r,n,o),t.in=e.in,t.out=e.out});function Cs(t,e){return new Yf({type:"pipe",in:t,out:e})}var Qf=m("ZodCodec",(t,e)=>{Yf.init(t,e),ui.init(t,e)});function lT(t,e,r){return new Qf({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var n$=m("ZodReadonly",(t,e)=>{kd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ay(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function o$(t){return new n$({type:"readonly",innerType:t})}var i$=m("ZodTemplateLiteral",(t,e)=>{Sd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>L_(t,r,n,o)});function dT(t,e){return new i$({type:"template_literal",parts:t,...S.normalizeParams(e)})}var a$=m("ZodLazy",(t,e)=>{Id.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>cy(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function s$(t){return new a$({type:"lazy",getter:t})}var c$=m("ZodPromise",(t,e)=>{zd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>sy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function fT(t){return new c$({type:"promise",innerType:t})}var u$=m("ZodFunction",(t,e)=>{wd.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>B_(t,r,n,o)});function pT(t){return new u$({type:"function",input:Array.isArray(t?.input)?Zy(t?.input):t?.input??re(_e()),output:t?.output??_e()})}var Js=m("ZodCustom",(t,e)=>{Td.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>V_(t,r,n,o)});function mT(t){let e=new ge({check:"custom"});return e._zod.check=t,e}function ep(t,e){return df(Js,t??(()=>!0),e)}function l$(t,e={}){return ff(Js,t,e)}function d$(t){return pf(t)}var hT=mf,gT=hf;function vT(t,e={}){let r=new Js({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...S.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var _T=(...t)=>gf({Codec:Qf,Boolean:Zs,String:Ds},...t);function yT(t){let e=s$(()=>ye([_(t),de(),je(),Ls(),re(e),me(_(),e)]));return e}function Ws(t,e){return Cs(Kf(t),e)}var f$;f$||(f$={});var g6={...Si,...js,iso:Hr};Re(Pd());var rp="2025-11-25";var p$=[rp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zr="io.modelcontextprotocol/related-task",Ks="2.0",Ce=ep(t=>t!==null&&(typeof t=="object"||typeof t=="function")),m$=ye([_(),de().int()]),h$=_(),C6=Ve({ttl:de().optional(),pollInterval:de().optional()}),kT=O({ttl:de().optional()}),ST=O({taskId:_()}),np=Ve({progressToken:m$.optional(),[zr]:ST.optional()}),mt=O({_meta:np.optional()}),Ti=mt.extend({task:kT.optional()}),g$=t=>Ti.safeParse(t).success,Ue=O({method:_(),params:mt.loose().optional()}),xt=O({_meta:np.optional()}),kt=O({method:_(),params:xt.loose().optional()}),Ze=Ve({_meta:np.optional()}),Hs=ye([_(),de().int()]),v$=O({jsonrpc:D(Ks),id:Hs,...Ue.shape}).strict(),op=t=>v$.safeParse(t).success,_$=O({jsonrpc:D(Ks),...kt.shape}).strict(),y$=t=>_$.safeParse(t).success,ip=O({jsonrpc:D(Ks),id:Hs,result:Ze}).strict(),Pi=t=>ip.safeParse(t).success;var B;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(B||(B={}));var ap=O({jsonrpc:D(Ks),id:Hs.optional(),error:O({code:de().int(),message:_(),data:_e().optional()})}).strict();var $$=t=>ap.safeParse(t).success;var b$=ye([v$,_$,ip,ap]),D6=ye([ip,ap]),Xr=Ze.strict(),wT=xt.extend({requestId:Hs.optional(),reason:_().optional()}),Xs=kt.extend({method:D("notifications/cancelled"),params:wT}),zT=O({src:_(),mimeType:_().optional(),sizes:re(_()).optional(),theme:Be(["light","dark"]).optional()}),Ei=O({icons:re(zT).optional()}),Jn=O({name:_(),title:_().optional()}),x$=Jn.extend({...Jn.shape,...Ei.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),IT=Ii(O({applyDefaults:je().optional()}),me(_(),_e())),TT=Ws(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ii(O({form:IT.optional(),url:Ce.optional()}),me(_(),_e()).optional())),PT=Ve({list:Ce.optional(),cancel:Ce.optional(),requests:Ve({sampling:Ve({createMessage:Ce.optional()}).optional(),elicitation:Ve({create:Ce.optional()}).optional()}).optional()}),ET=Ve({list:Ce.optional(),cancel:Ce.optional(),requests:Ve({tools:Ve({call:Ce.optional()}).optional()}).optional()}),OT=O({experimental:me(_(),Ce).optional(),sampling:O({context:Ce.optional(),tools:Ce.optional()}).optional(),elicitation:TT.optional(),roots:O({listChanged:je().optional()}).optional(),tasks:PT.optional(),extensions:me(_(),Ce).optional()}),jT=mt.extend({protocolVersion:_(),capabilities:OT,clientInfo:x$}),NT=Ue.extend({method:D("initialize"),params:jT});var RT=O({experimental:me(_(),Ce).optional(),logging:Ce.optional(),completions:Ce.optional(),prompts:O({listChanged:je().optional()}).optional(),resources:O({subscribe:je().optional(),listChanged:je().optional()}).optional(),tools:O({listChanged:je().optional()}).optional(),tasks:ET.optional(),extensions:me(_(),Ce).optional()}),sp=Ze.extend({protocolVersion:_(),capabilities:RT,serverInfo:x$,instructions:_().optional()}),CT=kt.extend({method:D("notifications/initialized"),params:xt.optional()});var Ys=Ue.extend({method:D("ping"),params:mt.optional()}),DT=O({progress:de(),total:ke(de()),message:ke(_())}),AT=O({...xt.shape,...DT.shape,progressToken:m$}),Qs=kt.extend({method:D("notifications/progress"),params:AT}),UT=mt.extend({cursor:h$.optional()}),Oi=Ue.extend({params:UT.optional()}),ji=Ze.extend({nextCursor:h$.optional()}),ZT=Be(["working","input_required","completed","failed","cancelled"]),Ni=O({taskId:_(),status:ZT,ttl:ye([de(),Ls()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:ke(de()),statusMessage:ke(_())}),Yr=Ze.extend({task:Ni}),MT=xt.merge(Ni),Ri=kt.extend({method:D("notifications/tasks/status"),params:MT}),ec=Ue.extend({method:D("tasks/get"),params:mt.extend({taskId:_()})}),tc=Ze.merge(Ni),rc=Ue.extend({method:D("tasks/result"),params:mt.extend({taskId:_()})}),A6=Ze.loose(),nc=Oi.extend({method:D("tasks/list")}),oc=ji.extend({tasks:re(Ni)}),ic=Ue.extend({method:D("tasks/cancel"),params:mt.extend({taskId:_()})}),k$=Ze.merge(Ni),S$=O({uri:_(),mimeType:ke(_()),_meta:me(_(),_e()).optional()}),w$=S$.extend({text:_()}),cp=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),z$=S$.extend({blob:cp}),Ci=Be(["user","assistant"]),Wn=O({audience:re(Ci).optional(),priority:de().min(0).max(1).optional(),lastModified:Hr.datetime({offset:!0}).optional()}),I$=O({...Jn.shape,...Ei.shape,uri:_(),description:ke(_()),mimeType:ke(_()),size:ke(de()),annotations:Wn.optional(),_meta:ke(Ve({}))}),LT=O({...Jn.shape,...Ei.shape,uriTemplate:_(),description:ke(_()),mimeType:ke(_()),annotations:Wn.optional(),_meta:ke(Ve({}))}),qT=Oi.extend({method:D("resources/list")}),up=ji.extend({resources:re(I$)}),FT=Oi.extend({method:D("resources/templates/list")}),lp=ji.extend({resourceTemplates:re(LT)}),dp=mt.extend({uri:_()}),VT=dp,BT=Ue.extend({method:D("resources/read"),params:VT}),fp=Ze.extend({contents:re(ye([w$,z$]))}),pp=kt.extend({method:D("notifications/resources/list_changed"),params:xt.optional()}),JT=dp,WT=Ue.extend({method:D("resources/subscribe"),params:JT}),GT=dp,KT=Ue.extend({method:D("resources/unsubscribe"),params:GT}),HT=xt.extend({uri:_()}),XT=kt.extend({method:D("notifications/resources/updated"),params:HT}),YT=O({name:_(),description:ke(_()),required:ke(je())}),QT=O({...Jn.shape,...Ei.shape,description:ke(_()),arguments:ke(re(YT)),_meta:ke(Ve({}))}),eP=Oi.extend({method:D("prompts/list")}),mp=ji.extend({prompts:re(QT)}),tP=mt.extend({name:_(),arguments:me(_(),_()).optional()}),rP=Ue.extend({method:D("prompts/get"),params:tP}),hp=O({type:D("text"),text:_(),annotations:Wn.optional(),_meta:me(_(),_e()).optional()}),gp=O({type:D("image"),data:cp,mimeType:_(),annotations:Wn.optional(),_meta:me(_(),_e()).optional()}),vp=O({type:D("audio"),data:cp,mimeType:_(),annotations:Wn.optional(),_meta:me(_(),_e()).optional()}),nP=O({type:D("tool_use"),name:_(),id:_(),input:me(_(),_e()),_meta:me(_(),_e()).optional()}),oP=O({type:D("resource"),resource:ye([w$,z$]),annotations:Wn.optional(),_meta:me(_(),_e()).optional()}),iP=I$.extend({type:D("resource_link")}),_p=ye([hp,gp,vp,iP,oP]),aP=O({role:Ci,content:_p}),yp=Ze.extend({description:_().optional(),messages:re(aP)}),$p=kt.extend({method:D("notifications/prompts/list_changed"),params:xt.optional()}),sP=O({title:_().optional(),readOnlyHint:je().optional(),destructiveHint:je().optional(),idempotentHint:je().optional(),openWorldHint:je().optional()}),cP=O({taskSupport:Be(["required","optional","forbidden"]).optional()}),T$=O({...Jn.shape,...Ei.shape,description:_().optional(),inputSchema:O({type:D("object"),properties:me(_(),Ce).optional(),required:re(_()).optional()}).catchall(_e()),outputSchema:O({type:D("object"),properties:me(_(),Ce).optional(),required:re(_()).optional()}).catchall(_e()).optional(),annotations:sP.optional(),execution:cP.optional(),_meta:me(_(),_e()).optional()}),uP=Oi.extend({method:D("tools/list")}),bp=ji.extend({tools:re(T$)}),Gn=Ze.extend({content:re(_p).default([]),structuredContent:me(_(),_e()).optional(),isError:je().optional()}),U6=Gn.or(Ze.extend({toolResult:_e()})),lP=Ti.extend({name:_(),arguments:me(_(),_e()).optional()}),dP=Ue.extend({method:D("tools/call"),params:lP}),xp=kt.extend({method:D("notifications/tools/list_changed"),params:xt.optional()}),P$=O({autoRefresh:je().default(!0),debounceMs:de().int().nonnegative().default(300)}),E$=Be(["debug","info","notice","warning","error","critical","alert","emergency"]),fP=mt.extend({level:E$}),pP=Ue.extend({method:D("logging/setLevel"),params:fP}),mP=xt.extend({level:E$,logger:_().optional(),data:_e()}),hP=kt.extend({method:D("notifications/message"),params:mP}),gP=O({name:_().optional()}),vP=O({hints:re(gP).optional(),costPriority:de().min(0).max(1).optional(),speedPriority:de().min(0).max(1).optional(),intelligencePriority:de().min(0).max(1).optional()}),_P=O({mode:Be(["auto","required","none"]).optional()}),yP=O({type:D("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:re(_p).default([]),structuredContent:O({}).loose().optional(),isError:je().optional(),_meta:me(_(),_e()).optional()}),$P=Vs("type",[hp,gp,vp]),Gs=Vs("type",[hp,gp,vp,nP,yP]),bP=O({role:Ci,content:ye([Gs,re(Gs)]),_meta:me(_(),_e()).optional()}),xP=Ti.extend({messages:re(bP),modelPreferences:vP.optional(),systemPrompt:_().optional(),includeContext:Be(["none","thisServer","allServers"]).optional(),temperature:de().optional(),maxTokens:de().int(),stopSequences:re(_()).optional(),metadata:Ce.optional(),tools:re(T$).optional(),toolChoice:_P.optional()}),kp=Ue.extend({method:D("sampling/createMessage"),params:xP}),Sp=Ze.extend({model:_(),stopReason:ke(Be(["endTurn","stopSequence","maxTokens"]).or(_())),role:Ci,content:$P}),wp=Ze.extend({model:_(),stopReason:ke(Be(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Ci,content:ye([Gs,re(Gs)])}),kP=O({type:D("boolean"),title:_().optional(),description:_().optional(),default:je().optional()}),SP=O({type:D("string"),title:_().optional(),description:_().optional(),minLength:de().optional(),maxLength:de().optional(),format:Be(["email","uri","date","date-time"]).optional(),default:_().optional()}),wP=O({type:Be(["number","integer"]),title:_().optional(),description:_().optional(),minimum:de().optional(),maximum:de().optional(),default:de().optional()}),zP=O({type:D("string"),title:_().optional(),description:_().optional(),enum:re(_()),default:_().optional()}),IP=O({type:D("string"),title:_().optional(),description:_().optional(),oneOf:re(O({const:_(),title:_()})),default:_().optional()}),TP=O({type:D("string"),title:_().optional(),description:_().optional(),enum:re(_()),enumNames:re(_()).optional(),default:_().optional()}),PP=ye([zP,IP]),EP=O({type:D("array"),title:_().optional(),description:_().optional(),minItems:de().optional(),maxItems:de().optional(),items:O({type:D("string"),enum:re(_())}),default:re(_()).optional()}),OP=O({type:D("array"),title:_().optional(),description:_().optional(),minItems:de().optional(),maxItems:de().optional(),items:O({anyOf:re(O({const:_(),title:_()}))}),default:re(_()).optional()}),jP=ye([EP,OP]),NP=ye([TP,PP,jP]),RP=ye([NP,kP,SP,wP]),CP=Ti.extend({mode:D("form").optional(),message:_(),requestedSchema:O({type:D("object"),properties:me(_(),RP),required:re(_()).optional()})}),DP=Ti.extend({mode:D("url"),message:_(),elicitationId:_(),url:_().url()}),AP=ye([CP,DP]),zp=Ue.extend({method:D("elicitation/create"),params:AP}),UP=xt.extend({elicitationId:_()}),ZP=kt.extend({method:D("notifications/elicitation/complete"),params:UP}),Ip=Ze.extend({action:Be(["accept","decline","cancel"]),content:Ws(t=>t===null?void 0:t,me(_(),ye([_(),de(),je(),re(_())])).optional())}),MP=O({type:D("ref/resource"),uri:_()});var LP=O({type:D("ref/prompt"),name:_()}),qP=mt.extend({ref:ye([LP,MP]),argument:O({name:_(),value:_()}),context:O({arguments:me(_(),_()).optional()}).optional()}),FP=Ue.extend({method:D("completion/complete"),params:qP});var Tp=Ze.extend({completion:Ve({values:re(_()).max(100),total:ke(de().int()),hasMore:ke(je())})}),VP=O({uri:_().startsWith("file://"),name:_().optional(),_meta:me(_(),_e()).optional()}),BP=Ue.extend({method:D("roots/list"),params:mt.optional()}),JP=Ze.extend({roots:re(VP)}),WP=kt.extend({method:D("notifications/roots/list_changed"),params:xt.optional()}),Z6=ye([Ys,NT,FP,pP,rP,eP,qT,FT,BT,WT,KT,dP,uP,ec,rc,nc,ic]),M6=ye([Xs,Qs,CT,WP,Ri]),L6=ye([Xr,Sp,wp,Ip,JP,tc,oc,Yr]),q6=ye([Ys,kp,zp,BP,ec,rc,nc,ic]),F6=ye([Xs,Qs,hP,XT,pp,xp,$p,Ri,ZP]),V6=ye([Xr,sp,Tp,yp,mp,up,lp,fp,Gn,bp,tc,oc,Yr]),Z=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===B.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new tp(o.elicitations,r)}return new t(e,r,n)}},tp=class extends Z{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(B.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Ir(t){return t==="completed"||t==="failed"||t==="cancelled"}var SM=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Pp(t){let r=Os(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=fy(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ep(t,e){let r=Nt(t,e);if(!r.success)throw r.error;return r.data}var QP=6e4,ac=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Xs,r=>{this._oncancel(r)}),this.setNotificationHandler(Qs,r=>{this._onprogress(r)}),this.setRequestHandler(Ys,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ec,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(B.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(rc,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new Z(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new Z(B.InvalidParams,`Task not found: ${i}`);if(!Ir(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Ir(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[zr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(nc,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new Z(B.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ic,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(B.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ir(o.status))throw new Z(B.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Z(B.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(B.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),Z.fromError(B.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),Pi(i)||$$(i)?this._onresponse(i):op(i)?this._onrequest(i,a):y$(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Z.fromError(B.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[zr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:B.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=g$(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new Z(B.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let v=f.relatedTask?.taskId??i;return v&&c&&await c.updateTaskStatus(v,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:B.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Pi(e))n(e);else{let a=new Z(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Pi(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),Pi(e))o(e);else{let a=Z.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof Z?a:new Z(B.InternalError,String(a))}}return}let i;try{let a=await this.request(e,Yr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new Z(B.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Ir(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new Z(B.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Z(B.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof Z?a:new Z(B.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(P){d(P);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[zr]:c}});let v=P=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(P)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(U=>this._onerror(new Error(`Failed to send cancellation: ${U}`)));let j=P instanceof Z?P:new Z(B.RequestTimeout,String(P));l(j)};this._responseHandlers.set(p,P=>{if(!n?.signal?.aborted){if(P instanceof Error)return l(P);try{let j=Nt(r,P.result);j.success?u(j.data):l(j.error)}catch(j){l(j)}}}),n?.signal?.addEventListener("abort",()=>{v(n?.signal?.reason)});let h=n?.timeout??QP,$=()=>v(Z.fromError(B.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let P=j=>{let U=this._responseHandlers.get(p);U?U(j):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,P),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(j=>{this._cleanupTimeout(p),l(j)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(P=>{this._cleanupTimeout(p),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},tc,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},oc,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},k$,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[zr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[zr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[zr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=Pp(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Ep(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Pp(e);this._notificationHandlers.set(n,o=>{let i=Ep(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&op(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new Z(B.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new Z(B.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new Z(B.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new Z(B.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Ri.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Ir(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new Z(B.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Ir(s.status))throw new Z(B.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Ri.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ir(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function O$(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function j$(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];O$(a)&&O$(i)?r[o]={...a,...i}:r[o]=i}return r}var _k=fe(hh(),1),yk=fe(vk(),1);function V4(){let t=new _k.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,yk.default)(t),t}var qc=class{constructor(e){this._ajv=e??V4()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Fc=class{constructor(e){this._client=e}async*callToolStream(e,r=Gn,n){let o=this._client,i={...n,task:n?.task??(o.isToolTask(e.name)?{}:void 0)},a=o.requestStream({method:"tools/call",params:e},r,i),s=o.getToolOutputValidator(e.name);for await(let c of a){if(c.type==="result"&&s){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new Z(B.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=s(u.structuredContent);if(!l.valid){yield{type:"error",error:new Z(B.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof Z){yield{type:"error",error:l};return}yield{type:"error",error:new Z(B.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function $k(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bk(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function Vc(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Vc(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&Vc(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&Vc(r,e)}}function B4(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Bc=class extends ac{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new qc,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",xp,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",$p,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",pp,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Fc(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=j$(this._capabilities,e)}setRequestHandler(e,r){let o=Os(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Vn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");let a=i;if(a==="elicitation/create"){let s=async(c,u)=>{let l=Nt(zp,c);if(!l.success){let P=l.error instanceof Error?l.error.message:String(l.error);throw new Z(B.InvalidParams,`Invalid elicitation request: ${P}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=B4(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new Z(B.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new Z(B.InvalidParams,"Client does not support URL-mode elicitation requests");let v=await Promise.resolve(r(c,u));if(d.task){let P=Nt(Yr,v);if(!P.success){let j=P.error instanceof Error?P.error.message:String(P.error);throw new Z(B.InvalidParams,`Invalid task creation result: ${j}`)}return P.data}let h=Nt(Ip,v);if(!h.success){let P=h.error instanceof Error?h.error.message:String(h.error);throw new Z(B.InvalidParams,`Invalid elicitation result: ${P}`)}let $=h.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&$.action==="accept"&&$.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{Vc(w,$.content)}catch{}return $};return super.setRequestHandler(e,s)}if(a==="sampling/createMessage"){let s=async(c,u)=>{let l=Nt(kp,c);if(!l.success){let $=l.error instanceof Error?l.error.message:String(l.error);throw new Z(B.InvalidParams,`Invalid sampling request: ${$}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let $=Nt(Yr,p);if(!$.success){let w=$.error instanceof Error?$.error.message:String($.error);throw new Z(B.InvalidParams,`Invalid task creation result: ${w}`)}return $.data}let v=d.tools||d.toolChoice?wp:Sp,h=Nt(v,p);if(!h.success){let $=h.error instanceof Error?h.error.message:String(h.error);throw new Z(B.InvalidParams,`Invalid sampling result: ${$}`)}return h.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:rp,capabilities:this._capabilities,clientInfo:this._clientInfo}},sp,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!p$.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){$k(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&bk(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Xr,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Tp,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Xr,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},yp,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},mp,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},up,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},lp,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},fp,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Xr,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Xr,r)}async callTool(e,r=Gn,n){if(this.isToolTaskRequired(e.name))throw new Z(B.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new Z(B.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let a=i(o.structuredContent);if(!a.valid)throw new Z(B.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof Z?a:new Z(B.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return o}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},bp,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,o){let i=P$.safeParse(n);if(!i.success)throw new Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:s}=i.data,{onChanged:c}=n,u=async()=>{if(!a){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(s){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(u,s);this._listChangedDebounceTimers.set(e,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var dS=fe(uS(),1),Kc=fe(require("node:process"),1),fS=require("node:stream");var Wc=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
88
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),_R(r)}clear(){this._buffer=void 0}};function _R(t){return b$.parse(JSON.parse(t))}function lS(t){return JSON.stringify(t)+`
89
+ `}var yR=Kc.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function $R(){let t={};for(let e of yR){let r=Kc.default.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var Gc=class{constructor(e){this._readBuffer=new Wc,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new fS.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,dS.default)(this._serverParams.command,this._serverParams.args??[],{env:{...$R(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Kc.default.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",n=>{r(n),this.onerror?.(n)}),this._process.on("spawn",()=>{e()}),this._process.on("close",n=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",n=>{this.onerror?.(n)}),this._process.stdout?.on("data",n=>{this._readBuffer.append(n),this.processReadBuffer()}),this._process.stdout?.on("error",n=>{this.onerror?.(n)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let r=new Promise(n=>{e.once("close",()=>{n()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let n=lS(e);this._process.stdin.write(n)?r():this._process.stdin.once("drain",r)})}};var mS=require("child_process"),Dr=fe(require("fs")),fa=fe(require("path"));var pS={"aws-docs":{description:"Search and read AWS official documentation",command:"uvx",args:["awslabs.aws-documentation-mcp-server@latest"],env:{FASTMCP_LOG_LEVEL:"ERROR",AWS_DOCUMENTATION_PARTITION:"aws"},autoApprove:["search_documentation","read_documentation","recommend","read_sections"]},"cloudflare-docs":{description:"Search Cloudflare official documentation (via Vectorize)",command:"npx",args:["-y","mcp-remote","https://docs.mcp.cloudflare.com/mcp"],autoApprove:["search_cloudflare_documentation"]},context7:{description:"Fetch up-to-date, version-accurate documentation for any library",command:"npx",args:["-y","@upstash/context7-mcp"],autoApprove:["resolve-library-id","get-library-docs"]},"sequential-thinking":{description:"Structured step-by-step problem solving with revision and branching",command:"npx",args:["-y","@modelcontextprotocol/server-sequential-thinking"],autoApprove:["sequentialthinking"]}};function xR(){return pS}var Hc=class{servers=new Map;toolMap=new Map;toolDefs=[];registry;userConfig={};constructor(){this.registry=xR()}async init(){this.userConfig=this.loadUserConfig();let e=Object.entries(this.userConfig).filter(([,o])=>!o.disabled),r=await Promise.allSettled(e.map(async([o,i])=>this.connectServer(o,{...this.registry[o],...i}))),n=[];return r.forEach((o,i)=>{o.status==="fulfilled"?n.push(...o.value):console.error(` MCP [${e[i][0]}]: failed \u2014 ${o.reason.message}`)}),this.toolDefs=n,n}async enable(e){if(this.servers.has(e))return{ok:!1,error:`${e} is already connected`};let r=this.userConfig[e]||this.registry[e];if(!r)return{ok:!1,error:`Unknown server: ${e}. Available: ${this.listAvailable().join(", ")}`};let n=this.checkCommand(r.command);if(n)return{ok:!1,error:n};try{let o=await this.connectServer(e,r);return this.toolDefs.push(...o),this.userConfig[e]={...r,disabled:!1},this.saveUserConfig(),{ok:!0,tools:o}}catch(o){return{ok:!1,error:o.message}}}async disable(e){let r=this.servers.get(e);if(!r)return{ok:!1,error:`${e} is not connected`};try{await r.client.close()}catch{}for(let n of r.tools)this.toolMap.delete(n.name);return this.toolDefs=this.toolDefs.filter(n=>n.serverName!==e),this.servers.delete(e),this.userConfig[e]={...this.userConfig[e]||this.registry[e],disabled:!0},this.saveUserConfig(),{ok:!0}}listAll(){let e={...this.registry,...this.userConfig};return Object.entries(e).map(([r,n])=>({name:r,description:n.description||"",connected:this.servers.has(r)}))}listAvailable(){let e={...this.registry,...this.userConfig};return Object.keys(e).filter(r=>!this.servers.has(r))}getToolList(){return this.toolDefs}getInstructions(){let e={};for(let[r,n]of this.servers)n.instructions&&(e[r]=n.instructions);return e}getServerForTool(e){return this.toolMap.get(e)}isAutoApprove(e){let r=this.toolMap.get(e);return r?this.servers.get(r)?.config.autoApprove?.includes(e)??!1:!1}async callTool(e,r){let n=this.toolMap.get(e);if(!n)return{success:!1,output:`MCP tool not found: ${e}`};let o=this.servers.get(n);if(!o)return{success:!1,output:`MCP server not connected: ${n}`};try{let i=await o.client.callTool({name:e,arguments:r}),a=i.content.map(s=>s.type==="text"?s.text:JSON.stringify(s)).join(`
90
+ `);return{success:!i.isError,output:a}}catch(i){this.servers.delete(n);for(let a of o.tools)this.toolMap.delete(a.name);return this.toolDefs=this.toolDefs.filter(a=>a.serverName!==n),{success:!1,output:`MCP server ${n} disconnected: ${i.message}`}}}async shutdown(){for(let[,{client:e}]of this.servers)try{await e.close()}catch{}this.servers.clear(),this.toolMap.clear(),this.toolDefs=[]}async connectServer(e,r){let n={...process.env,...r.env?this.expandEnv(r.env):{}},o=new Gc({command:r.command,args:r.args,env:n,stderr:"ignore"}),i=new Bc({name:`synara-${e}`,version:"1.0.0"});await i.connect(o);let a=i._instructions||void 0,{tools:s}=await i.listTools(),c=new Set(r.disabledTools||[]),u=new Set(r.autoApprove||[]),l=s.filter(d=>!c.has(d.name)).map(d=>(this.toolMap.set(d.name,e),{name:d.name,description:d.description||"",inputSchema:d.inputSchema,serverName:e,autoApprove:u.has(d.name)}));return this.servers.set(e,{client:i,transport:o,config:r,tools:l,instructions:a}),l}loadUserConfig(){let e={},r=fa.join(process.env.HOME||"~",".synapse","settings","mcp.json");this.mergeFile(r,e);let n=fa.join(process.cwd(),".synapse","settings","mcp.json");return this.mergeFile(n,e),e}saveUserConfig(){let e=fa.join(process.env.HOME||"~",".synapse","settings");Dr.mkdirSync(e,{recursive:!0});let r=fa.join(e,"mcp.json");Dr.writeFileSync(r,JSON.stringify({mcpServers:this.userConfig},null,2),"utf-8")}mergeFile(e,r){try{if(!Dr.existsSync(e))return;let n=JSON.parse(Dr.readFileSync(e,"utf-8")),o=n.mcpServers||n;for(let[i,a]of Object.entries(o))r[i]=a}catch{}}expandEnv(e){let r={};for(let[n,o]of Object.entries(e))r[n]=o.replace(/\$\{(\w+)\}/g,(i,a)=>process.env[a]||"");return r}checkCommand(e){try{return(0,mS.execSync)(`which ${e}`,{stdio:"ignore"}),null}catch{return`'${e}' not found. ${{uvx:"Install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh",npx:"Install Node.js: https://nodejs.org/",python3:"Install Python 3: https://www.python.org/downloads/"}[e]||`Please install '${e}' and try again.`}`}}};var kR=process.env.SYNAPSE_CLI_WS||"wss://cli.synapse.cloudc.top",SR=Zt.join(process.env.HOME||"~",".synapse","token"),ho=[],hS=[],pa="idle",ln=!1,wR=0,ma=!1,hr=[],Xc=process.argv[2];(async()=>{Xc==="login"&&(await lv(),process.exit(0)),Xc==="logout"&&(await dv(),process.exit(0)),(Xc==="--help"||Xc==="-h")&&(console.log(`
91
+ ${g.cyan.bold("\u26A1 Synara")} \u2014 AI coding assistant
92
92
 
93
- ${v.bold("Usage:")}
93
+ ${g.bold("Usage:")}
94
94
  synara Start coding session in current directory
95
95
  synara login Login with username/password
96
96
  synara logout Remove stored credentials
97
97
 
98
- ${v.bold("Session commands:")}
98
+ ${g.bold("Session commands:")}
99
99
  /compact Compress conversation history
100
100
  /context Show context usage (tokens, messages)
101
101
  /tools List available tools
@@ -107,53 +107,54 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
107
107
  /help Show this help
108
108
  /quit End session
109
109
 
110
- ${v.bold("Input:")}
110
+ ${g.bold("Input:")}
111
111
  \\ + Enter Multi-line continuation
112
112
  Ctrl+C Cancel current operation
113
- `),process.exit(0));let t=null,e=null,r=null,n=new Jc;function o(){if(r)return;ua="active";let $=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],b=0;process.stdout.write(v.gray(`
114
- ${$[0]} Thinking...`)),r=setInterval(()=>{b=(b+1)%$.length,process.stdout.write(`\r ${v.gray($[b]+" Thinking...")}`)},80)}function i(){r&&(clearInterval(r),r=null,process.stdout.write("\r\x1B[2K"))}function a(){try{return Te.readFileSync(kR,"utf-8").trim()}catch{return null}}function s(){for(let $ of["SYNAPSE.md","synapse.md"]){let b=Wt.join(process.cwd(),$);if(Te.existsSync(b))return Te.readFileSync(b,"utf-8")}}async function c(){ev();let $=a();$||(Io("Not logged in. Run: synara login"),process.exit(1));let b=`${xR}/ws?token=${encodeURIComponent($)}`,C=new Rg(b);t=C,process.on("SIGINT",()=>{ua==="idle"&&(console.log(v.gray(`
115
- Bye!`)),process.exit(0)),i(),console.log(v.yellow(`
116
- \u23F9 Cancelled`)),ce({type:"cancel"}),ua="idle",po=!0;let G=mS;z()}),C.on("open",()=>{ce({type:"auth",token:$,project:{path:process.cwd(),synapseMd:s()}}),n.init().then(G=>{if(G.length>0){ce({type:"mcp_tools",tools:G,instructions:n.getInstructions()});let Oe=[...new Set(G.map(Ie=>Ie.serverName))];for(let Ie of Oe)console.log(v.gray(` MCP: ${Ie} connected`))}}).catch(()=>{})}),C.on("message",async G=>{let Oe=JSON.parse(G.toString());if(la){pr.push(Oe);return}await B(Oe)});async function B(G){switch(G.type){case"session_ready":z();break;case"reasoning_token":case"reasoning_end":break;case"content_token":if(po)break;i(),process.stdout.write(G.content);break;case"content_end":if(po)break;process.stdout.write(`
117
- `);break;case"turn_end":i(),ua="idle",po=!1,z();break;case"assistant_message":i(),tv(Yg(G.content)),z();break;case"tool_request":if(i(),po)break;G.tool==="web_search"||G.tool==="web_fetch"?Ca(G.tool,G.args):n.getServerForTool(G.tool)?await l(G):await u(G);break;case"tool_result_from_cloud":rv(G.tool,G.success,G.output),o();break;case"session_save":i(),p(G),z();break;case"session_load":i(),g(G);break;case"session_list_request":i(),h(),z();break;case"error":i(),Io(G.message),z();break}}C.on("close",()=>{console.log(v.gray(`
118
- Connection closed.`)),process.exit(0)}),C.on("error",G=>{Io(`Connection failed: ${G.message}`),process.exit(1)})}async function u($){let b=$.description||`${$.tool}`;Ca($.tool,$.args,b);let C=await Xg($.tool,$.args,b);if(C==="y"||C==="t"){d($.tool,$.args);let Ie=Date.now(),pt=await $u($.tool,$.args);zo($.tool,pt.success,pt.output,Date.now()-Ie,$.args),ce({type:"tool_result",call_id:$.call_id,...pt}),o();return}if($.tool==="write_file"&&$.args.content){let Ie=xu($.args.path);Ie?ku(Ie,$.args.content,$.args.path):nv($.args.path,$.args.content)}else if($.tool==="edit_file"&&$.args.old_str&&$.args.new_str){let Ie=xu($.args.path);ku($.args.old_str,$.args.new_str,$.args.path,Ie)}e?.close(),e=null,la=!0;let B;try{B=await bu($.tool,$.args,b)}catch{B="n"}if(la=!1,B==="n"){for(ce({type:"tool_result",call_id:$.call_id,success:!1,output:"User denied"});pr.length;)await handleMessage(pr.shift());o();return}d($.tool,$.args);let G=Date.now(),Oe=await $u($.tool,$.args);for(zo($.tool,Oe.success,Oe.output,Date.now()-G,$.args),ce({type:"tool_result",call_id:$.call_id,...Oe});pr.length;)await handleMessage(pr.shift());o()}async function l($){let b=$.description||`${$.tool}`;if(Ca($.tool,$.args,b),n.isAutoApprove($.tool)){let Oe=Date.now(),Ie=await n.callTool($.tool,$.args);zo($.tool,Ie.success,Ie.output,Date.now()-Oe,$.args),ce({type:"tool_result",call_id:$.call_id,...Ie}),o();return}e?.close(),e=null,la=!0;let C;try{C=await bu($.tool,$.args,b)}catch{C="n"}if(la=!1,C==="n"){for(ce({type:"tool_result",call_id:$.call_id,success:!1,output:"User denied"});pr.length;)await handleMessage(pr.shift());o();return}let B=Date.now(),G=await n.callTool($.tool,$.args);for(zo($.tool,G.success,G.output,Date.now()-B,$.args),ce({type:"tool_result",call_id:$.call_id,...G});pr.length;)await handleMessage(pr.shift());o()}function d($,b){if($!=="write_file"&&$!=="edit_file")return;let C=b.path;if(!C)return;let B=Wt.resolve(process.cwd(),C);try{Te.existsSync(B)?fo.push({tool:$,path:C,content:Te.readFileSync(B,"utf-8")}):fo.push({tool:$,path:C,content:""}),fo.length>50&&fo.shift()}catch{}}let f=Wt.join(process.cwd(),".synapse","sessions");function p($){Te.mkdirSync(f,{recursive:!0});let b=$.name||new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),C=Wt.join(f,`${b}.json`);if(Te.existsSync(C)&&!$.force){Io(`Session '${b}' already exists. Use /save ${b} --force to overwrite.`);return}let B={name:b,saved_at:new Date().toISOString(),messages:$.messages,meta:$.meta};Te.writeFileSync(C,JSON.stringify(B,null,2),"utf-8"),console.log(v.blue(` \u2713 Session saved: ${b}`)+v.gray(` (${$.messages.length} messages)`))}function g($){let b=$.name;if(!b){h(),ce({type:"session_data",messages:null,error:"No name. Use /load <name>"}),z();return}let C=Wt.join(f,`${b}.json`);if(!Te.existsSync(C)){ce({type:"session_data",messages:null,error:`Session '${b}' not found.`}),z();return}try{let B=JSON.parse(Te.readFileSync(C,"utf-8"));ce({type:"session_data",name:b,messages:B.messages,meta:B.meta||{}}),o()}catch(B){ce({type:"session_data",messages:null,error:`${B}`}),z()}}function h(){if(!Te.existsSync(f)){console.log(v.gray(" No saved sessions."));return}let $=Te.readdirSync(f).filter(b=>b.endsWith(".json")).sort();if($.length===0){console.log(v.gray(" No saved sessions."));return}console.log(v.white(`
119
- Saved sessions (${$.length}):`));for(let b of $)try{let C=JSON.parse(Te.readFileSync(Wt.join(f,b),"utf-8")),B=b.replace(".json","");console.log(v.cyan(` ${B}`)+v.gray(` \u2014 ${C.messages?.length||0} messages`))}catch{console.log(v.cyan(` ${b.replace(".json","")}`))}console.log("")}function y(){let $=[{name:"read_file",desc:"Read a file",perm:"auto"},{name:"write_file",desc:"Create or overwrite a file",perm:"ask"},{name:"edit_file",desc:"Edit a file (string replace)",perm:"ask"},{name:"grep",desc:"Search for patterns in files",perm:"auto"},{name:"glob",desc:"Find files by name pattern",perm:"auto"},{name:"list_dir",desc:"List directory contents",perm:"auto"},{name:"bash",desc:"Execute shell command",perm:"always ask"},{name:"web_search",desc:"Search the web",perm:"auto"},{name:"web_fetch",desc:"Fetch URL content",perm:"auto"}];console.log(v.white(`
113
+ `),process.exit(0));let t=null,e=null,r=null,n=new Hc,o;function i(){if(r)return;pa="active";let y=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],b=0;process.stdout.write(g.gray(`
114
+ ${y[0]} Thinking...`)),r=setInterval(()=>{b=(b+1)%y.length,process.stdout.write(`\r ${g.gray(y[b]+" Thinking...")}`)},80)}function a(){r&&(clearInterval(r),r=null,process.stdout.write("\r\x1B[2K"))}function s(){try{return Ee.readFileSync(SR,"utf-8").trim()}catch{return null}}function c(){for(let y of["SYNAPSE.md","synapse.md"]){let b=Zt.join(process.cwd(),y);if(Ee.existsSync(b))return Ee.readFileSync(b,"utf-8")}}async function u(){nv();let y=s();y||(Eo("Not logged in. Run: synara login"),process.exit(1));let b=`${kR}/ws?token=${encodeURIComponent(y)}`,R=new Ag(b);t=R;let N=0;process.on("SIGINT",()=>{if(pa==="idle"){let G=Date.now();G-N<2e3&&(console.log(g.gray(`
115
+ Bye!`)),process.exit(0)),N=G,console.log(g.gray(`
116
+ Press Ctrl+C again or type ${g.cyan("/quit")} to exit.`)),z();return}a(),console.log(g.yellow(`
117
+ \u23F9 Cancelled`)),ze({type:"cancel"}),pa="idle",ln=!0,z()}),R.on("open",()=>{ze({type:"auth",token:y,project:{path:process.cwd(),synapseMd:c()}});let G=Date.now();n.init().then(le=>{if(le.length>0){ze({type:"mcp_tools",tools:le,instructions:n.getInstructions()});let be=((Date.now()-G)/1e3).toFixed(1),ht=[...new Set(le.map(go=>go.serverName))];process.stdout.write("\r\x1B[2K");for(let go of ht)console.log(g.yellow(` MCP: ${go} connected`));console.log(g.gray(` Loaded in ${be}s`)),e&&(e.close(),e=null),z()}}).catch(()=>{})}),R.on("message",async G=>{let le=JSON.parse(G.toString());if(ma){hr.push(le);return}await oe(le)});async function oe(G){switch(G.type){case"session_ready":z();break;case"reasoning_token":case"reasoning_end":break;case"content_token":if(ln)break;a(),process.stdout.write(G.content);break;case"content_end":if(ln)break;process.stdout.write(`
118
+ `),i();break;case"turn_end":a(),pa="idle",ln=!1,z();break;case"assistant_message":a(),ov(tv(G.content)),z();break;case"tool_request":if(a(),ln)break;G.tool==="web_search"||G.tool==="web_fetch"?Za(G.tool,G.args):n.getServerForTool(G.tool)?await d(G):await l(G);break;case"tool_result_from_cloud":if(ln)break;iv(G.tool,G.success,G.output),i();break;case"session_save":a(),v(G),z();break;case"session_load":a(),h(G);break;case"session_list_request":a(),$(),z();break;case"error":a(),Eo(G.message),z();break}}o=oe,R.on("close",()=>{console.log(g.gray(`
119
+ Connection closed.`)),process.exit(0)}),R.on("error",G=>{Eo(`Connection failed: ${G.message}`),process.exit(1)})}async function l(y){let b=y.description||`${y.tool}`;Za(y.tool,y.args,b);let R=await ev(y.tool,y.args,b);if(R==="y"||R==="t"){if(y.tool==="write_file"&&y.args.content){let ht=To(y.args.path);ht?Oo(ht,y.args.content,y.args.path):zu(y.args.path,y.args.content)}else y.tool==="edit_file"&&y.args.old_str&&y.args.new_str&&Oo(y.args.old_str,y.args.new_str,y.args.path,To(y.args.path));p(y.tool,y.args);let le=Date.now(),be=await Su(y.tool,y.args);Po(y.tool,be.success,be.output,Date.now()-le,y.args),ze({type:"tool_result",call_id:y.call_id,...be}),i();return}if(y.tool==="write_file"&&y.args.content){let le=To(y.args.path);le?Oo(le,y.args.content,y.args.path):zu(y.args.path,y.args.content)}else if(y.tool==="edit_file"&&y.args.old_str&&y.args.new_str){let le=To(y.args.path);Oo(y.args.old_str,y.args.new_str,y.args.path,le)}e?.close(),e=null,ma=!0;let N;try{N=await wu(y.tool,y.args,b)}catch{N="n"}if(ma=!1,N==="n"){for(ze({type:"tool_result",call_id:y.call_id,success:!1,output:"User denied"});hr.length;)await o(hr.shift());i();return}p(y.tool,y.args);let oe=Date.now(),G=await Su(y.tool,y.args);for(Po(y.tool,G.success,G.output,Date.now()-oe,y.args),ze({type:"tool_result",call_id:y.call_id,...G});hr.length;)await o(hr.shift());i()}async function d(y){let b=y.description||`${y.tool}`;if(Za(y.tool,y.args,b),n.isAutoApprove(y.tool)){let G=Date.now(),le=await n.callTool(y.tool,y.args);Po(y.tool,le.success,le.output,Date.now()-G,y.args),ze({type:"tool_result",call_id:y.call_id,...le}),i();return}e?.close(),e=null,ma=!0;let R;try{R=await wu(y.tool,y.args,b)}catch{R="n"}if(ma=!1,R==="n"){for(ze({type:"tool_result",call_id:y.call_id,success:!1,output:"User denied"});hr.length;)await o(hr.shift());i();return}let N=Date.now(),oe=await n.callTool(y.tool,y.args);for(Po(y.tool,oe.success,oe.output,Date.now()-N,y.args),ze({type:"tool_result",call_id:y.call_id,...oe});hr.length;)await o(hr.shift());i()}function p(y,b){if(y!=="write_file"&&y!=="edit_file")return;let R=b.path;if(!R)return;let N=Zt.resolve(process.cwd(),R);try{Ee.existsSync(N)?ho.push({tool:y,path:R,content:Ee.readFileSync(N,"utf-8")}):ho.push({tool:y,path:R,content:""}),ho.length>50&&ho.shift()}catch{}}let f=Zt.join(process.cwd(),".synapse","sessions");function v(y){Ee.mkdirSync(f,{recursive:!0});let b=y.name||new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),R=Zt.join(f,`${b}.json`);if(Ee.existsSync(R)&&!y.force){Eo(`Session '${b}' already exists. Use /save ${b} --force to overwrite.`);return}let N={name:b,saved_at:new Date().toISOString(),messages:y.messages,meta:y.meta};Ee.writeFileSync(R,JSON.stringify(N,null,2),"utf-8"),console.log(g.blue(` \u2713 Session saved: ${b}`)+g.gray(` (${y.messages.length} messages)`))}function h(y){let b=y.name;if(!b){$(),ze({type:"session_data",messages:null,error:"No name. Use /load <name>"}),z();return}let R=Zt.join(f,`${b}.json`);if(!Ee.existsSync(R)){console.log(g.gray(` [debug] Session file not found: ${R}`)),ze({type:"session_data",messages:null,error:`Session '${b}' not found.`}),z();return}try{let N=JSON.parse(Ee.readFileSync(R,"utf-8"));console.log(g.gray(` [debug] Sending session_data: ${N.messages?.length||0} messages`)),ze({type:"session_data",name:b,messages:N.messages,meta:N.meta||{}}),i()}catch(N){ze({type:"session_data",messages:null,error:`${N}`}),z()}}function $(){if(!Ee.existsSync(f)){console.log(g.gray(" No saved sessions."));return}let y=Ee.readdirSync(f).filter(b=>b.endsWith(".json")).sort();if(y.length===0){console.log(g.gray(" No saved sessions."));return}console.log(g.white(`
120
+ Saved sessions (${y.length}):`));for(let b of y)try{let R=JSON.parse(Ee.readFileSync(Zt.join(f,b),"utf-8")),N=b.replace(".json","");console.log(g.cyan(` ${N}`)+g.gray(` \u2014 ${R.messages?.length||0} messages`))}catch{console.log(g.cyan(` ${b.replace(".json","")}`))}console.log("")}function w(){let y=[{name:"read_file",desc:"Read a file",perm:"auto"},{name:"write_file",desc:"Create or overwrite a file",perm:"ask"},{name:"edit_file",desc:"Edit a file (string replace)",perm:"ask"},{name:"grep",desc:"Search for patterns in files",perm:"auto"},{name:"glob",desc:"Find files by name pattern",perm:"auto"},{name:"list_dir",desc:"List directory contents",perm:"auto"},{name:"bash",desc:"Execute shell command",perm:"always ask"},{name:"web_search",desc:"Search the web",perm:"auto"},{name:"web_fetch",desc:"Fetch URL content",perm:"auto"}];console.log(g.white(`
120
121
  Available tools:
121
- `));for(let C of $){let B=C.perm==="always ask"?v.red("always ask"):Kg(C.name)?v.cyan("trusted"):C.perm==="ask"?v.yellow("ask"):v.cyan("auto");console.log(` ${v.cyan(C.name.padEnd(12))} ${B.padEnd(20)} ${v.gray(C.desc)}`)}let b=n.getToolList();if(b.length>0){console.log(v.white(`
122
+ `)),console.log(g.gray(` ${"Tool".padEnd(12)} Permission`)),console.log(g.gray(` ${"\u2500".repeat(12)} ${"\u2500".repeat(12)}`));for(let R of y){let N=R.perm==="always ask"?g.red("always ask"):Yg(R.name)?g.cyan("trusted"):R.perm==="ask"?g.yellow("ask"):g.cyan("auto"),oe=" ".repeat(Math.max(0,12-R.perm.length));console.log(` ${g.cyan(R.name.padEnd(12))} ${N}${oe}`)}let b=n.getToolList();if(b.length>0){console.log(g.white(`
122
123
  MCP tools:
123
- `));for(let C of b){let B=C.autoApprove?v.cyan("auto"):v.yellow("ask");console.log(` ${v.cyan(C.name.padEnd(24))} ${B.padEnd(20)} ${v.gray(C.serverName)} ${v.gray("\u2014 "+(C.description||"").slice(0,40))}`)}}console.log(v.gray(`
124
+ `)),console.log(g.gray(` ${"Tool".padEnd(36)} ${"Permission".padEnd(12)} Server`)),console.log(g.gray(` ${"\u2500".repeat(36)} ${"\u2500".repeat(12)} ${"\u2500".repeat(16)}`));let R=[...new Set(b.map(N=>N.serverName))];for(let N=0;N<R.length;N++){let oe=R[N];N>0&&console.log("");let G=b.filter(le=>le.serverName===oe);for(let le of G){let be=le.autoApprove?"auto":"ask",ht=le.autoApprove?g.cyan("auto"):g.yellow("ask"),go=" ".repeat(Math.max(0,12-be.length));console.log(` ${g.cyan(le.name.padEnd(36))} ${ht}${go} ${g.gray(oe)}`)}}}console.log(g.gray(`
124
125
  Use /tools reset to restore default permissions.
125
- `))}function w(){let $=n.listAll();if($.length===0){console.log(v.gray(`
126
+ `))}function P(){let y=n.listAll();if(y.length===0){console.log(g.gray(`
126
127
  No MCP servers available.
127
- `));return}console.log(v.white(`
128
+ `));return}console.log(g.white(`
128
129
  MCP servers:
129
- `));for(let b of $){let C=b.connected?v.cyan("connected"):v.gray("disabled");console.log(` ${v.cyan(b.name.padEnd(20))} ${C.padEnd(18)} ${v.gray(b.description)}`)}console.log(v.gray(`
130
- /mcp enable <name> Connect a server`)),console.log(v.gray(` /mcp disable <name> Disconnect a server
131
- `))}async function P($){let b=$.split(/\s+/).slice(1),C,B;if(b[0]==="enable"||b[0]==="disable"?(C=b[0],B=b[1]):(b[1]==="enable"||b[1]==="disable")&&(B=b[0],C=b[1]),C==="enable"&&B){console.log(v.gray(`
132
- Connecting to ${B}...`));let G=await n.enable(B);G.ok?(console.log(v.cyan(` \u2713 ${B} connected \u2014 ${G.tools.length} tools loaded`)),ce({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(v.red(` \u2717 ${G.error}`))}else if(C==="disable"&&B){let G=await n.disable(B);G.ok?(console.log(v.cyan(`
133
- \u2713 ${B} disconnected`)),ce({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(v.red(`
134
- \u2717 ${G.error}`))}else console.log(v.gray(`
135
- Usage: /mcp <name> enable | /mcp <name> disable`));z()}function j(){if(fo.length===0){console.log(v.gray(" Nothing to undo."));return}let $=fo.pop(),b=Wt.resolve(process.cwd(),$.path);try{$.content===""&&Te.existsSync(b)?(Te.unlinkSync(b),console.log(v.blue(` \u2713 Undo: deleted ${$.path} (was newly created)`))):(Te.writeFileSync(b,$.content,"utf-8"),console.log(v.blue(` \u2713 Undo: restored ${$.path}`)))}catch(C){console.log(v.red(` \u2717 Undo failed: ${C.message}`))}}function z(){e&&(e.close(),e=null),ua="idle";let $=["/save","/load","/sessions","/compact","/context","/tools","/tools reset","/usage","/undo","/mcp","/help","/quit"];e=Ph.createInterface({input:process.stdin,output:process.stdout,terminal:!0,completer:b=>{if(b.startsWith("/mcp ")){let B=b.split(/\s+/),G=n.listAll().map(Oe=>Oe.name);if(B.length===2){let Oe=B[1],Ie=G.filter(pt=>pt.startsWith(Oe)).map(pt=>`/mcp ${pt}`);return[Ie.length?Ie:G.map(pt=>`/mcp ${pt}`),b]}if(B.length===3){let Oe=B[2],Ie=["enable","disable"],pt=Ie.filter(mo=>mo.startsWith(Oe)).map(mo=>`/mcp ${B[1]} ${mo}`);return[pt.length?pt:Ie.map(mo=>`/mcp ${B[1]} ${mo}`),b]}return[[],b]}let C=$.filter(B=>B.startsWith(b));return[C.length?C:$,b]},history:pS.slice().reverse(),historySize:100}),e.question(v.cyan(`
136
- > `),b=>{if(e?.close(),e=null,b.trimEnd().endsWith("\\")){N([b.trimEnd().slice(0,-1)]);return}Ce(b)})}function N($){e&&(e.close(),e=null),e=Ph.createInterface({input:process.stdin,output:process.stdout,terminal:!0}),e.question(v.gray("\u2026 "),b=>{e?.close(),e=null,b.trimEnd().endsWith("\\")?($.push(b.trimEnd().slice(0,-1)),N($)):($.push(b),Ce($.join(`
137
- `)))})}function Ce($){let b=$.trim();if(!b){z();return}if(b.startsWith("/")||pS.push(b),(b==="/quit"||b==="/exit")&&process.exit(0),b==="/undo"){j(),z();return}if(b==="/sessions"){h(),z();return}if(b==="/tools"){y(),z();return}if(b==="/tools reset"){Hg(),y(),z();return}if(b==="/mcp"){w(),z();return}if(b.startsWith("/mcp ")){P(b);return}if(b==="/help"){console.log(`
138
- ${v.cyan("/compact")} Compress conversation history to free context
139
- ${v.cyan("/context")} Show context usage (tokens, messages, compactions)
140
- ${v.cyan("/tools")} List all tools and their permission levels
141
- ${v.cyan("/mcp")} Manage MCP servers (enable/disable/status)
142
- ${v.cyan("/usage")} Show token consumption and credit balance
143
- ${v.cyan("/save")} Save session locally (/save [name] [--force])
144
- ${v.cyan("/load")} Load a saved session (/load <name>)
145
- ${v.cyan("/sessions")} List all saved sessions
146
- ${v.cyan("/undo")} Undo last file write or edit
147
- ${v.cyan("/quit")} End session
130
+ `));for(let b of y){let R=b.connected?g.cyan("connected"):g.gray("disabled");console.log(` ${g.cyan(b.name.padEnd(20))} ${R.padEnd(18)} ${g.gray(b.description)}`)}console.log(g.gray(`
131
+ /mcp enable <name> Connect a server`)),console.log(g.gray(` /mcp disable <name> Disconnect a server
132
+ `))}async function j(y){let b=y.split(/\s+/).slice(1),R,N;if(b[0]==="enable"||b[0]==="disable"?(R=b[0],N=b[1]):(b[1]==="enable"||b[1]==="disable")&&(N=b[0],R=b[1]),R==="enable"&&N){console.log(g.gray(`
133
+ Connecting to ${N}...`));let oe=await n.enable(N);oe.ok?(console.log(g.cyan(` \u2713 ${N} connected \u2014 ${oe.tools.length} tools loaded`)),ze({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(g.red(` \u2717 ${oe.error}`))}else if(R==="disable"&&N){let oe=await n.disable(N);oe.ok?(console.log(g.cyan(`
134
+ \u2713 ${N} disconnected`)),ze({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(g.red(`
135
+ \u2717 ${oe.error}`))}else console.log(g.gray(`
136
+ Usage: /mcp <name> enable | /mcp <name> disable`));z()}function U(){if(ho.length===0){console.log(g.gray(" Nothing to undo."));return}let y=ho.pop(),b=Zt.resolve(process.cwd(),y.path);try{y.content===""&&Ee.existsSync(b)?(Ee.unlinkSync(b),console.log(g.blue(` \u2713 Undo: deleted ${y.path} (was newly created)`))):(Ee.writeFileSync(b,y.content,"utf-8"),console.log(g.blue(` \u2713 Undo: restored ${y.path}`)))}catch(R){console.log(g.red(` \u2717 Undo failed: ${R.message}`))}}function z(){e&&(e.close(),e=null),pa="idle";let y=["/save","/load","/sessions","/compact","/context","/tools","/tools reset","/usage","/undo","/mcp","/help","/quit"];e=jh.createInterface({input:process.stdin,output:process.stdout,terminal:!0,completer:b=>{if(b.startsWith("/mcp ")){let N=b.split(/\s+/),oe=n.listAll().map(G=>G.name);if(N.length===2){let G=N[1],le=oe.filter(be=>be.startsWith(G)).map(be=>`/mcp ${be}`);return[le.length?le:oe.map(be=>`/mcp ${be}`),b]}if(N.length===3){let G=N[2],le=["enable","disable"],be=le.filter(ht=>ht.startsWith(G)).map(ht=>`/mcp ${N[1]} ${ht}`);return[be.length?be:le.map(ht=>`/mcp ${N[1]} ${ht}`),b]}return[[],b]}if(b.startsWith("/load ")){let N=b.slice(6);try{let oe=Zt.join(process.cwd(),".synapse","sessions");if(Ee.existsSync(oe)){let G=Ee.readdirSync(oe).filter(be=>be.endsWith(".json")).map(be=>be.replace(".json","")),le=G.filter(be=>be.startsWith(N)).map(be=>`/load ${be}`);return[le.length?le:G.map(be=>`/load ${be}`),b]}}catch{}return[[],b]}let R=y.filter(N=>N.startsWith(b));return[R.length?R:y,b]},history:hS.slice().reverse(),historySize:100}),e.question(g.cyan("> "),b=>{if(e?.close(),e=null,b.trimEnd().endsWith("\\")){Ae([b.trimEnd().slice(0,-1)]);return}if(process.stdin.readable){let R=b,N=()=>{let oe=process.stdin.read();oe?(R+=`
137
+ `+oe.toString().replace(/\n$/,""),setTimeout(N,10)):Ne(R)};setTimeout(N,30)}else Ne(b)})}function Ae(y){e&&(e.close(),e=null),e=jh.createInterface({input:process.stdin,output:process.stdout,terminal:!0}),e.question(g.gray("\u2026 "),b=>{e?.close(),e=null,b.trimEnd().endsWith("\\")?(y.push(b.trimEnd().slice(0,-1)),Ae(y)):(y.push(b),Ne(y.join(`
138
+ `)))})}function Ne(y){let b=y.trim();if(!b){z();return}if(b.startsWith("!")){let R=b.slice(1).trim();if(R)try{let{execSync:N}=require("child_process"),oe=N(R,{cwd:process.cwd(),encoding:"utf-8",timeout:3e4,maxBuffer:1024*1024});oe.trim()&&console.log(oe.trimEnd())}catch(N){let oe=N.stderr||N.message||"";console.log(g.red(oe.trimEnd()||`Command failed: ${R}`))}z();return}if(b.startsWith("/")||hS.push(b),(b==="/quit"||b==="/exit")&&process.exit(0),b==="/undo"){U(),z();return}if(b==="/sessions"){$(),z();return}if(b==="/tools"){w(),z();return}if(b==="/tools reset"){Qg(),w(),z();return}if(b==="/mcp"){P(),z();return}if(b.startsWith("/mcp ")){j(b);return}if(b==="/help"){console.log(`
139
+ ${g.cyan("/compact")} Compress conversation history to free context
140
+ ${g.cyan("/context")} Show context usage (tokens, messages, compactions)
141
+ ${g.cyan("/tools")} List all tools and their permission levels
142
+ ${g.cyan("/mcp")} Manage MCP servers (enable/disable/status)
143
+ ${g.cyan("/usage")} Show token consumption and credit balance
144
+ ${g.cyan("/save")} Save session locally (/save [name] [--force])
145
+ ${g.cyan("/load")} Load a saved session (/load <name>)
146
+ ${g.cyan("/sessions")} List all saved sessions
147
+ ${g.cyan("/undo")} Undo last file write or edit
148
+ ${g.cyan("/quit")} End session
148
149
 
149
- ${v.gray("\\ + Enter for multi-line input. Ctrl+C to cancel.")}
150
+ ${g.gray("\\ + Enter for multi-line input. Ctrl+C to cancel.")}
150
151
  `),z();return}if(b==="/save help"){console.log(`
151
- ${v.cyan("/save [name] [--force]")} Save current session locally
152
- ${v.gray("name defaults to timestamp. --force overwrites existing.")}
152
+ ${g.cyan("/save [name] [--force]")} Save current session locally
153
+ ${g.gray("name defaults to timestamp. --force overwrites existing.")}
153
154
  `),z();return}if(b==="/load help"){console.log(`
154
- ${v.cyan("/load <name>")} Load a previously saved session
155
- ${v.gray("Use /sessions to see available names.")}
155
+ ${g.cyan("/load <name>")} Load a previously saved session
156
+ ${g.gray("Use /sessions to see available names.")}
156
157
  `),z();return}if(b==="/tools help"){console.log(`
157
- ${v.cyan("/tools")} Show tools and current permissions
158
- ${v.cyan("/tools reset")} Reset all trusted tools to default
159
- `),z();return}if(b.startsWith("/save")){ce({type:"user_message",content:b});return}if(b.startsWith("/load")){let C=b.split(/\s+/)[1]||"";if(!C){h(),console.log(v.gray(" Usage: /load <name>")),z();return}g({type:"session_load",name:C});return}ce({type:"user_message",content:$}),mS++,po=!1,o()}function ce($){t?.send(JSON.stringify($))}c().catch($=>{console.error($),process.exit(1)})})();
158
+ ${g.cyan("/tools")} Show tools and current permissions
159
+ ${g.cyan("/tools reset")} Reset all trusted tools to default
160
+ `),z();return}if(b.startsWith("/save")){ze({type:"user_message",content:b});return}if(b.startsWith("/load")){let R=b.split(/\s+/)[1]||"";if(!R){$(),console.log(g.gray(" Usage: /load <name>")),z();return}h({type:"session_load",name:R});return}ze({type:"user_message",content:y}),wR++,ln=!1,i()}function ze(y){t?.send(JSON.stringify(y))}u().catch(y=>{console.error(y),process.exit(1)})})();