synara 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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 Gc=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),ho=(t,e)=>{for(var r in e)Gc(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&&Gc(t,o,{get:()=>e[o],enumerable:!(n=vS(e,o))||n.enumerable});return t};var de=(t,e,r)=>(r=t!=null?gS(yS(t)):{},bS(e||!t||!t.__esModule?Gc(r,"default",{value:t,enumerable:!0}):r,t));var Kt=x((zR,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((IR,da)=>{"use strict";var{EMPTY_BUFFER:xS}=Kt(),Kc=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 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 SS(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:kS,mask:Nh,toArrayBuffer:SS,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((TR,Ch)=>{"use strict";var Dh=Symbol("kDone"),Xc=Symbol("kRun"),Yc=class{constructor(e){this[Dh]=()=>{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[Dh])}}};Ch.exports=Yc});var fn=x((PR,Lh)=>{"use strict";var vo=require("zlib"),Uh=go(),wS=Ah(),{kStatusCode:Zh}=Kt(),zS=Buffer[Symbol.species],IS=Buffer.from([0,0,255,255]),pa=Symbol("permessage-deflate"),Ht=Symbol("total-length"),ln=Symbol("callback"),hr=Symbol("buffers"),dn=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 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[ln];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[Ht]=0,this._inflate[hr]=[],this._inflate.on("error",PS),this._inflate.on("data",Mh)}this._inflate[ln]=n,this._inflate.write(e),r&&this._inflate.write(IS),this._inflate.flush(()=>{let i=this._inflate[dn];if(i){this._inflate.close(),this._inflate=null,n(i);return}let a=Uh.concat(this._inflate[hr],this._inflate[Ht]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ht]=0,this._inflate[hr]=[],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[Ht]=0,this._deflate[hr]=[],this._deflate.on("data",TS)}this._deflate[ln]=n,this._deflate.write(e),this._deflate.flush(vo.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=Uh.concat(this._deflate[hr],this._deflate[Ht]);r&&(i=new zS(i.buffer,i.byteOffset,i.length-4)),this._deflate[ln]=null,this._deflate[Ht]=0,this._deflate[hr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};Lh.exports=Qc;function TS(t){this[hr].push(t),this[Ht]+=t.length}function Mh(t){if(this[Ht]+=t.length,this[pa]._maxPayload<1||this[Ht]<=this[pa]._maxPayload){this[hr].push(t);return}this[dn]=new RangeError("Max payload size exceeded"),this[dn].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dn][Zh]=1009,this.removeListener("data",Mh),this.reset()}function PS(t){if(this[pa]._inflate=null,this[dn]){this[ln](this[dn]);return}t[Zh]=1007,this[ln](t)}});var pn=x((ER,ma)=>{"use strict";var{isUtf8:qh}=require("buffer"),{hasBlob:ES}=Kt(),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 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 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")}ma.exports={isBlob:NS,isValidStatusCode:jS,isValidUTF8:eu,tokenChars:OS};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((OR,Kh)=>{"use strict";var{Writable:RS}=require("stream"),Fh=fn(),{BINARY_TYPES:DS,EMPTY_BUFFER:Vh,kStatusCode:CS,kWebSocket:AS}=Kt(),{concat:tu,toArrayBuffer:US,unmask:ZS}=go(),{isValidStatusCode:MS,isValidUTF8:Bh}=pn(),ha=Buffer[Symbol.species],mt=0,Jh=1,Wh=2,Gh=3,ru=4,nu=5,ga=6,ou=class extends RS{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||DS[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=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&&ZS(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=US(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(!MS(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((NR,Yh)=>{"use strict";var{Duplex:jR}=require("stream"),{randomFillSync:LS}=require("crypto"),Hh=fn(),{EMPTY_BUFFER:qS,kWebSocket:FS,NOOP:VS}=Kt(),{isBlob:mn,isValidStatusCode:BS}=pn(),{mask:Xh,toBuffer:Cr}=go(),ht=Symbol("kByteLength"),JS=Buffer.alloc(4),va=8*1024,Ar,hn=va,It=0,WS=1,GS=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=It,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):(hn===va&&(Ar===void 0&&(Ar=Buffer.alloc(va)),LS(Ar,0,va),hn=0),n[0]=Ar[hn++],n[1]=Ar[hn++],n[2]=Ar[hn++],n[3]=Ar[hn++]),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=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={[ht]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==It?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):mn(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};mn(e)?this._state!==It?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==It?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):mn(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};mn(e)?this._state!==It?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==It?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):mn(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};mn(e)?this._state!==It?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==It?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=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(su,this,s,o);return}this._bufferedBytes-=n[ht];let a=Cr(i);r?this.dispatch(a,r,n,o):(this._state=It,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[Hh.extensionName];this._bufferedBytes+=n[ht],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");su(this,c,o);return}this._bufferedBytes-=n[ht],this._state=It,n.readOnly=!1,this.sendFrame(t.frame(s,n),o),this.dequeue()})}dequeue(){for(;this._state===It&&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 KS(t,e,r){su(t,e,r),t.onerror(e)}});var sg=x((RR,ag)=>{"use strict";var{kForOnEventAttribute:_o,kListener:uu}=Kt(),Qh=Symbol("kCode"),eg=Symbol("kData"),tg=Symbol("kError"),rg=Symbol("kMessage"),ng=Symbol("kReason"),gn=Symbol("kTarget"),og=Symbol("kType"),ig=Symbol("kWasClean"),Xt=class{constructor(e){this[gn]=null,this[og]=e}get target(){return this[gn]}get type(){return this[og]}};Object.defineProperty(Xt.prototype,"target",{enumerable:!0});Object.defineProperty(Xt.prototype,"type",{enumerable:!0});var Ur=class extends Xt{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(Ur.prototype,"code",{enumerable:!0});Object.defineProperty(Ur.prototype,"reason",{enumerable:!0});Object.defineProperty(Ur.prototype,"wasClean",{enumerable:!0});var vn=class extends Xt{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(vn.prototype,"error",{enumerable:!0});Object.defineProperty(vn.prototype,"message",{enumerable:!0});var yo=class extends Xt{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 HS={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[gn]=this,_a(e,this,s)};else if(t==="close")n=function(i,a){let s=new Ur("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[gn]=this,_a(e,this,s)};else if(t==="error")n=function(i){let a=new vn("error",{error:i,message:i.message});a[gn]=this,_a(e,this,a)};else if(t==="open")n=function(){let i=new Xt("open");i[gn]=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:Ur,ErrorEvent:vn,Event:Xt,EventTarget:HS,MessageEvent:yo};function _a(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var ya=x((DR,cg)=>{"use strict";var{tokenChars:$o}=pn();function Ut(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&&$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?(Ut(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),Ut(r,t.slice(c,l),!0),u===44&&(Ut(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),Ut(r,s,p),u===44&&(Ut(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?Ut(e,f,r):(s===void 0?Ut(r,f,!0):n?Ut(r,s,f.replace(/\\/g,"")):Ut(r,s,f),Ut(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(", ")}cg.exports={format:YS,parse:XS}});var ka=x((UR,$g)=>{"use strict";var QS=require("events"),ew=require("https"),tw=require("http"),dg=require("net"),rw=require("tls"),{randomBytes:nw,createHash:ow}=require("crypto"),{Duplex:CR,Readable:AR}=require("stream"),{URL:lu}=require("url"),gr=fn(),iw=iu(),aw=cu(),{isBlob:sw}=pn(),{BINARY_TYPES:ug,CLOSE_TIMEOUT:cw,EMPTY_BUFFER:$a,GUID:uw,kForOnEventAttribute:du,kListener:lw,kStatusCode:dw,kWebSocket:De,NOOP:fg}=Kt(),{EventTarget:{addEventListener:fw,removeEventListener:pw}}=sg(),{format:mw,parse:hw}=ya(),{toBuffer:gw}=go(),pg=Symbol("kAborted"),fu=[8,13],Yt=["CONNECTING","OPEN","CLOSING","CLOSED"],vw=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,we=class t extends QS{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 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",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[gr.extensionName]&&this._extensions[gr.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){st(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[gr.extensionName]||(o.compress=!1),this._sender.send(e||$a,o,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){st(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(we,"CONNECTING",{enumerable:!0,value:Yt.indexOf("CONNECTING")});Object.defineProperty(we.prototype,"CONNECTING",{enumerable:!0,value:Yt.indexOf("CONNECTING")});Object.defineProperty(we,"OPEN",{enumerable:!0,value:Yt.indexOf("OPEN")});Object.defineProperty(we.prototype,"OPEN",{enumerable:!0,value:Yt.indexOf("OPEN")});Object.defineProperty(we,"CLOSING",{enumerable:!0,value:Yt.indexOf("CLOSING")});Object.defineProperty(we.prototype,"CLOSING",{enumerable:!0,value:Yt.indexOf("CLOSING")});Object.defineProperty(we,"CLOSED",{enumerable:!0,value:Yt.indexOf("CLOSED")});Object.defineProperty(we.prototype,"CLOSED",{enumerable:!0,value:Yt.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(we.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(we.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[du])return e[lw];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})}})});we.prototype.addEventListener=fw;we.prototype.removeEventListener=pw;$g.exports=we;function mg(t,e,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:cw,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=nw(16).toString("base64"),d=a?ew.request:tw.request,f=new Set,p;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&&(p=new gr({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=mw({[gr.extensionName]:p.offer()})),r.length){for(let h of r){if(typeof h!="string"||!vw.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",()=>{st(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){st(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)||st(t,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,w)=>{if(t.emit("upgrade",h),t.readyState!==we.CONNECTING)return;g=t._req=null;let P=h.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){st(t,y,"Invalid Upgrade header");return}let j=ow("sha1").update(l+uw).digest("base64");if(h.headers["sec-websocket-accept"]!==j){st(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){st(t,y,N);return}z&&(t._protocol=z);let Re=h.headers["sec-websocket-extensions"];if(Re!==void 0){if(!p){st(t,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ce;try{ce=hw(Re)}catch{st(t,y,"Invalid Sec-WebSocket-Extensions header");return}let $=Object.keys(ce);if($.length!==1||$[0]!==gr.extensionName){st(t,y,"Server indicated an extension that was not requested");return}try{p.accept(ce[gr.extensionName])}catch{st(t,y,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[gr.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=we.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function _w(t){return t.path=t.socketPath,dg.connect(t)}function yw(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=dg.isIP(t.host)?"":t.host),rw.connect(t)}function st(t,e,r){t._readyState=we.CLOSING;let n=new Error(r);Error.captureStackTrace(n,st),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=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} (${Yt[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",xa),process.nextTick(hg,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",xa),process.nextTick(hg,e._socket),e.close(t[dw])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function lg(){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,fg),e.emit("ping",t)}function ww(t){this[De].emit("pong",t)}function hg(t){t.resume()}function zw(t){let e=this[De];e.readyState!==we.CLOSED&&(e.readyState===we.OPEN&&(e._readyState=we.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[De];if(this.removeListener("close",vg),this.removeListener("data",xa),this.removeListener("end",_g),t._readyState=we.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",lg),t._receiver.on("finish",lg))}function xa(t){this[De]._receiver.write(t)||this.pause()}function _g(){let t=this[De];t._readyState=we.CLOSING,t._receiver.end(),this.end()}function yg(){let t=this[De];this.removeListener("error",yg),this.on("error",fg),t&&(t._readyState=we.CLOSING,this.destroy())}});var Sg=x((MR,kg)=>{"use strict";var ZR=ka(),{Duplex:Iw}=require("stream");function bg(t){t.emit("close")}function Tw(){!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 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(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",Tw),n.on("error",xg),n}kg.exports=Pw});var mu=x((LR,wg)=>{"use strict";var{tokenChars:Ew}=pn();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}wg.exports={parse:Ow}});var jg=x((FR,Og)=>{"use strict";var jw=require("events"),Sa=require("http"),{Duplex:qR}=require("stream"),{createHash:Nw}=require("crypto"),zg=ya(),Zr=fn(),Rw=mu(),Dw=ka(),{CLOSE_TIMEOUT:Cw,GUID:Aw,kWebSocket:Uw}=Kt(),Zw=/^[+/0-9A-Za-z]{22}==$/,Ig=0,Tg=1,Eg=2,hu=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:Cw,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Dw,...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=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=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"){Mr(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){Mr(this,e,r,400,"Invalid Upgrade header");return}if(i===void 0||!Zw.test(i)){Mr(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(s!==13&&s!==8){Mr(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=Rw.parse(c)}catch{Mr(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 Zr({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let p=zg.parse(l);p[Zr.extensionName]&&(f.accept(p[Zr.extensionName]),d[Zr.extensionName]=f)}catch{Mr(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[Uw])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: ${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[Zr.extensionName]){let d=e[Zr.extensionName].params,f=zg.format({[Zr.extensionName]:[d]});u.push(`Sec-WebSocket-Extensions: ${f}`),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
|
|
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 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 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
|
|
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 Mr(t,e,r,n,o,i){if(t.listenerCount("wsClientError")){let a=new Error(o);Error.captureStackTrace(a,Mr),t.emit("wsClientError",a,r,e)}else xo(r,n,o,i)}});var Di=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 Yr=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=Yr;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 Yr&&(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 eE(r),new xt(r)}ue.str=j$;function Pp(t,e){e instanceof xt?t.push(...e._items):e instanceof Yr?t.push(e):t.push(nE(e))}ue.addCodeArg=Pp;function eE(t){let e=1;for(;e<t.length-1;){if(t[e]===Tp){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 Yr||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 Yr))return`"${t}${e.slice(1)}`}function rE(t,e){return e.emptyStr()?t:t.emptyStr()?e:j$`${t}${e}`}ue.strConcat=rE;function nE(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ri(Array.isArray(t)?t.join(","):t)}function oE(t){return new xt(Ri(t))}ue.stringify=oE;function Ri(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ue.safeStringify=Ri;function iE(t){return typeof t=="string"&&ue.IDENTIFIER.test(t)?new xt(`.${t}`):O$`[${t}]`}ue.getProperty=iE;function aE(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=aE;function sE(t){return new xt(t.toString())}ue.regexpCode=sE});var jp=x(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.ValueScope=ot.ValueScopeName=ot.Scope=ot.varKinds=ot.UsedValueState=void 0;var nt=Di(),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||(ot.UsedValueState=nc={}));ot.varKinds={const:new nt.Name("const"),let:new nt.Name("let"),var:new nt.Name("var")};var oc=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof nt.Name?e:this.name(e)}name(e){return new nt.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}}};ot.Scope=oc;var ic=class extends nt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,nt._)`.${new nt.Name(r)}[${n}]`}};ot.ValueScopeName=ic;var cE=(0,nt._)`\n`,Op=class extends oc{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cE:nt.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,nt._)`${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=nt.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?ot.varKinds.var:ot.varKinds.const;i=(0,nt._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,nt._)`${i}${l}${this.opts._n}`;else throw new Ep(u);c.set(u,nc.Completed)})}return i}};ot.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=Di(),Nt=jp(),Ir=Di();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return Ir._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return Ir.str}});Object.defineProperty(te,"strConcat",{enumerable:!0,get:function(){return Ir.strConcat}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return Ir.nil}});Object.defineProperty(te,"getProperty",{enumerable:!0,get:function(){return Ir.getProperty}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return Ir.stringify}});Object.defineProperty(te,"regexpCode",{enumerable:!0,get:function(){return Ir.regexpCode}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return Ir.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 ur=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Np=class extends ur{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Nt.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=Kn(this.rhs,e,r)),this}get names(){return this.rhs instanceof ie._CodeOrName?this.rhs.names:{}}},ac=class extends ur{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=Kn(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}},Dp=class extends ur{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cp=class extends ur{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ap=class extends ur{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Up=class extends ur{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=Kn(this.code,e,r),this}get names(){return this.code instanceof ie._CodeOrName?this.code.names:{}}},Ci=class extends ur{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)=>tn(e,r.names),{})}},lr=class extends Ci{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Zp=class extends Ci{},Gn=class extends lr{};Gn.kind="else";var Qr=class t extends lr{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 Gn(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=Kn(this.condition,e,r),this}get names(){let e=super.names;return cc(e,this.condition),this.else&&tn(e,this.else.names),e}};Qr.kind="if";var en=class extends lr{};en.kind="for";var Mp=class extends en{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=Kn(this.iteration,e,r),this}get names(){return tn(super.names,this.iteration.names)}},Lp=class extends en{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Nt.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 en{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=Kn(this.iterable,e,r),this}get names(){return tn(super.names,this.iterable.names)}},Ai=class extends lr{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 Ci{render(e){return"return "+super.render(e)}};Ui.kind="return";var qp=class extends lr{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&&tn(e,this.catch.names),this.finally&&tn(e,this.finally.names),e}},Zi=class extends lr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Zi.kind="catch";var Mi=class extends lr{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 Nt.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(Nt.varKinds.const,e,r,n)}let(e,r,n){return this._def(Nt.varKinds.let,e,r,n)}var(e,r,n){return this._def(Nt.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 Qr(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 Qr(e))}else(){return this._elseNode(new Gn)}endIf(){return this._endBlockNode(Qr,Gn)}_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?Nt.varKinds.var:Nt.varKinds.let){let a=this._scope.toName(e);return this._for(new Lp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=Nt.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?Nt.varKinds.var:Nt.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(en)}label(e){return this._leafNode(new Dp(e))}break(e){return this._leafNode(new Cp(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 Qr))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 tn(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?tn(t,e.names):t}function Kn(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 uE(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 lE=R$(te.operators.AND);function dE(...t){return t.reduce(lE)}te.and=dE;var fE=R$(te.operators.OR);function pE(...t){return t.reduce(fE)}te.or=pE;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(),mE=Di();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:(A$(t,e),!U$(e,t.self.RULES.all))}ne.alwaysValidSchema=gE;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 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,ye._)`${r}`}return(0,ye._)`${t}${e}${(0,ye.getProperty)(n)}`}ne.schemaRefOrVal=_E;function yE(t){return Z$(decodeURIComponent(t))}ne.unescapeFragment=yE;function $E(t){return encodeURIComponent(Jp(t))}ne.escapeFragment=$E;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 bE(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ne.eachItem=bE;function D$({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:D$({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:D$({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 C$={};function xE(t,e){return t.scopeValue("func",{ref:e,code:C$[e.code]||(C$[e.code]=new mE._Code(e.code))})}ne.useFunc=xE;var Bp;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Bp||(ne.Type=Bp={}));function kE(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=kE;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 dr=x(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Be=Q(),SE={data:new Be.Name("data"),valCxt:new Be.Name("valCxt"),instancePath:new Be.Name("instancePath"),parentData:new Be.Name("parentData"),parentDataProperty:new Be.Name("parentDataProperty"),rootData:new Be.Name("rootData"),dynamicAnchors:new Be.Name("dynamicAnchors"),vErrors:new Be.Name("vErrors"),errors:new Be.Name("errors"),this:new Be.Name("this"),self:new Be.Name("self"),scope:new Be.Name("scope"),json:new Be.Name("json"),jsonPos:new Be.Name("jsonPos"),jsonLen:new Be.Name("jsonLen"),jsonPart:new Be.Name("jsonPart")};Gp.default=SE});var Li=x(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.extendErrors=Je.resetErrorsCount=Je.reportExtraError=Je.reportError=Je.keyword$DataError=Je.keywordError=void 0;var se=Q(),lc=ae(),Qe=dr();Je.keywordError={message:({keyword:t})=>(0,se.str)`must pass "${t}" keyword validation`};Je.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 wE(t,e=Je.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}]`)}Je.reportError=wE;function zE(t,e=Je.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,Qe.default.vErrors)}Je.reportExtraError=zE;function IE(t,e){t.assign(Qe.default.errors,e),t.if((0,se._)`${Qe.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,se._)`${Qe.default.vErrors}.length`,e),()=>t.assign(Qe.default.vErrors,null)))}Je.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,Qe.default.errors,s=>{t.const(a,(0,se._)`${Qe.default.vErrors}[${s}]`),t.if((0,se._)`${a}.instancePath === undefined`,()=>t.assign((0,se._)`${a}.instancePath`,(0,se.strConcat)(Qe.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))})}Je.extendErrors=TE;function q$(t,e){let r=t.const("err",e);t.if((0,se._)`${Qe.default.vErrors} === null`,()=>t.assign(Qe.default.vErrors,(0,se._)`[${r}]`),(0,se._)`${Qe.default.vErrors}.push(${r})`),t.code((0,se._)`${Qe.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 rn={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._)`{}`: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,se.str)`${t}${(0,lc.getErrorPath)(e,lc.Type.Str)}`:t;return[Qe.default.instancePath,(0,se.strConcat)(Qe.default.instancePath,r)]}function OE({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)}`),[rn.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([rn.keyword,o],[rn.params,typeof e=="function"?e(t):e||(0,se._)`{}`]),c.messages&&n.push([rn.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([rn.schema,a],[rn.parentSchema,(0,se._)`${l}${d}`],[Qe.default.data,i]),u&&n.push([rn.propertyName,u])}});var J$=x(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.boolOrEmptySchema=Hn.topBoolOrEmptySchema=void 0;var NE=Li(),RE=Q(),DE=dr(),CE={message:"boolean schema is false"};function AE(t){let{gen:e,schema:r,validateName:n}=t;r===!1?B$(t,!1):typeof r=="object"&&r.$async===!0?e.return(DE.default.data):(e.assign((0,RE._)`${n}.errors`,null),e.return(!0))}Hn.topBoolOrEmptySchema=AE;function UE(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),B$(t)):r.var(e,!0)}Hn.boolOrEmptySchema=UE;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,NE.reportError)(o,CE,void 0,e)}});var Kp=x(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.getRules=Xn.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)}Xn.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:{}}}Xn.getRules=qE});var Hp=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.shouldUseRule=Tr.shouldUseGroup=Tr.schemaHasRulesForType=void 0;function FE({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&W$(t,n)}Tr.schemaHasRulesForType=FE;function W$(t,e){return e.rules.some(r=>G$(t,r))}Tr.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))}Tr.shouldUseRule=G$});var qi=x(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.reportTypeError=We.checkDataTypes=We.checkDataType=We.coerceAndCheckDataType=We.getJSONTypes=We.getSchemaTypes=We.DataType=void 0;var VE=Kp(),BE=Hp(),JE=Li(),Y=Q(),K$=ae(),Yn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Yn||(We.DataType=Yn={}));function WE(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}We.getSchemaTypes=WE;function H$(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(","))}We.getJSONTypes=H$;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=Yp(e,n,o.strictNumbers,Yn.Wrong);r.if(s,()=>{i.length?HE(t,e,i):Qp(t)})}return a}We.coerceAndCheckDataType=GE;var X$=new Set(["string","number","integer","boolean","null"]);function KE(t,e){return e?t.filter(r=>X$.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(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),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 Xp(t,e,r,n=Yn.Correct){let o=n===Yn.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===Yn.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)}}We.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}We.checkDataTypes=Yp;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 Qp(t){let e=QE(t);(0,JE.reportError)(e,YE)}We.reportTypeError=Qp;function QE(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 Qn=Q(),eO=ae();function tO(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=tO;function Y$(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,Qn._)`${i}${(0,Qn.getProperty)(e)}`;if(o){(0,eO.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,Qn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,Qn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,Qn._)`${s} = ${(0,Qn.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 ke=Q(),em=ae(),Pr=dr(),rO=ae();function nO(t,e){let{gen:r,data:n,it:o}=t;r.if(rm(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ke._)`${e}`},!0),t.error()})}me.checkReportMissingProp=nO;function oO({gen:t,data:e,it:{opts:r}},n,o){return(0,ke.or)(...n.map(i=>(0,ke.and)(rm(t,e,i,r.ownProperties),(0,ke._)`${o} = ${i}`)))}me.checkMissingProp=oO;function iO(t,e){t.setParams({missingProperty:e},!0),t.error()}me.reportMissingProp=iO;function eb(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ke._)`Object.prototype.hasOwnProperty`})}me.hasPropFunc=eb;function tm(t,e,r){return(0,ke._)`${eb(t)}.call(${e}, ${r})`}me.isOwnProperty=tm;function aO(t,e,r,n){let o=(0,ke._)`${e}${(0,ke.getProperty)(r)} !== undefined`;return n?(0,ke._)`${o} && ${tm(t,e,r)}`:o}me.propertyInData=aO;function rm(t,e,r,n){let o=(0,ke._)`${e}${(0,ke.getProperty)(r)} === undefined`;return n?(0,ke.or)(o,(0,ke.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 sO(t,e){return tb(e).filter(r=>!(0,em.alwaysValidSchema)(t,e[r]))}me.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,ke._)`${t}, ${e}, ${n}${o}`:e,d=[[Pr.default.instancePath,(0,ke.strConcat)(Pr.default.instancePath,i)],[Pr.default.parentData,a.parentData],[Pr.default.parentDataProperty,a.parentDataProperty],[Pr.default.rootData,Pr.default.rootData]];a.opts.dynamicRef&&d.push([Pr.default.dynamicAnchors,Pr.default.dynamicAnchors]);let f=(0,ke._)`${l}, ${r.object(...d)}`;return c!==ke.nil?(0,ke._)`${s}.call(${c}, ${f})`:(0,ke._)`${s}(${f})`}me.callValidateCode=cO;var uO=(0,ke._)`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,ke._)`${o.code==="new RegExp"?uO:(0,rO.useFunc)(t,o)}(${r}, ${n})`})}me.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,ke._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:em.Type.Num},i),e.if((0,ke.not)(i),s)})}}me.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,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,ke._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,ke.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}me.validateUnion=fO});var ob=x(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.validateKeywordUsage=qt.validSchemaType=qt.funcKeywordCode=qt.macroKeywordCode=void 0;var et=Q(),nn=dr(),pO=kt(),mO=Li();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=nb(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:et.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}qt.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=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(()=>vO(t,w))}}function p(){let w=n.let("ruleErrs",null);return n.try(()=>h((0,et._)`await `),P=>n.assign(d,!1).if((0,et._)`${P} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,et._)`${P}.errors`),()=>n.throw(P))),w}function g(){let w=(0,et._)`${l}.errors`;return n.assign(w,null),h(et.nil),w}function h(w=e.async?(0,et._)`await `:et.nil){let P=c.opts.passContext?nn.default.this:nn.default.self,j=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,et._)`${w}${(0,pO.callValidateCode)(t,l,P,j)}`,e.modifying)}function y(w){var P;n.if((0,et.not)((P=e.valid)!==null&&P!==void 0?P:d),w)}}qt.funcKeywordCode=gO;function rb(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,et._)`${n.parentData}[${n.parentDataProperty}]`))}function vO(t,e){let{gen:r}=t;r.if((0,et._)`Array.isArray(${e})`,()=>{r.assign(nn.default.vErrors,(0,et._)`${nn.default.vErrors} === null ? ${e} : ${nn.default.vErrors}.concat(${e})`).assign(nn.default.errors,(0,et._)`${nn.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 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,et.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")}qt.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)}}qt.validateKeywordUsage=$O});var ab=x(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.extendSubschemaMode=Er.extendSubschemaData=Er.getSubschema=void 0;var Ft=Q(),ib=ae();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,Ft._)`${t.schemaPath}${(0,Ft.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,Ft._)`${t.schemaPath}${(0,Ft.getProperty)(e)}${(0,Ft.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')}Er.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,f=s.let("data",(0,Ft._)`${e.data}${(0,Ft.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Ft.str)`${u}${(0,ib.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ft._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ft.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]}}Er.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}Er.extendSubschemaMode=kO});var nm=x((Uq,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((Zq,cb)=>{"use strict";var Or=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)};Or.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Or.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Or.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Or.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 Or.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 Or.propsKeywords){if(d&&typeof d=="object")for(var p in d)fc(t,e,r,d[p],o+"/"+l+"/"+SO(p),i,o,l,n,p)}else(l in Or.keywords||t.allKeys&&!(l in Or.skipKeywords))&&fc(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 Fi=x(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.getSchemaRefs=it.resolveUrl=it.normalizeId=it._getFullPath=it.getFullPath=it.inlineRef=void 0;var wO=ae(),zO=nm(),IO=ub(),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?!om(t):e?lb(t)<=e:!1}it.inlineRef=PO;var EO=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function om(t){for(let e in t){if(EO.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++,!TO.has(r)&&(typeof t[r]=="object"&&(0,wO.eachItem)(t[r],n=>e+=lb(n)),e===1/0))return 1/0}return e}function db(t,e="",r){r!==!1&&(e=eo(e));let n=t.parse(e);return fb(t,n)}it.getFullPath=db;function fb(t,e){return t.serialize(e).split("#")[0]+"#"}it._getFullPath=fb;var OO=/#\/?$/;function eo(t){return t?t.replace(OO,""):""}it.normalizeId=eo;function jO(t,e,r){return r=eo(r),t.resolve(e,r)}it.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=eo(t[r]||e),i={"":o},a=db(n,o,!1),s={},c=new Set;return IO(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=eo(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!==eo(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,f,p){if(f!==void 0&&!zO(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}it.getSchemaRefs=RO});var Ji=x(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.getData=jr.KeywordCxt=jr.validateFunctionCode=void 0;var vb=J$(),pb=qi(),am=Hp(),pc=qi(),DO=Q$(),Bi=ob(),im=ab(),A=Q(),W=dr(),CO=Fi(),fr=ae(),Vi=Li();function AO(t){if($b(t)&&(bb(t),yb(t))){MO(t);return}_b(t,()=>(0,vb.topBoolOrEmptySchema)(t))}jr.validateFunctionCode=AO;function _b({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,A._)`${W.default.data}, ${W.default.valCxt}`,n.$async,()=>{t.code((0,A._)`"use strict"; ${mb(r,o)}`),ZO(t,o),t.code(i)}):t.func(e,(0,A._)`${W.default.data}, ${UO(o)}`,n.$async,()=>t.code(mb(r,o)).code(i))}function UO(t){return(0,A._)`{${W.default.instancePath}="", ${W.default.parentData}, ${W.default.parentDataProperty}, ${W.default.rootData}=${W.default.data}${t.dynamicRef?(0,A._)`, ${W.default.dynamicAnchors}={}`:A.nil}}={}`}function ZO(t,e){t.if(W.default.valCxt,()=>{t.var(W.default.instancePath,(0,A._)`${W.default.valCxt}.${W.default.instancePath}`),t.var(W.default.parentData,(0,A._)`${W.default.valCxt}.${W.default.parentData}`),t.var(W.default.parentDataProperty,(0,A._)`${W.default.valCxt}.${W.default.parentDataProperty}`),t.var(W.default.rootData,(0,A._)`${W.default.valCxt}.${W.default.rootData}`),e.dynamicRef&&t.var(W.default.dynamicAnchors,(0,A._)`${W.default.valCxt}.${W.default.dynamicAnchors}`)},()=>{t.var(W.default.instancePath,(0,A._)`""`),t.var(W.default.parentData,(0,A._)`undefined`),t.var(W.default.parentDataProperty,(0,A._)`undefined`),t.var(W.default.rootData,W.default.data),e.dynamicRef&&t.var(W.default.dynamicAnchors,(0,A._)`{}`)})}function MO(t){let{schema:e,opts:r,gen:n}=t;_b(t,()=>{r.$comment&&e.$comment&&kb(t),BO(t),n.let(W.default.vErrors,null),n.let(W.default.errors,0),r.unevaluated&&LO(t),xb(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 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 qO(t,e){if($b(t)&&(bb(t),yb(t))){FO(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 FO(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&kb(t),JO(t),WO(t);let i=n.const("_errs",W.default.errors);xb(t,i),n.var(e,(0,A._)`${i} === ${W.default.errors}`)}function bb(t){(0,fr.checkUnknownRules)(t),VO(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 VO(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,fr.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,fr.checkStrictMode)(t,"default is ignored in the schema root")}function JO(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,CO.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 kb({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,A._)`${W.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._)`${W.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._)`${W.default.errors} === 0`,()=>e.return(W.default.data),()=>e.throw((0,A._)`new ${o}(${W.default.vErrors})`)):(e.assign((0,A._)`${n}.errors`,W.default.vErrors),i.unevaluated&&KO(t),e.return((0,A._)`${W.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 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,fr.schemaHasRulesButRef)(i,l))){o.block(()=>wb(t,"$ref",l.all.$ref.definition));return}c.jtd||HO(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._)`${W.default.errors} === ${n||0}`))}}function gb(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,DO.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 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=>{Sb(t.dataTypes,r)||sm(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"))&&sm(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,am.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>e1(e,a))&&sm(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function e1(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 t1(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,fr.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,fr.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",W.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 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=fr.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=fr.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}};jr.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 r1=/^\/(?:[^~]|~0|~1)*$/,n1=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function zb(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return W.default.rootData;if(t[0]==="/"){if(!r1.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=W.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,fr.unescapeJsonPointer)(u))}`,a=(0,A._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}jr.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 Rt=Q(),o1=hc(),on=dr(),Dt=Fi(),Ib=ae(),i1=Ji(),to=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={}}};St.SchemaEnv=to;function mm(t){let e=Tb.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 Rt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:o1.default,code:(0,Rt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:on.default.data,parentData:on.default.parentData,parentDataProperty:on.default.parentDataProperty,dataNames:[on.default.data],dataPathArr:[Rt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Rt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Rt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Rt._)`""`,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(on.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let p=new Function(`${on.default.self}`,`${on.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 Rt.Name?void 0:g,items:h instanceof Rt.Name?void 0:h,dynamicProps:g instanceof Rt.Name,dynamicItems:h instanceof Rt.Name},p.source&&(p.source.evaluated=(0,Rt.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 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 to({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=s1.call(this,i)}St.resolveRef=a1;function s1(t){return(0,Dt.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(c1(e,t))return e}St.getCompilingSchema=Tb;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]||gc.call(this,t,e)}function gc(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 pm.call(this,r,t);let i=(0,Dt.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,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 to({schema:s,schemaId:c,root:t,baseId:o})}return pm.call(this,r,a)}}St.resolveSchema=gc;var l1=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];!l1.has(s)&&u&&(e=(0,Dt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Ib.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Dt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=gc.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new to({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var Pb=x((Bq,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 gm=x((Jq,Nb)=>{"use strict";var f1=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 p1=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Eb(t){return t.length=0,!0}function m1(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 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=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(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(!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:p1,recomposeAuthority:y1,normalizeComponentEncoding:_1,removeDotSegments:v1,isIPv4:Ob,isUUID:f1,normalizeIPv6:jb,stringArrayToHexStripped:hm}});var Ub=x((Wq,Ab)=>{"use strict";var{isUUID:$1}=gm(),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 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 Db(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=vm(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function w1(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 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=_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 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=_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 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 Cb={scheme:"http",domainHost:!0,parse:Rb,serialize:Db},E1={scheme:"https",domainHost:Cb.domainHost,parse:Rb,serialize:Db},_c={scheme:"ws",domainHost:!0,parse:S1,serialize:w1},O1={scheme:"wss",domainHost:_c.domainHost,parse:_c.parse,serialize:_c.serialize},j1={scheme:"urn",parse:z1,serialize:I1,skipNormalize:!0},N1={scheme:"urn:uuid",parse:T1,serialize:P1,skipNormalize:!0},yc={http:Cb,https:E1,ws:_c,wss:O1,urn:j1,"urn:uuid":N1};Object.setPrototypeOf(yc,null);function _m(t){return t&&(yc[t]||yc[t.toLowerCase()])||void 0}Ab.exports={wsIsSecure:vm,SCHEMES:yc,isValidSchemeName:k1,getSchemeHandler:_m}});var Lb=x((Gq,bc)=>{"use strict";var{normalizeIPv6:R1,removeDotSegments:Gi,recomposeAuthority:D1,normalizeComponentEncoding:$c,isIPv4:C1,nonSimpleDomain:A1}=gm(),{SCHEMES:U1,getSchemeHandler:Zb}=Ub();function Z1(t,e){return typeof t=="string"?t=Vt(pr(t,e),e):typeof t=="object"&&(t=pr(Vt(t,e),e)),t}function M1(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Mb(pr(t,n),pr(e,n),n,!0);return n.skipEscape=!0,Vt(o,n)}function Mb(t,e,r,n){let o={};return n||(t=pr(Vt(t,r),r),e=pr(Vt(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 L1(t,e,r){return typeof t=="string"?(t=unescape(t),t=Vt($c(pr(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Vt($c(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Vt($c(pr(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Vt($c(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Vt(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=D1(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 q1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function pr(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(C1(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=Zb(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 ym={SCHEMES:U1,normalize:Z1,resolve:M1,resolveComponent:Mb,equal:L1,serialize:Vt,parse:pr};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 F1=Ji();Object.defineProperty(Ze,"KeywordCxt",{enumerable:!0,get:function(){return F1.KeywordCxt}});var ro=Q();Object.defineProperty(Ze,"_",{enumerable:!0,get:function(){return ro._}});Object.defineProperty(Ze,"str",{enumerable:!0,get:function(){return ro.str}});Object.defineProperty(Ze,"stringify",{enumerable:!0,get:function(){return ro.stringify}});Object.defineProperty(Ze,"nil",{enumerable:!0,get:function(){return ro.nil}});Object.defineProperty(Ze,"Name",{enumerable:!0,get:function(){return ro.Name}});Object.defineProperty(Ze,"CodeGen",{enumerable:!0,get:function(){return ro.CodeGen}});var V1=hc(),Gb=Wi(),B1=Kp(),Ki=vc(),J1=Q(),Hi=Fi(),xc=qi(),xm=ae(),Vb=Pb(),W1=Fb(),Kb=(t,e)=>new RegExp(t,e);Kb.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.'},Bb=200;function Y1(t){var e,r,n,o,i,a,s,c,u,l,d,f,p,g,h,y,w,P,j,z,N,Re,ce,$,b;let D=t.strict,U=(e=t.code)===null||e===void 0?void 0:e.optimize,L=U===!0||U===void 0?1:U||0,Te=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Kb,$e=(o=t.uriResolver)!==null&&o!==void 0?o:W1.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:D)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:D)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:D)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:D)!==null&&f!==void 0?f:"log",strictRequired:(g=(p=t.strictRequired)!==null&&p!==void 0?p:D)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:L,regExp:Te}:{optimize:L,regExp:Te},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:(Re=t.validateSchema)!==null&&Re!==void 0?Re:!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:$e}}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,...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)(),Jb.call(this,H1,e,"NOT SUPPORTED"),Jb.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=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(aj.call(this,n,r),!r)return(0,xm.eachItem)(n,i=>bm.call(this,i)),this;cj.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=V1.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 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,xm.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 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?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=Hb(e)),t.validateSchema=this.compile(e,!0))}var uj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hb(t){return{anyOf:[t,uj]}}});var Yb=x(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});var lj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};km.default=lj});var rx=x(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.callRef=an.getValidate=void 0;var dj=Wi(),Qb=kt(),at=Q(),no=dr(),ex=vc(),kc=ae(),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=ex.resolveRef.call(c,u,o,r);if(l===void 0)throw new dj.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,at._)`${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,at.stringify)(g)}:{ref:g}),y=e.name("valid"),w=t.subschema({schema:g,dataTypes:[],schemaPath:at.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,at._)`${r.scopeValue("wrapper",{ref:e})}.validate`}an.getValidate=tx;function Sc(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?no.default.this:at.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,at._)`await ${(0,Qb.callValidateCode)(t,e,u)}`),p(e),a||o.assign(g,!0)},h=>{o.if((0,at._)`!(${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,at._)`${g}.errors`;o.assign(no.default.vErrors,(0,at._)`${no.default.vErrors} === null ? ${h} : ${no.default.vErrors}.concat(${h})`),o.assign(no.default.errors,(0,at._)`${no.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,at._)`${g}.evaluated.props`);i.props=kc.mergeEvaluated.props(o,w,i.props,at.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,at._)`${g}.evaluated.items`);i.items=kc.mergeEvaluated.items(o,w,i.items,at.Name)}}}an.callRef=Sc;an.default=fj});var nx=x(Sm=>{"use strict";Object.defineProperty(Sm,"__esModule",{value:!0});var pj=Yb(),mj=rx(),hj=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",pj.default,mj.default];Sm.default=hj});var ox=x(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});var wc=Q(),Nr=wc.operators,zc={maximum:{okStr:"<=",ok:Nr.LTE,fail:Nr.GT},minimum:{okStr:">=",ok:Nr.GTE,fail:Nr.LT},exclusiveMaximum:{okStr:"<",ok:Nr.LT,fail:Nr.GTE},exclusiveMinimum:{okStr:">",ok:Nr.GT,fail:Nr.LTE}},gj={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}}`},vj={keyword:Object.keys(zc),type:"number",schemaType:"number",$data:!0,error:gj,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,wc._)`${r} ${zc[e].fail} ${n} || isNaN(${r})`)}};wm.default=vj});var ix=x(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Yi=Q(),_j={message:({schemaCode:t})=>(0,Yi.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Yi._)`{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,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=yj});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 sn=Q(),$j=ae(),bj=sx(),xj={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,sn.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,sn._)`{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"?sn.operators.GT:sn.operators.LT,a=o.opts.unicode===!1?(0,sn._)`${r}.length`:(0,sn._)`${(0,$j.useFunc)(t.gen,bj.default)}(${r})`;t.fail$data((0,sn._)`${a} ${i} ${n}`)}};Tm.default=kj});var ux=x(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var Sj=kt(),wj=ae(),oo=Q(),zj={message:({schemaCode:t})=>(0,oo.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,oo._)`{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,oo._)`new RegExp`:(0,wj.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,oo._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,oo._)`!${l}`)}else{let c=(0,Sj.usePattern)(t,o);t.fail$data((0,oo._)`!${c}.test(${r})`)}}};Pm.default=Ij});var lx=x(Em=>{"use strict";Object.defineProperty(Em,"__esModule",{value:!0});var Qi=Q(),Tj={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}}`},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"?Qi.operators.GT:Qi.operators.LT;t.fail$data((0,Qi._)`Object.keys(${r}).length ${o} ${n}`)}};Em.default=Pj});var dx=x(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});var ea=kt(),ta=Q(),Ej=ae(),Oj={message:({params:{missingProperty:t}})=>(0,ta.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ta._)`{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 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,Ej.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=jj});var fx=x(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var ra=Q(),Nj={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}}`},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"?ra.operators.GT:ra.operators.LT;t.fail$data((0,ra._)`${r}.length ${o} ${n}`)}};jm.default=Rj});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(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var Rm=qi(),Me=Q(),Dj=ae(),Cj=Ic(),Aj={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}}`},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,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,Dj.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)})))}}};Dm.default=Uj});var hx=x(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});var Cm=Q(),Zj=ae(),Mj=Ic(),Lj={message:"must be equal to constant",params:({schemaCode:t})=>(0,Cm._)`{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,Cm._)`!${(0,Zj.useFunc)(e,Mj.default)}(${r}, ${o})`):t.fail((0,Cm._)`${i} !== ${r}`)}};Am.default=qj});var gx=x(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});var na=Q(),Fj=ae(),Vj=Ic(),Bj={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,na._)`{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 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=Jj});var vx=x(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});var Wj=ox(),Gj=ix(),Kj=cx(),Hj=ux(),Xj=lx(),Yj=dx(),Qj=fx(),eN=mx(),tN=hx(),rN=gx(),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];Zm.default=nN});var Lm=x(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.validateAdditionalItems=void 0;var cn=Q(),Mm=ae(),oN={message:({params:{len:t}})=>(0,cn.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,cn._)`{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,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,cn._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,cn._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Mm.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,cn._)`${s} <= ${e.length}`);r.if((0,cn.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,cn.not)(u),()=>r.break())})}}oa.validateAdditionalItems=_x;oa.default=iN});var qm=x(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.validateTuple=void 0;var yx=Q(),Tc=ae(),aN=kt(),sN={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,aN.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=sN});var bx=x(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});var cN=qm(),uN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,cN.validateTuple)(t,"items")};Fm.default=uN});var kx=x(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});var xx=Q(),lN=ae(),dN=kt(),fN=Lm(),pN={message:({params:{len:t}})=>(0,xx.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xx._)`{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)))}};Vm.default=mN});var Sx=x(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});var wt=Q(),Pc=ae(),hN={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}}`},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,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=gN});var Ix=x(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.validateSchemaDeps=Bt.validatePropertyDeps=Bt.error=void 0;var Jm=Q(),vN=ae(),aa=kt();Bt.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},
|
|
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:Bt.error,code(t){let[e,r]=yN(t);wx(t,e),zx(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 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())}}Bt.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,vN.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))}Bt.validateSchemaDeps=zx;Bt.default=_N});var Px=x(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var Tx=Q(),$N=ae(),bN={message:"property name must be valid",params:({params:t})=>(0,Tx._)`{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,Tx.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Wm.default=xN});var Km=x(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});var Ec=kt(),Ct=Q(),kN=dr(),Oc=ae(),SN={message:"must NOT have additional properties",params:({params:t})=>(0,Ct._)`{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,Oc.alwaysValidSchema)(a,r))return;let u=(0,Ec.allSchemaProperties)(n.properties),l=(0,Ec.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ct._)`${i} === ${kN.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=wN});var jx=x(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var zN=Ji(),Ex=kt(),Hm=ae(),Ox=Km(),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&&Ox.default.code(new zN.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=IN});var Cx=x(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var Nx=kt(),jc=Q(),Rx=ae(),Dx=ae(),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,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,Dx.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:Dx.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=TN});var Ax=x(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});var PN=ae(),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"}};Qm.default=EN});var Ux=x(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var ON=kt(),jN={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ON.validateUnion,error:{message:"must match a schema in anyOf"}};eh.default=jN});var Zx=x(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});var Nc=Q(),NN=ae(),RN={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Nc._)`{passingSchemas: ${t.passing}}`},DN={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 f;(0,NN.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=DN});var Mx=x(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});var CN=ae(),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,CN.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};rh.default=AN});var Fx=x(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});var Rc=Q(),qx=ae(),UN={message:({params:t})=>(0,Rc.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Rc._)`{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,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=ZN});var Vx=x(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});var MN=ae(),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`)}};oh.default=LN});var Bx=x(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var qN=Lm(),FN=bx(),VN=qm(),BN=kx(),JN=Sx(),WN=Ix(),GN=Px(),KN=Km(),HN=jx(),XN=Cx(),YN=Ax(),QN=Ux(),e4=Zx(),t4=Mx(),r4=Fx(),n4=Vx();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}ih.default=o4});var Jx=x(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});var Ee=Q(),i4={message:({schemaCode:t})=>(0,Ee.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ee._)`{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?f():p();function f(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Ee._)`${g}[${a}]`),y=r.let("fType"),w=r.let("format");r.if((0,Ee._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Ee._)`${h}.type || "string"`).assign(w,(0,Ee._)`${h}.validate`),()=>r.assign(y,(0,Ee._)`"string"`).assign(w,h)),t.fail$data((0,Ee.or)(P(),j()));function P(){return c.strictSchema===!1?Ee.nil:(0,Ee._)`${a} && !${w}`}function j(){let z=l.$async?(0,Ee._)`(${h}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,Ee._)`${w}(${n})`,N=(0,Ee._)`(typeof ${w} == "function" ? ${z} : ${w}.test(${n}))`;return(0,Ee._)`${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 Re=N instanceof RegExp?(0,Ee.regexpCode)(N):c.code.formats?(0,Ee._)`${c.code.formats}${(0,Ee.getProperty)(i)}`:void 0,ce=r.scopeValue("formats",{key:i,ref:N,code:Re});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,Ee._)`${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,Ee._)`await ${w}(${n})`}return typeof y=="function"?(0,Ee._)`${w}(${n})`:(0,Ee._)`${w}.test(${n})`}}}};ah.default=a4});var Wx=x(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});var s4=Jx(),c4=[s4.default];sh.default=c4});var Gx=x(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.contentVocabulary=io.metadataVocabulary=void 0;io.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];io.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Hx=x(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});var u4=nx(),l4=vx(),d4=Bx(),f4=Wx(),Kx=Gx(),p4=[u4.default,l4.default,(0,d4.default)(),f4.default,Kx.metadataVocabulary,Kx.contentVocabulary];ch.default=p4});var Yx=x(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.DiscrError=void 0;var Xx;(function(t){t.Tag="tag",t.Mapping="mapping"})(Xx||(Dc.DiscrError=Xx={}))});var ek=x(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var ao=Q(),uh=Yx(),Qx=vc(),m4=Wi(),h4=ae(),g4={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,ao._)`{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,ao._)`${r}${(0,ao.getProperty)(s)}`);e.if((0,ao._)`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,ao._)`${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,ao.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,h4.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 m4.default(i.opts.uriResolver,i.baseId,ce)}let Re=(p=N?.properties)===null||p===void 0?void 0:p[s];if(typeof Re!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(h||w(N)),P(Re,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 Re of z.enum)j(Re,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=v4});var tk=x((C9,_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 fh=x((Se,dh)=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.MissingRefError=Se.ValidationError=Se.CodeGen=Se.Name=Se.nil=Se.stringify=Se.str=Se._=Se.KeywordCxt=Se.Ajv=void 0;var y4=Xb(),$4=Hx(),b4=ek(),rk=tk(),x4=["/properties"],Cc="http://json-schema.org/draft-07/schema",so=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(rk,x4):rk;this.addMetaSchema(e,Cc,!1),this.refs["http://json-schema.org/schema"]=Cc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Cc)?Cc:void 0)}};Se.Ajv=so;dh.exports=Se=so;dh.exports.Ajv=so;Object.defineProperty(Se,"__esModule",{value:!0});Se.default=so;var k4=Ji();Object.defineProperty(Se,"KeywordCxt",{enumerable:!0,get:function(){return k4.KeywordCxt}});var co=Q();Object.defineProperty(Se,"_",{enumerable:!0,get:function(){return co._}});Object.defineProperty(Se,"str",{enumerable:!0,get:function(){return co.str}});Object.defineProperty(Se,"stringify",{enumerable:!0,get:function(){return co.stringify}});Object.defineProperty(Se,"nil",{enumerable:!0,get:function(){return co.nil}});Object.defineProperty(Se,"Name",{enumerable:!0,get:function(){return co.Name}});Object.defineProperty(Se,"CodeGen",{enumerable:!0,get:function(){return co.CodeGen}});var S4=hc();Object.defineProperty(Se,"ValidationError",{enumerable:!0,get:function(){return S4.default}});var w4=Wi();Object.defineProperty(Se,"MissingRefError",{enumerable:!0,get:function(){return w4.default}})});var lk=x(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.formatNames=Wt.fastFormats=Wt.fullFormats=void 0;function Jt(t,e){return{validate:t,compare:e}}Wt.fullFormats={date:Jt(ak,gh),time:Jt(mh(!0),vh),"date-time":Jt(nk(!0),ck),"iso-time":Jt(mh(),sk),"iso-date-time":Jt(nk(),uk),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:D4},int64:{type:"number",validate:C4},float:{type:"number",validate:ik},double:{type:"number",validate:ik},password:!0,binary:!0};Wt.fastFormats={...Wt.fullFormats,date:Jt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,gh),time:Jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vh),"date-time":Jt(/^\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":Jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sk),"iso-date-time":Jt(/^\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};Wt.formatNames=Object.keys(Wt.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 ak(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 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 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 ok=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function j4(t){return ok.lastIndex=0,ok.test(t)}var N4=-(2**31),R4=2**31-1;function D4(t){return Number.isInteger(t)&&t<=R4&&t>=N4}function C4(t){return Number.isInteger(t)}function ik(){return!0}var A4=/[^\\]\\Z/;function U4(t){if(A4.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var dk=x(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.formatLimitDefinition=void 0;var Z4=fh(),At=Q(),Rr=At.operators,Ac={formatMaximum:{okStr:"<=",ok:Rr.LTE,fail:Rr.GT},formatMinimum:{okStr:">=",ok:Rr.GTE,fail:Rr.LT},formatExclusiveMaximum:{okStr:"<",ok:Rr.LT,fail:Rr.GTE},formatExclusiveMinimum:{okStr:">",ok:Rr.GT,fail:Rr.LTE}},M4={message:({keyword:t,schemaCode:e})=>(0,At.str)`should be ${Ac[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,At._)`{comparison: ${Ac[t].okStr}, limit: ${e}}`};uo.formatLimitDefinition={keyword:Object.keys(Ac),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 f=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=e.const("fmt",(0,At._)`${f}[${c.schemaCode}]`);t.fail$data((0,At.or)((0,At._)`typeof ${p} != "object"`,(0,At._)`${p} instanceof RegExp`,(0,At._)`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,At._)`${a.code.formats}${(0,At.getProperty)(f)}`:void 0});t.fail$data(d(g))}function d(f){return(0,At._)`${f}.compare(${r}, ${n}) ${Ac[o].fail} 0`}},dependencies:["format"]};var L4=t=>(t.addKeyword(uo.formatLimitDefinition),t);uo.default=L4});var hk=x((sa,mk)=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var lo=lk(),q4=dk(),_h=Q(),fk=new _h.Name("fullFormats"),F4=new _h.Name("fastFormats"),yh=(t,e={keywords:!0})=>{if(Array.isArray(e))return pk(t,e,lo.fullFormats,fk),t;let[r,n]=e.mode==="fast"?[lo.fastFormats,F4]:[lo.fullFormats,fk],o=e.formats||lo.formatNames;return pk(t,o,r,n),e.keywords&&(0,q4.default)(t),t};yh.get=(t,e="full")=>{let n=(e==="fast"?lo.fastFormats:lo.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((H9,kk)=>{kk.exports=xk;xk.sync=W4;var $k=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 bk(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:J4(e,r)}function xk(t,e,r){$k.stat(t,function(n,o){r(n,n?!1:bk(o,t,e))})}function W4(t,e){return bk($k.statSync(t),t,e)}});var Pk=x((X9,Tk)=>{Tk.exports=zk;zk.sync=G4;var wk=require("fs");function zk(t,e,r){wk.stat(t,function(n,o){r(n,n?!1:Ik(o,e))})}function G4(t,e){return Ik(wk.statSync(t),e)}function Ik(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 Ok=x((Q9,Ek)=>{var Y9=require("fs"),qc;process.platform==="win32"||global.TESTING_WINDOWS?qc=Sk():qc=Pk();Ek.exports=$h;$h.sync=H4;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 H4(t,e){try{return qc.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Uk=x((eF,Ak)=>{var fo=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",jk=require("path"),X4=fo?";":":",Nk=Ok(),Rk=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Dk=(t,e)=>{let r=e.colon||X4,n=t.match(/\//)||fo&&t.match(/\\/)?[""]:[...fo?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=fo?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=fo?o.split(r):[""];return fo&&t.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Ck=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Dk(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)},Y4=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Dk(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=Ck;Ck.sync=Y4});var Mk=x((tF,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((rF,Fk)=>{"use strict";var Lk=require("path"),Q4=Uk(),eR=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=Q4.sync(t.command,{path:r[eR({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 tR(t){return qk(t)||qk(t,!0)}Fk.exports=tR});var Bk=x((nF,kh)=>{"use strict";var xh=/([()\][%!^"`<>&|;, *?])/g;function rR(t){return t=t.replace(xh,"^$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(xh,"^$1"),e&&(t=t.replace(xh,"^$1")),t}kh.exports.command=rR;kh.exports.argument=nR});var Wk=x((oF,Jk)=>{"use strict";Jk.exports=/^#!(.*)/});var Kk=x((iF,Gk)=>{"use strict";var oR=Wk();Gk.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 Xk=x((aF,Hk)=>{"use strict";var Sh=require("fs"),iR=Kk();function aR(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 iR(r.toString())}Hk.exports=aR});var tS=x((sF,eS)=>{"use strict";var sR=require("path"),Yk=Vk(),Qk=Bk(),cR=Xk(),uR=process.platform==="win32",lR=/\.(?:com|exe)$/i,dR=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function fR(t){t.file=Yk(t);let e=t.file&&cR(t.file);return e?(t.args.unshift(t.file),t.command=e,Yk(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=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 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)}eS.exports=mR});var oS=x((cF,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 hR(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 gR(t,e){return wh&&t===1&&!e.file?zh(e.original,"spawnSync"):null}nS.exports={hookChildProcess:hR,verifyENOENT:rS,verifyENOENTSync:gR,notFoundError:zh}});var sS=x((uF,po)=>{"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 vR(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}po.exports=aS;po.exports.spawn=aS;po.exports.sync=vR;po.exports._parse=Ih;po.exports._enoent=Th});var Lw=de(Sg(),1),qw=de(ya(),1),Fw=de(fn(),1),Vw=de(iu(),1),Bw=de(cu(),1),Jw=de(mu(),1),Ng=de(ka(),1),Ww=de(jg(),1);var Rg=Ng.default;var Ph=de(require("readline")),Pe=de(require("fs")),Gt=de(require("path"));var Dg=(t=0)=>e=>`\x1B[${e+t}m`,Cg=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Ag=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,ze={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]}},BR=Object.keys(ze.modifier),Gw=Object.keys(ze.color),Kw=Object.keys(ze.bgColor),JR=[...Gw,...Kw];function Hw(){let t=new Map;for(let[e,r]of Object.entries(ze)){for(let[n,o]of Object.entries(r))ze[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=ze[n],t.set(o[0],o[1]);Object.defineProperty(ze,e,{value:r,enumerable:!1})}return Object.defineProperty(ze,"codes",{value:t,enumerable:!1}),ze.color.close="\x1B[39m",ze.bgColor.close="\x1B[49m",ze.color.ansi=Dg(),ze.color.ansi256=Cg(),ze.color.ansi16m=Ag(),ze.bgColor.ansi=Dg(10),ze.bgColor.ansi256=Cg(10),ze.bgColor.ansi16m=Ag(10),Object.defineProperties(ze,{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=>ze.rgbToAnsi256(...ze.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)=>ze.ansi256ToAnsi(ze.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>ze.ansi256ToAnsi(ze.hexToAnsi256(e)),enumerable:!1}}),ze}var Xw=Hw(),Tt=Xw;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:Ie}=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 Yw(){if("FORCE_COLOR"in Ie)return Ie.FORCE_COLOR==="true"?1:Ie.FORCE_COLOR==="false"?0:Ie.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ie.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&&(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 Ie&&"AGENT_NAME"in Ie)return 1;if(t&&!e&&o===void 0)return 0;let i=o||0;if(Ie.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 Ie)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Ie)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Ie)||Ie.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Ie)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ie.TEAMCITY_VERSION)?1:0;if(Ie.COLORTERM==="truecolor"||Ie.TERM==="xterm-kitty"||Ie.TERM==="xterm-ghostty"||Ie.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Ie){let a=Number.parseInt((Ie.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ie.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ie.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ie.TERM)||"COLORTERM"in Ie?1:i}function Ug(t,e={}){let r=e0(t,{streamIsTTY:t&&t.isTTY,...e});return Qw(r)}var t0={stdout:Ug({isTTY:gu.default.isatty(1)}),stderr:Ug({isTTY:gu.default.isatty(2)})},Mg=t0;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
|
|
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"),
|
|
19
|
-
`);return i!==-1&&(e=qg(e,o,n,i)),n+e+o};Object.defineProperties(So.prototype,
|
|
18
|
+
`,o)}while(n!==-1);return i+=t.slice(o),i}var{stdout:Fg,stderr:Vg}=Mg,vu=Symbol("GENERATOR"),_n=Symbol("STYLER"),ko=Symbol("IS_EMPTY"),Bg=["ansi","ansi","ansi256","ansi16m"],yn=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=Fg?Fg.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,So.prototype),e};function So(t){return n0(t)}Object.setPrototypeOf(So.prototype,Function.prototype);for(let[t,e]of Object.entries(Tt))yn[t]={get(){let r=Ia(this,yu(e.open,e.close,this[_n]),this[ko]);return Object.defineProperty(this,t,{value:r}),r}};yn.visible={get(){let t=Ia(this,this[_n],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var _u=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?Tt[r].ansi16m(...n):e==="ansi256"?Tt[r].ansi256(Tt.rgbToAnsi256(...n)):Tt[r].ansi(Tt.rgbToAnsi(...n)):t==="hex"?_u("rgb",e,r,...Tt.hexToRgb(...n)):Tt[r][t](...n),o0=["rgb","hex","ansi256"];for(let t of o0){yn[t]={get(){let{level:r}=this;return function(...n){let o=yu(_u(t,Bg[r],"color",...n),Tt.color.close,this[_n]);return Ia(this,o,this[ko])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);yn[e]={get(){let{level:r}=this;return function(...n){let o=yu(_u(t,Bg[r],"bgColor",...n),Tt.bgColor.close,this[_n]);return Ia(this,o,this[ko])}}}}var i0=Object.defineProperties(()=>{},{...yn,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)=>a0(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,i0),n[vu]=t,n[_n]=e,n[ko]=r,n},a0=(t,e)=>{if(t.level<=0||!e)return t[ko]?"":e;let r=t[_n];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,yn);var s0=So(),QR=So({level:Vg?Vg.level:0});var v=s0;var Ta=require("child_process"),tt=de(require("fs")),Pa=de(require("path")),Ea=process.cwd();async function $u(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 Oa(t){return Pa.resolve(Ea,t)}var Jg=100*1024;function c0(t){let e=Oa(t.path),r=tt.statSync(e);if(r.size>Jg){let o=tt.readFileSync(e,"utf-8").slice(0,Jg),i=tt.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:
|
|
24
|
-
`)||"(empty)"}}function
|
|
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
|
|
23
|
+
[FILE TRUNCATED: showing ${a}/${i} lines (${(r.size/1024).toFixed(0)}KB). Use grep to find specific sections.]`}}return{success:!0,output:tt.readFileSync(e,"utf-8")}}function u0(t){let e=Oa(t.path);return tt.mkdirSync(Pa.dirname(e),{recursive:!0}),tt.writeFileSync(e,t.content,"utf-8"),{success:!0,output:`Written ${t.path} (${t.content.length} chars)`}}function l0(t){let e=Oa(t.path),r=tt.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`}:(tt.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,Ta.execSync)(n,{cwd:Ea,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,Ta.execSync)(e,{cwd:Ea,encoding:"utf-8",timeout:1e4})||"(no files found)"}}function p0(t){let e=Oa(t.path||".");return{success:!0,output:tt.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[/\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 h0(t){let e=wo.resolve(ja,t);return e.startsWith(ja+wo.sep)||e===ja}var g0=new Set(["read_file","grep","glob","list_dir"]);async function Xg(t,e,r){if(g0.has(t)){let n=e.path||e.pattern||".";if(h0(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 v0(`
|
|
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 v0(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
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
|
|
27
|
+
`)}var Qg=de(require("fs")),Ra=de(require("path"));function _0(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=(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 f=(l%2===0?n:o)(u[l]),p=u[l].length,g=" ".repeat(Math.max(0,e-4-p));console.log(` ${a} ${f}${g} ${a}`)}console.log(c("")),console.log(c(r("AI-powered coding assistant")+" ".repeat(Math.max(0,e-38))+r("v0.1.9"))),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 ")+v.hex("#F6821F")("Cloudflare"))),console.log(` ${n("\u2514"+"\u2500".repeat(e-2)+"\u2518")}`),console.log(v.gray(" Built by ")+v.cyan.bold("Bowen Liu")),console.log("")}function tv(t){console.log(v.white(t))}function Da(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:{let s=Object.values(e).find(u=>u&&typeof u=="string")||"";o=`I will ${s.startsWith("http")?"fetch":t.includes("search")?"search":"query"}: ${v.blue(s.slice(0,80))}`}}console.log(v.yellow(`
|
|
28
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(`
|
|
29
29
|
`).slice(0,20).map(l=>` ${l}`).join(`
|
|
30
30
|
`);console.log(v.white(u)),r.split(`
|
|
@@ -41,14 +41,14 @@
|
|
|
41
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
42
|
`))}function ku(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
|
|
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 $0=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(`
|
|
45
45
|
\u26A1 Synapse Login
|
|
46
|
-
`));let t=await ov(" Username: "),e=await ov(" Password: ");try{let r=await fetch(`${
|
|
47
|
-
\u274C ${n.error||"Login failed"}`)),process.exit(1))
|
|
46
|
+
`));let t=await ov(" Username: "),e=await ov(" 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(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
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(`
|
|
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"]),Qt=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 ct=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()}};ct.create=t=>new ct(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,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}},vr=b0;var x0=vr;function To(){return x0}var Ca=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=Ca({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===vr?void 0:vr].filter(o=>!!o)});t.common.issues.push(n)}var qe=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 V;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 V;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}}},V=Object.freeze({status:"aborted"}),bn=t=>({status:"dirty",value:t}),Ge=t=>({status:"valid",value:t}),wu=t=>t.status==="aborted",zu=t=>t.status==="dirty",Lr=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(Lr(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 ct(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 Qt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qe,ctx:{common:e.parent.common,data:e.data,parsedType:Qt(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:Qt(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:Qt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Lr(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=>Lr(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:Qt(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 Et({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 Pt.create(this,this._def)}nullable(){return rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return qr.create(this,this._def)}or(e){return zn.create([this,e],this._def)}and(e){return In.create(this,e,this._def)}transform(e){return new Et({...K(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new jn({...K(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new Aa({typeName:M.ZodBranded,type:this,...K(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Nn({...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 Ua.create(this,e)}readonly(){return Rn.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})+$",Iu,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]))$/,D0=/^(([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}=))?$/,A0=/^([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])))",U0=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 Z0(t){return new RegExp(`^${pv(t)}$`)}function M0(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 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)&&D0.test(t))}var kn=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}),V}let n=new qe,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")Iu||(Iu=new RegExp(O0,"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")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"?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"?A0.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}};kn.create=t=>new kn({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 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}),V}let n,o=new qe;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"?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()):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:M.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 qe;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}),V}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:M.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}),V}return Ge(e.data)}};jo.create=t=>new jo({typeName:M.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}),V}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return I(i,{code:k.invalid_date}),V}let n=new qe,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:M.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}),V}return Ge(e.data)}};Ro.create=t=>new Ro({typeName:M.ZodSymbol,...K(t)});var Sn=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}),V}return Ge(e.data)}};Sn.create=t=>new Sn({typeName:M.ZodUndefined,...K(t)});var wn=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}),V}return Ge(e.data)}};wn.create=t=>new wn({typeName:M.ZodNull,...K(t)});var Do=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Do.create=t=>new Do({typeName:M.ZodAny,...K(t)});var _r=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};_r.create=t=>new _r({typeName:M.ZodUnknown,...K(t)});var Zt=class extends ee{_parse(e){let r=this._getOrReturnCtx(e);return I(r,{code:k.invalid_type,expected:E.never,received:r.parsedType}),V}};Zt.create=t=>new Zt({typeName:M.ZodNever,...K(t)});var Co=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}),V}return Ge(e.data)}};Co.create=t=>new Co({typeName:M.ZodVoid,...K(t)});var yr=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}),V;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=>qe.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new vt(r,a,r.path,s)));return qe.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)}};yr.create=(t,e)=>new yr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...K(e)});function xn(t){if(t instanceof ut){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Pt.create(xn(n))}return new ut({...t._def,shape:()=>e})}else return t instanceof yr?new yr({...t._def,type:xn(t.element)}):t instanceof Pt?Pt.create(xn(t.unwrap())):t instanceof rr?rr.create(xn(t.unwrap())):t instanceof tr?tr.create(t.items.map(e=>xn(e))):t}var ut=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}),V}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Zt&&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 Zt){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=>qe.mergeObjectSync(n,u)):qe.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: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 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 xn(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 Pt;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return mv(oe.objectKeys(this.shape))}};ut.create=(t,e)=>new ut({shape:()=>t,unknownKeys:"strip",catchall:Zt.create(),typeName:M.ZodObject,...K(e)});ut.strictCreate=(t,e)=>new ut({shape:()=>t,unknownKeys:"strict",catchall:Zt.create(),typeName:M.ZodObject,...K(e)});ut.lazycreate=(t,e)=>new ut({shape:t,unknownKeys:"strip",catchall:Zt.create(),typeName:M.ZodObject,...K(e)});var zn=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 ct(s.ctx.common.issues));return I(r,{code:k.invalid_union,unionErrors:a}),V}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 ct(c));return I(r,{code:k.invalid_union,unionErrors:s}),V}}get options(){return this._def.options}};zn.create=(t,e)=>new zn({options:t,typeName:M.ZodUnion,...K(e)});var er=t=>t instanceof Tn?er(t.schema):t instanceof Et?er(t.innerType()):t instanceof Pn?[t.value]:t instanceof En?t.options:t instanceof On?oe.objectValues(t.enum):t instanceof jn?er(t._def.innerType):t instanceof Sn?[void 0]:t instanceof wn?[null]:t instanceof Pt?[void 0,...er(t.unwrap())]:t instanceof rr?[null,...er(t.unwrap())]:t instanceof Aa||t instanceof Rn?er(t.unwrap()):t instanceof Nn?er(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}),V;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]}),V)}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=er(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 Pu(t,e){let r=Qt(t),n=Qt(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 In=class extends ee{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(wu(i)||wu(a))return V;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}),V)};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}))}};In.create=(t,e,r)=>new In({left:t,right:e,typeName:M.ZodIntersection,...K(r)});var tr=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}),V;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"}),V;!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=>qe.mergeArray(r,a)):qe.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};tr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tr({items:t,typeName:M.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}),V;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?qe.mergeObjectAsync(r,o):qe.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:kn.create(),valueType:e,typeName:M.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}),V;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 V;(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 V;(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:M.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}),V;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 V;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:M.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}),V;function n(s,c){return Ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,To(),vr].filter(u=>!!u),issueData:{code:k.invalid_arguments,argumentsError:c}})}function o(s,c){return Ca({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,To(),vr].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 qr){let s=this;return Ge(async function(...c){let u=new ct([]),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 Ge(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new ct([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new ct([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:tr.create(e).rest(_r.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||tr.create([]).rest(_r.create()),returns:r||_r.create(),typeName:M.ZodFunction,...K(n)})}},Tn=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})}};Tn.create=(t,e)=>new Tn({getter:t,typeName:M.ZodLazy,...K(e)});var Pn=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}),V}return{status:"valid",value:e.data}}get value(){return this._def.value}};Pn.create=(t,e)=>new Pn({value:t,typeName:M.ZodLiteral,...K(e)});function mv(t,e){return new En({values:t,typeName:M.ZodEnum,...K(e)})}var En=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}),V}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}),V}return Ge(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})}};En.create=mv;var On=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}),V}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}),V}return Ge(e.data)}get enum(){return this._def.values}};On.create=(t,e)=>new On({values:t,typeName:M.ZodNativeEnum,...K(e)});var qr=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}),V;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Ge(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};qr.create=(t,e)=>new qr({type:t,typeName:M.ZodPromise,...K(e)});var Et=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 V;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?V:c.status==="dirty"?bn(c.value):r.value==="dirty"?bn(c.value):c});{if(r.value==="aborted")return V;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?V:s.status==="dirty"?bn(s.value):r.value==="dirty"?bn(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"?V:(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"?V:(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(!Lr(a))return V;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=>Lr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):V);oe.assertNever(o)}};Et.create=(t,e,r)=>new Et({schema:t,typeName:M.ZodEffects,effect:e,...K(r)});Et.createWithPreprocess=(t,e,r)=>new Et({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...K(r)});var Pt=class extends ee{_parse(e){return this._getType(e)===E.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pt.create=(t,e)=>new Pt({innerType:t,typeName:M.ZodOptional,...K(e)});var rr=class extends ee{_parse(e){return this._getType(e)===E.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};rr.create=(t,e)=>new rr({innerType:t,typeName:M.ZodNullable,...K(e)});var jn=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}};jn.create=(t,e)=>new jn({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var Nn=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 ct(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ct(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nn.create=(t,e)=>new Nn({innerType:t,typeName:M.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}),V}return{status:"valid",value:e.data}}};Zo.create=t=>new Zo({typeName:M.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"?V:i.status==="dirty"?(r.dirty(),bn(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"?V: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})}},Rn=class extends ee{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Lr(o)&&(o.value=Object.freeze(o.value)),o);return Po(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Rn.create=(t,e)=>new Rn({innerType:t,typeName:M.ZodReadonly,...K(e)});var zD={object:ut.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 ID=kn.create,TD=Eo.create,PD=Zo.create,ED=Oo.create,OD=jo.create,jD=No.create,ND=Ro.create,RD=Sn.create,DD=wn.create,CD=Do.create,AD=_r.create,UD=Zt.create,ZD=Co.create,MD=yr.create,B0=ut.create,LD=ut.strictCreate,qD=zn.create,FD=Tu.create,VD=In.create,BD=tr.create,JD=Eu.create,WD=Ao.create,GD=Uo.create,KD=Ou.create,HD=Tn.create,XD=Pn.create,YD=En.create,QD=On.create,eC=qr.create,tC=Et.create,rC=Pt.create,nC=rr.create,oC=Et.createWithPreprocess,iC=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 Mt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Fr=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:()=>kr,allowsEval:()=>Cu,assert:()=>Y0,assertEqual:()=>G0,assertIs:()=>H0,assertNever:()=>X0,assertNotEqual:()=>K0,assignProp:()=>br,base64ToUint8Array:()=>kv,base64urlToUint8Array:()=>uz,cached:()=>Cn,captureStackTrace:()=>La,cleanEnum:()=>cz,cleanRegex:()=>qo,clone:()=>Ke,cloneDef:()=>ez,createTransparentProxy:()=>az,defineLazy:()=>H,esc:()=>Ma,escapeRegex:()=>_t,extend:()=>yv,finalizeIssue:()=>rt,floatSafeRemainder:()=>Ru,getElementAtPath:()=>tz,getEnumValues:()=>Lo,getLengthableOrigin:()=>Bo,getParsedType:()=>iz,getSizableOrigin:()=>Vo,hexToUint8Array:()=>dz,isObject:()=>Vr,isPlainObject:()=>xr,issue:()=>An,joinValues:()=>q,jsonStringifyReplacer:()=>Dn,merge:()=>sz,mergeDefs:()=>nr,normalizeParams:()=>T,nullish:()=>$r,numKeys:()=>oz,objectClone:()=>Q0,omit:()=>_v,optionalKeys:()=>Zu,parsedType:()=>B,partial:()=>bv,pick:()=>vv,prefixIssues:()=>lt,primitiveTypes:()=>Uu,promiseAllObject:()=>rz,propertyKeyTypes:()=>Fo,randomString:()=>nz,required:()=>xv,safeExtend:()=>$v,shallowClone:()=>Au,slugify:()=>Du,stringifyPrimitive:()=>F,uint8ArrayToBase64:()=>Sv,uint8ArrayToBase64url:()=>lz,uint8ArrayToHex:()=>fz,unwrapMessage:()=>Mo});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 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 q(t,e="|"){return t.map(r=>F(r)).join(e)}function Dn(t,e){return typeof e=="bigint"?e.toString():e}function Cn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function $r(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 Q0(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function br(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nr(...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 nr(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 Ma(t){return JSON.stringify(t)}function Du(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var La="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Vr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Cu=Cn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function xr(t){if(Vr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Vr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Au(t){return xr(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}`)}},Fo=new Set(["string","number","symbol"]),Uu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function _t(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(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 F(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=nr(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 br(this,"shape",a),a},checks:[]});return Ke(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=nr(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 br(this,"shape",a),a},checks:[]});return Ke(t,i)}function yv(t,e){if(!xr(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=nr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return br(this,"shape",i),i}});return Ke(t,o)}function $v(t,e){if(!xr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=nr(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return br(this,"shape",n),n}});return Ke(t,r)}function sz(t,e){let r=nr(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return br(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Ke(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=nr(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 br(this,"shape",c),c},checks:[]});return Ke(e,a)}function xv(t,e,r){let n=nr(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 br(this,"shape",i),i}});return Ke(e,n)}function kr(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 lt(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 rt(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 B(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 An(...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 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 uz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return kv(e+r)}function lz(t){return Sv(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 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,Dn,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 Mt;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>rt(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=>rt(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 Mt;return i.issues.length?{success:!1,error:new(t??qa)(i.issues.map(a=>rt(a,o,je())))}:{success:!0,data:i.value}},Un=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=>rt(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:()=>bz,cidrv4:()=>tl,cidrv6:()=>rl,cuid:()=>qu,cuid2:()=>Fu,date:()=>il,datetime:()=>sl,domain:()=>Sz,duration:()=>Gu,e164:()=>ol,email:()=>Hu,emoji:()=>Xu,extendedDuration:()=>mz,guid:()=>Ku,hex:()=>wz,hostname:()=>kz,html5Email:()=>_z,idnEmail:()=>$z,integer:()=>ll,ipv4:()=>Yu,ipv6:()=>Qu,ksuid:()=>Ju,lowercase:()=>ml,mac:()=>el,md5_base64:()=>Iz,md5_base64url:()=>Tz,md5_hex:()=>zz,nanoid:()=>Wu,null:()=>fl,number:()=>Ja,rfc5322Email:()=>yz,sha1_base64:()=>Ez,sha1_base64url:()=>Oz,sha1_hex:()=>Pz,sha256_base64:()=>Nz,sha256_base64url:()=>Rz,sha256_hex:()=>jz,sha384_base64:()=>Cz,sha384_base64url:()=>Az,sha384_hex:()=>Dz,sha512_base64:()=>Zz,sha512_base64url:()=>Mz,sha512_hex:()=>Uz,string:()=>cl,time:()=>al,ulid:()=>Vu,undefined:()=>pl,unicodeEmail:()=>Rv,uppercase:()=>hl,uuid:()=>Br,uuid4:()=>hz,uuid6:()=>gz,uuid7:()=>vz,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)?)?)$/,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)?)??$/,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})$/,Br=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=Br(4),gz=Br(6),vz=Br(7),Hu=/^(?!\.)(?!.*\.\.)([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,}))$/,Rv=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,$z=Rv,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 Xu(){return new RegExp(xz,"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_-]*$/,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,}$/,ol=/^\+[1-9]\d{6,14}$/,Dv="(?:(?:\\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(`^${Dv}$`);function Cv(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(`^${Cv(t)}$`)}function sl(t){let e=Cv({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(`^${Dv}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]*$/,wz=/^[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 zz=/^[0-9a-fA-F]{32}$/,Iz=ei(22,"=="),Tz=ti(22),Pz=/^[0-9a-fA-F]{40}$/,Ez=ei(27,"="),Oz=ti(27),jz=/^[0-9a-fA-F]{64}$/,Nz=ei(43,"="),Rz=ti(43),Dz=/^[0-9a-fA-F]{96}$/,Cz=ei(64,""),Az=ti(64),Uz=/^[0-9a-fA-F]{128}$/,Zz=ei(86,"=="),Mz=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!$r(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!$r(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!$r(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!$r(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!$r(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!$r(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(...lt(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(`
|
|
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(`
|
|
51
|
+
`))}};var o_={major:4,minor:3,patch:6};var G=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=kr(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 Mt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=kr(a,f)))});else{if(a.issues.length===f)continue;u||(u=kr(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(kr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new Mt;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 Mt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}H(t,"~standard",()=>({validate:o=>{try{let i=Un(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}))}),Jr=m("$ZodString",(t,e)=>{G.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),Jr.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=Br(n))}else e.pattern??(e.pattern=Br());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"}),Dl=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})}}}),Cl=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 Lz(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=>{Lz(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 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 ql=m("$ZodJWT",(t,e)=>{fe.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})}}),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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.init(t,e),t._zod.parse=r=>r}),Hl=m("$ZodUnknown",(t,e)=>{G.init(t,e),t._zod.parse=r=>r}),Xl=m("$ZodNever",(t,e)=>{G.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)=>{G.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)=>{G.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(...lt(r,t.issues)),e.value[r]=t.value}var ed=m("$ZodArray",(t,e)=>{G.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(...lt(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(G.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=Cn(()=>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=Vr,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=Cn(()=>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
52
|
if (${z}.issues.length) {
|
|
53
53
|
if (${N} in input) {
|
|
54
54
|
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
newResult[${N}] = ${z}.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
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");let P=p.compile();return(j,z)=>P(f,j,z)},i,a=Vr,s=!Za.jitless,u=s&&Cu.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=>!kr(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=>rt(a,n,je())))}),e)}var oi=m("$ZodUnion",(t,e)=>{G.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=>rt(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=Cn(()=>{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(!Vr(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)=>{G.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(xr(t)&&xr(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}),kr(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)=>{G.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(...lt(r,t.issues)),e.value[r]=t.value}var od=m("$ZodRecord",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!xr(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(...lt(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...lt(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=>rt(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(...lt(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...lt(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),id=m("$ZodMap",(t,e)=>{G.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(...lt(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>rt(s,a,je()))})),e.issues.length&&(Fo.has(typeof n)?r.issues.push(...lt(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>rt(s,a,je()))})),r.value.set(t.value,e.value)}var ad=m("$ZodSet",(t,e)=>{G.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)=>{G.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(G.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)=>{G.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)=>{G.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Fr(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 Mt;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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Fr("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)=>{G.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=>rt(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=>rt(i,n,je()))},input:r.value}),r.issues=[]),r)}}),_d=m("$ZodNaN",(t,e)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>{G.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)=>(G.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)=>{G.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)=>{G.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),G.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(An(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=B(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${F(o.values[0])}`:`Invalid option: expected one of ${q(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":""}: ${q(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:Vz()}}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 He=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 Dd(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function Cd(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 or(t,e){return new gl({check:"less_than",...T(e),value:t,inclusive:!1})}function dt(t,e){return new gl({check:"less_than",...T(e),value:t,inclusive:!0})}function ir(t,e){return new vl({check:"greater_than",...T(e),value:t,inclusive:!1})}function Xe(t,e){return new vl({check:"greater_than",...T(e),value:t,inclusive:!0})}function tf(t){return ir(0,t)}function rf(t){return or(0,t)}function nf(t){return dt(0,t)}function of(t){return Xe(0,t)}function Wr(t,e){return new Zv({check:"multiple_of",...T(e),value:t})}function Gr(t,e){return new qv({check:"max_size",...T(e),maximum:t})}function ar(t,e){return new Fv({check:"min_size",...T(e),minimum:t})}function Zn(t,e){return new Vv({check:"size_equals",...T(e),size:t})}function Mn(t,e){return new Bv({check:"max_length",...T(e),maximum:t})}function Sr(t,e){return new Jv({check:"min_length",...T(e),minimum:t})}function Ln(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 Lt(t){return new r_({check:"overwrite",tx:t})}function hi(t){return Lt(e=>e.normalize(t))}function gi(){return Lt(t=>t.trim())}function vi(){return Lt(t=>t.toLowerCase())}function _i(){return Lt(t=>t.toUpperCase())}function ks(){return Lt(t=>Du(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=Gz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(An(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(An(o))}},t(r.value,r)));return e}function Gz(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=He.get(r)??{};He.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=He.get(r)??{};He.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??Jr,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 qn(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??He,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 be(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),be(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"&&Ye(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>
|
|
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),
|
|
89
|
-
`}var
|
|
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");
|
|
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 Ye(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 Ye(n.element,r);if(n.type==="set")return Ye(n.valueType,r);if(n.type==="lazy")return Ye(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 Ye(n.innerType,r);if(n.type==="intersection")return Ye(n.left,r)||Ye(n.right,r);if(n.type==="record"||n.type==="map")return Ye(n.keyType,r)||Ye(n.valueType,r);if(n.type==="pipe")return Ye(n.in,r)||Ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ye(o,r))return!0;return!!(n.rest&&Ye(n.rest,r))}return!1}var k_=(t,e={})=>r=>{let n=Ss({...r,processors:e});return be(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 be(t,a),ws(a,t),zs(a,t)};var Kz={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=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}))])}},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)=>{},D_=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},C_=(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=be(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]=be(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=be(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)=>be(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=be(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=be(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)=>be(f,e,{...n,path:[...n.path,a,p]})),u=i.rest?be(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=be(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=be(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=be(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=be(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;be(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ey=(t,e,r,n)=>{let o=t._zod.def;be(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;be(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;be(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;be(i,e,n);let a=e.seen.get(t);a.ref=i},oy=(t,e,r,n)=>{let o=t._zod.def;be(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;be(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},hf=(t,e,r,n)=>{let o=t._zod.def;be(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ay=(t,e,r,n)=>{let o=t._zod.innerType;be(o,e,n);let i=e.seen.get(t);i.ref=o};function Fn(t){return!!t._zod}function jt(t,e){return Fn(t)?Un(t,e):t.safeParse(e)}function Is(t){if(!t)return;let e;if(Fn(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(Fn(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:()=>Cs,ZodBigIntFormat:()=>Ff,ZodBoolean:()=>Ds,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:()=>Df,ZodIPv6:()=>Cf,ZodIntersection:()=>Dy,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:()=>Vn,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:()=>Cy,ZodType:()=>X,ZodULID:()=>jf,ZodURL:()=>Ns,ZodUUID:()=>sr,ZodUndefined:()=>zy,ZodUnion:()=>Zs,ZodUnknown:()=>Py,ZodVoid:()=>Oy,ZodXID:()=>Nf,ZodXor:()=>Ny,_ZodString:()=>zf,_default:()=>Wy,_function:()=>pT,any:()=>KI,array:()=>re,base64:()=>jI,base64url:()=>NI,bigint:()=>VI,boolean:()=>Oe,catch:()=>Qy,check:()=>mT,cidrv4:()=>EI,cidrv6:()=>OI,codec:()=>lT,cuid:()=>xI,cuid2:()=>kI,custom:()=>Xf,date:()=>XI,describe:()=>hT,discriminatedUnion:()=>Ms,e164:()=>RI,email:()=>fI,emoji:()=>$I,enum:()=>Ve,exactOptional:()=>Vy,file:()=>aT,float32:()=>MI,float64:()=>LI,function:()=>pT,guid:()=>pI,hash:()=>ZI,hex:()=>UI,hostname:()=>AI,httpUrl:()=>yI,instanceof:()=>vT,int:()=>wf,int32:()=>qI,int64:()=>BI,intersection:()=>ki,ipv4:()=>II,ipv6:()=>PI,json:()=>yT,jwt:()=>DI,keyof:()=>YI,ksuid:()=>zI,lazy:()=>i$,literal:()=>C,looseObject:()=>Fe,looseRecord:()=>rT,mac:()=>TI,map:()=>nT,meta:()=>gT,nan:()=>uT,nanoid:()=>bI,nativeEnum:()=>iT,never:()=>Vf,nonoptional:()=>Hy,null:()=>As,nullable:()=>Es,nullish:()=>sT,number:()=>le,object:()=>O,optional:()=>xe,partialRecord:()=>tT,pipe:()=>Os,prefault:()=>Ky,preprocess:()=>Fs,promise:()=>fT,readonly:()=>r$,record:()=>pe,refine:()=>c$,set:()=>oT,strictObject:()=>QI,string:()=>_,stringFormat:()=>CI,stringbool:()=>_T,success:()=>cT,superRefine:()=>u$,symbol:()=>WI,templateLiteral:()=>dT,transform:()=>Jf,tuple:()=>Ay,uint32:()=>FI,uint64:()=>JI,ulid:()=>SI,undefined:()=>GI,union:()=>_e,unknown:()=>ve,url:()=>_I,uuid:()=>mI,uuidv4:()=>hI,uuidv6:()=>gI,uuidv7:()=>vI,void:()=>HI,xid:()=>wI,xor:()=>eT});var Ts={};ho(Ts,{endsWith:()=>pi,gt:()=>ir,gte:()=>Xe,includes:()=>di,length:()=>Ln,lowercase:()=>ui,lt:()=>or,lte:()=>dt,maxLength:()=>Mn,maxSize:()=>Gr,mime:()=>mi,minLength:()=>Sr,minSize:()=>ar,multipleOf:()=>Wr,negative:()=>rf,nonnegative:()=>of,nonpositive:()=>nf,normalize:()=>hi,overwrite:()=>Lt,positive:()=>tf,property:()=>af,regex:()=>ci,size:()=>Zn,slugify:()=>ks,startsWith:()=>fi,toLowerCase:()=>vi,toUpperCase:()=>_i,trim:()=>gi,uppercase:()=>li});var Kr={};ho(Kr,{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 Dd(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,Dn,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Dn,2)}},isEmpty:{get(){return t.issues.length===0}}})},s6=m("ZodError",dy),ft=m("ZodError",dy,{Parent:Error});var fy=Wo(ft),py=Ko(ft),my=Xo(ft),hy=Yo(ft),gy=zv(ft),vy=Iv(ft),_y=Tv(ft),yy=Pv(ft),$y=Ev(ft),by=Ov(ft),xy=jv(ft),ky=Nv(ft);var X=m("ZodType",(t,e)=>(G.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)=>Ke(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(Lt(r)),t.optional=()=>xe(t),t.exactOptional=()=>Vy(t),t.nullable=()=>Es(t),t.nullish=()=>xe(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 He.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return He.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return He.get(t);let n=t.clone();return He.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)=>{Jr.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(Sr(...n)),t.max=(...n)=>t.check(Mn(...n)),t.length=(...n)=>t.check(Ln(...n)),t.nonempty=(...n)=>t.check(Sr(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)=>{Jr.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(sr,r)),t.uuidv4=r=>t.check(is(sr,r)),t.uuidv6=r=>t.check(as(sr,r)),t.uuidv7=r=>t.check(ss(sr,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(Df,r)),t.ipv6=r=>t.check(gs(Cf,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 fI(t){return ns(If,t)}var Ps=m("ZodGUID",(t,e)=>{yl.init(t,e),ge.init(t,e)});function pI(t){return ai(Ps,t)}var sr=m("ZodUUID",(t,e)=>{$l.init(t,e),ge.init(t,e)});function mI(t){return os(sr,t)}function hI(t){return is(sr,t)}function gI(t){return as(sr,t)}function vI(t){return ss(sr,t)}var Ns=m("ZodURL",(t,e)=>{xl.init(t,e),ge.init(t,e)});function _I(t){return si(Ns,t)}function yI(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 $I(t){return cs(Tf,t)}var Pf=m("ZodNanoID",(t,e)=>{Sl.init(t,e),ge.init(t,e)});function bI(t){return us(Pf,t)}var Ef=m("ZodCUID",(t,e)=>{wl.init(t,e),ge.init(t,e)});function xI(t){return ls(Ef,t)}var Of=m("ZodCUID2",(t,e)=>{zl.init(t,e),ge.init(t,e)});function kI(t){return ds(Of,t)}var jf=m("ZodULID",(t,e)=>{Il.init(t,e),ge.init(t,e)});function SI(t){return fs(jf,t)}var Nf=m("ZodXID",(t,e)=>{Tl.init(t,e),ge.init(t,e)});function wI(t){return ps(Nf,t)}var Rf=m("ZodKSUID",(t,e)=>{Pl.init(t,e),ge.init(t,e)});function zI(t){return ms(Rf,t)}var Df=m("ZodIPv4",(t,e)=>{Rl.init(t,e),ge.init(t,e)});function II(t){return hs(Df,t)}var Sy=m("ZodMAC",(t,e)=>{Cl.init(t,e),ge.init(t,e)});function TI(t){return Od(Sy,t)}var Cf=m("ZodIPv6",(t,e)=>{Dl.init(t,e),ge.init(t,e)});function PI(t){return gs(Cf,t)}var Af=m("ZodCIDRv4",(t,e)=>{Al.init(t,e),ge.init(t,e)});function EI(t){return vs(Af,t)}var Uf=m("ZodCIDRv6",(t,e)=>{Ul.init(t,e),ge.init(t,e)});function OI(t){return _s(Uf,t)}var Zf=m("ZodBase64",(t,e)=>{Zl.init(t,e),ge.init(t,e)});function jI(t){return ys(Zf,t)}var Mf=m("ZodBase64URL",(t,e)=>{Ml.init(t,e),ge.init(t,e)});function NI(t){return $s(Mf,t)}var Lf=m("ZodE164",(t,e)=>{Ll.init(t,e),ge.init(t,e)});function RI(t){return bs(Lf,t)}var qf=m("ZodJWT",(t,e)=>{ql.init(t,e),ge.init(t,e)});function DI(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 qn(xi,t,e,r)}function AI(t){return qn(xi,"hostname",yt.hostname,t)}function UI(t){return qn(xi,"hex",yt.hex,t)}function ZI(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=yt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return qn(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(ir(n,o)),t.gte=(n,o)=>t.check(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.lt=(n,o)=>t.check(or(n,o)),t.lte=(n,o)=>t.check(dt(n,o)),t.max=(n,o)=>t.check(dt(n,o)),t.int=n=>t.check(wf(n)),t.safe=n=>t.check(wf(n)),t.positive=n=>t.check(ir(0,n)),t.nonnegative=n=>t.check(Xe(0,n)),t.negative=n=>t.check(or(0,n)),t.nonpositive=n=>t.check(dt(0,n)),t.multipleOf=(n,o)=>t.check(Wr(n,o)),t.step=(n,o)=>t.check(Wr(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 Cd(Rs,t)}var Vn=m("ZodNumberFormat",(t,e)=>{Vl.init(t,e),Rs.init(t,e)});function wf(t){return Ad(Vn,t)}function MI(t){return Ud(Vn,t)}function LI(t){return Zd(Vn,t)}function qI(t){return Md(Vn,t)}function FI(t){return Ld(Vn,t)}var Ds=m("ZodBoolean",(t,e)=>{ni.init(t,e),X.init(t,e),t._zod.processJSONSchema=(r,n,o)=>z_(t,r,n,o)});function Oe(t){return qd(Ds,t)}var Cs=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(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.gt=(n,o)=>t.check(ir(n,o)),t.gte=(n,o)=>t.check(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.lt=(n,o)=>t.check(or(n,o)),t.lte=(n,o)=>t.check(dt(n,o)),t.max=(n,o)=>t.check(dt(n,o)),t.positive=n=>t.check(ir(BigInt(0),n)),t.negative=n=>t.check(or(BigInt(0),n)),t.nonpositive=n=>t.check(dt(BigInt(0),n)),t.nonnegative=n=>t.check(Xe(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Wr(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 Fd(Cs,t)}var Ff=m("ZodBigIntFormat",(t,e)=>{Bl.init(t,e),Cs.init(t,e)});function BI(t){return Vd(Ff,t)}function JI(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 WI(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 GI(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 KI(){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 HI(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)=>D_(t,n,o,i),t.min=(n,o)=>t.check(Xe(n,o)),t.max=(n,o)=>t.check(dt(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 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(Sr(r,n)),t.nonempty=r=>t.check(Sr(1,r)),t.max=(r,n)=>t.check(Mn(r,n)),t.length=(r,n)=>t.check(Ln(r,n)),t.unwrap=()=>t.element});function re(t,e){return x_(jy,t,e)}function YI(t){let e=t._zod.def.shape;return Ve(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=()=>Ve(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 QI(t,e){return new Us({type:"object",shape:t,catchall:Vf(),...S.normalizeParams(e)})}function Fe(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 eT(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 Dy=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 Dy({type:"intersection",left:t,right:e})}var Cy=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 G,o=n?r:e,i=n?e:null;return new Cy({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 tT(t,e,r){let n=Ke(t);return n._zod.values=void 0,new Ls({type:"record",keyType:n,valueType:e,...S.normalizeParams(r)})}function rT(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(ar(...r)),t.nonempty=r=>t.check(ar(1,r)),t.max=(...r)=>t.check(Gr(...r)),t.size=(...r)=>t.check(Zn(...r))});function nT(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(ar(...r)),t.nonempty=r=>t.check(ar(1,r)),t.max=(...r)=>t.check(Gr(...r)),t.size=(...r)=>t.check(Zn(...r))});function oT(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)=>C_(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 Ve(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 iT(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 C(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(ar(r,n)),t.max=(r,n)=>t.check(Gr(r,n)),t.mime=(r,n)=>t.check(mi(Array.isArray(r)?r:[r],n))});function aT(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 Fr(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 xe(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 sT(t){return xe(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 cT(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 uT(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 lT(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 dT(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 fT(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 pT(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 mT(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 hT=df,gT=ff;function vT(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 _T=(...t)=>pf({Codec:Hf,Boolean:Ds,String:js},...t);function yT(t){let e=i$(()=>_e([_(t),le(),Oe(),As(),re(e),pe(_(),e)]));return e}function Fs(t,e){return Os(Jf(t),e)}var l$;l$||(l$={});var h6={...$i,...Ts,iso:Kr};je(zd());var Qf="2025-11-25";var d$=[Qf,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],wr="io.modelcontextprotocol/related-task",Bs="2.0",Ne=Xf(t=>t!==null&&(typeof t=="object"||typeof t=="function")),f$=_e([_(),le().int()]),p$=_(),R6=Fe({ttl:le().optional(),pollInterval:le().optional()}),kT=O({ttl:le().optional()}),ST=O({taskId:_()}),ep=Fe({progressToken:f$.optional(),[wr]:ST.optional()}),pt=O({_meta:ep.optional()}),Si=pt.extend({task:kT.optional()}),m$=t=>Si.safeParse(t).success,Ce=O({method:_(),params:pt.loose().optional()}),$t=O({_meta:ep.optional()}),bt=O({method:_(),params:$t.loose().optional()}),Ae=Fe({_meta:ep.optional()}),Js=_e([_(),le().int()]),h$=O({jsonrpc:C(Bs),id:Js,...Ce.shape}).strict(),tp=t=>h$.safeParse(t).success,g$=O({jsonrpc:C(Bs),...bt.shape}).strict(),v$=t=>g$.safeParse(t).success,rp=O({jsonrpc:C(Bs),id:Js,result:Ae}).strict(),wi=t=>rp.safeParse(t).success;var J;(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"})(J||(J={}));var np=O({jsonrpc:C(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]),D6=_e([rp,np]),Hr=Ae.strict(),wT=$t.extend({requestId:Js.optional(),reason:_().optional()}),Ws=bt.extend({method:C("notifications/cancelled"),params:wT}),zT=O({src:_(),mimeType:_().optional(),sizes:re(_()).optional(),theme:Ve(["light","dark"]).optional()}),zi=O({icons:re(zT).optional()}),Bn=O({name:_(),title:_().optional()}),$$=Bn.extend({...Bn.shape,...zi.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),IT=ki(O({applyDefaults:Oe().optional()}),pe(_(),ve())),TT=Fs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,ki(O({form:IT.optional(),url:Ne.optional()}),pe(_(),ve()).optional())),PT=Fe({list:Ne.optional(),cancel:Ne.optional(),requests:Fe({sampling:Fe({createMessage:Ne.optional()}).optional(),elicitation:Fe({create:Ne.optional()}).optional()}).optional()}),ET=Fe({list:Ne.optional(),cancel:Ne.optional(),requests:Fe({tools:Fe({call:Ne.optional()}).optional()}).optional()}),OT=O({experimental:pe(_(),Ne).optional(),sampling:O({context:Ne.optional(),tools:Ne.optional()}).optional(),elicitation:TT.optional(),roots:O({listChanged:Oe().optional()}).optional(),tasks:PT.optional(),extensions:pe(_(),Ne).optional()}),jT=pt.extend({protocolVersion:_(),capabilities:OT,clientInfo:$$}),NT=Ce.extend({method:C("initialize"),params:jT});var RT=O({experimental:pe(_(),Ne).optional(),logging:Ne.optional(),completions:Ne.optional(),prompts:O({listChanged:Oe().optional()}).optional(),resources:O({subscribe:Oe().optional(),listChanged:Oe().optional()}).optional(),tools:O({listChanged:Oe().optional()}).optional(),tasks:ET.optional(),extensions:pe(_(),Ne).optional()}),op=Ae.extend({protocolVersion:_(),capabilities:RT,serverInfo:$$,instructions:_().optional()}),DT=bt.extend({method:C("notifications/initialized"),params:$t.optional()});var Gs=Ce.extend({method:C("ping"),params:pt.optional()}),CT=O({progress:le(),total:xe(le()),message:xe(_())}),AT=O({...$t.shape,...CT.shape,progressToken:f$}),Ks=bt.extend({method:C("notifications/progress"),params:AT}),UT=pt.extend({cursor:p$.optional()}),Ii=Ce.extend({params:UT.optional()}),Ti=Ae.extend({nextCursor:p$.optional()}),ZT=Ve(["working","input_required","completed","failed","cancelled"]),Pi=O({taskId:_(),status:ZT,ttl:_e([le(),As()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:xe(le()),statusMessage:xe(_())}),Xr=Ae.extend({task:Pi}),MT=$t.merge(Pi),Ei=bt.extend({method:C("notifications/tasks/status"),params:MT}),Hs=Ce.extend({method:C("tasks/get"),params:pt.extend({taskId:_()})}),Xs=Ae.merge(Pi),Ys=Ce.extend({method:C("tasks/result"),params:pt.extend({taskId:_()})}),C6=Ae.loose(),Qs=Ii.extend({method:C("tasks/list")}),ec=Ti.extend({tasks:re(Pi)}),tc=Ce.extend({method:C("tasks/cancel"),params:pt.extend({taskId:_()})}),b$=Ae.merge(Pi),x$=O({uri:_(),mimeType:xe(_()),_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=Ve(["user","assistant"]),Jn=O({audience:re(Oi).optional(),priority:le().min(0).max(1).optional(),lastModified:Kr.datetime({offset:!0}).optional()}),w$=O({...Bn.shape,...zi.shape,uri:_(),description:xe(_()),mimeType:xe(_()),size:xe(le()),annotations:Jn.optional(),_meta:xe(Fe({}))}),LT=O({...Bn.shape,...zi.shape,uriTemplate:_(),description:xe(_()),mimeType:xe(_()),annotations:Jn.optional(),_meta:xe(Fe({}))}),qT=Ii.extend({method:C("resources/list")}),ap=Ti.extend({resources:re(w$)}),FT=Ii.extend({method:C("resources/templates/list")}),sp=Ti.extend({resourceTemplates:re(LT)}),cp=pt.extend({uri:_()}),VT=cp,BT=Ce.extend({method:C("resources/read"),params:VT}),up=Ae.extend({contents:re(_e([k$,S$]))}),lp=bt.extend({method:C("notifications/resources/list_changed"),params:$t.optional()}),JT=cp,WT=Ce.extend({method:C("resources/subscribe"),params:JT}),GT=cp,KT=Ce.extend({method:C("resources/unsubscribe"),params:GT}),HT=$t.extend({uri:_()}),XT=bt.extend({method:C("notifications/resources/updated"),params:HT}),YT=O({name:_(),description:xe(_()),required:xe(Oe())}),QT=O({...Bn.shape,...zi.shape,description:xe(_()),arguments:xe(re(YT)),_meta:xe(Fe({}))}),eP=Ii.extend({method:C("prompts/list")}),dp=Ti.extend({prompts:re(QT)}),tP=pt.extend({name:_(),arguments:pe(_(),_()).optional()}),rP=Ce.extend({method:C("prompts/get"),params:tP}),fp=O({type:C("text"),text:_(),annotations:Jn.optional(),_meta:pe(_(),ve()).optional()}),pp=O({type:C("image"),data:ip,mimeType:_(),annotations:Jn.optional(),_meta:pe(_(),ve()).optional()}),mp=O({type:C("audio"),data:ip,mimeType:_(),annotations:Jn.optional(),_meta:pe(_(),ve()).optional()}),nP=O({type:C("tool_use"),name:_(),id:_(),input:pe(_(),ve()),_meta:pe(_(),ve()).optional()}),oP=O({type:C("resource"),resource:_e([k$,S$]),annotations:Jn.optional(),_meta:pe(_(),ve()).optional()}),iP=w$.extend({type:C("resource_link")}),hp=_e([fp,pp,mp,iP,oP]),aP=O({role:Oi,content:hp}),gp=Ae.extend({description:_().optional(),messages:re(aP)}),vp=bt.extend({method:C("notifications/prompts/list_changed"),params:$t.optional()}),sP=O({title:_().optional(),readOnlyHint:Oe().optional(),destructiveHint:Oe().optional(),idempotentHint:Oe().optional(),openWorldHint:Oe().optional()}),cP=O({taskSupport:Ve(["required","optional","forbidden"]).optional()}),z$=O({...Bn.shape,...zi.shape,description:_().optional(),inputSchema:O({type:C("object"),properties:pe(_(),Ne).optional(),required:re(_()).optional()}).catchall(ve()),outputSchema:O({type:C("object"),properties:pe(_(),Ne).optional(),required:re(_()).optional()}).catchall(ve()).optional(),annotations:sP.optional(),execution:cP.optional(),_meta:pe(_(),ve()).optional()}),uP=Ii.extend({method:C("tools/list")}),_p=Ti.extend({tools:re(z$)}),Wn=Ae.extend({content:re(hp).default([]),structuredContent:pe(_(),ve()).optional(),isError:Oe().optional()}),A6=Wn.or(Ae.extend({toolResult:ve()})),lP=Si.extend({name:_(),arguments:pe(_(),ve()).optional()}),dP=Ce.extend({method:C("tools/call"),params:lP}),yp=bt.extend({method:C("notifications/tools/list_changed"),params:$t.optional()}),I$=O({autoRefresh:Oe().default(!0),debounceMs:le().int().nonnegative().default(300)}),T$=Ve(["debug","info","notice","warning","error","critical","alert","emergency"]),fP=pt.extend({level:T$}),pP=Ce.extend({method:C("logging/setLevel"),params:fP}),mP=$t.extend({level:T$,logger:_().optional(),data:ve()}),hP=bt.extend({method:C("notifications/message"),params:mP}),gP=O({name:_().optional()}),vP=O({hints:re(gP).optional(),costPriority:le().min(0).max(1).optional(),speedPriority:le().min(0).max(1).optional(),intelligencePriority:le().min(0).max(1).optional()}),_P=O({mode:Ve(["auto","required","none"]).optional()}),yP=O({type:C("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:re(hp).default([]),structuredContent:O({}).loose().optional(),isError:Oe().optional(),_meta:pe(_(),ve()).optional()}),$P=Ms("type",[fp,pp,mp]),Vs=Ms("type",[fp,pp,mp,nP,yP]),bP=O({role:Oi,content:_e([Vs,re(Vs)]),_meta:pe(_(),ve()).optional()}),xP=Si.extend({messages:re(bP),modelPreferences:vP.optional(),systemPrompt:_().optional(),includeContext:Ve(["none","thisServer","allServers"]).optional(),temperature:le().optional(),maxTokens:le().int(),stopSequences:re(_()).optional(),metadata:Ne.optional(),tools:re(z$).optional(),toolChoice:_P.optional()}),$p=Ce.extend({method:C("sampling/createMessage"),params:xP}),bp=Ae.extend({model:_(),stopReason:xe(Ve(["endTurn","stopSequence","maxTokens"]).or(_())),role:Oi,content:$P}),xp=Ae.extend({model:_(),stopReason:xe(Ve(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Oi,content:_e([Vs,re(Vs)])}),kP=O({type:C("boolean"),title:_().optional(),description:_().optional(),default:Oe().optional()}),SP=O({type:C("string"),title:_().optional(),description:_().optional(),minLength:le().optional(),maxLength:le().optional(),format:Ve(["email","uri","date","date-time"]).optional(),default:_().optional()}),wP=O({type:Ve(["number","integer"]),title:_().optional(),description:_().optional(),minimum:le().optional(),maximum:le().optional(),default:le().optional()}),zP=O({type:C("string"),title:_().optional(),description:_().optional(),enum:re(_()),default:_().optional()}),IP=O({type:C("string"),title:_().optional(),description:_().optional(),oneOf:re(O({const:_(),title:_()})),default:_().optional()}),TP=O({type:C("string"),title:_().optional(),description:_().optional(),enum:re(_()),enumNames:re(_()).optional(),default:_().optional()}),PP=_e([zP,IP]),EP=O({type:C("array"),title:_().optional(),description:_().optional(),minItems:le().optional(),maxItems:le().optional(),items:O({type:C("string"),enum:re(_())}),default:re(_()).optional()}),OP=O({type:C("array"),title:_().optional(),description:_().optional(),minItems:le().optional(),maxItems:le().optional(),items:O({anyOf:re(O({const:_(),title:_()}))}),default:re(_()).optional()}),jP=_e([EP,OP]),NP=_e([TP,PP,jP]),RP=_e([NP,kP,SP,wP]),DP=Si.extend({mode:C("form").optional(),message:_(),requestedSchema:O({type:C("object"),properties:pe(_(),RP),required:re(_()).optional()})}),CP=Si.extend({mode:C("url"),message:_(),elicitationId:_(),url:_().url()}),AP=_e([DP,CP]),kp=Ce.extend({method:C("elicitation/create"),params:AP}),UP=$t.extend({elicitationId:_()}),ZP=bt.extend({method:C("notifications/elicitation/complete"),params:UP}),Sp=Ae.extend({action:Ve(["accept","decline","cancel"]),content:Fs(t=>t===null?void 0:t,pe(_(),_e([_(),le(),Oe(),re(_())])).optional())}),MP=O({type:C("ref/resource"),uri:_()});var LP=O({type:C("ref/prompt"),name:_()}),qP=pt.extend({ref:_e([LP,MP]),argument:O({name:_(),value:_()}),context:O({arguments:pe(_(),_()).optional()}).optional()}),FP=Ce.extend({method:C("completion/complete"),params:qP});var wp=Ae.extend({completion:Fe({values:re(_()).max(100),total:xe(le().int()),hasMore:xe(Oe())})}),VP=O({uri:_().startsWith("file://"),name:_().optional(),_meta:pe(_(),ve()).optional()}),BP=Ce.extend({method:C("roots/list"),params:pt.optional()}),JP=Ae.extend({roots:re(VP)}),WP=bt.extend({method:C("notifications/roots/list_changed"),params:$t.optional()}),U6=_e([Gs,NT,FP,pP,rP,eP,qT,FT,BT,WT,KT,dP,uP,Hs,Ys,Qs,tc]),Z6=_e([Ws,Ks,DT,WP,Ei]),M6=_e([Hr,bp,xp,Sp,JP,Xs,ec,Xr]),L6=_e([Gs,$p,kp,BP,Hs,Ys,Qs,tc]),q6=_e([Ws,Ks,hP,XT,lp,yp,vp,Ei,ZP]),F6=_e([Hr,op,wp,gp,dp,ap,sp,up,Wn,_p,Xs,ec,Xr]),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===J.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Yf(o.elicitations,r)}return new t(e,r,n)}},Yf=class extends Z{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(J.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function zr(t){return t==="completed"||t==="failed"||t==="cancelled"}var kM=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=jt(t,e);if(!r.success)throw r.error;return r.data}var QP=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 Z(J.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 Z(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 Z(J.InvalidParams,`Task not found: ${i}`);if(!zr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(zr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[wr]:{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 Z(J.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 Z(J.InvalidParams,`Task not found: ${r.params.taskId}`);if(zr(o.status))throw new Z(J.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(J.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(J.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(J.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=Z.fromError(J.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?.[wr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:J.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 Z(J.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:J.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 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(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=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(J.InternalError,String(a))}}return}let i;try{let a=await this.request(e,Xr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new Z(J.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},zr(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(J.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Z(J.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(J.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||{},[wr]: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 Z?P:new Z(J.RequestTimeout,String(P));l(j)};this._responseHandlers.set(f,P=>{if(!n?.signal?.aborted){if(P instanceof Error)return l(P);try{let j=jt(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??QP,y=()=>g(Z.fromError(J.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||{},[wr]: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||{},[wr]: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||{},[wr]: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 Z(J.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(J.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new Z(J.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(J.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),zr(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(J.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(zr(s.status))throw new Z(J.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),zr(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 V4(){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??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 Zc=class{constructor(e){this._client=e}async*callToolStream(e,r=Wn,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(J.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(J.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(J.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 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 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(Fn(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=jt(kp,c);if(!l.success){let P=l.error instanceof Error?l.error.message:String(l.error);throw new Z(J.InvalidParams,`Invalid elicitation request: ${P}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:p}=B4(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new Z(J.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!p)throw new Z(J.InvalidParams,"Client does not support URL-mode elicitation requests");let g=await Promise.resolve(r(c,u));if(d.task){let P=jt(Xr,g);if(!P.success){let j=P.error instanceof Error?P.error.message:String(P.error);throw new Z(J.InvalidParams,`Invalid task creation result: ${j}`)}return P.data}let h=jt(Sp,g);if(!h.success){let P=h.error instanceof Error?h.error.message:String(h.error);throw new Z(J.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=jt($p,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new Z(J.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let y=jt(Xr,f);if(!y.success){let w=y.error instanceof Error?y.error.message:String(y.error);throw new Z(J.InvalidParams,`Invalid task creation result: ${w}`)}return y.data}let g=d.tools||d.toolChoice?xp:bp,h=jt(g,f);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new Z(J.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"},Hr,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}},Hr,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},Hr,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Hr,r)}async callTool(e,r=Wn,n){if(this.isToolTaskRequired(e.name))throw new Z(J.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(J.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(J.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof Z?a:new Z(J.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),_R(r)}clear(){this._buffer=void 0}};function _R(t){return y$.parse(JSON.parse(t))}function cS(t){return JSON.stringify(t)+`
|
|
89
|
+
`}var yR=Bc.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=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:{...$R(),...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"),Dr=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"]},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 dS}var Jc=class{servers=new Map;toolMap=new Map;toolDefs=[];registry;userConfig={};constructor(){this.registry=xR()}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}`};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 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");Dr.mkdirSync(e,{recursive:!0});let r=ca.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,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 kR=process.env.SYNAPSE_CLI_WS||"wss://cli.synapse.cloudc.top",SR=Gt.join(process.env.HOME||"~",".synapse","token"),mo=[],pS=[],ua="idle",un=!1,mS=0,la=!1,mr=[],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
91
|
${v.cyan.bold("\u26A1 Synara")} \u2014 AI coding assistant
|
|
92
92
|
|
|
93
93
|
${v.bold("Usage:")}
|
|
@@ -111,30 +111,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
111
111
|
\\ + Enter Multi-line continuation
|
|
112
112
|
Ctrl+C Cancel current operation
|
|
113
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
|
|
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 Pe.readFileSync(SR,"utf-8").trim()}catch{return null}}function s(){for(let $ of["SYNAPSE.md","synapse.md"]){let b=Gt.join(process.cwd(),$);if(Pe.existsSync(b))return Pe.readFileSync(b,"utf-8")}}async function c(){ev();let $=a();$||(Io("Not logged in. Run: synara login"),process.exit(1));let b=`${kR}/ws?token=${encodeURIComponent($)}`,D=new Rg(b);t=D,process.on("SIGINT",()=>{ua==="idle"&&(console.log(v.gray(`
|
|
115
115
|
Bye!`)),process.exit(0)),i(),console.log(v.yellow(`
|
|
116
|
-
\u23F9 Cancelled`)),ce({type:"cancel"}),ua="idle",
|
|
117
|
-
`);break;case"turn_end":i(),ua="idle",
|
|
118
|
-
Connection closed.`)),process.exit(0)}),
|
|
119
|
-
Saved sessions (${$.length}):`));for(let b of $)try{let
|
|
116
|
+
\u23F9 Cancelled`)),ce({type:"cancel"}),ua="idle",un=!0;let L=mS;z()}),D.on("open",()=>{ce({type:"auth",token:$,project:{path:process.cwd(),synapseMd:s()}});let L=Date.now();n.init().then(Te=>{if(Te.length>0){ce({type:"mcp_tools",tools:Te,instructions:n.getInstructions()});let $e=((Date.now()-L)/1e3).toFixed(1),Le=[...new Set(Te.map(zt=>zt.serverName))];process.stdout.write("\r\x1B[2K");for(let zt of Le)console.log(v.yellow(` MCP: ${zt} connected`));console.log(v.gray(` Loaded in ${$e}s`)),e&&(e.close(),e=null),z()}}).catch(()=>{})}),D.on("message",async L=>{let Te=JSON.parse(L.toString());if(la){mr.push(Te);return}await U(Te)});async function U(L){switch(L.type){case"session_ready":z();break;case"reasoning_token":case"reasoning_end":break;case"content_token":if(un)break;i(),process.stdout.write(L.content);break;case"content_end":if(un)break;process.stdout.write(`
|
|
117
|
+
`);break;case"turn_end":i(),ua="idle",un=!1,z();break;case"assistant_message":i(),tv(Yg(L.content)),z();break;case"tool_request":if(i(),un)break;L.tool==="web_search"||L.tool==="web_fetch"?Da(L.tool,L.args):n.getServerForTool(L.tool)?await l(L):await u(L);break;case"tool_result_from_cloud":if(un)break;rv(L.tool,L.success,L.output),o();break;case"session_save":i(),p(L),z();break;case"session_load":i(),g(L);break;case"session_list_request":i(),h(),z();break;case"error":i(),Io(L.message),z();break}}D.on("close",()=>{console.log(v.gray(`
|
|
118
|
+
Connection closed.`)),process.exit(0)}),D.on("error",L=>{Io(`Connection failed: ${L.message}`),process.exit(1)})}async function u($){let b=$.description||`${$.tool}`;Da($.tool,$.args,b);let D=await Xg($.tool,$.args,b);if(D==="y"||D==="t"){d($.tool,$.args);let $e=Date.now(),Le=await $u($.tool,$.args);zo($.tool,Le.success,Le.output,Date.now()-$e,$.args),ce({type:"tool_result",call_id:$.call_id,...Le}),o();return}if($.tool==="write_file"&&$.args.content){let $e=xu($.args.path);$e?ku($e,$.args.content,$.args.path):nv($.args.path,$.args.content)}else if($.tool==="edit_file"&&$.args.old_str&&$.args.new_str){let $e=xu($.args.path);ku($.args.old_str,$.args.new_str,$.args.path,$e)}e?.close(),e=null,la=!0;let U;try{U=await bu($.tool,$.args,b)}catch{U="n"}if(la=!1,U==="n"){for(ce({type:"tool_result",call_id:$.call_id,success:!1,output:"User denied"});mr.length;)await handleMessage(mr.shift());o();return}d($.tool,$.args);let L=Date.now(),Te=await $u($.tool,$.args);for(zo($.tool,Te.success,Te.output,Date.now()-L,$.args),ce({type:"tool_result",call_id:$.call_id,...Te});mr.length;)await handleMessage(mr.shift());o()}async function l($){let b=$.description||`${$.tool}`;if(Da($.tool,$.args,b),n.isAutoApprove($.tool)){let Te=Date.now(),$e=await n.callTool($.tool,$.args);zo($.tool,$e.success,$e.output,Date.now()-Te,$.args),ce({type:"tool_result",call_id:$.call_id,...$e}),o();return}e?.close(),e=null,la=!0;let D;try{D=await bu($.tool,$.args,b)}catch{D="n"}if(la=!1,D==="n"){for(ce({type:"tool_result",call_id:$.call_id,success:!1,output:"User denied"});mr.length;)await handleMessage(mr.shift());o();return}let U=Date.now(),L=await n.callTool($.tool,$.args);for(zo($.tool,L.success,L.output,Date.now()-U,$.args),ce({type:"tool_result",call_id:$.call_id,...L});mr.length;)await handleMessage(mr.shift());o()}function d($,b){if($!=="write_file"&&$!=="edit_file")return;let D=b.path;if(!D)return;let U=Gt.resolve(process.cwd(),D);try{Pe.existsSync(U)?mo.push({tool:$,path:D,content:Pe.readFileSync(U,"utf-8")}):mo.push({tool:$,path:D,content:""}),mo.length>50&&mo.shift()}catch{}}let f=Gt.join(process.cwd(),".synapse","sessions");function p($){Pe.mkdirSync(f,{recursive:!0});let b=$.name||new Date().toISOString().replace(/[:.]/g,"-").slice(0,19),D=Gt.join(f,`${b}.json`);if(Pe.existsSync(D)&&!$.force){Io(`Session '${b}' already exists. Use /save ${b} --force to overwrite.`);return}let U={name:b,saved_at:new Date().toISOString(),messages:$.messages,meta:$.meta};Pe.writeFileSync(D,JSON.stringify(U,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 D=Gt.join(f,`${b}.json`);if(!Pe.existsSync(D)){ce({type:"session_data",messages:null,error:`Session '${b}' not found.`}),z();return}try{let U=JSON.parse(Pe.readFileSync(D,"utf-8"));ce({type:"session_data",name:b,messages:U.messages,meta:U.meta||{}}),o()}catch(U){ce({type:"session_data",messages:null,error:`${U}`}),z()}}function h(){if(!Pe.existsSync(f)){console.log(v.gray(" No saved sessions."));return}let $=Pe.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 D=JSON.parse(Pe.readFileSync(Gt.join(f,b),"utf-8")),U=b.replace(".json","");console.log(v.cyan(` ${U}`)+v.gray(` \u2014 ${D.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(`
|
|
120
120
|
Available tools:
|
|
121
|
-
`));for(let
|
|
121
|
+
`)),console.log(v.gray(` ${"Tool".padEnd(12)} Permission`)),console.log(v.gray(` ${"\u2500".repeat(12)} ${"\u2500".repeat(12)}`));for(let D of $){let U=D.perm==="always ask"?v.red("always ask"):Kg(D.name)?v.cyan("trusted"):D.perm==="ask"?v.yellow("ask"):v.cyan("auto"),L=" ".repeat(Math.max(0,12-D.perm.length));console.log(` ${v.cyan(D.name.padEnd(12))} ${U}${L}`)}let b=n.getToolList();if(b.length>0){console.log(v.white(`
|
|
122
122
|
MCP tools:
|
|
123
|
-
`));for(let
|
|
123
|
+
`)),console.log(v.gray(` ${"Tool".padEnd(36)} ${"Permission".padEnd(12)} Server`)),console.log(v.gray(` ${"\u2500".repeat(36)} ${"\u2500".repeat(12)} ${"\u2500".repeat(16)}`));let D=[...new Set(b.map(U=>U.serverName))];for(let U=0;U<D.length;U++){let L=D[U];U>0&&console.log("");let Te=b.filter($e=>$e.serverName===L);for(let $e of Te){let Le=$e.autoApprove?"auto":"ask",zt=$e.autoApprove?v.cyan("auto"):v.yellow("ask"),hS=" ".repeat(Math.max(0,12-Le.length));console.log(` ${v.cyan($e.name.padEnd(36))} ${zt}${hS} ${v.gray(L)}`)}}}console.log(v.gray(`
|
|
124
124
|
Use /tools reset to restore default permissions.
|
|
125
125
|
`))}function w(){let $=n.listAll();if($.length===0){console.log(v.gray(`
|
|
126
126
|
No MCP servers available.
|
|
127
127
|
`));return}console.log(v.white(`
|
|
128
128
|
MCP servers:
|
|
129
|
-
`));for(let b of $){let
|
|
129
|
+
`));for(let b of $){let D=b.connected?v.cyan("connected"):v.gray("disabled");console.log(` ${v.cyan(b.name.padEnd(20))} ${D.padEnd(18)} ${v.gray(b.description)}`)}console.log(v.gray(`
|
|
130
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),
|
|
132
|
-
Connecting to ${
|
|
133
|
-
\u2713 ${
|
|
134
|
-
\u2717 ${
|
|
135
|
-
Usage: /mcp <name> enable | /mcp <name> disable`));z()}function j(){if(
|
|
136
|
-
|
|
137
|
-
`)))})}function
|
|
131
|
+
`))}async function P($){let b=$.split(/\s+/).slice(1),D,U;if(b[0]==="enable"||b[0]==="disable"?(D=b[0],U=b[1]):(b[1]==="enable"||b[1]==="disable")&&(U=b[0],D=b[1]),D==="enable"&&U){console.log(v.gray(`
|
|
132
|
+
Connecting to ${U}...`));let L=await n.enable(U);L.ok?(console.log(v.cyan(` \u2713 ${U} connected \u2014 ${L.tools.length} tools loaded`)),ce({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(v.red(` \u2717 ${L.error}`))}else if(D==="disable"&&U){let L=await n.disable(U);L.ok?(console.log(v.cyan(`
|
|
133
|
+
\u2713 ${U} disconnected`)),ce({type:"mcp_tools",tools:n.getToolList(),instructions:n.getInstructions()})):console.log(v.red(`
|
|
134
|
+
\u2717 ${L.error}`))}else console.log(v.gray(`
|
|
135
|
+
Usage: /mcp <name> enable | /mcp <name> disable`));z()}function j(){if(mo.length===0){console.log(v.gray(" Nothing to undo."));return}let $=mo.pop(),b=Gt.resolve(process.cwd(),$.path);try{$.content===""&&Pe.existsSync(b)?(Pe.unlinkSync(b),console.log(v.blue(` \u2713 Undo: deleted ${$.path} (was newly created)`))):(Pe.writeFileSync(b,$.content,"utf-8"),console.log(v.blue(` \u2713 Undo: restored ${$.path}`)))}catch(D){console.log(v.red(` \u2717 Undo failed: ${D.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 U=b.split(/\s+/),L=n.listAll().map(Te=>Te.name);if(U.length===2){let Te=U[1],$e=L.filter(Le=>Le.startsWith(Te)).map(Le=>`/mcp ${Le}`);return[$e.length?$e:L.map(Le=>`/mcp ${Le}`),b]}if(U.length===3){let Te=U[2],$e=["enable","disable"],Le=$e.filter(zt=>zt.startsWith(Te)).map(zt=>`/mcp ${U[1]} ${zt}`);return[Le.length?Le:$e.map(zt=>`/mcp ${U[1]} ${zt}`),b]}return[[],b]}let D=$.filter(U=>U.startsWith(b));return[D.length?D:$,b]},history:pS.slice().reverse(),historySize:100}),e.question(v.cyan("> "),b=>{if(e?.close(),e=null,b.trimEnd().endsWith("\\")){N([b.trimEnd().slice(0,-1)]);return}if(process.stdin.readable){let D=b,U=()=>{let L=process.stdin.read();L?(D+=`
|
|
136
|
+
`+L.toString().replace(/\n$/,""),setTimeout(U,10)):Re(D)};setTimeout(U,30)}else Re(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),Re($.join(`
|
|
137
|
+
`)))})}function Re($){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
138
|
${v.cyan("/compact")} Compress conversation history to free context
|
|
139
139
|
${v.cyan("/context")} Show context usage (tokens, messages, compactions)
|
|
140
140
|
${v.cyan("/tools")} List all tools and their permission levels
|
|
@@ -156,4 +156,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
156
156
|
`),z();return}if(b==="/tools help"){console.log(`
|
|
157
157
|
${v.cyan("/tools")} Show tools and current permissions
|
|
158
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
|
|
159
|
+
`),z();return}if(b.startsWith("/save")){ce({type:"user_message",content:b});return}if(b.startsWith("/load")){let D=b.split(/\s+/)[1]||"";if(!D){h(),console.log(v.gray(" Usage: /load <name>")),z();return}g({type:"session_load",name:D});return}ce({type:"user_message",content:$}),mS++,un=!1,o()}function ce($){t?.send(JSON.stringify($))}c().catch($=>{console.error($),process.exit(1)})})();
|