Skip to content

Instantly share code, notes, and snippets.

@elsayed85
Created August 20, 2023 06:38
Show Gist options
  • Save elsayed85/46590306367ba6b4e4bbccea9742f233 to your computer and use it in GitHub Desktop.
Save elsayed85/46590306367ba6b4e4bbccea9742f233 to your computer and use it in GitHub Desktop.
copilot extsnion.js with logs
This file has been truncated, but you can view the full file.
/*! For license information please see extension.js.LICENSE.txt */
(() => {
var __webpack_modules__ = {
8348: (e) => {
const t =
"object" == typeof performance &&
performance &&
"function" == typeof performance.now
? performance
: Date,
n =
"function" == typeof AbortController
? AbortController
: class {
constructor() {
this.signal = new o();
}
abort() {
this.signal.dispatchEvent("abort");
}
},
r = "function" == typeof AbortSignal,
i = "function" == typeof n.AbortSignal,
o = r
? AbortSignal
: i
? n.AbortController
: class {
constructor() {
(this.aborted = !1), (this._listeners = []);
}
dispatchEvent(e) {
if ("abort" === e) {
this.aborted = !0;
const t = { type: e, target: this };
this.onabort(t), this._listeners.forEach((e) => e(t), this);
}
}
onabort() {}
addEventListener(e, t) {
"abort" === e && this._listeners.push(t);
}
removeEventListener(e, t) {
"abort" === e &&
(this._listeners = this._listeners.filter((e) => e !== t));
}
},
s = new Set(),
a = (e, t) => {
const n = `LRU_CACHE_OPTION_${e}`;
u(n) && p(n, `${e} option`, `options.${t}`, g);
},
c = (e, t) => {
const n = `LRU_CACHE_METHOD_${e}`;
if (u(n)) {
const { prototype: r } = g,
{ get: i } = Object.getOwnPropertyDescriptor(r, e);
p(n, `${e} method`, `cache.${t}()`, i);
}
},
l = (...e) => {
"object" == typeof process &&
process &&
"function" == typeof process.emitWarning
? process.emitWarning(...e)
: console.error(...e);
},
u = (e) => !s.has(e),
p = (e, t, n, r) => {
s.add(e),
l(
`The ${t} is deprecated. Please use ${n} instead.`,
"DeprecationWarning",
e,
r,
);
},
d = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e),
h = (e) =>
d(e)
? e <= Math.pow(2, 8)
? Uint8Array
: e <= Math.pow(2, 16)
? Uint16Array
: e <= Math.pow(2, 32)
? Uint32Array
: e <= Number.MAX_SAFE_INTEGER
? f
: null
: null;
class f extends Array {
constructor(e) {
super(e), this.fill(0);
}
}
class m {
constructor(e) {
if (0 === e) return [];
const t = h(e);
(this.heap = new t(e)), (this.length = 0);
}
push(e) {
this.heap[this.length++] = e;
}
pop() {
return this.heap[--this.length];
}
}
class g {
constructor(e = {}) {
const {
max: t = 0,
ttl: n,
ttlResolution: r = 1,
ttlAutopurge: i,
updateAgeOnGet: o,
updateAgeOnHas: c,
allowStale: p,
dispose: f,
disposeAfter: y,
noDisposeOnSet: _,
noUpdateTTL: v,
maxSize: b = 0,
sizeCalculation: E,
fetchMethod: w,
fetchContext: S,
noDeleteOnFetchRejection: T,
noDeleteOnStaleGet: x,
} = e,
{ length: C, maxAge: I, stale: A } = e instanceof g ? {} : e;
if (0 !== t && !d(t))
throw new TypeError("max option must be a nonnegative integer");
const P = t ? h(t) : Array;
if (!P) throw new Error("invalid max value: " + t);
if (
((this.max = t),
(this.maxSize = b),
(this.sizeCalculation = E || C),
this.sizeCalculation)
) {
if (!this.maxSize)
throw new TypeError(
"cannot set sizeCalculation without setting maxSize",
);
if ("function" != typeof this.sizeCalculation)
throw new TypeError("sizeCalculation set to non-function");
}
if (
((this.fetchMethod = w || null),
this.fetchMethod && "function" != typeof this.fetchMethod)
)
throw new TypeError(
"fetchMethod must be a function if specified",
);
if (((this.fetchContext = S), !this.fetchMethod && void 0 !== S))
throw new TypeError(
"cannot set fetchContext without fetchMethod",
);
if (
((this.keyMap = new Map()),
(this.keyList = new Array(t).fill(null)),
(this.valList = new Array(t).fill(null)),
(this.next = new P(t)),
(this.prev = new P(t)),
(this.head = 0),
(this.tail = 0),
(this.free = new m(t)),
(this.initialFill = 1),
(this.size = 0),
"function" == typeof f && (this.dispose = f),
"function" == typeof y
? ((this.disposeAfter = y), (this.disposed = []))
: ((this.disposeAfter = null), (this.disposed = null)),
(this.noDisposeOnSet = !!_),
(this.noUpdateTTL = !!v),
(this.noDeleteOnFetchRejection = !!T),
0 !== this.maxSize)
) {
if (!d(this.maxSize))
throw new TypeError(
"maxSize must be a positive integer if specified",
);
this.initializeSizeTracking();
}
if (
((this.allowStale = !!p || !!A),
(this.noDeleteOnStaleGet = !!x),
(this.updateAgeOnGet = !!o),
(this.updateAgeOnHas = !!c),
(this.ttlResolution = d(r) || 0 === r ? r : 1),
(this.ttlAutopurge = !!i),
(this.ttl = n || I || 0),
this.ttl)
) {
if (!d(this.ttl))
throw new TypeError(
"ttl must be a positive integer if specified",
);
this.initializeTTLTracking();
}
if (0 === this.max && 0 === this.ttl && 0 === this.maxSize)
throw new TypeError(
"At least one of max, maxSize, or ttl is required",
);
if (!this.ttlAutopurge && !this.max && !this.maxSize) {
const e = "LRU_CACHE_UNBOUNDED";
u(e) &&
(s.add(e),
l(
"TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.",
"UnboundedCacheWarning",
e,
g,
));
}
A && a("stale", "allowStale"),
I && a("maxAge", "ttl"),
C && a("length", "sizeCalculation");
}
getRemainingTTL(e) {
return this.has(e, { updateAgeOnHas: !1 }) ? 1 / 0 : 0;
}
initializeTTLTracking() {
(this.ttls = new f(this.max)),
(this.starts = new f(this.max)),
(this.setItemTTL = (e, n, r = t.now()) => {
if (
((this.starts[e] = 0 !== n ? r : 0),
(this.ttls[e] = n),
0 !== n && this.ttlAutopurge)
) {
const t = setTimeout(() => {
this.isStale(e) && this.delete(this.keyList[e]);
}, n + 1);
t.unref && t.unref();
}
}),
(this.updateItemAge = (e) => {
this.starts[e] = 0 !== this.ttls[e] ? t.now() : 0;
});
let e = 0;
const n = () => {
const n = t.now();
if (this.ttlResolution > 0) {
e = n;
const t = setTimeout(() => (e = 0), this.ttlResolution);
t.unref && t.unref();
}
return n;
};
(this.getRemainingTTL = (t) => {
const r = this.keyMap.get(t);
return void 0 === r
? 0
: 0 === this.ttls[r] || 0 === this.starts[r]
? 1 / 0
: this.starts[r] + this.ttls[r] - (e || n());
}),
(this.isStale = (t) =>
0 !== this.ttls[t] &&
0 !== this.starts[t] &&
(e || n()) - this.starts[t] > this.ttls[t]);
}
updateItemAge(e) {}
setItemTTL(e, t, n) {}
isStale(e) {
return !1;
}
initializeSizeTracking() {
(this.calculatedSize = 0),
(this.sizes = new f(this.max)),
(this.removeItemSize = (e) => {
(this.calculatedSize -= this.sizes[e]), (this.sizes[e] = 0);
}),
(this.requireSize = (e, t, n, r) => {
if (!d(n)) {
if (!r)
throw new TypeError(
"invalid size value (must be positive integer)",
);
if ("function" != typeof r)
throw new TypeError("sizeCalculation must be a function");
if (((n = r(t, e)), !d(n)))
throw new TypeError(
"sizeCalculation return invalid (expect positive integer)",
);
}
return n;
}),
(this.addItemSize = (e, t) => {
this.sizes[e] = t;
const n = this.maxSize - this.sizes[e];
for (; this.calculatedSize > n; ) this.evict(!0);
this.calculatedSize += this.sizes[e];
});
}
removeItemSize(e) {}
addItemSize(e, t) {}
requireSize(e, t, n, r) {
if (n || r)
throw new TypeError(
"cannot set size without setting maxSize on cache",
);
}
*indexes({ allowStale: e = this.allowStale } = {}) {
if (this.size)
for (
let t = this.tail;
this.isValidIndex(t) &&
((!e && this.isStale(t)) || (yield t), t !== this.head);
)
t = this.prev[t];
}
*rindexes({ allowStale: e = this.allowStale } = {}) {
if (this.size)
for (
let t = this.head;
this.isValidIndex(t) &&
((!e && this.isStale(t)) || (yield t), t !== this.tail);
)
t = this.next[t];
}
isValidIndex(e) {
return this.keyMap.get(this.keyList[e]) === e;
}
*entries() {
for (const e of this.indexes())
yield [this.keyList[e], this.valList[e]];
}
*rentries() {
for (const e of this.rindexes())
yield [this.keyList[e], this.valList[e]];
}
*keys() {
for (const e of this.indexes()) yield this.keyList[e];
}
*rkeys() {
for (const e of this.rindexes()) yield this.keyList[e];
}
*values() {
for (const e of this.indexes()) yield this.valList[e];
}
*rvalues() {
for (const e of this.rindexes()) yield this.valList[e];
}
[Symbol.iterator]() {
return this.entries();
}
find(e, t = {}) {
for (const n of this.indexes())
if (e(this.valList[n], this.keyList[n], this))
return this.get(this.keyList[n], t);
}
forEach(e, t = this) {
for (const n of this.indexes())
e.call(t, this.valList[n], this.keyList[n], this);
}
rforEach(e, t = this) {
for (const n of this.rindexes())
e.call(t, this.valList[n], this.keyList[n], this);
}
get prune() {
return c("prune", "purgeStale"), this.purgeStale;
}
purgeStale() {
let e = !1;
for (const t of this.rindexes({ allowStale: !0 }))
this.isStale(t) && (this.delete(this.keyList[t]), (e = !0));
return e;
}
dump() {
const e = [];
for (const n of this.indexes({ allowStale: !0 })) {
const r = this.keyList[n],
i = this.valList[n],
o = {
value: this.isBackgroundFetch(i) ? i.__staleWhileFetching : i,
};
if (this.ttls) {
o.ttl = this.ttls[n];
const e = t.now() - this.starts[n];
o.start = Math.floor(Date.now() - e);
}
this.sizes && (o.size = this.sizes[n]), e.unshift([r, o]);
}
return e;
}
load(e) {
this.clear();
for (const [n, r] of e) {
if (r.start) {
const e = Date.now() - r.start;
r.start = t.now() - e;
}
this.set(n, r.value, r);
}
}
dispose(e, t, n) {}
set(
e,
t,
{
ttl: n = this.ttl,
start: r,
noDisposeOnSet: i = this.noDisposeOnSet,
size: o = 0,
sizeCalculation: s = this.sizeCalculation,
noUpdateTTL: a = this.noUpdateTTL,
} = {},
) {
if (
((o = this.requireSize(e, t, o, s)),
this.maxSize && o > this.maxSize)
)
return this;
let c = 0 === this.size ? void 0 : this.keyMap.get(e);
if (void 0 === c)
(c = this.newIndex()),
(this.keyList[c] = e),
(this.valList[c] = t),
this.keyMap.set(e, c),
(this.next[this.tail] = c),
(this.prev[c] = this.tail),
(this.tail = c),
this.size++,
this.addItemSize(c, o),
(a = !1);
else {
const n = this.valList[c];
t !== n &&
(this.isBackgroundFetch(n)
? n.__abortController.abort()
: i ||
(this.dispose(n, e, "set"),
this.disposeAfter && this.disposed.push([n, e, "set"])),
this.removeItemSize(c),
(this.valList[c] = t),
this.addItemSize(c, o)),
this.moveToTail(c);
}
if (
(0 === n ||
0 !== this.ttl ||
this.ttls ||
this.initializeTTLTracking(),
a || this.setItemTTL(c, n, r),
this.disposeAfter)
)
for (; this.disposed.length; )
this.disposeAfter(...this.disposed.shift());
return this;
}
newIndex() {
return 0 === this.size
? this.tail
: this.size === this.max && 0 !== this.max
? this.evict(!1)
: 0 !== this.free.length
? this.free.pop()
: this.initialFill++;
}
pop() {
if (this.size) {
const e = this.valList[this.head];
return this.evict(!0), e;
}
}
evict(e) {
const t = this.head,
n = this.keyList[t],
r = this.valList[t];
return (
this.isBackgroundFetch(r)
? r.__abortController.abort()
: (this.dispose(r, n, "evict"),
this.disposeAfter && this.disposed.push([r, n, "evict"])),
this.removeItemSize(t),
e &&
((this.keyList[t] = null),
(this.valList[t] = null),
this.free.push(t)),
(this.head = this.next[t]),
this.keyMap.delete(n),
this.size--,
t
);
}
has(e, { updateAgeOnHas: t = this.updateAgeOnHas } = {}) {
const n = this.keyMap.get(e);
return (
void 0 !== n &&
!this.isStale(n) &&
(t && this.updateItemAge(n), !0)
);
}
peek(e, { allowStale: t = this.allowStale } = {}) {
const n = this.keyMap.get(e);
if (void 0 !== n && (t || !this.isStale(n))) {
const e = this.valList[n];
return this.isBackgroundFetch(e) ? e.__staleWhileFetching : e;
}
}
backgroundFetch(e, t, r, i) {
const o = void 0 === t ? void 0 : this.valList[t];
if (this.isBackgroundFetch(o)) return o;
const s = new n(),
a = { signal: s.signal, options: r, context: i },
c = new Promise((t) => t(this.fetchMethod(e, o, a))).then(
(t) => (s.signal.aborted || this.set(e, t, a.options), t),
(n) => {
if (
(this.valList[t] === c &&
(r.noDeleteOnFetchRejection &&
void 0 !== c.__staleWhileFetching
? (this.valList[t] = c.__staleWhileFetching)
: this.delete(e)),
c.__returned === c)
)
throw n;
},
);
return (
(c.__abortController = s),
(c.__staleWhileFetching = o),
(c.__returned = null),
void 0 === t
? (this.set(e, c, a.options), (t = this.keyMap.get(e)))
: (this.valList[t] = c),
c
);
}
isBackgroundFetch(e) {
return (
e &&
"object" == typeof e &&
"function" == typeof e.then &&
Object.prototype.hasOwnProperty.call(e, "__staleWhileFetching") &&
Object.prototype.hasOwnProperty.call(e, "__returned") &&
(e.__returned === e || null === e.__returned)
);
}
async fetch(
e,
{
allowStale: t = this.allowStale,
updateAgeOnGet: n = this.updateAgeOnGet,
noDeleteOnStaleGet: r = this.noDeleteOnStaleGet,
ttl: i = this.ttl,
noDisposeOnSet: o = this.noDisposeOnSet,
size: s = 0,
sizeCalculation: a = this.sizeCalculation,
noUpdateTTL: c = this.noUpdateTTL,
noDeleteOnFetchRejection: l = this.noDeleteOnFetchRejection,
fetchContext: u = this.fetchContext,
forceRefresh: p = !1,
} = {},
) {
if (!this.fetchMethod)
return this.get(e, {
allowStale: t,
updateAgeOnGet: n,
noDeleteOnStaleGet: r,
});
const d = {
allowStale: t,
updateAgeOnGet: n,
noDeleteOnStaleGet: r,
ttl: i,
noDisposeOnSet: o,
size: s,
sizeCalculation: a,
noUpdateTTL: c,
noDeleteOnFetchRejection: l,
};
let h = this.keyMap.get(e);
if (void 0 === h) {
const t = this.backgroundFetch(e, h, d, u);
return (t.__returned = t);
}
{
const r = this.valList[h];
if (this.isBackgroundFetch(r))
return t && void 0 !== r.__staleWhileFetching
? r.__staleWhileFetching
: (r.__returned = r);
if (!p && !this.isStale(h))
return this.moveToTail(h), n && this.updateItemAge(h), r;
const i = this.backgroundFetch(e, h, d, u);
return t && void 0 !== i.__staleWhileFetching
? i.__staleWhileFetching
: (i.__returned = i);
}
}
get(
e,
{
allowStale: t = this.allowStale,
updateAgeOnGet: n = this.updateAgeOnGet,
noDeleteOnStaleGet: r = this.noDeleteOnStaleGet,
} = {},
) {
const i = this.keyMap.get(e);
if (void 0 !== i) {
const o = this.valList[i],
s = this.isBackgroundFetch(o);
if (this.isStale(i))
return s
? t
? o.__staleWhileFetching
: void 0
: (r || this.delete(e), t ? o : void 0);
if (s) return;
return this.moveToTail(i), n && this.updateItemAge(i), o;
}
}
connect(e, t) {
(this.prev[t] = e), (this.next[e] = t);
}
moveToTail(e) {
e !== this.tail &&
(e === this.head
? (this.head = this.next[e])
: this.connect(this.prev[e], this.next[e]),
this.connect(this.tail, e),
(this.tail = e));
}
get del() {
return c("del", "delete"), this.delete;
}
delete(e) {
let t = !1;
if (0 !== this.size) {
const n = this.keyMap.get(e);
if (void 0 !== n)
if (((t = !0), 1 === this.size)) this.clear();
else {
this.removeItemSize(n);
const t = this.valList[n];
this.isBackgroundFetch(t)
? t.__abortController.abort()
: (this.dispose(t, e, "delete"),
this.disposeAfter &&
this.disposed.push([t, e, "delete"])),
this.keyMap.delete(e),
(this.keyList[n] = null),
(this.valList[n] = null),
n === this.tail
? (this.tail = this.prev[n])
: n === this.head
? (this.head = this.next[n])
: ((this.next[this.prev[n]] = this.next[n]),
(this.prev[this.next[n]] = this.prev[n])),
this.size--,
this.free.push(n);
}
}
if (this.disposed)
for (; this.disposed.length; )
this.disposeAfter(...this.disposed.shift());
return t;
}
clear() {
for (const e of this.rindexes({ allowStale: !0 })) {
const t = this.valList[e];
if (this.isBackgroundFetch(t)) t.__abortController.abort();
else {
const n = this.keyList[e];
this.dispose(t, n, "delete"),
this.disposeAfter && this.disposed.push([t, n, "delete"]);
}
}
if (
(this.keyMap.clear(),
this.valList.fill(null),
this.keyList.fill(null),
this.ttls && (this.ttls.fill(0), this.starts.fill(0)),
this.sizes && this.sizes.fill(0),
(this.head = 0),
(this.tail = 0),
(this.initialFill = 1),
(this.free.length = 0),
(this.calculatedSize = 0),
(this.size = 0),
this.disposed)
)
for (; this.disposed.length; )
this.disposeAfter(...this.disposed.shift());
}
get reset() {
return c("reset", "clear"), this.clear;
}
get length() {
return (
((e, t) => {
const n = `LRU_CACHE_PROPERTY_${e}`;
if (u(n)) {
const { prototype: t } = g,
{ get: r } = Object.getOwnPropertyDescriptor(t, e);
p(n, `${e} property`, "cache.size", r);
}
})("length"),
this.size
);
}
static get AbortController() {
return n;
}
static get AbortSignal() {
return o;
}
}
e.exports = g;
},
99407: (e, t, n) => {
"use strict";
const { randomBytes: r } = n(6113),
{ Readable: i } = n(12781),
o = (e) =>
"object" == typeof e &&
0 ===
["arrayBuffer", "stream", "text", "slice", "constructor"]
.map((t) => typeof e[t])
.filter((e) => "function" !== e).length &&
"string" == typeof e.type &&
"number" == typeof e.size &&
/^(Blob|File)$/.test(e[Symbol.toStringTag]),
s = (e) => `--${e}--\r\n\r\n`,
a = (e, t, n) => {
let r = "";
return (
(r += `--${e}\r\n`),
(r += `Content-Disposition: form-data; name="${t}"`),
o(n) &&
((r += `; filename="${n.name}"\r\n`),
(r += `Content-Type: ${n.type || "application/octet-stream"}`)),
`${r}\r\n\r\n`
);
};
e.exports = {
isFormData: (e) =>
null != e &&
"object" == typeof e &&
0 ===
[
"append",
"delete",
"get",
"getAll",
"has",
"set",
"keys",
"values",
"entries",
"constructor",
]
.map((t) => typeof e[t])
.filter((e) => "function" !== e).length &&
"FormData" === e[Symbol.toStringTag],
FormDataSerializer: class {
constructor(e) {
(this.fd = e), (this.boundary = r(8).toString("hex"));
}
length() {
return (
void 0 === this._length &&
(this._length = ((e, t) => {
let n = 0;
for (const [r, i] of e)
(n += Buffer.byteLength(a(t, r, i))),
(n += o(i) ? i.size : Buffer.byteLength(String(i))),
(n += Buffer.byteLength("\r\n"));
return (n += Buffer.byteLength(s(t))), n;
})(this.fd, this.boundary)),
this._length
);
}
contentType() {
return `multipart/form-data; boundary=${this.boundary}`;
}
stream() {
return i.from(
(async function* (e, t) {
for (const [n, r] of e)
yield a(t, n, r),
o(r) ? yield* r.stream() : yield r,
yield "\r\n";
yield s(t);
})(this.fd, this.boundary),
);
}
},
};
},
4544: (e, t, n) => {
"use strict";
const {
constants: { MAX_LENGTH: r },
} = n(14300),
{ pipeline: i, PassThrough: o } = n(12781),
{ promisify: s } = n(73837),
{
createGunzip: a,
createInflate: c,
createBrotliDecompress: l,
constants: { Z_SYNC_FLUSH: u },
} = n(59796),
p = n(15158)("helix-fetch:utils"),
d = s(i),
h = (e, t) => {
if (Buffer.isBuffer(e)) return e.length;
switch (typeof e) {
case "string":
return 2 * e.length;
case "boolean":
return 4;
case "number":
return 8;
case "symbol":
return Symbol.keyFor(e)
? 2 * Symbol.keyFor(e).length
: 2 * (e.toString().length - 8);
case "object":
return Array.isArray(e) ? f(e, t) : m(e, t);
default:
return 0;
}
},
f = (e, t) => (
t.add(e),
e.map((e) => (t.has(e) ? 0 : h(e, t))).reduce((e, t) => e + t, 0)
),
m = (e, t) => {
if (null == e) return 0;
t.add(e);
let n = 0;
const r = [];
for (const t in e) r.push(t);
return (
r.push(...Object.getOwnPropertySymbols(e)),
r.forEach((r) => {
if (
((n += h(r, t)), "object" == typeof e[r] && null !== e[r])
) {
if (t.has(e[r])) return;
t.add(e[r]);
}
n += h(e[r], t);
}),
n
);
};
e.exports = {
decodeStream: (e, t, n, r) => {
if (
!((e, t) =>
204 !== e &&
304 !== e &&
0 != +t["content-length"] &&
/^\s*(?:(x-)?deflate|(x-)?gzip|br)\s*$/.test(
t["content-encoding"],
))(e, t)
)
return n;
const o = (e) => {
e && (p(`encountered error while decoding stream: ${e}`), r(e));
};
switch (t["content-encoding"].trim()) {
case "gzip":
case "x-gzip":
return i(n, a({ flush: u, finishFlush: u }), o);
case "deflate":
case "x-deflate":
return i(n, c(), o);
case "br":
return i(n, l(), o);
default:
return n;
}
},
isPlainObject: (e) => {
if (!e || "object" != typeof e) return !1;
if ("[object Object]" !== Object.prototype.toString.call(e))
return !1;
if (null === Object.getPrototypeOf(e)) return !0;
let t = e;
for (; null !== Object.getPrototypeOf(t); )
t = Object.getPrototypeOf(t);
return Object.getPrototypeOf(e) === t;
},
sizeof: (e) => h(e, new WeakSet()),
streamToBuffer: async (e) => {
const t = new o();
let n = 0;
const i = [];
return (
t.on("data", (e) => {
if (n + e.length > r)
throw new Error("Buffer.constants.MAX_SIZE exceeded");
i.push(e), (n += e.length);
}),
await d(e, t),
Buffer.concat(i, n)
);
},
};
},
1787: (e) => {
"use strict";
class t extends Error {
get name() {
return this.constructor.name;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
}
e.exports = { RequestAbortedError: t };
},
49803: (e, t, n) => {
"use strict";
const r = n(13685),
i = n(95687),
{ Readable: o } = n(12781),
s = n(15158)("helix-fetch:h1"),
{ RequestAbortedError: a } = n(1787),
{ decodeStream: c } = n(4544);
e.exports = {
request: async (e, t, n) => {
const { request: l } = "https:" === t.protocol ? i : r,
u = ((e, t) => {
const {
h1: n,
options: { h1: o, rejectUnauthorized: s },
} = e;
return "https:" === t
? n.httpsAgent
? n.httpsAgent
: o || "boolean" == typeof s
? ((n.httpsAgent = new i.Agent(
"boolean" == typeof s
? { ...(o || {}), rejectUnauthorized: s }
: o,
)),
n.httpsAgent)
: void 0
: n.httpAgent
? n.httpAgent
: o
? ((n.httpAgent = new r.Agent(o)), n.httpAgent)
: void 0;
})(e, t.protocol),
p = { ...n, agent: u },
{ socket: d, body: h } = p;
return (
d &&
(delete p.socket,
d.assigned ||
((d.assigned = !0),
u
? (p.agent = new Proxy(u, {
get: (e, t) =>
"createConnection" !== t || d.inUse
? e[t]
: (e, t) => {
s(
`agent reusing socket #${d.id} (${d.servername})`,
),
(d.inUse = !0),
t(null, d);
},
}))
: (p.createConnection = (e, t) => {
s(`reusing socket #${d.id} (${d.servername})`),
(d.inUse = !0),
t(null, d);
}))),
new Promise((e, n) => {
let r;
s(`${p.method} ${t.href}`);
const { signal: i } = p,
u = () => {
i.removeEventListener("abort", u),
d &&
!d.inUse &&
(s(
`discarding redundant socket used for ALPN: #${d.id} ${d.servername}`,
),
d.destroy()),
n(new a()),
r && r.abort();
};
if (i) {
if (i.aborted) return void n(new a());
i.addEventListener("abort", u);
}
(r = l(t, p)),
r.once("response", (t) => {
i && i.removeEventListener("abort", u),
d &&
!d.inUse &&
(s(
`discarding redundant socket used for ALPN: #${d.id} ${d.servername}`,
),
d.destroy()),
e(
((e, t, n) => {
const {
statusCode: r,
statusMessage: i,
httpVersion: o,
httpVersionMajor: s,
httpVersionMinor: a,
headers: l,
} = e,
u = t ? c(r, l, e, n) : e;
return {
statusCode: r,
statusText: i,
httpVersion: o,
httpVersionMajor: s,
httpVersionMinor: a,
headers: l,
readable: u,
decoded: !(!t || u === e),
};
})(t, p.decode, n),
);
}),
r.once("error", (e) => {
i && i.removeEventListener("abort", u),
d &&
!d.inUse &&
(s(
`discarding redundant socket used for ALPN: #${d.id} ${d.servername}`,
),
d.destroy()),
r.aborted ||
(s(`${p.method} ${t.href} failed with: ${e.message}`),
r.abort(),
n(e));
}),
h instanceof o ? h.pipe(r) : (h && r.write(h), r.end());
})
);
},
setupContext: (e) => {
e.h1 = {};
},
resetContext: async ({ h1: e }) => {
e.httpAgent &&
(s("resetContext: destroying httpAgent"),
e.httpAgent.destroy(),
delete e.httpAgent),
e.httpsAgent &&
(s("resetContext: destroying httpsAgent"),
e.httpsAgent.destroy(),
delete e.httpsAgent);
},
};
},
97262: (e, t, n) => {
"use strict";
const { connect: r, constants: i } = n(85158),
{ Readable: o } = n(12781),
s = n(15158)("helix-fetch:h2"),
{ RequestAbortedError: a } = n(1787),
{ decodeStream: c } = n(4544),
{ NGHTTP2_CANCEL: l } = i,
u = 3e5,
p = 5e3,
d = (e, t, n, r = () => {}) => {
const i = { ...e },
o = i[":status"];
delete i[":status"];
const s = n ? c(o, e, t, r) : t;
return {
statusCode: o,
statusText: "",
httpVersion: "2.0",
httpVersionMajor: 2,
httpVersionMinor: 0,
headers: i,
readable: s,
decoded: !(!n || s === t),
};
};
e.exports = {
request: async (e, t, n) => {
const { origin: i, pathname: c, search: h, hash: f } = t,
m = `${c}${h}${f}`,
{
options: { h2: g = {} },
h2: { sessionCache: y },
} = e,
{
idleSessionTimeout: _ = u,
pushPromiseHandler: v,
pushHandler: b,
} = g,
E = { ...n },
{ method: w, headers: S, socket: T, body: x, decode: C } = E;
return (
T && delete E.socket,
S.host && ((S[":authority"] = S.host), delete S.host),
new Promise((n, c) => {
let u,
h = y[i];
if (!h || h.closed || h.destroyed) {
const t = !(
!1 === e.options.rejectUnauthorized ||
!1 === g.rejectUnauthorized
),
n = { ...g, rejectUnauthorized: t };
T &&
!T.inUse &&
(n.createConnection = () => (
s(`reusing socket #${T.id} (${T.servername})`),
(T.inUse = !0),
T
));
const o = !(!v && !b);
(h = r(i, { ...n, settings: { enablePush: o } })),
h.setMaxListeners(1e3),
h.setTimeout(_, () => {
s(`closing session ${i} after ${_} ms of inactivity`),
h.close();
}),
h.once("connect", () => {
s(`session ${i} established`),
s(`caching session ${i}`),
(y[i] = h);
}),
h.on("localSettings", (e) => {
s(`session ${i} localSettings: ${JSON.stringify(e)}`);
}),
h.on("remoteSettings", (e) => {
s(`session ${i} remoteSettings: ${JSON.stringify(e)}`);
}),
h.once("close", () => {
s(`session ${i} closed`),
y[i] === h &&
(s(`discarding cached session ${i}`), delete y[i]);
}),
h.once("error", (e) => {
s(`session ${i} encountered error: ${e}`),
y[i] === h &&
(s(`discarding cached session ${i}`), delete y[i]);
}),
h.on("frameError", (e, t, n) => {
s(
`session ${i} encountered frameError: type: ${e}, code: ${t}, id: ${n}`,
);
}),
h.once("goaway", (e, t, n) => {
s(
`session ${i} received GOAWAY frame: errorCode: ${e}, lastStreamID: ${t}, opaqueData: ${
n ? n.toString() : void 0
}`,
);
}),
h.on("stream", (t, n, r) => {
((e, t, n, r, i, o) => {
const {
options: {
h2: {
pushPromiseHandler: a,
pushHandler: c,
pushedStreamIdleTimeout: u = p,
},
},
} = e,
h = i[":path"],
f = `${t}${h}`;
s(
`received PUSH_PROMISE: ${f}, stream #${
r.id
}, headers: ${JSON.stringify(i)}, flags: ${o}`,
),
a &&
a(f, i, () => {
r.close(l);
}),
r.on("push", (e, o) => {
s(
`received push headers for ${t}${h}, stream #${
r.id
}, headers: ${JSON.stringify(e)}, flags: ${o}`,
),
r.setTimeout(u, () => {
s(
`closing pushed stream #${r.id} after ${u} ms of inactivity`,
),
r.close(l);
}),
c && c(f, i, d(e, r, n));
}),
r.on("aborted", () => {
s(`pushed stream #${r.id} aborted`);
}),
r.on("error", (e) => {
s(`pushed stream #${r.id} encountered error: ${e}`);
}),
r.on("frameError", (e, t, n) => {
s(
`pushed stream #${r.id} encountered frameError: type: ${e}, code: ${t}, id: ${n}`,
);
});
})(e, i, C, t, n, r);
});
} else
T &&
T.id !== h.socket.id &&
!T.inUse &&
(s(
`discarding redundant socket used for ALPN: #${T.id} ${T.servername}`,
),
T.destroy());
s(`${w} ${t.host}${m}`);
const { signal: f } = E,
I = () => {
f.removeEventListener("abort", I),
c(new a()),
u && u.close(l);
};
if (f) {
if (f.aborted) return void c(new a());
f.addEventListener("abort", I);
}
const A = (e) => {
s(
`session ${i} encountered error during ${E.method} ${t.href}: ${e}`,
),
c(e);
};
h.once("error", A),
(u = h.request({ ":method": w, ":path": m, ...S })),
u.once("response", (e) => {
h.off("error", A),
f && f.removeEventListener("abort", I),
n(d(e, u, E.decode, c));
}),
u.once("error", (e) => {
h.off("error", A),
f && f.removeEventListener("abort", I),
u.rstCode !== l &&
(s(`${E.method} ${t.href} failed with: ${e.message}`),
u.close(l),
c(e));
}),
u.once("frameError", (e, n, r) => {
h.off("error", A),
s(
`encountered frameError during ${E.method} ${t.href}: type: ${e}, code: ${n}, id: ${r}`,
);
}),
u.on("push", (e, t) => {
s(
`received 'push' event: headers: ${JSON.stringify(
e,
)}, flags: ${t}`,
);
}),
x instanceof o ? x.pipe(u) : (x && u.write(x), u.end());
})
);
},
setupContext: (e) => {
e.h2 = { sessionCache: {} };
},
resetContext: async ({ h2: e }) =>
Promise.all(
Object.values(e.sessionCache).map(
(e) =>
new Promise((t) => {
e.on("close", t),
s(
`resetContext: destroying session (socket #${
e.socket && e.socket.id
}, ${e.socket && e.socket.servername})`,
),
e.destroy();
}),
),
),
};
},
33100: (e, t, n) => {
"use strict";
const r = n(15158)("helix-fetch:core"),
{
request: i,
setupContext: o,
resetContext: s,
RequestAbortedError: a,
ALPN_HTTP2: c,
ALPN_HTTP2C: l,
ALPN_HTTP1_1: u,
ALPN_HTTP1_0: p,
} = n(9575);
class d {
constructor(e) {
(this.options = { ...(e || {}) }), o(this);
}
api() {
return {
request: async (e, t) => this.request(e, t),
context: (e = {}) => new d(e).api(),
setCA: (e) => this.setCA(e),
reset: async () => this.reset(),
RequestAbortedError: a,
ALPN_HTTP2: c,
ALPN_HTTP2C: l,
ALPN_HTTP1_1: u,
ALPN_HTTP1_0: p,
};
}
async request(e, t) {
return i(this, e, t);
}
setCA(e) {
this.options.ca = e;
}
async reset() {
return r("resetting context"), s(this);
}
}
e.exports = new d().api();
},
43769: (e, t, n) => {
"use strict";
const { EventEmitter: r } = n(82361);
e.exports = () => {
const e = {},
t = new r();
return (
t.setMaxListeners(0),
{
acquire: (n) =>
new Promise((r) => {
if (!e[n]) return (e[n] = !0), void r();
const i = (o) => {
e[n] || ((e[n] = !0), t.removeListener(n, i), r(o));
};
t.on(n, i);
}),
release: (n, r) => {
Reflect.deleteProperty(e, n), setImmediate(() => t.emit(n, r));
},
}
);
};
},
9575: (e, t, n) => {
"use strict";
const { Readable: r } = n(12781),
i = n(24404),
{
types: { isAnyArrayBuffer: o },
} = n(73837),
s = n(8348),
a = n(15158)("helix-fetch:core"),
{ RequestAbortedError: c } = n(1787),
l = n(49803),
u = n(97262),
p = n(43769),
{ isPlainObject: d } = n(4544),
{ isFormData: h, FormDataSerializer: f } = n(99407),
{ version: m } = n(55258),
g = "h2",
y = "h2c",
_ = "http/1.0",
v = "http/1.1",
b = 100,
E = 36e5,
w = [g, v, _],
S = `helix-fetch/${m}`,
T = { method: "GET", compress: !0, decode: !0 };
let x = 0;
const C = p(),
I = (e, t) =>
new Promise((n, r) => {
const { signal: o } = t;
let s;
const l = () => {
o.removeEventListener("abort", l);
const e = new c();
r(e), s && s.destroy(e);
};
if (o) {
if (o.aborted) return void r(new c());
o.addEventListener("abort", l);
}
const u = +e.port || 443,
p = (t) => {
o && o.removeEventListener("abort", l),
t instanceof c ||
(a(
`connecting to ${e.hostname}:${u} failed with: ${t.message}`,
),
r(t));
};
(s = i.connect(u, e.hostname, t)),
s.once("secureConnect", () => {
o && o.removeEventListener("abort", l),
s.off("error", p),
(x += 1),
(s.id = x),
(s.secureConnecting = !1),
a(`established TLS connection: #${s.id} (${s.servername})`),
n(s);
}),
s.once("error", p);
});
e.exports = {
request: async (e, t, n) => {
const i = new URL(t),
s = { ...T, ...(n || {}) };
let c;
if (
("string" == typeof s.method &&
(s.method = s.method.toUpperCase()),
(s.headers = ((e) => {
const t = {};
return (
Object.keys(e).forEach((n) => {
t[n.toLowerCase()] = e[n];
}),
t
);
})(s.headers || {})),
void 0 === s.headers.host && (s.headers.host = i.host),
e.userAgent &&
void 0 === s.headers["user-agent"] &&
(s.headers["user-agent"] = e.userAgent),
s.body instanceof URLSearchParams)
)
(c = "application/x-www-form-urlencoded; charset=utf-8"),
(s.body = s.body.toString());
else if (h(s.body)) {
const e = new f(s.body);
(c = e.contentType()),
(s.body = e.stream()),
void 0 === s.headers["transfer-encoding"] &&
void 0 === s.headers["content-length"] &&
(s.headers["content-length"] = String(e.length()));
} else
"string" == typeof s.body || s.body instanceof String
? (c = "text/plain; charset=utf-8")
: d(s.body)
? ((s.body = JSON.stringify(s.body)), (c = "application/json"))
: o(s.body) && (s.body = Buffer.from(s.body));
void 0 === s.headers["content-type"] &&
void 0 !== c &&
(s.headers["content-type"] = c),
null != s.body &&
(s.body instanceof r ||
("string" == typeof s.body ||
s.body instanceof String ||
Buffer.isBuffer(s.body) ||
(s.body = String(s.body)),
void 0 === s.headers["transfer-encoding"] &&
void 0 === s.headers["content-length"] &&
(s.headers["content-length"] = String(
Buffer.isBuffer(s.body)
? s.body.length
: Buffer.byteLength(s.body, "utf-8"),
)))),
void 0 === s.headers.accept && (s.headers.accept = "*/*"),
null == s.body &&
["POST", "PUT"].includes(s.method) &&
(s.headers["content-length"] = "0"),
s.compress &&
void 0 === s.headers["accept-encoding"] &&
(s.headers["accept-encoding"] = "gzip,deflate,br");
const { signal: p } = s,
{ protocol: m, socket: b = null } = e.socketFactory
? await (async (e, t, n, r) => {
const i = "https:" === t.protocol;
let o;
o = t.port ? t.port : i ? 443 : 80;
const s = { ...n, host: t.host, port: o },
a = await e(s);
if (i) {
const e = { ...s, ALPNProtocols: r };
(e.socket = a), (e.servername = s.host);
const n = await I(t, e);
return { protocol: n.alpnProtocol || v, socket: n };
}
return { protocol: a.alpnProtocol || v, socket: a };
})(e.socketFactory, i, s, e.alpnProtocols)
: await (async (e, t, n) => {
const r = `${t.protocol}//${t.host}`;
let i = e.alpnCache.get(r);
if (i) return { protocol: i };
switch (t.protocol) {
case "http:":
return (i = v), e.alpnCache.set(r, i), { protocol: i };
case "http2:":
return (i = y), e.alpnCache.set(r, i), { protocol: i };
case "https:":
break;
default:
throw new TypeError(
`unsupported protocol: ${t.protocol}`,
);
}
const {
options: {
rejectUnauthorized: o,
h1: s = {},
h2: a = {},
},
} = e,
c = !(
!1 === o ||
!1 === s.rejectUnauthorized ||
!1 === a.rejectUnauthorized
),
l = {
servername: t.hostname,
ALPNProtocols: e.alpnProtocols,
signal: n,
rejectUnauthorized: c,
};
e.options.ca && (l.ca = e.options.ca);
const u = await (async (e, t) => {
let n = await C.acquire(e.origin);
try {
return n || (n = await I(e, t)), n;
} finally {
C.release(e.origin, n);
}
})(t, l);
return (
(i = u.alpnProtocol),
i || (i = v),
e.alpnCache.set(r, i),
{ protocol: i, socket: u }
);
})(e, i, p);
switch ((a(`${i.host} -> ${m}`), m)) {
case g:
try {
return await u.request(e, i, b ? { ...s, socket: b } : s);
} catch (t) {
const { code: n, message: r } = t;
throw (
("ERR_HTTP2_ERROR" === n &&
"Protocol error" === r &&
e.alpnCache.delete(`${i.protocol}//${i.host}`),
t)
);
}
case y:
return u.request(
e,
new URL(`http://${i.host}${i.pathname}${i.hash}${i.search}`),
b ? { ...s, socket: b } : s,
);
case _:
case v:
return l.request(e, i, b ? { ...s, socket: b } : s);
default:
throw new TypeError(`unsupported protocol: ${m}`);
}
},
setupContext: (e) => {
const {
options: {
alpnProtocols: t = w,
alpnCacheTTL: n = E,
alpnCacheSize: r = b,
userAgent: i = S,
socketFactory: o,
},
} = e;
(e.alpnProtocols = t),
(e.alpnCache = new s({ max: r, ttl: n })),
(e.userAgent = i),
(e.socketFactory = o),
l.setupContext(e),
u.setupContext(e);
},
resetContext: async (e) => (
e.alpnCache.clear(),
Promise.all([l.resetContext(e), u.resetContext(e)])
),
RequestAbortedError: c,
ALPN_HTTP2: g,
ALPN_HTTP2C: y,
ALPN_HTTP1_1: v,
ALPN_HTTP1_0: _,
};
},
96829: (e, t, n) => {
"use strict";
const { EventEmitter: r } = n(82361),
i = Symbol("AbortSignal internals");
class o {
constructor() {
this[i] = { eventEmitter: new r(), onabort: null, aborted: !1 };
}
get aborted() {
return this[i].aborted;
}
get onabort() {
return this[i].onabort;
}
set onabort(e) {
this[i].onabort = e;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
removeEventListener(e, t) {
this[i].eventEmitter.removeListener(e, t);
}
addEventListener(e, t) {
this[i].eventEmitter.on(e, t);
}
dispatchEvent(e) {
const t = { type: e, target: this },
n = `on${e}`;
"function" == typeof this[i][n] && this[n](t),
this[i].eventEmitter.emit(e, t);
}
fire() {
(this[i].aborted = !0), this.dispatchEvent("abort");
}
}
Object.defineProperties(o.prototype, {
addEventListener: { enumerable: !0 },
removeEventListener: { enumerable: !0 },
dispatchEvent: { enumerable: !0 },
aborted: { enumerable: !0 },
onabort: { enumerable: !0 },
});
class s extends o {
constructor(e) {
if (!Number.isInteger(e))
throw new TypeError("Expected an integer, got " + typeof e);
super(),
(this[i].timerId = setTimeout(() => {
this.fire();
}, e));
}
clear() {
clearTimeout(this[i].timerId);
}
}
Object.defineProperties(s.prototype, { clear: { enumerable: !0 } });
const a = Symbol("AbortController internals");
class c {
constructor() {
this[a] = { signal: new o() };
}
get signal() {
return this[a].signal;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
abort() {
this[a].signal.aborted || this[a].signal.fire();
}
}
Object.defineProperties(c.prototype, {
signal: { enumerable: !0 },
abort: { enumerable: !0 },
}),
(e.exports = {
AbortController: c,
AbortSignal: o,
TimeoutSignal: s,
});
},
95600: (e, t, n) => {
"use strict";
const { PassThrough: r, Readable: i } = n(12781),
{
types: { isAnyArrayBuffer: o },
} = n(73837),
{ FetchError: s, FetchBaseError: a } = n(63683),
{ streamToBuffer: c } = n(4544),
l = Buffer.alloc(0),
u = Symbol("Body internals"),
p = async (e) => {
if (e[u].disturbed) throw new TypeError("Already read");
if (e[u].error)
throw new TypeError(`Stream had error: ${e[u].error.message}`);
e[u].disturbed = !0;
const { stream: t } = e[u];
return null === t ? l : c(t);
};
class d {
constructor(e) {
let t;
(t =
null == e
? null
: e instanceof URLSearchParams
? i.from(e.toString())
: e instanceof i
? e
: Buffer.isBuffer(e)
? i.from(e)
: o(e)
? i.from(Buffer.from(e))
: "string" == typeof e || e instanceof String
? i.from(e)
: i.from(String(e))),
(this[u] = { stream: t, disturbed: !1, error: null }),
e instanceof i &&
t.on("error", (e) => {
const t =
e instanceof a
? e
: new s(
`Invalid response body while trying to fetch ${this.url}: ${e.message}`,
"system",
e,
);
this[u].error = t;
});
}
get body() {
return this[u].stream;
}
get bodyUsed() {
return this[u].disturbed;
}
async buffer() {
return p(this);
}
async arrayBuffer() {
return (e = await this.buffer()).buffer.slice(
e.byteOffset,
e.byteOffset + e.byteLength,
);
var e;
}
async text() {
return (await p(this)).toString();
}
async json() {
return JSON.parse(await this.text());
}
}
Object.defineProperties(d.prototype, {
body: { enumerable: !0 },
bodyUsed: { enumerable: !0 },
arrayBuffer: { enumerable: !0 },
json: { enumerable: !0 },
text: { enumerable: !0 },
}),
(e.exports = {
Body: d,
cloneStream: (e) => {
if (e[u].disturbed)
throw new TypeError("Cannot clone: already read");
const { stream: t } = e[u];
let n = t;
if (t instanceof i) {
n = new r();
const i = new r();
t.pipe(n), t.pipe(i), (e[u].stream = i);
}
return n;
},
guessContentType: (e) =>
null === e
? null
: "string" == typeof e
? "text/plain; charset=utf-8"
: e instanceof URLSearchParams
? "application/x-www-form-urlencoded; charset=utf-8"
: Buffer.isBuffer(e) || o(e) || e instanceof i
? null
: "text/plain; charset=utf-8",
});
},
42500: (e, t, n) => {
"use strict";
const { Readable: r } = n(12781),
{ Headers: i } = n(9872),
{ Response: o } = n(2981),
s = Symbol("CacheableResponse internals");
class a extends o {
constructor(e, t) {
super(e, t);
const n = new i(t.headers);
this[s] = { headers: n, bufferedBody: e };
}
get headers() {
return this[s].headers;
}
set headers(e) {
if (!(e instanceof i))
throw new TypeError("instance of Headers expected");
this[s].headers = e;
}
get body() {
return r.from(this[s].bufferedBody);
}
get bodyUsed() {
return !1;
}
async buffer() {
return this[s].bufferedBody;
}
async arrayBuffer() {
return (e = this[s].bufferedBody).buffer.slice(
e.byteOffset,
e.byteOffset + e.byteLength,
);
var e;
}
async text() {
return this[s].bufferedBody.toString();
}
async json() {
return JSON.parse(await this.text());
}
clone() {
const {
url: e,
status: t,
statusText: n,
headers: r,
httpVersion: i,
decoded: o,
counter: c,
} = this;
return new a(this[s].bufferedBody, {
url: e,
status: t,
statusText: n,
headers: r,
httpVersion: i,
decoded: o,
counter: c,
});
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
}
e.exports = {
cacheableResponse: async (e) => {
const t = await e.buffer(),
{
url: n,
status: r,
statusText: i,
headers: o,
httpVersion: s,
decoded: c,
counter: l,
} = e;
return new a(t, {
url: n,
status: r,
statusText: i,
headers: o,
httpVersion: s,
decoded: c,
counter: l,
});
},
};
},
63683: (e) => {
"use strict";
class t extends Error {
constructor(e, t) {
super(e), (this.type = t);
}
get name() {
return this.constructor.name;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
}
e.exports = {
FetchBaseError: t,
FetchError: class extends t {
constructor(e, t, n) {
super(e, t),
n &&
((this.code = n.code),
(this.errno = n.errno),
(this.erroredSysCall = n.syscall));
}
},
AbortError: class extends t {
constructor(e, t = "aborted") {
super(e, t);
}
},
};
},
9872: (e, t, n) => {
"use strict";
const { validateHeaderName: r, validateHeaderValue: i } = n(13685),
{ isPlainObject: o } = n(4544),
s = Symbol("Headers internals"),
a = (e) => {
const t = "string" != typeof e ? String(e) : e;
if ("function" == typeof r) r(t);
else if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)) {
const e = new TypeError(
`Header name must be a valid HTTP token [${t}]`,
);
throw (
(Object.defineProperty(e, "code", {
value: "ERR_INVALID_HTTP_TOKEN",
}),
e)
);
}
return t.toLowerCase();
},
c = (e, t) => {
const n = "string" != typeof e ? String(e) : e;
if ("function" == typeof i) i(t, n);
else if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(n)) {
const e = new TypeError(
`Invalid character in header content ["${t}"]`,
);
throw (
(Object.defineProperty(e, "code", {
value: "ERR_INVALID_CHAR",
}),
e)
);
}
return n;
};
class l {
constructor(e = {}) {
if (((this[s] = { map: new Map() }), e instanceof l))
e.forEach((e, t) => {
this.append(t, e);
});
else if (Array.isArray(e))
e.forEach(([e, t]) => {
this.append(e, t);
});
else if (o(e))
for (const [t, n] of Object.entries(e)) this.append(t, n);
}
set(e, t) {
this[s].map.set(a(e), c(t, e));
}
has(e) {
return this[s].map.has(a(e));
}
get(e) {
const t = this[s].map.get(a(e));
return void 0 === t ? null : t;
}
append(e, t) {
const n = a(e),
r = c(t, e),
i = this[s].map.get(n);
this[s].map.set(n, i ? `${i}, ${r}` : r);
}
delete(e) {
this[s].map.delete(a(e));
}
forEach(e, t) {
for (const n of this.keys()) e.call(t, this.get(n), n);
}
keys() {
return Array.from(this[s].map.keys()).sort();
}
*values() {
for (const e of this.keys()) yield this.get(e);
}
*entries() {
for (const e of this.keys()) yield [e, this.get(e)];
}
[Symbol.iterator]() {
return this.entries();
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
plain() {
return Object.fromEntries(this[s].map);
}
}
Object.defineProperties(
l.prototype,
[
"append",
"delete",
"entries",
"forEach",
"get",
"has",
"keys",
"set",
"values",
].reduce((e, t) => ((e[t] = { enumerable: !0 }), e), {}),
),
(e.exports = { Headers: l });
},
56143: (e, t, n) => {
"use strict";
const { EventEmitter: r } = n(82361),
{ Readable: i } = n(12781),
o = n(15158)("helix-fetch"),
s = n(8348),
{ Body: a } = n(95600),
{ Headers: c } = n(9872),
{ Request: l } = n(48359),
{ Response: u } = n(2981),
{ FetchBaseError: p, FetchError: d, AbortError: h } = n(63683),
{ AbortController: f, AbortSignal: m, TimeoutSignal: g } = n(96829),
y = n(24193),
{ cacheableResponse: _ } = n(42500),
{ sizeof: v } = n(4544),
{ isFormData: b } = n(99407),
{ context: E, RequestAbortedError: w } = n(33100),
S = ["GET", "HEAD"],
T = "push",
x = async (e, t, n) => {
const { request: r } = e.context,
o = t instanceof l && void 0 === n ? t : new l(t, n),
{
method: s,
body: a,
signal: p,
compress: f,
decode: m,
follow: g,
redirect: y,
init: { body: _ },
} = o;
let v;
if (p && p.aborted) {
const e = new h("The operation was aborted.");
throw (o.init.body instanceof i && o.init.body.destroy(e), e);
}
try {
v = await r(o.url, {
...n,
method: s,
headers: o.headers.plain(),
body: !_ || _ instanceof i || b(_) ? a : _,
compress: f,
decode: m,
follow: g,
redirect: y,
signal: p,
});
} catch (e) {
if ((_ instanceof i && _.destroy(e), e instanceof TypeError))
throw e;
if (e instanceof w) throw new h("The operation was aborted.");
throw new d(e.message, "system", e);
}
const E = () => {
p.removeEventListener("abort", E);
const e = new h("The operation was aborted.");
o.init.body instanceof i && o.init.body.destroy(e),
v.readable.emit("error", e);
};
p && p.addEventListener("abort", E);
const {
statusCode: S,
statusText: T,
httpVersion: C,
headers: I,
readable: A,
decoded: P,
} = v;
if ([301, 302, 303, 307, 308].includes(S)) {
const { location: t } = I,
n = null == t ? null : new URL(t, o.url);
switch (o.redirect) {
case "manual":
break;
case "error":
throw (
(p && p.removeEventListener("abort", E),
new d(
`uri requested responds with a redirect, redirect mode is set to 'error': ${o.url}`,
"no-redirect",
))
);
case "follow": {
if (null === n) break;
if (o.counter >= o.follow)
throw (
(p && p.removeEventListener("abort", E),
new d(
`maximum redirect reached at: ${o.url}`,
"max-redirect",
))
);
const t = {
headers: new c(o.headers),
follow: o.follow,
compress: o.compress,
decode: o.decode,
counter: o.counter + 1,
method: o.method,
body: o.body,
signal: o.signal,
};
if (303 !== S && o.body && o.init.body instanceof i)
throw (
(p && p.removeEventListener("abort", E),
new d(
"Cannot follow redirect with body being a readable stream",
"unsupported-redirect",
))
);
return (
(303 !== S &&
((301 !== S && 302 !== S) || "POST" !== o.method)) ||
((t.method = "GET"),
(t.body = void 0),
t.headers.delete("content-length")),
p && p.removeEventListener("abort", E),
x(e, new l(n, t))
);
}
}
}
return (
p &&
(A.once("end", () => {
p.removeEventListener("abort", E);
}),
A.once("error", () => {
p.removeEventListener("abort", E);
})),
new u(A, {
url: o.url,
status: S,
statusText: T,
headers: I,
httpVersion: C,
decoded: P,
counter: o.counter,
})
);
},
C = async (e, t, n) => {
if (0 === e.options.maxCacheSize) return n;
if (!S.includes(t.method)) return n;
const r = new y(t, n, { shared: !1 });
if (r.storable()) {
const i = await _(n);
return (
e.cache.set(t.url, { policy: r, response: i }, r.timeToLive()),
i
);
}
return n;
},
I = (e, t = {}) => {
const n = new URL(e);
if ("object" != typeof t || Array.isArray(t))
throw new TypeError("qs: object expected");
return (
Object.entries(t).forEach(([e, t]) => {
Array.isArray(t)
? t.forEach((t) => n.searchParams.append(e, t))
: n.searchParams.append(e, t);
}),
n.href
);
},
A = (e) => new g(e);
class P {
constructor(e) {
this.options = { ...e };
const { maxCacheSize: t } = this.options;
let n = "number" == typeof t && t >= 0 ? t : 104857600,
i = 500;
0 === n && ((n = 1), (i = 1)),
(this.cache = new s({
max: i,
maxSize: n,
sizeCalculation: ({ response: e }, t) => v(e),
})),
(this.eventEmitter = new r()),
(this.options.h2 = this.options.h2 || {}),
void 0 === this.options.h2.enablePush &&
(this.options.h2.enablePush = !0);
const { enablePush: o } = this.options.h2;
o &&
((this.options.h2.pushPromiseHandler = (e, t, n) => {
const r = { ...t };
Object.keys(r)
.filter((e) => e.startsWith(":"))
.forEach((e) => delete r[e]),
this.pushPromiseHandler(e, r, n);
}),
(this.options.h2.pushHandler = (e, t, n) => {
const r = { ...t };
Object.keys(r)
.filter((e) => e.startsWith(":"))
.forEach((e) => delete r[e]);
const {
statusCode: i,
statusText: o,
httpVersion: s,
headers: a,
readable: c,
decoded: l,
} = n;
this.pushHandler(
e,
r,
new u(c, {
url: e,
status: i,
statusText: o,
headers: a,
httpVersion: s,
decoded: l,
}),
);
})),
(this.context = E(this.options));
}
api() {
return {
fetch: async (e, t) => this.fetch(e, t),
Body: a,
Headers: c,
Request: l,
Response: u,
AbortController: f,
AbortSignal: m,
FetchBaseError: p,
FetchError: d,
AbortError: h,
context: (e = {}) => new P(e).api(),
setCA: (e) => this.setCA(e),
noCache: (e = {}) => new P({ ...e, maxCacheSize: 0 }).api(),
h1: (e = {}) =>
new P({
...e,
alpnProtocols: [this.context.ALPN_HTTP1_1],
}).api(),
keepAlive: (e = {}) =>
new P({
...e,
alpnProtocols: [this.context.ALPN_HTTP1_1],
h1: { keepAlive: !0 },
}).api(),
h1NoCache: (e = {}) =>
new P({
...e,
maxCacheSize: 0,
alpnProtocols: [this.context.ALPN_HTTP1_1],
}).api(),
keepAliveNoCache: (e = {}) =>
new P({
...e,
maxCacheSize: 0,
alpnProtocols: [this.context.ALPN_HTTP1_1],
h1: { keepAlive: !0 },
}).api(),
reset: async () => this.context.reset(),
onPush: (e) => this.onPush(e),
offPush: (e) => this.offPush(e),
createUrl: I,
timeoutSignal: A,
clearCache: () => this.clearCache(),
cacheStats: () => this.cacheStats(),
ALPN_HTTP2: this.context.ALPN_HTTP2,
ALPN_HTTP2C: this.context.ALPN_HTTP2C,
ALPN_HTTP1_1: this.context.ALPN_HTTP1_1,
ALPN_HTTP1_0: this.context.ALPN_HTTP1_0,
};
}
async fetch(e, t) {
return (async (e, t, n) => {
const r = new l(t, n);
if (
0 !== e.options.maxCacheSize &&
S.includes(r.method) &&
!["no-store", "reload"].includes(r.cache)
) {
const { policy: t, response: n } = e.cache.get(r.url) || {};
if (t && t.satisfiesWithoutRevalidation(r)) {
n.headers = new c(t.responseHeaders(n));
const e = n.clone();
return (e.fromCache = !0), e;
}
}
const i = await x(e, r);
return "no-store" !== r.cache ? C(e, r, i) : i;
})(this, e, t);
}
setCA(e) {
(this.options.ca = e), this.context.setCA(e);
}
onPush(e) {
return this.eventEmitter.on(T, e);
}
offPush(e) {
return this.eventEmitter.off(T, e);
}
clearCache() {
this.cache.clear();
}
cacheStats() {
return { size: this.cache.calculatedSize, count: this.cache.size };
}
pushPromiseHandler(e, t, n) {
o(
`received server push promise: ${e}, headers: ${JSON.stringify(
t,
)}`,
);
const r = new l(e, { headers: t }),
{ policy: i } = this.cache.get(e) || {};
i &&
i.satisfiesWithoutRevalidation(r) &&
(o(
`already cached, reject push promise: ${e}, headers: ${JSON.stringify(
t,
)}`,
),
n());
}
async pushHandler(e, t, n) {
o(
`caching resource pushed by server: ${e}, reqHeaders: ${JSON.stringify(
t,
)}, status: ${n.status}, respHeaders: ${JSON.stringify(
n.headers,
)}`,
);
const r = await C(this, new l(e, { headers: t }), n);
this.eventEmitter.emit(T, e, r);
}
}
e.exports = new P().api();
},
24193: (e, t, n) => {
"use strict";
const r = n(26214),
{ Headers: i } = n(9872),
o = (e) => ({
url: e.url,
method: e.method,
headers: e.headers.plain(),
}),
s = (e) => ({ status: e.status, headers: e.headers.plain() });
e.exports = class {
constructor(e, t, n) {
this.policy = new r(o(e), s(t), n);
}
storable() {
return this.policy.storable();
}
satisfiesWithoutRevalidation(e) {
return this.policy.satisfiesWithoutRevalidation(o(e));
}
responseHeaders(e) {
return new i(this.policy.responseHeaders(s(e)));
}
timeToLive() {
return this.policy.timeToLive();
}
};
},
48359: (e, t, n) => {
"use strict";
const { AbortSignal: r } = n(96829),
{ Body: i, cloneStream: o, guessContentType: s } = n(95600),
{ Headers: a } = n(9872),
{ isPlainObject: c } = n(4544),
{ isFormData: l, FormDataSerializer: u } = n(99407),
p = Symbol("Request internals");
class d extends i {
constructor(e, t = {}) {
const n = e instanceof d ? e : null,
i = n ? new URL(n.url) : new URL(e);
let h = t.method || (n && n.method) || "GET";
if (
((h = h.toUpperCase()),
(null != t.body || (n && null !== n.body)) &&
["GET", "HEAD"].includes(h))
)
throw new TypeError(
"Request with GET/HEAD method cannot have body",
);
let f = t.body || (n && n.body ? o(n) : null);
const m = new a(t.headers || (n && n.headers) || {});
if (l(f) && !m.has("content-type")) {
const e = new u(f);
(f = e.stream()),
m.set("content-type", e.contentType()),
m.has("transfer-encoding") ||
m.has("content-length") ||
m.set("content-length", e.length());
}
if (!m.has("content-type"))
if (c(f))
(f = JSON.stringify(f)),
m.set("content-type", "application/json");
else {
const e = s(f);
e && m.set("content-type", e);
}
super(f);
let g = n ? n.signal : null;
if (("signal" in t && (g = t.signal), g && !(g instanceof r)))
throw new TypeError(
"signal needs to be an instance of AbortSignal",
);
const y = t.redirect || (n && n.redirect) || "follow";
if (!["follow", "error", "manual"].includes(y))
throw new TypeError(`'${y}' is not a valid redirect option`);
const _ = t.cache || (n && n.cache) || "default";
if (
![
"default",
"no-store",
"reload",
"no-cache",
"force-cache",
"only-if-cached",
].includes(_)
)
throw new TypeError(`'${_}' is not a valid cache option`);
(this[p] = {
init: { ...t },
method: h,
redirect: y,
cache: _,
headers: m,
parsedURL: i,
signal: g,
}),
void 0 === t.follow
? n && void 0 !== n.follow
? (this.follow = n.follow)
: (this.follow = 20)
: (this.follow = t.follow),
(this.counter = t.counter || (n && n.counter) || 0),
void 0 === t.compress
? n && void 0 !== n.compress
? (this.compress = n.compress)
: (this.compress = !0)
: (this.compress = t.compress),
void 0 === t.decode
? n && void 0 !== n.decode
? (this.decode = n.decode)
: (this.decode = !0)
: (this.decode = t.decode);
}
get method() {
return this[p].method;
}
get url() {
return this[p].parsedURL.toString();
}
get headers() {
return this[p].headers;
}
get redirect() {
return this[p].redirect;
}
get cache() {
return this[p].cache;
}
get signal() {
return this[p].signal;
}
clone() {
return new d(this);
}
get init() {
return this[p].init;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
}
Object.defineProperties(d.prototype, {
method: { enumerable: !0 },
url: { enumerable: !0 },
headers: { enumerable: !0 },
redirect: { enumerable: !0 },
cache: { enumerable: !0 },
clone: { enumerable: !0 },
signal: { enumerable: !0 },
}),
(e.exports = { Request: d });
},
2981: (e, t, n) => {
"use strict";
const { Body: r, cloneStream: i, guessContentType: o } = n(95600),
{ Headers: s } = n(9872),
{ isPlainObject: a } = n(4544),
{ isFormData: c, FormDataSerializer: l } = n(99407),
u = Symbol("Response internals");
class p extends r {
constructor(e = null, t = {}) {
const n = new s(t.headers);
let r = e;
if (c(r) && !n.has("content-type")) {
const e = new l(r);
(r = e.stream()),
n.set("content-type", e.contentType()),
n.has("transfer-encoding") ||
n.has("content-length") ||
n.set("content-length", e.length());
}
if (null !== r && !n.has("content-type"))
if (a(r))
(r = JSON.stringify(r)),
n.set("content-type", "application/json");
else {
const e = o(r);
e && n.set("content-type", e);
}
super(r),
(this[u] = {
url: t.url,
status: t.status || 200,
statusText: t.statusText || "",
headers: n,
httpVersion: t.httpVersion,
decoded: t.decoded,
counter: t.counter,
});
}
get url() {
return this[u].url || "";
}
get status() {
return this[u].status;
}
get statusText() {
return this[u].statusText;
}
get ok() {
return this[u].status >= 200 && this[u].status < 300;
}
get redirected() {
return this[u].counter > 0;
}
get headers() {
return this[u].headers;
}
get httpVersion() {
return this[u].httpVersion;
}
get decoded() {
return this[u].decoded;
}
static redirect(e, t = 302) {
if (![301, 302, 303, 307, 308].includes(t))
throw new RangeError("Invalid status code");
return new p(null, {
headers: { location: new URL(e).toString() },
status: t,
});
}
clone() {
if (this.bodyUsed)
throw new TypeError("Cannot clone: already read");
return new p(i(this), { ...this[u] });
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
}
Object.defineProperties(p.prototype, {
url: { enumerable: !0 },
status: { enumerable: !0 },
ok: { enumerable: !0 },
redirected: { enumerable: !0 },
statusText: { enumerable: !0 },
headers: { enumerable: !0 },
clone: { enumerable: !0 },
}),
(e.exports = { Response: p });
},
79825: (e, t, n) => {
"use strict";
e.exports = n(56143);
},
36709: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
RestError: () => $e,
bearerTokenAuthenticationPolicy: () => It,
bearerTokenAuthenticationPolicyName: () => xt,
createDefaultHttpClient: () => st,
createEmptyPipeline: () => o,
createHttpHeaders: () => Je,
createPipelineFromOptions: () => Ge,
createPipelineRequest: () => yt,
decompressResponsePolicy: () => Q,
decompressResponsePolicyName: () => X,
defaultRetryPolicy: () => de,
exponentialRetryPolicy: () => vt,
exponentialRetryPolicyName: () => _t,
formDataPolicy: () => ge,
formDataPolicyName: () => me,
getDefaultProxySettings: () => Ce,
isRestError: () => Ve,
logPolicy: () => U,
logPolicyName: () => F,
ndJsonPolicy: () => Pt,
ndJsonPolicyName: () => At,
proxyPolicy: () => Ae,
proxyPolicyName: () => Ee,
redirectPolicy: () => $,
redirectPolicyName: () => j,
retryPolicy: () => pe,
setClientRequestIdPolicy: () => ke,
setClientRequestIdPolicyName: () => Pe,
systemErrorRetryPolicy: () => Et,
systemErrorRetryPolicyName: () => bt,
throttlingRetryPolicy: () => St,
throttlingRetryPolicyName: () => wt,
tlsPolicy: () => Oe,
tlsPolicyName: () => Ne,
tracingPolicy: () => ze,
tracingPolicyName: () => qe,
userAgentPolicy: () => W,
userAgentPolicyName: () => K,
});
const r = new Set(["Deserialize", "Serialize", "Retry", "Sign"]);
class i {
constructor(e) {
var t;
(this._policies = []),
(this._policies =
null !== (t = null == e ? void 0 : e.slice(0)) && void 0 !== t
? t
: []),
(this._orderedPolicies = void 0);
}
addPolicy(e, t = {}) {
if (t.phase && t.afterPhase)
throw new Error(
"Policies inside a phase cannot specify afterPhase.",
);
if (t.phase && !r.has(t.phase))
throw new Error(`Invalid phase name: ${t.phase}`);
if (t.afterPhase && !r.has(t.afterPhase))
throw new Error(`Invalid afterPhase name: ${t.afterPhase}`);
this._policies.push({ policy: e, options: t }),
(this._orderedPolicies = void 0);
}
removePolicy(e) {
const t = [];
return (
(this._policies = this._policies.filter(
(n) =>
!(
(e.name && n.policy.name === e.name) ||
(e.phase && n.options.phase === e.phase)
) || (t.push(n.policy), !1),
)),
(this._orderedPolicies = void 0),
t
);
}
sendRequest(e, t) {
return this.getOrderedPolicies().reduceRight(
(e, t) => (n) => t.sendRequest(n, e),
(t) => e.sendRequest(t),
)(t);
}
getOrderedPolicies() {
return (
this._orderedPolicies ||
(this._orderedPolicies = this.orderPolicies()),
this._orderedPolicies
);
}
clone() {
return new i(this._policies);
}
static create() {
return new i();
}
orderPolicies() {
const e = [],
t = new Map();
function n(e) {
return {
name: e,
policies: new Set(),
hasRun: !1,
hasAfterPolicies: !1,
};
}
const r = n("Serialize"),
i = n("None"),
o = n("Deserialize"),
s = n("Retry"),
a = n("Sign"),
c = [r, i, o, s, a];
function l(e) {
return "Retry" === e
? s
: "Serialize" === e
? r
: "Deserialize" === e
? o
: "Sign" === e
? a
: i;
}
for (const e of this._policies) {
const n = e.policy,
r = e.options,
i = n.name;
if (t.has(i))
throw new Error(
"Duplicate policy names not allowed in pipeline",
);
const o = {
policy: n,
dependsOn: new Set(),
dependants: new Set(),
};
r.afterPhase &&
((o.afterPhase = l(r.afterPhase)),
(o.afterPhase.hasAfterPolicies = !0)),
t.set(i, o),
l(r.phase).policies.add(o);
}
for (const e of this._policies) {
const { policy: n, options: r } = e,
i = n.name,
o = t.get(i);
if (!o) throw new Error(`Missing node for policy ${i}`);
if (r.afterPolicies)
for (const e of r.afterPolicies) {
const n = t.get(e);
n && (o.dependsOn.add(n), n.dependants.add(o));
}
if (r.beforePolicies)
for (const e of r.beforePolicies) {
const n = t.get(e);
n && (n.dependsOn.add(o), o.dependants.add(n));
}
}
function u(n) {
n.hasRun = !0;
for (const r of n.policies)
if (
(!r.afterPhase ||
(r.afterPhase.hasRun && !r.afterPhase.policies.size)) &&
0 === r.dependsOn.size
) {
e.push(r.policy);
for (const e of r.dependants) e.dependsOn.delete(r);
t.delete(r.policy.name), n.policies.delete(r);
}
}
function p() {
for (const e of c) {
if ((u(e), e.policies.size > 0 && e !== i))
return void (i.hasRun || u(i));
e.hasAfterPolicies && u(i);
}
}
let d = 0;
for (; t.size > 0; ) {
d++;
const t = e.length;
if ((p(), e.length <= t && d > 1))
throw new Error(
"Cannot satisfy policy dependencies due to requirements cycle.",
);
}
return e;
}
}
function o() {
return i.create();
}
var s = n(73837),
a = n.n(s),
c = n(22037);
const l =
("undefined" != typeof process && process.env && process.env.DEBUG) ||
void 0;
let u,
p = [],
d = [];
const h = [];
l && m(l);
const f = Object.assign((e) => y(e), {
enable: m,
enabled: g,
disable: function () {
const e = u || "";
return m(""), e;
},
log: function (e, ...t) {
process.stderr.write(`${a().format(e, ...t)}${c.EOL}`);
},
});
function m(e) {
(u = e), (p = []), (d = []);
const t = /\*/g,
n = e.split(",").map((e) => e.trim().replace(t, ".*?"));
for (const e of n)
e.startsWith("-")
? d.push(new RegExp(`^${e.substr(1)}$`))
: p.push(new RegExp(`^${e}$`));
for (const e of h) e.enabled = g(e.namespace);
}
function g(e) {
if (e.endsWith("*")) return !0;
for (const t of d) if (t.test(e)) return !1;
for (const t of p) if (t.test(e)) return !0;
return !1;
}
function y(e) {
const t = Object.assign(
function (...n) {
t.enabled &&
(n.length > 0 && (n[0] = `${e} ${n[0]}`), t.log(...n));
},
{ enabled: g(e), destroy: _, log: f.log, namespace: e, extend: v },
);
return h.push(t), t;
}
function _() {
const e = h.indexOf(this);
return e >= 0 && (h.splice(e, 1), !0);
}
function v(e) {
const t = y(`${this.namespace}:${e}`);
return (t.log = this.log), t;
}
const b = f,
E = new Set(),
w =
("undefined" != typeof process &&
process.env &&
process.env.AZURE_LOG_LEVEL) ||
void 0;
let S;
const T = b("azure");
T.log = (...e) => {
b.log(...e);
};
const x = ["verbose", "info", "warning", "error"];
w &&
(N(w)
? (function (e) {
if (e && !N(e))
throw new Error(
`Unknown log level '${e}'. Acceptable values: ${x.join(
",",
)}`,
);
S = e;
const t = [];
for (const e of E) k(e) && t.push(e.namespace);
b.enable(t.join(","));
})(w)
: console.error(
`AZURE_LOG_LEVEL set to unknown log level '${w}'; logging is not enabled. Acceptable values: ${x.join(
", ",
)}.`,
));
const C = { verbose: 400, info: 300, warning: 200, error: 100 };
function I(e) {
const t = T.extend(e);
return (
A(T, t),
{
error: P(t, "error"),
warning: P(t, "warning"),
info: P(t, "info"),
verbose: P(t, "verbose"),
}
);
}
function A(e, t) {
t.log = (...t) => {
e.log(...t);
};
}
function P(e, t) {
const n = Object.assign(e.extend(t), { level: t });
if ((A(e, n), k(n))) {
const e = b.disable();
b.enable(e + "," + n.namespace);
}
return E.add(n), n;
}
function k(e) {
return !!(S && C[e.level] <= C[S]);
}
function N(e) {
return x.includes(e);
}
const O = I("core-rest-pipeline");
function R(e) {
return !(
"object" != typeof e ||
null === e ||
Array.isArray(e) ||
e instanceof RegExp ||
e instanceof Date
);
}
const M = "REDACTED",
L = [
"x-ms-client-request-id",
"x-ms-return-client-request-id",
"x-ms-useragent",
"x-ms-correlation-request-id",
"x-ms-request-id",
"client-request-id",
"ms-cv",
"return-client-request-id",
"traceparent",
"Access-Control-Allow-Credentials",
"Access-Control-Allow-Headers",
"Access-Control-Allow-Methods",
"Access-Control-Allow-Origin",
"Access-Control-Expose-Headers",
"Access-Control-Max-Age",
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"Origin",
"Accept",
"Accept-Encoding",
"Cache-Control",
"Connection",
"Content-Length",
"Content-Type",
"Date",
"ETag",
"Expires",
"If-Match",
"If-Modified-Since",
"If-None-Match",
"If-Unmodified-Since",
"Last-Modified",
"Pragma",
"Request-Id",
"Retry-After",
"Server",
"Transfer-Encoding",
"User-Agent",
"WWW-Authenticate",
],
D = ["api-version"];
class B {
constructor({
additionalAllowedHeaderNames: e = [],
additionalAllowedQueryParameters: t = [],
} = {}) {
(e = L.concat(e)),
(t = D.concat(t)),
(this.allowedHeaderNames = new Set(
e.map((e) => e.toLowerCase()),
)),
(this.allowedQueryParameters = new Set(
t.map((e) => e.toLowerCase()),
));
}
sanitize(e) {
const t = new Set();
return JSON.stringify(
e,
(e, n) => {
if (n instanceof Error)
return Object.assign(Object.assign({}, n), {
name: n.name,
message: n.message,
});
if ("headers" === e) return this.sanitizeHeaders(n);
if ("url" === e) return this.sanitizeUrl(n);
if ("query" === e) return this.sanitizeQuery(n);
if ("body" !== e && "response" !== e && "operationSpec" !== e) {
if (Array.isArray(n) || R(n)) {
if (t.has(n)) return "[Circular]";
t.add(n);
}
return n;
}
},
2,
);
}
sanitizeHeaders(e) {
const t = {};
for (const n of Object.keys(e))
this.allowedHeaderNames.has(n.toLowerCase())
? (t[n] = e[n])
: (t[n] = M);
return t;
}
sanitizeQuery(e) {
if ("object" != typeof e || null === e) return e;
const t = {};
for (const n of Object.keys(e))
this.allowedQueryParameters.has(n.toLowerCase())
? (t[n] = e[n])
: (t[n] = M);
return t;
}
sanitizeUrl(e) {
if ("string" != typeof e || null === e) return e;
const t = new URL(e);
if (!t.search) return e;
for (const [e] of t.searchParams)
this.allowedQueryParameters.has(e.toLowerCase()) ||
t.searchParams.set(e, M);
return t.toString();
}
}
const F = "logPolicy";
function U(e = {}) {
var t;
const n = null !== (t = e.logger) && void 0 !== t ? t : O.info,
r = new B({
additionalAllowedHeaderNames: e.additionalAllowedHeaderNames,
additionalAllowedQueryParameters:
e.additionalAllowedQueryParameters,
});
return {
name: F,
async sendRequest(e, t) {
if (!n.enabled) return t(e);
n(`Request: ${r.sanitize(e)}`);
const i = await t(e);
return (
n(`Response status code: ${i.status}`),
n(`Headers: ${r.sanitize(i.headers)}`),
i
);
},
};
}
const j = "redirectPolicy",
H = ["GET", "HEAD"];
function $(e = {}) {
const { maxRetries: t = 20 } = e;
return {
name: j,
async sendRequest(e, n) {
const r = await n(e);
return V(n, r, t);
},
};
}
async function V(e, t, n, r = 0) {
const { request: i, status: o, headers: s } = t,
a = s.get("location");
if (
a &&
(300 === o ||
(301 === o && H.includes(i.method)) ||
(302 === o && H.includes(i.method)) ||
(303 === o && "POST" === i.method) ||
307 === o) &&
r < n
) {
const t = new URL(a, i.url);
(i.url = t.toString()),
303 === o &&
((i.method = "GET"),
i.headers.delete("Content-Length"),
delete i.body),
i.headers.delete("Authorization");
const s = await e(i);
return V(e, s, n, r + 1);
}
return t;
}
const q = "1.10.1";
function z(e) {
const t = new Map();
var n;
t.set("core-rest-pipeline", q),
(n = t).set("Node", process.version),
n.set("OS", `(${c.arch()}-${c.type()}-${c.release()})`);
const r = (function (e) {
const t = [];
for (const [n, r] of e) {
const e = r ? `${n}/${r}` : n;
t.push(e);
}
return t.join(" ");
})(t);
return e ? `${e} ${r}` : r;
}
const G = "User-Agent",
K = "userAgentPolicy";
function W(e = {}) {
const t = z(e.userAgentPrefix);
return {
name: K,
sendRequest: async (e, n) => (
e.headers.has(G) || e.headers.set(G, t), n(e)
),
};
}
const X = "decompressResponsePolicy";
function Q() {
return {
name: X,
sendRequest: async (e, t) => (
"HEAD" !== e.method &&
e.headers.set("Accept-Encoding", "gzip,deflate"),
t(e)
),
};
}
const Y = new WeakMap(),
Z = new WeakMap();
class J {
constructor() {
(this.onabort = null), Y.set(this, []), Z.set(this, !1);
}
get aborted() {
if (!Z.has(this))
throw new TypeError(
"Expected `this` to be an instance of AbortSignal.",
);
return Z.get(this);
}
static get none() {
return new J();
}
addEventListener(e, t) {
if (!Y.has(this))
throw new TypeError(
"Expected `this` to be an instance of AbortSignal.",
);
Y.get(this).push(t);
}
removeEventListener(e, t) {
if (!Y.has(this))
throw new TypeError(
"Expected `this` to be an instance of AbortSignal.",
);
const n = Y.get(this),
r = n.indexOf(t);
r > -1 && n.splice(r, 1);
}
dispatchEvent(e) {
throw new Error(
"This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.",
);
}
}
function ee(e) {
if (e.aborted) return;
e.onabort && e.onabort.call(e);
const t = Y.get(e);
t &&
t.slice().forEach((t) => {
t.call(e, { type: "abort" });
}),
Z.set(e, !0);
}
class te extends Error {
constructor(e) {
super(e), (this.name = "AbortError");
}
}
class ne {
constructor(e) {
if (((this._signal = new J()), e)) {
Array.isArray(e) || (e = arguments);
for (const t of e)
t.aborted
? this.abort()
: t.addEventListener("abort", () => {
this.abort();
});
}
}
get signal() {
return this._signal;
}
abort() {
ee(this._signal);
}
static timeout(e) {
const t = new J(),
n = setTimeout(ee, e, t);
return "function" == typeof n.unref && n.unref(), t;
}
}
function re(e, t, n) {
return new Promise((r, i) => {
let o, s;
const a = () =>
i(
new te(
(null == n ? void 0 : n.abortErrorMsg)
? null == n
? void 0
: n.abortErrorMsg
: "The operation was aborted.",
),
),
c = () => {
(null == n ? void 0 : n.abortSignal) &&
s &&
n.abortSignal.removeEventListener("abort", s);
};
if (
((s = () => (o && clearTimeout(o), c(), a())),
(null == n ? void 0 : n.abortSignal) && n.abortSignal.aborted)
)
return a();
(o = setTimeout(() => {
c(), r(t);
}, e)),
(null == n ? void 0 : n.abortSignal) &&
n.abortSignal.addEventListener("abort", s);
});
}
function ie(e, t) {
const n = e.headers.get(t);
if (!n) return;
const r = Number(n);
return Number.isNaN(r) ? void 0 : r;
}
const oe = "Retry-After",
se = ["retry-after-ms", "x-ms-retry-after-ms", oe];
function ae(e) {
if (e && [429, 503].includes(e.status))
try {
for (const t of se) {
const n = ie(e, t);
if (0 === n || n) return n * (t === oe ? 1e3 : 1);
}
const t = e.headers.get(oe);
if (!t) return;
const n = Date.parse(t) - Date.now();
return Number.isFinite(n) ? Math.max(0, n) : void 0;
} catch (e) {
return;
}
}
function ce() {
return {
name: "throttlingRetryStrategy",
retry({ response: e }) {
const t = ae(e);
return Number.isFinite(t)
? { retryAfterInMs: t }
: { skipStrategy: !0 };
},
};
}
function le(e = {}) {
var t, n;
const r = null !== (t = e.retryDelayInMs) && void 0 !== t ? t : 1e3,
i = null !== (n = e.maxRetryDelayInMs) && void 0 !== n ? n : 64e3;
let o = r;
return {
name: "exponentialRetryStrategy",
retry({ retryCount: t, response: n, responseError: r }) {
const s =
!!(p = r) &&
("ETIMEDOUT" === p.code ||
"ESOCKETTIMEDOUT" === p.code ||
"ECONNREFUSED" === p.code ||
"ECONNRESET" === p.code ||
"ENOENT" === p.code),
a = s && e.ignoreSystemErrors,
c = (function (e) {
return Boolean(
e &&
void 0 !== e.status &&
(e.status >= 500 || 408 === e.status) &&
501 !== e.status &&
505 !== e.status,
);
})(n),
l = c && e.ignoreHttpStatusCodes,
u =
n &&
((function (e) {
return Number.isFinite(ae(e));
})(n) ||
!c);
var p;
if (u || l || a) return { skipStrategy: !0 };
if (r && !s && !c) return { errorToThrow: r };
const d = o * Math.pow(2, t),
h = Math.min(i, d);
var f, m;
return (
(o =
h / 2 +
((f = 0),
(m = h / 2),
(f = Math.ceil(f)),
(m = Math.floor(m)),
Math.floor(Math.random() * (m - f + 1)) + f)),
{ retryAfterInMs: o }
);
},
};
}
const ue = I("core-rest-pipeline retryPolicy");
function pe(e, t = { maxRetries: 3 }) {
const n = t.logger || ue;
return {
name: "retryPolicy",
async sendRequest(r, i) {
var o, s;
let a,
c,
l = -1;
e: for (;;) {
(l += 1), (a = void 0), (c = void 0);
try {
n.info(`Retry ${l}: Attempting to send request`, r.requestId),
(a = await i(r)),
n.info(
`Retry ${l}: Received a response from request`,
r.requestId,
);
} catch (e) {
if (
(n.error(
`Retry ${l}: Received an error from request`,
r.requestId,
),
(c = e),
!e || "RestError" !== c.name)
)
throw e;
a = c.response;
}
if (
null === (o = r.abortSignal) || void 0 === o
? void 0
: o.aborted
)
throw (n.error(`Retry ${l}: Request aborted.`), new te());
if (
l >= (null !== (s = t.maxRetries) && void 0 !== s ? s : 3)
) {
if (
(n.info(
`Retry ${l}: Maximum retries reached. Returning the last received response, or throwing the last received error.`,
),
c)
)
throw c;
if (a) return a;
throw new Error(
"Maximum retries reached with no response or error to throw",
);
}
n.info(`Retry ${l}: Processing ${e.length} retry strategies.`);
t: for (const t of e) {
const e = t.logger || ue;
e.info(`Retry ${l}: Processing retry strategy ${t.name}.`);
const n = t.retry({
retryCount: l,
response: a,
responseError: c,
});
if (n.skipStrategy) {
e.info(`Retry ${l}: Skipped.`);
continue t;
}
const {
errorToThrow: i,
retryAfterInMs: o,
redirectTo: s,
} = n;
if (i)
throw (
(e.error(
`Retry ${l}: Retry strategy ${t.name} throws error:`,
i,
),
i)
);
if (o || 0 === o) {
e.info(
`Retry ${l}: Retry strategy ${t.name} retries after ${o}`,
),
await re(o, void 0, { abortSignal: r.abortSignal });
continue e;
}
if (s) {
e.info(
`Retry ${l}: Retry strategy ${t.name} redirects to ${s}`,
),
(r.url = s);
continue e;
}
}
if (c)
throw (
(n.info(
"None of the retry strategies could work with the received error. Throwing it.",
),
c)
);
if (a)
return (
n.info(
"None of the retry strategies could work with the received response. Returning it.",
),
a
);
}
},
};
}
function de(e = {}) {
var t;
return {
name: "defaultRetryPolicy",
sendRequest: pe([ce(), le(e)], {
maxRetries: null !== (t = e.maxRetries) && void 0 !== t ? t : 3,
}).sendRequest,
};
}
var he = n(46882),
fe = n.n(he);
const me = "formDataPolicy";
function ge() {
return {
name: me,
async sendRequest(e, t) {
if (e.formData) {
const t = e.headers.get("Content-Type");
t && -1 !== t.indexOf("application/x-www-form-urlencoded")
? ((e.body = (function (e) {
const t = new URLSearchParams();
for (const [n, r] of Object.entries(e))
if (Array.isArray(r))
for (const e of r) t.append(n, e.toString());
else t.append(n, r.toString());
return t.toString();
})(e.formData)),
(e.formData = void 0))
: await (async function (e, t) {
const n = new (fe())();
for (const t of Object.keys(e)) {
const r = e[t];
if (Array.isArray(r)) for (const e of r) n.append(t, e);
else n.append(t, r);
}
(t.body = n), (t.formData = void 0);
const r = t.headers.get("Content-Type");
r &&
-1 !== r.indexOf("multipart/form-data") &&
t.headers.set(
"Content-Type",
`multipart/form-data; boundary=${n.getBoundary()}`,
);
try {
const e = await new Promise((e, t) => {
n.getLength((n, r) => {
n ? t(n) : e(r);
});
});
t.headers.set("Content-Length", e);
} catch (e) {}
})(e.formData, e);
}
return t(e);
},
};
}
var ye;
const _e =
"undefined" != typeof process &&
Boolean(process.version) &&
Boolean(
null === (ye = process.versions) || void 0 === ye
? void 0
: ye.node,
);
var ve = n(26018),
be = n(74476);
const Ee = "proxyPolicy",
we = [];
let Se = !1;
const Te = new Map();
function xe(e) {
return process.env[e]
? process.env[e]
: process.env[e.toLowerCase()]
? process.env[e.toLowerCase()]
: void 0;
}
function Ce(e) {
if (
!e &&
!(e = (function () {
if (!process) return;
const e = xe("HTTPS_PROXY"),
t = xe("ALL_PROXY"),
n = xe("HTTP_PROXY");
return e || t || n;
})())
)
return;
const t = new URL(e);
return {
host: (t.protocol ? t.protocol + "//" : "") + t.hostname,
port: Number.parseInt(t.port || "80"),
username: t.username,
password: t.password,
};
}
function Ie(e, { headers: t, tlsSettings: n }) {
let r;
try {
r = new URL(e.host);
} catch (t) {
throw new Error(
`Expecting a valid host string in proxy settings, but found "${e.host}".`,
);
}
n &&
O.warning(
"TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.",
);
const i = {
hostname: r.hostname,
port: e.port,
protocol: r.protocol,
headers: t.toJSON(),
};
return (
e.username && e.password
? (i.auth = `${e.username}:${e.password}`)
: e.username && (i.auth = `${e.username}`),
i
);
}
function Ae(e = Ce(), t) {
Se ||
we.push(
...(function () {
const e = xe("NO_PROXY");
return (
(Se = !0),
e
? e
.split(",")
.map((e) => e.trim())
.filter((e) => e.length)
: []
);
})(),
);
const n = {};
return {
name: Ee,
async sendRequest(r, i) {
var o;
return (
r.proxySettings ||
(function (e, t, n) {
if (0 === t.length) return !1;
const r = new URL(e).hostname;
if (null == n ? void 0 : n.has(r)) return n.get(r);
let i = !1;
for (const e of t)
"." === e[0]
? (r.endsWith(e) ||
(r.length === e.length - 1 && r === e.slice(1))) &&
(i = !0)
: r === e && (i = !0);
return null == n || n.set(r, i), i;
})(
r.url,
null !== (o = null == t ? void 0 : t.customNoProxyList) &&
void 0 !== o
? o
: we,
(null == t ? void 0 : t.customNoProxyList) ? void 0 : Te,
) ||
(r.proxySettings = e),
r.proxySettings &&
(function (e, t) {
if (e.agent) return;
const n = "https:" !== new URL(e.url).protocol,
r = e.proxySettings;
if (r)
if (n) {
if (!t.httpProxyAgent) {
const n = Ie(r, e);
t.httpProxyAgent = new be.HttpProxyAgent(n);
}
e.agent = t.httpProxyAgent;
} else {
if (!t.httpsProxyAgent) {
const n = Ie(r, e);
t.httpsProxyAgent = new ve.HttpsProxyAgent(n);
}
e.agent = t.httpsProxyAgent;
}
})(r, n),
i(r)
);
},
};
}
const Pe = "setClientRequestIdPolicy";
function ke(e = "x-ms-client-request-id") {
return {
name: Pe,
sendRequest: async (t, n) => (
t.headers.has(e) || t.headers.set(e, t.requestId), n(t)
),
};
}
const Ne = "tlsPolicy";
function Oe(e) {
return {
name: Ne,
sendRequest: async (t, n) => (
t.tlsSettings || (t.tlsSettings = e), n(t)
),
};
}
const Re = {
span: Symbol.for("@azure/core-tracing span"),
namespace: Symbol.for("@azure/core-tracing namespace"),
};
function Me(e = {}) {
let t = new Le(e.parentContext);
return (
e.span && (t = t.setValue(Re.span, e.span)),
e.namespace && (t = t.setValue(Re.namespace, e.namespace)),
t
);
}
class Le {
constructor(e) {
this._contextMap =
e instanceof Le ? new Map(e._contextMap) : new Map();
}
setValue(e, t) {
const n = new Le(this);
return n._contextMap.set(e, t), n;
}
getValue(e) {
return this._contextMap.get(e);
}
deleteValue(e) {
const t = new Le(this);
return t._contextMap.delete(e), t;
}
}
let De;
function Be() {
return (
De ||
(De = {
createRequestHeaders: () => ({}),
parseTraceparentHeader: () => {},
startSpan: (e, t) => ({
span: {
end: () => {},
isRecording: () => !1,
recordException: () => {},
setAttribute: () => {},
setStatus: () => {},
},
tracingContext: Me({ parentContext: t.tracingContext }),
}),
withContext: (e, t, ...n) => t(...n),
}),
De
);
}
function Fe(e) {
if (R(e)) {
const t = "string" == typeof e.name,
n = "string" == typeof e.message;
return t && n;
}
return !1;
}
function Ue(e) {
if (Fe(e)) return e.message;
{
let t;
try {
t = "object" == typeof e && e ? JSON.stringify(e) : String(e);
} catch (e) {
t = "[unable to stringify input]";
}
return `Unknown error ${t}`;
}
}
const je = s.inspect.custom,
He = new B();
class $e extends Error {
constructor(e, t = {}) {
super(e),
(this.name = "RestError"),
(this.code = t.code),
(this.statusCode = t.statusCode),
(this.request = t.request),
(this.response = t.response),
Object.setPrototypeOf(this, $e.prototype);
}
[je]() {
return `RestError: ${this.message} \n ${He.sanitize(this)}`;
}
}
function Ve(e) {
return e instanceof $e || (Fe(e) && "RestError" === e.name);
}
($e.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR"),
($e.PARSE_ERROR = "PARSE_ERROR");
const qe = "tracingPolicy";
function ze(e = {}) {
const t = z(e.userAgentPrefix),
n = (function () {
try {
return (function (e) {
const { namespace: t, packageName: n, packageVersion: r } = e;
function i(e, i, o) {
var s;
const a = Be().startSpan(
e,
Object.assign(Object.assign({}, o), {
packageName: n,
packageVersion: r,
tracingContext:
null ===
(s = null == i ? void 0 : i.tracingOptions) ||
void 0 === s
? void 0
: s.tracingContext,
}),
);
let c = a.tracingContext;
const l = a.span;
return (
c.getValue(Re.namespace) ||
(c = c.setValue(Re.namespace, t)),
l.setAttribute("az.namespace", c.getValue(Re.namespace)),
{
span: l,
updatedOptions: Object.assign({}, i, {
tracingOptions: Object.assign(
Object.assign(
{},
null == i ? void 0 : i.tracingOptions,
),
{ tracingContext: c },
),
}),
}
);
}
function o(e, t, ...n) {
return Be().withContext(e, t, ...n);
}
return {
startSpan: i,
withSpan: async function (e, t, n, r) {
const { span: s, updatedOptions: a } = i(e, t, r);
try {
const e = await o(a.tracingOptions.tracingContext, () =>
Promise.resolve(n(a, s)),
);
return s.setStatus({ status: "success" }), e;
} catch (e) {
throw (s.setStatus({ status: "error", error: e }), e);
} finally {
s.end();
}
},
withContext: o,
parseTraceparentHeader: function (e) {
return Be().parseTraceparentHeader(e);
},
createRequestHeaders: function (e) {
return Be().createRequestHeaders(e);
},
};
})({
namespace: "",
packageName: "@azure/core-rest-pipeline",
packageVersion: q,
});
} catch (e) {
return void O.warning(
`Error when creating the TracingClient: ${Ue(e)}`,
);
}
})();
return {
name: qe,
async sendRequest(e, r) {
var i, o;
if (
!n ||
!(null === (i = e.tracingOptions) || void 0 === i
? void 0
: i.tracingContext)
)
return r(e);
const { span: s, tracingContext: a } =
null !==
(o = (function (e, t, n) {
try {
const { span: r, updatedOptions: i } = e.startSpan(
`HTTP ${t.method}`,
{ tracingOptions: t.tracingOptions },
{
spanKind: "client",
spanAttributes: {
"http.method": t.method,
"http.url": t.url,
requestId: t.requestId,
},
},
);
if (!r.isRecording()) return void r.end();
n && r.setAttribute("http.user_agent", n);
const o = e.createRequestHeaders(
i.tracingOptions.tracingContext,
);
for (const [e, n] of Object.entries(o))
t.headers.set(e, n);
return {
span: r,
tracingContext: i.tracingOptions.tracingContext,
};
} catch (e) {
return void O.warning(
`Skipping creating a tracing span due to an error: ${Ue(
e,
)}`,
);
}
})(n, e, t)) && void 0 !== o
? o
: {};
if (!s || !a) return r(e);
try {
const t = await n.withContext(a, r, e);
return (
(function (e, t) {
try {
e.setAttribute("http.status_code", t.status);
const n = t.headers.get("x-ms-request-id");
n && e.setAttribute("serviceRequestId", n),
e.setStatus({ status: "success" }),
e.end();
} catch (e) {
O.warning(
`Skipping tracing span processing due to an error: ${Ue(
e,
)}`,
);
}
})(s, t),
t
);
} catch (e) {
throw (
((function (e, t) {
try {
e.setStatus({
status: "error",
error: Fe(t) ? t : void 0,
}),
Ve(t) &&
t.statusCode &&
e.setAttribute("http.status_code", t.statusCode),
e.end();
} catch (e) {
O.warning(
`Skipping tracing span processing due to an error: ${Ue(
e,
)}`,
);
}
})(s, e),
e)
);
}
},
};
}
function Ge(e) {
const t = o();
return (
_e &&
(e.tlsOptions && t.addPolicy(Oe(e.tlsOptions)),
t.addPolicy(Ae(e.proxyOptions)),
t.addPolicy(Q())),
t.addPolicy(ge()),
t.addPolicy(W(e.userAgentOptions)),
t.addPolicy(ke()),
t.addPolicy(de(e.retryOptions), { phase: "Retry" }),
t.addPolicy(ze(e.userAgentOptions), { afterPhase: "Retry" }),
_e && t.addPolicy($(e.redirectOptions), { afterPhase: "Retry" }),
t.addPolicy(U(e.loggingOptions), { afterPhase: "Sign" }),
t
);
}
var Ke = n(13685),
We = n(95687),
Xe = n(59796),
Qe = n(12781);
function Ye(e) {
return e.toLowerCase();
}
class Ze {
constructor(e) {
if (((this._headersMap = new Map()), e))
for (const t of Object.keys(e)) this.set(t, e[t]);
}
set(e, t) {
this._headersMap.set(Ye(e), { name: e, value: String(t) });
}
get(e) {
var t;
return null === (t = this._headersMap.get(Ye(e))) || void 0 === t
? void 0
: t.value;
}
has(e) {
return this._headersMap.has(Ye(e));
}
delete(e) {
this._headersMap.delete(Ye(e));
}
toJSON(e = {}) {
const t = {};
if (e.preserveCase)
for (const e of this._headersMap.values()) t[e.name] = e.value;
else for (const [e, n] of this._headersMap) t[e] = n.value;
return t;
}
toString() {
return JSON.stringify(this.toJSON({ preserveCase: !0 }));
}
[Symbol.iterator]() {
return (function* (e) {
for (const t of e.values()) yield [t.name, t.value];
})(this._headersMap);
}
}
function Je(e) {
return new Ze(e);
}
const et = {};
function tt(e) {
return e && "function" == typeof e.pipe;
}
function nt(e) {
return new Promise((t) => {
e.on("close", t), e.on("end", t), e.on("error", t);
});
}
function rt(e) {
return e && "number" == typeof e.byteLength;
}
class it extends Qe.Transform {
constructor(e) {
super(), (this.loadedBytes = 0), (this.progressCallback = e);
}
_transform(e, t, n) {
this.push(e), (this.loadedBytes += e.length);
try {
this.progressCallback({ loadedBytes: this.loadedBytes }), n();
} catch (e) {
n(e);
}
}
}
class ot {
constructor() {
this.cachedHttpsAgents = new WeakMap();
}
async sendRequest(e) {
var t, n, r;
const i = new ne();
let o;
if (e.abortSignal) {
if (e.abortSignal.aborted)
throw new te("The operation was aborted.");
(o = (e) => {
"abort" === e.type && i.abort();
}),
e.abortSignal.addEventListener("abort", o);
}
e.timeout > 0 &&
setTimeout(() => {
i.abort();
}, e.timeout);
const s = e.headers.get("Accept-Encoding"),
a =
(null == s ? void 0 : s.includes("gzip")) ||
(null == s ? void 0 : s.includes("deflate"));
let c,
l = "function" == typeof e.body ? e.body() : e.body;
if (l && !e.headers.has("Content-Length")) {
const t = (function (e) {
return e
? Buffer.isBuffer(e)
? e.length
: tt(e)
? null
: rt(e)
? e.byteLength
: "string" == typeof e
? Buffer.from(e).length
: null
: 0;
})(l);
null !== t && e.headers.set("Content-Length", t);
}
try {
if (l && e.onUploadProgress) {
const t = e.onUploadProgress,
n = new it(t);
n.on("error", (e) => {
O.error("Error in upload progress", e);
}),
tt(l) ? l.pipe(n) : n.end(l),
(l = n);
}
const s = await this.makeRequest(e, i, l),
p = (function (e) {
const t = Je();
for (const n of Object.keys(e.headers)) {
const r = e.headers[n];
Array.isArray(r)
? r.length > 0 && t.set(n, r[0])
: r && t.set(n, r);
}
return t;
})(s),
d = {
status: null !== (t = s.statusCode) && void 0 !== t ? t : 0,
headers: p,
request: e,
};
if ("HEAD" === e.method) return s.resume(), d;
c = a
? (function (e, t) {
const n = t.get("Content-Encoding");
if ("gzip" === n) {
const t = Xe.createGunzip();
return e.pipe(t), t;
}
if ("deflate" === n) {
const t = Xe.createInflate();
return e.pipe(t), t;
}
return e;
})(s, p)
: s;
const h = e.onDownloadProgress;
if (h) {
const e = new it(h);
e.on("error", (e) => {
O.error("Error in download progress", e);
}),
c.pipe(e),
(c = e);
}
return (
(null === (n = e.streamResponseStatusCodes) || void 0 === n
? void 0
: n.has(Number.POSITIVE_INFINITY)) ||
(null === (r = e.streamResponseStatusCodes) || void 0 === r
? void 0
: r.has(d.status))
? (d.readableStreamBody = c)
: (d.bodyAsText = await ((u = c),
new Promise((e, t) => {
const n = [];
u.on("data", (e) => {
Buffer.isBuffer(e) ? n.push(e) : n.push(Buffer.from(e));
}),
u.on("end", () => {
e(Buffer.concat(n).toString("utf8"));
}),
u.on("error", (e) => {
e && "AbortError" === (null == e ? void 0 : e.name)
? t(e)
: t(
new $e(
`Error reading response as text: ${e.message}`,
{ code: $e.PARSE_ERROR },
),
);
});
}))),
d
);
} finally {
if (e.abortSignal && o) {
let t = Promise.resolve();
tt(l) && (t = nt(l));
let n = Promise.resolve();
tt(c) && (n = nt(c)),
Promise.all([t, n])
.then(() => {
var t;
o &&
(null === (t = e.abortSignal) ||
void 0 === t ||
t.removeEventListener("abort", o));
})
.catch((e) => {
O.warning(
"Error when cleaning up abortListener on httpRequest",
e,
);
});
}
}
var u;
}
makeRequest(e, t, n) {
var r;
const i = new URL(e.url),
o = "https:" !== i.protocol;
if (o && !e.allowInsecureConnection)
throw new Error(
`Cannot connect to ${e.url} while allowInsecureConnection is false.`,
);
const s = {
agent:
null !== (r = e.agent) && void 0 !== r
? r
: this.getOrCreateAgent(e, o),
hostname: i.hostname,
path: `${i.pathname}${i.search}`,
port: i.port,
method: e.method,
headers: e.headers.toJSON({ preserveCase: !0 }),
};
return new Promise((r, i) => {
const a = o ? Ke.request(s, r) : We.request(s, r);
a.once("error", (t) => {
var n;
i(
new $e(t.message, {
code:
null !== (n = t.code) && void 0 !== n
? n
: $e.REQUEST_SEND_ERROR,
request: e,
}),
);
}),
t.signal.addEventListener("abort", () => {
const e = new te("The operation was aborted.");
a.destroy(e), i(e);
}),
n && tt(n)
? n.pipe(a)
: n
? "string" == typeof n || Buffer.isBuffer(n)
? a.end(n)
: rt(n)
? a.end(
ArrayBuffer.isView(n)
? Buffer.from(n.buffer)
: Buffer.from(n),
)
: (O.error("Unrecognized body type", n),
i(new $e("Unrecognized body type")))
: a.end();
});
}
getOrCreateAgent(e, t) {
var n;
const r = e.disableKeepAlive;
if (t)
return r
? Ke.globalAgent
: (this.cachedHttpAgent ||
(this.cachedHttpAgent = new Ke.Agent({ keepAlive: !0 })),
this.cachedHttpAgent);
{
if (r && !e.tlsSettings) return We.globalAgent;
const t = null !== (n = e.tlsSettings) && void 0 !== n ? n : et;
let i = this.cachedHttpsAgents.get(t);
return (
(i && i.options.keepAlive === !r) ||
(O.info("No cached TLS Agent exist, creating a new Agent"),
(i = new We.Agent(Object.assign({ keepAlive: !r }, t))),
this.cachedHttpsAgents.set(t, i)),
i
);
}
}
}
function st() {
return new ot();
}
var at = n(6113),
ct = n.n(at);
const lt = new Uint8Array(256);
let ut = lt.length;
function pt() {
return (
ut > lt.length - 16 && (ct().randomFillSync(lt), (ut = 0)),
lt.slice(ut, (ut += 16))
);
}
const dt =
/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,
ht = [];
for (let e = 0; e < 256; ++e) ht.push((e + 256).toString(16).substr(1));
const ft = function (e, t = 0) {
const n = (
ht[e[t + 0]] +
ht[e[t + 1]] +
ht[e[t + 2]] +
ht[e[t + 3]] +
"-" +
ht[e[t + 4]] +
ht[e[t + 5]] +
"-" +
ht[e[t + 6]] +
ht[e[t + 7]] +
"-" +
ht[e[t + 8]] +
ht[e[t + 9]] +
"-" +
ht[e[t + 10]] +
ht[e[t + 11]] +
ht[e[t + 12]] +
ht[e[t + 13]] +
ht[e[t + 14]] +
ht[e[t + 15]]
).toLowerCase();
if (
!(function (e) {
return "string" == typeof e && dt.test(e);
})(n)
)
throw TypeError("Stringified UUID is invalid");
return n;
},
mt = function (e, t, n) {
const r = (e = e || {}).random || (e.rng || pt)();
if (((r[6] = (15 & r[6]) | 64), (r[8] = (63 & r[8]) | 128), t)) {
n = n || 0;
for (let e = 0; e < 16; ++e) t[n + e] = r[e];
return t;
}
return ft(r);
};
class gt {
constructor(e) {
var t, n, r, i, o, s, a;
(this.url = e.url),
(this.body = e.body),
(this.headers =
null !== (t = e.headers) && void 0 !== t ? t : Je()),
(this.method =
null !== (n = e.method) && void 0 !== n ? n : "GET"),
(this.timeout = null !== (r = e.timeout) && void 0 !== r ? r : 0),
(this.formData = e.formData),
(this.disableKeepAlive =
null !== (i = e.disableKeepAlive) && void 0 !== i && i),
(this.proxySettings = e.proxySettings),
(this.streamResponseStatusCodes = e.streamResponseStatusCodes),
(this.withCredentials =
null !== (o = e.withCredentials) && void 0 !== o && o),
(this.abortSignal = e.abortSignal),
(this.tracingOptions = e.tracingOptions),
(this.onUploadProgress = e.onUploadProgress),
(this.onDownloadProgress = e.onDownloadProgress),
(this.requestId = e.requestId || mt()),
(this.allowInsecureConnection =
null !== (s = e.allowInsecureConnection) && void 0 !== s && s),
(this.enableBrowserStreams =
null !== (a = e.enableBrowserStreams) && void 0 !== a && a);
}
}
function yt(e) {
return new gt(e);
}
const _t = "exponentialRetryPolicy";
function vt(e = {}) {
var t;
return pe(
[
le(
Object.assign(Object.assign({}, e), { ignoreSystemErrors: !0 }),
),
],
{ maxRetries: null !== (t = e.maxRetries) && void 0 !== t ? t : 3 },
);
}
const bt = "systemErrorRetryPolicy";
function Et(e = {}) {
var t;
return {
name: bt,
sendRequest: pe(
[
le(
Object.assign(Object.assign({}, e), {
ignoreHttpStatusCodes: !0,
}),
),
],
{
maxRetries: null !== (t = e.maxRetries) && void 0 !== t ? t : 3,
},
).sendRequest,
};
}
const wt = "throttlingRetryPolicy";
function St(e = {}) {
var t;
return {
name: wt,
sendRequest: pe([ce()], {
maxRetries: null !== (t = e.maxRetries) && void 0 !== t ? t : 3,
}).sendRequest,
};
}
const Tt = {
forcedRefreshWindowInMs: 1e3,
retryIntervalInMs: 3e3,
refreshWindowInMs: 12e4,
};
const xt = "bearerTokenAuthenticationPolicy";
async function Ct(e) {
const { scopes: t, getAccessToken: n, request: r } = e,
i = {
abortSignal: r.abortSignal,
tracingOptions: r.tracingOptions,
},
o = await n(t, i);
o && e.request.headers.set("Authorization", `Bearer ${o.token}`);
}
function It(e) {
var t;
const { credential: n, scopes: r, challengeCallbacks: i } = e,
o = e.logger || O,
s = Object.assign(
{
authorizeRequest:
null !== (t = null == i ? void 0 : i.authorizeRequest) &&
void 0 !== t
? t
: Ct,
authorizeRequestOnChallenge:
null == i ? void 0 : i.authorizeRequestOnChallenge,
},
i,
),
a = n
? (function (e, t) {
let n,
r = null,
i = null;
const o = Object.assign(Object.assign({}, Tt), t),
s = {
get isRefreshing() {
return null !== r;
},
get shouldRefresh() {
var e;
return (
!s.isRefreshing &&
(null !==
(e = null == i ? void 0 : i.expiresOnTimestamp) &&
void 0 !== e
? e
: 0) -
o.refreshWindowInMs <
Date.now()
);
},
get mustRefresh() {
return (
null === i ||
i.expiresOnTimestamp - o.forcedRefreshWindowInMs <
Date.now()
);
},
};
function a(t, a) {
var c;
return (
s.isRefreshing ||
(r = (async function (e, t, n) {
async function r() {
if (!(Date.now() < n)) {
const t = await e();
if (null === t)
throw new Error(
"Failed to refresh access token.",
);
return t;
}
try {
return await e();
} catch (e) {
return null;
}
}
let i = await r();
for (; null === i; ) await re(t), (i = await r());
return i;
})(
() => e.getToken(t, a),
o.retryIntervalInMs,
null !==
(c = null == i ? void 0 : i.expiresOnTimestamp) &&
void 0 !== c
? c
: Date.now(),
)
.then(
(e) => ((r = null), (i = e), (n = a.tenantId), i),
)
.catch((e) => {
throw ((r = null), (i = null), (n = void 0), e);
})),
r
);
}
return async (e, t) =>
n !== t.tenantId || Boolean(t.claims) || s.mustRefresh
? a(e, t)
: (s.shouldRefresh && a(e, t), i);
})(n)
: () => Promise.resolve(null);
return {
name: xt,
async sendRequest(e, t) {
if (!e.url.toLowerCase().startsWith("https://"))
throw new Error(
"Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.",
);
let n, i;
await s.authorizeRequest({
scopes: Array.isArray(r) ? r : [r],
request: e,
getAccessToken: a,
logger: o,
});
try {
n = await t(e);
} catch (e) {
(i = e), (n = e.response);
}
if (
s.authorizeRequestOnChallenge &&
401 === (null == n ? void 0 : n.status) &&
(function (e) {
const t = e.headers.get("WWW-Authenticate");
if (401 === e.status && t) return t;
})(n) &&
(await s.authorizeRequestOnChallenge({
scopes: Array.isArray(r) ? r : [r],
request: e,
response: n,
getAccessToken: a,
logger: o,
}))
)
return t(e);
if (i) throw i;
return n;
},
};
}
const At = "ndJsonPolicy";
function Pt() {
return {
name: At,
async sendRequest(e, t) {
if ("string" == typeof e.body && e.body.startsWith("[")) {
const t = JSON.parse(e.body);
Array.isArray(t) &&
(e.body = t.map((e) => JSON.stringify(e) + "\n").join(""));
}
return t(e);
},
};
}
},
65521: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.default = function (e, t, { signal: n } = {}) {
return new Promise((r, i) => {
function o() {
null == n || n.removeEventListener("abort", o),
e.removeListener(t, s),
e.removeListener("error", a);
}
function s(...e) {
o(), r(e);
}
function a(e) {
o(), i(e);
}
null == n || n.addEventListener("abort", o),
e.on(t, s),
e.on("error", a);
});
});
},
88192: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 });
const o = i(n(41808)),
s = i(n(24404)),
a = i(n(57310)),
c = i(n(15158)),
l = i(n(65521)),
u = n(88054),
p = (0, c.default)("http-proxy-agent");
class d extends u.Agent {
constructor(e) {
let t;
if (((t = "string" == typeof e ? a.default.parse(e) : e), !t))
throw new Error(
"an HTTP(S) proxy server `host` and `port` must be specified!",
);
p("Creating new HttpProxyAgent instance: %o", t), super(t);
const n = Object.assign({}, t);
var r;
(this.secureProxy =
t.secureProxy ||
("string" == typeof (r = n.protocol) && /^https:?$/i.test(r))),
(n.host = n.hostname || n.host),
"string" == typeof n.port && (n.port = parseInt(n.port, 10)),
!n.port && n.host && (n.port = this.secureProxy ? 443 : 80),
n.host && n.path && (delete n.path, delete n.pathname),
(this.proxy = n);
}
callback(e, t) {
return r(this, void 0, void 0, function* () {
const { proxy: n, secureProxy: r } = this,
i = a.default.parse(e.path);
let c;
if (
(i.protocol || (i.protocol = "http:"),
i.hostname || (i.hostname = t.hostname || t.host || null),
null == i.port && (t.port, 1) && (i.port = String(t.port)),
"80" === i.port && (i.port = ""),
(e.path = a.default.format(i)),
n.auth &&
e.setHeader(
"Proxy-Authorization",
`Basic ${Buffer.from(n.auth).toString("base64")}`,
),
r
? (p("Creating `tls.Socket`: %o", n),
(c = s.default.connect(n)))
: (p("Creating `net.Socket`: %o", n),
(c = o.default.connect(n))),
e._header)
) {
let t, n;
p("Regenerating stored HTTP header string for request"),
(e._header = null),
e._implicitHeader(),
e.output && e.output.length > 0
? (p(
"Patching connection write() output buffer with updated header",
),
(t = e.output[0]),
(n = t.indexOf("\r\n\r\n") + 4),
(e.output[0] = e._header + t.substring(n)),
p("Output buffer: %o", e.output))
: e.outputData &&
e.outputData.length > 0 &&
(p(
"Patching connection write() output buffer with updated header",
),
(t = e.outputData[0].data),
(n = t.indexOf("\r\n\r\n") + 4),
(e.outputData[0].data = e._header + t.substring(n)),
p("Output buffer: %o", e.outputData[0].data));
}
return yield (0, l.default)(c, "connect"), c;
});
}
}
t.default = d;
},
74476: function (e, t, n) {
"use strict";
const r = (
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
}
)(n(88192));
function i(e) {
return new r.default(e);
}
!(function (e) {
(e.HttpProxyAgent = r.default), (e.prototype = r.default.prototype);
})(i || (i = {})),
(e.exports = i);
},
40166: (e, t, n) => {
"use strict";
n.r(t), n.d(t, { webSnippet: () => r });
var r =
'!function(T,l,y){var S=T.location,k="script",D="instrumentationKey",C="ingestionendpoint",I="disableExceptionTracking",E="ai.device.",b="toLowerCase",w="crossOrigin",N="POST",e="appInsightsSDK",t=y.name||"appInsights";(y.name||T[e])&&(T[e]=t);var n=T[t]||function(d){var g=!1,f=!1,m={initialize:!0,queue:[],sv:"5",version:2,config:d};function v(e,t){var n={},a="Browser";return n[E+"id"]=a[b](),n[E+"type"]=a,n["ai.operation.name"]=S&&S.pathname||"_unknown_",n["ai.internal.sdkVersion"]="javascript:snippet_"+(m.sv||m.version),{time:function(){var e=new Date;function t(e){var t=""+e;return 1===t.length&&(t="0"+t),t}return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}(),iKey:e,name:"Microsoft.ApplicationInsights."+e.replace(/-/g,"")+"."+t,sampleRate:100,tags:n,data:{baseData:{ver:2}}}}var h=d.url||y.src;if(h){function a(e){var t,n,a,i,r,o,s,c,u,p,l;g=!0,m.queue=[],f||(f=!0,t=h,s=function(){var e={},t=d.connectionString;if(t)for(var n=t.split(";"),a=0;a<n.length;a++){var i=n[a].split("=");2===i.length&&(e[i[0][b]()]=i[1])}if(!e[C]){var r=e.endpointsuffix,o=r?e.location:null;e[C]="https://"+(o?o+".":"")+"dc."+(r||"services.visualstudio.com")}return e}(),c=s[D]||d[D]||"",u=s[C],p=u?u+"/v2/track":d.endpointUrl,(l=[]).push((n="SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)",a=t,i=p,(o=(r=v(c,"Exception")).data).baseType="ExceptionData",o.baseData.exceptions=[{typeName:"SDKLoadFailed",message:n.replace(/\\./g,"-"),hasFullStack:!1,stack:n+"\\nSnippet failed to load ["+a+"] -- Telemetry is disabled\\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\\nHost: "+(S&&S.pathname||"_unknown_")+"\\nEndpoint: "+i,parsedStack:[]}],r)),l.push(function(e,t,n,a){var i=v(c,"Message"),r=i.data;r.baseType="MessageData";var o=r.baseData;return o.message=\'AI (Internal): 99 message:"\'+("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) ("+n+")").replace(/\\"/g,"")+\'"\',o.properties={endpoint:a},i}(0,0,t,p)),function(e,t){if(JSON){var n=T.fetch;if(n&&!y.useXhr)n(t,{method:N,body:JSON.stringify(e),mode:"cors"});else if(XMLHttpRequest){var a=new XMLHttpRequest;a.open(N,t),a.setRequestHeader("Content-type","application/json"),a.send(JSON.stringify(e))}}}(l,p))}function i(e,t){f||setTimeout(function(){!t&&m.core||a()},500)}var e=function(){var n=l.createElement(k);n.src=h;var e=y[w];return!e&&""!==e||"undefined"==n[w]||(n[w]=e),n.onload=i,n.onerror=a,n.onreadystatechange=function(e,t){"loaded"!==n.readyState&&"complete"!==n.readyState||i(0,t)},n}();y.ld<0?l.getElementsByTagName("head")[0].appendChild(e):setTimeout(function(){l.getElementsByTagName(k)[0].parentNode.appendChild(e)},y.ld||0)}try{m.cookie=l.cookie}catch(p){}function t(e){for(;e.length;)!function(t){m[t]=function(){var e=arguments;g||m.queue.push(function(){m[t].apply(m,e)})}}(e.pop())}var n="track",r="TrackPage",o="TrackEvent";t([n+"Event",n+"PageView",n+"Exception",n+"Trace",n+"DependencyData",n+"Metric",n+"PageViewPerformance","start"+r,"stop"+r,"start"+o,"stop"+o,"addTelemetryInitializer","setAuthenticatedUserContext","clearAuthenticatedUserContext","flush"]),m.SeverityLevel={Verbose:0,Information:1,Warning:2,Error:3,Critical:4};var s=(d.extensionConfig||{}).ApplicationInsightsAnalytics||{};if(!0!==d[I]&&!0!==s[I]){var c="onerror";t(["_"+c]);var u=T[c];T[c]=function(e,t,n,a,i){var r=u&&u(e,t,n,a,i);return!0!==r&&m["_"+c]({message:e,url:t,lineNumber:n,columnNumber:a,error:i}),r},d.autoExceptionInstrumented=!0}return m}(y.cfg);function a(){y.onInit&&y.onInit(n)}(T[t]=n).queue&&0===n.queue.length?(n.queue.push(a),n.trackPageView({})):a()}(window,document,{\r\nsrc: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source\r\n// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied\r\n// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,\r\n// useXhr: 1, // Use XHR instead of fetch to report failures (if available),\r\n// crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag\r\n// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won\'t get called)\r\ncfg: { // Application Insights Configuration\r\n instrumentationKey: "INSTRUMENTATION_KEY"\r\n}});';
},
7150: (e, t, n) => {
"use strict";
n.d(t, { c: () => h });
var r = n(15834),
i = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
},
o = function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
},
s = (function () {
function e() {}
return (
(e.prototype.active = function () {
return r.I;
}),
(e.prototype.with = function (e, t, n) {
for (var r = [], s = 3; s < arguments.length; s++)
r[s - 3] = arguments[s];
return t.call.apply(t, o([n], i(r), !1));
}),
(e.prototype.bind = function (e, t) {
return t;
}),
(e.prototype.enable = function () {
return this;
}),
(e.prototype.disable = function () {
return this;
}),
e
);
})(),
a = n(30658),
c = n(95774),
l = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
},
u = function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
},
p = "context",
d = new s(),
h = (function () {
function e() {}
return (
(e.getInstance = function () {
return (
this._instance || (this._instance = new e()), this._instance
);
}),
(e.prototype.setGlobalContextManager = function (e) {
return (0, a.TG)(p, e, c.G.instance());
}),
(e.prototype.active = function () {
return this._getContextManager().active();
}),
(e.prototype.with = function (e, t, n) {
for (var r, i = [], o = 3; o < arguments.length; o++)
i[o - 3] = arguments[o];
return (r = this._getContextManager()).with.apply(
r,
u([e, t, n], l(i), !1),
);
}),
(e.prototype.bind = function (e, t) {
return this._getContextManager().bind(e, t);
}),
(e.prototype._getContextManager = function () {
return (0, a.Rd)(p) || d;
}),
(e.prototype.disable = function () {
this._getContextManager().disable(),
(0, a.J_)(p, c.G.instance());
}),
e
);
})();
},
95774: (e, t, n) => {
"use strict";
n.d(t, { G: () => l });
var r = n(30658),
i = (function () {
function e(e) {
this._namespace = e.namespace || "DiagComponentLogger";
}
return (
(e.prototype.debug = function () {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return o("debug", this._namespace, e);
}),
(e.prototype.error = function () {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return o("error", this._namespace, e);
}),
(e.prototype.info = function () {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return o("info", this._namespace, e);
}),
(e.prototype.warn = function () {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return o("warn", this._namespace, e);
}),
(e.prototype.verbose = function () {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
return o("verbose", this._namespace, e);
}),
e
);
})();
function o(e, t, n) {
var i = (0, r.Rd)("diag");
if (i)
return (
n.unshift(t),
i[e].apply(
i,
(function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
})(
[],
(function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (
;
(void 0 === t || t-- > 0) && !(r = o.next()).done;
)
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
})(n),
!1,
),
)
);
}
var s = n(16740),
a = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
},
c = function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
},
l = (function () {
function e() {
function e(e) {
return function () {
for (var t = [], n = 0; n < arguments.length; n++)
t[n] = arguments[n];
var i = (0, r.Rd)("diag");
if (i) return i[e].apply(i, c([], a(t), !1));
};
}
var t = this;
(t.setLogger = function (e, n) {
var i, o, a;
if ((void 0 === n && (n = { logLevel: s.n.INFO }), e === t)) {
var c = new Error(
"Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation",
);
return (
t.error(
null !== (i = c.stack) && void 0 !== i ? i : c.message,
),
!1
);
}
"number" == typeof n && (n = { logLevel: n });
var l = (0, r.Rd)("diag"),
u = (function (e, t) {
function n(n, r) {
var i = t[n];
return "function" == typeof i && e >= r
? i.bind(t)
: function () {};
}
return (
e < s.n.NONE
? (e = s.n.NONE)
: e > s.n.ALL && (e = s.n.ALL),
(t = t || {}),
{
error: n("error", s.n.ERROR),
warn: n("warn", s.n.WARN),
info: n("info", s.n.INFO),
debug: n("debug", s.n.DEBUG),
verbose: n("verbose", s.n.VERBOSE),
}
);
})(
null !== (o = n.logLevel) && void 0 !== o ? o : s.n.INFO,
e,
);
if (l && !n.suppressOverrideMessage) {
var p =
null !== (a = new Error().stack) && void 0 !== a
? a
: "<failed to generate stacktrace>";
l.warn("Current logger will be overwritten from " + p),
u.warn(
"Current logger will overwrite one already registered from " +
p,
);
}
return (0, r.TG)("diag", u, t, !0);
}),
(t.disable = function () {
(0, r.J_)("diag", t);
}),
(t.createComponentLogger = function (e) {
return new i(e);
}),
(t.verbose = e("verbose")),
(t.debug = e("debug")),
(t.info = e("info")),
(t.warn = e("warn")),
(t.error = e("error"));
}
return (
(e.instance = function () {
return (
this._instance || (this._instance = new e()), this._instance
);
}),
e
);
})();
},
92599: (e, t, n) => {
"use strict";
n.d(t, { u: () => l, H: () => c });
var r = n(95774),
i = function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t ? "Object is not iterable." : "Symbol.iterator is not defined.",
);
},
o = (function () {
function e(e) {
this._entries = e ? new Map(e) : new Map();
}
return (
(e.prototype.getEntry = function (e) {
var t = this._entries.get(e);
if (t) return Object.assign({}, t);
}),
(e.prototype.getAllEntries = function () {
return Array.from(this._entries.entries()).map(function (e) {
var t = (function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (
;
(void 0 === t || t-- > 0) && !(r = o.next()).done;
)
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
})(e, 2);
return [t[0], t[1]];
});
}),
(e.prototype.setEntry = function (t, n) {
var r = new e(this._entries);
return r._entries.set(t, n), r;
}),
(e.prototype.removeEntry = function (t) {
var n = new e(this._entries);
return n._entries.delete(t), n;
}),
(e.prototype.removeEntries = function () {
for (var t, n, r = [], o = 0; o < arguments.length; o++)
r[o] = arguments[o];
var s = new e(this._entries);
try {
for (var a = i(r), c = a.next(); !c.done; c = a.next()) {
var l = c.value;
s._entries.delete(l);
}
} catch (e) {
t = { error: e };
} finally {
try {
c && !c.done && (n = a.return) && n.call(a);
} finally {
if (t) throw t.error;
}
}
return s;
}),
(e.prototype.clear = function () {
return new e();
}),
e
);
})(),
s = Symbol("BaggageEntryMetadata"),
a = r.G.instance();
function c(e) {
return void 0 === e && (e = {}), new o(new Map(Object.entries(e)));
}
function l(e) {
return (
"string" != typeof e &&
(a.error(
"Cannot create baggage metadata from unknown type: " + typeof e,
),
(e = "")),
{
__TYPE__: s,
toString: function () {
return e;
},
}
);
}
},
66339: (e, t, n) => {
"use strict";
n.d(t, { D: () => r });
var r = n(7150).c.getInstance();
},
15834: (e, t, n) => {
"use strict";
function r(e) {
return Symbol.for(e);
}
n.d(t, { I: () => i, Y: () => r });
var i = new (function e(t) {
var n = this;
(n._currentContext = t ? new Map(t) : new Map()),
(n.getValue = function (e) {
return n._currentContext.get(e);
}),
(n.setValue = function (t, r) {
var i = new e(n._currentContext);
return i._currentContext.set(t, r), i;
}),
(n.deleteValue = function (t) {
var r = new e(n._currentContext);
return r._currentContext.delete(t), r;
});
})();
},
90928: (e, t, n) => {
"use strict";
n.d(t, { K: () => r });
var r = n(95774).G.instance();
},
16740: (e, t, n) => {
"use strict";
var r;
n.d(t, { n: () => r }),
(function (e) {
(e[(e.NONE = 0)] = "NONE"),
(e[(e.ERROR = 30)] = "ERROR"),
(e[(e.WARN = 50)] = "WARN"),
(e[(e.INFO = 60)] = "INFO"),
(e[(e.DEBUG = 70)] = "DEBUG"),
(e[(e.VERBOSE = 80)] = "VERBOSE"),
(e[(e.ALL = 9999)] = "ALL");
})(r || (r = {}));
},
94284: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
DiagConsoleLogger: () => c,
DiagLogLevel: () => l.n,
INVALID_SPANID: () => $.fQ,
INVALID_SPAN_CONTEXT: () => $.Rr,
INVALID_TRACEID: () => $.AE,
ProxyTracer: () => P.T,
ProxyTracerProvider: () => k.K,
ROOT_CONTEXT: () => s.I,
SamplingDecision: () => N.U,
SpanKind: () => O.M,
SpanStatusCode: () => R.Q,
TraceFlags: () => M.r,
ValueType: () => i,
baggageEntryMetadataFromString: () => o.u,
context: () => V.D,
createContextKey: () => s.Y,
createNoopMeter: () => I,
createTraceState: () => j,
default: () => Z,
defaultTextMapGetter: () => A.r,
defaultTextMapSetter: () => A.M,
diag: () => q.K,
isSpanContextValid: () => H.BM,
isValidSpanId: () => H.Lc,
isValidTraceId: () => H.jN,
metrics: () => X,
propagation: () => Q.u,
trace: () => Y.g,
});
var r,
i,
o = n(92599),
s = n(15834),
a = [
{ n: "error", c: "error" },
{ n: "warn", c: "warn" },
{ n: "info", c: "info" },
{ n: "debug", c: "debug" },
{ n: "verbose", c: "trace" },
],
c = function () {
function e(e) {
return function () {
for (var t = [], n = 0; n < arguments.length; n++)
t[n] = arguments[n];
if (console) {
var r = console[e];
if (
("function" != typeof r && (r = console.log),
"function" == typeof r)
)
return r.apply(console, t);
}
};
}
for (var t = 0; t < a.length; t++) this[a[t].n] = e(a[t].c);
},
l = n(16740),
u =
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
if ("function" != typeof t && null !== t)
throw new TypeError(
"Class extends value " +
String(t) +
" is not a constructor or null",
);
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
p = (function () {
function e() {}
return (
(e.prototype.createHistogram = function (e, t) {
return w;
}),
(e.prototype.createCounter = function (e, t) {
return E;
}),
(e.prototype.createUpDownCounter = function (e, t) {
return S;
}),
(e.prototype.createObservableGauge = function (e, t) {
return x;
}),
(e.prototype.createObservableCounter = function (e, t) {
return T;
}),
(e.prototype.createObservableUpDownCounter = function (e, t) {
return C;
}),
(e.prototype.addBatchObservableCallback = function (e, t) {}),
(e.prototype.removeBatchObservableCallback = function (e) {}),
e
);
})(),
d = function () {},
h = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), (t.prototype.add = function (e, t) {}), t;
})(d),
f = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), (t.prototype.add = function (e, t) {}), t;
})(d),
m = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), (t.prototype.record = function (e, t) {}), t;
})(d),
g = (function () {
function e() {}
return (
(e.prototype.addCallback = function (e) {}),
(e.prototype.removeCallback = function (e) {}),
e
);
})(),
y = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), t;
})(g),
_ = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), t;
})(g),
v = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return u(t, e), t;
})(g),
b = new p(),
E = new h(),
w = new m(),
S = new f(),
T = new y(),
x = new _(),
C = new v();
function I() {
return b;
}
!(function (e) {
(e[(e.INT = 0)] = "INT"), (e[(e.DOUBLE = 1)] = "DOUBLE");
})(i || (i = {}));
var A = n(7008),
P = n(69953),
k = n(5236),
N = n(51227),
O = n(70087),
R = n(1820),
M = n(68726),
L = "[_0-9a-z-*/]",
D = new RegExp(
"^(?:[a-z]" +
L +
"{0,255}|[a-z0-9]" +
L +
"{0,240}@[a-z]" +
L +
"{0,13})$",
),
B = /^[ -~]{0,255}[!-~]$/,
F = /,|=/,
U = (function () {
function e(e) {
(this._internalState = new Map()), e && this._parse(e);
}
return (
(e.prototype.set = function (e, t) {
var n = this._clone();
return (
n._internalState.has(e) && n._internalState.delete(e),
n._internalState.set(e, t),
n
);
}),
(e.prototype.unset = function (e) {
var t = this._clone();
return t._internalState.delete(e), t;
}),
(e.prototype.get = function (e) {
return this._internalState.get(e);
}),
(e.prototype.serialize = function () {
var e = this;
return this._keys()
.reduce(function (t, n) {
return t.push(n + "=" + e.get(n)), t;
}, [])
.join(",");
}),
(e.prototype._parse = function (e) {
e.length > 512 ||
((this._internalState = e
.split(",")
.reverse()
.reduce(function (e, t) {
var n = t.trim(),
r = n.indexOf("=");
if (-1 !== r) {
var i = n.slice(0, r),
o = n.slice(r + 1, t.length);
(function (e) {
return D.test(e);
})(i) &&
(function (e) {
return B.test(e) && !F.test(e);
})(o) &&
e.set(i, o);
}
return e;
}, new Map())),
this._internalState.size > 32 &&
(this._internalState = new Map(
Array.from(this._internalState.entries())
.reverse()
.slice(0, 32),
)));
}),
(e.prototype._keys = function () {
return Array.from(this._internalState.keys()).reverse();
}),
(e.prototype._clone = function () {
var t = new e();
return (t._internalState = new Map(this._internalState)), t;
}),
e
);
})();
function j(e) {
return new U(e);
}
var H = n(97228),
$ = n(27007),
V = n(66339),
q = n(90928),
z = new ((function () {
function e() {}
return (
(e.prototype.getMeter = function (e, t, n) {
return b;
}),
e
);
})())(),
G = n(30658),
K = n(95774),
W = "metrics",
X = (function () {
function e() {}
return (
(e.getInstance = function () {
return (
this._instance || (this._instance = new e()), this._instance
);
}),
(e.prototype.setGlobalMeterProvider = function (e) {
return (0, G.TG)(W, e, K.G.instance());
}),
(e.prototype.getMeterProvider = function () {
return (0, G.Rd)(W) || z;
}),
(e.prototype.getMeter = function (e, t, n) {
return this.getMeterProvider().getMeter(e, t, n);
}),
(e.prototype.disable = function () {
(0, G.J_)(W, K.G.instance());
}),
e
);
})().getInstance(),
Q = n(68303),
Y = n(52210);
const Z = {
context: V.D,
diag: q.K,
metrics: X,
propagation: Q.u,
trace: Y.g,
};
},
30658: (e, t, n) => {
"use strict";
n.d(t, { Rd: () => p, TG: () => u, J_: () => d });
var r = "object" == typeof globalThis ? globalThis : global,
i = "1.4.1",
o = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,
s = (function (e) {
var t = new Set([e]),
n = new Set(),
r = e.match(o);
if (!r)
return function () {
return !1;
};
var i = +r[1],
s = +r[2],
a = +r[3];
if (null != r[4])
return function (t) {
return t === e;
};
function c(e) {
return n.add(e), !1;
}
function l(e) {
return t.add(e), !0;
}
return function (e) {
if (t.has(e)) return !0;
if (n.has(e)) return !1;
var r = e.match(o);
if (!r) return c(e);
var u = +r[1],
p = +r[2],
d = +r[3];
return null != r[4] || i !== u
? c(e)
: 0 === i
? s === p && a <= d
? l(e)
: c(e)
: s <= p
? l(e)
: c(e);
};
})(i),
a = i.split(".")[0],
c = Symbol.for("opentelemetry.js.api." + a),
l = r;
function u(e, t, n, r) {
var o;
void 0 === r && (r = !1);
var s = (l[c] =
null !== (o = l[c]) && void 0 !== o ? o : { version: i });
if (!r && s[e]) {
var a = new Error(
"@opentelemetry/api: Attempted duplicate registration of API: " +
e,
);
return n.error(a.stack || a.message), !1;
}
return s.version !== i
? ((a = new Error(
"@opentelemetry/api: Registration of version v" +
s.version +
" for " +
e +
" does not match previously registered API v" +
i,
)),
n.error(a.stack || a.message),
!1)
: ((s[e] = t),
n.debug(
"@opentelemetry/api: Registered a global for " +
e +
" v" +
i +
".",
),
!0);
}
function p(e) {
var t,
n,
r = null === (t = l[c]) || void 0 === t ? void 0 : t.version;
if (r && s(r))
return null === (n = l[c]) || void 0 === n ? void 0 : n[e];
}
function d(e, t) {
t.debug(
"@opentelemetry/api: Unregistering a global for " +
e +
" v" +
i +
".",
);
var n = l[c];
n && delete n[e];
}
},
68303: (e, t, n) => {
"use strict";
n.d(t, { u: () => y });
var r = n(30658),
i = (function () {
function e() {}
return (
(e.prototype.inject = function (e, t) {}),
(e.prototype.extract = function (e, t) {
return e;
}),
(e.prototype.fields = function () {
return [];
}),
e
);
})(),
o = n(7008),
s = n(7150),
a = (0, n(15834).Y)("OpenTelemetry Baggage Key");
function c(e) {
return e.getValue(a) || void 0;
}
function l() {
return c(s.c.getInstance().active());
}
function u(e, t) {
return e.setValue(a, t);
}
function p(e) {
return e.deleteValue(a);
}
var d = n(92599),
h = n(95774),
f = "propagation",
m = new i(),
g = (function () {
function e() {
(this.createBaggage = d.H),
(this.getBaggage = c),
(this.getActiveBaggage = l),
(this.setBaggage = u),
(this.deleteBaggage = p);
}
return (
(e.getInstance = function () {
return (
this._instance || (this._instance = new e()), this._instance
);
}),
(e.prototype.setGlobalPropagator = function (e) {
return (0, r.TG)(f, e, h.G.instance());
}),
(e.prototype.inject = function (e, t, n) {
return (
void 0 === n && (n = o.M),
this._getGlobalPropagator().inject(e, t, n)
);
}),
(e.prototype.extract = function (e, t, n) {
return (
void 0 === n && (n = o.r),
this._getGlobalPropagator().extract(e, t, n)
);
}),
(e.prototype.fields = function () {
return this._getGlobalPropagator().fields();
}),
(e.prototype.disable = function () {
(0, r.J_)(f, h.G.instance());
}),
(e.prototype._getGlobalPropagator = function () {
return (0, r.Rd)(f) || m;
}),
e
);
})(),
y = g.getInstance();
},
7008: (e, t, n) => {
"use strict";
n.d(t, { M: () => i, r: () => r });
var r = {
get: function (e, t) {
if (null != e) return e[t];
},
keys: function (e) {
return null == e ? [] : Object.keys(e);
},
},
i = {
set: function (e, t, n) {
null != e && (e[t] = n);
},
};
},
52210: (e, t, n) => {
"use strict";
n.d(t, { g: () => l });
var r = n(30658),
i = n(5236),
o = n(97228),
s = n(73557),
a = n(95774),
c = "trace",
l = (function () {
function e() {
(this._proxyTracerProvider = new i.K()),
(this.wrapSpanContext = o.kw),
(this.isSpanContextValid = o.BM),
(this.deleteSpan = s.TW),
(this.getSpan = s.Br),
(this.getActiveSpan = s.HN),
(this.getSpanContext = s.A3),
(this.setSpan = s.WZ),
(this.setSpanContext = s.G3);
}
return (
(e.getInstance = function () {
return (
this._instance || (this._instance = new e()), this._instance
);
}),
(e.prototype.setGlobalTracerProvider = function (e) {
var t = (0, r.TG)(c, this._proxyTracerProvider, a.G.instance());
return t && this._proxyTracerProvider.setDelegate(e), t;
}),
(e.prototype.getTracerProvider = function () {
return (0, r.Rd)(c) || this._proxyTracerProvider;
}),
(e.prototype.getTracer = function (e, t) {
return this.getTracerProvider().getTracer(e, t);
}),
(e.prototype.disable = function () {
(0, r.J_)(c, a.G.instance()),
(this._proxyTracerProvider = new i.K());
}),
e
);
})().getInstance();
},
97817: (e, t, n) => {
"use strict";
n.d(t, { s: () => i });
var r = n(27007),
i = (function () {
function e(e) {
void 0 === e && (e = r.Rr), (this._spanContext = e);
}
return (
(e.prototype.spanContext = function () {
return this._spanContext;
}),
(e.prototype.setAttribute = function (e, t) {
return this;
}),
(e.prototype.setAttributes = function (e) {
return this;
}),
(e.prototype.addEvent = function (e, t) {
return this;
}),
(e.prototype.setStatus = function (e) {
return this;
}),
(e.prototype.updateName = function (e) {
return this;
}),
(e.prototype.end = function (e) {}),
(e.prototype.isRecording = function () {
return !1;
}),
(e.prototype.recordException = function (e, t) {}),
e
);
})();
},
39127: (e, t, n) => {
"use strict";
n.d(t, { E: () => c });
var r = n(7150),
i = n(73557),
o = n(97817),
s = n(97228),
a = r.c.getInstance(),
c = (function () {
function e() {}
return (
(e.prototype.startSpan = function (e, t, n) {
if (
(void 0 === n && (n = a.active()),
Boolean(null == t ? void 0 : t.root))
)
return new o.s();
var r,
c = n && (0, i.A3)(n);
return "object" == typeof (r = c) &&
"string" == typeof r.spanId &&
"string" == typeof r.traceId &&
"number" == typeof r.traceFlags &&
(0, s.BM)(c)
? new o.s(c)
: new o.s();
}),
(e.prototype.startActiveSpan = function (e, t, n, r) {
var o, s, c;
if (!(arguments.length < 2)) {
2 === arguments.length
? (c = t)
: 3 === arguments.length
? ((o = t), (c = n))
: ((o = t), (s = n), (c = r));
var l = null != s ? s : a.active(),
u = this.startSpan(e, o, l),
p = (0, i.WZ)(l, u);
return a.with(p, c, void 0, u);
}
}),
e
);
})();
},
69953: (e, t, n) => {
"use strict";
n.d(t, { T: () => i });
var r = new (n(39127).E)(),
i = (function () {
function e(e, t, n, r) {
(this._provider = e),
(this.name = t),
(this.version = n),
(this.options = r);
}
return (
(e.prototype.startSpan = function (e, t, n) {
return this._getTracer().startSpan(e, t, n);
}),
(e.prototype.startActiveSpan = function (e, t, n, r) {
var i = this._getTracer();
return Reflect.apply(i.startActiveSpan, i, arguments);
}),
(e.prototype._getTracer = function () {
if (this._delegate) return this._delegate;
var e = this._provider.getDelegateTracer(
this.name,
this.version,
this.options,
);
return e ? ((this._delegate = e), this._delegate) : r;
}),
e
);
})();
},
5236: (e, t, n) => {
"use strict";
n.d(t, { K: () => s });
var r = n(69953),
i = n(39127),
o = new ((function () {
function e() {}
return (
(e.prototype.getTracer = function (e, t, n) {
return new i.E();
}),
e
);
})())(),
s = (function () {
function e() {}
return (
(e.prototype.getTracer = function (e, t, n) {
var i;
return null !== (i = this.getDelegateTracer(e, t, n)) &&
void 0 !== i
? i
: new r.T(this, e, t, n);
}),
(e.prototype.getDelegate = function () {
var e;
return null !== (e = this._delegate) && void 0 !== e ? e : o;
}),
(e.prototype.setDelegate = function (e) {
this._delegate = e;
}),
(e.prototype.getDelegateTracer = function (e, t, n) {
var r;
return null === (r = this._delegate) || void 0 === r
? void 0
: r.getTracer(e, t, n);
}),
e
);
})();
},
51227: (e, t, n) => {
"use strict";
var r;
n.d(t, { U: () => r }),
(function (e) {
(e[(e.NOT_RECORD = 0)] = "NOT_RECORD"),
(e[(e.RECORD = 1)] = "RECORD"),
(e[(e.RECORD_AND_SAMPLED = 2)] = "RECORD_AND_SAMPLED");
})(r || (r = {}));
},
73557: (e, t, n) => {
"use strict";
n.d(t, {
A3: () => d,
Br: () => a,
G3: () => p,
HN: () => c,
TW: () => u,
WZ: () => l,
});
var r = n(15834),
i = n(97817),
o = n(7150),
s = (0, r.Y)("OpenTelemetry Context Key SPAN");
function a(e) {
return e.getValue(s) || void 0;
}
function c() {
return a(o.c.getInstance().active());
}
function l(e, t) {
return e.setValue(s, t);
}
function u(e) {
return e.deleteValue(s);
}
function p(e, t) {
return l(e, new i.s(t));
}
function d(e) {
var t;
return null === (t = a(e)) || void 0 === t ? void 0 : t.spanContext();
}
},
27007: (e, t, n) => {
"use strict";
n.d(t, { AE: () => o, Rr: () => s, fQ: () => i });
var r = n(68726),
i = "0000000000000000",
o = "00000000000000000000000000000000",
s = { traceId: o, spanId: i, traceFlags: r.r.NONE };
},
70087: (e, t, n) => {
"use strict";
var r;
n.d(t, { M: () => r }),
(function (e) {
(e[(e.INTERNAL = 0)] = "INTERNAL"),
(e[(e.SERVER = 1)] = "SERVER"),
(e[(e.CLIENT = 2)] = "CLIENT"),
(e[(e.PRODUCER = 3)] = "PRODUCER"),
(e[(e.CONSUMER = 4)] = "CONSUMER");
})(r || (r = {}));
},
97228: (e, t, n) => {
"use strict";
n.d(t, { BM: () => l, Lc: () => c, jN: () => a, kw: () => u });
var r = n(27007),
i = n(97817),
o = /^([0-9a-f]{32})$/i,
s = /^[0-9a-f]{16}$/i;
function a(e) {
return o.test(e) && e !== r.AE;
}
function c(e) {
return s.test(e) && e !== r.fQ;
}
function l(e) {
return a(e.traceId) && c(e.spanId);
}
function u(e) {
return new i.s(e);
}
},
1820: (e, t, n) => {
"use strict";
var r;
n.d(t, { Q: () => r }),
(function (e) {
(e[(e.UNSET = 0)] = "UNSET"),
(e[(e.OK = 1)] = "OK"),
(e[(e.ERROR = 2)] = "ERROR");
})(r || (r = {}));
},
68726: (e, t, n) => {
"use strict";
var r;
n.d(t, { r: () => r }),
(function (e) {
(e[(e.NONE = 0)] = "NONE"), (e[(e.SAMPLED = 1)] = "SAMPLED");
})(r || (r = {}));
},
63420: (e, t, n) => {
"use strict";
var r;
n.d(t, { I: () => r }),
(function (e) {
(e[(e.SUCCESS = 0)] = "SUCCESS"), (e[(e.FAILED = 1)] = "FAILED");
})(r || (r = {}));
},
3250: (e, t, n) => {
"use strict";
n.d(t, {
Cx: () => a,
H3: () => l,
Vo: () => r,
WM: () => s,
bO: () => i,
bU: () => o,
ef: () => c,
});
var r = "=",
i = ";",
o = ",",
s = "baggage",
a = 180,
c = 4096,
l = 8192;
},
80926: (e, t, n) => {
"use strict";
n.d(t, { a: () => a });
var r = n(68303),
i = n(98397),
o = n(3250),
s = n(60315),
a = (function () {
function e() {}
return (
(e.prototype.inject = function (e, t, n) {
var a = r.u.getBaggage(e);
if (a && !(0, i.Ll)(e)) {
var c = (0, s.getKeyPairs)(a)
.filter(function (e) {
return e.length <= o.ef;
})
.slice(0, o.Cx),
l = (0, s.serializeKeyPairs)(c);
l.length > 0 && n.set(t, o.WM, l);
}
}),
(e.prototype.extract = function (e, t, n) {
var i = n.get(t, o.WM),
a = Array.isArray(i) ? i.join(o.bU) : i;
if (!a) return e;
var c = {};
return 0 === a.length
? e
: (a.split(o.bU).forEach(function (e) {
var t = (0, s.parsePairKeyValue)(e);
if (t) {
var n = { value: t.value };
t.metadata && (n.metadata = t.metadata), (c[t.key] = n);
}
}),
0 === Object.entries(c).length
? e
: r.u.setBaggage(e, r.u.createBaggage(c)));
}),
(e.prototype.fields = function () {
return [o.WM];
}),
e
);
})();
},
60315: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
getKeyPairs: () => s,
parseKeyPairsIntoRecord: () => c,
parsePairKeyValue: () => a,
serializeKeyPairs: () => o,
});
var r = n(92599),
i = n(3250);
function o(e) {
return e.reduce(function (e, t) {
var n = "" + e + ("" !== e ? i.bU : "") + t;
return n.length > i.H3 ? e : n;
}, "");
}
function s(e) {
return e.getAllEntries().map(function (e) {
var t = (function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
})(e, 2),
n = t[0],
r = t[1],
o = encodeURIComponent(n) + "=" + encodeURIComponent(r.value);
return (
void 0 !== r.metadata && (o += i.bO + r.metadata.toString()), o
);
});
}
function a(e) {
var t = e.split(i.bO);
if (!(t.length <= 0)) {
var n = t.shift();
if (n) {
var o = n.split(i.Vo);
if (2 === o.length) {
var s,
a = decodeURIComponent(o[0].trim()),
c = decodeURIComponent(o[1].trim());
return (
t.length > 0 && (s = (0, r.u)(t.join(i.bO))),
{ key: a, value: c, metadata: s }
);
}
}
}
}
function c(e) {
return "string" != typeof e || 0 === e.length
? {}
: e
.split(i.bU)
.map(function (e) {
return a(e);
})
.filter(function (e) {
return void 0 !== e && e.value.length > 0;
})
.reduce(function (e, t) {
return (e[t.key] = t.value), e;
}, {});
}
},
60551: (e, t, n) => {
"use strict";
n.d(t, { Do: () => c, FT: () => s, sy: () => a });
var r = n(90928),
i = function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t ? "Object is not iterable." : "Symbol.iterator is not defined.",
);
},
o = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
};
function s(e) {
var t,
n,
s = {};
if ("object" != typeof e || null == e) return s;
try {
for (
var l = i(Object.entries(e)), u = l.next();
!u.done;
u = l.next()
) {
var p = o(u.value, 2),
d = p[0],
h = p[1];
a(d)
? c(h)
? Array.isArray(h)
? (s[d] = h.slice())
: (s[d] = h)
: r.K.warn("Invalid attribute value set for key: " + d)
: r.K.warn("Invalid attribute key: " + d);
}
} catch (e) {
t = { error: e };
} finally {
try {
u && !u.done && (n = l.return) && n.call(l);
} finally {
if (t) throw t.error;
}
}
return s;
}
function a(e) {
return "string" == typeof e && e.length > 0;
}
function c(e) {
return (
null == e ||
(Array.isArray(e)
? (function (e) {
var t, n, r;
try {
for (var o = i(e), s = o.next(); !s.done; s = o.next()) {
var a = s.value;
if (null != a) {
if (!r) {
if (l(a)) {
r = typeof a;
continue;
}
return !1;
}
if (typeof a !== r) return !1;
}
}
} catch (e) {
t = { error: e };
} finally {
try {
s && !s.done && (n = o.return) && n.call(o);
} finally {
if (t) throw t.error;
}
}
return !0;
})(e)
: l(e))
);
}
function l(e) {
switch (typeof e) {
case "number":
case "boolean":
case "string":
return !0;
}
return !1;
}
},
36220: (e, t, n) => {
"use strict";
n.d(t, { L: () => o, c: () => i });
var r = (0, n(26470).x)();
function i(e) {
r = e;
}
function o(e) {
try {
r(e);
} catch (e) {}
}
},
26470: (e, t, n) => {
"use strict";
n.d(t, { x: () => i });
var r = n(90928);
function i() {
return function (e) {
r.K.error(
(function (e) {
return "string" == typeof e
? e
: JSON.stringify(
(function (e) {
for (var t = {}, n = e; null !== n; )
Object.getOwnPropertyNames(n).forEach(function (e) {
if (!t[e]) {
var r = n[e];
r && (t[e] = String(r));
}
}),
(n = Object.getPrototypeOf(n));
return t;
})(e),
);
})(e),
);
};
}
},
97664: (e, t, n) => {
"use strict";
n.d(t, {
Dt: () => m,
J3: () => u,
Jt: () => c,
KO: () => h,
PW: () => d,
U: () => a,
Us: () => p,
X_: () => g,
aE: () => l,
i5: () => s,
ji: () => f,
vF: () => y,
});
var r = n(90471),
i = Math.pow(10, 6),
o = Math.pow(10, 9);
function s(e) {
var t = e / 1e3;
return [Math.trunc(t), Math.round((e % 1e3) * i)];
}
function a() {
var e = r.t.timeOrigin;
if ("number" != typeof e) {
var t = r.t;
e = t.timing && t.timing.fetchStart;
}
return e;
}
function c(e) {
return y(s(a()), s("number" == typeof e ? e : r.t.now()));
}
function l(e) {
if (m(e)) return e;
if ("number" == typeof e) return e < a() ? c(e) : s(e);
if (e instanceof Date) return s(e.getTime());
throw TypeError("Invalid input type");
}
function u(e, t) {
var n = t[0] - e[0],
r = t[1] - e[1];
return r < 0 && ((n -= 1), (r += o)), [n, r];
}
function p(e) {
var t = "" + "0".repeat(9) + e[1] + "Z",
n = t.substr(t.length - 9 - 1);
return new Date(1e3 * e[0]).toISOString().replace("000Z", n);
}
function d(e) {
return e[0] * o + e[1];
}
function h(e) {
return Math.round(1e3 * e[0] + e[1] / 1e6);
}
function f(e) {
return Math.round(1e6 * e[0] + e[1] / 1e3);
}
function m(e) {
return (
Array.isArray(e) &&
2 === e.length &&
"number" == typeof e[0] &&
"number" == typeof e[1]
);
}
function g(e) {
return m(e) || "number" == typeof e || e instanceof Date;
}
function y(e, t) {
var n = [e[0] + t[0], e[1] + t[1]];
return n[1] >= o && ((n[1] -= o), (n[0] += 1)), n;
}
},
47593: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
AlwaysOffSampler: () => R,
AlwaysOnSampler: () => M,
AnchoredClock: () => i,
BindOnceFuture: () => Y.q,
CompositePropagator: () => x.Y,
DEFAULT_ATTRIBUTE_COUNT_LIMIT: () => $.qG,
DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT: () => $.KR,
DEFAULT_ENVIRONMENT: () => $.J9,
DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT: () => $.Ys,
DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT: () => $.VH,
ExportResultCode: () => l.I,
ParentBasedSampler: () => F,
RPCType: () => E,
RandomIdGenerator: () => _,
SDK_INFO: () => S.m,
TRACE_PARENT_HEADER: () => C.FX,
TRACE_STATE_HEADER: () => C.C3,
TimeoutError: () => G,
TraceIdRatioBasedSampler: () => U,
TraceState: () => H.n,
TracesSamplerValues: () => q.J,
VERSION: () => u.q,
W3CBaggagePropagator: () => r.a,
W3CTraceContextPropagator: () => C.jf,
_globalThis: () => h,
addHrTimes: () => c.vF,
baggageUtils: () => p,
callWithTimeout: () => K,
deleteRPCMetadata: () => P,
getEnv: () => d.d,
getEnvWithoutDefaults: () => $.vU,
getRPCMetadata: () => k,
getTimeOrigin: () => c.U,
globalErrorHandler: () => s.L,
hexToBase64: () => y,
hrTime: () => c.Jt,
hrTimeDuration: () => c.J3,
hrTimeToMicroseconds: () => c.ji,
hrTimeToMilliseconds: () => c.KO,
hrTimeToNanoseconds: () => c.PW,
hrTimeToTimeStamp: () => c.Us,
internal: () => J,
isAttributeKey: () => o.sy,
isAttributeValue: () => o.Do,
isTimeInput: () => c.X_,
isTimeInputHrTime: () => c.Dt,
isTracingSuppressed: () => j.Ll,
isUrlIgnored: () => X,
isWrapped: () => Q,
loggingErrorHandler: () => a.x,
merge: () => V.T,
millisToHrTime: () => c.i5,
otperformance: () => w.t,
parseEnvironment: () => $.Ds,
parseTraceParent: () => C.j_,
sanitizeAttributes: () => o.FT,
setGlobalErrorHandler: () => s.c,
setRPCMetadata: () => A,
suppressTracing: () => j.hE,
timeInputToHrTime: () => c.aE,
unrefTimer: () => T.g,
unsuppressTracing: () => j.yy,
urlMatches: () => W,
});
var r = n(80926),
i = (function () {
function e(e, t) {
(this._monotonicClock = t),
(this._epochMillis = e.now()),
(this._performanceMillis = t.now());
}
return (
(e.prototype.now = function () {
var e = this._monotonicClock.now() - this._performanceMillis;
return this._epochMillis + e;
}),
e
);
})(),
o = n(60551),
s = n(36220),
a = n(26470),
c = n(97664),
l = n(63420),
u = n(18923),
p = n(60315),
d = n(54241),
h = "object" == typeof globalThis ? globalThis : global;
function f(e) {
return e >= 48 && e <= 57
? e - 48
: e >= 97 && e <= 102
? e - 87
: e - 55;
}
var m = Buffer.alloc(8),
g = Buffer.alloc(16);
function y(e) {
var t;
t =
16 === e.length
? m
: 32 === e.length
? g
: Buffer.alloc(e.length / 2);
for (var n = 0, r = 0; r < e.length; r += 2) {
var i = f(e.charCodeAt(r)),
o = f(e.charCodeAt(r + 1));
t.writeUInt8((i << 4) | o, n++);
}
return t.toString("base64");
}
var _ = function () {
(this.generateTraceId = b(16)), (this.generateSpanId = b(8));
},
v = Buffer.allocUnsafe(16);
function b(e) {
return function () {
for (var t = 0; t < e / 4; t++)
v.writeUInt32BE((Math.random() * Math.pow(2, 32)) >>> 0, 4 * t);
for (t = 0; t < e && !(v[t] > 0); t++)
t === e - 1 && (v[e - 1] = 1);
return v.toString("hex", 0, e);
};
}
var E,
w = n(90471),
S = n(93290),
T = n(52140),
x = n(63135),
C = n(49588),
I = (0, n(15834).Y)("OpenTelemetry SDK Context Key RPC_METADATA");
function A(e, t) {
return e.setValue(I, t);
}
function P(e) {
return e.deleteValue(I);
}
function k(e) {
return e.getValue(I);
}
!(function (e) {
e.HTTP = "http";
})(E || (E = {}));
var N,
O = n(51227),
R = (function () {
function e() {}
return (
(e.prototype.shouldSample = function () {
return { decision: O.U.NOT_RECORD };
}),
(e.prototype.toString = function () {
return "AlwaysOffSampler";
}),
e
);
})(),
M = (function () {
function e() {}
return (
(e.prototype.shouldSample = function () {
return { decision: O.U.RECORD_AND_SAMPLED };
}),
(e.prototype.toString = function () {
return "AlwaysOnSampler";
}),
e
);
})(),
L = n(52210),
D = n(97228),
B = n(68726),
F = (function () {
function e(e) {
var t, n, r, i;
(this._root = e.root),
this._root ||
((0, s.L)(
new Error(
"ParentBasedSampler must have a root sampler configured",
),
),
(this._root = new M())),
(this._remoteParentSampled =
null !== (t = e.remoteParentSampled) && void 0 !== t
? t
: new M()),
(this._remoteParentNotSampled =
null !== (n = e.remoteParentNotSampled) && void 0 !== n
? n
: new R()),
(this._localParentSampled =
null !== (r = e.localParentSampled) && void 0 !== r
? r
: new M()),
(this._localParentNotSampled =
null !== (i = e.localParentNotSampled) && void 0 !== i
? i
: new R());
}
return (
(e.prototype.shouldSample = function (e, t, n, r, i, o) {
var s = L.g.getSpanContext(e);
return s && (0, D.BM)(s)
? s.isRemote
? s.traceFlags & B.r.SAMPLED
? this._remoteParentSampled.shouldSample(e, t, n, r, i, o)
: this._remoteParentNotSampled.shouldSample(
e,
t,
n,
r,
i,
o,
)
: s.traceFlags & B.r.SAMPLED
? this._localParentSampled.shouldSample(e, t, n, r, i, o)
: this._localParentNotSampled.shouldSample(e, t, n, r, i, o)
: this._root.shouldSample(e, t, n, r, i, o);
}),
(e.prototype.toString = function () {
return (
"ParentBased{root=" +
this._root.toString() +
", remoteParentSampled=" +
this._remoteParentSampled.toString() +
", remoteParentNotSampled=" +
this._remoteParentNotSampled.toString() +
", localParentSampled=" +
this._localParentSampled.toString() +
", localParentNotSampled=" +
this._localParentNotSampled.toString() +
"}"
);
}),
e
);
})(),
U = (function () {
function e(e) {
void 0 === e && (e = 0),
(this._ratio = e),
(this._ratio = this._normalize(e)),
(this._upperBound = Math.floor(4294967295 * this._ratio));
}
return (
(e.prototype.shouldSample = function (e, t) {
return {
decision:
(0, D.jN)(t) && this._accumulate(t) < this._upperBound
? O.U.RECORD_AND_SAMPLED
: O.U.NOT_RECORD,
};
}),
(e.prototype.toString = function () {
return "TraceIdRatioBased{" + this._ratio + "}";
}),
(e.prototype._normalize = function (e) {
return "number" != typeof e || isNaN(e)
? 0
: e >= 1
? 1
: e <= 0
? 0
: e;
}),
(e.prototype._accumulate = function (e) {
for (var t = 0, n = 0; n < e.length / 8; n++) {
var r = 8 * n;
t = (t ^ parseInt(e.slice(r, r + 8), 16)) >>> 0;
}
return t;
}),
e
);
})(),
j = n(98397),
H = n(59598),
$ = n(70450),
V = n(39009),
q = n(29290),
z =
((N = function (e, t) {
return (
(N =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
N(e, t)
);
}),
function (e, t) {
if ("function" != typeof t && null !== t)
throw new TypeError(
"Class extends value " +
String(t) +
" is not a constructor or null",
);
function n() {
this.constructor = e;
}
N(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
G = (function (e) {
function t(n) {
var r = e.call(this, n) || this;
return Object.setPrototypeOf(r, t.prototype), r;
}
return z(t, e), t;
})(Error);
function K(e, t) {
var n,
r = new Promise(function (e, r) {
n = setTimeout(function () {
r(new G("Operation timed out."));
}, t);
});
return Promise.race([e, r]).then(
function (e) {
return clearTimeout(n), e;
},
function (e) {
throw (clearTimeout(n), e);
},
);
}
function W(e, t) {
return "string" == typeof t ? e === t : !!e.match(t);
}
function X(e, t) {
var n, r;
if (!t) return !1;
try {
for (
var i = (function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t
? "Object is not iterable."
: "Symbol.iterator is not defined.",
);
})(t),
o = i.next();
!o.done;
o = i.next()
)
if (W(e, o.value)) return !0;
} catch (e) {
n = { error: e };
} finally {
try {
o && !o.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
return !1;
}
function Q(e) {
return (
"function" == typeof e &&
"function" == typeof e.__original &&
"function" == typeof e.__unwrap &&
!0 === e.__wrapped
);
}
var Y = n(71399),
Z = n(66339),
J = {
_export: function (e, t) {
return new Promise(function (n) {
Z.D.with((0, j.hE)(Z.D.active()), function () {
e.export(t, function (e) {
n(e);
});
});
});
},
};
},
54241: (e, t, n) => {
"use strict";
n.d(t, { d: () => o });
var r = n(22037),
i = n(70450);
function o() {
var e = (0, i.Ds)(process.env);
return Object.assign({ HOSTNAME: r.hostname() }, i.J9, e);
}
},
90471: (e, t, n) => {
"use strict";
n.d(t, { t: () => r });
var r = require("perf_hooks").performance;
},
93290: (e, t, n) => {
"use strict";
n.d(t, { m: () => s });
var r,
i = n(18923),
o = n(95364),
s =
(((r = {})[o.R9.TELEMETRY_SDK_NAME] = "opentelemetry"),
(r[o.R9.PROCESS_RUNTIME_NAME] = "node"),
(r[o.R9.TELEMETRY_SDK_LANGUAGE] = o.Te.NODEJS),
(r[o.R9.TELEMETRY_SDK_VERSION] = i.q),
r);
},
52140: (e, t, n) => {
"use strict";
function r(e) {
e.unref();
}
n.d(t, { g: () => r });
},
63135: (e, t, n) => {
"use strict";
n.d(t, { Y: () => i });
var r = n(90928),
i = (function () {
function e(e) {
var t;
void 0 === e && (e = {}),
(this._propagators =
null !== (t = e.propagators) && void 0 !== t ? t : []),
(this._fields = Array.from(
new Set(
this._propagators
.map(function (e) {
return "function" == typeof e.fields ? e.fields() : [];
})
.reduce(function (e, t) {
return e.concat(t);
}, []),
),
));
}
return (
(e.prototype.inject = function (e, t, n) {
var i, o;
try {
for (
var s = (function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t
? "Object is not iterable."
: "Symbol.iterator is not defined.",
);
})(this._propagators),
a = s.next();
!a.done;
a = s.next()
) {
var c = a.value;
try {
c.inject(e, t, n);
} catch (e) {
r.K.warn(
"Failed to inject with " +
c.constructor.name +
". Err: " +
e.message,
);
}
}
} catch (e) {
i = { error: e };
} finally {
try {
a && !a.done && (o = s.return) && o.call(s);
} finally {
if (i) throw i.error;
}
}
}),
(e.prototype.extract = function (e, t, n) {
return this._propagators.reduce(function (e, i) {
try {
return i.extract(e, t, n);
} catch (e) {
r.K.warn(
"Failed to inject with " +
i.constructor.name +
". Err: " +
e.message,
);
}
return e;
}, e);
}),
(e.prototype.fields = function () {
return this._fields.slice();
}),
e
);
})();
},
59598: (e, t, n) => {
"use strict";
n.d(t, { n: () => a });
var r = "[_0-9a-z-*/]",
i = new RegExp(
"^(?:[a-z]" +
r +
"{0,255}|[a-z0-9]" +
r +
"{0,240}@[a-z]" +
r +
"{0,13})$",
),
o = /^[ -~]{0,255}[!-~]$/,
s = /,|=/,
a = (function () {
function e(e) {
(this._internalState = new Map()), e && this._parse(e);
}
return (
(e.prototype.set = function (e, t) {
var n = this._clone();
return (
n._internalState.has(e) && n._internalState.delete(e),
n._internalState.set(e, t),
n
);
}),
(e.prototype.unset = function (e) {
var t = this._clone();
return t._internalState.delete(e), t;
}),
(e.prototype.get = function (e) {
return this._internalState.get(e);
}),
(e.prototype.serialize = function () {
var e = this;
return this._keys()
.reduce(function (t, n) {
return t.push(n + "=" + e.get(n)), t;
}, [])
.join(",");
}),
(e.prototype._parse = function (e) {
e.length > 512 ||
((this._internalState = e
.split(",")
.reverse()
.reduce(function (e, t) {
var n = t.trim(),
r = n.indexOf("=");
if (-1 !== r) {
var a = n.slice(0, r),
c = n.slice(r + 1, t.length);
(function (e) {
return i.test(e);
})(a) &&
(function (e) {
return o.test(e) && !s.test(e);
})(c) &&
e.set(a, c);
}
return e;
}, new Map())),
this._internalState.size > 32 &&
(this._internalState = new Map(
Array.from(this._internalState.entries())
.reverse()
.slice(0, 32),
)));
}),
(e.prototype._keys = function () {
return Array.from(this._internalState.keys()).reverse();
}),
(e.prototype._clone = function () {
var t = new e();
return (t._internalState = new Map(this._internalState)), t;
}),
e
);
})();
},
49588: (e, t, n) => {
"use strict";
n.d(t, { C3: () => l, FX: () => c, j_: () => p, jf: () => d });
var r = n(52210),
i = n(97228),
o = n(68726),
s = n(98397),
a = n(59598),
c = "traceparent",
l = "tracestate",
u = new RegExp(
"^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$",
);
function p(e) {
var t = u.exec(e);
return t
? "00" === t[1] && t[5]
? null
: { traceId: t[2], spanId: t[3], traceFlags: parseInt(t[4], 16) }
: null;
}
var d = (function () {
function e() {}
return (
(e.prototype.inject = function (e, t, n) {
var a = r.g.getSpanContext(e);
if (a && !(0, s.Ll)(e) && (0, i.BM)(a)) {
var u =
"00-" +
a.traceId +
"-" +
a.spanId +
"-0" +
Number(a.traceFlags || o.r.NONE).toString(16);
n.set(t, c, u),
a.traceState && n.set(t, l, a.traceState.serialize());
}
}),
(e.prototype.extract = function (e, t, n) {
var i = n.get(t, c);
if (!i) return e;
var o = Array.isArray(i) ? i[0] : i;
if ("string" != typeof o) return e;
var s = p(o);
if (!s) return e;
s.isRemote = !0;
var u = n.get(t, l);
if (u) {
var d = Array.isArray(u) ? u.join(",") : u;
s.traceState = new a.n("string" == typeof d ? d : void 0);
}
return r.g.setSpanContext(e, s);
}),
(e.prototype.fields = function () {
return [c, l];
}),
e
);
})();
},
98397: (e, t, n) => {
"use strict";
n.d(t, { Ll: () => s, hE: () => i, yy: () => o });
var r = (0, n(15834).Y)(
"OpenTelemetry SDK Context Key SUPPRESS_TRACING",
);
function i(e) {
return e.setValue(r, !0);
}
function o(e) {
return e.deleteValue(r);
}
function s(e) {
return !0 === e.getValue(r);
}
},
71399: (e, t, n) => {
"use strict";
n.d(t, { q: () => s });
var r = (function () {
function e() {
var e = this;
this._promise = new Promise(function (t, n) {
(e._resolve = t), (e._reject = n);
});
}
return (
Object.defineProperty(e.prototype, "promise", {
get: function () {
return this._promise;
},
enumerable: !1,
configurable: !0,
}),
(e.prototype.resolve = function (e) {
this._resolve(e);
}),
(e.prototype.reject = function (e) {
this._reject(e);
}),
e
);
})(),
i = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
},
o = function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
},
s = (function () {
function e(e, t) {
(this._callback = e),
(this._that = t),
(this._isCalled = !1),
(this._deferred = new r());
}
return (
Object.defineProperty(e.prototype, "isCalled", {
get: function () {
return this._isCalled;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "promise", {
get: function () {
return this._deferred.promise;
},
enumerable: !1,
configurable: !0,
}),
(e.prototype.call = function () {
for (var e, t = this, n = [], r = 0; r < arguments.length; r++)
n[r] = arguments[r];
if (!this._isCalled) {
this._isCalled = !0;
try {
Promise.resolve(
(e = this._callback).call.apply(
e,
o([this._that], i(n), !1),
),
).then(
function (e) {
return t._deferred.resolve(e);
},
function (e) {
return t._deferred.reject(e);
},
);
} catch (e) {
this._deferred.reject(e);
}
}
return this._deferred.promise;
}),
e
);
})();
},
70450: (e, t, n) => {
"use strict";
n.d(t, {
qG: () => h,
KR: () => d,
J9: () => g,
Ys: () => f,
VH: () => m,
vU: () => S,
Ds: () => w,
});
var r = n(16740),
i = n(29290),
o =
"object" == typeof globalThis
? globalThis
: "object" == typeof self
? self
: "object" == typeof window
? window
: "object" == typeof global
? global
: {},
s = ["OTEL_SDK_DISABLED"];
function a(e) {
return s.indexOf(e) > -1;
}
var c = [
"OTEL_BSP_EXPORT_TIMEOUT",
"OTEL_BSP_MAX_EXPORT_BATCH_SIZE",
"OTEL_BSP_MAX_QUEUE_SIZE",
"OTEL_BSP_SCHEDULE_DELAY",
"OTEL_BLRP_EXPORT_TIMEOUT",
"OTEL_BLRP_MAX_EXPORT_BATCH_SIZE",
"OTEL_BLRP_MAX_QUEUE_SIZE",
"OTEL_BLRP_SCHEDULE_DELAY",
"OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT",
"OTEL_ATTRIBUTE_COUNT_LIMIT",
"OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT",
"OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT",
"OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT",
"OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT",
"OTEL_SPAN_EVENT_COUNT_LIMIT",
"OTEL_SPAN_LINK_COUNT_LIMIT",
"OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT",
"OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT",
"OTEL_EXPORTER_OTLP_TIMEOUT",
"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT",
"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT",
"OTEL_EXPORTER_JAEGER_AGENT_PORT",
];
function l(e) {
return c.indexOf(e) > -1;
}
var u = ["OTEL_NO_PATCH_MODULES", "OTEL_PROPAGATORS"];
function p(e) {
return u.indexOf(e) > -1;
}
var d = 1 / 0,
h = 128,
f = 128,
m = 128,
g = {
OTEL_SDK_DISABLED: !1,
CONTAINER_NAME: "",
ECS_CONTAINER_METADATA_URI_V4: "",
ECS_CONTAINER_METADATA_URI: "",
HOSTNAME: "",
KUBERNETES_SERVICE_HOST: "",
NAMESPACE: "",
OTEL_BSP_EXPORT_TIMEOUT: 3e4,
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: 512,
OTEL_BSP_MAX_QUEUE_SIZE: 2048,
OTEL_BSP_SCHEDULE_DELAY: 5e3,
OTEL_BLRP_EXPORT_TIMEOUT: 3e4,
OTEL_BLRP_MAX_EXPORT_BATCH_SIZE: 512,
OTEL_BLRP_MAX_QUEUE_SIZE: 2048,
OTEL_BLRP_SCHEDULE_DELAY: 5e3,
OTEL_EXPORTER_JAEGER_AGENT_HOST: "",
OTEL_EXPORTER_JAEGER_AGENT_PORT: 6832,
OTEL_EXPORTER_JAEGER_ENDPOINT: "",
OTEL_EXPORTER_JAEGER_PASSWORD: "",
OTEL_EXPORTER_JAEGER_USER: "",
OTEL_EXPORTER_OTLP_ENDPOINT: "",
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "",
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: "",
OTEL_EXPORTER_OTLP_HEADERS: "",
OTEL_EXPORTER_OTLP_TRACES_HEADERS: "",
OTEL_EXPORTER_OTLP_METRICS_HEADERS: "",
OTEL_EXPORTER_OTLP_TIMEOUT: 1e4,
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: 1e4,
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT: 1e4,
OTEL_EXPORTER_ZIPKIN_ENDPOINT: "http://localhost:9411/api/v2/spans",
OTEL_LOG_LEVEL: r.n.INFO,
OTEL_NO_PATCH_MODULES: [],
OTEL_PROPAGATORS: ["tracecontext", "baggage"],
OTEL_RESOURCE_ATTRIBUTES: "",
OTEL_SERVICE_NAME: "",
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: d,
OTEL_ATTRIBUTE_COUNT_LIMIT: h,
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT: d,
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: h,
OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT: d,
OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT: h,
OTEL_SPAN_EVENT_COUNT_LIMIT: 128,
OTEL_SPAN_LINK_COUNT_LIMIT: 128,
OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT: f,
OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT: m,
OTEL_TRACES_EXPORTER: "",
OTEL_TRACES_SAMPLER: i.J.ParentBasedAlwaysOn,
OTEL_TRACES_SAMPLER_ARG: "",
OTEL_LOGS_EXPORTER: "",
OTEL_EXPORTER_OTLP_INSECURE: "",
OTEL_EXPORTER_OTLP_TRACES_INSECURE: "",
OTEL_EXPORTER_OTLP_METRICS_INSECURE: "",
OTEL_EXPORTER_OTLP_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_COMPRESSION: "",
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: "",
OTEL_EXPORTER_OTLP_METRICS_COMPRESSION: "",
OTEL_EXPORTER_OTLP_CLIENT_KEY: "",
OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY: "",
OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY: "",
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE: "",
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf",
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: "http/protobuf",
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: "http/protobuf",
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: "cumulative",
};
function y(e, t, n) {
if (void 0 !== n[e]) {
var r = String(n[e]);
t[e] = "true" === r.toLowerCase();
}
}
function _(e, t, n, r, i) {
if (
(void 0 === r && (r = -1 / 0),
void 0 === i && (i = 1 / 0),
void 0 !== n[e])
) {
var o = Number(n[e]);
isNaN(o) || (t[e] = o < r ? r : o > i ? i : o);
}
}
function v(e, t, n, r) {
void 0 === r && (r = ",");
var i = n[e];
"string" == typeof i &&
(t[e] = i.split(r).map(function (e) {
return e.trim();
}));
}
var b = {
ALL: r.n.ALL,
VERBOSE: r.n.VERBOSE,
DEBUG: r.n.DEBUG,
INFO: r.n.INFO,
WARN: r.n.WARN,
ERROR: r.n.ERROR,
NONE: r.n.NONE,
};
function E(e, t, n) {
var r = n[e];
if ("string" == typeof r) {
var i = b[r.toUpperCase()];
null != i && (t[e] = i);
}
}
function w(e) {
var t = {};
for (var n in g) {
var r = n;
if ("OTEL_LOG_LEVEL" === r) E(r, t, e);
else if (a(r)) y(r, t, e);
else if (l(r)) _(r, t, e);
else if (p(r)) v(r, t, e);
else {
var i = e[r];
null != i && (t[r] = String(i));
}
}
return t;
}
function S() {
return "undefined" != typeof process && process && process.env
? w(process.env)
: w(o);
}
},
39009: (e, t, n) => {
"use strict";
n.d(t, { T: () => h });
var r,
i,
o = Function.prototype.toString,
s = o.call(Object),
a =
((r = Object.getPrototypeOf),
(i = Object),
function (e) {
return r(i(e));
}),
c = Object.prototype,
l = c.hasOwnProperty,
u = Symbol ? Symbol.toStringTag : void 0,
p = c.toString;
function d(e) {
if (
!(function (e) {
return null != e && "object" == typeof e;
})(e) ||
"[object Object]" !==
(function (e) {
return null == e
? void 0 === e
? "[object Undefined]"
: "[object Null]"
: u && u in Object(e)
? (function (e) {
var t = l.call(e, u),
n = e[u],
r = !1;
try {
(e[u] = void 0), (r = !0);
} catch (e) {}
var i = p.call(e);
return r && (t ? (e[u] = n) : delete e[u]), i;
})(e)
: (function (e) {
return p.call(e);
})(e);
})(e)
)
return !1;
var t = a(e);
if (null === t) return !0;
var n = l.call(t, "constructor") && t.constructor;
return "function" == typeof n && n instanceof n && o.call(n) === s;
}
function h() {
for (var e = [], t = 0; t < arguments.length; t++)
e[t] = arguments[t];
for (var n = e.shift(), r = new WeakMap(); e.length > 0; )
n = m(n, e.shift(), 0, r);
return n;
}
function f(e) {
return y(e) ? e.slice() : e;
}
function m(e, t, n, r) {
var i;
if ((void 0 === n && (n = 0), !(n > 20))) {
if ((n++, b(e) || b(t) || _(t))) i = f(t);
else if (y(e)) {
if (((i = e.slice()), y(t)))
for (var o = 0, s = t.length; o < s; o++) i.push(f(t[o]));
else if (v(t))
for (o = 0, s = (a = Object.keys(t)).length; o < s; o++)
i[(c = a[o])] = f(t[c]);
} else if (v(e))
if (v(t)) {
if (
!(function (e, t) {
return !(!d(e) || !d(t));
})(e, t)
)
return t;
var a;
for (
i = Object.assign({}, e),
o = 0,
s = (a = Object.keys(t)).length;
o < s;
o++
) {
var c,
l = t[(c = a[o])];
if (b(l)) void 0 === l ? delete i[c] : (i[c] = l);
else {
var u = i[c],
p = l;
if (g(e, c, r) || g(t, c, r)) delete i[c];
else {
if (v(u) && v(p)) {
var h = r.get(u) || [],
E = r.get(p) || [];
h.push({ obj: e, key: c }),
E.push({ obj: t, key: c }),
r.set(u, h),
r.set(p, E);
}
i[c] = m(i[c], l, n, r);
}
}
}
} else i = t;
return i;
}
}
function g(e, t, n) {
for (var r = n.get(e[t]) || [], i = 0, o = r.length; i < o; i++) {
var s = r[i];
if (s.key === t && s.obj === e) return !0;
}
return !1;
}
function y(e) {
return Array.isArray(e);
}
function _(e) {
return "function" == typeof e;
}
function v(e) {
return !b(e) && !y(e) && !_(e) && "object" == typeof e;
}
function b(e) {
return (
"string" == typeof e ||
"number" == typeof e ||
"boolean" == typeof e ||
void 0 === e ||
e instanceof Date ||
e instanceof RegExp ||
null === e
);
}
},
29290: (e, t, n) => {
"use strict";
var r;
n.d(t, { J: () => r }),
(function (e) {
(e.AlwaysOff = "always_off"),
(e.AlwaysOn = "always_on"),
(e.ParentBasedAlwaysOff = "parentbased_always_off"),
(e.ParentBasedAlwaysOn = "parentbased_always_on"),
(e.ParentBasedTraceIdRatio = "parentbased_traceidratio"),
(e.TraceIdRatio = "traceidratio");
})(r || (r = {}));
},
18923: (e, t, n) => {
"use strict";
n.d(t, { q: () => r });
var r = "1.12.0";
},
82506: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
AlwaysOffSampler: () => E,
AlwaysOnSampler: () => w,
BasicTracerProvider: () => re,
BatchSpanProcessor: () => ne,
ConsoleSpanExporter: () => ie,
ForceFlushState: () => B,
InMemorySpanExporter: () => oe,
NoopSpanProcessor: () => Q,
ParentBasedSampler: () => x,
RandomIdGenerator: () => R,
SamplingDecision: () => r,
SimpleSpanProcessor: () => ae,
Span: () => _,
TraceIdRatioBasedSampler: () => C,
Tracer: () => F,
});
var r,
i = n(66339),
o = n(52210),
s = n(90928),
a = n(27007),
c = n(70087),
l = n(51227),
u = n(68726),
p = n(98397),
d = n(60551),
h = n(1820),
f = n(90471),
m = n(97664),
g = n(73108),
y = function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (; (void 0 === t || t-- > 0) && !(r = o.next()).done; )
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
},
_ = (function () {
function e(e, t, n, r, i, o, s, a, c) {
void 0 === s && (s = []),
(this.attributes = {}),
(this.links = []),
(this.events = []),
(this._droppedAttributesCount = 0),
(this._droppedEventsCount = 0),
(this._droppedLinksCount = 0),
(this.status = { code: h.Q.UNSET }),
(this.endTime = [0, 0]),
(this._ended = !1),
(this._duration = [-1, -1]),
(this.name = n),
(this._spanContext = r),
(this.parentSpanId = o),
(this.kind = i),
(this.links = s);
var l = Date.now();
(this._performanceStartTime = f.t.now()),
(this._performanceOffset =
l - (this._performanceStartTime + (0, m.U)())),
(this._startTimeProvided = null != a),
(this.startTime = this._getTime(null != a ? a : l)),
(this.resource = e.resource),
(this.instrumentationLibrary = e.instrumentationLibrary),
(this._spanLimits = e.getSpanLimits()),
(this._spanProcessor = e.getActiveSpanProcessor()),
this._spanProcessor.onStart(this, t),
(this._attributeValueLengthLimit =
this._spanLimits.attributeValueLengthLimit || 0);
}
return (
(e.prototype.spanContext = function () {
return this._spanContext;
}),
(e.prototype.setAttribute = function (e, t) {
return null == t || this._isSpanEnded()
? this
: 0 === e.length
? (s.K.warn("Invalid attribute key: " + e), this)
: (0, d.Do)(t)
? Object.keys(this.attributes).length >=
this._spanLimits.attributeCountLimit &&
!Object.prototype.hasOwnProperty.call(this.attributes, e)
? (this._droppedAttributesCount++, this)
: ((this.attributes[e] = this._truncateToSize(t)), this)
: (s.K.warn("Invalid attribute value set for key: " + e),
this);
}),
(e.prototype.setAttributes = function (e) {
var t, n;
try {
for (
var r = (function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t
? "Object is not iterable."
: "Symbol.iterator is not defined.",
);
})(Object.entries(e)),
i = r.next();
!i.done;
i = r.next()
) {
var o = y(i.value, 2),
s = o[0],
a = o[1];
this.setAttribute(s, a);
}
} catch (e) {
t = { error: e };
} finally {
try {
i && !i.done && (n = r.return) && n.call(r);
} finally {
if (t) throw t.error;
}
}
return this;
}),
(e.prototype.addEvent = function (e, t, n) {
if (this._isSpanEnded()) return this;
if (0 === this._spanLimits.eventCountLimit)
return (
s.K.warn("No events allowed."),
this._droppedEventsCount++,
this
);
this.events.length >= this._spanLimits.eventCountLimit &&
(s.K.warn("Dropping extra events."),
this.events.shift(),
this._droppedEventsCount++),
(0, m.X_)(t) && ((0, m.X_)(n) || (n = t), (t = void 0));
var r = (0, d.FT)(t);
return (
this.events.push({
name: e,
attributes: r,
time: this._getTime(n),
droppedAttributesCount: 0,
}),
this
);
}),
(e.prototype.setStatus = function (e) {
return this._isSpanEnded() || (this.status = e), this;
}),
(e.prototype.updateName = function (e) {
return this._isSpanEnded() || (this.name = e), this;
}),
(e.prototype.end = function (e) {
this._isSpanEnded()
? s.K.error(
this.name +
" " +
this._spanContext.traceId +
"-" +
this._spanContext.spanId +
" - You can only call end() on a span once.",
)
: ((this._ended = !0),
(this.endTime = this._getTime(e)),
(this._duration = (0, m.J3)(this.startTime, this.endTime)),
this._duration[0] < 0 &&
(s.K.warn(
"Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",
this.startTime,
this.endTime,
),
(this.endTime = this.startTime.slice()),
(this._duration = [0, 0])),
this._spanProcessor.onEnd(this));
}),
(e.prototype._getTime = function (e) {
if ("number" == typeof e && e < f.t.now())
return (0, m.Jt)(e + this._performanceOffset);
if ("number" == typeof e) return (0, m.i5)(e);
if (e instanceof Date) return (0, m.i5)(e.getTime());
if ((0, m.Dt)(e)) return e;
if (this._startTimeProvided) return (0, m.i5)(Date.now());
var t = f.t.now() - this._performanceStartTime;
return (0, m.vF)(this.startTime, (0, m.i5)(t));
}),
(e.prototype.isRecording = function () {
return !1 === this._ended;
}),
(e.prototype.recordException = function (e, t) {
var n = {};
"string" == typeof e
? (n[g.og.EXCEPTION_MESSAGE] = e)
: e &&
(e.code
? (n[g.og.EXCEPTION_TYPE] = e.code.toString())
: e.name && (n[g.og.EXCEPTION_TYPE] = e.name),
e.message && (n[g.og.EXCEPTION_MESSAGE] = e.message),
e.stack && (n[g.og.EXCEPTION_STACKTRACE] = e.stack)),
n[g.og.EXCEPTION_TYPE] || n[g.og.EXCEPTION_MESSAGE]
? this.addEvent("exception", n, t)
: s.K.warn("Failed to record an exception " + e);
}),
Object.defineProperty(e.prototype, "duration", {
get: function () {
return this._duration;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "ended", {
get: function () {
return this._ended;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "droppedAttributesCount", {
get: function () {
return this._droppedAttributesCount;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "droppedEventsCount", {
get: function () {
return this._droppedEventsCount;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "droppedLinksCount", {
get: function () {
return this._droppedLinksCount;
},
enumerable: !1,
configurable: !0,
}),
(e.prototype._isSpanEnded = function () {
return (
this._ended &&
s.K.warn(
"Can not execute the operation on ended Span {traceId: " +
this._spanContext.traceId +
", spanId: " +
this._spanContext.spanId +
"}",
),
this._ended
);
}),
(e.prototype._truncateToLimitUtil = function (e, t) {
return e.length <= t ? e : e.substr(0, t);
}),
(e.prototype._truncateToSize = function (e) {
var t = this,
n = this._attributeValueLengthLimit;
return n <= 0
? (s.K.warn(
"Attribute value limit must be positive, got " + n,
),
e)
: "string" == typeof e
? this._truncateToLimitUtil(e, n)
: Array.isArray(e)
? e.map(function (e) {
return "string" == typeof e
? t._truncateToLimitUtil(e, n)
: e;
})
: e;
}),
e
);
})(),
v = n(54241),
b = n(29290);
!(function (e) {
(e[(e.NOT_RECORD = 0)] = "NOT_RECORD"),
(e[(e.RECORD = 1)] = "RECORD"),
(e[(e.RECORD_AND_SAMPLED = 2)] = "RECORD_AND_SAMPLED");
})(r || (r = {}));
var E = (function () {
function e() {}
return (
(e.prototype.shouldSample = function () {
return { decision: r.NOT_RECORD };
}),
(e.prototype.toString = function () {
return "AlwaysOffSampler";
}),
e
);
})(),
w = (function () {
function e() {}
return (
(e.prototype.shouldSample = function () {
return { decision: r.RECORD_AND_SAMPLED };
}),
(e.prototype.toString = function () {
return "AlwaysOnSampler";
}),
e
);
})(),
S = n(97228),
T = n(36220),
x = (function () {
function e(e) {
var t, n, r, i;
(this._root = e.root),
this._root ||
((0, T.L)(
new Error(
"ParentBasedSampler must have a root sampler configured",
),
),
(this._root = new w())),
(this._remoteParentSampled =
null !== (t = e.remoteParentSampled) && void 0 !== t
? t
: new w()),
(this._remoteParentNotSampled =
null !== (n = e.remoteParentNotSampled) && void 0 !== n
? n
: new E()),
(this._localParentSampled =
null !== (r = e.localParentSampled) && void 0 !== r
? r
: new w()),
(this._localParentNotSampled =
null !== (i = e.localParentNotSampled) && void 0 !== i
? i
: new E());
}
return (
(e.prototype.shouldSample = function (e, t, n, r, i, s) {
var a = o.g.getSpanContext(e);
return a && (0, S.BM)(a)
? a.isRemote
? a.traceFlags & u.r.SAMPLED
? this._remoteParentSampled.shouldSample(e, t, n, r, i, s)
: this._remoteParentNotSampled.shouldSample(
e,
t,
n,
r,
i,
s,
)
: a.traceFlags & u.r.SAMPLED
? this._localParentSampled.shouldSample(e, t, n, r, i, s)
: this._localParentNotSampled.shouldSample(e, t, n, r, i, s)
: this._root.shouldSample(e, t, n, r, i, s);
}),
(e.prototype.toString = function () {
return (
"ParentBased{root=" +
this._root.toString() +
", remoteParentSampled=" +
this._remoteParentSampled.toString() +
", remoteParentNotSampled=" +
this._remoteParentNotSampled.toString() +
", localParentSampled=" +
this._localParentSampled.toString() +
", localParentNotSampled=" +
this._localParentNotSampled.toString() +
"}"
);
}),
e
);
})(),
C = (function () {
function e(e) {
void 0 === e && (e = 0),
(this._ratio = e),
(this._ratio = this._normalize(e)),
(this._upperBound = Math.floor(4294967295 * this._ratio));
}
return (
(e.prototype.shouldSample = function (e, t) {
return {
decision:
(0, S.jN)(t) && this._accumulate(t) < this._upperBound
? r.RECORD_AND_SAMPLED
: r.NOT_RECORD,
};
}),
(e.prototype.toString = function () {
return "TraceIdRatioBased{" + this._ratio + "}";
}),
(e.prototype._normalize = function (e) {
return "number" != typeof e || isNaN(e)
? 0
: e >= 1
? 1
: e <= 0
? 0
: e;
}),
(e.prototype._accumulate = function (e) {
for (var t = 0, n = 0; n < e.length / 8; n++) {
var r = 8 * n;
t = (t ^ parseInt(e.slice(r, r + 8), 16)) >>> 0;
}
return t;
}),
e
);
})(),
I = (0, v.d)(),
A = b.J.AlwaysOn;
function P() {
return {
sampler: k(I),
forceFlushTimeoutMillis: 3e4,
generalLimits: {
attributeValueLengthLimit: (0, v.d)()
.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,
attributeCountLimit: (0, v.d)().OTEL_ATTRIBUTE_COUNT_LIMIT,
},
spanLimits: {
attributeValueLengthLimit: (0, v.d)()
.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,
attributeCountLimit: (0, v.d)().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,
linkCountLimit: (0, v.d)().OTEL_SPAN_LINK_COUNT_LIMIT,
eventCountLimit: (0, v.d)().OTEL_SPAN_EVENT_COUNT_LIMIT,
attributePerEventCountLimit: (0, v.d)()
.OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,
attributePerLinkCountLimit: (0, v.d)()
.OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,
},
};
}
function k(e) {
switch ((void 0 === e && (e = (0, v.d)()), e.OTEL_TRACES_SAMPLER)) {
case b.J.AlwaysOn:
return new w();
case b.J.AlwaysOff:
return new E();
case b.J.ParentBasedAlwaysOn:
return new x({ root: new w() });
case b.J.ParentBasedAlwaysOff:
return new x({ root: new E() });
case b.J.TraceIdRatio:
return new C(N(e));
case b.J.ParentBasedTraceIdRatio:
return new x({ root: new C(N(e)) });
default:
return (
s.K.error(
'OTEL_TRACES_SAMPLER value "' +
e.OTEL_TRACES_SAMPLER +
" invalid, defaulting to " +
A +
'".',
),
new w()
);
}
}
function N(e) {
if (
void 0 === e.OTEL_TRACES_SAMPLER_ARG ||
"" === e.OTEL_TRACES_SAMPLER_ARG
)
return (
s.K.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."), 1
);
var t = Number(e.OTEL_TRACES_SAMPLER_ARG);
return isNaN(t)
? (s.K.error(
"OTEL_TRACES_SAMPLER_ARG=" +
e.OTEL_TRACES_SAMPLER_ARG +
" was given, but it is invalid, defaulting to 1.",
),
1)
: t < 0 || t > 1
? (s.K.error(
"OTEL_TRACES_SAMPLER_ARG=" +
e.OTEL_TRACES_SAMPLER_ARG +
" was given, but it is out of range ([0..1]), defaulting to 1.",
),
1)
: t;
}
var O = n(70450),
R = function () {
(this.generateTraceId = L(16)), (this.generateSpanId = L(8));
},
M = Buffer.allocUnsafe(16);
function L(e) {
return function () {
for (var t = 0; t < e / 4; t++)
M.writeUInt32BE((Math.random() * Math.pow(2, 32)) >>> 0, 4 * t);
for (t = 0; t < e && !(M[t] > 0); t++)
t === e - 1 && (M[e - 1] = 1);
return M.toString("hex", 0, e);
};
}
var D,
B,
F = (function () {
function e(e, t, n) {
this._tracerProvider = n;
var r,
i,
o,
s,
a =
((r = t),
(i = { sampler: k() }),
(o = P()),
((s = Object.assign({}, o, i, r)).generalLimits =
Object.assign({}, o.generalLimits, r.generalLimits || {})),
(s.spanLimits = Object.assign(
{},
o.spanLimits,
r.spanLimits || {},
)),
s);
(this._sampler = a.sampler),
(this._generalLimits = a.generalLimits),
(this._spanLimits = a.spanLimits),
(this._idGenerator = t.idGenerator || new R()),
(this.resource = n.resource),
(this.instrumentationLibrary = e);
}
return (
(e.prototype.startSpan = function (e, t, n) {
var r, h, f;
void 0 === t && (t = {}),
void 0 === n && (n = i.D.active()),
t.root && (n = o.g.deleteSpan(n));
var m = o.g.getSpan(n);
if ((0, p.Ll)(n))
return (
s.K.debug(
"Instrumentation suppressed, returning Noop Span",
),
o.g.wrapSpanContext(a.Rr)
);
var g,
y,
v,
b = null == m ? void 0 : m.spanContext(),
E = this._idGenerator.generateSpanId();
b && o.g.isSpanContextValid(b)
? ((g = b.traceId), (y = b.traceState), (v = b.spanId))
: (g = this._idGenerator.generateTraceId());
var w =
null !== (r = t.kind) && void 0 !== r ? r : c.M.INTERNAL,
S = (null !== (h = t.links) && void 0 !== h ? h : []).map(
function (e) {
return {
context: e.context,
attributes: (0, d.FT)(e.attributes),
};
},
),
T = (0, d.FT)(t.attributes),
x = this._sampler.shouldSample(n, g, e, w, T, S);
y = null !== (f = x.traceState) && void 0 !== f ? f : y;
var C = {
traceId: g,
spanId: E,
traceFlags:
x.decision === l.U.RECORD_AND_SAMPLED
? u.r.SAMPLED
: u.r.NONE,
traceState: y,
};
if (x.decision === l.U.NOT_RECORD)
return (
s.K.debug(
"Recording is off, propagating context in a non-recording span",
),
o.g.wrapSpanContext(C)
);
var I = new _(this, n, e, C, w, v, S, t.startTime),
A = (0, d.FT)(Object.assign(T, x.attributes));
return I.setAttributes(A), I;
}),
(e.prototype.startActiveSpan = function (e, t, n, r) {
var s, a, c;
if (!(arguments.length < 2)) {
2 === arguments.length
? (c = t)
: 3 === arguments.length
? ((s = t), (c = n))
: ((s = t), (a = n), (c = r));
var l = null != a ? a : i.D.active(),
u = this.startSpan(e, s, l),
p = o.g.setSpan(l, u);
return i.D.with(p, c, void 0, u);
}
}),
(e.prototype.getGeneralLimits = function () {
return this._generalLimits;
}),
(e.prototype.getSpanLimits = function () {
return this._spanLimits;
}),
(e.prototype.getActiveSpanProcessor = function () {
return this._tracerProvider.getActiveSpanProcessor();
}),
e
);
})(),
U = n(68303),
j = n(39009),
H = n(63135),
$ = n(49588),
V = n(80926),
q = n(95364),
z = n(93290),
G = function () {
return (
(G =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
G.apply(this, arguments)
);
},
K = (function () {
function e(e, t) {
var n,
r = this;
(this._attributes = e),
(this.asyncAttributesPending = null != t),
(this._syncAttributes =
null !== (n = this._attributes) && void 0 !== n ? n : {}),
(this._asyncAttributesPromise =
null == t
? void 0
: t.then(
function (e) {
return (
(r._attributes = Object.assign(
{},
r._attributes,
e,
)),
(r.asyncAttributesPending = !1),
e
);
},
function (e) {
return (
s.K.debug(
"a resource's async attributes promise rejected: %s",
e,
),
(r.asyncAttributesPending = !1),
{}
);
},
));
}
return (
(e.empty = function () {
return e.EMPTY;
}),
(e.default = function () {
var t;
return new e(
(((t = {})[q.R9.SERVICE_NAME] =
"unknown_service:" + process.argv0),
(t[q.R9.TELEMETRY_SDK_LANGUAGE] =
z.m[q.R9.TELEMETRY_SDK_LANGUAGE]),
(t[q.R9.TELEMETRY_SDK_NAME] = z.m[q.R9.TELEMETRY_SDK_NAME]),
(t[q.R9.TELEMETRY_SDK_VERSION] =
z.m[q.R9.TELEMETRY_SDK_VERSION]),
t),
);
}),
Object.defineProperty(e.prototype, "attributes", {
get: function () {
var e;
return (
this.asyncAttributesPending &&
s.K.error(
"Accessing resource attributes before async attributes settled",
),
null !== (e = this._attributes) && void 0 !== e ? e : {}
);
},
enumerable: !1,
configurable: !0,
}),
(e.prototype.waitForAsyncAttributes = function () {
return (
(e = this),
(t = void 0),
(r = function () {
return (function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError(
"Generator is already executing.",
);
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw ||
((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0),
i && (o = [2 & o[0], i.value]),
o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 &&
i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
})(this, function (e) {
switch (e.label) {
case 0:
return this.asyncAttributesPending
? [4, this._asyncAttributesPromise]
: [3, 2];
case 1:
e.sent(), (e.label = 2);
case 2:
return [2];
}
});
}),
new ((n = void 0) || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
})
);
var e, t, n, r;
}),
(e.prototype.merge = function (t) {
var n,
r = this;
if (!t) return this;
var i = G(
G({}, this._syncAttributes),
null !== (n = t._syncAttributes) && void 0 !== n
? n
: t.attributes,
);
if (!this._asyncAttributesPromise && !t._asyncAttributesPromise)
return new e(i);
var o = Promise.all([
this._asyncAttributesPromise,
t._asyncAttributesPromise,
]).then(function (e) {
var n,
i = (function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (
;
(void 0 === t || t-- > 0) && !(r = o.next()).done;
)
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
})(e, 2),
o = i[0],
s = i[1];
return G(
G(
G(G({}, r._syncAttributes), o),
null !== (n = t._syncAttributes) && void 0 !== n
? n
: t.attributes,
),
s,
);
});
return new e(i, o);
}),
(e.EMPTY = new e({})),
e
);
})(),
W = function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t ? "Object is not iterable." : "Symbol.iterator is not defined.",
);
},
X = (function () {
function e(e) {
this._spanProcessors = e;
}
return (
(e.prototype.forceFlush = function () {
var e,
t,
n = [];
try {
for (
var r = W(this._spanProcessors), i = r.next();
!i.done;
i = r.next()
) {
var o = i.value;
n.push(o.forceFlush());
}
} catch (t) {
e = { error: t };
} finally {
try {
i && !i.done && (t = r.return) && t.call(r);
} finally {
if (e) throw e.error;
}
}
return new Promise(function (e) {
Promise.all(n)
.then(function () {
e();
})
.catch(function (t) {
(0, T.L)(
t || new Error("MultiSpanProcessor: forceFlush failed"),
),
e();
});
});
}),
(e.prototype.onStart = function (e, t) {
var n, r;
try {
for (
var i = W(this._spanProcessors), o = i.next();
!o.done;
o = i.next()
)
o.value.onStart(e, t);
} catch (e) {
n = { error: e };
} finally {
try {
o && !o.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
}),
(e.prototype.onEnd = function (e) {
var t, n;
try {
for (
var r = W(this._spanProcessors), i = r.next();
!i.done;
i = r.next()
)
i.value.onEnd(e);
} catch (e) {
t = { error: e };
} finally {
try {
i && !i.done && (n = r.return) && n.call(r);
} finally {
if (t) throw t.error;
}
}
}),
(e.prototype.shutdown = function () {
var e,
t,
n = [];
try {
for (
var r = W(this._spanProcessors), i = r.next();
!i.done;
i = r.next()
) {
var o = i.value;
n.push(o.shutdown());
}
} catch (t) {
e = { error: t };
} finally {
try {
i && !i.done && (t = r.return) && t.call(r);
} finally {
if (e) throw e.error;
}
}
return new Promise(function (e, t) {
Promise.all(n).then(function () {
e();
}, t);
});
}),
e
);
})(),
Q = (function () {
function e() {}
return (
(e.prototype.onStart = function (e, t) {}),
(e.prototype.onEnd = function (e) {}),
(e.prototype.shutdown = function () {
return Promise.resolve();
}),
(e.prototype.forceFlush = function () {
return Promise.resolve();
}),
e
);
})(),
Y = n(71399),
Z = n(63420),
J = n(52140),
ee = (function () {
function e(e, t) {
(this._exporter = e),
(this._finishedSpans = []),
(this._droppedSpansCount = 0);
var n = (0, v.d)();
(this._maxExportBatchSize =
"number" == typeof (null == t ? void 0 : t.maxExportBatchSize)
? t.maxExportBatchSize
: n.OTEL_BSP_MAX_EXPORT_BATCH_SIZE),
(this._maxQueueSize =
"number" == typeof (null == t ? void 0 : t.maxQueueSize)
? t.maxQueueSize
: n.OTEL_BSP_MAX_QUEUE_SIZE),
(this._scheduledDelayMillis =
"number" ==
typeof (null == t ? void 0 : t.scheduledDelayMillis)
? t.scheduledDelayMillis
: n.OTEL_BSP_SCHEDULE_DELAY),
(this._exportTimeoutMillis =
"number" ==
typeof (null == t ? void 0 : t.exportTimeoutMillis)
? t.exportTimeoutMillis
: n.OTEL_BSP_EXPORT_TIMEOUT),
(this._shutdownOnce = new Y.q(this._shutdown, this)),
this._maxExportBatchSize > this._maxQueueSize &&
(s.K.warn(
"BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize",
),
(this._maxExportBatchSize = this._maxQueueSize));
}
return (
(e.prototype.forceFlush = function () {
return this._shutdownOnce.isCalled
? this._shutdownOnce.promise
: this._flushAll();
}),
(e.prototype.onStart = function (e, t) {}),
(e.prototype.onEnd = function (e) {
this._shutdownOnce.isCalled ||
(0 != (e.spanContext().traceFlags & u.r.SAMPLED) &&
this._addToBuffer(e));
}),
(e.prototype.shutdown = function () {
return this._shutdownOnce.call();
}),
(e.prototype._shutdown = function () {
var e = this;
return Promise.resolve()
.then(function () {
return e.onShutdown();
})
.then(function () {
return e._flushAll();
})
.then(function () {
return e._exporter.shutdown();
});
}),
(e.prototype._addToBuffer = function (e) {
if (this._finishedSpans.length >= this._maxQueueSize)
return (
0 === this._droppedSpansCount &&
s.K.debug("maxQueueSize reached, dropping spans"),
void this._droppedSpansCount++
);
this._droppedSpansCount > 0 &&
(s.K.warn(
"Dropped " +
this._droppedSpansCount +
" spans because maxQueueSize reached",
),
(this._droppedSpansCount = 0)),
this._finishedSpans.push(e),
this._maybeStartTimer();
}),
(e.prototype._flushAll = function () {
var e = this;
return new Promise(function (t, n) {
for (
var r = [],
i = 0,
o = Math.ceil(
e._finishedSpans.length / e._maxExportBatchSize,
);
i < o;
i++
)
r.push(e._flushOneBatch());
Promise.all(r)
.then(function () {
t();
})
.catch(n);
});
}),
(e.prototype._flushOneBatch = function () {
var e = this;
return (
this._clearTimer(),
0 === this._finishedSpans.length
? Promise.resolve()
: new Promise(function (t, n) {
var r = setTimeout(function () {
n(new Error("Timeout"));
}, e._exportTimeoutMillis);
i.D.with((0, p.hE)(i.D.active()), function () {
var i = e._finishedSpans.splice(
0,
e._maxExportBatchSize,
),
o = function () {
return e._exporter.export(i, function (e) {
var i;
clearTimeout(r),
e.code === Z.I.SUCCESS
? t()
: n(
null !== (i = e.error) && void 0 !== i
? i
: new Error(
"BatchSpanProcessor: span export failed",
),
);
});
},
s = i
.map(function (e) {
return e.resource;
})
.filter(function (e) {
return e.asyncAttributesPending;
});
0 === s.length
? o()
: Promise.all(
s.map(function (e) {
var t;
return null ===
(t = e.waitForAsyncAttributes) ||
void 0 === t
? void 0
: t.call(e);
}),
).then(o, function (e) {
(0, T.L)(e), n(e);
});
});
})
);
}),
(e.prototype._maybeStartTimer = function () {
var e = this;
void 0 === this._timer &&
((this._timer = setTimeout(function () {
e._flushOneBatch()
.then(function () {
e._finishedSpans.length > 0 &&
(e._clearTimer(), e._maybeStartTimer());
})
.catch(function (e) {
(0, T.L)(e);
});
}, this._scheduledDelayMillis)),
(0, J.g)(this._timer));
}),
(e.prototype._clearTimer = function () {
void 0 !== this._timer &&
(clearTimeout(this._timer), (this._timer = void 0));
}),
e
);
})(),
te =
((D = function (e, t) {
return (
(D =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
D(e, t)
);
}),
function (e, t) {
if ("function" != typeof t && null !== t)
throw new TypeError(
"Class extends value " +
String(t) +
" is not a constructor or null",
);
function n() {
this.constructor = e;
}
D(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
ne = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return te(t, e), (t.prototype.onShutdown = function () {}), t;
})(ee);
!(function (e) {
(e[(e.resolved = 0)] = "resolved"),
(e[(e.timeout = 1)] = "timeout"),
(e[(e.error = 2)] = "error"),
(e[(e.unresolved = 3)] = "unresolved");
})(B || (B = {}));
var re = (function () {
function e(e) {
var t;
void 0 === e && (e = {}),
(this._registeredSpanProcessors = []),
(this._tracers = new Map());
var n = (0, j.T)(
{},
P(),
(function (e) {
var t,
n,
r,
i,
o,
s,
a,
c,
l,
u,
p,
d,
h = Object.assign({}, e.spanLimits),
f = (0, O.vU)();
return (
(h.attributeCountLimit =
null !==
(s =
null !==
(o =
null !==
(i =
null !==
(n =
null === (t = e.spanLimits) ||
void 0 === t
? void 0
: t.attributeCountLimit) && void 0 !== n
? n
: null === (r = e.generalLimits) ||
void 0 === r
? void 0
: r.attributeCountLimit) && void 0 !== i
? i
: f.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT) &&
void 0 !== o
? o
: f.OTEL_ATTRIBUTE_COUNT_LIMIT) && void 0 !== s
? s
: O.qG),
(h.attributeValueLengthLimit =
null !==
(d =
null !==
(p =
null !==
(u =
null !==
(c =
null === (a = e.spanLimits) ||
void 0 === a
? void 0
: a.attributeValueLengthLimit) &&
void 0 !== c
? c
: null === (l = e.generalLimits) ||
void 0 === l
? void 0
: l.attributeValueLengthLimit) &&
void 0 !== u
? u
: f.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT) &&
void 0 !== p
? p
: f.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT) &&
void 0 !== d
? d
: O.KR),
Object.assign({}, e, { spanLimits: h })
);
})(e),
);
(this.resource =
null !== (t = n.resource) && void 0 !== t ? t : K.empty()),
(this.resource = K.default().merge(this.resource)),
(this._config = Object.assign({}, n, {
resource: this.resource,
}));
var r = this._buildExporterFromEnv();
if (void 0 !== r) {
var i = new ne(r);
this.activeSpanProcessor = i;
} else this.activeSpanProcessor = new Q();
}
return (
(e.prototype.getTracer = function (e, t, n) {
var r =
e +
"@" +
(t || "") +
":" +
((null == n ? void 0 : n.schemaUrl) || "");
return (
this._tracers.has(r) ||
this._tracers.set(
r,
new F(
{
name: e,
version: t,
schemaUrl: null == n ? void 0 : n.schemaUrl,
},
this._config,
this,
),
),
this._tracers.get(r)
);
}),
(e.prototype.addSpanProcessor = function (e) {
0 === this._registeredSpanProcessors.length &&
this.activeSpanProcessor.shutdown().catch(function (e) {
return s.K.error(
"Error while trying to shutdown current span processor",
e,
);
}),
this._registeredSpanProcessors.push(e),
(this.activeSpanProcessor = new X(
this._registeredSpanProcessors,
));
}),
(e.prototype.getActiveSpanProcessor = function () {
return this.activeSpanProcessor;
}),
(e.prototype.register = function (e) {
void 0 === e && (e = {}),
o.g.setGlobalTracerProvider(this),
void 0 === e.propagator &&
(e.propagator = this._buildPropagatorFromEnv()),
e.contextManager &&
i.D.setGlobalContextManager(e.contextManager),
e.propagator && U.u.setGlobalPropagator(e.propagator);
}),
(e.prototype.forceFlush = function () {
var e = this._config.forceFlushTimeoutMillis,
t = this._registeredSpanProcessors.map(function (t) {
return new Promise(function (n) {
var r,
i = setTimeout(function () {
n(
new Error(
"Span processor did not completed within timeout period of " +
e +
" ms",
),
),
(r = B.timeout);
}, e);
t.forceFlush()
.then(function () {
clearTimeout(i),
r !== B.timeout && ((r = B.resolved), n(r));
})
.catch(function (e) {
clearTimeout(i), (r = B.error), n(e);
});
});
});
return new Promise(function (e, n) {
Promise.all(t)
.then(function (t) {
var r = t.filter(function (e) {
return e !== B.resolved;
});
r.length > 0 ? n(r) : e();
})
.catch(function (e) {
return n([e]);
});
});
}),
(e.prototype.shutdown = function () {
return this.activeSpanProcessor.shutdown();
}),
(e.prototype._getPropagator = function (e) {
var t;
return null ===
(t = this.constructor._registeredPropagators.get(e)) ||
void 0 === t
? void 0
: t();
}),
(e.prototype._getSpanExporter = function (e) {
var t;
return null ===
(t = this.constructor._registeredExporters.get(e)) ||
void 0 === t
? void 0
: t();
}),
(e.prototype._buildPropagatorFromEnv = function () {
var e = this,
t = Array.from(new Set((0, v.d)().OTEL_PROPAGATORS)),
n = t
.map(function (t) {
var n = e._getPropagator(t);
return (
n ||
s.K.warn(
'Propagator "' +
t +
'" requested through environment variable is unavailable.',
),
n
);
})
.reduce(function (e, t) {
return t && e.push(t), e;
}, []);
return 0 === n.length
? void 0
: 1 === t.length
? n[0]
: new H.Y({ propagators: n });
}),
(e.prototype._buildExporterFromEnv = function () {
var e = (0, v.d)().OTEL_TRACES_EXPORTER;
if ("none" !== e && "" !== e) {
var t = this._getSpanExporter(e);
return (
t ||
s.K.error(
'Exporter "' +
e +
'" requested through environment variable is unavailable.',
),
t
);
}
}),
(e._registeredPropagators = new Map([
[
"tracecontext",
function () {
return new $.jf();
},
],
[
"baggage",
function () {
return new V.a();
},
],
])),
(e._registeredExporters = new Map()),
e
);
})(),
ie = (function () {
function e() {}
return (
(e.prototype.export = function (e, t) {
return this._sendSpans(e, t);
}),
(e.prototype.shutdown = function () {
return this._sendSpans([]), Promise.resolve();
}),
(e.prototype._exportInfo = function (e) {
var t;
return {
traceId: e.spanContext().traceId,
parentId: e.parentSpanId,
traceState:
null === (t = e.spanContext().traceState) || void 0 === t
? void 0
: t.serialize(),
name: e.name,
id: e.spanContext().spanId,
kind: e.kind,
timestamp: (0, m.ji)(e.startTime),
duration: (0, m.ji)(e.duration),
attributes: e.attributes,
status: e.status,
events: e.events,
links: e.links,
};
}),
(e.prototype._sendSpans = function (e, t) {
var n, r;
try {
for (
var i = (function (e) {
var t = "function" == typeof Symbol && Symbol.iterator,
n = t && e[t],
r = 0;
if (n) return n.call(e);
if (e && "number" == typeof e.length)
return {
next: function () {
return (
e && r >= e.length && (e = void 0),
{ value: e && e[r++], done: !e }
);
},
};
throw new TypeError(
t
? "Object is not iterable."
: "Symbol.iterator is not defined.",
);
})(e),
o = i.next();
!o.done;
o = i.next()
) {
var s = o.value;
console.dir(this._exportInfo(s), { depth: 3 });
}
} catch (e) {
n = { error: e };
} finally {
try {
o && !o.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
if (t) return t({ code: Z.I.SUCCESS });
}),
e
);
})(),
oe = (function () {
function e() {
(this._finishedSpans = []), (this._stopped = !1);
}
return (
(e.prototype.export = function (e, t) {
var n;
if (this._stopped)
return t({
code: Z.I.FAILED,
error: new Error("Exporter has been stopped"),
});
(n = this._finishedSpans).push.apply(
n,
(function (e, t, n) {
if (n || 2 === arguments.length)
for (var r, i = 0, o = t.length; i < o; i++)
(!r && i in t) ||
(r || (r = Array.prototype.slice.call(t, 0, i)),
(r[i] = t[i]));
return e.concat(r || Array.prototype.slice.call(t));
})(
[],
(function (e, t) {
var n = "function" == typeof Symbol && e[Symbol.iterator];
if (!n) return e;
var r,
i,
o = n.call(e),
s = [];
try {
for (
;
(void 0 === t || t-- > 0) && !(r = o.next()).done;
)
s.push(r.value);
} catch (e) {
i = { error: e };
} finally {
try {
r && !r.done && (n = o.return) && n.call(o);
} finally {
if (i) throw i.error;
}
}
return s;
})(e),
!1,
),
),
setTimeout(function () {
return t({ code: Z.I.SUCCESS });
}, 0);
}),
(e.prototype.shutdown = function () {
return (
(this._stopped = !0),
(this._finishedSpans = []),
Promise.resolve()
);
}),
(e.prototype.reset = function () {
this._finishedSpans = [];
}),
(e.prototype.getFinishedSpans = function () {
return this._finishedSpans;
}),
e
);
})(),
se = n(47593),
ae = (function () {
function e(e) {
(this._exporter = e),
(this._shutdownOnce = new Y.q(this._shutdown, this)),
(this._unresolvedExports = new Set());
}
return (
(e.prototype.forceFlush = function () {
return (
(e = this),
(t = void 0),
(r = function () {
return (function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError(
"Generator is already executing.",
);
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw ||
((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0),
i && (o = [2 & o[0], i.value]),
o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 &&
i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
})(this, function (e) {
switch (e.label) {
case 0:
return [
4,
Promise.all(Array.from(this._unresolvedExports)),
];
case 1:
return e.sent(), [2];
}
});
}),
new ((n = void 0) || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
})
);
var e, t, n, r;
}),
(e.prototype.onStart = function (e, t) {}),
(e.prototype.onEnd = function (e) {
var t,
n,
r = this;
if (
!this._shutdownOnce.isCalled &&
0 != (e.spanContext().traceFlags & u.r.SAMPLED)
) {
var i = function () {
return se.internal
._export(r._exporter, [e])
.then(function (e) {
var t;
e.code !== Z.I.SUCCESS &&
(0, T.L)(
null !== (t = e.error) && void 0 !== t
? t
: new Error(
"SimpleSpanProcessor: span export failed (status " +
e +
")",
),
);
})
.catch(function (e) {
(0, T.L)(e);
});
};
if (e.resource.asyncAttributesPending) {
var o =
null === (n = (t = e.resource).waitForAsyncAttributes) ||
void 0 === n
? void 0
: n.call(t).then(
function () {
return (
null != o && r._unresolvedExports.delete(o), i()
);
},
function (e) {
return (0, T.L)(e);
},
);
null != o && this._unresolvedExports.add(o);
} else i();
}
}),
(e.prototype.shutdown = function () {
return this._shutdownOnce.call();
}),
(e.prototype._shutdown = function () {
return this._exporter.shutdown();
}),
e
);
})();
},
47480: (e, t, n) => {
"use strict";
n.r(t),
n.d(t, {
AwsEcsLaunchtypeValues: () => i._t,
CloudPlatformValues: () => i.CY,
CloudProviderValues: () => i.LH,
DbCassandraConsistencyLevelValues: () => r.xM,
DbSystemValues: () => r.fL,
FaasDocumentOperationValues: () => r.ZI,
FaasInvokedProviderValues: () => r.o0,
FaasTriggerValues: () => r.iD,
HostArchValues: () => i.IV,
HttpFlavorValues: () => r.Yi,
MessageTypeValues: () => r._J,
MessagingDestinationKindValues: () => r.y8,
MessagingOperationValues: () => r.jU,
NetHostConnectionSubtypeValues: () => r.oP,
NetHostConnectionTypeValues: () => r.ZM,
NetTransportValues: () => r.Di,
OsTypeValues: () => i.er,
RpcGrpcStatusCodeValues: () => r.yG,
SemanticAttributes: () => r.og,
SemanticResourceAttributes: () => i.R9,
TelemetrySdkLanguageValues: () => i.Te,
});
var r = n(73108),
i = n(95364);
},
95364: (e, t, n) => {
"use strict";
n.d(t, {
CY: () => o,
IV: () => a,
LH: () => i,
R9: () => r,
Te: () => l,
_t: () => s,
er: () => c,
});
var r = {
CLOUD_PROVIDER: "cloud.provider",
CLOUD_ACCOUNT_ID: "cloud.account.id",
CLOUD_REGION: "cloud.region",
CLOUD_AVAILABILITY_ZONE: "cloud.availability_zone",
CLOUD_PLATFORM: "cloud.platform",
AWS_ECS_CONTAINER_ARN: "aws.ecs.container.arn",
AWS_ECS_CLUSTER_ARN: "aws.ecs.cluster.arn",
AWS_ECS_LAUNCHTYPE: "aws.ecs.launchtype",
AWS_ECS_TASK_ARN: "aws.ecs.task.arn",
AWS_ECS_TASK_FAMILY: "aws.ecs.task.family",
AWS_ECS_TASK_REVISION: "aws.ecs.task.revision",
AWS_EKS_CLUSTER_ARN: "aws.eks.cluster.arn",
AWS_LOG_GROUP_NAMES: "aws.log.group.names",
AWS_LOG_GROUP_ARNS: "aws.log.group.arns",
AWS_LOG_STREAM_NAMES: "aws.log.stream.names",
AWS_LOG_STREAM_ARNS: "aws.log.stream.arns",
CONTAINER_NAME: "container.name",
CONTAINER_ID: "container.id",
CONTAINER_RUNTIME: "container.runtime",
CONTAINER_IMAGE_NAME: "container.image.name",
CONTAINER_IMAGE_TAG: "container.image.tag",
DEPLOYMENT_ENVIRONMENT: "deployment.environment",
DEVICE_ID: "device.id",
DEVICE_MODEL_IDENTIFIER: "device.model.identifier",
DEVICE_MODEL_NAME: "device.model.name",
FAAS_NAME: "faas.name",
FAAS_ID: "faas.id",
FAAS_VERSION: "faas.version",
FAAS_INSTANCE: "faas.instance",
FAAS_MAX_MEMORY: "faas.max_memory",
HOST_ID: "host.id",
HOST_NAME: "host.name",
HOST_TYPE: "host.type",
HOST_ARCH: "host.arch",
HOST_IMAGE_NAME: "host.image.name",
HOST_IMAGE_ID: "host.image.id",
HOST_IMAGE_VERSION: "host.image.version",
K8S_CLUSTER_NAME: "k8s.cluster.name",
K8S_NODE_NAME: "k8s.node.name",
K8S_NODE_UID: "k8s.node.uid",
K8S_NAMESPACE_NAME: "k8s.namespace.name",
K8S_POD_UID: "k8s.pod.uid",
K8S_POD_NAME: "k8s.pod.name",
K8S_CONTAINER_NAME: "k8s.container.name",
K8S_REPLICASET_UID: "k8s.replicaset.uid",
K8S_REPLICASET_NAME: "k8s.replicaset.name",
K8S_DEPLOYMENT_UID: "k8s.deployment.uid",
K8S_DEPLOYMENT_NAME: "k8s.deployment.name",
K8S_STATEFULSET_UID: "k8s.statefulset.uid",
K8S_STATEFULSET_NAME: "k8s.statefulset.name",
K8S_DAEMONSET_UID: "k8s.daemonset.uid",
K8S_DAEMONSET_NAME: "k8s.daemonset.name",
K8S_JOB_UID: "k8s.job.uid",
K8S_JOB_NAME: "k8s.job.name",
K8S_CRONJOB_UID: "k8s.cronjob.uid",
K8S_CRONJOB_NAME: "k8s.cronjob.name",
OS_TYPE: "os.type",
OS_DESCRIPTION: "os.description",
OS_NAME: "os.name",
OS_VERSION: "os.version",
PROCESS_PID: "process.pid",
PROCESS_EXECUTABLE_NAME: "process.executable.name",
PROCESS_EXECUTABLE_PATH: "process.executable.path",
PROCESS_COMMAND: "process.command",
PROCESS_COMMAND_LINE: "process.command_line",
PROCESS_COMMAND_ARGS: "process.command_args",
PROCESS_OWNER: "process.owner",
PROCESS_RUNTIME_NAME: "process.runtime.name",
PROCESS_RUNTIME_VERSION: "process.runtime.version",
PROCESS_RUNTIME_DESCRIPTION: "process.runtime.description",
SERVICE_NAME: "service.name",
SERVICE_NAMESPACE: "service.namespace",
SERVICE_INSTANCE_ID: "service.instance.id",
SERVICE_VERSION: "service.version",
TELEMETRY_SDK_NAME: "telemetry.sdk.name",
TELEMETRY_SDK_LANGUAGE: "telemetry.sdk.language",
TELEMETRY_SDK_VERSION: "telemetry.sdk.version",
TELEMETRY_AUTO_VERSION: "telemetry.auto.version",
WEBENGINE_NAME: "webengine.name",
WEBENGINE_VERSION: "webengine.version",
WEBENGINE_DESCRIPTION: "webengine.description",
},
i = {
ALIBABA_CLOUD: "alibaba_cloud",
AWS: "aws",
AZURE: "azure",
GCP: "gcp",
},
o = {
ALIBABA_CLOUD_ECS: "alibaba_cloud_ecs",
ALIBABA_CLOUD_FC: "alibaba_cloud_fc",
AWS_EC2: "aws_ec2",
AWS_ECS: "aws_ecs",
AWS_EKS: "aws_eks",
AWS_LAMBDA: "aws_lambda",
AWS_ELASTIC_BEANSTALK: "aws_elastic_beanstalk",
AZURE_VM: "azure_vm",
AZURE_CONTAINER_INSTANCES: "azure_container_instances",
AZURE_AKS: "azure_aks",
AZURE_FUNCTIONS: "azure_functions",
AZURE_APP_SERVICE: "azure_app_service",
GCP_COMPUTE_ENGINE: "gcp_compute_engine",
GCP_CLOUD_RUN: "gcp_cloud_run",
GCP_KUBERNETES_ENGINE: "gcp_kubernetes_engine",
GCP_CLOUD_FUNCTIONS: "gcp_cloud_functions",
GCP_APP_ENGINE: "gcp_app_engine",
},
s = { EC2: "ec2", FARGATE: "fargate" },
a = {
AMD64: "amd64",
ARM32: "arm32",
ARM64: "arm64",
IA64: "ia64",
PPC32: "ppc32",
PPC64: "ppc64",
X86: "x86",
},
c = {
WINDOWS: "windows",
LINUX: "linux",
DARWIN: "darwin",
FREEBSD: "freebsd",
NETBSD: "netbsd",
OPENBSD: "openbsd",
DRAGONFLYBSD: "dragonflybsd",
HPUX: "hpux",
AIX: "aix",
SOLARIS: "solaris",
Z_OS: "z_os",
},
l = {
CPP: "cpp",
DOTNET: "dotnet",
ERLANG: "erlang",
GO: "go",
JAVA: "java",
NODEJS: "nodejs",
PHP: "php",
PYTHON: "python",
RUBY: "ruby",
WEBJS: "webjs",
};
},
73108: (e, t, n) => {
"use strict";
n.d(t, {
Di: () => l,
Yi: () => d,
ZI: () => a,
ZM: () => u,
_J: () => g,
fL: () => i,
iD: () => s,
jU: () => f,
o0: () => c,
oP: () => p,
og: () => r,
xM: () => o,
y8: () => h,
yG: () => m,
});
var r = {
AWS_LAMBDA_INVOKED_ARN: "aws.lambda.invoked_arn",
DB_SYSTEM: "db.system",
DB_CONNECTION_STRING: "db.connection_string",
DB_USER: "db.user",
DB_JDBC_DRIVER_CLASSNAME: "db.jdbc.driver_classname",
DB_NAME: "db.name",
DB_STATEMENT: "db.statement",
DB_OPERATION: "db.operation",
DB_MSSQL_INSTANCE_NAME: "db.mssql.instance_name",
DB_CASSANDRA_KEYSPACE: "db.cassandra.keyspace",
DB_CASSANDRA_PAGE_SIZE: "db.cassandra.page_size",
DB_CASSANDRA_CONSISTENCY_LEVEL: "db.cassandra.consistency_level",
DB_CASSANDRA_TABLE: "db.cassandra.table",
DB_CASSANDRA_IDEMPOTENCE: "db.cassandra.idempotence",
DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:
"db.cassandra.speculative_execution_count",
DB_CASSANDRA_COORDINATOR_ID: "db.cassandra.coordinator.id",
DB_CASSANDRA_COORDINATOR_DC: "db.cassandra.coordinator.dc",
DB_HBASE_NAMESPACE: "db.hbase.namespace",
DB_REDIS_DATABASE_INDEX: "db.redis.database_index",
DB_MONGODB_COLLECTION: "db.mongodb.collection",
DB_SQL_TABLE: "db.sql.table",
EXCEPTION_TYPE: "exception.type",
EXCEPTION_MESSAGE: "exception.message",
EXCEPTION_STACKTRACE: "exception.stacktrace",
EXCEPTION_ESCAPED: "exception.escaped",
FAAS_TRIGGER: "faas.trigger",
FAAS_EXECUTION: "faas.execution",
FAAS_DOCUMENT_COLLECTION: "faas.document.collection",
FAAS_DOCUMENT_OPERATION: "faas.document.operation",
FAAS_DOCUMENT_TIME: "faas.document.time",
FAAS_DOCUMENT_NAME: "faas.document.name",
FAAS_TIME: "faas.time",
FAAS_CRON: "faas.cron",
FAAS_COLDSTART: "faas.coldstart",
FAAS_INVOKED_NAME: "faas.invoked_name",
FAAS_INVOKED_PROVIDER: "faas.invoked_provider",
FAAS_INVOKED_REGION: "faas.invoked_region",
NET_TRANSPORT: "net.transport",
NET_PEER_IP: "net.peer.ip",
NET_PEER_PORT: "net.peer.port",
NET_PEER_NAME: "net.peer.name",
NET_HOST_IP: "net.host.ip",
NET_HOST_PORT: "net.host.port",
NET_HOST_NAME: "net.host.name",
NET_HOST_CONNECTION_TYPE: "net.host.connection.type",
NET_HOST_CONNECTION_SUBTYPE: "net.host.connection.subtype",
NET_HOST_CARRIER_NAME: "net.host.carrier.name",
NET_HOST_CARRIER_MCC: "net.host.carrier.mcc",
NET_HOST_CARRIER_MNC: "net.host.carrier.mnc",
NET_HOST_CARRIER_ICC: "net.host.carrier.icc",
PEER_SERVICE: "peer.service",
ENDUSER_ID: "enduser.id",
ENDUSER_ROLE: "enduser.role",
ENDUSER_SCOPE: "enduser.scope",
THREAD_ID: "thread.id",
THREAD_NAME: "thread.name",
CODE_FUNCTION: "code.function",
CODE_NAMESPACE: "code.namespace",
CODE_FILEPATH: "code.filepath",
CODE_LINENO: "code.lineno",
HTTP_METHOD: "http.method",
HTTP_URL: "http.url",
HTTP_TARGET: "http.target",
HTTP_HOST: "http.host",
HTTP_SCHEME: "http.scheme",
HTTP_STATUS_CODE: "http.status_code",
HTTP_FLAVOR: "http.flavor",
HTTP_USER_AGENT: "http.user_agent",
HTTP_REQUEST_CONTENT_LENGTH: "http.request_content_length",
HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:
"http.request_content_length_uncompressed",
HTTP_RESPONSE_CONTENT_LENGTH: "http.response_content_length",
HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:
"http.response_content_length_uncompressed",
HTTP_SERVER_NAME: "http.server_name",
HTTP_ROUTE: "http.route",
HTTP_CLIENT_IP: "http.client_ip",
AWS_DYNAMODB_TABLE_NAMES: "aws.dynamodb.table_names",
AWS_DYNAMODB_CONSUMED_CAPACITY: "aws.dynamodb.consumed_capacity",
AWS_DYNAMODB_ITEM_COLLECTION_METRICS:
"aws.dynamodb.item_collection_metrics",
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:
"aws.dynamodb.provisioned_read_capacity",
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:
"aws.dynamodb.provisioned_write_capacity",
AWS_DYNAMODB_CONSISTENT_READ: "aws.dynamodb.consistent_read",
AWS_DYNAMODB_PROJECTION: "aws.dynamodb.projection",
AWS_DYNAMODB_LIMIT: "aws.dynamodb.limit",
AWS_DYNAMODB_ATTRIBUTES_TO_GET: "aws.dynamodb.attributes_to_get",
AWS_DYNAMODB_INDEX_NAME: "aws.dynamodb.index_name",
AWS_DYNAMODB_SELECT: "aws.dynamodb.select",
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:
"aws.dynamodb.global_secondary_indexes",
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:
"aws.dynamodb.local_secondary_indexes",
AWS_DYNAMODB_EXCLUSIVE_START_TABLE:
"aws.dynamodb.exclusive_start_table",
AWS_DYNAMODB_TABLE_COUNT: "aws.dynamodb.table_count",
AWS_DYNAMODB_SCAN_FORWARD: "aws.dynamodb.scan_forward",
AWS_DYNAMODB_SEGMENT: "aws.dynamodb.segment",
AWS_DYNAMODB_TOTAL_SEGMENTS: "aws.dynamodb.total_segments",
AWS_DYNAMODB_COUNT: "aws.dynamodb.count",
AWS_DYNAMODB_SCANNED_COUNT: "aws.dynamodb.scanned_count",
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:
"aws.dynamodb.attribute_definitions",
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:
"aws.dynamodb.global_secondary_index_updates",
MESSAGING_SYSTEM: "messaging.system",
MESSAGING_DESTINATION: "messaging.destination",
MESSAGING_DESTINATION_KIND: "messaging.destination_kind",
MESSAGING_TEMP_DESTINATION: "messaging.temp_destination",
MESSAGING_PROTOCOL: "messaging.protocol",
MESSAGING_PROTOCOL_VERSION: "messaging.protocol_version",
MESSAGING_URL: "messaging.url",
MESSAGING_MESSAGE_ID: "messaging.message_id",
MESSAGING_CONVERSATION_ID: "messaging.conversation_id",
MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:
"messaging.message_payload_size_bytes",
MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:
"messaging.message_payload_compressed_size_bytes",
MESSAGING_OPERATION: "messaging.operation",
MESSAGING_CONSUMER_ID: "messaging.consumer_id",
MESSAGING_RABBITMQ_ROUTING_KEY: "messaging.rabbitmq.routing_key",
MESSAGING_KAFKA_MESSAGE_KEY: "messaging.kafka.message_key",
MESSAGING_KAFKA_CONSUMER_GROUP: "messaging.kafka.consumer_group",
MESSAGING_KAFKA_CLIENT_ID: "messaging.kafka.client_id",
MESSAGING_KAFKA_PARTITION: "messaging.kafka.partition",
MESSAGING_KAFKA_TOMBSTONE: "messaging.kafka.tombstone",
RPC_SYSTEM: "rpc.system",
RPC_SERVICE: "rpc.service",
RPC_METHOD: "rpc.method",
RPC_GRPC_STATUS_CODE: "rpc.grpc.status_code",
RPC_JSONRPC_VERSION: "rpc.jsonrpc.version",
RPC_JSONRPC_REQUEST_ID: "rpc.jsonrpc.request_id",
RPC_JSONRPC_ERROR_CODE: "rpc.jsonrpc.error_code",
RPC_JSONRPC_ERROR_MESSAGE: "rpc.jsonrpc.error_message",
MESSAGE_TYPE: "message.type",
MESSAGE_ID: "message.id",
MESSAGE_COMPRESSED_SIZE: "message.compressed_size",
MESSAGE_UNCOMPRESSED_SIZE: "message.uncompressed_size",
},
i = {
OTHER_SQL: "other_sql",
MSSQL: "mssql",
MYSQL: "mysql",
ORACLE: "oracle",
DB2: "db2",
POSTGRESQL: "postgresql",
REDSHIFT: "redshift",
HIVE: "hive",
CLOUDSCAPE: "cloudscape",
HSQLDB: "hsqldb",
PROGRESS: "progress",
MAXDB: "maxdb",
HANADB: "hanadb",
INGRES: "ingres",
FIRSTSQL: "firstsql",
EDB: "edb",
CACHE: "cache",
ADABAS: "adabas",
FIREBIRD: "firebird",
DERBY: "derby",
FILEMAKER: "filemaker",
INFORMIX: "informix",
INSTANTDB: "instantdb",
INTERBASE: "interbase",
MARIADB: "mariadb",
NETEZZA: "netezza",
PERVASIVE: "pervasive",
POINTBASE: "pointbase",
SQLITE: "sqlite",
SYBASE: "sybase",
TERADATA: "teradata",
VERTICA: "vertica",
H2: "h2",
COLDFUSION: "coldfusion",
CASSANDRA: "cassandra",
HBASE: "hbase",
MONGODB: "mongodb",
REDIS: "redis",
COUCHBASE: "couchbase",
COUCHDB: "couchdb",
COSMOSDB: "cosmosdb",
DYNAMODB: "dynamodb",
NEO4J: "neo4j",
GEODE: "geode",
ELASTICSEARCH: "elasticsearch",
MEMCACHED: "memcached",
COCKROACHDB: "cockroachdb",
},
o = {
ALL: "all",
EACH_QUORUM: "each_quorum",
QUORUM: "quorum",
LOCAL_QUORUM: "local_quorum",
ONE: "one",
TWO: "two",
THREE: "three",
LOCAL_ONE: "local_one",
ANY: "any",
SERIAL: "serial",
LOCAL_SERIAL: "local_serial",
},
s = {
DATASOURCE: "datasource",
HTTP: "http",
PUBSUB: "pubsub",
TIMER: "timer",
OTHER: "other",
},
a = { INSERT: "insert", EDIT: "edit", DELETE: "delete" },
c = {
ALIBABA_CLOUD: "alibaba_cloud",
AWS: "aws",
AZURE: "azure",
GCP: "gcp",
},
l = {
IP_TCP: "ip_tcp",
IP_UDP: "ip_udp",
IP: "ip",
UNIX: "unix",
PIPE: "pipe",
INPROC: "inproc",
OTHER: "other",
},
u = {
WIFI: "wifi",
WIRED: "wired",
CELL: "cell",
UNAVAILABLE: "unavailable",
UNKNOWN: "unknown",
},
p = {
GPRS: "gprs",
EDGE: "edge",
UMTS: "umts",
CDMA: "cdma",
EVDO_0: "evdo_0",
EVDO_A: "evdo_a",
CDMA2000_1XRTT: "cdma2000_1xrtt",
HSDPA: "hsdpa",
HSUPA: "hsupa",
HSPA: "hspa",
IDEN: "iden",
EVDO_B: "evdo_b",
LTE: "lte",
EHRPD: "ehrpd",
HSPAP: "hspap",
GSM: "gsm",
TD_SCDMA: "td_scdma",
IWLAN: "iwlan",
NR: "nr",
NRNSA: "nrnsa",
LTE_CA: "lte_ca",
},
d = {
HTTP_1_0: "1.0",
HTTP_1_1: "1.1",
HTTP_2_0: "2.0",
SPDY: "SPDY",
QUIC: "QUIC",
},
h = { QUEUE: "queue", TOPIC: "topic" },
f = { RECEIVE: "receive", PROCESS: "process" },
m = {
OK: 0,
CANCELLED: 1,
UNKNOWN: 2,
INVALID_ARGUMENT: 3,
DEADLINE_EXCEEDED: 4,
NOT_FOUND: 5,
ALREADY_EXISTS: 6,
PERMISSION_DENIED: 7,
RESOURCE_EXHAUSTED: 8,
FAILED_PRECONDITION: 9,
ABORTED: 10,
OUT_OF_RANGE: 11,
UNIMPLEMENTED: 12,
INTERNAL: 13,
UNAVAILABLE: 14,
DATA_LOSS: 15,
UNAUTHENTICATED: 16,
},
g = { SENT: "SENT", RECEIVED: "RECEIVED" };
},
44473: (e, t, n) => {
const r = n(95687),
i = n(2517);
if ("darwin" !== process.platform)
(e.exports.all = () => []), (e.exports.each = () => {});
else {
const t = n(32081),
o = /(?=-----BEGIN\sCERTIFICATE-----)/g,
s = "/System/Library/Keychains/SystemRootCertificates.keychain",
a = ["find-certificate", "-a", "-p"],
c = t.spawnSync("/usr/bin/security", a).stdout.toString().split(o),
l = t
.spawnSync("/usr/bin/security", a.concat(s))
.stdout.toString()
.split(o);
r.globalAgent.options.ca = r.globalAgent.options.ca || [];
const u = r.globalAgent.options.ca,
p = c.concat(l);
p
.filter(function (e, t, n) {
return n.indexOf(e) === t;
})
.forEach((e) => u.push(e)),
(e.exports.der2 = i.validFormats),
(e.exports.all = function (e) {
return p.map(i.transform(e)).filter((e) => e);
}),
(e.exports.each = function (e, t) {
return (
"function" == typeof e && ((t = e), (e = void 0)),
p
.map(i.transform(e))
.filter((e) => e)
.forEach(t)
);
});
}
},
2517: (e, t, n) => {
const r = n(22079),
i = n(6825);
var o = (e.exports.validFormats = { der: 0, pem: 1, txt: 2, asn1: 3 });
function s(e) {
const t = r.pki.pemToDer(e),
n = r.asn1,
i = n.fromDer(t.data.toString("binary")).value[0].value,
o = i[0],
s =
o.tagClass === n.Class.CONTEXT_SPECIFIC &&
0 === o.type &&
o.constructed,
a = i.slice(s);
return { serial: a[0], issuer: a[2], valid: a[3], subject: a[4] };
}
e.exports.transform = function (e) {
return function (t) {
try {
switch (e) {
case o.der:
return r.pki.pemToDer(t);
case o.pem:
return t;
case o.txt:
return (function (e) {
const t = s(e),
n = new Date(),
r = t.subject.value
.map((e) => e.value[0].value[1].value)
.join("/"),
o = t.valid.value.map((e) => e.value).join(" - "),
a = n.toTimeString().replace(/\s*\(.*\)\s*/, "");
return [
`Subject\t${r}`,
`Valid\t${o}`,
`Saved\t${n.toLocaleDateString()} ${a} by ${i.name}@${
i.version
}`,
String(e),
].join("\n");
})(t);
case o.asn1:
return s(t);
default:
return r.pki.certificateFromPem(t);
}
} catch (e) {
return;
}
};
};
},
29311: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.TypeCompiler =
t.TypeCompilerTypeGuardError =
t.TypeCompilerDereferenceError =
t.TypeCompilerUnknownTypeError =
t.TypeCheck =
void 0);
const r = n(85007),
i = n(14350),
o = n(48803),
s = n(97540),
a = n(37657);
class c {
constructor(e, t, n, r) {
(this.schema = e),
(this.references = t),
(this.checkFunc = n),
(this.code = r);
}
Code() {
return this.code;
}
Errors(e) {
return o.Errors(this.schema, this.references, e);
}
Check(e) {
return this.checkFunc(e);
}
}
var l, u, p, d;
(t.TypeCheck = c),
(function (e) {
(e.DollarSign = function (e) {
return 36 === e;
}),
(e.IsUnderscore = function (e) {
return 95 === e;
}),
(e.IsAlpha = function (e) {
return (e >= 65 && e <= 90) || (e >= 97 && e <= 122);
}),
(e.IsNumeric = function (e) {
return e >= 48 && e <= 57;
});
})(l || (l = {})),
(function (e) {
e.Encode = function (e, t) {
return (function (e) {
if (
(function (e) {
return 0 !== e.length && l.IsNumeric(e.charCodeAt(0));
})(e)
)
return !1;
for (let t = 0; t < e.length; t++) {
const n = e.charCodeAt(t);
if (
!(
l.IsAlpha(n) ||
l.IsNumeric(n) ||
l.DollarSign(n) ||
l.IsUnderscore(n)
)
)
return !1;
}
return !0;
})(t)
? `${e}.${t}`
: `${e}['${(function (e) {
return e.replace(/'/g, "\\'");
})(t)}']`;
};
})(u || (u = {})),
(function (e) {
e.Encode = function (e) {
const t = [];
for (let n = 0; n < e.length; n++) {
const r = e.charCodeAt(n);
l.IsNumeric(r) || l.IsAlpha(r)
? t.push(e.charAt(n))
: t.push(`_${r}_`);
}
return t.join("").replace(/__/g, "_");
};
})(p || (p = {}));
class h extends Error {
constructor(e) {
super("TypeCompiler: Unknown type"), (this.schema = e);
}
}
t.TypeCompilerUnknownTypeError = h;
class f extends Error {
constructor(e) {
super(
`TypeCompiler: Unable to dereference type with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
t.TypeCompilerDereferenceError = f;
class m extends Error {
constructor(e) {
super(
"TypeCompiler: Preflight validation check failed to guard for the given schema",
),
(this.schema = e);
}
}
(t.TypeCompilerTypeGuardError = m),
(function (e) {
function t(e) {
return "Any" === e[i.Kind] || "Unknown" === e[i.Kind];
}
function n(e, t, n) {
return r.TypeSystem.ExactOptionalPropertyTypes
? `('${t}' in ${e} ? ${n} : true)`
: `(${u.Encode(e, t)} !== undefined ? ${n} : true)`;
}
function* o(e, s, c, p = !0) {
const m = a.IsString(e.$id) ? [...s, e] : s,
b = e;
if (p && a.IsString(e.$id)) {
const t = g(e.$id);
if (l.functions.has(t)) return yield `${t}(${c})`;
{
const n = _(t, e, s, "value", !1);
return l.functions.set(t, n), yield `${t}(${c})`;
}
}
switch (b[i.Kind]) {
case "Any":
case "Unknown":
return yield* (function* (e, t, n) {
yield "true";
})();
case "Array":
return yield* (function* (e, t, n) {
yield `Array.isArray(${n})`;
const [r, o] = [v("value", "any"), v("acc", "number")];
a.IsNumber(e.minItems) &&
(yield `${n}.length >= ${e.minItems}`),
a.IsNumber(e.maxItems) &&
(yield `${n}.length <= ${e.maxItems}`);
const s = d(e.items, t, "value");
if (
(yield `${n}.every((${r}) => ${s})`,
i.TypeGuard.TSchema(e.contains) ||
a.IsNumber(e.minContains) ||
a.IsNumber(e.maxContains))
) {
const s = `const count = ${n}.reduce((${o}, ${r}) => ${d(
i.TypeGuard.TSchema(e.contains)
? e.contains
: i.Type.Never(),
t,
"value",
)} ? acc + 1 : acc, 0)`,
c = [
"(count > 0)",
...(a.IsNumber(e.minContains)
? [`(count >= ${e.minContains})`]
: []),
...(a.IsNumber(e.maxContains)
? [`(count <= ${e.maxContains})`]
: []),
].join(" && ");
yield `((${r}) => { ${s}; return ${c}})(${n})`;
}
if (!0 === e.uniqueItems) {
const e =
"const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true }";
yield `((${r}) => { ${e} )(${n})`;
}
})(b, m, c);
case "AsyncIterator":
return yield* (function* (e, t, n) {
yield `(typeof value === 'object' && Symbol.asyncIterator in ${n})`;
})(0, 0, c);
case "BigInt":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'bigint')`,
a.IsBigInt(e.multipleOf) &&
(yield `(${n} % BigInt(${e.multipleOf})) === 0`),
a.IsBigInt(e.exclusiveMinimum) &&
(yield `${n} > BigInt(${e.exclusiveMinimum})`),
a.IsBigInt(e.exclusiveMaximum) &&
(yield `${n} < BigInt(${e.exclusiveMaximum})`),
a.IsBigInt(e.minimum) &&
(yield `${n} >= BigInt(${e.minimum})`),
a.IsBigInt(e.maximum) &&
(yield `${n} <= BigInt(${e.maximum})`);
})(b, 0, c);
case "Boolean":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'boolean')`;
})(0, 0, c);
case "Constructor":
return yield* (function* (e, t, n) {
yield* o(e.returns, t, `${n}.prototype`);
})(b, m, c);
case "Date":
return yield* (function* (e, t, n) {
yield `(${n} instanceof Date) && Number.isFinite(${n}.getTime())`,
a.IsNumber(e.exclusiveMinimumTimestamp) &&
(yield `${n}.getTime() > ${e.exclusiveMinimumTimestamp}`),
a.IsNumber(e.exclusiveMaximumTimestamp) &&
(yield `${n}.getTime() < ${e.exclusiveMaximumTimestamp}`),
a.IsNumber(e.minimumTimestamp) &&
(yield `${n}.getTime() >= ${e.minimumTimestamp}`),
a.IsNumber(e.maximumTimestamp) &&
(yield `${n}.getTime() <= ${e.maximumTimestamp}`);
})(b, 0, c);
case "Function":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'function')`;
})(0, 0, c);
case "Integer":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'number' && Number.isInteger(${n}))`,
a.IsNumber(e.multipleOf) &&
(yield `(${n} % ${e.multipleOf}) === 0`),
a.IsNumber(e.exclusiveMinimum) &&
(yield `${n} > ${e.exclusiveMinimum}`),
a.IsNumber(e.exclusiveMaximum) &&
(yield `${n} < ${e.exclusiveMaximum}`),
a.IsNumber(e.minimum) && (yield `${n} >= ${e.minimum}`),
a.IsNumber(e.maximum) && (yield `${n} <= ${e.maximum}`);
})(b, 0, c);
case "Intersect":
return yield* (function* (e, t, n) {
const r = e.allOf.map((e) => d(e, t, n)).join(" && ");
if (!1 === e.unevaluatedProperties) {
const t = y(
`${new RegExp(i.KeyResolver.ResolvePattern(e))};`,
),
o = `Object.getOwnPropertyNames(${n}).every(key => ${t}.test(key))`;
yield `(${r} && ${o})`;
} else if (i.TypeGuard.TSchema(e.unevaluatedProperties)) {
const o = y(
`${new RegExp(i.KeyResolver.ResolvePattern(e))};`,
),
s = `Object.getOwnPropertyNames(${n}).every(key => ${o}.test(key) || ${d(
e.unevaluatedProperties,
t,
`${n}[key]`,
)})`;
yield `(${r} && ${s})`;
} else yield `(${r})`;
})(b, m, c);
case "Iterator":
return yield* (function* (e, t, n) {
yield `(typeof value === 'object' && Symbol.iterator in ${n})`;
})(0, 0, c);
case "Literal":
return yield* (function* (e, t, n) {
"number" == typeof e.const || "boolean" == typeof e.const
? yield `(${n} === ${e.const})`
: yield `(${n} === '${e.const}')`;
})(b, 0, c);
case "Never":
return yield* (function* (e, t, n) {
yield "false";
})();
case "Not":
return yield* (function* (e, t, n) {
const r = d(e.not, t, n);
yield `(!${r})`;
})(b, m, c);
case "Null":
return yield* (function* (e, t, n) {
yield `(${n} === null)`;
})(0, 0, c);
case "Number":
return yield* (function* (e, t, n) {
yield (function (e) {
return r.TypeSystem.AllowNaN
? `typeof ${e} === 'number'`
: `(typeof ${e} === 'number' && Number.isFinite(${e}))`;
})(n),
a.IsNumber(e.multipleOf) &&
(yield `(${n} % ${e.multipleOf}) === 0`),
a.IsNumber(e.exclusiveMinimum) &&
(yield `${n} > ${e.exclusiveMinimum}`),
a.IsNumber(e.exclusiveMaximum) &&
(yield `${n} < ${e.exclusiveMaximum}`),
a.IsNumber(e.minimum) && (yield `${n} >= ${e.minimum}`),
a.IsNumber(e.maximum) && (yield `${n} <= ${e.maximum}`);
})(b, 0, c);
case "Object":
return yield* (function* (e, s, c) {
yield (function (e) {
return r.TypeSystem.AllowArrayObjects
? `(typeof ${e} === 'object' && ${e} !== null)`
: `(typeof ${e} === 'object' && ${e} !== null && !Array.isArray(${e}))`;
})(c),
a.IsNumber(e.minProperties) &&
(yield `Object.getOwnPropertyNames(${c}).length >= ${e.minProperties}`),
a.IsNumber(e.maxProperties) &&
(yield `Object.getOwnPropertyNames(${c}).length <= ${e.maxProperties}`);
const l = Object.getOwnPropertyNames(e.properties);
for (const r of l) {
const a = u.Encode(c, r),
l = e.properties[r];
if (e.required && e.required.includes(r))
yield* o(l, s, a),
(i.ExtendsUndefined.Check(l) || t(l)) &&
(yield `('${r}' in ${c})`);
else {
const e = d(l, s, a);
yield n(c, r, e);
}
}
if (!1 === e.additionalProperties)
if (e.required && e.required.length === l.length)
yield `Object.getOwnPropertyNames(${c}).length === ${l.length}`;
else {
const e = `[${l.map((e) => `'${e}'`).join(", ")}]`;
yield `Object.getOwnPropertyNames(${c}).every(key => ${e}.includes(key))`;
}
if ("object" == typeof e.additionalProperties) {
const t = d(e.additionalProperties, s, `${c}[key]`),
n = `[${l.map((e) => `'${e}'`).join(", ")}]`;
yield `(Object.getOwnPropertyNames(${c}).every(key => ${n}.includes(key) || ${t}))`;
}
})(b, m, c);
case "Promise":
return yield* (function* (e, t, n) {
yield `(typeof value === 'object' && typeof ${n}.then === 'function')`;
})(0, 0, c);
case "Record":
return yield* (function* (e, t, n) {
yield (function (e) {
return r.TypeSystem.AllowArrayObjects
? `(typeof ${e} === 'object' && ${e} !== null && !(${e} instanceof Date) && !(${e} instanceof Uint8Array))`
: `(typeof ${e} === 'object' && ${e} !== null && !Array.isArray(${e}) && !(${e} instanceof Date) && !(${e} instanceof Uint8Array))`;
})(n),
a.IsNumber(e.minProperties) &&
(yield `Object.getOwnPropertyNames(${n}).length >= ${e.minProperties}`),
a.IsNumber(e.maxProperties) &&
(yield `Object.getOwnPropertyNames(${n}).length <= ${e.maxProperties}`);
const [o, s] = Object.entries(e.patternProperties)[0],
c = `(${y(`new RegExp(/${o}/)`)}.test(key) ? ${d(
s,
t,
"value",
)} : ${
i.TypeGuard.TSchema(e.additionalProperties)
? d(e.additionalProperties, t, n)
: !1 === e.additionalProperties
? "false"
: "true"
})`;
yield `(Object.entries(${n}).every(([key, value]) => ${c}))`;
})(b, m, c);
case "Ref":
return yield* (function* (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new f(e);
const i = t[r];
if (l.functions.has(e.$ref))
return yield `${g(e.$ref)}(${n})`;
yield* o(i, t, n);
})(b, m, c);
case "String":
return yield* (function* (e, t, n) {
if (
(yield `(typeof ${n} === 'string')`,
a.IsNumber(e.minLength) &&
(yield `${n}.length >= ${e.minLength}`),
a.IsNumber(e.maxLength) &&
(yield `${n}.length <= ${e.maxLength}`),
void 0 !== e.pattern)
) {
const t = y(`${new RegExp(e.pattern)};`);
yield `${t}.test(${n})`;
}
void 0 !== e.format &&
(yield `format('${e.format}', ${n})`);
})(b, 0, c);
case "Symbol":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'symbol')`;
})(0, 0, c);
case "TemplateLiteral":
return yield* (function* (e, t, n) {
yield `(typeof ${n} === 'string')`;
const r = y(`${new RegExp(e.pattern)};`);
yield `${r}.test(${n})`;
})(b, 0, c);
case "This":
return yield* (function* (e, t, n) {
const r = g(e.$ref);
yield `${r}(${n})`;
})(b, 0, c);
case "Tuple":
return yield* (function* (e, t, n) {
if ((yield `Array.isArray(${n})`, void 0 === e.items))
return yield `${n}.length === 0`;
yield `(${n}.length === ${e.maxItems})`;
for (let r = 0; r < e.items.length; r++) {
const i = d(e.items[r], t, `${n}[${r}]`);
yield `${i}`;
}
})(b, m, c);
case "Undefined":
return yield* (function* (e, t, n) {
yield `${n} === undefined`;
})(0, 0, c);
case "Union":
return yield* (function* (e, t, n) {
const r = e.anyOf.map((e) => d(e, t, n));
yield `(${r.join(" || ")})`;
})(b, m, c);
case "Uint8Array":
return yield* (function* (e, t, n) {
yield `${n} instanceof Uint8Array`,
a.IsNumber(e.maxByteLength) &&
(yield `(${n}.length <= ${e.maxByteLength})`),
a.IsNumber(e.minByteLength) &&
(yield `(${n}.length >= ${e.minByteLength})`);
})(b, 0, c);
case "Void":
return yield* (function* (e, t, n) {
yield (function (e) {
return r.TypeSystem.AllowVoidNull
? `(${e} === undefined || ${e} === null)`
: `${e} === undefined`;
})(n);
})(0, 0, c);
default:
if (!i.TypeRegistry.Has(b[i.Kind])) throw new h(e);
return yield* (function* (e, t, n) {
yield `kind('${e[i.Kind]}', ${n})`;
})(b, 0, c);
}
}
const l = {
language: "javascript",
functions: new Map(),
variables: new Map(),
};
function d(e, t, n, r = !0) {
return `(${[...o(e, t, n, r)].join(" && ")})`;
}
function g(e) {
return `check_${p.Encode(e)}`;
}
function y(e) {
const t = `local_${l.variables.size}`;
return l.variables.set(t, `const ${t} = ${e}`), t;
}
function _(e, t, n, r, i = !0) {
const [s, a] = ["\n", (e) => "".padStart(e, " ")],
c = v("value", "any"),
l = b("boolean"),
u = [...o(t, n, r, i)]
.map((e) => `${a(4)}${e}`)
.join(` &&${s}`);
return `function ${e}(${c})${l} {${s}${a(
2,
)}return (${s}${u}${s}${a(2)})\n}`;
}
function v(e, t) {
return `${e}${"typescript" === l.language ? `: ${t}` : ""}`;
}
function b(e) {
return "typescript" === l.language ? `: ${e}` : "";
}
function E(...e) {
const t = { language: "javascript" },
[n, r, o] =
2 === e.length && a.IsArray(e[1])
? [e[0], e[1], t]
: 2 !== e.length || a.IsArray(e[1])
? 3 === e.length
? [e[0], e[1], e[2]]
: 1 === e.length
? [e[0], [], t]
: [null, [], t]
: [e[0], [], e[1]];
if (
((l.language = o.language),
l.variables.clear(),
l.functions.clear(),
!i.TypeGuard.TSchema(n))
)
throw new m(n);
for (const e of r) if (!i.TypeGuard.TSchema(e)) throw new m(e);
return (function (e, t, n) {
const r = _("check", e, t, "value"),
i = v("value", "any"),
o = b("boolean"),
s = [...l.functions.values()];
return [
...l.variables.values(),
...s,
a.IsString(e.$id)
? `return function check(${i})${o} {\n return ${g(
e.$id,
)}(value)\n}`
: `return ${r}`,
].join("\n");
})(n, r);
}
(e.Code = E),
(e.Compile = function (e, t = []) {
const n = E(e, t, { language: "javascript" }),
r = globalThis.Function(
"kind",
"format",
"hash",
n,
)(
function (t, n) {
return (
!!i.TypeRegistry.Has(t) && i.TypeRegistry.Get(t)(e, n)
);
},
function (e, t) {
return (
!!i.FormatRegistry.Has(e) && i.FormatRegistry.Get(e)(t)
);
},
function (e) {
return s.Hash(e);
},
);
return new c(e, t, r, n);
});
})(d || (t.TypeCompiler = d = {}));
},
55644: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
(i &&
!("get" in i
? !t.__esModule
: i.writable || i.configurable)) ||
(i = {
enumerable: !0,
get: function () {
return t[n];
},
}),
Object.defineProperty(e, r, i);
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.ValueErrorType = void 0);
var o = n(48803);
Object.defineProperty(t, "ValueErrorType", {
enumerable: !0,
get: function () {
return o.ValueErrorType;
},
}),
i(n(29311), t);
},
73992: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Errors =
t.ValueErrorsDereferenceError =
t.ValueErrorsUnknownTypeError =
t.ValueErrorIterator =
t.ValueErrorType =
void 0);
const r = n(85007),
i = n(14350),
o = n(97540),
s = n(37657);
var a;
!(function (e) {
(e[(e.Array = 0)] = "Array"),
(e[(e.ArrayMinItems = 1)] = "ArrayMinItems"),
(e[(e.ArrayMaxItems = 2)] = "ArrayMaxItems"),
(e[(e.ArrayContains = 3)] = "ArrayContains"),
(e[(e.ArrayMinContains = 4)] = "ArrayMinContains"),
(e[(e.ArrayMaxContains = 5)] = "ArrayMaxContains"),
(e[(e.ArrayUniqueItems = 6)] = "ArrayUniqueItems"),
(e[(e.AsyncIterator = 7)] = "AsyncIterator"),
(e[(e.BigInt = 8)] = "BigInt"),
(e[(e.BigIntMultipleOf = 9)] = "BigIntMultipleOf"),
(e[(e.BigIntExclusiveMinimum = 10)] = "BigIntExclusiveMinimum"),
(e[(e.BigIntExclusiveMaximum = 11)] = "BigIntExclusiveMaximum"),
(e[(e.BigIntMinimum = 12)] = "BigIntMinimum"),
(e[(e.BigIntMaximum = 13)] = "BigIntMaximum"),
(e[(e.Boolean = 14)] = "Boolean"),
(e[(e.Date = 15)] = "Date"),
(e[(e.DateExclusiveMinimumTimestamp = 16)] =
"DateExclusiveMinimumTimestamp"),
(e[(e.DateExclusiveMaximumTimestamp = 17)] =
"DateExclusiveMaximumTimestamp"),
(e[(e.DateMinimumTimestamp = 18)] = "DateMinimumTimestamp"),
(e[(e.DateMaximumTimestamp = 19)] = "DateMaximumTimestamp"),
(e[(e.Function = 20)] = "Function"),
(e[(e.Integer = 21)] = "Integer"),
(e[(e.IntegerMultipleOf = 22)] = "IntegerMultipleOf"),
(e[(e.IntegerExclusiveMinimum = 23)] = "IntegerExclusiveMinimum"),
(e[(e.IntegerExclusiveMaximum = 24)] = "IntegerExclusiveMaximum"),
(e[(e.IntegerMinimum = 25)] = "IntegerMinimum"),
(e[(e.IntegerMaximum = 26)] = "IntegerMaximum"),
(e[(e.Intersect = 27)] = "Intersect"),
(e[(e.IntersectUnevaluatedProperties = 28)] =
"IntersectUnevaluatedProperties"),
(e[(e.Iterator = 29)] = "Iterator"),
(e[(e.Literal = 30)] = "Literal"),
(e[(e.Never = 31)] = "Never"),
(e[(e.Not = 32)] = "Not"),
(e[(e.Null = 33)] = "Null"),
(e[(e.Number = 34)] = "Number"),
(e[(e.NumberMultipleOf = 35)] = "NumberMultipleOf"),
(e[(e.NumberExclusiveMinimum = 36)] = "NumberExclusiveMinimum"),
(e[(e.NumberExclusiveMaximum = 37)] = "NumberExclusiveMaximum"),
(e[(e.NumberMinimum = 38)] = "NumberMinimum"),
(e[(e.NumberMaximum = 39)] = "NumberMaximum"),
(e[(e.Object = 40)] = "Object"),
(e[(e.ObjectMinProperties = 41)] = "ObjectMinProperties"),
(e[(e.ObjectMaxProperties = 42)] = "ObjectMaxProperties"),
(e[(e.ObjectAdditionalProperties = 43)] =
"ObjectAdditionalProperties"),
(e[(e.ObjectRequiredProperties = 44)] = "ObjectRequiredProperties"),
(e[(e.Promise = 45)] = "Promise"),
(e[(e.RecordKeyNumeric = 46)] = "RecordKeyNumeric"),
(e[(e.RecordKeyString = 47)] = "RecordKeyString"),
(e[(e.String = 48)] = "String"),
(e[(e.StringMinLength = 49)] = "StringMinLength"),
(e[(e.StringMaxLength = 50)] = "StringMaxLength"),
(e[(e.StringPattern = 51)] = "StringPattern"),
(e[(e.StringFormatUnknown = 52)] = "StringFormatUnknown"),
(e[(e.StringFormat = 53)] = "StringFormat"),
(e[(e.Symbol = 54)] = "Symbol"),
(e[(e.TupleZeroLength = 55)] = "TupleZeroLength"),
(e[(e.TupleLength = 56)] = "TupleLength"),
(e[(e.Undefined = 57)] = "Undefined"),
(e[(e.Union = 58)] = "Union"),
(e[(e.Uint8Array = 59)] = "Uint8Array"),
(e[(e.Uint8ArrayMinByteLength = 60)] = "Uint8ArrayMinByteLength"),
(e[(e.Uint8ArrayMaxByteLength = 61)] = "Uint8ArrayMaxByteLength"),
(e[(e.Void = 62)] = "Void"),
(e[(e.Kind = 63)] = "Kind");
})(a || (t.ValueErrorType = a = {}));
class c {
constructor(e) {
this.iterator = e;
}
[Symbol.iterator]() {
return this.iterator;
}
First() {
const e = this.iterator.next();
return e.done ? void 0 : e.value;
}
}
t.ValueErrorIterator = c;
class l extends Error {
constructor(e) {
super("ValueErrors: Unknown type"), (this.schema = e);
}
}
t.ValueErrorsUnknownTypeError = l;
class u extends Error {
constructor(e) {
super(
`ValueErrors: Unable to dereference type with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
function p(e) {
return void 0 !== e;
}
function d(e, t) {
return r.TypeSystem.ExactOptionalPropertyTypes
? t in e
: void 0 !== e[t];
}
function h(e) {
const t = s.IsObject(e);
return r.TypeSystem.AllowArrayObjects ? t : t && !s.IsArray(e);
}
function f(e) {
const t = s.IsNumber(e);
return r.TypeSystem.AllowNaN ? t : t && Number.isFinite(e);
}
function* m(e, t, n, c) {
const g = p(e.$id) ? [...t, e] : t,
y = e;
switch (y[i.Kind]) {
case "Any":
case "Unknown":
return yield* (function* (e, t, n, r) {})();
case "Array":
return yield* (function* (e, t, n, r) {
if (!s.IsArray(r))
return yield {
type: a.Array,
schema: e,
path: n,
value: r,
message: "Expected array",
};
!p(e.minItems) ||
r.length >= e.minItems ||
(yield {
type: a.ArrayMinItems,
schema: e,
path: n,
value: r,
message: `Expected array length to be greater or equal to ${e.minItems}`,
}),
!p(e.maxItems) ||
r.length <= e.maxItems ||
(yield {
type: a.ArrayMinItems,
schema: e,
path: n,
value: r,
message: `Expected array length to be less or equal to ${e.maxItems}`,
});
for (let i = 0; i < r.length; i++)
yield* m(e.items, t, `${n}/${i}`, r[i]);
if (
(!0 !== e.uniqueItems ||
(function () {
const e = new Set();
for (const t of r) {
const n = o.Hash(t);
if (e.has(n)) return !1;
e.add(n);
}
return !0;
})() ||
(yield {
type: a.ArrayUniqueItems,
schema: e,
path: n,
value: r,
message: "Expected array elements to be unique",
}),
!(p(e.contains) || f(e.minContains) || f(e.maxContains)))
)
return;
const c = p(e.contains) ? e.contains : i.Type.Never(),
l = r.reduce(
(e, r, i) =>
!0 === m(c, t, `${n}${i}`, r).next().done ? e + 1 : e,
0,
);
0 === l &&
(yield {
type: a.ArrayContains,
schema: e,
path: n,
value: r,
message:
"Expected array to contain at least one matching type",
}),
s.IsNumber(e.minContains) &&
l < e.minContains &&
(yield {
type: a.ArrayMinContains,
schema: e,
path: n,
value: r,
message: `Expected array to contain at least ${e.minContains} matching types`,
}),
s.IsNumber(e.maxContains) &&
l > e.maxContains &&
(yield {
type: a.ArrayMaxContains,
schema: e,
path: n,
value: r,
message: `Expected array to contain no more than ${e.maxContains} matching types`,
});
})(y, g, n, c);
case "AsyncIterator":
return yield* (function* (e, t, n, r) {
s.IsAsyncIterator(r) ||
(yield {
type: a.AsyncIterator,
schema: e,
path: n,
value: r,
message: "Expected value to be an async iterator",
});
})(y, 0, n, c);
case "BigInt":
return yield* (function* (e, t, n, r) {
if (!s.IsBigInt(r))
return yield {
type: a.BigInt,
schema: e,
path: n,
value: r,
message: "Expected bigint",
};
p(e.multipleOf) &&
r % e.multipleOf !== BigInt(0) &&
(yield {
type: a.BigIntMultipleOf,
schema: e,
path: n,
value: r,
message: `Expected bigint to be a multiple of ${e.multipleOf}`,
}),
!p(e.exclusiveMinimum) ||
r > e.exclusiveMinimum ||
(yield {
type: a.BigIntExclusiveMinimum,
schema: e,
path: n,
value: r,
message: `Expected bigint to be greater than ${e.exclusiveMinimum}`,
}),
!p(e.exclusiveMaximum) ||
r < e.exclusiveMaximum ||
(yield {
type: a.BigIntExclusiveMaximum,
schema: e,
path: n,
value: r,
message: `Expected bigint to be less than ${e.exclusiveMaximum}`,
}),
!p(e.minimum) ||
r >= e.minimum ||
(yield {
type: a.BigIntMinimum,
schema: e,
path: n,
value: r,
message: `Expected bigint to be greater or equal to ${e.minimum}`,
}),
!p(e.maximum) ||
r <= e.maximum ||
(yield {
type: a.BigIntMaximum,
schema: e,
path: n,
value: r,
message: `Expected bigint to be less or equal to ${e.maximum}`,
});
})(y, 0, n, c);
case "Boolean":
return yield* (function* (e, t, n, r) {
if (!s.IsBoolean(r))
return yield {
type: a.Boolean,
schema: e,
path: n,
value: r,
message: "Expected boolean",
};
})(y, 0, n, c);
case "Constructor":
return yield* (function* (e, t, n, r) {
yield* m(e.returns, t, n, r.prototype);
})(y, g, n, c);
case "Date":
return yield* (function* (e, t, n, r) {
return s.IsDate(r)
? isFinite(r.getTime())
? (!p(e.exclusiveMinimumTimestamp) ||
r.getTime() > e.exclusiveMinimumTimestamp ||
(yield {
type: a.DateExclusiveMinimumTimestamp,
schema: e,
path: n,
value: r,
message: `Expected Date timestamp to be greater than ${e.exclusiveMinimum}`,
}),
!p(e.exclusiveMaximumTimestamp) ||
r.getTime() < e.exclusiveMaximumTimestamp ||
(yield {
type: a.DateExclusiveMaximumTimestamp,
schema: e,
path: n,
value: r,
message: `Expected Date timestamp to be less than ${e.exclusiveMaximum}`,
}),
!p(e.minimumTimestamp) ||
r.getTime() >= e.minimumTimestamp ||
(yield {
type: a.DateMinimumTimestamp,
schema: e,
path: n,
value: r,
message: `Expected Date timestamp to be greater or equal to ${e.minimum}`,
}),
void (
!p(e.maximumTimestamp) ||
r.getTime() <= e.maximumTimestamp ||
(yield {
type: a.DateMaximumTimestamp,
schema: e,
path: n,
value: r,
message: `Expected Date timestamp to be less or equal to ${e.maximum}`,
})
))
: yield {
type: a.Date,
schema: e,
path: n,
value: r,
message: "Invalid Date",
}
: yield {
type: a.Date,
schema: e,
path: n,
value: r,
message: "Expected Date object",
};
})(y, 0, n, c);
case "Function":
return yield* (function* (e, t, n, r) {
if (!s.IsFunction(r))
return yield {
type: a.Function,
schema: e,
path: n,
value: r,
message: "Expected function",
};
})(y, 0, n, c);
case "Integer":
return yield* (function* (e, t, n, r) {
if (!s.IsInteger(r))
return yield {
type: a.Integer,
schema: e,
path: n,
value: r,
message: "Expected integer",
};
p(e.multipleOf) &&
r % e.multipleOf != 0 &&
(yield {
type: a.IntegerMultipleOf,
schema: e,
path: n,
value: r,
message: `Expected integer to be a multiple of ${e.multipleOf}`,
}),
!p(e.exclusiveMinimum) ||
r > e.exclusiveMinimum ||
(yield {
type: a.IntegerExclusiveMinimum,
schema: e,
path: n,
value: r,
message: `Expected integer to be greater than ${e.exclusiveMinimum}`,
}),
!p(e.exclusiveMaximum) ||
r < e.exclusiveMaximum ||
(yield {
type: a.IntegerExclusiveMaximum,
schema: e,
path: n,
value: r,
message: `Expected integer to be less than ${e.exclusiveMaximum}`,
}),
!p(e.minimum) ||
r >= e.minimum ||
(yield {
type: a.IntegerMinimum,
schema: e,
path: n,
value: r,
message: `Expected integer to be greater or equal to ${e.minimum}`,
}),
!p(e.maximum) ||
r <= e.maximum ||
(yield {
type: a.IntegerMaximum,
schema: e,
path: n,
value: r,
message: `Expected integer to be less or equal to ${e.maximum}`,
});
})(y, 0, n, c);
case "Intersect":
return yield* (function* (e, t, n, r) {
for (const i of e.allOf) {
const o = m(i, t, n, r).next();
if (!o.done)
return (
yield o.value,
void (yield {
type: a.Intersect,
schema: e,
path: n,
value: r,
message: "Expected all sub schemas to be valid",
})
);
}
if (!1 === e.unevaluatedProperties) {
const t = new RegExp(i.KeyResolver.ResolvePattern(e));
for (const i of Object.getOwnPropertyNames(r))
t.test(i) ||
(yield {
type: a.IntersectUnevaluatedProperties,
schema: e,
path: `${n}/${i}`,
value: r,
message: "Unexpected property",
});
}
if ("object" == typeof e.unevaluatedProperties) {
const o = new RegExp(i.KeyResolver.ResolvePattern(e));
for (const i of Object.getOwnPropertyNames(r))
if (!o.test(i)) {
const o = m(
e.unevaluatedProperties,
t,
`${n}/${i}`,
r[i],
).next();
if (!o.done)
return (
yield o.value,
void (yield {
type: a.IntersectUnevaluatedProperties,
schema: e,
path: `${n}/${i}`,
value: r,
message: "Invalid additional property",
})
);
}
}
})(y, g, n, c);
case "Iterator":
return yield* (function* (e, t, n, r) {
(h(r) && Symbol.iterator in r) ||
(yield {
type: a.Iterator,
schema: e,
path: n,
value: r,
message: "Expected value to be an iterator",
});
})(y, 0, n, c);
case "Literal":
return yield* (function* (e, t, n, r) {
if (r !== e.const) {
const t =
"string" == typeof e.const ? `'${e.const}'` : e.const;
return yield {
type: a.Literal,
schema: e,
path: n,
value: r,
message: `Expected ${t}`,
};
}
})(y, 0, n, c);
case "Never":
return yield* (function* (e, t, n, r) {
yield {
type: a.Never,
schema: e,
path: n,
value: r,
message: "Value cannot be validated",
};
})(y, 0, n, c);
case "Not":
return yield* (function* (e, t, n, r) {
!0 === m(e.not, t, n, r).next().done &&
(yield {
type: a.Not,
schema: e,
path: n,
value: r,
message: "Value should not validate",
});
})(y, g, n, c);
case "Null":
return yield* (function* (e, t, n, r) {
if (!s.IsNull(r))
return yield {
type: a.Null,
schema: e,
path: n,
value: r,
message: "Expected null",
};
})(y, 0, n, c);
case "Number":
return yield* (function* (e, t, n, r) {
if (!f(r))
return yield {
type: a.Number,
schema: e,
path: n,
value: r,
message: "Expected number",
};
p(e.multipleOf) &&
r % e.multipleOf != 0 &&
(yield {
type: a.NumberMultipleOf,
schema: e,
path: n,
value: r,
message: `Expected number to be a multiple of ${e.multipleOf}`,
}),
!p(e.exclusiveMinimum) ||
r > e.exclusiveMinimum ||
(yield {
type: a.NumberExclusiveMinimum,
schema: e,
path: n,
value: r,
message: `Expected number to be greater than ${e.exclusiveMinimum}`,
}),
!p(e.exclusiveMaximum) ||
r < e.exclusiveMaximum ||
(yield {
type: a.NumberExclusiveMaximum,
schema: e,
path: n,
value: r,
message: `Expected number to be less than ${e.exclusiveMaximum}`,
}),
!p(e.minimum) ||
r >= e.minimum ||
(yield {
type: a.NumberMinimum,
schema: e,
path: n,
value: r,
message: `Expected number to be greater or equal to ${e.minimum}`,
}),
!p(e.maximum) ||
r <= e.maximum ||
(yield {
type: a.NumberMaximum,
schema: e,
path: n,
value: r,
message: `Expected number to be less or equal to ${e.maximum}`,
});
})(y, 0, n, c);
case "Object":
return yield* (function* (e, t, n, r) {
if (!h(r))
return yield {
type: a.Object,
schema: e,
path: n,
value: r,
message: "Expected object",
};
!p(e.minProperties) ||
Object.getOwnPropertyNames(r).length >= e.minProperties ||
(yield {
type: a.ObjectMinProperties,
schema: e,
path: n,
value: r,
message: `Expected object to have at least ${e.minProperties} properties`,
}),
!p(e.maxProperties) ||
Object.getOwnPropertyNames(r).length <= e.maxProperties ||
(yield {
type: a.ObjectMaxProperties,
schema: e,
path: n,
value: r,
message: `Expected object to have no more than ${e.maxProperties} properties`,
});
const o = Array.isArray(e.required) ? e.required : [],
s = Object.getOwnPropertyNames(e.properties),
c = Object.getOwnPropertyNames(r);
for (const o of s) {
const s = e.properties[o];
e.required && e.required.includes(o)
? (yield* m(s, t, `${n}/${o}`, r[o]),
i.ExtendsUndefined.Check(e) &&
!(o in r) &&
(yield {
type: a.ObjectRequiredProperties,
schema: s,
path: `${n}/${o}`,
value: void 0,
message: "Expected required property",
}))
: d(r, o) && (yield* m(s, t, `${n}/${o}`, r[o]));
}
for (const t of o)
c.includes(t) ||
(yield {
type: a.ObjectRequiredProperties,
schema: e.properties[t],
path: `${n}/${t}`,
value: void 0,
message: "Expected required property",
});
if (!1 === e.additionalProperties)
for (const t of c)
s.includes(t) ||
(yield {
type: a.ObjectAdditionalProperties,
schema: e,
path: `${n}/${t}`,
value: r[t],
message: "Unexpected property",
});
if ("object" == typeof e.additionalProperties)
for (const i of c)
s.includes(i) ||
(yield* m(e.additionalProperties, t, `${n}/${i}`, r[i]));
})(y, g, n, c);
case "Promise":
return yield* (function* (e, t, n, r) {
s.IsPromise(r) ||
(yield {
type: a.Promise,
schema: e,
path: n,
value: r,
message: "Expected Promise",
});
})(y, 0, n, c);
case "Record":
return yield* (function* (e, t, n, r) {
if (
!(function (e) {
return (
h(e) && !(e instanceof Date) && !(e instanceof Uint8Array)
);
})(r)
)
return yield {
type: a.Object,
schema: e,
path: n,
value: r,
message: "Expected record object",
};
!p(e.minProperties) ||
Object.getOwnPropertyNames(r).length >= e.minProperties ||
(yield {
type: a.ObjectMinProperties,
schema: e,
path: n,
value: r,
message: `Expected object to have at least ${e.minProperties} properties`,
}),
!p(e.maxProperties) ||
Object.getOwnPropertyNames(r).length <= e.maxProperties ||
(yield {
type: a.ObjectMaxProperties,
schema: e,
path: n,
value: r,
message: `Expected object to have no more than ${e.maxProperties} properties`,
});
const [i, o] = Object.entries(e.patternProperties)[0],
s = new RegExp(i);
for (const [i, c] of Object.entries(r))
if (s.test(i)) yield* m(o, t, `${n}/${i}`, c);
else if (
("object" == typeof e.additionalProperties &&
(yield* m(e.additionalProperties, t, `${n}/${i}`, c)),
!1 === e.additionalProperties)
) {
const t = `${n}/${i}`,
r = `Unexpected property '${t}'`;
return yield {
type: a.ObjectAdditionalProperties,
schema: e,
path: t,
value: c,
message: r,
};
}
})(y, g, n, c);
case "Ref":
return yield* (function* (e, t, n, r) {
const i = t.findIndex((t) => t.$id === e.$ref);
if (-1 === i) throw new u(e);
const o = t[i];
yield* m(o, t, n, r);
})(y, g, n, c);
case "String":
return yield* (function* (e, t, n, r) {
if (!s.IsString(r))
return yield {
type: a.String,
schema: e,
path: n,
value: r,
message: "Expected string",
};
!p(e.minLength) ||
r.length >= e.minLength ||
(yield {
type: a.StringMinLength,
schema: e,
path: n,
value: r,
message: `Expected string length greater or equal to ${e.minLength}`,
}),
!p(e.maxLength) ||
r.length <= e.maxLength ||
(yield {
type: a.StringMaxLength,
schema: e,
path: n,
value: r,
message: `Expected string length less or equal to ${e.maxLength}`,
}),
s.IsString(e.pattern) &&
(new RegExp(e.pattern).test(r) ||
(yield {
type: a.StringPattern,
schema: e,
path: n,
value: r,
message: `Expected string to match pattern ${e.pattern}`,
})),
s.IsString(e.format) &&
(i.FormatRegistry.Has(e.format)
? i.FormatRegistry.Get(e.format)(r) ||
(yield {
type: a.StringFormat,
schema: e,
path: n,
value: r,
message: `Expected string to match format '${e.format}'`,
})
: yield {
type: a.StringFormatUnknown,
schema: e,
path: n,
value: r,
message: `Unknown string format '${e.format}'`,
});
})(y, 0, n, c);
case "Symbol":
return yield* (function* (e, t, n, r) {
if (!s.IsSymbol(r))
return yield {
type: a.Symbol,
schema: e,
path: n,
value: r,
message: "Expected symbol",
};
})(y, 0, n, c);
case "TemplateLiteral":
return yield* (function* (e, t, n, r) {
if (!s.IsString(r))
return yield {
type: a.String,
schema: e,
path: n,
value: r,
message: "Expected string",
};
new RegExp(e.pattern).test(r) ||
(yield {
type: a.StringPattern,
schema: e,
path: n,
value: r,
message: `Expected string to match pattern ${e.pattern}`,
});
})(y, 0, n, c);
case "This":
return yield* (function* (e, t, n, r) {
const i = t.findIndex((t) => t.$id === e.$ref);
if (-1 === i) throw new u(e);
const o = t[i];
yield* m(o, t, n, r);
})(y, g, n, c);
case "Tuple":
return yield* (function* (e, t, n, r) {
if (!s.IsArray(r))
return yield {
type: a.Array,
schema: e,
path: n,
value: r,
message: "Expected Array",
};
if (void 0 === e.items && 0 !== r.length)
return yield {
type: a.TupleZeroLength,
schema: e,
path: n,
value: r,
message: "Expected tuple to have 0 elements",
};
if (
(r.length !== e.maxItems &&
(yield {
type: a.TupleLength,
schema: e,
path: n,
value: r,
message: `Expected tuple to have ${e.maxItems} elements`,
}),
e.items)
)
for (let i = 0; i < e.items.length; i++)
yield* m(e.items[i], t, `${n}/${i}`, r[i]);
})(y, g, n, c);
case "Undefined":
return yield* (function* (e, t, n, r) {
void 0 !== r &&
(yield {
type: a.Undefined,
schema: e,
path: n,
value: r,
message: "Expected undefined",
});
})(y, 0, n, c);
case "Union":
return yield* (function* (e, t, n, r) {
const i = [];
for (const o of e.anyOf) {
const e = [...m(o, t, n, r)];
if (0 === e.length) return;
i.push(...e);
}
i.length > 0 &&
(yield {
type: a.Union,
schema: e,
path: n,
value: r,
message: "Expected value of union",
});
for (const e of i) yield e;
})(y, g, n, c);
case "Uint8Array":
return yield* (function* (e, t, n, r) {
if (!s.IsUint8Array(r))
return yield {
type: a.Uint8Array,
schema: e,
path: n,
value: r,
message: "Expected Uint8Array",
};
!p(e.maxByteLength) ||
r.length <= e.maxByteLength ||
(yield {
type: a.Uint8ArrayMaxByteLength,
schema: e,
path: n,
value: r,
message: `Expected Uint8Array to have a byte length less or equal to ${e.maxByteLength}`,
}),
!p(e.minByteLength) ||
r.length >= e.minByteLength ||
(yield {
type: a.Uint8ArrayMinByteLength,
schema: e,
path: n,
value: r,
message: `Expected Uint8Array to have a byte length greater or equal to ${e.maxByteLength}`,
});
})(y, 0, n, c);
case "Void":
return yield* (function* (e, t, n, i) {
if (
!(function (e) {
const t = s.IsUndefined(e);
return r.TypeSystem.AllowVoidNull ? t || null === e : t;
})(i)
)
return yield {
type: a.Void,
schema: e,
path: n,
value: i,
message: "Expected void",
};
})(y, 0, n, c);
default:
if (!i.TypeRegistry.Has(y[i.Kind])) throw new l(e);
return yield* (function* (e, t, n, r) {
if (!i.TypeRegistry.Get(e[i.Kind])(e, r))
return yield {
type: a.Kind,
schema: e,
path: n,
value: r,
message: `Expected kind ${e[i.Kind]}`,
};
})(y, 0, n, c);
}
}
(t.ValueErrorsDereferenceError = u),
(t.Errors = function (...e) {
const t =
3 === e.length ? m(e[0], e[1], "", e[2]) : m(e[0], [], "", e[1]);
return new c(t);
});
},
48803: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
(i &&
!("get" in i
? !t.__esModule
: i.writable || i.configurable)) ||
(i = {
enumerable: !0,
get: function () {
return t[n];
},
}),
Object.defineProperty(e, r, i);
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }), i(n(73992), t);
},
85007: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
(i &&
!("get" in i
? !t.__esModule
: i.writable || i.configurable)) ||
(i = {
enumerable: !0,
get: function () {
return t[n];
},
}),
Object.defineProperty(e, r, i);
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }), i(n(62437), t);
},
62437: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.TypeSystem =
t.TypeSystemDuplicateFormat =
t.TypeSystemDuplicateTypeKind =
void 0);
const r = n(14350);
class i extends Error {
constructor(e) {
super(`Duplicate type kind '${e}' detected`);
}
}
t.TypeSystemDuplicateTypeKind = i;
class o extends Error {
constructor(e) {
super(`Duplicate string format '${e}' detected`);
}
}
var s;
(t.TypeSystemDuplicateFormat = o),
(function (e) {
(e.ExactOptionalPropertyTypes = !1),
(e.AllowArrayObjects = !1),
(e.AllowNaN = !1),
(e.AllowVoidNull = !1),
(e.Type = function (e, t) {
if (r.TypeRegistry.Has(e)) throw new i(e);
return (
r.TypeRegistry.Set(e, t),
(t = {}) => r.Type.Unsafe({ ...t, [r.Kind]: e })
);
}),
(e.Format = function (e, t) {
if (r.FormatRegistry.Has(e)) throw new o(e);
return r.FormatRegistry.Set(e, t), e;
});
})(s || (t.TypeSystem = s = {}));
},
14350: (e, t) => {
"use strict";
var n, r, i, o, s, a, c, l, u, p, d, h, f, m, g, y, _, v, b;
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Type =
t.StandardType =
t.ExtendedTypeBuilder =
t.StandardTypeBuilder =
t.TypeBuilder =
t.TemplateLiteralDslParser =
t.TemplateLiteralGenerator =
t.TemplateLiteralFinite =
t.TemplateLiteralParser =
t.TemplateLiteralParserError =
t.TemplateLiteralResolver =
t.TemplateLiteralPattern =
t.UnionResolver =
t.KeyArrayResolver =
t.KeyResolver =
t.ObjectMap =
t.IndexedAccessor =
t.TypeClone =
t.TypeExtends =
t.TypeExtendsResult =
t.ExtendsUndefined =
t.TypeGuard =
t.TypeGuardUnknownTypeError =
t.ValueGuard =
t.FormatRegistry =
t.TypeRegistry =
t.PatternStringExact =
t.PatternNumberExact =
t.PatternBooleanExact =
t.PatternString =
t.PatternNumber =
t.PatternBoolean =
t.Kind =
t.Hint =
t.Optional =
t.Readonly =
void 0),
(t.Readonly = Symbol.for("TypeBox.Readonly")),
(t.Optional = Symbol.for("TypeBox.Optional")),
(t.Hint = Symbol.for("TypeBox.Hint")),
(t.Kind = Symbol.for("TypeBox.Kind")),
(t.PatternBoolean = "(true|false)"),
(t.PatternNumber = "(0|[1-9][0-9]*)"),
(t.PatternString = "(.*)"),
(t.PatternBooleanExact = `^${t.PatternBoolean}$`),
(t.PatternNumberExact = `^${t.PatternNumber}$`),
(t.PatternStringExact = `^${t.PatternString}$`),
(function (e) {
const t = new Map();
(e.Entries = function () {
return new Map(t);
}),
(e.Clear = function () {
return t.clear();
}),
(e.Delete = function (e) {
return t.delete(e);
}),
(e.Has = function (e) {
return t.has(e);
}),
(e.Set = function (e, n) {
t.set(e, n);
}),
(e.Get = function (e) {
return t.get(e);
});
})(n || (t.TypeRegistry = n = {})),
(function (e) {
const t = new Map();
(e.Entries = function () {
return new Map(t);
}),
(e.Clear = function () {
return t.clear();
}),
(e.Delete = function (e) {
return t.delete(e);
}),
(e.Has = function (e) {
return t.has(e);
}),
(e.Set = function (e, n) {
t.set(e, n);
}),
(e.Get = function (e) {
return t.get(e);
});
})(r || (t.FormatRegistry = r = {})),
(function (e) {
(e.IsObject = function (e) {
return "object" == typeof e && null !== e;
}),
(e.IsArray = function (e) {
return Array.isArray(e);
}),
(e.IsBoolean = function (e) {
return "boolean" == typeof e;
}),
(e.IsNull = function (e) {
return null === e;
}),
(e.IsUndefined = function (e) {
return void 0 === e;
}),
(e.IsBigInt = function (e) {
return "bigint" == typeof e;
}),
(e.IsNumber = function (e) {
return "number" == typeof e;
}),
(e.IsString = function (e) {
return "string" == typeof e;
});
})(i || (t.ValueGuard = i = {}));
class E extends Error {
constructor(e) {
super("TypeGuard: Unknown type"), (this.schema = e);
}
}
(t.TypeGuardUnknownTypeError = E),
(function (e) {
function r(e) {
try {
return new RegExp(e), !0;
} catch {
return !1;
}
}
function o(e) {
if (!i.IsString(e)) return !1;
for (let t = 0; t < e.length; t++) {
const n = e.charCodeAt(t);
if ((n >= 7 && n <= 13) || 27 === n || 127 === n) return !1;
}
return !0;
}
function s(e) {
return l(e) || K(e);
}
function a(e) {
return i.IsUndefined(e) || i.IsBigInt(e);
}
function c(e) {
return i.IsUndefined(e) || i.IsNumber(e);
}
function l(e) {
return i.IsUndefined(e) || i.IsBoolean(e);
}
function u(e) {
return i.IsUndefined(e) || i.IsString(e);
}
function p(e) {
return i.IsUndefined(e) || K(e);
}
function d(e) {
return S(e, "Any") && u(e.$id);
}
function h(e) {
return (
S(e, "Array") &&
"array" === e.type &&
u(e.$id) &&
K(e.items) &&
c(e.minItems) &&
c(e.maxItems) &&
l(e.uniqueItems) &&
p(e.contains) &&
c(e.minContains) &&
c(e.maxContains)
);
}
function f(e) {
return (
S(e, "AsyncIterator") &&
"AsyncIterator" === e.type &&
u(e.$id) &&
K(e.items)
);
}
function m(e) {
return (
S(e, "BigInt") &&
"bigint" === e.type &&
u(e.$id) &&
a(e.multipleOf) &&
a(e.minimum) &&
a(e.maximum) &&
a(e.exclusiveMinimum) &&
a(e.exclusiveMaximum)
);
}
function g(e) {
return S(e, "Boolean") && "boolean" === e.type && u(e.$id);
}
function y(e) {
if (
!(
S(e, "Constructor") &&
"constructor" === e.type &&
u(e.$id) &&
i.IsArray(e.parameters) &&
K(e.returns)
)
)
return !1;
for (const t of e.parameters) if (!K(t)) return !1;
return !0;
}
function _(e) {
return (
S(e, "Date") &&
"Date" === e.type &&
u(e.$id) &&
c(e.minimumTimestamp) &&
c(e.maximumTimestamp) &&
c(e.exclusiveMinimumTimestamp) &&
c(e.exclusiveMaximumTimestamp)
);
}
function v(e) {
if (
!(
S(e, "Function") &&
"function" === e.type &&
u(e.$id) &&
i.IsArray(e.parameters) &&
K(e.returns)
)
)
return !1;
for (const t of e.parameters) if (!K(t)) return !1;
return !0;
}
function b(e) {
return (
S(e, "Integer") &&
"integer" === e.type &&
u(e.$id) &&
c(e.multipleOf) &&
c(e.minimum) &&
c(e.maximum) &&
c(e.exclusiveMinimum) &&
c(e.exclusiveMaximum)
);
}
function E(e) {
if (
!(
S(e, "Intersect") &&
i.IsArray(e.allOf) &&
u(e.type) &&
(l(e.unevaluatedProperties) || p(e.unevaluatedProperties)) &&
u(e.$id)
)
)
return !1;
if ("type" in e && "object" !== e.type) return !1;
for (const t of e.allOf) if (!K(t)) return !1;
return !0;
}
function w(e) {
return (
S(e, "Iterator") &&
"Iterator" === e.type &&
u(e.$id) &&
K(e.items)
);
}
function S(e, n) {
return T(e) && e[t.Kind] === n;
}
function T(e) {
return i.IsObject(e) && t.Kind in e && i.IsString(e[t.Kind]);
}
function x(e) {
return I(e) && i.IsString(e.const);
}
function C(e) {
return I(e) && i.IsNumber(e.const);
}
function I(e) {
return (
S(e, "Literal") &&
u(e.$id) &&
(i.IsBoolean(e.const) ||
i.IsNumber(e.const) ||
i.IsString(e.const))
);
}
function A(e) {
return (
S(e, "Never") &&
i.IsObject(e.not) &&
0 === Object.getOwnPropertyNames(e.not).length
);
}
function P(e) {
return S(e, "Not") && K(e.not);
}
function k(e) {
return S(e, "Null") && "null" === e.type && u(e.$id);
}
function N(e) {
return (
S(e, "Number") &&
"number" === e.type &&
u(e.$id) &&
c(e.multipleOf) &&
c(e.minimum) &&
c(e.maximum) &&
c(e.exclusiveMinimum) &&
c(e.exclusiveMaximum)
);
}
function O(e) {
if (
!(
S(e, "Object") &&
"object" === e.type &&
u(e.$id) &&
i.IsObject(e.properties) &&
s(e.additionalProperties) &&
c(e.minProperties) &&
c(e.maxProperties)
)
)
return !1;
for (const [t, n] of Object.entries(e.properties)) {
if (!o(t)) return !1;
if (!K(n)) return !1;
}
return !0;
}
function R(e) {
return (
S(e, "Promise") && "Promise" === e.type && u(e.$id) && K(e.item)
);
}
function M(e) {
if (
!(
S(e, "Record") &&
"object" === e.type &&
u(e.$id) &&
s(e.additionalProperties) &&
i.IsObject(e.patternProperties)
)
)
return !1;
const t = Object.getOwnPropertyNames(e.patternProperties);
return (
1 === t.length && !!r(t[0]) && !!K(e.patternProperties[t[0]])
);
}
function L(e) {
return S(e, "Ref") && u(e.$id) && i.IsString(e.$ref);
}
function D(e) {
return (
S(e, "String") &&
"string" === e.type &&
u(e.$id) &&
c(e.minLength) &&
c(e.maxLength) &&
((t = e.pattern),
i.IsUndefined(t) || (i.IsString(t) && o(t) && r(t))) &&
(function (e) {
return i.IsUndefined(e) || (i.IsString(e) && o(e));
})(e.format)
);
var t;
}
function B(e) {
return S(e, "Symbol") && "symbol" === e.type && u(e.$id);
}
function F(e) {
return (
S(e, "TemplateLiteral") &&
"string" === e.type &&
i.IsString(e.pattern) &&
"^" === e.pattern[0] &&
"$" === e.pattern[e.pattern.length - 1]
);
}
function U(e) {
return S(e, "This") && u(e.$id) && i.IsString(e.$ref);
}
function j(e) {
if (
!(
S(e, "Tuple") &&
"array" === e.type &&
u(e.$id) &&
i.IsNumber(e.minItems) &&
i.IsNumber(e.maxItems) &&
e.minItems === e.maxItems
)
)
return !1;
if (
i.IsUndefined(e.items) &&
i.IsUndefined(e.additionalItems) &&
0 === e.minItems
)
return !0;
if (!i.IsArray(e.items)) return !1;
for (const t of e.items) if (!K(t)) return !1;
return !0;
}
function H(e) {
return S(e, "Undefined") && "undefined" === e.type && u(e.$id);
}
function $(e) {
if (!(S(e, "Union") && i.IsArray(e.anyOf) && u(e.$id))) return !1;
for (const t of e.anyOf) if (!K(t)) return !1;
return !0;
}
function V(e) {
return (
S(e, "Uint8Array") &&
"Uint8Array" === e.type &&
u(e.$id) &&
c(e.minByteLength) &&
c(e.maxByteLength)
);
}
function q(e) {
return S(e, "Unknown") && u(e.$id);
}
function z(e) {
return S(e, "Unsafe");
}
function G(e) {
return S(e, "Void") && "void" === e.type && u(e.$id);
}
function K(e) {
return (
i.IsObject(e) &&
(d(e) ||
h(e) ||
g(e) ||
m(e) ||
f(e) ||
y(e) ||
_(e) ||
v(e) ||
b(e) ||
E(e) ||
w(e) ||
I(e) ||
A(e) ||
P(e) ||
k(e) ||
N(e) ||
O(e) ||
R(e) ||
M(e) ||
L(e) ||
D(e) ||
B(e) ||
F(e) ||
U(e) ||
j(e) ||
H(e) ||
$(e) ||
V(e) ||
q(e) ||
z(e) ||
G(e) ||
(T(e) && n.Has(e[t.Kind])))
);
}
(e.TAny = d),
(e.TArray = h),
(e.TAsyncIterator = f),
(e.TBigInt = m),
(e.TBoolean = g),
(e.TConstructor = y),
(e.TDate = _),
(e.TFunction = v),
(e.TInteger = b),
(e.TIntersect = E),
(e.TIterator = w),
(e.TKindOf = S),
(e.TKind = T),
(e.TLiteralString = x),
(e.TLiteralNumber = C),
(e.TLiteralBoolean = function (e) {
return I(e) && i.IsBoolean(e.const);
}),
(e.TLiteral = I),
(e.TNever = A),
(e.TNot = P),
(e.TNull = k),
(e.TNumber = N),
(e.TObject = O),
(e.TPromise = R),
(e.TRecord = M),
(e.TRef = L),
(e.TString = D),
(e.TSymbol = B),
(e.TTemplateLiteral = F),
(e.TThis = U),
(e.TTuple = j),
(e.TUndefined = H),
(e.TUnionLiteral = function (e) {
return $(e) && e.anyOf.every((e) => x(e) || C(e));
}),
(e.TUnion = $),
(e.TUint8Array = V),
(e.TUnknown = q),
(e.TUnsafe = z),
(e.TVoid = G),
(e.TReadonly = function (e) {
return i.IsObject(e) && "Readonly" === e[t.Readonly];
}),
(e.TOptional = function (e) {
return i.IsObject(e) && "Optional" === e[t.Optional];
}),
(e.TSchema = K);
})(o || (t.TypeGuard = o = {})),
(function (e) {
e.Check = function e(n) {
return (
"Undefined" === n[t.Kind] ||
("Not" === n[t.Kind]
? !e(n.not)
: "Intersect" === n[t.Kind]
? n.allOf.every((t) => e(t))
: "Union" === n[t.Kind] && n.anyOf.some((t) => e(t)))
);
};
})(s || (t.ExtendsUndefined = s = {})),
(function (e) {
(e[(e.Union = 0)] = "Union"),
(e[(e.True = 1)] = "True"),
(e[(e.False = 2)] = "False");
})(a || (t.TypeExtendsResult = a = {})),
(function (e) {
function n(e) {
return e === a.False ? a.False : a.True;
}
function r(e) {
return (
o.TNever(e) ||
o.TIntersect(e) ||
o.TUnion(e) ||
o.TUnknown(e) ||
o.TAny(e)
);
}
function s(e, t) {
if (o.TNever(t)) return d();
if (o.TIntersect(t)) return p(e, t);
if (o.TUnion(t)) return A(e, t);
if (o.TUnknown(t)) return P();
if (o.TAny(t)) return c();
throw Error("TypeExtends: StructuralRight");
}
function c(e, t) {
return a.True;
}
function l(e, t) {
return (o.TLiteral(e) && i.IsBoolean(e.const)) || o.TBoolean(e)
? a.True
: a.False;
}
function u(e, t) {
return (o.TLiteral(e) && i.IsNumber(e.const)) ||
o.TNumber(e) ||
o.TInteger(e)
? a.True
: a.False;
}
function p(e, t) {
return t.allOf.every((t) => k(e, t) === a.True)
? a.True
: a.False;
}
function d(e, t) {
return a.False;
}
function h(e) {
let [n, r] = [e, 0];
for (; o.TNot(n); ) (n = n.not), (r += 1);
return r % 2 == 0 ? n : t.Type.Unknown();
}
function f(e, t) {
return o.TLiteralNumber(e) || o.TNumber(e) || o.TInteger(e)
? a.True
: a.False;
}
function m(e, t) {
return Object.getOwnPropertyNames(e.properties).length === t;
}
function y(e) {
return E(e);
}
function _(e) {
return (
m(e, 0) ||
(m(e, 1) &&
"description" in e.properties &&
o.TUnion(e.properties.description) &&
2 === e.properties.description.anyOf.length &&
((o.TString(e.properties.description.anyOf[0]) &&
o.TUndefined(e.properties.description.anyOf[1])) ||
(o.TString(e.properties.description.anyOf[1]) &&
o.TUndefined(e.properties.description.anyOf[0]))))
);
}
function v(e) {
return m(e, 0);
}
function b(e) {
return m(e, 0);
}
function E(e) {
const r = t.Type.Number();
return (
m(e, 0) ||
(m(e, 1) &&
"length" in e.properties &&
n(k(e.properties.length, r)) === a.True)
);
}
function w(e, t) {
return k(e, t) === a.False || (o.TOptional(e) && !o.TOptional(t))
? a.False
: a.True;
}
function S(e, r) {
return o.TUnknown(e)
? a.False
: o.TAny(e)
? a.Union
: o.TNever(e) ||
(o.TLiteralString(e) && y(r)) ||
(o.TLiteralNumber(e) && v(r)) ||
(o.TLiteralBoolean(e) && b(r)) ||
(o.TSymbol(e) && _(r)) ||
(o.TBigInt(e) && m(r, 0)) ||
(o.TString(e) && y(r)) ||
(o.TSymbol(e) && _(r)) ||
(o.TNumber(e) && v(r)) ||
(o.TInteger(e) && v(r)) ||
(o.TBoolean(e) && b(r)) ||
(o.TUint8Array(e) && E(r)) ||
(o.TDate(e) &&
(function (e) {
return m(e, 0);
})(r)) ||
(o.TConstructor(e) &&
(function (e) {
return m(e, 0);
})(r)) ||
(o.TFunction(e) &&
(function (e) {
const r = t.Type.Number();
return (
m(e, 0) ||
(m(e, 1) &&
"length" in e.properties &&
n(k(e.properties.length, r)) === a.True)
);
})(r))
? a.True
: o.TRecord(e) && o.TString(T(e))
? "Record" === r[t.Hint]
? a.True
: a.False
: o.TRecord(e) && o.TNumber(T(e)) && m(r, 0)
? a.True
: a.False;
}
function T(e) {
if (t.PatternNumberExact in e.patternProperties)
return t.Type.Number();
if (t.PatternStringExact in e.patternProperties)
return t.Type.String();
throw Error("TypeExtends: Cannot get record key");
}
function x(e) {
if (t.PatternNumberExact in e.patternProperties)
return e.patternProperties[t.PatternNumberExact];
if (t.PatternStringExact in e.patternProperties)
return e.patternProperties[t.PatternStringExact];
throw Error("TypeExtends: Cannot get record value");
}
function C(e, t) {
const r = T(t),
i = x(t);
if (o.TLiteralString(e) && o.TNumber(r) && n(k(e, i)) === a.True)
return a.True;
if (o.TUint8Array(e) && o.TNumber(r)) return k(e, i);
if (o.TString(e) && o.TNumber(r)) return k(e, i);
if (o.TArray(e) && o.TNumber(r)) return k(e, i);
if (o.TObject(e)) {
for (const t of Object.getOwnPropertyNames(e.properties))
if (w(i, e.properties[t]) === a.False) return a.False;
return a.True;
}
return a.False;
}
function I(e, t) {
return (o.TLiteral(e) && i.IsString(e.const)) || o.TString(e)
? a.True
: a.False;
}
function A(e, t) {
return t.anyOf.some((t) => k(e, t) === a.True) ? a.True : a.False;
}
function P(e, t) {
return a.True;
}
function k(e, y) {
if (o.TTemplateLiteral(e) || o.TTemplateLiteral(y))
return (function (e, t) {
if (o.TTemplateLiteral(e)) return k(g.Resolve(e), t);
if (o.TTemplateLiteral(t)) return k(e, g.Resolve(t));
throw new Error(
"TypeExtends: Invalid fallthrough for TemplateLiteral",
);
})(e, y);
if (o.TNot(e) || o.TNot(y))
return (function (e, t) {
if (o.TNot(e)) return k(h(e), t);
if (o.TNot(t)) return k(e, h(t));
throw new Error("TypeExtends: Invalid fallthrough for Not");
})(e, y);
if (o.TAny(e))
return (function (e, t) {
return o.TIntersect(t)
? p(e, t)
: o.TUnion(t) &&
t.anyOf.some((e) => o.TAny(e) || o.TUnknown(e))
? a.True
: o.TUnion(t)
? a.Union
: o.TUnknown(t) || o.TAny(t)
? a.True
: a.Union;
})(e, y);
if (o.TArray(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t) && E(t)
? a.True
: o.TArray(t)
? n(k(e.items, t.items))
: a.False;
})(e, y);
if (o.TBigInt(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TBigInt(t)
? a.True
: a.False;
})(e, y);
if (o.TBoolean(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TBoolean(t)
? a.True
: a.False;
})(e, y);
if (o.TAsyncIterator(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TAsyncIterator(t)
? n(k(e.items, t.items))
: a.False;
})(e, y);
if (o.TConstructor(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TConstructor(t)
? e.parameters.length > t.parameters.length
? a.False
: e.parameters.every(
(e, r) => n(k(t.parameters[r], e)) === a.True,
)
? n(k(e.returns, t.returns))
: a.False
: a.False;
})(e, y);
if (o.TDate(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TDate(t)
? a.True
: a.False;
})(e, y);
if (o.TFunction(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TFunction(t)
? e.parameters.length > t.parameters.length
? a.False
: e.parameters.every(
(e, r) => n(k(t.parameters[r], e)) === a.True,
)
? n(k(e.returns, t.returns))
: a.False
: a.False;
})(e, y);
if (o.TInteger(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TInteger(t) || o.TNumber(t)
? a.True
: a.False;
})(e, y);
if (o.TIntersect(e))
return (function (e, t) {
return e.allOf.some((e) => k(e, t) === a.True)
? a.True
: a.False;
})(e, y);
if (o.TIterator(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TIterator(t)
? n(k(e.items, t.items))
: a.False;
})(e, y);
if (o.TLiteral(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TString(t)
? I(e)
: o.TNumber(t)
? f(e)
: o.TInteger(t)
? u(e)
: o.TBoolean(t)
? l(e)
: o.TLiteral(t) && t.const === e.const
? a.True
: a.False;
})(e, y);
if (o.TNever(e)) return a.True;
if (o.TNull(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TNull(t)
? a.True
: a.False;
})(e, y);
if (o.TNumber(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TInteger(t) || o.TNumber(t)
? a.True
: a.False;
})(e, y);
if (o.TObject(e))
return (function (e, t) {
if (r(t)) return s(e, t);
if (o.TRecord(t)) return C(e, t);
if (!o.TObject(t)) return a.False;
for (const n of Object.getOwnPropertyNames(t.properties)) {
if (!(n in e.properties)) return a.False;
if (w(e.properties[n], t.properties[n]) === a.False)
return a.False;
}
return a.True;
})(e, y);
if (o.TRecord(e))
return (function (e, t) {
const n = x(e);
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? k(n, x(t))
: a.False;
})(e, y);
if (o.TString(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TString(t)
? a.True
: a.False;
})(e, y);
if (o.TSymbol(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TSymbol(t)
? a.True
: a.False;
})(e, y);
if (o.TTuple(e))
return (function (e, t) {
return r(t)
? s(e, t)
: (o.TObject(t) && E(t)) ||
(o.TArray(t) &&
(function (e, t) {
return (
o.TArray(t) &&
void 0 !== e.items &&
e.items.every((e) => k(e, t.items) === a.True)
);
})(e, t))
? a.True
: o.TTuple(t)
? (i.IsUndefined(e.items) && !i.IsUndefined(t.items)) ||
(!i.IsUndefined(e.items) && i.IsUndefined(t.items))
? a.False
: (i.IsUndefined(e.items) && !i.IsUndefined(t.items)) ||
e.items.every((e, n) => k(e, t.items[n]) === a.True)
? a.True
: a.False
: a.False;
})(e, y);
if (o.TPromise(e))
return (function (e, i) {
return r(i)
? s(e, i)
: o.TObject(i) &&
(function (e) {
const r = t.Type.Function([t.Type.Any()], t.Type.Any());
return (
m(e, 0) ||
(m(e, 1) &&
"then" in e.properties &&
n(k(e.properties.then, r)) === a.True)
);
})(i)
? a.True
: o.TPromise(i)
? n(k(e.item, i.item))
: a.False;
})(e, y);
if (o.TUint8Array(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TUint8Array(t)
? a.True
: a.False;
})(e, y);
if (o.TUndefined(e))
return (function (e, t) {
return r(t)
? s(e, t)
: o.TObject(t)
? S(e, t)
: o.TRecord(t)
? C(e, t)
: o.TVoid(t)
? (function (e, t) {
return o.TUndefined(e) || o.TUndefined(e)
? a.True
: a.False;
})(e)
: o.TUndefined(t)
? a.True
: a.False;
})(e, y);
if (o.TUnion(e))
return (function (e, t) {
return e.anyOf.every((e) => k(e, t) === a.True)
? a.True
: a.False;
})(e, y);
if (o.TUnknown(e))
return (function (e, t) {
return o.TNever(t)
? d()
: o.TIntersect(t)
? p(e, t)
: o.TUnion(t)
? A(e, t)
: o.TAny(t)
? c()
: o.TString(t)
? I(e)
: o.TNumber(t)
? f(e)
: o.TInteger(t)
? u(e)
: o.TBoolean(t)
? l(e)
: o.TArray(t)
? (function (e, t) {
return o.TUnknown(e)
? a.False
: o.TAny(e)
? a.Union
: o.TNever(e)
? a.True
: a.False;
})(e)
: o.TTuple(t)
? (function (e, t) {
return o.TNever(e)
? a.True
: o.TUnknown(e)
? a.False
: o.TAny(e)
? a.Union
: a.False;
})(e)
: o.TObject(t)
? S(e, t)
: o.TUnknown(t)
? a.True
: a.False;
})(e, y);
if (o.TVoid(e))
return (function (e, t) {
return o.TIntersect(t)
? p(e, t)
: o.TUnion(t)
? A(e, t)
: o.TUnknown(t)
? P()
: o.TAny(t)
? c()
: o.TObject(t)
? S(e, t)
: o.TVoid(t)
? a.True
: a.False;
})(e, y);
throw Error(
`TypeExtends: Unknown left type operand '${e[t.Kind]}'`,
);
}
e.Extends = function (e, t) {
return k(e, t);
};
})(c || (t.TypeExtends = c = {})),
(function (e) {
function t(e) {
return i.IsArray(e)
? (function (e) {
return e.map((e) => t(e));
})(e)
: i.IsObject(e)
? (function (e) {
return {
...Object.getOwnPropertyNames(e).reduce(
(n, r) => ({ ...n, [r]: t(e[r]) }),
{},
),
...Object.getOwnPropertySymbols(e).reduce(
(n, r) => ({ ...n, [r]: t(e[r]) }),
{},
),
};
})(e)
: e;
}
e.Clone = function (e, n = {}) {
return { ...t(e), ...n };
};
})(l || (t.TypeClone = l = {})),
(function (e) {
function n(e) {
return e.map((e) => {
const { [t.Optional]: n, ...r } = l.Clone(e);
return r;
});
}
function r(e) {
return "Intersect" === e[t.Kind]
? (function (e) {
const r = (function (e) {
return e.every((e) => o.TOptional(e));
})(e.allOf);
return r
? t.Type.Optional(t.Type.Intersect(n(e.allOf)))
: e;
})(e)
: "Union" === e[t.Kind]
? (function (e) {
const r = (function (e) {
return e.some((e) => o.TOptional(e));
})(e.anyOf);
return r ? t.Type.Optional(t.Type.Union(n(e.anyOf))) : e;
})(e)
: e;
}
function s(e, n) {
return "Intersect" === e[t.Kind]
? (function (e, n) {
const i = e.allOf.reduce((e, r) => {
const i = s(r, n);
return "Never" === i[t.Kind] ? e : [...e, i];
}, []);
return r(t.Type.Intersect(i));
})(e, n)
: "Union" === e[t.Kind]
? (function (e, n) {
const i = e.anyOf.map((e) => s(e, n));
return r(t.Type.Union(i));
})(e, n)
: "Object" === e[t.Kind]
? (function (e, n) {
const r = e.properties[n];
return i.IsUndefined(r)
? t.Type.Never()
: t.Type.Union([r]);
})(e, n)
: "Tuple" === e[t.Kind]
? (function (e, n) {
const r = e.items;
if (i.IsUndefined(r)) return t.Type.Never();
const o = r[n];
return i.IsUndefined(o) ? t.Type.Never() : o;
})(e, n)
: t.Type.Never();
}
e.Resolve = function (e, n, i = {}) {
const o = n.map((t) => s(e, t.toString()));
return r(t.Type.Union(o, i));
};
})(u || (t.IndexedAccessor = u = {})),
(function (e) {
function n(e, r) {
return "Intersect" === e[t.Kind]
? (function (e, r) {
return t.Type.Intersect(
e.allOf.map((e) => n(e, r)),
{ ...e },
);
})(e, r)
: "Union" === e[t.Kind]
? (function (e, r) {
return t.Type.Union(
e.anyOf.map((e) => n(e, r)),
{ ...e },
);
})(e, r)
: "Object" === e[t.Kind]
? (function (e, t) {
return t(e);
})(e, r)
: e;
}
e.Map = function (e, t, r) {
return { ...n(l.Clone(e), t), ...r };
};
})(p || (t.ObjectMap = p = {})),
(function (e) {
function t(e, n) {
return o.TIntersect(e)
? (function (e, n) {
return e.allOf.reduce((e, r) => [...e, ...t(r, n)], []);
})(e, n)
: o.TUnion(e)
? (function (e, n) {
const r = e.anyOf.map((e) => t(e, n));
return [
...r.reduce(
(e, t) =>
t.map((t) =>
r.every((e) => e.includes(t)) ? e.add(t) : e,
)[0],
new Set(),
),
];
})(e, n)
: o.TObject(e)
? (function (e, t) {
return Object.getOwnPropertyNames(e.properties);
})(e)
: o.TRecord(e)
? (function (e, t) {
return t.includePatterns
? Object.getOwnPropertyNames(e.patternProperties)
: [];
})(e, n)
: [];
}
function n(e, n) {
return [...new Set(t(e, n))];
}
(e.ResolveKeys = n),
(e.ResolvePattern = function (e) {
return `^(${n(e, { includePatterns: !0 })
.map(
(e) =>
`(${(function (e) {
return "^" === e[0] && "$" === e[e.length - 1]
? e.slice(1, e.length - 1)
: e;
})(e)})`,
)
.join("|")})$`;
});
})(d || (t.KeyResolver = d = {})),
(function (e) {
e.Resolve = function (e) {
if (Array.isArray(e)) return e;
if (o.TUnionLiteral(e))
return e.anyOf.map((e) => e.const.toString());
if (o.TLiteral(e)) return [e.const];
if (o.TTemplateLiteral(e)) {
const t = y.ParseExact(e.pattern);
if (!_.Check(t))
throw Error(
"KeyArrayResolver: Cannot resolve keys from infinite template expression",
);
return [...v.Generate(t)];
}
return [];
};
})(h || (t.KeyArrayResolver = h = {})),
(function (e) {
function* n(e) {
for (const r of e.anyOf)
"Union" === r[t.Kind] ? yield* n(r) : yield r;
}
e.Resolve = function (e) {
return t.Type.Union([...n(e)], { ...e });
};
})(f || (t.UnionResolver = f = {})),
(function (e) {
function n(e, r) {
if (o.TTemplateLiteral(e))
return e.pattern.slice(1, e.pattern.length - 1);
if (o.TUnion(e))
return `(${e.anyOf.map((e) => n(e, r)).join("|")})`;
if (o.TNumber(e)) return `${r}${t.PatternNumber}`;
if (o.TInteger(e)) return `${r}${t.PatternNumber}`;
if (o.TBigInt(e)) return `${r}${t.PatternNumber}`;
if (o.TString(e)) return `${r}${t.PatternString}`;
if (o.TLiteral(e))
return `${r}${
((i = e.const.toString()),
i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
}`;
if (o.TBoolean(e)) return `${r}${t.PatternBoolean}`;
throw o.TNever(e)
? Error(
"TemplateLiteralPattern: TemplateLiteral cannot operate on types of TNever",
)
: Error(
`TemplateLiteralPattern: Unexpected Kind '${e[t.Kind]}'`,
);
var i;
}
e.Create = function (e) {
return `^${e.map((e) => n(e, "")).join("")}$`;
};
})(m || (t.TemplateLiteralPattern = m = {})),
(function (e) {
e.Resolve = function (e) {
const n = y.ParseExact(e.pattern);
if (!_.Check(n)) return t.Type.String();
const r = [...v.Generate(n)].map((e) => t.Type.Literal(e));
return t.Type.Union(r);
};
})(g || (t.TemplateLiteralResolver = g = {}));
class w extends Error {
constructor(e) {
super(e);
}
}
(t.TemplateLiteralParserError = w),
(function (e) {
function t(e, t, n) {
return e[t] === n && 92 !== e.charCodeAt(t - 1);
}
function n(e, n) {
return t(e, n, "(");
}
function r(e, n) {
return t(e, n, ")");
}
function i(e, n) {
return t(e, n, "|");
}
function o(e) {
return (function (e) {
if (!n(e, 0) || !r(e, e.length - 1)) return !1;
let t = 0;
for (let i = 0; i < e.length; i++)
if (
(n(e, i) && (t += 1),
r(e, i) && (t -= 1),
0 === t && i !== e.length - 1)
)
return !1;
return !0;
})(e)
? o(
(function (e) {
return e.slice(1, e.length - 1);
})(e),
)
: (function (e) {
let t = 0;
for (let o = 0; o < e.length; o++)
if (
(n(e, o) && (t += 1),
r(e, o) && (t -= 1),
i(e, o) && 0 === t)
)
return !0;
return !1;
})(e)
? (function (e) {
let [t, s] = [0, 0];
const a = [];
for (let c = 0; c < e.length; c++)
if (
(n(e, c) && (t += 1),
r(e, c) && (t -= 1),
i(e, c) && 0 === t)
) {
const t = e.slice(s, c);
t.length > 0 && a.push(o(t)), (s = c + 1);
}
const c = e.slice(s);
return (
c.length > 0 && a.push(o(c)),
0 === a.length
? { type: "const", const: "" }
: 1 === a.length
? a[0]
: { type: "or", expr: a }
);
})(e)
: (function (e) {
for (let t = 0; t < e.length; t++) if (n(e, t)) return !0;
return !1;
})(e)
? (function (e) {
function t(e, t) {
if (!n(e, t))
throw new w(
"TemplateLiteralParser: Index must point to open parens",
);
let i = 0;
for (let o = t; o < e.length; o++)
if ((n(e, o) && (i += 1), r(e, o) && (i -= 1), 0 === i))
return [t, o];
throw new w(
"TemplateLiteralParser: Unclosed group parens in expression",
);
}
function i(e, t) {
for (let r = t; r < e.length; r++)
if (n(e, r)) return [t, r];
return [t, e.length];
}
const s = [];
for (let r = 0; r < e.length; r++)
if (n(e, r)) {
const [n, i] = t(e, r),
a = e.slice(n, i + 1);
s.push(o(a)), (r = i);
} else {
const [t, n] = i(e, r),
a = e.slice(t, n);
a.length > 0 && s.push(o(a)), (r = n - 1);
}
return 0 === s.length
? { type: "const", const: "" }
: 1 === s.length
? s[0]
: { type: "and", expr: s };
})(e)
: { type: "const", const: e };
}
(e.Parse = o),
(e.ParseExact = function (e) {
return o(e.slice(1, e.length - 1));
});
})(y || (t.TemplateLiteralParser = y = {})),
(function (e) {
e.Check = function e(t) {
if (
(function (e) {
return (
"or" === e.type &&
2 === e.expr.length &&
"const" === e.expr[0].type &&
"true" === e.expr[0].const &&
"const" === e.expr[1].type &&
"false" === e.expr[1].const
);
})(t)
)
return !0;
if (
(function (e) {
return (
"or" === e.type &&
2 === e.expr.length &&
"const" === e.expr[0].type &&
"0" === e.expr[0].const &&
"const" === e.expr[1].type &&
"[1-9][0-9]*" === e.expr[1].const
);
})(t) ||
(function (e) {
return "const" === e.type && ".*" === e.const;
})(t)
)
return !1;
if ("and" === t.type) return t.expr.every((t) => e(t));
if ("or" === t.type) return t.expr.every((t) => e(t));
if ("const" === t.type) return !0;
throw Error("TemplateLiteralFinite: Unknown expression type");
};
})(_ || (t.TemplateLiteralFinite = _ = {})),
(function (e) {
function* t(e) {
if (1 === e.length) return yield* e[0];
for (const n of e[0])
for (const r of t(e.slice(1))) yield `${n}${r}`;
}
function* n(e) {
return yield* t(e.expr.map((e) => [...r(e)]));
}
function* r(e) {
if ("and" === e.type) return yield* n(e);
if ("or" === e.type)
return yield* (function* (e) {
for (const t of e.expr) yield* r(t);
})(e);
if ("const" === e.type)
return yield* (function* (e) {
return yield e.const;
})(e);
throw Error("TemplateLiteralGenerator: Unknown expression");
}
e.Generate = r;
})(v || (t.TemplateLiteralGenerator = v = {})),
(function (e) {
function* n(e) {
const n = e.trim().replace(/"|'/g, "");
if ("boolean" === n) return yield t.Type.Boolean();
if ("number" === n) return yield t.Type.Number();
if ("bigint" === n) return yield t.Type.BigInt();
if ("string" === n) return yield t.Type.String();
const r = n.split("|").map((e) => t.Type.Literal(e.trim()));
return yield 0 === r.length
? t.Type.Never()
: 1 === r.length
? r[0]
: t.Type.Union(r);
}
function* r(e) {
if ("{" !== e[1]) {
const n = t.Type.Literal("$"),
r = i(e.slice(1));
return yield* [n, ...r];
}
for (let t = 2; t < e.length; t++)
if ("}" === e[t]) {
const r = n(e.slice(2, t)),
o = i(e.slice(t + 1));
return yield* [...r, ...o];
}
yield t.Type.Literal(e);
}
function* i(e) {
for (let n = 0; n < e.length; n++)
if ("$" === e[n]) {
const i = t.Type.Literal(e.slice(0, n)),
o = r(e.slice(n));
return yield* [i, ...o];
}
yield t.Type.Literal(e);
}
e.Parse = function (e) {
return [...i(e)];
};
})(b || (t.TemplateLiteralDslParser = b = {}));
let S = 0;
class T {
Create(e) {
return e;
}
Discard(e, t) {
const { [t]: n, ...r } = e;
return r;
}
Strict(e) {
return JSON.parse(JSON.stringify(e));
}
}
t.TypeBuilder = T;
class x extends T {
ReadonlyOptional(e) {
return this.Readonly(this.Optional(e));
}
Readonly(e) {
return { ...l.Clone(e), [t.Readonly]: "Readonly" };
}
Optional(e) {
return { ...l.Clone(e), [t.Optional]: "Optional" };
}
Any(e = {}) {
return this.Create({ ...e, [t.Kind]: "Any" });
}
Array(e, n = {}) {
return this.Create({
...n,
[t.Kind]: "Array",
type: "array",
items: l.Clone(e),
});
}
Boolean(e = {}) {
return this.Create({ ...e, [t.Kind]: "Boolean", type: "boolean" });
}
Capitalize(e, n = {}) {
const [r, i] = [e.const.slice(0, 1), e.const.slice(1)];
return t.Type.Literal(`${r.toUpperCase()}${i}`, n);
}
Composite(e, n) {
const r = t.Type.Intersect(e, {}),
i = d
.ResolveKeys(r, { includePatterns: !1 })
.reduce((e, n) => ({ ...e, [n]: t.Type.Index(r, [n]) }), {});
return t.Type.Object(i, n);
}
Enum(e, n = {}) {
const r = Object.getOwnPropertyNames(e)
.filter((e) => isNaN(e))
.map((t) => e[t])
.map((e) =>
i.IsString(e)
? { [t.Kind]: "Literal", type: "string", const: e }
: { [t.Kind]: "Literal", type: "number", const: e },
);
return this.Create({ ...n, [t.Kind]: "Union", anyOf: r });
}
Extends(e, t, n, r, i = {}) {
switch (c.Extends(e, t)) {
case a.Union:
return this.Union([l.Clone(n, i), l.Clone(r, i)]);
case a.True:
return l.Clone(n, i);
case a.False:
return l.Clone(r, i);
}
}
Exclude(e, t, n = {}) {
if (o.TTemplateLiteral(e)) return this.Exclude(g.Resolve(e), t, n);
if (o.TTemplateLiteral(t)) return this.Exclude(e, g.Resolve(t), n);
if (o.TUnion(e)) {
const r = e.anyOf.filter((e) => c.Extends(e, t) === a.False);
return 1 === r.length ? l.Clone(r[0], n) : this.Union(r, n);
}
return c.Extends(e, t) !== a.False ? this.Never(n) : l.Clone(e, n);
}
Extract(e, t, n = {}) {
if (o.TTemplateLiteral(e)) return this.Extract(g.Resolve(e), t, n);
if (o.TTemplateLiteral(t)) return this.Extract(e, g.Resolve(t), n);
if (o.TUnion(e)) {
const r = e.anyOf.filter((e) => c.Extends(e, t) !== a.False);
return 1 === r.length ? l.Clone(r[0], n) : this.Union(r, n);
}
return c.Extends(e, t) !== a.False ? l.Clone(e, n) : this.Never(n);
}
Index(e, t, n = {}) {
if (o.TArray(e) && o.TNumber(t)) return l.Clone(e.items, n);
if (o.TTuple(e) && o.TNumber(t)) {
const t = (i.IsUndefined(e.items) ? [] : e.items).map((e) =>
l.Clone(e),
);
return this.Union(t, n);
}
{
const r = h.Resolve(t),
i = l.Clone(e);
return u.Resolve(i, r, n);
}
}
Integer(e = {}) {
return this.Create({ ...e, [t.Kind]: "Integer", type: "integer" });
}
Intersect(e, n = {}) {
if (0 === e.length) return t.Type.Never();
if (1 === e.length) return l.Clone(e[0], n);
const r = e.every((e) => o.TObject(e)),
i = e.map((e) => l.Clone(e)),
s = o.TSchema(n.unevaluatedProperties)
? { unevaluatedProperties: l.Clone(n.unevaluatedProperties) }
: {};
return !1 === n.unevaluatedProperties ||
o.TSchema(n.unevaluatedProperties) ||
r
? this.Create({
...n,
...s,
[t.Kind]: "Intersect",
type: "object",
allOf: i,
})
: this.Create({ ...n, ...s, [t.Kind]: "Intersect", allOf: i });
}
KeyOf(e, n = {}) {
if (o.TRecord(e)) {
const r = Object.getOwnPropertyNames(e.patternProperties)[0];
if (r === t.PatternNumberExact) return this.Number(n);
if (r === t.PatternStringExact) return this.String(n);
throw Error(
"StandardTypeBuilder: Unable to resolve key type from Record key pattern",
);
}
if (o.TTuple(e)) {
const r = (i.IsUndefined(e.items) ? [] : e.items).map((e, n) =>
t.Type.Literal(n),
);
return this.Union(r, n);
}
if (o.TArray(e)) return this.Number(n);
{
const t = d.ResolveKeys(e, { includePatterns: !1 });
if (0 === t.length) return this.Never(n);
const r = t.map((e) => this.Literal(e));
return this.Union(r, n);
}
}
Literal(e, n = {}) {
return this.Create({
...n,
[t.Kind]: "Literal",
const: e,
type: typeof e,
});
}
Lowercase(e, n = {}) {
return t.Type.Literal(e.const.toLowerCase(), n);
}
Never(e = {}) {
return this.Create({ ...e, [t.Kind]: "Never", not: {} });
}
Not(e, n) {
return this.Create({ ...n, [t.Kind]: "Not", not: l.Clone(e) });
}
Null(e = {}) {
return this.Create({ ...e, [t.Kind]: "Null", type: "null" });
}
Number(e = {}) {
return this.Create({ ...e, [t.Kind]: "Number", type: "number" });
}
Object(e, n = {}) {
const r = Object.getOwnPropertyNames(e),
i = r.filter((t) => o.TOptional(e[t])),
s = r.filter((e) => !i.includes(e)),
a = o.TSchema(n.additionalProperties)
? { additionalProperties: l.Clone(n.additionalProperties) }
: {},
c = r.reduce((t, n) => ({ ...t, [n]: l.Clone(e[n]) }), {});
return s.length > 0
? this.Create({
...n,
...a,
[t.Kind]: "Object",
type: "object",
properties: c,
required: s,
})
: this.Create({
...n,
...a,
[t.Kind]: "Object",
type: "object",
properties: c,
});
}
Omit(e, t, n = {}) {
const r = h.Resolve(t);
return p.Map(
l.Clone(e),
(e) => {
i.IsArray(e.required) &&
((e.required = e.required.filter((e) => !r.includes(e))),
0 === e.required.length && delete e.required);
for (const t of Object.getOwnPropertyNames(e.properties))
r.includes(t) && delete e.properties[t];
return this.Create(e);
},
n,
);
}
Partial(e, t = {}) {
return p.Map(
e,
(e) => {
const t = Object.getOwnPropertyNames(e.properties).reduce(
(t, n) => ({ ...t, [n]: this.Optional(e.properties[n]) }),
{},
);
return this.Object(t, this.Discard(e, "required"));
},
t,
);
}
Pick(e, t, n = {}) {
const r = h.Resolve(t);
return p.Map(
l.Clone(e),
(e) => {
i.IsArray(e.required) &&
((e.required = e.required.filter((e) => r.includes(e))),
0 === e.required.length && delete e.required);
for (const t of Object.getOwnPropertyNames(e.properties))
r.includes(t) || delete e.properties[t];
return this.Create(e);
},
n,
);
}
Record(e, n, r = {}) {
if (o.TTemplateLiteral(e)) {
const i = y.ParseExact(e.pattern);
return _.Check(i)
? this.Object(
[...v.Generate(i)].reduce(
(e, t) => ({ ...e, [t]: l.Clone(n) }),
{},
),
r,
)
: this.Create({
...r,
[t.Kind]: "Record",
type: "object",
patternProperties: { [e.pattern]: l.Clone(n) },
});
}
if (o.TUnion(e)) {
const i = f.Resolve(e);
if (o.TUnionLiteral(i)) {
const e = i.anyOf.reduce(
(e, t) => ({ ...e, [t.const]: l.Clone(n) }),
{},
);
return this.Object(e, { ...r, [t.Hint]: "Record" });
}
throw Error(
"StandardTypeBuilder: Record key of type union contains non-literal types",
);
}
if (o.TLiteral(e)) {
if (i.IsString(e.const) || i.IsNumber(e.const))
return this.Object({ [e.const]: l.Clone(n) }, r);
throw Error(
"StandardTypeBuilder: Record key of type literal is not of type string or number",
);
}
if (o.TInteger(e) || o.TNumber(e))
return this.Create({
...r,
[t.Kind]: "Record",
type: "object",
patternProperties: { [t.PatternNumberExact]: l.Clone(n) },
});
if (o.TString(e)) {
const o = i.IsUndefined(e.pattern)
? t.PatternStringExact
: e.pattern;
return this.Create({
...r,
[t.Kind]: "Record",
type: "object",
patternProperties: { [o]: l.Clone(n) },
});
}
throw Error("StandardTypeBuilder: Record key is an invalid type");
}
Recursive(e, n = {}) {
i.IsUndefined(n.$id) && (n.$id = "T" + S++);
const r = e({ [t.Kind]: "This", $ref: `${n.$id}` });
return (
(r.$id = n.$id),
this.Create({ ...n, [t.Hint]: "Recursive", ...r })
);
}
Ref(e, n = {}) {
if (i.IsString(e))
return this.Create({ ...n, [t.Kind]: "Ref", $ref: e });
if (i.IsUndefined(e.$id))
throw Error(
"StandardTypeBuilder.Ref: Target type must specify an $id",
);
return this.Create({ ...n, [t.Kind]: "Ref", $ref: e.$id });
}
Required(e, n = {}) {
return p.Map(
e,
(e) => {
const n = Object.getOwnPropertyNames(e.properties).reduce(
(n, r) => ({
...n,
[r]: this.Discard(e.properties[r], t.Optional),
}),
{},
);
return this.Object(n, e);
},
n,
);
}
Rest(e) {
return o.TTuple(e)
? i.IsUndefined(e.items)
? []
: e.items.map((e) => l.Clone(e))
: [l.Clone(e)];
}
String(e = {}) {
return this.Create({ ...e, [t.Kind]: "String", type: "string" });
}
TemplateLiteral(e, n = {}) {
const r = i.IsString(e) ? m.Create(b.Parse(e)) : m.Create(e);
return this.Create({
...n,
[t.Kind]: "TemplateLiteral",
type: "string",
pattern: r,
});
}
Tuple(e, n = {}) {
const [r, i, o] = [!1, e.length, e.length],
s = e.map((e) => l.Clone(e)),
a =
e.length > 0
? {
...n,
[t.Kind]: "Tuple",
type: "array",
items: s,
additionalItems: r,
minItems: i,
maxItems: o,
}
: {
...n,
[t.Kind]: "Tuple",
type: "array",
minItems: i,
maxItems: o,
};
return this.Create(a);
}
Uncapitalize(e, n = {}) {
const [r, i] = [e.const.slice(0, 1), e.const.slice(1)];
return t.Type.Literal(`${r.toLocaleLowerCase()}${i}`, n);
}
Union(e, n = {}) {
if (o.TTemplateLiteral(e)) return g.Resolve(e);
{
const r = e;
if (0 === r.length) return this.Never(n);
if (1 === r.length) return this.Create(l.Clone(r[0], n));
const i = r.map((e) => l.Clone(e));
return this.Create({ ...n, [t.Kind]: "Union", anyOf: i });
}
}
Unknown(e = {}) {
return this.Create({ ...e, [t.Kind]: "Unknown" });
}
Unsafe(e = {}) {
return this.Create({ ...e, [t.Kind]: e[t.Kind] || "Unsafe" });
}
Uppercase(e, n = {}) {
return t.Type.Literal(e.const.toUpperCase(), n);
}
}
t.StandardTypeBuilder = x;
class C extends x {
AsyncIterator(e, n = {}) {
return this.Create({
...n,
[t.Kind]: "AsyncIterator",
type: "AsyncIterator",
items: l.Clone(e),
});
}
Awaited(e, n = {}) {
const r = (e) => {
if (0 === e.length) return e;
const [t, ...n] = e;
return [this.Awaited(t), ...r(n)];
};
return o.TIntersect(e)
? t.Type.Intersect(r(e.allOf))
: o.TUnion(e)
? t.Type.Union(r(e.anyOf))
: o.TPromise(e)
? this.Awaited(e.item)
: l.Clone(e, n);
}
BigInt(e = {}) {
return this.Create({ ...e, [t.Kind]: "BigInt", type: "bigint" });
}
ConstructorParameters(e, t = {}) {
return this.Tuple([...e.parameters], { ...t });
}
Constructor(e, n, r) {
const i = l.Clone(n),
o = e.map((e) => l.Clone(e));
return this.Create({
...r,
[t.Kind]: "Constructor",
type: "constructor",
parameters: o,
returns: i,
});
}
Date(e = {}) {
return this.Create({ ...e, [t.Kind]: "Date", type: "Date" });
}
Function(e, n, r) {
const i = l.Clone(n, {}),
o = e.map((e) => l.Clone(e));
return this.Create({
...r,
[t.Kind]: "Function",
type: "function",
parameters: o,
returns: i,
});
}
InstanceType(e, t = {}) {
return l.Clone(e.returns, t);
}
Iterator(e, n = {}) {
return this.Create({
...n,
[t.Kind]: "Iterator",
type: "Iterator",
items: l.Clone(e),
});
}
Parameters(e, t = {}) {
return this.Tuple(e.parameters, { ...t });
}
Promise(e, n = {}) {
return this.Create({
...n,
[t.Kind]: "Promise",
type: "Promise",
item: l.Clone(e),
});
}
RegExp(e, n = {}) {
const r = i.IsString(e) ? e : e.source;
return this.Create({
...n,
[t.Kind]: "String",
type: "string",
pattern: r,
});
}
RegEx(e, t = {}) {
return this.RegExp(e, t);
}
ReturnType(e, t = {}) {
return l.Clone(e.returns, t);
}
Symbol(e) {
return this.Create({ ...e, [t.Kind]: "Symbol", type: "symbol" });
}
Undefined(e = {}) {
return this.Create({
...e,
[t.Kind]: "Undefined",
type: "undefined",
});
}
Uint8Array(e = {}) {
return this.Create({
...e,
[t.Kind]: "Uint8Array",
type: "Uint8Array",
});
}
Void(e = {}) {
return this.Create({ ...e, [t.Kind]: "Void", type: "void" });
}
}
(t.ExtendedTypeBuilder = C),
(t.StandardType = new x()),
(t.Type = new C());
},
30728: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Cast =
t.ValueCastDereferenceError =
t.ValueCastUnknownTypeError =
t.ValueCastRecursiveTypeError =
t.ValueCastNeverTypeError =
t.ValueCastArrayUniqueItemsTypeError =
t.ValueCastReferenceTypeError =
void 0);
const r = n(14350),
i = n(8851),
o = n(4291),
s = n(95245),
a = n(37657);
class c extends Error {
constructor(e) {
super(
`ValueCast: Cannot locate referenced schema with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
t.ValueCastReferenceTypeError = c;
class l extends Error {
constructor(e, t) {
super(
"ValueCast: Array cast produced invalid data due to uniqueItems constraint",
),
(this.schema = e),
(this.value = t);
}
}
t.ValueCastArrayUniqueItemsTypeError = l;
class u extends Error {
constructor(e) {
super("ValueCast: Never types cannot be cast"), (this.schema = e);
}
}
t.ValueCastNeverTypeError = u;
class p extends Error {
constructor(e) {
super("ValueCast.Recursive: Cannot cast recursive schemas"),
(this.schema = e);
}
}
t.ValueCastRecursiveTypeError = p;
class d extends Error {
constructor(e) {
super("ValueCast: Unknown type"), (this.schema = e);
}
}
t.ValueCastUnknownTypeError = d;
class h extends Error {
constructor(e) {
super(`ValueCast: Unable to dereference type with $id '${e.$ref}'`),
(this.schema = e);
}
}
var f;
function m(e, t, n) {
const c = a.IsString(e.$id) ? [...t, e] : t,
p = e;
switch (e[r.Kind]) {
case "Any":
case "Date":
case "Symbol":
case "TemplateLiteral":
case "Undefined":
case "Uint8Array":
case "Unknown":
case "Void":
return (function (e, t, n) {
return o.Check(e, t, n) ? s.Clone(n) : i.Create(e, t);
})(p, c, n);
case "Array":
return (function (e, t, n) {
if (o.Check(e, t, n)) return s.Clone(n);
const r = a.IsArray(n) ? s.Clone(n) : i.Create(e, t),
c =
a.IsNumber(e.minItems) && r.length < e.minItems
? [
...r,
...Array.from(
{ length: e.minItems - r.length },
() => null,
),
]
: r,
u = (
a.IsNumber(e.maxItems) && c.length > e.maxItems
? c.slice(0, e.maxItems)
: c
).map((n) => m(e.items, t, n));
if (!0 !== e.uniqueItems) return u;
const p = [...new Set(u)];
if (!o.Check(e, t, p)) throw new l(e, p);
return p;
})(p, c, n);
case "AsyncIterator":
case "BigInt":
case "Boolean":
case "Function":
case "Integer":
case "Iterator":
case "Literal":
case "Not":
case "Null":
case "Number":
case "Promise":
case "String":
return (function (e, t, n) {
return o.Check(e, t, n) ? n : i.Create(e, t);
})(p, c, n);
case "Constructor":
return (function (e, t, n) {
if (o.Check(e, t, n)) return i.Create(e, t);
const r = new Set(e.returns.required || []),
s = function () {};
for (const [i, o] of Object.entries(e.returns.properties))
(r.has(i) || void 0 !== n.prototype[i]) &&
(s.prototype[i] = m(o, t, n.prototype[i]));
return s;
})(p, c, n);
case "Intersect":
return (function (e, t, n) {
const r = i.Create(e, t),
s =
a.IsPlainObject(r) && a.IsPlainObject(n)
? { ...r, ...n }
: n;
return o.Check(e, t, s) ? s : i.Create(e, t);
})(p, c, n);
case "Never":
return (function (e, t, n) {
throw new u(e);
})(p);
case "Object":
return (function (e, t, n) {
if (o.Check(e, t, n)) return n;
if (null === n || "object" != typeof n) return i.Create(e, t);
const r = new Set(e.required || []),
s = {};
for (const [i, o] of Object.entries(e.properties))
(r.has(i) || void 0 !== n[i]) && (s[i] = m(o, t, n[i]));
if ("object" == typeof e.additionalProperties) {
const r = Object.getOwnPropertyNames(e.properties);
for (const i of Object.getOwnPropertyNames(n))
r.includes(i) ||
(s[i] = m(e.additionalProperties, t, n[i]));
}
return s;
})(p, c, n);
case "Record":
return (function (e, t, n) {
if (o.Check(e, t, n)) return s.Clone(n);
if (
null === n ||
"object" != typeof n ||
Array.isArray(n) ||
n instanceof Date
)
return i.Create(e, t);
const r = Object.getOwnPropertyNames(e.patternProperties)[0],
a = e.patternProperties[r],
c = {};
for (const [e, r] of Object.entries(n)) c[e] = m(a, t, r);
return c;
})(p, c, n);
case "Ref":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new h(e);
return m(t[r], t, n);
})(p, c, n);
case "This":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new h(e);
return m(t[r], t, n);
})(p, c, n);
case "Tuple":
return (function (e, t, n) {
return o.Check(e, t, n)
? s.Clone(n)
: a.IsArray(n)
? void 0 === e.items
? []
: e.items.map((e, r) => m(e, t, n[r]))
: i.Create(e, t);
})(p, c, n);
case "Union":
return (function (e, t, n) {
return o.Check(e, t, n) ? s.Clone(n) : f.Create(e, t, n);
})(p, c, n);
default:
if (!r.TypeRegistry.Has(p[r.Kind])) throw new d(p);
return (function (e, t, n) {
return o.Check(e, t, n) ? s.Clone(n) : i.Create(e, t);
})(p, c, n);
}
}
function g(...e) {
return 3 === e.length ? m(e[0], e[1], e[2]) : m(e[0], [], e[1]);
}
(t.ValueCastDereferenceError = h),
(function (e) {
function t(e, t, n) {
if ("Object" !== e[r.Kind] || "object" != typeof n || a.IsNull(n))
return o.Check(e, t, n) ? 1 : 0;
{
const i = e,
s = Object.getOwnPropertyNames(n),
a = Object.entries(i.properties),
[c, l] = [1 / a.length, a.length];
return a.reduce(
(e, [i, a]) =>
e +
(("Literal" === a[r.Kind] && a.const === n[i] ? l : 0) +
(o.Check(a, t, n[i]) ? c : 0) +
(s.includes(i) ? c : 0)),
0,
);
}
}
e.Create = function (e, n, r) {
if ("default" in e) return e.default;
{
const i = (function (e, n, r) {
let [i, o] = [e.anyOf[0], 0];
for (const s of e.anyOf) {
const e = t(s, n, r);
e > o && ((i = s), (o = e));
}
return i;
})(e, n, r);
return g(i, n, r);
}
};
})(f || (f = {})),
(t.Cast = g);
},
4291: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Check =
t.ValueCheckDereferenceError =
t.ValueCheckUnknownTypeError =
void 0);
const r = n(85007),
i = n(14350),
o = n(37657),
s = n(97540);
class a extends Error {
constructor(e) {
super(
"ValueCheck: " +
(e[i.Kind] ? `Unknown type '${e[i.Kind]}'` : "Unknown type"),
),
(this.schema = e);
}
}
t.ValueCheckUnknownTypeError = a;
class c extends Error {
constructor(e) {
super(
`ValueCheck: Unable to dereference type with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
function l(e) {
return "Any" === e[i.Kind] || "Unknown" === e[i.Kind];
}
function u(e) {
return void 0 !== e;
}
function p(e, t) {
return r.TypeSystem.ExactOptionalPropertyTypes
? t in e
: void 0 !== e[t];
}
function d(e) {
const t = o.IsObject(e);
return r.TypeSystem.AllowArrayObjects ? t : t && !o.IsArray(e);
}
function h(e) {
const t = o.IsNumber(e);
return r.TypeSystem.AllowNaN ? t : t && Number.isFinite(e);
}
function f(e, t, n) {
const m = u(e.$id) ? [...t, e] : t,
g = e;
switch (g[i.Kind]) {
case "Any":
case "Unknown":
return !0;
case "Array":
return (function (e, t, n) {
if (!Array.isArray(n)) return !1;
if (u(e.minItems) && !(n.length >= e.minItems)) return !1;
if (u(e.maxItems) && !(n.length <= e.maxItems)) return !1;
if (!n.every((n) => f(e.items, t, n))) return !1;
if (
!0 === e.uniqueItems &&
!(function () {
const e = new Set();
for (const t of n) {
const n = s.Hash(t);
if (e.has(n)) return !1;
e.add(n);
}
return !0;
})()
)
return !1;
if (!(u(e.contains) || h(e.minContains) || h(e.maxContains)))
return !0;
const r = u(e.contains) ? e.contains : i.Type.Never(),
o = n.reduce((e, n) => (f(r, t, n) ? e + 1 : e), 0);
return !(
0 === o ||
(h(e.minContains) && o < e.minContains) ||
(h(e.maxContains) && o > e.maxContains)
);
})(g, m, n);
case "AsyncIterator":
return (function (e, t, n) {
return d(n) && Symbol.asyncIterator in n;
})(0, 0, n);
case "BigInt":
return (function (e, t, n) {
return !(
!o.IsBigInt(n) ||
(u(e.multipleOf) && n % e.multipleOf !== BigInt(0)) ||
(u(e.exclusiveMinimum) && !(n > e.exclusiveMinimum)) ||
(u(e.exclusiveMaximum) && !(n < e.exclusiveMaximum)) ||
(u(e.minimum) && !(n >= e.minimum)) ||
(u(e.maximum) && !(n <= e.maximum))
);
})(g, 0, n);
case "Boolean":
return (function (e, t, n) {
return "boolean" == typeof n;
})(0, 0, n);
case "Constructor":
return (function (e, t, n) {
return f(e.returns, t, n.prototype);
})(g, m, n);
case "Date":
return (function (e, t, n) {
return (
n instanceof Date &&
!!h(n.getTime()) &&
(!u(e.exclusiveMinimumTimestamp) ||
n.getTime() > e.exclusiveMinimumTimestamp) &&
(!u(e.exclusiveMaximumTimestamp) ||
n.getTime() < e.exclusiveMaximumTimestamp) &&
(!u(e.minimumTimestamp) ||
n.getTime() >= e.minimumTimestamp) &&
(!u(e.maximumTimestamp) || n.getTime() <= e.maximumTimestamp)
);
})(g, 0, n);
case "Function":
return (function (e, t, n) {
return "function" == typeof n;
})(0, 0, n);
case "Integer":
return (function (e, t, n) {
return !(
!o.IsInteger(n) ||
(u(e.multipleOf) && n % e.multipleOf != 0) ||
(u(e.exclusiveMinimum) && !(n > e.exclusiveMinimum)) ||
(u(e.exclusiveMaximum) && !(n < e.exclusiveMaximum)) ||
(u(e.minimum) && !(n >= e.minimum)) ||
(u(e.maximum) && !(n <= e.maximum))
);
})(g, 0, n);
case "Intersect":
return (function (e, t, n) {
const r = e.allOf.every((e) => f(e, t, n));
if (!1 === e.unevaluatedProperties) {
const t = new RegExp(i.KeyResolver.ResolvePattern(e)),
o = Object.getOwnPropertyNames(n).every((e) => t.test(e));
return r && o;
}
if (i.TypeGuard.TSchema(e.unevaluatedProperties)) {
const o = new RegExp(i.KeyResolver.ResolvePattern(e)),
s = Object.getOwnPropertyNames(n).every(
(r) => o.test(r) || f(e.unevaluatedProperties, t, n[r]),
);
return r && s;
}
return r;
})(g, m, n);
case "Iterator":
return (function (e, t, n) {
return d(n) && Symbol.iterator in n;
})(0, 0, n);
case "Literal":
return (function (e, t, n) {
return n === e.const;
})(g, 0, n);
case "Never":
return !1;
case "Not":
return (function (e, t, n) {
return !f(e.not, t, n);
})(g, m, n);
case "Null":
return (function (e, t, n) {
return null === n;
})(0, 0, n);
case "Number":
return (function (e, t, n) {
return !(
!h(n) ||
(u(e.multipleOf) && n % e.multipleOf != 0) ||
(u(e.exclusiveMinimum) && !(n > e.exclusiveMinimum)) ||
(u(e.exclusiveMaximum) && !(n < e.exclusiveMaximum)) ||
(u(e.minimum) && !(n >= e.minimum)) ||
(u(e.maximum) && !(n <= e.maximum))
);
})(g, 0, n);
case "Object":
return (function (e, t, n) {
if (!d(n)) return !1;
if (
u(e.minProperties) &&
!(Object.getOwnPropertyNames(n).length >= e.minProperties)
)
return !1;
if (
u(e.maxProperties) &&
!(Object.getOwnPropertyNames(n).length <= e.maxProperties)
)
return !1;
const r = Object.getOwnPropertyNames(e.properties);
for (const o of r) {
const r = e.properties[o];
if (e.required && e.required.includes(o)) {
if (!f(r, t, n[o])) return !1;
if ((i.ExtendsUndefined.Check(r) || l(r)) && !(o in n))
return !1;
} else if (p(n, o) && !f(r, t, n[o])) return !1;
}
if (!1 === e.additionalProperties) {
const t = Object.getOwnPropertyNames(n);
return (
!(
!e.required ||
e.required.length !== r.length ||
t.length !== r.length
) || t.every((e) => r.includes(e))
);
}
return (
"object" != typeof e.additionalProperties ||
Object.getOwnPropertyNames(n).every(
(i) => r.includes(i) || f(e.additionalProperties, t, n[i]),
)
);
})(g, m, n);
case "Promise":
return (function (e, t, n) {
return "object" == typeof n && "function" == typeof n.then;
})(0, 0, n);
case "Record":
return (function (e, t, n) {
if (
!(function (e) {
return (
d(e) && !(e instanceof Date) && !(e instanceof Uint8Array)
);
})(n)
)
return !1;
if (
u(e.minProperties) &&
!(Object.getOwnPropertyNames(n).length >= e.minProperties)
)
return !1;
if (
u(e.maxProperties) &&
!(Object.getOwnPropertyNames(n).length <= e.maxProperties)
)
return !1;
const [r, i] = Object.entries(e.patternProperties)[0],
o = new RegExp(r);
return Object.entries(n).every(([n, r]) =>
o.test(n)
? f(i, t, r)
: "object" == typeof e.additionalProperties
? f(e.additionalProperties, t, r)
: !1 !== e.additionalProperties,
);
})(g, m, n);
case "Ref":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new c(e);
return f(t[r], t, n);
})(g, m, n);
case "String":
return (function (e, t, n) {
return (
!!o.IsString(n) &&
(!u(e.minLength) || n.length >= e.minLength) &&
(!u(e.maxLength) || n.length <= e.maxLength) &&
!(u(e.pattern) && !new RegExp(e.pattern).test(n)) &&
(!u(e.format) ||
(!!i.FormatRegistry.Has(e.format) &&
i.FormatRegistry.Get(e.format)(n)))
);
})(g, 0, n);
case "Symbol":
return (function (e, t, n) {
return "symbol" == typeof n;
})(0, 0, n);
case "TemplateLiteral":
return (function (e, t, n) {
return !!o.IsString(n) && new RegExp(e.pattern).test(n);
})(g, 0, n);
case "This":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new c(e);
return f(t[r], t, n);
})(g, m, n);
case "Tuple":
return (function (e, t, n) {
if (!o.IsArray(n)) return !1;
if (void 0 === e.items && 0 !== n.length) return !1;
if (n.length !== e.maxItems) return !1;
if (!e.items) return !0;
for (let r = 0; r < e.items.length; r++)
if (!f(e.items[r], t, n[r])) return !1;
return !0;
})(g, m, n);
case "Undefined":
return (function (e, t, n) {
return void 0 === n;
})(0, 0, n);
case "Union":
return (function (e, t, n) {
return e.anyOf.some((e) => f(e, t, n));
})(g, m, n);
case "Uint8Array":
return (function (e, t, n) {
return (
n instanceof Uint8Array &&
(!u(e.maxByteLength) || n.length <= e.maxByteLength) &&
(!u(e.minByteLength) || n.length >= e.minByteLength)
);
})(g, 0, n);
case "Void":
return (function (e, t, n) {
return (function (e) {
const t = o.IsUndefined(e);
return r.TypeSystem.AllowVoidNull ? t || null === e : t;
})(n);
})(0, 0, n);
default:
if (!i.TypeRegistry.Has(g[i.Kind])) throw new a(g);
return (function (e, t, n) {
return (
!!i.TypeRegistry.Has(e[i.Kind]) &&
i.TypeRegistry.Get(e[i.Kind])(e, n)
);
})(g, 0, n);
}
}
(t.ValueCheckDereferenceError = c),
(t.Check = function (...e) {
return 3 === e.length ? f(e[0], e[1], e[2]) : f(e[0], [], e[1]);
});
},
95245: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Clone = void 0);
const r = n(37657);
t.Clone = function e(t) {
if (r.IsArray(t))
return (function (t) {
return t.map((t) => e(t));
})(t);
if (r.IsAsyncIterator(t)) return t;
if (r.IsFunction(t)) return t;
if (r.IsIterator(t)) return t;
if (r.IsPromise(t)) return t;
if (r.IsDate(t))
return (function (e) {
return new Date(e.toISOString());
})(t);
if (r.IsPlainObject(t))
return (function (t) {
return [
...Object.getOwnPropertyNames(t),
...Object.getOwnPropertySymbols(t),
].reduce((n, r) => ({ ...n, [r]: e(t[r]) }), {});
})(t);
if (r.IsTypedArray(t))
return (function (e) {
return e.slice();
})(t);
if (r.IsValueType(t)) return t;
throw new Error("ValueClone: Unable to clone value");
};
},
39303: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Convert =
t.ValueConvertDereferenceError =
t.ValueConvertUnknownTypeError =
void 0);
const r = n(14350),
i = n(95245),
o = n(4291),
s = n(37657);
class a extends Error {
constructor(e) {
super("ValueConvert: Unknown type"), (this.schema = e);
}
}
t.ValueConvertUnknownTypeError = a;
class c extends Error {
constructor(e) {
super(
`ValueConvert: Unable to dereference type with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
function l(e) {
return s.IsString(e) && !isNaN(e) && !isNaN(parseFloat(e));
}
function u(e) {
return (
!0 === e ||
(s.IsNumber(e) && 1 === e) ||
(s.IsBigInt(e) && e === BigInt("1")) ||
(s.IsString(e) && ("true" === e.toLowerCase() || "1" === e))
);
}
function p(e) {
return (
!1 === e ||
(s.IsNumber(e) && 0 === e) ||
(s.IsBigInt(e) && e === BigInt("0")) ||
(s.IsString(e) && ("false" === e.toLowerCase() || "0" === e))
);
}
function d(e) {
return !!u(e) || (!p(e) && e);
}
function h(e) {
return (function (e) {
return s.IsBigInt(e) || s.IsBoolean(e) || s.IsNumber(e);
})(e)
? e.toString()
: s.IsSymbol(e) && void 0 !== e.description
? e.description.toString()
: e;
}
function f(e) {
return l(e) ? parseFloat(e) : u(e) ? 1 : p(e) ? 0 : e;
}
function m(e, t, n) {
const g = s.IsString(e.$id) ? [...t, e] : t,
y = e;
switch (e[r.Kind]) {
case "Any":
case "AsyncIterator":
case "Function":
case "Intersect":
case "Iterator":
case "Never":
case "Promise":
case "Symbol":
case "TemplateLiteral":
case "Uint8Array":
case "Unknown":
case "Void":
return (function (e, t, n) {
return n;
})(0, 0, n);
case "Array":
return (function (e, t, n) {
return s.IsArray(n) ? n.map((n) => m(e.items, t, n)) : n;
})(y, g, n);
case "BigInt":
return (function (e, t, n) {
return (function (e) {
return l(e)
? BigInt(parseInt(e))
: s.IsNumber(e)
? BigInt(0 | e)
: p(e)
? 0
: u(e)
? 1
: e;
})(n);
})(0, 0, n);
case "Boolean":
return (function (e, t, n) {
return d(n);
})(0, 0, n);
case "Constructor":
return (function (e, t, n) {
return i.Clone(n);
})(0, 0, n);
case "Date":
return (function (e, t, n) {
return (function (e) {
return s.IsDate(e)
? e
: s.IsNumber(e)
? new Date(e)
: u(e)
? new Date(1)
: p(e)
? new Date(0)
: l(e)
? new Date(parseInt(e))
: (function (e) {
return (
s.IsString(e) &&
/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)
);
})(e)
? new Date(`1970-01-01T${e}.000Z`)
: (function (e) {
return (
s.IsString(e) &&
/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(
e,
)
);
})(e)
? new Date(`1970-01-01T${e}`)
: (function (e) {
return (
s.IsString(e) &&
/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(
e,
)
);
})(e)
? new Date(`${e}.000Z`)
: (function (e) {
return (
s.IsString(e) &&
/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(
e,
)
);
})(e)
? new Date(e)
: (function (e) {
return (
s.IsString(e) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)
);
})(e)
? new Date(`${e}T00:00:00.000Z`)
: e;
})(n);
})(0, 0, n);
case "Integer":
return (function (e, t, n) {
return (function (e) {
return l(e)
? parseInt(e)
: s.IsNumber(e)
? 0 | e
: u(e)
? 1
: p(e)
? 0
: e;
})(n);
})(0, 0, n);
case "Literal":
return (function (e, t, n) {
return (function (e, t) {
return "string" == typeof e.const
? (function (e, t) {
const n = h(e);
return n === t ? n : e;
})(t, e.const)
: "number" == typeof e.const
? (function (e, t) {
const n = f(e);
return n === t ? n : e;
})(t, e.const)
: "boolean" == typeof e.const
? (function (e, t) {
const n = d(e);
return n === t ? n : e;
})(t, e.const)
: i.Clone(t);
})(e, n);
})(y, 0, n);
case "Null":
return (function (e, t, n) {
return (function (e) {
return s.IsString(e) && "null" === e.toLowerCase() ? null : e;
})(n);
})(0, 0, n);
case "Number":
return (function (e, t, n) {
return f(n);
})(0, 0, n);
case "Object":
return (function (e, t, n) {
return s.IsObject(n)
? Object.getOwnPropertyNames(e.properties).reduce(
(r, i) =>
void 0 !== n[i]
? { ...r, [i]: m(e.properties[i], t, n[i]) }
: { ...r },
n,
)
: n;
})(y, g, n);
case "Record":
return (function (e, t, n) {
const r = Object.getOwnPropertyNames(e.patternProperties)[0],
i = e.patternProperties[r],
o = {};
for (const [e, r] of Object.entries(n)) o[e] = m(i, t, r);
return o;
})(y, g, n);
case "Ref":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new c(e);
return m(t[r], t, n);
})(y, g, n);
case "String":
return (function (e, t, n) {
return h(n);
})(0, 0, n);
case "This":
return (function (e, t, n) {
const r = t.findIndex((t) => t.$id === e.$ref);
if (-1 === r) throw new c(e);
return m(t[r], t, n);
})(y, g, n);
case "Tuple":
return (function (e, t, n) {
return s.IsArray(n) && !s.IsUndefined(e.items)
? n.map((n, r) =>
r < e.items.length ? m(e.items[r], t, n) : n,
)
: n;
})(y, g, n);
case "Undefined":
return (function (e, t, n) {
return (function (e) {
return s.IsString(e) && "undefined" === e ? void 0 : e;
})(n);
})(0, 0, n);
case "Union":
return (function (e, t, n) {
for (const r of e.anyOf) {
const e = m(r, t, n);
if (o.Check(r, t, e)) return e;
}
return n;
})(y, g, n);
default:
if (!r.TypeRegistry.Has(y[r.Kind])) throw new a(y);
return (function (e, t, n) {
return n;
})(0, 0, n);
}
}
(t.ValueConvertDereferenceError = c),
(t.Convert = function (...e) {
return 3 === e.length ? m(e[0], e[1], e[2]) : m(e[0], [], e[1]);
});
},
8851: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Create =
t.ValueCreateRecursiveInstantiationError =
t.ValueCreateDereferenceError =
t.ValueCreateTempateLiteralTypeError =
t.ValueCreateIntersectTypeError =
t.ValueCreateNotTypeError =
t.ValueCreateNeverTypeError =
t.ValueCreateUnknownTypeError =
void 0);
const r = n(14350),
i = n(4291),
o = n(37657);
class s extends Error {
constructor(e) {
super("ValueCreate: Unknown type"), (this.schema = e);
}
}
t.ValueCreateUnknownTypeError = s;
class a extends Error {
constructor(e) {
super("ValueCreate: Never types cannot be created"),
(this.schema = e);
}
}
t.ValueCreateNeverTypeError = a;
class c extends Error {
constructor(e) {
super("ValueCreate: Not types must have a default value"),
(this.schema = e);
}
}
t.ValueCreateNotTypeError = c;
class l extends Error {
constructor(e) {
super(
"ValueCreate: Intersect produced invalid value. Consider using a default value.",
),
(this.schema = e);
}
}
t.ValueCreateIntersectTypeError = l;
class u extends Error {
constructor(e) {
super(
"ValueCreate: Can only create template literal values from patterns that produce finite sequences. Consider using a default value.",
),
(this.schema = e);
}
}
t.ValueCreateTempateLiteralTypeError = u;
class p extends Error {
constructor(e) {
super(
`ValueCreate: Unable to dereference type with $id '${e.$ref}'`,
),
(this.schema = e);
}
}
t.ValueCreateDereferenceError = p;
class d extends Error {
constructor(e, t) {
super(
"ValueCreate: Value cannot be created as recursive type may produce value of infinite size. Consider using a default.",
),
(this.schema = e),
(this.recursiveMaxDepth = t);
}
}
function h(e, t) {
const n = o.IsString(e.$id) ? [...t, e] : t,
g = e;
switch (g[r.Kind]) {
case "Any":
case "Unknown":
return (function (e, t) {
return o.HasPropertyKey(e, "default") ? e.default : {};
})(g);
case "Array":
return (function (e, t) {
if (!0 !== e.uniqueItems || o.HasPropertyKey(e, "default")) {
if ("contains" in e && !o.HasPropertyKey(e, "default"))
throw new Error(
"ValueCreate.Array: Array with the contains constraint requires a default value",
);
return "default" in e
? e.default
: void 0 !== e.minItems
? Array.from({ length: e.minItems }).map((n) =>
h(e.items, t),
)
: [];
}
throw new Error(
"ValueCreate.Array: Array with the uniqueItems constraint requires a default value",
);
})(g, n);
case "AsyncIterator":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: (async function* () {})();
})(g);
case "BigInt":
return (function (e, t) {
return o.HasPropertyKey(e, "default") ? e.default : BigInt(0);
})(g);
case "Boolean":
return (function (e, t) {
return !!o.HasPropertyKey(e, "default") && e.default;
})(g);
case "Constructor":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
{
const n = h(e.returns, t);
return "object" != typeof n || Array.isArray(n)
? class {}
: class {
constructor() {
for (const [e, t] of Object.entries(n)) this[e] = t;
}
};
}
})(g, n);
case "Date":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: void 0 !== e.minimumTimestamp
? new Date(e.minimumTimestamp)
: new Date(0);
})(g);
case "Function":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: () => h(e.returns, t);
})(g, n);
case "Integer":
case "Number":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: void 0 !== e.minimum
? e.minimum
: 0;
})(g);
case "Intersect":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
{
const n = e.allOf.reduce((e, n) => {
const r = h(n, t);
return "object" == typeof r ? { ...e, ...r } : r;
}, {});
if (!i.Check(e, t, n)) throw new l(e);
return n;
}
})(g, n);
case "Iterator":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: (function* () {})();
})(g);
case "Literal":
return (function (e, t) {
return o.HasPropertyKey(e, "default") ? e.default : e.const;
})(g);
case "Never":
return (function (e, t) {
throw new a(e);
})(g);
case "Not":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
throw new c(e);
})(g);
case "Null":
return (function (e, t) {
return o.HasPropertyKey(e, "default") ? e.default : null;
})(g);
case "Object":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
{
const n = new Set(e.required);
return (
e.default ||
Object.entries(e.properties).reduce(
(e, [r, i]) =>
n.has(r) ? { ...e, [r]: h(i, t) } : { ...e },
{},
)
);
}
})(g, n);
case "Promise":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: Promise.resolve(h(e.item, t));
})(g, n);
case "Record":
return (function (e, t) {
const [n, i] = Object.entries(e.patternProperties)[0];
return o.HasPropertyKey(e, "default")
? e.default
: n !== r.PatternStringExact && n !== r.PatternNumberExact
? n
.slice(1, n.length - 1)
.split("|")
.reduce((e, n) => ({ ...e, [n]: h(i, t) }), {})
: {};
})(g, n);
case "Ref":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
{
const n = t.findIndex((t) => t.$id === e.$ref);
if (-1 === n) throw new p(e);
return h(t[n], t);
}
})(g, n);
case "String":
return (function (e, t) {
if (void 0 !== e.pattern) {
if (o.HasPropertyKey(e, "default")) return e.default;
throw new Error(
"ValueCreate.String: String types with patterns must specify a default value",
);
}
if (void 0 !== e.format) {
if (o.HasPropertyKey(e, "default")) return e.default;
throw new Error(
"ValueCreate.String: String types with formats must specify a default value",
);
}
return o.HasPropertyKey(e, "default")
? e.default
: void 0 !== e.minLength
? Array.from({ length: e.minLength })
.map(() => ".")
.join("")
: "";
})(g);
case "Symbol":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: "value" in e
? Symbol.for(e.value)
: Symbol();
})(g);
case "TemplateLiteral":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
const n = r.TemplateLiteralParser.ParseExact(e.pattern);
if (!r.TemplateLiteralFinite.Check(n)) throw new u(e);
return r.TemplateLiteralGenerator.Generate(n).next().value;
})(g);
case "This":
return (function (e, t) {
if (m++ > f) throw new d(e, f);
if (o.HasPropertyKey(e, "default")) return e.default;
{
const n = t.findIndex((t) => t.$id === e.$ref);
if (-1 === n) throw new p(e);
return h(t[n], t);
}
})(g, n);
case "Tuple":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: void 0 === e.items
? []
: Array.from({ length: e.minItems }).map((n, r) =>
h(e.items[r], t),
);
})(g, n);
case "Undefined":
case "Void":
return (function (e, t) {
return o.HasPropertyKey(e, "default") ? e.default : void 0;
})(g);
case "Union":
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
if (0 === e.anyOf.length)
throw new Error(
"ValueCreate.Union: Cannot create Union with zero variants",
);
return h(e.anyOf[0], t);
})(g, n);
case "Uint8Array":
return (function (e, t) {
return o.HasPropertyKey(e, "default")
? e.default
: void 0 !== e.minByteLength
? new Uint8Array(e.minByteLength)
: new Uint8Array(0);
})(g);
default:
if (!r.TypeRegistry.Has(g[r.Kind])) throw new s(g);
return (function (e, t) {
if (o.HasPropertyKey(e, "default")) return e.default;
throw new Error(
"ValueCreate: User defined types must specify a default value",
);
})(g);
}
}
t.ValueCreateRecursiveInstantiationError = d;
const f = 512;
let m = 0;
t.Create = function (...e) {
return (m = 0), 2 === e.length ? h(e[0], e[1]) : h(e[0], []);
};
},
92190: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Patch =
t.Diff =
t.ValueDeltaUnableToDiffUnknownValue =
t.ValueDeltaObjectWithSymbolKeyError =
t.Edit =
t.Delete =
t.Update =
t.Insert =
void 0);
const r = n(14350),
i = n(28019),
o = n(37657),
s = n(95245);
(t.Insert = r.Type.Object({
type: r.Type.Literal("insert"),
path: r.Type.String(),
value: r.Type.Unknown(),
})),
(t.Update = r.Type.Object({
type: r.Type.Literal("update"),
path: r.Type.String(),
value: r.Type.Unknown(),
})),
(t.Delete = r.Type.Object({
type: r.Type.Literal("delete"),
path: r.Type.String(),
})),
(t.Edit = r.Type.Union([t.Insert, t.Update, t.Delete]));
class a extends Error {
constructor(e) {
super("ValueDelta: Cannot diff objects with symbol keys"),
(this.key = e);
}
}
t.ValueDeltaObjectWithSymbolKeyError = a;
class c extends Error {
constructor(e) {
super("ValueDelta: Unable to create diff edits for unknown value"),
(this.value = e);
}
}
function l(e, t) {
return { type: "update", path: e, value: t };
}
function u(e, t) {
return { type: "insert", path: e, value: t };
}
function p(e) {
return { type: "delete", path: e };
}
function* d(e, t, n) {
if (o.IsPlainObject(t))
return yield* (function* (e, t, n) {
if (!o.IsPlainObject(n)) return yield l(e, n);
const r = [...Object.keys(t), ...Object.getOwnPropertySymbols(t)],
i = [...Object.keys(n), ...Object.getOwnPropertySymbols(n)];
for (const t of r) {
if (o.IsSymbol(t)) throw new a(t);
o.IsUndefined(n[t]) &&
i.includes(t) &&
(yield l(`${e}/${String(t)}`, void 0));
}
for (const r of i)
if (!o.IsUndefined(t[r]) && !o.IsUndefined(n[r])) {
if (o.IsSymbol(r)) throw new a(r);
yield* d(`${e}/${String(r)}`, t[r], n[r]);
}
for (const r of i) {
if (o.IsSymbol(r)) throw new a(r);
o.IsUndefined(t[r]) && (yield u(`${e}/${String(r)}`, n[r]));
}
for (const t of r.reverse()) {
if (o.IsSymbol(t)) throw new a(t);
o.IsUndefined(n[t]) &&
!i.includes(t) &&
(yield p(`${e}/${String(t)}`));
}
})(e, t, n);
if (o.IsArray(t))
return yield* (function* (e, t, n) {
if (!o.IsArray(n)) return yield l(e, n);
for (let r = 0; r < Math.min(t.length, n.length); r++)
yield* d(`${e}/${r}`, t[r], n[r]);
for (let r = 0; r < n.length; r++)
r < t.length || (yield u(`${e}/${r}`, n[r]));
for (let r = t.length - 1; r >= 0; r--)
r < n.length || (yield p(`${e}/${r}`));
})(e, t, n);
if (o.IsTypedArray(t))
return yield* (function* (e, t, n) {
if (
!o.IsTypedArray(n) ||
t.length !== n.length ||
Object.getPrototypeOf(t).constructor.name !==
Object.getPrototypeOf(n).constructor.name
)
return yield l(e, n);
for (let r = 0; r < Math.min(t.length, n.length); r++)
yield* d(`${e}/${r}`, t[r], n[r]);
})(e, t, n);
if (o.IsValueType(t))
return yield* (function* (e, t, n) {
t !== n && (yield l(e, n));
})(e, t, n);
throw new c(t);
}
(t.ValueDeltaUnableToDiffUnknownValue = c),
(t.Diff = function (e, t) {
return [...d("", e, t)];
}),
(t.Patch = function (e, t) {
if (
(function (e) {
return (
e.length > 0 && "" === e[0].path && "update" === e[0].type
);
})(t)
)
return s.Clone(t[0].value);
if (
(function (e) {
return 0 === e.length;
})(t)
)
return s.Clone(e);
const n = s.Clone(e);
for (const e of t)
switch (e.type) {
case "insert":
case "update":
i.ValuePointer.Set(n, e.path, e.value);
break;
case "delete":
i.ValuePointer.Delete(n, e.path);
}
return n;
});
},
77712: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Equal = void 0);
const r = n(37657);
t.Equal = function e(t, n) {
if (r.IsPlainObject(t))
return (function (t, n) {
if (!r.IsPlainObject(n)) return !1;
const i = [...Object.keys(t), ...Object.getOwnPropertySymbols(t)],
o = [...Object.keys(n), ...Object.getOwnPropertySymbols(n)];
return i.length === o.length && i.every((r) => e(t[r], n[r]));
})(t, n);
if (r.IsDate(t))
return (function (e, t) {
return r.IsDate(t) && e.getTime() === t.getTime();
})(t, n);
if (r.IsTypedArray(t))
return (function (t, n) {
return (
!(
!r.IsTypedArray(n) ||
t.length !== n.length ||
Object.getPrototypeOf(t).constructor.name !==
Object.getPrototypeOf(n).constructor.name
) && t.every((t, r) => e(t, n[r]))
);
})(t, n);
if (r.IsArray(t))
return (function (t, n) {
return (
!(!r.IsArray(n) || t.length !== n.length) &&
t.every((t, r) => e(t, n[r]))
);
})(t, n);
if (r.IsValueType(t))
return (function (e, t) {
return e === t;
})(t, n);
throw new Error("ValueEquals: Unable to compare value");
};
},
37657: (e, t) => {
"use strict";
function n(e) {
return null !== e && "object" == typeof e;
}
function r(e) {
return void 0 === e;
}
function i(e) {
return null === e;
}
function o(e) {
return "boolean" == typeof e;
}
function s(e) {
return "number" == typeof e;
}
function a(e) {
return "bigint" == typeof e;
}
function c(e) {
return "string" == typeof e;
}
function l(e) {
return "function" == typeof e;
}
function u(e) {
return "symbol" == typeof e;
}
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.IsValueType =
t.IsSymbol =
t.IsFunction =
t.IsString =
t.IsBigInt =
t.IsInteger =
t.IsNumber =
t.IsBoolean =
t.IsNull =
t.IsUndefined =
t.IsArray =
t.IsObject =
t.IsPlainObject =
t.HasPropertyKey =
t.IsDate =
t.IsUint8Array =
t.IsPromise =
t.IsTypedArray =
t.IsIterator =
t.IsAsyncIterator =
void 0),
(t.IsAsyncIterator = function (e) {
return n(e) && Symbol.asyncIterator in e;
}),
(t.IsIterator = function (e) {
return n(e) && Symbol.iterator in e;
}),
(t.IsTypedArray = function (e) {
return ArrayBuffer.isView(e);
}),
(t.IsPromise = function (e) {
return e instanceof Promise;
}),
(t.IsUint8Array = function (e) {
return e instanceof Uint8Array;
}),
(t.IsDate = function (e) {
return e instanceof Date;
}),
(t.HasPropertyKey = function (e, t) {
return t in e;
}),
(t.IsPlainObject = function (e) {
return n(e) && l(e.constructor) && "Object" === e.constructor.name;
}),
(t.IsObject = n),
(t.IsArray = function (e) {
return Array.isArray(e) && !ArrayBuffer.isView(e);
}),
(t.IsUndefined = r),
(t.IsNull = i),
(t.IsBoolean = o),
(t.IsNumber = s),
(t.IsInteger = function (e) {
return s(e) && Number.isInteger(e);
}),
(t.IsBigInt = a),
(t.IsString = c),
(t.IsFunction = l),
(t.IsSymbol = u),
(t.IsValueType = function (e) {
return a(e) || o(e) || i(e) || s(e) || c(e) || u(e) || r(e);
});
},
97540: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Hash = t.ByteMarker = t.ValueHashError = void 0);
const r = n(37657);
class i extends Error {
constructor(e) {
super("Hash: Unable to hash value"), (this.value = e);
}
}
var o;
(t.ValueHashError = i),
(function (e) {
(e[(e.Undefined = 0)] = "Undefined"),
(e[(e.Null = 1)] = "Null"),
(e[(e.Boolean = 2)] = "Boolean"),
(e[(e.Number = 3)] = "Number"),
(e[(e.String = 4)] = "String"),
(e[(e.Object = 5)] = "Object"),
(e[(e.Array = 6)] = "Array"),
(e[(e.Date = 7)] = "Date"),
(e[(e.Uint8Array = 8)] = "Uint8Array"),
(e[(e.Symbol = 9)] = "Symbol"),
(e[(e.BigInt = 10)] = "BigInt");
})(o || (t.ByteMarker = o = {}));
let s = BigInt("14695981039346656037");
const [a, c] = [BigInt("1099511628211"), BigInt("2") ** BigInt("64")],
l = Array.from({ length: 256 }).map((e, t) => BigInt(t)),
u = new Float64Array(1),
p = new DataView(u.buffer),
d = new Uint8Array(u.buffer);
function h(e) {
if (r.IsArray(e))
return (function (e) {
f(o.Array);
for (const t of e) h(t);
})(e);
if (r.IsBoolean(e))
return (function (e) {
f(o.Boolean), f(e ? 1 : 0);
})(e);
if (r.IsBigInt(e))
return (function (e) {
f(o.BigInt), p.setBigInt64(0, e);
for (const e of d) f(e);
})(e);
if (r.IsDate(e))
return (function (e) {
f(o.Date), h(e.getTime());
})(e);
if (!r.IsNull(e)) {
if (r.IsNumber(e))
return (function (e) {
f(o.Number), p.setFloat64(0, e);
for (const e of d) f(e);
})(e);
if (r.IsPlainObject(e))
return (function (e) {
f(o.Object);
for (const t of globalThis.Object.keys(e).sort()) h(t), h(e[t]);
})(e);
if (r.IsString(e))
return (function (e) {
f(o.String);
for (let t = 0; t < e.length; t++) f(e.charCodeAt(t));
})(e);
if (r.IsSymbol(e))
return (function (e) {
f(o.Symbol), h(e.description);
})(e);
if (r.IsUint8Array(e))
return (function (e) {
f(o.Uint8Array);
for (let t = 0; t < e.length; t++) f(e[t]);
})(e);
if (r.IsUndefined(e)) return f(o.Undefined);
throw new i(e);
}
f(o.Null);
}
function f(e) {
(s ^= l[e]), (s = (s * a) % c);
}
t.Hash = function (e) {
return (s = BigInt("14695981039346656037")), h(e), s;
};
},
38523: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Value =
t.ValuePointer =
t.Delete =
t.Update =
t.Insert =
t.Edit =
t.ValueErrorIterator =
t.ValueErrorType =
void 0);
var r = n(48803);
Object.defineProperty(t, "ValueErrorType", {
enumerable: !0,
get: function () {
return r.ValueErrorType;
},
}),
Object.defineProperty(t, "ValueErrorIterator", {
enumerable: !0,
get: function () {
return r.ValueErrorIterator;
},
});
var i = n(92190);
Object.defineProperty(t, "Edit", {
enumerable: !0,
get: function () {
return i.Edit;
},
}),
Object.defineProperty(t, "Insert", {
enumerable: !0,
get: function () {
return i.Insert;
},
}),
Object.defineProperty(t, "Update", {
enumerable: !0,
get: function () {
return i.Update;
},
}),
Object.defineProperty(t, "Delete", {
enumerable: !0,
get: function () {
return i.Delete;
},
});
var o = n(28019);
Object.defineProperty(t, "ValuePointer", {
enumerable: !0,
get: function () {
return o.ValuePointer;
},
});
var s = n(6690);
Object.defineProperty(t, "Value", {
enumerable: !0,
get: function () {
return s.Value;
},
});
},
97780: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Mutate =
t.ValueMutateInvalidRootMutationError =
t.ValueMutateTypeMismatchError =
void 0);
const r = n(28019),
i = n(95245),
o = n(37657);
class s extends Error {
constructor() {
super(
"ValueMutate: Cannot assign due type mismatch of assignable values",
);
}
}
t.ValueMutateTypeMismatchError = s;
class a extends Error {
constructor() {
super(
"ValueMutate: Only object and array types can be mutated at the root level",
);
}
}
function c(e, t, n, s) {
return o.IsArray(s)
? (function (e, t, n, s) {
if (o.IsArray(n)) {
for (let r = 0; r < s.length; r++)
c(e, `${t}/${r}`, n[r], s[r]);
n.splice(s.length);
} else r.ValuePointer.Set(e, t, i.Clone(s));
})(e, t, n, s)
: o.IsTypedArray(s)
? (function (e, t, n, s) {
if (o.IsTypedArray(n) && n.length === s.length)
for (let e = 0; e < n.length; e++) n[e] = s[e];
else r.ValuePointer.Set(e, t, i.Clone(s));
})(e, t, n, s)
: o.IsPlainObject(s)
? (function (e, t, n, s) {
if (o.IsPlainObject(n)) {
const r = Object.keys(n),
i = Object.keys(s);
for (const e of r) i.includes(e) || delete n[e];
for (const e of i) r.includes(e) || (n[e] = null);
for (const r of i) c(e, `${t}/${r}`, n[r], s[r]);
} else r.ValuePointer.Set(e, t, i.Clone(s));
})(e, t, n, s)
: o.IsValueType(s)
? (function (e, t, n, i) {
n !== i && r.ValuePointer.Set(e, t, i);
})(e, t, n, s)
: void 0;
}
function l(e) {
return o.IsTypedArray(e) || o.IsValueType(e);
}
(t.ValueMutateInvalidRootMutationError = a),
(t.Mutate = function (e, t) {
if (l(e) || l(t)) throw new a();
if (
(function (e, t) {
return (
(o.IsPlainObject(e) && o.IsArray(t)) ||
(o.IsArray(e) && o.IsPlainObject(t))
);
})(e, t)
)
throw new s();
c(e, "", e, t);
});
},
28019: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.ValuePointer =
t.ValuePointerRootDeleteError =
t.ValuePointerRootSetError =
void 0);
class n extends Error {
constructor(e, t, n) {
super("ValuePointer: Cannot set root value"),
(this.value = e),
(this.path = t),
(this.update = n);
}
}
t.ValuePointerRootSetError = n;
class r extends Error {
constructor(e, t) {
super("ValuePointer: Cannot delete root value"),
(this.value = e),
(this.path = t);
}
}
var i;
(t.ValuePointerRootDeleteError = r),
(function (e) {
function t(e) {
return -1 === e.indexOf("~")
? e
: e.replace(/~1/g, "/").replace(/~0/g, "~");
}
function* i(e) {
if ("" === e) return;
let [n, r] = [0, 0];
for (let i = 0; i < e.length; i++)
"/" === e.charAt(i)
? (0 === i || ((r = i), yield t(e.slice(n, r))), (n = i + 1))
: (r = i);
yield t(e.slice(n));
}
(e.Format = i),
(e.Set = function (e, t, r) {
if ("" === t) throw new n(e, t, r);
let [o, s, a] = [null, e, ""];
for (const e of i(t))
void 0 === s[e] && (s[e] = {}), (o = s), (s = s[e]), (a = e);
o[a] = r;
}),
(e.Delete = function (e, t) {
if ("" === t) throw new r(e, t);
let [n, o, s] = [null, e, ""];
for (const e of i(t)) {
if (void 0 === o[e] || null === o[e]) return;
(n = o), (o = o[e]), (s = e);
}
if (Array.isArray(n)) {
const e = parseInt(s);
n.splice(e, 1);
} else delete n[s];
}),
(e.Has = function (e, t) {
if ("" === t) return !0;
let [n, r, o] = [null, e, ""];
for (const e of i(t)) {
if (void 0 === r[e]) return !1;
(n = r), (r = r[e]), (o = e);
}
return Object.getOwnPropertyNames(n).includes(o);
}),
(e.Get = function (e, t) {
if ("" === t) return e;
let n = e;
for (const e of i(t)) {
if (void 0 === n[e]) return;
n = n[e];
}
return n;
});
})(i || (t.ValuePointer = i = {}));
},
6690: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Value = void 0);
const r = n(48803),
i = n(97780),
o = n(97540),
s = n(77712),
a = n(30728),
c = n(95245),
l = n(39303),
u = n(8851),
p = n(4291),
d = n(92190);
var h;
!(function (e) {
(e.Cast = function (...e) {
return a.Cast.apply(a, e);
}),
(e.Create = function (...e) {
return u.Create.apply(u, e);
}),
(e.Check = function (...e) {
return p.Check.apply(p, e);
}),
(e.Convert = function (...e) {
return l.Convert.apply(l, e);
}),
(e.Clone = function (e) {
return c.Clone(e);
}),
(e.Errors = function (...e) {
return r.Errors.apply(r, e);
}),
(e.Equal = function (e, t) {
return s.Equal(e, t);
}),
(e.Diff = function (e, t) {
return d.Diff(e, t);
}),
(e.Hash = function (e) {
return o.Hash(e);
}),
(e.Patch = function (e, t) {
return d.Patch(e, t);
}),
(e.Mutate = function (e, t) {
i.Mutate(e, t);
});
})(h || (t.Value = h = {}));
},
88054: function (e, t, n) {
"use strict";
var r =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule ? e : { default: e };
};
const i = n(82361),
o = r(n(15158)),
s = r(n(96304)),
a = o.default("agent-base");
function c() {
const { stack: e } = new Error();
return (
"string" == typeof e &&
e
.split("\n")
.some(
(e) =>
-1 !== e.indexOf("(https.js:") ||
-1 !== e.indexOf("node:https:"),
)
);
}
function l(e, t) {
return new l.Agent(e, t);
}
!(function (e) {
class t extends i.EventEmitter {
constructor(e, t) {
super();
let n = t;
"function" == typeof e ? (this.callback = e) : e && (n = e),
(this.timeout = null),
n && "number" == typeof n.timeout && (this.timeout = n.timeout),
(this.maxFreeSockets = 1),
(this.maxSockets = 1),
(this.maxTotalSockets = 1 / 0),
(this.sockets = {}),
(this.freeSockets = {}),
(this.requests = {}),
(this.options = {});
}
get defaultPort() {
return "number" == typeof this.explicitDefaultPort
? this.explicitDefaultPort
: c()
? 443
: 80;
}
set defaultPort(e) {
this.explicitDefaultPort = e;
}
get protocol() {
return "string" == typeof this.explicitProtocol
? this.explicitProtocol
: c()
? "https:"
: "http:";
}
set protocol(e) {
this.explicitProtocol = e;
}
callback(e, t, n) {
throw new Error(
'"agent-base" has no default implementation, you must subclass and override `callback()`',
);
}
addRequest(e, t) {
const n = Object.assign({}, t);
"boolean" != typeof n.secureEndpoint && (n.secureEndpoint = c()),
null == n.host && (n.host = "localhost"),
null == n.port && (n.port = n.secureEndpoint ? 443 : 80),
null == n.protocol &&
(n.protocol = n.secureEndpoint ? "https:" : "http:"),
n.host && n.path && delete n.path,
delete n.agent,
delete n.hostname,
delete n._defaultAgent,
delete n.defaultPort,
delete n.createConnection,
(e._last = !0),
(e.shouldKeepAlive = !1);
let r = !1,
i = null;
const o = n.timeout || this.timeout,
l = (t) => {
e._hadError || (e.emit("error", t), (e._hadError = !0));
},
u = () => {
(i = null), (r = !0);
const e = new Error(
`A "socket" was not created for HTTP request before ${o}ms`,
);
(e.code = "ETIMEOUT"), l(e);
},
p = (e) => {
r || (null !== i && (clearTimeout(i), (i = null)), l(e));
},
d = (t) => {
if (r) return;
if (
(null != i && (clearTimeout(i), (i = null)),
(o = t),
Boolean(o) && "function" == typeof o.addRequest)
)
return (
a(
"Callback returned another Agent instance %o",
t.constructor.name,
),
void t.addRequest(e, n)
);
var o;
if (t)
return (
t.once("free", () => {
this.freeSocket(t, n);
}),
void e.onSocket(t)
);
const s = new Error(
`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``,
);
l(s);
};
if ("function" == typeof this.callback) {
this.promisifiedCallback ||
(this.callback.length >= 3
? (a("Converting legacy callback function to promise"),
(this.promisifiedCallback = s.default(this.callback)))
: (this.promisifiedCallback = this.callback)),
"number" == typeof o && o > 0 && (i = setTimeout(u, o)),
"port" in n &&
"number" != typeof n.port &&
(n.port = Number(n.port));
try {
a(
"Resolving socket for %o request: %o",
n.protocol,
`${e.method} ${e.path}`,
),
Promise.resolve(this.promisifiedCallback(e, n)).then(d, p);
} catch (e) {
Promise.reject(e).catch(p);
}
} else l(new Error("`callback` is not defined"));
}
freeSocket(e, t) {
a("Freeing socket %o %o", e.constructor.name, t), e.destroy();
}
destroy() {
a("Destroying agent %o", this.constructor.name);
}
}
(e.Agent = t), (e.prototype = e.Agent.prototype);
})(l || (l = {})),
(e.exports = l);
},
96304: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.default = function (e) {
return function (t, n) {
return new Promise((r, i) => {
e.call(this, t, n, (e, t) => {
e ? i(e) : r(t);
});
});
};
});
},
20699: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AsyncScopeManager = t.OpenTelemetryScopeManagerWrapper = void 0);
var i = n(70894),
o = n(82361),
s = (function () {
function e() {}
return (
(e.prototype.active = function () {
var e = this,
t = i.CorrelationContextManager.getCurrentContext();
return r(r({}, t), {
getValue: function (n) {
return e._activeSymbol
? n === e._activeSymbol && t
: ((e._activeSymbol = n), t);
},
setValue: function () {},
});
}),
(e.prototype.with = function (t, n) {
var r = t.parentSpanId,
o = t.name,
s = e._spanToContext(t, r, o);
return i.CorrelationContextManager.runWithContext(s, n)();
}),
(e.prototype.bind = function (e) {
return "function" == typeof e
? i.CorrelationContextManager.wrapCallback(e)
: (e instanceof o.EventEmitter &&
i.CorrelationContextManager.wrapEmitter(e),
e);
}),
(e.prototype.enable = function () {
return i.CorrelationContextManager.enable(), this;
}),
(e.prototype.disable = function () {
return i.CorrelationContextManager.disable(), this;
}),
(e._spanToContext = function (e, t, n) {
var o = e.spanContext ? e.spanContext() : e.context(),
s = r(r({}, e.spanContext()), {
traceFlags: e.spanContext().traceFlags,
}),
a = t ? "|" + o.traceId + "." + t + "." : o.traceId,
c = i.CorrelationContextManager.getCurrentContext();
return (
c &&
((s.traceId = c.operation.id),
t || (a = c.operation.parentId)),
i.CorrelationContextManager.spanToContextObject(s, a, n)
);
}),
e
);
})();
(t.OpenTelemetryScopeManagerWrapper = s),
(t.AsyncScopeManager = new s());
},
81162: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AzureFunctionsHook = void 0);
var o = n(95282),
s = n(70894),
a = (function () {
function e(e) {
(this._client = e), (this._autoGenerateIncomingRequests = !1);
try {
this._functionsCoreModule = n(27593);
var t = this._functionsCoreModule.getProgrammingModel();
"@azure/functions" === t.name && t.version.startsWith("3.")
? (this._addPreInvocationHook(),
this._addPostInvocationHook())
: o.warn(
'AzureFunctionsHook does not support model "' +
t.name +
'" version "' +
t.version +
'"',
);
} catch (e) {
o.info(
"AzureFunctionsHook failed to load, not running in Azure Functions",
);
}
}
return (
(e.prototype.enable = function (e) {
this._autoGenerateIncomingRequests = e;
}),
(e.prototype.dispose = function () {
this.enable(!1),
this._removeInvocationHooks(),
(this._functionsCoreModule = void 0);
}),
(e.prototype._addPreInvocationHook = function () {
var e = this;
this._preInvocationHook ||
(this._preInvocationHook =
this._functionsCoreModule.registerHook(
"preInvocation",
function (t) {
return r(e, void 0, void 0, function () {
var e, n;
return i(this, function (r) {
e = t.invocationContext;
try {
(n =
s.CorrelationContextManager.startOperation(
e,
)) &&
(n.customProperties.setProperty(
"InvocationId",
e.invocationId,
),
e.traceContext.attributes &&
(n.customProperties.setProperty(
"ProcessId",
e.traceContext.attributes.ProcessId,
),
n.customProperties.setProperty(
"LogLevel",
e.traceContext.attributes.LogLevel,
),
n.customProperties.setProperty(
"Category",
e.traceContext.attributes.Category,
),
n.customProperties.setProperty(
"HostInstanceId",
e.traceContext.attributes.HostInstanceId,
),
n.customProperties.setProperty(
"AzFuncLiveLogsSessionId",
e.traceContext.attributes[
"#AzFuncLiveLogsSessionId"
],
)),
(t.functionCallback =
s.CorrelationContextManager.wrapCallback(
t.functionCallback,
n,
)),
this._isHttpTrigger(e) &&
this._autoGenerateIncomingRequests &&
((t.hookData.appInsightsExtractedContext = n),
(t.hookData.appInsightsStartTime =
Date.now())));
} catch (e) {
return (
o.warn(
"Failed to propagate context in Azure Functions",
e,
),
[2]
);
}
return [2];
});
});
},
));
}),
(e.prototype._addPostInvocationHook = function () {
var e = this;
this._postInvocationHook ||
(this._postInvocationHook =
this._functionsCoreModule.registerHook(
"postInvocation",
function (t) {
return r(e, void 0, void 0, function () {
var e,
n,
r,
a,
c,
l = this;
return i(this, function (i) {
try {
this._autoGenerateIncomingRequests &&
((e = t.invocationContext),
this._isHttpTrigger(e) &&
(n = t.inputs[0]) &&
((r =
t.hookData.appInsightsStartTime ||
Date.now()),
(a = this._getAzureFunctionResponse(t, e)),
(c = t.hookData.appInsightsExtractedContext)
? s.CorrelationContextManager.runWithContext(
c,
function () {
l._createIncomingRequestTelemetry(
n,
a,
r,
c.operation.parentId,
);
},
)
: this._createIncomingRequestTelemetry(
n,
a,
r,
null,
)));
} catch (e) {
o.warn(
"Error creating automatic incoming request in Azure Functions",
e,
);
}
return [2];
});
});
},
));
}),
(e.prototype._createIncomingRequestTelemetry = function (
e,
t,
n,
r,
) {
for (
var i = 200, o = 0, s = [t.statusCode, t.status];
o < s.length;
o++
) {
var a = s[o];
if ("number" == typeof a && Number.isInteger(a)) {
i = a;
break;
}
if ("string" == typeof a) {
var c = parseInt(a);
if (!isNaN(c)) {
i = c;
break;
}
}
}
this._client.trackRequest({
name: e.method + " " + e.url,
resultCode: i,
success: 0 < i && i < 400,
url: e.url,
time: new Date(n),
duration: Date.now() - n,
id: r,
}),
this._client.flush();
}),
(e.prototype._getAzureFunctionResponse = function (e, t) {
var n = t.bindingDefinitions.find(function (e) {
return (
"out" === e.direction && "http" === e.type.toLowerCase()
);
});
return "$return" === (null == n ? void 0 : n.name)
? e.result
: n && t.bindings && void 0 !== t.bindings[n.name]
? t.bindings[n.name]
: t.res;
}),
(e.prototype._isHttpTrigger = function (e) {
return e.bindingDefinitions.find(function (e) {
var t;
return (
"httptrigger" ===
(null === (t = e.type) || void 0 === t
? void 0
: t.toLowerCase())
);
});
}),
(e.prototype._removeInvocationHooks = function () {
this._preInvocationHook &&
(this._preInvocationHook.dispose(),
(this._preInvocationHook = void 0)),
this._postInvocationHook &&
(this._postInvocationHook.dispose(),
(this._postInvocationHook = void 0));
}),
e
);
})();
t.AzureFunctionsHook = a;
},
66281: (e, t, n) => {
"use strict";
var r = n(87396),
i = (function () {
function e(t) {
if (e.INSTANCE)
throw new Error(
"Console logging adapter tracking should be configured from the applicationInsights object",
);
(this._client = t), (e.INSTANCE = this);
}
return (
(e.prototype.enable = function (e, t) {
r.IsInitialized &&
(n(14309).wp(e && t, this._client),
n(35823).wp(e, this._client),
n(30454).wp(e, this._client));
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null), this.enable(!1, !1);
}),
(e._methodNames = ["debug", "info", "log", "warn", "error"]),
e
);
})();
e.exports = i;
},
70894: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.CorrelationContextManager = void 0);
var r = n(95282),
i = n(87396),
o = n(58090),
s = n(10420),
a = n(86694),
c = n(25740),
l = (function () {
function e() {}
return (
(e.getCurrentContext = function () {
if (!e.enabled) return null;
var t = e.session.get(e.CONTEXT_NAME);
return void 0 === t ? null : t;
}),
(e.generateContextObject = function (e, t, n, r, i, o) {
return (
(t = t || e),
this.enabled
? {
operation: {
name: n,
id: e,
parentId: t,
traceparent: i,
tracestate: o,
},
customProperties: new u(r),
}
: null
);
}),
(e.spanToContextObject = function (t, n, r) {
var i = new o();
return (
(i.traceId = t.traceId),
(i.spanId = t.spanId),
(i.traceFlag =
o.formatOpenTelemetryTraceFlags(t.traceFlags) ||
o.DEFAULT_TRACE_FLAG),
(i.parentId = n),
e.generateContextObject(i.traceId, i.parentId, r, null, i)
);
}),
(e.runWithContext = function (t, n) {
var i;
if (e.enabled)
try {
return e.session.bind(
n,
(((i = {})[e.CONTEXT_NAME] = t), i),
)();
} catch (e) {
r.warn("Error binding to session context", c.dumpObj(e));
}
return n();
}),
(e.wrapEmitter = function (t) {
if (e.enabled)
try {
e.session.bindEmitter(t);
} catch (e) {
r.warn("Error binding to session context", c.dumpObj(e));
}
}),
(e.wrapCallback = function (t, n) {
var i;
if (e.enabled)
try {
return e.session.bind(
t,
n ? (((i = {})[e.CONTEXT_NAME] = n), i) : void 0,
);
} catch (e) {
r.warn("Error binding to session context", c.dumpObj(e));
}
return t;
}),
(e.enable = function (t) {
this.enabled ||
(this.isNodeVersionCompatible()
? (e.hasEverEnabled ||
((this.forceClsHooked = t),
(this.hasEverEnabled = !0),
void 0 === this.cls &&
(!0 === e.forceClsHooked ||
(void 0 === e.forceClsHooked &&
e.shouldUseClsHooked())
? (this.cls = n(39562))
: (this.cls = n(13057))),
(e.session =
this.cls.createNamespace("AI-CLS-Session")),
i.registerContextPreservation(function (t) {
try {
return e.session.bind(t);
} catch (e) {
r.warn(
"Error binding to session context",
c.dumpObj(e),
);
}
})),
(this.enabled = !0))
: (this.enabled = !1));
}),
(e.startOperation = function (t, n) {
var i = (t && t.traceContext) || null,
c = t && t.spanContext ? t : null,
l = t && t.traceId ? t : null,
u = t && t.headers;
if (c)
return this.spanToContextObject(
c.spanContext(),
c.parentSpanId,
c.name,
);
if (l)
return this.spanToContextObject(
l,
"|" + l.traceId + "." + l.spanId + ".",
"string" == typeof n ? n : "",
);
var p = "string" == typeof n ? n : "";
if (i) {
var d = null,
h = null;
if (((p = i.attributes.OperationName || p), n)) {
var f = n;
f.headers &&
(f.headers.traceparent
? (d = new o(f.headers.traceparent))
: f.headers["request-id"] &&
(d = new o(null, f.headers["request-id"])),
f.headers.tracestate &&
(h = new s(f.headers.tracestate)));
}
d || (d = new o(i.traceparent)),
h || (h = new s(i.tracestate));
var m = void 0;
return (
"object" == typeof n &&
((m = (g = new a(n)).getCorrelationContextHeader()),
(p = g.getOperationName({}))),
e.generateContextObject(d.traceId, d.parentId, p, m, d, h)
);
}
if (u) {
(d = new o(u.traceparent ? u.traceparent.toString() : null)),
(h = new s(u.tracestate ? u.tracestate.toString() : null));
var g = new a(t);
return e.generateContextObject(
d.traceId,
d.parentId,
g.getOperationName({}),
g.getCorrelationContextHeader(),
d,
h,
);
}
return (
r.warn(
"startOperation was called with invalid arguments",
arguments,
),
null
);
}),
(e.disable = function () {
this.enabled = !1;
}),
(e.reset = function () {
e.hasEverEnabled &&
((e.session = null),
(e.session = this.cls.createNamespace("AI-CLS-Session")));
}),
(e.isNodeVersionCompatible = function () {
var e = process.versions.node.split(".");
return (
parseInt(e[0]) > 3 ||
(parseInt(e[0]) > 2 && parseInt(e[1]) > 2)
);
}),
(e.shouldUseClsHooked = function () {
var e = process.versions.node.split(".");
return (
parseInt(e[0]) > 8 ||
(parseInt(e[0]) >= 8 && parseInt(e[1]) >= 2)
);
}),
(e.canUseClsHooked = function () {
var e = process.versions.node.split("."),
t =
parseInt(e[0]) > 8 ||
(parseInt(e[0]) >= 8 && parseInt(e[1]) >= 0),
n =
parseInt(e[0]) < 8 ||
(parseInt(e[0]) <= 8 && parseInt(e[1]) < 2),
r =
parseInt(e[0]) > 4 ||
(parseInt(e[0]) >= 4 && parseInt(e[1]) >= 7);
return !(t && n) && r;
}),
(e.enabled = !1),
(e.hasEverEnabled = !1),
(e.forceClsHooked = void 0),
(e.CONTEXT_NAME = "ApplicationInsights-Context"),
e
);
})();
t.CorrelationContextManager = l;
var u = (function () {
function e(e) {
(this.props = []), this.addHeaderData(e);
}
return (
(e.prototype.addHeaderData = function (e) {
var t = e ? e.split(", ") : [];
this.props = t
.map(function (e) {
var t = e.split("=");
return { key: t[0], value: t[1] };
})
.concat(this.props);
}),
(e.prototype.serializeToHeader = function () {
return this.props
.map(function (e) {
return e.key + "=" + e.value;
})
.join(", ");
}),
(e.prototype.getProperty = function (e) {
for (var t = 0; t < this.props.length; ++t) {
var n = this.props[t];
if (n.key === e) return n.value;
}
}),
(e.prototype.setProperty = function (t, n) {
if (e.bannedCharacters.test(t) || e.bannedCharacters.test(n))
r.warn(
"Correlation context property keys and values must not contain ',' or '='. setProperty was called with key: " +
t +
" and value: " +
n,
);
else {
for (var i = 0; i < this.props.length; ++i) {
var o = this.props[i];
if (o.key === t) return void (o.value = n);
}
this.props.push({ key: t, value: n });
}
}),
(e.bannedCharacters = /[,=]/),
e
);
})();
},
6639: (e) => {
"use strict";
var t = (function () {
function e(t) {
if (e.INSTANCE)
throw new Error(
"Exception tracking should be configured from the applicationInsights object",
);
(e.INSTANCE = this), (this._client = t);
var n = process.versions.node.split(".");
e._canUseUncaughtExceptionMonitor =
parseInt(n[0]) > 13 ||
(13 === parseInt(n[0]) && parseInt(n[1]) >= 7);
}
return (
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype.enable = function (t) {
var n = this;
if (t) {
if (
((this._isInitialized = !0), !this._exceptionListenerHandle)
) {
var r = function (t, r, i) {
void 0 === i && (i = new Error(e._FALLBACK_ERROR_MESSAGE));
var o = { exception: i, contextObjects: {} };
(o.contextObjects.Error = i),
n._client.trackException(o),
n._client.flush({ isAppCrashing: !0 }),
t &&
r &&
1 === process.listeners(r).length &&
(console.error(i), process.exit(1));
};
e._canUseUncaughtExceptionMonitor
? ((this._exceptionListenerHandle = r.bind(
this,
!1,
void 0,
)),
process.on(
e.UNCAUGHT_EXCEPTION_MONITOR_HANDLER_NAME,
this._exceptionListenerHandle,
))
: ((this._exceptionListenerHandle = r.bind(
this,
!0,
e.UNCAUGHT_EXCEPTION_HANDLER_NAME,
)),
(this._rejectionListenerHandle = r.bind(
this,
!1,
void 0,
)),
process.on(
e.UNCAUGHT_EXCEPTION_HANDLER_NAME,
this._exceptionListenerHandle,
),
process.on(
e.UNHANDLED_REJECTION_HANDLER_NAME,
this._rejectionListenerHandle,
));
}
} else
this._exceptionListenerHandle &&
(e._canUseUncaughtExceptionMonitor
? process.removeListener(
e.UNCAUGHT_EXCEPTION_MONITOR_HANDLER_NAME,
this._exceptionListenerHandle,
)
: (process.removeListener(
e.UNCAUGHT_EXCEPTION_HANDLER_NAME,
this._exceptionListenerHandle,
),
process.removeListener(
e.UNHANDLED_REJECTION_HANDLER_NAME,
this._rejectionListenerHandle,
)),
(this._exceptionListenerHandle = void 0),
(this._rejectionListenerHandle = void 0),
delete this._exceptionListenerHandle,
delete this._rejectionListenerHandle);
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null), this.enable(!1), (this._isInitialized = !1);
}),
(e.INSTANCE = null),
(e.UNCAUGHT_EXCEPTION_MONITOR_HANDLER_NAME =
"uncaughtExceptionMonitor"),
(e.UNCAUGHT_EXCEPTION_HANDLER_NAME = "uncaughtException"),
(e.UNHANDLED_REJECTION_HANDLER_NAME = "unhandledRejection"),
(e._RETHROW_EXIT_MESSAGE =
"Application Insights Rethrow Exception Handler"),
(e._FALLBACK_ERROR_MESSAGE =
"A promise was rejected without providing an error. Application Insights generated this error stack for you."),
(e._canUseUncaughtExceptionMonitor = !1),
e
);
})();
e.exports = t;
},
38975: (e, t, n) => {
"use strict";
var r = n(6113),
i = n(22037),
o = n(63580),
s = n(54470),
a = (function () {
function e(t) {
(this._collectionInterval = 9e5),
e.INSTANCE || (e.INSTANCE = this),
(this._isInitialized = !1),
(this._client = t);
}
return (
(e.prototype.enable = function (e) {
var t = this;
(this._isEnabled = e),
this._isEnabled &&
!this._isInitialized &&
(this._isInitialized = !0),
e
? this._handle ||
((this._handle = setInterval(function () {
return t.trackHeartBeat(
t._client.config,
function () {},
);
}, this._collectionInterval)),
this._handle.unref())
: this._handle &&
(clearInterval(this._handle), (this._handle = null));
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.isEnabled = function () {
return e.INSTANCE && e.INSTANCE._isEnabled;
}),
(e.prototype.trackHeartBeat = function (e, t) {
var n = {},
a = s.sdkVersion;
(n.sdkVersion = a),
(n.osType = i.type()),
(n.osVersion = i.release()),
this._uniqueProcessId ||
(this._uniqueProcessId = r.randomBytes(16).toString("hex")),
(n.processSessionId = this._uniqueProcessId),
process.env.WEBSITE_SITE_NAME &&
(n.appSrv_SiteName = process.env.WEBSITE_SITE_NAME),
process.env.WEBSITE_HOME_STAMPNAME &&
(n.appSrv_wsStamp = process.env.WEBSITE_HOME_STAMPNAME),
process.env.WEBSITE_HOSTNAME &&
(n.appSrv_wsHost = process.env.WEBSITE_HOSTNAME),
process.env.WEBSITE_OWNER_NAME &&
(n.appSrv_wsOwner = process.env.WEBSITE_OWNER_NAME),
process.env.WEBSITE_RESOURCE_GROUP &&
(n.appSrv_ResourceGroup =
process.env.WEBSITE_RESOURCE_GROUP),
process.env.WEBSITE_SLOT_NAME &&
(n.appSrv_SlotName = process.env.WEBSITE_SLOT_NAME),
this._client.trackMetric({
name: o.HeartBeatMetricName,
value: 0,
properties: n,
}),
t();
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1);
}),
e
);
})();
e.exports = a;
},
88723: function (e, t, n) {
"use strict";
var r =
(this && this.__spreadArrays) ||
function () {
for (var e = 0, t = 0, n = arguments.length; t < n; t++)
e += arguments[t].length;
var r = Array(e),
i = 0;
for (t = 0; t < n; t++)
for (var o = arguments[t], s = 0, a = o.length; s < a; s++, i++)
r[i] = o[s];
return r;
},
i = n(13685),
o = n(95687),
s = n(95282),
a = n(25740),
c = n(59036),
l = n(48339),
u = n(70894),
p = n(58090),
d = n(87396),
h = n(29962),
f = (function () {
function e(t) {
if (e.INSTANCE)
throw new Error(
"Client request tracking should be configured from the applicationInsights object",
);
(e.INSTANCE = this), (this._client = t);
}
return (
(e.prototype.enable = function (e) {
(this._isEnabled = e),
this._isEnabled && !this._isInitialized && this._initialize(),
d.IsInitialized &&
(n(89879).wp(e, this._client),
n(67886).wp(e, this._client),
n(34777).wp(e, this._client),
n(85071).wp(e, this._client),
n(31227).wp(e, this._client));
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype._initialize = function () {
var t = this;
this._isInitialized = !0;
var n = i.request,
c = o.request,
l = function (n, r) {
try {
var i =
!r[e.disableCollectionRequestOption] &&
!n[e.alreadyAutoCollectedFlag],
o = null;
if (
(r.headers &&
(o =
r.headers["User-Agent"] ||
r.headers["user-agent"]) &&
-1 !== o.toString().indexOf("azsdk-js") &&
(i = !1),
n &&
r &&
i &&
(u.CorrelationContextManager.wrapEmitter(n),
t._isEnabled))
)
if (
((n[e.alreadyAutoCollectedFlag] = !0),
u.CorrelationContextManager.getCurrentContext())
)
e.trackRequest(t._client, { options: r, request: n });
else {
var c = null;
if (h.w3cEnabled) c = new p().traceId;
else {
var l = h.generateRequestId(null);
c = h.getRootId(l);
}
var d =
u.CorrelationContextManager.generateContextObject(
c,
);
u.CorrelationContextManager.runWithContext(
d,
function () {
e.trackRequest(t._client, {
options: r,
request: n,
});
},
);
}
} catch (e) {
s.warn(
"Failed to generate dependency telemetry.",
a.dumpObj(e),
);
}
};
(i.request = function (e) {
for (var t = [], o = 1; o < arguments.length; o++)
t[o - 1] = arguments[o];
var s = n.call.apply(n, r([i, e], t));
return l(s, e), s;
}),
(o.request = function (e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
var i = c.call.apply(c, r([o, e], t));
return l(i, e), i;
}),
(i.get = function (e) {
for (var t, n = [], o = 1; o < arguments.length; o++)
n[o - 1] = arguments[o];
var s = (t = i.request).call.apply(t, r([i, e], n));
return s.end(), s;
}),
(o.get = function (e) {
for (var t, n = [], i = 1; i < arguments.length; i++)
n[i - 1] = arguments[i];
var s = (t = o.request).call.apply(t, r([o, e], n));
return s.end(), s;
});
}),
(e.trackRequest = function (t, n) {
if (n.options && n.request && t) {
var r,
i,
o = new l(n.options, n.request),
d = u.CorrelationContextManager.getCurrentContext();
if (
(d &&
d.operation &&
d.operation.traceparent &&
p.isValidTraceId(d.operation.traceparent.traceId)
? (d.operation.traceparent.updateSpanId(),
(r = d.operation.traceparent.getBackCompatRequestId()))
: h.w3cEnabled
? ((i = (m = new p()).toString()),
(r = m.getBackCompatRequestId()))
: (r =
d &&
d.operation &&
d.operation.parentId + e.requestNumber++ + "."),
a.canIncludeCorrelationHeader(t, o.getUrl()) &&
n.request.getHeader &&
n.request.setHeader &&
t.config &&
t.config.correlationId)
) {
var f = n.request.getHeader(c.requestContextHeader);
try {
a.safeIncludeCorrelationHeader(t, n.request, f);
} catch (e) {
s.warn(
"Request-Context header could not be set. Correlation of requests may be lost",
e,
);
}
if (d && d.operation)
try {
if (
(n.request.setHeader(c.requestIdHeader, r),
t.config.ignoreLegacyHeaders ||
(n.request.setHeader(
c.parentIdHeader,
d.operation.id,
),
n.request.setHeader(c.rootIdHeader, r)),
i || d.operation.traceparent)
)
n.request.setHeader(
c.traceparentHeader,
i || d.operation.traceparent.toString(),
);
else if (h.w3cEnabled) {
var m = new p().toString();
n.request.setHeader(c.traceparentHeader, m);
}
if (d.operation.tracestate) {
var g = d.operation.tracestate.toString();
g && n.request.setHeader(c.traceStateHeader, g);
}
var y = d.customProperties.serializeToHeader();
y && n.request.setHeader(c.correlationContextHeader, y);
} catch (e) {
s.warn(
"Correlation headers could not be set. Correlation of requests may be lost.",
e,
);
}
}
n.request.on &&
(n.request.on("response", function (e) {
if (!n.isProcessed) {
(n.isProcessed = !0), o.onResponse(e);
var i = o.getDependencyTelemetry(n, r);
(i.contextObjects = i.contextObjects || {}),
(i.contextObjects["http.RequestOptions"] = n.options),
(i.contextObjects["http.ClientRequest"] = n.request),
(i.contextObjects["http.ClientResponse"] = e),
t.trackDependency(i);
}
}),
n.request.on("error", function (e) {
if (!n.isProcessed) {
(n.isProcessed = !0), o.onError(e);
var i = o.getDependencyTelemetry(n, r);
(i.contextObjects = i.contextObjects || {}),
(i.contextObjects["http.RequestOptions"] = n.options),
(i.contextObjects["http.ClientRequest"] = n.request),
(i.contextObjects.Error = e),
t.trackDependency(i);
}
}),
n.request.on("abort", function () {
if (!n.isProcessed) {
(n.isProcessed = !0),
o.onError(
new Error(
"The request has been aborted and the network socket has closed.",
),
);
var e = o.getDependencyTelemetry(n, r);
(e.contextObjects = e.contextObjects || {}),
(e.contextObjects["http.RequestOptions"] = n.options),
(e.contextObjects["http.ClientRequest"] = n.request),
t.trackDependency(e);
}
}));
} else
s.info(
"AutoCollectHttpDependencies.trackRequest was called with invalid parameters: ",
!n.options,
!n.request,
!t,
);
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1);
}),
(e.disableCollectionRequestOption =
"disableAppInsightsAutoCollection"),
(e.requestNumber = 1),
(e.alreadyAutoCollectedFlag = "_appInsightsAutoCollected"),
e
);
})();
e.exports = f;
},
48339: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = n(57310),
s = n(55290),
a = n(25740),
c = n(59036),
l = n(13054),
u = n(29962),
p = (function (e) {
function t(n, r) {
var i = e.call(this) || this;
return (
r &&
r.method &&
n &&
((i.method = r.method),
(i.url = t._getUrlFromRequestOptions(n, r)),
(i.startTime = +new Date())),
i
);
}
return (
i(t, e),
(t.prototype.onError = function (e) {
this._setStatus(void 0, e);
}),
(t.prototype.onResponse = function (e) {
this._setStatus(e.statusCode, void 0),
(this.correlationId = a.getCorrelationContextTarget(
e,
c.requestContextTargetKey,
));
}),
(t.prototype.getDependencyTelemetry = function (e, t) {
var n = this.method.toUpperCase(),
r = s.RemoteDependencyDataConstants.TYPE_HTTP,
i = "";
try {
var a = new o.URL(this.url);
(a.search = void 0),
(a.hash = void 0),
(n += " " + a.pathname),
(i = a.hostname),
a.port && (i += ":" + a.port);
} catch (e) {}
this.correlationId
? ((r = s.RemoteDependencyDataConstants.TYPE_AI),
this.correlationId !== u.correlationIdPrefix &&
(i += " | " + this.correlationId))
: (r = s.RemoteDependencyDataConstants.TYPE_HTTP);
var c = {
id: t,
name: n,
data: this.url,
duration: this.duration,
success: this._isSuccess(),
resultCode: this.statusCode
? this.statusCode.toString()
: null,
properties: this.properties || {},
dependencyTypeName: r,
target: i,
};
if (
(e && e.time
? (c.time = e.time)
: this.startTime && (c.time = new Date(this.startTime)),
e)
) {
for (var l in e) c[l] || (c[l] = e[l]);
if (e.properties)
for (var l in e.properties)
c.properties[l] = e.properties[l];
}
return c;
}),
(t._getUrlFromRequestOptions = function (e, t) {
if ("string" == typeof e)
if (0 === e.indexOf("http://") || 0 === e.indexOf("https://"))
try {
e = new o.URL(e);
} catch (e) {}
else
try {
var n = new o.URL("http://" + e);
e =
"443" === n.port
? new o.URL("https://" + e)
: new o.URL("http://" + e);
} catch (e) {}
else {
if (e && "function" == typeof o.URL && e instanceof o.URL)
return o.format(e);
var r = e;
(e = {}),
r &&
Object.keys(r).forEach(function (t) {
e[t] = r[t];
});
}
if (e.path && e.host)
try {
var i = new o.URL(e.path, "http://" + e.host + e.path);
(e.pathname = i.pathname), (e.search = i.search);
} catch (e) {}
if (e.path && e.hostname && !e.host)
try {
(i = new o.URL(e.path, "http://" + e.hostname + e.path)),
(e.pathname = i.pathname),
(e.search = i.search);
} catch (e) {}
if (e.host && e.port)
try {
!new o.URL("http://" + e.host).port &&
e.port &&
((e.hostname = e.host), delete e.host);
} catch (e) {}
return (
(e.protocol =
e.protocol ||
(t.agent && t.agent.protocol) ||
t.protocol ||
void 0),
(e.hostname = e.hostname || "localhost"),
o.format(e)
);
}),
t
);
})(l);
e.exports = p;
},
86694: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = n(57310),
s = n(55290),
a = n(25740),
c = n(59036),
l = n(13054),
u = n(29962),
p = n(10420),
d = n(58090),
h = (function (e) {
function t(t, n) {
var r = e.call(this) || this;
return (
t &&
((r.method = t.method),
(r.url = r._getAbsoluteUrl(t)),
(r.startTime = +new Date()),
(r.socketRemoteAddress = t.socket && t.socket.remoteAddress),
r.parseHeaders(t, n),
t.connection &&
((r.connectionRemoteAddress = t.connection.remoteAddress),
(r.legacySocketRemoteAddress =
t.connection.socket &&
t.connection.socket.remoteAddress))),
r
);
}
return (
i(t, e),
(t.prototype.onError = function (e, t) {
this._setStatus(void 0, e), t && (this.duration = t);
}),
(t.prototype.onResponse = function (e, t) {
this._setStatus(e.statusCode, void 0), t && (this.duration = t);
}),
(t.prototype.getRequestTelemetry = function (e) {
var t = this.method;
try {
t += " " + new o.URL(this.url).pathname;
} catch (e) {}
var n = {
id: this.requestId,
name: t,
url: this.url,
source: this.sourceCorrelationId,
duration: this.duration,
resultCode: this.statusCode
? this.statusCode.toString()
: null,
success: this._isSuccess(),
properties: this.properties,
};
if (
(e && e.time
? (n.time = e.time)
: this.startTime && (n.time = new Date(this.startTime)),
e)
) {
for (var r in e) n[r] || (n[r] = e[r]);
if (e.properties)
for (var r in e.properties)
n.properties[r] = e.properties[r];
}
return n;
}),
(t.prototype.getRequestTags = function (e) {
var n = {};
for (var r in e) n[r] = e[r];
return (
(n[t.keys.locationIp] =
e[t.keys.locationIp] || this._getIp()),
(n[t.keys.sessionId] =
e[t.keys.sessionId] || this._getId("ai_session")),
(n[t.keys.userId] =
e[t.keys.userId] || this._getId("ai_user")),
(n[t.keys.userAuthUserId] =
e[t.keys.userAuthUserId] || this._getId("ai_authUser")),
(n[t.keys.operationName] = this.getOperationName(e)),
(n[t.keys.operationParentId] = this.getOperationParentId(e)),
(n[t.keys.operationId] = this.getOperationId(e)),
n
);
}),
(t.prototype.getOperationId = function (e) {
return e[t.keys.operationId] || this.operationId;
}),
(t.prototype.getOperationParentId = function (e) {
return (
e[t.keys.operationParentId] ||
this.parentId ||
this.getOperationId(e)
);
}),
(t.prototype.getOperationName = function (e) {
if (e[t.keys.operationName]) return e[t.keys.operationName];
var n = "";
try {
n = new o.URL(this.url).pathname;
} catch (e) {}
var r = this.method;
return n && (r += " " + n), r;
}),
(t.prototype.getRequestId = function () {
return this.requestId;
}),
(t.prototype.getCorrelationContextHeader = function () {
return this.correlationContextHeader;
}),
(t.prototype.getTraceparent = function () {
return this.traceparent;
}),
(t.prototype.getTracestate = function () {
return this.tracestate;
}),
(t.prototype.getLegacyRootId = function () {
return this.legacyRootId;
}),
(t.prototype._getAbsoluteUrl = function (e) {
if (!e.headers) return e.url;
var t =
(e.connection && e.connection.encrypted) ||
"https" == e.headers["x-forwarded-proto"]
? "https"
: "http",
n = t + "://" + e.headers.host + "/",
r = "",
i = "";
try {
var s = new o.URL(e.url, n);
(r = s.pathname), (i = s.search);
} catch (e) {}
return o.format({
protocol: t,
host: e.headers.host,
pathname: r,
search: i,
});
}),
(t.prototype._getIp = function () {
var e = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/,
t = function (t) {
var n = e.exec(t);
if (n) return n[0];
},
n =
t(this.rawHeaders["x-forwarded-for"]) ||
t(this.rawHeaders["x-client-ip"]) ||
t(this.rawHeaders["x-real-ip"]) ||
t(this.connectionRemoteAddress) ||
t(this.socketRemoteAddress) ||
t(this.legacySocketRemoteAddress);
return (
!n &&
this.connectionRemoteAddress &&
this.connectionRemoteAddress.substr &&
"::" === this.connectionRemoteAddress.substr(0, 2) &&
(n = "127.0.0.1"),
n
);
}),
(t.prototype._getId = function (e) {
var n =
(this.rawHeaders &&
this.rawHeaders.cookie &&
"string" == typeof this.rawHeaders.cookie &&
this.rawHeaders.cookie) ||
"";
return t.parseId(a.getCookie(e, n));
}),
(t.prototype.setBackCompatFromThisTraceContext = function () {
(this.operationId = this.traceparent.traceId),
this.traceparent.legacyRootId &&
(this.legacyRootId = this.traceparent.legacyRootId),
(this.parentId = this.traceparent.parentId),
this.traceparent.updateSpanId(),
(this.requestId = this.traceparent.getBackCompatRequestId());
}),
(t.prototype.parseHeaders = function (e, t) {
if (
((this.rawHeaders = e.headers || e.rawHeaders),
(this.userAgent = e.headers && e.headers["user-agent"]),
(this.sourceCorrelationId = a.getCorrelationContextTarget(
e,
c.requestContextSourceKey,
)),
e.headers)
) {
var n = e.headers[c.traceStateHeader]
? e.headers[c.traceStateHeader].toString()
: null,
r = e.headers[c.traceparentHeader]
? e.headers[c.traceparentHeader].toString()
: null,
i = e.headers[c.requestIdHeader]
? e.headers[c.requestIdHeader].toString()
: null,
o = e.headers[c.parentIdHeader]
? e.headers[c.parentIdHeader].toString()
: null,
s = e.headers[c.rootIdHeader]
? e.headers[c.rootIdHeader].toString()
: null;
(this.correlationContextHeader = e.headers[
c.correlationContextHeader
]
? e.headers[c.correlationContextHeader].toString()
: null),
u.w3cEnabled && (r || n)
? ((this.traceparent = new d(r ? r.toString() : null)),
(this.tracestate =
r && n && new p(n ? n.toString() : null)),
this.setBackCompatFromThisTraceContext())
: i
? u.w3cEnabled
? ((this.traceparent = new d(null, i)),
this.setBackCompatFromThisTraceContext())
: ((this.parentId = i),
(this.requestId = u.generateRequestId(this.parentId)),
(this.operationId = u.getRootId(this.requestId)))
: u.w3cEnabled
? ((this.traceparent = new d()),
(this.traceparent.parentId = o),
(this.traceparent.legacyRootId = s || o),
this.setBackCompatFromThisTraceContext())
: ((this.parentId = o),
(this.requestId = u.generateRequestId(
s || this.parentId,
)),
(this.correlationContextHeader = null),
(this.operationId = u.getRootId(this.requestId))),
t &&
((this.requestId = t),
(this.operationId = u.getRootId(this.requestId)));
}
}),
(t.parseId = function (e) {
var t = e.split("|");
return t.length > 0 ? t[0] : "";
}),
(t.keys = new s.ContextTagKeys()),
t
);
})(l);
e.exports = h;
},
40731: (e, t, n) => {
"use strict";
var r = n(13685),
i = n(95687),
o = n(95282),
s = n(25740),
a = n(59036),
c = n(86694),
l = n(70894),
u = n(74350),
p = (function () {
function e(t) {
if (e.INSTANCE)
throw new Error(
"Server request tracking should be configured from the applicationInsights object",
);
(e.INSTANCE = this), (this._client = t);
}
return (
(e.prototype.enable = function (e) {
(this._isEnabled = e),
(this._isAutoCorrelating ||
this._isEnabled ||
u.isEnabled()) &&
!this._isInitialized &&
(this.useAutoCorrelation(this._isAutoCorrelating),
this._initialize());
}),
(e.prototype.useAutoCorrelation = function (e, t) {
e && !this._isAutoCorrelating
? l.CorrelationContextManager.enable(t)
: !e &&
this._isAutoCorrelating &&
l.CorrelationContextManager.disable(),
(this._isAutoCorrelating = e);
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype.isAutoCorrelating = function () {
return this._isAutoCorrelating;
}),
(e.prototype._generateCorrelationContext = function (e) {
if (this._isAutoCorrelating)
return l.CorrelationContextManager.generateContextObject(
e.getOperationId(this._client.context.tags),
e.getRequestId(),
e.getOperationName(this._client.context.tags),
e.getCorrelationContextHeader(),
e.getTraceparent(),
e.getTracestate(),
);
}),
(e.prototype._registerRequest = function (t, n, r) {
var i = this,
o = new c(t),
s = this._generateCorrelationContext(o);
l.CorrelationContextManager.runWithContext(s, function () {
i._isEnabled &&
((t[e.alreadyAutoCollectedFlag] = !0),
e.trackRequest(i._client, { request: t, response: n }, o)),
"function" == typeof r && r(t, n);
});
}),
(e.prototype._initialize = function () {
if (((this._isInitialized = !0), !e.HANDLER_READY)) {
e.HANDLER_READY = !0;
var t = function (t) {
if (t) {
if ("function" != typeof t)
throw new Error(
"onRequest handler must be a function",
);
return function (n, r) {
var i;
l.CorrelationContextManager.wrapEmitter(n),
l.CorrelationContextManager.wrapEmitter(r);
var o = n && !n[e.alreadyAutoCollectedFlag];
n && o
? null === (i = e.INSTANCE) ||
void 0 === i ||
i._registerRequest(n, r, t)
: "function" == typeof t && t(n, r);
};
}
},
n = function (e) {
var n = e.addListener.bind(e);
(e.addListener = function (e, r) {
switch (e) {
case "request":
case "checkContinue":
return n(e, t(r));
default:
return n(e, r);
}
}),
(e.on = e.addListener);
},
o = r.createServer;
r.createServer = function (e, r) {
if (r && "function" == typeof r) {
var i = o(e, t(r));
return n(i), i;
}
return (i = o(t(e))), n(i), i;
};
var s = i.createServer;
i.createServer = function (e, r) {
var i = s(e, t(r));
return n(i), i;
};
}
}),
(e.trackRequestSync = function (t, n) {
if (n.request && n.response && t) {
(n.isProcessed = !1),
e.addResponseCorrelationIdHeader(t, n.response);
var r = l.CorrelationContextManager.getCurrentContext(),
i = new c(n.request, r && r.operation.parentId);
r &&
((r.operation.id =
i.getOperationId(t.context.tags) || r.operation.id),
(r.operation.name =
i.getOperationName(t.context.tags) || r.operation.name),
(r.operation.parentId =
i.getRequestId() || r.operation.parentId),
r.customProperties.addHeaderData(
i.getCorrelationContextHeader(),
)),
e.endRequest(t, i, n, n.duration, n.error);
} else
o.info(
"AutoCollectHttpRequests.trackRequestSync was called with invalid parameters: ",
!n.request,
!n.response,
!t,
);
}),
(e.trackRequest = function (t, n, r) {
if (n.request && n.response && t) {
n.isProcessed = !1;
var i = l.CorrelationContextManager.getCurrentContext(),
a = r || new c(n.request, i && i.operation.parentId);
s.canIncludeCorrelationHeader(t, a.getUrl()) &&
e.addResponseCorrelationIdHeader(t, n.response),
i &&
!r &&
((i.operation.id =
a.getOperationId(t.context.tags) || i.operation.id),
(i.operation.name =
a.getOperationName(t.context.tags) || i.operation.name),
(i.operation.parentId =
a.getOperationParentId(t.context.tags) ||
i.operation.parentId),
i.customProperties.addHeaderData(
a.getCorrelationContextHeader(),
)),
n.response.once &&
n.response.once("finish", function () {
e.endRequest(t, a, n, null, null);
}),
n.request.on &&
n.request.on("error", function (r) {
e.endRequest(t, a, n, null, r);
}),
n.request.on &&
n.request.on("aborted", function () {
e.endRequest(
t,
a,
n,
null,
"The request has been aborted and the network socket has closed.",
);
});
} else
o.info(
"AutoCollectHttpRequests.trackRequest was called with invalid parameters: ",
!n.request,
!n.response,
!t,
);
}),
(e.addResponseCorrelationIdHeader = function (e, t) {
if (
e.config &&
e.config.correlationId &&
t.getHeader &&
t.setHeader &&
!t.headersSent
) {
var n = t.getHeader(a.requestContextHeader);
s.safeIncludeCorrelationHeader(e, t, n);
}
}),
(e.endRequest = function (e, t, n, r, i) {
if (!n.isProcessed) {
(n.isProcessed = !0),
i ? t.onError(i, r) : t.onResponse(n.response, r);
var o = t.getRequestTelemetry(n);
if (
((o.tagOverrides = t.getRequestTags(e.context.tags)),
n.tagOverrides)
)
for (var s in n.tagOverrides)
o.tagOverrides[s] = n.tagOverrides[s];
var a = t.getLegacyRootId();
a && (o.properties.ai_legacyRootId = a),
(o.contextObjects = o.contextObjects || {}),
(o.contextObjects["http.ServerRequest"] = n.request),
(o.contextObjects["http.ServerResponse"] = n.response),
e.trackRequest(o);
}
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1),
l.CorrelationContextManager.disable(),
(this._isAutoCorrelating = !1);
}),
(e.HANDLER_READY = !1),
(e.alreadyAutoCollectedFlag = "_appInsightsAutoCollected"),
e
);
})();
e.exports = p;
},
11629: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AutoCollectNativePerformance = void 0);
var i = n(54470),
o = n(95282),
s = (function () {
function e(t) {
(this._disabledMetrics = {}),
e.INSTANCE && e.INSTANCE.dispose(),
(e.INSTANCE = this),
(this._client = t);
}
return (
(e.prototype.enable = function (t, r, i) {
var s = this;
if (
(void 0 === r && (r = {}),
void 0 === i && (i = 6e4),
null == e._metricsAvailable && t && !this._isInitialized)
)
try {
var a = n(89166);
(e._emitter = new a()),
(e._metricsAvailable = !0),
o.info("Native metrics module successfully loaded!");
} catch (t) {
return void (e._metricsAvailable = !1);
}
(this._isEnabled = t),
(this._disabledMetrics = r),
this._isEnabled &&
!this._isInitialized &&
(this._isInitialized = !0),
this._isEnabled && e._emitter
? (e._emitter.enable(!0, i),
this._handle ||
((this._handle = setInterval(function () {
return s._trackNativeMetrics();
}, i)),
this._handle.unref()))
: e._emitter &&
(e._emitter.enable(!1),
this._handle &&
(clearInterval(this._handle), (this._handle = void 0)));
}),
(e.prototype.dispose = function () {
this.enable(!1);
}),
(e.parseEnabled = function (e, t) {
var n = t.disableAllExtendedMetrics,
i = t.extendedMetricDisablers;
if (n) return { isEnabled: !1, disabledMetrics: {} };
if (i) {
var o = i.split(","),
s = {};
if (o.length > 0)
for (var a = 0, c = o; a < c.length; a++) s[c[a]] = !0;
return "object" == typeof e
? { isEnabled: !0, disabledMetrics: r(r({}, e), s) }
: { isEnabled: e, disabledMetrics: s };
}
return "boolean" == typeof e
? { isEnabled: e, disabledMetrics: {} }
: { isEnabled: !0, disabledMetrics: e };
}),
(e.prototype._trackNativeMetrics = function () {
var e = !0;
"object" != typeof this._isEnabled && (e = this._isEnabled),
e &&
(this._trackGarbageCollection(),
this._trackEventLoop(),
this._trackHeapUsage());
}),
(e.prototype._trackGarbageCollection = function () {
var t;
if (!this._disabledMetrics.gc) {
var n = e._emitter.getGCData();
for (var r in n) {
var o = n[r].metrics,
s = r + " Garbage Collection Duration",
a =
Math.sqrt(
o.sumSquares / o.count -
Math.pow(o.total / o.count, 2),
) || 0;
this._client.trackMetric({
name: s,
value: o.total,
count: o.count,
max: o.max,
min: o.min,
stdDev: a,
tagOverrides:
((t = {}),
(t[this._client.context.keys.internalSdkVersion] =
"node-nativeperf:" + i.sdkVersion),
t),
});
}
}
}),
(e.prototype._trackEventLoop = function () {
var t;
if (!this._disabledMetrics.loop) {
var n = e._emitter.getLoopData().loopUsage;
if (0 != n.count) {
var r =
Math.sqrt(
n.sumSquares / n.count - Math.pow(n.total / n.count, 2),
) || 0;
this._client.trackMetric({
name: "Event Loop CPU Time",
value: n.total,
count: n.count,
min: n.min,
max: n.max,
stdDev: r,
tagOverrides:
((t = {}),
(t[this._client.context.keys.internalSdkVersion] =
"node-nativeperf:" + i.sdkVersion),
t),
});
}
}
}),
(e.prototype._trackHeapUsage = function () {
var e, t, n;
if (!this._disabledMetrics.heap) {
var r = process.memoryUsage(),
o = r.heapUsed,
s = r.heapTotal,
a = r.rss;
this._client.trackMetric({
name: "Memory Usage (Heap)",
value: o,
count: 1,
tagOverrides:
((e = {}),
(e[this._client.context.keys.internalSdkVersion] =
"node-nativeperf:" + i.sdkVersion),
e),
}),
this._client.trackMetric({
name: "Memory Total (Heap)",
value: s,
count: 1,
tagOverrides:
((t = {}),
(t[this._client.context.keys.internalSdkVersion] =
"node-nativeperf:" + i.sdkVersion),
t),
}),
this._client.trackMetric({
name: "Memory Usage (Non-Heap)",
value: a - s,
count: 1,
tagOverrides:
((n = {}),
(n[this._client.context.keys.internalSdkVersion] =
"node-nativeperf:" + i.sdkVersion),
n),
});
}
}),
e
);
})();
t.AutoCollectNativePerformance = s;
},
64555: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.NetworkStatsbeat = void 0);
t.NetworkStatsbeat = function (e, t) {
(this.endpoint = e),
(this.host = t),
(this.totalRequestCount = 0),
(this.totalSuccesfulRequestCount = 0),
(this.totalFailedRequestCount = []),
(this.retryCount = []),
(this.exceptionCount = []),
(this.throttleCount = []),
(this.intervalRequestExecutionTime = 0),
(this.lastIntervalRequestExecutionTime = 0),
(this.lastTime = +new Date()),
(this.lastRequestCount = 0);
};
},
74350: (e, t, n) => {
"use strict";
var r = n(22037),
i = n(63580),
o = (function () {
function e(t, n, r) {
void 0 === n && (n = 6e4),
void 0 === r && (r = !1),
(this._lastIntervalRequestExecutionTime = 0),
(this._lastIntervalDependencyExecutionTime = 0),
e.INSTANCE || (e.INSTANCE = this),
(this._lastRequests = {
totalRequestCount: 0,
totalFailedRequestCount: 0,
time: 0,
}),
(this._lastDependencies = {
totalDependencyCount: 0,
totalFailedDependencyCount: 0,
time: 0,
}),
(this._lastExceptions = { totalExceptionCount: 0, time: 0 }),
(this._isInitialized = !1),
(this._client = t),
(this._collectionInterval = n),
(this._enableLiveMetricsCounters = r);
}
return (
(e.prototype.enable = function (t, n) {
var i = this;
(this._isEnabled = t),
this._isEnabled &&
!this._isInitialized &&
(this._isInitialized = !0),
t
? this._handle ||
((this._lastCpus = r.cpus()),
(this._lastRequests = {
totalRequestCount: e._totalRequestCount,
totalFailedRequestCount: e._totalFailedRequestCount,
time: +new Date(),
}),
(this._lastDependencies = {
totalDependencyCount: e._totalDependencyCount,
totalFailedDependencyCount:
e._totalFailedDependencyCount,
time: +new Date(),
}),
(this._lastExceptions = {
totalExceptionCount: e._totalExceptionCount,
time: +new Date(),
}),
"function" == typeof process.cpuUsage &&
(this._lastAppCpuUsage = process.cpuUsage()),
(this._lastHrtime = process.hrtime()),
(this._collectionInterval =
n || this._collectionInterval),
(this._handle = setInterval(function () {
return i.trackPerformance();
}, this._collectionInterval)),
this._handle.unref())
: this._handle &&
(clearInterval(this._handle), (this._handle = void 0));
}),
(e.countRequest = function (t, n) {
var r;
if (e.isEnabled()) {
if ("string" == typeof t)
r = +new Date("1970-01-01T" + t + "Z");
else {
if ("number" != typeof t) return;
r = t;
}
(e._intervalRequestExecutionTime += r),
!1 === n && e._totalFailedRequestCount++,
e._totalRequestCount++;
}
}),
(e.countException = function () {
e._totalExceptionCount++;
}),
(e.countDependency = function (t, n) {
var r;
if (e.isEnabled()) {
if ("string" == typeof t)
r = +new Date("1970-01-01T" + t + "Z");
else {
if ("number" != typeof t) return;
r = t;
}
(e._intervalDependencyExecutionTime += r),
!1 === n && e._totalFailedDependencyCount++,
e._totalDependencyCount++;
}
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.isEnabled = function () {
return e.INSTANCE && e.INSTANCE._isEnabled;
}),
(e.prototype.trackPerformance = function () {
this._trackCpu(),
this._trackMemory(),
this._trackNetwork(),
this._trackDependencyRate(),
this._trackExceptionRate();
}),
(e.prototype._trackCpu = function () {
var e = r.cpus();
if (
e &&
e.length &&
this._lastCpus &&
e.length === this._lastCpus.length
) {
for (
var t = 0, n = 0, o = 0, s = 0, a = 0, c = 0;
e && c < e.length;
c++
) {
var l = e[c],
u = this._lastCpus[c],
p = (l.model, l.speed, l.times),
d = u.times;
(t += p.user - d.user || 0),
(n += p.sys - d.sys || 0),
(o += p.nice - d.nice || 0),
(s += p.idle - d.idle || 0),
(a += p.irq - d.irq || 0);
}
var h = void 0;
if ("function" == typeof process.cpuUsage) {
var f = process.cpuUsage(),
m = process.hrtime(),
g =
f.user -
this._lastAppCpuUsage.user +
(f.system - this._lastAppCpuUsage.system) || 0;
void 0 !== this._lastHrtime &&
2 === this._lastHrtime.length &&
(h =
(100 * g) /
((1e6 * (m[0] - this._lastHrtime[0]) +
(m[1] - this._lastHrtime[1]) / 1e3 || 0) *
e.length)),
(this._lastAppCpuUsage = f),
(this._lastHrtime = m);
}
var y = t + n + o + s + a || 1;
this._client.trackMetric({
name: i.PerformanceCounter.PROCESSOR_TIME,
value: ((y - s) / y) * 100,
}),
this._client.trackMetric({
name: i.PerformanceCounter.PROCESS_TIME,
value: h || (t / y) * 100,
});
}
this._lastCpus = e;
}),
(e.prototype._trackMemory = function () {
var e = r.freemem(),
t = process.memoryUsage().rss,
n = r.totalmem() - e;
this._client.trackMetric({
name: i.PerformanceCounter.PRIVATE_BYTES,
value: t,
}),
this._client.trackMetric({
name: i.PerformanceCounter.AVAILABLE_BYTES,
value: e,
}),
this._enableLiveMetricsCounters &&
this._client.trackMetric({
name: i.QuickPulseCounter.COMMITTED_BYTES,
value: n,
});
}),
(e.prototype._trackNetwork = function () {
var t = this._lastRequests,
n = {
totalRequestCount: e._totalRequestCount,
totalFailedRequestCount: e._totalFailedRequestCount,
time: +new Date(),
},
r = n.totalRequestCount - t.totalRequestCount || 0,
o =
n.totalFailedRequestCount - t.totalFailedRequestCount || 0,
s = n.time - t.time,
a = s / 1e3,
c =
(e._intervalRequestExecutionTime -
this._lastIntervalRequestExecutionTime) /
r || 0;
if (
((this._lastIntervalRequestExecutionTime =
e._intervalRequestExecutionTime),
s > 0)
) {
var l = r / a,
u = o / a;
this._client.trackMetric({
name: i.PerformanceCounter.REQUEST_RATE,
value: l,
}),
(!this._enableLiveMetricsCounters || r > 0) &&
this._client.trackMetric({
name: i.PerformanceCounter.REQUEST_DURATION,
value: c,
}),
this._enableLiveMetricsCounters &&
this._client.trackMetric({
name: i.QuickPulseCounter.REQUEST_FAILURE_RATE,
value: u,
});
}
this._lastRequests = n;
}),
(e.prototype._trackDependencyRate = function () {
if (this._enableLiveMetricsCounters) {
var t = this._lastDependencies,
n = {
totalDependencyCount: e._totalDependencyCount,
totalFailedDependencyCount: e._totalFailedDependencyCount,
time: +new Date(),
},
r = n.totalDependencyCount - t.totalDependencyCount || 0,
o =
n.totalFailedDependencyCount -
t.totalFailedDependencyCount || 0,
s = n.time - t.time,
a = s / 1e3,
c =
(e._intervalDependencyExecutionTime -
this._lastIntervalDependencyExecutionTime) /
r || 0;
if (
((this._lastIntervalDependencyExecutionTime =
e._intervalDependencyExecutionTime),
s > 0)
) {
var l = r / a,
u = o / a;
this._client.trackMetric({
name: i.QuickPulseCounter.DEPENDENCY_RATE,
value: l,
}),
this._client.trackMetric({
name: i.QuickPulseCounter.DEPENDENCY_FAILURE_RATE,
value: u,
}),
(!this._enableLiveMetricsCounters || r > 0) &&
this._client.trackMetric({
name: i.QuickPulseCounter.DEPENDENCY_DURATION,
value: c,
});
}
this._lastDependencies = n;
}
}),
(e.prototype._trackExceptionRate = function () {
if (this._enableLiveMetricsCounters) {
var t = this._lastExceptions,
n = {
totalExceptionCount: e._totalExceptionCount,
time: +new Date(),
},
r = n.totalExceptionCount - t.totalExceptionCount || 0,
o = n.time - t.time;
if (o > 0) {
var s = r / (o / 1e3);
this._client.trackMetric({
name: i.QuickPulseCounter.EXCEPTION_RATE,
value: s,
});
}
this._lastExceptions = n;
}
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1);
}),
(e._totalRequestCount = 0),
(e._totalFailedRequestCount = 0),
(e._totalDependencyCount = 0),
(e._totalFailedDependencyCount = 0),
(e._totalExceptionCount = 0),
(e._intervalDependencyExecutionTime = 0),
(e._intervalRequestExecutionTime = 0),
e
);
})();
e.exports = o;
},
62309: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
},
i = n(63580),
o = n(60521),
s = n(77535),
a = (function () {
function e(t, n) {
void 0 === n && (n = 6e4),
e.INSTANCE || (e.INSTANCE = this),
(this._isInitialized = !1),
(e._dependencyCountersCollection = []),
(e._requestCountersCollection = []),
(e._exceptionCountersCollection = []),
(e._traceCountersCollection = []),
(this._client = t),
(this._collectionInterval = n);
}
return (
(e.prototype.enable = function (e, t) {
var n = this;
(this._isEnabled = e),
this._isEnabled &&
!this._isInitialized &&
(this._isInitialized = !0),
e
? this._handle ||
((this._collectionInterval =
t || this._collectionInterval),
(this._handle = setInterval(function () {
return n.trackPreAggregatedMetrics();
}, this._collectionInterval)),
this._handle.unref())
: this._handle &&
(clearInterval(this._handle), (this._handle = void 0));
}),
(e.countException = function (t) {
e.isEnabled() &&
e._getAggregatedCounter(t, this._exceptionCountersCollection)
.totalCount++;
}),
(e.countTrace = function (t) {
e.isEnabled() &&
e._getAggregatedCounter(t, this._traceCountersCollection)
.totalCount++;
}),
(e.countRequest = function (t, n) {
if (e.isEnabled()) {
var r,
i = e._getAggregatedCounter(
n,
this._requestCountersCollection,
);
if ("string" == typeof t)
r = +new Date("1970-01-01T" + t + "Z");
else {
if ("number" != typeof t) return;
r = t;
}
(i.intervalExecutionTime += r), i.totalCount++;
}
}),
(e.countDependency = function (t, n) {
if (e.isEnabled()) {
var r,
i = e._getAggregatedCounter(
n,
this._dependencyCountersCollection,
);
if ("string" == typeof t)
r = +new Date("1970-01-01T" + t + "Z");
else {
if ("number" != typeof t) return;
r = t;
}
(i.intervalExecutionTime += r), i.totalCount++;
}
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.isEnabled = function () {
return e.INSTANCE && e.INSTANCE._isEnabled;
}),
(e.prototype.trackPreAggregatedMetrics = function () {
this._trackRequestMetrics(),
this._trackDependencyMetrics(),
this._trackExceptionMetrics(),
this._trackTraceMetrics();
}),
(e._getAggregatedCounter = function (e, t) {
for (var n = !1, r = 0; r < t.length; r++) {
if (e === t[r].dimensions) return t[r];
if (
Object.keys(e).length ===
Object.keys(t[r].dimensions).length
) {
for (var i in e)
if (e[i] != t[r].dimensions[i]) {
n = !0;
break;
}
if (!n) return t[r];
n = !1;
}
}
var s = new o.AggregatedMetricCounter(e);
return t.push(s), s;
}),
(e.prototype._trackRequestMetrics = function () {
for (var t = 0; t < e._requestCountersCollection.length; t++) {
var n = e._requestCountersCollection[t];
n.time = +new Date();
var r = n.totalCount - n.lastTotalCount || 0,
o = n.time - n.lastTime,
s =
(n.intervalExecutionTime - n.lastIntervalExecutionTime) /
r || 0;
(n.lastIntervalExecutionTime = n.intervalExecutionTime),
o > 0 &&
r > 0 &&
this._trackPreAggregatedMetric({
name: "Server response time",
dimensions: n.dimensions,
value: s,
count: r,
aggregationInterval: o,
metricType: i.MetricId.REQUESTS_DURATION,
}),
(n.lastTotalCount = n.totalCount),
(n.lastTime = n.time);
}
}),
(e.prototype._trackDependencyMetrics = function () {
for (
var t = 0;
t < e._dependencyCountersCollection.length;
t++
) {
var n = e._dependencyCountersCollection[t];
n.time = +new Date();
var r = n.totalCount - n.lastTotalCount || 0,
o = n.time - n.lastTime,
s =
(n.intervalExecutionTime - n.lastIntervalExecutionTime) /
r || 0;
(n.lastIntervalExecutionTime = n.intervalExecutionTime),
o > 0 &&
r > 0 &&
this._trackPreAggregatedMetric({
name: "Dependency duration",
dimensions: n.dimensions,
value: s,
count: r,
aggregationInterval: o,
metricType: i.MetricId.DEPENDENCIES_DURATION,
}),
(n.lastTotalCount = n.totalCount),
(n.lastTime = n.time);
}
}),
(e.prototype._trackExceptionMetrics = function () {
for (
var t = 0;
t < e._exceptionCountersCollection.length;
t++
) {
var n = e._exceptionCountersCollection[t];
n.time = +new Date();
var r = n.totalCount - n.lastTotalCount || 0,
o = n.time - n.lastTime;
o > 0 &&
r > 0 &&
this._trackPreAggregatedMetric({
name: "Exceptions",
dimensions: n.dimensions,
value: r,
count: r,
aggregationInterval: o,
metricType: i.MetricId.EXCEPTIONS_COUNT,
}),
(n.lastTotalCount = n.totalCount),
(n.lastTime = n.time);
}
}),
(e.prototype._trackTraceMetrics = function () {
for (var t = 0; t < e._traceCountersCollection.length; t++) {
var n = e._traceCountersCollection[t];
n.time = +new Date();
var r = n.totalCount - n.lastTotalCount || 0,
o = n.time - n.lastTime;
o > 0 &&
r > 0 &&
this._trackPreAggregatedMetric({
name: "Traces",
dimensions: n.dimensions,
value: r,
count: r,
aggregationInterval: o,
metricType: i.MetricId.TRACES_COUNT,
}),
(n.lastTotalCount = n.totalCount),
(n.lastTime = n.time);
}
}),
(e.prototype._trackPreAggregatedMetric = function (e) {
var t = {};
for (var n in e.dimensions)
t[s.PreaggregatedMetricPropertyNames[n]] = e.dimensions[n];
t = r(r({}, t), {
"_MS.MetricId": e.metricType,
"_MS.AggregationIntervalMs": String(e.aggregationInterval),
"_MS.IsAutocollected": "True",
});
var i = {
name: e.name,
value: e.value,
count: e.count,
properties: t,
kind: "Aggregation",
};
this._client.trackMetric(i);
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1);
}),
e
);
})();
e.exports = a;
},
13054: (e) => {
"use strict";
var t = (function () {
function e() {}
return (
(e.prototype.getUrl = function () {
return this.url;
}),
(e.prototype.RequestParser = function () {
this.startTime = +new Date();
}),
(e.prototype._setStatus = function (e, t) {
var n = +new Date();
(this.duration = n - this.startTime), (this.statusCode = e);
var r = this.properties || {};
if (t)
if ("string" == typeof t) r.error = t;
else if (t instanceof Error) r.error = t.message;
else if ("object" == typeof t)
for (var i in t)
r[i] = t[i] && t[i].toString && t[i].toString();
this.properties = r;
}),
(e.prototype._isSuccess = function () {
return 0 < this.statusCode && this.statusCode < 400;
}),
e
);
})();
e.exports = t;
},
49004: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
},
i =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
o =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
s = n(22037),
a = n(99813),
c = n(95282),
l = n(82588),
u = n(63580),
p = n(55290),
d = n(32713),
h = n(69253),
f = n(54470),
m = n(64555),
g = n(25740),
y = (function () {
function e(e, t) {
(this._attach = u.StatsbeatAttach.sdk),
(this._feature = u.StatsbeatFeature.NONE),
(this._instrumentation = u.StatsbeatInstrumentation.NONE),
(this._isInitialized = !1),
(this._statbeatMetrics = []),
(this._networkStatsbeatCollection = []),
(this._config = e),
(this._context = t || new f());
var n = this._getConnectionString(e);
(this._statsbeatConfig = new h(n)),
(this._statsbeatConfig.samplingPercentage = 100),
(this._sender = new l(
this._statsbeatConfig,
null,
null,
null,
null,
!0,
this._shutdownStatsbeat.bind(this),
));
}
return (
(e.prototype.enable = function (t) {
var n = this;
(this._isEnabled = t),
this._isEnabled &&
!this._isInitialized &&
(this._getCustomProperties(), (this._isInitialized = !0)),
t
? (this._handle ||
((this._handle = setInterval(function () {
n.trackShortIntervalStatsbeats();
}, e.STATS_COLLECTION_SHORT_INTERVAL)),
this._handle.unref()),
this._longHandle ||
(this.trackLongIntervalStatsbeats(),
(this._longHandle = setInterval(function () {
n.trackLongIntervalStatsbeats();
}, e.STATS_COLLECTION_LONG_INTERVAL)),
this._longHandle.unref()))
: (this._handle &&
(clearInterval(this._handle), (this._handle = null)),
this._longHandle &&
(clearInterval(this._longHandle),
(this._longHandle = null)));
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype.isEnabled = function () {
return this._isEnabled;
}),
(e.prototype.setCodelessAttach = function () {
this._attach = u.StatsbeatAttach.codeless;
}),
(e.prototype.addFeature = function (e) {
this._feature |= e;
}),
(e.prototype.removeFeature = function (e) {
this._feature &= ~e;
}),
(e.prototype.addInstrumentation = function (e) {
this._instrumentation |= e;
}),
(e.prototype.removeInstrumentation = function (e) {
this._instrumentation &= ~e;
}),
(e.prototype.countRequest = function (e, t, n, r, i) {
if (this.isEnabled()) {
var o = this._getNetworkStatsbeatCounter(e, t);
if (
(o.totalRequestCount++,
(o.intervalRequestExecutionTime += n),
!1 === r)
) {
if (!i) return;
var s = o.totalFailedRequestCount.find(function (e) {
return i === e.statusCode;
});
s
? s.count++
: o.totalFailedRequestCount.push({
statusCode: i,
count: 1,
});
} else o.totalSuccesfulRequestCount++;
}
}),
(e.prototype.countException = function (e, t, n) {
if (this.isEnabled()) {
var r = this._getNetworkStatsbeatCounter(e, t),
i = r.exceptionCount.find(function (e) {
return n.name === e.exceptionType;
});
i
? i.count++
: r.exceptionCount.push({
exceptionType: n.name,
count: 1,
});
}
}),
(e.prototype.countThrottle = function (e, t, n) {
if (this.isEnabled()) {
var r = this._getNetworkStatsbeatCounter(e, t),
i = r.throttleCount.find(function (e) {
return n === e.statusCode;
});
i
? i.count++
: r.throttleCount.push({ statusCode: n, count: 1 });
}
}),
(e.prototype.countRetry = function (e, t, n) {
if (this.isEnabled()) {
var r = this._getNetworkStatsbeatCounter(e, t),
i = r.retryCount.find(function (e) {
return n === e.statusCode;
});
i
? i.count++
: r.retryCount.push({ statusCode: n, count: 1 });
}
}),
(e.prototype.trackShortIntervalStatsbeats = function () {
return i(this, void 0, void 0, function () {
var t, n;
return o(this, function (r) {
switch (r.label) {
case 0:
return (
r.trys.push([0, 3, , 4]),
[4, this._getResourceProvider()]
);
case 1:
return (
r.sent(),
(t = {
os: this._os,
rp: this._resourceProvider,
cikey: this._cikey,
runtimeVersion: this._runtimeVersion,
language: this._language,
version: this._sdkVersion,
attach: this._attach,
}),
this._trackRequestDuration(t),
this._trackRequestsCount(t),
[4, this._sendStatsbeats()]
);
case 2:
return r.sent(), [3, 4];
case 3:
return (
(n = r.sent()),
c.info(
e.TAG,
"Failed to send Statsbeat metrics: " + g.dumpObj(n),
),
[3, 4]
);
case 4:
return [2];
}
});
});
}),
(e.prototype.trackLongIntervalStatsbeats = function () {
return i(this, void 0, void 0, function () {
var t, n, r, i, s;
return o(this, function (o) {
switch (o.label) {
case 0:
return (
o.trys.push([0, 3, , 4]),
[4, this._getResourceProvider()]
);
case 1:
return (
o.sent(),
(t = {
os: this._os,
rp: this._resourceProvider,
cikey: this._cikey,
runtimeVersion: this._runtimeVersion,
language: this._language,
version: this._sdkVersion,
attach: this._attach,
}),
(n = Object.assign(
{ rpId: this._resourceIdentifier },
t,
)),
this._statbeatMetrics.push({
name: u.StatsbeatCounter.ATTACH,
value: 1,
properties: n,
}),
this._instrumentation !=
u.StatsbeatInstrumentation.NONE &&
((r = Object.assign(
{
feature: this._instrumentation,
type: u.StatsbeatFeatureType.Instrumentation,
},
t,
)),
this._statbeatMetrics.push({
name: u.StatsbeatCounter.FEATURE,
value: 1,
properties: r,
})),
this._feature != u.StatsbeatFeature.NONE &&
((i = Object.assign(
{
feature: this._feature,
type: u.StatsbeatFeatureType.Feature,
},
t,
)),
this._statbeatMetrics.push({
name: u.StatsbeatCounter.FEATURE,
value: 1,
properties: i,
})),
[4, this._sendStatsbeats()]
);
case 2:
return o.sent(), [3, 4];
case 3:
return (
(s = o.sent()),
c.info(
e.TAG,
"Failed to send Statsbeat metrics: " + g.dumpObj(s),
),
[3, 4]
);
case 4:
return [2];
}
});
});
}),
(e.prototype._getNetworkStatsbeatCounter = function (e, t) {
for (
var n = this._getShortHost(t), r = 0;
r < this._networkStatsbeatCollection.length;
r++
)
if (
e === this._networkStatsbeatCollection[r].endpoint &&
n === this._networkStatsbeatCollection[r].host
)
return this._networkStatsbeatCollection[r];
var i = new m.NetworkStatsbeat(e, n);
return this._networkStatsbeatCollection.push(i), i;
}),
(e.prototype._trackRequestDuration = function (e) {
for (
var t = 0;
t < this._networkStatsbeatCollection.length;
t++
) {
var n = this._networkStatsbeatCollection[t];
n.time = +new Date();
var r = n.totalRequestCount - n.lastRequestCount || 0,
i =
n.intervalRequestExecutionTime -
n.lastIntervalRequestExecutionTime,
o = (i > 0 && i / r) || 0;
if (
((n.lastIntervalRequestExecutionTime =
n.intervalRequestExecutionTime),
r > 0)
) {
var s = Object.assign(
{
endpoint: this._networkStatsbeatCollection[t].endpoint,
host: this._networkStatsbeatCollection[t].host,
},
e,
);
this._statbeatMetrics.push({
name: u.StatsbeatCounter.REQUEST_DURATION,
value: o,
properties: s,
});
}
(n.lastRequestCount = n.totalRequestCount),
(n.lastTime = n.time);
}
}),
(e.prototype._getShortHost = function (e) {
var t = e;
try {
var n = new RegExp(/^https?:\/\/(?:www\.)?([^\/.-]+)/).exec(
e,
);
null != n && n.length > 1 && (t = n[1]),
(t = t.replace(".in.applicationinsights.azure.com", ""));
} catch (e) {}
return t;
}),
(e.prototype._trackRequestsCount = function (e) {
for (
var t,
n = this,
i = function (i) {
t = o._networkStatsbeatCollection[i];
var s = Object.assign(
{ endpoint: t.endpoint, host: t.host },
e,
);
t.totalSuccesfulRequestCount > 0 &&
(o._statbeatMetrics.push({
name: u.StatsbeatCounter.REQUEST_SUCCESS,
value: t.totalSuccesfulRequestCount,
properties: s,
}),
(t.totalSuccesfulRequestCount = 0)),
t.totalFailedRequestCount.length > 0 &&
(t.totalFailedRequestCount.forEach(function (e) {
(s = Object.assign(
r(r({}, s), { statusCode: e.statusCode }),
)),
n._statbeatMetrics.push({
name: u.StatsbeatCounter.REQUEST_FAILURE,
value: e.count,
properties: s,
});
}),
(t.totalFailedRequestCount = [])),
t.retryCount.length > 0 &&
(t.retryCount.forEach(function (e) {
(s = Object.assign(
r(r({}, s), { statusCode: e.statusCode }),
)),
n._statbeatMetrics.push({
name: u.StatsbeatCounter.RETRY_COUNT,
value: e.count,
properties: s,
});
}),
(t.retryCount = [])),
t.throttleCount.length > 0 &&
(t.throttleCount.forEach(function (e) {
(s = Object.assign(
r(r({}, s), { statusCode: e.statusCode }),
)),
n._statbeatMetrics.push({
name: u.StatsbeatCounter.THROTTLE_COUNT,
value: e.count,
properties: s,
});
}),
(t.throttleCount = [])),
t.exceptionCount.length > 0 &&
(t.exceptionCount.forEach(function (e) {
(s = Object.assign(
r(r({}, s), { exceptionType: e.exceptionType }),
)),
n._statbeatMetrics.push({
name: u.StatsbeatCounter.EXCEPTION_COUNT,
value: e.count,
properties: s,
});
}),
(t.exceptionCount = []));
},
o = this,
s = 0;
s < this._networkStatsbeatCollection.length;
s++
)
i(s);
}),
(e.prototype._sendStatsbeats = function () {
return i(this, void 0, void 0, function () {
var e, t, n, r;
return o(this, function (i) {
switch (i.label) {
case 0:
for (
e = [], t = 0;
t < this._statbeatMetrics.length;
t++
)
(n = {
name: this._statbeatMetrics[t].name,
value: this._statbeatMetrics[t].value,
properties: this._statbeatMetrics[t].properties,
}),
((r = a.createEnvelope(
n,
p.TelemetryType.Metric,
null,
this._context,
this._statsbeatConfig,
)).name = u.StatsbeatTelemetryName),
e.push(r);
return (
(this._statbeatMetrics = []),
[4, this._sender.send(e)]
);
case 1:
return i.sent(), [2];
}
});
});
}),
(e.prototype._getCustomProperties = function () {
(this._language = "node"),
(this._cikey = this._config.instrumentationKey),
(this._sdkVersion = f.sdkVersion),
(this._os = s.type()),
(this._runtimeVersion = process.version);
}),
(e.prototype._getResourceProvider = function () {
var e = this;
return new Promise(function (t, n) {
var r = !1;
(e._resourceProvider = u.StatsbeatResourceProvider.unknown),
(e._resourceIdentifier =
u.StatsbeatResourceProvider.unknown),
process.env.WEBSITE_SITE_NAME
? ((e._resourceProvider =
u.StatsbeatResourceProvider.appsvc),
(e._resourceIdentifier = process.env.WEBSITE_SITE_NAME),
process.env.WEBSITE_HOME_STAMPNAME &&
(e._resourceIdentifier +=
"/" + process.env.WEBSITE_HOME_STAMPNAME))
: process.env.FUNCTIONS_WORKER_RUNTIME
? ((e._resourceProvider =
u.StatsbeatResourceProvider.functions),
process.env.WEBSITE_HOSTNAME &&
(e._resourceIdentifier =
process.env.WEBSITE_HOSTNAME))
: e._config &&
(void 0 === e._isVM || 1 == e._isVM
? ((r = !0),
d.AzureVirtualMachine.getAzureComputeMetadata(
e._config,
function (n) {
(e._isVM = n.isVM),
e._isVM &&
((e._resourceProvider =
u.StatsbeatResourceProvider.vm),
(e._resourceIdentifier =
n.id + "/" + n.subscriptionId),
n.osType && (e._os = n.osType)),
t();
},
))
: (e._resourceProvider =
u.StatsbeatResourceProvider.unknown)),
r || t();
});
}),
(e.prototype._shutdownStatsbeat = function () {
this.enable(!1);
}),
(e.prototype._getConnectionString = function (t) {
for (
var n = t.endpointUrl,
r = [
"westeurope",
"northeurope",
"francecentral",
"francesouth",
"germanywestcentral",
"norwayeast",
"norwaywest",
"swedencentral",
"switzerlandnorth",
"switzerlandwest",
"uksouth",
"ukwest",
],
i = 0;
i < r.length;
i++
)
if (n.indexOf(r[i]) > -1) return e.EU_CONNECTION_STRING;
return e.NON_EU_CONNECTION_STRING;
}),
(e.NON_EU_CONNECTION_STRING =
"InstrumentationKey=c4a29126-a7cb-47e5-b348-11414998b11e;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com"),
(e.EU_CONNECTION_STRING =
"InstrumentationKey=7dc56bab-3c0c-4e9f-9ebb-d1acadee8d0f;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com"),
(e.STATS_COLLECTION_SHORT_INTERVAL = 9e5),
(e.STATS_COLLECTION_LONG_INTERVAL = 864e5),
(e.TAG = "Statsbeat"),
e
);
})();
e.exports = y;
},
11918: (e, t, n) => {
"use strict";
var r = n(13685),
i = n(95687),
o = n(59796),
s = n(95282),
a = n(82570),
c = n(40095),
l = n(63580),
u = n(55158),
p = n(40166),
d = (function () {
function e(t) {
var n;
if (((this._isIkeyValid = !0), e.INSTANCE))
throw new Error(
"Web snippet injection should be configured from the applicationInsights object",
);
(e.INSTANCE = this),
(e._aiUrl = l.WEB_INSTRUMENTATION_DEFAULT_SOURCE),
(e._aiDeprecatedUrl = l.WEB_INSTRUMENTATION_DEPRECATED_SOURCE);
var r = this._getWebSnippetIkey(
null === (n = t.config) || void 0 === n
? void 0
: n.webInstrumentationConnectionString,
);
(this._webInstrumentationIkey = r || t.config.instrumentationKey),
(this._clientWebInstrumentationConfig =
t.config.webInstrumentationConfig),
(this._clientWebInstrumentationSrc =
t.config.webInstrumentationSrc),
(this._statsbeat = t.getStatsbeat());
}
return (
(e.prototype.enable = function (t, n) {
(this._isEnabled = t),
(this._webInstrumentationIkey =
this._getWebSnippetIkey(n) || this._webInstrumentationIkey),
(e._snippet = this._getWebInstrumentationReplacedStr()),
this._isEnabled && !this._isInitialized && this._isIkeyValid
? (this._statsbeat &&
this._statsbeat.addFeature(
l.StatsbeatFeature.WEB_SNIPPET,
),
this._initialize())
: this._isEnabled ||
(this._statsbeat &&
this._statsbeat.removeFeature(
l.StatsbeatFeature.WEB_SNIPPET,
));
}),
(e.prototype.isInitialized = function () {
return this._isInitialized;
}),
(e.prototype._getWebSnippetIkey = function (e) {
var t = null;
try {
var n = u.parse(e).instrumentationkey || "";
u.isIkeyValid(n)
? ((this._isIkeyValid = !0), (t = n))
: ((this._isIkeyValid = !1),
s.info(
"Invalid web Instrumentation connection string, web Instrumentation is not enabled.",
));
} catch (e) {
s.info("get web snippet ikey error: " + e);
}
return t;
}),
(e.prototype._getWebInstrumentationReplacedStr = function () {
var e = this._getClientWebInstrumentationConfigStr(
this._clientWebInstrumentationConfig,
),
t = c.getOsPrefix(),
n = c.getResourceProvider(),
r =
this._webInstrumentationIkey +
'",\r\n' +
e +
' disableIkeyDeprecationMessage: true,\r\n sdkExtension: "' +
n +
t +
"d_n_",
i = p.webSnippet.replace("INSTRUMENTATION_KEY", r);
return this._clientWebInstrumentationSrc
? i.replace(
l.WEB_INSTRUMENTATION_DEFAULT_SOURCE + ".2.min.js",
this._clientWebInstrumentationSrc,
)
: i;
}),
(e.prototype._getClientWebInstrumentationConfigStr = function (
e,
) {
var t = "";
try {
null != e &&
e.length > 0 &&
e.forEach(function (e) {
var n = e.name;
if (void 0 !== n) {
var r = e.value;
switch (typeof r) {
case "function":
case "object":
break;
case "string":
t += " " + n + ': "' + r + '",\r\n';
break;
default:
t += " " + n + ": " + r + ",\r\n";
}
}
});
} catch (e) {
(this._isEnabled = !1),
s.info(
"Parse client web instrumentation error. Web Instrumentation is disabled",
);
}
return t;
}),
(e.prototype._initialize = function () {
this._isInitialized = !0;
var t = r.createServer,
n = i.createServer,
o = this._isEnabled;
(r.createServer = function (n) {
var r = n;
return (
r &&
(n = function (t, n) {
var i = n.write,
c = "GET" == t.method;
n.write = function (t, r, l) {
try {
if (o && c) {
var u = a.getContentEncodingFromHeaders(n),
p = void 0;
if (("string" == typeof r && (p = r), null == u))
e.INSTANCE.ValidateInjection(n, t) &&
(arguments[0] = e.INSTANCE.InjectWebSnippet(
n,
t,
void 0,
p,
));
else if (u.length) {
var d = u[0];
arguments[0] = e.INSTANCE.InjectWebSnippet(
n,
t,
d,
);
}
}
} catch (e) {
s.warn("Inject snippet error: " + e);
}
return i.apply(n, arguments);
};
var l = n.end;
return (
(n.end = function (t, r, i) {
if (o && c)
try {
if (o && c) {
var u = a.getContentEncodingFromHeaders(n),
p = void 0;
if (
("string" == typeof r && (p = r), null == u)
)
e.INSTANCE.ValidateInjection(n, t) &&
(arguments[0] =
e.INSTANCE.InjectWebSnippet(
n,
t,
void 0,
p,
));
else if (u.length) {
var d = u[0];
arguments[0] = e.INSTANCE.InjectWebSnippet(
n,
t,
d,
);
}
}
} catch (e) {
s.warn("Inject snipet error: " + e);
}
return l.apply(n, arguments);
}),
r(t, n)
);
}),
t(n)
);
}),
(i.createServer = function (t, r) {
var i = r;
if (i)
return (
(r = function (t, n) {
var r = "GET" == t.method,
c = n.write,
l = n.end;
return (
(n.write = function (t, i, l) {
try {
if (o && r) {
var u = a.getContentEncodingFromHeaders(n),
p = void 0;
if (
("string" == typeof i && (p = i), null == u)
)
e.INSTANCE.ValidateInjection(n, t) &&
(arguments[0] = this.InjectWebSnippet(
n,
t,
void 0,
p,
));
else if (u.length) {
var d = u[0];
arguments[0] = e.INSTANCE.InjectWebSnippet(
n,
t,
d,
);
}
}
} catch (e) {
s.warn("Inject snippet error: " + e);
}
return c.apply(n, arguments);
}),
(n.end = function (t, i, c) {
try {
if (o && r) {
var u = a.getContentEncodingFromHeaders(n),
p = void 0;
if (
("string" == typeof i && (p = i), null == u)
)
e.INSTANCE.ValidateInjection(n, t) &&
(arguments[0] =
e.INSTANCE.InjectWebSnippet(
n,
t,
void 0,
p,
));
else if (u.length) {
var d = u[0];
arguments[0] = e.INSTANCE.InjectWebSnippet(
n,
t,
d,
);
}
}
} catch (e) {
s.warn("Inject snippet error: " + e);
}
return l.apply(n, arguments);
}),
i(t, n)
);
}),
n(t, r)
);
});
}),
(e.prototype.ValidateInjection = function (t, n) {
try {
if (!t || !n || 200 != t.statusCode) return !1;
if (!a.isContentTypeHeaderHtml(t)) return !1;
var r = n.slice().toString();
if (
r.indexOf("<head>") >= 0 &&
r.indexOf("</head>") >= 0 &&
r.indexOf(e._aiUrl) < 0 &&
r.indexOf(e._aiDeprecatedUrl) < 0
)
return !0;
} catch (e) {
s.info("validate injections error: " + e);
}
return !1;
}),
(e.prototype.InjectWebSnippet = function (t, n, r, i) {
try {
if (r)
t.removeHeader("Content-Length"),
(n = this._getInjectedCompressBuffer(t, n, r)),
t.setHeader("Content-Length", n.length);
else {
var o = n.toString(),
c = o.indexOf("</head>");
if (c < 0) return n;
var l = a.insertSnippetByIndex(c, o, e._snippet);
if ("string" == typeof n)
t.removeHeader("Content-Length"),
(n = l),
t.setHeader("Content-Length", Buffer.byteLength(n));
else if (Buffer.isBuffer(n)) {
var u = i || "utf8";
if (a.isBufferType(n, u)) {
t.removeHeader("Content-Length");
var p = Buffer.from(l).toString(u);
(n = Buffer.from(p, u)),
t.setHeader("Content-Length", n.length);
}
}
}
} catch (e) {
s.warn(
"Failed to inject web snippet and change content-lenght headers. Exception:" +
e,
);
}
return n;
}),
(e.prototype._getInjectedCompressBuffer = function (e, t, n) {
try {
switch (n) {
case a.contentEncodingMethod.GZIP:
var r = o.gunzipSync(t);
if (this.ValidateInjection(e, r)) {
var i = this.InjectWebSnippet(e, r);
t = o.gzipSync(i);
}
break;
case a.contentEncodingMethod.DEFLATE:
var c = o.inflateSync(t);
if (this.ValidateInjection(e, c)) {
var l = this.InjectWebSnippet(e, c);
t = o.deflateSync(l);
}
break;
case a.contentEncodingMethod.BR:
var u = a.getBrotliDecompressSync(o),
p = a.getBrotliCompressSync(o);
if (u && p) {
var d = u(t);
this.ValidateInjection(e, d) &&
(t = p(this.InjectWebSnippet(e, d)));
break;
}
}
} catch (e) {
s.info("get web injection compress buffer error: " + e);
}
return t;
}),
(e.prototype.dispose = function () {
(e.INSTANCE = null),
this.enable(!1),
(this._isInitialized = !1);
}),
e
);
})();
e.exports = d;
},
60211: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.parseEventHubSpan = void 0);
var i = n(94284),
o = n(47593),
s = n(47480),
a = n(63580);
t.parseEventHubSpan = function (e, t) {
var n,
c = e.attributes[a.AzNamespace],
l = (
e.attributes[s.SemanticAttributes.NET_PEER_NAME] ||
e.attributes["peer.address"] ||
"unknown"
).replace(/\/$/g, ""),
u = e.attributes[a.MessageBusDestination] || "unknown";
switch (e.kind) {
case i.SpanKind.CLIENT:
(t.dependencyTypeName = c), (t.target = l + "/" + u);
break;
case i.SpanKind.PRODUCER:
(t.dependencyTypeName =
a.DependencyTypeName.QueueMessage + " | " + c),
(t.target = l + "/" + u);
break;
case i.SpanKind.CONSUMER:
(t.source = l + "/" + u),
(t.measurements = r(
r({}, t.measurements),
(((n = {})[a.TIME_SINCE_ENQUEUED] = (function (e) {
var t = 0,
n = 0,
r = o.hrTimeToMilliseconds(e.startTime);
return (
e.links.forEach(function (e) {
var i = e.attributes,
o = null == i ? void 0 : i[a.ENQUEUED_TIME];
o &&
((t += 1),
(n += r - (parseFloat(o.toString()) || 0)));
}),
Math.max(n / (t || 1), 0)
);
})(e)),
n),
));
}
};
},
65946: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.spanToTelemetryContract = void 0);
var r = n(57310),
i = n(94284),
o = n(47480),
s = n(63580),
a = n(60211),
c = n(25740);
function l(e) {
if (e.attributes[o.SemanticAttributes.HTTP_METHOD]) {
var t = e.attributes[o.SemanticAttributes.HTTP_URL];
if (t) return String(t);
var n = e.attributes[o.SemanticAttributes.HTTP_SCHEME],
r = e.attributes[o.SemanticAttributes.HTTP_TARGET];
if (n && r) {
var i = e.attributes[o.SemanticAttributes.HTTP_HOST];
if (i) return n + "://" + i + r;
var s = e.attributes[o.SemanticAttributes.NET_PEER_PORT];
if (s) {
var a = e.attributes[o.SemanticAttributes.NET_PEER_NAME];
if (a) return n + "://" + a + ":" + s + r;
var c = e.attributes[o.SemanticAttributes.NET_PEER_IP];
if (c) return n + "://" + c + ":" + s + r;
}
}
}
return "";
}
function u(e) {
var t = e.attributes[o.SemanticAttributes.PEER_SERVICE],
n = e.attributes[o.SemanticAttributes.HTTP_HOST],
r = e.attributes[o.SemanticAttributes.HTTP_URL],
i = e.attributes[o.SemanticAttributes.NET_PEER_NAME],
s = e.attributes[o.SemanticAttributes.NET_PEER_IP];
return t
? String(t)
: n
? String(n)
: r
? String(r)
: i
? String(i)
: s
? String(s)
: "";
}
t.spanToTelemetryContract = function (e) {
var t;
switch (e.kind) {
case i.SpanKind.CLIENT:
case i.SpanKind.PRODUCER:
case i.SpanKind.INTERNAL:
t = (function (e) {
var t = {
name: e.name,
success: e.status.code != i.SpanStatusCode.ERROR,
resultCode: "0",
duration: 0,
data: "",
dependencyTypeName: "",
};
e.kind === i.SpanKind.PRODUCER &&
(t.dependencyTypeName = s.DependencyTypeName.QueueMessage),
e.kind === i.SpanKind.INTERNAL &&
e.parentSpanId &&
(t.dependencyTypeName = s.DependencyTypeName.InProc);
var n = e.attributes[o.SemanticAttributes.HTTP_METHOD],
a = e.attributes[o.SemanticAttributes.DB_SYSTEM],
c = e.attributes[o.SemanticAttributes.RPC_SYSTEM];
if (n) {
t.dependencyTypeName = s.DependencyTypeName.Http;
var p = e.attributes[o.SemanticAttributes.HTTP_URL];
if (p) {
var d = "";
try {
d = new r.URL(String(p)).pathname;
} catch (e) {}
t.name = n + " " + d;
}
t.data = l(e);
var h = e.attributes[o.SemanticAttributes.HTTP_STATUS_CODE];
if ((h && (t.resultCode = String(h)), (v = u(e)))) {
try {
var f = new RegExp(/(https?)(:\/\/.*)(:\d+)(\S*)/).exec(
v,
);
if (null != f) {
var m = f[1],
g = f[3];
(("https" == m && ":443" == g) ||
("http" == m && ":80" == g)) &&
(v = f[1] + f[2] + f[4]);
}
} catch (e) {}
t.target = "" + v;
}
} else if (a) {
String(a) === o.DbSystemValues.MYSQL
? (t.dependencyTypeName = "mysql")
: String(a) === o.DbSystemValues.POSTGRESQL
? (t.dependencyTypeName = "postgresql")
: String(a) === o.DbSystemValues.MONGODB
? (t.dependencyTypeName = "mongodb")
: String(a) === o.DbSystemValues.REDIS
? (t.dependencyTypeName = "redis")
: (function (e) {
return (
e === o.DbSystemValues.DB2 ||
e === o.DbSystemValues.DERBY ||
e === o.DbSystemValues.MARIADB ||
e === o.DbSystemValues.MSSQL ||
e === o.DbSystemValues.ORACLE ||
e === o.DbSystemValues.SQLITE ||
e === o.DbSystemValues.OTHER_SQL ||
e === o.DbSystemValues.HSQLDB ||
e === o.DbSystemValues.H2
);
})(String(a))
? (t.dependencyTypeName = "SQL")
: (t.dependencyTypeName = String(a));
var y = e.attributes[o.SemanticAttributes.DB_STATEMENT],
_ = e.attributes[o.SemanticAttributes.DB_OPERATION];
y ? (t.data = String(y)) : _ && (t.data = String(_));
var v = u(e),
b = e.attributes[o.SemanticAttributes.DB_NAME];
t.target = v
? b
? v + "|" + b
: "" + v
: b
? "" + b
: "" + a;
} else if (c) {
t.dependencyTypeName = s.DependencyTypeName.Grpc;
var E =
e.attributes[o.SemanticAttributes.RPC_GRPC_STATUS_CODE];
E && (t.resultCode = String(E)),
(v = u(e))
? (t.target = "" + v)
: c && (t.target = String(c));
}
return t;
})(e);
break;
case i.SpanKind.SERVER:
case i.SpanKind.CONSUMER:
t = (function (e) {
var t = {
name: e.name,
success: e.status.code != i.SpanStatusCode.ERROR,
resultCode: "0",
duration: 0,
url: "",
source: void 0,
},
n = e.attributes[o.SemanticAttributes.HTTP_METHOD],
s = e.attributes[o.SemanticAttributes.RPC_GRPC_STATUS_CODE];
if (n) {
if (e.kind == i.SpanKind.SERVER) {
var a = e.attributes[o.SemanticAttributes.HTTP_ROUTE],
c = e.attributes[o.SemanticAttributes.HTTP_URL];
if (a) t.name = n + " " + a;
else if (c)
try {
var u = new r.URL(String(c));
t.name = n + " " + u.pathname;
} catch (e) {}
}
t.url = l(e);
var p = e.attributes[o.SemanticAttributes.HTTP_STATUS_CODE];
p && (t.resultCode = String(p));
} else s && (t.resultCode = String(s));
return t;
})(e);
}
var n = "" + (e.spanContext ? e.spanContext() : e.context()).spanId,
p = Math.round(1e3 * e.duration[0] + e.duration[1] / 1e6);
return (
(t.id = n),
(t.duration = p),
(t.properties = (function (e) {
for (
var t = {}, n = 0, r = Object.keys(e.attributes);
n < r.length;
n++
) {
var i = r[n];
i.startsWith("http.") ||
i.startsWith("rpc.") ||
i.startsWith("db.") ||
i.startsWith("peer.") ||
i.startsWith("net.") ||
(t[i] = e.attributes[i]);
}
var o = e.links.map(function (e) {
return {
operation_Id: e.context.traceId,
id: e.context.spanId,
};
});
return o.length > 0 && (t["_MS.links"] = c.stringify(o)), t;
})(e)),
e.attributes[s.AzNamespace] &&
(e.kind === i.SpanKind.INTERNAL &&
(t.dependencyTypeName =
s.DependencyTypeName.InProc +
" | " +
e.attributes[s.AzNamespace]),
e.attributes[s.AzNamespace] === s.MicrosoftEventHub &&
a.parseEventHubSpan(e, t)),
t
);
};
},
89879: (e, t, n) => {
"use strict";
t.wp = t.qP = void 0;
var r = n(94284),
i = n(63580),
o = n(84953),
s = n(65946),
a = n(20699),
c = [];
(t.qP = function (e) {
try {
var t = e.data,
n = s.spanToTelemetryContract(t);
a.AsyncScopeManager.with(t, function () {
c.forEach(function (e) {
t.kind === r.SpanKind.SERVER || t.kind === r.SpanKind.CONSUMER
? e.trackRequest(n)
: (t.kind !== r.SpanKind.CLIENT &&
t.kind !== r.SpanKind.INTERNAL &&
t.kind !== r.SpanKind.PRODUCER) ||
e.trackDependency(n);
});
});
} catch (e) {}
}),
(t.wp = function (e, n) {
if (e) {
if (
c.find(function (e) {
return e == n;
})
)
return;
0 === c.length &&
o.channel.subscribe(
"azure-coretracing",
t.qP,
o.trueFilter,
function (e, t) {
var r = n.getStatsbeat();
r &&
r.addInstrumentation(
i.StatsbeatInstrumentation.AZURE_CORE_TRACING,
);
},
),
c.push(n);
} else
0 ===
(c = c.filter(function (e) {
return e != n;
})).length && o.channel.unsubscribe("azure-coretracing", t.qP);
});
},
35823: (e, t, n) => {
"use strict";
t.wp = void 0;
var r = n(55290),
i = n(63580),
o = n(84953),
s = [],
a = {
10: r.SeverityLevel.Verbose,
20: r.SeverityLevel.Verbose,
30: r.SeverityLevel.Information,
40: r.SeverityLevel.Warning,
50: r.SeverityLevel.Error,
60: r.SeverityLevel.Critical,
},
c = function (e) {
var t = e.data.result,
n = a[e.data.level];
s.forEach(function (e) {
try {
var r = JSON.parse(t);
if (r.err) {
var i = new Error(r.err.message);
return (
(i.name = r.err.name),
(i.stack = r.err.stack),
e.config.enableLoggerErrorToTrace
? void e.trackTrace({ message: t, severity: n })
: void e.trackException({ exception: i })
);
}
} catch (e) {}
e.trackTrace({ message: t, severity: n });
});
};
t.wp = function (e, t) {
if (e) {
if (
s.find(function (e) {
return e == t;
})
)
return;
0 === s.length &&
o.channel.subscribe("bunyan", c, o.trueFilter, function (e, n) {
var r = t.getStatsbeat();
r && r.addInstrumentation(i.StatsbeatInstrumentation.BUNYAN);
}),
s.push(t);
} else
0 ===
(s = s.filter(function (e) {
return e != t;
})).length && o.channel.unsubscribe("bunyan", c);
};
},
14309: (e, t, n) => {
"use strict";
t.wp = void 0;
var r = n(55290),
i = n(63580),
o = n(84953),
s = [],
a = function (e) {
var t = e.data.message;
s.forEach(function (n) {
t instanceof Error && !n.config.enableLoggerErrorToTrace
? n.trackException({ exception: t })
: t instanceof Error
? n.trackTrace({
message: t.toString(),
severity: e.data.stderr
? r.SeverityLevel.Error
: r.SeverityLevel.Information,
})
: (t.lastIndexOf("\n") == t.length - 1 &&
(t = t.substring(0, t.length - 1)),
n.trackTrace({
message: t,
severity: e.data.stderr
? r.SeverityLevel.Warning
: r.SeverityLevel.Information,
}));
});
};
t.wp = function (e, t) {
if (e) {
if (
s.find(function (e) {
return e == t;
})
)
return;
0 === s.length &&
o.channel.subscribe("console", a, o.trueFilter, function (e, n) {
var r = t.getStatsbeat();
r && r.addInstrumentation(i.StatsbeatInstrumentation.CONSOLE);
}),
s.push(t);
} else
0 ===
(s = s.filter(function (e) {
return e != t;
})).length && o.channel.unsubscribe("console", a);
};
},
87396: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.registerContextPreservation = t.IsInitialized = void 0);
var r = n(95282),
i = n(3063);
t.IsInitialized = !i.JsonConfig.getInstance().noDiagnosticChannel;
var o = "DiagnosticChannel";
if (t.IsInitialized) {
var s = n(4106),
a = i.JsonConfig.getInstance().noPatchModules.split(","),
c = {
bunyan: s.bunyan,
console: s.console,
mongodb: s.mongodb,
mongodbCore: s.mongodbCore,
mysql: s.mysql,
redis: s.redis,
pg: s.pg,
pgPool: s.pgPool,
winston: s.winston,
azuresdk: s.azuresdk,
};
for (var l in c)
-1 === a.indexOf(l) &&
(c[l].enable(), r.info(o, "Subscribed to " + l + " events"));
a.length > 0 && r.info(o, "Some modules will not be patched", a);
} else
r.info(
o,
"Not subscribing to dependency autocollection because APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL was set",
);
t.registerContextPreservation = function (e) {
t.IsInitialized && n(84953).channel.addContextPreservation(e);
};
},
67886: (e, t, n) => {
"use strict";
t.wp = t.qP = void 0;
var r = n(63580),
i = n(84953),
o = [];
(t.qP = function (e) {
"ismaster" !== e.data.event.commandName &&
o.forEach(function (t) {
var n =
(e.data.startedData && e.data.startedData.databaseName) ||
"Unknown database";
t.trackDependency({
target: n,
data: e.data.event.commandName,
name: e.data.event.commandName,
duration: e.data.event.duration,
success: e.data.succeeded,
resultCode: e.data.succeeded ? "0" : "1",
time: e.data.startedData.time,
dependencyTypeName: "mongodb",
});
});
}),
(t.wp = function (e, n) {
if (e) {
if (
o.find(function (e) {
return e == n;
})
)
return;
0 === o.length &&
i.channel.subscribe(
"mongodb",
t.qP,
i.trueFilter,
function (e, t) {
var i = n.getStatsbeat();
i &&
i.addInstrumentation(r.StatsbeatInstrumentation.MONGODB);
},
),
o.push(n);
} else
0 ===
(o = o.filter(function (e) {
return e != n;
})).length && i.channel.unsubscribe("mongodb", t.qP);
});
},
34777: (e, t, n) => {
"use strict";
t.wp = t.qP = void 0;
var r = n(63580),
i = n(84953),
o = [];
(t.qP = function (e) {
o.forEach(function (t) {
var n = e.data.query || {},
r = n.sql || "Unknown query",
i = !e.data.err,
o = (n._connection || {}).config || {},
s = o.socketPath
? o.socketPath
: (o.host || "localhost") + ":" + o.port;
t.trackDependency({
target: s,
data: r,
name: r,
duration: e.data.duration,
success: i,
resultCode: i ? "0" : "1",
time: e.data.time,
dependencyTypeName: "mysql",
});
});
}),
(t.wp = function (e, n) {
if (e) {
if (
o.find(function (e) {
return e == n;
})
)
return;
0 === o.length &&
i.channel.subscribe(
"mysql",
t.qP,
i.trueFilter,
function (e, t) {
var i = n.getStatsbeat();
i && i.addInstrumentation(r.StatsbeatInstrumentation.MYSQL);
},
),
o.push(n);
} else
0 ===
(o = o.filter(function (e) {
return e != n;
})).length && i.channel.unsubscribe("mysql", t.qP);
});
},
31227: (e, t, n) => {
"use strict";
t.wp = t.qP = void 0;
var r = n(63580),
i = n(84953),
o = [];
(t.qP = function (e) {
o.forEach(function (t) {
var n = e.data.query,
r =
(n.preparable && n.preparable.text) ||
n.plan ||
n.text ||
"unknown query",
i = !e.data.error,
o = e.data.database.host + ":" + e.data.database.port;
t.trackDependency({
target: o,
data: r,
name: r,
duration: e.data.duration,
success: i,
resultCode: i ? "0" : "1",
time: e.data.time,
dependencyTypeName: "postgres",
});
});
}),
(t.wp = function (e, n) {
if (e) {
if (
o.find(function (e) {
return e == n;
})
)
return;
0 === o.length &&
i.channel.subscribe(
"postgres",
t.qP,
i.trueFilter,
function (e, t) {
var i = n.getStatsbeat();
i &&
i.addInstrumentation(r.StatsbeatInstrumentation.POSTGRES);
},
),
o.push(n);
} else
0 ===
(o = o.filter(function (e) {
return e != n;
})).length && i.channel.unsubscribe("postgres", t.qP);
});
},
85071: (e, t, n) => {
"use strict";
t.wp = t.qP = void 0;
var r = n(63580),
i = n(84953),
o = [];
(t.qP = function (e) {
o.forEach(function (t) {
"info" !== e.data.commandObj.command &&
t.trackDependency({
target: e.data.address,
name: e.data.commandObj.command,
data: e.data.commandObj.command,
duration: e.data.duration,
success: !e.data.err,
resultCode: e.data.err ? "1" : "0",
time: e.data.time,
dependencyTypeName: "redis",
});
});
}),
(t.wp = function (e, n) {
if (e) {
if (
o.find(function (e) {
return e == n;
})
)
return;
0 === o.length &&
i.channel.subscribe(
"redis",
t.qP,
i.trueFilter,
function (e, t) {
var i = n.getStatsbeat();
i && i.addInstrumentation(r.StatsbeatInstrumentation.REDIS);
},
),
o.push(n);
} else
0 ===
(o = o.filter(function (e) {
return e != n;
})).length && i.channel.unsubscribe("redis", t.qP);
});
},
30454: (e, t, n) => {
"use strict";
t.wp = void 0;
var r = n(63580),
i = n(55290),
o = n(84953),
s = [],
a = {
syslog: function (e) {
var t = {
emerg: i.SeverityLevel.Critical,
alert: i.SeverityLevel.Critical,
crit: i.SeverityLevel.Critical,
error: i.SeverityLevel.Error,
warning: i.SeverityLevel.Warning,
notice: i.SeverityLevel.Information,
info: i.SeverityLevel.Information,
debug: i.SeverityLevel.Verbose,
};
return void 0 === t[e] ? i.SeverityLevel.Information : t[e];
},
npm: function (e) {
var t = {
error: i.SeverityLevel.Error,
warn: i.SeverityLevel.Warning,
info: i.SeverityLevel.Information,
verbose: i.SeverityLevel.Verbose,
debug: i.SeverityLevel.Verbose,
silly: i.SeverityLevel.Verbose,
};
return void 0 === t[e] ? i.SeverityLevel.Information : t[e];
},
unknown: function (e) {
return i.SeverityLevel.Information;
},
},
c = function (e) {
var t = e.data.message,
n = a[e.data.levelKind](e.data.level);
s.forEach(function (r) {
t instanceof Error && !r.config.enableLoggerErrorToTrace
? r.trackException({ exception: t, properties: e.data.meta })
: t instanceof Error
? r.trackTrace({
message: t.toString(),
severity: n,
properties: e.data.meta,
})
: r.trackTrace({
message: t,
severity: n,
properties: e.data.meta,
});
});
};
t.wp = function (e, t) {
if (e) {
if (
s.find(function (e) {
return e == t;
})
)
return;
0 === s.length &&
o.channel.subscribe("winston", c, o.trueFilter, function (e, n) {
var i = t.getStatsbeat();
i && i.addInstrumentation(r.StatsbeatInstrumentation.WINSTON);
}),
s.push(t);
} else
0 ===
(s = s.filter(function (e) {
return e != t;
})).length && o.channel.unsubscribe("winston", c);
};
},
63580: (e, t) => {
"use strict";
var n, r, i, o, s, a, c, l;
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.WEB_INSTRUMENTATION_DEPRECATED_SOURCE =
t.WEB_INSTRUMENTATION_DEFAULT_SOURCE =
t.TIME_SINCE_ENQUEUED =
t.ENQUEUED_TIME =
t.MessageBusDestination =
t.MicrosoftEventHub =
t.AzNamespace =
t.StatsbeatNetworkCategory =
t.StatsbeatFeatureType =
t.StatsbeatInstrumentation =
t.StatsbeatFeature =
t.StatsbeatCounter =
t.StatsbeatAttach =
t.StatsbeatResourceProvider =
t.StatsbeatTelemetryName =
t.HeartBeatMetricName =
t.DependencyTypeName =
t.TelemetryTypeStringToQuickPulseDocumentType =
t.TelemetryTypeStringToQuickPulseType =
t.QuickPulseType =
t.QuickPulseDocumentType =
t.PerformanceToQuickPulseCounter =
t.MetricId =
t.PerformanceCounter =
t.QuickPulseCounter =
t.DEFAULT_LIVEMETRICS_HOST =
t.DEFAULT_LIVEMETRICS_ENDPOINT =
t.DEFAULT_BREEZE_ENDPOINT =
t.APPLICATION_INSIGHTS_SDK_VERSION =
void 0),
(t.APPLICATION_INSIGHTS_SDK_VERSION = "2.6.0"),
(t.DEFAULT_BREEZE_ENDPOINT = "https://dc.services.visualstudio.com"),
(t.DEFAULT_LIVEMETRICS_ENDPOINT =
"https://rt.services.visualstudio.com"),
(t.DEFAULT_LIVEMETRICS_HOST = "rt.services.visualstudio.com"),
(function (e) {
(e.COMMITTED_BYTES = "\\Memory\\Committed Bytes"),
(e.PROCESSOR_TIME = "\\Processor(_Total)\\% Processor Time"),
(e.REQUEST_RATE = "\\ApplicationInsights\\Requests/Sec"),
(e.REQUEST_FAILURE_RATE =
"\\ApplicationInsights\\Requests Failed/Sec"),
(e.REQUEST_DURATION = "\\ApplicationInsights\\Request Duration"),
(e.DEPENDENCY_RATE =
"\\ApplicationInsights\\Dependency Calls/Sec"),
(e.DEPENDENCY_FAILURE_RATE =
"\\ApplicationInsights\\Dependency Calls Failed/Sec"),
(e.DEPENDENCY_DURATION =
"\\ApplicationInsights\\Dependency Call Duration"),
(e.EXCEPTION_RATE = "\\ApplicationInsights\\Exceptions/Sec");
})((r = t.QuickPulseCounter || (t.QuickPulseCounter = {}))),
(function (e) {
(e.PRIVATE_BYTES = "\\Process(??APP_WIN32_PROC??)\\Private Bytes"),
(e.AVAILABLE_BYTES = "\\Memory\\Available Bytes"),
(e.PROCESSOR_TIME = "\\Processor(_Total)\\% Processor Time"),
(e.PROCESS_TIME =
"\\Process(??APP_WIN32_PROC??)\\% Processor Time"),
(e.REQUEST_RATE =
"\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Requests/Sec"),
(e.REQUEST_DURATION =
"\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Request Execution Time");
})((i = t.PerformanceCounter || (t.PerformanceCounter = {}))),
((l = t.MetricId || (t.MetricId = {})).REQUESTS_DURATION =
"requests/duration"),
(l.DEPENDENCIES_DURATION = "dependencies/duration"),
(l.EXCEPTIONS_COUNT = "exceptions/count"),
(l.TRACES_COUNT = "traces/count"),
(t.PerformanceToQuickPulseCounter =
(((n = {})[i.PROCESSOR_TIME] = r.PROCESSOR_TIME),
(n[i.REQUEST_RATE] = r.REQUEST_RATE),
(n[i.REQUEST_DURATION] = r.REQUEST_DURATION),
(n[r.COMMITTED_BYTES] = r.COMMITTED_BYTES),
(n[r.REQUEST_FAILURE_RATE] = r.REQUEST_FAILURE_RATE),
(n[r.DEPENDENCY_RATE] = r.DEPENDENCY_RATE),
(n[r.DEPENDENCY_FAILURE_RATE] = r.DEPENDENCY_FAILURE_RATE),
(n[r.DEPENDENCY_DURATION] = r.DEPENDENCY_DURATION),
(n[r.EXCEPTION_RATE] = r.EXCEPTION_RATE),
n)),
(t.QuickPulseDocumentType = {
Event: "Event",
Exception: "Exception",
Trace: "Trace",
Metric: "Metric",
Request: "Request",
Dependency: "RemoteDependency",
Availability: "Availability",
PageView: "PageView",
}),
(t.QuickPulseType = {
Event: "EventTelemetryDocument",
Exception: "ExceptionTelemetryDocument",
Trace: "TraceTelemetryDocument",
Metric: "MetricTelemetryDocument",
Request: "RequestTelemetryDocument",
Dependency: "DependencyTelemetryDocument",
Availability: "AvailabilityTelemetryDocument",
PageView: "PageViewTelemetryDocument",
}),
(t.TelemetryTypeStringToQuickPulseType = {
EventData: t.QuickPulseType.Event,
ExceptionData: t.QuickPulseType.Exception,
MessageData: t.QuickPulseType.Trace,
MetricData: t.QuickPulseType.Metric,
RequestData: t.QuickPulseType.Request,
RemoteDependencyData: t.QuickPulseType.Dependency,
AvailabilityData: t.QuickPulseType.Availability,
PageViewData: t.QuickPulseType.PageView,
}),
(t.TelemetryTypeStringToQuickPulseDocumentType = {
EventData: t.QuickPulseDocumentType.Event,
ExceptionData: t.QuickPulseDocumentType.Exception,
MessageData: t.QuickPulseDocumentType.Trace,
MetricData: t.QuickPulseDocumentType.Metric,
RequestData: t.QuickPulseDocumentType.Request,
RemoteDependencyData: t.QuickPulseDocumentType.Dependency,
AvailabilityData: t.QuickPulseDocumentType.Availability,
PageViewData: t.QuickPulseDocumentType.PageView,
}),
(t.DependencyTypeName = {
Grpc: "GRPC",
Http: "HTTP",
InProc: "InProc",
Sql: "SQL",
QueueMessage: "Queue Message",
}),
(t.HeartBeatMetricName = "HeartbeatState"),
(t.StatsbeatTelemetryName = "Statsbeat"),
(t.StatsbeatResourceProvider = {
appsvc: "appsvc",
functions: "functions",
vm: "vm",
unknown: "unknown",
}),
(t.StatsbeatAttach = { codeless: "codeless", sdk: "sdk" }),
(t.StatsbeatCounter = {
REQUEST_SUCCESS: "Request Success Count",
REQUEST_FAILURE: "Request Failure Count",
REQUEST_DURATION: "Request Duration",
RETRY_COUNT: "Retry Count",
THROTTLE_COUNT: "Throttle Count",
EXCEPTION_COUNT: "Exception Count",
ATTACH: "Attach",
FEATURE: "Feature",
}),
((c = t.StatsbeatFeature || (t.StatsbeatFeature = {}))[(c.NONE = 0)] =
"NONE"),
(c[(c.DISK_RETRY = 1)] = "DISK_RETRY"),
(c[(c.AAD_HANDLING = 2)] = "AAD_HANDLING"),
(c[(c.WEB_SNIPPET = 4)] = "WEB_SNIPPET"),
((a =
t.StatsbeatInstrumentation || (t.StatsbeatInstrumentation = {}))[
(a.NONE = 0)
] = "NONE"),
(a[(a.AZURE_CORE_TRACING = 1)] = "AZURE_CORE_TRACING"),
(a[(a.MONGODB = 2)] = "MONGODB"),
(a[(a.MYSQL = 4)] = "MYSQL"),
(a[(a.REDIS = 8)] = "REDIS"),
(a[(a.POSTGRES = 16)] = "POSTGRES"),
(a[(a.BUNYAN = 32)] = "BUNYAN"),
(a[(a.WINSTON = 64)] = "WINSTON"),
(a[(a.CONSOLE = 128)] = "CONSOLE"),
((s = t.StatsbeatFeatureType || (t.StatsbeatFeatureType = {}))[
(s.Feature = 0)
] = "Feature"),
(s[(s.Instrumentation = 1)] = "Instrumentation"),
((o =
t.StatsbeatNetworkCategory || (t.StatsbeatNetworkCategory = {}))[
(o.Breeze = 0)
] = "Breeze"),
(o[(o.Quickpulse = 1)] = "Quickpulse"),
(t.AzNamespace = "az.namespace"),
(t.MicrosoftEventHub = "Microsoft.EventHub"),
(t.MessageBusDestination = "message_bus.destination"),
(t.ENQUEUED_TIME = "enqueuedTime"),
(t.TIME_SINCE_ENQUEUED = "timeSinceEnqueued"),
(t.WEB_INSTRUMENTATION_DEFAULT_SOURCE =
"https://js.monitor.azure.com/scripts/b/ai"),
(t.WEB_INSTRUMENTATION_DEPRECATED_SOURCE =
"https://az416426.vo.msecnd.net/scripts/b/ai");
},
69382: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.domainSupportsProperties = t.RemoteDependencyDataConstants =
void 0);
var r = n(99958),
i = (function () {
function e() {}
return (
(e.TYPE_HTTP = "Http"),
(e.TYPE_AI = "Http (tracked component)"),
e
);
})();
(t.RemoteDependencyDataConstants = i),
(t.domainSupportsProperties = function (e) {
return (
"properties" in e ||
e instanceof r.EventData ||
e instanceof r.ExceptionData ||
e instanceof r.MessageData ||
e instanceof r.MetricData ||
e instanceof r.PageViewData ||
e instanceof r.RemoteDependencyData ||
e instanceof r.RequestData
);
});
},
27220: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.properties = {}), (t.measurements = {}), t;
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
64101: (e) => {
"use strict";
e.exports = function () {};
},
69871: (e) => {
"use strict";
e.exports = function () {
(this.applicationVersion = "ai.application.ver"),
(this.deviceId = "ai.device.id"),
(this.deviceLocale = "ai.device.locale"),
(this.deviceModel = "ai.device.model"),
(this.deviceOEMName = "ai.device.oemName"),
(this.deviceOSVersion = "ai.device.osVersion"),
(this.deviceType = "ai.device.type"),
(this.locationIp = "ai.location.ip"),
(this.operationId = "ai.operation.id"),
(this.operationName = "ai.operation.name"),
(this.operationParentId = "ai.operation.parentId"),
(this.operationSyntheticSource = "ai.operation.syntheticSource"),
(this.operationCorrelationVector =
"ai.operation.correlationVector"),
(this.sessionId = "ai.session.id"),
(this.sessionIsFirst = "ai.session.isFirst"),
(this.userAccountId = "ai.user.accountId"),
(this.userId = "ai.user.id"),
(this.userAuthUserId = "ai.user.authUserId"),
(this.cloudRole = "ai.cloud.role"),
(this.cloudRoleInstance = "ai.cloud.roleInstance"),
(this.internalSdkVersion = "ai.internal.sdkVersion"),
(this.internalAgentVersion = "ai.internal.agentVersion"),
(this.internalNodeName = "ai.internal.nodeName");
};
},
320: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
return e.call(this) || this;
}
return i(t, e), t;
})(n(64101));
e.exports = o;
},
78602: (e, t, n) => {
"use strict";
var r = n(80495);
e.exports = function () {
this.kind = r.Measurement;
};
},
80495: (e) => {
"use strict";
var t;
!(function (e) {
(e[(e.Measurement = 0)] = "Measurement"),
(e[(e.Aggregation = 1)] = "Aggregation");
})(t || (t = {})),
(e.exports = t);
},
78934: (e) => {
"use strict";
e.exports = function () {};
},
37300: (e) => {
"use strict";
e.exports = function () {
(this.ver = 1), (this.sampleRate = 100), (this.tags = {});
};
},
44526: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.properties = {}), (t.measurements = {}), t;
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
40935: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (
(t.ver = 2),
(t.exceptions = []),
(t.properties = {}),
(t.measurements = {}),
t
);
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
18082: (e) => {
"use strict";
e.exports = function () {
(this.hasFullStack = !0), (this.parsedStack = []);
};
},
10901: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.properties = {}), t;
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
33092: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.metrics = []), (t.properties = {}), t;
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
56279: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.properties = {}), (t.measurements = {}), t;
}
return i(t, e), t;
})(n(44526));
e.exports = o;
},
86290: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (
(t.ver = 2),
(t.success = !0),
(t.properties = {}),
(t.measurements = {}),
t
);
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
7339: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = (function (e) {
function t() {
var t = e.call(this) || this;
return (t.ver = 2), (t.properties = {}), (t.measurements = {}), t;
}
return i(t, e), t;
})(n(78934));
e.exports = o;
},
39697: (e) => {
"use strict";
var t;
!(function (e) {
(e[(e.Verbose = 0)] = "Verbose"),
(e[(e.Information = 1)] = "Information"),
(e[(e.Warning = 2)] = "Warning"),
(e[(e.Error = 3)] = "Error"),
(e[(e.Critical = 4)] = "Critical");
})(t || (t = {})),
(e.exports = t);
},
76376: (e) => {
"use strict";
e.exports = function () {};
},
99958: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AvailabilityData = n(27220)),
(t.Base = n(64101)),
(t.ContextTagKeys = n(69871)),
(t.Data = n(320)),
(t.DataPoint = n(78602)),
(t.DataPointType = n(80495)),
(t.Domain = n(78934)),
(t.Envelope = n(37300)),
(t.EventData = n(44526)),
(t.ExceptionData = n(40935)),
(t.ExceptionDetails = n(18082)),
(t.MessageData = n(10901)),
(t.MetricData = n(33092)),
(t.PageViewData = n(56279)),
(t.RemoteDependencyData = n(86290)),
(t.RequestData = n(7339)),
(t.SeverityLevel = n(39697)),
(t.StackFrame = n(76376));
},
76522: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
40532: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
84429: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
8937: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
49003: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
15323: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
89477: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
6647: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
85977: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n),
Object.defineProperty(e, r, {
enumerable: !0,
get: function () {
return t[n];
},
});
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
i(n(89477), t),
i(n(84429), t),
i(n(40532), t),
i(n(49003), t),
i(n(15323), t),
i(n(76522), t),
i(n(6647), t),
i(n(8937), t);
},
93382: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
31727: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
16375: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
78010: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
62637: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
34381: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
71143: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
42166: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
74013: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
72334: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
18836: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
75481: (e, t) => {
"use strict";
var n;
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.TelemetryType =
t.TelemetryTypeString =
t.baseTypeToTelemetryType =
t.telemetryTypeToBaseType =
void 0),
(t.telemetryTypeToBaseType = function (e) {
switch (e) {
case n.Event:
return "EventData";
case n.Exception:
return "ExceptionData";
case n.Trace:
return "MessageData";
case n.Metric:
return "MetricData";
case n.Request:
return "RequestData";
case n.Dependency:
return "RemoteDependencyData";
case n.Availability:
return "AvailabilityData";
case n.PageView:
return "PageViewData";
}
}),
(t.baseTypeToTelemetryType = function (e) {
switch (e) {
case "EventData":
return n.Event;
case "ExceptionData":
return n.Exception;
case "MessageData":
return n.Trace;
case "MetricData":
return n.Metric;
case "RequestData":
return n.Request;
case "RemoteDependencyData":
return n.Dependency;
case "AvailabilityData":
return n.Availability;
case "PageViewData":
return n.PageView;
}
}),
(t.TelemetryTypeString = {
Event: "EventData",
Exception: "ExceptionData",
Trace: "MessageData",
Metric: "MetricData",
Request: "RequestData",
Dependency: "RemoteDependencyData",
Availability: "AvailabilityData",
PageView: "PageViewData",
}),
(function (e) {
(e[(e.Event = 0)] = "Event"),
(e[(e.Exception = 1)] = "Exception"),
(e[(e.Trace = 2)] = "Trace"),
(e[(e.Metric = 3)] = "Metric"),
(e[(e.Request = 4)] = "Request"),
(e[(e.Dependency = 5)] = "Dependency"),
(e[(e.Availability = 6)] = "Availability"),
(e[(e.PageView = 7)] = "PageView");
})((n = t.TelemetryType || (t.TelemetryType = {})));
},
35539: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
62626: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n),
Object.defineProperty(e, r, {
enumerable: !0,
get: function () {
return t[n];
},
});
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
i(n(31727), t),
i(n(78010), t),
i(n(62637), t),
i(n(34381), t),
i(n(72334), t),
i(n(35539), t),
i(n(18836), t),
i(n(71143), t),
i(n(42166), t),
i(n(93382), t),
i(n(74013), t),
i(n(16375), t),
i(n(75481), t);
},
55290: function (e, t, n) {
"use strict";
var r =
(this && this.__createBinding) ||
(Object.create
? function (e, t, n, r) {
void 0 === r && (r = n),
Object.defineProperty(e, r, {
enumerable: !0,
get: function () {
return t[n];
},
});
}
: function (e, t, n, r) {
void 0 === r && (r = n), (e[r] = t[n]);
}),
i =
(this && this.__exportStar) ||
function (e, t) {
for (var n in e)
"default" === n ||
Object.prototype.hasOwnProperty.call(t, n) ||
r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }),
i(n(69382), t),
i(n(99958), t),
i(n(62626), t),
i(n(85977), t);
},
60521: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AggregatedMetricCounter = void 0);
t.AggregatedMetricCounter = function (e) {
(this.dimensions = e),
(this.totalCount = 0),
(this.lastTotalCount = 0),
(this.intervalExecutionTime = 0),
(this.lastTime = +new Date()),
(this.lastIntervalExecutionTime = 0);
};
},
77535: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.PreaggregatedMetricPropertyNames = void 0),
(t.PreaggregatedMetricPropertyNames = {
cloudRoleInstance: "cloud/roleInstance",
cloudRoleName: "cloud/roleName",
operationSynthetic: "operation/synthetic",
requestSuccess: "Request.Success",
requestResultCode: "request/resultCode",
dependencyType: "Dependency.Type",
dependencyTarget: "dependency/target",
dependencySuccess: "Dependency.Success",
dependencyResultCode: "dependency/resultCode",
traceSeverityLevel: "trace/severityLevel",
});
},
80287: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
o = n(36709);
function s(e) {
return null;
}
var a = (function () {
function e(e) {
this._azureTokenPolicy = o.bearerTokenAuthenticationPolicy({
credential: e,
scopes: ["https://monitor.azure.com//.default"],
});
}
return (
(e.prototype.addAuthorizationHeader = function (e) {
return r(this, void 0, void 0, function () {
var t, n;
return i(this, function (r) {
switch (r.label) {
case 0:
return (
(t = "authorization"),
(n = o.createPipelineRequest({ url: "https://" })),
[4, this._azureTokenPolicy.sendRequest(n, s)]
);
case 1:
return r.sent(), (e.headers[t] = n.headers.get(t)), [2];
}
});
});
}),
e
);
})();
e.exports = a;
},
32713: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.AzureVirtualMachine = void 0);
var r = n(95282),
i = n(25740),
o = n(88723),
s = (function () {
function e() {}
return (
(e.getAzureComputeMetadata = function (t, n) {
var s,
a = this,
c = {},
l =
(((s = { method: "GET" })[
o.disableCollectionRequestOption
] = !0),
(s.headers = { Metadata: "True" }),
s),
u = i.makeRequest(
t,
"http://169.254.169.254/metadata/instance/compute?api-version=2017-12-01&format=json",
l,
function (t) {
if (200 === t.statusCode) {
c.isVM = !0;
var i = "";
t.on("data", function (e) {
i += e;
}),
t.on("end", function () {
try {
var t = JSON.parse(i);
(c.id = t.vmId || ""),
(c.subscriptionId = t.subscriptionId || ""),
(c.osType = t.osType || "");
} catch (t) {
r.info(e.TAG, t);
}
n(c);
});
} else n(c);
},
!1,
!1,
);
u &&
(setTimeout(function () {
(a._requestTimedOut = !0), u.abort();
}, e.HTTP_TIMEOUT),
u.on("error", function (t) {
a._requestTimedOut &&
t &&
((t.name = "telemetry timeout"),
(t.message = "telemetry request timed out")),
t && t.message && t.message.indexOf("UNREACH") > -1
? (c.isVM = !1)
: r.info(e.TAG, t),
n(c);
}),
u.end());
}),
(e.HTTP_TIMEOUT = 2500),
(e.TAG = "AzureVirtualMachine"),
e
);
})();
t.AzureVirtualMachine = s;
},
3504: (e, t, n) => {
"use strict";
var r = n(95282),
i = n(25740),
o = (function () {
function e(e, t, n, r) {
(this._buffer = []),
(this._lastSend = 0),
(this._isDisabled = e),
(this._getBatchSize = t),
(this._getBatchIntervalMs = n),
(this._sender = r);
}
return (
(e.prototype.setUseDiskRetryCaching = function (e, t, n) {
this._sender.setDiskRetryMode(e, t, n);
}),
(e.prototype.send = function (e) {
var t = this;
this._isDisabled() ||
(e
? (this._buffer.push(e),
this._buffer.length >= this._getBatchSize()
? this.triggerSend(!1)
: !this._timeoutHandle &&
this._buffer.length > 0 &&
(this._timeoutHandle = setTimeout(function () {
(t._timeoutHandle = null), t.triggerSend(!1);
}, this._getBatchIntervalMs())))
: r.warn("Cannot send null/undefined telemetry"));
}),
(e.prototype.triggerSend = function (e, t) {
var n = this._buffer.length < 1;
n ||
(e || i.isNodeExit
? (this._sender.saveOnCrash(this._buffer),
"function" == typeof t && t("data saved on crash"))
: this._sender.send(this._buffer, t)),
(this._lastSend = +new Date()),
(this._buffer = []),
clearTimeout(this._timeoutHandle),
(this._timeoutHandle = null),
n && "function" == typeof t && t("no data to send");
}),
e
);
})();
e.exports = o;
},
69253: (e, t, n) => {
"use strict";
var r = n(29962),
i = n(55158),
o = n(95282),
s = n(63580),
a = n(57310),
c = n(3063),
l = (function () {
function e(t) {
(this._endpointBase = s.DEFAULT_BREEZE_ENDPOINT),
this._mergeConfig();
var n = this._connectionString,
r = i.parse(t),
o = i.parse(n),
c =
!r.instrumentationkey && Object.keys(r).length > 0 ? null : t,
l = this._instrumentationKey;
this.instrumentationKey =
r.instrumentationkey || c || o.instrumentationkey || l;
var u =
"" +
(this.endpointUrl ||
r.ingestionendpoint ||
o.ingestionendpoint ||
this._endpointBase);
u.endsWith("/") && (u = u.slice(0, -1)),
(this.endpointUrl = u + "/v2.1/track"),
(this.maxBatchSize = this.maxBatchSize || 250),
(this.maxBatchIntervalMs = this.maxBatchIntervalMs || 15e3),
(this.disableAppInsights = this.disableAppInsights || !1),
(this.samplingPercentage = this.samplingPercentage || 100),
(this.correlationIdRetryIntervalMs =
this.correlationIdRetryIntervalMs || 3e4),
(this.enableWebInstrumentation =
this.enableWebInstrumentation ||
this.enableAutoWebSnippetInjection ||
!1),
(this.webInstrumentationConfig =
this.webInstrumentationConfig || null),
(this.enableAutoWebSnippetInjection =
this.enableWebInstrumentation),
(this.correlationHeaderExcludedDomains = this
.correlationHeaderExcludedDomains || [
"*.core.windows.net",
"*.core.chinacloudapi.cn",
"*.core.cloudapi.de",
"*.core.usgovcloudapi.net",
"*.core.microsoft.scloud",
"*.core.eaglex.ic.gov",
]),
(this.ignoreLegacyHeaders = this.ignoreLegacyHeaders || !1),
(this.profileQueryEndpoint =
r.ingestionendpoint ||
o.ingestionendpoint ||
process.env[e.ENV_profileQueryEndpoint] ||
this._endpointBase),
(this.quickPulseHost =
this.quickPulseHost ||
r.liveendpoint ||
o.liveendpoint ||
process.env[e.ENV_quickPulseHost] ||
s.DEFAULT_LIVEMETRICS_HOST),
(this.webInstrumentationConnectionString =
this.webInstrumentationConnectionString ||
this._webInstrumentationConnectionString ||
""),
(this.webSnippetConnectionString =
this.webInstrumentationConnectionString),
this.quickPulseHost.match(/^https?:\/\//) &&
(this.quickPulseHost = new a.URL(this.quickPulseHost).host);
}
return (
Object.defineProperty(e.prototype, "profileQueryEndpoint", {
get: function () {
return this._profileQueryEndpoint;
},
set: function (e) {
(this._profileQueryEndpoint = e),
(this.correlationId = r.correlationIdPrefix);
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "instrumentationKey", {
get: function () {
return this._instrumentationKey;
},
set: function (t) {
e._validateInstrumentationKey(t) ||
o.warn(
"An invalid instrumentation key was provided. There may be resulting telemetry loss",
this.instrumentationKey,
),
(this._instrumentationKey = t);
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(e.prototype, "webSnippetConnectionString", {
get: function () {
return this._webInstrumentationConnectionString;
},
set: function (e) {
this._webInstrumentationConnectionString = e;
},
enumerable: !1,
configurable: !0,
}),
Object.defineProperty(
e.prototype,
"webInstrumentationConnectionString",
{
get: function () {
return this._webInstrumentationConnectionString;
},
set: function (e) {
this._webInstrumentationConnectionString = e;
},
enumerable: !1,
configurable: !0,
},
),
(e.prototype._mergeConfig = function () {
var e = c.JsonConfig.getInstance();
(this._connectionString = e.connectionString),
(this._instrumentationKey = e.instrumentationKey),
(this.correlationHeaderExcludedDomains =
e.correlationHeaderExcludedDomains),
(this.correlationIdRetryIntervalMs =
e.correlationIdRetryIntervalMs),
(this.disableAllExtendedMetrics =
e.disableAllExtendedMetrics),
(this.disableAppInsights = e.disableAppInsights),
(this.disableStatsbeat = e.disableStatsbeat),
(this.distributedTracingMode = e.distributedTracingMode),
(this.enableAutoCollectConsole = e.enableAutoCollectConsole),
(this.enableLoggerErrorToTrace = e.enableLoggerErrorToTrace),
(this.enableAutoCollectDependencies =
e.enableAutoCollectDependencies),
(this.enableAutoCollectIncomingRequestAzureFunctions =
e.enableAutoCollectIncomingRequestAzureFunctions),
(this.enableAutoCollectExceptions =
e.enableAutoCollectExceptions),
(this.enableAutoCollectExtendedMetrics =
e.enableAutoCollectExtendedMetrics),
(this.enableAutoCollectExternalLoggers =
e.enableAutoCollectExternalLoggers),
(this.enableAutoCollectHeartbeat =
e.enableAutoCollectHeartbeat),
(this.enableAutoCollectPerformance =
e.enableAutoCollectPerformance),
(this.enableAutoCollectPreAggregatedMetrics =
e.enableAutoCollectPreAggregatedMetrics),
(this.enableAutoCollectRequests =
e.enableAutoCollectRequests),
(this.enableAutoDependencyCorrelation =
e.enableAutoDependencyCorrelation),
(this.enableInternalDebugLogging =
e.enableInternalDebugLogging),
(this.enableInternalWarningLogging =
e.enableInternalWarningLogging),
(this.enableResendInterval = e.enableResendInterval),
(this.enableMaxBytesOnDisk = e.enableMaxBytesOnDisk),
(this.enableSendLiveMetrics = e.enableSendLiveMetrics),
(this.enableUseAsyncHooks = e.enableUseAsyncHooks),
(this.enableUseDiskRetryCaching =
e.enableUseDiskRetryCaching),
(this.endpointUrl = e.endpointUrl),
(this.extendedMetricDisablers = e.extendedMetricDisablers),
(this.ignoreLegacyHeaders = e.ignoreLegacyHeaders),
(this.maxBatchIntervalMs = e.maxBatchIntervalMs),
(this.maxBatchSize = e.maxBatchSize),
(this.proxyHttpUrl = e.proxyHttpUrl),
(this.proxyHttpsUrl = e.proxyHttpsUrl),
(this.quickPulseHost = e.quickPulseHost),
(this.samplingPercentage = e.samplingPercentage),
(this.enableWebInstrumentation = e.enableWebInstrumentation),
(this._webInstrumentationConnectionString =
e.webInstrumentationConnectionString),
(this.webInstrumentationConfig = e.webInstrumentationConfig),
(this.webInstrumentationSrc = e.webInstrumentationSrc);
}),
(e._validateInstrumentationKey = function (e) {
return new RegExp(
"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
).test(e);
}),
(e.ENV_azurePrefix = "APPSETTING_"),
(e.ENV_iKey = "APPINSIGHTS_INSTRUMENTATIONKEY"),
(e.legacy_ENV_iKey = "APPINSIGHTS_INSTRUMENTATION_KEY"),
(e.ENV_profileQueryEndpoint =
"APPINSIGHTS_PROFILE_QUERY_ENDPOINT"),
(e.ENV_quickPulseHost = "APPINSIGHTS_QUICKPULSE_HOST"),
e
);
})();
e.exports = l;
},
55158: (e, t, n) => {
"use strict";
var r = n(63580),
i = (function () {
function e() {}
return (
(e.parse = function (t) {
if (!t) return {};
var n = t.split(e._FIELDS_SEPARATOR).reduce(function (t, n) {
var r = n.split(e._FIELD_KEY_VALUE_SEPARATOR);
if (2 === r.length) {
var i = r[0].toLowerCase(),
o = r[1];
t[i] = o;
}
return t;
}, {});
if (Object.keys(n).length > 0) {
if (n.endpointsuffix) {
var i = n.location ? n.location + "." : "";
(n.ingestionendpoint =
n.ingestionendpoint ||
"https://" + i + "dc." + n.endpointsuffix),
(n.liveendpoint =
n.liveendpoint ||
"https://" + i + "live." + n.endpointsuffix);
}
(n.ingestionendpoint =
n.ingestionendpoint || r.DEFAULT_BREEZE_ENDPOINT),
(n.liveendpoint =
n.liveendpoint || r.DEFAULT_LIVEMETRICS_ENDPOINT);
}
return n;
}),
(e.isIkeyValid = function (e) {
return (
!(!e || "" == e) &&
new RegExp(
"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
).test(e)
);
}),
(e._FIELDS_SEPARATOR = ";"),
(e._FIELD_KEY_VALUE_SEPARATOR = "="),
e
);
})();
e.exports = i;
},
54470: (e, t, n) => {
"use strict";
var r = n(22037),
i = n(57147),
o = n(71017),
s = n(55290),
a = n(63580),
c = n(95282),
l = (function () {
function e(e) {
(this.keys = new s.ContextTagKeys()),
(this.tags = {}),
this._loadApplicationContext(e),
this._loadDeviceContext(),
this._loadInternalContext();
}
return (
(e.prototype._loadApplicationContext = function (t) {
if (
((t = t || o.resolve(__dirname, "../../../../package.json")),
!e.appVersion[t])
) {
e.appVersion[t] = "unknown";
try {
var n = JSON.parse(i.readFileSync(t, "utf8"));
n &&
"string" == typeof n.version &&
(e.appVersion[t] = n.version);
} catch (e) {
c.info("unable to read app version: ", e);
}
}
this.tags[this.keys.applicationVersion] = e.appVersion[t];
}),
(e.prototype._loadDeviceContext = function () {
var t = r && r.hostname(),
n = e.DefaultRoleName;
process.env.WEBSITE_SITE_NAME &&
(n = process.env.WEBSITE_SITE_NAME),
process.env.WEBSITE_INSTANCE_ID &&
(t = process.env.WEBSITE_INSTANCE_ID),
(this.tags[this.keys.deviceId] = ""),
(this.tags[this.keys.cloudRoleInstance] = t),
(this.tags[this.keys.deviceOSVersion] =
r && r.type() + " " + r.release()),
(this.tags[this.keys.cloudRole] = n),
(this.tags["ai.device.osArchitecture"] = r && r.arch()),
(this.tags["ai.device.osPlatform"] = r && r.platform());
}),
(e.prototype._loadInternalContext = function () {
(e.sdkVersion = a.APPLICATION_INSIGHTS_SDK_VERSION),
(this.tags[this.keys.internalSdkVersion] =
"node:" + e.sdkVersion);
}),
(e.DefaultRoleName = "Web"),
(e.appVersion = {}),
(e.sdkVersion = null),
e
);
})();
e.exports = l;
},
29962: (e, t, n) => {
"use strict";
var r = n(25740),
i = (function () {
function e() {}
return (
(e.queryCorrelationId = function (e, t) {}),
(e.cancelCorrelationIdQuery = function (e, t) {}),
(e.generateRequestId = function (t) {
if (t) {
"." !== (t = "|" == t[0] ? t : "|" + t)[t.length - 1] &&
(t += ".");
var n = (e.currentRootId++).toString(16);
return e.appendSuffix(t, n, "_");
}
return e.generateRootId();
}),
(e.getRootId = function (e) {
var t = e.indexOf(".");
t < 0 && (t = e.length);
var n = "|" === e[0] ? 1 : 0;
return e.substring(n, t);
}),
(e.generateRootId = function () {
return "|" + r.w3cTraceId() + ".";
}),
(e.appendSuffix = function (t, n, i) {
if (t.length + n.length < e.requestIdMaxLength)
return t + n + i;
var o = e.requestIdMaxLength - 9;
if (t.length > o)
for (; o > 1; --o) {
var s = t[o - 1];
if ("." === s || "_" === s) break;
}
if (o <= 1) return e.generateRootId();
for (n = r.randomu32().toString(16); n.length < 8; )
n = "0" + n;
return t.substring(0, o) + n + "#";
}),
(e.correlationIdPrefix = "cid-v1:"),
(e.w3cEnabled = !0),
(e.HTTP_TIMEOUT = 2500),
(e.requestIdMaxLength = 1024),
(e.currentRootId = r.randomu32()),
e
);
})();
e.exports = i;
},
99813: (e, t, n) => {
"use strict";
var r = n(55290),
i = n(25740),
o = n(70894),
s = n(95282),
a = (function () {
function e() {}
return (
(e.createEnvelope = function (t, n, o, s, a) {
var c = null;
switch (n) {
case r.TelemetryType.Trace:
c = e.createTraceData(t);
break;
case r.TelemetryType.Dependency:
c = e.createDependencyData(t);
break;
case r.TelemetryType.Event:
c = e.createEventData(t);
break;
case r.TelemetryType.Exception:
c = e.createExceptionData(t);
break;
case r.TelemetryType.Request:
c = e.createRequestData(t);
break;
case r.TelemetryType.Metric:
c = e.createMetricData(t);
break;
case r.TelemetryType.Availability:
c = e.createAvailabilityData(t);
break;
case r.TelemetryType.PageView:
c = e.createPageViewData(t);
}
if (c && c.baseData && r.domainSupportsProperties(c.baseData)) {
if (o)
if (c.baseData.properties)
for (var l in o)
c.baseData.properties[l] ||
(c.baseData.properties[l] = o[l]);
else c.baseData.properties = o;
e.addAzureFunctionsCorrelationProperties(
c.baseData.properties,
),
c.baseData.properties &&
(c.baseData.properties = i.validateStringMap(
c.baseData.properties,
));
}
var u = (a && a.instrumentationKey) || "",
p = new r.Envelope();
return (
(p.data = c),
(p.iKey = u),
(p.name =
"Microsoft.ApplicationInsights." +
u.replace(/-/g, "") +
"." +
c.baseType.substr(0, c.baseType.length - 4)),
(p.tags = this.getTags(s, t.tagOverrides)),
(p.time = new Date().toISOString()),
(p.ver = 1),
(p.sampleRate = a ? a.samplingPercentage : 100),
n === r.TelemetryType.Metric && (p.sampleRate = 100),
p
);
}),
(e.addAzureFunctionsCorrelationProperties = function (e) {
var t = o.CorrelationContextManager.getCurrentContext();
if (
t &&
t.customProperties &&
t.customProperties.getProperty instanceof Function
) {
e = e || {};
var n = t.customProperties.getProperty("InvocationId");
n && (e.InvocationId = n),
(n = t.customProperties.getProperty("ProcessId")) &&
(e.ProcessId = n),
(n = t.customProperties.getProperty("LogLevel")) &&
(e.LogLevel = n),
(n = t.customProperties.getProperty("Category")) &&
(e.Category = n),
(n = t.customProperties.getProperty("HostInstanceId")) &&
(e.HostInstanceId = n),
(n = t.customProperties.getProperty(
"AzFuncLiveLogsSessionId",
)) && (e.AzFuncLiveLogsSessionId = n);
}
}),
(e.truncateProperties = function (e) {
if (e.properties)
try {
for (
var t = {},
n = Object.keys(e.properties),
r = Object.values(e.properties),
o = 0;
o < n.length;
o++
)
n[o].length <= 150 &&
(i.isDate(r[o]) ||
(null == r[o] && (r[o] = ""),
"object" == typeof r[o] && (r[o] = i.stringify(r[o])),
(t[n[o]] = String(r[o]).substring(0, 8192))),
(t[n[o]] = r[o]));
return t;
} catch (e) {
s.warn(
"Failed to properly truncate telemetry properties: ",
e,
);
}
}),
(e.createTraceData = function (e) {
var t,
n = new r.MessageData();
(n.message =
null === (t = e.message) || void 0 === t
? void 0
: t.substring(0, 32768)),
(n.properties = this.truncateProperties(e)),
isNaN(e.severity)
? (n.severityLevel = r.SeverityLevel.Information)
: (n.severityLevel = e.severity);
var i = new r.Data();
return (
(i.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Trace,
)),
(i.baseData = n),
i
);
}),
(e.createDependencyData = function (e) {
var t,
n,
o,
s = new r.RemoteDependencyData();
(s.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 1024)),
(s.data =
null === (n = e.data) || void 0 === n
? void 0
: n.substring(0, 8192)),
(s.target =
null === (o = e.target) || void 0 === o
? void 0
: o.substring(0, 1024)),
(s.duration = i.msToTimeSpan(e.duration)),
(s.success = e.success),
(s.type = e.dependencyTypeName),
(s.properties = this.truncateProperties(e)),
(s.resultCode = e.resultCode ? e.resultCode.toString() : "0"),
e.id ? (s.id = e.id) : (s.id = i.w3cTraceId());
var a = new r.Data();
return (
(a.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Dependency,
)),
(a.baseData = s),
a
);
}),
(e.createEventData = function (e) {
var t,
n = new r.EventData();
(n.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 512)),
(n.properties = this.truncateProperties(e)),
(n.measurements = e.measurements);
var i = new r.Data();
return (
(i.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Event,
)),
(i.baseData = n),
i
);
}),
(e.createExceptionData = function (e) {
var t,
n,
o = new r.ExceptionData();
(o.properties = this.truncateProperties(e)),
isNaN(e.severity)
? (o.severityLevel = r.SeverityLevel.Error)
: (o.severityLevel = e.severity),
(o.measurements = e.measurements),
(o.exceptions = []);
var s = e.exception.stack,
a = new r.ExceptionDetails();
(a.message =
null === (t = e.exception.message) || void 0 === t
? void 0
: t.substring(0, 32768)),
(a.typeName =
null === (n = e.exception.name) || void 0 === n
? void 0
: n.substring(0, 1024)),
(a.parsedStack = this.parseStack(s)),
(a.hasFullStack =
i.isArray(a.parsedStack) && a.parsedStack.length > 0),
o.exceptions.push(a);
var c = new r.Data();
return (
(c.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Exception,
)),
(c.baseData = o),
c
);
}),
(e.createRequestData = function (e) {
var t,
n,
o,
s,
a = new r.RequestData();
e.id ? (a.id = e.id) : (a.id = i.w3cTraceId()),
(a.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 1024)),
(a.url =
null === (n = e.url) || void 0 === n
? void 0
: n.substring(0, 2048)),
(a.source =
null === (o = e.source) || void 0 === o
? void 0
: o.substring(0, 1024)),
(a.duration = i.msToTimeSpan(e.duration)),
(a.responseCode =
null ===
(s = e.resultCode ? e.resultCode.toString() : "0") ||
void 0 === s
? void 0
: s.substring(0, 1024)),
(a.success = e.success),
(a.properties = this.truncateProperties(e)),
(a.measurements = e.measurements);
var c = new r.Data();
return (
(c.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Request,
)),
(c.baseData = a),
c
);
}),
(e.createMetricData = function (e) {
var t,
n = new r.MetricData();
n.metrics = [];
var i = new r.DataPoint();
(i.count = isNaN(e.count) ? 1 : e.count),
(i.kind = r.DataPointType.Aggregation),
(i.max = isNaN(e.max) ? e.value : e.max),
(i.min = isNaN(e.min) ? e.value : e.min),
(i.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 1024)),
(i.stdDev = isNaN(e.stdDev) ? 0 : e.stdDev),
(i.value = e.value),
(i.ns = e.namespace),
n.metrics.push(i),
(n.properties = this.truncateProperties(e));
var o = new r.Data();
return (
(o.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Metric,
)),
(o.baseData = n),
o
);
}),
(e.createAvailabilityData = function (e) {
var t,
n,
o = new r.AvailabilityData();
e.id ? (o.id = e.id) : (o.id = i.w3cTraceId()),
(o.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 1024)),
(o.duration = i.msToTimeSpan(e.duration)),
(o.success = e.success),
(o.runLocation = e.runLocation),
(o.message =
null === (n = e.message) || void 0 === n
? void 0
: n.substring(0, 8192)),
(o.measurements = e.measurements),
(o.properties = this.truncateProperties(e));
var s = new r.Data();
return (
(s.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.Availability,
)),
(s.baseData = o),
s
);
}),
(e.createPageViewData = function (e) {
var t,
n,
o = new r.PageViewData();
(o.name =
null === (t = e.name) || void 0 === t
? void 0
: t.substring(0, 1024)),
(o.duration = i.msToTimeSpan(e.duration)),
(o.url =
null === (n = e.url) || void 0 === n
? void 0
: n.substring(0, 2048)),
(o.measurements = e.measurements),
(o.properties = this.truncateProperties(e));
var s = new r.Data();
return (
(s.baseType = r.telemetryTypeToBaseType(
r.TelemetryType.PageView,
)),
(s.baseData = o),
s
);
}),
(e.getTags = function (e, t) {
var n = o.CorrelationContextManager.getCurrentContext(),
r = {};
if (e && e.tags) for (var i in e.tags) r[i] = e.tags[i];
if (t) for (var i in t) r[i] = t[i];
return (
n &&
((r[e.keys.operationId] =
r[e.keys.operationId] || n.operation.id),
(r[e.keys.operationName] =
r[e.keys.operationName] || n.operation.name),
(r[e.keys.operationParentId] =
r[e.keys.operationParentId] || n.operation.parentId)),
r
);
}),
(e.parseStack = function (e) {
var t = void 0;
if ("string" == typeof e) {
var n = e.split("\n");
t = [];
for (var r = 0, i = 0, o = 0; o <= n.length; o++) {
var s = n[o];
if (c.regex.test(s)) {
var a = new c(n[o], r++);
(i += a.sizeInBytes), t.push(a);
}
}
if (i > 32768)
for (
var l = 0, u = t.length - 1, p = 0, d = l, h = u;
l < u;
) {
if ((p += t[l].sizeInBytes + t[u].sizeInBytes) > 32768) {
var f = h - d + 1;
t.splice(d, f);
break;
}
(d = l), (h = u), l++, u--;
}
}
return t;
}),
e
);
})(),
c = (function () {
function e(t, n) {
(this.sizeInBytes = 0),
(this.level = n),
(this.method = "<no_method>"),
(this.assembly = i.trim(t));
var r = t.match(e.regex);
r &&
r.length >= 5 &&
((this.method = i.trim(r[2]) || this.method),
(this.fileName = i.trim(r[4]) || "<no_filename>"),
(this.line = parseInt(r[5]) || 0)),
(this.sizeInBytes += this.method.length),
(this.sizeInBytes += this.fileName.length),
(this.sizeInBytes += this.assembly.length),
(this.sizeInBytes += e.baseSize),
(this.sizeInBytes += this.level.toString().length),
(this.sizeInBytes += this.line.toString().length);
}
return (
(e.regex =
/^(\s+at)?(.*?)(\@|\s\(|\s)([^\(\n]+):(\d+):(\d+)(\)?)$/),
(e.baseSize = 58),
e
);
})();
e.exports = a;
},
12640: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.FileAccessControl = void 0);
var o = n(57147),
s = n(22037),
a = n(32081),
c = n(95282),
l = (function () {
function e() {}
return (
(e.checkFileProtection = function () {
if (
!e.OS_PROVIDES_FILE_PROTECTION &&
!e.OS_FILE_PROTECTION_CHECKED
)
if (((e.OS_FILE_PROTECTION_CHECKED = !0), e.USE_ICACLS)) {
try {
e.OS_PROVIDES_FILE_PROTECTION = o.existsSync(
e.ICACLS_PATH,
);
} catch (e) {}
e.OS_PROVIDES_FILE_PROTECTION ||
c.warn(
e.TAG,
"Could not find ICACLS in expected location! This is necessary to use disk retry mode on Windows.",
);
} else e.OS_PROVIDES_FILE_PROTECTION = !0;
}),
(e.applyACLRules = function (t) {
return r(this, void 0, void 0, function () {
var n, r;
return i(this, function (i) {
switch (i.label) {
case 0:
if (!e.USE_ICACLS) return [3, 7];
if (void 0 !== e.ACLED_DIRECTORIES[t]) return [3, 6];
(e.ACLED_DIRECTORIES[t] = !1), (i.label = 1);
case 1:
return (
i.trys.push([1, 4, , 5]), [4, this._getACLIdentity()]
);
case 2:
return (
(n = i.sent()),
[4, this._runICACLS(this._getACLArguments(t, n))]
);
case 3:
return i.sent(), (e.ACLED_DIRECTORIES[t] = !0), [3, 5];
case 4:
throw (
((r = i.sent()), (e.ACLED_DIRECTORIES[t] = !1), r)
);
case 5:
return [3, 7];
case 6:
if (!e.ACLED_DIRECTORIES[t])
throw new Error(
"Setting ACL restrictions did not succeed (cached result)",
);
i.label = 7;
case 7:
return [2];
}
});
});
}),
(e.applyACLRulesSync = function (t) {
if (e.USE_ICACLS) {
if (void 0 === e.ACLED_DIRECTORIES[t])
return (
this._runICACLSSync(
this._getACLArguments(t, this._getACLIdentitySync()),
),
void (e.ACLED_DIRECTORIES[t] = !0)
);
if (!e.ACLED_DIRECTORIES[t])
throw new Error(
"Setting ACL restrictions did not succeed (cached result)",
);
}
}),
(e._runICACLS = function (t) {
return new Promise(function (n, r) {
var i = a.spawn(e.ICACLS_PATH, t, { windowsHide: !0 });
i.on("error", function (e) {
return r(e);
}),
i.on("close", function (e, t) {
0 === e
? n()
: r(
new Error(
"Setting ACL restrictions did not succeed (ICACLS returned code " +
e +
")",
),
);
});
});
}),
(e._runICACLSSync = function (t) {
if (!a.spawnSync)
throw new Error(
"Could not synchronously call ICACLS under current version of Node.js",
);
var n = a.spawnSync(e.ICACLS_PATH, t, { windowsHide: !0 });
if (n.error) throw n.error;
if (0 !== n.status)
throw new Error(
"Setting ACL restrictions did not succeed (ICACLS returned code " +
n.status +
")",
);
}),
(e._getACLIdentity = function () {
return new Promise(function (t, n) {
e.ACL_IDENTITY && t(e.ACL_IDENTITY);
var r = a.spawn(
e.POWERSHELL_PATH,
[
"-Command",
"[System.Security.Principal.WindowsIdentity]::GetCurrent().Name",
],
{ windowsHide: !0, stdio: ["ignore", "pipe", "pipe"] },
),
i = "";
r.stdout.on("data", function (e) {
return (i += e);
}),
r.on("error", function (e) {
return n(e);
}),
r.on("close", function (r, o) {
(e.ACL_IDENTITY = i && i.trim()),
0 === r
? t(e.ACL_IDENTITY)
: n(
new Error(
"Getting ACL identity did not succeed (PS returned code " +
r +
")",
),
);
});
});
}),
(e._getACLIdentitySync = function () {
if (e.ACL_IDENTITY) return e.ACL_IDENTITY;
if (a.spawnSync) {
var t = a.spawnSync(
e.POWERSHELL_PATH,
[
"-Command",
"[System.Security.Principal.WindowsIdentity]::GetCurrent().Name",
],
{ windowsHide: !0, stdio: ["ignore", "pipe", "pipe"] },
);
if (t.error) throw t.error;
if (0 !== t.status)
throw new Error(
"Getting ACL identity did not succeed (PS returned code " +
t.status +
")",
);
return (
(e.ACL_IDENTITY = t.stdout && t.stdout.toString().trim()),
e.ACL_IDENTITY
);
}
throw new Error(
"Could not synchronously get ACL identity under current version of Node.js",
);
}),
(e._getACLArguments = function (e, t) {
return [
e,
"/grant",
"*S-1-5-32-544:(OI)(CI)F",
"/grant",
t + ":(OI)(CI)F",
"/inheritance:r",
];
}),
(e.TAG = "FileAccessControl"),
(e.ICACLS_PATH =
process.env.systemdrive + "/windows/system32/icacls.exe"),
(e.POWERSHELL_PATH =
process.env.systemdrive +
"/windows/system32/windowspowershell/v1.0/powershell.exe"),
(e.ACLED_DIRECTORIES = {}),
(e.ACL_IDENTITY = null),
(e.OS_FILE_PROTECTION_CHECKED = !1),
(e.OS_PROVIDES_FILE_PROTECTION = !1),
(e.USE_ICACLS = "Windows_NT" === s.type()),
e
);
})();
t.FileAccessControl = l;
},
30164: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
};
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.getShallowFileSize =
t.getShallowDirectorySizeSync =
t.getShallowDirectorySize =
t.confirmDirExists =
t.unlinkAsync =
t.readdirAsync =
t.readFileAsync =
t.writeFileAsync =
t.appendFileAsync =
t.accessAsync =
t.mkdirAsync =
t.lstatAsync =
t.statAsync =
void 0);
var o = n(57147),
s = n(71017),
a = n(73837);
(t.statAsync = a.promisify(o.stat)),
(t.lstatAsync = a.promisify(o.lstat)),
(t.mkdirAsync = a.promisify(o.mkdir)),
(t.accessAsync = a.promisify(o.access)),
(t.appendFileAsync = a.promisify(o.appendFile)),
(t.writeFileAsync = a.promisify(o.writeFile)),
(t.readFileAsync = a.promisify(o.readFile)),
(t.readdirAsync = a.promisify(o.readdir)),
(t.unlinkAsync = a.promisify(o.unlink)),
(t.confirmDirExists = function (e) {
return r(void 0, void 0, void 0, function () {
var n, r;
return i(this, function (i) {
switch (i.label) {
case 0:
return i.trys.push([0, 2, , 7]), [4, t.lstatAsync(e)];
case 1:
if (!i.sent().isDirectory())
throw new Error("Path existed but was not a directory");
return [3, 7];
case 2:
if (!(n = i.sent()) || "ENOENT" !== n.code) return [3, 6];
i.label = 3;
case 3:
return i.trys.push([3, 5, , 6]), [4, t.mkdirAsync(e)];
case 4:
return i.sent(), [3, 6];
case 5:
if ((r = i.sent()) && "EEXIST" !== r.code) throw r;
return [3, 6];
case 6:
return [3, 7];
case 7:
return [2];
}
});
});
}),
(t.getShallowDirectorySize = function (e) {
return r(void 0, void 0, void 0, function () {
var n, r, o, a, c, l;
return i(this, function (i) {
switch (i.label) {
case 0:
return [4, t.readdirAsync(e)];
case 1:
(n = i.sent()), (r = 0), (o = 0), (a = n), (i.label = 2);
case 2:
return o < a.length
? ((c = a[o]), [4, t.statAsync(s.join(e, c))])
: [3, 5];
case 3:
(l = i.sent()).isFile() && (r += l.size), (i.label = 4);
case 4:
return o++, [3, 2];
case 5:
return [2, r];
}
});
});
}),
(t.getShallowDirectorySizeSync = function (e) {
for (var t = o.readdirSync(e), n = 0, r = 0; r < t.length; r++)
n += o.statSync(s.join(e, t[r])).size;
return n;
}),
(t.getShallowFileSize = function (e) {
return r(void 0, void 0, void 0, function () {
var n;
return i(this, function (r) {
switch (r.label) {
case 0:
return [4, t.statAsync(e)];
case 1:
return (n = r.sent()).isFile() ? [2, n.size] : [2];
}
});
});
});
},
56761: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 });
},
23370: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
o =
(this && this.__spreadArrays) ||
function () {
for (var e = 0, t = 0, n = arguments.length; t < n; t++)
e += arguments[t].length;
var r = Array(e),
i = 0;
for (t = 0; t < n; t++)
for (var o = arguments[t], s = 0, a = o.length; s < a; s++, i++)
r[i] = o[s];
return r;
},
s = n(57147),
a = n(22037),
c = n(71017),
l = n(30164),
u = (function () {
function e() {
var t = this;
(this.TAG = "Logger"),
(this._cleanupTimeOut = 18e5),
(this._logToFile = !1),
(this._logToConsole = !0);
var n = process.env.APPLICATIONINSIGHTS_LOG_DESTINATION;
"file+console" == n && (this._logToFile = !0),
"file" == n &&
((this._logToFile = !0), (this._logToConsole = !1)),
(this.maxSizeBytes = 5e4),
(this.maxHistory = 1),
(this._logFileName = "applicationinsights.log");
var r = process.env.APPLICATIONINSIGHTS_LOGDIR;
r
? c.isAbsolute(r)
? (this._tempDir = r)
: (this._tempDir = c.join(process.cwd(), r))
: (this._tempDir = c.join(a.tmpdir(), "appInsights-node")),
(this._fileFullPath = c.join(this._tempDir, this._logFileName)),
(this._backUpNameFormat = "." + this._logFileName),
this._logToFile &&
(e._fileCleanupTimer ||
((e._fileCleanupTimer = setInterval(function () {
t._fileCleanupTask();
}, this._cleanupTimeOut)),
e._fileCleanupTimer.unref()));
}
return (
(e.prototype.info = function (e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
var r = e ? o([e], t) : t;
this._logToFile && this._storeToDisk(r),
this._logToConsole && console.info.apply(console, r);
}),
(e.prototype.warning = function (e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
var r = e ? o([e], t) : t;
this._logToFile && this._storeToDisk(r),
this._logToConsole && console.warn.apply(console, r);
}),
(e.getInstance = function () {
return e._instance || (e._instance = new e()), e._instance;
}),
(e.prototype._storeToDisk = function (e) {
return r(this, void 0, void 0, function () {
var t, n, r, o;
return i(this, function (i) {
switch (i.label) {
case 0:
(t = e + "\r\n"), (i.label = 1);
case 1:
return (
i.trys.push([1, 3, , 4]),
[4, l.confirmDirExists(this._tempDir)]
);
case 2:
return i.sent(), [3, 4];
case 3:
return (
(n = i.sent()),
console.log(
this.TAG,
"Failed to create directory for log file: " +
(n && n.message),
),
[2]
);
case 4:
return (
i.trys.push([4, 6, , 11]),
[
4,
l.accessAsync(this._fileFullPath, s.constants.F_OK),
]
);
case 5:
return i.sent(), [3, 11];
case 6:
(r = i.sent()), (i.label = 7);
case 7:
return (
i.trys.push([7, 9, , 10]),
[4, l.appendFileAsync(this._fileFullPath, t)]
);
case 8:
return i.sent(), [2];
case 9:
return (
i.sent(),
console.log(
this.TAG,
"Failed to put log into file: " + (r && r.message),
),
[2]
);
case 10:
return [3, 11];
case 11:
return (
i.trys.push([11, 17, , 18]),
[4, l.getShallowFileSize(this._fileFullPath)]
);
case 12:
return i.sent() > this.maxSizeBytes
? [4, this._createBackupFile(t)]
: [3, 14];
case 13:
return i.sent(), [3, 16];
case 14:
return [4, l.appendFileAsync(this._fileFullPath, t)];
case 15:
i.sent(), (i.label = 16);
case 16:
return [3, 18];
case 17:
return (
(o = i.sent()),
console.log(
this.TAG,
"Failed to create backup file: " + (o && o.message),
),
[3, 18]
);
case 18:
return [2];
}
});
});
}),
(e.prototype._createBackupFile = function (e) {
return r(this, void 0, void 0, function () {
var t, n, r;
return i(this, function (i) {
switch (i.label) {
case 0:
return (
i.trys.push([0, 3, 4, 5]),
[4, l.readFileAsync(this._fileFullPath)]
);
case 1:
return (
(t = i.sent()),
(n = c.join(
this._tempDir,
new Date().getTime() + "." + this._logFileName,
)),
[4, l.writeFileAsync(n, t)]
);
case 2:
return i.sent(), [3, 5];
case 3:
return (
(r = i.sent()),
console.log("Failed to generate backup log file", r),
[3, 5]
);
case 4:
return l.writeFileAsync(this._fileFullPath, e), [7];
case 5:
return [2];
}
});
});
}),
(e.prototype._fileCleanupTask = function () {
return r(this, void 0, void 0, function () {
var e,
t,
n,
r,
o,
s = this;
return i(this, function (i) {
switch (i.label) {
case 0:
return (
i.trys.push([0, 6, , 7]),
[4, l.readdirAsync(this._tempDir)]
);
case 1:
(e = (e = i.sent()).filter(function (e) {
return (
c.basename(e).indexOf(s._backUpNameFormat) > -1
);
})).sort(function (e, t) {
var n = new Date(
parseInt(e.split(s._backUpNameFormat)[0]),
),
r = new Date(
parseInt(t.split(s._backUpNameFormat)[0]),
);
return n < r ? -1 : n >= r ? 1 : void 0;
}),
(t = e.length),
(n = 0),
(i.label = 2);
case 2:
return n < t - this.maxHistory
? ((r = c.join(this._tempDir, e[n])),
[4, l.unlinkAsync(r)])
: [3, 5];
case 3:
i.sent(), (i.label = 4);
case 4:
return n++, [3, 2];
case 5:
return [3, 7];
case 6:
return (
(o = i.sent()),
console.log(
this.TAG,
"Failed to cleanup log files: " + (o && o.message),
),
[3, 7]
);
case 7:
return [2];
}
});
});
}),
(e._fileCleanupTimer = null),
e
);
})();
e.exports = u;
},
3063: (e, t, n) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.JsonConfig = void 0);
var r = n(57147),
i = n(71017),
o = n(95282),
s = "APPSETTING_",
a = "APPINSIGHTS_INSTRUMENTATIONKEY",
c = "APPINSIGHTS_INSTRUMENTATION_KEY",
l = (function () {
function e() {
(this.connectionString =
process.env.APPLICATIONINSIGHTS_CONNECTION_STRING),
(this.instrumentationKey =
process.env[a] ||
process.env[s + a] ||
process.env[c] ||
process.env[s + c]),
!this.connectionString &&
this.instrumentationKey &&
o.warn(
"APPINSIGHTS_INSTRUMENTATIONKEY is in path of deprecation, please use APPLICATIONINSIGHTS_CONNECTION_STRING env variable to setup the SDK.",
),
(this.disableAllExtendedMetrics =
!!process.env
.APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS),
(this.extendedMetricDisablers =
process.env.APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC),
(this.proxyHttpUrl = process.env.http_proxy),
(this.proxyHttpsUrl = process.env.https_proxy),
(this.noDiagnosticChannel =
!!process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL),
(this.disableStatsbeat =
!!process.env.APPLICATION_INSIGHTS_NO_STATSBEAT),
(this.noHttpAgentKeepAlive =
!!process.env.APPLICATION_INSIGHTS_NO_HTTP_AGENT_KEEP_ALIVE),
(this.noPatchModules =
process.env.APPLICATION_INSIGHTS_NO_PATCH_MODULES || ""),
(this.enableWebInstrumentation =
!!process.env
.APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_ENABLED ||
!!process.env.APPLICATIONINSIGHTS_WEB_SNIPPET_ENABLED),
(this.webInstrumentationSrc =
process.env.APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_SOURCE ||
""),
(this.webInstrumentationConnectionString =
process.env
.APPLICATIONINSIGHTS_WEB_INSTRUMENTATION_CONNECTION_STRING ||
process.env
.APPLICATIONINSIGHTS_WEB_SNIPPET_CONNECTION_STRING ||
""),
(this.enableAutoWebSnippetInjection =
this.enableWebInstrumentation),
(this.webSnippetConnectionString =
this.webInstrumentationConnectionString),
this._loadJsonFile();
}
return (
(e.getInstance = function () {
return e._instance || (e._instance = new e()), e._instance;
}),
(e.prototype._loadJsonFile = function () {
var e = i.join(__dirname, "../../"),
t = i.join(e, "applicationinsights.json"),
n = process.env.APPLICATIONINSIGHTS_CONFIGURATION_FILE;
n && (t = i.isAbsolute(n) ? n : i.join(e, n));
try {
var s = JSON.parse(r.readFileSync(t, "utf8"));
null != s.disableStatsbeat &&
(this.disableStatsbeat = s.disableStatsbeat),
null != s.disableAllExtendedMetrics &&
(this.disableAllExtendedMetrics = s.disableStatsbeat),
null != s.noDiagnosticChannel &&
(this.noDiagnosticChannel = s.noDiagnosticChannel),
null != s.noHttpAgentKeepAlive &&
(this.noHttpAgentKeepAlive = s.noHttpAgentKeepAlive),
null != s.connectionString &&
(this.connectionString = s.connectionString),
null != s.extendedMetricDisablers &&
(this.extendedMetricDisablers =
s.extendedMetricDisablers),
null != s.noDiagnosticChannel &&
(this.noDiagnosticChannel = s.noDiagnosticChannel),
null != s.proxyHttpUrl &&
(this.proxyHttpUrl = s.proxyHttpUrl),
null != s.proxyHttpsUrl &&
(this.proxyHttpsUrl = s.proxyHttpsUrl),
null != s.proxyHttpsUrl &&
(this.proxyHttpsUrl = s.proxyHttpsUrl),
null != s.noPatchModules &&
(this.noPatchModules = s.noPatchModules),
null != s.enableAutoWebSnippetInjection &&
((this.enableWebInstrumentation =
s.enableAutoWebSnippetInjection),
(this.enableAutoWebSnippetInjection =
this.enableWebInstrumentation)),
null != s.enableWebInstrumentation &&
((this.enableWebInstrumentation =
s.enableWebInstrumentation),
(this.enableAutoWebSnippetInjection =
this.enableWebInstrumentation)),
null != s.webSnippetConnectionString &&
((this.webInstrumentationConnectionString =
s.webSnippetConnectionString),
(this.webSnippetConnectionString =
this.webInstrumentationConnectionString)),
null != s.webInstrumentationConnectionString &&
((this.webInstrumentationConnectionString =
s.webInstrumentationConnectionString),
(this.webSnippetConnectionString =
this.webInstrumentationConnectionString)),
null != s.webInstrumentationConfig &&
(this.webInstrumentationConfig =
s.webInstrumentationConfig),
null != s.webInstrumentationSrc &&
(this.webInstrumentationSrc = s.webInstrumentationSrc),
null != s.enableLoggerErrorToTrace &&
(this.enableLoggerErrorToTrace =
s.enableLoggerErrorToTrace),
(this.endpointUrl = s.endpointUrl),
(this.maxBatchSize = s.maxBatchSize),
(this.maxBatchIntervalMs = s.maxBatchIntervalMs),
(this.disableAppInsights = s.disableAppInsights),
(this.samplingPercentage = s.samplingPercentage),
(this.correlationIdRetryIntervalMs =
s.correlationIdRetryIntervalMs),
(this.correlationHeaderExcludedDomains =
s.correlationHeaderExcludedDomains),
(this.ignoreLegacyHeaders = s.ignoreLegacyHeaders),
(this.distributedTracingMode = s.distributedTracingMode),
(this.enableAutoCollectExternalLoggers =
s.enableAutoCollectExternalLoggers),
(this.enableAutoCollectConsole =
s.enableAutoCollectConsole),
(this.enableLoggerErrorToTrace =
s.enableLoggerErrorToTrace),
(this.enableAutoCollectExceptions =
s.enableAutoCollectExceptions),
(this.enableAutoCollectPerformance =
s.enableAutoCollectPerformance),
(this.enableAutoCollectExtendedMetrics =
s.enableAutoCollectExtendedMetrics),
(this.enableAutoCollectPreAggregatedMetrics =
s.enableAutoCollectPreAggregatedMetrics),
(this.enableAutoCollectHeartbeat =
s.enableAutoCollectHeartbeat),
(this.enableAutoCollectRequests =
s.enableAutoCollectRequests),
(this.enableAutoCollectDependencies =
s.enableAutoCollectDependencies),
(this.enableAutoDependencyCorrelation =
s.enableAutoDependencyCorrelation),
(this.enableAutoCollectIncomingRequestAzureFunctions =
s.enableAutoCollectIncomingRequestAzureFunctions),
(this.enableUseAsyncHooks = s.enableUseAsyncHooks),
(this.enableUseDiskRetryCaching =
s.enableUseDiskRetryCaching),
(this.enableResendInterval = s.enableResendInterval),
(this.enableMaxBytesOnDisk = s.enableMaxBytesOnDisk),
(this.enableInternalDebugLogging =
s.enableInternalDebugLogging),
(this.enableInternalWarningLogging =
s.enableInternalWarningLogging),
(this.enableSendLiveMetrics = s.enableSendLiveMetrics),
(this.quickPulseHost = s.quickPulseHost);
} catch (e) {
o.info("Missing or invalid JSON config file: ", e);
}
}),
e
);
})();
t.JsonConfig = l;
},
95282: (e, t, n) => {
"use strict";
var r = n(23370),
i = (function () {
function e() {}
return (
(e.info = function (e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
this.enableDebug && r.getInstance().info(this.TAG + e, t);
}),
(e.warn = function (e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
this.disableWarnings ||
r.getInstance().warning(this.TAG + e, t);
}),
(e.enableDebug = !1),
(e.disableWarnings = !1),
(e.TAG = "ApplicationInsights:"),
e
);
})();
e.exports = i;
},
1259: function (e, t, n) {
"use strict";
var r,
i =
(this && this.__extends) ||
((r = function (e, t) {
return (
(r =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (e, t) {
e.__proto__ = t;
}) ||
function (e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) &&
(e[n] = t[n]);
}),
r(e, t)
);
}),
function (e, t) {
function n() {
this.constructor = e;
}
r(e, t),
(e.prototype =
null === t
? Object.create(t)
: ((n.prototype = t.prototype), new n()));
}),
o = n(67625),
s = n(40731),
a = n(88723),
c = n(95282),
l = (function (e) {
function t() {
return (null !== e && e.apply(this, arguments)) || this;
}
return (
i(t, e),
(t.prototype.trackNodeHttpRequestSync = function (e) {
e && e.request && e.response && e.duration
? s.trackRequestSync(this, e)
: c.warn(
"trackNodeHttpRequestSync requires NodeHttpRequestTelemetry object with request, response and duration specified.",
);
}),
(t.prototype.trackNodeHttpRequest = function (e) {
(e.duration || e.error) &&
c.warn(
"trackNodeHttpRequest will ignore supplied duration and error parameters. These values are collected from the request and response objects.",
),
e && e.request && e.response
? s.trackRequest(this, e)
: c.warn(
"trackNodeHttpRequest requires NodeHttpRequestTelemetry object with request and response specified.",
);
}),
(t.prototype.trackNodeHttpDependency = function (e) {
e && e.request
? a.trackRequest(this, e)
: c.warn(
"trackNodeHttpDependency requires NodeHttpDependencyTelemetry object with request specified.",
);
}),
t
);
})(o);
e.exports = l;
},
40095: (e, t) => {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.getResourceProvider =
t.getOsPrefix =
t.isFunctionApp =
t.isWebApp =
t.isLinux =
t.isWindows =
void 0),
(t.isWindows = function () {
return "win32" === process.platform;
}),
(t.isLinux = function () {
return "linux" === process.platform;
}),
(t.isWebApp = function () {
return !!process.env.WEBSITE_SITE_NAME;
}),
(t.isFunctionApp = function () {
return !!process.env.FUNCTIONS_WORKER_RUNTIME;
}),
(t.getOsPrefix = function () {
return t.isWindows() ? "w" : t.isLinux() ? "l" : "u";
}),
(t.getResourceProvider = function () {
return t.isWebApp() ? "a" : t.isFunctionApp() ? "f" : "u";
});
},
87148: function (e, t, n) {
"use strict";
var r =
(this && this.__assign) ||
function () {
return (
(r =
Object.assign ||
function (e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var i in (t = arguments[n]))
Object.prototype.hasOwnProperty.call(t, i) &&
(e[i] = t[i]);
return e;
}),
r.apply(this, arguments)
);
},
i = n(22037),
o = n(55290),
s = n(63580),
a = n(25740),
c = n(95282),
l = a.w3cTraceId(),
u = (function () {
function e() {}
return (
(e.createQuickPulseEnvelope = function (e, t, n, r) {
var o =
(i && "function" == typeof i.hostname && i.hostname()) ||
"Unknown",
s =
(r.tags &&
r.keys &&
r.keys.cloudRoleInstance &&
r.tags[r.keys.cloudRoleInstance]) ||
o,
a =
(r.tags &&
r.keys &&
r.keys.cloudRole &&
r.tags[r.keys.cloudRole]) ||
null;
return {
Documents: t.length > 0 ? t : null,
InstrumentationKey: n.instrumentationKey || "",
Metrics: e.length > 0 ? e : null,
InvariantVersion: 1,
Timestamp: "/Date(" + Date.now() + ")/",
Version: r.tags[r.keys.internalSdkVersion],
StreamId: l,
MachineName: o,
Instance: s,
RoleName: a,
};
}),
(e.createQuickPulseMetric = function (e) {
return { Name: e.name, Value: e.value, Weight: e.count || 1 };
}),
(e.telemetryEnvelopeToQuickPulseDocument = function (t) {
switch (t.data.baseType) {
case o.TelemetryTypeString.Event:
return e.createQuickPulseEventDocument(t);
case o.TelemetryTypeString.Exception:
return e.createQuickPulseExceptionDocument(t);
case o.TelemetryTypeString.Trace:
return e.createQuickPulseTraceDocument(t);
case o.TelemetryTypeString.Dependency:
return e.createQuickPulseDependencyDocument(t);
case o.TelemetryTypeString.Request:
return e.createQuickPulseRequestDocument(t);
}
return null;
}),
(e.createQuickPulseEventDocument = function (t) {
var n = e.createQuickPulseDocument(t),
i = t.data.baseData.name;
return r(r({}, n), { Name: i });
}),
(e.createQuickPulseTraceDocument = function (t) {
var n = e.createQuickPulseDocument(t),
i = t.data.baseData.severityLevel || 0;
return r(r({}, n), {
Message: t.data.baseData.message,
SeverityLevel: o.SeverityLevel[i],
});
}),
(e.createQuickPulseExceptionDocument = function (t) {
var n = e.createQuickPulseDocument(t),
i = t.data.baseData.exceptions,
o = "",
s = "",
a = "";
return (
i &&
i.length > 0 &&
(i[0].parsedStack && i[0].parsedStack.length > 0
? i[0].parsedStack.forEach(function (e) {
o += e.assembly + "\n";
})
: i[0].stack && i[0].stack.length > 0 && (o = i[0].stack),
(s = i[0].message),
(a = i[0].typeName)),
r(r({}, n), {
Exception: o,
ExceptionMessage: s,
ExceptionType: a,
})
);
}),
(e.createQuickPulseRequestDocument = function (t) {
var n = e.createQuickPulseDocument(t),
i = t.data.baseData;
return r(r({}, n), {
Name: i.name,
Success: i.success,
Duration: i.duration,
ResponseCode: i.responseCode,
OperationName: i.name,
});
}),
(e.createQuickPulseDependencyDocument = function (t) {
var n = e.createQuickPulseDocument(t),
i = t.data.baseData;
return r(r({}, n), {
Name: i.name,
Target: i.target,
Success: i.success,
Duration: i.duration,
ResultCode: i.resultCode,
CommandName: i.data,
OperationName: n.OperationId,
DependencyTypeName: i.type,
});
}),
(e.createQuickPulseDocument = function (t) {
var n, r;
return (
t.data.baseType
? ((r =
s.TelemetryTypeStringToQuickPulseType[t.data.baseType]),
(n =
s.TelemetryTypeStringToQuickPulseDocumentType[
t.data.baseType
]))
: c.warn(
"Document type invalid; not sending live metric document",
t.data.baseType,
),
{
DocumentType: n,
__type: r,
OperationId: t.tags[e.keys.operationId],
Version: "1.0",
Properties: e.aggregateProperties(t),
}
);
}),
(e.aggregateProperties = function (e) {
var t = [],
n = e.data.baseData.measurements || {};
for (var r in n)
if (n.hasOwnProperty(r)) {
var i = { key: r, value: n[r] };
t.push(i);
}
var o = e.data.baseData.properties || {};
for (var r in o)
o.hasOwnProperty(r) &&
((i = { key: r, value: o[r] }), t.push(i));
return t;
}),
(e.keys = new o.ContextTagKeys()),
e
);
})();
e.exports = u;
},
59184: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
o = n(95687),
s = n(88723),
a = n(95282),
c = n(3751),
l = n(25740),
u = n(57310),
p = "x-ms-qps-service-polling-interval-hint",
d = "x-ms-qps-service-endpoint-redirect-v2",
h = (function () {
function e(e, t) {
(this._config = e),
(this._consecutiveErrors = 0),
(this._getAuthorizationHandler = t);
}
return (
(e.prototype.ping = function (e, t, n) {
var r = [
{ name: "x-ms-qps-stream-id", value: e.StreamId },
{ name: "x-ms-qps-machine-name", value: e.MachineName },
{ name: "x-ms-qps-role-name", value: e.RoleName },
{ name: "x-ms-qps-instance-name", value: e.Instance },
{
name: "x-ms-qps-invariant-version",
value: e.InvariantVersion.toString(),
},
];
this._submitData(e, t, n, "ping", r);
}),
(e.prototype.post = function (e, t, n) {
return r(this, void 0, void 0, function () {
return i(this, function (r) {
switch (r.label) {
case 0:
return [4, this._submitData([e], t, n, "post")];
case 1:
return r.sent(), [2];
}
});
});
}),
(e.prototype._submitData = function (t, n, h, f, m) {
return r(this, void 0, void 0, function () {
var r,
g,
y,
_,
v,
b,
E,
w = this;
return i(this, function (i) {
switch (i.label) {
case 0:
if (
((r = l.stringify(t)),
((b = {})[s.disableCollectionRequestOption] = !0),
(b.host =
n && n.length > 0
? n
: this._config.quickPulseHost),
(b.method = "POST"),
(b.path =
"/QuickPulseService.svc/" +
f +
"?ikey=" +
this._config.instrumentationKey),
(b.headers =
(((E = { Expect: "100-continue" })[
"x-ms-qps-transmission-time"
] = c.getTransmissionTime()),
(E["Content-Type"] = "application/json"),
(E["Content-Length"] = Buffer.byteLength(r)),
E)),
(g = b),
m &&
m.length > 0 &&
m.forEach(function (e) {
return (g.headers[e.name] = e.value);
}),
"post" !== f)
)
return [3, 4];
if (
!(y = this._getAuthorizationHandler
? this._getAuthorizationHandler(this._config)
: null)
)
return [3, 4];
i.label = 1;
case 1:
return (
i.trys.push([1, 3, , 4]),
[4, y.addAuthorizationHeader(g)]
);
case 2:
return i.sent(), [3, 4];
case 3:
return (
(_ = i.sent()),
a.info(
e.TAG,
"Failed to get AAD bearer token for the Application. Error:",
_,
),
[2]
);
case 4:
return (
this._config.httpsAgent
? (g.agent = this._config.httpsAgent)
: (g.agent = l.tlsRestrictedAgent),
(v = o.request(g, function (e) {
if (200 == e.statusCode) {
var t =
"true" === e.headers["x-ms-qps-subscribed"],
n = null;
try {
n = e.headers[d]
? new u.URL(e.headers[d].toString()).host
: null;
} catch (e) {
w._onError(
"Failed to parse redirect header from QuickPulse: " +
l.dumpObj(e),
);
}
var r = e.headers[p]
? parseInt(e.headers[p].toString())
: null;
(w._consecutiveErrors = 0), h(t, e, n, r);
} else
w._onError(
"StatusCode:" +
e.statusCode +
" StatusMessage:" +
e.statusMessage,
),
h();
})).on("error", function (e) {
w._onError(e), h();
}),
v.write(r),
v.end(),
[2]
);
}
});
});
}),
(e.prototype._onError = function (t) {
this._consecutiveErrors++;
var n =
"Transient error connecting to the Live Metrics endpoint. This packet will not appear in your Live Metrics Stream. Error:";
this._consecutiveErrors % e.MAX_QPS_FAILURES_BEFORE_WARN == 0
? ((n =
"Live Metrics endpoint could not be reached " +
this._consecutiveErrors +
" consecutive times. Most recent error:"),
a.warn(e.TAG, n, t))
: a.info(e.TAG, n, t);
}),
(e.TAG = "QuickPulseSender"),
(e.MAX_QPS_FAILURES_BEFORE_WARN = 25),
e
);
})();
e.exports = h;
},
83668: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
o = n(95282),
s = n(87148),
a = n(59184),
c = n(63580),
l = n(54470),
u = (function () {
function e(e, t, n) {
(this._isCollectingData = !1),
(this._lastSuccessTime = Date.now()),
(this._lastSendSucceeded = !0),
(this._metrics = {}),
(this._documents = []),
(this._collectors = []),
(this._redirectedHost = null),
(this._pollingIntervalHint = -1),
(this.config = e),
(this.context = t || new l()),
(this._sender = new a(this.config, n)),
(this._isEnabled = !1);
}
return (
(e.prototype.addCollector = function (e) {
this._collectors.push(e);
}),
(e.prototype.trackMetric = function (e) {
this._addMetric(e);
}),
(e.prototype.addDocument = function (e) {
if (this._isCollectingData) {
var t = s.telemetryEnvelopeToQuickPulseDocument(e);
t && this._documents.push(t);
}
}),
(e.prototype.enable = function (e) {
e && !this._isEnabled
? ((this._isEnabled = !0), this._goQuickPulse())
: !e &&
this._isEnabled &&
((this._isEnabled = !1),
clearTimeout(this._handle),
(this._handle = void 0));
}),
(e.prototype.enableCollectors = function (e) {
this._collectors.forEach(function (t) {
t.enable(e);
});
}),
(e.prototype._addMetric = function (e) {
var t = e.value,
n = e.count || 1,
r = c.PerformanceToQuickPulseCounter[e.name];
r &&
(this._metrics[r]
? ((this._metrics[r].Value =
(this._metrics[r].Value * this._metrics[r].Weight +
t * n) /
(this._metrics[r].Weight + n)),
(this._metrics[r].Weight += n))
: ((this._metrics[r] = s.createQuickPulseMetric(e)),
(this._metrics[r].Name = r),
(this._metrics[r].Weight = 1)));
}),
(e.prototype._resetQuickPulseBuffer = function () {
delete this._metrics,
(this._metrics = {}),
(this._documents.length = 0);
}),
(e.prototype._goQuickPulse = function () {
return r(this, void 0, void 0, function () {
var t,
n,
r,
o,
a = this;
return i(this, function (i) {
switch (i.label) {
case 0:
return (
(t = Object.keys(this._metrics).map(function (e) {
return a._metrics[e];
})),
(n = s.createQuickPulseEnvelope(
t,
this._documents.slice(),
this.config,
this.context,
)),
this._resetQuickPulseBuffer(),
this._isCollectingData ? [4, this._post(n)] : [3, 2]
);
case 1:
return i.sent(), [3, 3];
case 2:
this._ping(n), (i.label = 3);
case 3:
return (
(r =
this._pollingIntervalHint > 0
? this._pollingIntervalHint
: e.PING_INTERVAL),
(o = this._isCollectingData ? e.POST_INTERVAL : r),
this._isCollectingData &&
Date.now() - this._lastSuccessTime >=
e.MAX_POST_WAIT_TIME &&
!this._lastSendSucceeded
? ((this._isCollectingData = !1),
(o = e.FALLBACK_INTERVAL))
: !this._isCollectingData &&
Date.now() - this._lastSuccessTime >=
e.MAX_PING_WAIT_TIME &&
!this._lastSendSucceeded &&
(o = e.FALLBACK_INTERVAL),
(this._lastSendSucceeded = null),
(this._handle = setTimeout(
this._goQuickPulse.bind(this),
o,
)),
this._handle.unref(),
[2]
);
}
});
});
}),
(e.prototype._ping = function (e) {
this._sender.ping(
e,
this._redirectedHost,
this._quickPulseDone.bind(this),
);
}),
(e.prototype._post = function (e) {
return r(this, void 0, void 0, function () {
return i(this, function (t) {
switch (t.label) {
case 0:
return [
4,
this._sender.post(
e,
this._redirectedHost,
this._quickPulseDone.bind(this),
),
];
case 1:
return t.sent(), [2];
}
});
});
}),
(e.prototype._quickPulseDone = function (e, t, n, r) {
null != e
? (this._isCollectingData !== e &&
(o.info("Live Metrics sending data", e),
this.enableCollectors(e)),
(this._isCollectingData = e),
n &&
n.length > 0 &&
((this._redirectedHost = n),
o.info("Redirecting endpoint to: ", n)),
r && r > 0 && (this._pollingIntervalHint = r),
t && t.statusCode < 300 && t.statusCode >= 200
? ((this._lastSuccessTime = Date.now()),
(this._lastSendSucceeded = !0))
: (this._lastSendSucceeded = !1))
: (this._lastSendSucceeded = !1);
}),
(e.MAX_POST_WAIT_TIME = 2e4),
(e.MAX_PING_WAIT_TIME = 6e4),
(e.FALLBACK_INTERVAL = 6e4),
(e.PING_INTERVAL = 5e3),
(e.POST_INTERVAL = 1e3),
e
);
})();
e.exports = u;
},
3751: (e) => {
"use strict";
e.exports = {
getTransmissionTime: function () {
return 1e4 * (Date.now() + 621355968e5);
},
};
},
59036: (e) => {
"use strict";
e.exports = {
requestContextHeader: "request-context",
requestContextSourceKey: "appId",
requestContextTargetKey: "appId",
requestIdHeader: "request-id",
parentIdHeader: "x-ms-request-id",
rootIdHeader: "x-ms-request-root-id",
correlationContextHeader: "correlation-context",
traceparentHeader: "traceparent",
traceStateHeader: "tracestate",
};
},
82588: function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (i, o) {
function s(e) {
try {
c(r.next(e));
} catch (e) {
o(e);
}
}
function a(e) {
try {
c(r.throw(e));
} catch (e) {
o(e);
}
}
function c(e) {
var t;
e.done
? i(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(s, a);
}
c((r = r.apply(e, t || [])).next());
});
},
i =
(this && this.__generator) ||
function (e, t) {
var n,
r,
i,
o,
s = {
label: 0,
sent: function () {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: [],
};
return (
(o = { next: a(0), throw: a(1), return: a(2) }),
"function" == typeof Symbol &&
(o[Symbol.iterator] = function () {
return this;
}),
o
);
function a(o) {
return function (a) {
return (function (o) {
if (n)
throw new TypeError("Generator is already executing.");
for (; s; )
try {
if (
((n = 1),
r &&
(i =
2 & o[0]
? r.return
: o[0]
? r.throw || ((i = r.return) && i.call(r), 0)
: r.next) &&
!(i = i.call(r, o[1])).done)
)
return i;
switch (
((r = 0), i && (o = [2 & o[0], i.value]), o[0])
) {
case 0:
case 1:
i = o;
break;
case 4:
return s.label++, { value: o[1], done: !1 };
case 5:
s.label++, (r = o[1]), (o = [0]);
continue;
case 7:
(o = s.ops.pop()), s.trys.pop();
continue;
default:
if (
!(
(i =
(i = s.trys).length > 0 && i[i.length - 1]) ||
(6 !== o[0] && 2 !== o[0])
)
) {
s = 0;
continue;
}
if (
3 === o[0] &&
(!i || (o[1] > i[0] && o[1] < i[3]))
) {
s.label = o[1];
break;
}
if (6 === o[0] && s.label < i[1]) {
(s.label = i[1]), (i = o);
break;
}
if (i && s.label < i[2]) {
(s.label = i[2]), s.ops.push(o);
break;
}
i[2] && s.ops.pop(), s.trys.pop();
continue;
}
o = t.call(e, s);
} catch (e) {
(o = [6, e]), (r = 0);
} finally {
n = i = 0;
}
if (5 & o[0]) throw o[1];
return { value: o[0] ? o[1] : void 0, done: !0 };
})([o, a]);
};
}
},
o = n(57147),
s = n(22037),
a = n(71017),
c = n(59796),
l = n(63580),
u = n(88723),
p = n(30164),
d = n(25740),
h = n(57310),
f = n(95282),
m = n(12640),
g = [200, 206, 402, 408, 429, 439, 500],
y = (function () {
function e(t, n, r, i, o, c, l) {
(this._redirectedHost = null),
(this._config = t),
(this._onSuccess = r),
(this._onError = i),
(this._statsbeat = o),
(this._enableDiskRetryMode = !1),
(this._resendInterval = e.WAIT_BETWEEN_RESEND),
(this._maxBytesOnDisk = e.MAX_BYTES_ON_DISK),
(this._numConsecutiveFailures = 0),
(this._numConsecutiveRedirects = 0),
(this._resendTimer = null),
(this._getAuthorizationHandler = n),
(this._fileCleanupTimer = null),
(this._tempDir = a.join(
s.tmpdir(),
e.TEMPDIR_PREFIX + this._config.instrumentationKey,
)),
(this._isStatsbeatSender = c || !1),
(this._shutdownStatsbeat = l),
(this._failedToIngestCounter = 0),
(this._statsbeatHasReachedIngestionAtLeastOnce = !1);
}
return (
(e.prototype.setDiskRetryMode = function (t, n, r) {
var i = this;
t && m.FileAccessControl.checkFileProtection(),
(this._enableDiskRetryMode =
m.FileAccessControl.OS_PROVIDES_FILE_PROTECTION && t),
"number" == typeof n &&
n >= 0 &&
(this._resendInterval = Math.floor(n)),
"number" == typeof r &&
r >= 0 &&
(this._maxBytesOnDisk = Math.floor(r)),
t &&
!m.FileAccessControl.OS_PROVIDES_FILE_PROTECTION &&
((this._enableDiskRetryMode = !1),
this._logWarn(
"Ignoring request to enable disk retry mode. Sufficient file protection capabilities were not detected.",
)),
this._enableDiskRetryMode
? (this._statsbeat &&
this._statsbeat.addFeature(
l.StatsbeatFeature.DISK_RETRY,
),
this._fileCleanupTimer ||
((this._fileCleanupTimer = setTimeout(function () {
i._fileCleanupTask();
}, e.CLEANUP_TIMEOUT)),
this._fileCleanupTimer.unref()))
: (this._statsbeat &&
this._statsbeat.removeFeature(
l.StatsbeatFeature.DISK_RETRY,
),
this._fileCleanupTimer &&
clearTimeout(this._fileCleanupTimer));
}),
(e.prototype.send = function (t, n) {
return r(this, void 0, void 0, function () {
var r,
o,
s,
a,
p,
f,
m,
y,
_ = this;
return i(this, function (i) {
switch (i.label) {
case 0:
if (!t) return [3, 5];
if (
((r =
this._redirectedHost || this._config.endpointUrl),
(o = new h.URL(r).hostname),
(s = {
method: "POST",
withCredentials: !1,
headers: {
"Content-Type": "application/x-json-stream",
},
}),
!(a = this._getAuthorizationHandler
? this._getAuthorizationHandler(this._config)
: null))
)
return [3, 4];
this._statsbeat &&
this._statsbeat.addFeature(
l.StatsbeatFeature.AAD_HANDLING,
),
(i.label = 1);
case 1:
return (
i.trys.push([1, 3, , 4]),
[4, a.addAuthorizationHeader(s)]
);
case 2:
return i.sent(), [3, 4];
case 3:
return (
(p = i.sent()),
(f =
"Failed to get AAD bearer token for the Application."),
this._enableDiskRetryMode &&
((f +=
"This batch of telemetry items will be retried. "),
this._storeToDisk(t)),
(f += "Error:" + p.toString()),
this._logWarn(f),
"function" == typeof n && n(f),
[2]
);
case 4:
(m = ""),
t.forEach(function (e) {
var t = d.stringify(e);
"string" == typeof t && (m += t + "\n");
}),
m.length > 0 && (m = m.substring(0, m.length - 1)),
(y = Buffer.from ? Buffer.from(m) : new Buffer(m)),
c.gzip(y, function (i, a) {
var c = a;
i
? (_._logWarn(d.dumpObj(i)),
(c = y),
(s.headers["Content-Length"] =
y.length.toString()))
: ((s.headers["Content-Encoding"] = "gzip"),
(s.headers["Content-Length"] =
a.length.toString())),
_._logInfo(d.dumpObj(s)),
(s[u.disableCollectionRequestOption] = !0);
var p = +new Date(),
h = d.makeRequest(_._config, r, s, function (e) {
e.setEncoding("utf-8");
var r = "";
e.on("data", function (e) {
r += e;
}),
e.on("end", function () {
var i = +new Date() - p;
if (
((_._numConsecutiveFailures = 0),
_._isStatsbeatSender &&
!_._statsbeatHasReachedIngestionAtLeastOnce &&
(g.includes(e.statusCode)
? (_._statsbeatHasReachedIngestionAtLeastOnce =
!0)
: _._statsbeatFailedToI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment