cloudbees-openfeature-provider-browser
Version:
An OpenFeature provider for CloudBees Feature Management
5,304 lines • 236 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// node_modules/axios/dist/browser/axios.cjs
var require_axios = __commonJS({
"node_modules/axios/dist/browser/axios.cjs"(exports, module) {
"use strict";
function bind(fn, thisArg) {
return function wrap() {
return fn.apply(thisArg, arguments);
};
}
var { toString } = Object.prototype;
var { getPrototypeOf } = Object;
var { iterator, toStringTag } = Symbol;
var kindOf = ((cache) => (thing) => {
const str = toString.call(thing);
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null));
var kindOfTest = (type) => {
type = type.toLowerCase();
return (thing) => kindOf(thing) === type;
};
var typeOfTest = (type) => (thing) => typeof thing === type;
var { isArray } = Array;
var isUndefined = typeOfTest("undefined");
function isBuffer(val) {
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
}
var isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(val) {
let result;
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
result = ArrayBuffer.isView(val);
} else {
result = val && val.buffer && isArrayBuffer(val.buffer);
}
return result;
}
var isString = typeOfTest("string");
var isFunction = typeOfTest("function");
var isNumber = typeOfTest("number");
var isObject = (thing) => thing !== null && typeof thing === "object";
var isBoolean = (thing) => thing === true || thing === false;
var isPlainObject = (val) => {
if (kindOf(val) !== "object") {
return false;
}
const prototype2 = getPrototypeOf(val);
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
};
var isDate = kindOfTest("Date");
var isFile = kindOfTest("File");
var isBlob = kindOfTest("Blob");
var isFileList = kindOfTest("FileList");
var isStream = (val) => isObject(val) && isFunction(val.pipe);
var isFormData = (thing) => {
let kind;
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
};
var isURLSearchParams = kindOfTest("URLSearchParams");
var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach(obj, fn, { allOwnKeys = false } = {}) {
if (obj === null || typeof obj === "undefined") {
return;
}
let i;
let l;
if (typeof obj !== "object") {
obj = [obj];
}
if (isArray(obj)) {
for (i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
const len = keys.length;
let key;
for (i = 0; i < len; i++) {
key = keys[i];
fn.call(null, obj[key], key, obj);
}
}
}
function findKey(obj, key) {
key = key.toLowerCase();
const keys = Object.keys(obj);
let i = keys.length;
let _key;
while (i-- > 0) {
_key = keys[i];
if (key === _key.toLowerCase()) {
return _key;
}
}
return null;
}
var _global = (() => {
if (typeof globalThis !== "undefined")
return globalThis;
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
})();
var isContextDefined = (context) => !isUndefined(context) && context !== _global;
function merge() {
const { caseless } = isContextDefined(this) && this || {};
const result = {};
const assignValue = (val, key) => {
const targetKey = caseless && findKey(result, key) || key;
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
result[targetKey] = merge(result[targetKey], val);
} else if (isPlainObject(val)) {
result[targetKey] = merge({}, val);
} else if (isArray(val)) {
result[targetKey] = val.slice();
} else {
result[targetKey] = val;
}
};
for (let i = 0, l = arguments.length; i < l; i++) {
arguments[i] && forEach(arguments[i], assignValue);
}
return result;
}
var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
forEach(b, (val, key) => {
if (thisArg && isFunction(val)) {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
}, { allOwnKeys });
return a;
};
var stripBOM = (content) => {
if (content.charCodeAt(0) === 65279) {
content = content.slice(1);
}
return content;
};
var inherits = (constructor, superConstructor, props, descriptors2) => {
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
constructor.prototype.constructor = constructor;
Object.defineProperty(constructor, "super", {
value: superConstructor.prototype
});
props && Object.assign(constructor.prototype, props);
};
var toFlatObject = (sourceObj, destObj, filter, propFilter) => {
let props;
let i;
let prop;
const merged = {};
destObj = destObj || {};
if (sourceObj == null)
return destObj;
do {
props = Object.getOwnPropertyNames(sourceObj);
i = props.length;
while (i-- > 0) {
prop = props[i];
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
destObj[prop] = sourceObj[prop];
merged[prop] = true;
}
}
sourceObj = filter !== false && getPrototypeOf(sourceObj);
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
return destObj;
};
var endsWith = (str, searchString, position) => {
str = String(str);
if (position === void 0 || position > str.length) {
position = str.length;
}
position -= searchString.length;
const lastIndex = str.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
var toArray = (thing) => {
if (!thing)
return null;
if (isArray(thing))
return thing;
let i = thing.length;
if (!isNumber(i))
return null;
const arr = new Array(i);
while (i-- > 0) {
arr[i] = thing[i];
}
return arr;
};
var isTypedArray = ((TypedArray) => {
return (thing) => {
return TypedArray && thing instanceof TypedArray;
};
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
var forEachEntry = (obj, fn) => {
const generator = obj && obj[iterator];
const _iterator = generator.call(obj);
let result;
while ((result = _iterator.next()) && !result.done) {
const pair = result.value;
fn.call(obj, pair[0], pair[1]);
}
};
var matchAll = (regExp, str) => {
let matches;
const arr = [];
while ((matches = regExp.exec(str)) !== null) {
arr.push(matches);
}
return arr;
};
var isHTMLForm = kindOfTest("HTMLFormElement");
var toCamelCase = (str) => {
return str.toLowerCase().replace(
/[-_\s]([a-z\d])(\w*)/g,
function replacer(m, p1, p2) {
return p1.toUpperCase() + p2;
}
);
};
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
var isRegExp = kindOfTest("RegExp");
var reduceDescriptors = (obj, reducer) => {
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
const reducedDescriptors = {};
forEach(descriptors2, (descriptor, name) => {
let ret;
if ((ret = reducer(descriptor, name, obj)) !== false) {
reducedDescriptors[name] = ret || descriptor;
}
});
Object.defineProperties(obj, reducedDescriptors);
};
var freezeMethods = (obj) => {
reduceDescriptors(obj, (descriptor, name) => {
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
return false;
}
const value = obj[name];
if (!isFunction(value))
return;
descriptor.enumerable = false;
if ("writable" in descriptor) {
descriptor.writable = false;
return;
}
if (!descriptor.set) {
descriptor.set = () => {
throw Error("Can not rewrite read-only method '" + name + "'");
};
}
});
};
var toObjectSet = (arrayOrString, delimiter) => {
const obj = {};
const define2 = (arr) => {
arr.forEach((value) => {
obj[value] = true;
});
};
isArray(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
return obj;
};
var noop = () => {
};
var toFiniteNumber = (value, defaultValue) => {
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
};
function isSpecCompliantForm(thing) {
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
}
var toJSONObject = (obj) => {
const stack = new Array(10);
const visit = (source, i) => {
if (isObject(source)) {
if (stack.indexOf(source) >= 0) {
return;
}
if (!("toJSON" in source)) {
stack[i] = source;
const target = isArray(source) ? [] : {};
forEach(source, (value, key) => {
const reducedValue = visit(value, i + 1);
!isUndefined(reducedValue) && (target[key] = reducedValue);
});
stack[i] = void 0;
return target;
}
}
return source;
};
return visit(obj, 0);
};
var isAsyncFn = kindOfTest("AsyncFunction");
var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
if (setImmediateSupported) {
return setImmediate;
}
return postMessageSupported ? ((token, callbacks) => {
_global.addEventListener("message", ({ source, data }) => {
if (source === _global && data === token) {
callbacks.length && callbacks.shift()();
}
}, false);
return (cb) => {
callbacks.push(cb);
_global.postMessage(token, "*");
};
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
})(
typeof setImmediate === "function",
isFunction(_global.postMessage)
);
var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
var utils$1 = {
isArray,
isArrayBuffer,
isBuffer,
isFormData,
isArrayBufferView,
isString,
isNumber,
isBoolean,
isObject,
isPlainObject,
isReadableStream,
isRequest,
isResponse,
isHeaders,
isUndefined,
isDate,
isFile,
isBlob,
isRegExp,
isFunction,
isStream,
isURLSearchParams,
isTypedArray,
isFileList,
forEach,
merge,
extend,
trim,
stripBOM,
inherits,
toFlatObject,
kindOf,
kindOfTest,
endsWith,
toArray,
forEachEntry,
matchAll,
isHTMLForm,
hasOwnProperty,
hasOwnProp: hasOwnProperty,
reduceDescriptors,
freezeMethods,
toObjectSet,
toCamelCase,
noop,
toFiniteNumber,
findKey,
global: _global,
isContextDefined,
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
isThenable,
setImmediate: _setImmediate,
asap,
isIterable
};
function AxiosError(message, code, config, request, response) {
Error.call(this);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack;
}
this.message = message;
this.name = "AxiosError";
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils$1.inherits(AxiosError, Error, {
toJSON: function toJSON() {
return {
message: this.message,
name: this.name,
description: this.description,
number: this.number,
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
});
var prototype$1 = AxiosError.prototype;
var descriptors = {};
[
"ERR_BAD_OPTION_VALUE",
"ERR_BAD_OPTION",
"ECONNABORTED",
"ETIMEDOUT",
"ERR_NETWORK",
"ERR_FR_TOO_MANY_REDIRECTS",
"ERR_DEPRECATED",
"ERR_BAD_RESPONSE",
"ERR_BAD_REQUEST",
"ERR_CANCELED",
"ERR_NOT_SUPPORT",
"ERR_INVALID_URL"
].forEach((code) => {
descriptors[code] = { value: code };
});
Object.defineProperties(AxiosError, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
AxiosError.from = (error, code, config, request, response, customProps) => {
const axiosError = Object.create(prototype$1);
utils$1.toFlatObject(error, axiosError, function filter(obj) {
return obj !== Error.prototype;
}, (prop) => {
return prop !== "isAxiosError";
});
AxiosError.call(axiosError, error.message, code, config, request, response);
axiosError.cause = error;
axiosError.name = error.name;
customProps && Object.assign(axiosError, customProps);
return axiosError;
};
var httpAdapter = null;
function isVisitable(thing) {
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
function removeBrackets(key) {
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
}
function renderKey(path, key, dots) {
if (!path)
return key;
return path.concat(key).map(function each(token, i) {
token = removeBrackets(token);
return !dots && i ? "[" + token + "]" : token;
}).join(dots ? "." : "");
}
function isFlatArray(arr) {
return utils$1.isArray(arr) && !arr.some(isVisitable);
}
var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
function toFormData(obj, formData, options) {
if (!utils$1.isObject(obj)) {
throw new TypeError("target must be an object");
}
formData = formData || new FormData();
options = utils$1.toFlatObject(options, {
metaTokens: true,
dots: false,
indexes: false
}, false, function defined(option, source) {
return !utils$1.isUndefined(source[option]);
});
const metaTokens = options.metaTokens;
const visitor = options.visitor || defaultVisitor;
const dots = options.dots;
const indexes = options.indexes;
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
if (!utils$1.isFunction(visitor)) {
throw new TypeError("visitor must be a function");
}
function convertValue(value) {
if (value === null)
return "";
if (utils$1.isDate(value)) {
return value.toISOString();
}
if (!useBlob && utils$1.isBlob(value)) {
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
}
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
}
return value;
}
function defaultVisitor(value, key, path) {
let arr = value;
if (value && !path && typeof value === "object") {
if (utils$1.endsWith(key, "{}")) {
key = metaTokens ? key : key.slice(0, -2);
value = JSON.stringify(value);
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!(utils$1.isUndefined(el) || el === null) && formData.append(
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
convertValue(el)
);
});
return false;
}
}
if (isVisitable(value)) {
return true;
}
formData.append(renderKey(path, key, dots), convertValue(value));
return false;
}
const stack = [];
const exposedHelpers = Object.assign(predicates, {
defaultVisitor,
convertValue,
isVisitable
});
function build(value, path) {
if (utils$1.isUndefined(value))
return;
if (stack.indexOf(value) !== -1) {
throw Error("Circular reference detected in " + path.join("."));
}
stack.push(value);
utils$1.forEach(value, function each(el, key) {
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
formData,
el,
utils$1.isString(key) ? key.trim() : key,
path,
exposedHelpers
);
if (result === true) {
build(el, path ? path.concat(key) : [key]);
}
});
stack.pop();
}
if (!utils$1.isObject(obj)) {
throw new TypeError("data must be an object");
}
build(obj);
return formData;
}
function encode$1(str) {
const charMap = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
return charMap[match];
});
}
function AxiosURLSearchParams(params, options) {
this._pairs = [];
params && toFormData(params, this, options);
}
var prototype = AxiosURLSearchParams.prototype;
prototype.append = function append(name, value) {
this._pairs.push([name, value]);
};
prototype.toString = function toString2(encoder) {
const _encode = encoder ? function(value) {
return encoder.call(this, value, encode$1);
} : encode$1;
return this._pairs.map(function each(pair) {
return _encode(pair[0]) + "=" + _encode(pair[1]);
}, "").join("&");
};
function encode(val) {
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function buildURL(url, params, options) {
if (!params) {
return url;
}
const _encode = options && options.encode || encode;
if (utils$1.isFunction(options)) {
options = {
serialize: options
};
}
const serializeFn = options && options.serialize;
let serializedParams;
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
}
if (serializedParams) {
const hashmarkIndex = url.indexOf("#");
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
}
return url;
}
var InterceptorManager = class {
constructor() {
this.handlers = [];
}
use(fulfilled, rejected, options) {
this.handlers.push({
fulfilled,
rejected,
synchronous: options ? options.synchronous : false,
runWhen: options ? options.runWhen : null
});
return this.handlers.length - 1;
}
eject(id) {
if (this.handlers[id]) {
this.handlers[id] = null;
}
}
clear() {
if (this.handlers) {
this.handlers = [];
}
}
forEach(fn) {
utils$1.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
});
}
};
var InterceptorManager$1 = InterceptorManager;
var transitionalDefaults = {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
};
var URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
var FormData$1 = typeof FormData !== "undefined" ? FormData : null;
var Blob$1 = typeof Blob !== "undefined" ? Blob : null;
var platform$1 = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams$1,
FormData: FormData$1,
Blob: Blob$1
},
protocols: ["http", "https", "file", "blob", "url", "data"]
};
var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
var _navigator = typeof navigator === "object" && navigator || void 0;
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
var hasStandardBrowserWebWorkerEnv = (() => {
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
})();
var origin = hasBrowserEnv && window.location.href || "http://localhost";
var utils = /* @__PURE__ */ Object.freeze({
__proto__: null,
hasBrowserEnv,
hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv,
navigator: _navigator,
origin
});
var platform = {
...utils,
...platform$1
};
function toURLEncodedForm(data, options) {
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
visitor: function(value, key, path, helpers) {
if (platform.isNode && utils$1.isBuffer(value)) {
this.append(key, value.toString("base64"));
return false;
}
return helpers.defaultVisitor.apply(this, arguments);
}
}, options));
}
function parsePropPath(name) {
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
return match[0] === "[]" ? "" : match[1] || match[0];
});
}
function arrayToObject(arr) {
const obj = {};
const keys = Object.keys(arr);
let i;
const len = keys.length;
let key;
for (i = 0; i < len; i++) {
key = keys[i];
obj[key] = arr[key];
}
return obj;
}
function formDataToJSON(formData) {
function buildPath(path, value, target, index) {
let name = path[index++];
if (name === "__proto__")
return true;
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path.length;
name = !name && utils$1.isArray(target) ? target.length : name;
if (isLast) {
if (utils$1.hasOwnProp(target, name)) {
target[name] = [target[name], value];
} else {
target[name] = value;
}
return !isNumericKey;
}
if (!target[name] || !utils$1.isObject(target[name])) {
target[name] = [];
}
const result = buildPath(path, value, target[name], index);
if (result && utils$1.isArray(target[name])) {
target[name] = arrayToObject(target[name]);
}
return !isNumericKey;
}
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
const obj = {};
utils$1.forEachEntry(formData, (name, value) => {
buildPath(parsePropPath(name), value, obj, 0);
});
return obj;
}
return null;
}
function stringifySafely(rawValue, parser, encoder) {
if (utils$1.isString(rawValue)) {
try {
(parser || JSON.parse)(rawValue);
return utils$1.trim(rawValue);
} catch (e) {
if (e.name !== "SyntaxError") {
throw e;
}
}
}
return (encoder || JSON.stringify)(rawValue);
}
var defaults = {
transitional: transitionalDefaults,
adapter: ["xhr", "http", "fetch"],
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || "";
const hasJSONContentType = contentType.indexOf("application/json") > -1;
const isObjectPayload = utils$1.isObject(data);
if (isObjectPayload && utils$1.isHTMLForm(data)) {
data = new FormData(data);
}
const isFormData2 = utils$1.isFormData(data);
if (isFormData2) {
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
return data;
}
if (utils$1.isArrayBufferView(data)) {
return data.buffer;
}
if (utils$1.isURLSearchParams(data)) {
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
return data.toString();
}
let isFileList2;
if (isObjectPayload) {
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
return toURLEncodedForm(data, this.formSerializer).toString();
}
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
const _FormData = this.env && this.env.FormData;
return toFormData(
isFileList2 ? { "files[]": data } : data,
_FormData && new _FormData(),
this.formSerializer
);
}
}
if (isObjectPayload || hasJSONContentType) {
headers.setContentType("application/json", false);
return stringifySafely(data);
}
return data;
}],
transformResponse: [function transformResponse(data) {
const transitional = this.transitional || defaults.transitional;
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
const JSONRequested = this.responseType === "json";
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
return data;
}
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
const silentJSONParsing = transitional && transitional.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
try {
return JSON.parse(data);
} catch (e) {
if (strictJSONParsing) {
if (e.name === "SyntaxError") {
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
}
throw e;
}
}
}
return data;
}],
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: platform.classes.FormData,
Blob: platform.classes.Blob
},
validateStatus: function validateStatus(status) {
return status >= 200 && status < 300;
},
headers: {
common: {
"Accept": "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
defaults.headers[method] = {};
});
var defaults$1 = defaults;
var ignoreDuplicateOf = utils$1.toObjectSet([
"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"
]);
var parseHeaders = (rawHeaders) => {
const parsed = {};
let key;
let val;
let i;
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
i = line.indexOf(":");
key = line.substring(0, i).trim().toLowerCase();
val = line.substring(i + 1).trim();
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
return;
}
if (key === "set-cookie") {
if (parsed[key]) {
parsed[key].push(val);
} else {
parsed[key] = [val];
}
} else {
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
}
});
return parsed;
};
var $internals = Symbol("internals");
function normalizeHeader(header) {
return header && String(header).trim().toLowerCase();
}
function normalizeValue(value) {
if (value === false || value == null) {
return value;
}
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
}
function parseTokens(str) {
const tokens = /* @__PURE__ */ Object.create(null);
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let match;
while (match = tokensRE.exec(str)) {
tokens[match[1]] = match[2];
}
return tokens;
}
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
if (utils$1.isFunction(filter)) {
return filter.call(this, value, header);
}
if (isHeaderNameFilter) {
value = header;
}
if (!utils$1.isString(value))
return;
if (utils$1.isString(filter)) {
return value.indexOf(filter) !== -1;
}
if (utils$1.isRegExp(filter)) {
return filter.test(value);
}
}
function formatHeader(header) {
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
return char.toUpperCase() + str;
});
}
function buildAccessors(obj, header) {
const accessorName = utils$1.toCamelCase(" " + header);
["get", "set", "has"].forEach((methodName) => {
Object.defineProperty(obj, methodName + accessorName, {
value: function(arg1, arg2, arg3) {
return this[methodName].call(this, header, arg1, arg2, arg3);
},
configurable: true
});
});
}
var AxiosHeaders = class {
constructor(headers) {
headers && this.set(headers);
}
set(header, valueOrRewrite, rewrite) {
const self2 = this;
function setHeader(_value, _header, _rewrite) {
const lHeader = normalizeHeader(_header);
if (!lHeader) {
throw new Error("header name must be a non-empty string");
}
const key = utils$1.findKey(self2, lHeader);
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
self2[key || _header] = normalizeValue(_value);
}
}
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
setHeaders(header, valueOrRewrite);
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
let obj = {}, dest, key;
for (const entry of header) {
if (!utils$1.isArray(entry)) {
throw TypeError("Object iterator must return a key-value pair");
}
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
}
setHeaders(obj, valueOrRewrite);
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
}
return this;
}
get(header, parser) {
header = normalizeHeader(header);
if (header) {
const key = utils$1.findKey(this, header);
if (key) {
const value = this[key];
if (!parser) {
return value;
}
if (parser === true) {
return parseTokens(value);
}
if (utils$1.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils$1.isRegExp(parser)) {
return parser.exec(value);
}
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(header, matcher) {
header = normalizeHeader(header);
if (header) {
const key = utils$1.findKey(this, header);
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
}
return false;
}
delete(header, matcher) {
const self2 = this;
let deleted = false;
function deleteHeader(_header) {
_header = normalizeHeader(_header);
if (_header) {
const key = utils$1.findKey(self2, _header);
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
delete self2[key];
deleted = true;
}
}
}
if (utils$1.isArray(header)) {
header.forEach(deleteHeader);
} else {
deleteHeader(header);
}
return deleted;
}
clear(matcher) {
const keys = Object.keys(this);
let i = keys.length;
let deleted = false;
while (i--) {
const key = keys[i];
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
delete this[key];
deleted = true;
}
}
return deleted;
}
normalize(format) {
const self2 = this;
const headers = {};
utils$1.forEach(this, (value, header) => {
const key = utils$1.findKey(headers, header);
if (key) {
self2[key] = normalizeValue(value);
delete self2[header];
return;
}
const normalized = format ? formatHeader(header) : String(header).trim();
if (normalized !== header) {
delete self2[header];
}
self2[normalized] = normalizeValue(value);
headers[normalized] = true;
});
return this;
}
concat(...targets) {
return this.constructor.concat(this, ...targets);
}
toJSON(asStrings) {
const obj = /* @__PURE__ */ Object.create(null);
utils$1.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
});
return obj;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
}
getSetCookie() {
return this.get("set-cookie") || [];
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(thing) {
return thing instanceof this ? thing : new this(thing);
}
static concat(first, ...targets) {
const computed = new this(first);
targets.forEach((target) => computed.set(target));
return computed;
}
static accessor(header) {
const internals = this[$internals] = this[$internals] = {
accessors: {}
};
const accessors = internals.accessors;
const prototype2 = this.prototype;
function defineAccessor(_header) {
const lHeader = normalizeHeader(_header);
if (!accessors[lHeader]) {
buildAccessors(prototype2, _header);
accessors[lHeader] = true;
}
}
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
};
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
let mapped = key[0].toUpperCase() + key.slice(1);
return {
get: () => value,
set(headerValue) {
this[mapped] = headerValue;
}
};
});
utils$1.freezeMethods(AxiosHeaders);
var AxiosHeaders$1 = AxiosHeaders;
function transformData(fns, response) {
const config = this || defaults$1;
const context = response || config;
const headers = AxiosHeaders$1.from(context.headers);
let data = context.data;
utils$1.forEach(fns, function transform(fn) {
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
});
headers.normalize();
return data;
}
function isCancel(value) {
return !!(value && value.__CANCEL__);
}
function CanceledError(message, config, request) {
AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
this.name = "CanceledError";
}
utils$1.inherits(CanceledError, AxiosError, {
__CANCEL__: true
});
function settle(resolve, reject, response) {
const validateStatus = response.config.validateStatus;
if (!response.status || !validateStatus || validateStatus(response.status)) {
resolve(response);
} else {
reject(new AxiosError(
"Request failed with status code " + response.status,
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
response.config,
response.request,
response
));
}
}
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
return match && match[1] || "";
}
function speedometer(samplesCount, min) {
samplesCount = samplesCount || 10;
const bytes = new Array(samplesCount);
const timestamps = new Array(samplesCount);
let head = 0;
let tail = 0;
let firstSampleTS;
min = min !== void 0 ? min : 1e3;
return function push(chunkLength) {
const now = Date.now();
const startedAt = timestamps[tail];
if (!firstSampleTS) {
firstSampleTS = now;
}
bytes[head] = chunkLength;
timestamps[head] = now;
let i = tail;
let bytesCount = 0;
while (i !== head) {
bytesCount += bytes[i++];
i = i % samplesCount;
}
head = (head + 1) % samplesCount;
if (head === tail) {
tail = (tail + 1) % samplesCount;
}
if (now - firstSampleTS < min) {
return;
}
const passed = startedAt && now - startedAt;
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
};
}
function throttle(fn, freq) {
let timestamp = 0;
let threshold = 1e3 / freq;
let lastArgs;
let timer;
const invoke = (args, now = Date.now()) => {
timestamp = now;
lastArgs = null;
if (timer) {
clearTimeout(timer);
timer = null;
}
fn.apply(null, args);
};
const throttled = (...args) => {
const now = Date.now();
const passed = now - timestamp;
if (passed >= threshold) {
invoke(args, now);
} else {
lastArgs = args;
if (!timer) {
timer = setTimeout(() => {
timer = null;
invoke(lastArgs);
}, threshold - passed);
}
}
};
const flush = () => lastArgs && invoke(lastArgs);
return [throttled, flush];
}
var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
let bytesNotified = 0;
const _speedometer = speedometer(50, 250);
return throttle((e) => {
const loaded = e.loaded;
const total = e.lengthComputable ? e.total : void 0;
const progressBytes = loaded - bytesNotified;
const rate = _speedometer(progressBytes);
const inRange = loaded <= total;
bytesNotified = loaded;
const data = {
loaded,
total,
progress: total ? loaded / total : void 0,
bytes: progressBytes,
rate: rate ? rate : void 0,
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
event: e,
lengthComputable: total != null,
[isDownloadStream ? "download" : "upload"]: true
};
listener(data);
}, freq);
};
var progressEventDecorator = (total, throttled) => {
const lengthComputable = total != null;
return [(loaded) => throttled[0]({
lengthComputable,
total,
loaded
}), throttled[1]];
};
var asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url) => {
url = new URL(url, platform.origin);
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
})(
new URL(platform.origin),
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => true;
var cookies = platform.hasStandardBrowserEnv ? {
write(name, value, expires, path, domain, secure) {
const cookie = [name + "=" + encodeURIComponent(value)];
utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
utils$1.isString(path) && cookie.push("path=" + path);
utils$1.isString(domain) && cookie.push("domain=" + domain);
secure === true && cookie.push("secure");
document.cookie = cookie.join("; ");
},
read(name) {
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
return match ? decodeURIComponent(match[3]) : null;
},
remove(name) {
this.write(name, "", Date.now() - 864e5);
}
} : {
write() {
},
read() {
return null;
},
remove() {
}
};
function isAbsoluteURL(url) {
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
}
function combineURLs(baseURL, relativeURL) {
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
}
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
let isRelativeUrl = !isAbsoluteURL(requestedURL);
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
return combineURLs(baseURL, requestedURL);
}
return requestedURL;
}
var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
function mergeConfig(config1, config2) {
config2 = config2 || {};
const config = {};
function getMergedValue(target, source, prop, caseless) {
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
return utils$1.merge.call({ caseless }, target, source);
} else if (utils$1.isPlainObject(source)) {
return utils$1.merge({}, source);
} else if (utils$1.isArray(source)) {
return source.slice();
}
return source;
}
function mergeDeepProperties(a, b, prop, caseless) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(a, b, prop, caseless);
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(void 0, a, prop, caseless);
}
}
function valueFromConfig2(a, b) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(void 0, b);
}
}
function defaultToConfig2(a, b) {
if (!utils$1.isUndefined(b)) {
return getMergedValue(void 0, b);
} else if (!utils$1.isUndefined(a)) {
return getMergedValue(void 0, a);
}
}
function mergeDirectKeys(a, b, prop) {
if (prop in config2) {
return getMergedValue(a, b);
} else if (prop in config1) {
return getMergedValue(void 0, a);
}
}
const mergeMap = {
url: valueFromConfig2,
method: valueFromConfig2,
data: valueFromConfig2,
baseURL: defaultToConfig2,
transformRequest: defaultToConfig2,
transformResponse: defaultToConfig2,
paramsSerializer: defaultToConfig2,
timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2,
responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2,
xsrfHeaderName: defaultToConfig2,
onUploadProgress: defaultToConfig2,
onDownloadProgress: defaultToConfig2,
decompress: defaultToConfig2,
maxContentLength: defaultToConfig2,
maxBodyLength: defaultToConfig2,
beforeRedirect: defaultToConfig2,
transport: defaultToConfig2,
httpAgent: defaultToConfig2,
httpsAgent: defaultToConfig2,
cancelToken: defaultToConfig2,
socketPath: defaultToConfig2,
responseEncoding: defaultToConfig2,
validateStatus: mergeDirectKeys,
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
};
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
const merge2 = mergeMap[prop] || mergeDeepProperties;
const configValue = merge2(config1[prop], config2[prop], prop);
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
});
return config;
}
var resolveConfig = (config) => {
const newConfig = mergeConfig({}, config);
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
newConfig.headers = headers = AxiosHeaders$1.from(headers);
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
if (auth) {
headers.set(
"Authorization",
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
);
}
let contentType;
if (utils$1.isFormData(data)) {
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
headers.setContentType(void 0);
} else if ((contentType = headers.getContentType()) !== false) {
const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
}
}
if (platform.hasStandardBrowserEnv) {
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
if (xsrfValue) {
headers.set(xsrfHeaderName, xsrfValue);
}
}
}
return newConfig;
};
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
var xhrAdapter = isXHRAdapterSupported && function(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
const _config = resolveConfig(config);
let requestData = _config.data;
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
let { responseType, onUploadProgress, onDownloadProgress } = _config;
let onCanceled;
let uploadThrottled, downloadThrottled;
let flushUpload, flushDownload;
function done() {
flushUpload && flushUpload();
flushDownload && flushDownload();
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
}
let request = new XMLHttpRequest();
request.open(_config.method.toUpperCase(), _config.url, true);
request.timeout = _config.timeout;
function onloadend() {
if (!request) {
return;
}
const responseHeaders = AxiosHeaders$1.from(
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
);
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
const response = {
data: responseData,
status: request.status,
statusText: request.statusText,
headers: responseHeaders,
config,
request
};
settle(function _resolve(value) {
resolve(value);
done();
}, function _reject(err) {
reject(err);
done();
}, response);
request = null;
}
if ("onloadend" in request) {
request.onloadend = onloadend;
} else {
request.onreadystatechange = function handleLoad() {
if (!request || request.readyState !== 4) {
return;
}
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
return;
}
setTimeout(onloadend);
};
}
request.onabort = function handleAbort() {
if (!request) {
return;
}
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
request = null;
};
request.onerror = function handleError() {
reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
request = null;
};
request.ontimeout = function handleTimeout() {
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
const transitional = _config.transitional || transitionalDefaults;
if (_config.timeoutErrorMessage) {
timeoutErrorMessage = _config.timeoutErrorMessage;
}
reject(new AxiosError(
timeoutErrorMessage,
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
config,
request
));
request = null;
};
requestData === void 0 && requestHeaders.setContentType(null);
if ("setRequestHeader" in request) {
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
request.setRequestHeader(key, val);
});
}
if (!utils$1.isUndefined(_config.withCredentials)) {
request.withCredentials = !!_config.withCredentials;
}
if (responseType && responseType !== "json") {
request.responseType = _config.responseType;
}
if (onDownloadProgress) {
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
request.addEventListener("progress", downloadThrottled);
}
if (onUploadProgress && request.upload) {
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
request.upload.addEventListener("progress", uploadThrottled);
request.upload.addEventListener("loadend", flushUpload);
}
if (_config.cancelToken || _config.signal) {
onCanceled = (cancel) => {
if (!request) {
return;
}
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
request.abort();
request = null;
};
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
if (_config.signal) {
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
}
}
const protocol = parseProtocol(_config.url);
if (protocol && platform.protocols.indexOf(protocol) === -1) {
reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
return;
}
request.send(requestData || null);
});
};
var composeSignals = (signals, timeout) => {
const { length } = signals = signals ? signals.filter(Boolean) : [];
if (timeout || length) {
let controller = new AbortController();
let aborted;
const onabort = function(reason) {
if (!aborted) {
aborted = true;
unsubscribe();
const err = reason instanceof Error ? reason : this.reason;
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
}
};
let timer = timeout && setTimeout(() => {
timer = null;
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
}, timeout);
const unsubscribe = () => {
if (signals) {
timer && clearTimeout(timer);
timer = null;
signals.forEach((signal2) => {
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
});
signals = null;
}
};
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
const { signal } = controller;
signal.unsubscribe = () => utils$1.asap(unsubscribe);
return signal;
}
};
var composeSignals$1 = composeSignals;
var streamChunk = function* (chunk, chunkSize) {
let len = chunk.byteLength;
if (!chunkSize || len < chunkSize) {
yield chunk;
return;
}
let pos = 0;
let end;
while (pos < len) {
end = pos + chunkSize;
yield chunk.slice(pos, end);
pos = end;
}
};
var readBytes = async function* (iterable, chunkSize) {
for await (const chunk of readStream(iterable)) {
yield* streamChunk(chunk, chunkSize);
}
};
var readStream = async function* (stream) {
if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (; ; ) {
const { done, value } = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
};
var trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator2 = readBytes(stream, chunkSize);
let bytes = 0;
let done;
let _onFinish = (e) => {
if (!done) {
done = true;
onFinish && onFinish(e);
}
};
return new ReadableStream({
async pull(controller) {
try {
const { done: done2, value } = await iterator2.next();
if (done2) {
_onFinish();
controller.close();
return;
}
let len = value.byteLength;
if (onProgress) {
let loadedBytes = bytes += len;
onProgress(loadedBytes);
}
controller.enqueue(new Uint8Array(value));
} catch (err) {
_onFinish(err);
throw err;
}
},
cancel(reason) {
_onFinish(reason);
return iterator2.return();
}
}, {
highWaterMark: 2
});
};
var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
var test = (fn, ...args) => {
try {
return !!fn(...args);
} catch (e) {
return false;
}
};
var supportsRequestStream = isReadableStreamSupported && test(() => {
let duplexAccessed = false;
const hasContentType = new Request(platform.origin, {
body: new ReadableStream(),
method: "POST",
get duplex() {
duplexAccessed = true;
return "half";
}
}).headers.has("Content-Type");
return duplexAccessed && !hasContentType;
});
var DEFAULT_CHUNK_SIZE = 64 * 1024;
var supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
var resolvers = {
stream: supportsResponseStream && ((res) => res.body)
};
isFetchSupported && ((res) => {
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
});
});
})(new Response());
var getBodyLength = async (body) => {
if (body == null) {
return 0;
}
if (utils$1.isBlob(body)) {
return body.size;
}
if (utils$1.isSpecCompliantForm(body)) {
const _request = new Request(platform.origin, {
method: "POST",
body
});
return (await _request.arrayBuffer()).byteLength;
}
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
return body.byteLength;
}
if (utils$1.isURLSearchParams(body)) {
body = body + "";
}
if (utils$1.isString(body)) {
return (await encodeText(body)).byteLength;
}
};
var resolveBodyLength = async (headers, body) => {
const length = utils$1.toFiniteNumber(headers.getContentLength());
return length == null ? getBodyLength(body) : length;
};
var fetchAdapter = isFetchSupported && (async (config) => {
let {
url,
method,
data,
signal,
cancelToken,
timeout,
onDownloadProgress,
onUploadProgress,
responseType,
headers,
withCredentials = "same-origin",
fetchOptions
} = resolveConfig(config);
responseType = responseType ? (responseType + "").toLowerCase() : "text";
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
let request;
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
composedSignal.unsubscribe();
});
let requestContentLength;
try {
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
let _request = new Request(url, {
method: "POST",
body: data,
duplex: "half"
});
let contentTypeHeader;
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
headers.setContentType(contentTypeHeader);
}
if (_request.body) {
const [onProgress, flush] = progressEventDecorator(
requestContentLength,
progressEventReducer(asyncDecorator(onUploadProgress))
);
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
}
}
if (!utils$1.isString(withCredentials)) {
withCredentials = withCredentials ? "include" : "omit";
}
const isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, {
...fetchOptions,
signal: composedSignal,
method: method.toUpperCase(),
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: isCredentialsSupported ? withCredentials : void 0
});
let response = await fetch(request);
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
const options = {};
["status", "statusText", "headers"].forEach((prop) => {
options[prop] = response[prop];
});
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
responseContentLength,
progressEventReducer(asyncDecorator(onDownloadProgress), true)
) || [];
response = new Response(
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush();
unsubscribe && unsubscribe();
}),
options
);
}
responseType = responseType || "text";
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
!isStreamResponse && unsubscribe && unsubscribe();
return await new Promise((resolve, reject) => {
settle(resolve, reject, {
data: responseData,
headers: AxiosHeaders$1.from(response.headers),
status: response.status,
statusText: response.statusText,
config,
request
});
});
} catch (err) {
unsubscribe && unsubscribe();
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
throw Object.assign(
new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
{
cause: err.cause || err
}
);
}
throw AxiosError.from(err, err && err.code, config, request);
}
});
var knownAdapters = {
http: httpAdapter,
xhr: xhrAdapter,
fetch: fetchAdapter
};
utils$1.forEach(knownAdapters, (fn, value) => {
if (fn) {
try {
Object.defineProperty(fn, "name", { value });
} catch (e) {
}
Object.defineProperty(fn, "adapterName", { value });
}
});
var renderReason = (reason) => `- ${reason}`;
var isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
var adapters = {
getAdapter: (adapters2) => {
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
const { length } = adapters2;
let nameOrAdapter;
let adapter;
const rejectedReasons = {};
for (let i = 0; i < length; i++) {
nameOrAdapter = adapters2[i];
let id;
adapter = nameOrAdapter;
if (!isResolvedHandle(nameOrAdapter)) {
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
if (adapter === void 0) {
throw new AxiosError(`Unknown adapter '${id}'`);
}
}
if (adapter) {
break;
}
rejectedReasons[id || "#" + i] = adapter;
}
if (!adapter) {
const reasons = Object.entries(rejectedReasons).map(
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
);
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
throw new AxiosError(
`There is no suitable adapter to dispatch the request ` + s,
"ERR_NOT_SUPPORT"
);
}
return adapter;
},
adapters: knownAdapters
};
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
if (config.signal && config.signal.aborted) {
throw new CanceledError(null, config);
}
}
function dispatchRequest(config) {
throwIfCancellationRequested(config);
config.headers = AxiosHeaders$1.from(config.headers);
config.data = transformData.call(
config,
config.transformRequest
);
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
config.headers.setContentType("application/x-www-form-urlencoded", false);
}
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
return adapter(config).then(function onAdapterResolution(response) {
throwIfCancellationRequested(config);
response.data = transformData.call(
config,
config.transformResponse,
response
);
response.headers = AxiosHeaders$1.from(response.headers);
return response;
}, function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
if (reason && reason.response) {
reason.response.data = transformData.call(
config,
config.transformResponse,
reason.response
);
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
}
}
return Promise.reject(reason);
});
}
var VERSION = "1.9.0";
var validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
validators$1[type] = function validator2(thing) {
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
};
});
var deprecatedWarnings = {};
validators$1.transitional = function transitional(validator2, version, message) {
function formatMessage(opt, desc) {
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
}
return (value, opt, opts) => {
if (validator2 === false) {
throw new AxiosError(
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
AxiosError.ERR_DEPRECATED
);
}
if (version && !deprecatedWarnings[opt]) {
deprecatedWarnings[opt] = true;
console.warn(
formatMessage(
opt,
" has been deprecated since v" + version + " and will be removed in the near future"
)
);
}
return validator2 ? validator2(value, opt, opts) : true;
};
};
validators$1.spelling = function spelling(correctSpelling) {
return (value, opt) => {
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
return true;
};
};
function assertOptions(options, schema, allowUnknown) {
if (typeof options !== "object") {
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
}
const keys = Object.keys(options);
let i = keys.length;
while (i-- > 0) {
const opt = keys[i];
const validator2 = schema[opt];
if (validator2) {
const value = options[opt];
const result = value === void 0 || validator2(value, opt, options);
if (result !== true) {
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
}
continue;
}
if (allowUnknown !== true) {
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
}
}
}
var validator = {
assertOptions,
validators: validators$1
};
var validators = validator.validators;
var Axios = class {
constructor(instanceConfig) {
this.defaults = instanceConfig || {};
this.interceptors = {
request: new InterceptorManager$1(),
response: new InterceptorManager$1()
};
}
async request(configOrUrl, config) {
try {
return await this._request(configOrUrl, config);
} catch (err) {
if (err instanceof Error) {
let dummy = {};
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
try {
if (!err.stack) {
err.stack = stack;
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
err.stack += "\n" + stack;
}
} catch (e) {
}
}
throw err;
}
}
_request(configOrUrl, config) {
if (typeof configOrUrl === "string") {
config = config || {};
config.url = configOrUrl;
} else {
config = configOrUrl || {};
}
config = mergeConfig(this.defaults, config);
const { transitional, paramsSerializer, headers } = config;
if (transitional !== void 0) {
validator.assertOptions(transitional, {
silentJSONParsing: validators.transitional(validators.boolean),
forcedJSONParsing: validators.transitional(validators.boolean),
clarifyTimeoutError: validators.transitional(validators.boolean)
}, false);
}
if (paramsSerializer != null) {
if (utils$1.isFunction(paramsSerializer)) {
config.paramsSerializer = {
serialize: paramsSerializer
};
} else {
validator.assertOptions(paramsSerializer, {
encode: validators.function,
serialize: validators.function
}, true);
}
}
if (config.allowAbsoluteUrls !== void 0)
;
else if (this.defaults.allowAbsoluteUrls !== void 0) {
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
} else {
config.allowAbsoluteUrls = true;
}
validator.assertOptions(config, {
baseUrl: validators.spelling("baseURL"),
withXsrfToken: validators.spelling("withXSRFToken")
}, true);
config.method = (config.method || this.defaults.method || "get").toLowerCase();
let contextHeaders = headers && utils$1.merge(
headers.common,
headers[config.method]
);
headers && utils$1.forEach(
["delete", "get", "head", "post", "put", "patch", "common"],
(method) => {
delete headers[method];
}
);
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
const requestInterceptorChain = [];
let synchronousRequestInterceptors = true;
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
return;
}
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
});
const responseInterceptorChain = [];
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
});
let promise;
let i = 0;
let len;
if (!synchronousRequestInterceptors) {
const chain = [dispatchRequest.bind(this), void 0];
chain.unshift.apply(chain, requestInterceptorChain);
chain.push.apply(chain, responseInterceptorChain);
len = chain.length;
promise = Promise.resolve(config);
while (i < len) {
promise = promise.then(chain[i++], chain[i++]);
}
return promise;
}
len = requestInterceptorChain.length;
let newConfig = config;
i = 0;
while (i < len) {
const onFulfilled = requestInterceptorChain[i++];
const onRejected = requestInterceptorChain[i++];
try {
newConfig = onFulfilled(newConfig);
} catch (error) {
onRejected.call(this, error);
break;
}
}
try {
promise = dispatchRequest.call(this, newConfig);
} catch (error) {
return Promise.reject(error);
}
i = 0;
len = responseInterceptorChain.length;
while (i < len) {
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
}
return promise;
}
getUri(config) {
config = mergeConfig(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
};
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
Axios.prototype[method] = function(url, config) {
return this.request(mergeConfig(config || {}, {
method,
url,
data: (config || {}).data
}));
};
});
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
function generateHTTPMethod(isForm) {
return function httpMethod(url, data, config) {
return this.request(mergeConfig(config || {}, {
method,
headers: isForm ? {
"Content-Type": "multipart/form-data"
} : {},
url,
data
}));
};
}
Axios.prototype[method] = generateHTTPMethod();
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
});
var Axios$1 = Axios;
var CancelToken = class {
constructor(executor) {
if (typeof executor !== "function") {
throw new TypeError("executor must be a function.");
}
let resolvePromise;
this.promise = new Promise(function promiseExecutor(resolve) {
resolvePromise = resolve;
});
const token = this;
this.promise.then((cancel) => {
if (!token._listeners)
return;
let i = token._listeners.length;
while (i-- > 0) {
token._listeners[i](cancel);
}
token._listeners = null;
});
this.promise.then = (onfulfilled) => {
let _resolve;
const promise = new Promise((resolve) => {
token.subscribe(resolve);
_resolve = resolve;
}).then(onfulfilled);
promise.cancel = function reject() {
token.unsubscribe(_resolve);
};
return promise;
};
executor(function cancel(message, config, request) {
if (token.reason) {
return;
}
token.reason = new CanceledError(message, config, request);
resolvePromise(token.reason);
});
}
throwIfRequested() {
if (this.reason) {
throw this.reason;
}
}
subscribe(listener) {
if (this.reason) {
listener(this.reason);
return;
}
if (this._listeners) {
this._listeners.push(listener);
} else {
this._listeners = [listener];
}
}
unsubscribe(listener) {
if (!this._listeners) {
return;
}
const index = this._listeners.indexOf(listener);
if (index !== -1) {
this._listeners.splice(index, 1);
}
}
toAbortSignal() {
const controller = new AbortController();
const abort = (err) => {
controller.abort(err);
};
this.subscribe(abort);
controller.signal.unsubscribe = () => this.unsubscribe(abort);
return controller.signal;
}
static source() {
let cancel;
const token = new CancelToken(function executor(c) {
cancel = c;
});
return {
token,
cancel
};
}
};
var CancelToken$1 = CancelToken;
function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
}
function isAxiosError(payload) {
return utils$1.isObject(payload) && payload.isAxiosError === true;
}
var HttpStatusCode = {
Continue: 100,
SwitchingProtocols: 101,
Processing: 102,
EarlyHints: 103,
Ok: 200,
Created: 201,
Accepted: 202,
NonAuthoritativeInformation: 203,
NoContent: 204,
ResetContent: 205,
PartialContent: 206,
MultiStatus: 207,
AlreadyReported: 208,
ImUsed: 226,
MultipleChoices: 300,
MovedPermanently: 301,
Found: 302,
SeeOther: 303,
NotModified: 304,
UseProxy: 305,
Unused: 306,
TemporaryRedirect: 307,
PermanentRedirect: 308,
BadRequest: 400,
Unauthorized: 401,
PaymentRequired: 402,
Forbidden: 403,
NotFound: 404,
MethodNotAllowed: 405,
NotAcceptable: 406,
ProxyAuthenticationRequired: 407,
RequestTimeout: 408,
Conflict: 409,
Gone: 410,
LengthRequired: 411,
PreconditionFailed: 412,
PayloadTooLarge: 413,
UriTooLong: 414,
UnsupportedMediaType: 415,
RangeNotSatisfiable: 416,
ExpectationFailed: 417,
ImATeapot: 418,
MisdirectedRequest: 421,
UnprocessableEntity: 422,
Locked: 423,
FailedDependency: 424,
TooEarly: 425,
UpgradeRequired: 426,
PreconditionRequired: 428,
TooManyRequests: 429,
RequestHeaderFieldsTooLarge: 431,
UnavailableForLegalReasons: 451,
InternalServerError: 500,
NotImplemented: 501,
BadGateway: 502,
ServiceUnavailable: 503,
GatewayTimeout: 504,
HttpVersionNotSupported: 505,
VariantAlsoNegotiates: 506,
InsufficientStorage: 507,
LoopDetected: 508,
NotExtended: 510,
NetworkAuthenticationRequired: 511
};
Object.entries(HttpStatusCode).forEach(([key, value]) => {
HttpStatusCode[value] = key;
});
var HttpStatusCode$1 = HttpStatusCode;
function createInstance(defaultConfig) {
const context = new Axios$1(defaultConfig);
const instance = bind(Axios$1.prototype.request, context);
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
utils$1.extend(instance, context, null, { allOwnKeys: true });
instance.create = function create(instanceConfig) {
return createInstance(mergeConfig(defaultConfig, instanceConfig));
};
return instance;
}
var axios = createInstance(defaults$1);
axios.Axios = Axios$1;
axios.CanceledError = CanceledError;
axios.CancelToken = CancelToken$1;
axios.isCancel = isCancel;
axios.VERSION = VERSION;
axios.toFormData = toFormData;
axios.AxiosError = AxiosError;
axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = spread;
axios.isAxiosError = isAxiosError;
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
module.exports = axios;
}
});
// node_modules/rox-browser/dist/rox-browser.min.js
var require_rox_browser_min = __commonJS({
"node_modules/rox-browser/dist/rox-browser.min.js"(exports, module) {
!function(t, e) {
"object" == typeof exports && "object" == typeof module ? module.exports = e(require_axios()) : "function" == typeof define && define.amd ? define(["axios"], e) : "object" == typeof exports ? exports.Rox = e(require_axios()) : t.Rox = e(t.axios);
}(globalThis, (t) => {
return r = { 934: (t2) => {
var e2 = { utf8: { stringToBytes: function(t3) {
return e2.bin.stringToBytes(unescape(encodeURIComponent(t3)));
}, bytesToString: function(t3) {
return decodeURIComponent(escape(e2.bin.bytesToString(t3)));
} }, bin: { stringToBytes: function(t3) {
for (var e3 = [], r2 = 0; r2 < t3.length; r2++)
e3.push(255 & t3.charCodeAt(r2));
return e3;
}, bytesToString: function(t3) {
for (var e3 = [], r2 = 0; r2 < t3.length; r2++)
e3.push(String.fromCharCode(t3[r2]));
return e3.join("");
} } };
t2.exports = e2;
}, 242: (t2) => {
var e2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r2 = { rotl: function(t3, e3) {
return t3 << e3 | t3 >>> 32 - e3;
}, rotr: function(t3, e3) {
return t3 << 32 - e3 | t3 >>> e3;
}, endian: function(t3) {
if (t3.constructor == Number)
return 16711935 & r2.rotl(t3, 8) | 4278255360 & r2.rotl(t3, 24);
for (var e3 = 0; e3 < t3.length; e3++)
t3[e3] = r2.endian(t3[e3]);
return t3;
}, randomBytes: function(t3) {
for (var e3 = []; 0 < t3; t3--)
e3.push(Math.floor(256 * Math.random()));
return e3;
}, bytesToWords: function(t3) {
for (var e3 = [], r3 = 0, i2 = 0; r3 < t3.length; r3++, i2 += 8)
e3[i2 >>> 5] |= t3[r3] << 24 - i2 % 32;
return e3;
}, wordsToBytes: function(t3) {
for (var e3 = [], r3 = 0; r3 < 32 * t3.length; r3 += 8)
e3.push(t3[r3 >>> 5] >>> 24 - r3 % 32 & 255);
return e3;
}, bytesToHex: function(t3) {
for (var e3 = [], r3 = 0; r3 < t3.length; r3++)
e3.push((t3[r3] >>> 4).toString(16)), e3.push((15 & t3[r3]).toString(16));
return e3.join("");
}, hexToBytes: function(t3) {
for (var e3 = [], r3 = 0; r3 < t3.length; r3 += 2)
e3.push(parseInt(t3.substr(r3, 2), 16));
return e3;
}, bytesToBase64: function(t3) {
for (var r3 = [], i2 = 0; i2 < t3.length; i2 += 3)
for (var n2 = t3[i2] << 16 | t3[i2 + 1] << 8 | t3[i2 + 2], s = 0; s < 4; s++)
8 * i2 + 6 * s <= 8 * t3.length ? r3.push(e2.charAt(n2 >>> 6 * (3 - s) & 63)) : r3.push("=");
return r3.join("");
}, base64ToBytes: function(t3) {
t3 = t3.replace(/[^A-Z0-9+\/]/gi, "");
for (var r3 = [], i2 = 0, n2 = 0; i2 < t3.length; n2 = ++i2 % 4)
0 != n2 && r3.push((e2.indexOf(t3.charAt(i2 - 1)) & Math.pow(2, -2 * n2 + 8) - 1) << 2 * n2 | e2.indexOf(t3.charAt(i2)) >>> 6 - 2 * n2);
return r3;
} };
t2.exports = r2;
}, 518: function(t2, e2) {
var r2, i2, n2, s, o, a, u, h, c, l, p;
function f() {
}
t2.exports = (r2 = Math, i2 = Object.create || function(t3) {
return f.prototype = t3, t3 = new f(), f.prototype = null, t3;
}, n2 = (t2 = {}).lib = {}, s = n2.Base = { extend: function(t3) {
var e3 = i2(this);
return t3 && e3.mixIn(t3), e3.hasOwnProperty("init") && this.init !== e3.init || (e3.init = function() {
e3.$super.init.apply(this, arguments);
}), (e3.init.prototype = e3).$super = this, e3;
}, create: function() {
var t3 = this.extend();
return t3.init.apply(t3, arguments), t3;
}, init: function() {
}, mixIn: function(t3) {
for (var e3 in t3)
t3.hasOwnProperty(e3) && (this[e3] = t3[e3]);
t3.hasOwnProperty("toString") && (this.toString = t3.toString);
}, clone: function() {
return this.init.prototype.extend(this);
} }, o = n2.WordArray = s.extend({ init: function(t3, e3) {
t3 = this.words = t3 || [], this.sigBytes = null != e3 ? e3 : 4 * t3.length;
}, toString: function(t3) {
return (t3 || u).stringify(this);
}, concat: function(t3) {
var e3 = this.words, r3 = t3.words, i3 = this.sigBytes, n3 = t3.sigBytes;
if (this.clamp(), i3 % 4)
for (var s2 = 0; s2 < n3; s2++) {
var o2 = r3[s2 >>> 2] >>> 24 - s2 % 4 * 8 & 255;
e3[i3 + s2 >>> 2] |= o2 << 24 - (i3 + s2) % 4 * 8;
}
else
for (s2 = 0; s2 < n3; s2 += 4)
e3[i3 + s2 >>> 2] = r3[s2 >>> 2];
return this.sigBytes += n3, this;
}, clamp: function() {
var t3 = this.words, e3 = this.sigBytes;
t3[e3 >>> 2] &= 4294967295 << 32 - e3 % 4 * 8, t3.length = r2.ceil(e3 / 4);
}, clone: function() {
var t3 = s.clone.call(this);
return t3.words = this.words.slice(0), t3;
}, random: function(t3) {
for (var e3 = [], i3 = 0; i3 < t3; i3 += 4) {
var n3 = function(t4) {
var e4 = 987654321, i4 = 4294967295;
return function() {
return ((((e4 = 36969 * (65535 & e4) + (e4 >> 16) & i4) << 16) + (t4 = 18e3 * (65535 & t4) + (t4 >> 16) & i4) & i4) / 4294967296 + 0.5) * (0.5 < r2.random() ? 1 : -1);
};
}(4294967296 * (s2 || r2.random())), s2 = 987654071 * n3();
e3.push(4294967296 * n3() | 0);
}
return new o.init(e3, t3);
} }), a = t2.enc = {}, u = a.Hex = { stringify: function(t3) {
for (var e3 = t3.words, r3 = t3.sigBytes, i3 = [], n3 = 0; n3 < r3; n3++) {
var s2 = e3[n3 >>> 2] >>> 24 - n3 % 4 * 8 & 255;
i3.push((s2 >>> 4).toString(16)), i3.push((15 & s2).toString(16));
}
return i3.join("");
}, parse: function(t3) {
for (var e3 = t3.length, r3 = [], i3 = 0; i3 < e3; i3 += 2)
r3[i3 >>> 3] |= parseInt(t3.substr(i3, 2), 16) << 24 - i3 % 8 * 4;
return new o.init(r3, e3 / 2);
} }, h = a.Latin1 = { stringify: function(t3) {
for (var e3 = t3.words, r3 = t3.sigBytes, i3 = [], n3 = 0; n3 < r3; n3++) {
var s2 = e3[n3 >>> 2] >>> 24 - n3 % 4 * 8 & 255;
i3.push(String.fromCharCode(s2));
}
return i3.join("");
}, parse: function(t3) {
for (var e3 = t3.length, r3 = [], i3 = 0; i3 < e3; i3++)
r3[i3 >>> 2] |= (255 & t3.charCodeAt(i3)) << 24 - i3 % 4 * 8;
return new o.init(r3, e3);
} }, c = a.Utf8 = { stringify: function(t3) {
try {
return decodeURIComponent(escape(h.stringify(t3)));
} catch (t4) {
throw new Error("Malformed UTF-8 data");
}
}, parse: function(t3) {
return h.parse(unescape(encodeURIComponent(t3)));
} }, l = n2.BufferedBlockAlgorithm = s.extend({ reset: function() {
this._data = new o.init(), this._nDataBytes = 0;
}, _append: function(t3) {
"string" == typeof t3 && (t3 = c.parse(t3)), this._data.concat(t3), this._nDataBytes += t3.sigBytes;
}, _process: function(t3) {
var e3 = this._data, i3 = e3.words, n3 = e3.sigBytes, s2 = this.blockSize, a2 = n3 / (4 * s2), u2 = (a2 = t3 ? r2.ceil(a2) : r2.max((0 | a2) - this._minBufferSize, 0)) * s2;
if (t3 = r2.min(4 * u2, n3), u2) {
for (var h2 = 0; h2 < u2; h2 += s2)
this._doProcessBlock(i3, h2);
var c2 = i3.splice(0, u2);
e3.sigBytes -= t3;
}
return new o.init(c2, t3);
}, clone: function() {
var t3 = s.clone.call(this);
return t3._data = this._data.clone(), t3;
}, _minBufferSize: 0 }), n2.Hasher = l.extend({ cfg: s.extend(), init: function(t3) {
this.cfg = this.cfg.extend(t3), this.reset();
}, reset: function() {
l.reset.call(this), this._doReset();
}, update: function(t3) {
return this._append(t3), this._process(), this;
}, finalize: function(t3) {
return t3 && this._append(t3), this._doFinalize();
}, blockSize: 16, _createHelper: function(t3) {
return function(e3, r3) {
return new t3.init(r3).finalize(e3);
};
}, _createHmacHelper: function(t3) {
return function(e3, r3) {
return new p.HMAC.init(t3, r3).finalize(e3);
};
} }), p = t2.algo = {}, t2);
}, 110: function(t2, e2, r2) {
t2.exports = function(t3) {
var e3 = Math, r3 = t3, i2 = (s = r3.lib).WordArray, n2 = s.Hasher, s = r3.algo, o = [], a = [];
function u(t4) {
return 4294967296 * (t4 - (0 | t4)) | 0;
}
for (var h = 2, c = 0; c < 64; )
!function(t4) {
for (var r4 = e3.sqrt(t4), i3 = 2; i3 <= r4; i3++)
if (!(t4 % i3))
return;
return 1;
}(h) || (c < 8 && (o[c] = u(e3.pow(h, 0.5))), a[c] = u(e3.pow(h, 1 / 3)), c++), h++;
var l = [];
return s = s.SHA256 = n2.extend({ _doReset: function() {
this._hash = new i2.init(o.slice(0));
}, _doProcessBlock: function(t4, e4) {
for (var r4 = this._hash.words, i3 = r4[0], n3 = r4[1], s2 = r4[2], o2 = r4[3], u2 = r4[4], h2 = r4[5], c2 = r4[6], p = r4[7], f = 0; f < 64; f++) {
f < 16 ? l[f] = 0 | t4[e4 + f] : (d = l[f - 15], g = l[f - 2], l[f] = ((d << 25 | d >>> 7) ^ (d << 14 | d >>> 18) ^ d >>> 3) + l[f - 7] + ((g << 15 | g >>> 17) ^ (g << 13 | g >>> 19) ^ g >>> 10) + l[f - 16]);
var d = i3 & n3 ^ i3 & s2 ^ n3 & s2, g = p + ((u2 << 26 | u2 >>> 6) ^ (u2 << 21 | u2 >>> 11) ^ (u2 << 7 | u2 >>> 25)) + (u2 & h2 ^ ~u2 & c2) + a[f] + l[f];
p = c2, c2 = h2, h2 = u2, u2 = o2 + g | 0, o2 = s2, s2 = n3, n3 = i3, i3 = g + (((i3 << 30 | i3 >>> 2) ^ (i3 << 19 | i3 >>> 13) ^ (i3 << 10 | i3 >>> 22)) + d) | 0;
}
r4[0] = r4[0] + i3 | 0, r4[1] = r4[1] + n3 | 0, r4[2] = r4[2] + s2 | 0, r4[3] = r4[3] + o2 | 0, r4[4] = r4[4] + u2 | 0, r4[5] = r4[5] + h2 | 0, r4[6] = r4[6] + c2 | 0, r4[7] = r4[7] + p | 0;
}, _doFinalize: function() {
var t4 = this._data, r4 = t4.words, i3 = 8 * this._nDataBytes, n3 = 8 * t4.sigBytes;
return r4[n3 >>> 5] |= 128 << 24 - n3 % 32, r4[14 + (64 + n3 >>> 9 << 4)] = e3.floor(i3 / 4294967296), r4[15 + (64 + n3 >>> 9 << 4)] = i3, t4.sigBytes = 4 * r4.length, this._process(), this._hash;
}, clone: function() {
var t4 = n2.clone.call(this);
return t4._hash = this._hash.clone(), t4;
} }), r3.SHA256 = n2._createHelper(s), r3.HmacSHA256 = n2._createHmacHelper(s), t3.SHA256;
}(r2(518));
}, 703: (t2) => {
function e2(t3) {
return !!t3.constructor && "function" == typeof t3.constructor.isBuffer && t3.constructor.isBuffer(t3);
}
t2.exports = function(t3) {
return null != t3 && (e2(t3) || "function" == typeof t3.readFloatLE && "function" == typeof t3.slice && e2(t3.slice(0, 0)) || !!t3._isBuffer);
};
}, 814: function(t2, e2) {
!function(t3) {
"use strict";
function e3(t4) {
return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(t4);
}
function r2(t4, e4) {
return t4 & e4;
}
function i2(t4, e4) {
return t4 | e4;
}
function n2(t4, e4) {
return t4 ^ e4;
}
function s(t4, e4) {
return t4 & ~e4;
}
f.prototype.toString = function(t4) {
if (this.s < 0)
return "-" + this.negate().toString(t4);
var r3;
if (16 == t4)
r3 = 4;
else if (8 == t4)
r3 = 3;
else if (2 == t4)
r3 = 1;
else if (32 == t4)
r3 = 5;
else {
if (4 != t4)
return this.toRadix(t4);
r3 = 2;
}
var i3, n3 = (1 << r3) - 1, s2 = false, o2 = "", a2 = this.t, u2 = this.DB - a2 * this.DB % r3;
if (0 < a2--)
for (u2 < this.DB && 0 < (i3 = this[a2] >> u2) && (s2 = true, o2 = e3(i3)); 0 <= a2; )
u2 < r3 ? (i3 = (this[a2] & (1 << u2) - 1) << r3 - u2, i3 |= this[--a2] >> (u2 += this.DB - r3)) : (i3 = this[a2] >> (u2 -= r3) & n3, u2 <= 0 && (u2 += this.DB, --a2)), (s2 = 0 < i3 || s2) && (o2 += e3(i3));
return s2 ? o2 : "0";
}, f.prototype.negate = function() {
var t4 = d();
return f.ZERO.subTo(this, t4), t4;
}, f.prototype.abs = function() {
return this.s < 0 ? this.negate() : this;
}, f.prototype.compareTo = function(t4) {
var e4 = this.s - t4.s;
if (0 != e4)
return e4;
var r3 = this.t;
if (0 != (e4 = r3 - t4.t))
return this.s < 0 ? -e4 : e4;
for (; 0 <= --r3; )
if (0 != (e4 = this[r3] - t4[r3]))
return e4;
return 0;
}, f.prototype.bitLength = function() {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + x(this[this.t - 1] ^ this.s & this.DM);
}, f.prototype.mod = function(t4) {
var e4 = d();
return this.abs().divRemTo(t4, null, e4), this.s < 0 && 0 < e4.compareTo(f.ZERO) && t4.subTo(e4, e4), e4;
}, f.prototype.modPowInt = function(t4, e4) {
return e4 = new (t4 < 256 || e4.isEven() ? u : h)(e4), this.exp(t4, e4);
}, f.prototype.clone = function() {
var t4 = d();
return this.copyTo(t4), t4;
}, f.prototype.intValue = function() {
if (this.s < 0) {
if (1 == this.t)
return this[0] - this.DV;
if (0 == this.t)
return -1;
} else {
if (1 == this.t)
return this[0];
if (0 == this.t)
return 0;
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
}, f.prototype.byteValue = function() {
return 0 == this.t ? this.s : this[0] << 24 >> 24;
}, f.prototype.shortValue = function() {
return 0 == this.t ? this.s : this[0] << 16 >> 16;
}, f.prototype.signum = function() {
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1;
}, f.prototype.equals = function(t4) {
return 0 == this.compareTo(t4);
}, f.prototype.min = function(t4) {
return this.compareTo(t4) < 0 ? this : t4;
}, f.prototype.max = function(t4) {
return 0 < this.compareTo(t4) ? this : t4;
}, f.prototype.and = function(t4) {
var e4 = d();
return this.bitwiseTo(t4, r2, e4), e4;
}, f.prototype.or = function(t4) {
var e4 = d();
return this.bitwiseTo(t4, i2, e4), e4;
}, f.prototype.xor = function(t4) {
var e4 = d();
return this.bitwiseTo(t4, n2, e4), e4;
}, f.prototype.shiftLeft = function(t4) {
var e4 = d();
return t4 < 0 ? this.rShiftTo(-t4, e4) : this.lShiftTo(t4, e4), e4;
}, f.prototype.bitCount = function() {
for (var t4 = 0, e4 = this.s & this.DM, r3 = 0; r3 < this.t; ++r3)
t4 += function(t5) {
for (var e5 = 0; 0 != t5; )
t5 &= t5 - 1, ++e5;
return e5;
}(this[r3] ^ e4);
return t4;
}, f.prototype.testBit = function(t4) {
var e4 = Math.floor(t4 / this.DB);
return e4 >= this.t ? 0 != this.s : !!(this[e4] & 1 << t4 % this.DB);
}, f.prototype.setBit = function(t4) {
return this.changeBit(t4, i2);
}, f.prototype.clearBit = function(t4) {
return this.changeBit(t4, s);
}, f.prototype.flipBit = function(t4) {
return this.changeBit(t4, n2);
}, f.prototype.subtract = function(t4) {
var e4 = d();
return this.subTo(t4, e4), e4;
}, f.prototype.multiply = function(t4) {
var e4 = d();
return this.multiplyTo(t4, e4), e4;
}, f.prototype.divide = function(t4) {
var e4 = d();
return this.divRemTo(t4, e4, null), e4;
}, f.prototype.remainder = function(t4) {
var e4 = d();
return this.divRemTo(t4, null, e4), e4;
}, f.prototype.divideAndRemainder = function(t4) {
var e4 = d(), r3 = d();
return this.divRemTo(t4, e4, r3), [e4, r3];
}, f.prototype.pow = function(t4) {
return this.exp(t4, new a());
}, f.prototype.copyTo = function(t4) {
for (var e4 = this.t - 1; 0 <= e4; --e4)
t4[e4] = this[e4];
t4.t = this.t, t4.s = this.s;
}, f.prototype.fromInt = function(t4) {
this.t = 1, this.s = t4 < 0 ? -1 : 0, 0 < t4 ? this[0] = t4 : t4 < -1 ? this[0] = t4 + this.DV : this.t = 0;
}, f.prototype.fromString = function(t4, e4) {
var r3;
if (16 == e4)
r3 = 4;
else if (8 == e4)
r3 = 3;
else if (256 == e4)
r3 = 8;
else if (2 == e4)
r3 = 1;
else if (32 == e4)
r3 = 5;
else {
if (4 != e4)
return void this.fromRadix(t4, e4);
r3 = 2;
}
this.t = 0, this.s = 0;
for (var i3 = t4.length, n3 = false, s2 = 0; 0 <= --i3; ) {
var o2 = 8 == r3 ? 255 & +t4[i3] : b(t4, i3);
o2 < 0 ? "-" == t4.charAt(i3) && (n3 = true) : (n3 = false, 0 == s2 ? this[this.t++] = o2 : s2 + r3 > this.DB ? (this[this.t - 1] |= (o2 & (1 << this.DB - s2) - 1) << s2, this[this.t++] = o2 >> this.DB - s2) : this[this.t - 1] |= o2 << s2, (s2 += r3) >= this.DB && (s2 -= this.DB));
}
8 == r3 && !!(128 & +t4[0]) && (this.s = -1, 0 < s2 && (this[this.t - 1] |= (1 << this.DB - s2) - 1 << s2)), this.clamp(), n3 && f.ZERO.subTo(this, this);
}, f.prototype.clamp = function() {
for (var t4 = this.s & this.DM; 0 < this.t && this[this.t - 1] == t4; )
--this.t;
}, f.prototype.dlShiftTo = function(t4, e4) {
for (var r3 = this.t - 1; 0 <= r3; --r3)
e4[r3 + t4] = this[r3];
for (r3 = t4 - 1; 0 <= r3; --r3)
e4[r3] = 0;
e4.t = this.t + t4, e4.s = this.s;
}, f.prototype.drShiftTo = function(t4, e4) {
for (var r3 = t4; r3 < this.t; ++r3)
e4[r3 - t4] = this[r3];
e4.t = Math.max(this.t - t4, 0), e4.s = this.s;
}, f.prototype.lShiftTo = function(t4, e4) {
for (var r3 = t4 % this.DB, i3 = this.DB - r3, n3 = (1 << i3) - 1, s2 = Math.floor(t4 / this.DB), o2 = this.s << r3 & this.DM, a2 = this.t - 1; 0 <= a2; --a2)
e4[a2 + s2 + 1] = this[a2] >> i3 | o2, o2 = (this[a2] & n3) << r3;
for (a2 = s2 - 1; 0 <= a2; --a2)
e4[a2] = 0;
e4[s2] = o2, e4.t = this.t + s2 + 1, e4.s = this.s, e4.clamp();
}, f.prototype.rShiftTo = function(t4, e4) {
e4.s = this.s;
var r3 = Math.floor(t4 / this.DB);
if (r3 >= this.t)
e4.t = 0;
else {
var i3 = t4 % this.DB, n3 = this.DB - i3, s2 = (1 << i3) - 1;
e4[0] = this[r3] >> i3;
for (var o2 = r3 + 1; o2 < this.t; ++o2)
e4[o2 - r3 - 1] |= (this[o2] & s2) << n3, e4[o2 - r3] = this[o2] >> i3;
0 < i3 && (e4[this.t - r3 - 1] |= (this.s & s2) << n3), e4.t = this.t - r3, e4.clamp();
}
}, f.prototype.subTo = function(t4, e4) {
for (var r3 = 0, i3 = 0, n3 = Math.min(t4.t, this.t); r3 < n3; )
i3 += this[r3] - t4[r3], e4[r3++] = i3 & this.DM, i3 >>= this.DB;
if (t4.t < this.t) {
for (i3 -= t4.s; r3 < this.t; )
i3 += this[r3], e4[r3++] = i3 & this.DM, i3 >>= this.DB;
i3 += this.s;
} else {
for (i3 += this.s; r3 < t4.t; )
i3 -= t4[r3], e4[r3++] = i3 & this.DM, i3 >>= this.DB;
i3 -= t4.s;
}
e4.s = i3 < 0 ? -1 : 0, i3 < -1 ? e4[r3++] = this.DV + i3 : 0 < i3 && (e4[r3++] = i3), e4.t = r3, e4.clamp();
}, f.prototype.multiplyTo = function(t4, e4) {
var r3 = this.abs(), i3 = t4.abs(), n3 = r3.t;
for (e4.t = n3 + i3.t; 0 <= --n3; )
e4[n3] = 0;
for (n3 = 0; n3 < i3.t; ++n3)
e4[n3 + r3.t] = r3.am(0, i3[n3], e4, n3, 0, r3.t);
e4.s = 0, e4.clamp(), this.s != t4.s && f.ZERO.subTo(e4, e4);
}, f.prototype.squareTo = function(t4) {
for (var e4 = this.abs(), r3 = t4.t = 2 * e4.t; 0 <= --r3; )
t4[r3] = 0;
for (r3 = 0; r3 < e4.t - 1; ++r3) {
var i3 = e4.am(r3, e4[r3], t4, 2 * r3, 0, 1);
(t4[r3 + e4.t] += e4.am(r3 + 1, 2 * e4[r3], t4, 2 * r3 + 1, i3, e4.t - r3 - 1)) >= e4.DV && (t4[r3 + e4.t] -= e4.DV, t4[r3 + e4.t + 1] = 1);
}
0 < t4.t && (t4[t4.t - 1] += e4.am(r3, e4[r3], t4, 2 * r3, 0, 1)), t4.s = 0, t4.clamp();
}, f.prototype.divRemTo = function(t4, e4, r3) {
if (!((h2 = t4.abs()).t <= 0)) {
var i3 = this.abs();
if (i3.t < h2.t)
return null != e4 && e4.fromInt(0), void (null != r3 && this.copyTo(r3));
null == r3 && (r3 = d());
var n3 = d(), s2 = this.s, o2 = (t4 = t4.s, this.DB - x(h2[h2.t - 1])), a2 = (0 < o2 ? (h2.lShiftTo(o2, n3), i3.lShiftTo(o2, r3)) : (h2.copyTo(n3), i3.copyTo(r3)), n3.t), u2 = n3[a2 - 1];
if (0 != u2) {
var h2 = u2 * (1 << this.F1) + (1 < a2 ? n3[a2 - 2] >> this.F2 : 0), c2 = this.FV / h2, l2 = (1 << this.F1) / h2, p2 = 1 << this.F2, g2 = r3.t, m2 = g2 - a2, y2 = null == e4 ? d() : e4;
for (n3.dlShiftTo(m2, y2), 0 <= r3.compareTo(y2) && (r3[r3.t++] = 1, r3.subTo(y2, r3)), f.ONE.dlShiftTo(a2, y2), y2.subTo(n3, n3); n3.t < a2; )
n3[n3.t++] = 0;
for (; 0 <= --m2; ) {
var v2 = r3[--g2] == u2 ? this.DM : Math.floor(r3[g2] * c2 + (r3[g2 - 1] + p2) * l2);
if ((r3[g2] += n3.am(0, v2, r3, m2, 0, a2)) < v2)
for (n3.dlShiftTo(m2, y2), r3.subTo(y2, r3); r3[g2] < --v2; )
r3.subTo(y2, r3);
}
null != e4 && (r3.drShiftTo(a2, e4), s2 != t4 && f.ZERO.subTo(e4, e4)), r3.t = a2, r3.clamp(), 0 < o2 && r3.rShiftTo(o2, r3), s2 < 0 && f.ZERO.subTo(r3, r3);
}
}
}, f.prototype.invDigit = function() {
if (this.t < 1)
return 0;
var t4 = this[0];
if (!(1 & t4))
return 0;
var e4 = 3 & t4;
return 0 < (e4 = (e4 = (e4 = (e4 = e4 * (2 - (15 & t4) * e4) & 15) * (2 - (255 & t4) * e4) & 255) * (2 - ((65535 & t4) * e4 & 65535)) & 65535) * (2 - t4 * e4 % this.DV) % this.DV) ? this.DV - e4 : -e4;
}, f.prototype.isEven = function() {
return 0 == (0 < this.t ? 1 & this[0] : this.s);
}, f.prototype.exp = function(t4, e4) {
if (4294967295 < t4 || t4 < 1)
return f.ONE;
var r3, i3 = d(), n3 = d(), s2 = e4.convert(this), o2 = x(t4) - 1;
for (s2.copyTo(i3); 0 <= --o2; )
e4.sqrTo(i3, n3), 0 < (t4 & 1 << o2) ? e4.mulTo(n3, s2, i3) : (r3 = i3, i3 = n3, n3 = r3);
return e4.revert(i3);
}, f.prototype.chunkSize = function(t4) {
return Math.floor(Math.LN2 * this.DB / Math.log(t4));
}, f.prototype.toRadix = function(t4) {
if (null == t4 && (t4 = 10), 0 == this.signum() || t4 < 2 || 36 < t4)
return "0";
var e4 = this.chunkSize(t4), r3 = Math.pow(t4, e4), i3 = _(r3), n3 = d(), s2 = d(), o2 = "";
for (this.divRemTo(i3, n3, s2); 0 < n3.signum(); )
o2 = (r3 + s2.intValue()).toString(t4).substr(1) + o2, n3.divRemTo(i3, n3, s2);
return s2.intValue().toString(t4) + o2;
}, f.prototype.fromRadix = function(t4, e4) {
this.fromInt(0);
for (var r3 = this.chunkSize(e4 = null == e4 ? 10 : e4), i3 = Math.pow(e4, r3), n3 = false, s2 = 0, o2 = 0, a2 = 0; a2 < t4.length; ++a2) {
var u2 = b(t4, a2);
u2 < 0 ? "-" == t4.charAt(a2) && 0 == this.signum() && (n3 = true) : (o2 = e4 * o2 + u2, ++s2 >= r3 && (this.dMultiply(i3), this.dAddOffset(o2, 0), o2 = s2 = 0));
}
0 < s2 && (this.dMultiply(Math.pow(e4, s2)), this.dAddOffset(o2, 0)), n3 && f.ZERO.subTo(this, this);
}, f.prototype.bitwiseTo = function(t4, e4, r3) {
for (var i3, n3 = Math.min(t4.t, this.t), s2 = 0; s2 < n3; ++s2)
r3[s2] = e4(this[s2], t4[s2]);
if (t4.t < this.t) {
for (i3 = t4.s & this.DM, s2 = n3; s2 < this.t; ++s2)
r3[s2] = e4(this[s2], i3);
r3.t = this.t;
} else {
for (i3 = this.s & this.DM, s2 = n3; s2 < t4.t; ++s2)
r3[s2] = e4(i3, t4[s2]);
r3.t = t4.t;
}
r3.s = e4(this.s, t4.s), r3.clamp();
}, f.prototype.changeBit = function(t4, e4) {
return t4 = f.ONE.shiftLeft(t4), this.bitwiseTo(t4, e4, t4), t4;
}, f.prototype.dMultiply = function(t4) {
this[this.t] = this.am(0, t4 - 1, this, 0, 0, this.t), ++this.t, this.clamp();
}, f.prototype.dAddOffset = function(t4, e4) {
if (0 != t4) {
for (; this.t <= e4; )
this[this.t++] = 0;
for (this[e4] += t4; this[e4] >= this.DV; )
this[e4] -= this.DV, ++e4 >= this.t && (this[this.t++] = 0), ++this[e4];
}
}, f.prototype.multiplyLowerTo = function(t4, e4, r3) {
var i3 = Math.min(this.t + t4.t, e4);
for (r3.s = 0, r3.t = i3; 0 < i3; )
r3[--i3] = 0;
for (var n3 = r3.t - this.t; i3 < n3; ++i3)
r3[i3 + this.t] = this.am(0, t4[i3], r3, i3, 0, this.t);
for (n3 = Math.min(t4.t, e4); i3 < n3; ++i3)
this.am(0, t4[i3], r3, i3, 0, e4 - i3);
r3.clamp();
}, f.prototype.multiplyUpperTo = function(t4, e4, r3) {
var i3 = r3.t = this.t + t4.t - --e4;
for (r3.s = 0; 0 <= --i3; )
r3[i3] = 0;
for (i3 = Math.max(e4 - this.t, 0); i3 < t4.t; ++i3)
r3[this.t + i3 - e4] = this.am(e4 - i3, t4[i3], r3, 0, 0, this.t + i3 - e4);
r3.clamp(), r3.drShiftTo(1, r3);
}, f.prototype.square = function() {
var t4 = d();
return this.squareTo(t4), t4;
};
var o = f, a = (p.prototype.convert = function(t4) {
return t4;
}, p.prototype.revert = function(t4) {
return t4;
}, p.prototype.mulTo = function(t4, e4, r3) {
t4.multiplyTo(e4, r3);
}, p.prototype.sqrTo = function(t4, e4) {
t4.squareTo(e4);
}, p), u = (l.prototype.convert = function(t4) {
return t4.s < 0 || 0 <= t4.compareTo(this.m) ? t4.mod(this.m) : t4;
}, l.prototype.revert = function(t4) {
return t4;
}, l.prototype.reduce = function(t4) {
t4.divRemTo(this.m, null, t4);
}, l.prototype.mulTo = function(t4, e4, r3) {
t4.multiplyTo(e4, r3), this.reduce(r3);
}, l.prototype.sqrTo = function(t4, e4) {
t4.squareTo(e4), this.reduce(e4);
}, l), h = (c.prototype.convert = function(t4) {
var e4 = d();
return t4.abs().dlShiftTo(this.m.t, e4), e4.divRemTo(this.m, null, e4), t4.s < 0 && 0 < e4.compareTo(o.ZERO) && this.m.subTo(e4, e4), e4;
}, c.prototype.revert = function(t4) {
var e4 = d();
return t4.copyTo(e4), this.reduce(e4), e4;
}, c.prototype.reduce = function(t4) {
for (; t4.t <= this.mt2; )
t4[t4.t++] = 0;
for (var e4 = 0; e4 < this.m.t; ++e4) {
var r3 = 32767 & t4[e4], i3 = r3 * this.mpl + ((r3 * this.mph + (t4[e4] >> 15) * this.mpl & this.um) << 15) & t4.DM;
for (t4[r3 = e4 + this.m.t] += this.m.am(0, i3, t4, e4, 0, this.m.t); t4[r3] >= t4.DV; )
t4[r3] -= t4.DV, t4[++r3]++;
}
t4.clamp(), t4.drShiftTo(this.m.t, t4), 0 <= t4.compareTo(this.m) && t4.subTo(this.m, t4);
}, c.prototype.mulTo = function(t4, e4, r3) {
t4.multiplyTo(e4, r3), this.reduce(r3);
}, c.prototype.sqrTo = function(t4, e4) {
t4.squareTo(e4), this.reduce(e4);
}, c);
function c(t4) {
this.m = t4, this.mp = t4.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t4.DB - 15) - 1, this.mt2 = 2 * t4.t;
}
function l(t4) {
this.m = t4;
}
function p() {
}
function f(t4, e4, r3) {
null != t4 && "number" != typeof t4 && (null == e4 && "string" != typeof t4 ? this.fromString(t4, 256) : this.fromString(t4, e4));
}
function d() {
return new o(null);
}
function g(t4, e4) {
return new o(t4, e4);
}
T = "Microsoft Internet Explorer" == navigator.appName ? (o.prototype.am = function(t4, e4, r3, i3, n3, s2) {
for (var o2 = 32767 & e4, a2 = e4 >> 15; 0 <= --s2; ) {
var u2 = 32767 & this[t4], h2 = this[t4++] >> 15, c2 = a2 * u2 + h2 * o2;
n3 = ((u2 = o2 * u2 + ((32767 & c2) << 15) + r3[i3] + (1073741823 & n3)) >>> 30) + (c2 >>> 15) + a2 * h2 + (n3 >>> 30), r3[i3++] = 1073741823 & u2;
}
return n3;
}, 30) : "Netscape" != navigator.appName ? (o.prototype.am = function(t4, e4, r3, i3, n3, s2) {
for (; 0 <= --s2; ) {
var o2 = e4 * this[t4++] + r3[i3] + n3;
n3 = Math.floor(o2 / 67108864), r3[i3++] = 67108863 & o2;
}
return n3;
}, 26) : (o.prototype.am = function(t4, e4, r3, i3, n3, s2) {
for (var o2 = 16383 & e4, a2 = e4 >> 14; 0 <= --s2; ) {
var u2 = 16383 & this[t4], h2 = this[t4++] >> 14, c2 = a2 * u2 + h2 * o2;
n3 = ((u2 = o2 * u2 + ((16383 & c2) << 14) + r3[i3] + n3) >> 28) + (c2 >> 14) + a2 * h2, r3[i3++] = 268435455 & u2;
}
return n3;
}, 28), o.prototype.DB = T, o.prototype.DM = (1 << T) - 1, o.prototype.DV = 1 << T, o.prototype.FV = Math.pow(2, 52), o.prototype.F1 = 52 - T, o.prototype.F2 = 2 * T - 52;
for (var m = [], y = "0".charCodeAt(0), v = 0; v <= 9; ++v)
m[y++] = v;
for (y = "a".charCodeAt(0), v = 10; v < 36; ++v)
m[y++] = v;
for (y = "A".charCodeAt(0), v = 10; v < 36; ++v)
m[y++] = v;
function b(t4, e4) {
return null == (t4 = m[t4.charCodeAt(e4)]) ? -1 : t4;
}
function _(t4) {
var e4 = d();
return e4.fromInt(t4), e4;
}
function x(t4) {
var e4, r3 = 1;
return 0 != (e4 = t4 >>> 16) && (t4 = e4, r3 += 16), 0 != (e4 = t4 >> 8) && (t4 = e4, r3 += 8), 0 != (e4 = t4 >> 4) && (t4 = e4, r3 += 4), 0 != (e4 = t4 >> 2) && (t4 = e4, r3 += 2), 0 != (e4 = t4 >> 1) && (t4 = e4, r3 += 1), r3;
}
o.ZERO = _(0), o.ONE = _(1), O.prototype.doPublic = function(t4) {
return t4.modPowInt(this.e, this.n);
}, O.prototype.setPublic = function(t4, e4) {
null != t4 && null != e4 && 0 < t4.length && 0 < e4.length ? (this.n = g(t4, 16), this.e = parseInt(e4, 16)) : console.error("Invalid RSA public key");
}, O.prototype.verify = function(t4, e4, r3) {
return e4 = g(e4, 16), null == (e4 = this.doPublic(e4)) ? null : function(t5) {
for (var e5 in S)
if (S.hasOwnProperty(e5)) {
var r4 = (e5 = S[e5]).length;
if (t5.substr(0, r4) == e5)
return t5.substr(r4);
}
return t5;
}(e4.toString(16).replace(/^1f+00/, "")) == r3(t4).toString();
};
var w = O, S = { md2: "3020300c06082a864886f70d020205000410", md5: "3020300c06082a864886f70d020505000410", sha1: "3021300906052b0e03021a05000414", sha224: "302d300d06096086480165030402040500041c", sha256: "3031300d060960864801650304020105000420", sha384: "3041300d060960864801650304020205000430", sha512: "3051300d060960864801650304020305000440", ripemd160: "3021300906052b2403020105000414" };
function O() {
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
}
E.prototype.verify = function(t4, r3, i3) {
try {
return this.getKey().verify(t4, function(t5) {
for (var r4 = "", i4 = 0, n3 = 0, s2 = 0; s2 < t5.length && "=" != t5.charAt(s2); ++s2) {
var o2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(t5.charAt(s2));
o2 < 0 || (i4 = 0 == i4 ? (r4 += e3(o2 >> 2), n3 = 3 & o2, 1) : 1 == i4 ? (r4 += e3(n3 << 2 | o2 >> 4), n3 = 15 & o2, 2) : 2 == i4 ? (r4 = (r4 += e3(n3)) + e3(o2 >> 2), n3 = 3 & o2, 3) : (r4 = (r4 += e3(n3 << 2 | o2 >> 4)) + e3(15 & o2), 0));
}
return 1 == i4 && (r4 += e3(n3 << 2)), r4;
}(r3), i3);
} catch (t5) {
return false;
}
}, E.prototype.getKey = function(t4) {
return this.key || (this.key = new w()), this.key;
}, E.version = "3.0.0-rc.1";
var T = E;
function E(t4) {
this.key = null;
}
t3.JSEncrypt = T, t3.default = T, Object.defineProperty(t3, "__esModule", { value: true });
}(e2);
}, 650: (t2, e2, r2) => {
r2 = r2(942).Symbol, t2.exports = r2;
}, 379: (t2, e2, r2) => {
var i2 = r2(650), n2 = r2(870), s = r2(5), o = i2 ? i2.toStringTag : void 0;
t2.exports = function(t3) {
return null == t3 ? void 0 === t3 ? "[object Undefined]" : "[object Null]" : (o && o in Object(t3) ? n2 : s)(t3);
};
}, 403: (t2, e2, r2) => {
var i2 = r2(945), n2 = /^\s+/;
t2.exports = function(t3) {
return t3 && t3.slice(0, i2(t3) + 1).replace(n2, "");
};
}, 967: (t2) => {
var e2 = "object" == typeof window && window && window.Object === Object && window;
t2.exports = e2;
}, 870: (t2, e2, r2) => {
r2 = r2(650);
var i2 = Object.prototype, n2 = i2.hasOwnProperty, s = i2.toString, o = r2 ? r2.toStringTag : void 0;
t2.exports = function(t3) {
var e3 = n2.call(t3, o), r3 = t3[o];
try {
var i3 = !(t3[o] = void 0);
} catch (t4) {
}
var a = s.call(t3);
return i3 && (e3 ? t3[o] = r3 : delete t3[o]), a;
};
}, 5: (t2) => {
var e2 = Object.prototype.toString;
t2.exports = function(t3) {
return e2.call(t3);
};
}, 942: (t2, e2, r2) => {
r2 = r2(967);
var i2 = "object" == typeof self && self && self.Object === Object && self;
r2 = r2 || i2 || Function("return this")(), t2.exports = r2;
}, 945: (t2) => {
var e2 = /\s/;
t2.exports = function(t3) {
for (var r2 = t3.length; r2-- && e2.test(t3.charAt(r2)); )
;
return r2;
};
}, 784: (t2, e2, r2) => {
var i2 = r2(580), n2 = r2(495), s = r2(131), o = Math.max, a = Math.min;
t2.exports = function(t3, e3, r3) {
var u, h, c, l, p, f, d = 0, g = false, m = false, y = true;
if ("function" != typeof t3)
throw new TypeError("Expected a function");
function v(e4) {
var r4 = u, i3 = h;
return u = h = void 0, d = e4, l = t3.apply(i3, r4);
}
function b(t4) {
var r4 = t4 - f;
return void 0 === f || e3 <= r4 || r4 < 0 || m && c <= t4 - d;
}
function _() {
var t4, r4 = n2();
if (b(r4))
return x(r4);
p = setTimeout(_, (t4 = e3 - (r4 - f), m ? a(t4, c - (r4 - d)) : t4));
}
function x(t4) {
return p = void 0, y && u ? v(t4) : (u = h = void 0, l);
}
function w() {
var t4 = n2(), r4 = b(t4);
if (u = arguments, h = this, f = t4, r4) {
if (void 0 === p)
return d = t4 = f, p = setTimeout(_, e3), g ? v(t4) : l;
if (m)
return clearTimeout(p), p = setTimeout(_, e3), v(f);
}
return void 0 === p && (p = setTimeout(_, e3)), l;
}
return e3 = s(e3) || 0, i2(r3) && (g = !!r3.leading, c = (m = "maxWait" in r3) ? o(s(r3.maxWait) || 0, e3) : c, y = "trailing" in r3 ? !!r3.trailing : y), w.cancel = function() {
void 0 !== p && clearTimeout(p), u = f = h = p = void (d = 0);
}, w.flush = function() {
return void 0 === p ? l : x(n2());
}, w;
};
}, 580: (t2) => {
t2.exports = function(t3) {
var e2 = typeof t3;
return null != t3 && ("object" == e2 || "function" == e2);
};
}, 547: (t2) => {
t2.exports = function(t3) {
return null != t3 && "object" == typeof t3;
};
}, 187: (t2, e2, r2) => {
var i2 = r2(379), n2 = r2(547);
t2.exports = function(t3) {
return "symbol" == typeof t3 || n2(t3) && "[object Symbol]" == i2(t3);
};
}, 495: (t2, e2, r2) => {
var i2 = r2(942);
t2.exports = function() {
return i2.Date.now();
};
}, 131: (t2, e2, r2) => {
var i2 = r2(403), n2 = r2(580), s = r2(187), o = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, u = /^0o[0-7]+$/i, h = parseInt;
t2.exports = function(t3) {
if ("number" == typeof t3)
return t3;
if (s(t3))
return NaN;
if (n2(t3) && (e3 = "function" == typeof t3.valueOf ? t3.valueOf() : t3, t3 = n2(e3) ? e3 + "" : e3), "string" != typeof t3)
return 0 === t3 ? t3 : +t3;
t3 = i2(t3);
var e3 = a.test(t3);
return e3 || u.test(t3) ? h(t3.slice(2), e3 ? 2 : 8) : o.test(t3) ? NaN : +t3;
};
}, 834: function(t2, e2) {
var r2;
void 0 !== (e2 = "function" == typeof (r2 = function() {
var t3, e3, r3 = "lscache-", i2 = "-cacheexpiration", n2 = 6e4, s = b(n2), o = "", a = false;
function u() {
var e4 = "__lscachetest__";
if (void 0 !== t3)
return t3;
try {
if (!localStorage)
return false;
} catch (e5) {
return false;
}
try {
f(e4, "__lscachetest__"), d(e4), t3 = true;
} catch (e5) {
t3 = !(!h(e5) || !localStorage.length);
}
return t3;
}
function h(t4) {
return t4 && ("QUOTA_EXCEEDED_ERR" === t4.name || "NS_ERROR_DOM_QUOTA_REACHED" === t4.name || "QuotaExceededError" === t4.name);
}
function c() {
return e3 = void 0 === e3 ? null != window.JSON : e3;
}
function l() {
return Math.floor(new Date().getTime() / n2);
}
function p(t4) {
return localStorage.getItem(r3 + o + t4);
}
function f(t4, e4) {
localStorage.removeItem(r3 + o + t4), localStorage.setItem(r3 + o + t4, e4);
}
function d(t4) {
localStorage.removeItem(r3 + o + t4);
}
function g(t4) {
for (var e4, n3 = new RegExp("^" + r3 + o.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&") + "(.*)"), s2 = [], a2 = 0; a2 < localStorage.length; a2++)
(e4 = (e4 = (e4 = localStorage.key(a2)) && e4.match(n3)) && e4[1]) && e4.indexOf(i2) < 0 && s2.push(e4);
for (a2 = 0; a2 < s2.length; a2++)
t4(s2[a2], s2[a2] + i2);
}
function m(t4) {
var e4 = t4 + i2;
d(t4), d(e4);
}
function y(t4) {
var e4 = t4 + i2, r4 = p(e4);
return r4 && (r4 = parseInt(r4, 10), l() >= r4 && (d(t4), d(e4), 1));
}
function v(t4, e4) {
a && "console" in window && "function" == typeof window.console.warn && (window.console.warn("lscache - " + t4), e4 && window.console.warn("lscache - The error was: " + e4.message));
}
function b(t4) {
return Math.floor(864e13 / t4);
}
return { set: function(t4, e4, r4) {
if (!u())
return false;
if (!c())
return false;
try {
e4 = JSON.stringify(e4);
} catch (r5) {
return false;
}
try {
f(t4, e4);
} catch (r5) {
if (!h(r5))
return v("Could not add item with key '" + t4 + "'", r5), false;
for (var n3, o2 = [], a2 = (g(function(t5, e5) {
e5 = (e5 = p(e5)) ? parseInt(e5, 10) : s, o2.push({ key: t5, size: (p(t5) || "").length, expiration: e5 });
}), o2.sort(function(t5, e5) {
return e5.expiration - t5.expiration;
}), (e4 || "").length); o2.length && 0 < a2; )
v("Cache is full, removing item with key '" + (n3 = o2.pop()).key + "'"), m(n3.key), a2 -= n3.size;
try {
f(t4, e4);
} catch (r6) {
return v("Could not add item with key '" + t4 + "', perhaps it's too big?", r6), false;
}
}
return r4 ? f(t4 + i2, (l() + r4).toString(10)) : d(t4 + i2), true;
}, get: function(t4) {
if (!u())
return null;
if (y(t4))
return null;
if (!(t4 = p(t4)) || !c())
return t4;
try {
return JSON.parse(t4);
} catch (e4) {
return t4;
}
}, remove: function(t4) {
u() && m(t4);
}, supported: u, flush: function() {
u() && g(function(t4) {
m(t4);
});
}, flushExpired: function() {
u() && g(function(t4) {
y(t4);
});
}, setBucket: function(t4) {
o = t4;
}, resetBucket: function() {
o = "";
}, getExpiryMilliseconds: function() {
return n2;
}, setExpiryMilliseconds: function(t4) {
s = b(n2 = t4);
}, enableWarnings: function(t4) {
a = t4;
} };
}) ? r2.apply(e2, []) : r2) && (t2.exports = e2);
}, 150: (t2, e2, r2) => {
function i2(t3, e3) {
t3.constructor == String ? t3 = (e3 && "binary" === e3.encoding ? a : s).stringToBytes(t3) : o(t3) ? t3 = Array.prototype.slice.call(t3, 0) : Array.isArray(t3) || t3.constructor === Uint8Array || (t3 = t3.toString());
for (var r3 = n2.bytesToWords(t3), u = (e3 = 8 * t3.length, 1732584193), h = -271733879, c = -1732584194, l = 271733878, p = 0; p < r3.length; p++)
r3[p] = 16711935 & (r3[p] << 8 | r3[p] >>> 24) | 4278255360 & (r3[p] << 24 | r3[p] >>> 8);
r3[e3 >>> 5] |= 128 << e3 % 32, r3[14 + (64 + e3 >>> 9 << 4)] = e3;
var f = i2._ff, d = i2._gg, g = i2._hh, m = i2._ii;
for (p = 0; p < r3.length; p += 16) {
var y = u, v = h, b = c, _ = l;
u = f(u, h, c, l, r3[p + 0], 7, -680876936), l = f(l, u, h, c, r3[p + 1], 12, -389564586), c = f(c, l, u, h, r3[p + 2], 17, 606105819), h = f(h, c, l, u, r3[p + 3], 22, -1044525330), u = f(u, h, c, l, r3[p + 4], 7, -176418897), l = f(l, u, h, c, r3[p + 5], 12, 1200080426), c = f(c, l, u, h, r3[p + 6], 17, -1473231341), h = f(h, c, l, u, r3[p + 7], 22, -45705983), u = f(u, h, c, l, r3[p + 8], 7, 1770035416), l = f(l, u, h, c, r3[p + 9], 12, -1958414417), c = f(c, l, u, h, r3[p + 10], 17, -42063), h = f(h, c, l, u, r3[p + 11], 22, -1990404162), u = f(u, h, c, l, r3[p + 12], 7, 1804603682), l = f(l, u, h, c, r3[p + 13], 12, -40341101), c = f(c, l, u, h, r3[p + 14], 17, -1502002290), u = d(u, h = f(h, c, l, u, r3[p + 15], 22, 1236535329), c, l, r3[p + 1], 5, -165796510), l = d(l, u, h, c, r3[p + 6], 9, -1069501632), c = d(c, l, u, h, r3[p + 11], 14, 643717713), h = d(h, c, l, u, r3[p + 0], 20, -373897302), u = d(u, h, c, l, r3[p + 5], 5, -701558691), l = d(l, u, h, c, r3[p + 10], 9, 38016083), c = d(c, l, u, h, r3[p + 15], 14, -660478335), h = d(h, c, l, u, r3[p + 4], 20, -405537848), u = d(u, h, c, l, r3[p + 9], 5, 568446438), l = d(l, u, h, c, r3[p + 14], 9, -1019803690), c = d(c, l, u, h, r3[p + 3], 14, -187363961), h = d(h, c, l, u, r3[p + 8], 20, 1163531501), u = d(u, h, c, l, r3[p + 13], 5, -1444681467), l = d(l, u, h, c, r3[p + 2], 9, -51403784), c = d(c, l, u, h, r3[p + 7], 14, 1735328473), u = g(u, h = d(h, c, l, u, r3[p + 12], 20, -1926607734), c, l, r3[p + 5], 4, -378558), l = g(l, u, h, c, r3[p + 8], 11, -2022574463), c = g(c, l, u, h, r3[p + 11], 16, 1839030562), h = g(h, c, l, u, r3[p + 14], 23, -35309556), u = g(u, h, c, l, r3[p + 1], 4, -1530992060), l = g(l, u, h, c, r3[p + 4], 11, 1272893353), c = g(c, l, u, h, r3[p + 7], 16, -155497632), h = g(h, c, l, u, r3[p + 10], 23, -1094730640), u = g(u, h, c, l, r3[p + 13], 4, 681279174), l = g(l, u, h, c, r3[p + 0], 11, -358537222), c = g(c, l, u, h, r3[p + 3], 16, -722521979), h = g(h, c, l, u, r3[p + 6], 23, 76029189), u = g(u, h, c, l, r3[p + 9], 4, -640364487), l = g(l, u, h, c, r3[p + 12], 11, -421815835), c = g(c, l, u, h, r3[p + 15], 16, 530742520), u = m(u, h = g(h, c, l, u, r3[p + 2], 23, -995338651), c, l, r3[p + 0], 6, -198630844), l = m(l, u, h, c, r3[p + 7], 10, 1126891415), c = m(c, l, u, h, r3[p + 14], 15, -1416354905), h = m(h, c, l, u, r3[p + 5], 21, -57434055), u = m(u, h, c, l, r3[p + 12], 6, 1700485571), l = m(l, u, h, c, r3[p + 3], 10, -1894986606), c = m(c, l, u, h, r3[p + 10], 15, -1051523), h = m(h, c, l, u, r3[p + 1], 21, -2054922799), u = m(u, h, c, l, r3[p + 8], 6, 1873313359), l = m(l, u, h, c, r3[p + 15], 10, -30611744), c = m(c, l, u, h, r3[p + 6], 15, -1560198380), h = m(h, c, l, u, r3[p + 13], 21, 1309151649), u = m(u, h, c, l, r3[p + 4], 6, -145523070), l = m(l, u, h, c, r3[p + 11], 10, -1120210379), c = m(c, l, u, h, r3[p + 2], 15, 718787259), h = m(h, c, l, u, r3[p + 9], 21, -343485551), u = u + y >>> 0, h = h + v >>> 0, c = c + b >>> 0, l = l + _ >>> 0;
}
return n2.endian([u, h, c, l]);
}
var n2 = r2(242), s = r2(934).utf8, o = r2(703), a = r2(934).bin;
i2._ff = function(t3, e3, r3, i3, n3, s2, o2) {
return ((t3 = t3 + (e3 & r3 | ~e3 & i3) + (n3 >>> 0) + o2) << s2 | t3 >>> 32 - s2) + e3;
}, i2._gg = function(t3, e3, r3, i3, n3, s2, o2) {
return ((t3 = t3 + (e3 & i3 | r3 & ~i3) + (n3 >>> 0) + o2) << s2 | t3 >>> 32 - s2) + e3;
}, i2._hh = function(t3, e3, r3, i3, n3, s2, o2) {
return ((t3 = t3 + (e3 ^ r3 ^ i3) + (n3 >>> 0) + o2) << s2 | t3 >>> 32 - s2) + e3;
}, i2._ii = function(t3, e3, r3, i3, n3, s2, o2) {
return ((t3 = t3 + (r3 ^ (e3 | ~i3)) + (n3 >>> 0) + o2) << s2 | t3 >>> 32 - s2) + e3;
}, i2._blocksize = 16, i2._digestsize = 16, t2.exports = function(t3, e3) {
if (null == t3)
throw new Error("Illegal argument " + t3);
return t3 = n2.wordsToBytes(i2(t3, e3)), e3 && e3.asBytes ? t3 : e3 && e3.asString ? a.bytesToString(t3) : n2.bytesToHex(t3);
};
}, 157: (t2) => {
for (var e2 = [], r2 = 0; r2 < 256; ++r2)
e2[r2] = (r2 + 256).toString(16).substr(1);
t2.exports = function(t3, r3) {
return r3 = r3 || 0, e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3++]] + "-" + e2[t3[r3++]] + e2[t3[r3++]] + "-" + e2[t3[r3++]] + e2[t3[r3++]] + "-" + e2[t3[r3++]] + e2[t3[r3++]] + "-" + e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3++]] + e2[t3[r3]];
};
}, 396: (t2) => {
var e2, r2, i2, n2 = "undefined" != typeof window && (window.crypto || window.msCrypto);
n2 && n2.getRandomValues && (e2 = new Uint8Array(16), r2 = function() {
return n2.getRandomValues(e2), e2;
}), r2 || (i2 = new Array(16), r2 = function() {
for (var t3, e3 = 0; e3 < 16; e3++)
!(3 & e3) && (t3 = 4294967296 * Math.random()), i2[e3] = t3 >>> ((3 & e3) << 3) & 255;
return i2;
}), t2.exports = r2;
}, 496: (t2, e2, r2) => {
var i2 = r2(396), n2 = r2(157);
t2.exports = function(t3, e3, r3) {
var s = e3 && r3 || 0, o = ("string" == typeof t3 && (e3 = "binary" == t3 ? new Array(16) : null, t3 = null), (t3 = t3 || {}).random || (t3.rng || i2)());
if (o[6] = 15 & o[6] | 64, o[8] = 63 & o[8] | 128, e3)
for (var a = 0; a < 16; ++a)
e3[s + a] = o[a];
return e3 || n2(o);
};
}, 742: (e2) => {
"use strict";
e2.exports = t;
} }, i = {}, e.n = (t2) => {
var r2 = t2 && t2.__esModule ? () => t2.default : () => t2;
return e.d(r2, { a: r2 }), r2;
}, e.d = (t2, r2) => {
for (var i2 in r2)
e.o(r2, i2) && !e.o(t2, i2) && Object.defineProperty(t2, i2, { enumerable: true, get: r2[i2] });
}, e.o = (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), e.r = (t2) => {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true });
}, n = {}, (() => {
"use strict";
e.d(n, { default: () => Gr });
var t2 = {}, r2 = (e.r(t2), e.d(t2, { and: () => it, b64d: () => kt, concat: () => Ct, eq: () => ot, flagValue: () => Et, gt: () => pt, gte: () => gt, ifThen: () => ut, inArray: () => Dt, isInPercentage: () => Ot, isInPercentageRange: () => Tt, isInTargetGroup: () => Nt, isTargetGroupPaired: () => Pt, isUndefined: () => et, lt: () => ht, lte: () => ct, match: () => mt, md5: () => Rt, mergeSeed: () => St, ne: () => st, not: () => at, now: () => rt, numeq: () => dt, numne: () => ft, operatorsWithContext: () => It, or: () => nt, property: () => At, semverEq: () => xt, semverGt: () => bt, semverGte: () => _t, semverLt: () => yt, semverLte: () => vt, semverNe: () => wt, tsToNum: () => lt }), {}), i2 = (e.r(r2), e.d(r2, { fL: () => Jt, Zn: () => Ee, Y3: () => Wt, WB: () => Gt }), {}), s = (e.r(i2), e.d(i2, { B: () => Ut }), {}), o = (e.r(s), e.d(s, { clearAllOverrides: () => or, clearOverride: () => sr, getOriginalValue: () => function(t3) {
if (!t3)
throw new Error("Missing name");
const e2 = $.flagWithName(t3);
return e2 ? e2._originalValue() : null;
}, getOverride: () => function(t3 = null) {
if (t3)
return rr[t3];
throw new Error("Missing name");
}, hasOverride: () => function(t3 = null) {
return void 0 !== t3 && void 0 !== rr[t3];
}, setOverride: () => nr }), {});
e.r(o), e.d(o, { iI: () => $ });
const a = { debug: 0, info: 1, warn: 2, error: 3 };
let u = "error", h = new class {
constructor() {
this.debug = (t3, ...e2) => {
a[u] <= a.debug && console && console.log(t3, ...e2);
}, this.info = (t3, ...e2) => {
a[u] <= a.info && console && console.info(t3, ...e2);
}, this.warn = (t3, ...e2) => {
a[u] <= a.warn && console && console.warn(t3, ...e2);
}, this.error = (t3, ...e2) => {
console && console.error(t3, ...e2);
}, this.setVerboseMode = (t3) => {
"verbose" === t3 ? (u = "debug", this.debug("Active verbose mode")) : u = "error";
}, this.setLogger = (t3) => {
h = t3;
};
}
}();
const c = h;
var l = "function" == typeof atob, p = "function" == typeof btoa, f = "function" == typeof Buffer;
const d = "function" == typeof TextDecoder ? new TextDecoder() : void 0, g = "function" == typeof TextEncoder ? new TextEncoder() : void 0, m = Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="), y = ((t3) => {
let e2 = {};
return t3.forEach((t4, r3) => e2[t4] = r3), e2;
})(m), v = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, b = String.fromCharCode.bind(String), _ = "function" == typeof Uint8Array.from ? Uint8Array.from.bind(Uint8Array) : (t3, e2 = (t4) => t4) => new Uint8Array(Array.prototype.slice.call(t3, 0).map(e2)), x = (t3) => t3.replace(/[^A-Za-z0-9\+\/]/g, ""), w = p ? (t3) => btoa(t3) : f ? (t3) => Buffer.from(t3, "binary").toString("base64") : (t3) => {
let e2, r3, i3, n2, s2 = "";
var o2 = t3.length % 3;
for (let o3 = 0; o3 < t3.length; ) {
if (255 < (r3 = t3.charCodeAt(o3++)) || 255 < (i3 = t3.charCodeAt(o3++)) || 255 < (n2 = t3.charCodeAt(o3++)))
throw new TypeError("invalid character found");
e2 = r3 << 16 | i3 << 8 | n2, s2 += m[e2 >> 18 & 63] + m[e2 >> 12 & 63] + m[e2 >> 6 & 63] + m[63 & e2];
}
return o2 ? s2.slice(0, o2 - 3) + "===".substring(o2) : s2;
}, S = f ? (t3) => Buffer.from(t3).toString("base64") : (t3) => {
let e2 = [];
for (let r3 = 0, i3 = t3.length; r3 < i3; r3 += 4096)
e2.push(b.apply(null, t3.subarray(r3, r3 + 4096)));
return w(e2.join(""));
}, O = (t3) => {
var e2;
return t3.length < 2 ? (e2 = t3.charCodeAt(0)) < 128 ? t3 : e2 < 2048 ? b(192 | e2 >>> 6) + b(128 | 63 & e2) : b(224 | e2 >>> 12 & 15) + b(128 | e2 >>> 6 & 63) + b(128 | 63 & e2) : (e2 = 65536 + 1024 * (t3.charCodeAt(0) - 55296) + (t3.charCodeAt(1) - 56320), b(240 | e2 >>> 18 & 7) + b(128 | e2 >>> 12 & 63) + b(128 | e2 >>> 6 & 63) + b(128 | 63 & e2));
}, T = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, E = f ? (t3) => Buffer.from(t3, "utf8").toString("base64") : g ? (t3) => S(g.encode(t3)) : (t3) => w(((t4) => t4.replace(T, O))(t3)), N = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, P = (t3) => {
switch (t3.length) {
case 4:
var e2 = ((7 & t3.charCodeAt(0)) << 18 | (63 & t3.charCodeAt(1)) << 12 | (63 & t3.charCodeAt(2)) << 6 | 63 & t3.charCodeAt(3)) - 65536;
return b(55296 + (e2 >>> 10)) + b(56320 + (1023 & e2));
case 3:
return b((15 & t3.charCodeAt(0)) << 12 | (63 & t3.charCodeAt(1)) << 6 | 63 & t3.charCodeAt(2));
default:
return b((31 & t3.charCodeAt(0)) << 6 | 63 & t3.charCodeAt(1));
}
}, A = l ? (t3) => atob(x(t3)) : f ? (t3) => Buffer.from(t3, "base64").toString("binary") : (t3) => {
if (t3 = t3.replace(/\s+/g, ""), !v.test(t3))
throw new TypeError("malformed base64.");
t3 += "==".slice(2 - (3 & t3.length));
let e2, r3, i3, n2 = "";
for (let s2 = 0; s2 < t3.length; )
e2 = y[t3.charAt(s2++)] << 18 | y[t3.charAt(s2++)] << 12 | (r3 = y[t3.charAt(s2++)]) << 6 | (i3 = y[t3.charAt(s2++)]), n2 += 64 === r3 ? b(e2 >> 16 & 255) : 64 === i3 ? b(e2 >> 16 & 255, e2 >> 8 & 255) : b(e2 >> 16 & 255, e2 >> 8 & 255, 255 & e2);
return n2;
}, D = f ? (t3) => _(Buffer.from(t3, "base64")) : (t3) => _(A(t3), (t4) => t4.charCodeAt(0)), R = f ? (t3) => Buffer.from(t3, "base64").toString("utf8") : d ? (t3) => d.decode(D(t3)) : (t3) => ((t4) => t4.replace(N, P))(A(t3)), C = "roxTargetUrl", k = "roxAuth";
class I {
constructor(t3) {
this._proxyUrl = "", this._proxyAuthHeader = "", this._proxySettings = false, t3 && (this._proxySettings = Object.assign({}, t3), this._proxyUrl = this._proxySettings.protocol + "://" + this._proxySettings.host + (this._proxySettings.port ? ":" + this._proxySettings.port : ""), this._proxySettings.auth && this._proxySettings.auth.username && this._proxySettings.auth.password && (this._proxyAuthHeader = "Basic " + ((t4, e2 = false) => e2 ? E(t4).replace(/=/g, "").replace(/[+\/]/g, (t5) => "+" == t5 ? "-" : "_") : E(t4))(this._proxySettings.auth.username + ":" + this._proxySettings.auth.password), this._proxyAuthHeaderEncoded = encodeURIComponent(this._proxyAuthHeader)));
}
applyProxyToRequest(t3) {
if (this._proxySettings) {
t3.options = t3.options ? Object.assign({}, t3.options) : {};
const e2 = t3.options;
e2.params = e2.params || {}, e2.params[C] = t3.url, this._proxyAuthHeader && (e2.params[k] = this._proxyAuthHeader), t3.url = this._proxyUrl;
}
}
applyProxyToSseRequest(t3) {
this._proxySettings && (t3.url = `${this._proxyUrl}?${C}=` + encodeURIComponent(t3.url), this._proxyAuthHeaderEncoded && (t3.url = `${t3.url}&${k}=` + this._proxyAuthHeaderEncoded));
}
get proxyUrl() {
return this._proxyUrl;
}
}
const F = "x-api.rollout.io";
let M = new I();
const j = (t3) => {
let e2 = F;
const r3 = { API_HOST: e2 = "eu" == t3 ? "eu-" + F : e2, CD_API_ENDPOINT: `https://${e2}/device/get_configuration`, CD_S3_ENDPOINT: "https://conf.rollout.io/", SS_API_ENDPOINT: `https://${e2}/device/update_state_store/`, SS_S3_ENDPOINT: "https://statestore.rollout.io/", CLIENT_DATA_CACHE_KEY: "client_data", NOTIFICATIONS_ENDPOINT: "https://push.rollout.io/sse", ANALYTICS_ENDPOINT: "https://analytic.rollout.io", ERROR_REPORTER: void 0 };
return "platform" == t3 && (r3.API_HOST = "api.cloudbees.io", r3.CD_API_ENDPOINT = "https://api.cloudbees.io/device/get_configuration", r3.CD_S3_ENDPOINT = "https://rox-conf.cloudbees.io/", r3.SS_API_ENDPOINT = "https://api.cloudbees.io/device/update_state_store/", r3.SS_S3_ENDPOINT = "https://rox-state.cloudbees.io/", r3.ANALYTICS_ENDPOINT = "https://fm-analytics.cloudbees.io", r3.NOTIFICATIONS_ENDPOINT = "https://sdk-notification-service.cloudbees.io/sse"), r3;
};
let B = Object.assign({}, j());
const V = (t3) => B[t3], U = () => M, z = function(t3) {
"eu" === t3 && (B = Object.assign({}, j("eu-"))), "platform" === t3 && (B = Object.assign({}, j(t3)));
}, L = () => B.ERROR_REPORTER;
class H {
constructor(t3, e2, r3, i3) {
var { distinct_id: n2, app_release: s2, platform: o2, api_version: a2, lib_version: u2 } = e2 = e2.getProperties();
e2 = function(t4, e3) {
var r4 = {};
for (n3 in t4)
Object.prototype.hasOwnProperty.call(t4, n3) && e3.indexOf(n3) < 0 && (r4[n3] = t4[n3]);
if (null != t4 && "function" == typeof Object.getOwnPropertySymbols)
for (var i4 = 0, n3 = Object.getOwnPropertySymbols(t4); i4 < n3.length; i4++)
e3.indexOf(n3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(t4, n3[i4]) && (r4[n3[i4]] = t4[n3[i4]]);
return r4;
}(e2, ["distinct_id", "app_release", "platform", "api_version", "lib_version"]), this.device = e2, this.header = { apiKey: "abbf3bd9c6e80eb1e8c0566c35b08748", notifier: { name: "Rollout JavaScript SDK", version: u2, url: "undefined" != typeof window && window.location && window.location.href || void 0 } }, this.networkOptions = r3, this.networkSender = i3, this.user = { distinct_id: n2, app_release: s2, app_key: t3, platform: o2 }, this.app = { api_version: a2, lib_version: u2 };
}
error(t3, e2) {
return this._notify("error", t3, e2);
}
_notify(t3, e2, r3) {
const i3 = { payloadVersion: 4, exceptions: [], app: this.app, user: this.user, device: this.device, metaData: { data: { message: e2, exception: r3.toString() } }, severity: t3 };
return r3 instanceof Error ? (i3.exceptions.push({ errorClass: r3.name, message: e2 + "\n" + r3.message, stacktrace: r3.stack || "" }), i3.groupingHash = r3.fileName) : i3.exceptions.push({ errorClass: "Error", message: e2, stacktrace: [] }), this._send([i3]);
}
_send(t3) {
t3 = Object.assign({ events: t3 }, this.header), c.debug("Sending bugsnag error report."), t3 = { url: "https://notify.bugsnag.com", data: t3, options: this.networkOptions }, U().applyProxyToRequest(t3);
try {
this.networkSender.post(t3.url, t3.data, t3.options).then(() => {
c.debug("Successfully sent error report.");
}).catch((t4) => {
c.debug("Failed to send error report", t4);
});
} catch (t4) {
c.debug("Failed to send error report.", t4);
}
}
}
class K {
constructor(t3, e2) {
this.flagRepo = t3, this.experimentsRepo = e2;
}
prepareFlagsWithExperiments() {
const t3 = this.experimentsRepo.experiments || [], e2 = (c.debug("Set experiments " + JSON.stringify(t3)), []);
t3.forEach((t4) => {
t4 && t4.flags.forEach((r3) => {
(r3 = r3 && this.flagRepo.flagWithName(r3.name)) && (e2.push(r3), this.connectExperimentToFlag(r3, t4.deploymentConfiguration.condition));
});
}), this.flagRepo.flags.forEach((t4) => {
e2.some((e3) => e3 === t4) || this.connectExperimentToFlag(t4, void 0);
});
}
setAddedFlag(t3) {
var e2 = this.experimentsRepo.experimentForFlag(t3);
e2 && this.connectExperimentToFlag(t3, e2.deploymentConfiguration.condition);
}
connectExperimentToFlag(t3, e2) {
t3.condition = e2;
}
}
const q = new class {
constructor() {
this.map = {};
}
setExperiments(t3) {
this.map = {}, (t3 = t3 || []).forEach(function(t4) {
this.map[t4.identifier] = t4;
}, this);
}
experimentWithName(t3) {
return this.map[t3];
}
get experiments() {
return Object.keys(this.map).map((t3) => this.map[t3]);
}
experimentForFlagName(t3) {
return this.experiments.find((e2) => e2.flags && e2.flags.some((e3) => e3.name === t3));
}
experimentForFlag(t3) {
return this.experimentForFlagName(t3.name);
}
}(), $ = new class {
constructor() {
this.map = {};
}
addFlag(t3, e2) {
e2.name = t3, this.map[t3] = e2, new K(this, q).setAddedFlag(e2);
}
flagWithName(t3) {
return this.map[t3];
}
get flags() {
return Object.keys(this.map).map((t3) => this.map[t3]);
}
get items() {
return this.flags;
}
}();
class J {
constructor(t3, e2, r3) {
this._string = t3, this._delimiters = e2, this._returnDelim = r3, this._position = 0;
}
countTokens() {
let t3 = 0, e2 = false;
for (let r3 = this._position, i3 = this._string.length; r3 < i3; r3++)
-1 != this._delimiters.indexOf(this._string.charAt(r3)) ? (this._returnDelim && t3++, e2 && (t3++, e2 = false)) : e2 = true;
return e2 && t3++, t3;
}
hasMoreElements() {
return this.hasMoreTokens();
}
hasMoreTokens() {
if (!this._delimiters)
return false;
var t3 = this._string.length;
if (this._position < t3) {
if (this._returnDelim)
return true;
for (let e2 = this._position; e2 < t3; e2++)
if (-1 == this._delimiters.indexOf(this._string.charAt(e2)))
return true;
}
return false;
}
nextElement() {
return this.nextToken();
}
nextToken() {
if (this._delimiters) {
let e2 = this._position;
var t3 = this._string.length;
if (e2 < t3) {
if (this._returnDelim) {
if (-1 != this._delimiters.indexOf(this._string.charAt(this._position)))
return this._string.charAt(this._position++);
for (this._position++; this._position < t3; this._position++)
if (-1 != this._delimiters.indexOf(this._string.charAt(this._position)))
return this._string.substr(e2, this._position - e2);
return this._string.substr(e2);
}
for (; e2 < t3 && -1 != this._delimiters.indexOf(this._string.charAt(this._position)); )
e2++;
if ((this._position = e2) < t3) {
for (this._position++; this._position < t3; this._position++)
if (-1 != this._delimiters.indexOf(this._string.charAt(this._position)))
return this._string.substr(e2, this._position - e2);
return this._string.substr(e2);
}
}
}
}
nextTokenWithDelimiters(t3) {
return this._delimiters = t3, this.nextToken();
}
}
const W = new class {
constructor() {
this.map = {};
}
addTargetGroup(t3) {
this.map[t3.identifier] = t3;
}
setTargetGroups(t3) {
this.map = {}, (t3 = t3 || []).forEach(function(t4) {
this.map[t4.identifier] = t4;
}, this);
}
targetGroupWithName(t3) {
return this.map[t3];
}
get targetGroups() {
return Object.keys(this.map).map((t3) => this.map[t3]);
}
}(), G = new class {
constructor() {
this.store = /* @__PURE__ */ new Map();
}
has(t3) {
return this.store.has(t3.name);
}
get(t3) {
return this.store.get(t3);
}
set(t3) {
this.store.set(t3.name, t3);
}
setIfNotExists(t3) {
this.has(t3) || this.set(t3);
}
clear() {
this.store.clear();
}
get items() {
return Array.from(this.store.values());
}
}();
p = e(150);
var Z = e.n(p);
let Y = (t3, e2) => e2 ? e2[t3] : void 0;
const Q = new class {
invoke(t3, e2) {
if (this.userUnhandledErrorHandler)
try {
this.userUnhandledErrorHandler(t3, e2);
} catch (t4) {
c.error("User Unhandled Error Handler itself threw an exception. original exception:" + e2, t4);
}
else
c.error("User Unhandled Error Occured, no fallback handler was set, exception ignored.", e2);
}
setHandler(t3) {
t3 instanceof Function ? this.userUnhandledErrorHandler = t3 : c.warn("UserspaceUnhandledErrorHandler must be a function. default will be used.");
}
}();
function X(t3, e2, r3 = { zeroExtend: true, lexicographical: true }) {
const i3 = r3 && r3.lexicographical;
r3 = r3 && r3.zeroExtend;
let n2 = t3.split("."), s2 = e2.split(".");
function o2(t4) {
return (i3 ? /[0-9A-Za-z_-]+$/ : /^\d+$/).test(t4);
}
if (!n2.every(o2) || !s2.every(o2))
return NaN;
if (r3) {
for (; n2.length < s2.length; )
n2.push("0");
for (; s2.length < n2.length; )
s2.push("0");
}
i3 || (n2 = n2.map(Number), s2 = s2.map(Number));
for (let t4 = 0; t4 < n2.length; ++t4) {
if (s2.length == t4)
return 1;
if (n2[t4] != s2[t4])
return n2[t4] > s2[t4] ? 1 : -1;
}
return n2.length != s2.length ? -1 : 0;
}
const tt = (t3) => ((255 & (t3 = Z()(t3, { asBytes: true }))[0] | (255 & t3[1]) << 8 | (255 & t3[2]) << 16 | (255 & t3[3]) << 24) >>> 0) / (Math.pow(2, 32) - 1), et = (t3) => void 0 === t3, rt = () => Date.now(), it = (t3, e2) => t3 && e2, nt = (t3, e2) => t3 || e2, st = (t3, e2) => (!et(t3) && t3) !== (!et(e2) && e2), ot = (t3, e2) => (!et(t3) && t3) === (!et(e2) && e2), at = (t3) => !t3, ut = (t3, e2, r3) => t3 ? e2 : r3, ht = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || !(t3 < e2)), ct = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || !(t3 <= e2)), lt = (t3) => {
if (!et(t3))
return t3 instanceof Date ? t3.getTime() / 1e3 : void 0;
}, pt = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || !(e2 < t3)), ft = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || t3 === e2), dt = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || t3 !== e2), gt = (t3, e2) => !(et(t3) || et(e2) || "number" != typeof t3 && (t3 = Number(t3), isNaN(t3)) || "number" != typeof e2 && (e2 = Number(e2), isNaN(e2)) || !(e2 <= t3)), mt = (t3, e2, r3) => !!new RegExp(e2, r3).exec(t3), yt = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && X(t3, e2, { zeroExtend: true }) < 0, vt = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && X(t3, e2, { zeroExtend: true }) <= 0, bt = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && 0 < X(t3, e2, { zeroExtend: true }), _t = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && 0 <= X(t3, e2, { zeroExtend: true }), xt = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && 0 == X(t3, e2), wt = (t3, e2) => !et(t3) && !et(e2) && "string" == typeof t3 && "string" == typeof e2 && 0 != X(t3, e2), St = (t3, e2) => t3 + "." + e2, Ot = (t3, e2) => tt(e2) <= t3, Tt = (t3, e2, r3) => t3 <= (r3 = tt(r3)) && r3 <= e2, Et = (t3, e2 = {}, r3 = {}) => {
const i3 = $.flagWithName(t3);
if (i3)
return n2 = Object.assign({}, r3), i3.getInternalValue(n2, e2), n2.isPeek || n2.result.isOverride || n2.result.isFreezed || i3._flagImpression(n2.result.value, n2.result.usedContext), n2.result.value;
var n2 = q.experimentForFlagName(t3);
return n2 && n2.deploymentConfiguration && new Ut().evaluateExpression(n2.deploymentConfiguration.condition, r3, e2) || "false";
}, Nt = (t3, e2 = {}, r3 = {}) => !!(t3 = W.targetGroupWithName(t3)) && new Ut().evaluateExpression(t3.condition, r3, e2), Pt = () => false, At = (t3, e2 = {}) => {
const r3 = G.get(t3);
if (r3)
return r3.getValue(e2);
{
const i3 = Y;
let n2;
if (i3)
if (i3._isUserDefined)
try {
n2 = i3(t3, e2);
} catch (r4) {
throw r4.isUserError = true, r4.trigger = "DYNAMIC_PROPERTIES_RULE", r4;
}
else
n2 = i3(t3, e2);
return n2;
}
}, Dt = (t3, e2) => !!e2 && e2.includes(t3), Rt = (t3) => {
if ("string" == typeof t3)
return Z()(t3);
}, Ct = (t3, e2) => {
if ("string" == typeof t3 && "string" == typeof e2)
return "" + t3 + e2;
}, kt = (t3) => {
if ("string" == typeof t3)
return decodeURIComponent(((t4) => R(((t5) => x(t5.replace(/[-_]/g, (t6) => "-" == t6 ? "+" : "/")))(t4)))(t3));
}, It = [Nt, Et, At], Ft = Object.keys(t2), Mt = '{}[]():, \r\n"', jt = "operator", Bt = "operand";
class Vt {
constructor() {
this.tokenArray = [], this.arrayAccumulator = void 0, this.dictionaryAccumulator = void 0, this.dictKey = void 0;
}
_stringToRoxx(t3) {
return Ft.includes(t3) ? { type: jt, value: t3 } : "true" == t3 ? { type: Bt, value: true } : "false" == t3 ? { type: Bt, value: false } : "undefined" == t3 ? { type: Bt, value: void 0 } : '"' == t3.charAt(0) && '"' == t3.charAt(t3.length - 1) ? { type: Bt, value: t3.substr(1, t3.length - 2) } : isNaN(t3) ? { type: "UNKNOWN" } : { type: Bt, value: +t3 };
}
push(t3) {
this.dictionaryAccumulator && !this.dictKey ? this.dictKey = t3.value : this.dictionaryAccumulator && this.dictKey ? (this.dictionaryAccumulator[this.dictKey] = t3.value, this.dictKey = void 0) : this.arrayAccumulator ? this.arrayAccumulator.push(t3.value) : this.tokenArray.push(t3);
}
tokenize(t3) {
this.tokenArray = [], this.arrayAccumulator = void 0, this.dictionaryAccumulator = void 0;
let e2 = Mt;
t3 = t3.replace('\\"', "\\RO_Q");
const r3 = new J(t3, e2, true);
let i3, n2;
for (; r3.hasMoreTokens(); )
switch (n2 = i3, i3 = r3.nextTokenWithDelimiters(e2)) {
case "{":
this.dictionaryAccumulator = {};
break;
case "}":
this.tokenArray.push({ type: Bt, value: this.dictionaryAccumulator }), this.dictionaryAccumulator = void 0;
break;
case "[":
this.arrayAccumulator = [];
break;
case "]":
this.tokenArray.push({ type: Bt, value: this.arrayAccumulator }), this.arrayAccumulator = void 0;
break;
case '"':
'"' == n2 && this.push({ type: Bt, value: "" }), e2 = '"' == e2 ? Mt : '"';
break;
default:
'"' == e2 ? this.push({ type: Bt, value: i3.replace("\\RO_Q", '\\"') }) : -1 == Mt.indexOf(i3) && this.push(this._stringToRoxx(i3));
}
return this.tokenArray;
}
}
class Ut {
constructor(t3) {
this._tokenizer = new Vt(), this._cache = t3 || {};
}
_argsArrayForOperator(t3, e2) {
const r3 = [];
var i3 = t3.length;
for (let t4 = 0; t4 < i3; t4++) {
var n2 = e2.pop();
r3.push(n2);
}
return r3;
}
_modifyArgsHook({ operator: t3, args: e2, context: r3, callContext: i3 }) {
let n2 = e2;
return r3 && It.includes(t3) && (n2 = [...e2, r3]), i3 ? [...n2, i3] : n2;
}
compileExpression(t3) {
let e2 = this._cache[t3];
return e2 || (e2 = this._tokenizer.tokenize(t3).reverse(), this._cache[t3] = e2), e2;
}
evaluateExpression(e2, r3 = {}, i3 = {}, n2) {
var s2;
const o2 = [];
var a2 = this.compileExpression(e2);
let u2;
var h2 = a2.length;
try {
for (let e3 = 0; e3 < h2; e3++) {
var l2 = a2[e3];
if (l2.type == Bt)
o2.push(l2.value);
else {
if (l2.type != jt) {
o2.push(void 0);
break;
}
{
const e4 = t2[l2.value];
var p2 = this._argsArrayForOperator(e4, o2), f2 = (p2 = this._modifyArgsHook({ operator: e4, args: p2, context: i3, callContext: r3 }), e4.apply(this, p2)), d2 = (o2.push(f2), `${l2.value}(${JSON.stringify(p2)}) => ` + f2);
n2 && n2.push(d2), c.debug("Roxx: " + d2);
}
}
}
u2 = o2.pop();
} catch (t3) {
var g2 = "Uh oh! An error occurred during Roxx evaluation. " + e2;
t3.isUserError ? Q.invoke(t3.trigger, t3) : null != (s2 = L()) && s2.error(g2, t3), c.error(g2, t3), u2 = false;
} finally {
return u2;
}
}
}
let zt = false;
const Lt = { "rox.internal.pushUpdates": "true", "rox.internal.considerThrottleInPush": "false", "rox.internal.throttleFetchInSeconds": "0", "rox.internal.analytics": "true" };
function Ht(t3) {
return "boolean" == typeof (t3 = Kt(t3)) ? t3 : "true" === t3;
}
function Kt(t3) {
return zt && Object.prototype.hasOwnProperty.call(Lt, t3) ? Lt[t3] : (t3 = q.experimentForFlagName(t3)) && t3.deploymentConfiguration ? new Ut().evaluateExpression(t3.deploymentConfiguration.condition) : "";
}
let qt = null, $t = null;
const Jt = { frozenOrCalc: "frozenValueOrOneTimeEval", oneTimeCalc: "oneTimeEval", default: "useFrozen" }, Wt = { boolean: "boolean", number: "number", string: "string" };
class Gt {
constructor(t3, e2, r3) {
if (this._type = r3, r3 = this._validateDefault(t3), Array.isArray(e2))
this._validateOptions(e2), this._options = e2.map((t4) => t4.toString());
else {
if (null != e2)
throw new Error("RoxStringBase wrong variations type");
this._options = [];
}
-1 === this._options.indexOf(r3) && this._options.push(r3), this._value = this._defaultValue = r3, this._frozen = false, this._freezable = true;
}
_validateDefault(t3) {
if (typeof t3 !== this._type)
throw new Error(`RoxStringBase default value must be of ${this._type} type. Received '${t3}'`);
return t3.toString();
}
_validateOptions(t3) {
var e2 = new Error(`RoxStringBase options must be a non-empty array of ${this._type}. Received '${t3}'`);
if (!t3.every((t4) => typeof t4 === this._type))
throw e2;
}
get defaultValue() {
return this._defaultValue;
}
get overridenValue() {
if (this.overrider.hasOverride(this.name))
return this.overrider.getOverride(this.name);
}
get overrider() {
throw new Error("Not implemented");
}
getInternalValue(t3, e2) {
throw Error("not implemented");
}
get externalType() {
switch (this._type) {
case Wt.boolean:
return Boolean.name;
case Wt.number:
return Number.name;
default:
return Wt.string, String.name;
}
}
set name(t3) {
this._name = t3;
}
get name() {
return this._name;
}
_getNameDetails() {
if (this.name) {
const t3 = this.name.split(".");
return { name: t3.pop(), namespace: t3.join(".") || "default" };
}
}
dump() {
var t3 = { type: Jt.frozenOrCalc };
return this.getInternalValue(t3), { name: this.name, type: this._type, nameDetails: this._getNameDetails(), options: [...this._options], defaultValue: this.defaultValue, originalValue: this._originalValue(), overridingValue: this.overridenValue, value: t3.result.value };
}
getActiveValue(t3, e2) {
throw new Error("Not implemented");
}
_originalValue() {
var t3 = { type: Jt.frozenOrCalc };
return this.getActiveValue(t3), t3.result.value;
}
_flagImpression(t3, e2) {
var r3 = q.experimentForFlag(this);
try {
if ($t && Ht("rox.internal.analytics")) {
var i3 = r3 && r3.stickinessProperty;
let s2 = i3 && G.get(i3);
var n2 = (s2 = s2 || G.get("rox.distinct_id")) ? s2.getValue(e2) : "";
$t.track({ flag: this.name, value: t3, distinctId: n2, type: "IMPRESSION", time: new Date().getTime() });
}
} catch (t4) {
c.error("Failed to send analytics", t4);
}
if ("function" == typeof qt) {
i3 = !!r3;
try {
qt({ name: this.name, value: t3, targeting: i3 }, e2);
} catch (t4) {
Q.invoke("IMPRESSION_HANDLER", t4);
}
}
}
static _normalizeString(t3) {
return t3;
}
static _normalizeNumber(t3) {
return Number(t3);
}
static _normalizeBoolean(t3) {
return "boolean" == typeof t3 ? t3 : "true" === t3;
}
}
const Zt = { flagsRepository: $ };
function Yt(t3, e2 = null) {
let { app_key: r3, buid: i3, relative_url: n2 } = t3, s2 = function(t4, e3) {
var r4 = {};
for (n3 in t4)
Object.prototype.hasOwnProperty.call(t4, n3) && e3.indexOf(n3) < 0 && (r4[n3] = t4[n3]);
if (null != t4 && "function" == typeof Object.getOwnPropertySymbols)
for (var i4 = 0, n3 = Object.getOwnPropertySymbols(t4); i4 < n3.length; i4++)
e3.indexOf(n3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(t4, n3[i4]) && (r4[n3[i4]] = t4[n3[i4]]);
return r4;
}(t3, ["app_key", "buid", "relative_url"]);
return s2.cache_miss_relative_url = n2, t3 = V("CD_API_ENDPOINT") + `/${r3}/` + i3, { url: e2 || t3, body: s2 };
}
function Qt(t3, e2 = null) {
return { url: e2 || "" + V("SS_API_ENDPOINT") + t3.app_key + "/" + t3.md5, body: { platform: t3.platform, feature_flags: t3.feature_flags, custom_properties: t3.custom_properties, devModeSecret: t3.devModeSecret } };
}
function Xt(t3) {
var { data: t3, status: e2 } = t3;
return 200 === e2 && t3 && "object" == typeof t3 ? (c.debug("succeed fetch from API"), t3) : Promise.reject(new Error("Unexpected response from ROX API"));
}
function te(t3, e2, r3, i3) {
return e2 = { url: e2, data: r3, options: i3 }, U().applyProxyToRequest(e2), t3.post(e2.url, e2.data, e2.options).then(Xt);
}
function ee(t3, e2, r3, i3) {
return e2 = { url: e2, data: r3, options: i3 }, U().applyProxyToRequest(e2), t3.post(e2.url, e2.data, e2.options).then(({ status: t4 }) => {
if (200 !== t4)
return Promise.reject(new Error("Unexpected response from ROX API"));
c.debug("succeed setState from API");
});
}
function re(t3) {
return t3.catch((t4) => {
throw t4.message = "Unable to fetch rox configuration!\n" + t4.message, c.error(t4), t4;
});
}
const ie = ["lib_version", "api_version", "platform", "app_key", "customSigningCertificate"], ne = ["platform", "app_key", "feature_flags", "custom_properties", "devModeSecret"];
function se(t3 = {}, e2 = []) {
const r3 = e2.map((e3) => {
var r4 = t3[e3];
return r4 ? r4.constructor === Object || r4.constructor === Array ? JSON.stringify(r4) : r4 : e3;
});
return Z()(r3.join("|"));
}
class oe {
constructor(t3) {
this.condition = t3;
}
}
class ae {
constructor(t3, e2, r3, i3, n2, s2, o2, a2) {
this.identifier = t3, this.name = e2, this.archived = r3, this.sticky = i3, this.deploymentConfiguration = n2, this.flags = s2, this.labels = o2, this.stickinessProperty = a2;
}
}
const ue = "deploymentConfiguration", he = "condition", ce = "name", le = "featureFlags";
class pe {
constructor(t3) {
this._json = t3;
}
parse() {
if (!this._json || !this._json.length)
return [];
const t3 = [];
return this._json.forEach((e2) => {
var r3, i3;
e2 && e2[ue] && e2._id && e2[ce] && e2[le] && (i3 = e2[ue])[he] && (r3 = e2.labels || [], i3 = new oe(i3[he]), t3.push(new ae(e2._id, e2[ce], !!e2.archived, !!e2.sticky, i3, e2[le], r3, e2.stickinessProperty)));
}), t3;
}
}
class fe {
constructor(t3, e2) {
this.identifier = t3, this.condition = e2;
}
}
const de = "condition";
class ge {
constructor(t3) {
this._json = t3;
}
parse() {
if (!this._json || !this._json.length)
return [];
const t3 = [];
return this._json.forEach((e2) => {
e2 && e2._id && e2[de] && t3.push(new fe(e2._id, e2[de]));
}), t3;
}
}
class me {
constructor(t3, e2, r3 = true) {
if (!t3 || "object" != typeof t3)
throw new Error("ConfigurationParser should be constructed with JSON object. Received " + t3);
if (!e2 || "string" != typeof e2)
throw new Error("ConfigurationParser should be constructed with app key string. Received " + e2);
this._json = t3, this._appKey = e2, this._validateAppKey = r3;
}
parse() {
var t3 = this._extractInnerJson(this._json);
return this._validateAppKey && t3.application !== this._appKey ? null : (this._parseExperiments(t3.experiments), this._parseTargetGroups(t3.targetGroups), this._signedDate = new Date(this._json.signed_date), this);
}
experiments() {
return this._experiments || [];
}
targetGroups() {
return this._targetGroups || [];
}
signedDate() {
return this._signedDate;
}
_extractInnerJson(t3) {
return JSON.parse(t3.data);
}
_parseExperiments(t3) {
this._experiments = new pe(t3).parse();
}
_parseTargetGroups(t3) {
this._targetGroups = new ge(t3).parse();
}
}
const ye = "ERROR_FETCH_FAILED";
class ve {
constructor(t3, e2, r3, i3, n2) {
this.fetcherStatus = t3, this.creationDate = e2, this.hasChanges = r3, this.errorDetails = i3, this.clientData = n2;
}
}
let be, _e;
try {
_e = $__ROX_EMBEDDED_CONTENT;
} catch (r3) {
}
if (_e && "string" == typeof _e)
try {
_e = JSON.parse(_e);
} catch (r3) {
_e = void 0;
}
const xe = be = _e && _e.constructor === Object && _e.signed_date ? _e : be, we = V("CLIENT_DATA_CACHE_KEY");
let Se = false;
const Oe = class {
constructor(t3, e2, r3, i3, n2, s2, o2, a2) {
this.cache = i3.RoxCache, this.crypto = i3.RoxCrypto, this.embdeddedJSON = this.fetchFromEmbedded(n2), this.appKey = t3, this.deviceProperties = e2, this.devModeSecret = r3, this.options = s2 || {}, this.networkOptions = o2, this.networkSender = a2, this.lastResponse = null;
}
runHandler(t3, e2) {
var r3;
if (e2.errorDetails && null != (r3 = L()) && r3.error("Configuration fetcher returned with " + e2.fetcherStatus, e2.errorDetails), t3 instanceof Function)
try {
t3(e2);
} catch (t4) {
}
}
dispatch({ handler: t3, options: e2 }) {
try {
c.debug("dispatch();");
const s2 = [];
var r3, i3, n2;
if (e2.useCache && (this.embdeddedJSON && (this.verifyPayload(this.embdeddedJSON) ? (r3 = this.parsePayload(this.embdeddedJSON)) && s2.push({ payload: this.embdeddedJSON, parser: r3, status: "APPLIED_FROM_EMBEDDED" }) : c.error("The embdeddedJSON was corrupted or its authenticity cannot be securely verified. skipping embedded")), (i3 = this.fetchFromCache()) && (this.verifyPayload(i3) ? (n2 = this.parsePayload(i3)) && s2.push({ payload: i3, parser: n2, status: "APPLIED_FROM_CACHE" }) : c.error("The cachedPayload was corrupted or its authenticity cannot be securely verified. skipping cache"))), 0 < s2.length) {
const e3 = s2.reduce((t4, e4) => t4 && t4.parser.signedDate() > e4.parser.signedDate() ? t4 : e4, null);
(!this.lastApplied || this.lastApplied.signedDate() < e3.parser.signedDate()) && (this.lastResponse = e3.payload, this.apply(e3.parser, e3.status, false, t3, e3.payload));
}
return e2.skipNetwork ? void 0 : this.shouldSkipFetch(e2.source) ? void c.debug("Skipping fetch - kill switch") : this._dispatch({ handler: t3, storeInCache: true });
} catch (t4) {
c.error("Unexpected error in dispatch", t4);
}
}
shouldSkipFetch(t3) {
t3 = "push" === t3;
var e2 = (e2 = Kt("rox.internal.throttleFetchInSeconds"), parseInt(e2) || 0);
if (0 < e2 && (!t3 || Ht("rox.internal.considerThrottleInPush"))) {
if (t3 = +Date.now(), this.lastFetchTryTime && t3 < this.lastFetchTryTime + 1e3 * e2)
return true;
this.lastFetchTryTime = t3;
}
return false;
}
dispatchPeriodically({ handler: t3, periodTimeInSec: e2 }) {
if (Se)
return c.debug("Dispatch Periodically already running"), Promise.resolve();
Se = true, c.debug("Dispatch Periodically"), setInterval(() => {
this._dispatch({ handler: t3 });
}, 1e3 * e2);
}
_dispatch({ handler: t3, storeInCache: e2 }) {
return this.fetchFromNetwork().then((r3) => {
var i3 = this.isNewResponse(r3);
return this.process(r3, "APPLIED_FROM_NETWORK", i3, t3).then(() => {
e2 && this.storeInCache(r3), this.lastResponse = r3;
});
}).catch((e3) => {
this.runHandler(t3, new ve(ye, null, false, e3));
});
}
fetchFromNetwork() {
c.debug("fetch from network for appKey " + this.appKey);
var t3, e2, r3, i3, n2, s2, o2 = function({ appKey: t4, deviceProperties: e3, devModeSecret: r4 }) {
const i4 = e3.getProperties();
var n3;
return i4.app_key = t4, i4.buid = ([e3 = {}, n3 = ie] = [i4], se(e3, n3)), i4.buid_generators_list = ie.join(","), i4.relative_url = t4 + "/" + i4.buid, i4.cache_url = "" + V("CD_S3_ENDPOINT") + i4.relative_url, i4.devModeSecret = r4, i4;
}({ appKey: this.appKey, deviceProperties: this.deviceProperties, devModeSecret: this.devModeSecret });
return this.rc = o2, this.options.roxyUrl ? (n2 = this.networkSender, s2 = this.options.roxyUrl, i3 = this.networkOptions, s2 = { url: Yt(o2, s2).url, options: i3 }, U().applyProxyToRequest(s2), re(n2.get(s2.url, s2.options).then(Xt))) : ([t3, e2, r3, i3 = {}] = [this.networkSender, o2, this.networkOptions, this.options], n2 = `${e2.cache_url}?distinct_id=${e2.distinct_id}&platform=${e2.realPlatform}&lib_version=` + e2.lib_version, i3.selfManagedMode && !V("CD_S3_ENDPOINT") ? (s2 = Yt(e2), re(te(t3, s2.url, s2.body, r3))) : (o2 = t3, i3 = { url: n2, options: r3 }, U().applyProxyToRequest(i3), re(o2.get(i3.url, i3.options).then(({ data: t4, status: e3 }) => {
if (200 === e3 && t4 && "object" == typeof t4) {
if (404 !== t4.result)
return c.debug("succeed fetch from CDN"), t4;
{
c.debug("succeed fetch from CDN, but it was missing");
const t5 = new Error("missing from CDN");
return t5.missing = true, Promise.reject(t5);
}
}
}).catch((t4) => {
if (t4.missing || t4.response && (404 == t4.response.status || 403 == t4.response.status))
return Promise.reject();
c.debug("Unexpected error calling get configuration, status code returned different from 403 or 404. error: " + t4);
}).catch(() => {
var i4 = Yt(e2);
return te(t3, i4.url, i4.body, r3);
}))));
}
fetchFromCache() {
c.debug("fetch From Cache");
let t3, e2 = this.cache.get(this.cacheKey());
if (e2 = e2 || this.cache.get(we)) {
try {
t3 = JSON.parse(e2);
} catch (e3) {
c.warn(`Configuration retrieved from cache, but is corrupted. Aborting. (Error: ${e3})`);
}
if (t3 && t3.constructor === Object)
return c.debug("Parsed cached = " + JSON.stringify(t3)), t3;
}
}
cacheKey() {
return we + "-" + this.appKey;
}
fetchFromEmbedded(t3) {
let e2;
if (t3) {
try {
e2 = JSON.parse(t3);
} catch (t4) {
c.warn("Received embdedded configuration, but it is corrupted. Aborting. Error: ", t4);
}
if (e2 && e2.constructor === Object)
return c.debug("Parsed embedded = " + JSON.stringify(e2)), e2;
}
if (xe && "object" == typeof xe)
return xe;
}
storeInCache(t3) {
c.debug("Store in cache response = " + JSON.stringify(t3)), this.cache.set(this.cacheKey(), JSON.stringify(t3));
}
process(t3, e2, r3, i3) {
if (!t3)
return Promise.reject("Empty configuration");
if (!this.verifyPayload(t3))
return Promise.reject("The payload has corrupted or its authenticity cannot be securely verified.");
var n2 = this.parsePayload(t3);
return n2 ? this.apply(n2, e2, r3, i3, t3) : Promise.reject("Failed to parse configuration");
}
apply(t3, e2, r3, i3, n2) {
if (t3)
return this.calculatePayload(t3), this.lastApplied = t3, new Promise((s2) => {
var o2 = new ve(e2, t3.signedDate(), r3, void 0, n2);
this.runHandler(i3, o2), s2();
});
}
parsePayload(t3) {
var e2 = !this.options.roxyUrl;
const r3 = new me(t3, this.appKey, e2);
return r3.parse() ? r3 : (c.debug(`failed to parse payload. response = ${JSON.stringify(t3)} deviceProps = ${this.deviceProperties} app_key = ` + this.appKey), null);
}
verifyPayload(t3) {
var { signature_v0: t3, data: e2 } = t3;
return !!(this.options.roxyUrl || this.options.selfManagedMode || this.options.disableSignatureVerification) || this.crypto.verify(e2, t3);
}
calculatePayload(t3) {
if (t3)
return W.setTargetGroups(t3.targetGroups()), q.setExperiments(t3.experiments()), new K($, q).prepareFlagsWithExperiments(), t3;
}
isNewResponse(t3) {
return JSON.stringify(this.lastResponse) !== JSON.stringify(t3);
}
get cacheURL() {
return this.rc && this.rc.cache_url;
}
}, Te = "Semver";
class Ee {
constructor(t3, e2, r3) {
if (e2 === Te && (this._isSemver = true, e2 = String), void 0 === t3 || "" === t3)
throw new Error("Custom property must be initialized with a name.");
if (this._name = t3, "function" == typeof r3) {
if (1 < r3.length)
throw new Error("Dynamic value of a custom property should be a function with maximum 1 argument");
r3.isDynamic = true, this._value = r3;
} else {
if (t3 = e2, r3 && r3.constructor !== t3 && r3.constructor !== Function)
throw new Error(`Custom property initialized with an invalid type / value combination. (Type: ${t3}, Value: ${r3})`);
this._value = () => r3;
}
this._type = e2;
}
get type() {
return this.externalType;
}
get externalType() {
return this._isSemver ? Te : this._type.name == Date.name ? Ee.dateTypeName : this._type.name;
}
get name() {
return this._name;
}
getValue(t3 = {}) {
if (this._value && this._value.isDynamic)
try {
return this._value(t3);
} catch (t4) {
throw t4.isUserError = true, t4.trigger = "CUSTOM_PROPERTY_GENERATOR", t4;
}
return this._value(t3);
}
static get dateTypeName() {
return "DateTime";
}
static get semverTypeName() {
return Te;
}
get value() {
return this._value();
}
}
const Ne = (t3) => {
setTimeout(t3, 5);
}, Pe = () => {
}, Ae = class {
constructor(t3, e2, r3, i3, n2) {
if (e2 = e2 || {}, this.queue = [], this.writeKey = t3, this.host = e2.host || V("ANALYTICS_ENDPOINT"), this.timeout = e2.timeout || false, this.flushAt = Math.max(e2.flushAt || 20, 1), this.flushInterval = e2.flushInterval || 1e4, this.flushed = false, this.version = r3.getProperties().lib_version || "0.0", void 0 === r3.getProperties().platform)
throw new Error("Platform must be provided");
this.platform = r3.getProperties().platform || "", this.networkOptions = i3, this.networkSender = n2, Object.defineProperty(this, "enable", { configurable: false, writable: false, enumerable: true, value: "boolean" != typeof e2.enable || e2.enable });
}
identify(t3, e2) {
return this.enqueue("identify", t3, e2), this;
}
group(t3, e2) {
return this.enqueue("group", t3, e2), this;
}
track(t3, e2) {
return this.enqueue("track", t3, e2), this;
}
page(t3, e2) {
return this.enqueue("page", t3, e2), this;
}
screen(t3, e2) {
return this.enqueue("screen", t3, e2), this;
}
alias(t3, e2) {
return this.enqueue("alias", t3, e2), this;
}
enqueue(t3, e2, r3) {
return r3 = r3 || Pe, this.enable ? (e2 = Object.assign({}, e2), this.queue.push({ message: e2, callback: r3 }), this.flushed ? (this.queue.length >= this.flushAt && this.flush(), void (this.flushInterval && !this.timer && (this.timer = setTimeout(this.flush.bind(this), this.flushInterval)))) : (this.flushed = true, void this.flush())) : Ne(r3);
}
flush(t3) {
if (t3 = t3 || Pe, !this.enable)
return Ne(t3);
if (this.timer && (clearTimeout(this.timer), this.timer = null), !this.queue.length)
return Ne(t3);
const e2 = this.queue.splice(0, this.flushAt), r3 = e2.map((t4) => t4.callback);
var i3 = e2.map((t4) => t4.message);
const n2 = { analyticsVersion: "1.0.0", sdkVersion: this.version, time: new Date().getTime(), platform: this.platform, rolloutKey: this.writeKey, events: i3 }, s2 = (e3) => {
r3.forEach((t4) => t4(e3)), t3(e3, n2);
}, o2 = (i3 = this.host + "/impression/" + this.writeKey, { httpsAgent: this.networkOptions.httpsAgent, httpAgent: this.networkOptions.httpAgent });
this.timeout && (o2.timeout = this.timeout), i3 = { url: i3, data: n2, options: o2 }, U().applyProxyToRequest(i3), this.networkSender.post(i3.url, i3.data, i3.options).then(() => s2()).catch((t4) => {
var e3;
if (t4.response)
return e3 = new Error(t4.response.statusText), s2(e3);
s2(t4);
});
}
}, De = "object" == typeof window && window.EventSource;
class Re {
constructor(t3, e2, r3, i3) {
t3 = t3 + (t3.endsWith("/") ? "" : "/") + e2, c.info("Starting push notification listener to " + t3), e2 = { url: t3, options: i3 }, U().applyProxyToSseRequest(e2), r3 ? this.eventSource = new r3(e2.url, e2.options) : De && (this.eventSource = new De(e2.url));
}
on(t3, e2) {
this.eventSource && this.eventSource.addEventListener(t3, (t4) => {
try {
e2(t4);
} catch (t5) {
}
});
}
stop() {
this.eventSource && this.eventSource.close();
}
}
l = e(784);
var Ce = e.n(l);
function ke(t3) {
return t3.catch((t4) => {
throw t4.message = "Unable to send state!\n" + t4.message, t4;
});
}
class Ie {
constructor(t3 = false) {
this.includePlatformChanges = t3;
}
get customProperties() {
const t3 = [];
return G.items.forEach((e2) => {
if (e2.externalType !== Ee.dateTypeName || this.includePlatformChanges) {
const r3 = { name: e2.name, externalType: e2.externalType };
r3.type = e2.type, t3.push(r3);
}
}), t3;
}
get featureFlags() {
const t3 = [];
return $.items.forEach((e2) => {
const r3 = { name: e2.name, defaultValue: e2.defaultValue, options: e2._options };
this.includePlatformChanges && (r3.externalType = e2.externalType), t3.push(r3);
}), t3;
}
}
const Fe = class {
constructor(t3, e2, r3, i3, n2, s2, o2) {
this.appKey = t3, this.deviceProperties = e2, this.devModeSecret = r3, this.networkOptions = i3, this.options = n2, this.registry = new Ie(s2), this.networkSender = o2;
}
send() {
c.debug("check for cached state for appKey " + this.appKey);
var t3, e2, r3, i3, n2, s2, o2, a2, u2, h2 = this.buildSetState();
try {
[t3, e2, r3, i3 = {}] = [this.networkSender, h2, this.networkOptions, this.options], a2 = e2, u2 = "" + V("SS_S3_ENDPOINT") + a2.app_key + "/" + a2.md5, (i3.selfManagedMode && !V("SS_S3_ENDPOINT") ? (n2 = Qt(e2), ke(ee(t3, n2.url, n2.body, r3))) : (s2 = t3, o2 = { url: u2, options: r3 }, U().applyProxyToRequest(o2), ke(s2.get(o2.url, o2.options).then(({ data: t4, status: e3 }) => {
if (200 === e3 && t4 && "object" == typeof t4) {
if (404 === t4.result) {
c.debug("succeed setState from CDN, but it was missing");
const t5 = new Error("missing from CDN");
return t5.missing = true, Promise.reject(t5);
}
if (200 === t4.result)
return void c.debug("succeed setState from CDN");
}
c.debug("succeed setState, but with unexpected response");
}).catch((t4) => {
if (t4.missing || t4.response && (404 == t4.response.status || 403 == t4.response.status))
return Promise.reject();
c.debug("Unexpected error calling setState, status code returned different from 403 or 404. error: " + t4);
}).catch(() => {
var i4 = Qt(e2);
return ee(t3, i4.url, i4.body, r3);
})))).catch((t4) => {
c.error("failed to send state (promise)", t4);
});
} catch (i4) {
c.error("failed to send state", i4);
}
}
sortItemsByName(t3) {
return t3.sort((t4, e2) => t4.name > e2.name ? -1 : 1);
}
buildSetState() {
const t3 = this.deviceProperties.getProperties();
var e2, r3;
return t3.app_key = this.appKey, t3.feature_flags = this.sortItemsByName(this.registry.featureFlags), t3.custom_properties = this.sortItemsByName(this.registry.customProperties), t3.devModeSecret = this.devModeSecret, t3.md5 = ([e2 = {}, r3 = ne] = [t3], se(e2, r3)), t3;
}
};
class Me {
constructor(t3, e2, r3) {
this.status = t3, this.data = e2, this.headers = r3;
}
}
class je {
constructor(t3) {
this.fetch = t3;
}
get(t3, e2) {
return e2 = Object.assign({ method: "GET" }, e2), this.fetch(t3, e2).then(this.handleFetch);
}
post(t3, e2, r3) {
var i3 = r3.headers;
return r3 = function(t4, e3) {
var r4 = {};
for (n2 in t4)
Object.prototype.hasOwnProperty.call(t4, n2) && e3.indexOf(n2) < 0 && (r4[n2] = t4[n2]);
if (null != t4 && "function" == typeof Object.getOwnPropertySymbols)
for (var i4 = 0, n2 = Object.getOwnPropertySymbols(t4); i4 < n2.length; i4++)
e3.indexOf(n2[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(t4, n2[i4]) && (r4[n2[i4]] = t4[n2[i4]]);
return r4;
}(r3, ["headers"]), e2 = Object.assign({ method: "POST", body: JSON.stringify(e2), headers: Object.assign({ "Content-Type": "application/json" }, i3) }, r3), this.fetch(t3, e2).then(this.handleFetch);
}
handleFetch(t3) {
if (!t3.ok) {
const e3 = new Error("network returned non 2xx response");
return e3.response = t3, Promise.reject(e3);
}
const e2 = t3.headers.get("content-type");
return e2 && e2.includes("application/json") ? t3.json().then((e3) => new Me(t3.status, e3, t3.headers)) : t3.text().then((e3) => new Me(t3.status, e3, t3.headers));
}
}
f = e(742);
var Be = e.n(f);
class Ve {
get(t3, e2) {
return Be().get(t3, e2).then((t4) => new Me(t4.status, t4.data, t4.headers));
}
post(t3, e2, r3) {
return Be().post(t3, e2, r3).then((t4) => new Me(t4.status, t4.data, t4.headers));
}
}
let Ue = { ClassRegister: class {
constructor(t3 = {}) {
this.options = Object.assign({}, Zt, t3), this._flagsRepository = this.options.flagsRepository, this._namespaceStore = /* @__PURE__ */ new Set();
}
handleContainer(t3, e2) {
if ("[object String]" !== Object.prototype.toString.call(t3))
throw new Error("InvalidNamespace: Namespace must be a string (non-nullable).");
var r3, i3;
if (this._namespaceStore.has(t3))
throw new Error(`InvalidNamespace: A namespace must be unique. A container with the given namespace ('${t3}') has already been registered.`);
this._namespaceStore.add(t3);
for (const n2 in e2)
Object.prototype.hasOwnProperty.call(e2, n2) && (r3 = t3 ? t3 + "." + n2 : n2, (i3 = e2[n2]) instanceof Gt && this._flagsRepository.addFlag(r3, i3));
}
} };
const ze = new class {
constructor(t3 = 5e3) {
this.classRegisterer = new Ue.ClassRegister(), this.sendStateDebounceNoCheck = Ce()(() => {
this._sendState();
}, t3, { maxWait: t3, leading: false, trailing: true }), this.sendStateDebounced = () => {
this.appKey && this.sendStateDebounceNoCheck();
}, this.onConfigurationFetched = this.onConfigurationFetched.bind(this);
}
get dynamicApi() {
return this._dynamicApi;
}
get appKey() {
return this.app_key;
}
setKey(t3, e2) {
var r3 = /^[a-f\d]{24}$/i.test(t3), i3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t3);
if (!r3 && !i3)
throw Error("invalid rollout apikey");
this.app_key = t3, i3 && (z("platform"), e2.disableSignatureVerification = true);
}
setup(t3) {
var e2;
try {
this.handleOptions(t3), Ue.DeviceProperties = Ue.DeviceProperties.create ? Ue.DeviceProperties.create(Ue) : Ue.DeviceProperties, this.app_release && Ue.DeviceProperties.setAppRelease(this.app_release), this.distinct_id && Ue.DeviceProperties.setDistinctId(this.distinct_id), this.platform && Ue.DeviceProperties.setPlatform(this.platform), this.deviceProperties = Ue.DeviceProperties, this.deviceProperties.setRealPlatform(this.realPlatform), this.selfManagedMode && function(t4) {
B.ERROR_REPORTER = t4;
}(new H(this.appKey, Ue.DeviceProperties, this.networkOptions, this.networkApi)), this.configurationFetcher = new Oe(this.appKey, this.deviceProperties, this.devModeSecret, Ue, this.embeddedConfiguration, { roxyUrl: this.roxyUrl, selfManagedMode: this.selfManagedMode, disableSignatureVerification: this.disableSignatureVerification }, this.networkOptions, this.networkApi), this.roxyUrl || (this.stateSender = new Fe(this.appKey, this.deviceProperties, this.devModeSecret, this.networkOptions, { selfManagedMode: this.selfManagedMode }, this.disableSignatureVerification, this.networkApi), this.disableNetwork || (e2 = new Ae(this.appKey, Object.assign({}, this.analyticsOptions), Ue.DeviceProperties, this.networkOptions, this.networkApi), $t = e2)), Ue.getDefaultCustomProperties(this.deviceProperties, this.appKey).map(G.setIfNotExists.bind(G));
} catch (r3) {
t3 = "Uh oh! An error occurred during setup.", c.error(t3, r3), null != (e2 = L()) && e2.error(t3, r3);
}
return Promise.resolve(this);
}
handleOptions(t3) {
var e2 = Ue.DefaultSetupOptions.platform;
const r3 = Object.assign({}, Ue.DefaultSetupOptions, t3);
if (r3.selfManaged && "object" == typeof r3.selfManaged) {
if (!r3.selfManaged.analyticsURL)
throw new Error("analyticsURL is required on self managed mode");
if (!r3.selfManaged.serverURL)
throw new Error("serverURL is required on self managed mode");
t3.selfManaged.configurationURL && (r3.selfManaged.configurationURL = t3.selfManaged.configurationURL.endsWith("/") ? t3.selfManaged.configurationURL : t3.selfManaged.configurationURL + "/"), t3.selfManaged.stateURL && (r3.selfManaged.stateURL = t3.selfManaged.stateURL.endsWith("/") ? t3.selfManaged.stateURL : t3.selfManaged.stateURL + "/"), function(t4) {
var e3, r4, i3, n2;
B = Object.assign({}, j(), ({ analyticsURL: t4, serverURL: e3, pushUpdateURL: r4, configurationURL: i3, stateURL: n2 } = t4, { CD_API_ENDPOINT: e3 + "/device/get_configuration", SS_API_ENDPOINT: e3 + "/device/update_state_store/", CLIENT_DATA_CACHE_KEY: "client_data", ANALYTICS_ENDPOINT: t4, NOTIFICATIONS_ENDPOINT: r4 + "/sse", CD_S3_ENDPOINT: i3, SS_S3_ENDPOINT: n2, ERROR_REPORTER: void 0 }));
}(r3.selfManaged), zt = true, this.selfManagedMode = true;
}
r3.configuration && r3.configuration.disableNetwork && (this.disableNetwork = true), this.embeddedConfiguration = r3.embedded, this.fetchIntervalInSec = r3.fetchIntervalInSec, this.disablePushUpdateListener = !!(this.disableNetwork || this.selfManagedMode && !r3.selfManaged.pushUpdateURL) || r3.disablePushUpdateListener, this.configurationFetchedHandler = r3.configurationFetchedHandler, this.impressionHandler = r3.impressionHandler, this.dynamicPropertyRuleHandler = r3.dynamicPropertyRuleHandler, this.app_release = r3.version, this.distinct_id = r3.distinctId, this.devModeSecret = r3.devModeSecret, this.platform = r3.platform, this.fetchFunction = r3.fetchFunction, this.networkApi = r3.networkApi, this.networkApi ? c.debug("network: using custom") : this.fetchFunction ? (c.debug("network: using fetch"), this.networkApi = new je(this.fetchFunction)) : (c.debug("network: using axios"), this.networkApi = new Ve()), this.realPlatform = e2, this.roxyUrl = r3.roxy, this.networkOptions = { httpAgent: r3.httpAgent, httpsAgent: r3.httpsAgent }, this.disableSignatureVerification = r3.disableSignatureVerification || false, this.analyticsOptions = r3.analytics, this.eventSourceImpl = r3.eventSourceImpl, e2 = this.impressionHandler, qt = e2, t3.logger && c.setLogger(t3.logger), this.dynamicPropertyRuleHandler && (e2 = this.dynamicPropertyRuleHandler, (Y = e2) && (Y._isUserDefined = true));
}
fetchPeriodically() {
if (!this.app_key)
return c.warn("no app key"), Promise.reject();
if (this.fetchIntervalInSec <= 0)
return Promise.resolve();
this.fetchIntervalInSec < 30 && (this.fetchIntervalInSec = 30);
var t3 = this._fetch({ useCache: false });
return this.configurationFetcher.dispatchPeriodically({ handler: this.onConfigurationFetched, periodTimeInSec: this.fetchIntervalInSec }), t3;
}
fetchCacheOnly() {
return this._fetch({ useCache: true, skipNetwork: true });
}
fetchWithCacheAndProceed() {
return this._fetch({ useCache: true });
}
fetch() {
return this._fetch({ useCache: false });
}
_fetchFromPush() {
return this._fetch({ useCache: false, source: "push" });
}
sendState() {
this._sendState();
}
_sendState() {
this.sendStateDebounceNoCheck.cancel(), this.app_key && (this.disableNetwork ? c.debug("send state - disabled network") : this.stateSender && this.stateSender.send());
}
_fetch(t3 = {}) {
if (this.app_key) {
if (this.configurationFetcher)
return this.disableNetwork && (c.debug("fetch - disabling network"), t3.skipNetwork = true), this.configurationFetcher.dispatch({ handler: this.onConfigurationFetched, options: t3 });
} else
c.warn("no app key");
}
register(t3, e2) {
void 0 === e2 && "object" == typeof t3 && null !== t3 && (e2 = t3, t3 = ""), c.debug(`Registering container '${t3}' = ` + JSON.stringify(e2)), this.classRegisterer.handleContainer(t3, e2), this.sendStateDebounced();
}
setSemverCustomProperty(t3, e2) {
this.setCustomProperty(t3, Ee.semverTypeName, e2);
}
setCustomProperty(t3, e2, r3) {
t3 = new Ee(t3, e2, r3), e2 = !G.has(t3), G.set(t3), e2 && this.sendStateDebounced();
}
unfreeze(t3, e2) {
$.flags.filter((e3) => {
if (!e3.name || "string" != typeof t3)
return true;
const r3 = e3.name.split(".");
return 1 === r3.length && "" === t3 || r3.slice(0, r3.length - 1).join(".") === t3;
}).forEach((t4) => {
t4.unfreeze(e2);
});
}
get metadata() {
const t3 = new Ut();
return { targetGroups: W.targetGroups.map((e2) => ({ name: e2.name, isEnabled: t3.evaluateExpression(e2.condition) })), experiments: q.experiments.map((e2) => ({ name: e2.name, isEnabled: "true" === t3.evaluateExpression(e2.deploymentConfiguration.condition) })), flags: $.flags.map((t4) => ({ name: t4.name, value: t4._peek() })) };
}
onConfigurationFetched(t3) {
try {
t3.fetcherStatus !== ye && this.startOrStopPushUpdatesListener();
} catch (t4) {
c.warn("Cound not start or stop push notification listener. exception: " + t4);
}
if (this.configurationFetchedHandler instanceof Function)
try {
return this.configurationFetchedHandler(t3);
} catch (t4) {
Q.invoke("CONFIGURATION_FETCHED_HANDLER", t4);
}
}
startOrStopPushUpdatesListener() {
!this.disablePushUpdateListener && Ht("rox.internal.pushUpdates") ? this.app_key && !this.pushUpdatesListener && (this.pushUpdatesListener = new Re(V("NOTIFICATIONS_ENDPOINT"), this.app_key, this.eventSourceImpl, this.networkOptions), this.pushUpdatesListener.on("changed", () => {
this._fetchFromPush();
})) : this.pushUpdatesListener && (this.pushUpdatesListener.stop(), this.pushUpdatesListener = null);
}
setUserspaceUnhandledErrorHandler(t3) {
Q.setHandler(t3);
}
get cacheURL() {
if (this.configurationFetcher && this.configurationFetcher.cacheURL)
return this.configurationFetcher.cacheURL;
throw new Error("Rox was not initialized. Please call setup() before calling cacheURL()");
}
}();
p = e(834);
var Le = e.n(p);
const He = new class {
set(t3, e2, r3) {
Le().set(t3, e2, r3);
}
get(t3) {
return Le().get(t3);
}
}(), { api_version: Ke, lib_version: qe } = (l = e(496), { api_version: "1.9.0", lib_version: "6.0.2" }), $e = (f = new class extends class {
constructor(t3, e2) {
this.cache = t3, this._uuid = e2, this.distinct_id = this.generateDistinctId(), this.app_release = "0.0", this.distinctIdSetExplicitly = false;
}
setPlatform(t3) {
this.platform = t3;
}
setRealPlatform(t3) {
this.realPlatform = t3;
}
setDistinctId(t3) {
this.distinctIdSetExplicitly = true, this.distinct_id = t3;
}
setAppRelease(t3) {
this.app_release = t3;
}
uuid() {
return this._uuid();
}
generateDistinctId() {
let t3 = this.cache.get("distinctId");
return t3 || (t3 = this.uuid(), this.cache.set("distinctId", t3)), t3;
}
} {
getProperties() {
var { distinct_id: t3, app_release: e2, platform: r3, realPlatform: i3 } = this;
return Object.assign({ app_release: e2, api_version: Ke, lib_version: qe, distinct_id: t3, platform: r3, realPlatform: i3, customSigningCertificate: "5659eb0ca47811395ef85f0b09be63b7", language: navigator.language, anticache: +Date.now() }, "undefined" == typeof window ? {} : { screen_width: window.screen.width, screen_height: window.screen.height });
}
}(He, e.n(l)()), r2.Zn);
p = e(814);
var Je = e.n(p), We = (l = e(110), e.n(l));
p = new class {
constructor() {
this.verifier = new (Je())(void 0), this.verifier.getKey().setPublic("eaf0631114bc9a4150c475c1e5626ecd9c6ac0aa12cfd84ff6ed6db5c9341e8a7eebf05393ffb8c9d0f2e97062f0ff7cc34f9c33209dceb45cb81d6adeda19fbc26b7e6c8f9b6d2ffd90aae6aa4a63023d7e3f09c1e2584469ddbb96894c0aecf9a6eaea8b6d3d93bab9d4831d7ead3f3adecffc19a9f8b04db361788ccb0f6316545189154c098faa09f0c6e5a82596a7fce18d8ed8fd38683c78e70e7dccb10b818347f61a8a5fa486de08fc71deb125d5ba4a979edb1b7609d7285917ebcd93b853dcde977c972fba37a3925a96cd57c526115672827c564f7bf1053d935af15ec5b5b9d8a38563dd702248edf883c430f2413cf0e237d2769eeb6dbdf329", "10001");
}
verify(t3, e2) {
return this.verifier.verify(t3, e2, We());
}
}();
let Ge = {};
function Ze(t3) {
Ge = t3;
}
const Ye = { freezeOptionNone: "none", freezeOptionUntilLaunch: "untilLaunch" };
let Qe = null;
function Xe(t3) {
return Object.keys(Ye).find(function(e2) {
return Ye[e2] === t3;
});
}
const tr = Ye.freezeOptionNone, er = "roxOverrideValues";
let rr = He.get(er);
function ir(t3) {
He.set(er, JSON.stringify(t3));
}
function nr(t3, e2) {
if (!t3)
throw new Error("Missing name");
rr[t3] = e2, ir(rr);
}
function sr(t3) {
if (!t3)
throw new Error("Missing name");
rr[t3] = void 0, delete rr[t3], ir(rr);
}
function or() {
ir(rr = {});
}
rr = rr ? JSON.parse(rr) : {};
const { fL: ar, Y3: ur } = r2, hr = new (0, i2.B)();
class cr extends Gt {
constructor(t3, e2, { freeze: r3 } = {}, i3 = ur.string) {
if (super(t3, e2, i3), r3 && !Xe(r3))
throw new Error("Freeze option is invalid " + r3);
this._localFreeze = r3, this._lastResultExplanation = {};
}
unfreeze() {
this._frozen = false;
}
setLastResultToExperiment(t3, e2) {
this._lastResultExplanation = { value: t3, from: "experiment", payload: { condition: this.condition, expressionEvaluation: e2 } };
}
setLastResultToDefault(t3) {
this.condition ? this._lastResultExplanation = { value: t3, from: "exception", payload: { condition: this.condition } } : this._lastResultExplanation = { value: t3, from: "default" };
}
setLastResultToFreeze() {
this._lastResultExplanation = { value: this._value, from: "freeze", payload: { freezedBy: "freeze" === this._lastResultExplanation.from ? this._lastResultExplanation.payload.freezedBy : this._lastResultExplanation } };
}
calculateCondition(t3, e2) {
const r3 = { isExperimenting: false, value: null != t3.alternativeDefaultValue ? t3.alternativeDefaultValue : this._defaultValue, usedContext: e2 };
var i3 = [];
if (this.condition) {
var n2 = Ge;
e2 = e2 ? Object.assign({}, n2, e2) : Object.assign({}, n2), r3.usedContext = e2;
let s2 = hr.evaluateExpression(this.condition, t3, e2, i3);
void 0 !== (s2 = s2 && s2.toString ? s2.toString() : s2) && (r3.isExperimenting = true, r3.value = s2);
}
t3.isPeek || (r3.isExperimenting ? this.setLastResultToExperiment(r3.value, i3) : this.setLastResultToDefault(r3.value)), t3.result = r3;
}
getOneTimeValue(t3, e2) {
this.calculateCondition(t3, e2);
}
getFreezedValue(t3) {
t3.isPeek || this.setLastResultToFreeze(), t3.result = { value: this._value, isFreezed: true, isExperimenting: this._isExperimenting };
}
getActiveValue(t3, e2) {
if (this._freeze !== Ye.freezeOptionNone)
return t3.type === ar.frozenOrCalc ? this._frozen ? void this.getFreezedValue(t3) : void this.getOneTimeValue(t3, e2) : t3.type !== ar.oneTimeCalc ? t3.type && t3.type !== ar.default || this._frozen ? void this.getFreezedValue(t3) : (this.calculateCondition(t3, e2), this.setValue(t3.result), this._frozen = true, t3.result.isExperimenting = this._isExperimenting, void (t3.result.value = this._value)) : void this.getOneTimeValue(t3, e2);
this.getOneTimeValue(t3, e2);
}
getInternalValue(t3, e2) {
var r3 = this.overridenValue;
if (r3)
return t3.result = { isExperimenting: true, isOverride: true, usedContext: e2, value: r3 }, void (this._lastResultExplanation = { value: r3, from: "override" });
this.getActiveValue(t3, e2);
}
getValue(t3) {
var e2 = { result: void 0, isOverride: void 0 };
return this.getInternalValue(e2, t3), e2.result.isFreezed || e2.isOverride || this._flagImpression(e2.result.value, t3), e2.result.value;
}
setValue(t3) {
this._frozen || (this._isExperimenting = t3.isExperimenting, this._value = t3.value);
}
explainLastResult() {
return this._lastResultExplanation;
}
peek(t3) {
var e2 = { isPeek: true, type: ar.oneTimeCalc, result: void 0 };
return this.getInternalValue(e2, t3), e2.result.value;
}
get _freeze() {
return this._localFreeze || Qe || tr;
}
get overrider() {
return s;
}
}
const { Y3: lr, WB: pr } = r2;
class fr extends cr {
constructor(t3, e2, r3) {
super(t3, e2, r3, lr.number);
}
getValue(t3) {
var e2 = {};
this.getInternalValue(e2, t3);
const r3 = pr._normalizeNumber(e2.result.value);
return e2.result.isOverride || e2.result.isFreezed || this._flagImpression(r3.toString(), e2.result.usedContext), r3;
}
}
class dr extends cr {
constructor(t3 = false, e2) {
super(t3, [false, true], e2, Wt.boolean);
}
isEnabled(t3) {
var e2 = { result: void 0 };
this.getInternalValue(e2, t3);
const r3 = Gt._normalizeBoolean(e2.result.value);
return e2.result.isOverride || e2.result.isFreezed || this._flagImpression(r3.toString(), e2.result.usedContext), r3;
}
}
l = new class {
createFlag(t3) {
return new dr(t3);
}
createString(t3, e2) {
return new cr(t3, e2);
}
createNumber(t3, e2) {
return new fr(t3, e2);
}
}(), i2 = { DeviceProperties: f, getDefaultCustomProperties: function(t3, e2) {
return t3 = t3.getProperties(), [new $e("rox.app_release", $e.semverTypeName, t3.app_release), new $e("rox.platform", String, t3.platform), new $e("rox.screen_width", Number, t3.screen_width), new $e("rox.screen_height", Number, t3.screen_height), new $e("rox.language", String, t3.language), new $e("rox.distinct_id", String, t3.distinct_id), new $e("rox.internal.realPlatform", String, "Browser"), new $e("rox.internal.customPlatform", String, t3.platform), new $e("rox.internal.appKey", String, e2), new $e("rox.internal.distinct_id", String, t3.distinct_id), new $e("rox.now", Date, () => new Date())];
}, DefaultSetupOptions: { distinctId: null, version: "0", configurationFetchedHandler: function() {
}, impressionHandler: null, devModeSecret: null, platform: "Browser", analytics: { flushAt: 20, flushInterval: 1e3 } }, RoxCache: He, RoxCrypto: p, EntitiesProvider: l }, Ue = Object.assign({}, Ue, i2), ze._dynamicApi = new class {
constructor(t3, e2, r3) {
this.entityProvider = t3, this.flagRepository = e2, this.client = r3;
}
genericValue(t3, e2, r3, i3, n2 = Wt.string, s2 = this.entityProvider.createString, o2 = Gt._normalizeString) {
if ("string" != typeof t3)
throw new Error("DynamicApi error - name must be a string");
if (typeof e2 !== n2)
throw new Error(`DynamicApi default value must be of ${n2} type. Received '${e2}'`);
let a2 = this.flagRepository.flagWithName(t3);
a2 || (a2 = s2(e2, r3), this.flagRepository.addFlag(t3, a2), this.client.sendStateDebounced()), n2 = { alternativeDefaultValue: e2.toString() }, a2.getInternalValue(n2, i3);
const u2 = o2(n2.result.value);
return n2.result.isFreezed || n2.result.isOverride || a2._flagImpression(u2.toString(), n2.result.usedContext), u2;
}
isEnabled(t3, e2, r3) {
return this.genericValue(t3, e2, null, r3, Wt.boolean, this.entityProvider.createFlag, Gt._normalizeBoolean);
}
value(t3, e2, r3, i3) {
return Array.isArray(r3) || (i3 = r3, r3 = null), this.genericValue(t3, e2, r3, i3);
}
getNumber(t3, e2, r3, i3) {
return Array.isArray(r3) || (i3 = r3, r3 = null), this.genericValue(t3, e2, r3, i3, Wt.number, this.entityProvider.createNumber, Gt._normalizeNumber);
}
}(i2.EntitiesProvider, $, ze);
const gr = ze;
function mr(...t3) {
const e2 = t3;
return function(t4) {
for (let r3 = e2.length - 1; -1 < r3; r3--)
t4 = e2[r3].call(this, t4);
return t4;
};
}
const yr = (t3 = {}) => Object.keys(t3).map((e2) => e2 + ": " + t3[e2]).join(";"), vr = (t3) => (e2) => (e2.setAttribute("class", t3), e2), br = (t3, e2, r3) => (t3.addEventListener(e2, r3), t3), _r = (t3, e2) => br(t3, "click", e2);
let xr, wr, Sr, Or, Tr, Er;
xr = wr = Sr = Or = Tr, Er = () => {
}, "undefined" != typeof window && "undefined" != typeof document && (xr = (t3, e2 = []) => e2.reduce((t4, e3) => (!e3 || t4.appendChild(e3)) && t4, t3), wr = (t3 = "div", e2 = "") => {
const r3 = document.createElement(t3);
return r3.textContent = e2, r3;
}, Sr = (t3 = "div", e2 = {}) => {
const r3 = document.createElement(t3);
return Object.keys(e2).forEach((t4) => r3.setAttribute(t4, e2[t4])), r3;
}, Or = (t3 = "div", e2 = []) => xr(document.createElement(t3), e2), Tr = wr.bind(document, "div"), Er = (t3 = []) => Or("div", t3));
const Nr = o.iI;
let Pr, Ar, Dr, Rr;
const Cr = "Original", kr = "bottom right", Ir = { "top left": { top: 0, left: 0 }, "top right": { top: 0, right: 0 }, "bottom left": { bottom: 0, left: 0 }, "bottom right": { bottom: 0, right: 0 } }, Fr = { background: "inherit", "z-index": 999999, position: "fixed", width: "400px", height: "600px", overflow: "auto" }, Mr = ({ value: t3, text: e2, selected: r3 }) => {
const i3 = document.createElement("option");
return r3 && i3.setAttribute("selected", true), i3.setAttribute("value", t3), i3.textContent = e2, i3;
}, jr = ({ originalValue: t3, overridingValue: e2, option: r3 }) => e2 ? e2 === r3 : t3 === r3, Br = (t3) => {
if (t3.type === Wt.boolean)
return [{ options: e2, originalValue: n2, overridingValue: s2 } = { options: [] }] = [t3], e2.map((t4) => ({ text: t4 === n2 ? Cr + ` (${t4})` : t4, value: t4, selected: jr({ originalValue: n2, overridingValue: s2, option: t4 }) }));
{
var [{ options: e2, originalValue: r3, overridingValue: i3 } = { options: [] }] = [t3];
const n3 = e2.map((t4) => ({ text: t4 === r3 ? Cr + ` (${t4})` : t4, value: t4, selected: jr({ originalValue: r3, overridingValue: i3, option: t4 }) }));
return n3.find((t4) => t4.value === i3) || "string" == typeof i3 && n3.push({ text: i3, value: i3, selected: jr({ originalValue: r3, overridingValue: i3, option: i3 }) }), n3.find((t4) => t4.value === r3) || "string" == typeof r3 && n3.push({ text: Cr + ` (${r3})`, value: r3, selected: jr({ originalValue: r3, overridingValue: i3, option: r3 }) }), n3.push({ text: "Add New Value...", value: "freeText" }), n3;
}
var n2, s2;
}, Vr = (t3) => ((t4, e2 = "") => (t4.setAttribute("style", e2), t4))(t3, yr(Fr) + ";" + yr(Ir[Ar])), Ur = ({ name: t3, originalValue: e2, overridingValue: r3 }) => Er([Tr(t3), r3 ? mr(vr("roxFlagSub"), Tr)("Original value: " + e2) : void 0]), zr = (t3) => {
var { name: e2, nameDetails: r3, originalValue: i3, overridingValue: n2 } = t3;
return mr(vr("roxPushAside roxFlag"), Er)([Ur({ name: r3.name, originalValue: i3, overridingValue: n2 }), Kr(e2, i3, Br(t3))]);
}, Lr = ({ target: t3, keyCode: e2 }) => {
Dr = 27 === e2 ? (t3.value = "", null) : t3.value, $r();
}, Hr = () => (or(), $r()), Kr = (t3, e2, r3 = []) => ((t4, e3) => br(t4, "change", e3))(Or("select", r3.map(Mr)), ((t4, e3) => (r4) => {
var i3 = "freeText" === (i3 = r4.target.value) ? prompt("Please enter a custom value", "value") : i3;
r4.preventDefault(), e3 === i3 ? sr(t4) : nr(t4, i3), $r();
})(t3, e2)), qr = () => mr(vr("roxFlags"), Er)(((t3) => Object.keys(t3).map(((t4, e2) => Er([mr(vr("roxNamespace"), Tr)(e2), mr(vr("roxFlagsList"), Er)(t4[e2].map(zr))])).bind(null, t3)))(Nr.items.map((t3) => t3.dump()).filter((t3) => !Dr || -1 !== t3.name.toLowerCase().indexOf(Dr.toLowerCase())).reduce((t3, e2) => (t3[e2.nameDetails.namespace] || (t3[e2.nameDetails.namespace] = []), t3[e2.nameDetails.namespace].push(e2), t3), {})));
function $r() {
Pr.removeChild(Rr), Rr = qr(), Pr.appendChild(Rr);
}
function Jr(t3 = kr) {
if (!Pr) {
-1 === Object.keys(Ir).indexOf(t3) && (t3 = kr), Ar = t3, Rr = qr(), Pr = mr(vr("roxDbg"), Vr, Er)([Er([mr(vr("roxPushAside roxTitle"), Er)([wr("span", "ROX Overrides"), _r(wr("a", "\u2573"), Wr)]), mr(vr("roxSearch roxPushAside"), Er)([(t3 = Sr("input", { placeholder: "Search Flags" }), e2 = Lr, br(t3, "keyup", e2)), _r(wr("a", "Reset All Overrides"), Hr)])]), Rr]);
const r3 = document.getElementsByTagName("body")[0];
r3.appendChild(Sr("link", { href: "https://fonts.googleapis.com/css?family=Lato", rel: "stylesheet" })), r3.appendChild(Sr("link", { href: "https://connect.rollout.io/rox.browser.css", rel: "stylesheet" })), r3.appendChild(Pr), $r();
}
var e2;
}
function Wr() {
document.getElementsByTagName("body")[0].removeChild(Pr), Pr = void 0;
}
const Gr = new class {
constructor() {
this.RoxString = cr, this.RoxNumber = fr, this.setContext = Ze, this.Flag = dr, this.showOverrides = Jr, this.overrides = s;
}
setup(t3, e2 = {}) {
if (c.setVerboseMode(e2.debugLevel), e2.proxy && function(t4) {
M = new I(t4);
}(e2.proxy), e2.freeze) {
var r3 = e2.freeze;
if (!Xe(r3))
throw new Error("Invalid freeze option: " + r3);
Qe = r3;
}
return gr.setKey(t3, e2), e2.configuration ? function(t4) {
B = Object.assign({}, t4);
}(e2.configuration) : e2.hosting && z(e2.hosting), gr.setup(e2), gr.sendState(), e2.disableNetworkFetch ? gr.fetchCacheOnly() : gr.fetchWithCacheAndProceed();
}
fetch() {
gr && gr.fetch();
}
setCustomStringProperty(t3, e2) {
gr.setCustomProperty(t3, String, e2);
}
setCustomDateProperty(t3, e2) {
gr.setCustomProperty(t3, Date, e2);
}
setCustomNumberProperty(t3, e2) {
gr.setCustomProperty(t3, Number, e2);
}
setCustomBooleanProperty(t3, e2) {
gr.setCustomProperty(t3, Boolean, e2);
}
setCustomSemverProperty(t3, e2) {
gr.setSemverCustomProperty(t3, e2);
}
register(t3, e2) {
gr.register(t3, e2);
}
unfreeze(t3) {
gr.unfreeze(t3);
}
get flags() {
return $.flags;
}
get dynamicApi() {
return gr.dynamicApi;
}
setUserspaceUnhandledErrorHandler(t3) {
gr.setUserspaceUnhandledErrorHandler(t3);
}
}();
})(), n.default;
function e(t2) {
var n2 = i[t2];
return void 0 === n2 && (n2 = i[t2] = { exports: {} }, r[t2].call(n2.exports, n2, n2.exports, e)), n2.exports;
}
var r, i, n;
});
}
});
// node_modules/@openfeature/js-sdk/dist/esm/index.js
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp2.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
var LOG_LEVELS = ["error", "warn", "info", "debug"];
var DefaultLogger = class {
error(...args) {
console.error(...args);
}
warn(...args) {
console.warn(...args);
}
info() {
}
debug() {
}
};
var SafeLogger = class {
constructor(logger) {
this.fallbackLogger = new DefaultLogger();
try {
for (const level of LOG_LEVELS) {
if (!logger[level] || typeof logger[level] !== "function") {
throw new Error(`The provided logger is missing the ${level} method.`);
}
}
this.logger = logger;
} catch (err) {
console.error(err);
console.error("Falling back to the default logger.");
this.logger = this.fallbackLogger;
}
}
error(...args) {
this.log("error", ...args);
}
warn(...args) {
this.log("warn", ...args);
}
info(...args) {
this.log("info", ...args);
}
debug(...args) {
this.log("debug", ...args);
}
log(level, ...args) {
try {
this.logger[level](...args);
} catch (error) {
this.fallbackLogger[level](...args);
}
}
};
var StandardResolutionReasons = {
TARGETING_MATCH: "TARGETING_MATCH",
SPLIT: "SPLIT",
DISABLED: "DISABLED",
DEFAULT: "DEFAULT",
UNKNOWN: "UNKNOWN",
ERROR: "ERROR"
};
var OpenFeatureClient = class {
constructor(providerAccessor, globalLogger, options, context = {}) {
this.providerAccessor = providerAccessor;
this.globalLogger = globalLogger;
this._hooks = [];
this.metadata = {
name: options.name,
version: options.version
};
this._context = context;
}
setLogger(logger) {
this._clientLogger = new SafeLogger(logger);
return this;
}
setContext(context) {
this._context = context;
return this;
}
getContext() {
return this._context;
}
addHooks(...hooks) {
this._hooks = [...this._hooks, ...hooks];
return this;
}
getHooks() {
return this._hooks;
}
clearHooks() {
this._hooks = [];
return this;
}
getBooleanValue(flagKey, defaultValue, context, options) {
return __async(this, null, function* () {
return (yield this.getBooleanDetails(flagKey, defaultValue, context, options)).value;
});
}
getBooleanDetails(flagKey, defaultValue, context, options) {
return this.evaluate(
flagKey,
this._provider.resolveBooleanEvaluation,
defaultValue,
"boolean",
context,
options
);
}
getStringValue(flagKey, defaultValue, context, options) {
return __async(this, null, function* () {
return (yield this.getStringDetails(flagKey, defaultValue, context, options)).value;
});
}
getStringDetails(flagKey, defaultValue, context, options) {
return this.evaluate(
flagKey,
this._provider.resolveStringEvaluation,
defaultValue,
"string",
context,
options
);
}
getNumberValue(flagKey, defaultValue, context, options) {
return __async(this, null, function* () {
return (yield this.getNumberDetails(flagKey, defaultValue, context, options)).value;
});
}
getNumberDetails(flagKey, defaultValue, context, options) {
return this.evaluate(
flagKey,
this._provider.resolveNumberEvaluation,
defaultValue,
"number",
context,
options
);
}
getObjectValue(flagKey, defaultValue, context, options) {
return __async(this, null, function* () {
return (yield this.getObjectDetails(flagKey, defaultValue, context, options)).value;
});
}
getObjectDetails(flagKey, defaultValue, context, options) {
return this.evaluate(flagKey, this._provider.resolveObjectEvaluation, defaultValue, "object", context, options);
}
evaluate(_0, _1, _2, _3) {
return __async(this, arguments, function* (flagKey, resolver, defaultValue, flagType, invocationContext = {}, options = {}) {
const allHooks = [
...OpenFeature.getHooks(),
...this.getHooks(),
...options.hooks || [],
...this._provider.hooks || []
];
const allHooksReversed = [...allHooks].reverse();
const mergedContext = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, OpenFeature.getContext()), OpenFeature.getTransactionContext()), this._context), invocationContext);
const hookContext = {
flagKey,
defaultValue,
flagValueType: flagType,
clientMetadata: this.metadata,
providerMetadata: OpenFeature.providerMetadata,
context: mergedContext,
logger: this._logger
};
try {
const frozenContext = yield this.beforeHooks(allHooks, hookContext, options);
const resolution = yield resolver.call(this._provider, flagKey, defaultValue, frozenContext, this._logger);
const evaluationDetails = __spreadProps(__spreadValues({}, resolution), {
flagKey
});
yield this.afterHooks(allHooksReversed, hookContext, evaluationDetails, options);
return evaluationDetails;
} catch (err) {
const errorMessage = err == null ? void 0 : err.message;
const errorCode = (err == null ? void 0 : err.code) || "GENERAL";
yield this.errorHooks(allHooksReversed, hookContext, err, options);
return {
errorCode,
errorMessage,
value: defaultValue,
reason: StandardResolutionReasons.ERROR,
flagKey
};
} finally {
yield this.finallyHooks(allHooksReversed, hookContext, options);
}
});
}
beforeHooks(hooks, hookContext, options) {
return __async(this, null, function* () {
var _a;
for (const hook of hooks) {
Object.freeze(hookContext);
Object.assign(hookContext.context, __spreadValues(__spreadValues({}, hookContext.context), yield (_a = hook == null ? void 0 : hook.before) == null ? void 0 : _a.call(hook, hookContext, Object.freeze(options.hookHints))));
}
return Object.freeze(hookContext.context);
});
}
afterHooks(hooks, hookContext, evaluationDetails, options) {
return __async(this, null, function* () {
var _a;
for (const hook of hooks) {
yield (_a = hook == null ? void 0 : hook.after) == null ? void 0 : _a.call(hook, hookContext, evaluationDetails, options.hookHints);
}
});
}
errorHooks(hooks, hookContext, err, options) {
return __async(this, null, function* () {
var _a;
for (const hook of hooks) {
try {
yield (_a = hook == null ? void 0 : hook.error) == null ? void 0 : _a.call(hook, hookContext, err, options.hookHints);
} catch (err2) {
this._logger.error(`Unhandled error during 'error' hook: ${err2}`);
if (err2 instanceof Error) {
this._logger.error(err2.stack);
}
this._logger.error(err2 == null ? void 0 : err2.stack);
}
}
});
}
finallyHooks(hooks, hookContext, options) {
return __async(this, null, function* () {
var _a;
for (const hook of hooks) {
try {
yield (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, options.hookHints);
} catch (err) {
this._logger.error(`Unhandled error during 'finally' hook: ${err}`);
if (err instanceof Error) {
this._logger.error(err.stack);
}
this._logger.error(err == null ? void 0 : err.stack);
}
}
});
}
get _provider() {
return this.providerAccessor();
}
get _logger() {
return this._clientLogger || this.globalLogger();
}
};
var REASON_NO_OP = "No-op";
var NoopFeatureProvider = class {
constructor() {
this.metadata = {
name: "No-op Provider"
};
}
resolveBooleanEvaluation(_, defaultValue) {
return this.noOp(defaultValue);
}
resolveStringEvaluation(_, defaultValue) {
return this.noOp(defaultValue);
}
resolveNumberEvaluation(_, defaultValue) {
return this.noOp(defaultValue);
}
resolveObjectEvaluation(_, defaultValue) {
return this.noOp(defaultValue);
}
noOp(defaultValue) {
return Promise.resolve({
value: defaultValue,
reason: REASON_NO_OP
});
}
};
var NOOP_PROVIDER = new NoopFeatureProvider();
var NoopTransactionContextPropagator = class {
getTransactionContext() {
return {};
}
setTransactionContext(_, callback) {
callback();
}
};
var NOOP_TRANSACTION_CONTEXT_PROPAGATOR = new NoopTransactionContextPropagator();
var GLOBAL_OPENFEATURE_API_KEY = Symbol.for("@openfeature/js.api");
var _globalThis = globalThis;
var OpenFeatureAPI = class {
constructor() {
this._provider = NOOP_PROVIDER;
this._transactionContextPropagator = NOOP_TRANSACTION_CONTEXT_PROPAGATOR;
this._context = {};
this._hooks = [];
this._logger = new DefaultLogger();
}
static getInstance() {
const globalApi = _globalThis[GLOBAL_OPENFEATURE_API_KEY];
if (globalApi) {
return globalApi;
}
const instance = new OpenFeatureAPI();
_globalThis[GLOBAL_OPENFEATURE_API_KEY] = instance;
return instance;
}
setLogger(logger) {
this._logger = new SafeLogger(logger);
return this;
}
getClient(name, version, context) {
return new OpenFeatureClient(
() => this._provider,
() => this._logger,
{ name, version },
context
);
}
get providerMetadata() {
return this._provider.metadata;
}
addHooks(...hooks) {
this._hooks = [...this._hooks, ...hooks];
return this;
}
getHooks() {
return this._hooks;
}
clearHooks() {
this._hooks = [];
return this;
}
setProvider(provider) {
this._provider = provider;
return this;
}
setContext(context) {
this._context = context;
return this;
}
getContext() {
return this._context;
}
setTransactionContextPropagator(transactionContextPropagator) {
const baseMessage = "Invalid TransactionContextPropagator, will not be set: ";
if (typeof (transactionContextPropagator == null ? void 0 : transactionContextPropagator.getTransactionContext) !== "function") {
this._logger.error(`${baseMessage}: getTransactionContext is not a function.`);
} else if (typeof (transactionContextPropagator == null ? void 0 : transactionContextPropagator.setTransactionContext) !== "function") {
this._logger.error(`${baseMessage}: setTransactionContext is not a function.`);
} else {
this._transactionContextPropagator = transactionContextPropagator;
}
return this;
}
setTransactionContext(transactionContext, callback, ...args) {
this._transactionContextPropagator.setTransactionContext(transactionContext, callback, ...args);
}
getTransactionContext() {
try {
return this._transactionContextPropagator.getTransactionContext();
} catch (err) {
const error = err;
this._logger.error(`Error getting transaction context: ${error == null ? void 0 : error.message}, returning empty context.`);
this._logger.error(error == null ? void 0 : error.stack);
return {};
}
}
};
var OpenFeature = OpenFeatureAPI.getInstance();
var OpenFeatureError = class extends Error {
constructor(message) {
super(message);
Object.setPrototypeOf(this, OpenFeatureError.prototype);
this.name = "OpenFeatureError";
}
};
var InvalidContextError = class extends OpenFeatureError {
constructor(message) {
super(message);
Object.setPrototypeOf(this, InvalidContextError.prototype);
this.name = "InvalidContextError";
this.code = "INVALID_CONTEXT";
}
};
// src/provider.ts
var import_rox_browser = __toESM(require_rox_browser_min());
var CloudbeesProvider = class {
constructor() {
this.metadata = {
name: "CloudBees Feature Management Provider"
};
}
static async build(appKey, options = {}) {
await import_rox_browser.default.setup(appKey, options);
return new CloudbeesProvider();
}
resolveBooleanEvaluation(flagKey, defaultValue, context) {
return Promise.resolve({ value: import_rox_browser.default.dynamicApi.isEnabled(flagKey, defaultValue, context) });
}
resolveStringEvaluation(flagKey, defaultValue, context) {
return Promise.resolve({ value: import_rox_browser.default.dynamicApi.value(flagKey, defaultValue, context) });
}
resolveNumberEvaluation(flagKey, defaultValue, context) {
return Promise.resolve({ value: import_rox_browser.default.dynamicApi.getNumber(flagKey, defaultValue, context) });
}
resolveObjectEvaluation(flagKey, defaultValue, context) {
return Promise.reject(new InvalidContextError("Not implemented - CloudBees feature management does not support an object type. Only String, Number and Boolean"));
}
};
export {
CloudbeesProvider
};
/*! Axios v1.9.0 Copyright (c) 2025 Matt Zabriskie and contributors */
//# sourceMappingURL=index.js.map