ljs-tools
Version:
ljs-tools和常用插件
1,470 lines • 378 kB
JavaScript
var io = Object.defineProperty;
var oo = (e, r, n) => r in e ? io(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
var Ft = (e, r, n) => (oo(e, typeof r != "symbol" ? r + "" : r, n), n);
import { getCurrentInstance as He, inject as Ee, ref as ie, computed as H, unref as R, shallowRef as Mt, watchEffect as ya, readonly as so, getCurrentScope as lo, onScopeDispose as ba, onMounted as qe, nextTick as Ce, watch as Be, isRef as _a, warn as co, provide as bn, defineComponent as se, openBlock as L, createElementBlock as V, mergeProps as zt, renderSlot as he, createElementVNode as Y, toRef as n0, onUnmounted as uo, useAttrs as fo, useSlots as Ca, normalizeClass as K, normalizeStyle as ve, createCommentVNode as Q, Fragment as Le, createBlock as ne, withCtx as oe, resolveDynamicComponent as Se, withModifiers as It, createVNode as xe, toDisplayString as le, onBeforeUnmount as Ht, Text as xo, reactive as Ea, h as vo, markRaw as r0, toRefs as po, resolveComponent as Fe, Transition as _n, withDirectives as b0, withKeys as Wt, createTextVNode as Jt, vShow as _0, isVNode as Ba, render as Da, Teleport as Aa, renderList as x0, pushScopeId as Cn, popScopeId as En } from "vue";
const ho = () => {
re.colorLog({ content: ["", "******************************************"] }), re.colorLog({ content: ["Core Dependencies:", "ljs-tools"] }), re.colorLog({ content: ["Author:", "LJS"] }), re.colorLog({ content: ["API", "https://ljs-y.github.io/ljs-vue3"], color: [
"background: #666666; color: #fff; border-radius: 4px 0 0 4px; padding: 3px 6px;",
"background: #FFF; border: 1px solid #666666; color: #fff; border-radius: 0 4px 4px 0; padding: 2px 6px;"
] }), re.colorLog({ content: ["", "******************************************"] });
};
function mo(e) {
return e == null || e === "";
}
function wa({ data: e, value: r, key: n = "id", children: t = "children", parents: a = [] }) {
const i = e.length;
for (let o = 0; o < i; o++)
if (e[o][n] === r || e[o][t] !== void 0 && (a = wa({
data: e[o][t],
value: r,
key: n,
children: t,
parents: a
}), a.length > 0 && a[a.length - 1][n] === r))
return a.unshift(e[o]), a;
return a;
}
function fn({ data: e, opts: r = [], disabled: n = !1 }) {
if (!e)
return;
const t = e.length;
for (let a = 0; a < t; a++) {
e[a].disabled = n;
let i = !1;
const o = r.length;
for (let s = 0; s < o; s++) {
const c = r[s];
if (e[a][c.key] === c.value) {
i = !0;
break;
}
}
i ? (e[a].disabled = !0, e[a].children = fn({ data: e[a].children, opts: r, disabled: !0 })) : e[a].children !== void 0 && (e[a].children = fn({ data: e[a].children, opts: r, disabled: n }));
}
return e;
}
function go(e) {
let r = [];
if (!e || !e.length)
return [];
for (let n = 0; n < e.length; n++) {
let t = e[n], a = JSON.parse(JSON.stringify(t));
a.children = void 0, r.push(a);
const i = this.handleTreeList(t.children);
r = r.concat(i);
}
return r;
}
function yo({ data: e, id: r = "id", parentId: n = "parentId", children: t = "children" }) {
let a = { id: r, parentId: n, childrenList: t };
var i = {}, o = {}, s = [];
for (let l of e) {
let u = l[a.parentId];
i[u] == null && (i[u] = []), o[l[a.id]] = l, i[u].push(l);
}
for (let l of e) {
let u = l[a.parentId];
o[u] == null && s.push(l);
}
for (let l of s)
c(l);
function c(l) {
if (i[l[a.id]] !== null && (l[a.childrenList] = i[l[a.id]]), l[a.childrenList])
for (let u of l[a.childrenList])
c(u);
}
return s;
}
function bo(e = 120) {
var r = document.documentElement, n = r.clientWidth / e;
r.style.fontSize = n + "px";
}
function _o({ data: e, value: r, labelKey: n = "dictLabel", valueKey: t = "dictValue", isTrue: a = !1 }) {
if (r === void 0)
return "";
let i = [];
return Object.keys(e).some((o, s) => {
if (e[o][t] == "" + r)
return n === "$index" ? (i = s, s) : (i.push(e[o][n]), !0);
}), n === "$index" ? i : (i.length === 0 && i.push(r), a ? i[0] : i.join(""));
}
function Co({ content: e = ["暂无内容"], type: r = "info", color: n = [
"background: #666666; color: #fff; border-radius: 4px 0 0 4px; padding: 3px 6px;",
"background: #1475B2; color: #fff; border-radius: 0 4px 4px 0; padding: 3px 6px;"
] }) {
let t = "";
e.forEach((a) => {
t += `%c${a}`;
}), console[r](t, n[0], n[1]);
}
function Eo({ _this: e, url: r, name: n = (/* @__PURE__ */ new Date()).valueOf() }) {
let t = new Image();
t.setAttribute("crossOrigin", "anonymous"), t.src = r + "?time=" + (/* @__PURE__ */ new Date()).valueOf(), e.$nextTick(() => {
t.onload = () => {
const a = document.createElement("canvas");
a.width = t.width, a.height = t.height, a.getContext("2d").drawImage(t, 0, 0, t.width, t.height), a.toBlob((o) => {
const s = URL.createObjectURL(o), c = document.createElement("a");
c.download = n, c.href = s, c.click(), c.remove(), URL.revokeObjectURL(s);
});
};
});
}
function Bo(e) {
return e instanceof Blob || e instanceof File ? new Promise((r, n) => {
const t = new FileReader();
t.onloadend = () => r(t.result);
try {
t.readAsDataURL(e);
} catch (a) {
n(a);
}
}) : "";
}
function Do() {
var e = 0, r = window.screen, n = navigator.userAgent.toLowerCase();
return window.devicePixelRatio !== void 0 ? e = window.devicePixelRatio : ~n.indexOf("msie") ? r.deviceXDPI && r.logicalXDPI && (e = r.deviceXDPI / r.logicalXDPI) : window.outerWidth !== void 0 && window.innerWidth !== void 0 && (e = window.outerWidth / window.innerWidth), e && (e = Math.round(e * 100)), e;
}
function a0(e) {
let r = Array.isArray(e) ? [] : {};
for (let n in e)
e.hasOwnProperty(n) && (typeof e[n] == "object" && e[n] !== null ? r[n] = a0(e[n]) : r[n] = e[n]);
return r;
}
function Ao(e, r) {
if (typeof e != "object" || typeof r != "object")
return r;
const n = a0(e), t = a0(r);
for (let a in n)
t[a] = n[a];
return t;
}
const re = {
fieldCheck: mo,
deepCopy: a0,
getTreeParents: wa,
editTreeParentIdCheck: fn,
handleTreeList: go,
handleListTree: yo,
setRemUnit: bo,
selectDictLabel: _o,
colorLog: Co,
downloadImage: Eo,
imageFileToBase64: Bo,
getWindowRatio: Do,
objectCopy: Ao
};
ho();
function wo(e) {
const r = e.getters.menuList, n = Sa({ menuList: r }), t = Fa({ data: r, value: n.url });
n.address = t, e.commit("SET_menuNowOpen", n), e.commit("SET_menuOpenList", [n]);
}
function Fa({ data: e, value: r, key: n = "url" }) {
const t = re.getTreeParents({ data: e, value: r, key: n }), a = [];
return t.forEach((i) => {
const o = {
title: i.title,
// 菜单名称
url: i.url
// 菜单路由path
};
a.push(o);
}), a;
}
function Sa({ menuList: e }) {
if (e.length === 0)
return {};
let r = {};
return e.forEach((n, t) => {
t === 0 && (!re.fieldCheck(n.children) && n.children.length > 0 ? (n.open = !0, r = Sa({ menuList: n.children })) : r = n);
}), r;
}
function Fo({ store: e, path: r }) {
const n = e.getters.menuList, t = re.handleTreeList(n), a = t.length;
for (let i = 0; i < a; i++) {
const o = t[i];
if (o.url === r)
return o;
}
}
function So({ store: e, run: r, path: n, query: t = {} }) {
const a = Fo({ store: e, path: n });
ka({ store: e, run: r, menuObj: a, query: t });
}
function ka({ store: e, run: r, menuObj: n, query: t }) {
let a = e.getters.menuList;
if (re.fieldCheck(n.children) && (n.children = []), n.children.length > 0) {
if (n.open)
n.open = !n.open;
else {
const i = re.getTreeParents({
data: a,
value: n.menuId,
key: "menuId"
});
Bn({ menuList: a, parents: i });
}
e.commit("SET_menuList", a);
} else {
const i = e.getters.menuNowOpen;
let o = e.getters.menuOpenList;
if (i.url === n.url)
return;
n.address = Fa({ data: e.getters.menuList, value: n.url });
let s = n;
n.choose = !n.choose, e.commit("SET_menuNowOpen", s);
const c = o.length;
let l = !1;
for (let u = 0; u < c; u++)
if (o[u].url === n.url) {
l = !0;
break;
}
l || (o = e.getters.menuOpenList, o.push(s), e.commit("SET_menuOpenList", o)), r.push({
path: n.url,
query: t
});
}
}
function Bn({ menuList: e, parents: r, key: n = "menuId" }) {
return e.forEach((t) => {
t[n] === r[0][n] ? (t.open = !0, r.length > 1 && r.splice(0, 1)) : t.open = !1, t.children && t.children.length > 0 && (t.children = Bn({ menuList: t.children, parents: r, key: n }));
}), e;
}
const Ta = {
fristOpenMenu: wo,
handPush: So,
menuControl: ka,
updateTreeOpen: Bn
}, Zt = 1e-14;
function ko(e, r = 2, n = "0") {
if (Nt(e)) {
e = e.toString();
const t = e.length, a = r - t;
let i = "";
for (let o = 0; o < a; o++)
i += n;
return i + e;
}
return e;
}
function To(e, r = 4, n = ",") {
if (Nt(e)) {
e += "";
var t = e.split("."), a = t[0], i = t.length > 1 ? "." + t[1] : "";
const o = new RegExp("(\\d+)(\\d{" + r + "})");
for (; o.test(a); )
a = a.replace(o, "$1" + n + "$2");
return a + i;
}
return e;
}
function Io(e) {
if (Nt(e)) {
e = Math.ceil(e);
const r = (e + "").length, n = Math.pow(10, r - 1);
return Math.ceil(e / n) * n;
}
return e;
}
function Po({
value: e,
ws: r = 0,
units: n = ["", "万", "亿万", "万亿"],
isMerge: t = !0
}) {
if (Nt(e)) {
let a = "";
const i = Number(e) < 0 ? -1 : 1, o = Math.abs(Number(e));
let s = 0;
if (o < 1e4)
a = i * o, s = 0;
else if (o >= 1e4 && o < 1e4 * 1e4) {
let c = o / 1e4 + Zt;
c = Number(c.toFixed(r)), c < 1e4 ? (a = i * c, s = 1) : (a = i * c / 1e4, s = 2);
} else if (o >= 1e4 * 1e4 && o < 1e4 * 1e4 * 1e4) {
let c = o / 1e8 + Zt;
c = Number(c.toFixed(r)), c < 1e4 ? (a = i * c, s = 2) : (a = i * c / 1e4, s = 3);
} else
o >= 1e4 * 1e4 * 1e4 && (a = i * (o / (1e4 * 1e4 * 1e4) + Zt).toFixed(r), s = 3);
return t ? a + n[s] : {
num: a,
unit: n[s]
};
}
return e;
}
function Ia(e, r = 2) {
return Nt(e) && (e = e + "", e.indexOf(".") > -1 && e.split(".")[1].length > r) ? (e = Number(e), (e + Zt).toFixed(r)) : e;
}
function Nt(e) {
const r = typeof e;
return r === "number" || r === "string" && !isNaN(Number(e, 10));
}
function Mo(e, r = 12, n = 2) {
e = Number(e);
const t = (e / r).toFixed(n), a = [];
for (let i = 0; i < r; i++)
i < r - 1 ? a.push(t) : a.push(Ia(e - t * (r - 1), n));
return a;
}
const te = {
numberB0: ko,
longNumText: Po,
numberCeil: Io,
moneySplit: To,
numberChangeDecimal: Ia,
averageNum: Mo
};
function Me(e, r) {
if (re.fieldCheck(e))
return e;
const n = new Date(e), t = r || "{y}-{m}-{d} {h}:{i}:{s}", a = {
y: n.getFullYear(),
m: te.numberB0(n.getMonth() + 1),
d: te.numberB0(n.getDate()),
h: te.numberB0(n.getHours()),
i: te.numberB0(n.getMinutes()),
s: te.numberB0(n.getSeconds()),
MS: n.getMilliseconds()
};
return t.replace(/{(y|m|d|h|i|s|MS)+}/g, (i, o) => a[o]);
}
function Ro(e, r, n = 0) {
if (re.fieldCheck(e))
return e;
if (n === 0) {
let t = new Date(e).getTime();
return Me(t, r);
}
if (r === "{y}-{m}-{d}") {
let t = new Date(e).getTime();
return t = t + 3600 * 1e3 * 24 * n, Me(t, r);
} else if (r === "{y}-{m}") {
const t = n / Math.abs(n);
let a = new Date(e), i = "";
const o = a.getMonth() + 1;
let s = 0, c = 0;
if (t === -1)
s = a.getFullYear() + Math.floor((o + n) / 12), c = 12 * Math.abs(s - a.getFullYear()) + o + n, (o + n) % 12 === 0 && (s += t, c = 12);
else if (t === 1)
if (o + n <= 12)
s = a.getFullYear(), c = o + n;
else if ((o + n) % 12 !== 0)
s = a.getFullYear() + Math.floor((o + n) / 12), c = o + n - Math.abs(s - a.getFullYear()) * 12;
else {
const l = (o + n) / 12;
s = a.getFullYear() + (l > 1 ? l - 1 : l), c = o + n - Math.abs(s - a.getFullYear()) * 12;
}
return i = s + "-" + te.numberB0(c), i;
} else if (r === "{y}")
return (new Date(e).getFullYear() + n).toString();
}
function zo(e, r = 1) {
if (e[0] === "" || e[0] === null)
return e;
const n = new Date(e[0]), t = new Date(e[1]);
switch (r === void 0 && (r = 1), r) {
case 1:
return [
n.getFullYear() + "-" + te.numberB0(n.getMonth() + 1) + "-" + te.numberB0(n.getDate()) + " 00:00:00",
t.getFullYear() + "-" + te.numberB0(t.getMonth() + 1) + "-" + te.numberB0(t.getDate()) + " 23:59:59"
];
case 2:
return [
n.getFullYear() + "-" + te.numberB0(n.getMonth() + 1) + "-" + te.numberB0(n.getDate()) + " " + te.numberB0(n.getHours()) + ":00:00",
t.getFullYear() + "-" + te.numberB0(t.getMonth() + 1) + "-" + te.numberB0(t.getDate()) + " " + te.numberB0(t.getHours()) + ":59:59"
];
case 3:
return [
n.getFullYear() + "-" + te.numberB0(n.getMonth() + 1) + "-" + te.numberB0(n.getDate()) + " " + te.numberB0(n.getHours()) + ":" + te.numberB0(n.getMinutes()) + ":00",
t.getFullYear() + "-" + te.numberB0(t.getMonth() + 1) + "-" + te.numberB0(t.getDate()) + " " + te.numberB0(t.getHours()) + ":" + te.numberB0(t.getMinutes()) + ":59"
];
}
return e;
}
function Lo({ time: e = 0, showTag: r = ["天", "小时", "分钟", "秒", "毫秒"], showAll: n = !1, onlyTime: t = !1 }) {
let a = 1;
e < 0 && (a = -1), e = Math.abs(e);
const i = 1e3, o = 60 * i, s = 60 * o, c = 24 * s, l = [0, 0, 0, 0, 0];
if (e >= c) {
const f = Math.floor(e / c);
l[0] = a * f, e -= c * f;
}
if (e >= s) {
const f = Math.floor(e / s);
l[1] = a * f, e -= s * f;
}
if (e >= o) {
const f = Math.floor(e / o);
l[2] = a * f, e -= o * f;
}
if (e >= i) {
const f = Math.floor(e / i);
l[3] = a * f, e -= i * f;
}
if (l[4] = a * e, t)
return l;
let u = n, m = "";
return l.forEach((f, h) => {
!u && f !== 0 && (u = !0), u && (m += f + r[h]);
}), m;
}
function $o(e = 10, r = !1) {
let n = "", t = "", a = "{y}-{m}-{d}";
return r && (a = "{y}-{m}-{d} {h}:{i}:{s}"), n = Me((/* @__PURE__ */ new Date()).getTime() - 3600 * 1e3 * 24 * (e - 1), a), t = Me(/* @__PURE__ */ new Date(), a), [n, t];
}
function Oo(e = "date", r = 0) {
const n = /* @__PURE__ */ new Date();
let t = "", a = "";
switch (e) {
case "datetime":
t = Me(n, "{y}-{m}-{d} 00:00:00"), a = Me(n, "{y}-{m}-{d} {h}:{i}:{s}");
break;
case "date":
t = Me(n, "{y}-{m}-01"), a = Me(n, "{y}-{m}-{d}");
break;
case "month":
t = Me(n, "{y}-01"), a = Me(n, "{y}-{m}");
break;
case "year":
t = n.getFullYear() - (r + 1) * 5, a = n.getFullYear();
break;
}
return [t, a];
}
const ue = {
formatTime: Me,
customizedDate: Ro,
dateQjChange: zo,
timeRunDistance: Lo,
initSearchDate: $o,
initSearchDateQj: Oo
};
function Ho({ form: e, key: r = "money", zs: n = 10, ws: t = 2, type: a = "Number", fu: i = !1 }) {
const o = e;
o[r] = o[r] + "", a === "Number" && (o[r].slice(0, 1) === "0" && (o[r] = o[r].slice(1, 2) !== "." ? "0" : o[r]), o[r].slice(0, 1) === "-" && (o[r] = o[r].slice(1, 2) === "." ? "-" : o[r]), o[r].slice(0, 2) === "-0" && (o[r] = o[r].slice(2, 3) !== "." ? "-0" : o[r])), i ? o[r] = o[r].replace(/[^\d.-]/g, "") : o[r] = o[r].replace(/[^\d.]/g, ""), o[r] = o[r].replace(/^\./g, ""), o[r] = o[r].replace(/\.{2,}/g, "."), o[r] = o[r].slice(0, 1) + o[r].slice(1, o[r].length).replace(/\-/g, "");
const s = new RegExp("^(\\-)*(\\d+)\\.(\\d{0," + t + "}).*$");
if (n !== "" && o[r].length > 0) {
const c = o[r].split(".");
let l = c[0], u = "";
const m = l.slice(0, 1) === "-" ? 1 : 0;
l.length > n + m && (l = l.slice(0, n + m)), c.length > 1 ? (u = c[1], o[r] = l + "." + u) : o[r] = l;
}
o[r] = o[r].replace(s, "$1$2.$3");
}
function No({ form: e, key: r = "num", type: n = "Number", numberFristIs0: t = !0 }) {
n === "Number" && !t && (e[r] = e[r].slice(0, 1) === "0" ? "" : e[r]), e[r] = e[r].replace(/[^\d]/g, ""), n === "Number" && e[r].length > 0 && (e[r] = Number(e[r]));
}
function Vo(e, r = "username") {
e[r] = e[r] + "", e[r] = e[r].replace(/[^\w]/g, ""), e[r] = e[r].replace(/\_/g, "");
}
function qo(e, r) {
const n = document.createElement("a"), t = new Blob([e], {
type: "application/vnd.ms-excel"
});
n.style.display = "none", n.href = URL.createObjectURL(t), n.setAttribute("download", r), document.body.appendChild(n), n.click(), document.body.removeChild(n);
}
function Wo(e = {}) {
const r = {
dateType: "3",
direction: 1,
span: 0,
dateTypeKeyValue: ["1", "2", "3", "4"]
};
for (let o in e)
r[o] = e[o];
const n = 3600 * 1e3 * 24;
let t = null, a = null, i = 0;
switch (r.dateType) {
case r.dateTypeKeyValue[3]:
i += 1e3 * r.span;
break;
case r.dateTypeKeyValue[2]:
i += n * r.span;
break;
case r.dateTypeKeyValue[1]:
t = new Date(i).getFullYear(), a = new Date(i).getMonth() + 1 + r.span, a < 0 ? (t += r.span, a = 12) : a += 1, i = (/* @__PURE__ */ new Date(`${t}-${a}`)).getTime();
break;
case r.dateTypeKeyValue[0]:
t = new Date(i).getFullYear(), t += r.span, i = (/* @__PURE__ */ new Date(`${t}-01`)).getTime();
break;
}
return (o) => {
if (r.direction === 1)
return o.getTime() > i + Date.now();
if (r.direction === -1)
return o.getTime() < i + Date.now();
};
}
let mt = 0;
function Yo(e = 30, r) {
r ? mt = ue.formatTime(r[0], "{y}-{m}-{d}") : mt = 0;
const n = 3600 * 1e3 * 24 * e;
return (t) => {
if (mt === 0)
return t.getTime() > Date.now() || t.getTime() < mt;
{
const a = new Date(mt).getTime() + n - 864e5, i = new Date(mt).getTime() - n;
return a >= Date.now() ? t.getTime() > Date.now() || t.getTime() < i : t.getTime() > a || t.getTime() < i;
}
};
}
const v0 = {
numCheck: No,
numEnCheck: Vo,
numDxsCheck: Ho,
downloadBlobData: qo,
pickerOptions: Wo,
pickerOptionsDynamic: Yo
};
function Ko(e, r = {
name: "name",
key: "val"
}) {
if (e.length === 0)
return e;
const n = {
name: "name",
key: "val"
};
for (let i in r)
n[i] = r[i];
let t = 0;
if (e.forEach((i) => {
i.proportion = 0, t += Number(i[n.key]);
}), t > 0) {
let i = {
value: 0,
index: -1
};
e.forEach((o, s) => {
o[n.key] = o[n.key] == 0 ? null : o[n.key];
const c = te.numberChangeDecimal(Number(o[n.key]) / t * 100), l = Number(c);
Number(i.value) < l && (i = {
value: c,
index: s
}), o.proportion = l === 0 && Number(o[n.key]) > 0 ? 0.01 : l;
}), e[i.index].proportion = 100, e.forEach((o, s) => {
s !== i.index && (e[i.index].proportion = te.numberChangeDecimal(e[i.index].proportion - Number(o.proportion)));
});
}
const a = [];
return e.forEach((i) => {
a.push({
name: i[n.name],
value: i[n.key],
proportion: i.proportion + "%"
});
}), a;
}
const Pa = {
pieChange: Ko
};
var j = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Uo(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function jo(e) {
if (e.__esModule)
return e;
var r = e.default;
if (typeof r == "function") {
var n = function t() {
return this instanceof t ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
};
n.prototype = r.prototype;
} else
n = {};
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(t) {
var a = Object.getOwnPropertyDescriptor(e, t);
Object.defineProperty(n, t, a.get ? a : {
enumerable: !0,
get: function() {
return e[t];
}
});
}), n;
}
var Ma = { exports: {} };
function Go(e) {
throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var C0 = { exports: {} };
const Xo = {}, Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Xo
}, Symbol.toStringTag, { value: "Module" })), Zo = /* @__PURE__ */ jo(Jo);
var Qn;
function X() {
return Qn || (Qn = 1, function(e, r) {
(function(n, t) {
e.exports = t();
})(j, function() {
var n = n || function(t, a) {
var i;
if (typeof window < "u" && window.crypto && (i = window.crypto), typeof self < "u" && self.crypto && (i = self.crypto), typeof globalThis < "u" && globalThis.crypto && (i = globalThis.crypto), !i && typeof window < "u" && window.msCrypto && (i = window.msCrypto), !i && typeof j < "u" && j.crypto && (i = j.crypto), !i && typeof Go == "function")
try {
i = Zo;
} catch {
}
var o = function() {
if (i) {
if (typeof i.getRandomValues == "function")
try {
return i.getRandomValues(new Uint32Array(1))[0];
} catch {
}
if (typeof i.randomBytes == "function")
try {
return i.randomBytes(4).readInt32LE();
} catch {
}
}
throw new Error("Native crypto module could not be used to get secure random number.");
}, s = Object.create || function() {
function p() {
}
return function(g) {
var y;
return p.prototype = g, y = new p(), p.prototype = null, y;
};
}(), c = {}, l = c.lib = {}, u = l.Base = function() {
return {
/**
* Creates a new object that inherits from this object.
*
* @param {Object} overrides Properties to copy into the new object.
*
* @return {Object} The new object.
*
* @static
*
* @example
*
* var MyType = CryptoJS.lib.Base.extend({
* field: 'value',
*
* method: function () {
* }
* });
*/
extend: function(p) {
var g = s(this);
return p && g.mixIn(p), (!g.hasOwnProperty("init") || this.init === g.init) && (g.init = function() {
g.$super.init.apply(this, arguments);
}), g.init.prototype = g, g.$super = this, g;
},
/**
* Extends this object and runs the init method.
* Arguments to create() will be passed to init().
*
* @return {Object} The new object.
*
* @static
*
* @example
*
* var instance = MyType.create();
*/
create: function() {
var p = this.extend();
return p.init.apply(p, arguments), p;
},
/**
* Initializes a newly created object.
* Override this method to add some logic when your objects are created.
*
* @example
*
* var MyType = CryptoJS.lib.Base.extend({
* init: function () {
* // ...
* }
* });
*/
init: function() {
},
/**
* Copies properties into this object.
*
* @param {Object} properties The properties to mix in.
*
* @example
*
* MyType.mixIn({
* field: 'value'
* });
*/
mixIn: function(p) {
for (var g in p)
p.hasOwnProperty(g) && (this[g] = p[g]);
p.hasOwnProperty("toString") && (this.toString = p.toString);
},
/**
* Creates a copy of this object.
*
* @return {Object} The clone.
*
* @example
*
* var clone = instance.clone();
*/
clone: function() {
return this.init.prototype.extend(this);
}
};
}(), m = l.WordArray = u.extend({
/**
* Initializes a newly created word array.
*
* @param {Array} words (Optional) An array of 32-bit words.
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
*
* @example
*
* var wordArray = CryptoJS.lib.WordArray.create();
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
*/
init: function(p, g) {
p = this.words = p || [], g != a ? this.sigBytes = g : this.sigBytes = p.length * 4;
},
/**
* Converts this word array to a string.
*
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
*
* @return {string} The stringified word array.
*
* @example
*
* var string = wordArray + '';
* var string = wordArray.toString();
* var string = wordArray.toString(CryptoJS.enc.Utf8);
*/
toString: function(p) {
return (p || h).stringify(this);
},
/**
* Concatenates a word array to this word array.
*
* @param {WordArray} wordArray The word array to append.
*
* @return {WordArray} This word array.
*
* @example
*
* wordArray1.concat(wordArray2);
*/
concat: function(p) {
var g = this.words, y = p.words, E = this.sigBytes, C = p.sigBytes;
if (this.clamp(), E % 4)
for (var B = 0; B < C; B++) {
var w = y[B >>> 2] >>> 24 - B % 4 * 8 & 255;
g[E + B >>> 2] |= w << 24 - (E + B) % 4 * 8;
}
else
for (var P = 0; P < C; P += 4)
g[E + P >>> 2] = y[P >>> 2];
return this.sigBytes += C, this;
},
/**
* Removes insignificant bits.
*
* @example
*
* wordArray.clamp();
*/
clamp: function() {
var p = this.words, g = this.sigBytes;
p[g >>> 2] &= 4294967295 << 32 - g % 4 * 8, p.length = t.ceil(g / 4);
},
/**
* Creates a copy of this word array.
*
* @return {WordArray} The clone.
*
* @example
*
* var clone = wordArray.clone();
*/
clone: function() {
var p = u.clone.call(this);
return p.words = this.words.slice(0), p;
},
/**
* Creates a word array filled with random bytes.
*
* @param {number} nBytes The number of random bytes to generate.
*
* @return {WordArray} The random word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.lib.WordArray.random(16);
*/
random: function(p) {
for (var g = [], y = 0; y < p; y += 4)
g.push(o());
return new m.init(g, p);
}
}), f = c.enc = {}, h = f.Hex = {
/**
* Converts a word array to a hex string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The hex string.
*
* @static
*
* @example
*
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
*/
stringify: function(p) {
for (var g = p.words, y = p.sigBytes, E = [], C = 0; C < y; C++) {
var B = g[C >>> 2] >>> 24 - C % 4 * 8 & 255;
E.push((B >>> 4).toString(16)), E.push((B & 15).toString(16));
}
return E.join("");
},
/**
* Converts a hex string to a word array.
*
* @param {string} hexStr The hex string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
*/
parse: function(p) {
for (var g = p.length, y = [], E = 0; E < g; E += 2)
y[E >>> 3] |= parseInt(p.substr(E, 2), 16) << 24 - E % 8 * 4;
return new m.init(y, g / 2);
}
}, d = f.Latin1 = {
/**
* Converts a word array to a Latin1 string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The Latin1 string.
*
* @static
*
* @example
*
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
*/
stringify: function(p) {
for (var g = p.words, y = p.sigBytes, E = [], C = 0; C < y; C++) {
var B = g[C >>> 2] >>> 24 - C % 4 * 8 & 255;
E.push(String.fromCharCode(B));
}
return E.join("");
},
/**
* Converts a Latin1 string to a word array.
*
* @param {string} latin1Str The Latin1 string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
*/
parse: function(p) {
for (var g = p.length, y = [], E = 0; E < g; E++)
y[E >>> 2] |= (p.charCodeAt(E) & 255) << 24 - E % 4 * 8;
return new m.init(y, g);
}
}, x = f.Utf8 = {
/**
* Converts a word array to a UTF-8 string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The UTF-8 string.
*
* @static
*
* @example
*
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
*/
stringify: function(p) {
try {
return decodeURIComponent(escape(d.stringify(p)));
} catch {
throw new Error("Malformed UTF-8 data");
}
},
/**
* Converts a UTF-8 string to a word array.
*
* @param {string} utf8Str The UTF-8 string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
*/
parse: function(p) {
return d.parse(unescape(encodeURIComponent(p)));
}
}, v = l.BufferedBlockAlgorithm = u.extend({
/**
* Resets this block algorithm's data buffer to its initial state.
*
* @example
*
* bufferedBlockAlgorithm.reset();
*/
reset: function() {
this._data = new m.init(), this._nDataBytes = 0;
},
/**
* Adds new data to this block algorithm's buffer.
*
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
*
* @example
*
* bufferedBlockAlgorithm._append('data');
* bufferedBlockAlgorithm._append(wordArray);
*/
_append: function(p) {
typeof p == "string" && (p = x.parse(p)), this._data.concat(p), this._nDataBytes += p.sigBytes;
},
/**
* Processes available data blocks.
*
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
*
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
*
* @return {WordArray} The processed data.
*
* @example
*
* var processedData = bufferedBlockAlgorithm._process();
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
*/
_process: function(p) {
var g, y = this._data, E = y.words, C = y.sigBytes, B = this.blockSize, w = B * 4, P = C / w;
p ? P = t.ceil(P) : P = t.max((P | 0) - this._minBufferSize, 0);
var _ = P * B, A = t.min(_ * 4, C);
if (_) {
for (var F = 0; F < _; F += B)
this._doProcessBlock(E, F);
g = E.splice(0, _), y.sigBytes -= A;
}
return new m.init(g, A);
},
/**
* Creates a copy of this object.
*
* @return {Object} The clone.
*
* @example
*
* var clone = bufferedBlockAlgorithm.clone();
*/
clone: function() {
var p = u.clone.call(this);
return p._data = this._data.clone(), p;
},
_minBufferSize: 0
});
l.Hasher = v.extend({
/**
* Configuration options.
*/
cfg: u.extend(),
/**
* Initializes a newly created hasher.
*
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
*
* @example
*
* var hasher = CryptoJS.algo.SHA256.create();
*/
init: function(p) {
this.cfg = this.cfg.extend(p), this.reset();
},
/**
* Resets this hasher to its initial state.
*
* @example
*
* hasher.reset();
*/
reset: function() {
v.reset.call(this), this._doReset();
},
/**
* Updates this hasher with a message.
*
* @param {WordArray|string} messageUpdate The message to append.
*
* @return {Hasher} This hasher.
*
* @example
*
* hasher.update('message');
* hasher.update(wordArray);
*/
update: function(p) {
return this._append(p), this._process(), this;
},
/**
* Finalizes the hash computation.
* Note that the finalize operation is effectively a destructive, read-once operation.
*
* @param {WordArray|string} messageUpdate (Optional) A final message update.
*
* @return {WordArray} The hash.
*
* @example
*
* var hash = hasher.finalize();
* var hash = hasher.finalize('message');
* var hash = hasher.finalize(wordArray);
*/
finalize: function(p) {
p && this._append(p);
var g = this._doFinalize();
return g;
},
blockSize: 16,
/**
* Creates a shortcut function to a hasher's object interface.
*
* @param {Hasher} hasher The hasher to create a helper for.
*
* @return {Function} The shortcut function.
*
* @static
*
* @example
*
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
*/
_createHelper: function(p) {
return function(g, y) {
return new p.init(y).finalize(g);
};
},
/**
* Creates a shortcut function to the HMAC's object interface.
*
* @param {Hasher} hasher The hasher to use in this HMAC helper.
*
* @return {Function} The shortcut function.
*
* @static
*
* @example
*
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
*/
_createHmacHelper: function(p) {
return function(g, y) {
return new b.HMAC.init(p, y).finalize(g);
};
}
});
var b = c.algo = {};
return c;
}(Math);
return n;
});
}(C0)), C0.exports;
}
var E0 = { exports: {} }, er;
function p0() {
return er || (er = 1, function(e, r) {
(function(n, t) {
e.exports = t(X());
})(j, function(n) {
return function(t) {
var a = n, i = a.lib, o = i.Base, s = i.WordArray, c = a.x64 = {};
c.Word = o.extend({
/**
* Initializes a newly created 64-bit word.
*
* @param {number} high The high 32 bits.
* @param {number} low The low 32 bits.
*
* @example
*
* var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
*/
init: function(l, u) {
this.high = l, this.low = u;
}
/**
* Bitwise NOTs this word.
*
* @return {X64Word} A new x64-Word object after negating.
*
* @example
*
* var negated = x64Word.not();
*/
// not: function () {
// var high = ~this.high;
// var low = ~this.low;
// return X64Word.create(high, low);
// },
/**
* Bitwise ANDs this word with the passed word.
*
* @param {X64Word} word The x64-Word to AND with this word.
*
* @return {X64Word} A new x64-Word object after ANDing.
*
* @example
*
* var anded = x64Word.and(anotherX64Word);
*/
// and: function (word) {
// var high = this.high & word.high;
// var low = this.low & word.low;
// return X64Word.create(high, low);
// },
/**
* Bitwise ORs this word with the passed word.
*
* @param {X64Word} word The x64-Word to OR with this word.
*
* @return {X64Word} A new x64-Word object after ORing.
*
* @example
*
* var ored = x64Word.or(anotherX64Word);
*/
// or: function (word) {
// var high = this.high | word.high;
// var low = this.low | word.low;
// return X64Word.create(high, low);
// },
/**
* Bitwise XORs this word with the passed word.
*
* @param {X64Word} word The x64-Word to XOR with this word.
*
* @return {X64Word} A new x64-Word object after XORing.
*
* @example
*
* var xored = x64Word.xor(anotherX64Word);
*/
// xor: function (word) {
// var high = this.high ^ word.high;
// var low = this.low ^ word.low;
// return X64Word.create(high, low);
// },
/**
* Shifts this word n bits to the left.
*
* @param {number} n The number of bits to shift.
*
* @return {X64Word} A new x64-Word object after shifting.
*
* @example
*
* var shifted = x64Word.shiftL(25);
*/
// shiftL: function (n) {
// if (n < 32) {
// var high = (this.high << n) | (this.low >>> (32 - n));
// var low = this.low << n;
// } else {
// var high = this.low << (n - 32);
// var low = 0;
// }
// return X64Word.create(high, low);
// },
/**
* Shifts this word n bits to the right.
*
* @param {number} n The number of bits to shift.
*
* @return {X64Word} A new x64-Word object after shifting.
*
* @example
*
* var shifted = x64Word.shiftR(7);
*/
// shiftR: function (n) {
// if (n < 32) {
// var low = (this.low >>> n) | (this.high << (32 - n));
// var high = this.high >>> n;
// } else {
// var low = this.high >>> (n - 32);
// var high = 0;
// }
// return X64Word.create(high, low);
// },
/**
* Rotates this word n bits to the left.
*
* @param {number} n The number of bits to rotate.
*
* @return {X64Word} A new x64-Word object after rotating.
*
* @example
*
* var rotated = x64Word.rotL(25);
*/
// rotL: function (n) {
// return this.shiftL(n).or(this.shiftR(64 - n));
// },
/**
* Rotates this word n bits to the right.
*
* @param {number} n The number of bits to rotate.
*
* @return {X64Word} A new x64-Word object after rotating.
*
* @example
*
* var rotated = x64Word.rotR(7);
*/
// rotR: function (n) {
// return this.shiftR(n).or(this.shiftL(64 - n));
// },
/**
* Adds this word with the passed word.
*
* @param {X64Word} word The x64-Word to add with this word.
*
* @return {X64Word} A new x64-Word object after adding.
*
* @example
*
* var added = x64Word.add(anotherX64Word);
*/
// add: function (word) {
// var low = (this.low + word.low) | 0;
// var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
// var high = (this.high + word.high + carry) | 0;
// return X64Word.create(high, low);
// }
}), c.WordArray = o.extend({
/**
* Initializes a newly created word array.
*
* @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
*
* @example
*
* var wordArray = CryptoJS.x64.WordArray.create();
*
* var wordArray = CryptoJS.x64.WordArray.create([
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
* ]);
*
* var wordArray = CryptoJS.x64.WordArray.create([
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
* ], 10);
*/
init: function(l, u) {
l = this.words = l || [], u != t ? this.sigBytes = u : this.sigBytes = l.length * 8;
},
/**
* Converts this 64-bit word array to a 32-bit word array.
*
* @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
*
* @example
*
* var x32WordArray = x64WordArray.toX32();
*/
toX32: function() {
for (var l = this.words, u = l.length, m = [], f = 0; f < u; f++) {
var h = l[f];
m.push(h.high), m.push(h.low);
}
return s.create(m, this.sigBytes);
},
/**
* Creates a copy of this word array.
*
* @return {X64WordArray} The clone.
*
* @example
*
* var clone = x64WordArray.clone();
*/
clone: function() {
for (var l = o.clone.call(this), u = l.words = this.words.slice(0), m = u.length, f = 0; f < m; f++)
u[f] = u[f].clone();
return l;
}
});
}(), n;
});
}(E0)), E0.exports;
}
var B0 = { exports: {} }, tr;
function Qo() {
return tr || (tr = 1, function(e, r) {
(function(n, t) {
e.exports = t(X());
})(j, function(n) {
return function() {
if (typeof ArrayBuffer == "function") {
var t = n, a = t.lib, i = a.WordArray, o = i.init, s = i.init = function(c) {
if (c instanceof ArrayBuffer && (c = new Uint8Array(c)), (c instanceof Int8Array || typeof Uint8ClampedArray < "u" && c instanceof Uint8ClampedArray || c instanceof Int16Array || c instanceof Uint16Array || c instanceof Int32Array || c instanceof Uint32Array || c instanceof Float32Array || c instanceof Float64Array) && (c = new Uint8Array(c.buffer, c.byteOffset, c.byteLength)), c instanceof Uint8Array) {
for (var l = c.byteLength, u = [], m = 0; m < l; m++)
u[m >>> 2] |= c[m] << 24 - m % 4 * 8;
o.call(this, u, l);
} else
o.apply(this, arguments);
};
s.prototype = i;
}
}(), n.lib.WordArray;
});
}(B0)), B0.exports;
}
var D0 = { exports: {} }, nr;
function es() {
return nr || (nr = 1, function(e, r) {
(function(n, t) {
e.exports = t(X());
})(j, function(n) {
return function() {
var t = n, a = t.lib, i = a.WordArray, o = t.enc;
o.Utf16 = o.Utf16BE = {
/**
* Converts a word array to a UTF-16 BE string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The UTF-16 BE string.
*
* @static
*
* @example
*
* var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
*/
stringify: function(c) {
for (var l = c.words, u = c.sigBytes, m = [], f = 0; f < u; f += 2) {
var h = l[f >>> 2] >>> 16 - f % 4 * 8 & 65535;
m.push(String.fromCharCode(h));
}
return m.join("");
},
/**
* Converts a UTF-16 BE string to a word array.
*
* @param {string} utf16Str The UTF-16 BE string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
*/
parse: function(c) {
for (var l = c.length, u = [], m = 0; m < l; m++)
u[m >>> 1] |= c.charCodeAt(m) << 16 - m % 2 * 16;
return i.create(u, l * 2);
}
}, o.Utf16LE = {
/**
* Converts a word array to a UTF-16 LE string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The UTF-16 LE string.
*
* @static
*
* @example
*
* var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
*/
stringify: function(c) {
for (var l = c.words, u = c.sigBytes, m = [], f = 0; f < u; f += 2) {
var h = s(l[f >>> 2] >>> 16 - f % 4 * 8 & 65535);
m.push(String.fromCharCode(h));
}
return m.join("");
},
/**
* Converts a UTF-16 LE string to a word array.
*
* @param {string} utf16Str The UTF-16 LE string.
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
*/
parse: function(c) {
for (var l = c.length, u = [], m = 0; m < l; m++)
u[m >>> 1] |= s(c.charCodeAt(m) << 16 - m % 2 * 16);
return i.create(u, l * 2);
}
};
function s(c) {
return c << 8 & 4278255360 | c >>> 8 & 16711935;
}
}(), n.enc.Utf16;
});
}(D0)), D0.exports;
}
var A0 = { exports: {} }, rr;
function dt() {
return rr || (rr = 1, function(e, r) {
(function(n, t) {
e.exports = t(X());
})(j, function(n) {
return function() {
var t = n, a = t.lib, i = a.WordArray, o = t.enc;
o.Base64 = {
/**
* Converts a word array to a Base64 string.
*
* @param {WordArray} wordArray The word array.
*
* @return {string} The Base64 string.
*
* @static
*
* @example
*
* var base64String = CryptoJS.enc.Base64.stringify(wordArray);
*/
stringify: function(c) {
var l = c.words, u = c.sigBytes, m = this._map;
c.clamp();
for (var f = [], h = 0; h < u; h += 3)
for (var d = l[h >>> 2] >>> 24 - h % 4 * 8 & 255, x = l[h + 1 >>> 2] >>> 24 - (h + 1) % 4 * 8 & 255, v = l[h + 2 >>> 2] >>> 24 - (h + 2) % 4 * 8 & 255, b = d << 16 | x << 8 | v, p = 0; p < 4 && h + p * 0.7