UNPKG

@glodon-aiot/agent-cli-sdk

Version:

aiot agent client js sdk

1,413 lines (1,411 loc) 1.87 MB
class Yr { constructor(O, L = !1) { Object.defineProperty(this, "prefix", { enumerable: !0, configurable: !0, writable: !0, value: O }), Object.defineProperty(this, "open", { enumerable: !0, configurable: !0, writable: !0, value: L }); } disable() { this.open = !1; } enable() { this.open = !0; } log(...O) { !this.open && !Yr.debug || console.log(this.prefix, ...O); } info(...O) { !this.open && !Yr.debug || console.info(`%c ${this.prefix} %o`, "color:#0f0;", ...O); } error(...O) { !this.open && !Yr.debug || console.error(this.prefix, ...O); } warn(...O) { !this.open && !Yr.debug || console.warn(this.prefix, ...O); } } Object.defineProperty(Yr, "debug", { enumerable: !0, configurable: !0, writable: !0, value: !1 }); const id = new Yr("[Config] "); var ua; (function(K) { K.dev = "https://aiot-dev.glodon.com/api/cvforcepd", K.test = "https://aiot-dev.glodon.com/api/cvforce", K.prod = "https://copilot.glodon.com/api/cvforce", K.local = "http://localhost:3000/api/cvforcepd"; })(ua || (ua = {})); let Lr = { debug: !1, env: "prod", //AIoT 环境, 与apiRoot配对使用 apiRoot: ua.prod, //https://${hostname}/${PRODUCD_CODE} applicationId: "", plugins: {}, loadRelatedQuesions: !0 }; function nd(K) { Yr.debug = (K == null ? void 0 : K.debug) || !1, Lr = Object.assign(Object.assign(Object.assign({}, Lr), K), { apiRoot: (K == null ? void 0 : K.apiRoot) || Lr.apiRoot || (K != null && K.env ? ua[K.env || "prod"] : Lr.apiRoot) }), Yr.debug && id.log("updated", Lr); } /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ function od(K, O) { var L = {}; for (var Y in K) Object.prototype.hasOwnProperty.call(K, Y) && O.indexOf(Y) < 0 && (L[Y] = K[Y]); if (K != null && typeof Object.getOwnPropertySymbols == "function") for (var ut = 0, Y = Object.getOwnPropertySymbols(K); ut < Y.length; ut++) O.indexOf(Y[ut]) < 0 && Object.prototype.propertyIsEnumerable.call(K, Y[ut]) && (L[Y[ut]] = K[Y[ut]]); return L; } function Le(K, O, L, Y) { function ut(lt) { return lt instanceof L ? lt : new L(function(V) { V(lt); }); } return new (L || (L = Promise))(function(lt, V) { function _(v) { try { x(Y.next(v)); } catch (m) { V(m); } } function y(v) { try { x(Y.throw(v)); } catch (m) { V(m); } } function x(v) { v.done ? lt(v.value) : ut(v.value).then(_, y); } x((Y = Y.apply(K, O || [])).next()); }); } const nu = typeof Buffer == "function", bl = typeof TextDecoder == "function" ? new TextDecoder() : void 0; typeof TextEncoder == "function" && new TextEncoder(); const ad = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", sd = Array.prototype.slice.call(ad), Go = ((K) => { let O = {}; return K.forEach((L, Y) => O[L] = Y), O; })(sd), ud = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, pn = String.fromCharCode.bind(String), wl = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (K) => new Uint8Array(Array.prototype.slice.call(K, 0)), ch = (K) => K.replace(/[^A-Za-z0-9\+\/]/g, ""), cd = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, ld = (K) => { switch (K.length) { case 4: var O = (7 & K.charCodeAt(0)) << 18 | (63 & K.charCodeAt(1)) << 12 | (63 & K.charCodeAt(2)) << 6 | 63 & K.charCodeAt(3), L = O - 65536; return pn((L >>> 10) + 55296) + pn((L & 1023) + 56320); case 3: return pn((15 & K.charCodeAt(0)) << 12 | (63 & K.charCodeAt(1)) << 6 | 63 & K.charCodeAt(2)); default: return pn((31 & K.charCodeAt(0)) << 6 | 63 & K.charCodeAt(1)); } }, hd = (K) => K.replace(cd, ld), fd = (K) => { if (K = K.replace(/\s+/g, ""), !ud.test(K)) throw new TypeError("malformed base64."); K += "==".slice(2 - (K.length & 3)); let O, L = "", Y, ut; for (let lt = 0; lt < K.length; ) O = Go[K.charAt(lt++)] << 18 | Go[K.charAt(lt++)] << 12 | (Y = Go[K.charAt(lt++)]) << 6 | (ut = Go[K.charAt(lt++)]), L += Y === 64 ? pn(O >> 16 & 255) : ut === 64 ? pn(O >> 16 & 255, O >> 8 & 255) : pn(O >> 16 & 255, O >> 8 & 255, O & 255); return L; }, lh = typeof atob == "function" ? (K) => atob(ch(K)) : nu ? (K) => Buffer.from(K, "base64").toString("binary") : fd, pd = nu ? (K) => wl(Buffer.from(K, "base64")) : (K) => wl(lh(K).split("").map((O) => O.charCodeAt(0))), dd = nu ? (K) => Buffer.from(K, "base64").toString("utf8") : bl ? (K) => bl.decode(pd(K)) : (K) => hd(lh(K)), md = (K) => ch(K.replace(/[-_]/g, (O) => O == "-" ? "+" : "/")), gd = (K) => dd(md(K)), ca = (K) => JSON.parse(gd(K.split(".")[1])), vd = (K) => { const O = ca(K).exp; return (/* @__PURE__ */ new Date()).valueOf() / 1e3 >= O; }, yd = (K) => K == null ? void 0 : K.replace(/[\r\n]+/gm, ""), bd = (K) => K.replace(/\\|\\/g, ""); var wd = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function hh(K) { return K && K.__esModule && Object.prototype.hasOwnProperty.call(K, "default") ? K.default : K; } var ou = { exports: {} }, fh = function(O, L) { return function() { for (var ut = new Array(arguments.length), lt = 0; lt < ut.length; lt++) ut[lt] = arguments[lt]; return O.apply(L, ut); }; }, Md = fh, dn = Object.prototype.toString; function au(K) { return dn.call(K) === "[object Array]"; } function Zs(K) { return typeof K > "u"; } function xd(K) { return K !== null && !Zs(K) && K.constructor !== null && !Zs(K.constructor) && typeof K.constructor.isBuffer == "function" && K.constructor.isBuffer(K); } function _d(K) { return dn.call(K) === "[object ArrayBuffer]"; } function Sd(K) { return typeof FormData < "u" && K instanceof FormData; } function Ed(K) { var O; return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? O = ArrayBuffer.isView(K) : O = K && K.buffer && K.buffer instanceof ArrayBuffer, O; } function kd(K) { return typeof K == "string"; } function Id(K) { return typeof K == "number"; } function ph(K) { return K !== null && typeof K == "object"; } function ia(K) { if (dn.call(K) !== "[object Object]") return !1; var O = Object.getPrototypeOf(K); return O === null || O === Object.prototype; } function Od(K) { return dn.call(K) === "[object Date]"; } function Ad(K) { return dn.call(K) === "[object File]"; } function Td(K) { return dn.call(K) === "[object Blob]"; } function dh(K) { return dn.call(K) === "[object Function]"; } function Bd(K) { return ph(K) && dh(K.pipe); } function jd(K) { return typeof URLSearchParams < "u" && K instanceof URLSearchParams; } function Rd(K) { return K.trim ? K.trim() : K.replace(/^\s+|\s+$/g, ""); } function Nd() { return typeof navigator < "u" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS") ? !1 : typeof window < "u" && typeof document < "u"; } function su(K, O) { if (!(K === null || typeof K > "u")) if (typeof K != "object" && (K = [K]), au(K)) for (var L = 0, Y = K.length; L < Y; L++) O.call(null, K[L], L, K); else for (var ut in K) Object.prototype.hasOwnProperty.call(K, ut) && O.call(null, K[ut], ut, K); } function Ks() { var K = {}; function O(ut, lt) { ia(K[lt]) && ia(ut) ? K[lt] = Ks(K[lt], ut) : ia(ut) ? K[lt] = Ks({}, ut) : au(ut) ? K[lt] = ut.slice() : K[lt] = ut; } for (var L = 0, Y = arguments.length; L < Y; L++) su(arguments[L], O); return K; } function Cd(K, O, L) { return su(O, function(ut, lt) { L && typeof ut == "function" ? K[lt] = Md(ut, L) : K[lt] = ut; }), K; } function Pd(K) { return K.charCodeAt(0) === 65279 && (K = K.slice(1)), K; } var oi = { isArray: au, isArrayBuffer: _d, isBuffer: xd, isFormData: Sd, isArrayBufferView: Ed, isString: kd, isNumber: Id, isObject: ph, isPlainObject: ia, isUndefined: Zs, isDate: Od, isFile: Ad, isBlob: Td, isFunction: dh, isStream: Bd, isURLSearchParams: jd, isStandardBrowserEnv: Nd, forEach: su, merge: Ks, extend: Cd, trim: Rd, stripBOM: Pd }, In = oi; function Ml(K) { return encodeURIComponent(K).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } var mh = function(O, L, Y) { if (!L) return O; var ut; if (Y) ut = Y(L); else if (In.isURLSearchParams(L)) ut = L.toString(); else { var lt = []; In.forEach(L, function(y, x) { y === null || typeof y > "u" || (In.isArray(y) ? x = x + "[]" : y = [y], In.forEach(y, function(m) { In.isDate(m) ? m = m.toISOString() : In.isObject(m) && (m = JSON.stringify(m)), lt.push(Ml(x) + "=" + Ml(m)); })); }), ut = lt.join("&"); } if (ut) { var V = O.indexOf("#"); V !== -1 && (O = O.slice(0, V)), O += (O.indexOf("?") === -1 ? "?" : "&") + ut; } return O; }, Ld = oi; function ha() { this.handlers = []; } ha.prototype.use = function(O, L, Y) { return this.handlers.push({ fulfilled: O, rejected: L, synchronous: Y ? Y.synchronous : !1, runWhen: Y ? Y.runWhen : null }), this.handlers.length - 1; }; ha.prototype.eject = function(O) { this.handlers[O] && (this.handlers[O] = null); }; ha.prototype.forEach = function(O) { Ld.forEach(this.handlers, function(Y) { Y !== null && O(Y); }); }; var Dd = ha, Ud = oi, qd = function(O, L) { Ud.forEach(O, function(ut, lt) { lt !== L && lt.toUpperCase() === L.toUpperCase() && (O[L] = ut, delete O[lt]); }); }, gh = function(O, L, Y, ut, lt) { return O.config = L, Y && (O.code = Y), O.request = ut, O.response = lt, O.isAxiosError = !0, O.toJSON = function() { return { // Standard message: this.message, name: this.name, // Microsoft description: this.description, number: this.number, // Mozilla fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, // Axios config: this.config, code: this.code, status: this.response && this.response.status ? this.response.status : null }; }, O; }, Ss, xl; function vh() { if (xl) return Ss; xl = 1; var K = gh; return Ss = function(L, Y, ut, lt, V) { var _ = new Error(L); return K(_, Y, ut, lt, V); }, Ss; } var Es, _l; function Fd() { if (_l) return Es; _l = 1; var K = vh(); return Es = function(L, Y, ut) { var lt = ut.config.validateStatus; !ut.status || !lt || lt(ut.status) ? L(ut) : Y(K( "Request failed with status code " + ut.status, ut.config, null, ut.request, ut )); }, Es; } var ks, Sl; function zd() { if (Sl) return ks; Sl = 1; var K = oi; return ks = K.isStandardBrowserEnv() ? ( // Standard browser envs support document.cookie function() { return { write: function(Y, ut, lt, V, _, y) { var x = []; x.push(Y + "=" + encodeURIComponent(ut)), K.isNumber(lt) && x.push("expires=" + new Date(lt).toGMTString()), K.isString(V) && x.push("path=" + V), K.isString(_) && x.push("domain=" + _), y === !0 && x.push("secure"), document.cookie = x.join("; "); }, read: function(Y) { var ut = document.cookie.match(new RegExp("(^|;\\s*)(" + Y + ")=([^;]*)")); return ut ? decodeURIComponent(ut[3]) : null; }, remove: function(Y) { this.write(Y, "", Date.now() - 864e5); } }; }() ) : ( // Non standard browser env (web workers, react-native) lack needed support. function() { return { write: function() { }, read: function() { return null; }, remove: function() { } }; }() ), ks; } var Is, El; function $d() { return El || (El = 1, Is = function(O) { return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(O); }), Is; } var Os, kl; function Hd() { return kl || (kl = 1, Os = function(O, L) { return L ? O.replace(/\/+$/, "") + "/" + L.replace(/^\/+/, "") : O; }), Os; } var As, Il; function Wd() { if (Il) return As; Il = 1; var K = $d(), O = Hd(); return As = function(Y, ut) { return Y && !K(ut) ? O(Y, ut) : ut; }, As; } var Ts, Ol; function Vd() { if (Ol) return Ts; Ol = 1; var K = oi, O = [ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ]; return Ts = function(Y) { var ut = {}, lt, V, _; return Y && K.forEach(Y.split(` `), function(x) { if (_ = x.indexOf(":"), lt = K.trim(x.substr(0, _)).toLowerCase(), V = K.trim(x.substr(_ + 1)), lt) { if (ut[lt] && O.indexOf(lt) >= 0) return; lt === "set-cookie" ? ut[lt] = (ut[lt] ? ut[lt] : []).concat([V]) : ut[lt] = ut[lt] ? ut[lt] + ", " + V : V; } }), ut; }, Ts; } var Bs, Al; function Xd() { if (Al) return Bs; Al = 1; var K = oi; return Bs = K.isStandardBrowserEnv() ? ( // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. function() { var L = /(msie|trident)/i.test(navigator.userAgent), Y = document.createElement("a"), ut; function lt(V) { var _ = V; return L && (Y.setAttribute("href", _), _ = Y.href), Y.setAttribute("href", _), { href: Y.href, protocol: Y.protocol ? Y.protocol.replace(/:$/, "") : "", host: Y.host, search: Y.search ? Y.search.replace(/^\?/, "") : "", hash: Y.hash ? Y.hash.replace(/^#/, "") : "", hostname: Y.hostname, port: Y.port, pathname: Y.pathname.charAt(0) === "/" ? Y.pathname : "/" + Y.pathname }; } return ut = lt(window.location.href), function(_) { var y = K.isString(_) ? lt(_) : _; return y.protocol === ut.protocol && y.host === ut.host; }; }() ) : ( // Non standard browser envs (web workers, react-native) lack needed support. function() { return function() { return !0; }; }() ), Bs; } var js, Tl; function fa() { if (Tl) return js; Tl = 1; function K(O) { this.message = O; } return K.prototype.toString = function() { return "Cancel" + (this.message ? ": " + this.message : ""); }, K.prototype.__CANCEL__ = !0, js = K, js; } var Rs, Bl; function jl() { if (Bl) return Rs; Bl = 1; var K = oi, O = Fd(), L = zd(), Y = mh, ut = Wd(), lt = Vd(), V = Xd(), _ = vh(), y = pa(), x = fa(); return Rs = function(m) { return new Promise(function(a, p) { var c = m.data, l = m.headers, f = m.responseType, g; function h() { m.cancelToken && m.cancelToken.unsubscribe(g), m.signal && m.signal.removeEventListener("abort", g); } K.isFormData(c) && delete l["Content-Type"]; var u = new XMLHttpRequest(); if (m.auth) { var w = m.auth.username || "", b = m.auth.password ? unescape(encodeURIComponent(m.auth.password)) : ""; l.Authorization = "Basic " + btoa(w + ":" + b); } var E = ut(m.baseURL, m.url); u.open(m.method.toUpperCase(), Y(E, m.params, m.paramsSerializer), !0), u.timeout = m.timeout; function I() { if (u) { var B = "getAllResponseHeaders" in u ? lt(u.getAllResponseHeaders()) : null, P = !f || f === "text" || f === "json" ? u.responseText : u.response, N = { data: P, status: u.status, statusText: u.statusText, headers: B, config: m, request: u }; O(function(et) { a(et), h(); }, function(et) { p(et), h(); }, N), u = null; } } if ("onloadend" in u ? u.onloadend = I : u.onreadystatechange = function() { !u || u.readyState !== 4 || u.status === 0 && !(u.responseURL && u.responseURL.indexOf("file:") === 0) || setTimeout(I); }, u.onabort = function() { u && (p(_("Request aborted", m, "ECONNABORTED", u)), u = null); }, u.onerror = function() { p(_("Network Error", m, null, u)), u = null; }, u.ontimeout = function() { var P = m.timeout ? "timeout of " + m.timeout + "ms exceeded" : "timeout exceeded", N = m.transitional || y.transitional; m.timeoutErrorMessage && (P = m.timeoutErrorMessage), p(_( P, m, N.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", u )), u = null; }, K.isStandardBrowserEnv()) { var M = (m.withCredentials || V(E)) && m.xsrfCookieName ? L.read(m.xsrfCookieName) : void 0; M && (l[m.xsrfHeaderName] = M); } "setRequestHeader" in u && K.forEach(l, function(P, N) { typeof c > "u" && N.toLowerCase() === "content-type" ? delete l[N] : u.setRequestHeader(N, P); }), K.isUndefined(m.withCredentials) || (u.withCredentials = !!m.withCredentials), f && f !== "json" && (u.responseType = m.responseType), typeof m.onDownloadProgress == "function" && u.addEventListener("progress", m.onDownloadProgress), typeof m.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", m.onUploadProgress), (m.cancelToken || m.signal) && (g = function(B) { u && (p(!B || B && B.type ? new x("canceled") : B), u.abort(), u = null); }, m.cancelToken && m.cancelToken.subscribe(g), m.signal && (m.signal.aborted ? g() : m.signal.addEventListener("abort", g))), c || (c = null), u.send(c); }); }, Rs; } var Ns, Rl; function pa() { if (Rl) return Ns; Rl = 1; var K = oi, O = qd, L = gh, Y = { "Content-Type": "application/x-www-form-urlencoded" }; function ut(y, x) { !K.isUndefined(y) && K.isUndefined(y["Content-Type"]) && (y["Content-Type"] = x); } function lt() { var y; return (typeof XMLHttpRequest < "u" || typeof process < "u" && Object.prototype.toString.call(process) === "[object process]") && (y = jl()), y; } function V(y, x, v) { if (K.isString(y)) try { return (x || JSON.parse)(y), K.trim(y); } catch (m) { if (m.name !== "SyntaxError") throw m; } return (v || JSON.stringify)(y); } var _ = { transitional: { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 }, adapter: lt(), transformRequest: [function(x, v) { return O(v, "Accept"), O(v, "Content-Type"), K.isFormData(x) || K.isArrayBuffer(x) || K.isBuffer(x) || K.isStream(x) || K.isFile(x) || K.isBlob(x) ? x : K.isArrayBufferView(x) ? x.buffer : K.isURLSearchParams(x) ? (ut(v, "application/x-www-form-urlencoded;charset=utf-8"), x.toString()) : K.isObject(x) || v && v["Content-Type"] === "application/json" ? (ut(v, "application/json"), V(x)) : x; }], transformResponse: [function(x) { var v = this.transitional || _.transitional, m = v && v.silentJSONParsing, S = v && v.forcedJSONParsing, a = !m && this.responseType === "json"; if (a || S && K.isString(x) && x.length) try { return JSON.parse(x); } catch (p) { if (a) throw p.name === "SyntaxError" ? L(p, this, "E_JSON_PARSE") : p; } return x; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, validateStatus: function(x) { return x >= 200 && x < 300; }, headers: { common: { Accept: "application/json, text/plain, */*" } } }; return K.forEach(["delete", "get", "head"], function(x) { _.headers[x] = {}; }), K.forEach(["post", "put", "patch"], function(x) { _.headers[x] = K.merge(Y); }), Ns = _, Ns; } var Zd = oi, Kd = pa(), Jd = function(O, L, Y) { var ut = this || Kd; return Zd.forEach(Y, function(V) { O = V.call(ut, O, L); }), O; }, Cs, Nl; function yh() { return Nl || (Nl = 1, Cs = function(O) { return !!(O && O.__CANCEL__); }), Cs; } var Cl = oi, Ps = Jd, Gd = yh(), Yd = pa(), Qd = fa(); function Ls(K) { if (K.cancelToken && K.cancelToken.throwIfRequested(), K.signal && K.signal.aborted) throw new Qd("canceled"); } var t0 = function(O) { Ls(O), O.headers = O.headers || {}, O.data = Ps.call( O, O.data, O.headers, O.transformRequest ), O.headers = Cl.merge( O.headers.common || {}, O.headers[O.method] || {}, O.headers ), Cl.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], function(ut) { delete O.headers[ut]; } ); var L = O.adapter || Yd.adapter; return L(O).then(function(ut) { return Ls(O), ut.data = Ps.call( O, ut.data, ut.headers, O.transformResponse ), ut; }, function(ut) { return Gd(ut) || (Ls(O), ut && ut.response && (ut.response.data = Ps.call( O, ut.response.data, ut.response.headers, O.transformResponse ))), Promise.reject(ut); }); }, ni = oi, bh = function(O, L) { L = L || {}; var Y = {}; function ut(v, m) { return ni.isPlainObject(v) && ni.isPlainObject(m) ? ni.merge(v, m) : ni.isPlainObject(m) ? ni.merge({}, m) : ni.isArray(m) ? m.slice() : m; } function lt(v) { if (ni.isUndefined(L[v])) { if (!ni.isUndefined(O[v])) return ut(void 0, O[v]); } else return ut(O[v], L[v]); } function V(v) { if (!ni.isUndefined(L[v])) return ut(void 0, L[v]); } function _(v) { if (ni.isUndefined(L[v])) { if (!ni.isUndefined(O[v])) return ut(void 0, O[v]); } else return ut(void 0, L[v]); } function y(v) { if (v in L) return ut(O[v], L[v]); if (v in O) return ut(void 0, O[v]); } var x = { url: V, method: V, data: V, baseURL: _, transformRequest: _, transformResponse: _, paramsSerializer: _, timeout: _, timeoutMessage: _, withCredentials: _, adapter: _, responseType: _, xsrfCookieName: _, xsrfHeaderName: _, onUploadProgress: _, onDownloadProgress: _, decompress: _, maxContentLength: _, maxBodyLength: _, transport: _, httpAgent: _, httpsAgent: _, cancelToken: _, socketPath: _, responseEncoding: _, validateStatus: y }; return ni.forEach(Object.keys(O).concat(Object.keys(L)), function(m) { var S = x[m] || lt, a = S(m); ni.isUndefined(a) && S !== y || (Y[m] = a); }), Y; }, Ds, Pl; function wh() { return Pl || (Pl = 1, Ds = { version: "0.24.0" }), Ds; } var e0 = wh().version, uu = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(K, O) { uu[K] = function(Y) { return typeof Y === K || "a" + (O < 1 ? "n " : " ") + K; }; }); var Ll = {}; uu.transitional = function(O, L, Y) { function ut(lt, V) { return "[Axios v" + e0 + "] Transitional option '" + lt + "'" + V + (Y ? ". " + Y : ""); } return function(lt, V, _) { if (O === !1) throw new Error(ut(V, " has been removed" + (L ? " in " + L : ""))); return L && !Ll[V] && (Ll[V] = !0, console.warn( ut( V, " has been deprecated since v" + L + " and will be removed in the near future" ) )), O ? O(lt, V, _) : !0; }; }; function r0(K, O, L) { if (typeof K != "object") throw new TypeError("options must be an object"); for (var Y = Object.keys(K), ut = Y.length; ut-- > 0; ) { var lt = Y[ut], V = O[lt]; if (V) { var _ = K[lt], y = _ === void 0 || V(_, lt, K); if (y !== !0) throw new TypeError("option " + lt + " must be " + y); continue; } if (L !== !0) throw Error("Unknown option " + lt); } } var i0 = { assertOptions: r0, validators: uu }, Mh = oi, n0 = mh, Dl = Dd, Ul = t0, da = bh, xh = i0, On = xh.validators; function ro(K) { this.defaults = K, this.interceptors = { request: new Dl(), response: new Dl() }; } ro.prototype.request = function(O) { typeof O == "string" ? (O = arguments[1] || {}, O.url = arguments[0]) : O = O || {}, O = da(this.defaults, O), O.method ? O.method = O.method.toLowerCase() : this.defaults.method ? O.method = this.defaults.method.toLowerCase() : O.method = "get"; var L = O.transitional; L !== void 0 && xh.assertOptions(L, { silentJSONParsing: On.transitional(On.boolean), forcedJSONParsing: On.transitional(On.boolean), clarifyTimeoutError: On.transitional(On.boolean) }, !1); var Y = [], ut = !0; this.interceptors.request.forEach(function(S) { typeof S.runWhen == "function" && S.runWhen(O) === !1 || (ut = ut && S.synchronous, Y.unshift(S.fulfilled, S.rejected)); }); var lt = []; this.interceptors.response.forEach(function(S) { lt.push(S.fulfilled, S.rejected); }); var V; if (!ut) { var _ = [Ul, void 0]; for (Array.prototype.unshift.apply(_, Y), _ = _.concat(lt), V = Promise.resolve(O); _.length; ) V = V.then(_.shift(), _.shift()); return V; } for (var y = O; Y.length; ) { var x = Y.shift(), v = Y.shift(); try { y = x(y); } catch (m) { v(m); break; } } try { V = Ul(y); } catch (m) { return Promise.reject(m); } for (; lt.length; ) V = V.then(lt.shift(), lt.shift()); return V; }; ro.prototype.getUri = function(O) { return O = da(this.defaults, O), n0(O.url, O.params, O.paramsSerializer).replace(/^\?/, ""); }; Mh.forEach(["delete", "get", "head", "options"], function(O) { ro.prototype[O] = function(L, Y) { return this.request(da(Y || {}, { method: O, url: L, data: (Y || {}).data })); }; }); Mh.forEach(["post", "put", "patch"], function(O) { ro.prototype[O] = function(L, Y, ut) { return this.request(da(ut || {}, { method: O, url: L, data: Y })); }; }); var o0 = ro, Us, ql; function a0() { if (ql) return Us; ql = 1; var K = fa(); function O(L) { if (typeof L != "function") throw new TypeError("executor must be a function."); var Y; this.promise = new Promise(function(V) { Y = V; }); var ut = this; this.promise.then(function(lt) { if (ut._listeners) { var V, _ = ut._listeners.length; for (V = 0; V < _; V++) ut._listeners[V](lt); ut._listeners = null; } }), this.promise.then = function(lt) { var V, _ = new Promise(function(y) { ut.subscribe(y), V = y; }).then(lt); return _.cancel = function() { ut.unsubscribe(V); }, _; }, L(function(V) { ut.reason || (ut.reason = new K(V), Y(ut.reason)); }); } return O.prototype.throwIfRequested = function() { if (this.reason) throw this.reason; }, O.prototype.subscribe = function(Y) { if (this.reason) { Y(this.reason); return; } this._listeners ? this._listeners.push(Y) : this._listeners = [Y]; }, O.prototype.unsubscribe = function(Y) { if (this._listeners) { var ut = this._listeners.indexOf(Y); ut !== -1 && this._listeners.splice(ut, 1); } }, O.source = function() { var Y, ut = new O(function(V) { Y = V; }); return { token: ut, cancel: Y }; }, Us = O, Us; } var qs, Fl; function s0() { return Fl || (Fl = 1, qs = function(O) { return function(Y) { return O.apply(null, Y); }; }), qs; } var Fs, zl; function u0() { return zl || (zl = 1, Fs = function(O) { return typeof O == "object" && O.isAxiosError === !0; }), Fs; } var $l = oi, c0 = fh, na = o0, l0 = bh, h0 = pa(); function _h(K) { var O = new na(K), L = c0(na.prototype.request, O); return $l.extend(L, na.prototype, O), $l.extend(L, O), L.create = function(ut) { return _h(l0(K, ut)); }, L; } var Ri = _h(h0); Ri.Axios = na; Ri.Cancel = fa(); Ri.CancelToken = a0(); Ri.isCancel = yh(); Ri.VERSION = wh().version; Ri.all = function(O) { return Promise.all(O); }; Ri.spread = s0(); Ri.isAxiosError = u0(); ou.exports = Ri; ou.exports.default = Ri; var f0 = ou.exports, p0 = f0; const Sh = /* @__PURE__ */ hh(p0); var d0 = Object.defineProperty, Hl = Object.getOwnPropertySymbols, m0 = Object.prototype.hasOwnProperty, g0 = Object.prototype.propertyIsEnumerable, Wl = (K, O, L) => O in K ? d0(K, O, { enumerable: !0, configurable: !0, writable: !0, value: L }) : K[O] = L, zs = (K, O) => { for (var L in O || (O = {})) m0.call(O, L) && Wl(K, L, O[L]); if (Hl) for (var L of Hl(O)) g0.call(O, L) && Wl(K, L, O[L]); return K; }, di = (K, O, L) => new Promise((Y, ut) => { var lt = (y) => { try { _(L.next(y)); } catch (x) { ut(x); } }, V = (y) => { try { _(L.throw(y)); } catch (x) { ut(x); } }, _ = (y) => y.done ? Y(y.value) : Promise.resolve(y.value).then(lt, V); _((L = L.apply(K, O)).next()); }); class v0 { constructor(O, L) { this.axios = O, this.errorHandler = L; } get(O, L, Y) { return di(this, null, function* () { const ut = this.axios.get(O, { params: L }); return this.handleResponse(ut, Y); }); } listPaged(O, L) { return di(this, null, function* () { const Y = this.axios.get(O, { params: L }); return this.handleResponse(Y); }); } list(O, L) { return di(this, null, function* () { const Y = this.axios.get(O, { params: L }); return this.handleResponse(Y); }); } delete(O, L) { return di(this, null, function* () { const Y = this.axios.delete(O, { params: L }); return this.handleResponse(Y); }); } post(O, L, Y, ut) { return di(this, null, function* () { const lt = this.axios.post(O, L, zs({ params: Y }, ut)); return this.handleResponse(lt); }); } postForm(O, L, Y) { return di(this, null, function* () { const ut = this.axios.post(O, L, { params: Y, headers: { "Content-Type": "multipart/form-data" } }); return this.handleResponse(ut); }); } patch(O, L, Y) { return di(this, null, function* () { const ut = this.axios.patch(O, L, { params: Y }); return this.handleResponse(ut); }); } put(O, L) { return di(this, null, function* () { const Y = this.axios.put(O, L); return this.handleResponse(Y); }); } upload(O, L, Y) { return di(this, null, function* () { const ut = this.axios.post(O, L, zs({}, Y)); return this.handleResponse(ut); }); } getNonStandard(O, L) { return di(this, null, function* () { const Y = this.axios.get(O, L); try { const ut = yield Y; if (ut.status === 200) return ut; } catch (ut) { throw this.handleError(ut); } }); } postNonStandard(O, L, Y, ut) { return di(this, null, function* () { var lt, V; const _ = yield this.axios.post(O, L, zs({ params: Y }, ut)); if (_.status === 200) if ((lt = _.data) != null && lt.code) (V = this.errorHandler) != null && V.onAppStatusError && this.errorHandler.onAppStatusError(_.data.code, _.data.message); else return _.data; }); } handleResponse(O, L) { return di(this, null, function* () { try { const Y = yield O; return this.handleAppError(Y.data, L).data; } catch (Y) { throw this.handleError(Y); } }); } handleAppError(O, L) { var Y; if (O.code < 200 || O.code >= 300) throw (Y = this.errorHandler) != null && Y.onAppStatusError ? this.errorHandler.onAppStatusError(O.code, b0(O.code, O.message), L) : console.error("未处理应用错误:", O), { isAxiosError: !1, message: O.message }; return O; } // https://github.com/axios/axios#handling-errors handleError(O) { var L, Y; return O.response ? (L = this.errorHandler) != null && L.onHttpStatusError && (console.log("HTTP 错误", this.errorHandler), this.errorHandler.onHttpStatusError(O.response.status, "", O.response)) : O.request ? (console.log(O.request), (Y = this.errorHandler) != null && Y.onNetworkError && this.errorHandler.onNetworkError()) : console.error("axios request config error:", O), new Error(O.message); } } const y0 = (K) => K >= 10002 && K <= 10012, b0 = (K, O) => y0(K) ? "数据操作错误" : O || "未知接口错误"; var w0 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Eh = { exports: {} }, $s = (K, O) => { if (O = Symbol[K]) return O; throw Error("Symbol." + K + " is not defined"); }, An = Math.pow, Hs = (K, O, L) => new Promise((Y, ut) => { var lt = (y) => { try { _(L.next(y)); } catch (x) { ut(x); } }, V = (y) => { try { _(L.throw(y)); } catch (x) { ut(x); } }, _ = (y) => y.done ? Y(y.value) : Promise.resolve(y.value).then(lt, V); _((L = L.apply(K, O)).next()); }), M0 = function(K, O) { this[0] = K, this[1] = O; }, x0 = (K) => { var O = K[$s("asyncIterator")], L = !1, Y, ut = {}; return O == null ? (O = K[$s("iterator")](), Y = (lt) => ut[lt] = (V) => O[lt](V)) : (O = O.call(K), Y = (lt) => ut[lt] = (V) => { if (L) { if (L = !1, lt === "throw") throw V; return V; } return L = !0, { done: !1, value: new M0(new Promise((_) => { var y = O[lt](V); if (!(y instanceof Object)) throw TypeError("Object expected"); _(y); }), 1) }; }), ut[$s("iterator")] = () => ut, Y("next"), "throw" in O ? Y("throw") : ut.throw = (lt) => { throw lt; }, "return" in O && Y("return"), ut; }; /*! For license information please see minio-zj.js.LICENSE.txt */ (function(K, O) { (function(L, Y) { K.exports = Y(); })(w0, () => (() => { var L = { 9809: (V, _, y) => { const x = _; x.bignum = y(4590), x.define = y(2500).define, x.base = y(1979), x.constants = y(6826), x.decoders = y(8307), x.encoders = y(6579); }, 2500: (V, _, y) => { const x = y(6579), v = y(8307), m = y(5717); function S(a, p) { this.name = a, this.body = p, this.decoders = {}, this.encoders = {}; } _.define = function(a, p) { return new S(a, p); }, S.prototype._createNamed = function(a) { const p = this.name; function c(l) { this._initNamed(l, p); } return m(c, a), c.prototype._initNamed = function(l, f) { a.call(this, l, f); }, new c(this); }, S.prototype._getDecoder = function(a) { return a = a || "der", this.decoders.hasOwnProperty(a) || (this.decoders[a] = this._createNamed(v[a])), this.decoders[a]; }, S.prototype.decode = function(a, p, c) { return this._getDecoder(p).decode(a, c); }, S.prototype._getEncoder = function(a) { return a = a || "der", this.encoders.hasOwnProperty(a) || (this.encoders[a] = this._createNamed(x[a])), this.encoders[a]; }, S.prototype.encode = function(a, p, c) { return this._getEncoder(p).encode(a, c); }; }, 6625: (V, _, y) => { const x = y(5717), v = y(8465).b, m = y(2399).Buffer; function S(p, c) { v.call(this, c), m.isBuffer(p) ? (this.base = p, this.offset = 0, this.length = p.length) : this.error("Input not Buffer"); } function a(p, c) { if (Array.isArray(p)) this.length = 0, this.value = p.map(function(l) { return a.isEncoderBuffer(l) || (l = new a(l, c)), this.length += l.length, l; }, this); else if (typeof p == "number") { if (!(0 <= p && p <= 255)) return c.error("non-byte EncoderBuffer value"); this.value = p, this.length = 1; } else if (typeof p == "string") this.value = p, this.length = m.byteLength(p); else { if (!m.isBuffer(p)) return c.error("Unsupported type: " + typeof p); this.value = p, this.length = p.length; } } x(S, v), _.C = S, S.isDecoderBuffer = function(p) { return p instanceof S || typeof p == "object" && m.isBuffer(p.base) && p.constructor.name === "DecoderBuffer" && typeof p.offset == "number" && typeof p.length == "number" && typeof p.save == "function" && typeof p.restore == "function" && typeof p.isEmpty == "function" && typeof p.readUInt8 == "function" && typeof p.skip == "function" && typeof p.raw == "function"; }, S.prototype.save = function() { return { offset: this.offset, reporter: v.prototype.save.call(this) }; }, S.prototype.restore = function(p) { const c = new S(this.base); return c.offset = p.offset, c.length = this.offset, this.offset = p.offset, v.prototype.restore.call(this, p.reporter), c; }, S.prototype.isEmpty = function() { return this.offset === this.length; }, S.prototype.readUInt8 = function(p) { return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(p || "DecoderBuffer overrun"); }, S.prototype.skip = function(p, c) { if (!(this.offset + p <= this.length)) return this.error(c || "DecoderBuffer overrun"); const l = new S(this.base); return l._reporterState = this._reporterState, l.offset = this.offset, l.length = this.offset + p, this.offset += p, l; }, S.prototype.raw = function(p) { return this.base.slice(p ? p.offset : this.offset, this.length); }, _.R = a, a.isEncoderBuffer = function(p) { return p instanceof a || typeof p == "object" && p.constructor.name === "EncoderBuffer" && typeof p.length == "number" && typeof p.join == "function"; }, a.prototype.join = function(p, c) { return p || (p = m.alloc(this.length)), c || (c = 0), this.length === 0 || (Array.isArray(this.value) ? this.value.forEach(function(l) { l.join(p, c), c += l.length; }) : (typeof this.value == "number" ? p[c] = this.value : typeof this.value == "string" ? p.write(this.value, c) : m.isBuffer(this.value) && this.value.copy(p, c), c += this.length)), p; }; }, 1979: (V, _, y) => { const x = _; x.Reporter = y(8465).b, x.DecoderBuffer = y(6625).C, x.EncoderBuffer = y(6625).R, x.Node = y(1949); }, 1949: (V, _, y) => { const x = y(8465).b, v = y(6625).R, m = y(6625).C, S = y(9746), a = ["seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr"], p = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat(a); function c(f, g, h) { const u = {}; this._baseState = u, u.name = h, u.enc = f, u.parent = g || null, u.children = null, u.tag = null, u.args = null, u.reverseArgs = null, u.choice = null, u.optional = !1, u.any = !1, u.obj = !1, u.use = null, u.useDecoder = null, u.key = null, u.default = null, u.explicit = null, u.implicit = null, u.contains = null, u.parent || (u.children = [], this._wrap()); } V.exports = c; const l = ["enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains"]; c.prototype.clone = function() { const f = this._baseState, g = {}; l.forEach(function(u) { g[u] = f[u]; }); const h = new this.constructor(g.parent); return h._baseState = g, h; }, c.prototype._wrap = function() { const f = this._baseState; p.forEach(function(g) { this[g] = function() { const h = new this.constructor(this); return f.children.push(h), h[g].apply(h, arguments); }; }, this); }, c.prototype._init = function(f) { const g = this._baseState; S(g.parent === null), f.call(this), g.children = g.children.filter(function(h) { return h._baseState.parent === this; }, this), S.equal(g.children.length, 1, "Root node can have only one child"); }, c.prototype._useArgs = function(f) { const g = this._baseState, h = f.filter(function(u) { return u instanceof this.constructor; }, this); f = f.filter(function(u) { return !(u instanceof this.constructor); }, this), h.length !== 0 && (S(g.children === null), g.children = h, h.forEach(function(u) { u._baseState.parent = this; }, this)), f.length !== 0 && (S(g.args === null), g.args = f, g.reverseArgs = f.map(function(u) { if (typeof u != "object" || u.constructor !== Object) return u; const w = {}; return Object.keys(u).forEach(function(b) { b == (0 | b) && (b |= 0); const E = u[b]; w[E] = b; }), w; })); }, ["_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool"].forEach(function(f) { c.prototype[f] = function() { const g = this._baseState; throw new Error(f + " not implemented for encoding: " + g.enc); }; }), a.forEach(function(f) { c.prototype[f] = function() { const g = this._baseState, h = Array.prototype.slice.call(arguments); return S(g.tag === null), g.tag = f, this._useArgs(h), this; }; }), c.prototype.use = function(f) { S(f); const g = this._baseState; return S(g.use === null), g.use = f, this; }, c.prototype.optional = function() { return this._baseState.optional = !0, this; }, c.prototype.def = function(f) { const g = this._baseState; return S(g.default === null), g.default = f, g.optional = !0, this; }, c.prototype.explicit = function(f) { const g = this._baseState; return S(g.explicit === null && g.implicit === null), g.explicit = f, this; }, c.prototype.implicit = function(f) { const g = this._baseState; return S(g.explicit === null && g.implicit === null), g.implicit = f, this; }, c.prototype.obj = function() { const f = this._baseState, g = Array.prototype.slice.call(arguments); return f.obj = !0, g.length !== 0 && this._useArgs(g), this; }, c.prototype.key = function(f) { const g = this._baseState; return S(g.key === null), g.key = f, this; }, c.prototype.any = function() { return this._baseState.any = !0, this; }, c.prototype.choice = function(f) { const g = this._baseState; return S(g.choice === null), g.choice = f, this._useArgs(Object.keys(f).map(function(h) { return f[h]; })), this; }, c.prototype.contains = function(f) { const g = this._baseState; return S(g.use === null), g.contains = f, this; }, c.prototype._decode = function(f, g) { const h = this._baseState; if (h.parent === null) return f.wrapResult(h.children[0]._decode(f, g)); let u, w = h.default, b = !0, E = null; if (h.key !== null && (E = f.enterKey(h.key)), h.optional) { let I = null; if (h.explicit !== null ? I = h.explicit : h.implicit !== null ? I = h.implicit : h.tag !== null && (I = h.tag), I !== null || h.any) { if (b = this._peekTag(f, I, h.any), f.isError(b)) return b; } else { const M = f.save(); try { h.choice === null ? this._decodeGeneric(h.tag, f, g) : this._decodeChoice(f, g), b = !0; } catch { b = !1; } f.restore(M); } } if (h.obj && b && (u = f.enterObject()), b) { if (h.explicit !== null) { const M = this._decodeTag(f, h.explicit); if (f.isError(M)) return M; f = M; } const I = f.offset; if (h.use === null && h.choice === null) { let M; h.any && (M = f.save()); const B = this._decodeTag(f, h.implicit !== null ? h.implicit : h.tag, h.any); if (f.isError(B)) return B; h.any ? w = f.raw(M) : f = B; } if (g && g.track && h.tag !== null && g.track(f.path(), I, f.length, "tagged"), g && g.track && h.tag !== null && g.track(f.path(), f.offset, f.length, "content"), h.any || (w = h.choice === null ? this._decodeGeneric(h.tag, f, g) : this._decodeChoice(f, g)), f.isError(w)) return w; if (h.any || h.choice !== null || h.children === null || h.children.forEach(function(M) { M._decode(f, g); }), h.contains && (h.tag === "octstr" || h.tag === "bitstr")) { const M = new m(w); w = this._getUse(h.contains, f._reporterState.obj)._decode(M, g); } } return h.obj && b && (w = f.leaveObject(u)), h.key === null || w === null && b !== !0 ? E !== null && f.exitKey(E) : f.leaveKey(E, h.key, w), w; }, c.prototype._decodeGeneric = function(f, g, h) { const u = this._baseState; return f === "seq" || f === "set" ? null : f === "seqof" || f === "setof" ? this._decodeList(g, f, u.args[0], h) : /str$/.test(f) ? this._decodeStr(g, f, h) : f === "objid" && u.args ? this._decodeObjid(g, u.args[0], u.args[1], h) : f === "objid" ? this._decodeObjid(g, null, null, h) : f === "gentime" || f === "utctime" ? this._decodeTime(g, f, h) : f === "null_" ? this._decodeNull(g, h) : f === "bool" ? this._decodeBool(g, h) : f === "objDesc" ? this._decodeStr(g, f, h) : f === "int" || f === "enum" ? this._decodeInt(g, u.args && u.args[0], h) : u.use !== null ? this._getUse(u.use, g._reporterState.obj)._decode(g, h) : g.error("unknown tag: " + f); }, c.prototype._getUse = function(f, g) { const h = this._baseState; return h.useDecoder = this._use(f, g), S(h.useDecoder._baseState.parent === null), h.useDecoder = h.useDecoder._baseState.children[0], h.implicit !== h.useDecoder._baseState.implicit && (h.useDecoder = h.useDecoder.clone(), h.useDecoder._baseState.implicit = h.implicit), h.useDecoder; }, c.prototype._decodeChoice = function(f, g) { const h = this._baseState; let u = null, w = !1; return Object.keys(h.choice).some(function(b) { const E = f.save(), I = h.choice[b]; try { const M = I._decode(f, g); if (f.isError(M)) return !1; u = { type: b, value: M }, w = !0; } catch { return f.restore(E), !1; } return !0; }, this), w ? u : f.error("Choice not matched"); }, c.prototype._createEncoderBuffer = function(f) { return new v(f, this.reporter); }, c.prototype._encode = function(f, g, h) { const u = this._baseState; if (u.default !== null && u.default === f) return; const w = this._encodeValue(f, g, h); return w === void 0 || this._skipDefault(w, g, h) ? void 0 : w; }, c.prototype._encodeValue = function(f, g, h) { const u = this._baseState; if (u.parent === null) return u.children[0]._encode(f, g || new x()); let w = null; if (this.reporter = g, u.optional && f === void 0) { if (u.default === null) return; f = u.default; } let b = null, E = !1; if (u.any) w = this._createEncoderBuffer(f); else if (u.choice) w = this._encodeChoice(f, g); else if (u.contains) b = this._getUse(u.contains, h)._encode(f, g), E = !0; else if (u.children) b = u.children.map(function(I) { if (I._baseState.tag === "null_") return I._encode(null, g, f); if (I._baseState.key === null) return g.error("Child should have a key"); const M = g.enterKey(I._baseState.key); if (typeof f != "object") return g.error("Child expected, but input is not object"); const B = I._encode(f[I._baseState.key], g, f); return g.leaveKey(M), B; }, this).filter(function(I) { return I; }), b = this._createEncoderBuffer(b); else if (u.tag === "seqof" || u.tag === "setof") { if (!u.args || u.args.len