spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / plugins / code-review / github-tools / index.js
16,798 lines · 609.5 KBRaw
1var __create = Object.create;
2var __getProtoOf = Object.getPrototypeOf;
3var __defProp = Object.defineProperty;
4var __getOwnPropNames = Object.getOwnPropertyNames;
5var __hasOwnProp = Object.prototype.hasOwnProperty;
6var __toESM = (mod, isNodeMode, target) => {
7 target = mod != null ? __create(__getProtoOf(mod)) : {};
8 const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9 for (let key of __getOwnPropNames(mod))
10 if (!__hasOwnProp.call(to, key))
11 __defProp(to, key, {
12 get: () => mod[key],
13 enumerable: true
14 });
15 return to;
16};
17var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18var __export = (target, all) => {
19 for (var name in all)
20 __defProp(target, name, {
21 get: all[name],
22 enumerable: true,
23 configurable: true,
24 set: (newValue) => all[name] = () => newValue
25 });
26};
27
28// node_modules/uri-js/dist/es5/uri.all.js
29var require_uri_all = __commonJS((exports, module) => {
30 (function(global, factory) {
31 typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global.URI = global.URI || {});
32 })(exports, function(exports2) {
33 function merge() {
34 for (var _len = arguments.length, sets = Array(_len), _key = 0;_key < _len; _key++) {
35 sets[_key] = arguments[_key];
36 }
37 if (sets.length > 1) {
38 sets[0] = sets[0].slice(0, -1);
39 var xl = sets.length - 1;
40 for (var x = 1;x < xl; ++x) {
41 sets[x] = sets[x].slice(1, -1);
42 }
43 sets[xl] = sets[xl].slice(1);
44 return sets.join("");
45 } else {
46 return sets[0];
47 }
48 }
49 function subexp(str) {
50 return "(?:" + str + ")";
51 }
52 function typeOf(o) {
53 return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
54 }
55 function toUpperCase(str) {
56 return str.toUpperCase();
57 }
58 function toArray(obj) {
59 return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
60 }
61 function assign(target, source) {
62 var obj = target;
63 if (source) {
64 for (var key in source) {
65 obj[key] = source[key];
66 }
67 }
68 return obj;
69 }
70 function buildExps(isIRI2) {
71 var ALPHA$$ = "[A-Za-z]", CR$ = "[\\x0D]", DIGIT$$ = "[0-9]", DQUOTE$$ = "[\\x22]", HEXDIG$$2 = merge(DIGIT$$, "[A-Fa-f]"), LF$$ = "[\\x0A]", SP$$ = "[\\x20]", PCT_ENCODED$2 = subexp(subexp("%[EFef]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%" + HEXDIG$$2 + HEXDIG$$2)), GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI2 ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", IPRIVATE$$ = isIRI2 ? "[\\uE000-\\uF8FF]" : "[]", UNRESERVED$$2 = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), USERINFO$ = subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]")) + "*"), DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$2 + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$2 + "|" + PCT_ENCODED$2) + "+"), IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$2 + "{2})") + ZONEID$), IPVFUTURE$ = subexp("[vV]" + HEXDIG$$2 + "+\\." + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]") + "+"), IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), REG_NAME$ = subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$)) + "*"), HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), PORT$ = subexp(DIGIT$$ + "*"), AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), PCHAR$ = subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@]")), SEGMENT$ = subexp(PCHAR$ + "*"), SEGMENT_NZ$ = subexp(PCHAR$ + "+"), SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\@]")) + "+"), PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), PATH_EMPTY$ = "(?!" + PCHAR$ + ")", PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";
72 return {
73 NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
74 NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"),
75 NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"),
76 NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"),
77 NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"),
78 NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
79 NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
80 ESCAPE: new RegExp(merge("[^]", UNRESERVED$$2, SUB_DELIMS$$), "g"),
81 UNRESERVED: new RegExp(UNRESERVED$$2, "g"),
82 OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$2, RESERVED$$), "g"),
83 PCT_ENCODED: new RegExp(PCT_ENCODED$2, "g"),
84 IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
85 IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$2 + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$")
86 };
87 }
88 var URI_PROTOCOL = buildExps(false);
89 var IRI_PROTOCOL = buildExps(true);
90 var slicedToArray = function() {
91 function sliceIterator(arr, i) {
92 var _arr = [];
93 var _n = true;
94 var _d = false;
95 var _e = undefined;
96 try {
97 for (var _i = arr[Symbol.iterator](), _s;!(_n = (_s = _i.next()).done); _n = true) {
98 _arr.push(_s.value);
99 if (i && _arr.length === i)
100 break;
101 }
102 } catch (err) {
103 _d = true;
104 _e = err;
105 } finally {
106 try {
107 if (!_n && _i["return"])
108 _i["return"]();
109 } finally {
110 if (_d)
111 throw _e;
112 }
113 }
114 return _arr;
115 }
116 return function(arr, i) {
117 if (Array.isArray(arr)) {
118 return arr;
119 } else if (Symbol.iterator in Object(arr)) {
120 return sliceIterator(arr, i);
121 } else {
122 throw new TypeError("Invalid attempt to destructure non-iterable instance");
123 }
124 };
125 }();
126 var toConsumableArray = function(arr) {
127 if (Array.isArray(arr)) {
128 for (var i = 0, arr2 = Array(arr.length);i < arr.length; i++)
129 arr2[i] = arr[i];
130 return arr2;
131 } else {
132 return Array.from(arr);
133 }
134 };
135 var maxInt = 2147483647;
136 var base = 36;
137 var tMin = 1;
138 var tMax = 26;
139 var skew = 38;
140 var damp = 700;
141 var initialBias = 72;
142 var initialN = 128;
143 var delimiter = "-";
144 var regexPunycode = /^xn--/;
145 var regexNonASCII = /[^\0-\x7E]/;
146 var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
147 var errors2 = {
148 overflow: "Overflow: input needs wider integers to process",
149 "not-basic": "Illegal input >= 0x80 (not a basic code point)",
150 "invalid-input": "Invalid input"
151 };
152 var baseMinusTMin = base - tMin;
153 var floor = Math.floor;
154 var stringFromCharCode = String.fromCharCode;
155 function error$1(type) {
156 throw new RangeError(errors2[type]);
157 }
158 function map(array, fn) {
159 var result = [];
160 var length = array.length;
161 while (length--) {
162 result[length] = fn(array[length]);
163 }
164 return result;
165 }
166 function mapDomain(string, fn) {
167 var parts = string.split("@");
168 var result = "";
169 if (parts.length > 1) {
170 result = parts[0] + "@";
171 string = parts[1];
172 }
173 string = string.replace(regexSeparators, ".");
174 var labels = string.split(".");
175 var encoded = map(labels, fn).join(".");
176 return result + encoded;
177 }
178 function ucs2decode(string) {
179 var output = [];
180 var counter = 0;
181 var length = string.length;
182 while (counter < length) {
183 var value = string.charCodeAt(counter++);
184 if (value >= 55296 && value <= 56319 && counter < length) {
185 var extra = string.charCodeAt(counter++);
186 if ((extra & 64512) == 56320) {
187 output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
188 } else {
189 output.push(value);
190 counter--;
191 }
192 } else {
193 output.push(value);
194 }
195 }
196 return output;
197 }
198 var ucs2encode = function ucs2encode(array) {
199 return String.fromCodePoint.apply(String, toConsumableArray(array));
200 };
201 var basicToDigit = function basicToDigit(codePoint) {
202 if (codePoint - 48 < 10) {
203 return codePoint - 22;
204 }
205 if (codePoint - 65 < 26) {
206 return codePoint - 65;
207 }
208 if (codePoint - 97 < 26) {
209 return codePoint - 97;
210 }
211 return base;
212 };
213 var digitToBasic = function digitToBasic(digit, flag) {
214 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
215 };
216 var adapt = function adapt(delta, numPoints, firstTime) {
217 var k = 0;
218 delta = firstTime ? floor(delta / damp) : delta >> 1;
219 delta += floor(delta / numPoints);
220 for (;delta > baseMinusTMin * tMax >> 1; k += base) {
221 delta = floor(delta / baseMinusTMin);
222 }
223 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
224 };
225 var decode = function decode(input) {
226 var output = [];
227 var inputLength = input.length;
228 var i = 0;
229 var n = initialN;
230 var bias = initialBias;
231 var basic = input.lastIndexOf(delimiter);
232 if (basic < 0) {
233 basic = 0;
234 }
235 for (var j = 0;j < basic; ++j) {
236 if (input.charCodeAt(j) >= 128) {
237 error$1("not-basic");
238 }
239 output.push(input.charCodeAt(j));
240 }
241 for (var index = basic > 0 ? basic + 1 : 0;index < inputLength; ) {
242 var oldi = i;
243 for (var w = 1, k = base;; k += base) {
244 if (index >= inputLength) {
245 error$1("invalid-input");
246 }
247 var digit = basicToDigit(input.charCodeAt(index++));
248 if (digit >= base || digit > floor((maxInt - i) / w)) {
249 error$1("overflow");
250 }
251 i += digit * w;
252 var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
253 if (digit < t) {
254 break;
255 }
256 var baseMinusT = base - t;
257 if (w > floor(maxInt / baseMinusT)) {
258 error$1("overflow");
259 }
260 w *= baseMinusT;
261 }
262 var out = output.length + 1;
263 bias = adapt(i - oldi, out, oldi == 0);
264 if (floor(i / out) > maxInt - n) {
265 error$1("overflow");
266 }
267 n += floor(i / out);
268 i %= out;
269 output.splice(i++, 0, n);
270 }
271 return String.fromCodePoint.apply(String, output);
272 };
273 var encode = function encode(input) {
274 var output = [];
275 input = ucs2decode(input);
276 var inputLength = input.length;
277 var n = initialN;
278 var delta = 0;
279 var bias = initialBias;
280 var _iteratorNormalCompletion = true;
281 var _didIteratorError = false;
282 var _iteratorError = undefined;
283 try {
284 for (var _iterator = input[Symbol.iterator](), _step;!(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
285 var _currentValue2 = _step.value;
286 if (_currentValue2 < 128) {
287 output.push(stringFromCharCode(_currentValue2));
288 }
289 }
290 } catch (err) {
291 _didIteratorError = true;
292 _iteratorError = err;
293 } finally {
294 try {
295 if (!_iteratorNormalCompletion && _iterator.return) {
296 _iterator.return();
297 }
298 } finally {
299 if (_didIteratorError) {
300 throw _iteratorError;
301 }
302 }
303 }
304 var basicLength = output.length;
305 var handledCPCount = basicLength;
306 if (basicLength) {
307 output.push(delimiter);
308 }
309 while (handledCPCount < inputLength) {
310 var m = maxInt;
311 var _iteratorNormalCompletion2 = true;
312 var _didIteratorError2 = false;
313 var _iteratorError2 = undefined;
314 try {
315 for (var _iterator2 = input[Symbol.iterator](), _step2;!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
316 var currentValue = _step2.value;
317 if (currentValue >= n && currentValue < m) {
318 m = currentValue;
319 }
320 }
321 } catch (err) {
322 _didIteratorError2 = true;
323 _iteratorError2 = err;
324 } finally {
325 try {
326 if (!_iteratorNormalCompletion2 && _iterator2.return) {
327 _iterator2.return();
328 }
329 } finally {
330 if (_didIteratorError2) {
331 throw _iteratorError2;
332 }
333 }
334 }
335 var handledCPCountPlusOne = handledCPCount + 1;
336 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
337 error$1("overflow");
338 }
339 delta += (m - n) * handledCPCountPlusOne;
340 n = m;
341 var _iteratorNormalCompletion3 = true;
342 var _didIteratorError3 = false;
343 var _iteratorError3 = undefined;
344 try {
345 for (var _iterator3 = input[Symbol.iterator](), _step3;!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
346 var _currentValue = _step3.value;
347 if (_currentValue < n && ++delta > maxInt) {
348 error$1("overflow");
349 }
350 if (_currentValue == n) {
351 var q = delta;
352 for (var k = base;; k += base) {
353 var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
354 if (q < t) {
355 break;
356 }
357 var qMinusT = q - t;
358 var baseMinusT = base - t;
359 output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
360 q = floor(qMinusT / baseMinusT);
361 }
362 output.push(stringFromCharCode(digitToBasic(q, 0)));
363 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
364 delta = 0;
365 ++handledCPCount;
366 }
367 }
368 } catch (err) {
369 _didIteratorError3 = true;
370 _iteratorError3 = err;
371 } finally {
372 try {
373 if (!_iteratorNormalCompletion3 && _iterator3.return) {
374 _iterator3.return();
375 }
376 } finally {
377 if (_didIteratorError3) {
378 throw _iteratorError3;
379 }
380 }
381 }
382 ++delta;
383 ++n;
384 }
385 return output.join("");
386 };
387 var toUnicode = function toUnicode(input) {
388 return mapDomain(input, function(string) {
389 return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
390 });
391 };
392 var toASCII = function toASCII(input) {
393 return mapDomain(input, function(string) {
394 return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
395 });
396 };
397 var punycode = {
398 version: "2.1.0",
399 ucs2: {
400 decode: ucs2decode,
401 encode: ucs2encode
402 },
403 decode,
404 encode,
405 toASCII,
406 toUnicode
407 };
408 var SCHEMES = {};
409 function pctEncChar(chr) {
410 var c = chr.charCodeAt(0);
411 var e = undefined;
412 if (c < 16)
413 e = "%0" + c.toString(16).toUpperCase();
414 else if (c < 128)
415 e = "%" + c.toString(16).toUpperCase();
416 else if (c < 2048)
417 e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
418 else
419 e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
420 return e;
421 }
422 function pctDecChars(str) {
423 var newStr = "";
424 var i = 0;
425 var il = str.length;
426 while (i < il) {
427 var c = parseInt(str.substr(i + 1, 2), 16);
428 if (c < 128) {
429 newStr += String.fromCharCode(c);
430 i += 3;
431 } else if (c >= 194 && c < 224) {
432 if (il - i >= 6) {
433 var c2 = parseInt(str.substr(i + 4, 2), 16);
434 newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
435 } else {
436 newStr += str.substr(i, 6);
437 }
438 i += 6;
439 } else if (c >= 224) {
440 if (il - i >= 9) {
441 var _c = parseInt(str.substr(i + 4, 2), 16);
442 var c3 = parseInt(str.substr(i + 7, 2), 16);
443 newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
444 } else {
445 newStr += str.substr(i, 9);
446 }
447 i += 9;
448 } else {
449 newStr += str.substr(i, 3);
450 i += 3;
451 }
452 }
453 return newStr;
454 }
455 function _normalizeComponentEncoding(components, protocol) {
456 function decodeUnreserved2(str) {
457 var decStr = pctDecChars(str);
458 return !decStr.match(protocol.UNRESERVED) ? str : decStr;
459 }
460 if (components.scheme)
461 components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_SCHEME, "");
462 if (components.userinfo !== undefined)
463 components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
464 if (components.host !== undefined)
465 components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
466 if (components.path !== undefined)
467 components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
468 if (components.query !== undefined)
469 components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
470 if (components.fragment !== undefined)
471 components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
472 return components;
473 }
474 function _stripLeadingZeros(str) {
475 return str.replace(/^0*(.*)/, "$1") || "0";
476 }
477 function _normalizeIPv4(host, protocol) {
478 var matches = host.match(protocol.IPV4ADDRESS) || [];
479 var _matches = slicedToArray(matches, 2), address = _matches[1];
480 if (address) {
481 return address.split(".").map(_stripLeadingZeros).join(".");
482 } else {
483 return host;
484 }
485 }
486 function _normalizeIPv6(host, protocol) {
487 var matches = host.match(protocol.IPV6ADDRESS) || [];
488 var _matches2 = slicedToArray(matches, 3), address = _matches2[1], zone = _matches2[2];
489 if (address) {
490 var _address$toLowerCase$ = address.toLowerCase().split("::").reverse(), _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), last = _address$toLowerCase$2[0], first = _address$toLowerCase$2[1];
491 var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
492 var lastFields = last.split(":").map(_stripLeadingZeros);
493 var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
494 var fieldCount = isLastFieldIPv4Address ? 7 : 8;
495 var lastFieldsStart = lastFields.length - fieldCount;
496 var fields = Array(fieldCount);
497 for (var x = 0;x < fieldCount; ++x) {
498 fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || "";
499 }
500 if (isLastFieldIPv4Address) {
501 fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
502 }
503 var allZeroFields = fields.reduce(function(acc, field, index) {
504 if (!field || field === "0") {
505 var lastLongest = acc[acc.length - 1];
506 if (lastLongest && lastLongest.index + lastLongest.length === index) {
507 lastLongest.length++;
508 } else {
509 acc.push({ index, length: 1 });
510 }
511 }
512 return acc;
513 }, []);
514 var longestZeroFields = allZeroFields.sort(function(a, b) {
515 return b.length - a.length;
516 })[0];
517 var newHost = undefined;
518 if (longestZeroFields && longestZeroFields.length > 1) {
519 var newFirst = fields.slice(0, longestZeroFields.index);
520 var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
521 newHost = newFirst.join(":") + "::" + newLast.join(":");
522 } else {
523 newHost = fields.join(":");
524 }
525 if (zone) {
526 newHost += "%" + zone;
527 }
528 return newHost;
529 } else {
530 return host;
531 }
532 }
533 var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
534 var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
535 function parse(uriString) {
536 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
537 var components = {};
538 var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
539 if (options.reference === "suffix")
540 uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
541 var matches = uriString.match(URI_PARSE);
542 if (matches) {
543 if (NO_MATCH_IS_UNDEFINED) {
544 components.scheme = matches[1];
545 components.userinfo = matches[3];
546 components.host = matches[4];
547 components.port = parseInt(matches[5], 10);
548 components.path = matches[6] || "";
549 components.query = matches[7];
550 components.fragment = matches[8];
551 if (isNaN(components.port)) {
552 components.port = matches[5];
553 }
554 } else {
555 components.scheme = matches[1] || undefined;
556 components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
557 components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
558 components.port = parseInt(matches[5], 10);
559 components.path = matches[6] || "";
560 components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
561 components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
562 if (isNaN(components.port)) {
563 components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
564 }
565 }
566 if (components.host) {
567 components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
568 }
569 if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
570 components.reference = "same-document";
571 } else if (components.scheme === undefined) {
572 components.reference = "relative";
573 } else if (components.fragment === undefined) {
574 components.reference = "absolute";
575 } else {
576 components.reference = "uri";
577 }
578 if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
579 components.error = components.error || "URI is not a " + options.reference + " reference.";
580 }
581 var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
582 if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
583 if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
584 try {
585 components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
586 } catch (e) {
587 components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
588 }
589 }
590 _normalizeComponentEncoding(components, URI_PROTOCOL);
591 } else {
592 _normalizeComponentEncoding(components, protocol);
593 }
594 if (schemeHandler && schemeHandler.parse) {
595 schemeHandler.parse(components, options);
596 }
597 } else {
598 components.error = components.error || "URI can not be parsed.";
599 }
600 return components;
601 }
602 function _recomposeAuthority(components, options) {
603 var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
604 var uriTokens = [];
605 if (components.userinfo !== undefined) {
606 uriTokens.push(components.userinfo);
607 uriTokens.push("@");
608 }
609 if (components.host !== undefined) {
610 uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function(_, $1, $2) {
611 return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
612 }));
613 }
614 if (typeof components.port === "number" || typeof components.port === "string") {
615 uriTokens.push(":");
616 uriTokens.push(String(components.port));
617 }
618 return uriTokens.length ? uriTokens.join("") : undefined;
619 }
620 var RDS1 = /^\.\.?\//;
621 var RDS2 = /^\/\.(\/|$)/;
622 var RDS3 = /^\/\.\.(\/|$)/;
623 var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
624 function removeDotSegments(input) {
625 var output = [];
626 while (input.length) {
627 if (input.match(RDS1)) {
628 input = input.replace(RDS1, "");
629 } else if (input.match(RDS2)) {
630 input = input.replace(RDS2, "/");
631 } else if (input.match(RDS3)) {
632 input = input.replace(RDS3, "/");
633 output.pop();
634 } else if (input === "." || input === "..") {
635 input = "";
636 } else {
637 var im = input.match(RDS5);
638 if (im) {
639 var s = im[0];
640 input = input.slice(s.length);
641 output.push(s);
642 } else {
643 throw new Error("Unexpected dot segment condition");
644 }
645 }
646 }
647 return output.join("");
648 }
649 function serialize(components) {
650 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
651 var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
652 var uriTokens = [];
653 var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
654 if (schemeHandler && schemeHandler.serialize)
655 schemeHandler.serialize(components, options);
656 if (components.host) {
657 if (protocol.IPV6ADDRESS.test(components.host)) {} else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
658 try {
659 components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
660 } catch (e) {
661 components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
662 }
663 }
664 }
665 _normalizeComponentEncoding(components, protocol);
666 if (options.reference !== "suffix" && components.scheme) {
667 uriTokens.push(components.scheme);
668 uriTokens.push(":");
669 }
670 var authority = _recomposeAuthority(components, options);
671 if (authority !== undefined) {
672 if (options.reference !== "suffix") {
673 uriTokens.push("//");
674 }
675 uriTokens.push(authority);
676 if (components.path && components.path.charAt(0) !== "/") {
677 uriTokens.push("/");
678 }
679 }
680 if (components.path !== undefined) {
681 var s = components.path;
682 if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
683 s = removeDotSegments(s);
684 }
685 if (authority === undefined) {
686 s = s.replace(/^\/\//, "/%2F");
687 }
688 uriTokens.push(s);
689 }
690 if (components.query !== undefined) {
691 uriTokens.push("?");
692 uriTokens.push(components.query);
693 }
694 if (components.fragment !== undefined) {
695 uriTokens.push("#");
696 uriTokens.push(components.fragment);
697 }
698 return uriTokens.join("");
699 }
700 function resolveComponents(base2, relative) {
701 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
702 var skipNormalization = arguments[3];
703 var target = {};
704 if (!skipNormalization) {
705 base2 = parse(serialize(base2, options), options);
706 relative = parse(serialize(relative, options), options);
707 }
708 options = options || {};
709 if (!options.tolerant && relative.scheme) {
710 target.scheme = relative.scheme;
711 target.userinfo = relative.userinfo;
712 target.host = relative.host;
713 target.port = relative.port;
714 target.path = removeDotSegments(relative.path || "");
715 target.query = relative.query;
716 } else {
717 if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
718 target.userinfo = relative.userinfo;
719 target.host = relative.host;
720 target.port = relative.port;
721 target.path = removeDotSegments(relative.path || "");
722 target.query = relative.query;
723 } else {
724 if (!relative.path) {
725 target.path = base2.path;
726 if (relative.query !== undefined) {
727 target.query = relative.query;
728 } else {
729 target.query = base2.query;
730 }
731 } else {
732 if (relative.path.charAt(0) === "/") {
733 target.path = removeDotSegments(relative.path);
734 } else {
735 if ((base2.userinfo !== undefined || base2.host !== undefined || base2.port !== undefined) && !base2.path) {
736 target.path = "/" + relative.path;
737 } else if (!base2.path) {
738 target.path = relative.path;
739 } else {
740 target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative.path;
741 }
742 target.path = removeDotSegments(target.path);
743 }
744 target.query = relative.query;
745 }
746 target.userinfo = base2.userinfo;
747 target.host = base2.host;
748 target.port = base2.port;
749 }
750 target.scheme = base2.scheme;
751 }
752 target.fragment = relative.fragment;
753 return target;
754 }
755 function resolve(baseURI, relativeURI, options) {
756 var schemelessOptions = assign({ scheme: "null" }, options);
757 return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
758 }
759 function normalize(uri, options) {
760 if (typeof uri === "string") {
761 uri = serialize(parse(uri, options), options);
762 } else if (typeOf(uri) === "object") {
763 uri = parse(serialize(uri, options), options);
764 }
765 return uri;
766 }
767 function equal(uriA, uriB, options) {
768 if (typeof uriA === "string") {
769 uriA = serialize(parse(uriA, options), options);
770 } else if (typeOf(uriA) === "object") {
771 uriA = serialize(uriA, options);
772 }
773 if (typeof uriB === "string") {
774 uriB = serialize(parse(uriB, options), options);
775 } else if (typeOf(uriB) === "object") {
776 uriB = serialize(uriB, options);
777 }
778 return uriA === uriB;
779 }
780 function escapeComponent(str, options) {
781 return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
782 }
783 function unescapeComponent(str, options) {
784 return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
785 }
786 var handler = {
787 scheme: "http",
788 domainHost: true,
789 parse: function parse(components, options) {
790 if (!components.host) {
791 components.error = components.error || "HTTP URIs must have a host.";
792 }
793 return components;
794 },
795 serialize: function serialize(components, options) {
796 var secure = String(components.scheme).toLowerCase() === "https";
797 if (components.port === (secure ? 443 : 80) || components.port === "") {
798 components.port = undefined;
799 }
800 if (!components.path) {
801 components.path = "/";
802 }
803 return components;
804 }
805 };
806 var handler$1 = {
807 scheme: "https",
808 domainHost: handler.domainHost,
809 parse: handler.parse,
810 serialize: handler.serialize
811 };
812 function isSecure(wsComponents) {
813 return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
814 }
815 var handler$2 = {
816 scheme: "ws",
817 domainHost: true,
818 parse: function parse(components, options) {
819 var wsComponents = components;
820 wsComponents.secure = isSecure(wsComponents);
821 wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
822 wsComponents.path = undefined;
823 wsComponents.query = undefined;
824 return wsComponents;
825 },
826 serialize: function serialize(wsComponents, options) {
827 if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
828 wsComponents.port = undefined;
829 }
830 if (typeof wsComponents.secure === "boolean") {
831 wsComponents.scheme = wsComponents.secure ? "wss" : "ws";
832 wsComponents.secure = undefined;
833 }
834 if (wsComponents.resourceName) {
835 var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
836 wsComponents.path = path && path !== "/" ? path : undefined;
837 wsComponents.query = query;
838 wsComponents.resourceName = undefined;
839 }
840 wsComponents.fragment = undefined;
841 return wsComponents;
842 }
843 };
844 var handler$3 = {
845 scheme: "wss",
846 domainHost: handler$2.domainHost,
847 parse: handler$2.parse,
848 serialize: handler$2.serialize
849 };
850 var O = {};
851 var isIRI = true;
852 var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
853 var HEXDIG$$ = "[0-9A-Fa-f]";
854 var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$));
855 var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
856 var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
857 var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
858 var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
859 var UNRESERVED = new RegExp(UNRESERVED$$, "g");
860 var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
861 var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\\"]", VCHAR$$), "g");
862 var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
863 var NOT_HFVALUE = NOT_HFNAME;
864 function decodeUnreserved(str) {
865 var decStr = pctDecChars(str);
866 return !decStr.match(UNRESERVED) ? str : decStr;
867 }
868 var handler$4 = {
869 scheme: "mailto",
870 parse: function parse$$1(components, options) {
871 var mailtoComponents = components;
872 var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
873 mailtoComponents.path = undefined;
874 if (mailtoComponents.query) {
875 var unknownHeaders = false;
876 var headers = {};
877 var hfields = mailtoComponents.query.split("&");
878 for (var x = 0, xl = hfields.length;x < xl; ++x) {
879 var hfield = hfields[x].split("=");
880 switch (hfield[0]) {
881 case "to":
882 var toAddrs = hfield[1].split(",");
883 for (var _x = 0, _xl = toAddrs.length;_x < _xl; ++_x) {
884 to.push(toAddrs[_x]);
885 }
886 break;
887 case "subject":
888 mailtoComponents.subject = unescapeComponent(hfield[1], options);
889 break;
890 case "body":
891 mailtoComponents.body = unescapeComponent(hfield[1], options);
892 break;
893 default:
894 unknownHeaders = true;
895 headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
896 break;
897 }
898 }
899 if (unknownHeaders)
900 mailtoComponents.headers = headers;
901 }
902 mailtoComponents.query = undefined;
903 for (var _x2 = 0, _xl2 = to.length;_x2 < _xl2; ++_x2) {
904 var addr = to[_x2].split("@");
905 addr[0] = unescapeComponent(addr[0]);
906 if (!options.unicodeSupport) {
907 try {
908 addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
909 } catch (e) {
910 mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
911 }
912 } else {
913 addr[1] = unescapeComponent(addr[1], options).toLowerCase();
914 }
915 to[_x2] = addr.join("@");
916 }
917 return mailtoComponents;
918 },
919 serialize: function serialize$$1(mailtoComponents, options) {
920 var components = mailtoComponents;
921 var to = toArray(mailtoComponents.to);
922 if (to) {
923 for (var x = 0, xl = to.length;x < xl; ++x) {
924 var toAddr = String(to[x]);
925 var atIdx = toAddr.lastIndexOf("@");
926 var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
927 var domain = toAddr.slice(atIdx + 1);
928 try {
929 domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
930 } catch (e) {
931 components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
932 }
933 to[x] = localPart + "@" + domain;
934 }
935 components.path = to.join(",");
936 }
937 var headers = mailtoComponents.headers = mailtoComponents.headers || {};
938 if (mailtoComponents.subject)
939 headers["subject"] = mailtoComponents.subject;
940 if (mailtoComponents.body)
941 headers["body"] = mailtoComponents.body;
942 var fields = [];
943 for (var name in headers) {
944 if (headers[name] !== O[name]) {
945 fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
946 }
947 }
948 if (fields.length) {
949 components.query = fields.join("&");
950 }
951 return components;
952 }
953 };
954 var URN_PARSE = /^([^\:]+)\:(.*)/;
955 var handler$5 = {
956 scheme: "urn",
957 parse: function parse$$1(components, options) {
958 var matches = components.path && components.path.match(URN_PARSE);
959 var urnComponents = components;
960 if (matches) {
961 var scheme = options.scheme || urnComponents.scheme || "urn";
962 var nid = matches[1].toLowerCase();
963 var nss = matches[2];
964 var urnScheme = scheme + ":" + (options.nid || nid);
965 var schemeHandler = SCHEMES[urnScheme];
966 urnComponents.nid = nid;
967 urnComponents.nss = nss;
968 urnComponents.path = undefined;
969 if (schemeHandler) {
970 urnComponents = schemeHandler.parse(urnComponents, options);
971 }
972 } else {
973 urnComponents.error = urnComponents.error || "URN can not be parsed.";
974 }
975 return urnComponents;
976 },
977 serialize: function serialize$$1(urnComponents, options) {
978 var scheme = options.scheme || urnComponents.scheme || "urn";
979 var nid = urnComponents.nid;
980 var urnScheme = scheme + ":" + (options.nid || nid);
981 var schemeHandler = SCHEMES[urnScheme];
982 if (schemeHandler) {
983 urnComponents = schemeHandler.serialize(urnComponents, options);
984 }
985 var uriComponents = urnComponents;
986 var nss = urnComponents.nss;
987 uriComponents.path = (nid || options.nid) + ":" + nss;
988 return uriComponents;
989 }
990 };
991 var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
992 var handler$6 = {
993 scheme: "urn:uuid",
994 parse: function parse(urnComponents, options) {
995 var uuidComponents = urnComponents;
996 uuidComponents.uuid = uuidComponents.nss;
997 uuidComponents.nss = undefined;
998 if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
999 uuidComponents.error = uuidComponents.error || "UUID is not valid.";
1000 }
1001 return uuidComponents;
1002 },
1003 serialize: function serialize(uuidComponents, options) {
1004 var urnComponents = uuidComponents;
1005 urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
1006 return urnComponents;
1007 }
1008 };
1009 SCHEMES[handler.scheme] = handler;
1010 SCHEMES[handler$1.scheme] = handler$1;
1011 SCHEMES[handler$2.scheme] = handler$2;
1012 SCHEMES[handler$3.scheme] = handler$3;
1013 SCHEMES[handler$4.scheme] = handler$4;
1014 SCHEMES[handler$5.scheme] = handler$5;
1015 SCHEMES[handler$6.scheme] = handler$6;
1016 exports2.SCHEMES = SCHEMES;
1017 exports2.pctEncChar = pctEncChar;
1018 exports2.pctDecChars = pctDecChars;
1019 exports2.parse = parse;
1020 exports2.removeDotSegments = removeDotSegments;
1021 exports2.serialize = serialize;
1022 exports2.resolveComponents = resolveComponents;
1023 exports2.resolve = resolve;
1024 exports2.normalize = normalize;
1025 exports2.equal = equal;
1026 exports2.escapeComponent = escapeComponent;
1027 exports2.unescapeComponent = unescapeComponent;
1028 Object.defineProperty(exports2, "__esModule", { value: true });
1029 });
1030});
1031
1032// node_modules/fast-deep-equal/index.js
1033var require_fast_deep_equal = __commonJS((exports, module) => {
1034 module.exports = function equal(a, b) {
1035 if (a === b)
1036 return true;
1037 if (a && b && typeof a == "object" && typeof b == "object") {
1038 if (a.constructor !== b.constructor)
1039 return false;
1040 var length, i, keys;
1041 if (Array.isArray(a)) {
1042 length = a.length;
1043 if (length != b.length)
1044 return false;
1045 for (i = length;i-- !== 0; )
1046 if (!equal(a[i], b[i]))
1047 return false;
1048 return true;
1049 }
1050 if (a.constructor === RegExp)
1051 return a.source === b.source && a.flags === b.flags;
1052 if (a.valueOf !== Object.prototype.valueOf)
1053 return a.valueOf() === b.valueOf();
1054 if (a.toString !== Object.prototype.toString)
1055 return a.toString() === b.toString();
1056 keys = Object.keys(a);
1057 length = keys.length;
1058 if (length !== Object.keys(b).length)
1059 return false;
1060 for (i = length;i-- !== 0; )
1061 if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
1062 return false;
1063 for (i = length;i-- !== 0; ) {
1064 var key = keys[i];
1065 if (!equal(a[key], b[key]))
1066 return false;
1067 }
1068 return true;
1069 }
1070 return a !== a && b !== b;
1071 };
1072});
1073
1074// node_modules/ajv/lib/compile/ucs2length.js
1075var require_ucs2length = __commonJS((exports, module) => {
1076 module.exports = function ucs2length(str) {
1077 var length = 0, len = str.length, pos = 0, value;
1078 while (pos < len) {
1079 length++;
1080 value = str.charCodeAt(pos++);
1081 if (value >= 55296 && value <= 56319 && pos < len) {
1082 value = str.charCodeAt(pos);
1083 if ((value & 64512) == 56320)
1084 pos++;
1085 }
1086 }
1087 return length;
1088 };
1089});
1090
1091// node_modules/ajv/lib/compile/util.js
1092var require_util = __commonJS((exports, module) => {
1093 module.exports = {
1094 copy,
1095 checkDataType,
1096 checkDataTypes,
1097 coerceToTypes,
1098 toHash,
1099 getProperty,
1100 escapeQuotes,
1101 equal: require_fast_deep_equal(),
1102 ucs2length: require_ucs2length(),
1103 varOccurences,
1104 varReplace,
1105 schemaHasRules,
1106 schemaHasRulesExcept,
1107 schemaUnknownRules,
1108 toQuotedString,
1109 getPathExpr,
1110 getPath,
1111 getData,
1112 unescapeFragment,
1113 unescapeJsonPointer,
1114 escapeFragment,
1115 escapeJsonPointer
1116 };
1117 function copy(o, to) {
1118 to = to || {};
1119 for (var key in o)
1120 to[key] = o[key];
1121 return to;
1122 }
1123 function checkDataType(dataType, data, strictNumbers, negate) {
1124 var EQUAL = negate ? " !== " : " === ", AND = negate ? " || " : " && ", OK2 = negate ? "!" : "", NOT = negate ? "" : "!";
1125 switch (dataType) {
1126 case "null":
1127 return data + EQUAL + "null";
1128 case "array":
1129 return OK2 + "Array.isArray(" + data + ")";
1130 case "object":
1131 return "(" + OK2 + data + AND + "typeof " + data + EQUAL + '"object"' + AND + NOT + "Array.isArray(" + data + "))";
1132 case "integer":
1133 return "(typeof " + data + EQUAL + '"number"' + AND + NOT + "(" + data + " % 1)" + AND + data + EQUAL + data + (strictNumbers ? AND + OK2 + "isFinite(" + data + ")" : "") + ")";
1134 case "number":
1135 return "(typeof " + data + EQUAL + '"' + dataType + '"' + (strictNumbers ? AND + OK2 + "isFinite(" + data + ")" : "") + ")";
1136 default:
1137 return "typeof " + data + EQUAL + '"' + dataType + '"';
1138 }
1139 }
1140 function checkDataTypes(dataTypes, data, strictNumbers) {
1141 switch (dataTypes.length) {
1142 case 1:
1143 return checkDataType(dataTypes[0], data, strictNumbers, true);
1144 default:
1145 var code = "";
1146 var types2 = toHash(dataTypes);
1147 if (types2.array && types2.object) {
1148 code = types2.null ? "(" : "(!" + data + " || ";
1149 code += "typeof " + data + ' !== "object")';
1150 delete types2.null;
1151 delete types2.array;
1152 delete types2.object;
1153 }
1154 if (types2.number)
1155 delete types2.integer;
1156 for (var t in types2)
1157 code += (code ? " && " : "") + checkDataType(t, data, strictNumbers, true);
1158 return code;
1159 }
1160 }
1161 var COERCE_TO_TYPES = toHash(["string", "number", "integer", "boolean", "null"]);
1162 function coerceToTypes(optionCoerceTypes, dataTypes) {
1163 if (Array.isArray(dataTypes)) {
1164 var types2 = [];
1165 for (var i = 0;i < dataTypes.length; i++) {
1166 var t = dataTypes[i];
1167 if (COERCE_TO_TYPES[t])
1168 types2[types2.length] = t;
1169 else if (optionCoerceTypes === "array" && t === "array")
1170 types2[types2.length] = t;
1171 }
1172 if (types2.length)
1173 return types2;
1174 } else if (COERCE_TO_TYPES[dataTypes]) {
1175 return [dataTypes];
1176 } else if (optionCoerceTypes === "array" && dataTypes === "array") {
1177 return ["array"];
1178 }
1179 }
1180 function toHash(arr) {
1181 var hash = {};
1182 for (var i = 0;i < arr.length; i++)
1183 hash[arr[i]] = true;
1184 return hash;
1185 }
1186 var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
1187 var SINGLE_QUOTE = /'|\\/g;
1188 function getProperty(key) {
1189 return typeof key == "number" ? "[" + key + "]" : IDENTIFIER.test(key) ? "." + key : "['" + escapeQuotes(key) + "']";
1190 }
1191 function escapeQuotes(str) {
1192 return str.replace(SINGLE_QUOTE, "\\$&").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\f/g, "\\f").replace(/\t/g, "\\t");
1193 }
1194 function varOccurences(str, dataVar) {
1195 dataVar += "[^0-9]";
1196 var matches = str.match(new RegExp(dataVar, "g"));
1197 return matches ? matches.length : 0;
1198 }
1199 function varReplace(str, dataVar, expr) {
1200 dataVar += "([^0-9])";
1201 expr = expr.replace(/\$/g, "$$$$");
1202 return str.replace(new RegExp(dataVar, "g"), expr + "$1");
1203 }
1204 function schemaHasRules(schema, rules) {
1205 if (typeof schema == "boolean")
1206 return !schema;
1207 for (var key in schema)
1208 if (rules[key])
1209 return true;
1210 }
1211 function schemaHasRulesExcept(schema, rules, exceptKeyword) {
1212 if (typeof schema == "boolean")
1213 return !schema && exceptKeyword != "not";
1214 for (var key in schema)
1215 if (key != exceptKeyword && rules[key])
1216 return true;
1217 }
1218 function schemaUnknownRules(schema, rules) {
1219 if (typeof schema == "boolean")
1220 return;
1221 for (var key in schema)
1222 if (!rules[key])
1223 return key;
1224 }
1225 function toQuotedString(str) {
1226 return "'" + escapeQuotes(str) + "'";
1227 }
1228 function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
1229 var path = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
1230 return joinPaths(currentPath, path);
1231 }
1232 function getPath(currentPath, prop, jsonPointers) {
1233 var path = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
1234 return joinPaths(currentPath, path);
1235 }
1236 var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
1237 var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
1238 function getData($data, lvl, paths) {
1239 var up, jsonPointer, data, matches;
1240 if ($data === "")
1241 return "rootData";
1242 if ($data[0] == "/") {
1243 if (!JSON_POINTER.test($data))
1244 throw new Error("Invalid JSON-pointer: " + $data);
1245 jsonPointer = $data;
1246 data = "rootData";
1247 } else {
1248 matches = $data.match(RELATIVE_JSON_POINTER);
1249 if (!matches)
1250 throw new Error("Invalid JSON-pointer: " + $data);
1251 up = +matches[1];
1252 jsonPointer = matches[2];
1253 if (jsonPointer == "#") {
1254 if (up >= lvl)
1255 throw new Error("Cannot access property/index " + up + " levels up, current level is " + lvl);
1256 return paths[lvl - up];
1257 }
1258 if (up > lvl)
1259 throw new Error("Cannot access data " + up + " levels up, current level is " + lvl);
1260 data = "data" + (lvl - up || "");
1261 if (!jsonPointer)
1262 return data;
1263 }
1264 var expr = data;
1265 var segments = jsonPointer.split("/");
1266 for (var i = 0;i < segments.length; i++) {
1267 var segment = segments[i];
1268 if (segment) {
1269 data += getProperty(unescapeJsonPointer(segment));
1270 expr += " && " + data;
1271 }
1272 }
1273 return expr;
1274 }
1275 function joinPaths(a, b) {
1276 if (a == '""')
1277 return b;
1278 return (a + " + " + b).replace(/([^\\])' \+ '/g, "$1");
1279 }
1280 function unescapeFragment(str) {
1281 return unescapeJsonPointer(decodeURIComponent(str));
1282 }
1283 function escapeFragment(str) {
1284 return encodeURIComponent(escapeJsonPointer(str));
1285 }
1286 function escapeJsonPointer(str) {
1287 return str.replace(/~/g, "~0").replace(/\//g, "~1");
1288 }
1289 function unescapeJsonPointer(str) {
1290 return str.replace(/~1/g, "/").replace(/~0/g, "~");
1291 }
1292});
1293
1294// node_modules/ajv/lib/compile/schema_obj.js
1295var require_schema_obj = __commonJS((exports, module) => {
1296 var util3 = require_util();
1297 module.exports = SchemaObject;
1298 function SchemaObject(obj) {
1299 util3.copy(obj, this);
1300 }
1301});
1302
1303// node_modules/json-schema-traverse/index.js
1304var require_json_schema_traverse = __commonJS((exports, module) => {
1305 var traverse = module.exports = function(schema, opts, cb) {
1306 if (typeof opts == "function") {
1307 cb = opts;
1308 opts = {};
1309 }
1310 cb = opts.cb || cb;
1311 var pre = typeof cb == "function" ? cb : cb.pre || function() {};
1312 var post = cb.post || function() {};
1313 _traverse(opts, pre, post, schema, "", schema);
1314 };
1315 traverse.keywords = {
1316 additionalItems: true,
1317 items: true,
1318 contains: true,
1319 additionalProperties: true,
1320 propertyNames: true,
1321 not: true
1322 };
1323 traverse.arrayKeywords = {
1324 items: true,
1325 allOf: true,
1326 anyOf: true,
1327 oneOf: true
1328 };
1329 traverse.propsKeywords = {
1330 definitions: true,
1331 properties: true,
1332 patternProperties: true,
1333 dependencies: true
1334 };
1335 traverse.skipKeywords = {
1336 default: true,
1337 enum: true,
1338 const: true,
1339 required: true,
1340 maximum: true,
1341 minimum: true,
1342 exclusiveMaximum: true,
1343 exclusiveMinimum: true,
1344 multipleOf: true,
1345 maxLength: true,
1346 minLength: true,
1347 pattern: true,
1348 format: true,
1349 maxItems: true,
1350 minItems: true,
1351 uniqueItems: true,
1352 maxProperties: true,
1353 minProperties: true
1354 };
1355 function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
1356 if (schema && typeof schema == "object" && !Array.isArray(schema)) {
1357 pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
1358 for (var key in schema) {
1359 var sch = schema[key];
1360 if (Array.isArray(sch)) {
1361 if (key in traverse.arrayKeywords) {
1362 for (var i = 0;i < sch.length; i++)
1363 _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i);
1364 }
1365 } else if (key in traverse.propsKeywords) {
1366 if (sch && typeof sch == "object") {
1367 for (var prop in sch)
1368 _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
1369 }
1370 } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
1371 _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
1372 }
1373 }
1374 post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
1375 }
1376 }
1377 function escapeJsonPtr(str) {
1378 return str.replace(/~/g, "~0").replace(/\//g, "~1");
1379 }
1380});
1381
1382// node_modules/ajv/lib/compile/resolve.js
1383var require_resolve = __commonJS((exports, module) => {
1384 var URI = require_uri_all();
1385 var equal = require_fast_deep_equal();
1386 var util3 = require_util();
1387 var SchemaObject = require_schema_obj();
1388 var traverse = require_json_schema_traverse();
1389 module.exports = resolve;
1390 resolve.normalizeId = normalizeId;
1391 resolve.fullPath = getFullPath;
1392 resolve.url = resolveUrl;
1393 resolve.ids = resolveIds;
1394 resolve.inlineRef = inlineRef;
1395 resolve.schema = resolveSchema;
1396 function resolve(compile, root, ref) {
1397 var refVal = this._refs[ref];
1398 if (typeof refVal == "string") {
1399 if (this._refs[refVal])
1400 refVal = this._refs[refVal];
1401 else
1402 return resolve.call(this, compile, root, refVal);
1403 }
1404 refVal = refVal || this._schemas[ref];
1405 if (refVal instanceof SchemaObject) {
1406 return inlineRef(refVal.schema, this._opts.inlineRefs) ? refVal.schema : refVal.validate || this._compile(refVal);
1407 }
1408 var res = resolveSchema.call(this, root, ref);
1409 var schema, v, baseId;
1410 if (res) {
1411 schema = res.schema;
1412 root = res.root;
1413 baseId = res.baseId;
1414 }
1415 if (schema instanceof SchemaObject) {
1416 v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
1417 } else if (schema !== undefined) {
1418 v = inlineRef(schema, this._opts.inlineRefs) ? schema : compile.call(this, schema, root, undefined, baseId);
1419 }
1420 return v;
1421 }
1422 function resolveSchema(root, ref) {
1423 var p = URI.parse(ref), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root.schema));
1424 if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
1425 var id = normalizeId(refPath);
1426 var refVal = this._refs[id];
1427 if (typeof refVal == "string") {
1428 return resolveRecursive.call(this, root, refVal, p);
1429 } else if (refVal instanceof SchemaObject) {
1430 if (!refVal.validate)
1431 this._compile(refVal);
1432 root = refVal;
1433 } else {
1434 refVal = this._schemas[id];
1435 if (refVal instanceof SchemaObject) {
1436 if (!refVal.validate)
1437 this._compile(refVal);
1438 if (id == normalizeId(ref))
1439 return { schema: refVal, root, baseId };
1440 root = refVal;
1441 } else {
1442 return;
1443 }
1444 }
1445 if (!root.schema)
1446 return;
1447 baseId = getFullPath(this._getId(root.schema));
1448 }
1449 return getJsonPointer.call(this, p, baseId, root.schema, root);
1450 }
1451 function resolveRecursive(root, ref, parsedRef) {
1452 var res = resolveSchema.call(this, root, ref);
1453 if (res) {
1454 var schema = res.schema;
1455 var baseId = res.baseId;
1456 root = res.root;
1457 var id = this._getId(schema);
1458 if (id)
1459 baseId = resolveUrl(baseId, id);
1460 return getJsonPointer.call(this, parsedRef, baseId, schema, root);
1461 }
1462 }
1463 var PREVENT_SCOPE_CHANGE = util3.toHash(["properties", "patternProperties", "enum", "dependencies", "definitions"]);
1464 function getJsonPointer(parsedRef, baseId, schema, root) {
1465 parsedRef.fragment = parsedRef.fragment || "";
1466 if (parsedRef.fragment.slice(0, 1) != "/")
1467 return;
1468 var parts = parsedRef.fragment.split("/");
1469 for (var i = 1;i < parts.length; i++) {
1470 var part = parts[i];
1471 if (part) {
1472 part = util3.unescapeFragment(part);
1473 schema = schema[part];
1474 if (schema === undefined)
1475 break;
1476 var id;
1477 if (!PREVENT_SCOPE_CHANGE[part]) {
1478 id = this._getId(schema);
1479 if (id)
1480 baseId = resolveUrl(baseId, id);
1481 if (schema.$ref) {
1482 var $ref = resolveUrl(baseId, schema.$ref);
1483 var res = resolveSchema.call(this, root, $ref);
1484 if (res) {
1485 schema = res.schema;
1486 root = res.root;
1487 baseId = res.baseId;
1488 }
1489 }
1490 }
1491 }
1492 }
1493 if (schema !== undefined && schema !== root.schema)
1494 return { schema, root, baseId };
1495 }
1496 var SIMPLE_INLINED = util3.toHash([
1497 "type",
1498 "format",
1499 "pattern",
1500 "maxLength",
1501 "minLength",
1502 "maxProperties",
1503 "minProperties",
1504 "maxItems",
1505 "minItems",
1506 "maximum",
1507 "minimum",
1508 "uniqueItems",
1509 "multipleOf",
1510 "required",
1511 "enum"
1512 ]);
1513 function inlineRef(schema, limit) {
1514 if (limit === false)
1515 return false;
1516 if (limit === undefined || limit === true)
1517 return checkNoRef(schema);
1518 else if (limit)
1519 return countKeys(schema) <= limit;
1520 }
1521 function checkNoRef(schema) {
1522 var item;
1523 if (Array.isArray(schema)) {
1524 for (var i = 0;i < schema.length; i++) {
1525 item = schema[i];
1526 if (typeof item == "object" && !checkNoRef(item))
1527 return false;
1528 }
1529 } else {
1530 for (var key in schema) {
1531 if (key == "$ref")
1532 return false;
1533 item = schema[key];
1534 if (typeof item == "object" && !checkNoRef(item))
1535 return false;
1536 }
1537 }
1538 return true;
1539 }
1540 function countKeys(schema) {
1541 var count = 0, item;
1542 if (Array.isArray(schema)) {
1543 for (var i = 0;i < schema.length; i++) {
1544 item = schema[i];
1545 if (typeof item == "object")
1546 count += countKeys(item);
1547 if (count == Infinity)
1548 return Infinity;
1549 }
1550 } else {
1551 for (var key in schema) {
1552 if (key == "$ref")
1553 return Infinity;
1554 if (SIMPLE_INLINED[key]) {
1555 count++;
1556 } else {
1557 item = schema[key];
1558 if (typeof item == "object")
1559 count += countKeys(item) + 1;
1560 if (count == Infinity)
1561 return Infinity;
1562 }
1563 }
1564 }
1565 return count;
1566 }
1567 function getFullPath(id, normalize) {
1568 if (normalize !== false)
1569 id = normalizeId(id);
1570 var p = URI.parse(id);
1571 return _getFullPath(p);
1572 }
1573 function _getFullPath(p) {
1574 return URI.serialize(p).split("#")[0] + "#";
1575 }
1576 var TRAILING_SLASH_HASH = /#\/?$/;
1577 function normalizeId(id) {
1578 return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
1579 }
1580 function resolveUrl(baseId, id) {
1581 id = normalizeId(id);
1582 return URI.resolve(baseId, id);
1583 }
1584 function resolveIds(schema) {
1585 var schemaId = normalizeId(this._getId(schema));
1586 var baseIds = { "": schemaId };
1587 var fullPaths = { "": getFullPath(schemaId, false) };
1588 var localRefs = {};
1589 var self = this;
1590 traverse(schema, { allKeys: true }, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
1591 if (jsonPtr === "")
1592 return;
1593 var id = self._getId(sch);
1594 var baseId = baseIds[parentJsonPtr];
1595 var fullPath = fullPaths[parentJsonPtr] + "/" + parentKeyword;
1596 if (keyIndex !== undefined)
1597 fullPath += "/" + (typeof keyIndex == "number" ? keyIndex : util3.escapeFragment(keyIndex));
1598 if (typeof id == "string") {
1599 id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
1600 var refVal = self._refs[id];
1601 if (typeof refVal == "string")
1602 refVal = self._refs[refVal];
1603 if (refVal && refVal.schema) {
1604 if (!equal(sch, refVal.schema))
1605 throw new Error('id "' + id + '" resolves to more than one schema');
1606 } else if (id != normalizeId(fullPath)) {
1607 if (id[0] == "#") {
1608 if (localRefs[id] && !equal(sch, localRefs[id]))
1609 throw new Error('id "' + id + '" resolves to more than one schema');
1610 localRefs[id] = sch;
1611 } else {
1612 self._refs[id] = fullPath;
1613 }
1614 }
1615 }
1616 baseIds[jsonPtr] = baseId;
1617 fullPaths[jsonPtr] = fullPath;
1618 });
1619 return localRefs;
1620 }
1621});
1622
1623// node_modules/ajv/lib/compile/error_classes.js
1624var require_error_classes = __commonJS((exports, module) => {
1625 var resolve = require_resolve();
1626 module.exports = {
1627 Validation: errorSubclass(ValidationError),
1628 MissingRef: errorSubclass(MissingRefError)
1629 };
1630 function ValidationError(errors2) {
1631 this.message = "validation failed";
1632 this.errors = errors2;
1633 this.ajv = this.validation = true;
1634 }
1635 MissingRefError.message = function(baseId, ref) {
1636 return "can't resolve reference " + ref + " from id " + baseId;
1637 };
1638 function MissingRefError(baseId, ref, message) {
1639 this.message = message || MissingRefError.message(baseId, ref);
1640 this.missingRef = resolve.url(baseId, ref);
1641 this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
1642 }
1643 function errorSubclass(Subclass) {
1644 Subclass.prototype = Object.create(Error.prototype);
1645 Subclass.prototype.constructor = Subclass;
1646 return Subclass;
1647 }
1648});
1649
1650// node_modules/fast-json-stable-stringify/index.js
1651var require_fast_json_stable_stringify = __commonJS((exports, module) => {
1652 module.exports = function(data, opts) {
1653 if (!opts)
1654 opts = {};
1655 if (typeof opts === "function")
1656 opts = { cmp: opts };
1657 var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
1658 var cmp = opts.cmp && function(f) {
1659 return function(node) {
1660 return function(a, b) {
1661 var aobj = { key: a, value: node[a] };
1662 var bobj = { key: b, value: node[b] };
1663 return f(aobj, bobj);
1664 };
1665 };
1666 }(opts.cmp);
1667 var seen = [];
1668 return function stringify(node) {
1669 if (node && node.toJSON && typeof node.toJSON === "function") {
1670 node = node.toJSON();
1671 }
1672 if (node === undefined)
1673 return;
1674 if (typeof node == "number")
1675 return isFinite(node) ? "" + node : "null";
1676 if (typeof node !== "object")
1677 return JSON.stringify(node);
1678 var i, out;
1679 if (Array.isArray(node)) {
1680 out = "[";
1681 for (i = 0;i < node.length; i++) {
1682 if (i)
1683 out += ",";
1684 out += stringify(node[i]) || "null";
1685 }
1686 return out + "]";
1687 }
1688 if (node === null)
1689 return "null";
1690 if (seen.indexOf(node) !== -1) {
1691 if (cycles)
1692 return JSON.stringify("__cycle__");
1693 throw new TypeError("Converting circular structure to JSON");
1694 }
1695 var seenIndex = seen.push(node) - 1;
1696 var keys = Object.keys(node).sort(cmp && cmp(node));
1697 out = "";
1698 for (i = 0;i < keys.length; i++) {
1699 var key = keys[i];
1700 var value = stringify(node[key]);
1701 if (!value)
1702 continue;
1703 if (out)
1704 out += ",";
1705 out += JSON.stringify(key) + ":" + value;
1706 }
1707 seen.splice(seenIndex, 1);
1708 return "{" + out + "}";
1709 }(data);
1710 };
1711});
1712
1713// node_modules/ajv/lib/dotjs/validate.js
1714var require_validate = __commonJS((exports, module) => {
1715 module.exports = function generate_validate(it, $keyword, $ruleType) {
1716 var out = "";
1717 var $async = it.schema.$async === true, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, "$ref"), $id = it.self._getId(it.schema);
1718 if (it.opts.strictKeywords) {
1719 var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
1720 if ($unknownKwd) {
1721 var $keywordsMsg = "unknown keyword: " + $unknownKwd;
1722 if (it.opts.strictKeywords === "log")
1723 it.logger.warn($keywordsMsg);
1724 else
1725 throw new Error($keywordsMsg);
1726 }
1727 }
1728 if (it.isTop) {
1729 out += " var validate = ";
1730 if ($async) {
1731 it.async = true;
1732 out += "async ";
1733 }
1734 out += "function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ";
1735 if ($id && (it.opts.sourceCode || it.opts.processCode)) {
1736 out += " " + ("/*# sourceURL=" + $id + " */") + " ";
1737 }
1738 }
1739 if (typeof it.schema == "boolean" || !($refKeywords || it.schema.$ref)) {
1740 var $keyword = "false schema";
1741 var $lvl = it.level;
1742 var $dataLvl = it.dataLevel;
1743 var $schema = it.schema[$keyword];
1744 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
1745 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
1746 var $breakOnError = !it.opts.allErrors;
1747 var $errorKeyword;
1748 var $data = "data" + ($dataLvl || "");
1749 var $valid = "valid" + $lvl;
1750 if (it.schema === false) {
1751 if (it.isTop) {
1752 $breakOnError = true;
1753 } else {
1754 out += " var " + $valid + " = false; ";
1755 }
1756 var $$outStack = $$outStack || [];
1757 $$outStack.push(out);
1758 out = "";
1759 if (it.createErrors !== false) {
1760 out += " { keyword: '" + ($errorKeyword || "false schema") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
1761 if (it.opts.messages !== false) {
1762 out += " , message: 'boolean schema is false' ";
1763 }
1764 if (it.opts.verbose) {
1765 out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
1766 }
1767 out += " } ";
1768 } else {
1769 out += " {} ";
1770 }
1771 var __err = out;
1772 out = $$outStack.pop();
1773 if (!it.compositeRule && $breakOnError) {
1774 if (it.async) {
1775 out += " throw new ValidationError([" + __err + "]); ";
1776 } else {
1777 out += " validate.errors = [" + __err + "]; return false; ";
1778 }
1779 } else {
1780 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
1781 }
1782 } else {
1783 if (it.isTop) {
1784 if ($async) {
1785 out += " return data; ";
1786 } else {
1787 out += " validate.errors = null; return true; ";
1788 }
1789 } else {
1790 out += " var " + $valid + " = true; ";
1791 }
1792 }
1793 if (it.isTop) {
1794 out += " }; return validate; ";
1795 }
1796 return out;
1797 }
1798 if (it.isTop) {
1799 var $top = it.isTop, $lvl = it.level = 0, $dataLvl = it.dataLevel = 0, $data = "data";
1800 it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
1801 it.baseId = it.baseId || it.rootId;
1802 delete it.isTop;
1803 it.dataPathArr = [""];
1804 if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
1805 var $defaultMsg = "default is ignored in the schema root";
1806 if (it.opts.strictDefaults === "log")
1807 it.logger.warn($defaultMsg);
1808 else
1809 throw new Error($defaultMsg);
1810 }
1811 out += " var vErrors = null; ";
1812 out += " var errors = 0; ";
1813 out += " if (rootData === undefined) rootData = data; ";
1814 } else {
1815 var { level: $lvl, dataLevel: $dataLvl } = it, $data = "data" + ($dataLvl || "");
1816 if ($id)
1817 it.baseId = it.resolve.url(it.baseId, $id);
1818 if ($async && !it.async)
1819 throw new Error("async schema in sync schema");
1820 out += " var errs_" + $lvl + " = errors;";
1821 }
1822 var $valid = "valid" + $lvl, $breakOnError = !it.opts.allErrors, $closingBraces1 = "", $closingBraces2 = "";
1823 var $errorKeyword;
1824 var $typeSchema = it.schema.type, $typeIsArray = Array.isArray($typeSchema);
1825 if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
1826 if ($typeIsArray) {
1827 if ($typeSchema.indexOf("null") == -1)
1828 $typeSchema = $typeSchema.concat("null");
1829 } else if ($typeSchema != "null") {
1830 $typeSchema = [$typeSchema, "null"];
1831 $typeIsArray = true;
1832 }
1833 }
1834 if ($typeIsArray && $typeSchema.length == 1) {
1835 $typeSchema = $typeSchema[0];
1836 $typeIsArray = false;
1837 }
1838 if (it.schema.$ref && $refKeywords) {
1839 if (it.opts.extendRefs == "fail") {
1840 throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');
1841 } else if (it.opts.extendRefs !== true) {
1842 $refKeywords = false;
1843 it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
1844 }
1845 }
1846 if (it.schema.$comment && it.opts.$comment) {
1847 out += " " + it.RULES.all.$comment.code(it, "$comment");
1848 }
1849 if ($typeSchema) {
1850 if (it.opts.coerceTypes) {
1851 var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
1852 }
1853 var $rulesGroup = it.RULES.types[$typeSchema];
1854 if ($coerceToTypes || $typeIsArray || $rulesGroup === true || $rulesGroup && !$shouldUseGroup($rulesGroup)) {
1855 var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type";
1856 var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type", $method = $typeIsArray ? "checkDataTypes" : "checkDataType";
1857 out += " if (" + it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) + ") { ";
1858 if ($coerceToTypes) {
1859 var $dataType = "dataType" + $lvl, $coerced = "coerced" + $lvl;
1860 out += " var " + $dataType + " = typeof " + $data + "; var " + $coerced + " = undefined; ";
1861 if (it.opts.coerceTypes == "array") {
1862 out += " if (" + $dataType + " == 'object' && Array.isArray(" + $data + ") && " + $data + ".length == 1) { " + $data + " = " + $data + "[0]; " + $dataType + " = typeof " + $data + "; if (" + it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers) + ") " + $coerced + " = " + $data + "; } ";
1863 }
1864 out += " if (" + $coerced + " !== undefined) ; ";
1865 var arr1 = $coerceToTypes;
1866 if (arr1) {
1867 var $type, $i = -1, l1 = arr1.length - 1;
1868 while ($i < l1) {
1869 $type = arr1[$i += 1];
1870 if ($type == "string") {
1871 out += " else if (" + $dataType + " == 'number' || " + $dataType + " == 'boolean') " + $coerced + " = '' + " + $data + "; else if (" + $data + " === null) " + $coerced + " = ''; ";
1872 } else if ($type == "number" || $type == "integer") {
1873 out += " else if (" + $dataType + " == 'boolean' || " + $data + " === null || (" + $dataType + " == 'string' && " + $data + " && " + $data + " == +" + $data + " ";
1874 if ($type == "integer") {
1875 out += " && !(" + $data + " % 1)";
1876 }
1877 out += ")) " + $coerced + " = +" + $data + "; ";
1878 } else if ($type == "boolean") {
1879 out += " else if (" + $data + " === 'false' || " + $data + " === 0 || " + $data + " === null) " + $coerced + " = false; else if (" + $data + " === 'true' || " + $data + " === 1) " + $coerced + " = true; ";
1880 } else if ($type == "null") {
1881 out += " else if (" + $data + " === '' || " + $data + " === 0 || " + $data + " === false) " + $coerced + " = null; ";
1882 } else if (it.opts.coerceTypes == "array" && $type == "array") {
1883 out += " else if (" + $dataType + " == 'string' || " + $dataType + " == 'number' || " + $dataType + " == 'boolean' || " + $data + " == null) " + $coerced + " = [" + $data + "]; ";
1884 }
1885 }
1886 }
1887 out += " else { ";
1888 var $$outStack = $$outStack || [];
1889 $$outStack.push(out);
1890 out = "";
1891 if (it.createErrors !== false) {
1892 out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '";
1893 if ($typeIsArray) {
1894 out += "" + $typeSchema.join(",");
1895 } else {
1896 out += "" + $typeSchema;
1897 }
1898 out += "' } ";
1899 if (it.opts.messages !== false) {
1900 out += " , message: 'should be ";
1901 if ($typeIsArray) {
1902 out += "" + $typeSchema.join(",");
1903 } else {
1904 out += "" + $typeSchema;
1905 }
1906 out += "' ";
1907 }
1908 if (it.opts.verbose) {
1909 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
1910 }
1911 out += " } ";
1912 } else {
1913 out += " {} ";
1914 }
1915 var __err = out;
1916 out = $$outStack.pop();
1917 if (!it.compositeRule && $breakOnError) {
1918 if (it.async) {
1919 out += " throw new ValidationError([" + __err + "]); ";
1920 } else {
1921 out += " validate.errors = [" + __err + "]; return false; ";
1922 }
1923 } else {
1924 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
1925 }
1926 out += " } if (" + $coerced + " !== undefined) { ";
1927 var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty";
1928 out += " " + $data + " = " + $coerced + "; ";
1929 if (!$dataLvl) {
1930 out += "if (" + $parentData + " !== undefined)";
1931 }
1932 out += " " + $parentData + "[" + $parentDataProperty + "] = " + $coerced + "; } ";
1933 } else {
1934 var $$outStack = $$outStack || [];
1935 $$outStack.push(out);
1936 out = "";
1937 if (it.createErrors !== false) {
1938 out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '";
1939 if ($typeIsArray) {
1940 out += "" + $typeSchema.join(",");
1941 } else {
1942 out += "" + $typeSchema;
1943 }
1944 out += "' } ";
1945 if (it.opts.messages !== false) {
1946 out += " , message: 'should be ";
1947 if ($typeIsArray) {
1948 out += "" + $typeSchema.join(",");
1949 } else {
1950 out += "" + $typeSchema;
1951 }
1952 out += "' ";
1953 }
1954 if (it.opts.verbose) {
1955 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
1956 }
1957 out += " } ";
1958 } else {
1959 out += " {} ";
1960 }
1961 var __err = out;
1962 out = $$outStack.pop();
1963 if (!it.compositeRule && $breakOnError) {
1964 if (it.async) {
1965 out += " throw new ValidationError([" + __err + "]); ";
1966 } else {
1967 out += " validate.errors = [" + __err + "]; return false; ";
1968 }
1969 } else {
1970 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
1971 }
1972 }
1973 out += " } ";
1974 }
1975 }
1976 if (it.schema.$ref && !$refKeywords) {
1977 out += " " + it.RULES.all.$ref.code(it, "$ref") + " ";
1978 if ($breakOnError) {
1979 out += " } if (errors === ";
1980 if ($top) {
1981 out += "0";
1982 } else {
1983 out += "errs_" + $lvl;
1984 }
1985 out += ") { ";
1986 $closingBraces2 += "}";
1987 }
1988 } else {
1989 var arr2 = it.RULES;
1990 if (arr2) {
1991 var $rulesGroup, i2 = -1, l2 = arr2.length - 1;
1992 while (i2 < l2) {
1993 $rulesGroup = arr2[i2 += 1];
1994 if ($shouldUseGroup($rulesGroup)) {
1995 if ($rulesGroup.type) {
1996 out += " if (" + it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) + ") { ";
1997 }
1998 if (it.opts.useDefaults) {
1999 if ($rulesGroup.type == "object" && it.schema.properties) {
2000 var $schema = it.schema.properties, $schemaKeys = Object.keys($schema);
2001 var arr3 = $schemaKeys;
2002 if (arr3) {
2003 var $propertyKey, i3 = -1, l3 = arr3.length - 1;
2004 while (i3 < l3) {
2005 $propertyKey = arr3[i3 += 1];
2006 var $sch = $schema[$propertyKey];
2007 if ($sch.default !== undefined) {
2008 var $passData = $data + it.util.getProperty($propertyKey);
2009 if (it.compositeRule) {
2010 if (it.opts.strictDefaults) {
2011 var $defaultMsg = "default is ignored for: " + $passData;
2012 if (it.opts.strictDefaults === "log")
2013 it.logger.warn($defaultMsg);
2014 else
2015 throw new Error($defaultMsg);
2016 }
2017 } else {
2018 out += " if (" + $passData + " === undefined ";
2019 if (it.opts.useDefaults == "empty") {
2020 out += " || " + $passData + " === null || " + $passData + " === '' ";
2021 }
2022 out += " ) " + $passData + " = ";
2023 if (it.opts.useDefaults == "shared") {
2024 out += " " + it.useDefault($sch.default) + " ";
2025 } else {
2026 out += " " + JSON.stringify($sch.default) + " ";
2027 }
2028 out += "; ";
2029 }
2030 }
2031 }
2032 }
2033 } else if ($rulesGroup.type == "array" && Array.isArray(it.schema.items)) {
2034 var arr4 = it.schema.items;
2035 if (arr4) {
2036 var $sch, $i = -1, l4 = arr4.length - 1;
2037 while ($i < l4) {
2038 $sch = arr4[$i += 1];
2039 if ($sch.default !== undefined) {
2040 var $passData = $data + "[" + $i + "]";
2041 if (it.compositeRule) {
2042 if (it.opts.strictDefaults) {
2043 var $defaultMsg = "default is ignored for: " + $passData;
2044 if (it.opts.strictDefaults === "log")
2045 it.logger.warn($defaultMsg);
2046 else
2047 throw new Error($defaultMsg);
2048 }
2049 } else {
2050 out += " if (" + $passData + " === undefined ";
2051 if (it.opts.useDefaults == "empty") {
2052 out += " || " + $passData + " === null || " + $passData + " === '' ";
2053 }
2054 out += " ) " + $passData + " = ";
2055 if (it.opts.useDefaults == "shared") {
2056 out += " " + it.useDefault($sch.default) + " ";
2057 } else {
2058 out += " " + JSON.stringify($sch.default) + " ";
2059 }
2060 out += "; ";
2061 }
2062 }
2063 }
2064 }
2065 }
2066 }
2067 var arr5 = $rulesGroup.rules;
2068 if (arr5) {
2069 var $rule, i5 = -1, l5 = arr5.length - 1;
2070 while (i5 < l5) {
2071 $rule = arr5[i5 += 1];
2072 if ($shouldUseRule($rule)) {
2073 var $code = $rule.code(it, $rule.keyword, $rulesGroup.type);
2074 if ($code) {
2075 out += " " + $code + " ";
2076 if ($breakOnError) {
2077 $closingBraces1 += "}";
2078 }
2079 }
2080 }
2081 }
2082 }
2083 if ($breakOnError) {
2084 out += " " + $closingBraces1 + " ";
2085 $closingBraces1 = "";
2086 }
2087 if ($rulesGroup.type) {
2088 out += " } ";
2089 if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) {
2090 out += " else { ";
2091 var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type";
2092 var $$outStack = $$outStack || [];
2093 $$outStack.push(out);
2094 out = "";
2095 if (it.createErrors !== false) {
2096 out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '";
2097 if ($typeIsArray) {
2098 out += "" + $typeSchema.join(",");
2099 } else {
2100 out += "" + $typeSchema;
2101 }
2102 out += "' } ";
2103 if (it.opts.messages !== false) {
2104 out += " , message: 'should be ";
2105 if ($typeIsArray) {
2106 out += "" + $typeSchema.join(",");
2107 } else {
2108 out += "" + $typeSchema;
2109 }
2110 out += "' ";
2111 }
2112 if (it.opts.verbose) {
2113 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
2114 }
2115 out += " } ";
2116 } else {
2117 out += " {} ";
2118 }
2119 var __err = out;
2120 out = $$outStack.pop();
2121 if (!it.compositeRule && $breakOnError) {
2122 if (it.async) {
2123 out += " throw new ValidationError([" + __err + "]); ";
2124 } else {
2125 out += " validate.errors = [" + __err + "]; return false; ";
2126 }
2127 } else {
2128 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
2129 }
2130 out += " } ";
2131 }
2132 }
2133 if ($breakOnError) {
2134 out += " if (errors === ";
2135 if ($top) {
2136 out += "0";
2137 } else {
2138 out += "errs_" + $lvl;
2139 }
2140 out += ") { ";
2141 $closingBraces2 += "}";
2142 }
2143 }
2144 }
2145 }
2146 }
2147 if ($breakOnError) {
2148 out += " " + $closingBraces2 + " ";
2149 }
2150 if ($top) {
2151 if ($async) {
2152 out += " if (errors === 0) return data; ";
2153 out += " else throw new ValidationError(vErrors); ";
2154 } else {
2155 out += " validate.errors = vErrors; ";
2156 out += " return errors === 0; ";
2157 }
2158 out += " }; return validate;";
2159 } else {
2160 out += " var " + $valid + " = errors === errs_" + $lvl + ";";
2161 }
2162 function $shouldUseGroup($rulesGroup2) {
2163 var rules = $rulesGroup2.rules;
2164 for (var i = 0;i < rules.length; i++)
2165 if ($shouldUseRule(rules[i]))
2166 return true;
2167 }
2168 function $shouldUseRule($rule2) {
2169 return it.schema[$rule2.keyword] !== undefined || $rule2.implements && $ruleImplementsSomeKeyword($rule2);
2170 }
2171 function $ruleImplementsSomeKeyword($rule2) {
2172 var impl = $rule2.implements;
2173 for (var i = 0;i < impl.length; i++)
2174 if (it.schema[impl[i]] !== undefined)
2175 return true;
2176 }
2177 return out;
2178 };
2179});
2180
2181// node_modules/ajv/lib/compile/index.js
2182var require_compile = __commonJS((exports, module) => {
2183 var resolve = require_resolve();
2184 var util3 = require_util();
2185 var errorClasses = require_error_classes();
2186 var stableStringify = require_fast_json_stable_stringify();
2187 var validateGenerator = require_validate();
2188 var ucs2length = util3.ucs2length;
2189 var equal = require_fast_deep_equal();
2190 var ValidationError = errorClasses.Validation;
2191 module.exports = compile;
2192 function compile(schema, root, localRefs, baseId) {
2193 var self = this, opts = this._opts, refVal = [undefined], refs = {}, patterns = [], patternsHash = {}, defaults = [], defaultsHash = {}, customRules = [];
2194 root = root || { schema, refVal, refs };
2195 var c = checkCompiling.call(this, schema, root, baseId);
2196 var compilation = this._compilations[c.index];
2197 if (c.compiling)
2198 return compilation.callValidate = callValidate;
2199 var formats = this._formats;
2200 var RULES = this.RULES;
2201 try {
2202 var v = localCompile(schema, root, localRefs, baseId);
2203 compilation.validate = v;
2204 var cv = compilation.callValidate;
2205 if (cv) {
2206 cv.schema = v.schema;
2207 cv.errors = null;
2208 cv.refs = v.refs;
2209 cv.refVal = v.refVal;
2210 cv.root = v.root;
2211 cv.$async = v.$async;
2212 if (opts.sourceCode)
2213 cv.source = v.source;
2214 }
2215 return v;
2216 } finally {
2217 endCompiling.call(this, schema, root, baseId);
2218 }
2219 function callValidate() {
2220 var validate = compilation.validate;
2221 var result = validate.apply(this, arguments);
2222 callValidate.errors = validate.errors;
2223 return result;
2224 }
2225 function localCompile(_schema, _root, localRefs2, baseId2) {
2226 var isRoot = !_root || _root && _root.schema == _schema;
2227 if (_root.schema != root.schema)
2228 return compile.call(self, _schema, _root, localRefs2, baseId2);
2229 var $async = _schema.$async === true;
2230 var sourceCode = validateGenerator({
2231 isTop: true,
2232 schema: _schema,
2233 isRoot,
2234 baseId: baseId2,
2235 root: _root,
2236 schemaPath: "",
2237 errSchemaPath: "#",
2238 errorPath: '""',
2239 MissingRefError: errorClasses.MissingRef,
2240 RULES,
2241 validate: validateGenerator,
2242 util: util3,
2243 resolve,
2244 resolveRef,
2245 usePattern,
2246 useDefault,
2247 useCustomRule,
2248 opts,
2249 formats,
2250 logger: self.logger,
2251 self
2252 });
2253 sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + vars(defaults, defaultCode) + vars(customRules, customRuleCode) + sourceCode;
2254 if (opts.processCode)
2255 sourceCode = opts.processCode(sourceCode, _schema);
2256 var validate;
2257 try {
2258 var makeValidate = new Function("self", "RULES", "formats", "root", "refVal", "defaults", "customRules", "equal", "ucs2length", "ValidationError", sourceCode);
2259 validate = makeValidate(self, RULES, formats, root, refVal, defaults, customRules, equal, ucs2length, ValidationError);
2260 refVal[0] = validate;
2261 } catch (e) {
2262 self.logger.error("Error compiling schema, function code:", sourceCode);
2263 throw e;
2264 }
2265 validate.schema = _schema;
2266 validate.errors = null;
2267 validate.refs = refs;
2268 validate.refVal = refVal;
2269 validate.root = isRoot ? validate : _root;
2270 if ($async)
2271 validate.$async = true;
2272 if (opts.sourceCode === true) {
2273 validate.source = {
2274 code: sourceCode,
2275 patterns,
2276 defaults
2277 };
2278 }
2279 return validate;
2280 }
2281 function resolveRef(baseId2, ref, isRoot) {
2282 ref = resolve.url(baseId2, ref);
2283 var refIndex = refs[ref];
2284 var _refVal, refCode;
2285 if (refIndex !== undefined) {
2286 _refVal = refVal[refIndex];
2287 refCode = "refVal[" + refIndex + "]";
2288 return resolvedRef(_refVal, refCode);
2289 }
2290 if (!isRoot && root.refs) {
2291 var rootRefId = root.refs[ref];
2292 if (rootRefId !== undefined) {
2293 _refVal = root.refVal[rootRefId];
2294 refCode = addLocalRef(ref, _refVal);
2295 return resolvedRef(_refVal, refCode);
2296 }
2297 }
2298 refCode = addLocalRef(ref);
2299 var v2 = resolve.call(self, localCompile, root, ref);
2300 if (v2 === undefined) {
2301 var localSchema = localRefs && localRefs[ref];
2302 if (localSchema) {
2303 v2 = resolve.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self, localSchema, root, localRefs, baseId2);
2304 }
2305 }
2306 if (v2 === undefined) {
2307 removeLocalRef(ref);
2308 } else {
2309 replaceLocalRef(ref, v2);
2310 return resolvedRef(v2, refCode);
2311 }
2312 }
2313 function addLocalRef(ref, v2) {
2314 var refId = refVal.length;
2315 refVal[refId] = v2;
2316 refs[ref] = refId;
2317 return "refVal" + refId;
2318 }
2319 function removeLocalRef(ref) {
2320 delete refs[ref];
2321 }
2322 function replaceLocalRef(ref, v2) {
2323 var refId = refs[ref];
2324 refVal[refId] = v2;
2325 }
2326 function resolvedRef(refVal2, code) {
2327 return typeof refVal2 == "object" || typeof refVal2 == "boolean" ? { code, schema: refVal2, inline: true } : { code, $async: refVal2 && !!refVal2.$async };
2328 }
2329 function usePattern(regexStr) {
2330 var index = patternsHash[regexStr];
2331 if (index === undefined) {
2332 index = patternsHash[regexStr] = patterns.length;
2333 patterns[index] = regexStr;
2334 }
2335 return "pattern" + index;
2336 }
2337 function useDefault(value) {
2338 switch (typeof value) {
2339 case "boolean":
2340 case "number":
2341 return "" + value;
2342 case "string":
2343 return util3.toQuotedString(value);
2344 case "object":
2345 if (value === null)
2346 return "null";
2347 var valueStr = stableStringify(value);
2348 var index = defaultsHash[valueStr];
2349 if (index === undefined) {
2350 index = defaultsHash[valueStr] = defaults.length;
2351 defaults[index] = value;
2352 }
2353 return "default" + index;
2354 }
2355 }
2356 function useCustomRule(rule, schema2, parentSchema, it) {
2357 if (self._opts.validateSchema !== false) {
2358 var deps = rule.definition.dependencies;
2359 if (deps && !deps.every(function(keyword) {
2360 return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
2361 }))
2362 throw new Error("parent schema must have all required keywords: " + deps.join(","));
2363 var validateSchema = rule.definition.validateSchema;
2364 if (validateSchema) {
2365 var valid = validateSchema(schema2);
2366 if (!valid) {
2367 var message = "keyword schema is invalid: " + self.errorsText(validateSchema.errors);
2368 if (self._opts.validateSchema == "log")
2369 self.logger.error(message);
2370 else
2371 throw new Error(message);
2372 }
2373 }
2374 }
2375 var compile2 = rule.definition.compile, inline = rule.definition.inline, macro = rule.definition.macro;
2376 var validate;
2377 if (compile2) {
2378 validate = compile2.call(self, schema2, parentSchema, it);
2379 } else if (macro) {
2380 validate = macro.call(self, schema2, parentSchema, it);
2381 if (opts.validateSchema !== false)
2382 self.validateSchema(validate, true);
2383 } else if (inline) {
2384 validate = inline.call(self, it, rule.keyword, schema2, parentSchema);
2385 } else {
2386 validate = rule.definition.validate;
2387 if (!validate)
2388 return;
2389 }
2390 if (validate === undefined)
2391 throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
2392 var index = customRules.length;
2393 customRules[index] = validate;
2394 return {
2395 code: "customRule" + index,
2396 validate
2397 };
2398 }
2399 }
2400 function checkCompiling(schema, root, baseId) {
2401 var index = compIndex.call(this, schema, root, baseId);
2402 if (index >= 0)
2403 return { index, compiling: true };
2404 index = this._compilations.length;
2405 this._compilations[index] = {
2406 schema,
2407 root,
2408 baseId
2409 };
2410 return { index, compiling: false };
2411 }
2412 function endCompiling(schema, root, baseId) {
2413 var i = compIndex.call(this, schema, root, baseId);
2414 if (i >= 0)
2415 this._compilations.splice(i, 1);
2416 }
2417 function compIndex(schema, root, baseId) {
2418 for (var i = 0;i < this._compilations.length; i++) {
2419 var c = this._compilations[i];
2420 if (c.schema == schema && c.root == root && c.baseId == baseId)
2421 return i;
2422 }
2423 return -1;
2424 }
2425 function patternCode(i, patterns) {
2426 return "var pattern" + i + " = new RegExp(" + util3.toQuotedString(patterns[i]) + ");";
2427 }
2428 function defaultCode(i) {
2429 return "var default" + i + " = defaults[" + i + "];";
2430 }
2431 function refValCode(i, refVal) {
2432 return refVal[i] === undefined ? "" : "var refVal" + i + " = refVal[" + i + "];";
2433 }
2434 function customRuleCode(i) {
2435 return "var customRule" + i + " = customRules[" + i + "];";
2436 }
2437 function vars(arr, statement) {
2438 if (!arr.length)
2439 return "";
2440 var code = "";
2441 for (var i = 0;i < arr.length; i++)
2442 code += statement(i, arr);
2443 return code;
2444 }
2445});
2446
2447// node_modules/ajv/lib/cache.js
2448var require_cache = __commonJS((exports, module) => {
2449 var Cache = module.exports = function Cache() {
2450 this._cache = {};
2451 };
2452 Cache.prototype.put = function Cache_put(key, value) {
2453 this._cache[key] = value;
2454 };
2455 Cache.prototype.get = function Cache_get(key) {
2456 return this._cache[key];
2457 };
2458 Cache.prototype.del = function Cache_del(key) {
2459 delete this._cache[key];
2460 };
2461 Cache.prototype.clear = function Cache_clear() {
2462 this._cache = {};
2463 };
2464});
2465
2466// node_modules/ajv/lib/compile/formats.js
2467var require_formats = __commonJS((exports, module) => {
2468 var util3 = require_util();
2469 var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
2470 var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2471 var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
2472 var 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;
2473 var URI = /^(?:[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;
2474 var URIREF = /^(?:[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;
2475 var URITEMPLATE = /^(?:(?:[^\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;
2476 var URL2 = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
2477 var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
2478 var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
2479 var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
2480 var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
2481 module.exports = formats;
2482 function formats(mode) {
2483 mode = mode == "full" ? "full" : "fast";
2484 return util3.copy(formats[mode]);
2485 }
2486 formats.fast = {
2487 date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
2488 time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
2489 "date-time": /^\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,
2490 uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
2491 "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
2492 "uri-template": URITEMPLATE,
2493 url: URL2,
2494 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,
2495 hostname: HOSTNAME,
2496 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
2497 ipv6: /^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,
2498 regex,
2499 uuid: UUID,
2500 "json-pointer": JSON_POINTER,
2501 "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT,
2502 "relative-json-pointer": RELATIVE_JSON_POINTER
2503 };
2504 formats.full = {
2505 date,
2506 time,
2507 "date-time": date_time,
2508 uri,
2509 "uri-reference": URIREF,
2510 "uri-template": URITEMPLATE,
2511 url: URL2,
2512 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,
2513 hostname: HOSTNAME,
2514 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
2515 ipv6: /^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,
2516 regex,
2517 uuid: UUID,
2518 "json-pointer": JSON_POINTER,
2519 "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT,
2520 "relative-json-pointer": RELATIVE_JSON_POINTER
2521 };
2522 function isLeapYear(year) {
2523 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
2524 }
2525 function date(str) {
2526 var matches = str.match(DATE);
2527 if (!matches)
2528 return false;
2529 var year = +matches[1];
2530 var month = +matches[2];
2531 var day = +matches[3];
2532 return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
2533 }
2534 function time(str, full) {
2535 var matches = str.match(TIME);
2536 if (!matches)
2537 return false;
2538 var hour = matches[1];
2539 var minute = matches[2];
2540 var second = matches[3];
2541 var timeZone = matches[5];
2542 return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
2543 }
2544 var DATE_TIME_SEPARATOR = /t|\s/i;
2545 function date_time(str) {
2546 var dateTime = str.split(DATE_TIME_SEPARATOR);
2547 return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
2548 }
2549 var NOT_URI_FRAGMENT = /\/|:/;
2550 function uri(str) {
2551 return NOT_URI_FRAGMENT.test(str) && URI.test(str);
2552 }
2553 var Z_ANCHOR = /[^\\]\\Z/;
2554 function regex(str) {
2555 if (Z_ANCHOR.test(str))
2556 return false;
2557 try {
2558 new RegExp(str);
2559 return true;
2560 } catch (e) {
2561 return false;
2562 }
2563 }
2564});
2565
2566// node_modules/ajv/lib/dotjs/ref.js
2567var require_ref = __commonJS((exports, module) => {
2568 module.exports = function generate_ref(it, $keyword, $ruleType) {
2569 var out = " ";
2570 var $lvl = it.level;
2571 var $dataLvl = it.dataLevel;
2572 var $schema = it.schema[$keyword];
2573 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2574 var $breakOnError = !it.opts.allErrors;
2575 var $data = "data" + ($dataLvl || "");
2576 var $valid = "valid" + $lvl;
2577 var $async, $refCode;
2578 if ($schema == "#" || $schema == "#/") {
2579 if (it.isRoot) {
2580 $async = it.async;
2581 $refCode = "validate";
2582 } else {
2583 $async = it.root.schema.$async === true;
2584 $refCode = "root.refVal[0]";
2585 }
2586 } else {
2587 var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
2588 if ($refVal === undefined) {
2589 var $message = it.MissingRefError.message(it.baseId, $schema);
2590 if (it.opts.missingRefs == "fail") {
2591 it.logger.error($message);
2592 var $$outStack = $$outStack || [];
2593 $$outStack.push(out);
2594 out = "";
2595 if (it.createErrors !== false) {
2596 out += " { keyword: '" + "$ref" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { ref: '" + it.util.escapeQuotes($schema) + "' } ";
2597 if (it.opts.messages !== false) {
2598 out += " , message: 'can\\'t resolve reference " + it.util.escapeQuotes($schema) + "' ";
2599 }
2600 if (it.opts.verbose) {
2601 out += " , schema: " + it.util.toQuotedString($schema) + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
2602 }
2603 out += " } ";
2604 } else {
2605 out += " {} ";
2606 }
2607 var __err = out;
2608 out = $$outStack.pop();
2609 if (!it.compositeRule && $breakOnError) {
2610 if (it.async) {
2611 out += " throw new ValidationError([" + __err + "]); ";
2612 } else {
2613 out += " validate.errors = [" + __err + "]; return false; ";
2614 }
2615 } else {
2616 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
2617 }
2618 if ($breakOnError) {
2619 out += " if (false) { ";
2620 }
2621 } else if (it.opts.missingRefs == "ignore") {
2622 it.logger.warn($message);
2623 if ($breakOnError) {
2624 out += " if (true) { ";
2625 }
2626 } else {
2627 throw new it.MissingRefError(it.baseId, $schema, $message);
2628 }
2629 } else if ($refVal.inline) {
2630 var $it = it.util.copy(it);
2631 $it.level++;
2632 var $nextValid = "valid" + $it.level;
2633 $it.schema = $refVal.schema;
2634 $it.schemaPath = "";
2635 $it.errSchemaPath = $schema;
2636 var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
2637 out += " " + $code + " ";
2638 if ($breakOnError) {
2639 out += " if (" + $nextValid + ") { ";
2640 }
2641 } else {
2642 $async = $refVal.$async === true || it.async && $refVal.$async !== false;
2643 $refCode = $refVal.code;
2644 }
2645 }
2646 if ($refCode) {
2647 var $$outStack = $$outStack || [];
2648 $$outStack.push(out);
2649 out = "";
2650 if (it.opts.passContext) {
2651 out += " " + $refCode + ".call(this, ";
2652 } else {
2653 out += " " + $refCode + "( ";
2654 }
2655 out += " " + $data + ", (dataPath || '')";
2656 if (it.errorPath != '""') {
2657 out += " + " + it.errorPath;
2658 }
2659 var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty";
2660 out += " , " + $parentData + " , " + $parentDataProperty + ", rootData) ";
2661 var __callValidate = out;
2662 out = $$outStack.pop();
2663 if ($async) {
2664 if (!it.async)
2665 throw new Error("async schema referenced by sync schema");
2666 if ($breakOnError) {
2667 out += " var " + $valid + "; ";
2668 }
2669 out += " try { await " + __callValidate + "; ";
2670 if ($breakOnError) {
2671 out += " " + $valid + " = true; ";
2672 }
2673 out += " } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ";
2674 if ($breakOnError) {
2675 out += " " + $valid + " = false; ";
2676 }
2677 out += " } ";
2678 if ($breakOnError) {
2679 out += " if (" + $valid + ") { ";
2680 }
2681 } else {
2682 out += " if (!" + __callValidate + ") { if (vErrors === null) vErrors = " + $refCode + ".errors; else vErrors = vErrors.concat(" + $refCode + ".errors); errors = vErrors.length; } ";
2683 if ($breakOnError) {
2684 out += " else { ";
2685 }
2686 }
2687 }
2688 return out;
2689 };
2690});
2691
2692// node_modules/ajv/lib/dotjs/allOf.js
2693var require_allOf = __commonJS((exports, module) => {
2694 module.exports = function generate_allOf(it, $keyword, $ruleType) {
2695 var out = " ";
2696 var $schema = it.schema[$keyword];
2697 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
2698 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2699 var $breakOnError = !it.opts.allErrors;
2700 var $it = it.util.copy(it);
2701 var $closingBraces = "";
2702 $it.level++;
2703 var $nextValid = "valid" + $it.level;
2704 var $currentBaseId = $it.baseId, $allSchemasEmpty = true;
2705 var arr1 = $schema;
2706 if (arr1) {
2707 var $sch, $i = -1, l1 = arr1.length - 1;
2708 while ($i < l1) {
2709 $sch = arr1[$i += 1];
2710 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
2711 $allSchemasEmpty = false;
2712 $it.schema = $sch;
2713 $it.schemaPath = $schemaPath + "[" + $i + "]";
2714 $it.errSchemaPath = $errSchemaPath + "/" + $i;
2715 out += " " + it.validate($it) + " ";
2716 $it.baseId = $currentBaseId;
2717 if ($breakOnError) {
2718 out += " if (" + $nextValid + ") { ";
2719 $closingBraces += "}";
2720 }
2721 }
2722 }
2723 }
2724 if ($breakOnError) {
2725 if ($allSchemasEmpty) {
2726 out += " if (true) { ";
2727 } else {
2728 out += " " + $closingBraces.slice(0, -1) + " ";
2729 }
2730 }
2731 return out;
2732 };
2733});
2734
2735// node_modules/ajv/lib/dotjs/anyOf.js
2736var require_anyOf = __commonJS((exports, module) => {
2737 module.exports = function generate_anyOf(it, $keyword, $ruleType) {
2738 var out = " ";
2739 var $lvl = it.level;
2740 var $dataLvl = it.dataLevel;
2741 var $schema = it.schema[$keyword];
2742 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
2743 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2744 var $breakOnError = !it.opts.allErrors;
2745 var $data = "data" + ($dataLvl || "");
2746 var $valid = "valid" + $lvl;
2747 var $errs = "errs__" + $lvl;
2748 var $it = it.util.copy(it);
2749 var $closingBraces = "";
2750 $it.level++;
2751 var $nextValid = "valid" + $it.level;
2752 var $noEmptySchema = $schema.every(function($sch2) {
2753 return it.opts.strictKeywords ? typeof $sch2 == "object" && Object.keys($sch2).length > 0 || $sch2 === false : it.util.schemaHasRules($sch2, it.RULES.all);
2754 });
2755 if ($noEmptySchema) {
2756 var $currentBaseId = $it.baseId;
2757 out += " var " + $errs + " = errors; var " + $valid + " = false; ";
2758 var $wasComposite = it.compositeRule;
2759 it.compositeRule = $it.compositeRule = true;
2760 var arr1 = $schema;
2761 if (arr1) {
2762 var $sch, $i = -1, l1 = arr1.length - 1;
2763 while ($i < l1) {
2764 $sch = arr1[$i += 1];
2765 $it.schema = $sch;
2766 $it.schemaPath = $schemaPath + "[" + $i + "]";
2767 $it.errSchemaPath = $errSchemaPath + "/" + $i;
2768 out += " " + it.validate($it) + " ";
2769 $it.baseId = $currentBaseId;
2770 out += " " + $valid + " = " + $valid + " || " + $nextValid + "; if (!" + $valid + ") { ";
2771 $closingBraces += "}";
2772 }
2773 }
2774 it.compositeRule = $it.compositeRule = $wasComposite;
2775 out += " " + $closingBraces + " if (!" + $valid + ") { var err = ";
2776 if (it.createErrors !== false) {
2777 out += " { keyword: '" + "anyOf" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
2778 if (it.opts.messages !== false) {
2779 out += " , message: 'should match some schema in anyOf' ";
2780 }
2781 if (it.opts.verbose) {
2782 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
2783 }
2784 out += " } ";
2785 } else {
2786 out += " {} ";
2787 }
2788 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
2789 if (!it.compositeRule && $breakOnError) {
2790 if (it.async) {
2791 out += " throw new ValidationError(vErrors); ";
2792 } else {
2793 out += " validate.errors = vErrors; return false; ";
2794 }
2795 }
2796 out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } ";
2797 if (it.opts.allErrors) {
2798 out += " } ";
2799 }
2800 } else {
2801 if ($breakOnError) {
2802 out += " if (true) { ";
2803 }
2804 }
2805 return out;
2806 };
2807});
2808
2809// node_modules/ajv/lib/dotjs/comment.js
2810var require_comment = __commonJS((exports, module) => {
2811 module.exports = function generate_comment(it, $keyword, $ruleType) {
2812 var out = " ";
2813 var $schema = it.schema[$keyword];
2814 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2815 var $breakOnError = !it.opts.allErrors;
2816 var $comment = it.util.toQuotedString($schema);
2817 if (it.opts.$comment === true) {
2818 out += " console.log(" + $comment + ");";
2819 } else if (typeof it.opts.$comment == "function") {
2820 out += " self._opts.$comment(" + $comment + ", " + it.util.toQuotedString($errSchemaPath) + ", validate.root.schema);";
2821 }
2822 return out;
2823 };
2824});
2825
2826// node_modules/ajv/lib/dotjs/const.js
2827var require_const = __commonJS((exports, module) => {
2828 module.exports = function generate_const(it, $keyword, $ruleType) {
2829 var out = " ";
2830 var $lvl = it.level;
2831 var $dataLvl = it.dataLevel;
2832 var $schema = it.schema[$keyword];
2833 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
2834 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2835 var $breakOnError = !it.opts.allErrors;
2836 var $data = "data" + ($dataLvl || "");
2837 var $valid = "valid" + $lvl;
2838 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
2839 if ($isData) {
2840 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
2841 $schemaValue = "schema" + $lvl;
2842 } else {
2843 $schemaValue = $schema;
2844 }
2845 if (!$isData) {
2846 out += " var schema" + $lvl + " = validate.schema" + $schemaPath + ";";
2847 }
2848 out += "var " + $valid + " = equal(" + $data + ", schema" + $lvl + "); if (!" + $valid + ") { ";
2849 var $$outStack = $$outStack || [];
2850 $$outStack.push(out);
2851 out = "";
2852 if (it.createErrors !== false) {
2853 out += " { keyword: '" + "const" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValue: schema" + $lvl + " } ";
2854 if (it.opts.messages !== false) {
2855 out += " , message: 'should be equal to constant' ";
2856 }
2857 if (it.opts.verbose) {
2858 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
2859 }
2860 out += " } ";
2861 } else {
2862 out += " {} ";
2863 }
2864 var __err = out;
2865 out = $$outStack.pop();
2866 if (!it.compositeRule && $breakOnError) {
2867 if (it.async) {
2868 out += " throw new ValidationError([" + __err + "]); ";
2869 } else {
2870 out += " validate.errors = [" + __err + "]; return false; ";
2871 }
2872 } else {
2873 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
2874 }
2875 out += " }";
2876 if ($breakOnError) {
2877 out += " else { ";
2878 }
2879 return out;
2880 };
2881});
2882
2883// node_modules/ajv/lib/dotjs/contains.js
2884var require_contains = __commonJS((exports, module) => {
2885 module.exports = function generate_contains(it, $keyword, $ruleType) {
2886 var out = " ";
2887 var $lvl = it.level;
2888 var $dataLvl = it.dataLevel;
2889 var $schema = it.schema[$keyword];
2890 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
2891 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2892 var $breakOnError = !it.opts.allErrors;
2893 var $data = "data" + ($dataLvl || "");
2894 var $valid = "valid" + $lvl;
2895 var $errs = "errs__" + $lvl;
2896 var $it = it.util.copy(it);
2897 var $closingBraces = "";
2898 $it.level++;
2899 var $nextValid = "valid" + $it.level;
2900 var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId, $nonEmptySchema = it.opts.strictKeywords ? typeof $schema == "object" && Object.keys($schema).length > 0 || $schema === false : it.util.schemaHasRules($schema, it.RULES.all);
2901 out += "var " + $errs + " = errors;var " + $valid + ";";
2902 if ($nonEmptySchema) {
2903 var $wasComposite = it.compositeRule;
2904 it.compositeRule = $it.compositeRule = true;
2905 $it.schema = $schema;
2906 $it.schemaPath = $schemaPath;
2907 $it.errSchemaPath = $errSchemaPath;
2908 out += " var " + $nextValid + " = false; for (var " + $idx + " = 0; " + $idx + " < " + $data + ".length; " + $idx + "++) { ";
2909 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
2910 var $passData = $data + "[" + $idx + "]";
2911 $it.dataPathArr[$dataNxt] = $idx;
2912 var $code = it.validate($it);
2913 $it.baseId = $currentBaseId;
2914 if (it.util.varOccurences($code, $nextData) < 2) {
2915 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
2916 } else {
2917 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
2918 }
2919 out += " if (" + $nextValid + ") break; } ";
2920 it.compositeRule = $it.compositeRule = $wasComposite;
2921 out += " " + $closingBraces + " if (!" + $nextValid + ") {";
2922 } else {
2923 out += " if (" + $data + ".length == 0) {";
2924 }
2925 var $$outStack = $$outStack || [];
2926 $$outStack.push(out);
2927 out = "";
2928 if (it.createErrors !== false) {
2929 out += " { keyword: '" + "contains" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
2930 if (it.opts.messages !== false) {
2931 out += " , message: 'should contain a valid item' ";
2932 }
2933 if (it.opts.verbose) {
2934 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
2935 }
2936 out += " } ";
2937 } else {
2938 out += " {} ";
2939 }
2940 var __err = out;
2941 out = $$outStack.pop();
2942 if (!it.compositeRule && $breakOnError) {
2943 if (it.async) {
2944 out += " throw new ValidationError([" + __err + "]); ";
2945 } else {
2946 out += " validate.errors = [" + __err + "]; return false; ";
2947 }
2948 } else {
2949 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
2950 }
2951 out += " } else { ";
2952 if ($nonEmptySchema) {
2953 out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } ";
2954 }
2955 if (it.opts.allErrors) {
2956 out += " } ";
2957 }
2958 return out;
2959 };
2960});
2961
2962// node_modules/ajv/lib/dotjs/dependencies.js
2963var require_dependencies = __commonJS((exports, module) => {
2964 module.exports = function generate_dependencies(it, $keyword, $ruleType) {
2965 var out = " ";
2966 var $lvl = it.level;
2967 var $dataLvl = it.dataLevel;
2968 var $schema = it.schema[$keyword];
2969 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
2970 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
2971 var $breakOnError = !it.opts.allErrors;
2972 var $data = "data" + ($dataLvl || "");
2973 var $errs = "errs__" + $lvl;
2974 var $it = it.util.copy(it);
2975 var $closingBraces = "";
2976 $it.level++;
2977 var $nextValid = "valid" + $it.level;
2978 var $schemaDeps = {}, $propertyDeps = {}, $ownProperties = it.opts.ownProperties;
2979 for ($property in $schema) {
2980 if ($property == "__proto__")
2981 continue;
2982 var $sch = $schema[$property];
2983 var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
2984 $deps[$property] = $sch;
2985 }
2986 out += "var " + $errs + " = errors;";
2987 var $currentErrorPath = it.errorPath;
2988 out += "var missing" + $lvl + ";";
2989 for (var $property in $propertyDeps) {
2990 $deps = $propertyDeps[$property];
2991 if ($deps.length) {
2992 out += " if ( " + $data + it.util.getProperty($property) + " !== undefined ";
2993 if ($ownProperties) {
2994 out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') ";
2995 }
2996 if ($breakOnError) {
2997 out += " && ( ";
2998 var arr1 = $deps;
2999 if (arr1) {
3000 var $propertyKey, $i = -1, l1 = arr1.length - 1;
3001 while ($i < l1) {
3002 $propertyKey = arr1[$i += 1];
3003 if ($i) {
3004 out += " || ";
3005 }
3006 var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop;
3007 out += " ( ( " + $useData + " === undefined ";
3008 if ($ownProperties) {
3009 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
3010 }
3011 out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) ";
3012 }
3013 }
3014 out += ")) { ";
3015 var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '";
3016 if (it.opts._errorDataPathProperty) {
3017 it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath;
3018 }
3019 var $$outStack = $$outStack || [];
3020 $$outStack.push(out);
3021 out = "";
3022 if (it.createErrors !== false) {
3023 out += " { keyword: '" + "dependencies" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } ";
3024 if (it.opts.messages !== false) {
3025 out += " , message: 'should have ";
3026 if ($deps.length == 1) {
3027 out += "property " + it.util.escapeQuotes($deps[0]);
3028 } else {
3029 out += "properties " + it.util.escapeQuotes($deps.join(", "));
3030 }
3031 out += " when property " + it.util.escapeQuotes($property) + " is present' ";
3032 }
3033 if (it.opts.verbose) {
3034 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3035 }
3036 out += " } ";
3037 } else {
3038 out += " {} ";
3039 }
3040 var __err = out;
3041 out = $$outStack.pop();
3042 if (!it.compositeRule && $breakOnError) {
3043 if (it.async) {
3044 out += " throw new ValidationError([" + __err + "]); ";
3045 } else {
3046 out += " validate.errors = [" + __err + "]; return false; ";
3047 }
3048 } else {
3049 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3050 }
3051 } else {
3052 out += " ) { ";
3053 var arr2 = $deps;
3054 if (arr2) {
3055 var $propertyKey, i2 = -1, l2 = arr2.length - 1;
3056 while (i2 < l2) {
3057 $propertyKey = arr2[i2 += 1];
3058 var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop;
3059 if (it.opts._errorDataPathProperty) {
3060 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
3061 }
3062 out += " if ( " + $useData + " === undefined ";
3063 if ($ownProperties) {
3064 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
3065 }
3066 out += ") { var err = ";
3067 if (it.createErrors !== false) {
3068 out += " { keyword: '" + "dependencies" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } ";
3069 if (it.opts.messages !== false) {
3070 out += " , message: 'should have ";
3071 if ($deps.length == 1) {
3072 out += "property " + it.util.escapeQuotes($deps[0]);
3073 } else {
3074 out += "properties " + it.util.escapeQuotes($deps.join(", "));
3075 }
3076 out += " when property " + it.util.escapeQuotes($property) + " is present' ";
3077 }
3078 if (it.opts.verbose) {
3079 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3080 }
3081 out += " } ";
3082 } else {
3083 out += " {} ";
3084 }
3085 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ";
3086 }
3087 }
3088 }
3089 out += " } ";
3090 if ($breakOnError) {
3091 $closingBraces += "}";
3092 out += " else { ";
3093 }
3094 }
3095 }
3096 it.errorPath = $currentErrorPath;
3097 var $currentBaseId = $it.baseId;
3098 for (var $property in $schemaDeps) {
3099 var $sch = $schemaDeps[$property];
3100 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
3101 out += " " + $nextValid + " = true; if ( " + $data + it.util.getProperty($property) + " !== undefined ";
3102 if ($ownProperties) {
3103 out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') ";
3104 }
3105 out += ") { ";
3106 $it.schema = $sch;
3107 $it.schemaPath = $schemaPath + it.util.getProperty($property);
3108 $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($property);
3109 out += " " + it.validate($it) + " ";
3110 $it.baseId = $currentBaseId;
3111 out += " } ";
3112 if ($breakOnError) {
3113 out += " if (" + $nextValid + ") { ";
3114 $closingBraces += "}";
3115 }
3116 }
3117 }
3118 if ($breakOnError) {
3119 out += " " + $closingBraces + " if (" + $errs + " == errors) {";
3120 }
3121 return out;
3122 };
3123});
3124
3125// node_modules/ajv/lib/dotjs/enum.js
3126var require_enum = __commonJS((exports, module) => {
3127 module.exports = function generate_enum(it, $keyword, $ruleType) {
3128 var out = " ";
3129 var $lvl = it.level;
3130 var $dataLvl = it.dataLevel;
3131 var $schema = it.schema[$keyword];
3132 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3133 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3134 var $breakOnError = !it.opts.allErrors;
3135 var $data = "data" + ($dataLvl || "");
3136 var $valid = "valid" + $lvl;
3137 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3138 if ($isData) {
3139 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3140 $schemaValue = "schema" + $lvl;
3141 } else {
3142 $schemaValue = $schema;
3143 }
3144 var $i = "i" + $lvl, $vSchema = "schema" + $lvl;
3145 if (!$isData) {
3146 out += " var " + $vSchema + " = validate.schema" + $schemaPath + ";";
3147 }
3148 out += "var " + $valid + ";";
3149 if ($isData) {
3150 out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {";
3151 }
3152 out += "" + $valid + " = false;for (var " + $i + "=0; " + $i + "<" + $vSchema + ".length; " + $i + "++) if (equal(" + $data + ", " + $vSchema + "[" + $i + "])) { " + $valid + " = true; break; }";
3153 if ($isData) {
3154 out += " } ";
3155 }
3156 out += " if (!" + $valid + ") { ";
3157 var $$outStack = $$outStack || [];
3158 $$outStack.push(out);
3159 out = "";
3160 if (it.createErrors !== false) {
3161 out += " { keyword: '" + "enum" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValues: schema" + $lvl + " } ";
3162 if (it.opts.messages !== false) {
3163 out += " , message: 'should be equal to one of the allowed values' ";
3164 }
3165 if (it.opts.verbose) {
3166 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3167 }
3168 out += " } ";
3169 } else {
3170 out += " {} ";
3171 }
3172 var __err = out;
3173 out = $$outStack.pop();
3174 if (!it.compositeRule && $breakOnError) {
3175 if (it.async) {
3176 out += " throw new ValidationError([" + __err + "]); ";
3177 } else {
3178 out += " validate.errors = [" + __err + "]; return false; ";
3179 }
3180 } else {
3181 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3182 }
3183 out += " }";
3184 if ($breakOnError) {
3185 out += " else { ";
3186 }
3187 return out;
3188 };
3189});
3190
3191// node_modules/ajv/lib/dotjs/format.js
3192var require_format = __commonJS((exports, module) => {
3193 module.exports = function generate_format(it, $keyword, $ruleType) {
3194 var out = " ";
3195 var $lvl = it.level;
3196 var $dataLvl = it.dataLevel;
3197 var $schema = it.schema[$keyword];
3198 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3199 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3200 var $breakOnError = !it.opts.allErrors;
3201 var $data = "data" + ($dataLvl || "");
3202 if (it.opts.format === false) {
3203 if ($breakOnError) {
3204 out += " if (true) { ";
3205 }
3206 return out;
3207 }
3208 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3209 if ($isData) {
3210 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3211 $schemaValue = "schema" + $lvl;
3212 } else {
3213 $schemaValue = $schema;
3214 }
3215 var $unknownFormats = it.opts.unknownFormats, $allowUnknown = Array.isArray($unknownFormats);
3216 if ($isData) {
3217 var $format = "format" + $lvl, $isObject = "isObject" + $lvl, $formatType = "formatType" + $lvl;
3218 out += " var " + $format + " = formats[" + $schemaValue + "]; var " + $isObject + " = typeof " + $format + " == 'object' && !(" + $format + " instanceof RegExp) && " + $format + ".validate; var " + $formatType + " = " + $isObject + " && " + $format + ".type || 'string'; if (" + $isObject + ") { ";
3219 if (it.async) {
3220 out += " var async" + $lvl + " = " + $format + ".async; ";
3221 }
3222 out += " " + $format + " = " + $format + ".validate; } if ( ";
3223 if ($isData) {
3224 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || ";
3225 }
3226 out += " (";
3227 if ($unknownFormats != "ignore") {
3228 out += " (" + $schemaValue + " && !" + $format + " ";
3229 if ($allowUnknown) {
3230 out += " && self._opts.unknownFormats.indexOf(" + $schemaValue + ") == -1 ";
3231 }
3232 out += ") || ";
3233 }
3234 out += " (" + $format + " && " + $formatType + " == '" + $ruleType + "' && !(typeof " + $format + " == 'function' ? ";
3235 if (it.async) {
3236 out += " (async" + $lvl + " ? await " + $format + "(" + $data + ") : " + $format + "(" + $data + ")) ";
3237 } else {
3238 out += " " + $format + "(" + $data + ") ";
3239 }
3240 out += " : " + $format + ".test(" + $data + "))))) {";
3241 } else {
3242 var $format = it.formats[$schema];
3243 if (!$format) {
3244 if ($unknownFormats == "ignore") {
3245 it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
3246 if ($breakOnError) {
3247 out += " if (true) { ";
3248 }
3249 return out;
3250 } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {
3251 if ($breakOnError) {
3252 out += " if (true) { ";
3253 }
3254 return out;
3255 } else {
3256 throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');
3257 }
3258 }
3259 var $isObject = typeof $format == "object" && !($format instanceof RegExp) && $format.validate;
3260 var $formatType = $isObject && $format.type || "string";
3261 if ($isObject) {
3262 var $async = $format.async === true;
3263 $format = $format.validate;
3264 }
3265 if ($formatType != $ruleType) {
3266 if ($breakOnError) {
3267 out += " if (true) { ";
3268 }
3269 return out;
3270 }
3271 if ($async) {
3272 if (!it.async)
3273 throw new Error("async format in sync schema");
3274 var $formatRef = "formats" + it.util.getProperty($schema) + ".validate";
3275 out += " if (!(await " + $formatRef + "(" + $data + "))) { ";
3276 } else {
3277 out += " if (! ";
3278 var $formatRef = "formats" + it.util.getProperty($schema);
3279 if ($isObject)
3280 $formatRef += ".validate";
3281 if (typeof $format == "function") {
3282 out += " " + $formatRef + "(" + $data + ") ";
3283 } else {
3284 out += " " + $formatRef + ".test(" + $data + ") ";
3285 }
3286 out += ") { ";
3287 }
3288 }
3289 var $$outStack = $$outStack || [];
3290 $$outStack.push(out);
3291 out = "";
3292 if (it.createErrors !== false) {
3293 out += " { keyword: '" + "format" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { format: ";
3294 if ($isData) {
3295 out += "" + $schemaValue;
3296 } else {
3297 out += "" + it.util.toQuotedString($schema);
3298 }
3299 out += " } ";
3300 if (it.opts.messages !== false) {
3301 out += ` , message: 'should match format "`;
3302 if ($isData) {
3303 out += "' + " + $schemaValue + " + '";
3304 } else {
3305 out += "" + it.util.escapeQuotes($schema);
3306 }
3307 out += `"' `;
3308 }
3309 if (it.opts.verbose) {
3310 out += " , schema: ";
3311 if ($isData) {
3312 out += "validate.schema" + $schemaPath;
3313 } else {
3314 out += "" + it.util.toQuotedString($schema);
3315 }
3316 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3317 }
3318 out += " } ";
3319 } else {
3320 out += " {} ";
3321 }
3322 var __err = out;
3323 out = $$outStack.pop();
3324 if (!it.compositeRule && $breakOnError) {
3325 if (it.async) {
3326 out += " throw new ValidationError([" + __err + "]); ";
3327 } else {
3328 out += " validate.errors = [" + __err + "]; return false; ";
3329 }
3330 } else {
3331 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3332 }
3333 out += " } ";
3334 if ($breakOnError) {
3335 out += " else { ";
3336 }
3337 return out;
3338 };
3339});
3340
3341// node_modules/ajv/lib/dotjs/if.js
3342var require_if = __commonJS((exports, module) => {
3343 module.exports = function generate_if(it, $keyword, $ruleType) {
3344 var out = " ";
3345 var $lvl = it.level;
3346 var $dataLvl = it.dataLevel;
3347 var $schema = it.schema[$keyword];
3348 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3349 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3350 var $breakOnError = !it.opts.allErrors;
3351 var $data = "data" + ($dataLvl || "");
3352 var $valid = "valid" + $lvl;
3353 var $errs = "errs__" + $lvl;
3354 var $it = it.util.copy(it);
3355 $it.level++;
3356 var $nextValid = "valid" + $it.level;
3357 var $thenSch = it.schema["then"], $elseSch = it.schema["else"], $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == "object" && Object.keys($thenSch).length > 0 || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == "object" && Object.keys($elseSch).length > 0 || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), $currentBaseId = $it.baseId;
3358 if ($thenPresent || $elsePresent) {
3359 var $ifClause;
3360 $it.createErrors = false;
3361 $it.schema = $schema;
3362 $it.schemaPath = $schemaPath;
3363 $it.errSchemaPath = $errSchemaPath;
3364 out += " var " + $errs + " = errors; var " + $valid + " = true; ";
3365 var $wasComposite = it.compositeRule;
3366 it.compositeRule = $it.compositeRule = true;
3367 out += " " + it.validate($it) + " ";
3368 $it.baseId = $currentBaseId;
3369 $it.createErrors = true;
3370 out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } ";
3371 it.compositeRule = $it.compositeRule = $wasComposite;
3372 if ($thenPresent) {
3373 out += " if (" + $nextValid + ") { ";
3374 $it.schema = it.schema["then"];
3375 $it.schemaPath = it.schemaPath + ".then";
3376 $it.errSchemaPath = it.errSchemaPath + "/then";
3377 out += " " + it.validate($it) + " ";
3378 $it.baseId = $currentBaseId;
3379 out += " " + $valid + " = " + $nextValid + "; ";
3380 if ($thenPresent && $elsePresent) {
3381 $ifClause = "ifClause" + $lvl;
3382 out += " var " + $ifClause + " = 'then'; ";
3383 } else {
3384 $ifClause = "'then'";
3385 }
3386 out += " } ";
3387 if ($elsePresent) {
3388 out += " else { ";
3389 }
3390 } else {
3391 out += " if (!" + $nextValid + ") { ";
3392 }
3393 if ($elsePresent) {
3394 $it.schema = it.schema["else"];
3395 $it.schemaPath = it.schemaPath + ".else";
3396 $it.errSchemaPath = it.errSchemaPath + "/else";
3397 out += " " + it.validate($it) + " ";
3398 $it.baseId = $currentBaseId;
3399 out += " " + $valid + " = " + $nextValid + "; ";
3400 if ($thenPresent && $elsePresent) {
3401 $ifClause = "ifClause" + $lvl;
3402 out += " var " + $ifClause + " = 'else'; ";
3403 } else {
3404 $ifClause = "'else'";
3405 }
3406 out += " } ";
3407 }
3408 out += " if (!" + $valid + ") { var err = ";
3409 if (it.createErrors !== false) {
3410 out += " { keyword: '" + "if" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { failingKeyword: " + $ifClause + " } ";
3411 if (it.opts.messages !== false) {
3412 out += ` , message: 'should match "' + ` + $ifClause + ` + '" schema' `;
3413 }
3414 if (it.opts.verbose) {
3415 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3416 }
3417 out += " } ";
3418 } else {
3419 out += " {} ";
3420 }
3421 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3422 if (!it.compositeRule && $breakOnError) {
3423 if (it.async) {
3424 out += " throw new ValidationError(vErrors); ";
3425 } else {
3426 out += " validate.errors = vErrors; return false; ";
3427 }
3428 }
3429 out += " } ";
3430 if ($breakOnError) {
3431 out += " else { ";
3432 }
3433 } else {
3434 if ($breakOnError) {
3435 out += " if (true) { ";
3436 }
3437 }
3438 return out;
3439 };
3440});
3441
3442// node_modules/ajv/lib/dotjs/items.js
3443var require_items = __commonJS((exports, module) => {
3444 module.exports = function generate_items(it, $keyword, $ruleType) {
3445 var out = " ";
3446 var $lvl = it.level;
3447 var $dataLvl = it.dataLevel;
3448 var $schema = it.schema[$keyword];
3449 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3450 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3451 var $breakOnError = !it.opts.allErrors;
3452 var $data = "data" + ($dataLvl || "");
3453 var $valid = "valid" + $lvl;
3454 var $errs = "errs__" + $lvl;
3455 var $it = it.util.copy(it);
3456 var $closingBraces = "";
3457 $it.level++;
3458 var $nextValid = "valid" + $it.level;
3459 var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId;
3460 out += "var " + $errs + " = errors;var " + $valid + ";";
3461 if (Array.isArray($schema)) {
3462 var $additionalItems = it.schema.additionalItems;
3463 if ($additionalItems === false) {
3464 out += " " + $valid + " = " + $data + ".length <= " + $schema.length + "; ";
3465 var $currErrSchemaPath = $errSchemaPath;
3466 $errSchemaPath = it.errSchemaPath + "/additionalItems";
3467 out += " if (!" + $valid + ") { ";
3468 var $$outStack = $$outStack || [];
3469 $$outStack.push(out);
3470 out = "";
3471 if (it.createErrors !== false) {
3472 out += " { keyword: '" + "additionalItems" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schema.length + " } ";
3473 if (it.opts.messages !== false) {
3474 out += " , message: 'should NOT have more than " + $schema.length + " items' ";
3475 }
3476 if (it.opts.verbose) {
3477 out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3478 }
3479 out += " } ";
3480 } else {
3481 out += " {} ";
3482 }
3483 var __err = out;
3484 out = $$outStack.pop();
3485 if (!it.compositeRule && $breakOnError) {
3486 if (it.async) {
3487 out += " throw new ValidationError([" + __err + "]); ";
3488 } else {
3489 out += " validate.errors = [" + __err + "]; return false; ";
3490 }
3491 } else {
3492 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3493 }
3494 out += " } ";
3495 $errSchemaPath = $currErrSchemaPath;
3496 if ($breakOnError) {
3497 $closingBraces += "}";
3498 out += " else { ";
3499 }
3500 }
3501 var arr1 = $schema;
3502 if (arr1) {
3503 var $sch, $i = -1, l1 = arr1.length - 1;
3504 while ($i < l1) {
3505 $sch = arr1[$i += 1];
3506 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
3507 out += " " + $nextValid + " = true; if (" + $data + ".length > " + $i + ") { ";
3508 var $passData = $data + "[" + $i + "]";
3509 $it.schema = $sch;
3510 $it.schemaPath = $schemaPath + "[" + $i + "]";
3511 $it.errSchemaPath = $errSchemaPath + "/" + $i;
3512 $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
3513 $it.dataPathArr[$dataNxt] = $i;
3514 var $code = it.validate($it);
3515 $it.baseId = $currentBaseId;
3516 if (it.util.varOccurences($code, $nextData) < 2) {
3517 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
3518 } else {
3519 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
3520 }
3521 out += " } ";
3522 if ($breakOnError) {
3523 out += " if (" + $nextValid + ") { ";
3524 $closingBraces += "}";
3525 }
3526 }
3527 }
3528 }
3529 if (typeof $additionalItems == "object" && (it.opts.strictKeywords ? typeof $additionalItems == "object" && Object.keys($additionalItems).length > 0 || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
3530 $it.schema = $additionalItems;
3531 $it.schemaPath = it.schemaPath + ".additionalItems";
3532 $it.errSchemaPath = it.errSchemaPath + "/additionalItems";
3533 out += " " + $nextValid + " = true; if (" + $data + ".length > " + $schema.length + ") { for (var " + $idx + " = " + $schema.length + "; " + $idx + " < " + $data + ".length; " + $idx + "++) { ";
3534 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
3535 var $passData = $data + "[" + $idx + "]";
3536 $it.dataPathArr[$dataNxt] = $idx;
3537 var $code = it.validate($it);
3538 $it.baseId = $currentBaseId;
3539 if (it.util.varOccurences($code, $nextData) < 2) {
3540 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
3541 } else {
3542 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
3543 }
3544 if ($breakOnError) {
3545 out += " if (!" + $nextValid + ") break; ";
3546 }
3547 out += " } } ";
3548 if ($breakOnError) {
3549 out += " if (" + $nextValid + ") { ";
3550 $closingBraces += "}";
3551 }
3552 }
3553 } else if (it.opts.strictKeywords ? typeof $schema == "object" && Object.keys($schema).length > 0 || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)) {
3554 $it.schema = $schema;
3555 $it.schemaPath = $schemaPath;
3556 $it.errSchemaPath = $errSchemaPath;
3557 out += " for (var " + $idx + " = " + 0 + "; " + $idx + " < " + $data + ".length; " + $idx + "++) { ";
3558 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
3559 var $passData = $data + "[" + $idx + "]";
3560 $it.dataPathArr[$dataNxt] = $idx;
3561 var $code = it.validate($it);
3562 $it.baseId = $currentBaseId;
3563 if (it.util.varOccurences($code, $nextData) < 2) {
3564 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
3565 } else {
3566 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
3567 }
3568 if ($breakOnError) {
3569 out += " if (!" + $nextValid + ") break; ";
3570 }
3571 out += " }";
3572 }
3573 if ($breakOnError) {
3574 out += " " + $closingBraces + " if (" + $errs + " == errors) {";
3575 }
3576 return out;
3577 };
3578});
3579
3580// node_modules/ajv/lib/dotjs/_limit.js
3581var require__limit = __commonJS((exports, module) => {
3582 module.exports = function generate__limit(it, $keyword, $ruleType) {
3583 var out = " ";
3584 var $lvl = it.level;
3585 var $dataLvl = it.dataLevel;
3586 var $schema = it.schema[$keyword];
3587 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3588 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3589 var $breakOnError = !it.opts.allErrors;
3590 var $errorKeyword;
3591 var $data = "data" + ($dataLvl || "");
3592 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3593 if ($isData) {
3594 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3595 $schemaValue = "schema" + $lvl;
3596 } else {
3597 $schemaValue = $schema;
3598 }
3599 var $isMax = $keyword == "maximum", $exclusiveKeyword = $isMax ? "exclusiveMaximum" : "exclusiveMinimum", $schemaExcl = it.schema[$exclusiveKeyword], $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, $op = $isMax ? "<" : ">", $notOp = $isMax ? ">" : "<", $errorKeyword = undefined;
3600 if (!($isData || typeof $schema == "number" || $schema === undefined)) {
3601 throw new Error($keyword + " must be number");
3602 }
3603 if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == "number" || typeof $schemaExcl == "boolean")) {
3604 throw new Error($exclusiveKeyword + " must be number or boolean");
3605 }
3606 if ($isDataExcl) {
3607 var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), $exclusive = "exclusive" + $lvl, $exclType = "exclType" + $lvl, $exclIsNumber = "exclIsNumber" + $lvl, $opExpr = "op" + $lvl, $opStr = "' + " + $opExpr + " + '";
3608 out += " var schemaExcl" + $lvl + " = " + $schemaValueExcl + "; ";
3609 $schemaValueExcl = "schemaExcl" + $lvl;
3610 out += " var " + $exclusive + "; var " + $exclType + " = typeof " + $schemaValueExcl + "; if (" + $exclType + " != 'boolean' && " + $exclType + " != 'undefined' && " + $exclType + " != 'number') { ";
3611 var $errorKeyword = $exclusiveKeyword;
3612 var $$outStack = $$outStack || [];
3613 $$outStack.push(out);
3614 out = "";
3615 if (it.createErrors !== false) {
3616 out += " { keyword: '" + ($errorKeyword || "_exclusiveLimit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
3617 if (it.opts.messages !== false) {
3618 out += " , message: '" + $exclusiveKeyword + " should be boolean' ";
3619 }
3620 if (it.opts.verbose) {
3621 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3622 }
3623 out += " } ";
3624 } else {
3625 out += " {} ";
3626 }
3627 var __err = out;
3628 out = $$outStack.pop();
3629 if (!it.compositeRule && $breakOnError) {
3630 if (it.async) {
3631 out += " throw new ValidationError([" + __err + "]); ";
3632 } else {
3633 out += " validate.errors = [" + __err + "]; return false; ";
3634 }
3635 } else {
3636 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3637 }
3638 out += " } else if ( ";
3639 if ($isData) {
3640 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3641 }
3642 out += " " + $exclType + " == 'number' ? ( (" + $exclusive + " = " + $schemaValue + " === undefined || " + $schemaValueExcl + " " + $op + "= " + $schemaValue + ") ? " + $data + " " + $notOp + "= " + $schemaValueExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) : ( (" + $exclusive + " = " + $schemaValueExcl + " === true) ? " + $data + " " + $notOp + "= " + $schemaValue + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { var op" + $lvl + " = " + $exclusive + " ? '" + $op + "' : '" + $op + "='; ";
3643 if ($schema === undefined) {
3644 $errorKeyword = $exclusiveKeyword;
3645 $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword;
3646 $schemaValue = $schemaValueExcl;
3647 $isData = $isDataExcl;
3648 }
3649 } else {
3650 var $exclIsNumber = typeof $schemaExcl == "number", $opStr = $op;
3651 if ($exclIsNumber && $isData) {
3652 var $opExpr = "'" + $opStr + "'";
3653 out += " if ( ";
3654 if ($isData) {
3655 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3656 }
3657 out += " ( " + $schemaValue + " === undefined || " + $schemaExcl + " " + $op + "= " + $schemaValue + " ? " + $data + " " + $notOp + "= " + $schemaExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { ";
3658 } else {
3659 if ($exclIsNumber && $schema === undefined) {
3660 $exclusive = true;
3661 $errorKeyword = $exclusiveKeyword;
3662 $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword;
3663 $schemaValue = $schemaExcl;
3664 $notOp += "=";
3665 } else {
3666 if ($exclIsNumber)
3667 $schemaValue = Math[$isMax ? "min" : "max"]($schemaExcl, $schema);
3668 if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
3669 $exclusive = true;
3670 $errorKeyword = $exclusiveKeyword;
3671 $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword;
3672 $notOp += "=";
3673 } else {
3674 $exclusive = false;
3675 $opStr += "=";
3676 }
3677 }
3678 var $opExpr = "'" + $opStr + "'";
3679 out += " if ( ";
3680 if ($isData) {
3681 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3682 }
3683 out += " " + $data + " " + $notOp + " " + $schemaValue + " || " + $data + " !== " + $data + ") { ";
3684 }
3685 }
3686 $errorKeyword = $errorKeyword || $keyword;
3687 var $$outStack = $$outStack || [];
3688 $$outStack.push(out);
3689 out = "";
3690 if (it.createErrors !== false) {
3691 out += " { keyword: '" + ($errorKeyword || "_limit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { comparison: " + $opExpr + ", limit: " + $schemaValue + ", exclusive: " + $exclusive + " } ";
3692 if (it.opts.messages !== false) {
3693 out += " , message: 'should be " + $opStr + " ";
3694 if ($isData) {
3695 out += "' + " + $schemaValue;
3696 } else {
3697 out += "" + $schemaValue + "'";
3698 }
3699 }
3700 if (it.opts.verbose) {
3701 out += " , schema: ";
3702 if ($isData) {
3703 out += "validate.schema" + $schemaPath;
3704 } else {
3705 out += "" + $schema;
3706 }
3707 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3708 }
3709 out += " } ";
3710 } else {
3711 out += " {} ";
3712 }
3713 var __err = out;
3714 out = $$outStack.pop();
3715 if (!it.compositeRule && $breakOnError) {
3716 if (it.async) {
3717 out += " throw new ValidationError([" + __err + "]); ";
3718 } else {
3719 out += " validate.errors = [" + __err + "]; return false; ";
3720 }
3721 } else {
3722 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3723 }
3724 out += " } ";
3725 if ($breakOnError) {
3726 out += " else { ";
3727 }
3728 return out;
3729 };
3730});
3731
3732// node_modules/ajv/lib/dotjs/_limitItems.js
3733var require__limitItems = __commonJS((exports, module) => {
3734 module.exports = function generate__limitItems(it, $keyword, $ruleType) {
3735 var out = " ";
3736 var $lvl = it.level;
3737 var $dataLvl = it.dataLevel;
3738 var $schema = it.schema[$keyword];
3739 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3740 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3741 var $breakOnError = !it.opts.allErrors;
3742 var $errorKeyword;
3743 var $data = "data" + ($dataLvl || "");
3744 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3745 if ($isData) {
3746 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3747 $schemaValue = "schema" + $lvl;
3748 } else {
3749 $schemaValue = $schema;
3750 }
3751 if (!($isData || typeof $schema == "number")) {
3752 throw new Error($keyword + " must be number");
3753 }
3754 var $op = $keyword == "maxItems" ? ">" : "<";
3755 out += "if ( ";
3756 if ($isData) {
3757 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3758 }
3759 out += " " + $data + ".length " + $op + " " + $schemaValue + ") { ";
3760 var $errorKeyword = $keyword;
3761 var $$outStack = $$outStack || [];
3762 $$outStack.push(out);
3763 out = "";
3764 if (it.createErrors !== false) {
3765 out += " { keyword: '" + ($errorKeyword || "_limitItems") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } ";
3766 if (it.opts.messages !== false) {
3767 out += " , message: 'should NOT have ";
3768 if ($keyword == "maxItems") {
3769 out += "more";
3770 } else {
3771 out += "fewer";
3772 }
3773 out += " than ";
3774 if ($isData) {
3775 out += "' + " + $schemaValue + " + '";
3776 } else {
3777 out += "" + $schema;
3778 }
3779 out += " items' ";
3780 }
3781 if (it.opts.verbose) {
3782 out += " , schema: ";
3783 if ($isData) {
3784 out += "validate.schema" + $schemaPath;
3785 } else {
3786 out += "" + $schema;
3787 }
3788 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3789 }
3790 out += " } ";
3791 } else {
3792 out += " {} ";
3793 }
3794 var __err = out;
3795 out = $$outStack.pop();
3796 if (!it.compositeRule && $breakOnError) {
3797 if (it.async) {
3798 out += " throw new ValidationError([" + __err + "]); ";
3799 } else {
3800 out += " validate.errors = [" + __err + "]; return false; ";
3801 }
3802 } else {
3803 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3804 }
3805 out += "} ";
3806 if ($breakOnError) {
3807 out += " else { ";
3808 }
3809 return out;
3810 };
3811});
3812
3813// node_modules/ajv/lib/dotjs/_limitLength.js
3814var require__limitLength = __commonJS((exports, module) => {
3815 module.exports = function generate__limitLength(it, $keyword, $ruleType) {
3816 var out = " ";
3817 var $lvl = it.level;
3818 var $dataLvl = it.dataLevel;
3819 var $schema = it.schema[$keyword];
3820 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3821 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3822 var $breakOnError = !it.opts.allErrors;
3823 var $errorKeyword;
3824 var $data = "data" + ($dataLvl || "");
3825 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3826 if ($isData) {
3827 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3828 $schemaValue = "schema" + $lvl;
3829 } else {
3830 $schemaValue = $schema;
3831 }
3832 if (!($isData || typeof $schema == "number")) {
3833 throw new Error($keyword + " must be number");
3834 }
3835 var $op = $keyword == "maxLength" ? ">" : "<";
3836 out += "if ( ";
3837 if ($isData) {
3838 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3839 }
3840 if (it.opts.unicode === false) {
3841 out += " " + $data + ".length ";
3842 } else {
3843 out += " ucs2length(" + $data + ") ";
3844 }
3845 out += " " + $op + " " + $schemaValue + ") { ";
3846 var $errorKeyword = $keyword;
3847 var $$outStack = $$outStack || [];
3848 $$outStack.push(out);
3849 out = "";
3850 if (it.createErrors !== false) {
3851 out += " { keyword: '" + ($errorKeyword || "_limitLength") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } ";
3852 if (it.opts.messages !== false) {
3853 out += " , message: 'should NOT be ";
3854 if ($keyword == "maxLength") {
3855 out += "longer";
3856 } else {
3857 out += "shorter";
3858 }
3859 out += " than ";
3860 if ($isData) {
3861 out += "' + " + $schemaValue + " + '";
3862 } else {
3863 out += "" + $schema;
3864 }
3865 out += " characters' ";
3866 }
3867 if (it.opts.verbose) {
3868 out += " , schema: ";
3869 if ($isData) {
3870 out += "validate.schema" + $schemaPath;
3871 } else {
3872 out += "" + $schema;
3873 }
3874 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3875 }
3876 out += " } ";
3877 } else {
3878 out += " {} ";
3879 }
3880 var __err = out;
3881 out = $$outStack.pop();
3882 if (!it.compositeRule && $breakOnError) {
3883 if (it.async) {
3884 out += " throw new ValidationError([" + __err + "]); ";
3885 } else {
3886 out += " validate.errors = [" + __err + "]; return false; ";
3887 }
3888 } else {
3889 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3890 }
3891 out += "} ";
3892 if ($breakOnError) {
3893 out += " else { ";
3894 }
3895 return out;
3896 };
3897});
3898
3899// node_modules/ajv/lib/dotjs/_limitProperties.js
3900var require__limitProperties = __commonJS((exports, module) => {
3901 module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
3902 var out = " ";
3903 var $lvl = it.level;
3904 var $dataLvl = it.dataLevel;
3905 var $schema = it.schema[$keyword];
3906 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3907 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3908 var $breakOnError = !it.opts.allErrors;
3909 var $errorKeyword;
3910 var $data = "data" + ($dataLvl || "");
3911 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3912 if ($isData) {
3913 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3914 $schemaValue = "schema" + $lvl;
3915 } else {
3916 $schemaValue = $schema;
3917 }
3918 if (!($isData || typeof $schema == "number")) {
3919 throw new Error($keyword + " must be number");
3920 }
3921 var $op = $keyword == "maxProperties" ? ">" : "<";
3922 out += "if ( ";
3923 if ($isData) {
3924 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || ";
3925 }
3926 out += " Object.keys(" + $data + ").length " + $op + " " + $schemaValue + ") { ";
3927 var $errorKeyword = $keyword;
3928 var $$outStack = $$outStack || [];
3929 $$outStack.push(out);
3930 out = "";
3931 if (it.createErrors !== false) {
3932 out += " { keyword: '" + ($errorKeyword || "_limitProperties") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } ";
3933 if (it.opts.messages !== false) {
3934 out += " , message: 'should NOT have ";
3935 if ($keyword == "maxProperties") {
3936 out += "more";
3937 } else {
3938 out += "fewer";
3939 }
3940 out += " than ";
3941 if ($isData) {
3942 out += "' + " + $schemaValue + " + '";
3943 } else {
3944 out += "" + $schema;
3945 }
3946 out += " properties' ";
3947 }
3948 if (it.opts.verbose) {
3949 out += " , schema: ";
3950 if ($isData) {
3951 out += "validate.schema" + $schemaPath;
3952 } else {
3953 out += "" + $schema;
3954 }
3955 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
3956 }
3957 out += " } ";
3958 } else {
3959 out += " {} ";
3960 }
3961 var __err = out;
3962 out = $$outStack.pop();
3963 if (!it.compositeRule && $breakOnError) {
3964 if (it.async) {
3965 out += " throw new ValidationError([" + __err + "]); ";
3966 } else {
3967 out += " validate.errors = [" + __err + "]; return false; ";
3968 }
3969 } else {
3970 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
3971 }
3972 out += "} ";
3973 if ($breakOnError) {
3974 out += " else { ";
3975 }
3976 return out;
3977 };
3978});
3979
3980// node_modules/ajv/lib/dotjs/multipleOf.js
3981var require_multipleOf = __commonJS((exports, module) => {
3982 module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
3983 var out = " ";
3984 var $lvl = it.level;
3985 var $dataLvl = it.dataLevel;
3986 var $schema = it.schema[$keyword];
3987 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
3988 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
3989 var $breakOnError = !it.opts.allErrors;
3990 var $data = "data" + ($dataLvl || "");
3991 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
3992 if ($isData) {
3993 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
3994 $schemaValue = "schema" + $lvl;
3995 } else {
3996 $schemaValue = $schema;
3997 }
3998 if (!($isData || typeof $schema == "number")) {
3999 throw new Error($keyword + " must be number");
4000 }
4001 out += "var division" + $lvl + ";if (";
4002 if ($isData) {
4003 out += " " + $schemaValue + " !== undefined && ( typeof " + $schemaValue + " != 'number' || ";
4004 }
4005 out += " (division" + $lvl + " = " + $data + " / " + $schemaValue + ", ";
4006 if (it.opts.multipleOfPrecision) {
4007 out += " Math.abs(Math.round(division" + $lvl + ") - division" + $lvl + ") > 1e-" + it.opts.multipleOfPrecision + " ";
4008 } else {
4009 out += " division" + $lvl + " !== parseInt(division" + $lvl + ") ";
4010 }
4011 out += " ) ";
4012 if ($isData) {
4013 out += " ) ";
4014 }
4015 out += " ) { ";
4016 var $$outStack = $$outStack || [];
4017 $$outStack.push(out);
4018 out = "";
4019 if (it.createErrors !== false) {
4020 out += " { keyword: '" + "multipleOf" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { multipleOf: " + $schemaValue + " } ";
4021 if (it.opts.messages !== false) {
4022 out += " , message: 'should be multiple of ";
4023 if ($isData) {
4024 out += "' + " + $schemaValue;
4025 } else {
4026 out += "" + $schemaValue + "'";
4027 }
4028 }
4029 if (it.opts.verbose) {
4030 out += " , schema: ";
4031 if ($isData) {
4032 out += "validate.schema" + $schemaPath;
4033 } else {
4034 out += "" + $schema;
4035 }
4036 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4037 }
4038 out += " } ";
4039 } else {
4040 out += " {} ";
4041 }
4042 var __err = out;
4043 out = $$outStack.pop();
4044 if (!it.compositeRule && $breakOnError) {
4045 if (it.async) {
4046 out += " throw new ValidationError([" + __err + "]); ";
4047 } else {
4048 out += " validate.errors = [" + __err + "]; return false; ";
4049 }
4050 } else {
4051 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4052 }
4053 out += "} ";
4054 if ($breakOnError) {
4055 out += " else { ";
4056 }
4057 return out;
4058 };
4059});
4060
4061// node_modules/ajv/lib/dotjs/not.js
4062var require_not = __commonJS((exports, module) => {
4063 module.exports = function generate_not(it, $keyword, $ruleType) {
4064 var out = " ";
4065 var $lvl = it.level;
4066 var $dataLvl = it.dataLevel;
4067 var $schema = it.schema[$keyword];
4068 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4069 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4070 var $breakOnError = !it.opts.allErrors;
4071 var $data = "data" + ($dataLvl || "");
4072 var $errs = "errs__" + $lvl;
4073 var $it = it.util.copy(it);
4074 $it.level++;
4075 var $nextValid = "valid" + $it.level;
4076 if (it.opts.strictKeywords ? typeof $schema == "object" && Object.keys($schema).length > 0 || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)) {
4077 $it.schema = $schema;
4078 $it.schemaPath = $schemaPath;
4079 $it.errSchemaPath = $errSchemaPath;
4080 out += " var " + $errs + " = errors; ";
4081 var $wasComposite = it.compositeRule;
4082 it.compositeRule = $it.compositeRule = true;
4083 $it.createErrors = false;
4084 var $allErrorsOption;
4085 if ($it.opts.allErrors) {
4086 $allErrorsOption = $it.opts.allErrors;
4087 $it.opts.allErrors = false;
4088 }
4089 out += " " + it.validate($it) + " ";
4090 $it.createErrors = true;
4091 if ($allErrorsOption)
4092 $it.opts.allErrors = $allErrorsOption;
4093 it.compositeRule = $it.compositeRule = $wasComposite;
4094 out += " if (" + $nextValid + ") { ";
4095 var $$outStack = $$outStack || [];
4096 $$outStack.push(out);
4097 out = "";
4098 if (it.createErrors !== false) {
4099 out += " { keyword: '" + "not" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
4100 if (it.opts.messages !== false) {
4101 out += " , message: 'should NOT be valid' ";
4102 }
4103 if (it.opts.verbose) {
4104 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4105 }
4106 out += " } ";
4107 } else {
4108 out += " {} ";
4109 }
4110 var __err = out;
4111 out = $$outStack.pop();
4112 if (!it.compositeRule && $breakOnError) {
4113 if (it.async) {
4114 out += " throw new ValidationError([" + __err + "]); ";
4115 } else {
4116 out += " validate.errors = [" + __err + "]; return false; ";
4117 }
4118 } else {
4119 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4120 }
4121 out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } ";
4122 if (it.opts.allErrors) {
4123 out += " } ";
4124 }
4125 } else {
4126 out += " var err = ";
4127 if (it.createErrors !== false) {
4128 out += " { keyword: '" + "not" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} ";
4129 if (it.opts.messages !== false) {
4130 out += " , message: 'should NOT be valid' ";
4131 }
4132 if (it.opts.verbose) {
4133 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4134 }
4135 out += " } ";
4136 } else {
4137 out += " {} ";
4138 }
4139 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4140 if ($breakOnError) {
4141 out += " if (false) { ";
4142 }
4143 }
4144 return out;
4145 };
4146});
4147
4148// node_modules/ajv/lib/dotjs/oneOf.js
4149var require_oneOf = __commonJS((exports, module) => {
4150 module.exports = function generate_oneOf(it, $keyword, $ruleType) {
4151 var out = " ";
4152 var $lvl = it.level;
4153 var $dataLvl = it.dataLevel;
4154 var $schema = it.schema[$keyword];
4155 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4156 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4157 var $breakOnError = !it.opts.allErrors;
4158 var $data = "data" + ($dataLvl || "");
4159 var $valid = "valid" + $lvl;
4160 var $errs = "errs__" + $lvl;
4161 var $it = it.util.copy(it);
4162 var $closingBraces = "";
4163 $it.level++;
4164 var $nextValid = "valid" + $it.level;
4165 var $currentBaseId = $it.baseId, $prevValid = "prevValid" + $lvl, $passingSchemas = "passingSchemas" + $lvl;
4166 out += "var " + $errs + " = errors , " + $prevValid + " = false , " + $valid + " = false , " + $passingSchemas + " = null; ";
4167 var $wasComposite = it.compositeRule;
4168 it.compositeRule = $it.compositeRule = true;
4169 var arr1 = $schema;
4170 if (arr1) {
4171 var $sch, $i = -1, l1 = arr1.length - 1;
4172 while ($i < l1) {
4173 $sch = arr1[$i += 1];
4174 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
4175 $it.schema = $sch;
4176 $it.schemaPath = $schemaPath + "[" + $i + "]";
4177 $it.errSchemaPath = $errSchemaPath + "/" + $i;
4178 out += " " + it.validate($it) + " ";
4179 $it.baseId = $currentBaseId;
4180 } else {
4181 out += " var " + $nextValid + " = true; ";
4182 }
4183 if ($i) {
4184 out += " if (" + $nextValid + " && " + $prevValid + ") { " + $valid + " = false; " + $passingSchemas + " = [" + $passingSchemas + ", " + $i + "]; } else { ";
4185 $closingBraces += "}";
4186 }
4187 out += " if (" + $nextValid + ") { " + $valid + " = " + $prevValid + " = true; " + $passingSchemas + " = " + $i + "; }";
4188 }
4189 }
4190 it.compositeRule = $it.compositeRule = $wasComposite;
4191 out += "" + $closingBraces + "if (!" + $valid + ") { var err = ";
4192 if (it.createErrors !== false) {
4193 out += " { keyword: '" + "oneOf" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { passingSchemas: " + $passingSchemas + " } ";
4194 if (it.opts.messages !== false) {
4195 out += " , message: 'should match exactly one schema in oneOf' ";
4196 }
4197 if (it.opts.verbose) {
4198 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4199 }
4200 out += " } ";
4201 } else {
4202 out += " {} ";
4203 }
4204 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4205 if (!it.compositeRule && $breakOnError) {
4206 if (it.async) {
4207 out += " throw new ValidationError(vErrors); ";
4208 } else {
4209 out += " validate.errors = vErrors; return false; ";
4210 }
4211 }
4212 out += "} else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; }";
4213 if (it.opts.allErrors) {
4214 out += " } ";
4215 }
4216 return out;
4217 };
4218});
4219
4220// node_modules/ajv/lib/dotjs/pattern.js
4221var require_pattern = __commonJS((exports, module) => {
4222 module.exports = function generate_pattern(it, $keyword, $ruleType) {
4223 var out = " ";
4224 var $lvl = it.level;
4225 var $dataLvl = it.dataLevel;
4226 var $schema = it.schema[$keyword];
4227 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4228 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4229 var $breakOnError = !it.opts.allErrors;
4230 var $data = "data" + ($dataLvl || "");
4231 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
4232 if ($isData) {
4233 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
4234 $schemaValue = "schema" + $lvl;
4235 } else {
4236 $schemaValue = $schema;
4237 }
4238 var $regexp = $isData ? "(new RegExp(" + $schemaValue + "))" : it.usePattern($schema);
4239 out += "if ( ";
4240 if ($isData) {
4241 out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || ";
4242 }
4243 out += " !" + $regexp + ".test(" + $data + ") ) { ";
4244 var $$outStack = $$outStack || [];
4245 $$outStack.push(out);
4246 out = "";
4247 if (it.createErrors !== false) {
4248 out += " { keyword: '" + "pattern" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { pattern: ";
4249 if ($isData) {
4250 out += "" + $schemaValue;
4251 } else {
4252 out += "" + it.util.toQuotedString($schema);
4253 }
4254 out += " } ";
4255 if (it.opts.messages !== false) {
4256 out += ` , message: 'should match pattern "`;
4257 if ($isData) {
4258 out += "' + " + $schemaValue + " + '";
4259 } else {
4260 out += "" + it.util.escapeQuotes($schema);
4261 }
4262 out += `"' `;
4263 }
4264 if (it.opts.verbose) {
4265 out += " , schema: ";
4266 if ($isData) {
4267 out += "validate.schema" + $schemaPath;
4268 } else {
4269 out += "" + it.util.toQuotedString($schema);
4270 }
4271 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4272 }
4273 out += " } ";
4274 } else {
4275 out += " {} ";
4276 }
4277 var __err = out;
4278 out = $$outStack.pop();
4279 if (!it.compositeRule && $breakOnError) {
4280 if (it.async) {
4281 out += " throw new ValidationError([" + __err + "]); ";
4282 } else {
4283 out += " validate.errors = [" + __err + "]; return false; ";
4284 }
4285 } else {
4286 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4287 }
4288 out += "} ";
4289 if ($breakOnError) {
4290 out += " else { ";
4291 }
4292 return out;
4293 };
4294});
4295
4296// node_modules/ajv/lib/dotjs/properties.js
4297var require_properties = __commonJS((exports, module) => {
4298 module.exports = function generate_properties(it, $keyword, $ruleType) {
4299 var out = " ";
4300 var $lvl = it.level;
4301 var $dataLvl = it.dataLevel;
4302 var $schema = it.schema[$keyword];
4303 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4304 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4305 var $breakOnError = !it.opts.allErrors;
4306 var $data = "data" + ($dataLvl || "");
4307 var $errs = "errs__" + $lvl;
4308 var $it = it.util.copy(it);
4309 var $closingBraces = "";
4310 $it.level++;
4311 var $nextValid = "valid" + $it.level;
4312 var $key = "key" + $lvl, $idx = "idx" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl;
4313 var $schemaKeys = Object.keys($schema || {}).filter(notProto), $pProperties = it.schema.patternProperties || {}, $pPropertyKeys = Object.keys($pProperties).filter(notProto), $aProperties = it.schema.additionalProperties, $someProperties = $schemaKeys.length || $pPropertyKeys.length, $noAdditional = $aProperties === false, $additionalIsSchema = typeof $aProperties == "object" && Object.keys($aProperties).length, $removeAdditional = it.opts.removeAdditional, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId;
4314 var $required = it.schema.required;
4315 if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
4316 var $requiredHash = it.util.toHash($required);
4317 }
4318 function notProto(p) {
4319 return p !== "__proto__";
4320 }
4321 out += "var " + $errs + " = errors;var " + $nextValid + " = true;";
4322 if ($ownProperties) {
4323 out += " var " + $dataProperties + " = undefined;";
4324 }
4325 if ($checkAdditional) {
4326 if ($ownProperties) {
4327 out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; ";
4328 } else {
4329 out += " for (var " + $key + " in " + $data + ") { ";
4330 }
4331 if ($someProperties) {
4332 out += " var isAdditional" + $lvl + " = !(false ";
4333 if ($schemaKeys.length) {
4334 if ($schemaKeys.length > 8) {
4335 out += " || validate.schema" + $schemaPath + ".hasOwnProperty(" + $key + ") ";
4336 } else {
4337 var arr1 = $schemaKeys;
4338 if (arr1) {
4339 var $propertyKey, i1 = -1, l1 = arr1.length - 1;
4340 while (i1 < l1) {
4341 $propertyKey = arr1[i1 += 1];
4342 out += " || " + $key + " == " + it.util.toQuotedString($propertyKey) + " ";
4343 }
4344 }
4345 }
4346 }
4347 if ($pPropertyKeys.length) {
4348 var arr2 = $pPropertyKeys;
4349 if (arr2) {
4350 var $pProperty, $i = -1, l2 = arr2.length - 1;
4351 while ($i < l2) {
4352 $pProperty = arr2[$i += 1];
4353 out += " || " + it.usePattern($pProperty) + ".test(" + $key + ") ";
4354 }
4355 }
4356 }
4357 out += " ); if (isAdditional" + $lvl + ") { ";
4358 }
4359 if ($removeAdditional == "all") {
4360 out += " delete " + $data + "[" + $key + "]; ";
4361 } else {
4362 var $currentErrorPath = it.errorPath;
4363 var $additionalProperty = "' + " + $key + " + '";
4364 if (it.opts._errorDataPathProperty) {
4365 it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
4366 }
4367 if ($noAdditional) {
4368 if ($removeAdditional) {
4369 out += " delete " + $data + "[" + $key + "]; ";
4370 } else {
4371 out += " " + $nextValid + " = false; ";
4372 var $currErrSchemaPath = $errSchemaPath;
4373 $errSchemaPath = it.errSchemaPath + "/additionalProperties";
4374 var $$outStack = $$outStack || [];
4375 $$outStack.push(out);
4376 out = "";
4377 if (it.createErrors !== false) {
4378 out += " { keyword: '" + "additionalProperties" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { additionalProperty: '" + $additionalProperty + "' } ";
4379 if (it.opts.messages !== false) {
4380 out += " , message: '";
4381 if (it.opts._errorDataPathProperty) {
4382 out += "is an invalid additional property";
4383 } else {
4384 out += "should NOT have additional properties";
4385 }
4386 out += "' ";
4387 }
4388 if (it.opts.verbose) {
4389 out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4390 }
4391 out += " } ";
4392 } else {
4393 out += " {} ";
4394 }
4395 var __err = out;
4396 out = $$outStack.pop();
4397 if (!it.compositeRule && $breakOnError) {
4398 if (it.async) {
4399 out += " throw new ValidationError([" + __err + "]); ";
4400 } else {
4401 out += " validate.errors = [" + __err + "]; return false; ";
4402 }
4403 } else {
4404 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4405 }
4406 $errSchemaPath = $currErrSchemaPath;
4407 if ($breakOnError) {
4408 out += " break; ";
4409 }
4410 }
4411 } else if ($additionalIsSchema) {
4412 if ($removeAdditional == "failing") {
4413 out += " var " + $errs + " = errors; ";
4414 var $wasComposite = it.compositeRule;
4415 it.compositeRule = $it.compositeRule = true;
4416 $it.schema = $aProperties;
4417 $it.schemaPath = it.schemaPath + ".additionalProperties";
4418 $it.errSchemaPath = it.errSchemaPath + "/additionalProperties";
4419 $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
4420 var $passData = $data + "[" + $key + "]";
4421 $it.dataPathArr[$dataNxt] = $key;
4422 var $code = it.validate($it);
4423 $it.baseId = $currentBaseId;
4424 if (it.util.varOccurences($code, $nextData) < 2) {
4425 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
4426 } else {
4427 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
4428 }
4429 out += " if (!" + $nextValid + ") { errors = " + $errs + "; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete " + $data + "[" + $key + "]; } ";
4430 it.compositeRule = $it.compositeRule = $wasComposite;
4431 } else {
4432 $it.schema = $aProperties;
4433 $it.schemaPath = it.schemaPath + ".additionalProperties";
4434 $it.errSchemaPath = it.errSchemaPath + "/additionalProperties";
4435 $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
4436 var $passData = $data + "[" + $key + "]";
4437 $it.dataPathArr[$dataNxt] = $key;
4438 var $code = it.validate($it);
4439 $it.baseId = $currentBaseId;
4440 if (it.util.varOccurences($code, $nextData) < 2) {
4441 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
4442 } else {
4443 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
4444 }
4445 if ($breakOnError) {
4446 out += " if (!" + $nextValid + ") break; ";
4447 }
4448 }
4449 }
4450 it.errorPath = $currentErrorPath;
4451 }
4452 if ($someProperties) {
4453 out += " } ";
4454 }
4455 out += " } ";
4456 if ($breakOnError) {
4457 out += " if (" + $nextValid + ") { ";
4458 $closingBraces += "}";
4459 }
4460 }
4461 var $useDefaults = it.opts.useDefaults && !it.compositeRule;
4462 if ($schemaKeys.length) {
4463 var arr3 = $schemaKeys;
4464 if (arr3) {
4465 var $propertyKey, i3 = -1, l3 = arr3.length - 1;
4466 while (i3 < l3) {
4467 $propertyKey = arr3[i3 += 1];
4468 var $sch = $schema[$propertyKey];
4469 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
4470 var $prop = it.util.getProperty($propertyKey), $passData = $data + $prop, $hasDefault = $useDefaults && $sch.default !== undefined;
4471 $it.schema = $sch;
4472 $it.schemaPath = $schemaPath + $prop;
4473 $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($propertyKey);
4474 $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
4475 $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
4476 var $code = it.validate($it);
4477 $it.baseId = $currentBaseId;
4478 if (it.util.varOccurences($code, $nextData) < 2) {
4479 $code = it.util.varReplace($code, $nextData, $passData);
4480 var $useData = $passData;
4481 } else {
4482 var $useData = $nextData;
4483 out += " var " + $nextData + " = " + $passData + "; ";
4484 }
4485 if ($hasDefault) {
4486 out += " " + $code + " ";
4487 } else {
4488 if ($requiredHash && $requiredHash[$propertyKey]) {
4489 out += " if ( " + $useData + " === undefined ";
4490 if ($ownProperties) {
4491 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
4492 }
4493 out += ") { " + $nextValid + " = false; ";
4494 var $currentErrorPath = it.errorPath, $currErrSchemaPath = $errSchemaPath, $missingProperty = it.util.escapeQuotes($propertyKey);
4495 if (it.opts._errorDataPathProperty) {
4496 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
4497 }
4498 $errSchemaPath = it.errSchemaPath + "/required";
4499 var $$outStack = $$outStack || [];
4500 $$outStack.push(out);
4501 out = "";
4502 if (it.createErrors !== false) {
4503 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4504 if (it.opts.messages !== false) {
4505 out += " , message: '";
4506 if (it.opts._errorDataPathProperty) {
4507 out += "is a required property";
4508 } else {
4509 out += "should have required property \\'" + $missingProperty + "\\'";
4510 }
4511 out += "' ";
4512 }
4513 if (it.opts.verbose) {
4514 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4515 }
4516 out += " } ";
4517 } else {
4518 out += " {} ";
4519 }
4520 var __err = out;
4521 out = $$outStack.pop();
4522 if (!it.compositeRule && $breakOnError) {
4523 if (it.async) {
4524 out += " throw new ValidationError([" + __err + "]); ";
4525 } else {
4526 out += " validate.errors = [" + __err + "]; return false; ";
4527 }
4528 } else {
4529 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4530 }
4531 $errSchemaPath = $currErrSchemaPath;
4532 it.errorPath = $currentErrorPath;
4533 out += " } else { ";
4534 } else {
4535 if ($breakOnError) {
4536 out += " if ( " + $useData + " === undefined ";
4537 if ($ownProperties) {
4538 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
4539 }
4540 out += ") { " + $nextValid + " = true; } else { ";
4541 } else {
4542 out += " if (" + $useData + " !== undefined ";
4543 if ($ownProperties) {
4544 out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
4545 }
4546 out += " ) { ";
4547 }
4548 }
4549 out += " " + $code + " } ";
4550 }
4551 }
4552 if ($breakOnError) {
4553 out += " if (" + $nextValid + ") { ";
4554 $closingBraces += "}";
4555 }
4556 }
4557 }
4558 }
4559 if ($pPropertyKeys.length) {
4560 var arr4 = $pPropertyKeys;
4561 if (arr4) {
4562 var $pProperty, i4 = -1, l4 = arr4.length - 1;
4563 while (i4 < l4) {
4564 $pProperty = arr4[i4 += 1];
4565 var $sch = $pProperties[$pProperty];
4566 if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) {
4567 $it.schema = $sch;
4568 $it.schemaPath = it.schemaPath + ".patternProperties" + it.util.getProperty($pProperty);
4569 $it.errSchemaPath = it.errSchemaPath + "/patternProperties/" + it.util.escapeFragment($pProperty);
4570 if ($ownProperties) {
4571 out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; ";
4572 } else {
4573 out += " for (var " + $key + " in " + $data + ") { ";
4574 }
4575 out += " if (" + it.usePattern($pProperty) + ".test(" + $key + ")) { ";
4576 $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
4577 var $passData = $data + "[" + $key + "]";
4578 $it.dataPathArr[$dataNxt] = $key;
4579 var $code = it.validate($it);
4580 $it.baseId = $currentBaseId;
4581 if (it.util.varOccurences($code, $nextData) < 2) {
4582 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
4583 } else {
4584 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
4585 }
4586 if ($breakOnError) {
4587 out += " if (!" + $nextValid + ") break; ";
4588 }
4589 out += " } ";
4590 if ($breakOnError) {
4591 out += " else " + $nextValid + " = true; ";
4592 }
4593 out += " } ";
4594 if ($breakOnError) {
4595 out += " if (" + $nextValid + ") { ";
4596 $closingBraces += "}";
4597 }
4598 }
4599 }
4600 }
4601 }
4602 if ($breakOnError) {
4603 out += " " + $closingBraces + " if (" + $errs + " == errors) {";
4604 }
4605 return out;
4606 };
4607});
4608
4609// node_modules/ajv/lib/dotjs/propertyNames.js
4610var require_propertyNames = __commonJS((exports, module) => {
4611 module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
4612 var out = " ";
4613 var $lvl = it.level;
4614 var $dataLvl = it.dataLevel;
4615 var $schema = it.schema[$keyword];
4616 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4617 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4618 var $breakOnError = !it.opts.allErrors;
4619 var $data = "data" + ($dataLvl || "");
4620 var $errs = "errs__" + $lvl;
4621 var $it = it.util.copy(it);
4622 var $closingBraces = "";
4623 $it.level++;
4624 var $nextValid = "valid" + $it.level;
4625 out += "var " + $errs + " = errors;";
4626 if (it.opts.strictKeywords ? typeof $schema == "object" && Object.keys($schema).length > 0 || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)) {
4627 $it.schema = $schema;
4628 $it.schemaPath = $schemaPath;
4629 $it.errSchemaPath = $errSchemaPath;
4630 var $key = "key" + $lvl, $idx = "idx" + $lvl, $i = "i" + $lvl, $invalidName = "' + " + $key + " + '", $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId;
4631 if ($ownProperties) {
4632 out += " var " + $dataProperties + " = undefined; ";
4633 }
4634 if ($ownProperties) {
4635 out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; ";
4636 } else {
4637 out += " for (var " + $key + " in " + $data + ") { ";
4638 }
4639 out += " var startErrs" + $lvl + " = errors; ";
4640 var $passData = $key;
4641 var $wasComposite = it.compositeRule;
4642 it.compositeRule = $it.compositeRule = true;
4643 var $code = it.validate($it);
4644 $it.baseId = $currentBaseId;
4645 if (it.util.varOccurences($code, $nextData) < 2) {
4646 out += " " + it.util.varReplace($code, $nextData, $passData) + " ";
4647 } else {
4648 out += " var " + $nextData + " = " + $passData + "; " + $code + " ";
4649 }
4650 it.compositeRule = $it.compositeRule = $wasComposite;
4651 out += " if (!" + $nextValid + ") { for (var " + $i + "=startErrs" + $lvl + "; " + $i + "<errors; " + $i + "++) { vErrors[" + $i + "].propertyName = " + $key + "; } var err = ";
4652 if (it.createErrors !== false) {
4653 out += " { keyword: '" + "propertyNames" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { propertyName: '" + $invalidName + "' } ";
4654 if (it.opts.messages !== false) {
4655 out += " , message: 'property name \\'" + $invalidName + "\\' is invalid' ";
4656 }
4657 if (it.opts.verbose) {
4658 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4659 }
4660 out += " } ";
4661 } else {
4662 out += " {} ";
4663 }
4664 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4665 if (!it.compositeRule && $breakOnError) {
4666 if (it.async) {
4667 out += " throw new ValidationError(vErrors); ";
4668 } else {
4669 out += " validate.errors = vErrors; return false; ";
4670 }
4671 }
4672 if ($breakOnError) {
4673 out += " break; ";
4674 }
4675 out += " } }";
4676 }
4677 if ($breakOnError) {
4678 out += " " + $closingBraces + " if (" + $errs + " == errors) {";
4679 }
4680 return out;
4681 };
4682});
4683
4684// node_modules/ajv/lib/dotjs/required.js
4685var require_required = __commonJS((exports, module) => {
4686 module.exports = function generate_required(it, $keyword, $ruleType) {
4687 var out = " ";
4688 var $lvl = it.level;
4689 var $dataLvl = it.dataLevel;
4690 var $schema = it.schema[$keyword];
4691 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4692 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4693 var $breakOnError = !it.opts.allErrors;
4694 var $data = "data" + ($dataLvl || "");
4695 var $valid = "valid" + $lvl;
4696 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
4697 if ($isData) {
4698 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
4699 $schemaValue = "schema" + $lvl;
4700 } else {
4701 $schemaValue = $schema;
4702 }
4703 var $vSchema = "schema" + $lvl;
4704 if (!$isData) {
4705 if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
4706 var $required = [];
4707 var arr1 = $schema;
4708 if (arr1) {
4709 var $property, i1 = -1, l1 = arr1.length - 1;
4710 while (i1 < l1) {
4711 $property = arr1[i1 += 1];
4712 var $propertySch = it.schema.properties[$property];
4713 if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == "object" && Object.keys($propertySch).length > 0 || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
4714 $required[$required.length] = $property;
4715 }
4716 }
4717 }
4718 } else {
4719 var $required = $schema;
4720 }
4721 }
4722 if ($isData || $required.length) {
4723 var $currentErrorPath = it.errorPath, $loopRequired = $isData || $required.length >= it.opts.loopRequired, $ownProperties = it.opts.ownProperties;
4724 if ($breakOnError) {
4725 out += " var missing" + $lvl + "; ";
4726 if ($loopRequired) {
4727 if (!$isData) {
4728 out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; ";
4729 }
4730 var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '";
4731 if (it.opts._errorDataPathProperty) {
4732 it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
4733 }
4734 out += " var " + $valid + " = true; ";
4735 if ($isData) {
4736 out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {";
4737 }
4738 out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { " + $valid + " = " + $data + "[" + $vSchema + "[" + $i + "]] !== undefined ";
4739 if ($ownProperties) {
4740 out += " && Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) ";
4741 }
4742 out += "; if (!" + $valid + ") break; } ";
4743 if ($isData) {
4744 out += " } ";
4745 }
4746 out += " if (!" + $valid + ") { ";
4747 var $$outStack = $$outStack || [];
4748 $$outStack.push(out);
4749 out = "";
4750 if (it.createErrors !== false) {
4751 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4752 if (it.opts.messages !== false) {
4753 out += " , message: '";
4754 if (it.opts._errorDataPathProperty) {
4755 out += "is a required property";
4756 } else {
4757 out += "should have required property \\'" + $missingProperty + "\\'";
4758 }
4759 out += "' ";
4760 }
4761 if (it.opts.verbose) {
4762 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4763 }
4764 out += " } ";
4765 } else {
4766 out += " {} ";
4767 }
4768 var __err = out;
4769 out = $$outStack.pop();
4770 if (!it.compositeRule && $breakOnError) {
4771 if (it.async) {
4772 out += " throw new ValidationError([" + __err + "]); ";
4773 } else {
4774 out += " validate.errors = [" + __err + "]; return false; ";
4775 }
4776 } else {
4777 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4778 }
4779 out += " } else { ";
4780 } else {
4781 out += " if ( ";
4782 var arr2 = $required;
4783 if (arr2) {
4784 var $propertyKey, $i = -1, l2 = arr2.length - 1;
4785 while ($i < l2) {
4786 $propertyKey = arr2[$i += 1];
4787 if ($i) {
4788 out += " || ";
4789 }
4790 var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop;
4791 out += " ( ( " + $useData + " === undefined ";
4792 if ($ownProperties) {
4793 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
4794 }
4795 out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) ";
4796 }
4797 }
4798 out += ") { ";
4799 var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '";
4800 if (it.opts._errorDataPathProperty) {
4801 it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath;
4802 }
4803 var $$outStack = $$outStack || [];
4804 $$outStack.push(out);
4805 out = "";
4806 if (it.createErrors !== false) {
4807 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4808 if (it.opts.messages !== false) {
4809 out += " , message: '";
4810 if (it.opts._errorDataPathProperty) {
4811 out += "is a required property";
4812 } else {
4813 out += "should have required property \\'" + $missingProperty + "\\'";
4814 }
4815 out += "' ";
4816 }
4817 if (it.opts.verbose) {
4818 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4819 }
4820 out += " } ";
4821 } else {
4822 out += " {} ";
4823 }
4824 var __err = out;
4825 out = $$outStack.pop();
4826 if (!it.compositeRule && $breakOnError) {
4827 if (it.async) {
4828 out += " throw new ValidationError([" + __err + "]); ";
4829 } else {
4830 out += " validate.errors = [" + __err + "]; return false; ";
4831 }
4832 } else {
4833 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
4834 }
4835 out += " } else { ";
4836 }
4837 } else {
4838 if ($loopRequired) {
4839 if (!$isData) {
4840 out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; ";
4841 }
4842 var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '";
4843 if (it.opts._errorDataPathProperty) {
4844 it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
4845 }
4846 if ($isData) {
4847 out += " if (" + $vSchema + " && !Array.isArray(" + $vSchema + ")) { var err = ";
4848 if (it.createErrors !== false) {
4849 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4850 if (it.opts.messages !== false) {
4851 out += " , message: '";
4852 if (it.opts._errorDataPathProperty) {
4853 out += "is a required property";
4854 } else {
4855 out += "should have required property \\'" + $missingProperty + "\\'";
4856 }
4857 out += "' ";
4858 }
4859 if (it.opts.verbose) {
4860 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4861 }
4862 out += " } ";
4863 } else {
4864 out += " {} ";
4865 }
4866 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (" + $vSchema + " !== undefined) { ";
4867 }
4868 out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { if (" + $data + "[" + $vSchema + "[" + $i + "]] === undefined ";
4869 if ($ownProperties) {
4870 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) ";
4871 }
4872 out += ") { var err = ";
4873 if (it.createErrors !== false) {
4874 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4875 if (it.opts.messages !== false) {
4876 out += " , message: '";
4877 if (it.opts._errorDataPathProperty) {
4878 out += "is a required property";
4879 } else {
4880 out += "should have required property \\'" + $missingProperty + "\\'";
4881 }
4882 out += "' ";
4883 }
4884 if (it.opts.verbose) {
4885 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4886 }
4887 out += " } ";
4888 } else {
4889 out += " {} ";
4890 }
4891 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ";
4892 if ($isData) {
4893 out += " } ";
4894 }
4895 } else {
4896 var arr3 = $required;
4897 if (arr3) {
4898 var $propertyKey, i3 = -1, l3 = arr3.length - 1;
4899 while (i3 < l3) {
4900 $propertyKey = arr3[i3 += 1];
4901 var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop;
4902 if (it.opts._errorDataPathProperty) {
4903 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
4904 }
4905 out += " if ( " + $useData + " === undefined ";
4906 if ($ownProperties) {
4907 out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') ";
4908 }
4909 out += ") { var err = ";
4910 if (it.createErrors !== false) {
4911 out += " { keyword: '" + "required" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } ";
4912 if (it.opts.messages !== false) {
4913 out += " , message: '";
4914 if (it.opts._errorDataPathProperty) {
4915 out += "is a required property";
4916 } else {
4917 out += "should have required property \\'" + $missingProperty + "\\'";
4918 }
4919 out += "' ";
4920 }
4921 if (it.opts.verbose) {
4922 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4923 }
4924 out += " } ";
4925 } else {
4926 out += " {} ";
4927 }
4928 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ";
4929 }
4930 }
4931 }
4932 }
4933 it.errorPath = $currentErrorPath;
4934 } else if ($breakOnError) {
4935 out += " if (true) {";
4936 }
4937 return out;
4938 };
4939});
4940
4941// node_modules/ajv/lib/dotjs/uniqueItems.js
4942var require_uniqueItems = __commonJS((exports, module) => {
4943 module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
4944 var out = " ";
4945 var $lvl = it.level;
4946 var $dataLvl = it.dataLevel;
4947 var $schema = it.schema[$keyword];
4948 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
4949 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
4950 var $breakOnError = !it.opts.allErrors;
4951 var $data = "data" + ($dataLvl || "");
4952 var $valid = "valid" + $lvl;
4953 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
4954 if ($isData) {
4955 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
4956 $schemaValue = "schema" + $lvl;
4957 } else {
4958 $schemaValue = $schema;
4959 }
4960 if (($schema || $isData) && it.opts.uniqueItems !== false) {
4961 if ($isData) {
4962 out += " var " + $valid + "; if (" + $schemaValue + " === false || " + $schemaValue + " === undefined) " + $valid + " = true; else if (typeof " + $schemaValue + " != 'boolean') " + $valid + " = false; else { ";
4963 }
4964 out += " var i = " + $data + ".length , " + $valid + " = true , j; if (i > 1) { ";
4965 var $itemType = it.schema.items && it.schema.items.type, $typeIsArray = Array.isArray($itemType);
4966 if (!$itemType || $itemType == "object" || $itemType == "array" || $typeIsArray && ($itemType.indexOf("object") >= 0 || $itemType.indexOf("array") >= 0)) {
4967 out += " outer: for (;i--;) { for (j = i; j--;) { if (equal(" + $data + "[i], " + $data + "[j])) { " + $valid + " = false; break outer; } } } ";
4968 } else {
4969 out += " var itemIndices = {}, item; for (;i--;) { var item = " + $data + "[i]; ";
4970 var $method = "checkDataType" + ($typeIsArray ? "s" : "");
4971 out += " if (" + it.util[$method]($itemType, "item", it.opts.strictNumbers, true) + ") continue; ";
4972 if ($typeIsArray) {
4973 out += ` if (typeof item == 'string') item = '"' + item; `;
4974 }
4975 out += " if (typeof itemIndices[item] == 'number') { " + $valid + " = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ";
4976 }
4977 out += " } ";
4978 if ($isData) {
4979 out += " } ";
4980 }
4981 out += " if (!" + $valid + ") { ";
4982 var $$outStack = $$outStack || [];
4983 $$outStack.push(out);
4984 out = "";
4985 if (it.createErrors !== false) {
4986 out += " { keyword: '" + "uniqueItems" + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { i: i, j: j } ";
4987 if (it.opts.messages !== false) {
4988 out += " , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";
4989 }
4990 if (it.opts.verbose) {
4991 out += " , schema: ";
4992 if ($isData) {
4993 out += "validate.schema" + $schemaPath;
4994 } else {
4995 out += "" + $schema;
4996 }
4997 out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
4998 }
4999 out += " } ";
5000 } else {
5001 out += " {} ";
5002 }
5003 var __err = out;
5004 out = $$outStack.pop();
5005 if (!it.compositeRule && $breakOnError) {
5006 if (it.async) {
5007 out += " throw new ValidationError([" + __err + "]); ";
5008 } else {
5009 out += " validate.errors = [" + __err + "]; return false; ";
5010 }
5011 } else {
5012 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
5013 }
5014 out += " } ";
5015 if ($breakOnError) {
5016 out += " else { ";
5017 }
5018 } else {
5019 if ($breakOnError) {
5020 out += " if (true) { ";
5021 }
5022 }
5023 return out;
5024 };
5025});
5026
5027// node_modules/ajv/lib/dotjs/index.js
5028var require_dotjs = __commonJS((exports, module) => {
5029 module.exports = {
5030 $ref: require_ref(),
5031 allOf: require_allOf(),
5032 anyOf: require_anyOf(),
5033 $comment: require_comment(),
5034 const: require_const(),
5035 contains: require_contains(),
5036 dependencies: require_dependencies(),
5037 enum: require_enum(),
5038 format: require_format(),
5039 if: require_if(),
5040 items: require_items(),
5041 maximum: require__limit(),
5042 minimum: require__limit(),
5043 maxItems: require__limitItems(),
5044 minItems: require__limitItems(),
5045 maxLength: require__limitLength(),
5046 minLength: require__limitLength(),
5047 maxProperties: require__limitProperties(),
5048 minProperties: require__limitProperties(),
5049 multipleOf: require_multipleOf(),
5050 not: require_not(),
5051 oneOf: require_oneOf(),
5052 pattern: require_pattern(),
5053 properties: require_properties(),
5054 propertyNames: require_propertyNames(),
5055 required: require_required(),
5056 uniqueItems: require_uniqueItems(),
5057 validate: require_validate()
5058 };
5059});
5060
5061// node_modules/ajv/lib/compile/rules.js
5062var require_rules = __commonJS((exports, module) => {
5063 var ruleModules = require_dotjs();
5064 var toHash = require_util().toHash;
5065 module.exports = function rules() {
5066 var RULES = [
5067 {
5068 type: "number",
5069 rules: [
5070 { maximum: ["exclusiveMaximum"] },
5071 { minimum: ["exclusiveMinimum"] },
5072 "multipleOf",
5073 "format"
5074 ]
5075 },
5076 {
5077 type: "string",
5078 rules: ["maxLength", "minLength", "pattern", "format"]
5079 },
5080 {
5081 type: "array",
5082 rules: ["maxItems", "minItems", "items", "contains", "uniqueItems"]
5083 },
5084 {
5085 type: "object",
5086 rules: [
5087 "maxProperties",
5088 "minProperties",
5089 "required",
5090 "dependencies",
5091 "propertyNames",
5092 { properties: ["additionalProperties", "patternProperties"] }
5093 ]
5094 },
5095 { rules: ["$ref", "const", "enum", "not", "anyOf", "oneOf", "allOf", "if"] }
5096 ];
5097 var ALL = ["type", "$comment"];
5098 var KEYWORDS = [
5099 "$schema",
5100 "$id",
5101 "id",
5102 "$data",
5103 "$async",
5104 "title",
5105 "description",
5106 "default",
5107 "definitions",
5108 "examples",
5109 "readOnly",
5110 "writeOnly",
5111 "contentMediaType",
5112 "contentEncoding",
5113 "additionalItems",
5114 "then",
5115 "else"
5116 ];
5117 var TYPES = ["number", "integer", "string", "array", "object", "boolean", "null"];
5118 RULES.all = toHash(ALL);
5119 RULES.types = toHash(TYPES);
5120 RULES.forEach(function(group) {
5121 group.rules = group.rules.map(function(keyword) {
5122 var implKeywords;
5123 if (typeof keyword == "object") {
5124 var key = Object.keys(keyword)[0];
5125 implKeywords = keyword[key];
5126 keyword = key;
5127 implKeywords.forEach(function(k) {
5128 ALL.push(k);
5129 RULES.all[k] = true;
5130 });
5131 }
5132 ALL.push(keyword);
5133 var rule = RULES.all[keyword] = {
5134 keyword,
5135 code: ruleModules[keyword],
5136 implements: implKeywords
5137 };
5138 return rule;
5139 });
5140 RULES.all.$comment = {
5141 keyword: "$comment",
5142 code: ruleModules.$comment
5143 };
5144 if (group.type)
5145 RULES.types[group.type] = group;
5146 });
5147 RULES.keywords = toHash(ALL.concat(KEYWORDS));
5148 RULES.custom = {};
5149 return RULES;
5150 };
5151});
5152
5153// node_modules/ajv/lib/data.js
5154var require_data = __commonJS((exports, module) => {
5155 var KEYWORDS = [
5156 "multipleOf",
5157 "maximum",
5158 "exclusiveMaximum",
5159 "minimum",
5160 "exclusiveMinimum",
5161 "maxLength",
5162 "minLength",
5163 "pattern",
5164 "additionalItems",
5165 "maxItems",
5166 "minItems",
5167 "uniqueItems",
5168 "maxProperties",
5169 "minProperties",
5170 "required",
5171 "additionalProperties",
5172 "enum",
5173 "format",
5174 "const"
5175 ];
5176 module.exports = function(metaSchema, keywordsJsonPointers) {
5177 for (var i = 0;i < keywordsJsonPointers.length; i++) {
5178 metaSchema = JSON.parse(JSON.stringify(metaSchema));
5179 var segments = keywordsJsonPointers[i].split("/");
5180 var keywords = metaSchema;
5181 var j;
5182 for (j = 1;j < segments.length; j++)
5183 keywords = keywords[segments[j]];
5184 for (j = 0;j < KEYWORDS.length; j++) {
5185 var key = KEYWORDS[j];
5186 var schema = keywords[key];
5187 if (schema) {
5188 keywords[key] = {
5189 anyOf: [
5190 schema,
5191 { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" }
5192 ]
5193 };
5194 }
5195 }
5196 }
5197 return metaSchema;
5198 };
5199});
5200
5201// node_modules/ajv/lib/compile/async.js
5202var require_async = __commonJS((exports, module) => {
5203 var MissingRefError = require_error_classes().MissingRef;
5204 module.exports = compileAsync;
5205 function compileAsync(schema, meta, callback) {
5206 var self = this;
5207 if (typeof this._opts.loadSchema != "function")
5208 throw new Error("options.loadSchema should be a function");
5209 if (typeof meta == "function") {
5210 callback = meta;
5211 meta = undefined;
5212 }
5213 var p = loadMetaSchemaOf(schema).then(function() {
5214 var schemaObj = self._addSchema(schema, undefined, meta);
5215 return schemaObj.validate || _compileAsync(schemaObj);
5216 });
5217 if (callback) {
5218 p.then(function(v) {
5219 callback(null, v);
5220 }, callback);
5221 }
5222 return p;
5223 function loadMetaSchemaOf(sch) {
5224 var $schema = sch.$schema;
5225 return $schema && !self.getSchema($schema) ? compileAsync.call(self, { $ref: $schema }, true) : Promise.resolve();
5226 }
5227 function _compileAsync(schemaObj) {
5228 try {
5229 return self._compile(schemaObj);
5230 } catch (e) {
5231 if (e instanceof MissingRefError)
5232 return loadMissingSchema(e);
5233 throw e;
5234 }
5235 function loadMissingSchema(e) {
5236 var ref = e.missingSchema;
5237 if (added(ref))
5238 throw new Error("Schema " + ref + " is loaded but " + e.missingRef + " cannot be resolved");
5239 var schemaPromise = self._loadingSchemas[ref];
5240 if (!schemaPromise) {
5241 schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
5242 schemaPromise.then(removePromise, removePromise);
5243 }
5244 return schemaPromise.then(function(sch) {
5245 if (!added(ref)) {
5246 return loadMetaSchemaOf(sch).then(function() {
5247 if (!added(ref))
5248 self.addSchema(sch, ref, undefined, meta);
5249 });
5250 }
5251 }).then(function() {
5252 return _compileAsync(schemaObj);
5253 });
5254 function removePromise() {
5255 delete self._loadingSchemas[ref];
5256 }
5257 function added(ref2) {
5258 return self._refs[ref2] || self._schemas[ref2];
5259 }
5260 }
5261 }
5262 }
5263});
5264
5265// node_modules/ajv/lib/dotjs/custom.js
5266var require_custom = __commonJS((exports, module) => {
5267 module.exports = function generate_custom(it, $keyword, $ruleType) {
5268 var out = " ";
5269 var $lvl = it.level;
5270 var $dataLvl = it.dataLevel;
5271 var $schema = it.schema[$keyword];
5272 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
5273 var $errSchemaPath = it.errSchemaPath + "/" + $keyword;
5274 var $breakOnError = !it.opts.allErrors;
5275 var $errorKeyword;
5276 var $data = "data" + ($dataLvl || "");
5277 var $valid = "valid" + $lvl;
5278 var $errs = "errs__" + $lvl;
5279 var $isData = it.opts.$data && $schema && $schema.$data, $schemaValue;
5280 if ($isData) {
5281 out += " var schema" + $lvl + " = " + it.util.getData($schema.$data, $dataLvl, it.dataPathArr) + "; ";
5282 $schemaValue = "schema" + $lvl;
5283 } else {
5284 $schemaValue = $schema;
5285 }
5286 var $rule = this, $definition = "definition" + $lvl, $rDef = $rule.definition, $closingBraces = "";
5287 var $compile, $inline, $macro, $ruleValidate, $validateCode;
5288 if ($isData && $rDef.$data) {
5289 $validateCode = "keywordValidate" + $lvl;
5290 var $validateSchema = $rDef.validateSchema;
5291 out += " var " + $definition + " = RULES.custom['" + $keyword + "'].definition; var " + $validateCode + " = " + $definition + ".validate;";
5292 } else {
5293 $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
5294 if (!$ruleValidate)
5295 return;
5296 $schemaValue = "validate.schema" + $schemaPath;
5297 $validateCode = $ruleValidate.code;
5298 $compile = $rDef.compile;
5299 $inline = $rDef.inline;
5300 $macro = $rDef.macro;
5301 }
5302 var $ruleErrs = $validateCode + ".errors", $i = "i" + $lvl, $ruleErr = "ruleErr" + $lvl, $asyncKeyword = $rDef.async;
5303 if ($asyncKeyword && !it.async)
5304 throw new Error("async keyword in sync schema");
5305 if (!($inline || $macro)) {
5306 out += "" + $ruleErrs + " = null;";
5307 }
5308 out += "var " + $errs + " = errors;var " + $valid + ";";
5309 if ($isData && $rDef.$data) {
5310 $closingBraces += "}";
5311 out += " if (" + $schemaValue + " === undefined) { " + $valid + " = true; } else { ";
5312 if ($validateSchema) {
5313 $closingBraces += "}";
5314 out += " " + $valid + " = " + $definition + ".validateSchema(" + $schemaValue + "); if (" + $valid + ") { ";
5315 }
5316 }
5317 if ($inline) {
5318 if ($rDef.statements) {
5319 out += " " + $ruleValidate.validate + " ";
5320 } else {
5321 out += " " + $valid + " = " + $ruleValidate.validate + "; ";
5322 }
5323 } else if ($macro) {
5324 var $it = it.util.copy(it);
5325 var $closingBraces = "";
5326 $it.level++;
5327 var $nextValid = "valid" + $it.level;
5328 $it.schema = $ruleValidate.validate;
5329 $it.schemaPath = "";
5330 var $wasComposite = it.compositeRule;
5331 it.compositeRule = $it.compositeRule = true;
5332 var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
5333 it.compositeRule = $it.compositeRule = $wasComposite;
5334 out += " " + $code;
5335 } else {
5336 var $$outStack = $$outStack || [];
5337 $$outStack.push(out);
5338 out = "";
5339 out += " " + $validateCode + ".call( ";
5340 if (it.opts.passContext) {
5341 out += "this";
5342 } else {
5343 out += "self";
5344 }
5345 if ($compile || $rDef.schema === false) {
5346 out += " , " + $data + " ";
5347 } else {
5348 out += " , " + $schemaValue + " , " + $data + " , validate.schema" + it.schemaPath + " ";
5349 }
5350 out += " , (dataPath || '')";
5351 if (it.errorPath != '""') {
5352 out += " + " + it.errorPath;
5353 }
5354 var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty";
5355 out += " , " + $parentData + " , " + $parentDataProperty + " , rootData ) ";
5356 var def_callRuleValidate = out;
5357 out = $$outStack.pop();
5358 if ($rDef.errors === false) {
5359 out += " " + $valid + " = ";
5360 if ($asyncKeyword) {
5361 out += "await ";
5362 }
5363 out += "" + def_callRuleValidate + "; ";
5364 } else {
5365 if ($asyncKeyword) {
5366 $ruleErrs = "customErrors" + $lvl;
5367 out += " var " + $ruleErrs + " = null; try { " + $valid + " = await " + def_callRuleValidate + "; } catch (e) { " + $valid + " = false; if (e instanceof ValidationError) " + $ruleErrs + " = e.errors; else throw e; } ";
5368 } else {
5369 out += " " + $ruleErrs + " = null; " + $valid + " = " + def_callRuleValidate + "; ";
5370 }
5371 }
5372 }
5373 if ($rDef.modifying) {
5374 out += " if (" + $parentData + ") " + $data + " = " + $parentData + "[" + $parentDataProperty + "];";
5375 }
5376 out += "" + $closingBraces;
5377 if ($rDef.valid) {
5378 if ($breakOnError) {
5379 out += " if (true) { ";
5380 }
5381 } else {
5382 out += " if ( ";
5383 if ($rDef.valid === undefined) {
5384 out += " !";
5385 if ($macro) {
5386 out += "" + $nextValid;
5387 } else {
5388 out += "" + $valid;
5389 }
5390 } else {
5391 out += " " + !$rDef.valid + " ";
5392 }
5393 out += ") { ";
5394 $errorKeyword = $rule.keyword;
5395 var $$outStack = $$outStack || [];
5396 $$outStack.push(out);
5397 out = "";
5398 var $$outStack = $$outStack || [];
5399 $$outStack.push(out);
5400 out = "";
5401 if (it.createErrors !== false) {
5402 out += " { keyword: '" + ($errorKeyword || "custom") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { keyword: '" + $rule.keyword + "' } ";
5403 if (it.opts.messages !== false) {
5404 out += ` , message: 'should pass "` + $rule.keyword + `" keyword validation' `;
5405 }
5406 if (it.opts.verbose) {
5407 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
5408 }
5409 out += " } ";
5410 } else {
5411 out += " {} ";
5412 }
5413 var __err = out;
5414 out = $$outStack.pop();
5415 if (!it.compositeRule && $breakOnError) {
5416 if (it.async) {
5417 out += " throw new ValidationError([" + __err + "]); ";
5418 } else {
5419 out += " validate.errors = [" + __err + "]; return false; ";
5420 }
5421 } else {
5422 out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
5423 }
5424 var def_customError = out;
5425 out = $$outStack.pop();
5426 if ($inline) {
5427 if ($rDef.errors) {
5428 if ($rDef.errors != "full") {
5429 out += " for (var " + $i + "=" + $errs + "; " + $i + "<errors; " + $i + "++) { var " + $ruleErr + " = vErrors[" + $i + "]; if (" + $ruleErr + ".dataPath === undefined) " + $ruleErr + ".dataPath = (dataPath || '') + " + it.errorPath + "; if (" + $ruleErr + ".schemaPath === undefined) { " + $ruleErr + '.schemaPath = "' + $errSchemaPath + '"; } ';
5430 if (it.opts.verbose) {
5431 out += " " + $ruleErr + ".schema = " + $schemaValue + "; " + $ruleErr + ".data = " + $data + "; ";
5432 }
5433 out += " } ";
5434 }
5435 } else {
5436 if ($rDef.errors === false) {
5437 out += " " + def_customError + " ";
5438 } else {
5439 out += " if (" + $errs + " == errors) { " + def_customError + " } else { for (var " + $i + "=" + $errs + "; " + $i + "<errors; " + $i + "++) { var " + $ruleErr + " = vErrors[" + $i + "]; if (" + $ruleErr + ".dataPath === undefined) " + $ruleErr + ".dataPath = (dataPath || '') + " + it.errorPath + "; if (" + $ruleErr + ".schemaPath === undefined) { " + $ruleErr + '.schemaPath = "' + $errSchemaPath + '"; } ';
5440 if (it.opts.verbose) {
5441 out += " " + $ruleErr + ".schema = " + $schemaValue + "; " + $ruleErr + ".data = " + $data + "; ";
5442 }
5443 out += " } } ";
5444 }
5445 }
5446 } else if ($macro) {
5447 out += " var err = ";
5448 if (it.createErrors !== false) {
5449 out += " { keyword: '" + ($errorKeyword || "custom") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { keyword: '" + $rule.keyword + "' } ";
5450 if (it.opts.messages !== false) {
5451 out += ` , message: 'should pass "` + $rule.keyword + `" keyword validation' `;
5452 }
5453 if (it.opts.verbose) {
5454 out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " ";
5455 }
5456 out += " } ";
5457 } else {
5458 out += " {} ";
5459 }
5460 out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";
5461 if (!it.compositeRule && $breakOnError) {
5462 if (it.async) {
5463 out += " throw new ValidationError(vErrors); ";
5464 } else {
5465 out += " validate.errors = vErrors; return false; ";
5466 }
5467 }
5468 } else {
5469 if ($rDef.errors === false) {
5470 out += " " + def_customError + " ";
5471 } else {
5472 out += " if (Array.isArray(" + $ruleErrs + ")) { if (vErrors === null) vErrors = " + $ruleErrs + "; else vErrors = vErrors.concat(" + $ruleErrs + "); errors = vErrors.length; for (var " + $i + "=" + $errs + "; " + $i + "<errors; " + $i + "++) { var " + $ruleErr + " = vErrors[" + $i + "]; if (" + $ruleErr + ".dataPath === undefined) " + $ruleErr + ".dataPath = (dataPath || '') + " + it.errorPath + "; " + $ruleErr + '.schemaPath = "' + $errSchemaPath + '"; ';
5473 if (it.opts.verbose) {
5474 out += " " + $ruleErr + ".schema = " + $schemaValue + "; " + $ruleErr + ".data = " + $data + "; ";
5475 }
5476 out += " } } else { " + def_customError + " } ";
5477 }
5478 }
5479 out += " } ";
5480 if ($breakOnError) {
5481 out += " else { ";
5482 }
5483 }
5484 return out;
5485 };
5486});
5487
5488// node_modules/ajv/lib/refs/json-schema-draft-07.json
5489var require_json_schema_draft_07 = __commonJS((exports, module) => {
5490 module.exports = {
5491 $schema: "http://json-schema.org/draft-07/schema#",
5492 $id: "http://json-schema.org/draft-07/schema#",
5493 title: "Core schema meta-schema",
5494 definitions: {
5495 schemaArray: {
5496 type: "array",
5497 minItems: 1,
5498 items: { $ref: "#" }
5499 },
5500 nonNegativeInteger: {
5501 type: "integer",
5502 minimum: 0
5503 },
5504 nonNegativeIntegerDefault0: {
5505 allOf: [
5506 { $ref: "#/definitions/nonNegativeInteger" },
5507 { default: 0 }
5508 ]
5509 },
5510 simpleTypes: {
5511 enum: [
5512 "array",
5513 "boolean",
5514 "integer",
5515 "null",
5516 "number",
5517 "object",
5518 "string"
5519 ]
5520 },
5521 stringArray: {
5522 type: "array",
5523 items: { type: "string" },
5524 uniqueItems: true,
5525 default: []
5526 }
5527 },
5528 type: ["object", "boolean"],
5529 properties: {
5530 $id: {
5531 type: "string",
5532 format: "uri-reference"
5533 },
5534 $schema: {
5535 type: "string",
5536 format: "uri"
5537 },
5538 $ref: {
5539 type: "string",
5540 format: "uri-reference"
5541 },
5542 $comment: {
5543 type: "string"
5544 },
5545 title: {
5546 type: "string"
5547 },
5548 description: {
5549 type: "string"
5550 },
5551 default: true,
5552 readOnly: {
5553 type: "boolean",
5554 default: false
5555 },
5556 examples: {
5557 type: "array",
5558 items: true
5559 },
5560 multipleOf: {
5561 type: "number",
5562 exclusiveMinimum: 0
5563 },
5564 maximum: {
5565 type: "number"
5566 },
5567 exclusiveMaximum: {
5568 type: "number"
5569 },
5570 minimum: {
5571 type: "number"
5572 },
5573 exclusiveMinimum: {
5574 type: "number"
5575 },
5576 maxLength: { $ref: "#/definitions/nonNegativeInteger" },
5577 minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
5578 pattern: {
5579 type: "string",
5580 format: "regex"
5581 },
5582 additionalItems: { $ref: "#" },
5583 items: {
5584 anyOf: [
5585 { $ref: "#" },
5586 { $ref: "#/definitions/schemaArray" }
5587 ],
5588 default: true
5589 },
5590 maxItems: { $ref: "#/definitions/nonNegativeInteger" },
5591 minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
5592 uniqueItems: {
5593 type: "boolean",
5594 default: false
5595 },
5596 contains: { $ref: "#" },
5597 maxProperties: { $ref: "#/definitions/nonNegativeInteger" },
5598 minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
5599 required: { $ref: "#/definitions/stringArray" },
5600 additionalProperties: { $ref: "#" },
5601 definitions: {
5602 type: "object",
5603 additionalProperties: { $ref: "#" },
5604 default: {}
5605 },
5606 properties: {
5607 type: "object",
5608 additionalProperties: { $ref: "#" },
5609 default: {}
5610 },
5611 patternProperties: {
5612 type: "object",
5613 additionalProperties: { $ref: "#" },
5614 propertyNames: { format: "regex" },
5615 default: {}
5616 },
5617 dependencies: {
5618 type: "object",
5619 additionalProperties: {
5620 anyOf: [
5621 { $ref: "#" },
5622 { $ref: "#/definitions/stringArray" }
5623 ]
5624 }
5625 },
5626 propertyNames: { $ref: "#" },
5627 const: true,
5628 enum: {
5629 type: "array",
5630 items: true,
5631 minItems: 1,
5632 uniqueItems: true
5633 },
5634 type: {
5635 anyOf: [
5636 { $ref: "#/definitions/simpleTypes" },
5637 {
5638 type: "array",
5639 items: { $ref: "#/definitions/simpleTypes" },
5640 minItems: 1,
5641 uniqueItems: true
5642 }
5643 ]
5644 },
5645 format: { type: "string" },
5646 contentMediaType: { type: "string" },
5647 contentEncoding: { type: "string" },
5648 if: { $ref: "#" },
5649 then: { $ref: "#" },
5650 else: { $ref: "#" },
5651 allOf: { $ref: "#/definitions/schemaArray" },
5652 anyOf: { $ref: "#/definitions/schemaArray" },
5653 oneOf: { $ref: "#/definitions/schemaArray" },
5654 not: { $ref: "#" }
5655 },
5656 default: true
5657 };
5658});
5659
5660// node_modules/ajv/lib/definition_schema.js
5661var require_definition_schema = __commonJS((exports, module) => {
5662 var metaSchema = require_json_schema_draft_07();
5663 module.exports = {
5664 $id: "https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",
5665 definitions: {
5666 simpleTypes: metaSchema.definitions.simpleTypes
5667 },
5668 type: "object",
5669 dependencies: {
5670 schema: ["validate"],
5671 $data: ["validate"],
5672 statements: ["inline"],
5673 valid: { not: { required: ["macro"] } }
5674 },
5675 properties: {
5676 type: metaSchema.properties.type,
5677 schema: { type: "boolean" },
5678 statements: { type: "boolean" },
5679 dependencies: {
5680 type: "array",
5681 items: { type: "string" }
5682 },
5683 metaSchema: { type: "object" },
5684 modifying: { type: "boolean" },
5685 valid: { type: "boolean" },
5686 $data: { type: "boolean" },
5687 async: { type: "boolean" },
5688 errors: {
5689 anyOf: [
5690 { type: "boolean" },
5691 { const: "full" }
5692 ]
5693 }
5694 }
5695 };
5696});
5697
5698// node_modules/ajv/lib/keyword.js
5699var require_keyword = __commonJS((exports, module) => {
5700 var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
5701 var customRuleCode = require_custom();
5702 var definitionSchema = require_definition_schema();
5703 module.exports = {
5704 add: addKeyword,
5705 get: getKeyword,
5706 remove: removeKeyword,
5707 validate: validateKeyword
5708 };
5709 function addKeyword(keyword, definition) {
5710 var RULES = this.RULES;
5711 if (RULES.keywords[keyword])
5712 throw new Error("Keyword " + keyword + " is already defined");
5713 if (!IDENTIFIER.test(keyword))
5714 throw new Error("Keyword " + keyword + " is not a valid identifier");
5715 if (definition) {
5716 this.validateKeyword(definition, true);
5717 var dataType = definition.type;
5718 if (Array.isArray(dataType)) {
5719 for (var i = 0;i < dataType.length; i++)
5720 _addRule(keyword, dataType[i], definition);
5721 } else {
5722 _addRule(keyword, dataType, definition);
5723 }
5724 var metaSchema = definition.metaSchema;
5725 if (metaSchema) {
5726 if (definition.$data && this._opts.$data) {
5727 metaSchema = {
5728 anyOf: [
5729 metaSchema,
5730 { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" }
5731 ]
5732 };
5733 }
5734 definition.validateSchema = this.compile(metaSchema, true);
5735 }
5736 }
5737 RULES.keywords[keyword] = RULES.all[keyword] = true;
5738 function _addRule(keyword2, dataType2, definition2) {
5739 var ruleGroup;
5740 for (var i2 = 0;i2 < RULES.length; i2++) {
5741 var rg = RULES[i2];
5742 if (rg.type == dataType2) {
5743 ruleGroup = rg;
5744 break;
5745 }
5746 }
5747 if (!ruleGroup) {
5748 ruleGroup = { type: dataType2, rules: [] };
5749 RULES.push(ruleGroup);
5750 }
5751 var rule = {
5752 keyword: keyword2,
5753 definition: definition2,
5754 custom: true,
5755 code: customRuleCode,
5756 implements: definition2.implements
5757 };
5758 ruleGroup.rules.push(rule);
5759 RULES.custom[keyword2] = rule;
5760 }
5761 return this;
5762 }
5763 function getKeyword(keyword) {
5764 var rule = this.RULES.custom[keyword];
5765 return rule ? rule.definition : this.RULES.keywords[keyword] || false;
5766 }
5767 function removeKeyword(keyword) {
5768 var RULES = this.RULES;
5769 delete RULES.keywords[keyword];
5770 delete RULES.all[keyword];
5771 delete RULES.custom[keyword];
5772 for (var i = 0;i < RULES.length; i++) {
5773 var rules = RULES[i].rules;
5774 for (var j = 0;j < rules.length; j++) {
5775 if (rules[j].keyword == keyword) {
5776 rules.splice(j, 1);
5777 break;
5778 }
5779 }
5780 }
5781 return this;
5782 }
5783 function validateKeyword(definition, throwError) {
5784 validateKeyword.errors = null;
5785 var v = this._validateKeyword = this._validateKeyword || this.compile(definitionSchema, true);
5786 if (v(definition))
5787 return true;
5788 validateKeyword.errors = v.errors;
5789 if (throwError)
5790 throw new Error("custom keyword definition is invalid: " + this.errorsText(v.errors));
5791 else
5792 return false;
5793 }
5794});
5795
5796// node_modules/ajv/lib/refs/data.json
5797var require_data2 = __commonJS((exports, module) => {
5798 module.exports = {
5799 $schema: "http://json-schema.org/draft-07/schema#",
5800 $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
5801 description: "Meta-schema for $data reference (JSON Schema extension proposal)",
5802 type: "object",
5803 required: ["$data"],
5804 properties: {
5805 $data: {
5806 type: "string",
5807 anyOf: [
5808 { format: "relative-json-pointer" },
5809 { format: "json-pointer" }
5810 ]
5811 }
5812 },
5813 additionalProperties: false
5814 };
5815});
5816
5817// node_modules/ajv/lib/ajv.js
5818var require_ajv = __commonJS((exports, module) => {
5819 var compileSchema = require_compile();
5820 var resolve = require_resolve();
5821 var Cache = require_cache();
5822 var SchemaObject = require_schema_obj();
5823 var stableStringify = require_fast_json_stable_stringify();
5824 var formats = require_formats();
5825 var rules = require_rules();
5826 var $dataMetaSchema = require_data();
5827 var util3 = require_util();
5828 module.exports = Ajv;
5829 Ajv.prototype.validate = validate;
5830 Ajv.prototype.compile = compile;
5831 Ajv.prototype.addSchema = addSchema;
5832 Ajv.prototype.addMetaSchema = addMetaSchema;
5833 Ajv.prototype.validateSchema = validateSchema;
5834 Ajv.prototype.getSchema = getSchema;
5835 Ajv.prototype.removeSchema = removeSchema;
5836 Ajv.prototype.addFormat = addFormat;
5837 Ajv.prototype.errorsText = errorsText;
5838 Ajv.prototype._addSchema = _addSchema;
5839 Ajv.prototype._compile = _compile;
5840 Ajv.prototype.compileAsync = require_async();
5841 var customKeyword = require_keyword();
5842 Ajv.prototype.addKeyword = customKeyword.add;
5843 Ajv.prototype.getKeyword = customKeyword.get;
5844 Ajv.prototype.removeKeyword = customKeyword.remove;
5845 Ajv.prototype.validateKeyword = customKeyword.validate;
5846 var errorClasses = require_error_classes();
5847 Ajv.ValidationError = errorClasses.Validation;
5848 Ajv.MissingRefError = errorClasses.MissingRef;
5849 Ajv.$dataMetaSchema = $dataMetaSchema;
5850 var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
5851 var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes", "strictDefaults"];
5852 var META_SUPPORT_DATA = ["/properties"];
5853 function Ajv(opts) {
5854 if (!(this instanceof Ajv))
5855 return new Ajv(opts);
5856 opts = this._opts = util3.copy(opts) || {};
5857 setLogger(this);
5858 this._schemas = {};
5859 this._refs = {};
5860 this._fragments = {};
5861 this._formats = formats(opts.format);
5862 this._cache = opts.cache || new Cache;
5863 this._loadingSchemas = {};
5864 this._compilations = [];
5865 this.RULES = rules();
5866 this._getId = chooseGetId(opts);
5867 opts.loopRequired = opts.loopRequired || Infinity;
5868 if (opts.errorDataPath == "property")
5869 opts._errorDataPathProperty = true;
5870 if (opts.serialize === undefined)
5871 opts.serialize = stableStringify;
5872 this._metaOpts = getMetaSchemaOptions(this);
5873 if (opts.formats)
5874 addInitialFormats(this);
5875 if (opts.keywords)
5876 addInitialKeywords(this);
5877 addDefaultMetaSchema(this);
5878 if (typeof opts.meta == "object")
5879 this.addMetaSchema(opts.meta);
5880 if (opts.nullable)
5881 this.addKeyword("nullable", { metaSchema: { type: "boolean" } });
5882 addInitialSchemas(this);
5883 }
5884 function validate(schemaKeyRef, data) {
5885 var v;
5886 if (typeof schemaKeyRef == "string") {
5887 v = this.getSchema(schemaKeyRef);
5888 if (!v)
5889 throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
5890 } else {
5891 var schemaObj = this._addSchema(schemaKeyRef);
5892 v = schemaObj.validate || this._compile(schemaObj);
5893 }
5894 var valid = v(data);
5895 if (v.$async !== true)
5896 this.errors = v.errors;
5897 return valid;
5898 }
5899 function compile(schema, _meta) {
5900 var schemaObj = this._addSchema(schema, undefined, _meta);
5901 return schemaObj.validate || this._compile(schemaObj);
5902 }
5903 function addSchema(schema, key, _skipValidation, _meta) {
5904 if (Array.isArray(schema)) {
5905 for (var i = 0;i < schema.length; i++)
5906 this.addSchema(schema[i], undefined, _skipValidation, _meta);
5907 return this;
5908 }
5909 var id = this._getId(schema);
5910 if (id !== undefined && typeof id != "string")
5911 throw new Error("schema id must be string");
5912 key = resolve.normalizeId(key || id);
5913 checkUnique(this, key);
5914 this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
5915 return this;
5916 }
5917 function addMetaSchema(schema, key, skipValidation) {
5918 this.addSchema(schema, key, skipValidation, true);
5919 return this;
5920 }
5921 function validateSchema(schema, throwOrLogError) {
5922 var $schema = schema.$schema;
5923 if ($schema !== undefined && typeof $schema != "string")
5924 throw new Error("$schema must be a string");
5925 $schema = $schema || this._opts.defaultMeta || defaultMeta(this);
5926 if (!$schema) {
5927 this.logger.warn("meta-schema not available");
5928 this.errors = null;
5929 return true;
5930 }
5931 var valid = this.validate($schema, schema);
5932 if (!valid && throwOrLogError) {
5933 var message = "schema is invalid: " + this.errorsText();
5934 if (this._opts.validateSchema == "log")
5935 this.logger.error(message);
5936 else
5937 throw new Error(message);
5938 }
5939 return valid;
5940 }
5941 function defaultMeta(self) {
5942 var meta = self._opts.meta;
5943 self._opts.defaultMeta = typeof meta == "object" ? self._getId(meta) || meta : self.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined;
5944 return self._opts.defaultMeta;
5945 }
5946 function getSchema(keyRef) {
5947 var schemaObj = _getSchemaObj(this, keyRef);
5948 switch (typeof schemaObj) {
5949 case "object":
5950 return schemaObj.validate || this._compile(schemaObj);
5951 case "string":
5952 return this.getSchema(schemaObj);
5953 case "undefined":
5954 return _getSchemaFragment(this, keyRef);
5955 }
5956 }
5957 function _getSchemaFragment(self, ref) {
5958 var res = resolve.schema.call(self, { schema: {} }, ref);
5959 if (res) {
5960 var { schema, root, baseId } = res;
5961 var v = compileSchema.call(self, schema, root, undefined, baseId);
5962 self._fragments[ref] = new SchemaObject({
5963 ref,
5964 fragment: true,
5965 schema,
5966 root,
5967 baseId,
5968 validate: v
5969 });
5970 return v;
5971 }
5972 }
5973 function _getSchemaObj(self, keyRef) {
5974 keyRef = resolve.normalizeId(keyRef);
5975 return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
5976 }
5977 function removeSchema(schemaKeyRef) {
5978 if (schemaKeyRef instanceof RegExp) {
5979 _removeAllSchemas(this, this._schemas, schemaKeyRef);
5980 _removeAllSchemas(this, this._refs, schemaKeyRef);
5981 return this;
5982 }
5983 switch (typeof schemaKeyRef) {
5984 case "undefined":
5985 _removeAllSchemas(this, this._schemas);
5986 _removeAllSchemas(this, this._refs);
5987 this._cache.clear();
5988 return this;
5989 case "string":
5990 var schemaObj = _getSchemaObj(this, schemaKeyRef);
5991 if (schemaObj)
5992 this._cache.del(schemaObj.cacheKey);
5993 delete this._schemas[schemaKeyRef];
5994 delete this._refs[schemaKeyRef];
5995 return this;
5996 case "object":
5997 var serialize = this._opts.serialize;
5998 var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
5999 this._cache.del(cacheKey);
6000 var id = this._getId(schemaKeyRef);
6001 if (id) {
6002 id = resolve.normalizeId(id);
6003 delete this._schemas[id];
6004 delete this._refs[id];
6005 }
6006 }
6007 return this;
6008 }
6009 function _removeAllSchemas(self, schemas, regex) {
6010 for (var keyRef in schemas) {
6011 var schemaObj = schemas[keyRef];
6012 if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
6013 self._cache.del(schemaObj.cacheKey);
6014 delete schemas[keyRef];
6015 }
6016 }
6017 }
6018 function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
6019 if (typeof schema != "object" && typeof schema != "boolean")
6020 throw new Error("schema should be object or boolean");
6021 var serialize = this._opts.serialize;
6022 var cacheKey = serialize ? serialize(schema) : schema;
6023 var cached = this._cache.get(cacheKey);
6024 if (cached)
6025 return cached;
6026 shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
6027 var id = resolve.normalizeId(this._getId(schema));
6028 if (id && shouldAddSchema)
6029 checkUnique(this, id);
6030 var willValidate = this._opts.validateSchema !== false && !skipValidation;
6031 var recursiveMeta;
6032 if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
6033 this.validateSchema(schema, true);
6034 var localRefs = resolve.ids.call(this, schema);
6035 var schemaObj = new SchemaObject({
6036 id,
6037 schema,
6038 localRefs,
6039 cacheKey,
6040 meta
6041 });
6042 if (id[0] != "#" && shouldAddSchema)
6043 this._refs[id] = schemaObj;
6044 this._cache.put(cacheKey, schemaObj);
6045 if (willValidate && recursiveMeta)
6046 this.validateSchema(schema, true);
6047 return schemaObj;
6048 }
6049 function _compile(schemaObj, root) {
6050 if (schemaObj.compiling) {
6051 schemaObj.validate = callValidate;
6052 callValidate.schema = schemaObj.schema;
6053 callValidate.errors = null;
6054 callValidate.root = root ? root : callValidate;
6055 if (schemaObj.schema.$async === true)
6056 callValidate.$async = true;
6057 return callValidate;
6058 }
6059 schemaObj.compiling = true;
6060 var currentOpts;
6061 if (schemaObj.meta) {
6062 currentOpts = this._opts;
6063 this._opts = this._metaOpts;
6064 }
6065 var v;
6066 try {
6067 v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs);
6068 } catch (e) {
6069 delete schemaObj.validate;
6070 throw e;
6071 } finally {
6072 schemaObj.compiling = false;
6073 if (schemaObj.meta)
6074 this._opts = currentOpts;
6075 }
6076 schemaObj.validate = v;
6077 schemaObj.refs = v.refs;
6078 schemaObj.refVal = v.refVal;
6079 schemaObj.root = v.root;
6080 return v;
6081 function callValidate() {
6082 var _validate = schemaObj.validate;
6083 var result = _validate.apply(this, arguments);
6084 callValidate.errors = _validate.errors;
6085 return result;
6086 }
6087 }
6088 function chooseGetId(opts) {
6089 switch (opts.schemaId) {
6090 case "auto":
6091 return _get$IdOrId;
6092 case "id":
6093 return _getId;
6094 default:
6095 return _get$Id;
6096 }
6097 }
6098 function _getId(schema) {
6099 if (schema.$id)
6100 this.logger.warn("schema $id ignored", schema.$id);
6101 return schema.id;
6102 }
6103 function _get$Id(schema) {
6104 if (schema.id)
6105 this.logger.warn("schema id ignored", schema.id);
6106 return schema.$id;
6107 }
6108 function _get$IdOrId(schema) {
6109 if (schema.$id && schema.id && schema.$id != schema.id)
6110 throw new Error("schema $id is different from id");
6111 return schema.$id || schema.id;
6112 }
6113 function errorsText(errors2, options) {
6114 errors2 = errors2 || this.errors;
6115 if (!errors2)
6116 return "No errors";
6117 options = options || {};
6118 var separator = options.separator === undefined ? ", " : options.separator;
6119 var dataVar = options.dataVar === undefined ? "data" : options.dataVar;
6120 var text = "";
6121 for (var i = 0;i < errors2.length; i++) {
6122 var e = errors2[i];
6123 if (e)
6124 text += dataVar + e.dataPath + " " + e.message + separator;
6125 }
6126 return text.slice(0, -separator.length);
6127 }
6128 function addFormat(name, format) {
6129 if (typeof format == "string")
6130 format = new RegExp(format);
6131 this._formats[name] = format;
6132 return this;
6133 }
6134 function addDefaultMetaSchema(self) {
6135 var $dataSchema;
6136 if (self._opts.$data) {
6137 $dataSchema = require_data2();
6138 self.addMetaSchema($dataSchema, $dataSchema.$id, true);
6139 }
6140 if (self._opts.meta === false)
6141 return;
6142 var metaSchema = require_json_schema_draft_07();
6143 if (self._opts.$data)
6144 metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
6145 self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
6146 self._refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
6147 }
6148 function addInitialSchemas(self) {
6149 var optsSchemas = self._opts.schemas;
6150 if (!optsSchemas)
6151 return;
6152 if (Array.isArray(optsSchemas))
6153 self.addSchema(optsSchemas);
6154 else
6155 for (var key in optsSchemas)
6156 self.addSchema(optsSchemas[key], key);
6157 }
6158 function addInitialFormats(self) {
6159 for (var name in self._opts.formats) {
6160 var format = self._opts.formats[name];
6161 self.addFormat(name, format);
6162 }
6163 }
6164 function addInitialKeywords(self) {
6165 for (var name in self._opts.keywords) {
6166 var keyword = self._opts.keywords[name];
6167 self.addKeyword(name, keyword);
6168 }
6169 }
6170 function checkUnique(self, id) {
6171 if (self._schemas[id] || self._refs[id])
6172 throw new Error('schema with key or id "' + id + '" already exists');
6173 }
6174 function getMetaSchemaOptions(self) {
6175 var metaOpts = util3.copy(self._opts);
6176 for (var i = 0;i < META_IGNORE_OPTIONS.length; i++)
6177 delete metaOpts[META_IGNORE_OPTIONS[i]];
6178 return metaOpts;
6179 }
6180 function setLogger(self) {
6181 var logger = self._opts.logger;
6182 if (logger === false) {
6183 self.logger = { log: noop, warn: noop, error: noop };
6184 } else {
6185 if (logger === undefined)
6186 logger = console;
6187 if (!(typeof logger == "object" && logger.log && logger.warn && logger.error))
6188 throw new Error("logger must implement log, warn and error methods");
6189 self.logger = logger;
6190 }
6191 }
6192 function noop() {}
6193});
6194
6195// node_modules/zod/v3/external.js
6196var exports_external = {};
6197__export(exports_external, {
6198 void: () => voidType,
6199 util: () => util,
6200 unknown: () => unknownType,
6201 union: () => unionType,
6202 undefined: () => undefinedType,
6203 tuple: () => tupleType,
6204 transformer: () => effectsType,
6205 symbol: () => symbolType,
6206 string: () => stringType,
6207 strictObject: () => strictObjectType,
6208 setErrorMap: () => setErrorMap,
6209 set: () => setType,
6210 record: () => recordType,
6211 quotelessJson: () => quotelessJson,
6212 promise: () => promiseType,
6213 preprocess: () => preprocessType,
6214 pipeline: () => pipelineType,
6215 ostring: () => ostring,
6216 optional: () => optionalType,
6217 onumber: () => onumber,
6218 oboolean: () => oboolean,
6219 objectUtil: () => objectUtil,
6220 object: () => objectType,
6221 number: () => numberType,
6222 nullable: () => nullableType,
6223 null: () => nullType,
6224 never: () => neverType,
6225 nativeEnum: () => nativeEnumType,
6226 nan: () => nanType,
6227 map: () => mapType,
6228 makeIssue: () => makeIssue,
6229 literal: () => literalType,
6230 lazy: () => lazyType,
6231 late: () => late,
6232 isValid: () => isValid,
6233 isDirty: () => isDirty,
6234 isAsync: () => isAsync,
6235 isAborted: () => isAborted,
6236 intersection: () => intersectionType,
6237 instanceof: () => instanceOfType,
6238 getParsedType: () => getParsedType,
6239 getErrorMap: () => getErrorMap,
6240 function: () => functionType,
6241 enum: () => enumType,
6242 effect: () => effectsType,
6243 discriminatedUnion: () => discriminatedUnionType,
6244 defaultErrorMap: () => en_default,
6245 datetimeRegex: () => datetimeRegex,
6246 date: () => dateType,
6247 custom: () => custom,
6248 coerce: () => coerce,
6249 boolean: () => booleanType,
6250 bigint: () => bigIntType,
6251 array: () => arrayType,
6252 any: () => anyType,
6253 addIssueToContext: () => addIssueToContext,
6254 ZodVoid: () => ZodVoid,
6255 ZodUnknown: () => ZodUnknown,
6256 ZodUnion: () => ZodUnion,
6257 ZodUndefined: () => ZodUndefined,
6258 ZodType: () => ZodType,
6259 ZodTuple: () => ZodTuple,
6260 ZodTransformer: () => ZodEffects,
6261 ZodSymbol: () => ZodSymbol,
6262 ZodString: () => ZodString,
6263 ZodSet: () => ZodSet,
6264 ZodSchema: () => ZodType,
6265 ZodRecord: () => ZodRecord,
6266 ZodReadonly: () => ZodReadonly,
6267 ZodPromise: () => ZodPromise,
6268 ZodPipeline: () => ZodPipeline,
6269 ZodParsedType: () => ZodParsedType,
6270 ZodOptional: () => ZodOptional,
6271 ZodObject: () => ZodObject,
6272 ZodNumber: () => ZodNumber,
6273 ZodNullable: () => ZodNullable,
6274 ZodNull: () => ZodNull,
6275 ZodNever: () => ZodNever,
6276 ZodNativeEnum: () => ZodNativeEnum,
6277 ZodNaN: () => ZodNaN,
6278 ZodMap: () => ZodMap,
6279 ZodLiteral: () => ZodLiteral,
6280 ZodLazy: () => ZodLazy,
6281 ZodIssueCode: () => ZodIssueCode,
6282 ZodIntersection: () => ZodIntersection,
6283 ZodFunction: () => ZodFunction,
6284 ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
6285 ZodError: () => ZodError,
6286 ZodEnum: () => ZodEnum,
6287 ZodEffects: () => ZodEffects,
6288 ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
6289 ZodDefault: () => ZodDefault,
6290 ZodDate: () => ZodDate,
6291 ZodCatch: () => ZodCatch,
6292 ZodBranded: () => ZodBranded,
6293 ZodBoolean: () => ZodBoolean,
6294 ZodBigInt: () => ZodBigInt,
6295 ZodArray: () => ZodArray,
6296 ZodAny: () => ZodAny,
6297 Schema: () => ZodType,
6298 ParseStatus: () => ParseStatus,
6299 OK: () => OK,
6300 NEVER: () => NEVER,
6301 INVALID: () => INVALID,
6302 EMPTY_PATH: () => EMPTY_PATH,
6303 DIRTY: () => DIRTY,
6304 BRAND: () => BRAND
6305});
6306
6307// node_modules/zod/v3/helpers/util.js
6308var util;
6309(function(util2) {
6310 util2.assertEqual = (_) => {};
6311 function assertIs(_arg) {}
6312 util2.assertIs = assertIs;
6313 function assertNever(_x) {
6314 throw new Error;
6315 }
6316 util2.assertNever = assertNever;
6317 util2.arrayToEnum = (items) => {
6318 const obj = {};
6319 for (const item of items) {
6320 obj[item] = item;
6321 }
6322 return obj;
6323 };
6324 util2.getValidEnumValues = (obj) => {
6325 const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
6326 const filtered = {};
6327 for (const k of validKeys) {
6328 filtered[k] = obj[k];
6329 }
6330 return util2.objectValues(filtered);
6331 };
6332 util2.objectValues = (obj) => {
6333 return util2.objectKeys(obj).map(function(e) {
6334 return obj[e];
6335 });
6336 };
6337 util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
6338 const keys = [];
6339 for (const key in object) {
6340 if (Object.prototype.hasOwnProperty.call(object, key)) {
6341 keys.push(key);
6342 }
6343 }
6344 return keys;
6345 };
6346 util2.find = (arr, checker) => {
6347 for (const item of arr) {
6348 if (checker(item))
6349 return item;
6350 }
6351 return;
6352 };
6353 util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
6354 function joinValues(array, separator = " | ") {
6355 return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
6356 }
6357 util2.joinValues = joinValues;
6358 util2.jsonStringifyReplacer = (_, value) => {
6359 if (typeof value === "bigint") {
6360 return value.toString();
6361 }
6362 return value;
6363 };
6364})(util || (util = {}));
6365var objectUtil;
6366(function(objectUtil2) {
6367 objectUtil2.mergeShapes = (first, second) => {
6368 return {
6369 ...first,
6370 ...second
6371 };
6372 };
6373})(objectUtil || (objectUtil = {}));
6374var ZodParsedType = util.arrayToEnum([
6375 "string",
6376 "nan",
6377 "number",
6378 "integer",
6379 "float",
6380 "boolean",
6381 "date",
6382 "bigint",
6383 "symbol",
6384 "function",
6385 "undefined",
6386 "null",
6387 "array",
6388 "object",
6389 "unknown",
6390 "promise",
6391 "void",
6392 "never",
6393 "map",
6394 "set"
6395]);
6396var getParsedType = (data) => {
6397 const t = typeof data;
6398 switch (t) {
6399 case "undefined":
6400 return ZodParsedType.undefined;
6401 case "string":
6402 return ZodParsedType.string;
6403 case "number":
6404 return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
6405 case "boolean":
6406 return ZodParsedType.boolean;
6407 case "function":
6408 return ZodParsedType.function;
6409 case "bigint":
6410 return ZodParsedType.bigint;
6411 case "symbol":
6412 return ZodParsedType.symbol;
6413 case "object":
6414 if (Array.isArray(data)) {
6415 return ZodParsedType.array;
6416 }
6417 if (data === null) {
6418 return ZodParsedType.null;
6419 }
6420 if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
6421 return ZodParsedType.promise;
6422 }
6423 if (typeof Map !== "undefined" && data instanceof Map) {
6424 return ZodParsedType.map;
6425 }
6426 if (typeof Set !== "undefined" && data instanceof Set) {
6427 return ZodParsedType.set;
6428 }
6429 if (typeof Date !== "undefined" && data instanceof Date) {
6430 return ZodParsedType.date;
6431 }
6432 return ZodParsedType.object;
6433 default:
6434 return ZodParsedType.unknown;
6435 }
6436};
6437
6438// node_modules/zod/v3/ZodError.js
6439var ZodIssueCode = util.arrayToEnum([
6440 "invalid_type",
6441 "invalid_literal",
6442 "custom",
6443 "invalid_union",
6444 "invalid_union_discriminator",
6445 "invalid_enum_value",
6446 "unrecognized_keys",
6447 "invalid_arguments",
6448 "invalid_return_type",
6449 "invalid_date",
6450 "invalid_string",
6451 "too_small",
6452 "too_big",
6453 "invalid_intersection_types",
6454 "not_multiple_of",
6455 "not_finite"
6456]);
6457var quotelessJson = (obj) => {
6458 const json = JSON.stringify(obj, null, 2);
6459 return json.replace(/"([^"]+)":/g, "$1:");
6460};
6461
6462class ZodError extends Error {
6463 get errors() {
6464 return this.issues;
6465 }
6466 constructor(issues) {
6467 super();
6468 this.issues = [];
6469 this.addIssue = (sub) => {
6470 this.issues = [...this.issues, sub];
6471 };
6472 this.addIssues = (subs = []) => {
6473 this.issues = [...this.issues, ...subs];
6474 };
6475 const actualProto = new.target.prototype;
6476 if (Object.setPrototypeOf) {
6477 Object.setPrototypeOf(this, actualProto);
6478 } else {
6479 this.__proto__ = actualProto;
6480 }
6481 this.name = "ZodError";
6482 this.issues = issues;
6483 }
6484 format(_mapper) {
6485 const mapper = _mapper || function(issue) {
6486 return issue.message;
6487 };
6488 const fieldErrors = { _errors: [] };
6489 const processError = (error) => {
6490 for (const issue of error.issues) {
6491 if (issue.code === "invalid_union") {
6492 issue.unionErrors.map(processError);
6493 } else if (issue.code === "invalid_return_type") {
6494 processError(issue.returnTypeError);
6495 } else if (issue.code === "invalid_arguments") {
6496 processError(issue.argumentsError);
6497 } else if (issue.path.length === 0) {
6498 fieldErrors._errors.push(mapper(issue));
6499 } else {
6500 let curr = fieldErrors;
6501 let i = 0;
6502 while (i < issue.path.length) {
6503 const el = issue.path[i];
6504 const terminal = i === issue.path.length - 1;
6505 if (!terminal) {
6506 curr[el] = curr[el] || { _errors: [] };
6507 } else {
6508 curr[el] = curr[el] || { _errors: [] };
6509 curr[el]._errors.push(mapper(issue));
6510 }
6511 curr = curr[el];
6512 i++;
6513 }
6514 }
6515 }
6516 };
6517 processError(this);
6518 return fieldErrors;
6519 }
6520 static assert(value) {
6521 if (!(value instanceof ZodError)) {
6522 throw new Error(`Not a ZodError: ${value}`);
6523 }
6524 }
6525 toString() {
6526 return this.message;
6527 }
6528 get message() {
6529 return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
6530 }
6531 get isEmpty() {
6532 return this.issues.length === 0;
6533 }
6534 flatten(mapper = (issue) => issue.message) {
6535 const fieldErrors = {};
6536 const formErrors = [];
6537 for (const sub of this.issues) {
6538 if (sub.path.length > 0) {
6539 const firstEl = sub.path[0];
6540 fieldErrors[firstEl] = fieldErrors[firstEl] || [];
6541 fieldErrors[firstEl].push(mapper(sub));
6542 } else {
6543 formErrors.push(mapper(sub));
6544 }
6545 }
6546 return { formErrors, fieldErrors };
6547 }
6548 get formErrors() {
6549 return this.flatten();
6550 }
6551}
6552ZodError.create = (issues) => {
6553 const error = new ZodError(issues);
6554 return error;
6555};
6556
6557// node_modules/zod/v3/locales/en.js
6558var errorMap = (issue, _ctx) => {
6559 let message;
6560 switch (issue.code) {
6561 case ZodIssueCode.invalid_type:
6562 if (issue.received === ZodParsedType.undefined) {
6563 message = "Required";
6564 } else {
6565 message = `Expected ${issue.expected}, received ${issue.received}`;
6566 }
6567 break;
6568 case ZodIssueCode.invalid_literal:
6569 message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
6570 break;
6571 case ZodIssueCode.unrecognized_keys:
6572 message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
6573 break;
6574 case ZodIssueCode.invalid_union:
6575 message = `Invalid input`;
6576 break;
6577 case ZodIssueCode.invalid_union_discriminator:
6578 message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
6579 break;
6580 case ZodIssueCode.invalid_enum_value:
6581 message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
6582 break;
6583 case ZodIssueCode.invalid_arguments:
6584 message = `Invalid function arguments`;
6585 break;
6586 case ZodIssueCode.invalid_return_type:
6587 message = `Invalid function return type`;
6588 break;
6589 case ZodIssueCode.invalid_date:
6590 message = `Invalid date`;
6591 break;
6592 case ZodIssueCode.invalid_string:
6593 if (typeof issue.validation === "object") {
6594 if ("includes" in issue.validation) {
6595 message = `Invalid input: must include "${issue.validation.includes}"`;
6596 if (typeof issue.validation.position === "number") {
6597 message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
6598 }
6599 } else if ("startsWith" in issue.validation) {
6600 message = `Invalid input: must start with "${issue.validation.startsWith}"`;
6601 } else if ("endsWith" in issue.validation) {
6602 message = `Invalid input: must end with "${issue.validation.endsWith}"`;
6603 } else {
6604 util.assertNever(issue.validation);
6605 }
6606 } else if (issue.validation !== "regex") {
6607 message = `Invalid ${issue.validation}`;
6608 } else {
6609 message = "Invalid";
6610 }
6611 break;
6612 case ZodIssueCode.too_small:
6613 if (issue.type === "array")
6614 message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
6615 else if (issue.type === "string")
6616 message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
6617 else if (issue.type === "number")
6618 message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
6619 else if (issue.type === "bigint")
6620 message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
6621 else if (issue.type === "date")
6622 message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
6623 else
6624 message = "Invalid input";
6625 break;
6626 case ZodIssueCode.too_big:
6627 if (issue.type === "array")
6628 message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
6629 else if (issue.type === "string")
6630 message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
6631 else if (issue.type === "number")
6632 message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
6633 else if (issue.type === "bigint")
6634 message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
6635 else if (issue.type === "date")
6636 message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
6637 else
6638 message = "Invalid input";
6639 break;
6640 case ZodIssueCode.custom:
6641 message = `Invalid input`;
6642 break;
6643 case ZodIssueCode.invalid_intersection_types:
6644 message = `Intersection results could not be merged`;
6645 break;
6646 case ZodIssueCode.not_multiple_of:
6647 message = `Number must be a multiple of ${issue.multipleOf}`;
6648 break;
6649 case ZodIssueCode.not_finite:
6650 message = "Number must be finite";
6651 break;
6652 default:
6653 message = _ctx.defaultError;
6654 util.assertNever(issue);
6655 }
6656 return { message };
6657};
6658var en_default = errorMap;
6659
6660// node_modules/zod/v3/errors.js
6661var overrideErrorMap = en_default;
6662function setErrorMap(map) {
6663 overrideErrorMap = map;
6664}
6665function getErrorMap() {
6666 return overrideErrorMap;
6667}
6668// node_modules/zod/v3/helpers/parseUtil.js
6669var makeIssue = (params) => {
6670 const { data, path, errorMaps, issueData } = params;
6671 const fullPath = [...path, ...issueData.path || []];
6672 const fullIssue = {
6673 ...issueData,
6674 path: fullPath
6675 };
6676 if (issueData.message !== undefined) {
6677 return {
6678 ...issueData,
6679 path: fullPath,
6680 message: issueData.message
6681 };
6682 }
6683 let errorMessage = "";
6684 const maps = errorMaps.filter((m) => !!m).slice().reverse();
6685 for (const map of maps) {
6686 errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
6687 }
6688 return {
6689 ...issueData,
6690 path: fullPath,
6691 message: errorMessage
6692 };
6693};
6694var EMPTY_PATH = [];
6695function addIssueToContext(ctx, issueData) {
6696 const overrideMap = getErrorMap();
6697 const issue = makeIssue({
6698 issueData,
6699 data: ctx.data,
6700 path: ctx.path,
6701 errorMaps: [
6702 ctx.common.contextualErrorMap,
6703 ctx.schemaErrorMap,
6704 overrideMap,
6705 overrideMap === en_default ? undefined : en_default
6706 ].filter((x) => !!x)
6707 });
6708 ctx.common.issues.push(issue);
6709}
6710
6711class ParseStatus {
6712 constructor() {
6713 this.value = "valid";
6714 }
6715 dirty() {
6716 if (this.value === "valid")
6717 this.value = "dirty";
6718 }
6719 abort() {
6720 if (this.value !== "aborted")
6721 this.value = "aborted";
6722 }
6723 static mergeArray(status, results) {
6724 const arrayValue = [];
6725 for (const s of results) {
6726 if (s.status === "aborted")
6727 return INVALID;
6728 if (s.status === "dirty")
6729 status.dirty();
6730 arrayValue.push(s.value);
6731 }
6732 return { status: status.value, value: arrayValue };
6733 }
6734 static async mergeObjectAsync(status, pairs) {
6735 const syncPairs = [];
6736 for (const pair of pairs) {
6737 const key = await pair.key;
6738 const value = await pair.value;
6739 syncPairs.push({
6740 key,
6741 value
6742 });
6743 }
6744 return ParseStatus.mergeObjectSync(status, syncPairs);
6745 }
6746 static mergeObjectSync(status, pairs) {
6747 const finalObject = {};
6748 for (const pair of pairs) {
6749 const { key, value } = pair;
6750 if (key.status === "aborted")
6751 return INVALID;
6752 if (value.status === "aborted")
6753 return INVALID;
6754 if (key.status === "dirty")
6755 status.dirty();
6756 if (value.status === "dirty")
6757 status.dirty();
6758 if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
6759 finalObject[key.value] = value.value;
6760 }
6761 }
6762 return { status: status.value, value: finalObject };
6763 }
6764}
6765var INVALID = Object.freeze({
6766 status: "aborted"
6767});
6768var DIRTY = (value) => ({ status: "dirty", value });
6769var OK = (value) => ({ status: "valid", value });
6770var isAborted = (x) => x.status === "aborted";
6771var isDirty = (x) => x.status === "dirty";
6772var isValid = (x) => x.status === "valid";
6773var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
6774// node_modules/zod/v3/helpers/errorUtil.js
6775var errorUtil;
6776(function(errorUtil2) {
6777 errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
6778 errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
6779})(errorUtil || (errorUtil = {}));
6780
6781// node_modules/zod/v3/types.js
6782class ParseInputLazyPath {
6783 constructor(parent, value, path, key) {
6784 this._cachedPath = [];
6785 this.parent = parent;
6786 this.data = value;
6787 this._path = path;
6788 this._key = key;
6789 }
6790 get path() {
6791 if (!this._cachedPath.length) {
6792 if (Array.isArray(this._key)) {
6793 this._cachedPath.push(...this._path, ...this._key);
6794 } else {
6795 this._cachedPath.push(...this._path, this._key);
6796 }
6797 }
6798 return this._cachedPath;
6799 }
6800}
6801var handleResult = (ctx, result) => {
6802 if (isValid(result)) {
6803 return { success: true, data: result.value };
6804 } else {
6805 if (!ctx.common.issues.length) {
6806 throw new Error("Validation failed but no issues detected.");
6807 }
6808 return {
6809 success: false,
6810 get error() {
6811 if (this._error)
6812 return this._error;
6813 const error = new ZodError(ctx.common.issues);
6814 this._error = error;
6815 return this._error;
6816 }
6817 };
6818 }
6819};
6820function processCreateParams(params) {
6821 if (!params)
6822 return {};
6823 const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
6824 if (errorMap2 && (invalid_type_error || required_error)) {
6825 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
6826 }
6827 if (errorMap2)
6828 return { errorMap: errorMap2, description };
6829 const customMap = (iss, ctx) => {
6830 const { message } = params;
6831 if (iss.code === "invalid_enum_value") {
6832 return { message: message ?? ctx.defaultError };
6833 }
6834 if (typeof ctx.data === "undefined") {
6835 return { message: message ?? required_error ?? ctx.defaultError };
6836 }
6837 if (iss.code !== "invalid_type")
6838 return { message: ctx.defaultError };
6839 return { message: message ?? invalid_type_error ?? ctx.defaultError };
6840 };
6841 return { errorMap: customMap, description };
6842}
6843
6844class ZodType {
6845 get description() {
6846 return this._def.description;
6847 }
6848 _getType(input) {
6849 return getParsedType(input.data);
6850 }
6851 _getOrReturnCtx(input, ctx) {
6852 return ctx || {
6853 common: input.parent.common,
6854 data: input.data,
6855 parsedType: getParsedType(input.data),
6856 schemaErrorMap: this._def.errorMap,
6857 path: input.path,
6858 parent: input.parent
6859 };
6860 }
6861 _processInputParams(input) {
6862 return {
6863 status: new ParseStatus,
6864 ctx: {
6865 common: input.parent.common,
6866 data: input.data,
6867 parsedType: getParsedType(input.data),
6868 schemaErrorMap: this._def.errorMap,
6869 path: input.path,
6870 parent: input.parent
6871 }
6872 };
6873 }
6874 _parseSync(input) {
6875 const result = this._parse(input);
6876 if (isAsync(result)) {
6877 throw new Error("Synchronous parse encountered promise.");
6878 }
6879 return result;
6880 }
6881 _parseAsync(input) {
6882 const result = this._parse(input);
6883 return Promise.resolve(result);
6884 }
6885 parse(data, params) {
6886 const result = this.safeParse(data, params);
6887 if (result.success)
6888 return result.data;
6889 throw result.error;
6890 }
6891 safeParse(data, params) {
6892 const ctx = {
6893 common: {
6894 issues: [],
6895 async: params?.async ?? false,
6896 contextualErrorMap: params?.errorMap
6897 },
6898 path: params?.path || [],
6899 schemaErrorMap: this._def.errorMap,
6900 parent: null,
6901 data,
6902 parsedType: getParsedType(data)
6903 };
6904 const result = this._parseSync({ data, path: ctx.path, parent: ctx });
6905 return handleResult(ctx, result);
6906 }
6907 "~validate"(data) {
6908 const ctx = {
6909 common: {
6910 issues: [],
6911 async: !!this["~standard"].async
6912 },
6913 path: [],
6914 schemaErrorMap: this._def.errorMap,
6915 parent: null,
6916 data,
6917 parsedType: getParsedType(data)
6918 };
6919 if (!this["~standard"].async) {
6920 try {
6921 const result = this._parseSync({ data, path: [], parent: ctx });
6922 return isValid(result) ? {
6923 value: result.value
6924 } : {
6925 issues: ctx.common.issues
6926 };
6927 } catch (err) {
6928 if (err?.message?.toLowerCase()?.includes("encountered")) {
6929 this["~standard"].async = true;
6930 }
6931 ctx.common = {
6932 issues: [],
6933 async: true
6934 };
6935 }
6936 }
6937 return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
6938 value: result.value
6939 } : {
6940 issues: ctx.common.issues
6941 });
6942 }
6943 async parseAsync(data, params) {
6944 const result = await this.safeParseAsync(data, params);
6945 if (result.success)
6946 return result.data;
6947 throw result.error;
6948 }
6949 async safeParseAsync(data, params) {
6950 const ctx = {
6951 common: {
6952 issues: [],
6953 contextualErrorMap: params?.errorMap,
6954 async: true
6955 },
6956 path: params?.path || [],
6957 schemaErrorMap: this._def.errorMap,
6958 parent: null,
6959 data,
6960 parsedType: getParsedType(data)
6961 };
6962 const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
6963 const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
6964 return handleResult(ctx, result);
6965 }
6966 refine(check, message) {
6967 const getIssueProperties = (val) => {
6968 if (typeof message === "string" || typeof message === "undefined") {
6969 return { message };
6970 } else if (typeof message === "function") {
6971 return message(val);
6972 } else {
6973 return message;
6974 }
6975 };
6976 return this._refinement((val, ctx) => {
6977 const result = check(val);
6978 const setError = () => ctx.addIssue({
6979 code: ZodIssueCode.custom,
6980 ...getIssueProperties(val)
6981 });
6982 if (typeof Promise !== "undefined" && result instanceof Promise) {
6983 return result.then((data) => {
6984 if (!data) {
6985 setError();
6986 return false;
6987 } else {
6988 return true;
6989 }
6990 });
6991 }
6992 if (!result) {
6993 setError();
6994 return false;
6995 } else {
6996 return true;
6997 }
6998 });
6999 }
7000 refinement(check, refinementData) {
7001 return this._refinement((val, ctx) => {
7002 if (!check(val)) {
7003 ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
7004 return false;
7005 } else {
7006 return true;
7007 }
7008 });
7009 }
7010 _refinement(refinement) {
7011 return new ZodEffects({
7012 schema: this,
7013 typeName: ZodFirstPartyTypeKind.ZodEffects,
7014 effect: { type: "refinement", refinement }
7015 });
7016 }
7017 superRefine(refinement) {
7018 return this._refinement(refinement);
7019 }
7020 constructor(def) {
7021 this.spa = this.safeParseAsync;
7022 this._def = def;
7023 this.parse = this.parse.bind(this);
7024 this.safeParse = this.safeParse.bind(this);
7025 this.parseAsync = this.parseAsync.bind(this);
7026 this.safeParseAsync = this.safeParseAsync.bind(this);
7027 this.spa = this.spa.bind(this);
7028 this.refine = this.refine.bind(this);
7029 this.refinement = this.refinement.bind(this);
7030 this.superRefine = this.superRefine.bind(this);
7031 this.optional = this.optional.bind(this);
7032 this.nullable = this.nullable.bind(this);
7033 this.nullish = this.nullish.bind(this);
7034 this.array = this.array.bind(this);
7035 this.promise = this.promise.bind(this);
7036 this.or = this.or.bind(this);
7037 this.and = this.and.bind(this);
7038 this.transform = this.transform.bind(this);
7039 this.brand = this.brand.bind(this);
7040 this.default = this.default.bind(this);
7041 this.catch = this.catch.bind(this);
7042 this.describe = this.describe.bind(this);
7043 this.pipe = this.pipe.bind(this);
7044 this.readonly = this.readonly.bind(this);
7045 this.isNullable = this.isNullable.bind(this);
7046 this.isOptional = this.isOptional.bind(this);
7047 this["~standard"] = {
7048 version: 1,
7049 vendor: "zod",
7050 validate: (data) => this["~validate"](data)
7051 };
7052 }
7053 optional() {
7054 return ZodOptional.create(this, this._def);
7055 }
7056 nullable() {
7057 return ZodNullable.create(this, this._def);
7058 }
7059 nullish() {
7060 return this.nullable().optional();
7061 }
7062 array() {
7063 return ZodArray.create(this);
7064 }
7065 promise() {
7066 return ZodPromise.create(this, this._def);
7067 }
7068 or(option) {
7069 return ZodUnion.create([this, option], this._def);
7070 }
7071 and(incoming) {
7072 return ZodIntersection.create(this, incoming, this._def);
7073 }
7074 transform(transform) {
7075 return new ZodEffects({
7076 ...processCreateParams(this._def),
7077 schema: this,
7078 typeName: ZodFirstPartyTypeKind.ZodEffects,
7079 effect: { type: "transform", transform }
7080 });
7081 }
7082 default(def) {
7083 const defaultValueFunc = typeof def === "function" ? def : () => def;
7084 return new ZodDefault({
7085 ...processCreateParams(this._def),
7086 innerType: this,
7087 defaultValue: defaultValueFunc,
7088 typeName: ZodFirstPartyTypeKind.ZodDefault
7089 });
7090 }
7091 brand() {
7092 return new ZodBranded({
7093 typeName: ZodFirstPartyTypeKind.ZodBranded,
7094 type: this,
7095 ...processCreateParams(this._def)
7096 });
7097 }
7098 catch(def) {
7099 const catchValueFunc = typeof def === "function" ? def : () => def;
7100 return new ZodCatch({
7101 ...processCreateParams(this._def),
7102 innerType: this,
7103 catchValue: catchValueFunc,
7104 typeName: ZodFirstPartyTypeKind.ZodCatch
7105 });
7106 }
7107 describe(description) {
7108 const This = this.constructor;
7109 return new This({
7110 ...this._def,
7111 description
7112 });
7113 }
7114 pipe(target) {
7115 return ZodPipeline.create(this, target);
7116 }
7117 readonly() {
7118 return ZodReadonly.create(this);
7119 }
7120 isOptional() {
7121 return this.safeParse(undefined).success;
7122 }
7123 isNullable() {
7124 return this.safeParse(null).success;
7125 }
7126}
7127var cuidRegex = /^c[^\s-]{8,}$/i;
7128var cuid2Regex = /^[0-9a-z]+$/;
7129var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
7130var uuidRegex = /^[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;
7131var nanoidRegex = /^[a-z0-9_-]{21}$/i;
7132var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
7133var durationRegex = /^[-+]?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)?)??$/;
7134var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
7135var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
7136var emojiRegex;
7137var ipv4Regex = /^(?:(?: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])$/;
7138var ipv4CidrRegex = /^(?:(?: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])$/;
7139var ipv6Regex = /^(([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]))$/;
7140var ipv6CidrRegex = /^(([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])$/;
7141var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
7142var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
7143var dateRegexSource = `((\\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])))`;
7144var dateRegex = new RegExp(`^${dateRegexSource}$`);
7145function timeRegexSource(args) {
7146 let secondsRegexSource = `[0-5]\\d`;
7147 if (args.precision) {
7148 secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
7149 } else if (args.precision == null) {
7150 secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
7151 }
7152 const secondsQuantifier = args.precision ? "+" : "?";
7153 return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
7154}
7155function timeRegex(args) {
7156 return new RegExp(`^${timeRegexSource(args)}$`);
7157}
7158function datetimeRegex(args) {
7159 let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
7160 const opts = [];
7161 opts.push(args.local ? `Z?` : `Z`);
7162 if (args.offset)
7163 opts.push(`([+-]\\d{2}:?\\d{2})`);
7164 regex = `${regex}(${opts.join("|")})`;
7165 return new RegExp(`^${regex}$`);
7166}
7167function isValidIP(ip, version) {
7168 if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
7169 return true;
7170 }
7171 if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
7172 return true;
7173 }
7174 return false;
7175}
7176function isValidJWT(jwt, alg) {
7177 if (!jwtRegex.test(jwt))
7178 return false;
7179 try {
7180 const [header] = jwt.split(".");
7181 if (!header)
7182 return false;
7183 const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
7184 const decoded = JSON.parse(atob(base64));
7185 if (typeof decoded !== "object" || decoded === null)
7186 return false;
7187 if ("typ" in decoded && decoded?.typ !== "JWT")
7188 return false;
7189 if (!decoded.alg)
7190 return false;
7191 if (alg && decoded.alg !== alg)
7192 return false;
7193 return true;
7194 } catch {
7195 return false;
7196 }
7197}
7198function isValidCidr(ip, version) {
7199 if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
7200 return true;
7201 }
7202 if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
7203 return true;
7204 }
7205 return false;
7206}
7207
7208class ZodString extends ZodType {
7209 _parse(input) {
7210 if (this._def.coerce) {
7211 input.data = String(input.data);
7212 }
7213 const parsedType = this._getType(input);
7214 if (parsedType !== ZodParsedType.string) {
7215 const ctx2 = this._getOrReturnCtx(input);
7216 addIssueToContext(ctx2, {
7217 code: ZodIssueCode.invalid_type,
7218 expected: ZodParsedType.string,
7219 received: ctx2.parsedType
7220 });
7221 return INVALID;
7222 }
7223 const status = new ParseStatus;
7224 let ctx = undefined;
7225 for (const check of this._def.checks) {
7226 if (check.kind === "min") {
7227 if (input.data.length < check.value) {
7228 ctx = this._getOrReturnCtx(input, ctx);
7229 addIssueToContext(ctx, {
7230 code: ZodIssueCode.too_small,
7231 minimum: check.value,
7232 type: "string",
7233 inclusive: true,
7234 exact: false,
7235 message: check.message
7236 });
7237 status.dirty();
7238 }
7239 } else if (check.kind === "max") {
7240 if (input.data.length > check.value) {
7241 ctx = this._getOrReturnCtx(input, ctx);
7242 addIssueToContext(ctx, {
7243 code: ZodIssueCode.too_big,
7244 maximum: check.value,
7245 type: "string",
7246 inclusive: true,
7247 exact: false,
7248 message: check.message
7249 });
7250 status.dirty();
7251 }
7252 } else if (check.kind === "length") {
7253 const tooBig = input.data.length > check.value;
7254 const tooSmall = input.data.length < check.value;
7255 if (tooBig || tooSmall) {
7256 ctx = this._getOrReturnCtx(input, ctx);
7257 if (tooBig) {
7258 addIssueToContext(ctx, {
7259 code: ZodIssueCode.too_big,
7260 maximum: check.value,
7261 type: "string",
7262 inclusive: true,
7263 exact: true,
7264 message: check.message
7265 });
7266 } else if (tooSmall) {
7267 addIssueToContext(ctx, {
7268 code: ZodIssueCode.too_small,
7269 minimum: check.value,
7270 type: "string",
7271 inclusive: true,
7272 exact: true,
7273 message: check.message
7274 });
7275 }
7276 status.dirty();
7277 }
7278 } else if (check.kind === "email") {
7279 if (!emailRegex.test(input.data)) {
7280 ctx = this._getOrReturnCtx(input, ctx);
7281 addIssueToContext(ctx, {
7282 validation: "email",
7283 code: ZodIssueCode.invalid_string,
7284 message: check.message
7285 });
7286 status.dirty();
7287 }
7288 } else if (check.kind === "emoji") {
7289 if (!emojiRegex) {
7290 emojiRegex = new RegExp(_emojiRegex, "u");
7291 }
7292 if (!emojiRegex.test(input.data)) {
7293 ctx = this._getOrReturnCtx(input, ctx);
7294 addIssueToContext(ctx, {
7295 validation: "emoji",
7296 code: ZodIssueCode.invalid_string,
7297 message: check.message
7298 });
7299 status.dirty();
7300 }
7301 } else if (check.kind === "uuid") {
7302 if (!uuidRegex.test(input.data)) {
7303 ctx = this._getOrReturnCtx(input, ctx);
7304 addIssueToContext(ctx, {
7305 validation: "uuid",
7306 code: ZodIssueCode.invalid_string,
7307 message: check.message
7308 });
7309 status.dirty();
7310 }
7311 } else if (check.kind === "nanoid") {
7312 if (!nanoidRegex.test(input.data)) {
7313 ctx = this._getOrReturnCtx(input, ctx);
7314 addIssueToContext(ctx, {
7315 validation: "nanoid",
7316 code: ZodIssueCode.invalid_string,
7317 message: check.message
7318 });
7319 status.dirty();
7320 }
7321 } else if (check.kind === "cuid") {
7322 if (!cuidRegex.test(input.data)) {
7323 ctx = this._getOrReturnCtx(input, ctx);
7324 addIssueToContext(ctx, {
7325 validation: "cuid",
7326 code: ZodIssueCode.invalid_string,
7327 message: check.message
7328 });
7329 status.dirty();
7330 }
7331 } else if (check.kind === "cuid2") {
7332 if (!cuid2Regex.test(input.data)) {
7333 ctx = this._getOrReturnCtx(input, ctx);
7334 addIssueToContext(ctx, {
7335 validation: "cuid2",
7336 code: ZodIssueCode.invalid_string,
7337 message: check.message
7338 });
7339 status.dirty();
7340 }
7341 } else if (check.kind === "ulid") {
7342 if (!ulidRegex.test(input.data)) {
7343 ctx = this._getOrReturnCtx(input, ctx);
7344 addIssueToContext(ctx, {
7345 validation: "ulid",
7346 code: ZodIssueCode.invalid_string,
7347 message: check.message
7348 });
7349 status.dirty();
7350 }
7351 } else if (check.kind === "url") {
7352 try {
7353 new URL(input.data);
7354 } catch {
7355 ctx = this._getOrReturnCtx(input, ctx);
7356 addIssueToContext(ctx, {
7357 validation: "url",
7358 code: ZodIssueCode.invalid_string,
7359 message: check.message
7360 });
7361 status.dirty();
7362 }
7363 } else if (check.kind === "regex") {
7364 check.regex.lastIndex = 0;
7365 const testResult = check.regex.test(input.data);
7366 if (!testResult) {
7367 ctx = this._getOrReturnCtx(input, ctx);
7368 addIssueToContext(ctx, {
7369 validation: "regex",
7370 code: ZodIssueCode.invalid_string,
7371 message: check.message
7372 });
7373 status.dirty();
7374 }
7375 } else if (check.kind === "trim") {
7376 input.data = input.data.trim();
7377 } else if (check.kind === "includes") {
7378 if (!input.data.includes(check.value, check.position)) {
7379 ctx = this._getOrReturnCtx(input, ctx);
7380 addIssueToContext(ctx, {
7381 code: ZodIssueCode.invalid_string,
7382 validation: { includes: check.value, position: check.position },
7383 message: check.message
7384 });
7385 status.dirty();
7386 }
7387 } else if (check.kind === "toLowerCase") {
7388 input.data = input.data.toLowerCase();
7389 } else if (check.kind === "toUpperCase") {
7390 input.data = input.data.toUpperCase();
7391 } else if (check.kind === "startsWith") {
7392 if (!input.data.startsWith(check.value)) {
7393 ctx = this._getOrReturnCtx(input, ctx);
7394 addIssueToContext(ctx, {
7395 code: ZodIssueCode.invalid_string,
7396 validation: { startsWith: check.value },
7397 message: check.message
7398 });
7399 status.dirty();
7400 }
7401 } else if (check.kind === "endsWith") {
7402 if (!input.data.endsWith(check.value)) {
7403 ctx = this._getOrReturnCtx(input, ctx);
7404 addIssueToContext(ctx, {
7405 code: ZodIssueCode.invalid_string,
7406 validation: { endsWith: check.value },
7407 message: check.message
7408 });
7409 status.dirty();
7410 }
7411 } else if (check.kind === "datetime") {
7412 const regex = datetimeRegex(check);
7413 if (!regex.test(input.data)) {
7414 ctx = this._getOrReturnCtx(input, ctx);
7415 addIssueToContext(ctx, {
7416 code: ZodIssueCode.invalid_string,
7417 validation: "datetime",
7418 message: check.message
7419 });
7420 status.dirty();
7421 }
7422 } else if (check.kind === "date") {
7423 const regex = dateRegex;
7424 if (!regex.test(input.data)) {
7425 ctx = this._getOrReturnCtx(input, ctx);
7426 addIssueToContext(ctx, {
7427 code: ZodIssueCode.invalid_string,
7428 validation: "date",
7429 message: check.message
7430 });
7431 status.dirty();
7432 }
7433 } else if (check.kind === "time") {
7434 const regex = timeRegex(check);
7435 if (!regex.test(input.data)) {
7436 ctx = this._getOrReturnCtx(input, ctx);
7437 addIssueToContext(ctx, {
7438 code: ZodIssueCode.invalid_string,
7439 validation: "time",
7440 message: check.message
7441 });
7442 status.dirty();
7443 }
7444 } else if (check.kind === "duration") {
7445 if (!durationRegex.test(input.data)) {
7446 ctx = this._getOrReturnCtx(input, ctx);
7447 addIssueToContext(ctx, {
7448 validation: "duration",
7449 code: ZodIssueCode.invalid_string,
7450 message: check.message
7451 });
7452 status.dirty();
7453 }
7454 } else if (check.kind === "ip") {
7455 if (!isValidIP(input.data, check.version)) {
7456 ctx = this._getOrReturnCtx(input, ctx);
7457 addIssueToContext(ctx, {
7458 validation: "ip",
7459 code: ZodIssueCode.invalid_string,
7460 message: check.message
7461 });
7462 status.dirty();
7463 }
7464 } else if (check.kind === "jwt") {
7465 if (!isValidJWT(input.data, check.alg)) {
7466 ctx = this._getOrReturnCtx(input, ctx);
7467 addIssueToContext(ctx, {
7468 validation: "jwt",
7469 code: ZodIssueCode.invalid_string,
7470 message: check.message
7471 });
7472 status.dirty();
7473 }
7474 } else if (check.kind === "cidr") {
7475 if (!isValidCidr(input.data, check.version)) {
7476 ctx = this._getOrReturnCtx(input, ctx);
7477 addIssueToContext(ctx, {
7478 validation: "cidr",
7479 code: ZodIssueCode.invalid_string,
7480 message: check.message
7481 });
7482 status.dirty();
7483 }
7484 } else if (check.kind === "base64") {
7485 if (!base64Regex.test(input.data)) {
7486 ctx = this._getOrReturnCtx(input, ctx);
7487 addIssueToContext(ctx, {
7488 validation: "base64",
7489 code: ZodIssueCode.invalid_string,
7490 message: check.message
7491 });
7492 status.dirty();
7493 }
7494 } else if (check.kind === "base64url") {
7495 if (!base64urlRegex.test(input.data)) {
7496 ctx = this._getOrReturnCtx(input, ctx);
7497 addIssueToContext(ctx, {
7498 validation: "base64url",
7499 code: ZodIssueCode.invalid_string,
7500 message: check.message
7501 });
7502 status.dirty();
7503 }
7504 } else {
7505 util.assertNever(check);
7506 }
7507 }
7508 return { status: status.value, value: input.data };
7509 }
7510 _regex(regex, validation, message) {
7511 return this.refinement((data) => regex.test(data), {
7512 validation,
7513 code: ZodIssueCode.invalid_string,
7514 ...errorUtil.errToObj(message)
7515 });
7516 }
7517 _addCheck(check) {
7518 return new ZodString({
7519 ...this._def,
7520 checks: [...this._def.checks, check]
7521 });
7522 }
7523 email(message) {
7524 return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
7525 }
7526 url(message) {
7527 return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
7528 }
7529 emoji(message) {
7530 return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
7531 }
7532 uuid(message) {
7533 return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
7534 }
7535 nanoid(message) {
7536 return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
7537 }
7538 cuid(message) {
7539 return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
7540 }
7541 cuid2(message) {
7542 return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
7543 }
7544 ulid(message) {
7545 return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
7546 }
7547 base64(message) {
7548 return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
7549 }
7550 base64url(message) {
7551 return this._addCheck({
7552 kind: "base64url",
7553 ...errorUtil.errToObj(message)
7554 });
7555 }
7556 jwt(options) {
7557 return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
7558 }
7559 ip(options) {
7560 return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
7561 }
7562 cidr(options) {
7563 return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
7564 }
7565 datetime(options) {
7566 if (typeof options === "string") {
7567 return this._addCheck({
7568 kind: "datetime",
7569 precision: null,
7570 offset: false,
7571 local: false,
7572 message: options
7573 });
7574 }
7575 return this._addCheck({
7576 kind: "datetime",
7577 precision: typeof options?.precision === "undefined" ? null : options?.precision,
7578 offset: options?.offset ?? false,
7579 local: options?.local ?? false,
7580 ...errorUtil.errToObj(options?.message)
7581 });
7582 }
7583 date(message) {
7584 return this._addCheck({ kind: "date", message });
7585 }
7586 time(options) {
7587 if (typeof options === "string") {
7588 return this._addCheck({
7589 kind: "time",
7590 precision: null,
7591 message: options
7592 });
7593 }
7594 return this._addCheck({
7595 kind: "time",
7596 precision: typeof options?.precision === "undefined" ? null : options?.precision,
7597 ...errorUtil.errToObj(options?.message)
7598 });
7599 }
7600 duration(message) {
7601 return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
7602 }
7603 regex(regex, message) {
7604 return this._addCheck({
7605 kind: "regex",
7606 regex,
7607 ...errorUtil.errToObj(message)
7608 });
7609 }
7610 includes(value, options) {
7611 return this._addCheck({
7612 kind: "includes",
7613 value,
7614 position: options?.position,
7615 ...errorUtil.errToObj(options?.message)
7616 });
7617 }
7618 startsWith(value, message) {
7619 return this._addCheck({
7620 kind: "startsWith",
7621 value,
7622 ...errorUtil.errToObj(message)
7623 });
7624 }
7625 endsWith(value, message) {
7626 return this._addCheck({
7627 kind: "endsWith",
7628 value,
7629 ...errorUtil.errToObj(message)
7630 });
7631 }
7632 min(minLength, message) {
7633 return this._addCheck({
7634 kind: "min",
7635 value: minLength,
7636 ...errorUtil.errToObj(message)
7637 });
7638 }
7639 max(maxLength, message) {
7640 return this._addCheck({
7641 kind: "max",
7642 value: maxLength,
7643 ...errorUtil.errToObj(message)
7644 });
7645 }
7646 length(len, message) {
7647 return this._addCheck({
7648 kind: "length",
7649 value: len,
7650 ...errorUtil.errToObj(message)
7651 });
7652 }
7653 nonempty(message) {
7654 return this.min(1, errorUtil.errToObj(message));
7655 }
7656 trim() {
7657 return new ZodString({
7658 ...this._def,
7659 checks: [...this._def.checks, { kind: "trim" }]
7660 });
7661 }
7662 toLowerCase() {
7663 return new ZodString({
7664 ...this._def,
7665 checks: [...this._def.checks, { kind: "toLowerCase" }]
7666 });
7667 }
7668 toUpperCase() {
7669 return new ZodString({
7670 ...this._def,
7671 checks: [...this._def.checks, { kind: "toUpperCase" }]
7672 });
7673 }
7674 get isDatetime() {
7675 return !!this._def.checks.find((ch) => ch.kind === "datetime");
7676 }
7677 get isDate() {
7678 return !!this._def.checks.find((ch) => ch.kind === "date");
7679 }
7680 get isTime() {
7681 return !!this._def.checks.find((ch) => ch.kind === "time");
7682 }
7683 get isDuration() {
7684 return !!this._def.checks.find((ch) => ch.kind === "duration");
7685 }
7686 get isEmail() {
7687 return !!this._def.checks.find((ch) => ch.kind === "email");
7688 }
7689 get isURL() {
7690 return !!this._def.checks.find((ch) => ch.kind === "url");
7691 }
7692 get isEmoji() {
7693 return !!this._def.checks.find((ch) => ch.kind === "emoji");
7694 }
7695 get isUUID() {
7696 return !!this._def.checks.find((ch) => ch.kind === "uuid");
7697 }
7698 get isNANOID() {
7699 return !!this._def.checks.find((ch) => ch.kind === "nanoid");
7700 }
7701 get isCUID() {
7702 return !!this._def.checks.find((ch) => ch.kind === "cuid");
7703 }
7704 get isCUID2() {
7705 return !!this._def.checks.find((ch) => ch.kind === "cuid2");
7706 }
7707 get isULID() {
7708 return !!this._def.checks.find((ch) => ch.kind === "ulid");
7709 }
7710 get isIP() {
7711 return !!this._def.checks.find((ch) => ch.kind === "ip");
7712 }
7713 get isCIDR() {
7714 return !!this._def.checks.find((ch) => ch.kind === "cidr");
7715 }
7716 get isBase64() {
7717 return !!this._def.checks.find((ch) => ch.kind === "base64");
7718 }
7719 get isBase64url() {
7720 return !!this._def.checks.find((ch) => ch.kind === "base64url");
7721 }
7722 get minLength() {
7723 let min = null;
7724 for (const ch of this._def.checks) {
7725 if (ch.kind === "min") {
7726 if (min === null || ch.value > min)
7727 min = ch.value;
7728 }
7729 }
7730 return min;
7731 }
7732 get maxLength() {
7733 let max = null;
7734 for (const ch of this._def.checks) {
7735 if (ch.kind === "max") {
7736 if (max === null || ch.value < max)
7737 max = ch.value;
7738 }
7739 }
7740 return max;
7741 }
7742}
7743ZodString.create = (params) => {
7744 return new ZodString({
7745 checks: [],
7746 typeName: ZodFirstPartyTypeKind.ZodString,
7747 coerce: params?.coerce ?? false,
7748 ...processCreateParams(params)
7749 });
7750};
7751function floatSafeRemainder(val, step) {
7752 const valDecCount = (val.toString().split(".")[1] || "").length;
7753 const stepDecCount = (step.toString().split(".")[1] || "").length;
7754 const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
7755 const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
7756 const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
7757 return valInt % stepInt / 10 ** decCount;
7758}
7759
7760class ZodNumber extends ZodType {
7761 constructor() {
7762 super(...arguments);
7763 this.min = this.gte;
7764 this.max = this.lte;
7765 this.step = this.multipleOf;
7766 }
7767 _parse(input) {
7768 if (this._def.coerce) {
7769 input.data = Number(input.data);
7770 }
7771 const parsedType = this._getType(input);
7772 if (parsedType !== ZodParsedType.number) {
7773 const ctx2 = this._getOrReturnCtx(input);
7774 addIssueToContext(ctx2, {
7775 code: ZodIssueCode.invalid_type,
7776 expected: ZodParsedType.number,
7777 received: ctx2.parsedType
7778 });
7779 return INVALID;
7780 }
7781 let ctx = undefined;
7782 const status = new ParseStatus;
7783 for (const check of this._def.checks) {
7784 if (check.kind === "int") {
7785 if (!util.isInteger(input.data)) {
7786 ctx = this._getOrReturnCtx(input, ctx);
7787 addIssueToContext(ctx, {
7788 code: ZodIssueCode.invalid_type,
7789 expected: "integer",
7790 received: "float",
7791 message: check.message
7792 });
7793 status.dirty();
7794 }
7795 } else if (check.kind === "min") {
7796 const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
7797 if (tooSmall) {
7798 ctx = this._getOrReturnCtx(input, ctx);
7799 addIssueToContext(ctx, {
7800 code: ZodIssueCode.too_small,
7801 minimum: check.value,
7802 type: "number",
7803 inclusive: check.inclusive,
7804 exact: false,
7805 message: check.message
7806 });
7807 status.dirty();
7808 }
7809 } else if (check.kind === "max") {
7810 const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
7811 if (tooBig) {
7812 ctx = this._getOrReturnCtx(input, ctx);
7813 addIssueToContext(ctx, {
7814 code: ZodIssueCode.too_big,
7815 maximum: check.value,
7816 type: "number",
7817 inclusive: check.inclusive,
7818 exact: false,
7819 message: check.message
7820 });
7821 status.dirty();
7822 }
7823 } else if (check.kind === "multipleOf") {
7824 if (floatSafeRemainder(input.data, check.value) !== 0) {
7825 ctx = this._getOrReturnCtx(input, ctx);
7826 addIssueToContext(ctx, {
7827 code: ZodIssueCode.not_multiple_of,
7828 multipleOf: check.value,
7829 message: check.message
7830 });
7831 status.dirty();
7832 }
7833 } else if (check.kind === "finite") {
7834 if (!Number.isFinite(input.data)) {
7835 ctx = this._getOrReturnCtx(input, ctx);
7836 addIssueToContext(ctx, {
7837 code: ZodIssueCode.not_finite,
7838 message: check.message
7839 });
7840 status.dirty();
7841 }
7842 } else {
7843 util.assertNever(check);
7844 }
7845 }
7846 return { status: status.value, value: input.data };
7847 }
7848 gte(value, message) {
7849 return this.setLimit("min", value, true, errorUtil.toString(message));
7850 }
7851 gt(value, message) {
7852 return this.setLimit("min", value, false, errorUtil.toString(message));
7853 }
7854 lte(value, message) {
7855 return this.setLimit("max", value, true, errorUtil.toString(message));
7856 }
7857 lt(value, message) {
7858 return this.setLimit("max", value, false, errorUtil.toString(message));
7859 }
7860 setLimit(kind, value, inclusive, message) {
7861 return new ZodNumber({
7862 ...this._def,
7863 checks: [
7864 ...this._def.checks,
7865 {
7866 kind,
7867 value,
7868 inclusive,
7869 message: errorUtil.toString(message)
7870 }
7871 ]
7872 });
7873 }
7874 _addCheck(check) {
7875 return new ZodNumber({
7876 ...this._def,
7877 checks: [...this._def.checks, check]
7878 });
7879 }
7880 int(message) {
7881 return this._addCheck({
7882 kind: "int",
7883 message: errorUtil.toString(message)
7884 });
7885 }
7886 positive(message) {
7887 return this._addCheck({
7888 kind: "min",
7889 value: 0,
7890 inclusive: false,
7891 message: errorUtil.toString(message)
7892 });
7893 }
7894 negative(message) {
7895 return this._addCheck({
7896 kind: "max",
7897 value: 0,
7898 inclusive: false,
7899 message: errorUtil.toString(message)
7900 });
7901 }
7902 nonpositive(message) {
7903 return this._addCheck({
7904 kind: "max",
7905 value: 0,
7906 inclusive: true,
7907 message: errorUtil.toString(message)
7908 });
7909 }
7910 nonnegative(message) {
7911 return this._addCheck({
7912 kind: "min",
7913 value: 0,
7914 inclusive: true,
7915 message: errorUtil.toString(message)
7916 });
7917 }
7918 multipleOf(value, message) {
7919 return this._addCheck({
7920 kind: "multipleOf",
7921 value,
7922 message: errorUtil.toString(message)
7923 });
7924 }
7925 finite(message) {
7926 return this._addCheck({
7927 kind: "finite",
7928 message: errorUtil.toString(message)
7929 });
7930 }
7931 safe(message) {
7932 return this._addCheck({
7933 kind: "min",
7934 inclusive: true,
7935 value: Number.MIN_SAFE_INTEGER,
7936 message: errorUtil.toString(message)
7937 })._addCheck({
7938 kind: "max",
7939 inclusive: true,
7940 value: Number.MAX_SAFE_INTEGER,
7941 message: errorUtil.toString(message)
7942 });
7943 }
7944 get minValue() {
7945 let min = null;
7946 for (const ch of this._def.checks) {
7947 if (ch.kind === "min") {
7948 if (min === null || ch.value > min)
7949 min = ch.value;
7950 }
7951 }
7952 return min;
7953 }
7954 get maxValue() {
7955 let max = null;
7956 for (const ch of this._def.checks) {
7957 if (ch.kind === "max") {
7958 if (max === null || ch.value < max)
7959 max = ch.value;
7960 }
7961 }
7962 return max;
7963 }
7964 get isInt() {
7965 return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
7966 }
7967 get isFinite() {
7968 let max = null;
7969 let min = null;
7970 for (const ch of this._def.checks) {
7971 if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
7972 return true;
7973 } else if (ch.kind === "min") {
7974 if (min === null || ch.value > min)
7975 min = ch.value;
7976 } else if (ch.kind === "max") {
7977 if (max === null || ch.value < max)
7978 max = ch.value;
7979 }
7980 }
7981 return Number.isFinite(min) && Number.isFinite(max);
7982 }
7983}
7984ZodNumber.create = (params) => {
7985 return new ZodNumber({
7986 checks: [],
7987 typeName: ZodFirstPartyTypeKind.ZodNumber,
7988 coerce: params?.coerce || false,
7989 ...processCreateParams(params)
7990 });
7991};
7992
7993class ZodBigInt extends ZodType {
7994 constructor() {
7995 super(...arguments);
7996 this.min = this.gte;
7997 this.max = this.lte;
7998 }
7999 _parse(input) {
8000 if (this._def.coerce) {
8001 try {
8002 input.data = BigInt(input.data);
8003 } catch {
8004 return this._getInvalidInput(input);
8005 }
8006 }
8007 const parsedType = this._getType(input);
8008 if (parsedType !== ZodParsedType.bigint) {
8009 return this._getInvalidInput(input);
8010 }
8011 let ctx = undefined;
8012 const status = new ParseStatus;
8013 for (const check of this._def.checks) {
8014 if (check.kind === "min") {
8015 const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
8016 if (tooSmall) {
8017 ctx = this._getOrReturnCtx(input, ctx);
8018 addIssueToContext(ctx, {
8019 code: ZodIssueCode.too_small,
8020 type: "bigint",
8021 minimum: check.value,
8022 inclusive: check.inclusive,
8023 message: check.message
8024 });
8025 status.dirty();
8026 }
8027 } else if (check.kind === "max") {
8028 const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
8029 if (tooBig) {
8030 ctx = this._getOrReturnCtx(input, ctx);
8031 addIssueToContext(ctx, {
8032 code: ZodIssueCode.too_big,
8033 type: "bigint",
8034 maximum: check.value,
8035 inclusive: check.inclusive,
8036 message: check.message
8037 });
8038 status.dirty();
8039 }
8040 } else if (check.kind === "multipleOf") {
8041 if (input.data % check.value !== BigInt(0)) {
8042 ctx = this._getOrReturnCtx(input, ctx);
8043 addIssueToContext(ctx, {
8044 code: ZodIssueCode.not_multiple_of,
8045 multipleOf: check.value,
8046 message: check.message
8047 });
8048 status.dirty();
8049 }
8050 } else {
8051 util.assertNever(check);
8052 }
8053 }
8054 return { status: status.value, value: input.data };
8055 }
8056 _getInvalidInput(input) {
8057 const ctx = this._getOrReturnCtx(input);
8058 addIssueToContext(ctx, {
8059 code: ZodIssueCode.invalid_type,
8060 expected: ZodParsedType.bigint,
8061 received: ctx.parsedType
8062 });
8063 return INVALID;
8064 }
8065 gte(value, message) {
8066 return this.setLimit("min", value, true, errorUtil.toString(message));
8067 }
8068 gt(value, message) {
8069 return this.setLimit("min", value, false, errorUtil.toString(message));
8070 }
8071 lte(value, message) {
8072 return this.setLimit("max", value, true, errorUtil.toString(message));
8073 }
8074 lt(value, message) {
8075 return this.setLimit("max", value, false, errorUtil.toString(message));
8076 }
8077 setLimit(kind, value, inclusive, message) {
8078 return new ZodBigInt({
8079 ...this._def,
8080 checks: [
8081 ...this._def.checks,
8082 {
8083 kind,
8084 value,
8085 inclusive,
8086 message: errorUtil.toString(message)
8087 }
8088 ]
8089 });
8090 }
8091 _addCheck(check) {
8092 return new ZodBigInt({
8093 ...this._def,
8094 checks: [...this._def.checks, check]
8095 });
8096 }
8097 positive(message) {
8098 return this._addCheck({
8099 kind: "min",
8100 value: BigInt(0),
8101 inclusive: false,
8102 message: errorUtil.toString(message)
8103 });
8104 }
8105 negative(message) {
8106 return this._addCheck({
8107 kind: "max",
8108 value: BigInt(0),
8109 inclusive: false,
8110 message: errorUtil.toString(message)
8111 });
8112 }
8113 nonpositive(message) {
8114 return this._addCheck({
8115 kind: "max",
8116 value: BigInt(0),
8117 inclusive: true,
8118 message: errorUtil.toString(message)
8119 });
8120 }
8121 nonnegative(message) {
8122 return this._addCheck({
8123 kind: "min",
8124 value: BigInt(0),
8125 inclusive: true,
8126 message: errorUtil.toString(message)
8127 });
8128 }
8129 multipleOf(value, message) {
8130 return this._addCheck({
8131 kind: "multipleOf",
8132 value,
8133 message: errorUtil.toString(message)
8134 });
8135 }
8136 get minValue() {
8137 let min = null;
8138 for (const ch of this._def.checks) {
8139 if (ch.kind === "min") {
8140 if (min === null || ch.value > min)
8141 min = ch.value;
8142 }
8143 }
8144 return min;
8145 }
8146 get maxValue() {
8147 let max = null;
8148 for (const ch of this._def.checks) {
8149 if (ch.kind === "max") {
8150 if (max === null || ch.value < max)
8151 max = ch.value;
8152 }
8153 }
8154 return max;
8155 }
8156}
8157ZodBigInt.create = (params) => {
8158 return new ZodBigInt({
8159 checks: [],
8160 typeName: ZodFirstPartyTypeKind.ZodBigInt,
8161 coerce: params?.coerce ?? false,
8162 ...processCreateParams(params)
8163 });
8164};
8165
8166class ZodBoolean extends ZodType {
8167 _parse(input) {
8168 if (this._def.coerce) {
8169 input.data = Boolean(input.data);
8170 }
8171 const parsedType = this._getType(input);
8172 if (parsedType !== ZodParsedType.boolean) {
8173 const ctx = this._getOrReturnCtx(input);
8174 addIssueToContext(ctx, {
8175 code: ZodIssueCode.invalid_type,
8176 expected: ZodParsedType.boolean,
8177 received: ctx.parsedType
8178 });
8179 return INVALID;
8180 }
8181 return OK(input.data);
8182 }
8183}
8184ZodBoolean.create = (params) => {
8185 return new ZodBoolean({
8186 typeName: ZodFirstPartyTypeKind.ZodBoolean,
8187 coerce: params?.coerce || false,
8188 ...processCreateParams(params)
8189 });
8190};
8191
8192class ZodDate extends ZodType {
8193 _parse(input) {
8194 if (this._def.coerce) {
8195 input.data = new Date(input.data);
8196 }
8197 const parsedType = this._getType(input);
8198 if (parsedType !== ZodParsedType.date) {
8199 const ctx2 = this._getOrReturnCtx(input);
8200 addIssueToContext(ctx2, {
8201 code: ZodIssueCode.invalid_type,
8202 expected: ZodParsedType.date,
8203 received: ctx2.parsedType
8204 });
8205 return INVALID;
8206 }
8207 if (Number.isNaN(input.data.getTime())) {
8208 const ctx2 = this._getOrReturnCtx(input);
8209 addIssueToContext(ctx2, {
8210 code: ZodIssueCode.invalid_date
8211 });
8212 return INVALID;
8213 }
8214 const status = new ParseStatus;
8215 let ctx = undefined;
8216 for (const check of this._def.checks) {
8217 if (check.kind === "min") {
8218 if (input.data.getTime() < check.value) {
8219 ctx = this._getOrReturnCtx(input, ctx);
8220 addIssueToContext(ctx, {
8221 code: ZodIssueCode.too_small,
8222 message: check.message,
8223 inclusive: true,
8224 exact: false,
8225 minimum: check.value,
8226 type: "date"
8227 });
8228 status.dirty();
8229 }
8230 } else if (check.kind === "max") {
8231 if (input.data.getTime() > check.value) {
8232 ctx = this._getOrReturnCtx(input, ctx);
8233 addIssueToContext(ctx, {
8234 code: ZodIssueCode.too_big,
8235 message: check.message,
8236 inclusive: true,
8237 exact: false,
8238 maximum: check.value,
8239 type: "date"
8240 });
8241 status.dirty();
8242 }
8243 } else {
8244 util.assertNever(check);
8245 }
8246 }
8247 return {
8248 status: status.value,
8249 value: new Date(input.data.getTime())
8250 };
8251 }
8252 _addCheck(check) {
8253 return new ZodDate({
8254 ...this._def,
8255 checks: [...this._def.checks, check]
8256 });
8257 }
8258 min(minDate, message) {
8259 return this._addCheck({
8260 kind: "min",
8261 value: minDate.getTime(),
8262 message: errorUtil.toString(message)
8263 });
8264 }
8265 max(maxDate, message) {
8266 return this._addCheck({
8267 kind: "max",
8268 value: maxDate.getTime(),
8269 message: errorUtil.toString(message)
8270 });
8271 }
8272 get minDate() {
8273 let min = null;
8274 for (const ch of this._def.checks) {
8275 if (ch.kind === "min") {
8276 if (min === null || ch.value > min)
8277 min = ch.value;
8278 }
8279 }
8280 return min != null ? new Date(min) : null;
8281 }
8282 get maxDate() {
8283 let max = null;
8284 for (const ch of this._def.checks) {
8285 if (ch.kind === "max") {
8286 if (max === null || ch.value < max)
8287 max = ch.value;
8288 }
8289 }
8290 return max != null ? new Date(max) : null;
8291 }
8292}
8293ZodDate.create = (params) => {
8294 return new ZodDate({
8295 checks: [],
8296 coerce: params?.coerce || false,
8297 typeName: ZodFirstPartyTypeKind.ZodDate,
8298 ...processCreateParams(params)
8299 });
8300};
8301
8302class ZodSymbol extends ZodType {
8303 _parse(input) {
8304 const parsedType = this._getType(input);
8305 if (parsedType !== ZodParsedType.symbol) {
8306 const ctx = this._getOrReturnCtx(input);
8307 addIssueToContext(ctx, {
8308 code: ZodIssueCode.invalid_type,
8309 expected: ZodParsedType.symbol,
8310 received: ctx.parsedType
8311 });
8312 return INVALID;
8313 }
8314 return OK(input.data);
8315 }
8316}
8317ZodSymbol.create = (params) => {
8318 return new ZodSymbol({
8319 typeName: ZodFirstPartyTypeKind.ZodSymbol,
8320 ...processCreateParams(params)
8321 });
8322};
8323
8324class ZodUndefined extends ZodType {
8325 _parse(input) {
8326 const parsedType = this._getType(input);
8327 if (parsedType !== ZodParsedType.undefined) {
8328 const ctx = this._getOrReturnCtx(input);
8329 addIssueToContext(ctx, {
8330 code: ZodIssueCode.invalid_type,
8331 expected: ZodParsedType.undefined,
8332 received: ctx.parsedType
8333 });
8334 return INVALID;
8335 }
8336 return OK(input.data);
8337 }
8338}
8339ZodUndefined.create = (params) => {
8340 return new ZodUndefined({
8341 typeName: ZodFirstPartyTypeKind.ZodUndefined,
8342 ...processCreateParams(params)
8343 });
8344};
8345
8346class ZodNull extends ZodType {
8347 _parse(input) {
8348 const parsedType = this._getType(input);
8349 if (parsedType !== ZodParsedType.null) {
8350 const ctx = this._getOrReturnCtx(input);
8351 addIssueToContext(ctx, {
8352 code: ZodIssueCode.invalid_type,
8353 expected: ZodParsedType.null,
8354 received: ctx.parsedType
8355 });
8356 return INVALID;
8357 }
8358 return OK(input.data);
8359 }
8360}
8361ZodNull.create = (params) => {
8362 return new ZodNull({
8363 typeName: ZodFirstPartyTypeKind.ZodNull,
8364 ...processCreateParams(params)
8365 });
8366};
8367
8368class ZodAny extends ZodType {
8369 constructor() {
8370 super(...arguments);
8371 this._any = true;
8372 }
8373 _parse(input) {
8374 return OK(input.data);
8375 }
8376}
8377ZodAny.create = (params) => {
8378 return new ZodAny({
8379 typeName: ZodFirstPartyTypeKind.ZodAny,
8380 ...processCreateParams(params)
8381 });
8382};
8383
8384class ZodUnknown extends ZodType {
8385 constructor() {
8386 super(...arguments);
8387 this._unknown = true;
8388 }
8389 _parse(input) {
8390 return OK(input.data);
8391 }
8392}
8393ZodUnknown.create = (params) => {
8394 return new ZodUnknown({
8395 typeName: ZodFirstPartyTypeKind.ZodUnknown,
8396 ...processCreateParams(params)
8397 });
8398};
8399
8400class ZodNever extends ZodType {
8401 _parse(input) {
8402 const ctx = this._getOrReturnCtx(input);
8403 addIssueToContext(ctx, {
8404 code: ZodIssueCode.invalid_type,
8405 expected: ZodParsedType.never,
8406 received: ctx.parsedType
8407 });
8408 return INVALID;
8409 }
8410}
8411ZodNever.create = (params) => {
8412 return new ZodNever({
8413 typeName: ZodFirstPartyTypeKind.ZodNever,
8414 ...processCreateParams(params)
8415 });
8416};
8417
8418class ZodVoid extends ZodType {
8419 _parse(input) {
8420 const parsedType = this._getType(input);
8421 if (parsedType !== ZodParsedType.undefined) {
8422 const ctx = this._getOrReturnCtx(input);
8423 addIssueToContext(ctx, {
8424 code: ZodIssueCode.invalid_type,
8425 expected: ZodParsedType.void,
8426 received: ctx.parsedType
8427 });
8428 return INVALID;
8429 }
8430 return OK(input.data);
8431 }
8432}
8433ZodVoid.create = (params) => {
8434 return new ZodVoid({
8435 typeName: ZodFirstPartyTypeKind.ZodVoid,
8436 ...processCreateParams(params)
8437 });
8438};
8439
8440class ZodArray extends ZodType {
8441 _parse(input) {
8442 const { ctx, status } = this._processInputParams(input);
8443 const def = this._def;
8444 if (ctx.parsedType !== ZodParsedType.array) {
8445 addIssueToContext(ctx, {
8446 code: ZodIssueCode.invalid_type,
8447 expected: ZodParsedType.array,
8448 received: ctx.parsedType
8449 });
8450 return INVALID;
8451 }
8452 if (def.exactLength !== null) {
8453 const tooBig = ctx.data.length > def.exactLength.value;
8454 const tooSmall = ctx.data.length < def.exactLength.value;
8455 if (tooBig || tooSmall) {
8456 addIssueToContext(ctx, {
8457 code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
8458 minimum: tooSmall ? def.exactLength.value : undefined,
8459 maximum: tooBig ? def.exactLength.value : undefined,
8460 type: "array",
8461 inclusive: true,
8462 exact: true,
8463 message: def.exactLength.message
8464 });
8465 status.dirty();
8466 }
8467 }
8468 if (def.minLength !== null) {
8469 if (ctx.data.length < def.minLength.value) {
8470 addIssueToContext(ctx, {
8471 code: ZodIssueCode.too_small,
8472 minimum: def.minLength.value,
8473 type: "array",
8474 inclusive: true,
8475 exact: false,
8476 message: def.minLength.message
8477 });
8478 status.dirty();
8479 }
8480 }
8481 if (def.maxLength !== null) {
8482 if (ctx.data.length > def.maxLength.value) {
8483 addIssueToContext(ctx, {
8484 code: ZodIssueCode.too_big,
8485 maximum: def.maxLength.value,
8486 type: "array",
8487 inclusive: true,
8488 exact: false,
8489 message: def.maxLength.message
8490 });
8491 status.dirty();
8492 }
8493 }
8494 if (ctx.common.async) {
8495 return Promise.all([...ctx.data].map((item, i) => {
8496 return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8497 })).then((result2) => {
8498 return ParseStatus.mergeArray(status, result2);
8499 });
8500 }
8501 const result = [...ctx.data].map((item, i) => {
8502 return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8503 });
8504 return ParseStatus.mergeArray(status, result);
8505 }
8506 get element() {
8507 return this._def.type;
8508 }
8509 min(minLength, message) {
8510 return new ZodArray({
8511 ...this._def,
8512 minLength: { value: minLength, message: errorUtil.toString(message) }
8513 });
8514 }
8515 max(maxLength, message) {
8516 return new ZodArray({
8517 ...this._def,
8518 maxLength: { value: maxLength, message: errorUtil.toString(message) }
8519 });
8520 }
8521 length(len, message) {
8522 return new ZodArray({
8523 ...this._def,
8524 exactLength: { value: len, message: errorUtil.toString(message) }
8525 });
8526 }
8527 nonempty(message) {
8528 return this.min(1, message);
8529 }
8530}
8531ZodArray.create = (schema, params) => {
8532 return new ZodArray({
8533 type: schema,
8534 minLength: null,
8535 maxLength: null,
8536 exactLength: null,
8537 typeName: ZodFirstPartyTypeKind.ZodArray,
8538 ...processCreateParams(params)
8539 });
8540};
8541function deepPartialify(schema) {
8542 if (schema instanceof ZodObject) {
8543 const newShape = {};
8544 for (const key in schema.shape) {
8545 const fieldSchema = schema.shape[key];
8546 newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
8547 }
8548 return new ZodObject({
8549 ...schema._def,
8550 shape: () => newShape
8551 });
8552 } else if (schema instanceof ZodArray) {
8553 return new ZodArray({
8554 ...schema._def,
8555 type: deepPartialify(schema.element)
8556 });
8557 } else if (schema instanceof ZodOptional) {
8558 return ZodOptional.create(deepPartialify(schema.unwrap()));
8559 } else if (schema instanceof ZodNullable) {
8560 return ZodNullable.create(deepPartialify(schema.unwrap()));
8561 } else if (schema instanceof ZodTuple) {
8562 return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
8563 } else {
8564 return schema;
8565 }
8566}
8567
8568class ZodObject extends ZodType {
8569 constructor() {
8570 super(...arguments);
8571 this._cached = null;
8572 this.nonstrict = this.passthrough;
8573 this.augment = this.extend;
8574 }
8575 _getCached() {
8576 if (this._cached !== null)
8577 return this._cached;
8578 const shape = this._def.shape();
8579 const keys = util.objectKeys(shape);
8580 this._cached = { shape, keys };
8581 return this._cached;
8582 }
8583 _parse(input) {
8584 const parsedType = this._getType(input);
8585 if (parsedType !== ZodParsedType.object) {
8586 const ctx2 = this._getOrReturnCtx(input);
8587 addIssueToContext(ctx2, {
8588 code: ZodIssueCode.invalid_type,
8589 expected: ZodParsedType.object,
8590 received: ctx2.parsedType
8591 });
8592 return INVALID;
8593 }
8594 const { status, ctx } = this._processInputParams(input);
8595 const { shape, keys: shapeKeys } = this._getCached();
8596 const extraKeys = [];
8597 if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
8598 for (const key in ctx.data) {
8599 if (!shapeKeys.includes(key)) {
8600 extraKeys.push(key);
8601 }
8602 }
8603 }
8604 const pairs = [];
8605 for (const key of shapeKeys) {
8606 const keyValidator = shape[key];
8607 const value = ctx.data[key];
8608 pairs.push({
8609 key: { status: "valid", value: key },
8610 value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
8611 alwaysSet: key in ctx.data
8612 });
8613 }
8614 if (this._def.catchall instanceof ZodNever) {
8615 const unknownKeys = this._def.unknownKeys;
8616 if (unknownKeys === "passthrough") {
8617 for (const key of extraKeys) {
8618 pairs.push({
8619 key: { status: "valid", value: key },
8620 value: { status: "valid", value: ctx.data[key] }
8621 });
8622 }
8623 } else if (unknownKeys === "strict") {
8624 if (extraKeys.length > 0) {
8625 addIssueToContext(ctx, {
8626 code: ZodIssueCode.unrecognized_keys,
8627 keys: extraKeys
8628 });
8629 status.dirty();
8630 }
8631 } else if (unknownKeys === "strip") {} else {
8632 throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
8633 }
8634 } else {
8635 const catchall = this._def.catchall;
8636 for (const key of extraKeys) {
8637 const value = ctx.data[key];
8638 pairs.push({
8639 key: { status: "valid", value: key },
8640 value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
8641 alwaysSet: key in ctx.data
8642 });
8643 }
8644 }
8645 if (ctx.common.async) {
8646 return Promise.resolve().then(async () => {
8647 const syncPairs = [];
8648 for (const pair of pairs) {
8649 const key = await pair.key;
8650 const value = await pair.value;
8651 syncPairs.push({
8652 key,
8653 value,
8654 alwaysSet: pair.alwaysSet
8655 });
8656 }
8657 return syncPairs;
8658 }).then((syncPairs) => {
8659 return ParseStatus.mergeObjectSync(status, syncPairs);
8660 });
8661 } else {
8662 return ParseStatus.mergeObjectSync(status, pairs);
8663 }
8664 }
8665 get shape() {
8666 return this._def.shape();
8667 }
8668 strict(message) {
8669 errorUtil.errToObj;
8670 return new ZodObject({
8671 ...this._def,
8672 unknownKeys: "strict",
8673 ...message !== undefined ? {
8674 errorMap: (issue, ctx) => {
8675 const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
8676 if (issue.code === "unrecognized_keys")
8677 return {
8678 message: errorUtil.errToObj(message).message ?? defaultError
8679 };
8680 return {
8681 message: defaultError
8682 };
8683 }
8684 } : {}
8685 });
8686 }
8687 strip() {
8688 return new ZodObject({
8689 ...this._def,
8690 unknownKeys: "strip"
8691 });
8692 }
8693 passthrough() {
8694 return new ZodObject({
8695 ...this._def,
8696 unknownKeys: "passthrough"
8697 });
8698 }
8699 extend(augmentation) {
8700 return new ZodObject({
8701 ...this._def,
8702 shape: () => ({
8703 ...this._def.shape(),
8704 ...augmentation
8705 })
8706 });
8707 }
8708 merge(merging) {
8709 const merged = new ZodObject({
8710 unknownKeys: merging._def.unknownKeys,
8711 catchall: merging._def.catchall,
8712 shape: () => ({
8713 ...this._def.shape(),
8714 ...merging._def.shape()
8715 }),
8716 typeName: ZodFirstPartyTypeKind.ZodObject
8717 });
8718 return merged;
8719 }
8720 setKey(key, schema) {
8721 return this.augment({ [key]: schema });
8722 }
8723 catchall(index) {
8724 return new ZodObject({
8725 ...this._def,
8726 catchall: index
8727 });
8728 }
8729 pick(mask) {
8730 const shape = {};
8731 for (const key of util.objectKeys(mask)) {
8732 if (mask[key] && this.shape[key]) {
8733 shape[key] = this.shape[key];
8734 }
8735 }
8736 return new ZodObject({
8737 ...this._def,
8738 shape: () => shape
8739 });
8740 }
8741 omit(mask) {
8742 const shape = {};
8743 for (const key of util.objectKeys(this.shape)) {
8744 if (!mask[key]) {
8745 shape[key] = this.shape[key];
8746 }
8747 }
8748 return new ZodObject({
8749 ...this._def,
8750 shape: () => shape
8751 });
8752 }
8753 deepPartial() {
8754 return deepPartialify(this);
8755 }
8756 partial(mask) {
8757 const newShape = {};
8758 for (const key of util.objectKeys(this.shape)) {
8759 const fieldSchema = this.shape[key];
8760 if (mask && !mask[key]) {
8761 newShape[key] = fieldSchema;
8762 } else {
8763 newShape[key] = fieldSchema.optional();
8764 }
8765 }
8766 return new ZodObject({
8767 ...this._def,
8768 shape: () => newShape
8769 });
8770 }
8771 required(mask) {
8772 const newShape = {};
8773 for (const key of util.objectKeys(this.shape)) {
8774 if (mask && !mask[key]) {
8775 newShape[key] = this.shape[key];
8776 } else {
8777 const fieldSchema = this.shape[key];
8778 let newField = fieldSchema;
8779 while (newField instanceof ZodOptional) {
8780 newField = newField._def.innerType;
8781 }
8782 newShape[key] = newField;
8783 }
8784 }
8785 return new ZodObject({
8786 ...this._def,
8787 shape: () => newShape
8788 });
8789 }
8790 keyof() {
8791 return createZodEnum(util.objectKeys(this.shape));
8792 }
8793}
8794ZodObject.create = (shape, params) => {
8795 return new ZodObject({
8796 shape: () => shape,
8797 unknownKeys: "strip",
8798 catchall: ZodNever.create(),
8799 typeName: ZodFirstPartyTypeKind.ZodObject,
8800 ...processCreateParams(params)
8801 });
8802};
8803ZodObject.strictCreate = (shape, params) => {
8804 return new ZodObject({
8805 shape: () => shape,
8806 unknownKeys: "strict",
8807 catchall: ZodNever.create(),
8808 typeName: ZodFirstPartyTypeKind.ZodObject,
8809 ...processCreateParams(params)
8810 });
8811};
8812ZodObject.lazycreate = (shape, params) => {
8813 return new ZodObject({
8814 shape,
8815 unknownKeys: "strip",
8816 catchall: ZodNever.create(),
8817 typeName: ZodFirstPartyTypeKind.ZodObject,
8818 ...processCreateParams(params)
8819 });
8820};
8821
8822class ZodUnion extends ZodType {
8823 _parse(input) {
8824 const { ctx } = this._processInputParams(input);
8825 const options = this._def.options;
8826 function handleResults(results) {
8827 for (const result of results) {
8828 if (result.result.status === "valid") {
8829 return result.result;
8830 }
8831 }
8832 for (const result of results) {
8833 if (result.result.status === "dirty") {
8834 ctx.common.issues.push(...result.ctx.common.issues);
8835 return result.result;
8836 }
8837 }
8838 const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
8839 addIssueToContext(ctx, {
8840 code: ZodIssueCode.invalid_union,
8841 unionErrors
8842 });
8843 return INVALID;
8844 }
8845 if (ctx.common.async) {
8846 return Promise.all(options.map(async (option) => {
8847 const childCtx = {
8848 ...ctx,
8849 common: {
8850 ...ctx.common,
8851 issues: []
8852 },
8853 parent: null
8854 };
8855 return {
8856 result: await option._parseAsync({
8857 data: ctx.data,
8858 path: ctx.path,
8859 parent: childCtx
8860 }),
8861 ctx: childCtx
8862 };
8863 })).then(handleResults);
8864 } else {
8865 let dirty = undefined;
8866 const issues = [];
8867 for (const option of options) {
8868 const childCtx = {
8869 ...ctx,
8870 common: {
8871 ...ctx.common,
8872 issues: []
8873 },
8874 parent: null
8875 };
8876 const result = option._parseSync({
8877 data: ctx.data,
8878 path: ctx.path,
8879 parent: childCtx
8880 });
8881 if (result.status === "valid") {
8882 return result;
8883 } else if (result.status === "dirty" && !dirty) {
8884 dirty = { result, ctx: childCtx };
8885 }
8886 if (childCtx.common.issues.length) {
8887 issues.push(childCtx.common.issues);
8888 }
8889 }
8890 if (dirty) {
8891 ctx.common.issues.push(...dirty.ctx.common.issues);
8892 return dirty.result;
8893 }
8894 const unionErrors = issues.map((issues2) => new ZodError(issues2));
8895 addIssueToContext(ctx, {
8896 code: ZodIssueCode.invalid_union,
8897 unionErrors
8898 });
8899 return INVALID;
8900 }
8901 }
8902 get options() {
8903 return this._def.options;
8904 }
8905}
8906ZodUnion.create = (types, params) => {
8907 return new ZodUnion({
8908 options: types,
8909 typeName: ZodFirstPartyTypeKind.ZodUnion,
8910 ...processCreateParams(params)
8911 });
8912};
8913var getDiscriminator = (type) => {
8914 if (type instanceof ZodLazy) {
8915 return getDiscriminator(type.schema);
8916 } else if (type instanceof ZodEffects) {
8917 return getDiscriminator(type.innerType());
8918 } else if (type instanceof ZodLiteral) {
8919 return [type.value];
8920 } else if (type instanceof ZodEnum) {
8921 return type.options;
8922 } else if (type instanceof ZodNativeEnum) {
8923 return util.objectValues(type.enum);
8924 } else if (type instanceof ZodDefault) {
8925 return getDiscriminator(type._def.innerType);
8926 } else if (type instanceof ZodUndefined) {
8927 return [undefined];
8928 } else if (type instanceof ZodNull) {
8929 return [null];
8930 } else if (type instanceof ZodOptional) {
8931 return [undefined, ...getDiscriminator(type.unwrap())];
8932 } else if (type instanceof ZodNullable) {
8933 return [null, ...getDiscriminator(type.unwrap())];
8934 } else if (type instanceof ZodBranded) {
8935 return getDiscriminator(type.unwrap());
8936 } else if (type instanceof ZodReadonly) {
8937 return getDiscriminator(type.unwrap());
8938 } else if (type instanceof ZodCatch) {
8939 return getDiscriminator(type._def.innerType);
8940 } else {
8941 return [];
8942 }
8943};
8944
8945class ZodDiscriminatedUnion extends ZodType {
8946 _parse(input) {
8947 const { ctx } = this._processInputParams(input);
8948 if (ctx.parsedType !== ZodParsedType.object) {
8949 addIssueToContext(ctx, {
8950 code: ZodIssueCode.invalid_type,
8951 expected: ZodParsedType.object,
8952 received: ctx.parsedType
8953 });
8954 return INVALID;
8955 }
8956 const discriminator = this.discriminator;
8957 const discriminatorValue = ctx.data[discriminator];
8958 const option = this.optionsMap.get(discriminatorValue);
8959 if (!option) {
8960 addIssueToContext(ctx, {
8961 code: ZodIssueCode.invalid_union_discriminator,
8962 options: Array.from(this.optionsMap.keys()),
8963 path: [discriminator]
8964 });
8965 return INVALID;
8966 }
8967 if (ctx.common.async) {
8968 return option._parseAsync({
8969 data: ctx.data,
8970 path: ctx.path,
8971 parent: ctx
8972 });
8973 } else {
8974 return option._parseSync({
8975 data: ctx.data,
8976 path: ctx.path,
8977 parent: ctx
8978 });
8979 }
8980 }
8981 get discriminator() {
8982 return this._def.discriminator;
8983 }
8984 get options() {
8985 return this._def.options;
8986 }
8987 get optionsMap() {
8988 return this._def.optionsMap;
8989 }
8990 static create(discriminator, options, params) {
8991 const optionsMap = new Map;
8992 for (const type of options) {
8993 const discriminatorValues = getDiscriminator(type.shape[discriminator]);
8994 if (!discriminatorValues.length) {
8995 throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
8996 }
8997 for (const value of discriminatorValues) {
8998 if (optionsMap.has(value)) {
8999 throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
9000 }
9001 optionsMap.set(value, type);
9002 }
9003 }
9004 return new ZodDiscriminatedUnion({
9005 typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
9006 discriminator,
9007 options,
9008 optionsMap,
9009 ...processCreateParams(params)
9010 });
9011 }
9012}
9013function mergeValues(a, b) {
9014 const aType = getParsedType(a);
9015 const bType = getParsedType(b);
9016 if (a === b) {
9017 return { valid: true, data: a };
9018 } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
9019 const bKeys = util.objectKeys(b);
9020 const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
9021 const newObj = { ...a, ...b };
9022 for (const key of sharedKeys) {
9023 const sharedValue = mergeValues(a[key], b[key]);
9024 if (!sharedValue.valid) {
9025 return { valid: false };
9026 }
9027 newObj[key] = sharedValue.data;
9028 }
9029 return { valid: true, data: newObj };
9030 } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
9031 if (a.length !== b.length) {
9032 return { valid: false };
9033 }
9034 const newArray = [];
9035 for (let index = 0;index < a.length; index++) {
9036 const itemA = a[index];
9037 const itemB = b[index];
9038 const sharedValue = mergeValues(itemA, itemB);
9039 if (!sharedValue.valid) {
9040 return { valid: false };
9041 }
9042 newArray.push(sharedValue.data);
9043 }
9044 return { valid: true, data: newArray };
9045 } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
9046 return { valid: true, data: a };
9047 } else {
9048 return { valid: false };
9049 }
9050}
9051
9052class ZodIntersection extends ZodType {
9053 _parse(input) {
9054 const { status, ctx } = this._processInputParams(input);
9055 const handleParsed = (parsedLeft, parsedRight) => {
9056 if (isAborted(parsedLeft) || isAborted(parsedRight)) {
9057 return INVALID;
9058 }
9059 const merged = mergeValues(parsedLeft.value, parsedRight.value);
9060 if (!merged.valid) {
9061 addIssueToContext(ctx, {
9062 code: ZodIssueCode.invalid_intersection_types
9063 });
9064 return INVALID;
9065 }
9066 if (isDirty(parsedLeft) || isDirty(parsedRight)) {
9067 status.dirty();
9068 }
9069 return { status: status.value, value: merged.data };
9070 };
9071 if (ctx.common.async) {
9072 return Promise.all([
9073 this._def.left._parseAsync({
9074 data: ctx.data,
9075 path: ctx.path,
9076 parent: ctx
9077 }),
9078 this._def.right._parseAsync({
9079 data: ctx.data,
9080 path: ctx.path,
9081 parent: ctx
9082 })
9083 ]).then(([left, right]) => handleParsed(left, right));
9084 } else {
9085 return handleParsed(this._def.left._parseSync({
9086 data: ctx.data,
9087 path: ctx.path,
9088 parent: ctx
9089 }), this._def.right._parseSync({
9090 data: ctx.data,
9091 path: ctx.path,
9092 parent: ctx
9093 }));
9094 }
9095 }
9096}
9097ZodIntersection.create = (left, right, params) => {
9098 return new ZodIntersection({
9099 left,
9100 right,
9101 typeName: ZodFirstPartyTypeKind.ZodIntersection,
9102 ...processCreateParams(params)
9103 });
9104};
9105
9106class ZodTuple extends ZodType {
9107 _parse(input) {
9108 const { status, ctx } = this._processInputParams(input);
9109 if (ctx.parsedType !== ZodParsedType.array) {
9110 addIssueToContext(ctx, {
9111 code: ZodIssueCode.invalid_type,
9112 expected: ZodParsedType.array,
9113 received: ctx.parsedType
9114 });
9115 return INVALID;
9116 }
9117 if (ctx.data.length < this._def.items.length) {
9118 addIssueToContext(ctx, {
9119 code: ZodIssueCode.too_small,
9120 minimum: this._def.items.length,
9121 inclusive: true,
9122 exact: false,
9123 type: "array"
9124 });
9125 return INVALID;
9126 }
9127 const rest = this._def.rest;
9128 if (!rest && ctx.data.length > this._def.items.length) {
9129 addIssueToContext(ctx, {
9130 code: ZodIssueCode.too_big,
9131 maximum: this._def.items.length,
9132 inclusive: true,
9133 exact: false,
9134 type: "array"
9135 });
9136 status.dirty();
9137 }
9138 const items = [...ctx.data].map((item, itemIndex) => {
9139 const schema = this._def.items[itemIndex] || this._def.rest;
9140 if (!schema)
9141 return null;
9142 return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
9143 }).filter((x) => !!x);
9144 if (ctx.common.async) {
9145 return Promise.all(items).then((results) => {
9146 return ParseStatus.mergeArray(status, results);
9147 });
9148 } else {
9149 return ParseStatus.mergeArray(status, items);
9150 }
9151 }
9152 get items() {
9153 return this._def.items;
9154 }
9155 rest(rest) {
9156 return new ZodTuple({
9157 ...this._def,
9158 rest
9159 });
9160 }
9161}
9162ZodTuple.create = (schemas, params) => {
9163 if (!Array.isArray(schemas)) {
9164 throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
9165 }
9166 return new ZodTuple({
9167 items: schemas,
9168 typeName: ZodFirstPartyTypeKind.ZodTuple,
9169 rest: null,
9170 ...processCreateParams(params)
9171 });
9172};
9173
9174class ZodRecord extends ZodType {
9175 get keySchema() {
9176 return this._def.keyType;
9177 }
9178 get valueSchema() {
9179 return this._def.valueType;
9180 }
9181 _parse(input) {
9182 const { status, ctx } = this._processInputParams(input);
9183 if (ctx.parsedType !== ZodParsedType.object) {
9184 addIssueToContext(ctx, {
9185 code: ZodIssueCode.invalid_type,
9186 expected: ZodParsedType.object,
9187 received: ctx.parsedType
9188 });
9189 return INVALID;
9190 }
9191 const pairs = [];
9192 const keyType = this._def.keyType;
9193 const valueType = this._def.valueType;
9194 for (const key in ctx.data) {
9195 pairs.push({
9196 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
9197 value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
9198 alwaysSet: key in ctx.data
9199 });
9200 }
9201 if (ctx.common.async) {
9202 return ParseStatus.mergeObjectAsync(status, pairs);
9203 } else {
9204 return ParseStatus.mergeObjectSync(status, pairs);
9205 }
9206 }
9207 get element() {
9208 return this._def.valueType;
9209 }
9210 static create(first, second, third) {
9211 if (second instanceof ZodType) {
9212 return new ZodRecord({
9213 keyType: first,
9214 valueType: second,
9215 typeName: ZodFirstPartyTypeKind.ZodRecord,
9216 ...processCreateParams(third)
9217 });
9218 }
9219 return new ZodRecord({
9220 keyType: ZodString.create(),
9221 valueType: first,
9222 typeName: ZodFirstPartyTypeKind.ZodRecord,
9223 ...processCreateParams(second)
9224 });
9225 }
9226}
9227
9228class ZodMap extends ZodType {
9229 get keySchema() {
9230 return this._def.keyType;
9231 }
9232 get valueSchema() {
9233 return this._def.valueType;
9234 }
9235 _parse(input) {
9236 const { status, ctx } = this._processInputParams(input);
9237 if (ctx.parsedType !== ZodParsedType.map) {
9238 addIssueToContext(ctx, {
9239 code: ZodIssueCode.invalid_type,
9240 expected: ZodParsedType.map,
9241 received: ctx.parsedType
9242 });
9243 return INVALID;
9244 }
9245 const keyType = this._def.keyType;
9246 const valueType = this._def.valueType;
9247 const pairs = [...ctx.data.entries()].map(([key, value], index) => {
9248 return {
9249 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
9250 value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
9251 };
9252 });
9253 if (ctx.common.async) {
9254 const finalMap = new Map;
9255 return Promise.resolve().then(async () => {
9256 for (const pair of pairs) {
9257 const key = await pair.key;
9258 const value = await pair.value;
9259 if (key.status === "aborted" || value.status === "aborted") {
9260 return INVALID;
9261 }
9262 if (key.status === "dirty" || value.status === "dirty") {
9263 status.dirty();
9264 }
9265 finalMap.set(key.value, value.value);
9266 }
9267 return { status: status.value, value: finalMap };
9268 });
9269 } else {
9270 const finalMap = new Map;
9271 for (const pair of pairs) {
9272 const key = pair.key;
9273 const value = pair.value;
9274 if (key.status === "aborted" || value.status === "aborted") {
9275 return INVALID;
9276 }
9277 if (key.status === "dirty" || value.status === "dirty") {
9278 status.dirty();
9279 }
9280 finalMap.set(key.value, value.value);
9281 }
9282 return { status: status.value, value: finalMap };
9283 }
9284 }
9285}
9286ZodMap.create = (keyType, valueType, params) => {
9287 return new ZodMap({
9288 valueType,
9289 keyType,
9290 typeName: ZodFirstPartyTypeKind.ZodMap,
9291 ...processCreateParams(params)
9292 });
9293};
9294
9295class ZodSet extends ZodType {
9296 _parse(input) {
9297 const { status, ctx } = this._processInputParams(input);
9298 if (ctx.parsedType !== ZodParsedType.set) {
9299 addIssueToContext(ctx, {
9300 code: ZodIssueCode.invalid_type,
9301 expected: ZodParsedType.set,
9302 received: ctx.parsedType
9303 });
9304 return INVALID;
9305 }
9306 const def = this._def;
9307 if (def.minSize !== null) {
9308 if (ctx.data.size < def.minSize.value) {
9309 addIssueToContext(ctx, {
9310 code: ZodIssueCode.too_small,
9311 minimum: def.minSize.value,
9312 type: "set",
9313 inclusive: true,
9314 exact: false,
9315 message: def.minSize.message
9316 });
9317 status.dirty();
9318 }
9319 }
9320 if (def.maxSize !== null) {
9321 if (ctx.data.size > def.maxSize.value) {
9322 addIssueToContext(ctx, {
9323 code: ZodIssueCode.too_big,
9324 maximum: def.maxSize.value,
9325 type: "set",
9326 inclusive: true,
9327 exact: false,
9328 message: def.maxSize.message
9329 });
9330 status.dirty();
9331 }
9332 }
9333 const valueType = this._def.valueType;
9334 function finalizeSet(elements2) {
9335 const parsedSet = new Set;
9336 for (const element of elements2) {
9337 if (element.status === "aborted")
9338 return INVALID;
9339 if (element.status === "dirty")
9340 status.dirty();
9341 parsedSet.add(element.value);
9342 }
9343 return { status: status.value, value: parsedSet };
9344 }
9345 const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
9346 if (ctx.common.async) {
9347 return Promise.all(elements).then((elements2) => finalizeSet(elements2));
9348 } else {
9349 return finalizeSet(elements);
9350 }
9351 }
9352 min(minSize, message) {
9353 return new ZodSet({
9354 ...this._def,
9355 minSize: { value: minSize, message: errorUtil.toString(message) }
9356 });
9357 }
9358 max(maxSize, message) {
9359 return new ZodSet({
9360 ...this._def,
9361 maxSize: { value: maxSize, message: errorUtil.toString(message) }
9362 });
9363 }
9364 size(size, message) {
9365 return this.min(size, message).max(size, message);
9366 }
9367 nonempty(message) {
9368 return this.min(1, message);
9369 }
9370}
9371ZodSet.create = (valueType, params) => {
9372 return new ZodSet({
9373 valueType,
9374 minSize: null,
9375 maxSize: null,
9376 typeName: ZodFirstPartyTypeKind.ZodSet,
9377 ...processCreateParams(params)
9378 });
9379};
9380
9381class ZodFunction extends ZodType {
9382 constructor() {
9383 super(...arguments);
9384 this.validate = this.implement;
9385 }
9386 _parse(input) {
9387 const { ctx } = this._processInputParams(input);
9388 if (ctx.parsedType !== ZodParsedType.function) {
9389 addIssueToContext(ctx, {
9390 code: ZodIssueCode.invalid_type,
9391 expected: ZodParsedType.function,
9392 received: ctx.parsedType
9393 });
9394 return INVALID;
9395 }
9396 function makeArgsIssue(args, error) {
9397 return makeIssue({
9398 data: args,
9399 path: ctx.path,
9400 errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
9401 issueData: {
9402 code: ZodIssueCode.invalid_arguments,
9403 argumentsError: error
9404 }
9405 });
9406 }
9407 function makeReturnsIssue(returns, error) {
9408 return makeIssue({
9409 data: returns,
9410 path: ctx.path,
9411 errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
9412 issueData: {
9413 code: ZodIssueCode.invalid_return_type,
9414 returnTypeError: error
9415 }
9416 });
9417 }
9418 const params = { errorMap: ctx.common.contextualErrorMap };
9419 const fn = ctx.data;
9420 if (this._def.returns instanceof ZodPromise) {
9421 const me = this;
9422 return OK(async function(...args) {
9423 const error = new ZodError([]);
9424 const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
9425 error.addIssue(makeArgsIssue(args, e));
9426 throw error;
9427 });
9428 const result = await Reflect.apply(fn, this, parsedArgs);
9429 const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
9430 error.addIssue(makeReturnsIssue(result, e));
9431 throw error;
9432 });
9433 return parsedReturns;
9434 });
9435 } else {
9436 const me = this;
9437 return OK(function(...args) {
9438 const parsedArgs = me._def.args.safeParse(args, params);
9439 if (!parsedArgs.success) {
9440 throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
9441 }
9442 const result = Reflect.apply(fn, this, parsedArgs.data);
9443 const parsedReturns = me._def.returns.safeParse(result, params);
9444 if (!parsedReturns.success) {
9445 throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
9446 }
9447 return parsedReturns.data;
9448 });
9449 }
9450 }
9451 parameters() {
9452 return this._def.args;
9453 }
9454 returnType() {
9455 return this._def.returns;
9456 }
9457 args(...items) {
9458 return new ZodFunction({
9459 ...this._def,
9460 args: ZodTuple.create(items).rest(ZodUnknown.create())
9461 });
9462 }
9463 returns(returnType) {
9464 return new ZodFunction({
9465 ...this._def,
9466 returns: returnType
9467 });
9468 }
9469 implement(func) {
9470 const validatedFunc = this.parse(func);
9471 return validatedFunc;
9472 }
9473 strictImplement(func) {
9474 const validatedFunc = this.parse(func);
9475 return validatedFunc;
9476 }
9477 static create(args, returns, params) {
9478 return new ZodFunction({
9479 args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
9480 returns: returns || ZodUnknown.create(),
9481 typeName: ZodFirstPartyTypeKind.ZodFunction,
9482 ...processCreateParams(params)
9483 });
9484 }
9485}
9486
9487class ZodLazy extends ZodType {
9488 get schema() {
9489 return this._def.getter();
9490 }
9491 _parse(input) {
9492 const { ctx } = this._processInputParams(input);
9493 const lazySchema = this._def.getter();
9494 return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
9495 }
9496}
9497ZodLazy.create = (getter, params) => {
9498 return new ZodLazy({
9499 getter,
9500 typeName: ZodFirstPartyTypeKind.ZodLazy,
9501 ...processCreateParams(params)
9502 });
9503};
9504
9505class ZodLiteral extends ZodType {
9506 _parse(input) {
9507 if (input.data !== this._def.value) {
9508 const ctx = this._getOrReturnCtx(input);
9509 addIssueToContext(ctx, {
9510 received: ctx.data,
9511 code: ZodIssueCode.invalid_literal,
9512 expected: this._def.value
9513 });
9514 return INVALID;
9515 }
9516 return { status: "valid", value: input.data };
9517 }
9518 get value() {
9519 return this._def.value;
9520 }
9521}
9522ZodLiteral.create = (value, params) => {
9523 return new ZodLiteral({
9524 value,
9525 typeName: ZodFirstPartyTypeKind.ZodLiteral,
9526 ...processCreateParams(params)
9527 });
9528};
9529function createZodEnum(values, params) {
9530 return new ZodEnum({
9531 values,
9532 typeName: ZodFirstPartyTypeKind.ZodEnum,
9533 ...processCreateParams(params)
9534 });
9535}
9536
9537class ZodEnum extends ZodType {
9538 _parse(input) {
9539 if (typeof input.data !== "string") {
9540 const ctx = this._getOrReturnCtx(input);
9541 const expectedValues = this._def.values;
9542 addIssueToContext(ctx, {
9543 expected: util.joinValues(expectedValues),
9544 received: ctx.parsedType,
9545 code: ZodIssueCode.invalid_type
9546 });
9547 return INVALID;
9548 }
9549 if (!this._cache) {
9550 this._cache = new Set(this._def.values);
9551 }
9552 if (!this._cache.has(input.data)) {
9553 const ctx = this._getOrReturnCtx(input);
9554 const expectedValues = this._def.values;
9555 addIssueToContext(ctx, {
9556 received: ctx.data,
9557 code: ZodIssueCode.invalid_enum_value,
9558 options: expectedValues
9559 });
9560 return INVALID;
9561 }
9562 return OK(input.data);
9563 }
9564 get options() {
9565 return this._def.values;
9566 }
9567 get enum() {
9568 const enumValues = {};
9569 for (const val of this._def.values) {
9570 enumValues[val] = val;
9571 }
9572 return enumValues;
9573 }
9574 get Values() {
9575 const enumValues = {};
9576 for (const val of this._def.values) {
9577 enumValues[val] = val;
9578 }
9579 return enumValues;
9580 }
9581 get Enum() {
9582 const enumValues = {};
9583 for (const val of this._def.values) {
9584 enumValues[val] = val;
9585 }
9586 return enumValues;
9587 }
9588 extract(values, newDef = this._def) {
9589 return ZodEnum.create(values, {
9590 ...this._def,
9591 ...newDef
9592 });
9593 }
9594 exclude(values, newDef = this._def) {
9595 return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
9596 ...this._def,
9597 ...newDef
9598 });
9599 }
9600}
9601ZodEnum.create = createZodEnum;
9602
9603class ZodNativeEnum extends ZodType {
9604 _parse(input) {
9605 const nativeEnumValues = util.getValidEnumValues(this._def.values);
9606 const ctx = this._getOrReturnCtx(input);
9607 if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
9608 const expectedValues = util.objectValues(nativeEnumValues);
9609 addIssueToContext(ctx, {
9610 expected: util.joinValues(expectedValues),
9611 received: ctx.parsedType,
9612 code: ZodIssueCode.invalid_type
9613 });
9614 return INVALID;
9615 }
9616 if (!this._cache) {
9617 this._cache = new Set(util.getValidEnumValues(this._def.values));
9618 }
9619 if (!this._cache.has(input.data)) {
9620 const expectedValues = util.objectValues(nativeEnumValues);
9621 addIssueToContext(ctx, {
9622 received: ctx.data,
9623 code: ZodIssueCode.invalid_enum_value,
9624 options: expectedValues
9625 });
9626 return INVALID;
9627 }
9628 return OK(input.data);
9629 }
9630 get enum() {
9631 return this._def.values;
9632 }
9633}
9634ZodNativeEnum.create = (values, params) => {
9635 return new ZodNativeEnum({
9636 values,
9637 typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
9638 ...processCreateParams(params)
9639 });
9640};
9641
9642class ZodPromise extends ZodType {
9643 unwrap() {
9644 return this._def.type;
9645 }
9646 _parse(input) {
9647 const { ctx } = this._processInputParams(input);
9648 if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
9649 addIssueToContext(ctx, {
9650 code: ZodIssueCode.invalid_type,
9651 expected: ZodParsedType.promise,
9652 received: ctx.parsedType
9653 });
9654 return INVALID;
9655 }
9656 const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
9657 return OK(promisified.then((data) => {
9658 return this._def.type.parseAsync(data, {
9659 path: ctx.path,
9660 errorMap: ctx.common.contextualErrorMap
9661 });
9662 }));
9663 }
9664}
9665ZodPromise.create = (schema, params) => {
9666 return new ZodPromise({
9667 type: schema,
9668 typeName: ZodFirstPartyTypeKind.ZodPromise,
9669 ...processCreateParams(params)
9670 });
9671};
9672
9673class ZodEffects extends ZodType {
9674 innerType() {
9675 return this._def.schema;
9676 }
9677 sourceType() {
9678 return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
9679 }
9680 _parse(input) {
9681 const { status, ctx } = this._processInputParams(input);
9682 const effect = this._def.effect || null;
9683 const checkCtx = {
9684 addIssue: (arg) => {
9685 addIssueToContext(ctx, arg);
9686 if (arg.fatal) {
9687 status.abort();
9688 } else {
9689 status.dirty();
9690 }
9691 },
9692 get path() {
9693 return ctx.path;
9694 }
9695 };
9696 checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
9697 if (effect.type === "preprocess") {
9698 const processed = effect.transform(ctx.data, checkCtx);
9699 if (ctx.common.async) {
9700 return Promise.resolve(processed).then(async (processed2) => {
9701 if (status.value === "aborted")
9702 return INVALID;
9703 const result = await this._def.schema._parseAsync({
9704 data: processed2,
9705 path: ctx.path,
9706 parent: ctx
9707 });
9708 if (result.status === "aborted")
9709 return INVALID;
9710 if (result.status === "dirty")
9711 return DIRTY(result.value);
9712 if (status.value === "dirty")
9713 return DIRTY(result.value);
9714 return result;
9715 });
9716 } else {
9717 if (status.value === "aborted")
9718 return INVALID;
9719 const result = this._def.schema._parseSync({
9720 data: processed,
9721 path: ctx.path,
9722 parent: ctx
9723 });
9724 if (result.status === "aborted")
9725 return INVALID;
9726 if (result.status === "dirty")
9727 return DIRTY(result.value);
9728 if (status.value === "dirty")
9729 return DIRTY(result.value);
9730 return result;
9731 }
9732 }
9733 if (effect.type === "refinement") {
9734 const executeRefinement = (acc) => {
9735 const result = effect.refinement(acc, checkCtx);
9736 if (ctx.common.async) {
9737 return Promise.resolve(result);
9738 }
9739 if (result instanceof Promise) {
9740 throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
9741 }
9742 return acc;
9743 };
9744 if (ctx.common.async === false) {
9745 const inner = this._def.schema._parseSync({
9746 data: ctx.data,
9747 path: ctx.path,
9748 parent: ctx
9749 });
9750 if (inner.status === "aborted")
9751 return INVALID;
9752 if (inner.status === "dirty")
9753 status.dirty();
9754 executeRefinement(inner.value);
9755 return { status: status.value, value: inner.value };
9756 } else {
9757 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
9758 if (inner.status === "aborted")
9759 return INVALID;
9760 if (inner.status === "dirty")
9761 status.dirty();
9762 return executeRefinement(inner.value).then(() => {
9763 return { status: status.value, value: inner.value };
9764 });
9765 });
9766 }
9767 }
9768 if (effect.type === "transform") {
9769 if (ctx.common.async === false) {
9770 const base = this._def.schema._parseSync({
9771 data: ctx.data,
9772 path: ctx.path,
9773 parent: ctx
9774 });
9775 if (!isValid(base))
9776 return INVALID;
9777 const result = effect.transform(base.value, checkCtx);
9778 if (result instanceof Promise) {
9779 throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
9780 }
9781 return { status: status.value, value: result };
9782 } else {
9783 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
9784 if (!isValid(base))
9785 return INVALID;
9786 return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
9787 status: status.value,
9788 value: result
9789 }));
9790 });
9791 }
9792 }
9793 util.assertNever(effect);
9794 }
9795}
9796ZodEffects.create = (schema, effect, params) => {
9797 return new ZodEffects({
9798 schema,
9799 typeName: ZodFirstPartyTypeKind.ZodEffects,
9800 effect,
9801 ...processCreateParams(params)
9802 });
9803};
9804ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
9805 return new ZodEffects({
9806 schema,
9807 effect: { type: "preprocess", transform: preprocess },
9808 typeName: ZodFirstPartyTypeKind.ZodEffects,
9809 ...processCreateParams(params)
9810 });
9811};
9812class ZodOptional extends ZodType {
9813 _parse(input) {
9814 const parsedType = this._getType(input);
9815 if (parsedType === ZodParsedType.undefined) {
9816 return OK(undefined);
9817 }
9818 return this._def.innerType._parse(input);
9819 }
9820 unwrap() {
9821 return this._def.innerType;
9822 }
9823}
9824ZodOptional.create = (type, params) => {
9825 return new ZodOptional({
9826 innerType: type,
9827 typeName: ZodFirstPartyTypeKind.ZodOptional,
9828 ...processCreateParams(params)
9829 });
9830};
9831
9832class ZodNullable extends ZodType {
9833 _parse(input) {
9834 const parsedType = this._getType(input);
9835 if (parsedType === ZodParsedType.null) {
9836 return OK(null);
9837 }
9838 return this._def.innerType._parse(input);
9839 }
9840 unwrap() {
9841 return this._def.innerType;
9842 }
9843}
9844ZodNullable.create = (type, params) => {
9845 return new ZodNullable({
9846 innerType: type,
9847 typeName: ZodFirstPartyTypeKind.ZodNullable,
9848 ...processCreateParams(params)
9849 });
9850};
9851
9852class ZodDefault extends ZodType {
9853 _parse(input) {
9854 const { ctx } = this._processInputParams(input);
9855 let data = ctx.data;
9856 if (ctx.parsedType === ZodParsedType.undefined) {
9857 data = this._def.defaultValue();
9858 }
9859 return this._def.innerType._parse({
9860 data,
9861 path: ctx.path,
9862 parent: ctx
9863 });
9864 }
9865 removeDefault() {
9866 return this._def.innerType;
9867 }
9868}
9869ZodDefault.create = (type, params) => {
9870 return new ZodDefault({
9871 innerType: type,
9872 typeName: ZodFirstPartyTypeKind.ZodDefault,
9873 defaultValue: typeof params.default === "function" ? params.default : () => params.default,
9874 ...processCreateParams(params)
9875 });
9876};
9877
9878class ZodCatch extends ZodType {
9879 _parse(input) {
9880 const { ctx } = this._processInputParams(input);
9881 const newCtx = {
9882 ...ctx,
9883 common: {
9884 ...ctx.common,
9885 issues: []
9886 }
9887 };
9888 const result = this._def.innerType._parse({
9889 data: newCtx.data,
9890 path: newCtx.path,
9891 parent: {
9892 ...newCtx
9893 }
9894 });
9895 if (isAsync(result)) {
9896 return result.then((result2) => {
9897 return {
9898 status: "valid",
9899 value: result2.status === "valid" ? result2.value : this._def.catchValue({
9900 get error() {
9901 return new ZodError(newCtx.common.issues);
9902 },
9903 input: newCtx.data
9904 })
9905 };
9906 });
9907 } else {
9908 return {
9909 status: "valid",
9910 value: result.status === "valid" ? result.value : this._def.catchValue({
9911 get error() {
9912 return new ZodError(newCtx.common.issues);
9913 },
9914 input: newCtx.data
9915 })
9916 };
9917 }
9918 }
9919 removeCatch() {
9920 return this._def.innerType;
9921 }
9922}
9923ZodCatch.create = (type, params) => {
9924 return new ZodCatch({
9925 innerType: type,
9926 typeName: ZodFirstPartyTypeKind.ZodCatch,
9927 catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
9928 ...processCreateParams(params)
9929 });
9930};
9931
9932class ZodNaN extends ZodType {
9933 _parse(input) {
9934 const parsedType = this._getType(input);
9935 if (parsedType !== ZodParsedType.nan) {
9936 const ctx = this._getOrReturnCtx(input);
9937 addIssueToContext(ctx, {
9938 code: ZodIssueCode.invalid_type,
9939 expected: ZodParsedType.nan,
9940 received: ctx.parsedType
9941 });
9942 return INVALID;
9943 }
9944 return { status: "valid", value: input.data };
9945 }
9946}
9947ZodNaN.create = (params) => {
9948 return new ZodNaN({
9949 typeName: ZodFirstPartyTypeKind.ZodNaN,
9950 ...processCreateParams(params)
9951 });
9952};
9953var BRAND = Symbol("zod_brand");
9954
9955class ZodBranded extends ZodType {
9956 _parse(input) {
9957 const { ctx } = this._processInputParams(input);
9958 const data = ctx.data;
9959 return this._def.type._parse({
9960 data,
9961 path: ctx.path,
9962 parent: ctx
9963 });
9964 }
9965 unwrap() {
9966 return this._def.type;
9967 }
9968}
9969
9970class ZodPipeline extends ZodType {
9971 _parse(input) {
9972 const { status, ctx } = this._processInputParams(input);
9973 if (ctx.common.async) {
9974 const handleAsync = async () => {
9975 const inResult = await this._def.in._parseAsync({
9976 data: ctx.data,
9977 path: ctx.path,
9978 parent: ctx
9979 });
9980 if (inResult.status === "aborted")
9981 return INVALID;
9982 if (inResult.status === "dirty") {
9983 status.dirty();
9984 return DIRTY(inResult.value);
9985 } else {
9986 return this._def.out._parseAsync({
9987 data: inResult.value,
9988 path: ctx.path,
9989 parent: ctx
9990 });
9991 }
9992 };
9993 return handleAsync();
9994 } else {
9995 const inResult = this._def.in._parseSync({
9996 data: ctx.data,
9997 path: ctx.path,
9998 parent: ctx
9999 });
10000 if (inResult.status === "aborted")
10001 return INVALID;
10002 if (inResult.status === "dirty") {
10003 status.dirty();
10004 return {
10005 status: "dirty",
10006 value: inResult.value
10007 };
10008 } else {
10009 return this._def.out._parseSync({
10010 data: inResult.value,
10011 path: ctx.path,
10012 parent: ctx
10013 });
10014 }
10015 }
10016 }
10017 static create(a, b) {
10018 return new ZodPipeline({
10019 in: a,
10020 out: b,
10021 typeName: ZodFirstPartyTypeKind.ZodPipeline
10022 });
10023 }
10024}
10025
10026class ZodReadonly extends ZodType {
10027 _parse(input) {
10028 const result = this._def.innerType._parse(input);
10029 const freeze = (data) => {
10030 if (isValid(data)) {
10031 data.value = Object.freeze(data.value);
10032 }
10033 return data;
10034 };
10035 return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
10036 }
10037 unwrap() {
10038 return this._def.innerType;
10039 }
10040}
10041ZodReadonly.create = (type, params) => {
10042 return new ZodReadonly({
10043 innerType: type,
10044 typeName: ZodFirstPartyTypeKind.ZodReadonly,
10045 ...processCreateParams(params)
10046 });
10047};
10048function cleanParams(params, data) {
10049 const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
10050 const p2 = typeof p === "string" ? { message: p } : p;
10051 return p2;
10052}
10053function custom(check, _params = {}, fatal) {
10054 if (check)
10055 return ZodAny.create().superRefine((data, ctx) => {
10056 const r = check(data);
10057 if (r instanceof Promise) {
10058 return r.then((r2) => {
10059 if (!r2) {
10060 const params = cleanParams(_params, data);
10061 const _fatal = params.fatal ?? fatal ?? true;
10062 ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10063 }
10064 });
10065 }
10066 if (!r) {
10067 const params = cleanParams(_params, data);
10068 const _fatal = params.fatal ?? fatal ?? true;
10069 ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10070 }
10071 return;
10072 });
10073 return ZodAny.create();
10074}
10075var late = {
10076 object: ZodObject.lazycreate
10077};
10078var ZodFirstPartyTypeKind;
10079(function(ZodFirstPartyTypeKind2) {
10080 ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
10081 ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
10082 ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
10083 ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
10084 ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
10085 ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
10086 ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
10087 ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
10088 ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
10089 ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
10090 ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
10091 ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
10092 ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
10093 ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
10094 ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
10095 ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
10096 ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
10097 ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
10098 ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
10099 ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
10100 ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
10101 ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
10102 ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
10103 ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
10104 ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
10105 ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
10106 ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
10107 ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
10108 ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
10109 ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
10110 ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
10111 ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
10112 ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
10113 ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
10114 ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
10115 ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
10116})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
10117var instanceOfType = (cls, params = {
10118 message: `Input not instance of ${cls.name}`
10119}) => custom((data) => data instanceof cls, params);
10120var stringType = ZodString.create;
10121var numberType = ZodNumber.create;
10122var nanType = ZodNaN.create;
10123var bigIntType = ZodBigInt.create;
10124var booleanType = ZodBoolean.create;
10125var dateType = ZodDate.create;
10126var symbolType = ZodSymbol.create;
10127var undefinedType = ZodUndefined.create;
10128var nullType = ZodNull.create;
10129var anyType = ZodAny.create;
10130var unknownType = ZodUnknown.create;
10131var neverType = ZodNever.create;
10132var voidType = ZodVoid.create;
10133var arrayType = ZodArray.create;
10134var objectType = ZodObject.create;
10135var strictObjectType = ZodObject.strictCreate;
10136var unionType = ZodUnion.create;
10137var discriminatedUnionType = ZodDiscriminatedUnion.create;
10138var intersectionType = ZodIntersection.create;
10139var tupleType = ZodTuple.create;
10140var recordType = ZodRecord.create;
10141var mapType = ZodMap.create;
10142var setType = ZodSet.create;
10143var functionType = ZodFunction.create;
10144var lazyType = ZodLazy.create;
10145var literalType = ZodLiteral.create;
10146var enumType = ZodEnum.create;
10147var nativeEnumType = ZodNativeEnum.create;
10148var promiseType = ZodPromise.create;
10149var effectsType = ZodEffects.create;
10150var optionalType = ZodOptional.create;
10151var nullableType = ZodNullable.create;
10152var preprocessType = ZodEffects.createWithPreprocess;
10153var pipelineType = ZodPipeline.create;
10154var ostring = () => stringType().optional();
10155var onumber = () => numberType().optional();
10156var oboolean = () => booleanType().optional();
10157var coerce = {
10158 string: (arg) => ZodString.create({ ...arg, coerce: true }),
10159 number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
10160 boolean: (arg) => ZodBoolean.create({
10161 ...arg,
10162 coerce: true
10163 }),
10164 bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
10165 date: (arg) => ZodDate.create({ ...arg, coerce: true })
10166};
10167var NEVER = INVALID;
10168// node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
10169var LATEST_PROTOCOL_VERSION = "2025-06-18";
10170var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-03-26", "2024-11-05", "2024-10-07"];
10171var JSONRPC_VERSION = "2.0";
10172var ProgressTokenSchema = exports_external.union([exports_external.string(), exports_external.number().int()]);
10173var CursorSchema = exports_external.string();
10174var RequestMetaSchema = exports_external.object({
10175 progressToken: exports_external.optional(ProgressTokenSchema)
10176}).passthrough();
10177var BaseRequestParamsSchema = exports_external.object({
10178 _meta: exports_external.optional(RequestMetaSchema)
10179}).passthrough();
10180var RequestSchema = exports_external.object({
10181 method: exports_external.string(),
10182 params: exports_external.optional(BaseRequestParamsSchema)
10183});
10184var BaseNotificationParamsSchema = exports_external.object({
10185 _meta: exports_external.optional(exports_external.object({}).passthrough())
10186}).passthrough();
10187var NotificationSchema = exports_external.object({
10188 method: exports_external.string(),
10189 params: exports_external.optional(BaseNotificationParamsSchema)
10190});
10191var ResultSchema = exports_external.object({
10192 _meta: exports_external.optional(exports_external.object({}).passthrough())
10193}).passthrough();
10194var RequestIdSchema = exports_external.union([exports_external.string(), exports_external.number().int()]);
10195var JSONRPCRequestSchema = exports_external.object({
10196 jsonrpc: exports_external.literal(JSONRPC_VERSION),
10197 id: RequestIdSchema
10198}).merge(RequestSchema).strict();
10199var isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;
10200var JSONRPCNotificationSchema = exports_external.object({
10201 jsonrpc: exports_external.literal(JSONRPC_VERSION)
10202}).merge(NotificationSchema).strict();
10203var isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
10204var JSONRPCResponseSchema = exports_external.object({
10205 jsonrpc: exports_external.literal(JSONRPC_VERSION),
10206 id: RequestIdSchema,
10207 result: ResultSchema
10208}).strict();
10209var isJSONRPCResponse = (value) => JSONRPCResponseSchema.safeParse(value).success;
10210var ErrorCode;
10211(function(ErrorCode2) {
10212 ErrorCode2[ErrorCode2["ConnectionClosed"] = -32000] = "ConnectionClosed";
10213 ErrorCode2[ErrorCode2["RequestTimeout"] = -32001] = "RequestTimeout";
10214 ErrorCode2[ErrorCode2["ParseError"] = -32700] = "ParseError";
10215 ErrorCode2[ErrorCode2["InvalidRequest"] = -32600] = "InvalidRequest";
10216 ErrorCode2[ErrorCode2["MethodNotFound"] = -32601] = "MethodNotFound";
10217 ErrorCode2[ErrorCode2["InvalidParams"] = -32602] = "InvalidParams";
10218 ErrorCode2[ErrorCode2["InternalError"] = -32603] = "InternalError";
10219})(ErrorCode || (ErrorCode = {}));
10220var JSONRPCErrorSchema = exports_external.object({
10221 jsonrpc: exports_external.literal(JSONRPC_VERSION),
10222 id: RequestIdSchema,
10223 error: exports_external.object({
10224 code: exports_external.number().int(),
10225 message: exports_external.string(),
10226 data: exports_external.optional(exports_external.unknown())
10227 })
10228}).strict();
10229var isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
10230var JSONRPCMessageSchema = exports_external.union([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]);
10231var EmptyResultSchema = ResultSchema.strict();
10232var CancelledNotificationSchema = NotificationSchema.extend({
10233 method: exports_external.literal("notifications/cancelled"),
10234 params: BaseNotificationParamsSchema.extend({
10235 requestId: RequestIdSchema,
10236 reason: exports_external.string().optional()
10237 })
10238});
10239var IconSchema = exports_external.object({
10240 src: exports_external.string(),
10241 mimeType: exports_external.optional(exports_external.string()),
10242 sizes: exports_external.optional(exports_external.array(exports_external.string()))
10243}).passthrough();
10244var IconsSchema = exports_external.object({
10245 icons: exports_external.array(IconSchema).optional()
10246}).passthrough();
10247var BaseMetadataSchema = exports_external.object({
10248 name: exports_external.string(),
10249 title: exports_external.optional(exports_external.string())
10250}).passthrough();
10251var ImplementationSchema = BaseMetadataSchema.extend({
10252 version: exports_external.string(),
10253 websiteUrl: exports_external.optional(exports_external.string())
10254}).merge(IconsSchema);
10255var ClientCapabilitiesSchema = exports_external.object({
10256 experimental: exports_external.optional(exports_external.object({}).passthrough()),
10257 sampling: exports_external.optional(exports_external.object({}).passthrough()),
10258 elicitation: exports_external.optional(exports_external.object({}).passthrough()),
10259 roots: exports_external.optional(exports_external.object({
10260 listChanged: exports_external.optional(exports_external.boolean())
10261 }).passthrough())
10262}).passthrough();
10263var InitializeRequestSchema = RequestSchema.extend({
10264 method: exports_external.literal("initialize"),
10265 params: BaseRequestParamsSchema.extend({
10266 protocolVersion: exports_external.string(),
10267 capabilities: ClientCapabilitiesSchema,
10268 clientInfo: ImplementationSchema
10269 })
10270});
10271var ServerCapabilitiesSchema = exports_external.object({
10272 experimental: exports_external.optional(exports_external.object({}).passthrough()),
10273 logging: exports_external.optional(exports_external.object({}).passthrough()),
10274 completions: exports_external.optional(exports_external.object({}).passthrough()),
10275 prompts: exports_external.optional(exports_external.object({
10276 listChanged: exports_external.optional(exports_external.boolean())
10277 }).passthrough()),
10278 resources: exports_external.optional(exports_external.object({
10279 subscribe: exports_external.optional(exports_external.boolean()),
10280 listChanged: exports_external.optional(exports_external.boolean())
10281 }).passthrough()),
10282 tools: exports_external.optional(exports_external.object({
10283 listChanged: exports_external.optional(exports_external.boolean())
10284 }).passthrough())
10285}).passthrough();
10286var InitializeResultSchema = ResultSchema.extend({
10287 protocolVersion: exports_external.string(),
10288 capabilities: ServerCapabilitiesSchema,
10289 serverInfo: ImplementationSchema,
10290 instructions: exports_external.optional(exports_external.string())
10291});
10292var InitializedNotificationSchema = NotificationSchema.extend({
10293 method: exports_external.literal("notifications/initialized")
10294});
10295var PingRequestSchema = RequestSchema.extend({
10296 method: exports_external.literal("ping")
10297});
10298var ProgressSchema = exports_external.object({
10299 progress: exports_external.number(),
10300 total: exports_external.optional(exports_external.number()),
10301 message: exports_external.optional(exports_external.string())
10302}).passthrough();
10303var ProgressNotificationSchema = NotificationSchema.extend({
10304 method: exports_external.literal("notifications/progress"),
10305 params: BaseNotificationParamsSchema.merge(ProgressSchema).extend({
10306 progressToken: ProgressTokenSchema
10307 })
10308});
10309var PaginatedRequestSchema = RequestSchema.extend({
10310 params: BaseRequestParamsSchema.extend({
10311 cursor: exports_external.optional(CursorSchema)
10312 }).optional()
10313});
10314var PaginatedResultSchema = ResultSchema.extend({
10315 nextCursor: exports_external.optional(CursorSchema)
10316});
10317var ResourceContentsSchema = exports_external.object({
10318 uri: exports_external.string(),
10319 mimeType: exports_external.optional(exports_external.string()),
10320 _meta: exports_external.optional(exports_external.object({}).passthrough())
10321}).passthrough();
10322var TextResourceContentsSchema = ResourceContentsSchema.extend({
10323 text: exports_external.string()
10324});
10325var Base64Schema = exports_external.string().refine((val) => {
10326 try {
10327 atob(val);
10328 return true;
10329 } catch (_a) {
10330 return false;
10331 }
10332}, { message: "Invalid Base64 string" });
10333var BlobResourceContentsSchema = ResourceContentsSchema.extend({
10334 blob: Base64Schema
10335});
10336var ResourceSchema = BaseMetadataSchema.extend({
10337 uri: exports_external.string(),
10338 description: exports_external.optional(exports_external.string()),
10339 mimeType: exports_external.optional(exports_external.string()),
10340 _meta: exports_external.optional(exports_external.object({}).passthrough())
10341}).merge(IconsSchema);
10342var ResourceTemplateSchema = BaseMetadataSchema.extend({
10343 uriTemplate: exports_external.string(),
10344 description: exports_external.optional(exports_external.string()),
10345 mimeType: exports_external.optional(exports_external.string()),
10346 _meta: exports_external.optional(exports_external.object({}).passthrough())
10347}).merge(IconsSchema);
10348var ListResourcesRequestSchema = PaginatedRequestSchema.extend({
10349 method: exports_external.literal("resources/list")
10350});
10351var ListResourcesResultSchema = PaginatedResultSchema.extend({
10352 resources: exports_external.array(ResourceSchema)
10353});
10354var ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({
10355 method: exports_external.literal("resources/templates/list")
10356});
10357var ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
10358 resourceTemplates: exports_external.array(ResourceTemplateSchema)
10359});
10360var ReadResourceRequestSchema = RequestSchema.extend({
10361 method: exports_external.literal("resources/read"),
10362 params: BaseRequestParamsSchema.extend({
10363 uri: exports_external.string()
10364 })
10365});
10366var ReadResourceResultSchema = ResultSchema.extend({
10367 contents: exports_external.array(exports_external.union([TextResourceContentsSchema, BlobResourceContentsSchema]))
10368});
10369var ResourceListChangedNotificationSchema = NotificationSchema.extend({
10370 method: exports_external.literal("notifications/resources/list_changed")
10371});
10372var SubscribeRequestSchema = RequestSchema.extend({
10373 method: exports_external.literal("resources/subscribe"),
10374 params: BaseRequestParamsSchema.extend({
10375 uri: exports_external.string()
10376 })
10377});
10378var UnsubscribeRequestSchema = RequestSchema.extend({
10379 method: exports_external.literal("resources/unsubscribe"),
10380 params: BaseRequestParamsSchema.extend({
10381 uri: exports_external.string()
10382 })
10383});
10384var ResourceUpdatedNotificationSchema = NotificationSchema.extend({
10385 method: exports_external.literal("notifications/resources/updated"),
10386 params: BaseNotificationParamsSchema.extend({
10387 uri: exports_external.string()
10388 })
10389});
10390var PromptArgumentSchema = exports_external.object({
10391 name: exports_external.string(),
10392 description: exports_external.optional(exports_external.string()),
10393 required: exports_external.optional(exports_external.boolean())
10394}).passthrough();
10395var PromptSchema = BaseMetadataSchema.extend({
10396 description: exports_external.optional(exports_external.string()),
10397 arguments: exports_external.optional(exports_external.array(PromptArgumentSchema)),
10398 _meta: exports_external.optional(exports_external.object({}).passthrough())
10399}).merge(IconsSchema);
10400var ListPromptsRequestSchema = PaginatedRequestSchema.extend({
10401 method: exports_external.literal("prompts/list")
10402});
10403var ListPromptsResultSchema = PaginatedResultSchema.extend({
10404 prompts: exports_external.array(PromptSchema)
10405});
10406var GetPromptRequestSchema = RequestSchema.extend({
10407 method: exports_external.literal("prompts/get"),
10408 params: BaseRequestParamsSchema.extend({
10409 name: exports_external.string(),
10410 arguments: exports_external.optional(exports_external.record(exports_external.string()))
10411 })
10412});
10413var TextContentSchema = exports_external.object({
10414 type: exports_external.literal("text"),
10415 text: exports_external.string(),
10416 _meta: exports_external.optional(exports_external.object({}).passthrough())
10417}).passthrough();
10418var ImageContentSchema = exports_external.object({
10419 type: exports_external.literal("image"),
10420 data: Base64Schema,
10421 mimeType: exports_external.string(),
10422 _meta: exports_external.optional(exports_external.object({}).passthrough())
10423}).passthrough();
10424var AudioContentSchema = exports_external.object({
10425 type: exports_external.literal("audio"),
10426 data: Base64Schema,
10427 mimeType: exports_external.string(),
10428 _meta: exports_external.optional(exports_external.object({}).passthrough())
10429}).passthrough();
10430var EmbeddedResourceSchema = exports_external.object({
10431 type: exports_external.literal("resource"),
10432 resource: exports_external.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
10433 _meta: exports_external.optional(exports_external.object({}).passthrough())
10434}).passthrough();
10435var ResourceLinkSchema = ResourceSchema.extend({
10436 type: exports_external.literal("resource_link")
10437});
10438var ContentBlockSchema = exports_external.union([
10439 TextContentSchema,
10440 ImageContentSchema,
10441 AudioContentSchema,
10442 ResourceLinkSchema,
10443 EmbeddedResourceSchema
10444]);
10445var PromptMessageSchema = exports_external.object({
10446 role: exports_external.enum(["user", "assistant"]),
10447 content: ContentBlockSchema
10448}).passthrough();
10449var GetPromptResultSchema = ResultSchema.extend({
10450 description: exports_external.optional(exports_external.string()),
10451 messages: exports_external.array(PromptMessageSchema)
10452});
10453var PromptListChangedNotificationSchema = NotificationSchema.extend({
10454 method: exports_external.literal("notifications/prompts/list_changed")
10455});
10456var ToolAnnotationsSchema = exports_external.object({
10457 title: exports_external.optional(exports_external.string()),
10458 readOnlyHint: exports_external.optional(exports_external.boolean()),
10459 destructiveHint: exports_external.optional(exports_external.boolean()),
10460 idempotentHint: exports_external.optional(exports_external.boolean()),
10461 openWorldHint: exports_external.optional(exports_external.boolean())
10462}).passthrough();
10463var ToolSchema = BaseMetadataSchema.extend({
10464 description: exports_external.optional(exports_external.string()),
10465 inputSchema: exports_external.object({
10466 type: exports_external.literal("object"),
10467 properties: exports_external.optional(exports_external.object({}).passthrough()),
10468 required: exports_external.optional(exports_external.array(exports_external.string()))
10469 }).passthrough(),
10470 outputSchema: exports_external.optional(exports_external.object({
10471 type: exports_external.literal("object"),
10472 properties: exports_external.optional(exports_external.object({}).passthrough()),
10473 required: exports_external.optional(exports_external.array(exports_external.string()))
10474 }).passthrough()),
10475 annotations: exports_external.optional(ToolAnnotationsSchema),
10476 _meta: exports_external.optional(exports_external.object({}).passthrough())
10477}).merge(IconsSchema);
10478var ListToolsRequestSchema = PaginatedRequestSchema.extend({
10479 method: exports_external.literal("tools/list")
10480});
10481var ListToolsResultSchema = PaginatedResultSchema.extend({
10482 tools: exports_external.array(ToolSchema)
10483});
10484var CallToolResultSchema = ResultSchema.extend({
10485 content: exports_external.array(ContentBlockSchema).default([]),
10486 structuredContent: exports_external.object({}).passthrough().optional(),
10487 isError: exports_external.optional(exports_external.boolean())
10488});
10489var CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
10490 toolResult: exports_external.unknown()
10491}));
10492var CallToolRequestSchema = RequestSchema.extend({
10493 method: exports_external.literal("tools/call"),
10494 params: BaseRequestParamsSchema.extend({
10495 name: exports_external.string(),
10496 arguments: exports_external.optional(exports_external.record(exports_external.unknown()))
10497 })
10498});
10499var ToolListChangedNotificationSchema = NotificationSchema.extend({
10500 method: exports_external.literal("notifications/tools/list_changed")
10501});
10502var LoggingLevelSchema = exports_external.enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
10503var SetLevelRequestSchema = RequestSchema.extend({
10504 method: exports_external.literal("logging/setLevel"),
10505 params: BaseRequestParamsSchema.extend({
10506 level: LoggingLevelSchema
10507 })
10508});
10509var LoggingMessageNotificationSchema = NotificationSchema.extend({
10510 method: exports_external.literal("notifications/message"),
10511 params: BaseNotificationParamsSchema.extend({
10512 level: LoggingLevelSchema,
10513 logger: exports_external.optional(exports_external.string()),
10514 data: exports_external.unknown()
10515 })
10516});
10517var ModelHintSchema = exports_external.object({
10518 name: exports_external.string().optional()
10519}).passthrough();
10520var ModelPreferencesSchema = exports_external.object({
10521 hints: exports_external.optional(exports_external.array(ModelHintSchema)),
10522 costPriority: exports_external.optional(exports_external.number().min(0).max(1)),
10523 speedPriority: exports_external.optional(exports_external.number().min(0).max(1)),
10524 intelligencePriority: exports_external.optional(exports_external.number().min(0).max(1))
10525}).passthrough();
10526var SamplingMessageSchema = exports_external.object({
10527 role: exports_external.enum(["user", "assistant"]),
10528 content: exports_external.union([TextContentSchema, ImageContentSchema, AudioContentSchema])
10529}).passthrough();
10530var CreateMessageRequestSchema = RequestSchema.extend({
10531 method: exports_external.literal("sampling/createMessage"),
10532 params: BaseRequestParamsSchema.extend({
10533 messages: exports_external.array(SamplingMessageSchema),
10534 systemPrompt: exports_external.optional(exports_external.string()),
10535 includeContext: exports_external.optional(exports_external.enum(["none", "thisServer", "allServers"])),
10536 temperature: exports_external.optional(exports_external.number()),
10537 maxTokens: exports_external.number().int(),
10538 stopSequences: exports_external.optional(exports_external.array(exports_external.string())),
10539 metadata: exports_external.optional(exports_external.object({}).passthrough()),
10540 modelPreferences: exports_external.optional(ModelPreferencesSchema)
10541 })
10542});
10543var CreateMessageResultSchema = ResultSchema.extend({
10544 model: exports_external.string(),
10545 stopReason: exports_external.optional(exports_external.enum(["endTurn", "stopSequence", "maxTokens"]).or(exports_external.string())),
10546 role: exports_external.enum(["user", "assistant"]),
10547 content: exports_external.discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema])
10548});
10549var BooleanSchemaSchema = exports_external.object({
10550 type: exports_external.literal("boolean"),
10551 title: exports_external.optional(exports_external.string()),
10552 description: exports_external.optional(exports_external.string()),
10553 default: exports_external.optional(exports_external.boolean())
10554}).passthrough();
10555var StringSchemaSchema = exports_external.object({
10556 type: exports_external.literal("string"),
10557 title: exports_external.optional(exports_external.string()),
10558 description: exports_external.optional(exports_external.string()),
10559 minLength: exports_external.optional(exports_external.number()),
10560 maxLength: exports_external.optional(exports_external.number()),
10561 format: exports_external.optional(exports_external.enum(["email", "uri", "date", "date-time"]))
10562}).passthrough();
10563var NumberSchemaSchema = exports_external.object({
10564 type: exports_external.enum(["number", "integer"]),
10565 title: exports_external.optional(exports_external.string()),
10566 description: exports_external.optional(exports_external.string()),
10567 minimum: exports_external.optional(exports_external.number()),
10568 maximum: exports_external.optional(exports_external.number())
10569}).passthrough();
10570var EnumSchemaSchema = exports_external.object({
10571 type: exports_external.literal("string"),
10572 title: exports_external.optional(exports_external.string()),
10573 description: exports_external.optional(exports_external.string()),
10574 enum: exports_external.array(exports_external.string()),
10575 enumNames: exports_external.optional(exports_external.array(exports_external.string()))
10576}).passthrough();
10577var PrimitiveSchemaDefinitionSchema = exports_external.union([BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema]);
10578var ElicitRequestSchema = RequestSchema.extend({
10579 method: exports_external.literal("elicitation/create"),
10580 params: BaseRequestParamsSchema.extend({
10581 message: exports_external.string(),
10582 requestedSchema: exports_external.object({
10583 type: exports_external.literal("object"),
10584 properties: exports_external.record(exports_external.string(), PrimitiveSchemaDefinitionSchema),
10585 required: exports_external.optional(exports_external.array(exports_external.string()))
10586 }).passthrough()
10587 })
10588});
10589var ElicitResultSchema = ResultSchema.extend({
10590 action: exports_external.enum(["accept", "decline", "cancel"]),
10591 content: exports_external.optional(exports_external.record(exports_external.string(), exports_external.unknown()))
10592});
10593var ResourceTemplateReferenceSchema = exports_external.object({
10594 type: exports_external.literal("ref/resource"),
10595 uri: exports_external.string()
10596}).passthrough();
10597var PromptReferenceSchema = exports_external.object({
10598 type: exports_external.literal("ref/prompt"),
10599 name: exports_external.string()
10600}).passthrough();
10601var CompleteRequestSchema = RequestSchema.extend({
10602 method: exports_external.literal("completion/complete"),
10603 params: BaseRequestParamsSchema.extend({
10604 ref: exports_external.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
10605 argument: exports_external.object({
10606 name: exports_external.string(),
10607 value: exports_external.string()
10608 }).passthrough(),
10609 context: exports_external.optional(exports_external.object({
10610 arguments: exports_external.optional(exports_external.record(exports_external.string(), exports_external.string()))
10611 }))
10612 })
10613});
10614var CompleteResultSchema = ResultSchema.extend({
10615 completion: exports_external.object({
10616 values: exports_external.array(exports_external.string()).max(100),
10617 total: exports_external.optional(exports_external.number().int()),
10618 hasMore: exports_external.optional(exports_external.boolean())
10619 }).passthrough()
10620});
10621var RootSchema = exports_external.object({
10622 uri: exports_external.string().startsWith("file://"),
10623 name: exports_external.optional(exports_external.string()),
10624 _meta: exports_external.optional(exports_external.object({}).passthrough())
10625}).passthrough();
10626var ListRootsRequestSchema = RequestSchema.extend({
10627 method: exports_external.literal("roots/list")
10628});
10629var ListRootsResultSchema = ResultSchema.extend({
10630 roots: exports_external.array(RootSchema)
10631});
10632var RootsListChangedNotificationSchema = NotificationSchema.extend({
10633 method: exports_external.literal("notifications/roots/list_changed")
10634});
10635var ClientRequestSchema = exports_external.union([
10636 PingRequestSchema,
10637 InitializeRequestSchema,
10638 CompleteRequestSchema,
10639 SetLevelRequestSchema,
10640 GetPromptRequestSchema,
10641 ListPromptsRequestSchema,
10642 ListResourcesRequestSchema,
10643 ListResourceTemplatesRequestSchema,
10644 ReadResourceRequestSchema,
10645 SubscribeRequestSchema,
10646 UnsubscribeRequestSchema,
10647 CallToolRequestSchema,
10648 ListToolsRequestSchema
10649]);
10650var ClientNotificationSchema = exports_external.union([
10651 CancelledNotificationSchema,
10652 ProgressNotificationSchema,
10653 InitializedNotificationSchema,
10654 RootsListChangedNotificationSchema
10655]);
10656var ClientResultSchema = exports_external.union([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
10657var ServerRequestSchema = exports_external.union([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
10658var ServerNotificationSchema = exports_external.union([
10659 CancelledNotificationSchema,
10660 ProgressNotificationSchema,
10661 LoggingMessageNotificationSchema,
10662 ResourceUpdatedNotificationSchema,
10663 ResourceListChangedNotificationSchema,
10664 ToolListChangedNotificationSchema,
10665 PromptListChangedNotificationSchema
10666]);
10667var ServerResultSchema = exports_external.union([
10668 EmptyResultSchema,
10669 InitializeResultSchema,
10670 CompleteResultSchema,
10671 GetPromptResultSchema,
10672 ListPromptsResultSchema,
10673 ListResourcesResultSchema,
10674 ListResourceTemplatesResultSchema,
10675 ReadResourceResultSchema,
10676 CallToolResultSchema,
10677 ListToolsResultSchema
10678]);
10679
10680class McpError extends Error {
10681 constructor(code, message, data) {
10682 super(`MCP error ${code}: ${message}`);
10683 this.code = code;
10684 this.data = data;
10685 this.name = "McpError";
10686 }
10687}
10688
10689// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
10690var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
10691
10692class Protocol {
10693 constructor(_options) {
10694 this._options = _options;
10695 this._requestMessageId = 0;
10696 this._requestHandlers = new Map;
10697 this._requestHandlerAbortControllers = new Map;
10698 this._notificationHandlers = new Map;
10699 this._responseHandlers = new Map;
10700 this._progressHandlers = new Map;
10701 this._timeoutInfo = new Map;
10702 this._pendingDebouncedNotifications = new Set;
10703 this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
10704 const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
10705 controller === null || controller === undefined || controller.abort(notification.params.reason);
10706 });
10707 this.setNotificationHandler(ProgressNotificationSchema, (notification) => {
10708 this._onprogress(notification);
10709 });
10710 this.setRequestHandler(PingRequestSchema, (_request) => ({}));
10711 }
10712 _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
10713 this._timeoutInfo.set(messageId, {
10714 timeoutId: setTimeout(onTimeout, timeout),
10715 startTime: Date.now(),
10716 timeout,
10717 maxTotalTimeout,
10718 resetTimeoutOnProgress,
10719 onTimeout
10720 });
10721 }
10722 _resetTimeout(messageId) {
10723 const info = this._timeoutInfo.get(messageId);
10724 if (!info)
10725 return false;
10726 const totalElapsed = Date.now() - info.startTime;
10727 if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
10728 this._timeoutInfo.delete(messageId);
10729 throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
10730 maxTotalTimeout: info.maxTotalTimeout,
10731 totalElapsed
10732 });
10733 }
10734 clearTimeout(info.timeoutId);
10735 info.timeoutId = setTimeout(info.onTimeout, info.timeout);
10736 return true;
10737 }
10738 _cleanupTimeout(messageId) {
10739 const info = this._timeoutInfo.get(messageId);
10740 if (info) {
10741 clearTimeout(info.timeoutId);
10742 this._timeoutInfo.delete(messageId);
10743 }
10744 }
10745 async connect(transport) {
10746 var _a, _b, _c;
10747 this._transport = transport;
10748 const _onclose = (_a = this.transport) === null || _a === undefined ? undefined : _a.onclose;
10749 this._transport.onclose = () => {
10750 _onclose === null || _onclose === undefined || _onclose();
10751 this._onclose();
10752 };
10753 const _onerror = (_b = this.transport) === null || _b === undefined ? undefined : _b.onerror;
10754 this._transport.onerror = (error) => {
10755 _onerror === null || _onerror === undefined || _onerror(error);
10756 this._onerror(error);
10757 };
10758 const _onmessage = (_c = this._transport) === null || _c === undefined ? undefined : _c.onmessage;
10759 this._transport.onmessage = (message, extra) => {
10760 _onmessage === null || _onmessage === undefined || _onmessage(message, extra);
10761 if (isJSONRPCResponse(message) || isJSONRPCError(message)) {
10762 this._onresponse(message);
10763 } else if (isJSONRPCRequest(message)) {
10764 this._onrequest(message, extra);
10765 } else if (isJSONRPCNotification(message)) {
10766 this._onnotification(message);
10767 } else {
10768 this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));
10769 }
10770 };
10771 await this._transport.start();
10772 }
10773 _onclose() {
10774 var _a;
10775 const responseHandlers = this._responseHandlers;
10776 this._responseHandlers = new Map;
10777 this._progressHandlers.clear();
10778 this._pendingDebouncedNotifications.clear();
10779 this._transport = undefined;
10780 (_a = this.onclose) === null || _a === undefined || _a.call(this);
10781 const error = new McpError(ErrorCode.ConnectionClosed, "Connection closed");
10782 for (const handler of responseHandlers.values()) {
10783 handler(error);
10784 }
10785 }
10786 _onerror(error) {
10787 var _a;
10788 (_a = this.onerror) === null || _a === undefined || _a.call(this, error);
10789 }
10790 _onnotification(notification) {
10791 var _a;
10792 const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== undefined ? _a : this.fallbackNotificationHandler;
10793 if (handler === undefined) {
10794 return;
10795 }
10796 Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
10797 }
10798 _onrequest(request, extra) {
10799 var _a, _b;
10800 const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== undefined ? _a : this.fallbackRequestHandler;
10801 const capturedTransport = this._transport;
10802 if (handler === undefined) {
10803 capturedTransport === null || capturedTransport === undefined || capturedTransport.send({
10804 jsonrpc: "2.0",
10805 id: request.id,
10806 error: {
10807 code: ErrorCode.MethodNotFound,
10808 message: "Method not found"
10809 }
10810 }).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
10811 return;
10812 }
10813 const abortController = new AbortController;
10814 this._requestHandlerAbortControllers.set(request.id, abortController);
10815 const fullExtra = {
10816 signal: abortController.signal,
10817 sessionId: capturedTransport === null || capturedTransport === undefined ? undefined : capturedTransport.sessionId,
10818 _meta: (_b = request.params) === null || _b === undefined ? undefined : _b._meta,
10819 sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
10820 sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
10821 authInfo: extra === null || extra === undefined ? undefined : extra.authInfo,
10822 requestId: request.id,
10823 requestInfo: extra === null || extra === undefined ? undefined : extra.requestInfo
10824 };
10825 Promise.resolve().then(() => handler(request, fullExtra)).then((result) => {
10826 if (abortController.signal.aborted) {
10827 return;
10828 }
10829 return capturedTransport === null || capturedTransport === undefined ? undefined : capturedTransport.send({
10830 result,
10831 jsonrpc: "2.0",
10832 id: request.id
10833 });
10834 }, (error) => {
10835 var _a2;
10836 if (abortController.signal.aborted) {
10837 return;
10838 }
10839 return capturedTransport === null || capturedTransport === undefined ? undefined : capturedTransport.send({
10840 jsonrpc: "2.0",
10841 id: request.id,
10842 error: {
10843 code: Number.isSafeInteger(error["code"]) ? error["code"] : ErrorCode.InternalError,
10844 message: (_a2 = error.message) !== null && _a2 !== undefined ? _a2 : "Internal error"
10845 }
10846 });
10847 }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
10848 this._requestHandlerAbortControllers.delete(request.id);
10849 });
10850 }
10851 _onprogress(notification) {
10852 const { progressToken, ...params } = notification.params;
10853 const messageId = Number(progressToken);
10854 const handler = this._progressHandlers.get(messageId);
10855 if (!handler) {
10856 this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
10857 return;
10858 }
10859 const responseHandler = this._responseHandlers.get(messageId);
10860 const timeoutInfo = this._timeoutInfo.get(messageId);
10861 if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
10862 try {
10863 this._resetTimeout(messageId);
10864 } catch (error) {
10865 responseHandler(error);
10866 return;
10867 }
10868 }
10869 handler(params);
10870 }
10871 _onresponse(response) {
10872 const messageId = Number(response.id);
10873 const handler = this._responseHandlers.get(messageId);
10874 if (handler === undefined) {
10875 this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
10876 return;
10877 }
10878 this._responseHandlers.delete(messageId);
10879 this._progressHandlers.delete(messageId);
10880 this._cleanupTimeout(messageId);
10881 if (isJSONRPCResponse(response)) {
10882 handler(response);
10883 } else {
10884 const error = new McpError(response.error.code, response.error.message, response.error.data);
10885 handler(error);
10886 }
10887 }
10888 get transport() {
10889 return this._transport;
10890 }
10891 async close() {
10892 var _a;
10893 await ((_a = this._transport) === null || _a === undefined ? undefined : _a.close());
10894 }
10895 request(request, resultSchema, options) {
10896 const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== undefined ? options : {};
10897 return new Promise((resolve, reject) => {
10898 var _a, _b, _c, _d, _e, _f;
10899 if (!this._transport) {
10900 reject(new Error("Not connected"));
10901 return;
10902 }
10903 if (((_a = this._options) === null || _a === undefined ? undefined : _a.enforceStrictCapabilities) === true) {
10904 this.assertCapabilityForMethod(request.method);
10905 }
10906 (_b = options === null || options === undefined ? undefined : options.signal) === null || _b === undefined || _b.throwIfAborted();
10907 const messageId = this._requestMessageId++;
10908 const jsonrpcRequest = {
10909 ...request,
10910 jsonrpc: "2.0",
10911 id: messageId
10912 };
10913 if (options === null || options === undefined ? undefined : options.onprogress) {
10914 this._progressHandlers.set(messageId, options.onprogress);
10915 jsonrpcRequest.params = {
10916 ...request.params,
10917 _meta: {
10918 ...((_c = request.params) === null || _c === undefined ? undefined : _c._meta) || {},
10919 progressToken: messageId
10920 }
10921 };
10922 }
10923 const cancel = (reason) => {
10924 var _a2;
10925 this._responseHandlers.delete(messageId);
10926 this._progressHandlers.delete(messageId);
10927 this._cleanupTimeout(messageId);
10928 (_a2 = this._transport) === null || _a2 === undefined || _a2.send({
10929 jsonrpc: "2.0",
10930 method: "notifications/cancelled",
10931 params: {
10932 requestId: messageId,
10933 reason: String(reason)
10934 }
10935 }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
10936 reject(reason);
10937 };
10938 this._responseHandlers.set(messageId, (response) => {
10939 var _a2;
10940 if ((_a2 = options === null || options === undefined ? undefined : options.signal) === null || _a2 === undefined ? undefined : _a2.aborted) {
10941 return;
10942 }
10943 if (response instanceof Error) {
10944 return reject(response);
10945 }
10946 try {
10947 const result = resultSchema.parse(response.result);
10948 resolve(result);
10949 } catch (error) {
10950 reject(error);
10951 }
10952 });
10953 (_d = options === null || options === undefined ? undefined : options.signal) === null || _d === undefined || _d.addEventListener("abort", () => {
10954 var _a2;
10955 cancel((_a2 = options === null || options === undefined ? undefined : options.signal) === null || _a2 === undefined ? undefined : _a2.reason);
10956 });
10957 const timeout = (_e = options === null || options === undefined ? undefined : options.timeout) !== null && _e !== undefined ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;
10958 const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
10959 this._setupTimeout(messageId, timeout, options === null || options === undefined ? undefined : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === undefined ? undefined : options.resetTimeoutOnProgress) !== null && _f !== undefined ? _f : false);
10960 this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {
10961 this._cleanupTimeout(messageId);
10962 reject(error);
10963 });
10964 });
10965 }
10966 async notification(notification, options) {
10967 var _a, _b;
10968 if (!this._transport) {
10969 throw new Error("Not connected");
10970 }
10971 this.assertNotificationCapability(notification.method);
10972 const debouncedMethods = (_b = (_a = this._options) === null || _a === undefined ? undefined : _a.debouncedNotificationMethods) !== null && _b !== undefined ? _b : [];
10973 const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !(options === null || options === undefined ? undefined : options.relatedRequestId);
10974 if (canDebounce) {
10975 if (this._pendingDebouncedNotifications.has(notification.method)) {
10976 return;
10977 }
10978 this._pendingDebouncedNotifications.add(notification.method);
10979 Promise.resolve().then(() => {
10980 var _a2;
10981 this._pendingDebouncedNotifications.delete(notification.method);
10982 if (!this._transport) {
10983 return;
10984 }
10985 const jsonrpcNotification2 = {
10986 ...notification,
10987 jsonrpc: "2.0"
10988 };
10989 (_a2 = this._transport) === null || _a2 === undefined || _a2.send(jsonrpcNotification2, options).catch((error) => this._onerror(error));
10990 });
10991 return;
10992 }
10993 const jsonrpcNotification = {
10994 ...notification,
10995 jsonrpc: "2.0"
10996 };
10997 await this._transport.send(jsonrpcNotification, options);
10998 }
10999 setRequestHandler(requestSchema, handler) {
11000 const method = requestSchema.shape.method.value;
11001 this.assertRequestHandlerCapability(method);
11002 this._requestHandlers.set(method, (request, extra) => {
11003 return Promise.resolve(handler(requestSchema.parse(request), extra));
11004 });
11005 }
11006 removeRequestHandler(method) {
11007 this._requestHandlers.delete(method);
11008 }
11009 assertCanSetRequestHandler(method) {
11010 if (this._requestHandlers.has(method)) {
11011 throw new Error(`A request handler for ${method} already exists, which would be overridden`);
11012 }
11013 }
11014 setNotificationHandler(notificationSchema, handler) {
11015 this._notificationHandlers.set(notificationSchema.shape.method.value, (notification) => Promise.resolve(handler(notificationSchema.parse(notification))));
11016 }
11017 removeNotificationHandler(method) {
11018 this._notificationHandlers.delete(method);
11019 }
11020}
11021function mergeCapabilities(base, additional) {
11022 return Object.entries(additional).reduce((acc, [key, value]) => {
11023 if (value && typeof value === "object") {
11024 acc[key] = acc[key] ? { ...acc[key], ...value } : value;
11025 } else {
11026 acc[key] = value;
11027 }
11028 return acc;
11029 }, { ...base });
11030}
11031
11032// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
11033var import_ajv = __toESM(require_ajv(), 1);
11034
11035class Server extends Protocol {
11036 constructor(_serverInfo, options) {
11037 var _a;
11038 super(options);
11039 this._serverInfo = _serverInfo;
11040 this._loggingLevels = new Map;
11041 this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
11042 this.isMessageIgnored = (level, sessionId) => {
11043 const currentLevel = this._loggingLevels.get(sessionId);
11044 return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
11045 };
11046 this._capabilities = (_a = options === null || options === undefined ? undefined : options.capabilities) !== null && _a !== undefined ? _a : {};
11047 this._instructions = options === null || options === undefined ? undefined : options.instructions;
11048 this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
11049 this.setNotificationHandler(InitializedNotificationSchema, () => {
11050 var _a2;
11051 return (_a2 = this.oninitialized) === null || _a2 === undefined ? undefined : _a2.call(this);
11052 });
11053 if (this._capabilities.logging) {
11054 this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
11055 var _a2;
11056 const transportSessionId = extra.sessionId || ((_a2 = extra.requestInfo) === null || _a2 === undefined ? undefined : _a2.headers["mcp-session-id"]) || undefined;
11057 const { level } = request.params;
11058 const parseResult = LoggingLevelSchema.safeParse(level);
11059 if (parseResult.success) {
11060 this._loggingLevels.set(transportSessionId, parseResult.data);
11061 }
11062 return {};
11063 });
11064 }
11065 }
11066 registerCapabilities(capabilities) {
11067 if (this.transport) {
11068 throw new Error("Cannot register capabilities after connecting to transport");
11069 }
11070 this._capabilities = mergeCapabilities(this._capabilities, capabilities);
11071 }
11072 assertCapabilityForMethod(method) {
11073 var _a, _b, _c;
11074 switch (method) {
11075 case "sampling/createMessage":
11076 if (!((_a = this._clientCapabilities) === null || _a === undefined ? undefined : _a.sampling)) {
11077 throw new Error(`Client does not support sampling (required for ${method})`);
11078 }
11079 break;
11080 case "elicitation/create":
11081 if (!((_b = this._clientCapabilities) === null || _b === undefined ? undefined : _b.elicitation)) {
11082 throw new Error(`Client does not support elicitation (required for ${method})`);
11083 }
11084 break;
11085 case "roots/list":
11086 if (!((_c = this._clientCapabilities) === null || _c === undefined ? undefined : _c.roots)) {
11087 throw new Error(`Client does not support listing roots (required for ${method})`);
11088 }
11089 break;
11090 case "ping":
11091 break;
11092 }
11093 }
11094 assertNotificationCapability(method) {
11095 switch (method) {
11096 case "notifications/message":
11097 if (!this._capabilities.logging) {
11098 throw new Error(`Server does not support logging (required for ${method})`);
11099 }
11100 break;
11101 case "notifications/resources/updated":
11102 case "notifications/resources/list_changed":
11103 if (!this._capabilities.resources) {
11104 throw new Error(`Server does not support notifying about resources (required for ${method})`);
11105 }
11106 break;
11107 case "notifications/tools/list_changed":
11108 if (!this._capabilities.tools) {
11109 throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);
11110 }
11111 break;
11112 case "notifications/prompts/list_changed":
11113 if (!this._capabilities.prompts) {
11114 throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);
11115 }
11116 break;
11117 case "notifications/cancelled":
11118 break;
11119 case "notifications/progress":
11120 break;
11121 }
11122 }
11123 assertRequestHandlerCapability(method) {
11124 switch (method) {
11125 case "sampling/createMessage":
11126 if (!this._capabilities.sampling) {
11127 throw new Error(`Server does not support sampling (required for ${method})`);
11128 }
11129 break;
11130 case "logging/setLevel":
11131 if (!this._capabilities.logging) {
11132 throw new Error(`Server does not support logging (required for ${method})`);
11133 }
11134 break;
11135 case "prompts/get":
11136 case "prompts/list":
11137 if (!this._capabilities.prompts) {
11138 throw new Error(`Server does not support prompts (required for ${method})`);
11139 }
11140 break;
11141 case "resources/list":
11142 case "resources/templates/list":
11143 case "resources/read":
11144 if (!this._capabilities.resources) {
11145 throw new Error(`Server does not support resources (required for ${method})`);
11146 }
11147 break;
11148 case "tools/call":
11149 case "tools/list":
11150 if (!this._capabilities.tools) {
11151 throw new Error(`Server does not support tools (required for ${method})`);
11152 }
11153 break;
11154 case "ping":
11155 case "initialize":
11156 break;
11157 }
11158 }
11159 async _oninitialize(request) {
11160 const requestedVersion = request.params.protocolVersion;
11161 this._clientCapabilities = request.params.capabilities;
11162 this._clientVersion = request.params.clientInfo;
11163 const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;
11164 return {
11165 protocolVersion,
11166 capabilities: this.getCapabilities(),
11167 serverInfo: this._serverInfo,
11168 ...this._instructions && { instructions: this._instructions }
11169 };
11170 }
11171 getClientCapabilities() {
11172 return this._clientCapabilities;
11173 }
11174 getClientVersion() {
11175 return this._clientVersion;
11176 }
11177 getCapabilities() {
11178 return this._capabilities;
11179 }
11180 async ping() {
11181 return this.request({ method: "ping" }, EmptyResultSchema);
11182 }
11183 async createMessage(params, options) {
11184 return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema, options);
11185 }
11186 async elicitInput(params, options) {
11187 const result = await this.request({ method: "elicitation/create", params }, ElicitResultSchema, options);
11188 if (result.action === "accept" && result.content) {
11189 try {
11190 const ajv = new import_ajv.default;
11191 const validate = ajv.compile(params.requestedSchema);
11192 const isValid2 = validate(result.content);
11193 if (!isValid2) {
11194 throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${ajv.errorsText(validate.errors)}`);
11195 }
11196 } catch (error) {
11197 if (error instanceof McpError) {
11198 throw error;
11199 }
11200 throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error}`);
11201 }
11202 }
11203 return result;
11204 }
11205 async listRoots(params, options) {
11206 return this.request({ method: "roots/list", params }, ListRootsResultSchema, options);
11207 }
11208 async sendLoggingMessage(params, sessionId) {
11209 if (this._capabilities.logging) {
11210 if (!this.isMessageIgnored(params.level, sessionId)) {
11211 return this.notification({ method: "notifications/message", params });
11212 }
11213 }
11214 }
11215 async sendResourceUpdated(params) {
11216 return this.notification({
11217 method: "notifications/resources/updated",
11218 params
11219 });
11220 }
11221 async sendResourceListChanged() {
11222 return this.notification({
11223 method: "notifications/resources/list_changed"
11224 });
11225 }
11226 async sendToolListChanged() {
11227 return this.notification({ method: "notifications/tools/list_changed" });
11228 }
11229 async sendPromptListChanged() {
11230 return this.notification({ method: "notifications/prompts/list_changed" });
11231 }
11232}
11233
11234// node_modules/zod-to-json-schema/dist/esm/Options.js
11235var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
11236var defaultOptions = {
11237 name: undefined,
11238 $refStrategy: "root",
11239 basePath: ["#"],
11240 effectStrategy: "input",
11241 pipeStrategy: "all",
11242 dateStrategy: "format:date-time",
11243 mapStrategy: "entries",
11244 removeAdditionalStrategy: "passthrough",
11245 allowedAdditionalProperties: true,
11246 rejectedAdditionalProperties: false,
11247 definitionPath: "definitions",
11248 target: "jsonSchema7",
11249 strictUnions: false,
11250 definitions: {},
11251 errorMessages: false,
11252 markdownDescription: false,
11253 patternStrategy: "escape",
11254 applyRegexFlags: false,
11255 emailStrategy: "format:email",
11256 base64Strategy: "contentEncoding:base64",
11257 nameStrategy: "ref",
11258 openAiAnyTypeName: "OpenAiAnyType"
11259};
11260var getDefaultOptions = (options) => typeof options === "string" ? {
11261 ...defaultOptions,
11262 name: options
11263} : {
11264 ...defaultOptions,
11265 ...options
11266};
11267// node_modules/zod-to-json-schema/dist/esm/Refs.js
11268var getRefs = (options) => {
11269 const _options = getDefaultOptions(options);
11270 const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
11271 return {
11272 ..._options,
11273 flags: { hasReferencedOpenAiAnyType: false },
11274 currentPath,
11275 propertyPath: undefined,
11276 seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
11277 def._def,
11278 {
11279 def: def._def,
11280 path: [..._options.basePath, _options.definitionPath, name],
11281 jsonSchema: undefined
11282 }
11283 ]))
11284 };
11285};
11286// node_modules/zod-to-json-schema/dist/esm/errorMessages.js
11287function addErrorMessage(res, key, errorMessage, refs) {
11288 if (!refs?.errorMessages)
11289 return;
11290 if (errorMessage) {
11291 res.errorMessage = {
11292 ...res.errorMessage,
11293 [key]: errorMessage
11294 };
11295 }
11296}
11297function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
11298 res[key] = value;
11299 addErrorMessage(res, key, errorMessage, refs);
11300}
11301// node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
11302var getRelativePath = (pathA, pathB) => {
11303 let i = 0;
11304 for (;i < pathA.length && i < pathB.length; i++) {
11305 if (pathA[i] !== pathB[i])
11306 break;
11307 }
11308 return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
11309};
11310// node_modules/zod-to-json-schema/dist/esm/parsers/any.js
11311function parseAnyDef(refs) {
11312 if (refs.target !== "openAi") {
11313 return {};
11314 }
11315 const anyDefinitionPath = [
11316 ...refs.basePath,
11317 refs.definitionPath,
11318 refs.openAiAnyTypeName
11319 ];
11320 refs.flags.hasReferencedOpenAiAnyType = true;
11321 return {
11322 $ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
11323 };
11324}
11325
11326// node_modules/zod-to-json-schema/dist/esm/parsers/array.js
11327function parseArrayDef(def, refs) {
11328 const res = {
11329 type: "array"
11330 };
11331 if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
11332 res.items = parseDef(def.type._def, {
11333 ...refs,
11334 currentPath: [...refs.currentPath, "items"]
11335 });
11336 }
11337 if (def.minLength) {
11338 setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
11339 }
11340 if (def.maxLength) {
11341 setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
11342 }
11343 if (def.exactLength) {
11344 setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
11345 setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
11346 }
11347 return res;
11348}
11349
11350// node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
11351function parseBigintDef(def, refs) {
11352 const res = {
11353 type: "integer",
11354 format: "int64"
11355 };
11356 if (!def.checks)
11357 return res;
11358 for (const check of def.checks) {
11359 switch (check.kind) {
11360 case "min":
11361 if (refs.target === "jsonSchema7") {
11362 if (check.inclusive) {
11363 setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
11364 } else {
11365 setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
11366 }
11367 } else {
11368 if (!check.inclusive) {
11369 res.exclusiveMinimum = true;
11370 }
11371 setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
11372 }
11373 break;
11374 case "max":
11375 if (refs.target === "jsonSchema7") {
11376 if (check.inclusive) {
11377 setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
11378 } else {
11379 setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
11380 }
11381 } else {
11382 if (!check.inclusive) {
11383 res.exclusiveMaximum = true;
11384 }
11385 setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
11386 }
11387 break;
11388 case "multipleOf":
11389 setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
11390 break;
11391 }
11392 }
11393 return res;
11394}
11395
11396// node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
11397function parseBooleanDef() {
11398 return {
11399 type: "boolean"
11400 };
11401}
11402
11403// node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
11404function parseBrandedDef(_def, refs) {
11405 return parseDef(_def.type._def, refs);
11406}
11407
11408// node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
11409var parseCatchDef = (def, refs) => {
11410 return parseDef(def.innerType._def, refs);
11411};
11412
11413// node_modules/zod-to-json-schema/dist/esm/parsers/date.js
11414function parseDateDef(def, refs, overrideDateStrategy) {
11415 const strategy = overrideDateStrategy ?? refs.dateStrategy;
11416 if (Array.isArray(strategy)) {
11417 return {
11418 anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
11419 };
11420 }
11421 switch (strategy) {
11422 case "string":
11423 case "format:date-time":
11424 return {
11425 type: "string",
11426 format: "date-time"
11427 };
11428 case "format:date":
11429 return {
11430 type: "string",
11431 format: "date"
11432 };
11433 case "integer":
11434 return integerDateParser(def, refs);
11435 }
11436}
11437var integerDateParser = (def, refs) => {
11438 const res = {
11439 type: "integer",
11440 format: "unix-time"
11441 };
11442 if (refs.target === "openApi3") {
11443 return res;
11444 }
11445 for (const check of def.checks) {
11446 switch (check.kind) {
11447 case "min":
11448 setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
11449 break;
11450 case "max":
11451 setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
11452 break;
11453 }
11454 }
11455 return res;
11456};
11457
11458// node_modules/zod-to-json-schema/dist/esm/parsers/default.js
11459function parseDefaultDef(_def, refs) {
11460 return {
11461 ...parseDef(_def.innerType._def, refs),
11462 default: _def.defaultValue()
11463 };
11464}
11465
11466// node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
11467function parseEffectsDef(_def, refs) {
11468 return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
11469}
11470
11471// node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
11472function parseEnumDef(def) {
11473 return {
11474 type: "string",
11475 enum: Array.from(def.values)
11476 };
11477}
11478
11479// node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
11480var isJsonSchema7AllOfType = (type) => {
11481 if ("type" in type && type.type === "string")
11482 return false;
11483 return "allOf" in type;
11484};
11485function parseIntersectionDef(def, refs) {
11486 const allOf = [
11487 parseDef(def.left._def, {
11488 ...refs,
11489 currentPath: [...refs.currentPath, "allOf", "0"]
11490 }),
11491 parseDef(def.right._def, {
11492 ...refs,
11493 currentPath: [...refs.currentPath, "allOf", "1"]
11494 })
11495 ].filter((x) => !!x);
11496 let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : undefined;
11497 const mergedAllOf = [];
11498 allOf.forEach((schema) => {
11499 if (isJsonSchema7AllOfType(schema)) {
11500 mergedAllOf.push(...schema.allOf);
11501 if (schema.unevaluatedProperties === undefined) {
11502 unevaluatedProperties = undefined;
11503 }
11504 } else {
11505 let nestedSchema = schema;
11506 if ("additionalProperties" in schema && schema.additionalProperties === false) {
11507 const { additionalProperties, ...rest } = schema;
11508 nestedSchema = rest;
11509 } else {
11510 unevaluatedProperties = undefined;
11511 }
11512 mergedAllOf.push(nestedSchema);
11513 }
11514 });
11515 return mergedAllOf.length ? {
11516 allOf: mergedAllOf,
11517 ...unevaluatedProperties
11518 } : undefined;
11519}
11520
11521// node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
11522function parseLiteralDef(def, refs) {
11523 const parsedType = typeof def.value;
11524 if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
11525 return {
11526 type: Array.isArray(def.value) ? "array" : "object"
11527 };
11528 }
11529 if (refs.target === "openApi3") {
11530 return {
11531 type: parsedType === "bigint" ? "integer" : parsedType,
11532 enum: [def.value]
11533 };
11534 }
11535 return {
11536 type: parsedType === "bigint" ? "integer" : parsedType,
11537 const: def.value
11538 };
11539}
11540
11541// node_modules/zod-to-json-schema/dist/esm/parsers/string.js
11542var emojiRegex2 = undefined;
11543var zodPatterns = {
11544 cuid: /^[cC][^\s-]{8,}$/,
11545 cuid2: /^[0-9a-z]+$/,
11546 ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
11547 email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
11548 emoji: () => {
11549 if (emojiRegex2 === undefined) {
11550 emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
11551 }
11552 return emojiRegex2;
11553 },
11554 uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
11555 ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
11556 ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
11557 ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
11558 ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
11559 base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
11560 base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
11561 nanoid: /^[a-zA-Z0-9_-]{21}$/,
11562 jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
11563};
11564function parseStringDef(def, refs) {
11565 const res = {
11566 type: "string"
11567 };
11568 if (def.checks) {
11569 for (const check of def.checks) {
11570 switch (check.kind) {
11571 case "min":
11572 setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
11573 break;
11574 case "max":
11575 setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
11576 break;
11577 case "email":
11578 switch (refs.emailStrategy) {
11579 case "format:email":
11580 addFormat(res, "email", check.message, refs);
11581 break;
11582 case "format:idn-email":
11583 addFormat(res, "idn-email", check.message, refs);
11584 break;
11585 case "pattern:zod":
11586 addPattern(res, zodPatterns.email, check.message, refs);
11587 break;
11588 }
11589 break;
11590 case "url":
11591 addFormat(res, "uri", check.message, refs);
11592 break;
11593 case "uuid":
11594 addFormat(res, "uuid", check.message, refs);
11595 break;
11596 case "regex":
11597 addPattern(res, check.regex, check.message, refs);
11598 break;
11599 case "cuid":
11600 addPattern(res, zodPatterns.cuid, check.message, refs);
11601 break;
11602 case "cuid2":
11603 addPattern(res, zodPatterns.cuid2, check.message, refs);
11604 break;
11605 case "startsWith":
11606 addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
11607 break;
11608 case "endsWith":
11609 addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
11610 break;
11611 case "datetime":
11612 addFormat(res, "date-time", check.message, refs);
11613 break;
11614 case "date":
11615 addFormat(res, "date", check.message, refs);
11616 break;
11617 case "time":
11618 addFormat(res, "time", check.message, refs);
11619 break;
11620 case "duration":
11621 addFormat(res, "duration", check.message, refs);
11622 break;
11623 case "length":
11624 setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
11625 setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
11626 break;
11627 case "includes": {
11628 addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
11629 break;
11630 }
11631 case "ip": {
11632 if (check.version !== "v6") {
11633 addFormat(res, "ipv4", check.message, refs);
11634 }
11635 if (check.version !== "v4") {
11636 addFormat(res, "ipv6", check.message, refs);
11637 }
11638 break;
11639 }
11640 case "base64url":
11641 addPattern(res, zodPatterns.base64url, check.message, refs);
11642 break;
11643 case "jwt":
11644 addPattern(res, zodPatterns.jwt, check.message, refs);
11645 break;
11646 case "cidr": {
11647 if (check.version !== "v6") {
11648 addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
11649 }
11650 if (check.version !== "v4") {
11651 addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
11652 }
11653 break;
11654 }
11655 case "emoji":
11656 addPattern(res, zodPatterns.emoji(), check.message, refs);
11657 break;
11658 case "ulid": {
11659 addPattern(res, zodPatterns.ulid, check.message, refs);
11660 break;
11661 }
11662 case "base64": {
11663 switch (refs.base64Strategy) {
11664 case "format:binary": {
11665 addFormat(res, "binary", check.message, refs);
11666 break;
11667 }
11668 case "contentEncoding:base64": {
11669 setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
11670 break;
11671 }
11672 case "pattern:zod": {
11673 addPattern(res, zodPatterns.base64, check.message, refs);
11674 break;
11675 }
11676 }
11677 break;
11678 }
11679 case "nanoid": {
11680 addPattern(res, zodPatterns.nanoid, check.message, refs);
11681 }
11682 case "toLowerCase":
11683 case "toUpperCase":
11684 case "trim":
11685 break;
11686 default:
11687 ((_) => {})(check);
11688 }
11689 }
11690 }
11691 return res;
11692}
11693function escapeLiteralCheckValue(literal, refs) {
11694 return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
11695}
11696var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
11697function escapeNonAlphaNumeric(source) {
11698 let result = "";
11699 for (let i = 0;i < source.length; i++) {
11700 if (!ALPHA_NUMERIC.has(source[i])) {
11701 result += "\\";
11702 }
11703 result += source[i];
11704 }
11705 return result;
11706}
11707function addFormat(schema, value, message, refs) {
11708 if (schema.format || schema.anyOf?.some((x) => x.format)) {
11709 if (!schema.anyOf) {
11710 schema.anyOf = [];
11711 }
11712 if (schema.format) {
11713 schema.anyOf.push({
11714 format: schema.format,
11715 ...schema.errorMessage && refs.errorMessages && {
11716 errorMessage: { format: schema.errorMessage.format }
11717 }
11718 });
11719 delete schema.format;
11720 if (schema.errorMessage) {
11721 delete schema.errorMessage.format;
11722 if (Object.keys(schema.errorMessage).length === 0) {
11723 delete schema.errorMessage;
11724 }
11725 }
11726 }
11727 schema.anyOf.push({
11728 format: value,
11729 ...message && refs.errorMessages && { errorMessage: { format: message } }
11730 });
11731 } else {
11732 setResponseValueAndErrors(schema, "format", value, message, refs);
11733 }
11734}
11735function addPattern(schema, regex, message, refs) {
11736 if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
11737 if (!schema.allOf) {
11738 schema.allOf = [];
11739 }
11740 if (schema.pattern) {
11741 schema.allOf.push({
11742 pattern: schema.pattern,
11743 ...schema.errorMessage && refs.errorMessages && {
11744 errorMessage: { pattern: schema.errorMessage.pattern }
11745 }
11746 });
11747 delete schema.pattern;
11748 if (schema.errorMessage) {
11749 delete schema.errorMessage.pattern;
11750 if (Object.keys(schema.errorMessage).length === 0) {
11751 delete schema.errorMessage;
11752 }
11753 }
11754 }
11755 schema.allOf.push({
11756 pattern: stringifyRegExpWithFlags(regex, refs),
11757 ...message && refs.errorMessages && { errorMessage: { pattern: message } }
11758 });
11759 } else {
11760 setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
11761 }
11762}
11763function stringifyRegExpWithFlags(regex, refs) {
11764 if (!refs.applyRegexFlags || !regex.flags) {
11765 return regex.source;
11766 }
11767 const flags = {
11768 i: regex.flags.includes("i"),
11769 m: regex.flags.includes("m"),
11770 s: regex.flags.includes("s")
11771 };
11772 const source = flags.i ? regex.source.toLowerCase() : regex.source;
11773 let pattern = "";
11774 let isEscaped = false;
11775 let inCharGroup = false;
11776 let inCharRange = false;
11777 for (let i = 0;i < source.length; i++) {
11778 if (isEscaped) {
11779 pattern += source[i];
11780 isEscaped = false;
11781 continue;
11782 }
11783 if (flags.i) {
11784 if (inCharGroup) {
11785 if (source[i].match(/[a-z]/)) {
11786 if (inCharRange) {
11787 pattern += source[i];
11788 pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
11789 inCharRange = false;
11790 } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
11791 pattern += source[i];
11792 inCharRange = true;
11793 } else {
11794 pattern += `${source[i]}${source[i].toUpperCase()}`;
11795 }
11796 continue;
11797 }
11798 } else if (source[i].match(/[a-z]/)) {
11799 pattern += `[${source[i]}${source[i].toUpperCase()}]`;
11800 continue;
11801 }
11802 }
11803 if (flags.m) {
11804 if (source[i] === "^") {
11805 pattern += `(^|(?<=[\r
11806]))`;
11807 continue;
11808 } else if (source[i] === "$") {
11809 pattern += `($|(?=[\r
11810]))`;
11811 continue;
11812 }
11813 }
11814 if (flags.s && source[i] === ".") {
11815 pattern += inCharGroup ? `${source[i]}\r
11816` : `[${source[i]}\r
11817]`;
11818 continue;
11819 }
11820 pattern += source[i];
11821 if (source[i] === "\\") {
11822 isEscaped = true;
11823 } else if (inCharGroup && source[i] === "]") {
11824 inCharGroup = false;
11825 } else if (!inCharGroup && source[i] === "[") {
11826 inCharGroup = true;
11827 }
11828 }
11829 try {
11830 new RegExp(pattern);
11831 } catch {
11832 console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
11833 return regex.source;
11834 }
11835 return pattern;
11836}
11837
11838// node_modules/zod-to-json-schema/dist/esm/parsers/record.js
11839function parseRecordDef(def, refs) {
11840 if (refs.target === "openAi") {
11841 console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
11842 }
11843 if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
11844 return {
11845 type: "object",
11846 required: def.keyType._def.values,
11847 properties: def.keyType._def.values.reduce((acc, key) => ({
11848 ...acc,
11849 [key]: parseDef(def.valueType._def, {
11850 ...refs,
11851 currentPath: [...refs.currentPath, "properties", key]
11852 }) ?? parseAnyDef(refs)
11853 }), {}),
11854 additionalProperties: refs.rejectedAdditionalProperties
11855 };
11856 }
11857 const schema = {
11858 type: "object",
11859 additionalProperties: parseDef(def.valueType._def, {
11860 ...refs,
11861 currentPath: [...refs.currentPath, "additionalProperties"]
11862 }) ?? refs.allowedAdditionalProperties
11863 };
11864 if (refs.target === "openApi3") {
11865 return schema;
11866 }
11867 if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
11868 const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
11869 return {
11870 ...schema,
11871 propertyNames: keyType
11872 };
11873 } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
11874 return {
11875 ...schema,
11876 propertyNames: {
11877 enum: def.keyType._def.values
11878 }
11879 };
11880 } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
11881 const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
11882 return {
11883 ...schema,
11884 propertyNames: keyType
11885 };
11886 }
11887 return schema;
11888}
11889
11890// node_modules/zod-to-json-schema/dist/esm/parsers/map.js
11891function parseMapDef(def, refs) {
11892 if (refs.mapStrategy === "record") {
11893 return parseRecordDef(def, refs);
11894 }
11895 const keys = parseDef(def.keyType._def, {
11896 ...refs,
11897 currentPath: [...refs.currentPath, "items", "items", "0"]
11898 }) || parseAnyDef(refs);
11899 const values = parseDef(def.valueType._def, {
11900 ...refs,
11901 currentPath: [...refs.currentPath, "items", "items", "1"]
11902 }) || parseAnyDef(refs);
11903 return {
11904 type: "array",
11905 maxItems: 125,
11906 items: {
11907 type: "array",
11908 items: [keys, values],
11909 minItems: 2,
11910 maxItems: 2
11911 }
11912 };
11913}
11914
11915// node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
11916function parseNativeEnumDef(def) {
11917 const object = def.values;
11918 const actualKeys = Object.keys(def.values).filter((key) => {
11919 return typeof object[object[key]] !== "number";
11920 });
11921 const actualValues = actualKeys.map((key) => object[key]);
11922 const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
11923 return {
11924 type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
11925 enum: actualValues
11926 };
11927}
11928
11929// node_modules/zod-to-json-schema/dist/esm/parsers/never.js
11930function parseNeverDef(refs) {
11931 return refs.target === "openAi" ? undefined : {
11932 not: parseAnyDef({
11933 ...refs,
11934 currentPath: [...refs.currentPath, "not"]
11935 })
11936 };
11937}
11938
11939// node_modules/zod-to-json-schema/dist/esm/parsers/null.js
11940function parseNullDef(refs) {
11941 return refs.target === "openApi3" ? {
11942 enum: ["null"],
11943 nullable: true
11944 } : {
11945 type: "null"
11946 };
11947}
11948
11949// node_modules/zod-to-json-schema/dist/esm/parsers/union.js
11950var primitiveMappings = {
11951 ZodString: "string",
11952 ZodNumber: "number",
11953 ZodBigInt: "integer",
11954 ZodBoolean: "boolean",
11955 ZodNull: "null"
11956};
11957function parseUnionDef(def, refs) {
11958 if (refs.target === "openApi3")
11959 return asAnyOf(def, refs);
11960 const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
11961 if (options.every((x) => (x._def.typeName in primitiveMappings) && (!x._def.checks || !x._def.checks.length))) {
11962 const types2 = options.reduce((types3, x) => {
11963 const type = primitiveMappings[x._def.typeName];
11964 return type && !types3.includes(type) ? [...types3, type] : types3;
11965 }, []);
11966 return {
11967 type: types2.length > 1 ? types2 : types2[0]
11968 };
11969 } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
11970 const types2 = options.reduce((acc, x) => {
11971 const type = typeof x._def.value;
11972 switch (type) {
11973 case "string":
11974 case "number":
11975 case "boolean":
11976 return [...acc, type];
11977 case "bigint":
11978 return [...acc, "integer"];
11979 case "object":
11980 if (x._def.value === null)
11981 return [...acc, "null"];
11982 case "symbol":
11983 case "undefined":
11984 case "function":
11985 default:
11986 return acc;
11987 }
11988 }, []);
11989 if (types2.length === options.length) {
11990 const uniqueTypes = types2.filter((x, i, a) => a.indexOf(x) === i);
11991 return {
11992 type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
11993 enum: options.reduce((acc, x) => {
11994 return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
11995 }, [])
11996 };
11997 }
11998 } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
11999 return {
12000 type: "string",
12001 enum: options.reduce((acc, x) => [
12002 ...acc,
12003 ...x._def.values.filter((x2) => !acc.includes(x2))
12004 ], [])
12005 };
12006 }
12007 return asAnyOf(def, refs);
12008}
12009var asAnyOf = (def, refs) => {
12010 const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
12011 ...refs,
12012 currentPath: [...refs.currentPath, "anyOf", `${i}`]
12013 })).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
12014 return anyOf.length ? { anyOf } : undefined;
12015};
12016
12017// node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
12018function parseNullableDef(def, refs) {
12019 if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
12020 if (refs.target === "openApi3") {
12021 return {
12022 type: primitiveMappings[def.innerType._def.typeName],
12023 nullable: true
12024 };
12025 }
12026 return {
12027 type: [
12028 primitiveMappings[def.innerType._def.typeName],
12029 "null"
12030 ]
12031 };
12032 }
12033 if (refs.target === "openApi3") {
12034 const base2 = parseDef(def.innerType._def, {
12035 ...refs,
12036 currentPath: [...refs.currentPath]
12037 });
12038 if (base2 && "$ref" in base2)
12039 return { allOf: [base2], nullable: true };
12040 return base2 && { ...base2, nullable: true };
12041 }
12042 const base = parseDef(def.innerType._def, {
12043 ...refs,
12044 currentPath: [...refs.currentPath, "anyOf", "0"]
12045 });
12046 return base && { anyOf: [base, { type: "null" }] };
12047}
12048
12049// node_modules/zod-to-json-schema/dist/esm/parsers/number.js
12050function parseNumberDef(def, refs) {
12051 const res = {
12052 type: "number"
12053 };
12054 if (!def.checks)
12055 return res;
12056 for (const check of def.checks) {
12057 switch (check.kind) {
12058 case "int":
12059 res.type = "integer";
12060 addErrorMessage(res, "type", check.message, refs);
12061 break;
12062 case "min":
12063 if (refs.target === "jsonSchema7") {
12064 if (check.inclusive) {
12065 setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
12066 } else {
12067 setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
12068 }
12069 } else {
12070 if (!check.inclusive) {
12071 res.exclusiveMinimum = true;
12072 }
12073 setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
12074 }
12075 break;
12076 case "max":
12077 if (refs.target === "jsonSchema7") {
12078 if (check.inclusive) {
12079 setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
12080 } else {
12081 setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
12082 }
12083 } else {
12084 if (!check.inclusive) {
12085 res.exclusiveMaximum = true;
12086 }
12087 setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
12088 }
12089 break;
12090 case "multipleOf":
12091 setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
12092 break;
12093 }
12094 }
12095 return res;
12096}
12097
12098// node_modules/zod-to-json-schema/dist/esm/parsers/object.js
12099function parseObjectDef(def, refs) {
12100 const forceOptionalIntoNullable = refs.target === "openAi";
12101 const result = {
12102 type: "object",
12103 properties: {}
12104 };
12105 const required = [];
12106 const shape = def.shape();
12107 for (const propName in shape) {
12108 let propDef = shape[propName];
12109 if (propDef === undefined || propDef._def === undefined) {
12110 continue;
12111 }
12112 let propOptional = safeIsOptional(propDef);
12113 if (propOptional && forceOptionalIntoNullable) {
12114 if (propDef._def.typeName === "ZodOptional") {
12115 propDef = propDef._def.innerType;
12116 }
12117 if (!propDef.isNullable()) {
12118 propDef = propDef.nullable();
12119 }
12120 propOptional = false;
12121 }
12122 const parsedDef = parseDef(propDef._def, {
12123 ...refs,
12124 currentPath: [...refs.currentPath, "properties", propName],
12125 propertyPath: [...refs.currentPath, "properties", propName]
12126 });
12127 if (parsedDef === undefined) {
12128 continue;
12129 }
12130 result.properties[propName] = parsedDef;
12131 if (!propOptional) {
12132 required.push(propName);
12133 }
12134 }
12135 if (required.length) {
12136 result.required = required;
12137 }
12138 const additionalProperties = decideAdditionalProperties(def, refs);
12139 if (additionalProperties !== undefined) {
12140 result.additionalProperties = additionalProperties;
12141 }
12142 return result;
12143}
12144function decideAdditionalProperties(def, refs) {
12145 if (def.catchall._def.typeName !== "ZodNever") {
12146 return parseDef(def.catchall._def, {
12147 ...refs,
12148 currentPath: [...refs.currentPath, "additionalProperties"]
12149 });
12150 }
12151 switch (def.unknownKeys) {
12152 case "passthrough":
12153 return refs.allowedAdditionalProperties;
12154 case "strict":
12155 return refs.rejectedAdditionalProperties;
12156 case "strip":
12157 return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
12158 }
12159}
12160function safeIsOptional(schema) {
12161 try {
12162 return schema.isOptional();
12163 } catch {
12164 return true;
12165 }
12166}
12167
12168// node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
12169var parseOptionalDef = (def, refs) => {
12170 if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
12171 return parseDef(def.innerType._def, refs);
12172 }
12173 const innerSchema = parseDef(def.innerType._def, {
12174 ...refs,
12175 currentPath: [...refs.currentPath, "anyOf", "1"]
12176 });
12177 return innerSchema ? {
12178 anyOf: [
12179 {
12180 not: parseAnyDef(refs)
12181 },
12182 innerSchema
12183 ]
12184 } : parseAnyDef(refs);
12185};
12186
12187// node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
12188var parsePipelineDef = (def, refs) => {
12189 if (refs.pipeStrategy === "input") {
12190 return parseDef(def.in._def, refs);
12191 } else if (refs.pipeStrategy === "output") {
12192 return parseDef(def.out._def, refs);
12193 }
12194 const a = parseDef(def.in._def, {
12195 ...refs,
12196 currentPath: [...refs.currentPath, "allOf", "0"]
12197 });
12198 const b = parseDef(def.out._def, {
12199 ...refs,
12200 currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
12201 });
12202 return {
12203 allOf: [a, b].filter((x) => x !== undefined)
12204 };
12205};
12206
12207// node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
12208function parsePromiseDef(def, refs) {
12209 return parseDef(def.type._def, refs);
12210}
12211
12212// node_modules/zod-to-json-schema/dist/esm/parsers/set.js
12213function parseSetDef(def, refs) {
12214 const items = parseDef(def.valueType._def, {
12215 ...refs,
12216 currentPath: [...refs.currentPath, "items"]
12217 });
12218 const schema = {
12219 type: "array",
12220 uniqueItems: true,
12221 items
12222 };
12223 if (def.minSize) {
12224 setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
12225 }
12226 if (def.maxSize) {
12227 setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
12228 }
12229 return schema;
12230}
12231
12232// node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
12233function parseTupleDef(def, refs) {
12234 if (def.rest) {
12235 return {
12236 type: "array",
12237 minItems: def.items.length,
12238 items: def.items.map((x, i) => parseDef(x._def, {
12239 ...refs,
12240 currentPath: [...refs.currentPath, "items", `${i}`]
12241 })).reduce((acc, x) => x === undefined ? acc : [...acc, x], []),
12242 additionalItems: parseDef(def.rest._def, {
12243 ...refs,
12244 currentPath: [...refs.currentPath, "additionalItems"]
12245 })
12246 };
12247 } else {
12248 return {
12249 type: "array",
12250 minItems: def.items.length,
12251 maxItems: def.items.length,
12252 items: def.items.map((x, i) => parseDef(x._def, {
12253 ...refs,
12254 currentPath: [...refs.currentPath, "items", `${i}`]
12255 })).reduce((acc, x) => x === undefined ? acc : [...acc, x], [])
12256 };
12257 }
12258}
12259
12260// node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
12261function parseUndefinedDef(refs) {
12262 return {
12263 not: parseAnyDef(refs)
12264 };
12265}
12266
12267// node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
12268function parseUnknownDef(refs) {
12269 return parseAnyDef(refs);
12270}
12271
12272// node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
12273var parseReadonlyDef = (def, refs) => {
12274 return parseDef(def.innerType._def, refs);
12275};
12276
12277// node_modules/zod-to-json-schema/dist/esm/selectParser.js
12278var selectParser = (def, typeName, refs) => {
12279 switch (typeName) {
12280 case ZodFirstPartyTypeKind.ZodString:
12281 return parseStringDef(def, refs);
12282 case ZodFirstPartyTypeKind.ZodNumber:
12283 return parseNumberDef(def, refs);
12284 case ZodFirstPartyTypeKind.ZodObject:
12285 return parseObjectDef(def, refs);
12286 case ZodFirstPartyTypeKind.ZodBigInt:
12287 return parseBigintDef(def, refs);
12288 case ZodFirstPartyTypeKind.ZodBoolean:
12289 return parseBooleanDef();
12290 case ZodFirstPartyTypeKind.ZodDate:
12291 return parseDateDef(def, refs);
12292 case ZodFirstPartyTypeKind.ZodUndefined:
12293 return parseUndefinedDef(refs);
12294 case ZodFirstPartyTypeKind.ZodNull:
12295 return parseNullDef(refs);
12296 case ZodFirstPartyTypeKind.ZodArray:
12297 return parseArrayDef(def, refs);
12298 case ZodFirstPartyTypeKind.ZodUnion:
12299 case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
12300 return parseUnionDef(def, refs);
12301 case ZodFirstPartyTypeKind.ZodIntersection:
12302 return parseIntersectionDef(def, refs);
12303 case ZodFirstPartyTypeKind.ZodTuple:
12304 return parseTupleDef(def, refs);
12305 case ZodFirstPartyTypeKind.ZodRecord:
12306 return parseRecordDef(def, refs);
12307 case ZodFirstPartyTypeKind.ZodLiteral:
12308 return parseLiteralDef(def, refs);
12309 case ZodFirstPartyTypeKind.ZodEnum:
12310 return parseEnumDef(def);
12311 case ZodFirstPartyTypeKind.ZodNativeEnum:
12312 return parseNativeEnumDef(def);
12313 case ZodFirstPartyTypeKind.ZodNullable:
12314 return parseNullableDef(def, refs);
12315 case ZodFirstPartyTypeKind.ZodOptional:
12316 return parseOptionalDef(def, refs);
12317 case ZodFirstPartyTypeKind.ZodMap:
12318 return parseMapDef(def, refs);
12319 case ZodFirstPartyTypeKind.ZodSet:
12320 return parseSetDef(def, refs);
12321 case ZodFirstPartyTypeKind.ZodLazy:
12322 return () => def.getter()._def;
12323 case ZodFirstPartyTypeKind.ZodPromise:
12324 return parsePromiseDef(def, refs);
12325 case ZodFirstPartyTypeKind.ZodNaN:
12326 case ZodFirstPartyTypeKind.ZodNever:
12327 return parseNeverDef(refs);
12328 case ZodFirstPartyTypeKind.ZodEffects:
12329 return parseEffectsDef(def, refs);
12330 case ZodFirstPartyTypeKind.ZodAny:
12331 return parseAnyDef(refs);
12332 case ZodFirstPartyTypeKind.ZodUnknown:
12333 return parseUnknownDef(refs);
12334 case ZodFirstPartyTypeKind.ZodDefault:
12335 return parseDefaultDef(def, refs);
12336 case ZodFirstPartyTypeKind.ZodBranded:
12337 return parseBrandedDef(def, refs);
12338 case ZodFirstPartyTypeKind.ZodReadonly:
12339 return parseReadonlyDef(def, refs);
12340 case ZodFirstPartyTypeKind.ZodCatch:
12341 return parseCatchDef(def, refs);
12342 case ZodFirstPartyTypeKind.ZodPipeline:
12343 return parsePipelineDef(def, refs);
12344 case ZodFirstPartyTypeKind.ZodFunction:
12345 case ZodFirstPartyTypeKind.ZodVoid:
12346 case ZodFirstPartyTypeKind.ZodSymbol:
12347 return;
12348 default:
12349 return ((_) => {
12350 return;
12351 })(typeName);
12352 }
12353};
12354
12355// node_modules/zod-to-json-schema/dist/esm/parseDef.js
12356function parseDef(def, refs, forceResolution = false) {
12357 const seenItem = refs.seen.get(def);
12358 if (refs.override) {
12359 const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
12360 if (overrideResult !== ignoreOverride) {
12361 return overrideResult;
12362 }
12363 }
12364 if (seenItem && !forceResolution) {
12365 const seenSchema = get$ref(seenItem, refs);
12366 if (seenSchema !== undefined) {
12367 return seenSchema;
12368 }
12369 }
12370 const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
12371 refs.seen.set(def, newItem);
12372 const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
12373 const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
12374 if (jsonSchema) {
12375 addMeta(def, refs, jsonSchema);
12376 }
12377 if (refs.postProcess) {
12378 const postProcessResult = refs.postProcess(jsonSchema, def, refs);
12379 newItem.jsonSchema = jsonSchema;
12380 return postProcessResult;
12381 }
12382 newItem.jsonSchema = jsonSchema;
12383 return jsonSchema;
12384}
12385var get$ref = (item, refs) => {
12386 switch (refs.$refStrategy) {
12387 case "root":
12388 return { $ref: item.path.join("/") };
12389 case "relative":
12390 return { $ref: getRelativePath(refs.currentPath, item.path) };
12391 case "none":
12392 case "seen": {
12393 if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
12394 console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
12395 return parseAnyDef(refs);
12396 }
12397 return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
12398 }
12399 }
12400};
12401var addMeta = (def, refs, jsonSchema) => {
12402 if (def.description) {
12403 jsonSchema.description = def.description;
12404 if (refs.markdownDescription) {
12405 jsonSchema.markdownDescription = def.description;
12406 }
12407 }
12408 return jsonSchema;
12409};
12410// node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
12411var zodToJsonSchema = (schema, options) => {
12412 const refs = getRefs(options);
12413 let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
12414 ...acc,
12415 [name2]: parseDef(schema2._def, {
12416 ...refs,
12417 currentPath: [...refs.basePath, refs.definitionPath, name2]
12418 }, true) ?? parseAnyDef(refs)
12419 }), {}) : undefined;
12420 const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? undefined : options?.name;
12421 const main = parseDef(schema._def, name === undefined ? refs : {
12422 ...refs,
12423 currentPath: [...refs.basePath, refs.definitionPath, name]
12424 }, false) ?? parseAnyDef(refs);
12425 const title = typeof options === "object" && options.name !== undefined && options.nameStrategy === "title" ? options.name : undefined;
12426 if (title !== undefined) {
12427 main.title = title;
12428 }
12429 if (refs.flags.hasReferencedOpenAiAnyType) {
12430 if (!definitions) {
12431 definitions = {};
12432 }
12433 if (!definitions[refs.openAiAnyTypeName]) {
12434 definitions[refs.openAiAnyTypeName] = {
12435 type: ["string", "number", "integer", "boolean", "array", "null"],
12436 items: {
12437 $ref: refs.$refStrategy === "relative" ? "1" : [
12438 ...refs.basePath,
12439 refs.definitionPath,
12440 refs.openAiAnyTypeName
12441 ].join("/")
12442 }
12443 };
12444 }
12445 }
12446 const combined = name === undefined ? definitions ? {
12447 ...main,
12448 [refs.definitionPath]: definitions
12449 } : main : {
12450 $ref: [
12451 ...refs.$refStrategy === "relative" ? [] : refs.basePath,
12452 refs.definitionPath,
12453 name
12454 ].join("/"),
12455 [refs.definitionPath]: {
12456 ...definitions,
12457 [name]: main
12458 }
12459 };
12460 if (refs.target === "jsonSchema7") {
12461 combined.$schema = "http://json-schema.org/draft-07/schema#";
12462 } else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
12463 combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
12464 }
12465 if (refs.target === "openAi" && (("anyOf" in combined) || ("oneOf" in combined) || ("allOf" in combined) || ("type" in combined) && Array.isArray(combined.type))) {
12466 console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
12467 }
12468 return combined;
12469};
12470// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
12471var McpZodTypeKind;
12472(function(McpZodTypeKind2) {
12473 McpZodTypeKind2["Completable"] = "McpCompletable";
12474})(McpZodTypeKind || (McpZodTypeKind = {}));
12475
12476class Completable extends ZodType {
12477 _parse(input) {
12478 const { ctx } = this._processInputParams(input);
12479 const data = ctx.data;
12480 return this._def.type._parse({
12481 data,
12482 path: ctx.path,
12483 parent: ctx
12484 });
12485 }
12486 unwrap() {
12487 return this._def.type;
12488 }
12489}
12490Completable.create = (type, params) => {
12491 return new Completable({
12492 type,
12493 typeName: McpZodTypeKind.Completable,
12494 complete: params.complete,
12495 ...processCreateParams2(params)
12496 });
12497};
12498function processCreateParams2(params) {
12499 if (!params)
12500 return {};
12501 const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
12502 if (errorMap2 && (invalid_type_error || required_error)) {
12503 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
12504 }
12505 if (errorMap2)
12506 return { errorMap: errorMap2, description };
12507 const customMap = (iss, ctx) => {
12508 var _a, _b;
12509 const { message } = params;
12510 if (iss.code === "invalid_enum_value") {
12511 return { message: message !== null && message !== undefined ? message : ctx.defaultError };
12512 }
12513 if (typeof ctx.data === "undefined") {
12514 return { message: (_a = message !== null && message !== undefined ? message : required_error) !== null && _a !== undefined ? _a : ctx.defaultError };
12515 }
12516 if (iss.code !== "invalid_type")
12517 return { message: ctx.defaultError };
12518 return { message: (_b = message !== null && message !== undefined ? message : invalid_type_error) !== null && _b !== undefined ? _b : ctx.defaultError };
12519 };
12520 return { errorMap: customMap, description };
12521}
12522
12523// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
12524class McpServer {
12525 constructor(serverInfo, options) {
12526 this._registeredResources = {};
12527 this._registeredResourceTemplates = {};
12528 this._registeredTools = {};
12529 this._registeredPrompts = {};
12530 this._toolHandlersInitialized = false;
12531 this._completionHandlerInitialized = false;
12532 this._resourceHandlersInitialized = false;
12533 this._promptHandlersInitialized = false;
12534 this.server = new Server(serverInfo, options);
12535 }
12536 async connect(transport) {
12537 return await this.server.connect(transport);
12538 }
12539 async close() {
12540 await this.server.close();
12541 }
12542 setToolRequestHandlers() {
12543 if (this._toolHandlersInitialized) {
12544 return;
12545 }
12546 this.server.assertCanSetRequestHandler(ListToolsRequestSchema.shape.method.value);
12547 this.server.assertCanSetRequestHandler(CallToolRequestSchema.shape.method.value);
12548 this.server.registerCapabilities({
12549 tools: {
12550 listChanged: true
12551 }
12552 });
12553 this.server.setRequestHandler(ListToolsRequestSchema, () => ({
12554 tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name, tool]) => {
12555 const toolDefinition = {
12556 name,
12557 title: tool.title,
12558 description: tool.description,
12559 inputSchema: tool.inputSchema ? zodToJsonSchema(tool.inputSchema, {
12560 strictUnions: true
12561 }) : EMPTY_OBJECT_JSON_SCHEMA,
12562 annotations: tool.annotations,
12563 _meta: tool._meta
12564 };
12565 if (tool.outputSchema) {
12566 toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, {
12567 strictUnions: true
12568 });
12569 }
12570 return toolDefinition;
12571 })
12572 }));
12573 this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
12574 const tool = this._registeredTools[request.params.name];
12575 if (!tool) {
12576 throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);
12577 }
12578 if (!tool.enabled) {
12579 throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);
12580 }
12581 let result;
12582 if (tool.inputSchema) {
12583 const parseResult = await tool.inputSchema.safeParseAsync(request.params.arguments);
12584 if (!parseResult.success) {
12585 throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${request.params.name}: ${parseResult.error.message}`);
12586 }
12587 const args = parseResult.data;
12588 const cb = tool.callback;
12589 try {
12590 result = await Promise.resolve(cb(args, extra));
12591 } catch (error) {
12592 result = {
12593 content: [
12594 {
12595 type: "text",
12596 text: error instanceof Error ? error.message : String(error)
12597 }
12598 ],
12599 isError: true
12600 };
12601 }
12602 } else {
12603 const cb = tool.callback;
12604 try {
12605 result = await Promise.resolve(cb(extra));
12606 } catch (error) {
12607 result = {
12608 content: [
12609 {
12610 type: "text",
12611 text: error instanceof Error ? error.message : String(error)
12612 }
12613 ],
12614 isError: true
12615 };
12616 }
12617 }
12618 if (tool.outputSchema && !result.isError) {
12619 if (!result.structuredContent) {
12620 throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} has an output schema but no structured content was provided`);
12621 }
12622 const parseResult = await tool.outputSchema.safeParseAsync(result.structuredContent);
12623 if (!parseResult.success) {
12624 throw new McpError(ErrorCode.InvalidParams, `Invalid structured content for tool ${request.params.name}: ${parseResult.error.message}`);
12625 }
12626 }
12627 return result;
12628 });
12629 this._toolHandlersInitialized = true;
12630 }
12631 setCompletionRequestHandler() {
12632 if (this._completionHandlerInitialized) {
12633 return;
12634 }
12635 this.server.assertCanSetRequestHandler(CompleteRequestSchema.shape.method.value);
12636 this.server.registerCapabilities({
12637 completions: {}
12638 });
12639 this.server.setRequestHandler(CompleteRequestSchema, async (request) => {
12640 switch (request.params.ref.type) {
12641 case "ref/prompt":
12642 return this.handlePromptCompletion(request, request.params.ref);
12643 case "ref/resource":
12644 return this.handleResourceCompletion(request, request.params.ref);
12645 default:
12646 throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`);
12647 }
12648 });
12649 this._completionHandlerInitialized = true;
12650 }
12651 async handlePromptCompletion(request, ref) {
12652 const prompt = this._registeredPrompts[ref.name];
12653 if (!prompt) {
12654 throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);
12655 }
12656 if (!prompt.enabled) {
12657 throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);
12658 }
12659 if (!prompt.argsSchema) {
12660 return EMPTY_COMPLETION_RESULT;
12661 }
12662 const field = prompt.argsSchema.shape[request.params.argument.name];
12663 if (!(field instanceof Completable)) {
12664 return EMPTY_COMPLETION_RESULT;
12665 }
12666 const def = field._def;
12667 const suggestions = await def.complete(request.params.argument.value, request.params.context);
12668 return createCompletionResult(suggestions);
12669 }
12670 async handleResourceCompletion(request, ref) {
12671 const template = Object.values(this._registeredResourceTemplates).find((t) => t.resourceTemplate.uriTemplate.toString() === ref.uri);
12672 if (!template) {
12673 if (this._registeredResources[ref.uri]) {
12674 return EMPTY_COMPLETION_RESULT;
12675 }
12676 throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`);
12677 }
12678 const completer = template.resourceTemplate.completeCallback(request.params.argument.name);
12679 if (!completer) {
12680 return EMPTY_COMPLETION_RESULT;
12681 }
12682 const suggestions = await completer(request.params.argument.value, request.params.context);
12683 return createCompletionResult(suggestions);
12684 }
12685 setResourceRequestHandlers() {
12686 if (this._resourceHandlersInitialized) {
12687 return;
12688 }
12689 this.server.assertCanSetRequestHandler(ListResourcesRequestSchema.shape.method.value);
12690 this.server.assertCanSetRequestHandler(ListResourceTemplatesRequestSchema.shape.method.value);
12691 this.server.assertCanSetRequestHandler(ReadResourceRequestSchema.shape.method.value);
12692 this.server.registerCapabilities({
12693 resources: {
12694 listChanged: true
12695 }
12696 });
12697 this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {
12698 const resources = Object.entries(this._registeredResources).filter(([_, resource]) => resource.enabled).map(([uri, resource]) => ({
12699 uri,
12700 name: resource.name,
12701 ...resource.metadata
12702 }));
12703 const templateResources = [];
12704 for (const template of Object.values(this._registeredResourceTemplates)) {
12705 if (!template.resourceTemplate.listCallback) {
12706 continue;
12707 }
12708 const result = await template.resourceTemplate.listCallback(extra);
12709 for (const resource of result.resources) {
12710 templateResources.push({
12711 ...template.metadata,
12712 ...resource
12713 });
12714 }
12715 }
12716 return { resources: [...resources, ...templateResources] };
12717 });
12718 this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
12719 const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({
12720 name,
12721 uriTemplate: template.resourceTemplate.uriTemplate.toString(),
12722 ...template.metadata
12723 }));
12724 return { resourceTemplates };
12725 });
12726 this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {
12727 const uri = new URL(request.params.uri);
12728 const resource = this._registeredResources[uri.toString()];
12729 if (resource) {
12730 if (!resource.enabled) {
12731 throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);
12732 }
12733 return resource.readCallback(uri, extra);
12734 }
12735 for (const template of Object.values(this._registeredResourceTemplates)) {
12736 const variables = template.resourceTemplate.uriTemplate.match(uri.toString());
12737 if (variables) {
12738 return template.readCallback(uri, variables, extra);
12739 }
12740 }
12741 throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`);
12742 });
12743 this.setCompletionRequestHandler();
12744 this._resourceHandlersInitialized = true;
12745 }
12746 setPromptRequestHandlers() {
12747 if (this._promptHandlersInitialized) {
12748 return;
12749 }
12750 this.server.assertCanSetRequestHandler(ListPromptsRequestSchema.shape.method.value);
12751 this.server.assertCanSetRequestHandler(GetPromptRequestSchema.shape.method.value);
12752 this.server.registerCapabilities({
12753 prompts: {
12754 listChanged: true
12755 }
12756 });
12757 this.server.setRequestHandler(ListPromptsRequestSchema, () => ({
12758 prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name, prompt]) => {
12759 return {
12760 name,
12761 title: prompt.title,
12762 description: prompt.description,
12763 arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined
12764 };
12765 })
12766 }));
12767 this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => {
12768 const prompt = this._registeredPrompts[request.params.name];
12769 if (!prompt) {
12770 throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);
12771 }
12772 if (!prompt.enabled) {
12773 throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);
12774 }
12775 if (prompt.argsSchema) {
12776 const parseResult = await prompt.argsSchema.safeParseAsync(request.params.arguments);
12777 if (!parseResult.success) {
12778 throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${parseResult.error.message}`);
12779 }
12780 const args = parseResult.data;
12781 const cb = prompt.callback;
12782 return await Promise.resolve(cb(args, extra));
12783 } else {
12784 const cb = prompt.callback;
12785 return await Promise.resolve(cb(extra));
12786 }
12787 });
12788 this.setCompletionRequestHandler();
12789 this._promptHandlersInitialized = true;
12790 }
12791 resource(name, uriOrTemplate, ...rest) {
12792 let metadata;
12793 if (typeof rest[0] === "object") {
12794 metadata = rest.shift();
12795 }
12796 const readCallback = rest[0];
12797 if (typeof uriOrTemplate === "string") {
12798 if (this._registeredResources[uriOrTemplate]) {
12799 throw new Error(`Resource ${uriOrTemplate} is already registered`);
12800 }
12801 const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback);
12802 this.setResourceRequestHandlers();
12803 this.sendResourceListChanged();
12804 return registeredResource;
12805 } else {
12806 if (this._registeredResourceTemplates[name]) {
12807 throw new Error(`Resource template ${name} is already registered`);
12808 }
12809 const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback);
12810 this.setResourceRequestHandlers();
12811 this.sendResourceListChanged();
12812 return registeredResourceTemplate;
12813 }
12814 }
12815 registerResource(name, uriOrTemplate, config, readCallback) {
12816 if (typeof uriOrTemplate === "string") {
12817 if (this._registeredResources[uriOrTemplate]) {
12818 throw new Error(`Resource ${uriOrTemplate} is already registered`);
12819 }
12820 const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback);
12821 this.setResourceRequestHandlers();
12822 this.sendResourceListChanged();
12823 return registeredResource;
12824 } else {
12825 if (this._registeredResourceTemplates[name]) {
12826 throw new Error(`Resource template ${name} is already registered`);
12827 }
12828 const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback);
12829 this.setResourceRequestHandlers();
12830 this.sendResourceListChanged();
12831 return registeredResourceTemplate;
12832 }
12833 }
12834 _createRegisteredResource(name, title, uri, metadata, readCallback) {
12835 const registeredResource = {
12836 name,
12837 title,
12838 metadata,
12839 readCallback,
12840 enabled: true,
12841 disable: () => registeredResource.update({ enabled: false }),
12842 enable: () => registeredResource.update({ enabled: true }),
12843 remove: () => registeredResource.update({ uri: null }),
12844 update: (updates) => {
12845 if (typeof updates.uri !== "undefined" && updates.uri !== uri) {
12846 delete this._registeredResources[uri];
12847 if (updates.uri)
12848 this._registeredResources[updates.uri] = registeredResource;
12849 }
12850 if (typeof updates.name !== "undefined")
12851 registeredResource.name = updates.name;
12852 if (typeof updates.title !== "undefined")
12853 registeredResource.title = updates.title;
12854 if (typeof updates.metadata !== "undefined")
12855 registeredResource.metadata = updates.metadata;
12856 if (typeof updates.callback !== "undefined")
12857 registeredResource.readCallback = updates.callback;
12858 if (typeof updates.enabled !== "undefined")
12859 registeredResource.enabled = updates.enabled;
12860 this.sendResourceListChanged();
12861 }
12862 };
12863 this._registeredResources[uri] = registeredResource;
12864 return registeredResource;
12865 }
12866 _createRegisteredResourceTemplate(name, title, template, metadata, readCallback) {
12867 const registeredResourceTemplate = {
12868 resourceTemplate: template,
12869 title,
12870 metadata,
12871 readCallback,
12872 enabled: true,
12873 disable: () => registeredResourceTemplate.update({ enabled: false }),
12874 enable: () => registeredResourceTemplate.update({ enabled: true }),
12875 remove: () => registeredResourceTemplate.update({ name: null }),
12876 update: (updates) => {
12877 if (typeof updates.name !== "undefined" && updates.name !== name) {
12878 delete this._registeredResourceTemplates[name];
12879 if (updates.name)
12880 this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
12881 }
12882 if (typeof updates.title !== "undefined")
12883 registeredResourceTemplate.title = updates.title;
12884 if (typeof updates.template !== "undefined")
12885 registeredResourceTemplate.resourceTemplate = updates.template;
12886 if (typeof updates.metadata !== "undefined")
12887 registeredResourceTemplate.metadata = updates.metadata;
12888 if (typeof updates.callback !== "undefined")
12889 registeredResourceTemplate.readCallback = updates.callback;
12890 if (typeof updates.enabled !== "undefined")
12891 registeredResourceTemplate.enabled = updates.enabled;
12892 this.sendResourceListChanged();
12893 }
12894 };
12895 this._registeredResourceTemplates[name] = registeredResourceTemplate;
12896 return registeredResourceTemplate;
12897 }
12898 _createRegisteredPrompt(name, title, description, argsSchema, callback) {
12899 const registeredPrompt = {
12900 title,
12901 description,
12902 argsSchema: argsSchema === undefined ? undefined : exports_external.object(argsSchema),
12903 callback,
12904 enabled: true,
12905 disable: () => registeredPrompt.update({ enabled: false }),
12906 enable: () => registeredPrompt.update({ enabled: true }),
12907 remove: () => registeredPrompt.update({ name: null }),
12908 update: (updates) => {
12909 if (typeof updates.name !== "undefined" && updates.name !== name) {
12910 delete this._registeredPrompts[name];
12911 if (updates.name)
12912 this._registeredPrompts[updates.name] = registeredPrompt;
12913 }
12914 if (typeof updates.title !== "undefined")
12915 registeredPrompt.title = updates.title;
12916 if (typeof updates.description !== "undefined")
12917 registeredPrompt.description = updates.description;
12918 if (typeof updates.argsSchema !== "undefined")
12919 registeredPrompt.argsSchema = exports_external.object(updates.argsSchema);
12920 if (typeof updates.callback !== "undefined")
12921 registeredPrompt.callback = updates.callback;
12922 if (typeof updates.enabled !== "undefined")
12923 registeredPrompt.enabled = updates.enabled;
12924 this.sendPromptListChanged();
12925 }
12926 };
12927 this._registeredPrompts[name] = registeredPrompt;
12928 return registeredPrompt;
12929 }
12930 _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, _meta, callback) {
12931 const registeredTool = {
12932 title,
12933 description,
12934 inputSchema: inputSchema === undefined ? undefined : exports_external.object(inputSchema),
12935 outputSchema: outputSchema === undefined ? undefined : exports_external.object(outputSchema),
12936 annotations,
12937 _meta,
12938 callback,
12939 enabled: true,
12940 disable: () => registeredTool.update({ enabled: false }),
12941 enable: () => registeredTool.update({ enabled: true }),
12942 remove: () => registeredTool.update({ name: null }),
12943 update: (updates) => {
12944 if (typeof updates.name !== "undefined" && updates.name !== name) {
12945 delete this._registeredTools[name];
12946 if (updates.name)
12947 this._registeredTools[updates.name] = registeredTool;
12948 }
12949 if (typeof updates.title !== "undefined")
12950 registeredTool.title = updates.title;
12951 if (typeof updates.description !== "undefined")
12952 registeredTool.description = updates.description;
12953 if (typeof updates.paramsSchema !== "undefined")
12954 registeredTool.inputSchema = exports_external.object(updates.paramsSchema);
12955 if (typeof updates.callback !== "undefined")
12956 registeredTool.callback = updates.callback;
12957 if (typeof updates.annotations !== "undefined")
12958 registeredTool.annotations = updates.annotations;
12959 if (typeof updates._meta !== "undefined")
12960 registeredTool._meta = updates._meta;
12961 if (typeof updates.enabled !== "undefined")
12962 registeredTool.enabled = updates.enabled;
12963 this.sendToolListChanged();
12964 }
12965 };
12966 this._registeredTools[name] = registeredTool;
12967 this.setToolRequestHandlers();
12968 this.sendToolListChanged();
12969 return registeredTool;
12970 }
12971 tool(name, ...rest) {
12972 if (this._registeredTools[name]) {
12973 throw new Error(`Tool ${name} is already registered`);
12974 }
12975 let description;
12976 let inputSchema;
12977 let outputSchema;
12978 let annotations;
12979 if (typeof rest[0] === "string") {
12980 description = rest.shift();
12981 }
12982 if (rest.length > 1) {
12983 const firstArg = rest[0];
12984 if (isZodRawShape(firstArg)) {
12985 inputSchema = rest.shift();
12986 if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShape(rest[0])) {
12987 annotations = rest.shift();
12988 }
12989 } else if (typeof firstArg === "object" && firstArg !== null) {
12990 annotations = rest.shift();
12991 }
12992 }
12993 const callback = rest[0];
12994 return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, undefined, callback);
12995 }
12996 registerTool(name, config, cb) {
12997 if (this._registeredTools[name]) {
12998 throw new Error(`Tool ${name} is already registered`);
12999 }
13000 const { title, description, inputSchema, outputSchema, annotations, _meta } = config;
13001 return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, _meta, cb);
13002 }
13003 prompt(name, ...rest) {
13004 if (this._registeredPrompts[name]) {
13005 throw new Error(`Prompt ${name} is already registered`);
13006 }
13007 let description;
13008 if (typeof rest[0] === "string") {
13009 description = rest.shift();
13010 }
13011 let argsSchema;
13012 if (rest.length > 1) {
13013 argsSchema = rest.shift();
13014 }
13015 const cb = rest[0];
13016 const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb);
13017 this.setPromptRequestHandlers();
13018 this.sendPromptListChanged();
13019 return registeredPrompt;
13020 }
13021 registerPrompt(name, config, cb) {
13022 if (this._registeredPrompts[name]) {
13023 throw new Error(`Prompt ${name} is already registered`);
13024 }
13025 const { title, description, argsSchema } = config;
13026 const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb);
13027 this.setPromptRequestHandlers();
13028 this.sendPromptListChanged();
13029 return registeredPrompt;
13030 }
13031 isConnected() {
13032 return this.server.transport !== undefined;
13033 }
13034 async sendLoggingMessage(params, sessionId) {
13035 return this.server.sendLoggingMessage(params, sessionId);
13036 }
13037 sendResourceListChanged() {
13038 if (this.isConnected()) {
13039 this.server.sendResourceListChanged();
13040 }
13041 }
13042 sendToolListChanged() {
13043 if (this.isConnected()) {
13044 this.server.sendToolListChanged();
13045 }
13046 }
13047 sendPromptListChanged() {
13048 if (this.isConnected()) {
13049 this.server.sendPromptListChanged();
13050 }
13051 }
13052}
13053var EMPTY_OBJECT_JSON_SCHEMA = {
13054 type: "object",
13055 properties: {}
13056};
13057function isZodRawShape(obj) {
13058 if (typeof obj !== "object" || obj === null)
13059 return false;
13060 const isEmptyObject = Object.keys(obj).length === 0;
13061 return isEmptyObject || Object.values(obj).some(isZodTypeLike);
13062}
13063function isZodTypeLike(value) {
13064 return value !== null && typeof value === "object" && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
13065}
13066function promptArgumentsFromSchema(schema) {
13067 return Object.entries(schema.shape).map(([name, field]) => ({
13068 name,
13069 description: field.description,
13070 required: !field.isOptional()
13071 }));
13072}
13073function createCompletionResult(suggestions) {
13074 return {
13075 completion: {
13076 values: suggestions.slice(0, 100),
13077 total: suggestions.length,
13078 hasMore: suggestions.length > 100
13079 }
13080 };
13081}
13082var EMPTY_COMPLETION_RESULT = {
13083 completion: {
13084 values: [],
13085 hasMore: false
13086 }
13087};
13088
13089// node:process
13090var C = Object.create;
13091var T = Object.defineProperty;
13092var q = Object.getOwnPropertyDescriptor;
13093var A = Object.getOwnPropertyNames;
13094var I = Object.getPrototypeOf;
13095var Q = Object.prototype.hasOwnProperty;
13096var S = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
13097var N = (e, t) => {
13098 for (var n in t)
13099 T(e, n, { get: t[n], enumerable: true });
13100};
13101var d = (e, t, n, w) => {
13102 if (t && typeof t == "object" || typeof t == "function")
13103 for (let l of A(t))
13104 !Q.call(e, l) && l !== n && T(e, l, { get: () => t[l], enumerable: !(w = q(t, l)) || w.enumerable });
13105 return e;
13106};
13107var h = (e, t, n) => (d(e, t, "default"), n && d(n, t, "default"));
13108var y = (e, t, n) => (n = e != null ? C(I(e)) : {}, d(t || !e || !e.__esModule ? T(n, "default", { value: e, enumerable: true }) : n, e));
13109var v = S((B, E) => {
13110 var r = E.exports = {}, i, u;
13111 function p() {
13112 throw new Error("setTimeout has not been defined");
13113 }
13114 function g() {
13115 throw new Error("clearTimeout has not been defined");
13116 }
13117 (function() {
13118 try {
13119 typeof setTimeout == "function" ? i = setTimeout : i = p;
13120 } catch {
13121 i = p;
13122 }
13123 try {
13124 typeof clearTimeout == "function" ? u = clearTimeout : u = g;
13125 } catch {
13126 u = g;
13127 }
13128 })();
13129 function b(e) {
13130 if (i === setTimeout)
13131 return setTimeout(e, 0);
13132 if ((i === p || !i) && setTimeout)
13133 return i = setTimeout, setTimeout(e, 0);
13134 try {
13135 return i(e, 0);
13136 } catch {
13137 try {
13138 return i.call(null, e, 0);
13139 } catch {
13140 return i.call(this, e, 0);
13141 }
13142 }
13143 }
13144 function O(e) {
13145 if (u === clearTimeout)
13146 return clearTimeout(e);
13147 if ((u === g || !u) && clearTimeout)
13148 return u = clearTimeout, clearTimeout(e);
13149 try {
13150 return u(e);
13151 } catch {
13152 try {
13153 return u.call(null, e);
13154 } catch {
13155 return u.call(this, e);
13156 }
13157 }
13158 }
13159 var o = [], s = false, a, m = -1;
13160 function U() {
13161 !s || !a || (s = false, a.length ? o = a.concat(o) : m = -1, o.length && x());
13162 }
13163 function x() {
13164 if (!s) {
13165 var e = b(U);
13166 s = true;
13167 for (var t = o.length;t; ) {
13168 for (a = o, o = [];++m < t; )
13169 a && a[m].run();
13170 m = -1, t = o.length;
13171 }
13172 a = null, s = false, O(e);
13173 }
13174 }
13175 r.nextTick = function(e) {
13176 var t = new Array(arguments.length - 1);
13177 if (arguments.length > 1)
13178 for (var n = 1;n < arguments.length; n++)
13179 t[n - 1] = arguments[n];
13180 o.push(new L(e, t)), o.length === 1 && !s && b(x);
13181 };
13182 function L(e, t) {
13183 this.fun = e, this.array = t;
13184 }
13185 L.prototype.run = function() {
13186 this.fun.apply(null, this.array);
13187 };
13188 r.title = "browser";
13189 r.browser = true;
13190 r.env = {};
13191 r.argv = [];
13192 r.version = "";
13193 r.versions = {};
13194 function c() {}
13195 r.on = c;
13196 r.addListener = c;
13197 r.once = c;
13198 r.off = c;
13199 r.removeListener = c;
13200 r.removeAllListeners = c;
13201 r.emit = c;
13202 r.prependListener = c;
13203 r.prependOnceListener = c;
13204 r.listeners = function(e) {
13205 return [];
13206 };
13207 r.binding = function(e) {
13208 throw new Error("process.binding is not supported");
13209 };
13210 r.cwd = function() {
13211 return "/";
13212 };
13213 r.chdir = function(e) {
13214 throw new Error("process.chdir is not supported");
13215 };
13216 r.umask = function() {
13217 return 0;
13218 };
13219});
13220var f = {};
13221N(f, { default: () => j });
13222h(f, y(v()));
13223var j = y(v());
13224
13225// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
13226class ReadBuffer {
13227 append(chunk) {
13228 this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
13229 }
13230 readMessage() {
13231 if (!this._buffer) {
13232 return null;
13233 }
13234 const index = this._buffer.indexOf(`
13235`);
13236 if (index === -1) {
13237 return null;
13238 }
13239 const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
13240 this._buffer = this._buffer.subarray(index + 1);
13241 return deserializeMessage(line);
13242 }
13243 clear() {
13244 this._buffer = undefined;
13245 }
13246}
13247function deserializeMessage(line) {
13248 return JSONRPCMessageSchema.parse(JSON.parse(line));
13249}
13250function serializeMessage(message) {
13251 return JSON.stringify(message) + `
13252`;
13253}
13254
13255// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
13256class StdioServerTransport {
13257 constructor(_stdin = j.stdin, _stdout = j.stdout) {
13258 this._stdin = _stdin;
13259 this._stdout = _stdout;
13260 this._readBuffer = new ReadBuffer;
13261 this._started = false;
13262 this._ondata = (chunk) => {
13263 this._readBuffer.append(chunk);
13264 this.processReadBuffer();
13265 };
13266 this._onerror = (error) => {
13267 var _a;
13268 (_a = this.onerror) === null || _a === undefined || _a.call(this, error);
13269 };
13270 }
13271 async start() {
13272 if (this._started) {
13273 throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
13274 }
13275 this._started = true;
13276 this._stdin.on("data", this._ondata);
13277 this._stdin.on("error", this._onerror);
13278 }
13279 processReadBuffer() {
13280 var _a, _b;
13281 while (true) {
13282 try {
13283 const message = this._readBuffer.readMessage();
13284 if (message === null) {
13285 break;
13286 }
13287 (_a = this.onmessage) === null || _a === undefined || _a.call(this, message);
13288 } catch (error) {
13289 (_b = this.onerror) === null || _b === undefined || _b.call(this, error);
13290 }
13291 }
13292 }
13293 async close() {
13294 var _a;
13295 this._stdin.off("data", this._ondata);
13296 this._stdin.off("error", this._onerror);
13297 const remainingDataListeners = this._stdin.listenerCount("data");
13298 if (remainingDataListeners === 0) {
13299 this._stdin.pause();
13300 }
13301 this._readBuffer.clear();
13302 (_a = this.onclose) === null || _a === undefined || _a.call(this);
13303 }
13304 send(message) {
13305 return new Promise((resolve) => {
13306 const json = serializeMessage(message);
13307 if (this._stdout.write(json)) {
13308 resolve();
13309 } else {
13310 this._stdout.once("drain", resolve);
13311 }
13312 });
13313 }
13314}
13315
13316// node_modules/universal-user-agent/index.js
13317function getUserAgent() {
13318 if (typeof navigator === "object" && "userAgent" in navigator) {
13319 return navigator.userAgent;
13320 }
13321 if (typeof process === "object" && process.version !== undefined) {
13322 return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
13323 }
13324 return "<environment undetectable>";
13325}
13326
13327// node_modules/before-after-hook/lib/register.js
13328function register(state, name, method, options) {
13329 if (typeof method !== "function") {
13330 throw new Error("method for before hook must be a function");
13331 }
13332 if (!options) {
13333 options = {};
13334 }
13335 if (Array.isArray(name)) {
13336 return name.reverse().reduce((callback, name2) => {
13337 return register.bind(null, state, name2, callback, options);
13338 }, method)();
13339 }
13340 return Promise.resolve().then(() => {
13341 if (!state.registry[name]) {
13342 return method(options);
13343 }
13344 return state.registry[name].reduce((method2, registered) => {
13345 return registered.hook.bind(null, method2, options);
13346 }, method)();
13347 });
13348}
13349
13350// node_modules/before-after-hook/lib/add.js
13351function addHook(state, kind, name, hook) {
13352 const orig = hook;
13353 if (!state.registry[name]) {
13354 state.registry[name] = [];
13355 }
13356 if (kind === "before") {
13357 hook = (method, options) => {
13358 return Promise.resolve().then(orig.bind(null, options)).then(method.bind(null, options));
13359 };
13360 }
13361 if (kind === "after") {
13362 hook = (method, options) => {
13363 let result;
13364 return Promise.resolve().then(method.bind(null, options)).then((result_) => {
13365 result = result_;
13366 return orig(result, options);
13367 }).then(() => {
13368 return result;
13369 });
13370 };
13371 }
13372 if (kind === "error") {
13373 hook = (method, options) => {
13374 return Promise.resolve().then(method.bind(null, options)).catch((error) => {
13375 return orig(error, options);
13376 });
13377 };
13378 }
13379 state.registry[name].push({
13380 hook,
13381 orig
13382 });
13383}
13384
13385// node_modules/before-after-hook/lib/remove.js
13386function removeHook(state, name, method) {
13387 if (!state.registry[name]) {
13388 return;
13389 }
13390 const index = state.registry[name].map((registered) => {
13391 return registered.orig;
13392 }).indexOf(method);
13393 if (index === -1) {
13394 return;
13395 }
13396 state.registry[name].splice(index, 1);
13397}
13398
13399// node_modules/before-after-hook/index.js
13400var bind = Function.bind;
13401var bindable = bind.bind(bind);
13402function bindApi(hook, state, name) {
13403 const removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]);
13404 hook.api = { remove: removeHookRef };
13405 hook.remove = removeHookRef;
13406 ["before", "error", "after", "wrap"].forEach((kind) => {
13407 const args = name ? [state, kind, name] : [state, kind];
13408 hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
13409 });
13410}
13411function Singular() {
13412 const singularHookName = Symbol("Singular");
13413 const singularHookState = {
13414 registry: {}
13415 };
13416 const singularHook = register.bind(null, singularHookState, singularHookName);
13417 bindApi(singularHook, singularHookState, singularHookName);
13418 return singularHook;
13419}
13420function Collection() {
13421 const state = {
13422 registry: {}
13423 };
13424 const hook = register.bind(null, state);
13425 bindApi(hook, state);
13426 return hook;
13427}
13428var before_after_hook_default = { Singular, Collection };
13429
13430// node_modules/@octokit/endpoint/dist-bundle/index.js
13431var VERSION = "0.0.0-development";
13432var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
13433var DEFAULTS = {
13434 method: "GET",
13435 baseUrl: "https://api.github.com",
13436 headers: {
13437 accept: "application/vnd.github.v3+json",
13438 "user-agent": userAgent
13439 },
13440 mediaType: {
13441 format: ""
13442 }
13443};
13444function lowercaseKeys(object2) {
13445 if (!object2) {
13446 return {};
13447 }
13448 return Object.keys(object2).reduce((newObj, key) => {
13449 newObj[key.toLowerCase()] = object2[key];
13450 return newObj;
13451 }, {});
13452}
13453function isPlainObject(value) {
13454 if (typeof value !== "object" || value === null)
13455 return false;
13456 if (Object.prototype.toString.call(value) !== "[object Object]")
13457 return false;
13458 const proto = Object.getPrototypeOf(value);
13459 if (proto === null)
13460 return true;
13461 const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
13462 return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
13463}
13464function mergeDeep(defaults, options) {
13465 const result = Object.assign({}, defaults);
13466 Object.keys(options).forEach((key) => {
13467 if (isPlainObject(options[key])) {
13468 if (!(key in defaults))
13469 Object.assign(result, { [key]: options[key] });
13470 else
13471 result[key] = mergeDeep(defaults[key], options[key]);
13472 } else {
13473 Object.assign(result, { [key]: options[key] });
13474 }
13475 });
13476 return result;
13477}
13478function removeUndefinedProperties(obj) {
13479 for (const key in obj) {
13480 if (obj[key] === undefined) {
13481 delete obj[key];
13482 }
13483 }
13484 return obj;
13485}
13486function merge(defaults, route, options) {
13487 if (typeof route === "string") {
13488 let [method, url] = route.split(" ");
13489 options = Object.assign(url ? { method, url } : { url: method }, options);
13490 } else {
13491 options = Object.assign({}, route);
13492 }
13493 options.headers = lowercaseKeys(options.headers);
13494 removeUndefinedProperties(options);
13495 removeUndefinedProperties(options.headers);
13496 const mergedOptions = mergeDeep(defaults || {}, options);
13497 if (options.url === "/graphql") {
13498 if (defaults && defaults.mediaType.previews?.length) {
13499 mergedOptions.mediaType.previews = defaults.mediaType.previews.filter((preview) => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);
13500 }
13501 mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
13502 }
13503 return mergedOptions;
13504}
13505function addQueryParameters(url, parameters) {
13506 const separator = /\?/.test(url) ? "&" : "?";
13507 const names = Object.keys(parameters);
13508 if (names.length === 0) {
13509 return url;
13510 }
13511 return url + separator + names.map((name) => {
13512 if (name === "q") {
13513 return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
13514 }
13515 return `${name}=${encodeURIComponent(parameters[name])}`;
13516 }).join("&");
13517}
13518var urlVariableRegex = /\{[^{}}]+\}/g;
13519function removeNonChars(variableName) {
13520 return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
13521}
13522function extractUrlVariableNames(url) {
13523 const matches = url.match(urlVariableRegex);
13524 if (!matches) {
13525 return [];
13526 }
13527 return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
13528}
13529function omit(object2, keysToOmit) {
13530 const result = { __proto__: null };
13531 for (const key of Object.keys(object2)) {
13532 if (keysToOmit.indexOf(key) === -1) {
13533 result[key] = object2[key];
13534 }
13535 }
13536 return result;
13537}
13538function encodeReserved(str) {
13539 return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
13540 if (!/%[0-9A-Fa-f]/.test(part)) {
13541 part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
13542 }
13543 return part;
13544 }).join("");
13545}
13546function encodeUnreserved(str) {
13547 return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
13548 return "%" + c.charCodeAt(0).toString(16).toUpperCase();
13549 });
13550}
13551function encodeValue(operator, value, key) {
13552 value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
13553 if (key) {
13554 return encodeUnreserved(key) + "=" + value;
13555 } else {
13556 return value;
13557 }
13558}
13559function isDefined(value) {
13560 return value !== undefined && value !== null;
13561}
13562function isKeyOperator(operator) {
13563 return operator === ";" || operator === "&" || operator === "?";
13564}
13565function getValues(context, operator, key, modifier) {
13566 var value = context[key], result = [];
13567 if (isDefined(value) && value !== "") {
13568 if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
13569 value = value.toString();
13570 if (modifier && modifier !== "*") {
13571 value = value.substring(0, parseInt(modifier, 10));
13572 }
13573 result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
13574 } else {
13575 if (modifier === "*") {
13576 if (Array.isArray(value)) {
13577 value.filter(isDefined).forEach(function(value2) {
13578 result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : ""));
13579 });
13580 } else {
13581 Object.keys(value).forEach(function(k) {
13582 if (isDefined(value[k])) {
13583 result.push(encodeValue(operator, value[k], k));
13584 }
13585 });
13586 }
13587 } else {
13588 const tmp = [];
13589 if (Array.isArray(value)) {
13590 value.filter(isDefined).forEach(function(value2) {
13591 tmp.push(encodeValue(operator, value2));
13592 });
13593 } else {
13594 Object.keys(value).forEach(function(k) {
13595 if (isDefined(value[k])) {
13596 tmp.push(encodeUnreserved(k));
13597 tmp.push(encodeValue(operator, value[k].toString()));
13598 }
13599 });
13600 }
13601 if (isKeyOperator(operator)) {
13602 result.push(encodeUnreserved(key) + "=" + tmp.join(","));
13603 } else if (tmp.length !== 0) {
13604 result.push(tmp.join(","));
13605 }
13606 }
13607 }
13608 } else {
13609 if (operator === ";") {
13610 if (isDefined(value)) {
13611 result.push(encodeUnreserved(key));
13612 }
13613 } else if (value === "" && (operator === "&" || operator === "?")) {
13614 result.push(encodeUnreserved(key) + "=");
13615 } else if (value === "") {
13616 result.push("");
13617 }
13618 }
13619 return result;
13620}
13621function parseUrl(template) {
13622 return {
13623 expand: expand.bind(null, template)
13624 };
13625}
13626function expand(template, context) {
13627 var operators = ["+", "#", ".", "/", ";", "?", "&"];
13628 template = template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function(_, expression, literal2) {
13629 if (expression) {
13630 let operator = "";
13631 const values = [];
13632 if (operators.indexOf(expression.charAt(0)) !== -1) {
13633 operator = expression.charAt(0);
13634 expression = expression.substr(1);
13635 }
13636 expression.split(/,/g).forEach(function(variable) {
13637 var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
13638 values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
13639 });
13640 if (operator && operator !== "+") {
13641 var separator = ",";
13642 if (operator === "?") {
13643 separator = "&";
13644 } else if (operator !== "#") {
13645 separator = operator;
13646 }
13647 return (values.length !== 0 ? operator : "") + values.join(separator);
13648 } else {
13649 return values.join(",");
13650 }
13651 } else {
13652 return encodeReserved(literal2);
13653 }
13654 });
13655 if (template === "/") {
13656 return template;
13657 } else {
13658 return template.replace(/\/$/, "");
13659 }
13660}
13661function parse(options) {
13662 let method = options.method.toUpperCase();
13663 let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
13664 let headers = Object.assign({}, options.headers);
13665 let body;
13666 let parameters = omit(options, [
13667 "method",
13668 "baseUrl",
13669 "url",
13670 "headers",
13671 "request",
13672 "mediaType"
13673 ]);
13674 const urlVariableNames = extractUrlVariableNames(url);
13675 url = parseUrl(url).expand(parameters);
13676 if (!/^http/.test(url)) {
13677 url = options.baseUrl + url;
13678 }
13679 const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
13680 const remainingParameters = omit(parameters, omittedParameters);
13681 const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
13682 if (!isBinaryRequest) {
13683 if (options.mediaType.format) {
13684 headers.accept = headers.accept.split(/,/).map((format) => format.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(",");
13685 }
13686 if (url.endsWith("/graphql")) {
13687 if (options.mediaType.previews?.length) {
13688 const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
13689 headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
13690 const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
13691 return `application/vnd.github.${preview}-preview${format}`;
13692 }).join(",");
13693 }
13694 }
13695 }
13696 if (["GET", "HEAD"].includes(method)) {
13697 url = addQueryParameters(url, remainingParameters);
13698 } else {
13699 if ("data" in remainingParameters) {
13700 body = remainingParameters.data;
13701 } else {
13702 if (Object.keys(remainingParameters).length) {
13703 body = remainingParameters;
13704 }
13705 }
13706 }
13707 if (!headers["content-type"] && typeof body !== "undefined") {
13708 headers["content-type"] = "application/json; charset=utf-8";
13709 }
13710 if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
13711 body = "";
13712 }
13713 return Object.assign({ method, url, headers }, typeof body !== "undefined" ? { body } : null, options.request ? { request: options.request } : null);
13714}
13715function endpointWithDefaults(defaults, route, options) {
13716 return parse(merge(defaults, route, options));
13717}
13718function withDefaults(oldDefaults, newDefaults) {
13719 const DEFAULTS2 = merge(oldDefaults, newDefaults);
13720 const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
13721 return Object.assign(endpoint2, {
13722 DEFAULTS: DEFAULTS2,
13723 defaults: withDefaults.bind(null, DEFAULTS2),
13724 merge: merge.bind(null, DEFAULTS2),
13725 parse
13726 });
13727}
13728var endpoint = withDefaults(null, DEFAULTS);
13729
13730// node_modules/fast-content-type-parse/index.js
13731var NullObject = function NullObject2() {};
13732NullObject.prototype = Object.create(null);
13733var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
13734var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
13735var mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u;
13736var defaultContentType = { type: "", parameters: new NullObject };
13737Object.freeze(defaultContentType.parameters);
13738Object.freeze(defaultContentType);
13739function safeParse(header) {
13740 if (typeof header !== "string") {
13741 return defaultContentType;
13742 }
13743 let index = header.indexOf(";");
13744 const type = index !== -1 ? header.slice(0, index).trim() : header.trim();
13745 if (mediaTypeRE.test(type) === false) {
13746 return defaultContentType;
13747 }
13748 const result = {
13749 type: type.toLowerCase(),
13750 parameters: new NullObject
13751 };
13752 if (index === -1) {
13753 return result;
13754 }
13755 let key;
13756 let match;
13757 let value;
13758 paramRE.lastIndex = index;
13759 while (match = paramRE.exec(header)) {
13760 if (match.index !== index) {
13761 return defaultContentType;
13762 }
13763 index += match[0].length;
13764 key = match[1].toLowerCase();
13765 value = match[2];
13766 if (value[0] === '"') {
13767 value = value.slice(1, value.length - 1);
13768 quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1"));
13769 }
13770 result.parameters[key] = value;
13771 }
13772 if (index !== header.length) {
13773 return defaultContentType;
13774 }
13775 return result;
13776}
13777var $safeParse = safeParse;
13778
13779// node_modules/@octokit/request-error/dist-src/index.js
13780class RequestError extends Error {
13781 name;
13782 status;
13783 request;
13784 response;
13785 constructor(message, statusCode, options) {
13786 super(message);
13787 this.name = "HttpError";
13788 this.status = Number.parseInt(statusCode);
13789 if (Number.isNaN(this.status)) {
13790 this.status = 0;
13791 }
13792 if ("response" in options) {
13793 this.response = options.response;
13794 }
13795 const requestCopy = Object.assign({}, options.request);
13796 if (options.request.headers.authorization) {
13797 requestCopy.headers = Object.assign({}, options.request.headers, {
13798 authorization: options.request.headers.authorization.replace(/(?<! ) .*$/, " [REDACTED]")
13799 });
13800 }
13801 requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
13802 this.request = requestCopy;
13803 }
13804}
13805
13806// node_modules/@octokit/request/dist-bundle/index.js
13807var VERSION2 = "10.0.5";
13808var defaults_default = {
13809 headers: {
13810 "user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}`
13811 }
13812};
13813function isPlainObject2(value) {
13814 if (typeof value !== "object" || value === null)
13815 return false;
13816 if (Object.prototype.toString.call(value) !== "[object Object]")
13817 return false;
13818 const proto = Object.getPrototypeOf(value);
13819 if (proto === null)
13820 return true;
13821 const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
13822 return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
13823}
13824async function fetchWrapper(requestOptions) {
13825 const fetch = requestOptions.request?.fetch || globalThis.fetch;
13826 if (!fetch) {
13827 throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");
13828 }
13829 const log = requestOptions.request?.log || console;
13830 const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
13831 const body = isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
13832 const requestHeaders = Object.fromEntries(Object.entries(requestOptions.headers).map(([name, value]) => [
13833 name,
13834 String(value)
13835 ]));
13836 let fetchResponse;
13837 try {
13838 fetchResponse = await fetch(requestOptions.url, {
13839 method: requestOptions.method,
13840 body,
13841 redirect: requestOptions.request?.redirect,
13842 headers: requestHeaders,
13843 signal: requestOptions.request?.signal,
13844 ...requestOptions.body && { duplex: "half" }
13845 });
13846 } catch (error) {
13847 let message = "Unknown Error";
13848 if (error instanceof Error) {
13849 if (error.name === "AbortError") {
13850 error.status = 500;
13851 throw error;
13852 }
13853 message = error.message;
13854 if (error.name === "TypeError" && "cause" in error) {
13855 if (error.cause instanceof Error) {
13856 message = error.cause.message;
13857 } else if (typeof error.cause === "string") {
13858 message = error.cause;
13859 }
13860 }
13861 }
13862 const requestError = new RequestError(message, 500, {
13863 request: requestOptions
13864 });
13865 requestError.cause = error;
13866 throw requestError;
13867 }
13868 const status = fetchResponse.status;
13869 const url = fetchResponse.url;
13870 const responseHeaders = {};
13871 for (const [key, value] of fetchResponse.headers) {
13872 responseHeaders[key] = value;
13873 }
13874 const octokitResponse = {
13875 url,
13876 status,
13877 headers: responseHeaders,
13878 data: ""
13879 };
13880 if ("deprecation" in responseHeaders) {
13881 const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
13882 const deprecationLink = matches && matches.pop();
13883 log.warn(`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`);
13884 }
13885 if (status === 204 || status === 205) {
13886 return octokitResponse;
13887 }
13888 if (requestOptions.method === "HEAD") {
13889 if (status < 400) {
13890 return octokitResponse;
13891 }
13892 throw new RequestError(fetchResponse.statusText, status, {
13893 response: octokitResponse,
13894 request: requestOptions
13895 });
13896 }
13897 if (status === 304) {
13898 octokitResponse.data = await getResponseData(fetchResponse);
13899 throw new RequestError("Not modified", status, {
13900 response: octokitResponse,
13901 request: requestOptions
13902 });
13903 }
13904 if (status >= 400) {
13905 octokitResponse.data = await getResponseData(fetchResponse);
13906 throw new RequestError(toErrorMessage(octokitResponse.data), status, {
13907 response: octokitResponse,
13908 request: requestOptions
13909 });
13910 }
13911 octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
13912 return octokitResponse;
13913}
13914async function getResponseData(response) {
13915 const contentType = response.headers.get("content-type");
13916 if (!contentType) {
13917 return response.text().catch(() => "");
13918 }
13919 const mimetype = $safeParse(contentType);
13920 if (isJSONResponse(mimetype)) {
13921 let text = "";
13922 try {
13923 text = await response.text();
13924 return JSON.parse(text);
13925 } catch (err) {
13926 return text;
13927 }
13928 } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
13929 return response.text().catch(() => "");
13930 } else {
13931 return response.arrayBuffer().catch(() => new ArrayBuffer(0));
13932 }
13933}
13934function isJSONResponse(mimetype) {
13935 return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
13936}
13937function toErrorMessage(data) {
13938 if (typeof data === "string") {
13939 return data;
13940 }
13941 if (data instanceof ArrayBuffer) {
13942 return "Unknown error";
13943 }
13944 if ("message" in data) {
13945 const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
13946 return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v2) => JSON.stringify(v2)).join(", ")}${suffix}` : `${data.message}${suffix}`;
13947 }
13948 return `Unknown error: ${JSON.stringify(data)}`;
13949}
13950function withDefaults2(oldEndpoint, newDefaults) {
13951 const endpoint2 = oldEndpoint.defaults(newDefaults);
13952 const newApi = function(route, parameters) {
13953 const endpointOptions = endpoint2.merge(route, parameters);
13954 if (!endpointOptions.request || !endpointOptions.request.hook) {
13955 return fetchWrapper(endpoint2.parse(endpointOptions));
13956 }
13957 const request2 = (route2, parameters2) => {
13958 return fetchWrapper(endpoint2.parse(endpoint2.merge(route2, parameters2)));
13959 };
13960 Object.assign(request2, {
13961 endpoint: endpoint2,
13962 defaults: withDefaults2.bind(null, endpoint2)
13963 });
13964 return endpointOptions.request.hook(request2, endpointOptions);
13965 };
13966 return Object.assign(newApi, {
13967 endpoint: endpoint2,
13968 defaults: withDefaults2.bind(null, endpoint2)
13969 });
13970}
13971var request = withDefaults2(endpoint, defaults_default);
13972
13973// node_modules/@octokit/graphql/dist-bundle/index.js
13974var VERSION3 = "0.0.0-development";
13975function _buildMessageForResponseErrors(data) {
13976 return `Request failed due to following response errors:
13977` + data.errors.map((e) => ` - ${e.message}`).join(`
13978`);
13979}
13980var GraphqlResponseError = class extends Error {
13981 constructor(request2, headers, response) {
13982 super(_buildMessageForResponseErrors(response));
13983 this.request = request2;
13984 this.headers = headers;
13985 this.response = response;
13986 this.errors = response.errors;
13987 this.data = response.data;
13988 if (Error.captureStackTrace) {
13989 Error.captureStackTrace(this, this.constructor);
13990 }
13991 }
13992 name = "GraphqlResponseError";
13993 errors;
13994 data;
13995};
13996var NON_VARIABLE_OPTIONS = [
13997 "method",
13998 "baseUrl",
13999 "url",
14000 "headers",
14001 "request",
14002 "query",
14003 "mediaType",
14004 "operationName"
14005];
14006var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
14007var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
14008function graphql(request2, query, options) {
14009 if (options) {
14010 if (typeof query === "string" && "query" in options) {
14011 return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
14012 }
14013 for (const key in options) {
14014 if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
14015 continue;
14016 return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`));
14017 }
14018 }
14019 const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
14020 const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
14021 if (NON_VARIABLE_OPTIONS.includes(key)) {
14022 result[key] = parsedOptions[key];
14023 return result;
14024 }
14025 if (!result.variables) {
14026 result.variables = {};
14027 }
14028 result.variables[key] = parsedOptions[key];
14029 return result;
14030 }, {});
14031 const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
14032 if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
14033 requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
14034 }
14035 return request2(requestOptions).then((response) => {
14036 if (response.data.errors) {
14037 const headers = {};
14038 for (const key of Object.keys(response.headers)) {
14039 headers[key] = response.headers[key];
14040 }
14041 throw new GraphqlResponseError(requestOptions, headers, response.data);
14042 }
14043 return response.data.data;
14044 });
14045}
14046function withDefaults3(request2, newDefaults) {
14047 const newRequest = request2.defaults(newDefaults);
14048 const newApi = (query, options) => {
14049 return graphql(newRequest, query, options);
14050 };
14051 return Object.assign(newApi, {
14052 defaults: withDefaults3.bind(null, newRequest),
14053 endpoint: newRequest.endpoint
14054 });
14055}
14056var graphql2 = withDefaults3(request, {
14057 headers: {
14058 "user-agent": `octokit-graphql.js/${VERSION3} ${getUserAgent()}`
14059 },
14060 method: "POST",
14061 url: "/graphql"
14062});
14063function withCustomRequest(customRequest) {
14064 return withDefaults3(customRequest, {
14065 method: "POST",
14066 url: "/graphql"
14067 });
14068}
14069
14070// node_modules/@octokit/auth-token/dist-bundle/index.js
14071var b64url = "(?:[a-zA-Z0-9_-]+)";
14072var sep = "\\.";
14073var jwtRE = new RegExp(`^${b64url}${sep}${b64url}${sep}${b64url}$`);
14074var isJWT = jwtRE.test.bind(jwtRE);
14075async function auth(token) {
14076 const isApp = isJWT(token);
14077 const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
14078 const isUserToServer = token.startsWith("ghu_");
14079 const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
14080 return {
14081 type: "token",
14082 token,
14083 tokenType
14084 };
14085}
14086function withAuthorizationPrefix(token) {
14087 if (token.split(/\./).length === 3) {
14088 return `bearer ${token}`;
14089 }
14090 return `token ${token}`;
14091}
14092async function hook(token, request2, route, parameters) {
14093 const endpoint2 = request2.endpoint.merge(route, parameters);
14094 endpoint2.headers.authorization = withAuthorizationPrefix(token);
14095 return request2(endpoint2);
14096}
14097var createTokenAuth = function createTokenAuth2(token) {
14098 if (!token) {
14099 throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
14100 }
14101 if (typeof token !== "string") {
14102 throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string");
14103 }
14104 token = token.replace(/^(token|bearer) +/i, "");
14105 return Object.assign(auth.bind(null, token), {
14106 hook: hook.bind(null, token)
14107 });
14108};
14109
14110// node_modules/@octokit/core/dist-src/version.js
14111var VERSION4 = "7.0.5";
14112
14113// node_modules/@octokit/core/dist-src/index.js
14114var noop = () => {};
14115var consoleWarn = console.warn.bind(console);
14116var consoleError = console.error.bind(console);
14117function createLogger(logger = {}) {
14118 if (typeof logger.debug !== "function") {
14119 logger.debug = noop;
14120 }
14121 if (typeof logger.info !== "function") {
14122 logger.info = noop;
14123 }
14124 if (typeof logger.warn !== "function") {
14125 logger.warn = consoleWarn;
14126 }
14127 if (typeof logger.error !== "function") {
14128 logger.error = consoleError;
14129 }
14130 return logger;
14131}
14132var userAgentTrail = `octokit-core.js/${VERSION4} ${getUserAgent()}`;
14133
14134class Octokit {
14135 static VERSION = VERSION4;
14136 static defaults(defaults) {
14137 const OctokitWithDefaults = class extends this {
14138 constructor(...args) {
14139 const options = args[0] || {};
14140 if (typeof defaults === "function") {
14141 super(defaults(options));
14142 return;
14143 }
14144 super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? {
14145 userAgent: `${options.userAgent} ${defaults.userAgent}`
14146 } : null));
14147 }
14148 };
14149 return OctokitWithDefaults;
14150 }
14151 static plugins = [];
14152 static plugin(...newPlugins) {
14153 const currentPlugins = this.plugins;
14154 const NewOctokit = class extends this {
14155 static plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin)));
14156 };
14157 return NewOctokit;
14158 }
14159 constructor(options = {}) {
14160 const hook2 = new before_after_hook_default.Collection;
14161 const requestDefaults = {
14162 baseUrl: request.endpoint.DEFAULTS.baseUrl,
14163 headers: {},
14164 request: Object.assign({}, options.request, {
14165 hook: hook2.bind(null, "request")
14166 }),
14167 mediaType: {
14168 previews: [],
14169 format: ""
14170 }
14171 };
14172 requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
14173 if (options.baseUrl) {
14174 requestDefaults.baseUrl = options.baseUrl;
14175 }
14176 if (options.previews) {
14177 requestDefaults.mediaType.previews = options.previews;
14178 }
14179 if (options.timeZone) {
14180 requestDefaults.headers["time-zone"] = options.timeZone;
14181 }
14182 this.request = request.defaults(requestDefaults);
14183 this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
14184 this.log = createLogger(options.log);
14185 this.hook = hook2;
14186 if (!options.authStrategy) {
14187 if (!options.auth) {
14188 this.auth = async () => ({
14189 type: "unauthenticated"
14190 });
14191 } else {
14192 const auth2 = createTokenAuth(options.auth);
14193 hook2.wrap("request", auth2.hook);
14194 this.auth = auth2;
14195 }
14196 } else {
14197 const { authStrategy, ...otherOptions } = options;
14198 const auth2 = authStrategy(Object.assign({
14199 request: this.request,
14200 log: this.log,
14201 octokit: this,
14202 octokitOptions: otherOptions
14203 }, options.auth));
14204 hook2.wrap("request", auth2.hook);
14205 this.auth = auth2;
14206 }
14207 const classConstructor = this.constructor;
14208 for (let i = 0;i < classConstructor.plugins.length; ++i) {
14209 Object.assign(this, classConstructor.plugins[i](this, options));
14210 }
14211 }
14212 request;
14213 graphql;
14214 log;
14215 hook;
14216 auth;
14217}
14218
14219// node_modules/@octokit/plugin-request-log/dist-src/version.js
14220var VERSION5 = "6.0.0";
14221
14222// node_modules/@octokit/plugin-request-log/dist-src/index.js
14223function requestLog(octokit) {
14224 octokit.hook.wrap("request", (request2, options) => {
14225 octokit.log.debug("request", options);
14226 const start = Date.now();
14227 const requestOptions = octokit.request.endpoint.parse(options);
14228 const path = requestOptions.url.replace(options.baseUrl, "");
14229 return request2(options).then((response) => {
14230 const requestId = response.headers["x-github-request-id"];
14231 octokit.log.info(`${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms`);
14232 return response;
14233 }).catch((error) => {
14234 const requestId = error.response?.headers["x-github-request-id"] || "UNKNOWN";
14235 octokit.log.error(`${requestOptions.method} ${path} - ${error.status} with id ${requestId} in ${Date.now() - start}ms`);
14236 throw error;
14237 });
14238 });
14239}
14240requestLog.VERSION = VERSION5;
14241
14242// node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.js
14243var VERSION6 = "0.0.0-development";
14244function normalizePaginatedListResponse(response) {
14245 if (!response.data) {
14246 return {
14247 ...response,
14248 data: []
14249 };
14250 }
14251 const responseNeedsNormalization = (("total_count" in response.data) || ("total_commits" in response.data)) && !("url" in response.data);
14252 if (!responseNeedsNormalization)
14253 return response;
14254 const incompleteResults = response.data.incomplete_results;
14255 const repositorySelection = response.data.repository_selection;
14256 const totalCount = response.data.total_count;
14257 const totalCommits = response.data.total_commits;
14258 delete response.data.incomplete_results;
14259 delete response.data.repository_selection;
14260 delete response.data.total_count;
14261 delete response.data.total_commits;
14262 const namespaceKey = Object.keys(response.data)[0];
14263 const data = response.data[namespaceKey];
14264 response.data = data;
14265 if (typeof incompleteResults !== "undefined") {
14266 response.data.incomplete_results = incompleteResults;
14267 }
14268 if (typeof repositorySelection !== "undefined") {
14269 response.data.repository_selection = repositorySelection;
14270 }
14271 response.data.total_count = totalCount;
14272 response.data.total_commits = totalCommits;
14273 return response;
14274}
14275function iterator(octokit, route, parameters) {
14276 const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
14277 const requestMethod = typeof route === "function" ? route : octokit.request;
14278 const method = options.method;
14279 const headers = options.headers;
14280 let url = options.url;
14281 return {
14282 [Symbol.asyncIterator]: () => ({
14283 async next() {
14284 if (!url)
14285 return { done: true };
14286 try {
14287 const response = await requestMethod({ method, url, headers });
14288 const normalizedResponse = normalizePaginatedListResponse(response);
14289 url = ((normalizedResponse.headers.link || "").match(/<([^<>]+)>;\s*rel="next"/) || [])[1];
14290 if (!url && "total_commits" in normalizedResponse.data) {
14291 const parsedUrl = new URL(normalizedResponse.url);
14292 const params = parsedUrl.searchParams;
14293 const page = parseInt(params.get("page") || "1", 10);
14294 const per_page = parseInt(params.get("per_page") || "250", 10);
14295 if (page * per_page < normalizedResponse.data.total_commits) {
14296 params.set("page", String(page + 1));
14297 url = parsedUrl.toString();
14298 }
14299 }
14300 return { value: normalizedResponse };
14301 } catch (error) {
14302 if (error.status !== 409)
14303 throw error;
14304 url = "";
14305 return {
14306 value: {
14307 status: 200,
14308 headers: {},
14309 data: []
14310 }
14311 };
14312 }
14313 }
14314 })
14315 };
14316}
14317function paginate(octokit, route, parameters, mapFn) {
14318 if (typeof parameters === "function") {
14319 mapFn = parameters;
14320 parameters = undefined;
14321 }
14322 return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn);
14323}
14324function gather(octokit, results, iterator2, mapFn) {
14325 return iterator2.next().then((result) => {
14326 if (result.done) {
14327 return results;
14328 }
14329 let earlyExit = false;
14330 function done() {
14331 earlyExit = true;
14332 }
14333 results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data);
14334 if (earlyExit) {
14335 return results;
14336 }
14337 return gather(octokit, results, iterator2, mapFn);
14338 });
14339}
14340var composePaginateRest = Object.assign(paginate, {
14341 iterator
14342});
14343function paginateRest(octokit) {
14344 return {
14345 paginate: Object.assign(paginate.bind(null, octokit), {
14346 iterator: iterator.bind(null, octokit)
14347 })
14348 };
14349}
14350paginateRest.VERSION = VERSION6;
14351
14352// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
14353var VERSION7 = "16.1.0";
14354
14355// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js
14356var Endpoints = {
14357 actions: {
14358 addCustomLabelsToSelfHostedRunnerForOrg: [
14359 "POST /orgs/{org}/actions/runners/{runner_id}/labels"
14360 ],
14361 addCustomLabelsToSelfHostedRunnerForRepo: [
14362 "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
14363 ],
14364 addRepoAccessToSelfHostedRunnerGroupInOrg: [
14365 "PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}"
14366 ],
14367 addSelectedRepoToOrgSecret: [
14368 "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
14369 ],
14370 addSelectedRepoToOrgVariable: [
14371 "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
14372 ],
14373 approveWorkflowRun: [
14374 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"
14375 ],
14376 cancelWorkflowRun: [
14377 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"
14378 ],
14379 createEnvironmentVariable: [
14380 "POST /repos/{owner}/{repo}/environments/{environment_name}/variables"
14381 ],
14382 createHostedRunnerForOrg: ["POST /orgs/{org}/actions/hosted-runners"],
14383 createOrUpdateEnvironmentSecret: [
14384 "PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
14385 ],
14386 createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"],
14387 createOrUpdateRepoSecret: [
14388 "PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"
14389 ],
14390 createOrgVariable: ["POST /orgs/{org}/actions/variables"],
14391 createRegistrationTokenForOrg: [
14392 "POST /orgs/{org}/actions/runners/registration-token"
14393 ],
14394 createRegistrationTokenForRepo: [
14395 "POST /repos/{owner}/{repo}/actions/runners/registration-token"
14396 ],
14397 createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"],
14398 createRemoveTokenForRepo: [
14399 "POST /repos/{owner}/{repo}/actions/runners/remove-token"
14400 ],
14401 createRepoVariable: ["POST /repos/{owner}/{repo}/actions/variables"],
14402 createWorkflowDispatch: [
14403 "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"
14404 ],
14405 deleteActionsCacheById: [
14406 "DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"
14407 ],
14408 deleteActionsCacheByKey: [
14409 "DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"
14410 ],
14411 deleteArtifact: [
14412 "DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"
14413 ],
14414 deleteEnvironmentSecret: [
14415 "DELETE /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
14416 ],
14417 deleteEnvironmentVariable: [
14418 "DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
14419 ],
14420 deleteHostedRunnerForOrg: [
14421 "DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
14422 ],
14423 deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"],
14424 deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"],
14425 deleteRepoSecret: [
14426 "DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"
14427 ],
14428 deleteRepoVariable: [
14429 "DELETE /repos/{owner}/{repo}/actions/variables/{name}"
14430 ],
14431 deleteSelfHostedRunnerFromOrg: [
14432 "DELETE /orgs/{org}/actions/runners/{runner_id}"
14433 ],
14434 deleteSelfHostedRunnerFromRepo: [
14435 "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"
14436 ],
14437 deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"],
14438 deleteWorkflowRunLogs: [
14439 "DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
14440 ],
14441 disableSelectedRepositoryGithubActionsOrganization: [
14442 "DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"
14443 ],
14444 disableWorkflow: [
14445 "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"
14446 ],
14447 downloadArtifact: [
14448 "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"
14449 ],
14450 downloadJobLogsForWorkflowRun: [
14451 "GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"
14452 ],
14453 downloadWorkflowRunAttemptLogs: [
14454 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"
14455 ],
14456 downloadWorkflowRunLogs: [
14457 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
14458 ],
14459 enableSelectedRepositoryGithubActionsOrganization: [
14460 "PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"
14461 ],
14462 enableWorkflow: [
14463 "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"
14464 ],
14465 forceCancelWorkflowRun: [
14466 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
14467 ],
14468 generateRunnerJitconfigForOrg: [
14469 "POST /orgs/{org}/actions/runners/generate-jitconfig"
14470 ],
14471 generateRunnerJitconfigForRepo: [
14472 "POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig"
14473 ],
14474 getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"],
14475 getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"],
14476 getActionsCacheUsageByRepoForOrg: [
14477 "GET /orgs/{org}/actions/cache/usage-by-repository"
14478 ],
14479 getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"],
14480 getAllowedActionsOrganization: [
14481 "GET /orgs/{org}/actions/permissions/selected-actions"
14482 ],
14483 getAllowedActionsRepository: [
14484 "GET /repos/{owner}/{repo}/actions/permissions/selected-actions"
14485 ],
14486 getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"],
14487 getCustomOidcSubClaimForRepo: [
14488 "GET /repos/{owner}/{repo}/actions/oidc/customization/sub"
14489 ],
14490 getEnvironmentPublicKey: [
14491 "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key"
14492 ],
14493 getEnvironmentSecret: [
14494 "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
14495 ],
14496 getEnvironmentVariable: [
14497 "GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
14498 ],
14499 getGithubActionsDefaultWorkflowPermissionsOrganization: [
14500 "GET /orgs/{org}/actions/permissions/workflow"
14501 ],
14502 getGithubActionsDefaultWorkflowPermissionsRepository: [
14503 "GET /repos/{owner}/{repo}/actions/permissions/workflow"
14504 ],
14505 getGithubActionsPermissionsOrganization: [
14506 "GET /orgs/{org}/actions/permissions"
14507 ],
14508 getGithubActionsPermissionsRepository: [
14509 "GET /repos/{owner}/{repo}/actions/permissions"
14510 ],
14511 getHostedRunnerForOrg: [
14512 "GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
14513 ],
14514 getHostedRunnersGithubOwnedImagesForOrg: [
14515 "GET /orgs/{org}/actions/hosted-runners/images/github-owned"
14516 ],
14517 getHostedRunnersLimitsForOrg: [
14518 "GET /orgs/{org}/actions/hosted-runners/limits"
14519 ],
14520 getHostedRunnersMachineSpecsForOrg: [
14521 "GET /orgs/{org}/actions/hosted-runners/machine-sizes"
14522 ],
14523 getHostedRunnersPartnerImagesForOrg: [
14524 "GET /orgs/{org}/actions/hosted-runners/images/partner"
14525 ],
14526 getHostedRunnersPlatformsForOrg: [
14527 "GET /orgs/{org}/actions/hosted-runners/platforms"
14528 ],
14529 getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"],
14530 getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"],
14531 getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"],
14532 getOrgVariable: ["GET /orgs/{org}/actions/variables/{name}"],
14533 getPendingDeploymentsForRun: [
14534 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
14535 ],
14536 getRepoPermissions: [
14537 "GET /repos/{owner}/{repo}/actions/permissions",
14538 {},
14539 { renamed: ["actions", "getGithubActionsPermissionsRepository"] }
14540 ],
14541 getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"],
14542 getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"],
14543 getRepoVariable: ["GET /repos/{owner}/{repo}/actions/variables/{name}"],
14544 getReviewsForRun: [
14545 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"
14546 ],
14547 getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"],
14548 getSelfHostedRunnerForRepo: [
14549 "GET /repos/{owner}/{repo}/actions/runners/{runner_id}"
14550 ],
14551 getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"],
14552 getWorkflowAccessToRepository: [
14553 "GET /repos/{owner}/{repo}/actions/permissions/access"
14554 ],
14555 getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"],
14556 getWorkflowRunAttempt: [
14557 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"
14558 ],
14559 getWorkflowRunUsage: [
14560 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"
14561 ],
14562 getWorkflowUsage: [
14563 "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"
14564 ],
14565 listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"],
14566 listEnvironmentSecrets: [
14567 "GET /repos/{owner}/{repo}/environments/{environment_name}/secrets"
14568 ],
14569 listEnvironmentVariables: [
14570 "GET /repos/{owner}/{repo}/environments/{environment_name}/variables"
14571 ],
14572 listGithubHostedRunnersInGroupForOrg: [
14573 "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners"
14574 ],
14575 listHostedRunnersForOrg: ["GET /orgs/{org}/actions/hosted-runners"],
14576 listJobsForWorkflowRun: [
14577 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
14578 ],
14579 listJobsForWorkflowRunAttempt: [
14580 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"
14581 ],
14582 listLabelsForSelfHostedRunnerForOrg: [
14583 "GET /orgs/{org}/actions/runners/{runner_id}/labels"
14584 ],
14585 listLabelsForSelfHostedRunnerForRepo: [
14586 "GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
14587 ],
14588 listOrgSecrets: ["GET /orgs/{org}/actions/secrets"],
14589 listOrgVariables: ["GET /orgs/{org}/actions/variables"],
14590 listRepoOrganizationSecrets: [
14591 "GET /repos/{owner}/{repo}/actions/organization-secrets"
14592 ],
14593 listRepoOrganizationVariables: [
14594 "GET /repos/{owner}/{repo}/actions/organization-variables"
14595 ],
14596 listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"],
14597 listRepoVariables: ["GET /repos/{owner}/{repo}/actions/variables"],
14598 listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"],
14599 listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"],
14600 listRunnerApplicationsForRepo: [
14601 "GET /repos/{owner}/{repo}/actions/runners/downloads"
14602 ],
14603 listSelectedReposForOrgSecret: [
14604 "GET /orgs/{org}/actions/secrets/{secret_name}/repositories"
14605 ],
14606 listSelectedReposForOrgVariable: [
14607 "GET /orgs/{org}/actions/variables/{name}/repositories"
14608 ],
14609 listSelectedRepositoriesEnabledGithubActionsOrganization: [
14610 "GET /orgs/{org}/actions/permissions/repositories"
14611 ],
14612 listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"],
14613 listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"],
14614 listWorkflowRunArtifacts: [
14615 "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"
14616 ],
14617 listWorkflowRuns: [
14618 "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
14619 ],
14620 listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"],
14621 reRunJobForWorkflowRun: [
14622 "POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"
14623 ],
14624 reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"],
14625 reRunWorkflowFailedJobs: [
14626 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"
14627 ],
14628 removeAllCustomLabelsFromSelfHostedRunnerForOrg: [
14629 "DELETE /orgs/{org}/actions/runners/{runner_id}/labels"
14630 ],
14631 removeAllCustomLabelsFromSelfHostedRunnerForRepo: [
14632 "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
14633 ],
14634 removeCustomLabelFromSelfHostedRunnerForOrg: [
14635 "DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"
14636 ],
14637 removeCustomLabelFromSelfHostedRunnerForRepo: [
14638 "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"
14639 ],
14640 removeSelectedRepoFromOrgSecret: [
14641 "DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
14642 ],
14643 removeSelectedRepoFromOrgVariable: [
14644 "DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
14645 ],
14646 reviewCustomGatesForRun: [
14647 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule"
14648 ],
14649 reviewPendingDeploymentsForRun: [
14650 "POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
14651 ],
14652 setAllowedActionsOrganization: [
14653 "PUT /orgs/{org}/actions/permissions/selected-actions"
14654 ],
14655 setAllowedActionsRepository: [
14656 "PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"
14657 ],
14658 setCustomLabelsForSelfHostedRunnerForOrg: [
14659 "PUT /orgs/{org}/actions/runners/{runner_id}/labels"
14660 ],
14661 setCustomLabelsForSelfHostedRunnerForRepo: [
14662 "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
14663 ],
14664 setCustomOidcSubClaimForRepo: [
14665 "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub"
14666 ],
14667 setGithubActionsDefaultWorkflowPermissionsOrganization: [
14668 "PUT /orgs/{org}/actions/permissions/workflow"
14669 ],
14670 setGithubActionsDefaultWorkflowPermissionsRepository: [
14671 "PUT /repos/{owner}/{repo}/actions/permissions/workflow"
14672 ],
14673 setGithubActionsPermissionsOrganization: [
14674 "PUT /orgs/{org}/actions/permissions"
14675 ],
14676 setGithubActionsPermissionsRepository: [
14677 "PUT /repos/{owner}/{repo}/actions/permissions"
14678 ],
14679 setSelectedReposForOrgSecret: [
14680 "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"
14681 ],
14682 setSelectedReposForOrgVariable: [
14683 "PUT /orgs/{org}/actions/variables/{name}/repositories"
14684 ],
14685 setSelectedRepositoriesEnabledGithubActionsOrganization: [
14686 "PUT /orgs/{org}/actions/permissions/repositories"
14687 ],
14688 setWorkflowAccessToRepository: [
14689 "PUT /repos/{owner}/{repo}/actions/permissions/access"
14690 ],
14691 updateEnvironmentVariable: [
14692 "PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
14693 ],
14694 updateHostedRunnerForOrg: [
14695 "PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
14696 ],
14697 updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"],
14698 updateRepoVariable: [
14699 "PATCH /repos/{owner}/{repo}/actions/variables/{name}"
14700 ]
14701 },
14702 activity: {
14703 checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"],
14704 deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"],
14705 deleteThreadSubscription: [
14706 "DELETE /notifications/threads/{thread_id}/subscription"
14707 ],
14708 getFeeds: ["GET /feeds"],
14709 getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"],
14710 getThread: ["GET /notifications/threads/{thread_id}"],
14711 getThreadSubscriptionForAuthenticatedUser: [
14712 "GET /notifications/threads/{thread_id}/subscription"
14713 ],
14714 listEventsForAuthenticatedUser: ["GET /users/{username}/events"],
14715 listNotificationsForAuthenticatedUser: ["GET /notifications"],
14716 listOrgEventsForAuthenticatedUser: [
14717 "GET /users/{username}/events/orgs/{org}"
14718 ],
14719 listPublicEvents: ["GET /events"],
14720 listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"],
14721 listPublicEventsForUser: ["GET /users/{username}/events/public"],
14722 listPublicOrgEvents: ["GET /orgs/{org}/events"],
14723 listReceivedEventsForUser: ["GET /users/{username}/received_events"],
14724 listReceivedPublicEventsForUser: [
14725 "GET /users/{username}/received_events/public"
14726 ],
14727 listRepoEvents: ["GET /repos/{owner}/{repo}/events"],
14728 listRepoNotificationsForAuthenticatedUser: [
14729 "GET /repos/{owner}/{repo}/notifications"
14730 ],
14731 listReposStarredByAuthenticatedUser: ["GET /user/starred"],
14732 listReposStarredByUser: ["GET /users/{username}/starred"],
14733 listReposWatchedByUser: ["GET /users/{username}/subscriptions"],
14734 listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"],
14735 listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"],
14736 listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"],
14737 markNotificationsAsRead: ["PUT /notifications"],
14738 markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"],
14739 markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"],
14740 markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"],
14741 setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"],
14742 setThreadSubscription: [
14743 "PUT /notifications/threads/{thread_id}/subscription"
14744 ],
14745 starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"],
14746 unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
14747 },
14748 apps: {
14749 addRepoToInstallation: [
14750 "PUT /user/installations/{installation_id}/repositories/{repository_id}",
14751 {},
14752 { renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] }
14753 ],
14754 addRepoToInstallationForAuthenticatedUser: [
14755 "PUT /user/installations/{installation_id}/repositories/{repository_id}"
14756 ],
14757 checkToken: ["POST /applications/{client_id}/token"],
14758 createFromManifest: ["POST /app-manifests/{code}/conversions"],
14759 createInstallationAccessToken: [
14760 "POST /app/installations/{installation_id}/access_tokens"
14761 ],
14762 deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
14763 deleteInstallation: ["DELETE /app/installations/{installation_id}"],
14764 deleteToken: ["DELETE /applications/{client_id}/token"],
14765 getAuthenticated: ["GET /app"],
14766 getBySlug: ["GET /apps/{app_slug}"],
14767 getInstallation: ["GET /app/installations/{installation_id}"],
14768 getOrgInstallation: ["GET /orgs/{org}/installation"],
14769 getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
14770 getSubscriptionPlanForAccount: [
14771 "GET /marketplace_listing/accounts/{account_id}"
14772 ],
14773 getSubscriptionPlanForAccountStubbed: [
14774 "GET /marketplace_listing/stubbed/accounts/{account_id}"
14775 ],
14776 getUserInstallation: ["GET /users/{username}/installation"],
14777 getWebhookConfigForApp: ["GET /app/hook/config"],
14778 getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"],
14779 listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
14780 listAccountsForPlanStubbed: [
14781 "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"
14782 ],
14783 listInstallationReposForAuthenticatedUser: [
14784 "GET /user/installations/{installation_id}/repositories"
14785 ],
14786 listInstallationRequestsForAuthenticatedApp: [
14787 "GET /app/installation-requests"
14788 ],
14789 listInstallations: ["GET /app/installations"],
14790 listInstallationsForAuthenticatedUser: ["GET /user/installations"],
14791 listPlans: ["GET /marketplace_listing/plans"],
14792 listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
14793 listReposAccessibleToInstallation: ["GET /installation/repositories"],
14794 listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
14795 listSubscriptionsForAuthenticatedUserStubbed: [
14796 "GET /user/marketplace_purchases/stubbed"
14797 ],
14798 listWebhookDeliveries: ["GET /app/hook/deliveries"],
14799 redeliverWebhookDelivery: [
14800 "POST /app/hook/deliveries/{delivery_id}/attempts"
14801 ],
14802 removeRepoFromInstallation: [
14803 "DELETE /user/installations/{installation_id}/repositories/{repository_id}",
14804 {},
14805 { renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] }
14806 ],
14807 removeRepoFromInstallationForAuthenticatedUser: [
14808 "DELETE /user/installations/{installation_id}/repositories/{repository_id}"
14809 ],
14810 resetToken: ["PATCH /applications/{client_id}/token"],
14811 revokeInstallationAccessToken: ["DELETE /installation/token"],
14812 scopeToken: ["POST /applications/{client_id}/token/scoped"],
14813 suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
14814 unsuspendInstallation: [
14815 "DELETE /app/installations/{installation_id}/suspended"
14816 ],
14817 updateWebhookConfigForApp: ["PATCH /app/hook/config"]
14818 },
14819 billing: {
14820 getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"],
14821 getGithubActionsBillingUser: [
14822 "GET /users/{username}/settings/billing/actions"
14823 ],
14824 getGithubBillingUsageReportOrg: [
14825 "GET /organizations/{org}/settings/billing/usage"
14826 ],
14827 getGithubBillingUsageReportUser: [
14828 "GET /users/{username}/settings/billing/usage"
14829 ],
14830 getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"],
14831 getGithubPackagesBillingUser: [
14832 "GET /users/{username}/settings/billing/packages"
14833 ],
14834 getSharedStorageBillingOrg: [
14835 "GET /orgs/{org}/settings/billing/shared-storage"
14836 ],
14837 getSharedStorageBillingUser: [
14838 "GET /users/{username}/settings/billing/shared-storage"
14839 ]
14840 },
14841 campaigns: {
14842 createCampaign: ["POST /orgs/{org}/campaigns"],
14843 deleteCampaign: ["DELETE /orgs/{org}/campaigns/{campaign_number}"],
14844 getCampaignSummary: ["GET /orgs/{org}/campaigns/{campaign_number}"],
14845 listOrgCampaigns: ["GET /orgs/{org}/campaigns"],
14846 updateCampaign: ["PATCH /orgs/{org}/campaigns/{campaign_number}"]
14847 },
14848 checks: {
14849 create: ["POST /repos/{owner}/{repo}/check-runs"],
14850 createSuite: ["POST /repos/{owner}/{repo}/check-suites"],
14851 get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"],
14852 getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"],
14853 listAnnotations: [
14854 "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"
14855 ],
14856 listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"],
14857 listForSuite: [
14858 "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"
14859 ],
14860 listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"],
14861 rerequestRun: [
14862 "POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"
14863 ],
14864 rerequestSuite: [
14865 "POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"
14866 ],
14867 setSuitesPreferences: [
14868 "PATCH /repos/{owner}/{repo}/check-suites/preferences"
14869 ],
14870 update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"]
14871 },
14872 codeScanning: {
14873 commitAutofix: [
14874 "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix/commits"
14875 ],
14876 createAutofix: [
14877 "POST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
14878 ],
14879 createVariantAnalysis: [
14880 "POST /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses"
14881 ],
14882 deleteAnalysis: [
14883 "DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"
14884 ],
14885 deleteCodeqlDatabase: [
14886 "DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
14887 ],
14888 getAlert: [
14889 "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}",
14890 {},
14891 { renamedParameters: { alert_id: "alert_number" } }
14892 ],
14893 getAnalysis: [
14894 "GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"
14895 ],
14896 getAutofix: [
14897 "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix"
14898 ],
14899 getCodeqlDatabase: [
14900 "GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
14901 ],
14902 getDefaultSetup: ["GET /repos/{owner}/{repo}/code-scanning/default-setup"],
14903 getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
14904 getVariantAnalysis: [
14905 "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}"
14906 ],
14907 getVariantAnalysisRepoTask: [
14908 "GET /repos/{owner}/{repo}/code-scanning/codeql/variant-analyses/{codeql_variant_analysis_id}/repos/{repo_owner}/{repo_name}"
14909 ],
14910 listAlertInstances: [
14911 "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"
14912 ],
14913 listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
14914 listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
14915 listAlertsInstances: [
14916 "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
14917 {},
14918 { renamed: ["codeScanning", "listAlertInstances"] }
14919 ],
14920 listCodeqlDatabases: [
14921 "GET /repos/{owner}/{repo}/code-scanning/codeql/databases"
14922 ],
14923 listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
14924 updateAlert: [
14925 "PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"
14926 ],
14927 updateDefaultSetup: [
14928 "PATCH /repos/{owner}/{repo}/code-scanning/default-setup"
14929 ],
14930 uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
14931 },
14932 codeSecurity: {
14933 attachConfiguration: [
14934 "POST /orgs/{org}/code-security/configurations/{configuration_id}/attach"
14935 ],
14936 attachEnterpriseConfiguration: [
14937 "POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach"
14938 ],
14939 createConfiguration: ["POST /orgs/{org}/code-security/configurations"],
14940 createConfigurationForEnterprise: [
14941 "POST /enterprises/{enterprise}/code-security/configurations"
14942 ],
14943 deleteConfiguration: [
14944 "DELETE /orgs/{org}/code-security/configurations/{configuration_id}"
14945 ],
14946 deleteConfigurationForEnterprise: [
14947 "DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
14948 ],
14949 detachConfiguration: [
14950 "DELETE /orgs/{org}/code-security/configurations/detach"
14951 ],
14952 getConfiguration: [
14953 "GET /orgs/{org}/code-security/configurations/{configuration_id}"
14954 ],
14955 getConfigurationForRepository: [
14956 "GET /repos/{owner}/{repo}/code-security-configuration"
14957 ],
14958 getConfigurationsForEnterprise: [
14959 "GET /enterprises/{enterprise}/code-security/configurations"
14960 ],
14961 getConfigurationsForOrg: ["GET /orgs/{org}/code-security/configurations"],
14962 getDefaultConfigurations: [
14963 "GET /orgs/{org}/code-security/configurations/defaults"
14964 ],
14965 getDefaultConfigurationsForEnterprise: [
14966 "GET /enterprises/{enterprise}/code-security/configurations/defaults"
14967 ],
14968 getRepositoriesForConfiguration: [
14969 "GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories"
14970 ],
14971 getRepositoriesForEnterpriseConfiguration: [
14972 "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories"
14973 ],
14974 getSingleConfigurationForEnterprise: [
14975 "GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
14976 ],
14977 setConfigurationAsDefault: [
14978 "PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults"
14979 ],
14980 setConfigurationAsDefaultForEnterprise: [
14981 "PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults"
14982 ],
14983 updateConfiguration: [
14984 "PATCH /orgs/{org}/code-security/configurations/{configuration_id}"
14985 ],
14986 updateEnterpriseConfiguration: [
14987 "PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}"
14988 ]
14989 },
14990 codesOfConduct: {
14991 getAllCodesOfConduct: ["GET /codes_of_conduct"],
14992 getConductCode: ["GET /codes_of_conduct/{key}"]
14993 },
14994 codespaces: {
14995 addRepositoryForSecretForAuthenticatedUser: [
14996 "PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
14997 ],
14998 addSelectedRepoToOrgSecret: [
14999 "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
15000 ],
15001 checkPermissionsForDevcontainer: [
15002 "GET /repos/{owner}/{repo}/codespaces/permissions_check"
15003 ],
15004 codespaceMachinesForAuthenticatedUser: [
15005 "GET /user/codespaces/{codespace_name}/machines"
15006 ],
15007 createForAuthenticatedUser: ["POST /user/codespaces"],
15008 createOrUpdateOrgSecret: [
15009 "PUT /orgs/{org}/codespaces/secrets/{secret_name}"
15010 ],
15011 createOrUpdateRepoSecret: [
15012 "PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
15013 ],
15014 createOrUpdateSecretForAuthenticatedUser: [
15015 "PUT /user/codespaces/secrets/{secret_name}"
15016 ],
15017 createWithPrForAuthenticatedUser: [
15018 "POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"
15019 ],
15020 createWithRepoForAuthenticatedUser: [
15021 "POST /repos/{owner}/{repo}/codespaces"
15022 ],
15023 deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"],
15024 deleteFromOrganization: [
15025 "DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"
15026 ],
15027 deleteOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}"],
15028 deleteRepoSecret: [
15029 "DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
15030 ],
15031 deleteSecretForAuthenticatedUser: [
15032 "DELETE /user/codespaces/secrets/{secret_name}"
15033 ],
15034 exportForAuthenticatedUser: [
15035 "POST /user/codespaces/{codespace_name}/exports"
15036 ],
15037 getCodespacesForUserInOrg: [
15038 "GET /orgs/{org}/members/{username}/codespaces"
15039 ],
15040 getExportDetailsForAuthenticatedUser: [
15041 "GET /user/codespaces/{codespace_name}/exports/{export_id}"
15042 ],
15043 getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"],
15044 getOrgPublicKey: ["GET /orgs/{org}/codespaces/secrets/public-key"],
15045 getOrgSecret: ["GET /orgs/{org}/codespaces/secrets/{secret_name}"],
15046 getPublicKeyForAuthenticatedUser: [
15047 "GET /user/codespaces/secrets/public-key"
15048 ],
15049 getRepoPublicKey: [
15050 "GET /repos/{owner}/{repo}/codespaces/secrets/public-key"
15051 ],
15052 getRepoSecret: [
15053 "GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
15054 ],
15055 getSecretForAuthenticatedUser: [
15056 "GET /user/codespaces/secrets/{secret_name}"
15057 ],
15058 listDevcontainersInRepositoryForAuthenticatedUser: [
15059 "GET /repos/{owner}/{repo}/codespaces/devcontainers"
15060 ],
15061 listForAuthenticatedUser: ["GET /user/codespaces"],
15062 listInOrganization: [
15063 "GET /orgs/{org}/codespaces",
15064 {},
15065 { renamedParameters: { org_id: "org" } }
15066 ],
15067 listInRepositoryForAuthenticatedUser: [
15068 "GET /repos/{owner}/{repo}/codespaces"
15069 ],
15070 listOrgSecrets: ["GET /orgs/{org}/codespaces/secrets"],
15071 listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"],
15072 listRepositoriesForSecretForAuthenticatedUser: [
15073 "GET /user/codespaces/secrets/{secret_name}/repositories"
15074 ],
15075 listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"],
15076 listSelectedReposForOrgSecret: [
15077 "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
15078 ],
15079 preFlightWithRepoForAuthenticatedUser: [
15080 "GET /repos/{owner}/{repo}/codespaces/new"
15081 ],
15082 publishForAuthenticatedUser: [
15083 "POST /user/codespaces/{codespace_name}/publish"
15084 ],
15085 removeRepositoryForSecretForAuthenticatedUser: [
15086 "DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
15087 ],
15088 removeSelectedRepoFromOrgSecret: [
15089 "DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
15090 ],
15091 repoMachinesForAuthenticatedUser: [
15092 "GET /repos/{owner}/{repo}/codespaces/machines"
15093 ],
15094 setRepositoriesForSecretForAuthenticatedUser: [
15095 "PUT /user/codespaces/secrets/{secret_name}/repositories"
15096 ],
15097 setSelectedReposForOrgSecret: [
15098 "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
15099 ],
15100 startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"],
15101 stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"],
15102 stopInOrganization: [
15103 "POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"
15104 ],
15105 updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"]
15106 },
15107 copilot: {
15108 addCopilotSeatsForTeams: [
15109 "POST /orgs/{org}/copilot/billing/selected_teams"
15110 ],
15111 addCopilotSeatsForUsers: [
15112 "POST /orgs/{org}/copilot/billing/selected_users"
15113 ],
15114 cancelCopilotSeatAssignmentForTeams: [
15115 "DELETE /orgs/{org}/copilot/billing/selected_teams"
15116 ],
15117 cancelCopilotSeatAssignmentForUsers: [
15118 "DELETE /orgs/{org}/copilot/billing/selected_users"
15119 ],
15120 copilotMetricsForOrganization: ["GET /orgs/{org}/copilot/metrics"],
15121 copilotMetricsForTeam: ["GET /orgs/{org}/team/{team_slug}/copilot/metrics"],
15122 getCopilotOrganizationDetails: ["GET /orgs/{org}/copilot/billing"],
15123 getCopilotSeatDetailsForUser: [
15124 "GET /orgs/{org}/members/{username}/copilot"
15125 ],
15126 listCopilotSeats: ["GET /orgs/{org}/copilot/billing/seats"]
15127 },
15128 credentials: { revoke: ["POST /credentials/revoke"] },
15129 dependabot: {
15130 addSelectedRepoToOrgSecret: [
15131 "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
15132 ],
15133 createOrUpdateOrgSecret: [
15134 "PUT /orgs/{org}/dependabot/secrets/{secret_name}"
15135 ],
15136 createOrUpdateRepoSecret: [
15137 "PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
15138 ],
15139 deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"],
15140 deleteRepoSecret: [
15141 "DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
15142 ],
15143 getAlert: ["GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"],
15144 getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"],
15145 getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"],
15146 getRepoPublicKey: [
15147 "GET /repos/{owner}/{repo}/dependabot/secrets/public-key"
15148 ],
15149 getRepoSecret: [
15150 "GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
15151 ],
15152 listAlertsForEnterprise: [
15153 "GET /enterprises/{enterprise}/dependabot/alerts"
15154 ],
15155 listAlertsForOrg: ["GET /orgs/{org}/dependabot/alerts"],
15156 listAlertsForRepo: ["GET /repos/{owner}/{repo}/dependabot/alerts"],
15157 listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"],
15158 listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"],
15159 listSelectedReposForOrgSecret: [
15160 "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
15161 ],
15162 removeSelectedRepoFromOrgSecret: [
15163 "DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
15164 ],
15165 repositoryAccessForOrg: [
15166 "GET /organizations/{org}/dependabot/repository-access"
15167 ],
15168 setRepositoryAccessDefaultLevel: [
15169 "PUT /organizations/{org}/dependabot/repository-access/default-level"
15170 ],
15171 setSelectedReposForOrgSecret: [
15172 "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
15173 ],
15174 updateAlert: [
15175 "PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"
15176 ],
15177 updateRepositoryAccessForOrg: [
15178 "PATCH /organizations/{org}/dependabot/repository-access"
15179 ]
15180 },
15181 dependencyGraph: {
15182 createRepositorySnapshot: [
15183 "POST /repos/{owner}/{repo}/dependency-graph/snapshots"
15184 ],
15185 diffRange: [
15186 "GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"
15187 ],
15188 exportSbom: ["GET /repos/{owner}/{repo}/dependency-graph/sbom"]
15189 },
15190 emojis: { get: ["GET /emojis"] },
15191 gists: {
15192 checkIsStarred: ["GET /gists/{gist_id}/star"],
15193 create: ["POST /gists"],
15194 createComment: ["POST /gists/{gist_id}/comments"],
15195 delete: ["DELETE /gists/{gist_id}"],
15196 deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"],
15197 fork: ["POST /gists/{gist_id}/forks"],
15198 get: ["GET /gists/{gist_id}"],
15199 getComment: ["GET /gists/{gist_id}/comments/{comment_id}"],
15200 getRevision: ["GET /gists/{gist_id}/{sha}"],
15201 list: ["GET /gists"],
15202 listComments: ["GET /gists/{gist_id}/comments"],
15203 listCommits: ["GET /gists/{gist_id}/commits"],
15204 listForUser: ["GET /users/{username}/gists"],
15205 listForks: ["GET /gists/{gist_id}/forks"],
15206 listPublic: ["GET /gists/public"],
15207 listStarred: ["GET /gists/starred"],
15208 star: ["PUT /gists/{gist_id}/star"],
15209 unstar: ["DELETE /gists/{gist_id}/star"],
15210 update: ["PATCH /gists/{gist_id}"],
15211 updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"]
15212 },
15213 git: {
15214 createBlob: ["POST /repos/{owner}/{repo}/git/blobs"],
15215 createCommit: ["POST /repos/{owner}/{repo}/git/commits"],
15216 createRef: ["POST /repos/{owner}/{repo}/git/refs"],
15217 createTag: ["POST /repos/{owner}/{repo}/git/tags"],
15218 createTree: ["POST /repos/{owner}/{repo}/git/trees"],
15219 deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"],
15220 getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"],
15221 getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"],
15222 getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"],
15223 getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"],
15224 getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"],
15225 listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"],
15226 updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"]
15227 },
15228 gitignore: {
15229 getAllTemplates: ["GET /gitignore/templates"],
15230 getTemplate: ["GET /gitignore/templates/{name}"]
15231 },
15232 hostedCompute: {
15233 createNetworkConfigurationForOrg: [
15234 "POST /orgs/{org}/settings/network-configurations"
15235 ],
15236 deleteNetworkConfigurationFromOrg: [
15237 "DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id}"
15238 ],
15239 getNetworkConfigurationForOrg: [
15240 "GET /orgs/{org}/settings/network-configurations/{network_configuration_id}"
15241 ],
15242 getNetworkSettingsForOrg: [
15243 "GET /orgs/{org}/settings/network-settings/{network_settings_id}"
15244 ],
15245 listNetworkConfigurationsForOrg: [
15246 "GET /orgs/{org}/settings/network-configurations"
15247 ],
15248 updateNetworkConfigurationForOrg: [
15249 "PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id}"
15250 ]
15251 },
15252 interactions: {
15253 getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
15254 getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
15255 getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"],
15256 getRestrictionsForYourPublicRepos: [
15257 "GET /user/interaction-limits",
15258 {},
15259 { renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] }
15260 ],
15261 removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"],
15262 removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"],
15263 removeRestrictionsForRepo: [
15264 "DELETE /repos/{owner}/{repo}/interaction-limits"
15265 ],
15266 removeRestrictionsForYourPublicRepos: [
15267 "DELETE /user/interaction-limits",
15268 {},
15269 { renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] }
15270 ],
15271 setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"],
15272 setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"],
15273 setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"],
15274 setRestrictionsForYourPublicRepos: [
15275 "PUT /user/interaction-limits",
15276 {},
15277 { renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] }
15278 ]
15279 },
15280 issues: {
15281 addAssignees: [
15282 "POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"
15283 ],
15284 addBlockedByDependency: [
15285 "POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
15286 ],
15287 addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"],
15288 addSubIssue: [
15289 "POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
15290 ],
15291 checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"],
15292 checkUserCanBeAssignedToIssue: [
15293 "GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}"
15294 ],
15295 create: ["POST /repos/{owner}/{repo}/issues"],
15296 createComment: [
15297 "POST /repos/{owner}/{repo}/issues/{issue_number}/comments"
15298 ],
15299 createLabel: ["POST /repos/{owner}/{repo}/labels"],
15300 createMilestone: ["POST /repos/{owner}/{repo}/milestones"],
15301 deleteComment: [
15302 "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"
15303 ],
15304 deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"],
15305 deleteMilestone: [
15306 "DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"
15307 ],
15308 get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"],
15309 getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"],
15310 getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"],
15311 getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"],
15312 getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"],
15313 getParent: ["GET /repos/{owner}/{repo}/issues/{issue_number}/parent"],
15314 list: ["GET /issues"],
15315 listAssignees: ["GET /repos/{owner}/{repo}/assignees"],
15316 listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"],
15317 listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"],
15318 listDependenciesBlockedBy: [
15319 "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by"
15320 ],
15321 listDependenciesBlocking: [
15322 "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking"
15323 ],
15324 listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"],
15325 listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"],
15326 listEventsForTimeline: [
15327 "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"
15328 ],
15329 listForAuthenticatedUser: ["GET /user/issues"],
15330 listForOrg: ["GET /orgs/{org}/issues"],
15331 listForRepo: ["GET /repos/{owner}/{repo}/issues"],
15332 listLabelsForMilestone: [
15333 "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"
15334 ],
15335 listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"],
15336 listLabelsOnIssue: [
15337 "GET /repos/{owner}/{repo}/issues/{issue_number}/labels"
15338 ],
15339 listMilestones: ["GET /repos/{owner}/{repo}/milestones"],
15340 listSubIssues: [
15341 "GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues"
15342 ],
15343 lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"],
15344 removeAllLabels: [
15345 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"
15346 ],
15347 removeAssignees: [
15348 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"
15349 ],
15350 removeDependencyBlockedBy: [
15351 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}"
15352 ],
15353 removeLabel: [
15354 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"
15355 ],
15356 removeSubIssue: [
15357 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue"
15358 ],
15359 reprioritizeSubIssue: [
15360 "PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority"
15361 ],
15362 setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"],
15363 unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"],
15364 update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"],
15365 updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"],
15366 updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"],
15367 updateMilestone: [
15368 "PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"
15369 ]
15370 },
15371 licenses: {
15372 get: ["GET /licenses/{license}"],
15373 getAllCommonlyUsed: ["GET /licenses"],
15374 getForRepo: ["GET /repos/{owner}/{repo}/license"]
15375 },
15376 markdown: {
15377 render: ["POST /markdown"],
15378 renderRaw: [
15379 "POST /markdown/raw",
15380 { headers: { "content-type": "text/plain; charset=utf-8" } }
15381 ]
15382 },
15383 meta: {
15384 get: ["GET /meta"],
15385 getAllVersions: ["GET /versions"],
15386 getOctocat: ["GET /octocat"],
15387 getZen: ["GET /zen"],
15388 root: ["GET /"]
15389 },
15390 migrations: {
15391 deleteArchiveForAuthenticatedUser: [
15392 "DELETE /user/migrations/{migration_id}/archive"
15393 ],
15394 deleteArchiveForOrg: [
15395 "DELETE /orgs/{org}/migrations/{migration_id}/archive"
15396 ],
15397 downloadArchiveForOrg: [
15398 "GET /orgs/{org}/migrations/{migration_id}/archive"
15399 ],
15400 getArchiveForAuthenticatedUser: [
15401 "GET /user/migrations/{migration_id}/archive"
15402 ],
15403 getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"],
15404 getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"],
15405 listForAuthenticatedUser: ["GET /user/migrations"],
15406 listForOrg: ["GET /orgs/{org}/migrations"],
15407 listReposForAuthenticatedUser: [
15408 "GET /user/migrations/{migration_id}/repositories"
15409 ],
15410 listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"],
15411 listReposForUser: [
15412 "GET /user/migrations/{migration_id}/repositories",
15413 {},
15414 { renamed: ["migrations", "listReposForAuthenticatedUser"] }
15415 ],
15416 startForAuthenticatedUser: ["POST /user/migrations"],
15417 startForOrg: ["POST /orgs/{org}/migrations"],
15418 unlockRepoForAuthenticatedUser: [
15419 "DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"
15420 ],
15421 unlockRepoForOrg: [
15422 "DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"
15423 ]
15424 },
15425 oidc: {
15426 getOidcCustomSubTemplateForOrg: [
15427 "GET /orgs/{org}/actions/oidc/customization/sub"
15428 ],
15429 updateOidcCustomSubTemplateForOrg: [
15430 "PUT /orgs/{org}/actions/oidc/customization/sub"
15431 ]
15432 },
15433 orgs: {
15434 addSecurityManagerTeam: [
15435 "PUT /orgs/{org}/security-managers/teams/{team_slug}",
15436 {},
15437 {
15438 deprecated: "octokit.rest.orgs.addSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team"
15439 }
15440 ],
15441 assignTeamToOrgRole: [
15442 "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
15443 ],
15444 assignUserToOrgRole: [
15445 "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}"
15446 ],
15447 blockUser: ["PUT /orgs/{org}/blocks/{username}"],
15448 cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"],
15449 checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"],
15450 checkMembershipForUser: ["GET /orgs/{org}/members/{username}"],
15451 checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"],
15452 convertMemberToOutsideCollaborator: [
15453 "PUT /orgs/{org}/outside_collaborators/{username}"
15454 ],
15455 createArtifactStorageRecord: [
15456 "POST /orgs/{org}/artifacts/metadata/storage-record"
15457 ],
15458 createInvitation: ["POST /orgs/{org}/invitations"],
15459 createIssueType: ["POST /orgs/{org}/issue-types"],
15460 createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"],
15461 createOrUpdateCustomPropertiesValuesForRepos: [
15462 "PATCH /orgs/{org}/properties/values"
15463 ],
15464 createOrUpdateCustomProperty: [
15465 "PUT /orgs/{org}/properties/schema/{custom_property_name}"
15466 ],
15467 createWebhook: ["POST /orgs/{org}/hooks"],
15468 delete: ["DELETE /orgs/{org}"],
15469 deleteAttestationsBulk: ["POST /orgs/{org}/attestations/delete-request"],
15470 deleteAttestationsById: [
15471 "DELETE /orgs/{org}/attestations/{attestation_id}"
15472 ],
15473 deleteAttestationsBySubjectDigest: [
15474 "DELETE /orgs/{org}/attestations/digest/{subject_digest}"
15475 ],
15476 deleteIssueType: ["DELETE /orgs/{org}/issue-types/{issue_type_id}"],
15477 deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
15478 get: ["GET /orgs/{org}"],
15479 getAllCustomProperties: ["GET /orgs/{org}/properties/schema"],
15480 getCustomProperty: [
15481 "GET /orgs/{org}/properties/schema/{custom_property_name}"
15482 ],
15483 getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
15484 getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
15485 getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
15486 getOrgRulesetHistory: ["GET /orgs/{org}/rulesets/{ruleset_id}/history"],
15487 getOrgRulesetVersion: [
15488 "GET /orgs/{org}/rulesets/{ruleset_id}/history/{version_id}"
15489 ],
15490 getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
15491 getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
15492 getWebhookDelivery: [
15493 "GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"
15494 ],
15495 list: ["GET /organizations"],
15496 listAppInstallations: ["GET /orgs/{org}/installations"],
15497 listArtifactStorageRecords: [
15498 "GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records"
15499 ],
15500 listAttestations: ["GET /orgs/{org}/attestations/{subject_digest}"],
15501 listAttestationsBulk: [
15502 "POST /orgs/{org}/attestations/bulk-list{?per_page,before,after}"
15503 ],
15504 listBlockedUsers: ["GET /orgs/{org}/blocks"],
15505 listCustomPropertiesValuesForRepos: ["GET /orgs/{org}/properties/values"],
15506 listFailedInvitations: ["GET /orgs/{org}/failed_invitations"],
15507 listForAuthenticatedUser: ["GET /user/orgs"],
15508 listForUser: ["GET /users/{username}/orgs"],
15509 listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
15510 listIssueTypes: ["GET /orgs/{org}/issue-types"],
15511 listMembers: ["GET /orgs/{org}/members"],
15512 listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
15513 listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
15514 listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"],
15515 listOrgRoles: ["GET /orgs/{org}/organization-roles"],
15516 listOrganizationFineGrainedPermissions: [
15517 "GET /orgs/{org}/organization-fine-grained-permissions"
15518 ],
15519 listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
15520 listPatGrantRepositories: [
15521 "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories"
15522 ],
15523 listPatGrantRequestRepositories: [
15524 "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories"
15525 ],
15526 listPatGrantRequests: ["GET /orgs/{org}/personal-access-token-requests"],
15527 listPatGrants: ["GET /orgs/{org}/personal-access-tokens"],
15528 listPendingInvitations: ["GET /orgs/{org}/invitations"],
15529 listPublicMembers: ["GET /orgs/{org}/public_members"],
15530 listSecurityManagerTeams: [
15531 "GET /orgs/{org}/security-managers",
15532 {},
15533 {
15534 deprecated: "octokit.rest.orgs.listSecurityManagerTeams() is deprecated, see https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams"
15535 }
15536 ],
15537 listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
15538 listWebhooks: ["GET /orgs/{org}/hooks"],
15539 pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
15540 redeliverWebhookDelivery: [
15541 "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
15542 ],
15543 removeCustomProperty: [
15544 "DELETE /orgs/{org}/properties/schema/{custom_property_name}"
15545 ],
15546 removeMember: ["DELETE /orgs/{org}/members/{username}"],
15547 removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
15548 removeOutsideCollaborator: [
15549 "DELETE /orgs/{org}/outside_collaborators/{username}"
15550 ],
15551 removePublicMembershipForAuthenticatedUser: [
15552 "DELETE /orgs/{org}/public_members/{username}"
15553 ],
15554 removeSecurityManagerTeam: [
15555 "DELETE /orgs/{org}/security-managers/teams/{team_slug}",
15556 {},
15557 {
15558 deprecated: "octokit.rest.orgs.removeSecurityManagerTeam() is deprecated, see https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team"
15559 }
15560 ],
15561 reviewPatGrantRequest: [
15562 "POST /orgs/{org}/personal-access-token-requests/{pat_request_id}"
15563 ],
15564 reviewPatGrantRequestsInBulk: [
15565 "POST /orgs/{org}/personal-access-token-requests"
15566 ],
15567 revokeAllOrgRolesTeam: [
15568 "DELETE /orgs/{org}/organization-roles/teams/{team_slug}"
15569 ],
15570 revokeAllOrgRolesUser: [
15571 "DELETE /orgs/{org}/organization-roles/users/{username}"
15572 ],
15573 revokeOrgRoleTeam: [
15574 "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
15575 ],
15576 revokeOrgRoleUser: [
15577 "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}"
15578 ],
15579 setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
15580 setPublicMembershipForAuthenticatedUser: [
15581 "PUT /orgs/{org}/public_members/{username}"
15582 ],
15583 unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
15584 update: ["PATCH /orgs/{org}"],
15585 updateIssueType: ["PUT /orgs/{org}/issue-types/{issue_type_id}"],
15586 updateMembershipForAuthenticatedUser: [
15587 "PATCH /user/memberships/orgs/{org}"
15588 ],
15589 updatePatAccess: ["POST /orgs/{org}/personal-access-tokens/{pat_id}"],
15590 updatePatAccesses: ["POST /orgs/{org}/personal-access-tokens"],
15591 updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
15592 updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
15593 },
15594 packages: {
15595 deletePackageForAuthenticatedUser: [
15596 "DELETE /user/packages/{package_type}/{package_name}"
15597 ],
15598 deletePackageForOrg: [
15599 "DELETE /orgs/{org}/packages/{package_type}/{package_name}"
15600 ],
15601 deletePackageForUser: [
15602 "DELETE /users/{username}/packages/{package_type}/{package_name}"
15603 ],
15604 deletePackageVersionForAuthenticatedUser: [
15605 "DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
15606 ],
15607 deletePackageVersionForOrg: [
15608 "DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
15609 ],
15610 deletePackageVersionForUser: [
15611 "DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
15612 ],
15613 getAllPackageVersionsForAPackageOwnedByAnOrg: [
15614 "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
15615 {},
15616 { renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] }
15617 ],
15618 getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: [
15619 "GET /user/packages/{package_type}/{package_name}/versions",
15620 {},
15621 {
15622 renamed: [
15623 "packages",
15624 "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"
15625 ]
15626 }
15627 ],
15628 getAllPackageVersionsForPackageOwnedByAuthenticatedUser: [
15629 "GET /user/packages/{package_type}/{package_name}/versions"
15630 ],
15631 getAllPackageVersionsForPackageOwnedByOrg: [
15632 "GET /orgs/{org}/packages/{package_type}/{package_name}/versions"
15633 ],
15634 getAllPackageVersionsForPackageOwnedByUser: [
15635 "GET /users/{username}/packages/{package_type}/{package_name}/versions"
15636 ],
15637 getPackageForAuthenticatedUser: [
15638 "GET /user/packages/{package_type}/{package_name}"
15639 ],
15640 getPackageForOrganization: [
15641 "GET /orgs/{org}/packages/{package_type}/{package_name}"
15642 ],
15643 getPackageForUser: [
15644 "GET /users/{username}/packages/{package_type}/{package_name}"
15645 ],
15646 getPackageVersionForAuthenticatedUser: [
15647 "GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
15648 ],
15649 getPackageVersionForOrganization: [
15650 "GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
15651 ],
15652 getPackageVersionForUser: [
15653 "GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
15654 ],
15655 listDockerMigrationConflictingPackagesForAuthenticatedUser: [
15656 "GET /user/docker/conflicts"
15657 ],
15658 listDockerMigrationConflictingPackagesForOrganization: [
15659 "GET /orgs/{org}/docker/conflicts"
15660 ],
15661 listDockerMigrationConflictingPackagesForUser: [
15662 "GET /users/{username}/docker/conflicts"
15663 ],
15664 listPackagesForAuthenticatedUser: ["GET /user/packages"],
15665 listPackagesForOrganization: ["GET /orgs/{org}/packages"],
15666 listPackagesForUser: ["GET /users/{username}/packages"],
15667 restorePackageForAuthenticatedUser: [
15668 "POST /user/packages/{package_type}/{package_name}/restore{?token}"
15669 ],
15670 restorePackageForOrg: [
15671 "POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"
15672 ],
15673 restorePackageForUser: [
15674 "POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"
15675 ],
15676 restorePackageVersionForAuthenticatedUser: [
15677 "POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
15678 ],
15679 restorePackageVersionForOrg: [
15680 "POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
15681 ],
15682 restorePackageVersionForUser: [
15683 "POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
15684 ]
15685 },
15686 privateRegistries: {
15687 createOrgPrivateRegistry: ["POST /orgs/{org}/private-registries"],
15688 deleteOrgPrivateRegistry: [
15689 "DELETE /orgs/{org}/private-registries/{secret_name}"
15690 ],
15691 getOrgPrivateRegistry: ["GET /orgs/{org}/private-registries/{secret_name}"],
15692 getOrgPublicKey: ["GET /orgs/{org}/private-registries/public-key"],
15693 listOrgPrivateRegistries: ["GET /orgs/{org}/private-registries"],
15694 updateOrgPrivateRegistry: [
15695 "PATCH /orgs/{org}/private-registries/{secret_name}"
15696 ]
15697 },
15698 projects: {
15699 addItemForOrg: ["POST /orgs/{org}/projectsV2/{project_number}/items"],
15700 addItemForUser: ["POST /users/{user_id}/projectsV2/{project_number}/items"],
15701 deleteItemForOrg: [
15702 "DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
15703 ],
15704 deleteItemForUser: [
15705 "DELETE /users/{user_id}/projectsV2/{project_number}/items/{item_id}"
15706 ],
15707 getFieldForOrg: [
15708 "GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id}"
15709 ],
15710 getFieldForUser: [
15711 "GET /users/{user_id}/projectsV2/{project_number}/fields/{field_id}"
15712 ],
15713 getForOrg: ["GET /orgs/{org}/projectsV2/{project_number}"],
15714 getForUser: ["GET /users/{user_id}/projectsV2/{project_number}"],
15715 getOrgItem: ["GET /orgs/{org}/projectsV2/{project_number}/items/{item_id}"],
15716 getUserItem: [
15717 "GET /users/{user_id}/projectsV2/{project_number}/items/{item_id}"
15718 ],
15719 listFieldsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/fields"],
15720 listFieldsForUser: [
15721 "GET /users/{user_id}/projectsV2/{project_number}/fields"
15722 ],
15723 listForOrg: ["GET /orgs/{org}/projectsV2"],
15724 listForUser: ["GET /users/{username}/projectsV2"],
15725 listItemsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/items"],
15726 listItemsForUser: [
15727 "GET /users/{user_id}/projectsV2/{project_number}/items"
15728 ],
15729 updateItemForOrg: [
15730 "PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id}"
15731 ],
15732 updateItemForUser: [
15733 "PATCH /users/{user_id}/projectsV2/{project_number}/items/{item_id}"
15734 ]
15735 },
15736 pulls: {
15737 checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
15738 create: ["POST /repos/{owner}/{repo}/pulls"],
15739 createReplyForReviewComment: [
15740 "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"
15741 ],
15742 createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
15743 createReviewComment: [
15744 "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"
15745 ],
15746 deletePendingReview: [
15747 "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
15748 ],
15749 deleteReviewComment: [
15750 "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"
15751 ],
15752 dismissReview: [
15753 "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"
15754 ],
15755 get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"],
15756 getReview: [
15757 "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
15758 ],
15759 getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"],
15760 list: ["GET /repos/{owner}/{repo}/pulls"],
15761 listCommentsForReview: [
15762 "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"
15763 ],
15764 listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"],
15765 listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"],
15766 listRequestedReviewers: [
15767 "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
15768 ],
15769 listReviewComments: [
15770 "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"
15771 ],
15772 listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"],
15773 listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
15774 merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
15775 removeRequestedReviewers: [
15776 "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
15777 ],
15778 requestReviewers: [
15779 "POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
15780 ],
15781 submitReview: [
15782 "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"
15783 ],
15784 update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"],
15785 updateBranch: [
15786 "PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"
15787 ],
15788 updateReview: [
15789 "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
15790 ],
15791 updateReviewComment: [
15792 "PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"
15793 ]
15794 },
15795 rateLimit: { get: ["GET /rate_limit"] },
15796 reactions: {
15797 createForCommitComment: [
15798 "POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"
15799 ],
15800 createForIssue: [
15801 "POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"
15802 ],
15803 createForIssueComment: [
15804 "POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
15805 ],
15806 createForPullRequestReviewComment: [
15807 "POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
15808 ],
15809 createForRelease: [
15810 "POST /repos/{owner}/{repo}/releases/{release_id}/reactions"
15811 ],
15812 createForTeamDiscussionCommentInOrg: [
15813 "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
15814 ],
15815 createForTeamDiscussionInOrg: [
15816 "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
15817 ],
15818 deleteForCommitComment: [
15819 "DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"
15820 ],
15821 deleteForIssue: [
15822 "DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"
15823 ],
15824 deleteForIssueComment: [
15825 "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"
15826 ],
15827 deleteForPullRequestComment: [
15828 "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"
15829 ],
15830 deleteForRelease: [
15831 "DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"
15832 ],
15833 deleteForTeamDiscussion: [
15834 "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"
15835 ],
15836 deleteForTeamDiscussionComment: [
15837 "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"
15838 ],
15839 listForCommitComment: [
15840 "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"
15841 ],
15842 listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"],
15843 listForIssueComment: [
15844 "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
15845 ],
15846 listForPullRequestReviewComment: [
15847 "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
15848 ],
15849 listForRelease: [
15850 "GET /repos/{owner}/{repo}/releases/{release_id}/reactions"
15851 ],
15852 listForTeamDiscussionCommentInOrg: [
15853 "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
15854 ],
15855 listForTeamDiscussionInOrg: [
15856 "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
15857 ]
15858 },
15859 repos: {
15860 acceptInvitation: [
15861 "PATCH /user/repository_invitations/{invitation_id}",
15862 {},
15863 { renamed: ["repos", "acceptInvitationForAuthenticatedUser"] }
15864 ],
15865 acceptInvitationForAuthenticatedUser: [
15866 "PATCH /user/repository_invitations/{invitation_id}"
15867 ],
15868 addAppAccessRestrictions: [
15869 "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
15870 {},
15871 { mapToData: "apps" }
15872 ],
15873 addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"],
15874 addStatusCheckContexts: [
15875 "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
15876 {},
15877 { mapToData: "contexts" }
15878 ],
15879 addTeamAccessRestrictions: [
15880 "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
15881 {},
15882 { mapToData: "teams" }
15883 ],
15884 addUserAccessRestrictions: [
15885 "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
15886 {},
15887 { mapToData: "users" }
15888 ],
15889 cancelPagesDeployment: [
15890 "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel"
15891 ],
15892 checkAutomatedSecurityFixes: [
15893 "GET /repos/{owner}/{repo}/automated-security-fixes"
15894 ],
15895 checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"],
15896 checkPrivateVulnerabilityReporting: [
15897 "GET /repos/{owner}/{repo}/private-vulnerability-reporting"
15898 ],
15899 checkVulnerabilityAlerts: [
15900 "GET /repos/{owner}/{repo}/vulnerability-alerts"
15901 ],
15902 codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"],
15903 compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"],
15904 compareCommitsWithBasehead: [
15905 "GET /repos/{owner}/{repo}/compare/{basehead}"
15906 ],
15907 createAttestation: ["POST /repos/{owner}/{repo}/attestations"],
15908 createAutolink: ["POST /repos/{owner}/{repo}/autolinks"],
15909 createCommitComment: [
15910 "POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"
15911 ],
15912 createCommitSignatureProtection: [
15913 "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
15914 ],
15915 createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"],
15916 createDeployKey: ["POST /repos/{owner}/{repo}/keys"],
15917 createDeployment: ["POST /repos/{owner}/{repo}/deployments"],
15918 createDeploymentBranchPolicy: [
15919 "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
15920 ],
15921 createDeploymentProtectionRule: [
15922 "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
15923 ],
15924 createDeploymentStatus: [
15925 "POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
15926 ],
15927 createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"],
15928 createForAuthenticatedUser: ["POST /user/repos"],
15929 createFork: ["POST /repos/{owner}/{repo}/forks"],
15930 createInOrg: ["POST /orgs/{org}/repos"],
15931 createOrUpdateCustomPropertiesValues: [
15932 "PATCH /repos/{owner}/{repo}/properties/values"
15933 ],
15934 createOrUpdateEnvironment: [
15935 "PUT /repos/{owner}/{repo}/environments/{environment_name}"
15936 ],
15937 createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
15938 createOrgRuleset: ["POST /orgs/{org}/rulesets"],
15939 createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"],
15940 createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
15941 createRelease: ["POST /repos/{owner}/{repo}/releases"],
15942 createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
15943 createUsingTemplate: [
15944 "POST /repos/{template_owner}/{template_repo}/generate"
15945 ],
15946 createWebhook: ["POST /repos/{owner}/{repo}/hooks"],
15947 declineInvitation: [
15948 "DELETE /user/repository_invitations/{invitation_id}",
15949 {},
15950 { renamed: ["repos", "declineInvitationForAuthenticatedUser"] }
15951 ],
15952 declineInvitationForAuthenticatedUser: [
15953 "DELETE /user/repository_invitations/{invitation_id}"
15954 ],
15955 delete: ["DELETE /repos/{owner}/{repo}"],
15956 deleteAccessRestrictions: [
15957 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
15958 ],
15959 deleteAdminBranchProtection: [
15960 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
15961 ],
15962 deleteAnEnvironment: [
15963 "DELETE /repos/{owner}/{repo}/environments/{environment_name}"
15964 ],
15965 deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"],
15966 deleteBranchProtection: [
15967 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection"
15968 ],
15969 deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"],
15970 deleteCommitSignatureProtection: [
15971 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
15972 ],
15973 deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"],
15974 deleteDeployment: [
15975 "DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"
15976 ],
15977 deleteDeploymentBranchPolicy: [
15978 "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
15979 ],
15980 deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"],
15981 deleteInvitation: [
15982 "DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"
15983 ],
15984 deleteOrgRuleset: ["DELETE /orgs/{org}/rulesets/{ruleset_id}"],
15985 deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"],
15986 deletePullRequestReviewProtection: [
15987 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
15988 ],
15989 deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"],
15990 deleteReleaseAsset: [
15991 "DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"
15992 ],
15993 deleteRepoRuleset: ["DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
15994 deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"],
15995 disableAutomatedSecurityFixes: [
15996 "DELETE /repos/{owner}/{repo}/automated-security-fixes"
15997 ],
15998 disableDeploymentProtectionRule: [
15999 "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
16000 ],
16001 disablePrivateVulnerabilityReporting: [
16002 "DELETE /repos/{owner}/{repo}/private-vulnerability-reporting"
16003 ],
16004 disableVulnerabilityAlerts: [
16005 "DELETE /repos/{owner}/{repo}/vulnerability-alerts"
16006 ],
16007 downloadArchive: [
16008 "GET /repos/{owner}/{repo}/zipball/{ref}",
16009 {},
16010 { renamed: ["repos", "downloadZipballArchive"] }
16011 ],
16012 downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"],
16013 downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"],
16014 enableAutomatedSecurityFixes: [
16015 "PUT /repos/{owner}/{repo}/automated-security-fixes"
16016 ],
16017 enablePrivateVulnerabilityReporting: [
16018 "PUT /repos/{owner}/{repo}/private-vulnerability-reporting"
16019 ],
16020 enableVulnerabilityAlerts: [
16021 "PUT /repos/{owner}/{repo}/vulnerability-alerts"
16022 ],
16023 generateReleaseNotes: [
16024 "POST /repos/{owner}/{repo}/releases/generate-notes"
16025 ],
16026 get: ["GET /repos/{owner}/{repo}"],
16027 getAccessRestrictions: [
16028 "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
16029 ],
16030 getAdminBranchProtection: [
16031 "GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
16032 ],
16033 getAllDeploymentProtectionRules: [
16034 "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
16035 ],
16036 getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"],
16037 getAllStatusCheckContexts: [
16038 "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"
16039 ],
16040 getAllTopics: ["GET /repos/{owner}/{repo}/topics"],
16041 getAppsWithAccessToProtectedBranch: [
16042 "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"
16043 ],
16044 getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"],
16045 getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"],
16046 getBranchProtection: [
16047 "GET /repos/{owner}/{repo}/branches/{branch}/protection"
16048 ],
16049 getBranchRules: ["GET /repos/{owner}/{repo}/rules/branches/{branch}"],
16050 getClones: ["GET /repos/{owner}/{repo}/traffic/clones"],
16051 getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"],
16052 getCollaboratorPermissionLevel: [
16053 "GET /repos/{owner}/{repo}/collaborators/{username}/permission"
16054 ],
16055 getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"],
16056 getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"],
16057 getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"],
16058 getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"],
16059 getCommitSignatureProtection: [
16060 "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
16061 ],
16062 getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"],
16063 getContent: ["GET /repos/{owner}/{repo}/contents/{path}"],
16064 getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"],
16065 getCustomDeploymentProtectionRule: [
16066 "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
16067 ],
16068 getCustomPropertiesValues: ["GET /repos/{owner}/{repo}/properties/values"],
16069 getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"],
16070 getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"],
16071 getDeploymentBranchPolicy: [
16072 "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
16073 ],
16074 getDeploymentStatus: [
16075 "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"
16076 ],
16077 getEnvironment: [
16078 "GET /repos/{owner}/{repo}/environments/{environment_name}"
16079 ],
16080 getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"],
16081 getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"],
16082 getOrgRuleSuite: ["GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id}"],
16083 getOrgRuleSuites: ["GET /orgs/{org}/rulesets/rule-suites"],
16084 getOrgRuleset: ["GET /orgs/{org}/rulesets/{ruleset_id}"],
16085 getOrgRulesets: ["GET /orgs/{org}/rulesets"],
16086 getPages: ["GET /repos/{owner}/{repo}/pages"],
16087 getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
16088 getPagesDeployment: [
16089 "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}"
16090 ],
16091 getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
16092 getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"],
16093 getPullRequestReviewProtection: [
16094 "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
16095 ],
16096 getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"],
16097 getReadme: ["GET /repos/{owner}/{repo}/readme"],
16098 getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"],
16099 getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"],
16100 getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"],
16101 getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"],
16102 getRepoRuleSuite: [
16103 "GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
16104 ],
16105 getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"],
16106 getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
16107 getRepoRulesetHistory: [
16108 "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history"
16109 ],
16110 getRepoRulesetVersion: [
16111 "GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history/{version_id}"
16112 ],
16113 getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
16114 getStatusChecksProtection: [
16115 "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
16116 ],
16117 getTeamsWithAccessToProtectedBranch: [
16118 "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"
16119 ],
16120 getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"],
16121 getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"],
16122 getUsersWithAccessToProtectedBranch: [
16123 "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"
16124 ],
16125 getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
16126 getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
16127 getWebhookConfigForRepo: [
16128 "GET /repos/{owner}/{repo}/hooks/{hook_id}/config"
16129 ],
16130 getWebhookDelivery: [
16131 "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"
16132 ],
16133 listActivities: ["GET /repos/{owner}/{repo}/activity"],
16134 listAttestations: [
16135 "GET /repos/{owner}/{repo}/attestations/{subject_digest}"
16136 ],
16137 listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"],
16138 listBranches: ["GET /repos/{owner}/{repo}/branches"],
16139 listBranchesForHeadCommit: [
16140 "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"
16141 ],
16142 listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"],
16143 listCommentsForCommit: [
16144 "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"
16145 ],
16146 listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"],
16147 listCommitStatusesForRef: [
16148 "GET /repos/{owner}/{repo}/commits/{ref}/statuses"
16149 ],
16150 listCommits: ["GET /repos/{owner}/{repo}/commits"],
16151 listContributors: ["GET /repos/{owner}/{repo}/contributors"],
16152 listCustomDeploymentRuleIntegrations: [
16153 "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps"
16154 ],
16155 listDeployKeys: ["GET /repos/{owner}/{repo}/keys"],
16156 listDeploymentBranchPolicies: [
16157 "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
16158 ],
16159 listDeploymentStatuses: [
16160 "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
16161 ],
16162 listDeployments: ["GET /repos/{owner}/{repo}/deployments"],
16163 listForAuthenticatedUser: ["GET /user/repos"],
16164 listForOrg: ["GET /orgs/{org}/repos"],
16165 listForUser: ["GET /users/{username}/repos"],
16166 listForks: ["GET /repos/{owner}/{repo}/forks"],
16167 listInvitations: ["GET /repos/{owner}/{repo}/invitations"],
16168 listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"],
16169 listLanguages: ["GET /repos/{owner}/{repo}/languages"],
16170 listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"],
16171 listPublic: ["GET /repositories"],
16172 listPullRequestsAssociatedWithCommit: [
16173 "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"
16174 ],
16175 listReleaseAssets: [
16176 "GET /repos/{owner}/{repo}/releases/{release_id}/assets"
16177 ],
16178 listReleases: ["GET /repos/{owner}/{repo}/releases"],
16179 listTags: ["GET /repos/{owner}/{repo}/tags"],
16180 listTeams: ["GET /repos/{owner}/{repo}/teams"],
16181 listWebhookDeliveries: [
16182 "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"
16183 ],
16184 listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
16185 merge: ["POST /repos/{owner}/{repo}/merges"],
16186 mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"],
16187 pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
16188 redeliverWebhookDelivery: [
16189 "POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
16190 ],
16191 removeAppAccessRestrictions: [
16192 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
16193 {},
16194 { mapToData: "apps" }
16195 ],
16196 removeCollaborator: [
16197 "DELETE /repos/{owner}/{repo}/collaborators/{username}"
16198 ],
16199 removeStatusCheckContexts: [
16200 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
16201 {},
16202 { mapToData: "contexts" }
16203 ],
16204 removeStatusCheckProtection: [
16205 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
16206 ],
16207 removeTeamAccessRestrictions: [
16208 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
16209 {},
16210 { mapToData: "teams" }
16211 ],
16212 removeUserAccessRestrictions: [
16213 "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
16214 {},
16215 { mapToData: "users" }
16216 ],
16217 renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"],
16218 replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"],
16219 requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"],
16220 setAdminBranchProtection: [
16221 "POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
16222 ],
16223 setAppAccessRestrictions: [
16224 "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
16225 {},
16226 { mapToData: "apps" }
16227 ],
16228 setStatusCheckContexts: [
16229 "PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
16230 {},
16231 { mapToData: "contexts" }
16232 ],
16233 setTeamAccessRestrictions: [
16234 "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
16235 {},
16236 { mapToData: "teams" }
16237 ],
16238 setUserAccessRestrictions: [
16239 "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
16240 {},
16241 { mapToData: "users" }
16242 ],
16243 testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"],
16244 transfer: ["POST /repos/{owner}/{repo}/transfer"],
16245 update: ["PATCH /repos/{owner}/{repo}"],
16246 updateBranchProtection: [
16247 "PUT /repos/{owner}/{repo}/branches/{branch}/protection"
16248 ],
16249 updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"],
16250 updateDeploymentBranchPolicy: [
16251 "PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
16252 ],
16253 updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"],
16254 updateInvitation: [
16255 "PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"
16256 ],
16257 updateOrgRuleset: ["PUT /orgs/{org}/rulesets/{ruleset_id}"],
16258 updatePullRequestReviewProtection: [
16259 "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
16260 ],
16261 updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"],
16262 updateReleaseAsset: [
16263 "PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"
16264 ],
16265 updateRepoRuleset: ["PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
16266 updateStatusCheckPotection: [
16267 "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks",
16268 {},
16269 { renamed: ["repos", "updateStatusCheckProtection"] }
16270 ],
16271 updateStatusCheckProtection: [
16272 "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
16273 ],
16274 updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"],
16275 updateWebhookConfigForRepo: [
16276 "PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"
16277 ],
16278 uploadReleaseAsset: [
16279 "POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}",
16280 { baseUrl: "https://uploads.github.com" }
16281 ]
16282 },
16283 search: {
16284 code: ["GET /search/code"],
16285 commits: ["GET /search/commits"],
16286 issuesAndPullRequests: [
16287 "GET /search/issues",
16288 {},
16289 {
16290 deprecated: "octokit.rest.search.issuesAndPullRequests() is deprecated, see https://docs.github.com/rest/search/search#search-issues-and-pull-requests"
16291 }
16292 ],
16293 labels: ["GET /search/labels"],
16294 repos: ["GET /search/repositories"],
16295 topics: ["GET /search/topics"],
16296 users: ["GET /search/users"]
16297 },
16298 secretScanning: {
16299 createPushProtectionBypass: [
16300 "POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses"
16301 ],
16302 getAlert: [
16303 "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
16304 ],
16305 getScanHistory: ["GET /repos/{owner}/{repo}/secret-scanning/scan-history"],
16306 listAlertsForEnterprise: [
16307 "GET /enterprises/{enterprise}/secret-scanning/alerts"
16308 ],
16309 listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"],
16310 listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"],
16311 listLocationsForAlert: [
16312 "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"
16313 ],
16314 listOrgPatternConfigs: [
16315 "GET /orgs/{org}/secret-scanning/pattern-configurations"
16316 ],
16317 updateAlert: [
16318 "PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
16319 ],
16320 updateOrgPatternConfigs: [
16321 "PATCH /orgs/{org}/secret-scanning/pattern-configurations"
16322 ]
16323 },
16324 securityAdvisories: {
16325 createFork: [
16326 "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks"
16327 ],
16328 createPrivateVulnerabilityReport: [
16329 "POST /repos/{owner}/{repo}/security-advisories/reports"
16330 ],
16331 createRepositoryAdvisory: [
16332 "POST /repos/{owner}/{repo}/security-advisories"
16333 ],
16334 createRepositoryAdvisoryCveRequest: [
16335 "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve"
16336 ],
16337 getGlobalAdvisory: ["GET /advisories/{ghsa_id}"],
16338 getRepositoryAdvisory: [
16339 "GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
16340 ],
16341 listGlobalAdvisories: ["GET /advisories"],
16342 listOrgRepositoryAdvisories: ["GET /orgs/{org}/security-advisories"],
16343 listRepositoryAdvisories: ["GET /repos/{owner}/{repo}/security-advisories"],
16344 updateRepositoryAdvisory: [
16345 "PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
16346 ]
16347 },
16348 teams: {
16349 addOrUpdateMembershipForUserInOrg: [
16350 "PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"
16351 ],
16352 addOrUpdateRepoPermissionsInOrg: [
16353 "PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
16354 ],
16355 checkPermissionsForRepoInOrg: [
16356 "GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
16357 ],
16358 create: ["POST /orgs/{org}/teams"],
16359 createDiscussionCommentInOrg: [
16360 "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
16361 ],
16362 createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"],
16363 deleteDiscussionCommentInOrg: [
16364 "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
16365 ],
16366 deleteDiscussionInOrg: [
16367 "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
16368 ],
16369 deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"],
16370 getByName: ["GET /orgs/{org}/teams/{team_slug}"],
16371 getDiscussionCommentInOrg: [
16372 "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
16373 ],
16374 getDiscussionInOrg: [
16375 "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
16376 ],
16377 getMembershipForUserInOrg: [
16378 "GET /orgs/{org}/teams/{team_slug}/memberships/{username}"
16379 ],
16380 list: ["GET /orgs/{org}/teams"],
16381 listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"],
16382 listDiscussionCommentsInOrg: [
16383 "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
16384 ],
16385 listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"],
16386 listForAuthenticatedUser: ["GET /user/teams"],
16387 listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"],
16388 listPendingInvitationsInOrg: [
16389 "GET /orgs/{org}/teams/{team_slug}/invitations"
16390 ],
16391 listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"],
16392 removeMembershipForUserInOrg: [
16393 "DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"
16394 ],
16395 removeRepoInOrg: [
16396 "DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
16397 ],
16398 updateDiscussionCommentInOrg: [
16399 "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
16400 ],
16401 updateDiscussionInOrg: [
16402 "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
16403 ],
16404 updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"]
16405 },
16406 users: {
16407 addEmailForAuthenticated: [
16408 "POST /user/emails",
16409 {},
16410 { renamed: ["users", "addEmailForAuthenticatedUser"] }
16411 ],
16412 addEmailForAuthenticatedUser: ["POST /user/emails"],
16413 addSocialAccountForAuthenticatedUser: ["POST /user/social_accounts"],
16414 block: ["PUT /user/blocks/{username}"],
16415 checkBlocked: ["GET /user/blocks/{username}"],
16416 checkFollowingForUser: ["GET /users/{username}/following/{target_user}"],
16417 checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"],
16418 createGpgKeyForAuthenticated: [
16419 "POST /user/gpg_keys",
16420 {},
16421 { renamed: ["users", "createGpgKeyForAuthenticatedUser"] }
16422 ],
16423 createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"],
16424 createPublicSshKeyForAuthenticated: [
16425 "POST /user/keys",
16426 {},
16427 { renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] }
16428 ],
16429 createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"],
16430 createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"],
16431 deleteAttestationsBulk: [
16432 "POST /users/{username}/attestations/delete-request"
16433 ],
16434 deleteAttestationsById: [
16435 "DELETE /users/{username}/attestations/{attestation_id}"
16436 ],
16437 deleteAttestationsBySubjectDigest: [
16438 "DELETE /users/{username}/attestations/digest/{subject_digest}"
16439 ],
16440 deleteEmailForAuthenticated: [
16441 "DELETE /user/emails",
16442 {},
16443 { renamed: ["users", "deleteEmailForAuthenticatedUser"] }
16444 ],
16445 deleteEmailForAuthenticatedUser: ["DELETE /user/emails"],
16446 deleteGpgKeyForAuthenticated: [
16447 "DELETE /user/gpg_keys/{gpg_key_id}",
16448 {},
16449 { renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] }
16450 ],
16451 deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"],
16452 deletePublicSshKeyForAuthenticated: [
16453 "DELETE /user/keys/{key_id}",
16454 {},
16455 { renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] }
16456 ],
16457 deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"],
16458 deleteSocialAccountForAuthenticatedUser: ["DELETE /user/social_accounts"],
16459 deleteSshSigningKeyForAuthenticatedUser: [
16460 "DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"
16461 ],
16462 follow: ["PUT /user/following/{username}"],
16463 getAuthenticated: ["GET /user"],
16464 getById: ["GET /user/{account_id}"],
16465 getByUsername: ["GET /users/{username}"],
16466 getContextForUser: ["GET /users/{username}/hovercard"],
16467 getGpgKeyForAuthenticated: [
16468 "GET /user/gpg_keys/{gpg_key_id}",
16469 {},
16470 { renamed: ["users", "getGpgKeyForAuthenticatedUser"] }
16471 ],
16472 getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"],
16473 getPublicSshKeyForAuthenticated: [
16474 "GET /user/keys/{key_id}",
16475 {},
16476 { renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] }
16477 ],
16478 getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"],
16479 getSshSigningKeyForAuthenticatedUser: [
16480 "GET /user/ssh_signing_keys/{ssh_signing_key_id}"
16481 ],
16482 list: ["GET /users"],
16483 listAttestations: ["GET /users/{username}/attestations/{subject_digest}"],
16484 listAttestationsBulk: [
16485 "POST /users/{username}/attestations/bulk-list{?per_page,before,after}"
16486 ],
16487 listBlockedByAuthenticated: [
16488 "GET /user/blocks",
16489 {},
16490 { renamed: ["users", "listBlockedByAuthenticatedUser"] }
16491 ],
16492 listBlockedByAuthenticatedUser: ["GET /user/blocks"],
16493 listEmailsForAuthenticated: [
16494 "GET /user/emails",
16495 {},
16496 { renamed: ["users", "listEmailsForAuthenticatedUser"] }
16497 ],
16498 listEmailsForAuthenticatedUser: ["GET /user/emails"],
16499 listFollowedByAuthenticated: [
16500 "GET /user/following",
16501 {},
16502 { renamed: ["users", "listFollowedByAuthenticatedUser"] }
16503 ],
16504 listFollowedByAuthenticatedUser: ["GET /user/following"],
16505 listFollowersForAuthenticatedUser: ["GET /user/followers"],
16506 listFollowersForUser: ["GET /users/{username}/followers"],
16507 listFollowingForUser: ["GET /users/{username}/following"],
16508 listGpgKeysForAuthenticated: [
16509 "GET /user/gpg_keys",
16510 {},
16511 { renamed: ["users", "listGpgKeysForAuthenticatedUser"] }
16512 ],
16513 listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"],
16514 listGpgKeysForUser: ["GET /users/{username}/gpg_keys"],
16515 listPublicEmailsForAuthenticated: [
16516 "GET /user/public_emails",
16517 {},
16518 { renamed: ["users", "listPublicEmailsForAuthenticatedUser"] }
16519 ],
16520 listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"],
16521 listPublicKeysForUser: ["GET /users/{username}/keys"],
16522 listPublicSshKeysForAuthenticated: [
16523 "GET /user/keys",
16524 {},
16525 { renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] }
16526 ],
16527 listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"],
16528 listSocialAccountsForAuthenticatedUser: ["GET /user/social_accounts"],
16529 listSocialAccountsForUser: ["GET /users/{username}/social_accounts"],
16530 listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"],
16531 listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"],
16532 setPrimaryEmailVisibilityForAuthenticated: [
16533 "PATCH /user/email/visibility",
16534 {},
16535 { renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] }
16536 ],
16537 setPrimaryEmailVisibilityForAuthenticatedUser: [
16538 "PATCH /user/email/visibility"
16539 ],
16540 unblock: ["DELETE /user/blocks/{username}"],
16541 unfollow: ["DELETE /user/following/{username}"],
16542 updateAuthenticated: ["PATCH /user"]
16543 }
16544};
16545var endpoints_default = Endpoints;
16546
16547// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
16548var endpointMethodsMap = /* @__PURE__ */ new Map;
16549for (const [scope, endpoints] of Object.entries(endpoints_default)) {
16550 for (const [methodName, endpoint2] of Object.entries(endpoints)) {
16551 const [route, defaults, decorations] = endpoint2;
16552 const [method, url] = route.split(/ /);
16553 const endpointDefaults = Object.assign({
16554 method,
16555 url
16556 }, defaults);
16557 if (!endpointMethodsMap.has(scope)) {
16558 endpointMethodsMap.set(scope, /* @__PURE__ */ new Map);
16559 }
16560 endpointMethodsMap.get(scope).set(methodName, {
16561 scope,
16562 methodName,
16563 endpointDefaults,
16564 decorations
16565 });
16566 }
16567}
16568var handler = {
16569 has({ scope }, methodName) {
16570 return endpointMethodsMap.get(scope).has(methodName);
16571 },
16572 getOwnPropertyDescriptor(target, methodName) {
16573 return {
16574 value: this.get(target, methodName),
16575 configurable: true,
16576 writable: true,
16577 enumerable: true
16578 };
16579 },
16580 defineProperty(target, methodName, descriptor) {
16581 Object.defineProperty(target.cache, methodName, descriptor);
16582 return true;
16583 },
16584 deleteProperty(target, methodName) {
16585 delete target.cache[methodName];
16586 return true;
16587 },
16588 ownKeys({ scope }) {
16589 return [...endpointMethodsMap.get(scope).keys()];
16590 },
16591 set(target, methodName, value) {
16592 return target.cache[methodName] = value;
16593 },
16594 get({ octokit, scope, cache }, methodName) {
16595 if (cache[methodName]) {
16596 return cache[methodName];
16597 }
16598 const method = endpointMethodsMap.get(scope).get(methodName);
16599 if (!method) {
16600 return;
16601 }
16602 const { endpointDefaults, decorations } = method;
16603 if (decorations) {
16604 cache[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations);
16605 } else {
16606 cache[methodName] = octokit.request.defaults(endpointDefaults);
16607 }
16608 return cache[methodName];
16609 }
16610};
16611function endpointsToMethods(octokit) {
16612 const newMethods = {};
16613 for (const scope of endpointMethodsMap.keys()) {
16614 newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
16615 }
16616 return newMethods;
16617}
16618function decorate(octokit, scope, methodName, defaults, decorations) {
16619 const requestWithDefaults = octokit.request.defaults(defaults);
16620 function withDecorations(...args) {
16621 let options = requestWithDefaults.endpoint.merge(...args);
16622 if (decorations.mapToData) {
16623 options = Object.assign({}, options, {
16624 data: options[decorations.mapToData],
16625 [decorations.mapToData]: undefined
16626 });
16627 return requestWithDefaults(options);
16628 }
16629 if (decorations.renamed) {
16630 const [newScope, newMethodName] = decorations.renamed;
16631 octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`);
16632 }
16633 if (decorations.deprecated) {
16634 octokit.log.warn(decorations.deprecated);
16635 }
16636 if (decorations.renamedParameters) {
16637 const options2 = requestWithDefaults.endpoint.merge(...args);
16638 for (const [name, alias] of Object.entries(decorations.renamedParameters)) {
16639 if (name in options2) {
16640 octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`);
16641 if (!(alias in options2)) {
16642 options2[alias] = options2[name];
16643 }
16644 delete options2[name];
16645 }
16646 }
16647 return requestWithDefaults(options2);
16648 }
16649 return requestWithDefaults(...args);
16650 }
16651 return Object.assign(withDecorations, requestWithDefaults);
16652}
16653
16654// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js
16655function restEndpointMethods(octokit) {
16656 const api = endpointsToMethods(octokit);
16657 return {
16658 rest: api
16659 };
16660}
16661restEndpointMethods.VERSION = VERSION7;
16662function legacyRestEndpointMethods(octokit) {
16663 const api = endpointsToMethods(octokit);
16664 return {
16665 ...api,
16666 rest: api
16667 };
16668}
16669legacyRestEndpointMethods.VERSION = VERSION7;
16670
16671// node_modules/@octokit/rest/dist-src/version.js
16672var VERSION8 = "22.0.0";
16673
16674// node_modules/@octokit/rest/dist-src/index.js
16675var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRest).defaults({
16676 userAgent: `octokit-rest.js/${VERSION8}`
16677});
16678
16679// inline-comment.ts
16680var githubToken = process.env.GITHUB_TOKEN;
16681if (!githubToken) {
16682 throw new Error("GITHUB_TOKEN environment variable is required");
16683}
16684function sanitizeContent(content) {
16685 const patterns = [
16686 /ghp_[a-zA-Z0-9]{36}/g,
16687 /gho_[a-zA-Z0-9]{36}/g,
16688 /ghs_[a-zA-Z0-9]{36}/g,
16689 /ghr_[a-zA-Z0-9]{36}/g,
16690 /github_pat_[a-zA-Z0-9_]{82}/g
16691 ];
16692 let sanitized = content;
16693 for (const pattern of patterns) {
16694 sanitized = sanitized.replace(pattern, "[REDACTED_TOKEN]");
16695 }
16696 return sanitized;
16697}
16698var server = new McpServer({
16699 name: "GitHub Inline Comment Server",
16700 version: "0.0.1"
16701});
16702server.tool("create_inline_comment", "Create an inline comment on a specific line or lines in a PR file. Use this tool to provide code suggestions or feedback directly in the PR diff.", {
16703 owner: exports_external.string().describe("Repository owner (e.g., 'anthropics')"),
16704 repo: exports_external.string().describe("Repository name (e.g., 'claude-code-action')"),
16705 pull_number: exports_external.number().positive().describe("Pull request number (e.g., 42)"),
16706 path: exports_external.string().describe("The file path to comment on (e.g., 'src/index.js')"),
16707 body: exports_external.string().describe("The comment text (supports markdown and GitHub code suggestion blocks). " + "For code suggestions, use: ```suggestion\\nreplacement code\\n```. " + "IMPORTANT: The suggestion block will REPLACE the ENTIRE line range (single line or startLine to line). " + "Ensure the replacement is syntactically complete and valid - it must work as a drop-in replacement for the selected lines."),
16708 line: exports_external.number().nonnegative().optional().describe("Line number for single-line comments (required if startLine is not provided)"),
16709 startLine: exports_external.number().nonnegative().optional().describe("Start line for multi-line comments (use with line parameter for the end line)"),
16710 side: exports_external.enum(["LEFT", "RIGHT"]).optional().default("RIGHT").describe("Side of the diff to comment on: LEFT (old code) or RIGHT (new code)"),
16711 commit_id: exports_external.string().optional().describe("Specific commit SHA to comment on (defaults to latest commit)")
16712}, async ({
16713 owner,
16714 repo,
16715 pull_number,
16716 path,
16717 body,
16718 line,
16719 startLine,
16720 side,
16721 commit_id
16722}) => {
16723 try {
16724 const octokit = new Octokit2({ auth: githubToken });
16725 const sanitizedBody = sanitizeContent(body);
16726 if (!line && !startLine) {
16727 throw new Error("Either 'line' for single-line comments or both 'startLine' and 'line' for multi-line comments must be provided");
16728 }
16729 const isSingleLine = !startLine;
16730 const pr = await octokit.rest.pulls.get({
16731 owner,
16732 repo,
16733 pull_number
16734 });
16735 const params = {
16736 owner,
16737 repo,
16738 pull_number,
16739 body: sanitizedBody,
16740 path,
16741 side: side || "RIGHT",
16742 commit_id: commit_id || pr.data.head.sha
16743 };
16744 if (isSingleLine) {
16745 params.line = line;
16746 } else {
16747 params.start_line = startLine;
16748 params.start_side = side || "RIGHT";
16749 params.line = line;
16750 }
16751 const result = await octokit.rest.pulls.createReviewComment(params);
16752 return {
16753 content: [
16754 {
16755 type: "text",
16756 text: JSON.stringify({
16757 success: true,
16758 comment_id: result.data.id,
16759 html_url: result.data.html_url,
16760 path: result.data.path,
16761 line: result.data.line || result.data.original_line,
16762 message: `Inline comment created successfully on ${path}${isSingleLine ? ` at line ${line}` : ` from line ${startLine} to ${line}`}`
16763 }, null, 2)
16764 }
16765 ]
16766 };
16767 } catch (error) {
16768 const errorMessage = error instanceof Error ? error.message : String(error);
16769 let helpMessage = "";
16770 if (errorMessage.includes("Validation Failed")) {
16771 helpMessage = `
16772
16773This usually means the line number doesn't exist in the diff or the file path is incorrect. Make sure you're commenting on lines that are part of the PR's changes.`;
16774 } else if (errorMessage.includes("Not Found")) {
16775 helpMessage = `
16776
16777This usually means the PR number, repository, or file path is incorrect.`;
16778 }
16779 return {
16780 content: [
16781 {
16782 type: "text",
16783 text: `Error creating inline comment: ${errorMessage}${helpMessage}`
16784 }
16785 ],
16786 error: errorMessage,
16787 isError: true
16788 };
16789 }
16790});
16791async function runServer() {
16792 const transport = new StdioServerTransport;
16793 await server.connect(transport);
16794 process.on("exit", () => {
16795 server.close();
16796 });
16797}
16798runServer().catch(console.error);