// ==UserScript==
// @name GM Api Test
// @namespace https://github.com/WhiteSevs/TamperMonkeyScript
// @version 2025.9.28
// @author WhiteSevs
// @description 用于测试您的油猴脚本管理器对油猴函数的支持程度
// @license GPL-3.0-only
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAACM9JREFUeF7tnUmsFUUUhj9klFmMsxiJGsUBFk4xbDAa16AG1EQUQSDRMBjBuHFrBCNDNBFkUEhUiApro9EFxKi4AAc0xmBEcUrQx6SIov2Te5+Xy323q/t2v9fd59Ty3erq+k99r7rqVNWpfuSb5gL3A2OAUcAwYAgwEDgj31eXrvQTwHHgT+AI0AUcADYBq/NS0y+Hgh+qNfqkWkPn8ApzRQqMHTUY1mepPisAxgGq2A3A8Cwr6GWdZoHDwE5A/2h7O7VPFgBsBqYAgzqtjD+fyAJ/AduA6YmeasrcCQArgZnAiE4q4M92bIFDwAZgQZqS0gBwDfA2cGGaF/ozuVlgP3AH8HmSNyQFYEbU8GuAwUle4nl7zQLHgDnAxtA3JgFgaTQ9WRxasOfrUwssA5aE1CAUgK21gV5ImZ6nGBbQAHFqXFVCAFgLzIoryH8vpAXWAbPb1SwOAI3yM3U8FNJM1a6U/AWaJbRM7QCYDLxXbduYUXcr8H4rtT0BMBbYDYw2Y6JqC/0dmBB9yvc1y+wJgO+Bi6ptE3PqfgAuDgFAHr755sxjQ/CqZo9hqx7goLt3K0uD3MYjG9U1A6CFnWmVle/CZIEtjQtIjQBoSfdLX9WrPCVaRbyqvpTcCICmfJr6eaq+BTQl1NSQRgCOAmdWX7srBP4AhjYCsDDas7fcTWPKAosiP8+Keg+wq+YoMGUB42Ll6JtYB+BvoL9xg1iT/w8wQAB492+t6f/Xu0gAbAe0hduTPQvsEABfAOPtaXfFkUNojwDQIoFv8LTJw34BoKVCHdvyZM8CXQJAZ9F8l6+9xpfiYwJA0wE/qGkTgBMC4F+b2l113RXsABhmwXsAw43vPYDxxncAHICT+wF8DGAYBAfAcOP7J8B44zsADoCPAawz4GMA4wQ4AA6ATwMtM+A9gOXWrx0McUeQYQi8BzDc+O4HMN74DoAD4I4g6wz4GMA4AQ6AA+COIMsMeA9gufXdEWS89R0AB8A/AcYZcAAcAJ8FWGbAewDLre+DQOOt7wA4AP4JMM6AA+AA+CzAMgPeA1hufR8EGm99B8AB8E+AcQZ6GwBFJVdo2q+B74BvatfU1K8819X0us7ksujG0kuAy6M7bq4GBpa0nQqvtzcAOAzsjBp1UwfX0N4d3XHzAHALcHbBYSiV3jwB6Ioun3wphyvn5wJPFTC+cSn15gGAbqV6C7g35//UF2u9wpCc3xNXfKn1Zg2AbqPSbdV746yW0e/nRWOG1/vwtrPS680KAB0wXQPMy6hhkxaj3mBO0y1oSctIkr8yerMAQFeQXVG7dyCJEbPOq8uuNbvI++q7SuntFIDuCwizbs0OysvzAszK6e0EgF8AfYOLmH4Gzs24YpXUmxaAE8A50TXzBzI2clbFjQF+zfAehMrqTQvAE9HVo0uzaq2cylkSjQeeyajsyupNA0ARv4M9tXMW44FK600KwClXj2f035VnMeNqaw2DUr5E9yldCmhMUYakMdm3QLBzLCkAcrrk7eHL2tCvRRDck7LQ1X3o20hZZeQTkbs8KCUBQL7u0UGlFi9Tmqvx9kdrGfItlDEF3wWZBIBnc1jY6S3jLgMeT/gyeTXVA5QxqQdQTxCbQgE4CgyLLa3YGY5EM5ehgVVUj3FWYN6iZvstpMcOBeBj4KaiKg2s10fAjYF5yzTy70lS0AwoFIBFEU0rAo1X1GwLoytylwdWbmY0+n85MG9Rsz0IbIirXAgAull0QFxBJfldW7T6x9RVecq6Ba1Z2vG4tgsB4DPgupI0cFw1PwWujcmkPBPiCirJ77vj2i4EgDcB7cmrQnoDuCtGiCm9IQDou/lYFVofeA7QeKZdMqU3BIBHo5W/FyoCwCPA8zFaTOkNAeB24N2KAHAb8E6MFlN6QwC4IPKH/1QRAM6P/OQ/xmgxpdcBOJ0GB6DJJqa6RMCU3pAewNSgCDClNwQAU9OimrvYzLRXAMjVe0abgZEpx0jkObOk94QA0LanwW0AkDtxYkVmAbsC3LyW9B4TAHG7ZUwtjgCW9HYJgJDtQ7M6ONtflM5Dh1bXBVbGit79AkARO8bHGMbMBomaHazo3SMAtgOTYgBQ1IsRgf89Rc12CBgeWDkrencIgNANhNY2hVrQO08AKOnAR9wuGGvbwquuV7uFBtUBCNpAWIvGYelgSJUPwpwc59QBCB0hWzsaVmW9J2c6dQD0GQgdJJVphBzas7UbG1ZRb/cgtxGAJMYqw5m5RGfkYmYHVdPbDXUjAElO0ipI0tgCxAXqqd10pm9fhkGjqqT3lM9aIwAy5ubIMTQtcK6sYEmhR60Ci8wsm46yZR0sqip6twDT65ZuBkB/P5jA6VPE72OST1lS4squV+O8kY2iWwGwMor9Mz+BZRQ8Sa7kvo4XpLhAe3IIDtVsijLrXQUsiANAv4csEDWWoyBKT/Zh3CDFA3o6w6BQcfyXUW/LeAetegCJV9j2T2L2CbQyUm+HTtXAdb2hULFp9R4DrgfqYfm7264nAJRhBvBK3L9Ci997K3iyQr/cKXdmijpm+UgZ9CrU/sZWotsBoPwKBbc4pbXyCp+uaB8PR3v3RqWsV16PFVWv7KVPZMsUB4Ae2gpM6cBqmpKp63m1gxgDOtt/X+3TVNSpZ91ERdK7DZjaru1CANDzayPHinzHnSZtQNVI/avAK2OurM0w4s70d1qvvJ7vS73a/TQ7TlgoACpHUTM04PJUfAtocS82OohkJAFA+SfXPgllDRdX/KbrrIba4KsuX7OxoJQUABWqNYAPShxDL8gwJcwk340u1dIaSHBKA0C9cHkM9Vko+17BYGMVNKPcu+ruT/Hwhda1EwDq79ACkmYJfT0fD9VclXzyP2iU372wk0ZYFgDovXUP1c05rMKl0VXlZ7Qq+WFWl3NlBUCjwTVn16dB7uSyTt+KBpCmk/KlqKvPNF5jHgA0w6AIY1qpk+dO4WYVylw7kNsdSC1aA/RGfbTApJ26OqupsLbyLGqFVZHNMm30RjH/AX1V4etVAz1zAAAAAElFTkSuQmCC
// @supportURL https://github.com/WhiteSevs/TamperMonkeyScript/issues
// @match *://*/*
// @require https://fastly.jsdelivr.net/gh/WhiteSevs/TamperMonkeyScript@86be74b83fca4fa47521cded28377b35e1d7d2ac/lib/CoverUMD/index.js
// @resource ViewerCSS https://fastly.jsdelivr.net/npm/[email protected]/dist/viewer.min.css
// @connect *
// @grant GM.addElement
// @grant GM.addStyle
// @grant GM.addValueChangeListener
// @grant GM.audio
// @grant GM.cookie
// @grant GM.deleteValue
// @grant GM.deleteValues
// @grant GM.download
// @grant GM.getResourceText
// @grant GM.getResourceUrl
// @grant GM.getTab
// @grant GM.getTabs
// @grant GM.getValue
// @grant GM.getValues
// @grant GM.info
// @grant GM.listValues
// @grant GM.log
// @grant GM.notification
// @grant GM.openInTab
// @grant GM.registerMenuCommand
// @grant GM.removeValueChangeListener
// @grant GM.saveTab
// @grant GM.setClipboard
// @grant GM.setValue
// @grant GM.setValues
// @grant GM.unregisterMenuCommand
// @grant GM.webRequest
// @grant GM.xmlHttpRequest
// @grant GM_addElement
// @grant GM_addStyle
// @grant GM_addValueChangeListener
// @grant GM_audio
// @grant GM_cookie
// @grant GM_deleteValue
// @grant GM_deleteValues
// @grant GM_download
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @grant GM_getTab
// @grant GM_getTabs
// @grant GM_getValue
// @grant GM_getValues
// @grant GM_info
// @grant GM_listValues
// @grant GM_log
// @grant GM_notification
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// @grant GM_removeValueChangeListener
// @grant GM_saveTab
// @grant GM_setClipboard
// @grant GM_setValue
// @grant GM_setValues
// @grant GM_unregisterMenuCommand
// @grant GM_webRequest
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @grant window.close
// @grant window.focus
// @grant window.onurlchange
// @run-at document-start
// ==/UserScript==
(function () {
"use strict";
var _GM = (() => (typeof GM != "undefined" ? GM : void 0))();
var _GM_addElement = (() => (typeof GM_addElement != "undefined" ? GM_addElement : void 0))();
var _GM_addStyle = (() => (typeof GM_addStyle != "undefined" ? GM_addStyle : void 0))();
var _GM_addValueChangeListener = (() =>
typeof GM_addValueChangeListener != "undefined" ? GM_addValueChangeListener : void 0)();
var _GM_cookie = (() => (typeof GM_cookie != "undefined" ? GM_cookie : void 0))();
var _GM_deleteValue = (() => (typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0))();
var _GM_deleteValues = (() => (typeof GM_deleteValues != "undefined" ? GM_deleteValues : void 0))();
var _GM_download = (() => (typeof GM_download != "undefined" ? GM_download : void 0))();
var _GM_getResourceText = (() => (typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0))();
var _GM_getResourceURL = (() => (typeof GM_getResourceURL != "undefined" ? GM_getResourceURL : void 0))();
var _GM_getTab = (() => (typeof GM_getTab != "undefined" ? GM_getTab : void 0))();
var _GM_getTabs = (() => (typeof GM_getTabs != "undefined" ? GM_getTabs : void 0))();
var _GM_getValue = (() => (typeof GM_getValue != "undefined" ? GM_getValue : void 0))();
var _GM_getValues = (() => (typeof GM_getValues != "undefined" ? GM_getValues : void 0))();
var _GM_info = (() => (typeof GM_info != "undefined" ? GM_info : void 0))();
var _GM_listValues = (() => (typeof GM_listValues != "undefined" ? GM_listValues : void 0))();
var _GM_log = (() => (typeof GM_log != "undefined" ? GM_log : void 0))();
var _GM_notification = (() => (typeof GM_notification != "undefined" ? GM_notification : void 0))();
var _GM_openInTab = (() => (typeof GM_openInTab != "undefined" ? GM_openInTab : void 0))();
var _GM_registerMenuCommand = (() =>
typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
var _GM_removeValueChangeListener = (() =>
typeof GM_removeValueChangeListener != "undefined" ? GM_removeValueChangeListener : void 0)();
var _GM_saveTab = (() => (typeof GM_saveTab != "undefined" ? GM_saveTab : void 0))();
var _GM_setClipboard = (() => (typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0))();
var _GM_setValue = (() => (typeof GM_setValue != "undefined" ? GM_setValue : void 0))();
var _GM_setValues = (() => (typeof GM_setValues != "undefined" ? GM_setValues : void 0))();
var _GM_unregisterMenuCommand = (() =>
typeof GM_unregisterMenuCommand != "undefined" ? GM_unregisterMenuCommand : void 0)();
var _GM_webRequest = (() => (typeof GM_webRequest != "undefined" ? GM_webRequest : void 0))();
var _GM_xmlhttpRequest = (() => (typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0))();
var _GM_audio = (() => (typeof GM_audio != "undefined" ? GM_audio : void 0))();
var _unsafeWindow = (() => (typeof unsafeWindow != "undefined" ? unsafeWindow : void 0))();
var _monkeyWindow = (() => window)();
function CompatibleProcessing() {
try {
if (typeof Object.assign !== "function") {
Object.assign = function (target) {
target = Object(target);
if (arguments.length > 1) {
const sourceList = [...arguments].splice(1, arguments.length - 1);
sourceList.forEach((sourceItem) => {
for (const sourceKey in sourceItem) {
if (Object.prototype.hasOwnProperty.call(sourceItem, sourceKey)) {
target[sourceKey] = sourceItem[sourceKey];
}
}
});
}
return target;
};
}
} catch (error) {
console.warn("Qmsg CompatibleProcessing Object.assign error", error);
}
try {
if (!("classList" in document.documentElement)) {
Object.defineProperty(HTMLElement.prototype, "classList", {
get: function () {
const self2 = this;
function update(fn) {
return function (value) {
const classes = self2.className.split(/\s+/g),
index = classes.indexOf(value);
fn(classes, index, value);
self2.className = classes.join(" ");
};
}
return {
add: update(function (classes, index, value) {
if (!~index) classes.push(value);
}),
remove: update(function (classes, index) {
if (~index) classes.splice(index, 1);
}),
toggle: update(function (classes, index, value) {
if (~index) classes.splice(index, 1);
else classes.push(value);
}),
contains: function (value) {
return !!~self2.className.split(/\s+/g).indexOf(value);
},
item: function (index) {
return self2.className.split(/\s+/g)[index] || null;
},
};
},
});
}
} catch (error) {
console.warn("Qmsg CompatibleProcessing HTMLElement.prototype.classList warning", error);
}
}
const QmsgDefaultConfig = {
get PLUGIN_NAME() {
return "qmsg";
},
get NAMESPACE() {
return "qmsg";
},
INS_DEFAULT: {},
get config() {
return {
parent: document.body || document.documentElement,
useShadowRoot: true,
shadowRootMode: "open",
animation: true,
autoClose: true,
listenEventToPauseAutoClose: true,
content: "",
isHTML: false,
position: "top",
showClose: false,
maxNums: 5,
onClose: null,
showIcon: true,
showMoreContent: false,
showReverse: false,
timeout: 2500,
type: "info",
zIndex: 5e4,
style: "",
customClass: "",
isLimitWidth: false,
limitWidthNum: 200,
limitWidthWrap: "no-wrap",
consoleLogContent: false,
afterRender: null,
};
},
};
const QmsgHeaderCloseIcon = `
<svg width="16" height="16" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" fill="white" fill-opacity="0.01"/>
<path d="M14 14L34 34" stroke="#909399" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14 34L34 14" stroke="#909399" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
</svg>`;
const QmsgIcon = {
info: `
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M512 64q190.016 4.992 316.512 131.488T960 512q-4.992 190.016-131.488 316.512T512 960q-190.016-4.992-316.512-131.488T64 512q4.992-190.016 131.488-316.512T512 64zm67.008 275.008q26.016 0 43.008-15.488t16.992-41.504-16.992-41.504-42.496-15.488-42.496 15.488-16.992 41.504 16.992 41.504 42.016 15.488zm12 360q0-6.016.992-16T592 664l-52.992 60.992q-8 8.992-16.512 14.016T508 742.016q-8.992-4-8-14.016l88-276.992q4.992-28-8.992-48t-44.992-24q-35.008.992-76.512 29.504t-72.512 72.512v15.008q-.992 10.016 0 19.008l52.992-60.992q8-8.992 16.512-14.016T468 437.024q10.016 4.992 7.008 16l-87.008 276q-7.008 24.992 7.008 44.512T444 800.032q50.016-.992 84-28.992t63.008-72z" fill="#909399"/>
</svg>`,
warning: `
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M512 64C264.64 64 64 264.64 64 512c0 247.424 200.64 448 448 448 247.488 0 448-200.576 448-448 0-247.36-200.512-448-448-448zm0 704c-26.432 0-48-21.504-48-48s21.568-48 48-48c26.624 0 48 21.504 48 48s-21.376 48-48 48zm48-240c0 26.56-21.376 48-48 48-26.432 0-48-21.44-48-48V304c0-26.56 21.568-48 48-48 26.624 0 48 21.44 48 48v224z" fill="#E6A23C"/>
</svg>`,
error: `
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M512 64C264.58 64 64 264.58 64 512s200.58 448 448 448 448-200.57 448-448S759.42 64 512 64zm158.39 561.14a32 32 0 1 1-45.25 45.26L512 557.26 398.86 670.4a32 32 0 0 1-45.25-45.26L466.75 512 353.61 398.86a32 32 0 0 1 45.25-45.25L512 466.74l113.14-113.13a32 32 0 0 1 45.25 45.25L557.25 512z" fill="#F56C6C"/>
</svg>`,
success: `
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M512 64q190.016 4.992 316.512 131.488T960 512q-4.992 190.016-131.488 316.512T512 960q-190.016-4.992-316.512-131.488T64 512q4.992-190.016 131.488-316.512T512 64zm-56 536l-99.008-99.008q-12-11.008-27.488-11.008t-27.008 11.488-11.488 26.496 11.008 27.008l127.008 127.008q11.008 11.008 27.008 11.008t27.008-11.008l263.008-263.008q15.008-15.008 9.504-36.512t-27.008-27.008-36.512 9.504z" fill="#67C23A"/>
</svg>`,
loading: `
<svg class="animate-turn" width="16" height="16" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#fff" fill-opacity=".01" d="M0 0h48v48H0z"/>
<path d="M4 24c0 11.046 8.954 20 20 20s20-8.954 20-20S35.046 4 24 4" stroke="#409eff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M36 24c0-6.627-5.373-12-12-12s-12 5.373-12 12 5.373 12 12 12" stroke="#409eff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
</svg>`,
};
const QmsgInstStorage = {
insInfoList: [],
remove(uuid) {
let flag = false;
for (let index = 0; index < QmsgInstStorage.insInfoList.length; index++) {
if (QmsgInstStorage.insInfoList[index].uuid === uuid) {
QmsgInstStorage.insInfoList.splice(index, 1);
flag = true;
break;
}
}
return flag;
},
};
const createCache$3 = (lastNumberWeakMap) => {
return (collection, nextNumber) => {
lastNumberWeakMap.set(collection, nextNumber);
return nextNumber;
};
};
const MAX_SAFE_INTEGER$3 = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
const TWO_TO_THE_POWER_OF_TWENTY_NINE$3 = 536870912;
const TWO_TO_THE_POWER_OF_THIRTY$3 = TWO_TO_THE_POWER_OF_TWENTY_NINE$3 * 2;
const createGenerateUniqueNumber$3 = (cache2, lastNumberWeakMap) => {
return (collection) => {
const lastNumber = lastNumberWeakMap.get(collection);
let nextNumber =
lastNumber === void 0 ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY$3 ? lastNumber + 1 : 0;
if (!collection.has(nextNumber)) {
return cache2(collection, nextNumber);
}
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE$3) {
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY$3);
}
return cache2(collection, nextNumber);
}
if (collection.size > MAX_SAFE_INTEGER$3) {
throw new Error(
"Congratulations, you created a collection of unique numbers which uses all available integers!"
);
}
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER$3);
}
return cache2(collection, nextNumber);
};
};
const LAST_NUMBER_WEAK_MAP$3 = new WeakMap();
const cache$3 = createCache$3(LAST_NUMBER_WEAK_MAP$3);
const generateUniqueNumber$3 = createGenerateUniqueNumber$3(cache$3, LAST_NUMBER_WEAK_MAP$3);
const isMessagePort$3 = (sender) => {
return typeof sender.start === "function";
};
const PORT_MAP$3 = new WeakMap();
const extendBrokerImplementation$3 = (partialBrokerImplementation) => ({
...partialBrokerImplementation,
connect: ({ call }) => {
return async () => {
const { port1, port2 } = new MessageChannel();
const portId = await call("connect", { port: port1 }, [port1]);
PORT_MAP$3.set(port2, portId);
return port2;
};
},
disconnect: ({ call }) => {
return async (port) => {
const portId = PORT_MAP$3.get(port);
if (portId === void 0) {
throw new Error("The given port is not connected.");
}
await call("disconnect", { portId });
};
},
isSupported: ({ call }) => {
return () => call("isSupported");
},
});
const ONGOING_REQUESTS$3 = new WeakMap();
const createOrGetOngoingRequests$3 = (sender) => {
if (ONGOING_REQUESTS$3.has(sender)) {
return ONGOING_REQUESTS$3.get(sender);
}
const ongoingRequests = new Map();
ONGOING_REQUESTS$3.set(sender, ongoingRequests);
return ongoingRequests;
};
const createBroker$3 = (brokerImplementation) => {
const fullBrokerImplementation = extendBrokerImplementation$3(brokerImplementation);
return (sender) => {
const ongoingRequests = createOrGetOngoingRequests$3(sender);
sender.addEventListener("message", ({ data: message }) => {
const { id } = message;
if (id !== null && ongoingRequests.has(id)) {
const { reject, resolve } = ongoingRequests.get(id);
ongoingRequests.delete(id);
if (message.error === void 0) {
resolve(message.result);
} else {
reject(new Error(message.error.message));
}
}
});
if (isMessagePort$3(sender)) {
sender.start();
}
const call = (method, params = null, transferables = []) => {
return new Promise((resolve, reject) => {
const id = generateUniqueNumber$3(ongoingRequests);
ongoingRequests.set(id, { reject, resolve });
if (params === null) {
sender.postMessage({ id, method }, transferables);
} else {
sender.postMessage({ id, method, params }, transferables);
}
});
};
const notify = (method, params, transferables = []) => {
sender.postMessage({ id: null, method, params }, transferables);
};
let functions = {};
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
functions = { ...functions, [key]: handler({ call, notify }) };
}
return { ...functions };
};
};
const scheduledIntervalsState$3 = new Map([[0, null]]);
const scheduledTimeoutsState$3 = new Map([[0, null]]);
const wrap$3 = createBroker$3({
clearInterval: ({ call }) => {
return (timerId) => {
if (typeof scheduledIntervalsState$3.get(timerId) === "symbol") {
scheduledIntervalsState$3.set(timerId, null);
call("clear", { timerId, timerType: "interval" }).then(() => {
scheduledIntervalsState$3.delete(timerId);
});
}
};
},
clearTimeout: ({ call }) => {
return (timerId) => {
if (typeof scheduledTimeoutsState$3.get(timerId) === "symbol") {
scheduledTimeoutsState$3.set(timerId, null);
call("clear", { timerId, timerType: "timeout" }).then(() => {
scheduledTimeoutsState$3.delete(timerId);
});
}
};
},
setInterval: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$3(scheduledIntervalsState$3);
scheduledIntervalsState$3.set(timerId, symbol);
const schedule = () =>
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "interval",
}).then(() => {
const state = scheduledIntervalsState$3.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
func(...args);
if (scheduledIntervalsState$3.get(timerId) === symbol) {
schedule();
}
}
});
schedule();
return timerId;
};
},
setTimeout: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$3(scheduledTimeoutsState$3);
scheduledTimeoutsState$3.set(timerId, symbol);
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "timeout",
}).then(() => {
const state = scheduledTimeoutsState$3.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
scheduledTimeoutsState$3.delete(timerId);
func(...args);
}
});
return timerId;
};
},
});
const load$3 = (url) => {
const worker2 = new Worker(url);
return wrap$3(worker2);
};
const createLoadOrReturnBroker$3 = (loadBroker, worker2) => {
let broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker2], { type: "application/javascript; charset=utf-8" });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
const worker$3 = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`;
const loadOrReturnBroker$3 = createLoadOrReturnBroker$3(load$3, worker$3);
const clearInterval$3 = (timerId) => loadOrReturnBroker$3().clearInterval(timerId);
const clearTimeout$2 = (timerId) => loadOrReturnBroker$3().clearTimeout(timerId);
const setInterval$3 = (...args) => loadOrReturnBroker$3().setInterval(...args);
const setTimeout$1$3 = (...args) => loadOrReturnBroker$3().setTimeout(...args);
const QmsgUtils = {
getNameSpacify(...args) {
let result = QmsgDefaultConfig.NAMESPACE;
for (let index = 0; index < args.length; ++index) {
result += "-" + args[index];
}
return result;
},
isNumber(text) {
const isNumberPattern = /^\d+$/;
return isNumberPattern.test(text);
},
getUUID() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (value) {
const randValue = (Math.random() * 16) | 0,
newValue = value == "x" ? randValue : (randValue & 3) | 8;
return newValue.toString(16);
});
},
mergeArgs(content = "", config) {
const opts = {};
if (arguments.length === 0) {
return opts;
}
if (config != null) {
opts.content = content;
if (typeof config === "object" && config != null) {
return Object.assign(opts, config);
}
} else {
if (typeof content === "object" && content != null) {
return Object.assign(opts, content);
} else {
opts.content = content;
}
}
return opts;
},
toDynamicObject(obj, ...other_objs) {
const __obj__ = Object.assign({}, obj ?? {});
Object.keys(__obj__).forEach((keyName) => {
let objValue = __obj__[keyName];
Object.defineProperty(__obj__, keyName, {
get() {
const findIndex = other_objs.findIndex((other_obj) => {
return (
typeof other_obj === "object" && other_obj != null && other_obj.hasOwnProperty.call(other_obj, keyName)
);
});
if (findIndex !== -1) {
const other_objValue = other_objs[findIndex][keyName];
return other_objValue;
} else {
return objValue;
}
},
set(newValue) {
objValue = newValue;
},
});
});
return __obj__;
},
setTimeout(callback, timeout) {
try {
return setTimeout$1$3(callback, timeout);
} catch {
return globalThis.setTimeout(callback, timeout);
}
},
clearTimeout(timeId) {
try {
if (timeId != null) {
clearTimeout$2(timeId);
}
} catch {
} finally {
globalThis.clearTimeout(timeId);
}
},
setInterval(callback, timeout) {
try {
return setInterval$3(callback, timeout);
} catch {
return globalThis.setInterval(callback, timeout);
}
},
clearInterval(timeId) {
try {
if (timeId != null) {
clearInterval$3(timeId);
}
} catch {
} finally {
globalThis.clearInterval(timeId);
}
},
setSafeHTML($el, text) {
try {
$el.innerHTML = text;
} catch {
if (globalThis.trustedTypes) {
const policy = globalThis.trustedTypes.createPolicy("safe-innerHTML", {
createHTML: (html) => html,
});
$el.innerHTML = policy.createHTML(text);
} else {
throw new Error("QmsgUtils trustedTypes is not defined");
}
}
},
};
const QmsgAnimation = {
$state: {
opening: "MessageMoveIn",
done: "",
closing: "MessageMoveOut",
},
$name: {
startNameList: ["animationName", "WebkitAnimationName", "MozAnimationName", "msAnimationName", "OAnimationName"],
endNameList: ["animationend", "webkitAnimationEnd", "mozAnimationEnd", "MSAnimationEnd", "oanimationend"],
},
__CAN_ANIMATION__: void 0,
get CAN_ANIMATION() {
this.__CAN_ANIMATION__ =
this.__CAN_ANIMATION__ ?? this.getStyleAnimationNameValue(document.createElement("div")) != null;
return this.__CAN_ANIMATION__;
},
getStyleAnimationNameValue(element) {
for (let index = 0; index < this.$name.startNameList.length; index++) {
const animationName = this.$name.startNameList[index];
const animationNameValue = element.style[animationName];
if (animationNameValue != null) {
return animationNameValue;
}
}
},
setStyleAnimationName(element, animationNameValue = "") {
this.$name.startNameList.forEach((animationName) => {
if (animationName in element.style) {
element.style[animationName] = animationNameValue;
}
});
},
};
const css_text$1 =
'@charset "utf-8";\r\n.qmsg.qmsg-wrapper {\r\n position: fixed;\r\n top: 16px;\r\n left: 0;\r\n z-index: 50000;\r\n display: flex;\r\n box-sizing: border-box;\r\n margin: 0;\r\n padding: 0;\r\n width: 100%;\r\n color: rgba(0, 0, 0, 0.55);\r\n list-style: none;\r\n font-variant: tabular-nums;\r\n font-size: 13px;\r\n line-height: 1;\r\n font-feature-settings: "tnum";\r\n pointer-events: none;\r\n flex-direction: column;\r\n}\r\n.qmsg.qmsg-data-position-center,\r\n.qmsg.qmsg-data-position-left,\r\n.qmsg.qmsg-data-position-right {\r\n position: fixed;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n}\r\n.qmsg.qmsg-data-position-bottom,\r\n.qmsg.qmsg-data-position-bottomleft,\r\n.qmsg.qmsg-data-position-bottomright {\r\n position: fixed;\r\n top: unset;\r\n bottom: 0;\r\n bottom: 8px;\r\n left: 50%;\r\n transform: translate(-50%, 0);\r\n}\r\n.qmsg.qmsg-data-position-bottomleft .qmsg-item,\r\n.qmsg.qmsg-data-position-left .qmsg-item,\r\n.qmsg.qmsg-data-position-topleft .qmsg-item {\r\n text-align: left;\r\n}\r\n.qmsg.qmsg-data-position-bottom .qmsg-item,\r\n.qmsg.qmsg-data-position-center .qmsg-item,\r\n.qmsg.qmsg-data-position-top .qmsg-item {\r\n text-align: center;\r\n}\r\n.qmsg.qmsg-data-position-bottomright .qmsg-item,\r\n.qmsg.qmsg-data-position-right .qmsg-item,\r\n.qmsg.qmsg-data-position-topright .qmsg-item {\r\n text-align: right;\r\n}\r\n.qmsg .qmsg-item {\r\n position: relative;\r\n padding: 8px;\r\n text-align: center;\r\n -webkit-animation-duration: 0.3s;\r\n animation-duration: 0.3s;\r\n}\r\n.qmsg .qmsg-item .qmsg-count {\r\n position: absolute;\r\n top: -4px;\r\n left: -4px;\r\n display: inline-block;\r\n height: 16px;\r\n min-width: 16px;\r\n border-radius: 2px;\r\n background-color: red;\r\n color: #fff;\r\n text-align: center;\r\n font-size: 12px;\r\n line-height: 16px;\r\n -webkit-animation-duration: 0.3s;\r\n animation-duration: 0.3s;\r\n}\r\n.qmsg .qmsg-item:first-child {\r\n margin-top: -8px;\r\n}\r\n.qmsg .qmsg-content {\r\n position: relative;\r\n display: inline-block;\r\n padding: 10px 12px;\r\n max-width: 80%;\r\n min-width: 40px;\r\n border-radius: 4px;\r\n background: #fff;\r\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\r\n text-align: center;\r\n pointer-events: all;\r\n}\r\n.qmsg .qmsg-content [class^="qmsg-content-"] {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.qmsg .qmsg-icon {\r\n position: relative;\r\n top: 1px;\r\n display: inline-block;\r\n margin-right: 8px;\r\n color: inherit;\r\n vertical-align: -0.125em;\r\n text-align: center;\r\n text-transform: none;\r\n font-style: normal;\r\n font-size: 16px;\r\n line-height: 0;\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n}\r\n.qmsg .qmsg-icon svg {\r\n display: inline-block;\r\n}\r\n.qmsg .qmsg-content .qmsg-show-more-content {\r\n display: flex;\r\n align-items: center;\r\n white-space: unset;\r\n overflow: unset;\r\n text-overflow: unset;\r\n padding-right: unset;\r\n}\r\n.qmsg .qmsg-content-info .qmsg-icon {\r\n color: #1890ff;\r\n}\r\n.qmsg .qmsg-icon-close {\r\n margin: 0;\r\n margin-left: 8px;\r\n padding: 0;\r\n outline: 0;\r\n border: none;\r\n background-color: transparent;\r\n color: rgba(0, 0, 0, 0.45);\r\n font-size: 12px;\r\n cursor: pointer;\r\n transition: color 0.3s;\r\n}\r\n.qmsg .qmsg-icon-close:hover > svg path {\r\n stroke: #555;\r\n}\r\n.qmsg .qmsg-icon-close.qmsg-show-more-content {\r\n position: unset;\r\n overflow: unset;\r\n padding-left: 6px;\r\n margin-right: 0;\r\n}\r\n.qmsg .animate-turn {\r\n animation: MessageTurn 1s linear infinite;\r\n -webkit-animation: MessageTurn 1s linear infinite;\r\n}\r\n';
const css_text =
"@keyframes MessageTurn {\r\n 0% {\r\n -webkit-transform: rotate(0);\r\n }\r\n 25% {\r\n -webkit-transform: rotate(90deg);\r\n }\r\n 50% {\r\n -webkit-transform: rotate(180deg);\r\n }\r\n 75% {\r\n -webkit-transform: rotate(270deg);\r\n }\r\n 100% {\r\n -webkit-transform: rotate(360deg);\r\n }\r\n}\r\n@-webkit-keyframes MessageTurn {\r\n 0% {\r\n -webkit-transform: rotate(0);\r\n }\r\n 25% {\r\n -webkit-transform: rotate(90deg);\r\n }\r\n 50% {\r\n -webkit-transform: rotate(180deg);\r\n }\r\n 75% {\r\n -webkit-transform: rotate(270deg);\r\n }\r\n 100% {\r\n -webkit-transform: rotate(360deg);\r\n }\r\n}\r\n@-webkit-keyframes MessageMoveOut {\r\n 0% {\r\n max-height: 150px;\r\n opacity: 1;\r\n }\r\n to {\r\n max-height: 0;\r\n opacity: 0;\r\n }\r\n}\r\n@keyframes MessageMoveOut {\r\n 0% {\r\n max-height: 150px;\r\n opacity: 1;\r\n }\r\n to {\r\n max-height: 0;\r\n opacity: 0;\r\n }\r\n}\r\n@-webkit-keyframes MessageMoveIn {\r\n 0% {\r\n opacity: 0;\r\n transform: translateY(-100%);\r\n transform-origin: 0 0;\r\n }\r\n to {\r\n opacity: 1;\r\n transform: translateY(0);\r\n transform-origin: 0 0;\r\n }\r\n}\r\n@keyframes MessageMoveIn {\r\n 0% {\r\n opacity: 0;\r\n transform: translateY(-100%);\r\n transform-origin: 0 0;\r\n }\r\n to {\r\n opacity: 1;\r\n transform: translateY(0);\r\n transform-origin: 0 0;\r\n }\r\n}\r\n@-webkit-keyframes MessageShake {\r\n 0%,\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n 25%,\r\n 75% {\r\n opacity: 0.75;\r\n transform: translateX(-4px);\r\n }\r\n 50% {\r\n opacity: 0.25;\r\n transform: translateX(4px);\r\n }\r\n}\r\n@keyframes MessageShake {\r\n 0%,\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n 25%,\r\n 75% {\r\n opacity: 0.75;\r\n transform: translateX(-4px);\r\n }\r\n 50% {\r\n opacity: 0.25;\r\n transform: translateX(4px);\r\n }\r\n}\r\n";
const QmsgCSS = {
css: `
${css_text$1}
${css_text}
`,
getStyleElement() {
const $style = document.createElement("style");
$style.setAttribute("type", "text/css");
$style.setAttribute("data-type", QmsgDefaultConfig.PLUGIN_NAME);
QmsgUtils.setSafeHTML($style, QmsgCSS.css);
return $style;
},
};
class QmsgMsg {
timeId = void 0;
startTime;
endTime;
setting;
uuid;
state;
repeatNum;
$Qmsg;
constructor(config, uuid) {
this.timeId = void 0;
this.startTime = Date.now();
this.endTime = null;
this.setting = QmsgUtils.toDynamicObject(QmsgDefaultConfig.config, config, QmsgDefaultConfig.INS_DEFAULT);
this.uuid = uuid;
this.state = "opening";
this.$Qmsg = document.createElement("div");
this.repeatNum = 1;
this.detectionType();
this.init();
const consoleLogContent =
typeof this.setting.consoleLogContent === "function"
? this.setting.consoleLogContent(this)
: this.setting.consoleLogContent;
if (consoleLogContent) {
console.log(this.setting.content);
}
if (typeof this.setting.afterRender === "function") {
this.setting.afterRender(this);
}
}
getSetting() {
return this.setting;
}
getRepeatNum() {
return this.repeatNum;
}
setRepeatNum(num) {
this.repeatNum = num;
}
setRepeatNumIncreasing() {
this.repeatNum++;
}
init() {
const QmsgContext = this;
if (this.setting.customClass && typeof this.setting.customClass === "string") {
this.$Qmsg.classList.add(this.setting.customClass);
}
const $svg = QmsgIcon[this.setting.type || "info"];
let contentClassName = QmsgUtils.getNameSpacify("content-" + this.setting.type || "info");
if (this.setting.showClose) {
contentClassName += " " + QmsgUtils.getNameSpacify("content-with-close");
}
const content = this.setting.content || "";
let extraCloseIconClassName = "";
const $closeSvg = QmsgHeaderCloseIcon;
if (this.setting.showMoreContent) {
contentClassName += "qmsg-show-more-content";
extraCloseIconClassName += "qmsg-show-more-content";
}
let $closeIcon = "";
if (this.setting.showClose) {
$closeIcon = `<i class="qmsg-icon qmsg-icon-close ${extraCloseIconClassName}">${$closeSvg}</i>`;
}
const $content = document.createElement("span");
const $positionClassName = QmsgUtils.getNameSpacify("data-position", this.setting.position.toLowerCase());
const isHTML = this.setting.isHTML;
if (isHTML) {
QmsgUtils.setSafeHTML($content, content);
} else {
$content.innerText = content;
}
if (this.setting.isLimitWidth) {
let limitWidthNum = this.setting.limitWidthNum;
if (typeof limitWidthNum === "string") {
if (QmsgUtils.isNumber(limitWidthNum)) {
limitWidthNum = limitWidthNum + "px";
}
} else {
limitWidthNum = limitWidthNum.toString() + "px";
}
$content.style.maxWidth = limitWidthNum;
$content.style.width = limitWidthNum;
if (this.setting.limitWidthWrap === "no-wrap") {
$content.style.whiteSpace = "nowrap";
} else if (this.setting.limitWidthWrap === "ellipsis") {
$content.style.whiteSpace = "nowrap";
$content.style.overflow = "hidden";
$content.style.textOverflow = "ellipsis";
} else if (this.setting.limitWidthWrap === "wrap") {
$content.style.whiteSpace = "";
}
}
QmsgUtils.setSafeHTML(
this.$Qmsg,
`
<div class="qmsg-content">
<div class="${contentClassName}">
${this.setting.showIcon ? `<i class="qmsg-icon">${$svg}</i>` : ""}
${$content.outerHTML}
${$closeIcon}
</div>
</div>
`
);
const $contentContainer = this.$Qmsg.querySelector(".qmsg-content");
this.$Qmsg.classList.add(QmsgUtils.getNameSpacify("item"));
this.$Qmsg.setAttribute(QmsgUtils.getNameSpacify("uuid"), this.uuid);
let $shadowContainer;
let $shadowRoot;
let $wrapper;
$shadowContainer = document.querySelector(".qmsg-shadow-container");
$shadowRoot = this.setting.useShadowRoot ? $shadowContainer?.shadowRoot : $shadowContainer;
if (!$shadowContainer) {
$shadowContainer = document.createElement("div");
$shadowContainer.className = "qmsg-shadow-container";
if (this.setting.useShadowRoot) {
$shadowRoot = $shadowContainer.attachShadow({
mode: this.setting.shadowRootMode,
});
} else {
$shadowRoot = $shadowContainer;
}
$shadowRoot.appendChild(QmsgCSS.getStyleElement());
if (this.setting.style != null) {
const __$ownStyle__ = document.createElement("style");
__$ownStyle__.setAttribute("type", "text/css");
__$ownStyle__.setAttribute("data-id", this.uuid);
QmsgUtils.setSafeHTML(__$ownStyle__, this.setting.style);
$contentContainer.insertAdjacentElement("afterend", __$ownStyle__);
}
this.setting.parent.appendChild($shadowContainer);
}
if ($shadowRoot == null) {
throw new Error("QmsgInst " + QmsgDefaultConfig.PLUGIN_NAME + " $shadowRoot is null");
}
$wrapper = $shadowRoot.querySelector(`.${QmsgDefaultConfig.NAMESPACE}.${$positionClassName}`);
if (!$wrapper) {
$wrapper = document.createElement("div");
$wrapper.classList.add(
QmsgDefaultConfig.NAMESPACE,
QmsgUtils.getNameSpacify("wrapper"),
QmsgUtils.getNameSpacify("is-initialized"),
$positionClassName
);
$shadowRoot.appendChild($wrapper);
}
if (this.setting.showReverse) {
$wrapper.style.flexDirection = "column-reverse";
} else {
$wrapper.style.flexDirection = "column";
}
let zIndex = this.setting.zIndex;
if (typeof zIndex === "function") {
zIndex = zIndex();
}
if (!isNaN(zIndex)) {
$wrapper.style.zIndex = zIndex.toString();
}
$wrapper.appendChild(this.$Qmsg);
this.setState(this.$Qmsg, "opening");
if (this.setting.showClose) {
const $closeIcon2 = this.$Qmsg.querySelector(".qmsg-icon-close");
if ($closeIcon2) {
$closeIcon2.addEventListener("click", (_event) => {
QmsgContext.close();
});
}
}
const animationendEvent = (_event) => {
const animationNameValue = QmsgAnimation.getStyleAnimationNameValue(QmsgContext.$Qmsg);
if (animationNameValue === QmsgAnimation.$state.closing) {
QmsgContext.endTime = Date.now();
QmsgContext.destroy();
}
QmsgAnimation.setStyleAnimationName(QmsgContext.$Qmsg);
};
QmsgAnimation.$name.endNameList.forEach(function (animationendName) {
QmsgContext.$Qmsg.addEventListener(animationendName, animationendEvent);
});
if (this.setting.autoClose && this.setting.listenEventToPauseAutoClose) {
this.resetAutoCloseTimer();
const enterEvent = (_event) => {
this.clearAutoCloseTimer();
};
const leaveEvent = (_event) => {
if (this.timeId != null) {
console.warn("QmsgInst timeId is not null,mouseenter may be not first trigger,timeId:" + this.timeId);
return;
}
this.startAutoCloseTimer();
};
let isRemoveMouseEvent = false;
this.$Qmsg.addEventListener("mouseenter", enterEvent);
this.$Qmsg.addEventListener("mouseleave", leaveEvent);
this.$Qmsg.addEventListener("touchstart", (evt) => {
if (!isRemoveMouseEvent) {
isRemoveMouseEvent = true;
this.$Qmsg.removeEventListener("mouseenter", enterEvent);
this.$Qmsg.removeEventListener("mouseleave", leaveEvent);
}
enterEvent();
});
this.$Qmsg.addEventListener("touchend", leaveEvent);
this.$Qmsg.addEventListener("touchcancel", leaveEvent);
}
}
detectionType() {
if (this.setting.timeout != null && typeof this.setting.timeout === "string") {
this.setting.timeout = parseInt(this.setting.timeout);
}
if (isNaN(this.setting.timeout)) {
this.setting.timeout = QmsgDefaultConfig.config.timeout;
}
if (
!(
this.setting.timeout != null &&
parseInt(this.setting.timeout.toString()) >= 0 &&
parseInt(this.setting.timeout.toString()) <= Number.MAX_VALUE
)
) {
this.setting.timeout = QmsgDefaultConfig.config.timeout;
}
if (typeof this.setting.zIndex === "function") {
this.setting.zIndex = this.setting.zIndex();
}
if (this.setting.zIndex != null && typeof this.setting.zIndex === "string") {
this.setting.zIndex = parseInt(this.setting.zIndex);
}
if (isNaN(this.setting.zIndex)) {
this.setting.zIndex =
typeof QmsgDefaultConfig.config.zIndex === "function"
? QmsgDefaultConfig.config.zIndex()
: QmsgDefaultConfig.config.zIndex;
}
}
setState(element, state) {
if (!state || !QmsgAnimation.$state[state]) return;
this.state = state;
QmsgAnimation.setStyleAnimationName(element, QmsgAnimation.$state[state]);
}
setMsgCount() {
const countClassName = QmsgUtils.getNameSpacify("count");
const wrapperClassName = `div.${QmsgUtils.getNameSpacify("data-position", this.setting.position.toLowerCase())} [class^="qmsg-content-"]`;
const $content = this.$Qmsg.querySelector(wrapperClassName);
if (!$content) {
throw new Error("QmsgInst $content is null");
}
let $count = $content.querySelector("." + countClassName);
if (!$count) {
$count = document.createElement("span");
$count.classList.add(countClassName);
$content.appendChild($count);
}
const repeatNum = this.getRepeatNum();
QmsgUtils.setSafeHTML($count, repeatNum.toString());
QmsgAnimation.setStyleAnimationName($count);
QmsgAnimation.setStyleAnimationName($count, "MessageShake");
this.resetAutoCloseTimer();
}
clearAutoCloseTimer() {
QmsgUtils.clearTimeout(this.timeId);
this.timeId = void 0;
this.startTime = null;
this.endTime = null;
}
startAutoCloseTimer() {
if (this.setting.autoClose && this.setting.listenEventToPauseAutoClose) {
this.startTime = Date.now();
this.endTime = null;
this.timeId = QmsgUtils.setTimeout(() => {
this.close();
}, this.setting.timeout);
}
}
resetAutoCloseTimer() {
this.clearAutoCloseTimer();
this.startAutoCloseTimer();
}
close() {
this.setState(this.$Qmsg, "closing");
if (QmsgAnimation.CAN_ANIMATION) {
QmsgInstStorage.remove(this.uuid);
} else {
this.destroy();
}
const onCloseCallBack = this.setting.onClose;
if (onCloseCallBack && typeof onCloseCallBack === "function") {
onCloseCallBack.call(this);
}
}
destroy() {
this.endTime = Date.now();
this.$Qmsg.remove();
QmsgUtils.clearTimeout(this.timeId);
QmsgInstStorage.remove(this.uuid);
this.timeId = void 0;
}
get $content() {
const $content = this.$Qmsg.querySelector("div[class^=qmsg-content-] > span");
if (!$content) {
throw new Error("QmsgInst $content is null");
}
return $content;
}
setText(text) {
const $content = this.$content;
$content.innerText = text;
this.setting.content = text;
}
setHTML(text) {
const $content = this.$content;
QmsgUtils.setSafeHTML($content, text);
this.setting.content = text;
}
}
function QmsgInstHandler(config = {}) {
const optionString = JSON.stringify(config);
let findQmsgItemInfo = QmsgInstStorage.insInfoList.find((item) => {
return item.config === optionString;
});
let qmsgInst = findQmsgItemInfo?.instance;
if (qmsgInst == null) {
const uuid = QmsgUtils.getUUID();
const qmsgInstStorageInfo = {
uuid,
config: optionString,
instance: new QmsgMsg(config, uuid),
};
QmsgInstStorage.insInfoList.push(qmsgInstStorageInfo);
const QmsgListLength = QmsgInstStorage.insInfoList.length;
const maxNums = qmsgInstStorageInfo.instance.getSetting().maxNums;
if (QmsgListLength > maxNums) {
for (let index = 0; index < QmsgListLength - maxNums; index++) {
const item = QmsgInstStorage.insInfoList[index];
item && item.instance.getSetting().autoClose && item.instance.close();
}
}
findQmsgItemInfo = qmsgInstStorageInfo;
qmsgInst = qmsgInstStorageInfo.instance;
} else {
if (!qmsgInst.getRepeatNum()) {
qmsgInst.setRepeatNum(2);
} else {
if (qmsgInst.getRepeatNum() >= 99);
else {
qmsgInst.setRepeatNumIncreasing();
}
}
qmsgInst.setMsgCount();
}
if (qmsgInst) {
qmsgInst.$Qmsg.setAttribute("data-count", qmsgInst?.getRepeatNum().toString());
} else {
throw new Error("QmsgInst is null");
}
return qmsgInst;
}
const QmsgEvent = {
visibilitychange: {
eventConfig: {
callback() {
if (document.visibilityState === "visible") {
for (let index = 0; index < QmsgInstStorage.insInfoList.length; index++) {
const qmsgInst = QmsgInstStorage.insInfoList[index];
if (
qmsgInst.instance.setting.type !== "loading" &&
qmsgInst.instance.endTime == null &&
qmsgInst.instance.startTime != null &&
Date.now() - qmsgInst.instance.startTime >= qmsgInst.instance.getSetting().timeout
) {
qmsgInst.instance.close();
}
}
}
},
option: {
capture: true,
},
},
addEvent() {
if ("visibilityState" in document) {
document.addEventListener(
"visibilitychange",
QmsgEvent.visibilitychange.eventConfig.callback,
QmsgEvent.visibilitychange.eventConfig.option
);
} else {
console.error("Qmsg addEvent visibilityState not support");
}
},
removeEvent() {
document.removeEventListener(
"visibilitychange",
QmsgEvent.visibilitychange.eventConfig.callback,
QmsgEvent.visibilitychange.eventConfig.option
);
},
},
};
const version$3 = "1.5.0";
CompatibleProcessing();
class Qmsg {
$data;
$eventUtils;
constructor(config) {
this.$data = {
version: version$3,
config: QmsgDefaultConfig,
icon: QmsgIcon,
instanceStorage: QmsgInstStorage,
};
this.$eventUtils = QmsgEvent;
this.$eventUtils.visibilitychange.addEvent();
this.config(config);
}
config(config) {
if (config == null) return;
if (typeof config !== "object") return;
QmsgDefaultConfig.INS_DEFAULT = null;
QmsgDefaultConfig.INS_DEFAULT = config;
}
info(content, config) {
const params = QmsgUtils.mergeArgs(content, config);
params.type = "info";
return QmsgInstHandler.call(this, params);
}
warning(content, config) {
const params = QmsgUtils.mergeArgs(content, config);
params.type = "warning";
return QmsgInstHandler.call(this, params);
}
success(content, config) {
const params = QmsgUtils.mergeArgs(content, config);
params.type = "success";
return QmsgInstHandler.call(this, params);
}
error(content, config) {
const params = QmsgUtils.mergeArgs(content, config);
params.type = "error";
return QmsgInstHandler.call(this, params);
}
loading(content, config) {
const params = QmsgUtils.mergeArgs(content, config);
params.type = "loading";
params.autoClose = false;
return QmsgInstHandler.call(this, params);
}
remove(uuid) {
QmsgInstStorage.remove(uuid);
}
closeAll() {
for (let index = QmsgInstStorage.insInfoList.length - 1; index >= 0; index--) {
const item = QmsgInstStorage.insInfoList[index];
item && item.instance && item.instance.close();
}
}
}
const qmsg = new Qmsg();
let WindowApi$1 = class WindowApi {
defaultApi = {
document,
window,
globalThis,
self,
top,
setTimeout: globalThis.setTimeout.bind(globalThis),
setInterval: globalThis.setInterval.bind(globalThis),
clearTimeout: globalThis.clearTimeout.bind(globalThis),
clearInterval: globalThis.clearInterval.bind(globalThis),
};
api;
constructor(option) {
if (option) {
if (option.globalThis == null) {
option.globalThis = option.window;
}
if (option.self == null) {
option.self = option.window;
}
}
if (!option) {
option = Object.assign({}, this.defaultApi);
}
this.api = Object.assign({}, option);
}
get document() {
return this.api.document;
}
get window() {
return this.api.window;
}
get globalThis() {
return this.api.globalThis;
}
get self() {
return this.api.self;
}
get top() {
return this.api.top;
}
get setTimeout() {
return this.api.setTimeout;
}
get clearTimeout() {
return this.api.clearTimeout;
}
get setInterval() {
return this.api.setInterval;
}
get clearInterval() {
return this.api.clearInterval;
}
};
const createCache$2 = (lastNumberWeakMap) => {
return (collection, nextNumber) => {
lastNumberWeakMap.set(collection, nextNumber);
return nextNumber;
};
};
const MAX_SAFE_INTEGER$2 = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
const TWO_TO_THE_POWER_OF_TWENTY_NINE$2 = 536870912;
const TWO_TO_THE_POWER_OF_THIRTY$2 = TWO_TO_THE_POWER_OF_TWENTY_NINE$2 * 2;
const createGenerateUniqueNumber$2 = (cache2, lastNumberWeakMap) => {
return (collection) => {
const lastNumber = lastNumberWeakMap.get(collection);
let nextNumber =
lastNumber === void 0 ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY$2 ? lastNumber + 1 : 0;
if (!collection.has(nextNumber)) {
return cache2(collection, nextNumber);
}
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE$2) {
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY$2);
}
return cache2(collection, nextNumber);
}
if (collection.size > MAX_SAFE_INTEGER$2) {
throw new Error(
"Congratulations, you created a collection of unique numbers which uses all available integers!"
);
}
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER$2);
}
return cache2(collection, nextNumber);
};
};
const LAST_NUMBER_WEAK_MAP$2 = new WeakMap();
const cache$2 = createCache$2(LAST_NUMBER_WEAK_MAP$2);
const generateUniqueNumber$2 = createGenerateUniqueNumber$2(cache$2, LAST_NUMBER_WEAK_MAP$2);
const isMessagePort$2 = (sender) => {
return typeof sender.start === "function";
};
const PORT_MAP$2 = new WeakMap();
const extendBrokerImplementation$2 = (partialBrokerImplementation) => ({
...partialBrokerImplementation,
connect: ({ call }) => {
return async () => {
const { port1, port2 } = new MessageChannel();
const portId = await call("connect", { port: port1 }, [port1]);
PORT_MAP$2.set(port2, portId);
return port2;
};
},
disconnect: ({ call }) => {
return async (port) => {
const portId = PORT_MAP$2.get(port);
if (portId === void 0) {
throw new Error("The given port is not connected.");
}
await call("disconnect", { portId });
};
},
isSupported: ({ call }) => {
return () => call("isSupported");
},
});
const ONGOING_REQUESTS$2 = new WeakMap();
const createOrGetOngoingRequests$2 = (sender) => {
if (ONGOING_REQUESTS$2.has(sender)) {
return ONGOING_REQUESTS$2.get(sender);
}
const ongoingRequests = new Map();
ONGOING_REQUESTS$2.set(sender, ongoingRequests);
return ongoingRequests;
};
const createBroker$2 = (brokerImplementation) => {
const fullBrokerImplementation = extendBrokerImplementation$2(brokerImplementation);
return (sender) => {
const ongoingRequests = createOrGetOngoingRequests$2(sender);
sender.addEventListener("message", ({ data: message }) => {
const { id } = message;
if (id !== null && ongoingRequests.has(id)) {
const { reject, resolve } = ongoingRequests.get(id);
ongoingRequests.delete(id);
if (message.error === void 0) {
resolve(message.result);
} else {
reject(new Error(message.error.message));
}
}
});
if (isMessagePort$2(sender)) {
sender.start();
}
const call = (method, params = null, transferables = []) => {
return new Promise((resolve, reject) => {
const id = generateUniqueNumber$2(ongoingRequests);
ongoingRequests.set(id, { reject, resolve });
if (params === null) {
sender.postMessage({ id, method }, transferables);
} else {
sender.postMessage({ id, method, params }, transferables);
}
});
};
const notify = (method, params, transferables = []) => {
sender.postMessage({ id: null, method, params }, transferables);
};
let functions = {};
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
functions = { ...functions, [key]: handler({ call, notify }) };
}
return { ...functions };
};
};
const scheduledIntervalsState$2 = new Map([[0, null]]);
const scheduledTimeoutsState$2 = new Map([[0, null]]);
const wrap$2 = createBroker$2({
clearInterval: ({ call }) => {
return (timerId) => {
if (typeof scheduledIntervalsState$2.get(timerId) === "symbol") {
scheduledIntervalsState$2.set(timerId, null);
call("clear", { timerId, timerType: "interval" }).then(() => {
scheduledIntervalsState$2.delete(timerId);
});
}
};
},
clearTimeout: ({ call }) => {
return (timerId) => {
if (typeof scheduledTimeoutsState$2.get(timerId) === "symbol") {
scheduledTimeoutsState$2.set(timerId, null);
call("clear", { timerId, timerType: "timeout" }).then(() => {
scheduledTimeoutsState$2.delete(timerId);
});
}
};
},
setInterval: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$2(scheduledIntervalsState$2);
scheduledIntervalsState$2.set(timerId, symbol);
const schedule = () =>
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "interval",
}).then(() => {
const state = scheduledIntervalsState$2.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
func(...args);
if (scheduledIntervalsState$2.get(timerId) === symbol) {
schedule();
}
}
});
schedule();
return timerId;
};
},
setTimeout: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$2(scheduledTimeoutsState$2);
scheduledTimeoutsState$2.set(timerId, symbol);
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "timeout",
}).then(() => {
const state = scheduledTimeoutsState$2.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
scheduledTimeoutsState$2.delete(timerId);
func(...args);
}
});
return timerId;
};
},
});
const load$2 = (url) => {
const worker2 = new Worker(url);
return wrap$2(worker2);
};
const createLoadOrReturnBroker$2 = (loadBroker, worker2) => {
let broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker2], { type: "application/javascript; charset=utf-8" });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
const worker$2 = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`;
const loadOrReturnBroker$2 = createLoadOrReturnBroker$2(load$2, worker$2);
const clearInterval$1$1 = (timerId) => loadOrReturnBroker$2().clearInterval(timerId);
const clearTimeout$1$2 = (timerId) => loadOrReturnBroker$2().clearTimeout(timerId);
const setInterval$1$1 = (...args) => loadOrReturnBroker$2().setInterval(...args);
const setTimeout$1$2 = (...args) => loadOrReturnBroker$2().setTimeout(...args);
const CommonUtils = {
windowApi: new WindowApi$1({
document,
window,
top,
setTimeout,
clearTimeout,
setInterval,
clearInterval,
}),
isShow($el) {
return Boolean($el.getClientRects().length);
},
createSafeHTML(text) {
if (window.trustedTypes) {
const policy = window.trustedTypes.createPolicy("safe-innerHTML", {
createHTML: (html) => html,
});
return policy.createHTML(text);
} else {
return text;
}
},
setSafeHTML($el, text) {
$el.innerHTML = this.createSafeHTML(text);
},
forceShow($el) {
const dupNode = $el.cloneNode(true);
dupNode.setAttribute("style", "visibility: hidden !important;display:block !important;");
this.windowApi.document.documentElement.appendChild(dupNode);
return {
recovery() {
dupNode.remove();
},
};
},
getStyleValue(element, styleName) {
let view = null;
let styles = null;
if (element instanceof CSSStyleDeclaration) {
styles = element;
} else {
view = element.ownerDocument.defaultView;
if (!view || !view.opener) {
view = window;
}
styles = view.getComputedStyle(element);
}
const value = parseFloat(styles[styleName]);
if (isNaN(value)) {
return 0;
} else {
return value;
}
},
isWin(target) {
if (typeof target !== "object") {
return false;
}
if (target instanceof Node) {
return false;
}
if (target === globalThis) {
return true;
}
if (target === window) {
return true;
}
if (target === self) {
return true;
}
if (target === globalThis) {
return true;
}
if (target === window) {
return true;
}
if (target === self) {
return true;
}
if (typeof unsafeWindow !== "undefined" && target === unsafeWindow) {
return true;
}
if (target?.Math?.toString() !== "[object Math]") {
return false;
}
return true;
},
isDOM($el) {
return $el instanceof Node;
},
delete(target, propName) {
if (typeof Reflect === "object" && Reflect != null && Reflect.deleteProperty) {
return Reflect.deleteProperty(target, propName);
} else {
delete target[propName];
}
},
setTimeout(callback, timeout = 0) {
try {
return setTimeout$1$2(callback, timeout);
} catch {
return this.windowApi.setTimeout(callback, timeout);
}
},
clearTimeout(timeId) {
try {
if (timeId != null) {
clearTimeout$1$2(timeId);
}
} catch {
} finally {
this.windowApi.clearTimeout(timeId);
}
},
setInterval(callback, timeout = 0) {
try {
return setInterval$1$1(callback, timeout);
} catch {
return this.windowApi.setInterval(callback, timeout);
}
},
clearInterval(timeId) {
try {
if (timeId != null) {
clearInterval$1$1(timeId);
}
} catch {
} finally {
this.windowApi.clearInterval(timeId);
}
},
isNodeList($ele) {
return Array.isArray($ele) || $ele instanceof NodeList;
},
getAnimationEndNameList() {
return ["webkitAnimationEnd", "mozAnimationEnd", "MSAnimationEnd", "oanimationend", "animationend"];
},
getTransitionEndNameList() {
return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
},
};
const version$2 = "1.7.0";
const GlobalData = {
domEventSymbol: Symbol("events_" + (((1 + Math.random()) * 65536) | 0).toString(16).substring(1)),
};
class ElementSelector {
windowApi;
constructor(windowApiOption) {
this.windowApi = new WindowApi$1(windowApiOption);
}
selector(selector, parent) {
return this.selectorAll(selector, parent)[0];
}
selectorAll(selector, parent) {
const context = this;
parent = parent || context.windowApi.document;
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return $ele?.innerHTML?.trim() === "";
});
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return ($ele?.textContent || $ele?.innerText)?.includes(text);
});
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return Boolean(($ele?.textContent || $ele?.innerText)?.match(regexp));
});
} else {
return Array.from(parent.querySelectorAll(selector));
}
}
matches($el, selector) {
selector = selector.trim();
if ($el == null) {
return false;
}
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return $el.matches(selector) && $el?.innerHTML?.trim() === "";
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && content?.includes(text);
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && Boolean(content?.match(regexp));
} else {
return $el.matches(selector);
}
}
closest($el, selector) {
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
const $closest = $el?.closest(selector);
if ($closest && $closest?.innerHTML?.trim() === "") {
return $closest;
}
return null;
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.includes(text)) {
return $closest;
}
}
return null;
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.match(regexp)) {
return $closest;
}
}
return null;
} else {
const $closest = $el?.closest(selector);
return $closest;
}
}
}
const elementSelector = new ElementSelector();
const isDOM = function ($el) {
return $el instanceof Node;
};
let Utils$1 = class Utils {
windowApi;
constructor(option) {
this.windowApi = new WindowApi$1(option);
}
isJQuery(target) {
let result = false;
if (typeof jQuery === "object" && target instanceof jQuery) {
result = true;
}
if (target == null) {
return false;
}
if (typeof target === "object") {
const jQueryProps = [
"add",
"addBack",
"addClass",
"after",
"ajaxComplete",
"ajaxError",
"ajaxSend",
"ajaxStart",
"ajaxStop",
"ajaxSuccess",
"animate",
"append",
"appendTo",
"attr",
"before",
"bind",
"blur",
"change",
"children",
"clearQueue",
"click",
"clone",
"closest",
"constructor",
"contents",
"contextmenu",
"css",
"data",
"dblclick",
"delay",
"delegate",
"dequeue",
"each",
"empty",
"end",
"eq",
"extend",
"fadeIn",
"fadeOut",
"fadeTo",
"fadeToggle",
"filter",
"find",
"first",
"focus",
"focusin",
"focusout",
"get",
"has",
"hasClass",
"height",
"hide",
"hover",
"html",
"index",
"init",
"innerHeight",
"innerWidth",
"insertAfter",
"insertBefore",
"is",
"jquery",
"keydown",
"keypress",
"keyup",
"last",
"load",
"map",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseout",
"mouseover",
"mouseup",
"next",
"nextAll",
"not",
"off",
"offset",
"offsetParent",
"on",
"one",
"outerHeight",
"outerWidth",
"parent",
"parents",
"position",
"prepend",
"prependTo",
"prev",
"prevAll",
"prevUntil",
"promise",
"prop",
"pushStack",
"queue",
"ready",
"remove",
"removeAttr",
"removeClass",
"removeData",
"removeProp",
"replaceAll",
"replaceWith",
"resize",
"scroll",
"scrollLeft",
"scrollTop",
"select",
"show",
"siblings",
"slice",
"slideDown",
"slideToggle",
"slideUp",
"sort",
"splice",
"text",
"toArray",
"toggle",
"toggleClass",
"trigger",
"triggerHandler",
"unbind",
"width",
"wrap",
];
for (const jQueryPropsName of jQueryProps) {
if (!(jQueryPropsName in target)) {
result = false;
break;
} else {
result = true;
}
}
}
return result;
}
assign(target = {}, source = {}, isAdd = false) {
const UtilsContext = this;
if (Array.isArray(source)) {
const canTraverse = source.filter((item) => {
return typeof item === "object";
});
if (!canTraverse.length) {
return source;
}
}
if (source == null) {
return target;
}
if (target == null) {
target = {};
}
if (isAdd) {
for (const sourceKeyName in source) {
const targetKeyName = sourceKeyName;
const targetValue = Reflect.get(target, targetKeyName);
const sourceValue = Reflect.get(source, sourceKeyName);
if (
typeof sourceValue === "object" &&
sourceValue != null &&
sourceKeyName in target &&
!isDOM(sourceValue)
) {
Reflect.set(target, sourceKeyName, UtilsContext.assign(targetValue, sourceValue, isAdd));
continue;
}
Reflect.set(target, sourceKeyName, sourceValue);
}
} else {
for (const targetKeyName in target) {
if (targetKeyName in source) {
const targetValue = Reflect.get(target, targetKeyName);
const sourceValue = Reflect.get(source, targetKeyName);
if (
typeof sourceValue === "object" &&
sourceValue != null &&
!isDOM(sourceValue) &&
Object.keys(sourceValue).length
) {
Reflect.set(target, targetKeyName, UtilsContext.assign(targetValue, sourceValue, isAdd));
continue;
}
Reflect.set(target, targetKeyName, sourceValue);
}
}
}
return target;
}
mutationObserver(target, observer_config) {
const that = this;
const default_obverser_config = {
callback: () => {},
config: {
subtree: void 0,
childList: void 0,
attributes: void 0,
attributeFilter: void 0,
attributeOldValue: void 0,
characterData: void 0,
characterDataOldValue: void 0,
},
immediate: false,
};
observer_config = that.assign(default_obverser_config, observer_config);
const windowMutationObserver =
this.windowApi.window.MutationObserver ||
this.windowApi.window.webkitMutationObserver ||
this.windowApi.window.MozMutationObserver;
const mutationObserver = new windowMutationObserver(function (mutations, observer) {
if (typeof observer_config.callback === "function") {
observer_config.callback(mutations, observer);
}
});
if (Array.isArray(target) || target instanceof NodeList) {
target.forEach((item) => {
mutationObserver.observe(item, observer_config.config);
});
} else if (that.isJQuery(target)) {
target.each((_, item) => {
mutationObserver.observe(item, observer_config.config);
});
} else {
mutationObserver.observe(target, observer_config.config);
}
if (observer_config.immediate) {
if (typeof observer_config.callback === "function") {
observer_config.callback([], mutationObserver);
}
}
return mutationObserver;
}
};
const utils$2 = new Utils$1();
class ElementWait extends ElementSelector {
windowApi;
constructor(windowApiOption) {
super(windowApiOption);
this.windowApi = new WindowApi$1(windowApiOption);
}
wait(checkFn, timeout, parent) {
const UtilsContext = this;
const __timeout__ = typeof timeout === "number" ? timeout : 0;
return new Promise((resolve) => {
const observer = utils$2.mutationObserver(parent || UtilsContext.windowApi.document, {
config: {
subtree: true,
childList: true,
attributes: true,
},
immediate: true,
callback(_, __observer__) {
const result = checkFn();
if (result.success) {
if (typeof __observer__?.disconnect === "function") {
__observer__.disconnect();
}
resolve(result.data);
}
},
});
if (__timeout__ > 0) {
CommonUtils.setTimeout(() => {
if (typeof observer?.disconnect === "function") {
observer.disconnect();
}
resolve(null);
}, __timeout__);
}
});
}
waitNode(...args) {
args = args.filter((arg) => arg !== void 0);
const UtilsContext = this;
const selector = args[0];
let parent = UtilsContext.windowApi.document;
let timeout = 0;
if (typeof args[0] !== "string" && !Array.isArray(args[0]) && typeof args[0] !== "function") {
throw new TypeError("Utils.waitNode 第一个参数必须是string|string[]|Function");
}
if (args.length === 1);
else if (args.length === 2) {
const secondParam = args[1];
if (typeof secondParam === "number") {
timeout = secondParam;
} else if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
} else {
throw new TypeError("Utils.waitNode 第二个参数必须是number|Node");
}
} else if (args.length === 3) {
const secondParam = args[1];
const thirdParam = args[2];
if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
if (typeof thirdParam === "number") {
timeout = thirdParam;
} else {
throw new TypeError("Utils.waitNode 第三个参数必须是number");
}
} else {
throw new TypeError("Utils.waitNode 第二个参数必须是Node");
}
} else {
throw new TypeError("Utils.waitNode 参数个数错误");
}
function getNode() {
if (Array.isArray(selector)) {
const result = [];
for (let index = 0; index < selector.length; index++) {
const node = elementSelector.selector(selector[index]);
if (node) {
result.push(node);
}
}
if (result.length === selector.length) {
return result;
}
} else if (typeof selector === "function") {
return selector();
} else {
return elementSelector.selector(selector, parent);
}
}
return UtilsContext.wait(
() => {
const node = getNode();
if (node) {
return {
success: true,
data: node,
};
} else {
return {
success: false,
data: node,
};
}
},
timeout,
parent
);
}
waitAnyNode(...args) {
args = args.filter((arg) => arg !== void 0);
const UtilsContext = this;
const selectorList = args[0];
let parent = UtilsContext.windowApi.document;
let timeout = 0;
if (typeof args[0] !== "object" && !Array.isArray(args[0])) {
throw new TypeError("Utils.waitAnyNode 第一个参数必须是string[]");
}
if (args.length === 1);
else if (args.length === 2) {
const secondParam = args[1];
if (typeof secondParam === "number") {
timeout = secondParam;
} else if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
} else {
throw new TypeError("Utils.waitAnyNode 第二个参数必须是number|Node");
}
} else if (args.length === 3) {
const secondParam = args[1];
const thirdParam = args[2];
if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
if (typeof thirdParam === "number") {
timeout = thirdParam;
} else {
throw new TypeError("Utils.waitAnyNode 第三个参数必须是number");
}
} else {
throw new TypeError("Utils.waitAnyNode 第二个参数必须是Node");
}
} else {
throw new TypeError("Utils.waitAnyNode 参数个数错误");
}
const promiseList = selectorList.map((selector) => {
return UtilsContext.waitNode(selector, parent, timeout);
});
return Promise.any(promiseList);
}
waitNodeList(...args) {
args = args.filter((arg) => arg !== void 0);
const UtilsContext = this;
const selector = args[0];
let parent = UtilsContext.windowApi.document;
let timeout = 0;
if (typeof args[0] !== "string" && !Array.isArray(args[0])) {
throw new TypeError("Utils.waitNodeList 第一个参数必须是string|string[]");
}
if (args.length === 1);
else if (args.length === 2) {
const secondParam = args[1];
if (typeof secondParam === "number") {
timeout = secondParam;
} else if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
} else {
throw new TypeError("Utils.waitNodeList 第二个参数必须是number|Node");
}
} else if (args.length === 3) {
const secondParam = args[1];
const thirdParam = args[2];
if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
if (typeof thirdParam === "number") {
timeout = thirdParam;
} else {
throw new TypeError("Utils.waitNodeList 第三个参数必须是number");
}
} else {
throw new TypeError("Utils.waitNodeList 第二个参数必须是Node");
}
} else {
throw new TypeError("Utils.waitNodeList 参数个数错误");
}
function getNodeList() {
if (Array.isArray(selector)) {
const result = [];
for (let index = 0; index < selector.length; index++) {
const nodeList = elementSelector.selectorAll(selector[index], parent);
if (nodeList.length) {
result.push(nodeList);
}
}
if (result.length === selector.length) {
return result;
}
} else {
const nodeList = elementSelector.selectorAll(selector, parent);
if (nodeList.length) {
return nodeList;
}
}
}
return UtilsContext.wait(
() => {
const node = getNodeList();
if (node) {
return {
success: true,
data: node,
};
} else {
return {
success: false,
data: node,
};
}
},
timeout,
parent
);
}
waitAnyNodeList(...args) {
args = args.filter((arg) => arg !== void 0);
const UtilsContext = this;
const selectorList = args[0];
let parent = UtilsContext.windowApi.document;
let timeout = 0;
if (!Array.isArray(args[0])) {
throw new TypeError("Utils.waitAnyNodeList 第一个参数必须是string[]");
}
if (args.length === 1);
else if (args.length === 2) {
const secondParam = args[1];
if (typeof secondParam === "number") {
timeout = secondParam;
} else if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
} else {
throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是number|Node");
}
} else if (args.length === 3) {
const secondParam = args[1];
const thirdParam = args[2];
if (typeof secondParam === "object" && secondParam instanceof Node) {
parent = secondParam;
if (typeof thirdParam === "number") {
timeout = thirdParam;
} else {
throw new TypeError("Utils.waitAnyNodeList 第三个参数必须是number");
}
} else {
throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是Node");
}
} else {
throw new TypeError("Utils.waitAnyNodeList 参数个数错误");
}
const promiseList = selectorList.map((selector) => {
return UtilsContext.waitNodeList(selector, parent, timeout);
});
return Promise.any(promiseList);
}
}
new ElementWait();
class ElementAnimate extends ElementWait {
windowApi;
constructor(windowApiOption) {
super(windowApiOption);
this.windowApi = new WindowApi$1(windowApiOption);
}
animate(element, styles, duration = 1e3, callback = null) {
const context = this;
if (typeof element === "string") {
element = elementSelector.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
context.animate($ele, styles, duration, callback);
});
return;
}
if (typeof duration !== "number" || duration <= 0) {
throw new TypeError("duration must be a positive number");
}
if (typeof callback !== "function" && callback !== void 0) {
throw new TypeError("callback must be a function or null");
}
if (typeof styles !== "object" || styles === void 0) {
throw new TypeError("styles must be an object");
}
if (Object.keys(styles).length === 0) {
throw new Error("styles must contain at least one property");
}
const start = performance.now();
const from = {};
const to = {};
for (const prop in styles) {
from[prop] = element.style[prop] || context.windowApi.globalThis.getComputedStyle(element)[prop];
to[prop] = styles[prop];
}
const timer = CommonUtils.setInterval(function () {
const timePassed = performance.now() - start;
let progress = timePassed / duration;
if (progress > 1) {
progress = 1;
}
for (const prop in styles) {
element.style[prop] = from[prop] + (to[prop] - from[prop]) * progress + "px";
}
if (progress === 1) {
CommonUtils.clearInterval(timer);
if (callback) {
callback();
}
}
}, 10);
}
show(target, checkVisiblie = true) {
const context = this;
if (target == null) {
return;
}
if (typeof target === "string") {
target = elementSelector.selectorAll(target);
}
if (target instanceof NodeList || target instanceof Array) {
target = target;
for (const element of target) {
context.show(element, checkVisiblie);
}
} else {
target = target;
target.style.display = "";
if (checkVisiblie) {
if (!CommonUtils.isShow(target)) {
target.style.setProperty("display", "unset", "important");
}
}
}
}
hide(target, checkVisiblie = true) {
const context = this;
if (target == null) {
return;
}
if (typeof target === "string") {
target = elementSelector.selectorAll(target);
}
if (target instanceof NodeList || target instanceof Array) {
target = target;
for (const element of target) {
context.hide(element, checkVisiblie);
}
} else {
target = target;
target.style.display = "none";
if (checkVisiblie) {
if (CommonUtils.isShow(target)) {
target.style.setProperty("display", "none", "important");
}
}
}
}
fadeIn(element, duration = 400, callback) {
if (element == null) {
return;
}
const context = this;
if (typeof element === "string") {
element = elementSelector.selectorAll(element);
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
context.fadeIn($ele, duration, callback);
});
return;
}
element.style.opacity = "0";
element.style.display = "";
let start = null;
let timer = null;
function step(timestamp) {
if (!start) start = timestamp;
const progress = timestamp - start;
element = element;
element.style.opacity = Math.min(progress / duration, 1).toString();
if (progress < duration) {
context.windowApi.window.requestAnimationFrame(step);
} else {
if (callback && typeof callback === "function") {
callback();
}
context.windowApi.window.cancelAnimationFrame(timer);
}
}
timer = context.windowApi.window.requestAnimationFrame(step);
}
fadeOut(element, duration = 400, callback) {
const context = this;
if (element == null) {
return;
}
if (typeof element === "string") {
element = elementSelector.selectorAll(element);
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
context.fadeOut($ele, duration, callback);
});
return;
}
element.style.opacity = "1";
let start = null;
let timer = null;
function step(timestamp) {
if (!start) start = timestamp;
const progress = timestamp - start;
element = element;
element.style.opacity = Math.max(1 - progress / duration, 0).toString();
if (progress < duration) {
context.windowApi.window.requestAnimationFrame(step);
} else {
element.style.display = "none";
if (typeof callback === "function") {
callback();
}
context.windowApi.window.cancelAnimationFrame(timer);
}
}
timer = context.windowApi.window.requestAnimationFrame(step);
}
toggle(element, checkVisiblie) {
const context = this;
if (typeof element === "string") {
element = elementSelector.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
context.toggle($ele);
});
return;
}
if (context.windowApi.globalThis.getComputedStyle(element).getPropertyValue("display") === "none") {
context.show(element, checkVisiblie);
} else {
context.hide(element, checkVisiblie);
}
}
}
new ElementAnimate();
const OriginPrototype$1 = {
Object: {
defineProperty: Object.defineProperty,
},
};
class ElementEvent extends ElementAnimate {
windowApi;
constructor(windowApiOption) {
super(windowApiOption);
this.windowApi = new WindowApi$1(windowApiOption);
}
getAnimationEndNameList() {
return CommonUtils.getAnimationEndNameList();
}
getTransitionEndNameList() {
return CommonUtils.getTransitionEndNameList();
}
on(element, eventType, selector, callback, option) {
function getOption(args2, startIndex, option2) {
const currentParam = args2[startIndex];
if (typeof currentParam === "boolean") {
option2.capture = currentParam;
if (typeof args2[startIndex + 1] === "boolean") {
option2.once = args2[startIndex + 1];
}
if (typeof args2[startIndex + 2] === "boolean") {
option2.passive = args2[startIndex + 2];
}
} else if (
typeof currentParam === "object" &&
("capture" in currentParam ||
"once" in currentParam ||
"passive" in currentParam ||
"isComposedPath" in currentParam)
) {
option2.capture = currentParam.capture;
option2.once = currentParam.once;
option2.passive = currentParam.passive;
option2.isComposedPath = currentParam.isComposedPath;
}
return option2;
}
const that = this;
const args = arguments;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
let elementList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
elementList = [...element];
} else {
elementList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(
eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== "")
);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
}
let selectorList = [];
if (Array.isArray(selector)) {
selectorList = selectorList.concat(
selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== "")
);
} else if (typeof selector === "string") {
selectorList.push(selector);
}
let listenerCallBack = callback;
let listenerOption = {
capture: false,
once: false,
passive: false,
isComposedPath: false,
};
if (typeof selector === "function") {
listenerCallBack = selector;
listenerOption = getOption(args, 3, listenerOption);
} else {
listenerOption = getOption(args, 4, listenerOption);
}
function checkOptionOnceToRemoveEventListener() {
if (listenerOption.once) {
that.off(element, eventType, selector, callback, option);
}
}
elementList.forEach((elementItem) => {
function domUtilsEventCallBack(event) {
if (selectorList.length) {
let eventTarget = listenerOption.isComposedPath ? event.composedPath()[0] : event.target;
let totalParent = elementItem;
if (CommonUtils.isWin(totalParent)) {
if (totalParent === that.windowApi.document) {
totalParent = that.windowApi.document.documentElement;
}
}
const findValue = selectorList.find((selectorItem) => {
if (that.matches(eventTarget, selectorItem)) {
return true;
}
const $closestMatches = that.closest(eventTarget, selectorItem);
if ($closestMatches && totalParent?.contains($closestMatches)) {
eventTarget = $closestMatches;
return true;
}
return false;
});
if (findValue) {
try {
OriginPrototype$1.Object.defineProperty(event, "target", {
get() {
return eventTarget;
},
});
} catch {}
listenerCallBack.call(eventTarget, event, eventTarget);
checkOptionOnceToRemoveEventListener();
}
} else {
listenerCallBack.call(elementItem, event);
checkOptionOnceToRemoveEventListener();
}
}
eventTypeList.forEach((eventName) => {
elementItem.addEventListener(eventName, domUtilsEventCallBack, listenerOption);
const elementEvents = Reflect.get(elementItem, GlobalData.domEventSymbol) || {};
elementEvents[eventName] = elementEvents[eventName] || [];
elementEvents[eventName].push({
selector: selectorList,
option: listenerOption,
callback: domUtilsEventCallBack,
originCallBack: listenerCallBack,
});
Reflect.set(elementItem, GlobalData.domEventSymbol, elementEvents);
});
});
}
off(element, eventType, selector, callback, option, filter) {
function getOption(args1, startIndex, option2) {
const currentParam = args1[startIndex];
if (typeof currentParam === "boolean") {
option2.capture = currentParam;
} else if (typeof currentParam === "object" && currentParam != null && "capture" in currentParam) {
option2.capture = currentParam.capture;
}
return option2;
}
const that = this;
const args = arguments;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
let $elList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
$elList = [...element];
} else {
$elList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(
eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== "")
);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
}
let selectorList = [];
if (Array.isArray(selector)) {
selectorList = selectorList.concat(
selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== "")
);
} else if (typeof selector === "string") {
selectorList.push(selector);
}
let listenerCallBack = callback;
let listenerOption = {
capture: false,
};
if (typeof selector === "function") {
listenerCallBack = selector;
listenerOption = getOption(args, 3, listenerOption);
} else {
listenerOption = getOption(args, 4, listenerOption);
}
let isRemoveAll = false;
if (args.length === 2) {
isRemoveAll = true;
} else if ((args.length === 3 && typeof args[2] === "string") || Array.isArray(args[2])) {
isRemoveAll = true;
}
if (args.length === 5 && typeof args[4] === "function" && typeof filter !== "function") {
filter = option;
}
$elList.forEach(($elItem) => {
const elementEvents = Reflect.get($elItem, GlobalData.domEventSymbol) || {};
eventTypeList.forEach((eventName) => {
const handlers = elementEvents[eventName] || [];
const filterHandler = typeof filter === "function" ? handlers.filter(filter) : handlers;
for (let index = 0; index < filterHandler.length; index++) {
const handler = filterHandler[index];
let flag = true;
if (flag && listenerCallBack && handler.originCallBack !== listenerCallBack) {
flag = false;
}
if (flag && selectorList.length && Array.isArray(handler.selector)) {
if (JSON.stringify(handler.selector) !== JSON.stringify(selectorList)) {
flag = false;
}
}
if (
flag &&
typeof handler.option.capture === "boolean" &&
listenerOption.capture !== handler.option.capture
) {
flag = false;
}
if (flag || isRemoveAll) {
$elItem.removeEventListener(eventName, handler.callback, handler.option);
const findIndex = handlers.findIndex((item) => item === handler);
if (findIndex !== -1) {
handlers.splice(findIndex, 1);
}
}
}
if (handlers.length === 0) {
CommonUtils.delete(elementEvents, eventType);
}
});
Reflect.set($elItem, GlobalData.domEventSymbol, elementEvents);
});
}
offAll(element, eventType) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
let $elList = [];
if (element instanceof NodeList || Array.isArray(element)) {
$elList = [...element];
} else {
$elList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(eventType);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" "));
}
$elList.forEach(($elItem) => {
const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), GlobalData.domEventSymbol])];
symbolList.forEach((symbolItem) => {
if (!symbolItem.toString().startsWith("Symbol(events_")) {
return;
}
const elementEvents = Reflect.get($elItem, symbolItem) || {};
const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
iterEventNameList.forEach((eventName) => {
const handlers = elementEvents[eventName];
if (!handlers) {
return;
}
for (const handler of handlers) {
$elItem.removeEventListener(eventName, handler.callback, {
capture: handler["option"]["capture"],
});
}
const events = Reflect.get($elItem, symbolItem);
CommonUtils.delete(events, eventName);
});
});
});
}
ready(callback) {
if (typeof callback !== "function") {
return;
}
const that = this;
function checkDOMReadyState() {
try {
if (
that.windowApi.document.readyState === "complete" ||
(that.windowApi.document.readyState !== "loading" && !that.windowApi.document.documentElement.doScroll)
) {
return true;
} else {
return false;
}
} catch {
return false;
}
}
function completed() {
removeDomReadyListener();
callback();
}
const targetList = [
{
target: that.windowApi.document,
eventType: "DOMContentLoaded",
callback: completed,
},
{
target: that.windowApi.window,
eventType: "load",
callback: completed,
},
];
function addDomReadyListener() {
for (let index = 0; index < targetList.length; index++) {
const item = targetList[index];
item.target.addEventListener(item.eventType, item.callback);
}
}
function removeDomReadyListener() {
for (let index = 0; index < targetList.length; index++) {
const item = targetList[index];
item.target.removeEventListener(item.eventType, item.callback);
}
}
if (checkDOMReadyState()) {
CommonUtils.setTimeout(callback);
} else {
addDomReadyListener();
}
}
trigger(element, eventType, details, useDispatchToTriggerEvent = true) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
let $elList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
$elList = [...element];
} else {
$elList = [element];
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventType;
} else if (typeof eventType === "string") {
eventTypeList = eventType.split(" ");
}
$elList.forEach(($elItem) => {
const elementEvents = Reflect.get($elItem, GlobalData.domEventSymbol) || {};
eventTypeList.forEach((__eventType) => {
let event = null;
if (details && details instanceof Event) {
event = details;
} else {
event = new Event(__eventType);
if (details) {
Object.keys(details).forEach((keyName) => {
const value = Reflect.get(details, keyName);
Reflect.set(event, keyName, value);
});
}
}
if (useDispatchToTriggerEvent == false && __eventType in elementEvents) {
elementEvents[__eventType].forEach((eventsItem) => {
eventsItem.callback(event);
});
} else {
$elItem.dispatchEvent(event);
}
});
});
}
click(element, handler, details, useDispatchToTriggerEvent) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.click($ele, handler, details, useDispatchToTriggerEvent);
});
return;
}
if (handler == null) {
that.trigger(element, "click", details, useDispatchToTriggerEvent);
} else {
that.on(element, "click", null, handler);
}
}
blur(element, handler, details, useDispatchToTriggerEvent) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.focus($ele, handler, details, useDispatchToTriggerEvent);
});
return;
}
if (handler === null) {
that.trigger(element, "blur", details, useDispatchToTriggerEvent);
} else {
that.on(element, "blur", null, handler);
}
}
focus(element, handler, details, useDispatchToTriggerEvent) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.focus($ele, handler, details, useDispatchToTriggerEvent);
});
return;
}
if (handler == null) {
that.trigger(element, "focus", details, useDispatchToTriggerEvent);
} else {
that.on(element, "focus", null, handler);
}
}
hover(element, handler, option) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (element == null) {
return;
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.hover($ele, handler, option);
});
return;
}
that.on(element, "mouseenter", null, handler, option);
that.on(element, "mouseleave", null, handler, option);
}
animationend(element, handler, option) {
const that = this;
if (typeof element === "string") {
element = that.selector(element);
}
if (element == null) {
return;
}
const defaultOption = {
once: true,
};
Object.assign(defaultOption, option || {});
const eventNameList = CommonUtils.getAnimationEndNameList();
that.on(element, eventNameList, null, handler, defaultOption);
if (!defaultOption.once) {
return {
off() {
that.off(element, eventNameList, null, handler, defaultOption);
},
};
}
}
transitionend(element, handler, option) {
const that = this;
if (typeof element === "string") {
element = that.selector(element);
}
if (element == null) {
return;
}
const defaultOption = {
once: true,
};
Object.assign(defaultOption, option || {});
const eventNameList = CommonUtils.getTransitionEndNameList();
that.on(element, eventNameList, null, handler, defaultOption);
if (!defaultOption.once) {
return {
off() {
that.off(element, eventNameList, null, handler, defaultOption);
},
};
}
}
keyup(element, handler, option) {
const that = this;
if (element == null) {
return;
}
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.keyup($ele, handler, option);
});
return;
}
that.on(element, "keyup", null, handler, option);
}
keydown(element, handler, option) {
const that = this;
if (element == null) {
return;
}
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.keydown($ele, handler, option);
});
return;
}
that.on(element, "keydown", null, handler, option);
}
keypress(element, handler, option) {
const that = this;
if (element == null) {
return;
}
if (typeof element === "string") {
element = that.selectorAll(element);
}
if (CommonUtils.isNodeList(element)) {
element.forEach(($ele) => {
that.keypress($ele, handler, option);
});
return;
}
that.on(element, "keypress", null, handler, option);
}
listenKeyboard(element, eventName = "keypress", callback, options) {
const that = this;
if (typeof element === "string") {
element = that.selectorAll(element);
}
const keyboardEventCallBack = function (event) {
const keyName = event.key || event.code;
const keyValue = event.charCode || event.keyCode || event.which;
const otherCodeList = [];
if (event.ctrlKey) {
otherCodeList.push("ctrl");
}
if (event.altKey) {
otherCodeList.push("alt");
}
if (event.metaKey) {
otherCodeList.push("meta");
}
if (event.shiftKey) {
otherCodeList.push("shift");
}
if (typeof callback === "function") {
callback(keyName, keyValue, otherCodeList, event);
}
};
that.on(element, eventName, keyboardEventCallBack, options);
return {
removeListen: () => {
that.off(element, eventName, keyboardEventCallBack, options);
},
};
}
preventEvent(...args) {
const stopEvent = (event) => {
event?.preventDefault();
event?.stopPropagation();
event?.stopImmediatePropagation();
return false;
};
if (args.length === 1) {
return stopEvent(args[0]);
} else {
const $el = args[0];
let eventNameList = args[1];
const capture = args[2];
if (typeof eventNameList === "string") {
eventNameList = [eventNameList];
}
this.on($el, eventNameList, stopEvent, { capture: Boolean(capture) });
}
}
}
new ElementEvent();
class ElementHandler extends ElementEvent {
windowApi;
constructor(windowApiOption) {
super(windowApiOption);
this.windowApi = new WindowApi$1(windowApiOption);
}
getElementSelector($el) {
const that = this;
if (!$el) return void 0;
if (!$el.parentElement) return void 0;
if ($el.id) return `#${$el.id}`;
let selector = that.getElementSelector($el.parentElement);
if (!selector) {
return $el.tagName.toLowerCase();
}
if ($el.parentElement.querySelectorAll($el.tagName).length > 1) {
const index = Array.prototype.indexOf.call($el.parentElement.children, $el) + 1;
selector += ` > ${$el.tagName.toLowerCase()}:nth-child(${index})`;
} else {
selector += ` > ${$el.tagName.toLowerCase()}`;
}
return selector;
}
}
new ElementHandler();
let DOMUtils$1 = class DOMUtils extends ElementHandler {
constructor(option) {
super(option);
}
version = version$2;
noConflict() {
const that = this;
if (that.windowApi.window.DOMUtils) {
CommonUtils.delete(window, "DOMUtils");
}
that.windowApi.window.DOMUtils = this;
return this;
}
attr($el, attrName, attrValue) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (attrValue == null) {
return that.attr($el[0], attrName, attrValue);
} else {
$el.forEach(($elItem) => {
that.attr($elItem, attrName, attrValue);
});
return;
}
}
if (attrValue == null) {
return $el.getAttribute(attrName);
} else {
$el.setAttribute(attrName, attrValue);
}
}
createElement(tagName, property, attributes) {
const that = this;
const $el = that.windowApi.document.createElement(tagName);
if (typeof property === "string") {
that.html($el, property);
return $el;
}
if (property == null) {
property = {};
}
if (attributes == null) {
attributes = {};
}
Object.keys(property).forEach((key) => {
const value = property[key];
if (key === "innerHTML") {
that.html($el, value);
return;
}
$el[key] = value;
});
Object.keys(attributes).forEach((key) => {
let value = attributes[key];
if (typeof value === "object") {
value = JSON.stringify(value);
} else if (typeof value === "function") {
value = value.toString();
}
$el.setAttribute(key, value);
});
return $el;
}
css($el, property, value) {
const that = this;
function handlePixe(propertyName, propertyValue) {
const allowAddPixe = ["width", "height", "top", "left", "right", "bottom", "font-size"];
if (typeof propertyValue === "number") {
propertyValue = propertyValue.toString();
}
if (
typeof propertyValue === "string" &&
allowAddPixe.includes(propertyName) &&
propertyValue.match(/[0-9]$/gi)
) {
propertyValue = propertyValue + "px";
}
return propertyValue;
}
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (typeof property === "string") {
if (value == null) {
return that.css($el[0], property);
} else {
$el.forEach(($elItem) => {
that.css($elItem, property);
});
return;
}
} else if (typeof property === "object") {
$el.forEach(($elItem) => {
that.css($elItem, property);
});
return;
}
return;
}
const setStyleProperty = (propertyName, propertyValue) => {
if (typeof propertyValue === "string" && propertyValue.trim().endsWith("!important")) {
propertyValue = propertyValue
.trim()
.replace(/!important$/gi, "")
.trim();
$el.style.setProperty(propertyName, propertyValue, "important");
} else {
propertyValue = handlePixe(propertyName, propertyValue);
$el.style.setProperty(propertyName, propertyValue);
}
};
if (typeof property === "string") {
if (value == null) {
return that.windowApi.globalThis.getComputedStyle($el).getPropertyValue(property);
} else {
setStyleProperty(property, value);
}
} else if (typeof property === "object") {
for (const prop in property) {
const value2 = property[prop];
setStyleProperty(prop, value2);
}
} else {
throw new TypeError("property must be string or object");
}
}
text($el, text) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (text == null) {
return that.text($el[0]);
} else {
$el.forEach(($elItem) => {
that.text($elItem, text);
});
}
return;
}
if (text == null) {
return $el.textContent || $el.innerText;
} else {
if (text instanceof Node) {
text = text.textContent || text.innerText;
}
if ("textContent" in $el) {
$el.textContent = text;
} else if ("innerText" in $el) {
$el.innerText = text;
}
}
}
html($el, html) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (html == null) {
return that.html($el[0]);
} else {
$el.forEach(($elItem) => {
that.html($elItem, html);
});
}
return;
}
if (html == null) {
return $el.innerHTML;
} else {
if (html instanceof Element) {
html = html.innerHTML;
}
if ("innerHTML" in $el) {
CommonUtils.setSafeHTML($el, html);
}
}
}
getTransform($el, isShow = false) {
const that = this;
let transform_left = 0;
let transform_top = 0;
if (!(isShow || (!isShow && CommonUtils.isShow($el)))) {
const { recovery } = CommonUtils.forceShow($el);
const transformInfo = that.getTransform($el, true);
recovery();
return transformInfo;
}
const elementTransform = that.windowApi.globalThis.getComputedStyle($el).transform;
if (elementTransform != null && elementTransform !== "none" && elementTransform !== "") {
const elementTransformSplit = elementTransform.match(/\((.+)\)/)?.[1].split(",");
if (elementTransformSplit) {
transform_left = Math.abs(parseInt(elementTransformSplit[4]));
transform_top = Math.abs(parseInt(elementTransformSplit[5]));
} else {
transform_left = 0;
transform_top = 0;
}
}
return {
transformLeft: transform_left,
transformTop: transform_top,
};
}
val($el, value) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (value == null) {
return that.val($el[0]);
} else {
$el.forEach(($elItem) => {
that.val($elItem, value);
});
}
return;
}
if (value == null) {
if ($el.localName === "input" && ($el.type === "checkbox" || $el.type === "radio")) {
return $el.checked;
} else {
return $el.value;
}
} else {
if ($el.localName === "input" && ($el.type === "checkbox" || $el.type === "radio")) {
$el.checked = !!value;
} else {
$el.value = value;
}
}
}
prop($el, propName, propValue) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
if (propValue == null) {
return that.prop($el[0], propName);
} else {
$el.forEach(($elItem) => {
that.prop($elItem, propName, propValue);
});
}
return;
}
if (propValue == null) {
return Reflect.get($el, propName);
} else {
if ($el instanceof Element && propName === "innerHTML") {
that.html($el, propValue);
} else {
Reflect.set($el, propName, propValue);
}
}
}
removeAttr($el, attrName) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.removeAttr($elItem, attrName);
});
return;
}
$el.removeAttribute(attrName);
}
removeClass($el, className) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.removeClass($elItem, className);
});
return;
}
if (className == null) {
$el.className = "";
} else {
if (!Array.isArray(className)) {
className = className.trim().split(" ");
}
className.forEach((itemClassName) => {
$el.classList.remove(itemClassName);
});
}
}
removeProp($el, propName) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.removeProp($elItem, propName);
});
return;
}
CommonUtils.delete($el, propName);
}
addClass($el, className) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.addClass($elItem, className);
});
return;
}
if (!Array.isArray(className)) {
className = className.split(" ");
}
className.forEach((itemClassName) => {
if (itemClassName.trim() == "") {
return;
}
$el.classList.add(itemClassName);
});
}
hasClass($el, className) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return false;
}
if (CommonUtils.isNodeList($el)) {
let flag = true;
for (let index = 0; index < $el.length; index++) {
const $elItem = $el[index];
flag = flag && that.hasClass($elItem, className);
}
return flag;
}
if (!$el?.classList) {
return false;
}
if (!Array.isArray(className)) {
className = className.split(" ");
}
for (let index = 0; index < className.length; index++) {
const item = className[index].trim();
if (!$el.classList.contains(item)) {
return false;
}
}
return true;
}
append($el, content) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.append($elItem, content);
});
return;
}
function elementAppendChild(ele, text) {
if (typeof content === "string") {
if (ele instanceof DocumentFragment) {
if (typeof text === "string") {
text = that.toElement(text, true, false);
}
ele.appendChild(text);
} else {
ele.insertAdjacentHTML("beforeend", CommonUtils.createSafeHTML(text));
}
} else {
ele.appendChild(text);
}
}
if (Array.isArray(content) || content instanceof NodeList) {
const fragment = that.windowApi.document.createDocumentFragment();
content.forEach((ele) => {
if (typeof ele === "string") {
ele = that.toElement(ele, true, false);
}
fragment.appendChild(ele);
});
$el.appendChild(fragment);
} else {
elementAppendChild($el, content);
}
}
prepend($el, content) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.prepend($elItem, content);
});
return;
}
if (typeof content === "string") {
if ($el instanceof DocumentFragment) {
content = that.toElement(content, true, false);
$el.prepend(content);
} else {
$el.insertAdjacentHTML("afterbegin", CommonUtils.createSafeHTML(content));
}
} else {
const $firstChild = $el.firstChild;
if ($firstChild == null) {
$el.prepend(content);
} else {
$el.insertBefore(content, $firstChild);
}
}
}
after($el, content) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.after($elItem, content);
});
return;
}
if (typeof content === "string") {
$el.insertAdjacentHTML("afterend", CommonUtils.createSafeHTML(content));
} else {
const $parent = $el.parentElement;
const $nextSlibling = $el.nextSibling;
if (!$parent || $nextSlibling) {
$el.after(content);
} else {
$parent.insertBefore(content, $nextSlibling);
}
}
}
before($el, content) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.before($elItem, content);
});
return;
}
if (typeof content === "string") {
$el.insertAdjacentHTML("beforebegin", CommonUtils.createSafeHTML(content));
} else {
const $parent = $el.parentElement;
if (!$parent) {
$el.before(content);
} else {
$parent.insertBefore(content, $el);
}
}
}
remove($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.remove($elItem);
});
return;
}
if (typeof $el.remove === "function") {
$el.remove();
} else if ($el.parentElement) {
$el.parentElement.removeChild($el);
} else if ($el.parentNode) {
$el.parentNode.removeChild($el);
}
}
empty($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.empty($elItem);
});
return;
}
if ($el.innerHTML) {
$el.innerHTML = "";
} else if ($el.textContent) {
$el.textContent = "";
}
}
offset($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el == null) {
return;
}
const rect = $el.getBoundingClientRect();
return {
top: rect.top + that.windowApi.globalThis.scrollY,
left: rect.left + that.windowApi.globalThis.scrollX,
};
}
width($el, isShow = false) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if (CommonUtils.isWin($el)) {
return that.windowApi.window.document.documentElement.clientWidth;
}
if ($el.nodeType === 9) {
$el = $el;
return Math.max(
$el.body.scrollWidth,
$el.documentElement.scrollWidth,
$el.body.offsetWidth,
$el.documentElement.offsetWidth,
$el.documentElement.clientWidth
);
}
if (isShow || (!isShow && CommonUtils.isShow($el))) {
$el = $el;
if (parseFloat(CommonUtils.getStyleValue($el, "width").toString()) > 0) {
return parseFloat(CommonUtils.getStyleValue($el, "width").toString());
}
if ($el.offsetWidth > 0) {
const borderLeftWidth = CommonUtils.getStyleValue($el, "borderLeftWidth");
const borderRightWidth = CommonUtils.getStyleValue($el, "borderRightWidth");
const paddingLeft = CommonUtils.getStyleValue($el, "paddingLeft");
const paddingRight = CommonUtils.getStyleValue($el, "paddingRight");
const backHeight =
parseFloat($el.offsetWidth.toString()) -
parseFloat(borderLeftWidth.toString()) -
parseFloat(borderRightWidth.toString()) -
parseFloat(paddingLeft.toString()) -
parseFloat(paddingRight.toString());
return parseFloat(backHeight.toString());
}
return 0;
} else {
$el = $el;
const { recovery } = CommonUtils.forceShow($el);
const width = that.width($el, true);
recovery();
return width;
}
}
height($el, isShow = false) {
const that = this;
if (CommonUtils.isWin($el)) {
return that.windowApi.window.document.documentElement.clientHeight;
}
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el.nodeType === 9) {
$el = $el;
return Math.max(
$el.body.scrollHeight,
$el.documentElement.scrollHeight,
$el.body.offsetHeight,
$el.documentElement.offsetHeight,
$el.documentElement.clientHeight
);
}
if (isShow || (!isShow && CommonUtils.isShow($el))) {
$el = $el;
if (parseFloat(CommonUtils.getStyleValue($el, "height").toString()) > 0) {
return parseFloat(CommonUtils.getStyleValue($el, "height").toString());
}
if ($el.offsetHeight > 0) {
const borderTopWidth = CommonUtils.getStyleValue($el, "borderTopWidth");
const borderBottomWidth = CommonUtils.getStyleValue($el, "borderBottomWidth");
const paddingTop = CommonUtils.getStyleValue($el, "paddingTop");
const paddingBottom = CommonUtils.getStyleValue($el, "paddingBottom");
const backHeight =
parseFloat($el.offsetHeight.toString()) -
parseFloat(borderTopWidth.toString()) -
parseFloat(borderBottomWidth.toString()) -
parseFloat(paddingTop.toString()) -
parseFloat(paddingBottom.toString());
return parseFloat(backHeight.toString());
}
return 0;
} else {
$el = $el;
const { recovery } = CommonUtils.forceShow($el);
const height = that.height($el, true);
recovery();
return height;
}
}
outerWidth($el, isShow = false) {
const that = this;
if (CommonUtils.isWin($el)) {
return that.windowApi.window.innerWidth;
}
if (typeof $el === "string") {
$el = that.selector($el);
}
$el = $el;
if (isShow || (!isShow && CommonUtils.isShow($el))) {
const style = that.windowApi.globalThis.getComputedStyle($el, null);
const marginLeft = CommonUtils.getStyleValue(style, "marginLeft");
const marginRight = CommonUtils.getStyleValue(style, "marginRight");
return $el.offsetWidth + marginLeft + marginRight;
} else {
const { recovery } = CommonUtils.forceShow($el);
const outerWidth = that.outerWidth($el, true);
recovery();
return outerWidth;
}
}
outerHeight($el, isShow = false) {
const that = this;
if (CommonUtils.isWin($el)) {
return that.windowApi.window.innerHeight;
}
if (typeof $el === "string") {
$el = that.selector($el);
}
$el = $el;
if (isShow || (!isShow && CommonUtils.isShow($el))) {
const style = that.windowApi.globalThis.getComputedStyle($el, null);
const marginTop = CommonUtils.getStyleValue(style, "marginTop");
const marginBottom = CommonUtils.getStyleValue(style, "marginBottom");
return $el.offsetHeight + marginTop + marginBottom;
} else {
const { recovery } = CommonUtils.forceShow($el);
const outerHeight = that.outerHeight($el, true);
recovery();
return outerHeight;
}
}
replaceWith($el, $newEl) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.replaceWith($elItem, $newEl);
});
return;
}
if (typeof $newEl === "string") {
$newEl = that.toElement($newEl, false, false);
}
const $parent = $el.parentElement;
if ($parent) {
$parent.replaceChild($newEl, $el);
} else {
that.after($el, $newEl);
$el.remove();
}
}
wrap($el, wrapperHTML) {
const that = this;
if (typeof $el === "string") {
$el = that.selectorAll($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
$el.forEach(($elItem) => {
that.wrap($elItem, wrapperHTML);
});
return;
}
$el = $el;
const $wrapper = that.windowApi.document.createElement("div");
that.html($wrapper, wrapperHTML);
const wrapperFirstChild = $wrapper.firstChild;
const parentElement = $el.parentElement;
parentElement.insertBefore(wrapperFirstChild, $el);
wrapperFirstChild.appendChild($el);
}
prev($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el == null) {
return;
}
return $el.previousElementSibling;
}
next($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el == null) {
return;
}
return $el.nextElementSibling;
}
siblings($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el == null) {
return;
}
return Array.from($el.parentElement.children).filter(($child) => $child !== $el);
}
parent($el) {
const that = this;
if (typeof $el === "string") {
$el = that.selector($el);
}
if ($el == null) {
return;
}
if (CommonUtils.isNodeList($el)) {
const resultArray = [];
$el.forEach(($elItem) => {
resultArray.push(that.parent($elItem));
});
return resultArray;
} else {
return $el.parentElement;
}
}
toElement(html, useParser = false, isComplete = false) {
const that = this;
html = html.trim();
function parseHTMLByDOMParser() {
const parser = new DOMParser();
if (isComplete) {
return parser.parseFromString(html, "text/html");
} else {
return parser.parseFromString(html, "text/html").body.firstChild;
}
}
function parseHTMLByCreateDom() {
const $el = that.windowApi.document.createElement("div");
that.html($el, html);
if (isComplete) {
return $el;
} else {
return $el.firstElementChild ?? $el.firstChild;
}
}
if (useParser) {
return parseHTMLByDOMParser();
} else {
return parseHTMLByCreateDom();
}
}
serialize($form) {
const elements = $form.elements;
const serializedArray = [];
for (let i2 = 0; i2 < elements.length; i2++) {
const element = elements[i2];
if (
element.name &&
!element.disabled &&
(element.checked ||
["text", "hidden", "password", "textarea", "select-one", "select-multiple"].includes(element.type))
) {
if (element.type === "select-multiple") {
for (let j2 = 0; j2 < element.options.length; j2++) {
if (element.options[j2].selected) {
serializedArray.push({
name: element.name,
value: element.options[j2].value,
});
}
}
} else {
serializedArray.push({ name: element.name, value: element.value });
}
}
}
return serializedArray
.map((item) => `${encodeURIComponent(item.name)}=${encodeURIComponent(item.value)}`)
.join("&");
}
createDOMUtils(option) {
return new DOMUtils(option);
}
getTextBoundingRect($input, selectionStart, selectionEnd) {
const that = this;
if (!$input || !("value" in $input)) return $input;
if (selectionStart == null) {
selectionStart = $input.selectionStart || 0;
}
if (selectionEnd == null) {
selectionEnd = $input.selectionEnd || 0;
}
if (typeof selectionStart == "string") selectionStart = parseFloat(selectionStart);
if (typeof selectionStart != "number" || isNaN(selectionStart)) {
selectionStart = 0;
}
if (selectionStart < 0) selectionStart = 0;
else selectionStart = Math.min($input.value.length, selectionStart);
if (typeof selectionEnd == "string") selectionEnd = parseFloat(selectionEnd);
if (typeof selectionEnd != "number" || isNaN(selectionEnd) || selectionEnd < selectionStart) {
selectionEnd = selectionStart;
}
if (selectionEnd < 0) selectionEnd = 0;
else selectionEnd = Math.min($input.value.length, selectionEnd);
if (typeof $input.createTextRange == "function") {
const range = $input.createTextRange();
range.collapse(true);
range.moveStart("character", selectionStart);
range.moveEnd("character", selectionEnd - selectionStart);
return range.getBoundingClientRect();
}
const offset = getInputOffset(),
width = getInputCSS("width", true),
height = getInputCSS("height", true);
let topPos = offset.top;
let leftPos = offset.left;
let cssDefaultStyles = "white-space:pre;padding:0;margin:0;";
const listOfModifiers = [
"direction",
"font-family",
"font-size",
"font-size-adjust",
"font-variant",
"font-weight",
"font-style",
"letter-spacing",
"line-height",
"text-align",
"text-indent",
"text-transform",
"word-wrap",
"word-spacing",
];
topPos += getInputCSS("padding-top", true);
topPos += getInputCSS("border-top-width", true);
leftPos += getInputCSS("padding-left", true);
leftPos += getInputCSS("border-left-width", true);
leftPos += 1;
for (let index = 0; index < listOfModifiers.length; index++) {
const property = listOfModifiers[index];
cssDefaultStyles += property + ":" + getInputCSS(property, false) + ";";
}
const text = $input.value || "G",
textLen = text.length,
fakeClone = that.windowApi.document.createElement("div");
if (selectionStart > 0) appendPart(0, selectionStart);
const fakeRange = appendPart(selectionStart, selectionEnd);
if (textLen > selectionEnd) appendPart(selectionEnd, textLen);
fakeClone.style.cssText = cssDefaultStyles;
fakeClone.style.position = "absolute";
fakeClone.style.top = topPos + "px";
fakeClone.style.left = leftPos + "px";
fakeClone.style.width = width + "px";
fakeClone.style.height = height + "px";
that.windowApi.document.body.appendChild(fakeClone);
const returnValue = fakeRange.getBoundingClientRect();
fakeClone?.parentNode?.removeChild(fakeClone);
return returnValue;
function appendPart(start, end) {
const span = that.windowApi.document.createElement("span");
span.style.cssText = cssDefaultStyles;
span.textContent = text.substring(start, end);
fakeClone.appendChild(span);
return span;
}
function getInputOffset() {
const body = that.windowApi.document.body,
win = that.windowApi.document.defaultView,
docElem = that.windowApi.document.documentElement,
$box = that.windowApi.document.createElement("div");
$box.style.paddingLeft = $box.style.width = "1px";
body.appendChild($box);
const isBoxModel = $box.offsetWidth == 2;
body.removeChild($box);
const $boxRect = $input.getBoundingClientRect();
const clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || (isBoxModel && docElem.scrollTop) || body.scrollTop,
scrollLeft = win.pageXOffset || (isBoxModel && docElem.scrollLeft) || body.scrollLeft;
return {
top: $boxRect.top + scrollTop - clientTop,
left: $boxRect.left + scrollLeft - clientLeft,
};
}
function getInputCSS(prop, isNumber) {
const val = that.windowApi.document.defaultView.getComputedStyle($input, null).getPropertyValue(prop);
if (isNumber) {
return parseFloat(val);
} else {
return val;
}
}
}
addStyle(cssText) {
if (typeof cssText !== "string") {
throw new Error("DOMUtils.addStyle 参数cssText 必须为String类型");
}
const $css = this.createElement("style", {
type: "text/css",
innerHTML: cssText,
});
if (this.windowApi.document.head) {
this.windowApi.document.head.appendChild($css);
} else if (this.windowApi.document.documentElement.childNodes.length === 0) {
this.windowApi.document.documentElement.appendChild($css);
} else {
this.windowApi.document.documentElement.insertBefore(
$css,
this.windowApi.document.documentElement.childNodes[0]
);
}
return $css;
}
checkUserClickInNode($el) {
const that = this;
if (!CommonUtils.isDOM($el)) {
throw new Error("Utils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");
}
const clickEvent = that.windowApi.window.event;
const touchEvent = that.windowApi.window.event;
const $click = clickEvent?.composedPath()?.[0];
const clickPosX = clickEvent?.clientX != null ? clickEvent.clientX : touchEvent.touches[0].clientX;
const clickPosY = clickEvent?.clientY != null ? clickEvent.clientY : touchEvent.touches[0].clientY;
const {
left: elementPosXLeft,
right: elementPosXRight,
top: elementPosYTop,
bottom: elementPosYBottom,
} = $el.getBoundingClientRect();
if (
clickPosX >= elementPosXLeft &&
clickPosX <= elementPosXRight &&
clickPosY >= elementPosYTop &&
clickPosY <= elementPosYBottom
) {
return true;
} else if (($click && $el.contains($click)) || $click == $el) {
return true;
} else {
return false;
}
}
deleteParentNode($el, parentSelector) {
if ($el == null) {
return;
}
if (!CommonUtils.isDOM($el)) {
throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");
}
if (typeof parentSelector !== "string") {
throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");
}
let result = false;
const $parent = domUtils$2.closest($el, parentSelector);
if ($parent) {
this.remove($parent);
result = true;
}
return result;
}
*findElementsWithText($el, text, filter) {
const that = this;
if ($el.outerHTML.includes(text)) {
if ($el.children.length === 0) {
const filterResult = typeof filter === "function" ? filter($el) : false;
if (!filterResult) {
yield $el;
}
} else {
const $text = Array.from($el.childNodes).filter(($child) => $child.nodeType === Node.TEXT_NODE);
for (const $child of $text) {
if ($child.textContent.includes(text)) {
const filterResult = typeof filter === "function" ? filter($el) : false;
if (!filterResult) {
yield $child;
}
}
}
}
}
for (let index = 0; index < $el.children.length; index++) {
const $child = $el.children[index];
yield* that.findElementsWithText($child, text, filter);
}
}
findVisibleElement($el) {
let $current = $el;
while ($current) {
const rect = $current.getBoundingClientRect();
if (rect.length) {
return $current;
}
$current = $current.parentElement;
}
return null;
}
setElementSelection($el, childTextNode, startIndex, endIndex) {
const range = this.windowApi.document.createRange();
range.selectNodeContents($el);
if (childTextNode) {
if (childTextNode.nodeType !== Node.TEXT_NODE) {
throw new TypeError("childTextNode必须是#text元素");
}
if (startIndex != null && endIndex != null) {
range.setStart(childTextNode, startIndex);
range.setEnd(childTextNode, endIndex);
}
}
const selection = this.windowApi.globalThis.getSelection();
if (selection) {
selection.removeAllRanges();
selection.addRange(range);
}
}
};
const domUtils$2 = new DOMUtils$1();
class ColorConversion {
isHex(str) {
if (typeof str !== "string") {
return false;
}
if (!str.match(/^(#|)[0-9a-fA-F]{6}$/)) {
return false;
}
return true;
}
hexToRgba(hex, opacity) {
if (!this.isHex(hex)) {
throw new TypeError(`输入错误的hex:${hex}`);
}
return hex && hex.replace(/\s+/g, "").length === 7
? `rgba(${parseInt(`0x${hex.slice(1, 3)}`)},${parseInt(`0x${hex.slice(3, 5)}`)},${parseInt(`0x${hex.slice(5, 7)}`)},${opacity})`
: "";
}
hexToRgb(str) {
if (!this.isHex(str)) {
throw new TypeError(`输入错误的hex:${str}`);
}
str = str.replace("#", "");
const hxs = str.match(/../g);
for (let index = 0; index < 3; index++) {
const value = parseInt(hxs[index], 16);
Reflect.set(hxs, index, value);
}
return hxs;
}
rgbToHex(redValue, greenValue, blueValue) {
const validPattern = /^\d{1,3}$/;
if (
!validPattern.test(redValue.toString()) ||
!validPattern.test(greenValue.toString()) ||
!validPattern.test(blueValue.toString())
)
throw new TypeError("输入错误的rgb颜色值");
const hexs = [redValue.toString(16), greenValue.toString(16), blueValue.toString(16)];
for (let index = 0; index < 3; index++) if (hexs[index].length == 1) hexs[index] = `0${hexs[index]}`;
return `#${hexs.join("")}`;
}
getDarkColor(color, level) {
if (!this.isHex(color)) {
throw new TypeError(`输入错误的hex:${color}`);
}
const rgbc = this.hexToRgb(color);
for (let index = 0; index < 3; index++) {
const rgbcItemValue = rgbc[index];
const value = Math.floor(Number(rgbcItemValue) * (1 - Number(level)));
Reflect.set(rgbc, index, value);
}
return this.rgbToHex(rgbc[0], rgbc[1], rgbc[2]);
}
getLightColor(color, level) {
if (!this.isHex(color)) {
throw new TypeError(`输入错误的hex:${color}`);
}
const rgbc = this.hexToRgb(color);
for (let index = 0; index < 3; index++) {
const rgbcItemValue = Number(rgbc[index]);
const value = Math.floor(255 - rgbcItemValue * level + rgbcItemValue);
Reflect.set(rgbc, index, value);
}
return this.rgbToHex(rgbc[0], rgbc[1], rgbc[2]);
}
}
class GBKEncoder {
#data;
#U2Ghash = {};
#G2Uhash = {};
constructor() {
const dataText = this.handleText(
"4e:020405060f12171f20212326292e2f313335373c40414244464a5155575a5b6263646567686a6b6c6d6e6f727475767778797a7b7c7d7f808182838485878a#909697999c9d9ea3aaafb0b1b4b6b7b8b9bcbdbec8cccfd0d2dadbdce0e2e6e7e9edeeeff1f4f8f9fafcfe,4f:00020304050607080b0c12131415161c1d212328292c2d2e31333537393b3e3f40414244454748494a4b4c525456616266686a6b6d6e7172757778797a7d8081828586878a8c8e909293959698999a9c9e9fa1a2a4abadb0b1b2b3b4b6b7b8b9babbbcbdbec0c1c2c6c7c8c9cbcccdd2d3d4d5d6d9dbe0e2e4e5e7ebecf0f2f4f5f6f7f9fbfcfdff,50:000102030405060708090a#0b0e1011131516171b1d1e20222324272b2f303132333435363738393b3d3f404142444546494a4b4d5051525354565758595b5d5e5f6061626364666768696a6b6d6e6f70717273747578797a7c7d818283848687898a8b8c8e8f909192939495969798999a9b9c9d9e9fa0a1a2a4a6aaabadaeafb0b1b3b4b5b6b7b8b9bcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdced0d1d2d3d4d5d7d8d9dbdcdddedfe0e1e2e3e4e5e8e9eaebeff0f1f2f4f6f7f8f9fafcfdfeff,51:00010203040508#090a0c0d0e0f1011131415161718191a1b1c1d1e1f2022232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e42474a4c4e4f5052535758595b5d5e5f606163646667696a6f727a7e7f838486878a8b8e8f90919394989a9d9e9fa1a3a6a7a8a9aaadaeb4b8b9babebfc1c2c3c5c8cacdced0d2d3d4d5d6d7d8d9dadcdedfe2e3e5e6e7e8e9eaeceef1f2f4f7fe,52:0405090b0c0f101314151c1e1f2122232526272a2c2f313234353c3e4445464748494b4e4f5253555758#595a5b5d5f6062636466686b6c6d6e7071737475767778797a7b7c7e808384858687898a8b8c8d8e8f91929495969798999a9ca4a5a6a7aeafb0b4b5b6b7b8b9babbbcbdc0c1c2c4c5c6c8cacccdcecfd1d3d4d5d7d9dadbdcdddee0e1e2e3e5e6e7e8e9eaebecedeeeff1f2f3f4f5f6f7f8fbfcfd,53:0102030407090a0b0c0e11121314181b1c1e1f2224252728292b2c2d2f3031323334353637383c3d404244464b4c4d505458595b5d65686a6c6d7276797b7c7d7e80818387888a8e8f#90919293949697999b9c9ea0a1a4a7aaabacadafb0b1b2b3b4b5b7b8b9babcbdbec0c3c4c5c6c7cecfd0d2d3d5dadcdddee1e2e7f4fafeff,54:000205070b1418191a1c2224252a303336373a3d3f4142444547494c4d4e4f515a5d5e5f6061636567696a6b6c6d6e6f7074797a7e7f8183858788898a8d919397989c9e9fa0a1a2a5aeb0b2b5b6b7b9babcbec3c5cacbd6d8dbe0e1e2e3e4ebeceff0f1f4f5f6f7f8f9fbfe,55:0002030405080a0b0c0d0e121315161718191a1c1d1e1f212526#28292b2d3234353638393a3b3d40424547484b4c4d4e4f515253545758595a5b5d5e5f60626368696b6f7071727374797a7d7f85868c8d8e9092939596979a9b9ea0a1a2a3a4a5a6a8a9aaabacadaeafb0b2b4b6b8babcbfc0c1c2c3c6c7c8cacbcecfd0d5d7d8d9dadbdee0e2e7e9edeef0f1f4f6f8f9fafbfcff,56:0203040506070a0b0d1011121314151617191a1c1d202122252628292a2b2e2f30333537383a3c3d3e404142434445464748494a4b4f5051525355565a5b5d5e5f6061#636566676d6e6f70727374757778797a7d7e7f80818283848788898a8b8c8d9091929495969798999a9b9c9d9e9fa0a1a2a4a5a6a7a8a9aaabacadaeb0b1b2b3b4b5b6b8b9babbbdbebfc0c1c2c3c4c5c6c7c8c9cbcccdcecfd0d1d2d3d5d6d8d9dce3e5e6e7e8e9eaeceeeff2f3f6f7f8fbfc,57:00010205070b0c0d0e0f101112131415161718191a1b1d1e202122242526272b313234353637383c3d3f414344454648494b52535455565859626365676c6e707172747578797a7d7e7f80#818788898a8d8e8f90919495969798999a9c9d9e9fa5a8aaacafb0b1b3b5b6b7b9babbbcbdbebfc0c1c4c5c6c7c8c9cacccdd0d1d3d6d7dbdcdee1e2e3e5e6e7e8e9eaebeceef0f1f2f3f5f6f7fbfcfeff,58:0103040508090a0c0e0f101213141617181a1b1c1d1f222325262728292b2c2d2e2f31323334363738393a3b3c3d3e3f4041424345464748494a4b4e4f505253555657595a5b5c5d5f6061626364666768696a6d6e6f707172737475767778797a7b7c7d7f82848687888a8b8c#8d8e8f909194959697989b9c9da0a1a2a3a4a5a6a7aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbdbebfc0c2c3c4c6c7c8c9cacbcccdcecfd0d2d3d4d6d7d8d9dadbdcdddedfe0e1e2e3e5e6e7e8e9eaedeff1f2f4f5f7f8fafbfcfdfeff,59:000103050608090a0b0c0e1011121317181b1d1e2021222326282c30323335363b3d3e3f404345464a4c4d505253595b5c5d5e5f616364666768696a6b6c6d6e6f70717275777a7b7c7e7f8085898b8c8e8f90919495989a9b9c9d9fa0a1a2a6#a7acadb0b1b3b4b5b6b7b8babcbdbfc0c1c2c3c4c5c7c8c9cccdcecfd5d6d9dbdedfe0e1e2e4e6e7e9eaebedeeeff0f1f2f3f4f5f6f7f8fafcfdfe,5a:00020a0b0d0e0f101214151617191a1b1d1e2122242627282a2b2c2d2e2f3033353738393a3b3d3e3f414243444547484b4c4d4e4f5051525354565758595b5c5d5e5f60616364656668696b6c6d6e6f7071727378797b7c7d7e808182838485868788898a8b8c8d8e8f9091939495969798999c9d9e9fa0a1a2a3a4a5a6a7a8a9abac#adaeafb0b1b4b6b7b9babbbcbdbfc0c3c4c5c6c7c8cacbcdcecfd0d1d3d5d7d9dadbdddedfe2e4e5e7e8eaecedeeeff0f2f3f4f5f6f7f8f9fafbfcfdfeff,5b:0001020304050607080a0b0c0d0e0f10111213141518191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303133353638393a3b3c3d3e3f4142434445464748494a4b4c4d4e4f52565e606167686b6d6e6f7274767778797b7c7e7f82868a8d8e90919294969fa7a8a9acadaeafb1b2b7babbbcc0c1c3c8c9cacbcdcecf#d1d4d5d6d7d8d9dadbdce0e2e3e6e7e9eaebecedeff1f2f3f4f5f6f7fdfe,5c:0002030507080b0c0d0e10121317191b1e1f2021232628292a2b2d2e2f303233353637434446474c4d5253545657585a5b5c5d5f62646768696a6b6c6d70727374757677787b7c7d7e808384858687898a8b8e8f9293959d9e9fa0a1a4a5a6a7a8aaaeafb0b2b4b6b9babbbcbec0c2c3c5c6c7c8c9cacccdcecfd0d1d3d4d5d6d7d8dadbdcdddedfe0e2e3e7e9ebeceeeff1f2f3f4f5f6f7f8f9fafcfdfeff,5d:00#01040508090a0b0c0d0f10111213151718191a1c1d1f2021222325282a2b2c2f3031323335363738393a3b3c3f4041424344454648494d4e4f5051525354555657595a5c5e5f6061626364656667686a6d6e7071727375767778797a7b7c7d7e7f8081838485868788898a8b8c8d8e8f9091929394959697989a9b9c9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b8b9babbbcbdbebfc0c1c2c3c4c6c7c8c9cacbcccecfd0d1d2d3d4d5d6d7d8d9dadcdfe0e3e4eaeced#f0f5f6f8f9fafbfcff,5e:000407090a0b0d0e1213171e1f20212223242528292a2b2c2f303233343536393a3e3f404143464748494a4b4d4e4f50515253565758595a5c5d5f60636465666768696a6b6c6d6e6f70717577797e8182838588898c8d8e92989b9da1a2a3a4a8a9aaabacaeafb0b1b2b4babbbcbdbfc0c1c2c3c4c5c6c7c8cbcccdcecfd0d4d5d7d8d9dadcdddedfe0e1e2e3e4e5e6e7e9ebecedeeeff0f1f2f3f5f8f9fbfcfd,5f:050607090c0d0e10121416191a1c1d1e21222324#282b2c2e30323334353637383b3d3e3f4142434445464748494a4b4c4d4e4f5154595a5b5c5e5f60636567686b6e6f72747576787a7d7e7f83868d8e8f919394969a9b9d9e9fa0a2a3a4a5a6a7a9abacafb0b1b2b3b4b6b8b9babbbebfc0c1c2c7c8cacbced3d4d5dadbdcdedfe2e3e5e6e8e9eceff0f2f3f4f6f7f9fafc,60:0708090b0c10111317181a1e1f2223242c2d2e3031323334363738393a3d3e404445464748494a4c4e4f5153545657585b5c5e5f606165666e71727475777e80#8182858687888a8b8e8f909193959798999c9ea1a2a4a5a7a9aaaeb0b3b5b6b7b9babdbebfc0c1c2c3c4c7c8c9cccdcecfd0d2d3d4d6d7d9dbdee1e2e3e4e5eaf1f2f5f7f8fbfcfdfeff,61:02030405070a0b0c1011121314161718191b1c1d1e21222528292a2c2d2e2f303132333435363738393a3b3c3d3e4041424344454647494b4d4f50525354565758595a5b5c5e5f606163646566696a6b6c6d6e6f717273747678797a7b7c7d7e7f808182838485868788898a8c8d8f9091929395#969798999a9b9c9e9fa0a1a2a3a4a5a6aaabadaeafb0b1b2b3b4b5b6b8b9babbbcbdbfc0c1c3c4c5c6c7c9cccdcecfd0d3d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e7e8e9eaebecedeeeff0f1f2f3f4f6f7f8f9fafbfcfdfe,62:00010203040507091314191c1d1e2023262728292b2d2f303132353638393a3b3c424445464a4f50555657595a5c5d5e5f6061626465687172747577787a7b7d818283858687888b8c8d8e8f9094999c9d9ea3a6a7a9aaadaeafb0b2b3b4b6b7b8babec0c1#c3cbcfd1d5dddee0e1e4eaebf0f2f5f8f9fafb,63:00030405060a0b0c0d0f10121314151718191c2627292c2d2e30313334353637383b3c3e3f40414447484a51525354565758595a5b5c5d60646566686a6b6c6f707273747578797c7d7e7f81838485868b8d9193949597999a9b9c9d9e9fa1a4a6abafb1b2b5b6b9bbbdbfc0c1c2c3c5c7c8cacbccd1d3d4d5d7d8d9dadbdcdddfe2e4e5e6e7e8ebeceeeff0f1f3f5f7f9fafbfcfe,64:0304060708090a0d0e111215161718191a1d1f222324#252728292b2e2f3031323335363738393b3c3e404243494b4c4d4e4f505153555657595a5b5c5d5f60616263646566686a6b6c6e6f70717273747576777b7c7d7e7f8081838688898a8b8c8d8e8f90939497989a9b9c9d9fa0a1a2a3a5a6a7a8aaabafb1b2b3b4b6b9bbbdbebfc1c3c4c6c7c8c9cacbcccfd1d3d4d5d6d9dadbdcdddfe0e1e3e5e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,65:01020304050607080a0b0c0d0e0f10111314151617191a1b1c1d1e1f2021#222324262728292a2c2d30313233373a3c3d404142434446474a4b4d4e5052535457585a5c5f606164656768696a6d6e6f7173757678797a7b7c7d7e7f8081828384858688898a8d8e8f92949596989a9d9ea0a2a3a6a8aaacaeb1b2b3b4b5b6b7b8babbbebfc0c2c7c8c9cacdd0d1d3d4d5d8d9dadbdcdddedfe1e3e4eaebf2f3f4f5f8f9fbfcfdfeff,66:0104050708090b0d1011121617181a1b1c1e2122232426292a2b2c2e3032333738393a3b3d3f40424445464748494a4d4e505158#595b5c5d5e6062636567696a6b6c6d7172737578797b7c7d7f808183858688898a8b8d8e8f909293949598999a9b9c9e9fa0a1a2a3a4a5a6a9aaabacadafb0b1b2b3b5b6b7b8babbbcbdbfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8dadedfe0e1e2e3e4e5e7e8eaebecedeeeff1f5f6f8fafbfd,67:010203040506070c0e0f1112131618191a1c1e20212223242527292e303233363738393b3c3e3f414445474a4b4d5254555758595a5b5d62636466676b6c6e717476#78797a7b7d8082838586888a8c8d8e8f9192939496999b9fa0a1a4a6a9acaeb1b2b4b9babbbcbdbebfc0c2c5c6c7c8c9cacbcccdced5d6d7dbdfe1e3e4e6e7e8eaebedeef2f5f6f7f8f9fafbfcfe,68:01020304060d1012141518191a1b1c1e1f20222324252627282b2c2d2e2f30313435363a3b3f474b4d4f52565758595a5b5c5d5e5f6a6c6d6e6f707172737578797a7b7c7d7e7f8082848788898a8b8c8d8e90919294959698999a9b9c9d9e9fa0a1a3a4a5a9aaabacaeb1b2b4b6b7b8#b9babbbcbdbebfc1c3c4c5c6c7c8cacccecfd0d1d3d4d6d7d9dbdcdddedfe1e2e4e5e6e7e8e9eaebecedeff2f3f4f6f7f8fbfdfeff,69:00020304060708090a0c0f11131415161718191a1b1c1d1e21222325262728292a2b2c2e2f313233353637383a3b3c3e4041434445464748494a4b4c4d4e4f50515253555658595b5c5f616264656768696a6c6d6f7072737475767a7b7d7e7f8183858a8b8c8e8f909192939697999a9d9e9fa0a1a2a3a4a5a6a9aaacaeafb0b2b3b5b6b8b9babcbd#bebfc0c2c3c4c5c6c7c8c9cbcdcfd1d2d3d5d6d7d8d9dadcdddee1e2e3e4e5e6e7e8e9eaebeceeeff0f1f3f4f5f6f7f8f9fafbfcfe,6a:000102030405060708090b0c0d0e0f10111213141516191a1b1c1d1e20222324252627292b2c2d2e30323334363738393a3b3c3f40414243454648494a4b4c4d4e4f515253545556575a5c5d5e5f60626364666768696a6b6c6d6e6f70727374757677787a7b7d7e7f81828385868788898a8b8c8d8f929394959698999a9b9c9d9e9fa1a2a3a4a5a6#a7a8aaadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,6b:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f252628292a2b2c2d2e2f303133343536383b3c3d3f4041424445484a4b4d4e4f5051525354555657585a5b5c5d5e5f606168696b6c6d6e6f7071727374757677787a7d7e7f808588#8c8e8f909194959798999c9d9e9fa0a2a3a4a5a6a7a8a9abacadaeafb0b1b2b6b8b9babbbcbdbec0c3c4c6c7c8c9caccced0d1d8dadcdddedfe0e2e3e4e5e6e7e8e9ecedeef0f1f2f4f6f7f8fafbfcfeff,6c:000102030408090a0b0c0e12171c1d1e2023252b2c2d31333637393a3b3c3e3f434445484b4c4d4e4f5152535658595a62636566676b6c6d6e6f71737577787a7b7c7f8084878a8b8d8e9192959697989a9c9d9ea0a2a8acafb0b4b5b6b7bac0c1c2c3c6c7c8cbcdcecfd1d2d8#d9dadcdddfe4e6e7e9ecedf2f4f9ff,6d:000203050608090a0d0f101113141516181c1d1f20212223242628292c2d2f30343637383a3f404244494c50555657585b5d5f6162646567686b6c6d707172737576797a7b7d7e7f8081838486878a8b8d8f9092969798999a9ca2a5acadb0b1b3b4b6b7b9babbbcbdbec1c2c3c8c9cacdcecfd0d2d3d4d5d7dadbdcdfe2e3e5e7e8e9eaedeff0f2f4f5f6f8fafdfeff,6e:0001020304060708090b0f12131518191b1c1e1f222627282a2c2e30313335#3637393b3c3d3e3f40414245464748494a4b4c4f5051525557595a5c5d5e606162636465666768696a6c6d6f707172737475767778797a7b7c7d8081828487888a8b8c8d8e91929394959697999a9b9d9ea0a1a3a4a6a8a9abacadaeb0b3b5b8b9bcbebfc0c3c4c5c6c8c9cacccdced0d2d6d8d9dbdcdde3e7eaebecedeeeff0f1f2f3f5f6f7f8fafbfcfdfeff,6f:000103040507080a0b0c0d0e101112161718191a1b1c1d1e1f212223252627282c2e303234353738393a3b3c3d3f404142#43444548494a4c4e4f5051525354555657595a5b5d5f60616364656768696a6b6c6f707173757677797b7d7e7f808182838586878a8b8f909192939495969798999a9b9d9e9fa0a2a3a4a5a6a8a9aaabacadaeafb0b1b2b4b5b7b8babbbcbdbebfc1c3c4c5c6c7c8cacbcccdcecfd0d3d4d5d6d7d8d9dadbdcdddfe2e3e4e5e6e7e8e9eaebecedf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,70:000102030405060708090a0b0c0d0e0f1012131415161718191c1d1e1f2021222425262728292a#2b2c2d2e2f30313233343637383a3b3c3d3e3f404142434445464748494a4b4d4e505152535455565758595a5b5c5d5f606162636465666768696a6e7172737477797a7b7d818283848687888b8c8d8f90919397989a9b9e9fa0a1a2a3a4a5a6a7a8a9aab0b2b4b5b6babebfc4c5c6c7c9cbcccdcecfd0d1d2d3d4d5d6d7dadcdddee0e1e2e3e5eaeef0f1f2f3f4f5f6f8fafbfcfeff,71:0001020304050607080b0c0d0e0f111214171b1c1d1e1f2021222324252728292a2b2c2d2e323334#353738393a3b3c3d3e3f4041424344464748494b4d4f505152535455565758595a5b5d5f6061626365696a6b6c6d6f707174757677797b7c7e7f8081828385868788898b8c8d8e909192939596979a9b9c9d9ea1a2a3a4a5a6a7a9aaabadaeafb0b1b2b4b6b7b8babbbcbdbebfc0c1c2c4c5c6c7c8c9cacbcccdcfd0d1d2d3d6d7d8d9dadbdcdddedfe1e2e3e4e6e8e9eaebecedeff0f1f2f3f4f5f6f7f8fafbfcfdfeff,72:0001020304050708090a0b0c0d0e0f101112131415161718191a#1b1c1e1f2021222324252627292b2d2e2f3233343a3c3e40414243444546494a4b4e4f505153545557585a5c5e60636465686a6b6c6d707173747677787b7c7d828385868788898c8e9091939495969798999a9b9c9d9ea0a1a2a3a4a5a6a7a8a9aaabaeb1b2b3b5babbbcbdbebfc0c5c6c7c9cacbcccfd1d3d4d5d6d8dadb#95$,30:000102,00b702:c9c7,00a830:0305,2014ff5e20:162618191c1d,30:141508090a0b0c0d0e0f16171011,00:b1d7f7,22:362728110f2a2908371aa52520,231222:992b2e614c483d1d606e6f64651e3534,26:4240,00b020:3233,2103ff0400a4ff:e0e1,203000a7211626:0605,25:cbcfcec7c6a1a0b3b2,203b21:92909193,30:13#95$,21:70717273747576777879#4$,24:88898a8b8c8d8e8f909192939495969798999a9b7475767778797a7b7c7d7e7f808182838485868760616263646566676869##,32:20212223242526272829##,21:606162636465666768696a6b#97$,ff:010203e505060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5de3#95$,30:4142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f90919293#106$a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6#103$,03:9192939495969798999a9b9c9d9e9fa0a1a3a4a5a6a7a8a9#6$b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c3c4c5c6c7c8c9#5$,fe:3536393a3f403d3e41424344##3b3c373831#3334#104$,04:10111213141501161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f#13$30313233343551363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f#11$,02:cacbd9,20:13152535,21:050996979899,22:151f23526667bf,25:505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f7071727381828384858687#88898a8b8c8d8e8f939495bcbde2e3e4e5,2609229530:121d1e#9$,010100e101ce00e0011300e9011b00e8012b00ed01d000ec014d00f301d200f2016b00fa01d400f901:d6d8dadc,00:fcea,0251e7c701:4448,e7c802:61#2$,31:05060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526272829#19$,30:212223242526272829,32a333:8e8f9c9d9ea1c4ced1d2d5,fe30ff:e2e4#,212132:31#,20:10#1$,30:fc9b9cfdfe069d9e,fe:494a4b4c4d4e4f50515254555657595a5b5c5d5e5f6061#626364656668696a6b,e7:e7e8e9eaebecedeeeff0f1f2f3,30:07#11$,25:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b#13$,72:dcdddfe2e3e4e5e6e7eaebf5f6f9fdfeff,73:00020405060708090b0c0d0f1011121418191a1f2023242627282d2f30323335363a3b3c3d404142434445464748#494a4b4c4e4f515354555658595a5b5c5d5e5f6162636465666768696a6b6e7071#92$72737475767778797a7b7c7d7f808182838586888a8c8d8f90929394959798999a9c9d9ea0a1a3a4a5a6a7a8aaacadb1b4b5b6b8b9bcbdbebfc1c3c4c5c6c7#cbccced2d3d4d5d6d7d8dadbdcdddfe1e2e3e4e6e8eaebeceeeff0f1f3f4f5f6f7#92$f8f9fafbfcfdfeff,74:0001020407080b0c0d0e1112131415161718191c1d1e1f2021232427292b2d2f31323738393a3b3d3e3f4042434445464748494a4b4c4d#4e4f505152535456585d606162636465666768696a6b6c6e6f717273747578797a#92$7b7c7d7f8284858688898a8c8d8f9192939495969798999a9b9d9fa0a1a2a3a4a5a6aaabacadaeafb0b1b2b3b4b5b6b7b8b9bbbcbdbebfc0c1c2c3c4c5c6c7#c8c9cacbcccdcecfd0d1d3d4d5d6d7d8d9dadbdddfe1e5e7e8e9eaebecedf0f1f2#92$f3f5f8f9fafbfcfdfe,75:0001020305060708090a0b0c0e1012141516171b1d1e202122232426272a2e3436393c3d3f414243444647494a4d5051525355565758#5d5e5f60616263646768696b6c6d6e6f7071737576777a7b7c7d7e808182848587#92$88898a8c8d8e909395989b9c9ea2a6a7a8a9aaadb6b7babbbfc0c1c6cbcccecfd0d1d3d7d9dadcdddfe0e1e5e9ecedeeeff2f3f5f6f7f8fafbfdfe,76:02040607#08090b0d0e0f11121314161a1c1d1e212327282c2e2f31323637393a3b3d414244#92$45464748494a4b4e4f50515253555758595a5b5d5f6061626465666768696a6c6d6e7071727374757677797a7c7f80818385898a8c8d8f9092949597989a9b#9c9d9e9fa0a1a2a3a5a6a7a8a9aaabacadafb0b3b5b6b7b8b9babbbcbdbec0c1c3,554a963f57c3632854ce550954c076:914c,853c77ee827e788d72319698978d6c285b894ffa630966975cb880fa684880ae660276ce51f9655671ac7ff1888450b2596561ca6fb382ad634c625253ed54277b06516b75a45df462d48dcb9776628a8019575d97387f627238767d67cf767e64464f708d2562dc7a17659173ed642c6273822c9881677f724862:6ecc,4f3474e3534a529e7eca90a65e2e6886699c81807ed168d278c5868c9551508d8c2482de80de53058912526576:c4c7c9cbccd3d5d9dadcdddee0e1e2e3e4e6e7e8e9eaebecedf0f3f5f6f7fafbfdff,77:00020305060a0c0e0f1011121314151617181b1c1d1e21232425272a2b#2c2e3031323334393b3d3e3f4244454648494a4b4c4d4e4f52535455565758595c,858496f94fdd582199715b9d62:b1a5,66b48c799c8d7206676f789160b253:5117,8f8880cc8d1d94a1500d72c8590760eb711988ab595482ef672c7b285d297ef7752d6cf58e668ff8903c9f3b6bd491197b145f7c78a784d6853d6b:d5d9d6,5e:0187,75f995ed655d5f:0ac5,8f9f58c181c2907f965b97ad8fb97f168d2c62414fbf53:d85e,8f:a8a9ab,904d68075f6a819888689cd6618b522b762a5f6c658c6fd26ee85bbe644851:75b0,67c44e1979c9997c70b377:5d5e5f606467696a6d6e6f7071727374757677787a7b7c818283868788898a8b8f90939495969798999a9b9c9d9ea1a3a4a6a8abadaeafb1b2b4b6b7b8b9ba#bcbec0c1c2c3c4c5c6c7c8c9cacbcccecfd0d1d2d3d4d5d6d8d9dadddedfe0e1e4,75c55e7673bb83e064ad62e894b56ce2535a52c3640f94c27b944f2f5e1b823681:168a,6e246cca9a736355535c54fa886557e04e0d5e036b657c3f90e8601664e6731c88c16750624d8d22776c8e2991c75f6983dc8521991053c286956b8b60:ede8,707f82:cd31,4ed36ca785cf64cd7cd969fd66f9834953957b564fa7518c6d4b5c428e6d63d253c983:2c36,67e578b4643d5bdf5c945dee8be762c667f48c7a640063ba8749998b8c177f2094f24ea7961098a4660c731677:e6e8eaeff0f1f2f4f5f7f9fafbfc,78:0304050607080a0b0e0f101315191b1e20212224282a2b2e2f31323335363d3f414243444648494a4b4d4f51535458595a#5b5c5e5f606162636465666768696f7071727374757678797a7b7d7e7f80818283,573a5c1d5e38957f507f80a05382655e7545553150218d856284949e671d56326f6e5de2543570928f66626f64a463a35f7b6f8890f481e38fb05c1866685ff16c8996488d81886c649179f057ce6a59621054484e587a0b60e96f848bda627f901e9a8b79e4540375f4630153196c608fdf5f1b9a70803b9f7f4f885c3a8d647fc565a570bd51:45b2,866b5d075ba062bd916c75748e0c7a2061017b794ec77ef877854e1181ed521d51fa6a7153a88e87950496cf6ec19664695a78:848586888a8b8f9092949596999d9ea0a2a4a6a8a9aaabacadaeafb5b6b7b8babbbcbdbfc0c2c3c4c6c7c8cccdcecfd1d2d3d6d7d8dadbdcdddedfe0e1e2e3#e4e5e6e7e9eaebedeeeff0f1f3f5f6f8f9fbfcfdfeff,79:00020304060708090a0b0c,784050a877d7641089e6590463e35ddd7a7f693d4f20823955984e3275ae7a975e:628a,95ef521b5439708a6376952457826625693f918755076df37eaf882262337ef075b5832878c196cc8f9e614874f78bcd6b64523a8d506b21806a847156f153064e:ce1b,51d17c97918b7c074fc38e7f7be17a9c64675d1450ac810676017cb96dec7fe067515b:58f8,78cb64:ae13,63:aa2b,9519642d8fbe7b5476296253592754466b7950a362345e266b864ee38d37888b5f85902e79:0d0e0f1011121415161718191a1b1c1d1f2021222325262728292a2b2c2d2e2f3031323335363738393d3f42434445474a4b4c4d4e4f505152545558596163#6466696a6b6c6e70717273747576797b7c7d7e7f8283868788898b8c8d8e909192,6020803d62c54e39535590f863b880c665e66c2e4f4660ee6de18bde5f3986cb5f536321515a83616863520063638e4850125c9b79775bfc52307a3b60bc905376d75f:b797,76848e6c706f767b7b4977aa51f3909358244f4e6ef48fea654c7b1b72c46da47fdf5ae162b55e95573084827b2c5e1d5f1f90127f1498a063826ec7789870b95178975b57ab75354f4375385e9760e659606dc06bbf788953fc96d551cb52016389540a94938c038dcc7239789f87768fed8c0d53e079:939495969798999b9c9d9e9fa0a1a2a3a4a5a6a8a9aaabacadaeafb0b1b2b4b5b6b7b8bcbfc2c4c5c7c8cacccecfd0d3d4d6d7d9dadbdcdddee0e1e2e5e8ea#eceef1f2f3f4f5f6f7f9fafcfeff,7a:0104050708090a0c0f10111213151618191b1c,4e0176ef53ee948998769f0e952d5b9a8ba24e:221c,51ac846361c252a8680b4f97606b51bb6d1e515c6296659796618c46901775d890fd77636bd272:8aec,8bfb583577798d4c675c9540809a5ea66e2159927aef77ed953b6bb565ad7f0e58065151961f5bf958a954288e726566987f56e4949d76fe9041638754c659:1a3a,579b8eb267358dfa8235524160f0581586fe5ce89e454fc4989d8bb95a2560765384627c904f9102997f6069800c513f80335c1499756d314e8c7a:1d1f21222425262728292a2b2c2d2e2f303132343536383a3e4041424344454748494a4b4c4d4e4f50525354555658595a5b5c5d5e5f606162636465666768#696a6b6c6d6e6f717273757b7c7d7e828587898a8b8c8e8f909394999a9b9ea1a2,8d3053d17f5a7b4f4f104e4f96006cd573d085e95e06756a7ffb6a0a77fe94927e4151e170e653cd8fd483038d2972af996d6cdb574a82b365b980aa623f963259a84eff8bbf7eba653e83f2975e556198de80a5532a8bfd542080ba5e9f6cb88d3982ac915a54296c1b52067eb7575f711a6c7e7c89594b4efd5fff61247caa4e305c0167ab87025cf0950b98ce75af70fd902251af7f1d8bbd594951e44f5b5426592b657780a45b7562:76c2,8f905e456c1f7b264f:0fd8,670d7a:a3a4a7a9aaabaeafb0b1b2b4b5b6b7b8b9babbbcbdbec0c1c2c3c4c5c6c7c8c9cacccdcecfd0d1d2d3d4d5d7d8dadbdcdde1e2e4e7e8e9eaebeceef0f1f2f3#f4f5f6f7f8fbfcfe,7b:0001020507090c0d0e1012131617181a1c1d1f21222327292d,6d:6eaa,798f88b15f17752b629a8f854fef91dc65a781:2f51,5e9c81508d74526f89868d4b590d50854ed8961c723681798d1f5bcc8ba3964459877f1a549056:760e,8be565396982949976d66e895e72751867:46d1,7aff809d8d76611f79c665628d635188521a94a27f38809b7eb25c976e2f67607bd9768b9ad8818f7f947cd5641e95507a3f54:4ae5,6b4c640162089e3d80f3759952729769845b683c86e496:0194,94ec4e2a54047ed968398ddf801566f45e9a7fb97b:2f303234353637393b3d3f404142434446484a4d4e535557595c5e5f61636465666768696a6b6c6d6f70737476787a7c7d7f81828384868788898a8b8c8e8f#9192939698999a9b9e9fa0a3a4a5aeafb0b2b3b5b6b7b9babbbcbdbebfc0c2c3c4,57c2803f68975de5653b529f606d9f9a4f9b8eac516c5bab5f135de96c5e62f18d21517194a952fe6c9f82df72d757a267848d2d591f8f9c83c754957b8d4f306cbd5b6459d19f1353e486ca9aa88c3780a16545987e56fa96c7522e74dc52505be1630289024e5662d0602a68fa51735b9851a089c27ba199867f5060ef704c8d2f51495e7f901b747089c4572d78455f529f9f95fa8f689b3c8be17678684267dc8d:ea35,523d8f8a6eda68cd950590ed56fd679c88f98fc754c87b:c5c8c9cacbcdcecfd0d2d4d5d6d7d8dbdcdedfe0e2e3e4e7e8e9ebecedeff0f2f3f4f5f6f8f9fafbfdff,7c:0001020304050608090a0d0e101112131415171819#1a1b1c1d1e20212223242528292b2c2d2e2f3031323334353637393a3b3c3d3e42,9ab85b696d776c264ea55bb39a87916361a890af97e9542b6db55bd251fd558a7f:55f0,64bc634d65f161be608d710a6c:5749,592f676d822a58d5568e8c6a6beb90dd597d801753f76d695475559d83:77cf,683879be548c4f55540876d28c8996026cb36db88d6b89109e648d3a563f9ed175d55f8872e0606854fc4ea86a2a886160528f7054c470d886799e3f6d2a5b8f5f187ea255894faf7334543c539a501954:0e7c,4e4e5ffd745a58f6846b80e1877472d07cca6e567c:434445464748494a4b4c4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f70717275767778797a7e7f8081828384858687#888a8b8c8d8e8f90939496999a9ba0a1a3a6a7a8a9abacadafb0b4b5b6b7b8babb,5f27864e552c62a44e926caa623782b154d7534e733e6ed1753b521253168bdd69d05f8a60006dee574f6b2273af68538fd87f13636260a3552475ea8c6271156da35ba65e7b8352614c9ec478fa87577c27768751f060f6714c66435e4c604d8c0e707063258f895fbd606286d456de6bc160946167534960e066668d3f79fd4f1a70e96c478b:b3f2,7ed88364660f5a5a9b426d:51f7,8c416d3b4f19706b83b7621660d1970d8d27797851fb57:3efa,673a75787a3d79ef7b957c:bfc0c2c3c4c6c9cbcecfd0d1d2d3d4d8dadbdddee1e2e3e4e5e6e7e9eaebecedeef0f1f2f3f4f5f6f7f9fafcfdfeff,7d:000102030405060708090b0c0d0e0f10#1112131415161718191a1b1c1d1e1f212324252628292a2c2d2e30313233343536,808c99658ff96fc08ba59e2159ec7ee97f095409678168d88f917c4d96c653ca602575be6c7253735ac97ea7632451e0810a5df184df628051805b634f0e796d524260b86d4e5b:c4c2,8b:a1b0,65e25fcc964559937e:e7aa,560967b759394f735bb652a0835a988a8d3e753294be50477a3c4ef767b69a7e5ac16b7c76d1575a5c167b3a95f4714e517c80a9827059787f04832768c067ec78:b177,62e363617b804fed526a51cf835069db92748d:f531,89c1952e7bad4ef67d:3738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6f70717273747576#78797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798,506582305251996f6e:1085,6da75efa50f559dc5c066d466c5f7586848b686859568bb253209171964d854969127901712680f64ea490ca6d479a845a0756bc640594f077eb4fa5811a72e189d2997a7f347ede527f655991758f:7f83,53eb7a9663:eda5,768679f888579636622a52ab8282685467706377776b7aed6d017ed389e359d0621285c982a5754c501f4ecb75a58beb5c4a5dfe7b4b65a491d14eca6d25895f7d2795264ec58c288fdb9773664b79818fd170ec6d787d:999a9b9c9d9e9fa0a1a2a3a4a5a7a8a9aaabacadafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9#dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fa,5c3d52b283465162830e775b66769cb84eac60ca7c:beb3,7ecf4e958b66666f988897595883656c955c5f8475c997567a:dfde,51c070af7a9863ea7a767ea0739697ed4e4570784e5d915253a965:51e7,81fc8205548e5c31759a97a062d872d975bd5c459a7983ca5c40548077e94e3e6cae805a62d2636e5de851778ddd8e1e952f4ff153e560e770ac526763509e435a1f5026773753777ee26485652b628963985014723589c951b38bc07edd574783cc94a7519b541b5cfb7d:fbfcfdfeff,7e:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536373839#3a3c3d3e3f40424344454648494a4b4c4d4e4f505152535455565758595a5b5c5d,4fca7ae36d5a90e19a8f55805496536154af5f0063e9697751ef6168520a582a52d8574e780d770b5eb761777ce062:5b97,4ea27095800362f770e49760577782db67ef68f578d5989779d158f354b353ef6e34514b523b5ba28bfe80af554357a660735751542d7a7a60505b5463a762a053e362635bc767af54ed7a9f82e691775e9388e4593857ae630e8de880ef57577b774fa95feb5bbd6b3e53217b5072c2684677:ff36,65f751b54e8f76d45cbf7aa58475594e9b4150807e:5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f8081838485868788898a8b8c8d8e8f909192939495969798999a9c9d9e#aeb4bbbcd6e4ecf9,7f:0a101e37393b3c3d3e3f404143464748494a4b4c4d4e4f5253,998861276e8357646606634656f062:ec69,5ed39614578362c955878721814a8fa3556683b167658d5684dd5a6a680f62e67bee961151706f9c8c3063fd89c861d27f0670c26ee57405699472fc5eca90ce67176d6a635e52b3726280014f6c59e5916a70d96d9d52d24e5096f7956d857e78ca7d2f5121579264c2808b7c7b6cea68f1695e51b7539868a872819ece7bf172f879bb6f137406674e91cc9ca4793c83:8954,540f68174e3d538952b1783e5386522950884f:8bd0,7f:56595b5c5d5e6063646566676b6c6d6f7073757677787a7b7c7d7f8082838485868788898b8d8f9091929395969798999b9ca0a2a3a5a6a8a9aaabacadaeb1#b3b4b5b6b7babbbec0c2c3c4c6c7c8c9cbcdcfd0d1d2d3d6d7d9dadbdcdddee2e3,75e27acb7c926ca596b6529b748354e94fe9805483b28fde95705ec9601c6d9f5e18655b813894fe604b70bc7ec37cae51c968817cb1826f4e248f8691cf667e4eae8c0564a9804a50da759771ce5be58fbd6f664e86648295635ed66599521788c270c852a3730e7433679778f797164e3490bb9cde6dcb51db8d41541d62ce73b283f196f69f8494c34f367f9a51cc707596755cad988653e64ee46e9c740969b4786b998f7559521876246d4167f3516d9f99804b54997b3c7abf7f:e4e7e8eaebecedeff2f4f5f6f7f8f9fafdfeff,80:020708090a0e0f11131a1b1d1e1f2123242b2c2d2e2f303234393a3c3e404144454748494e4f505153555657#595b5c5d5e5f6061626364656667686b6c6d6e6f7072737475767778797a7b7c7d,9686578462e29647697c5a0464027bd36f0f964b82a6536298855e90708963b35364864f9c819e93788c97328d:ef42,9e7f6f5e79845f559646622e9a74541594dd4fa365c55c:6561,7f1586516c2f5f8b73876ee47eff5ce6631b5b6a6ee653754e7163a0756562a18f6e4f264ed16ca67eb68bba841d87ba7f57903b95237ba99aa188f8843d6d1b9a867edc59889ebb739b780186829a:6c82,561b541757cb4e709ea653568fc881097792999286ee6ee1851366fc61626f2b80:7e818285888a8d8e8f909192949597999ea3a6a7a8acb0b3b5b6b8b9bbc5c7c8c9cacbcfd0d1d2d3d4d5d8dfe0e2e3e6eef5f7f9fbfeff,81:000103040507080b#0c1517191b1c1d1f202122232425262728292a2b2d2e3033343537393a3b3c3d3f,8c298292832b76f26c135fd983bd732b8305951a6bdb77db94c6536f830251925e3d8c8c8d384e4873ab679a68859176970971646ca177095a9295416bcf7f8e66275bd059b95a9a95:e8f7,4eec84:0c99,6aac76df9530731b68a65b5f772f919a97617cdc8ff78c1c5f257c7379d889c56ccc871c5bc65e4268c977207ef551:954d,52c95a297f05976282d763cf778485d079d26e3a5e9959998511706d6c1162bf76bf654f60af95fd660e879f9e2394ed54:0d7d,8c2c647881:40414243444547494d4e4f525657585b5c5d5e5f6162636466686a6b6c6f727375767778818384858687898b8c8d8e90929394959697999a9e9fa0a1a2a4a5#a7a9abacadaeafb0b1b2b4b5b6b7b8b9bcbdbebfc4c5c7c8c9cbcdcecfd0d1d2d3,647986116a21819c78e864699b5462b9672b83ab58a89ed86cab6f205bde964c8c0b725f67d062c772614ea959c66bcd589366ae5e5552df6155672876ee776672677a4662ff54:ea50,94a090a35a1c7eb36c164e435976801059485357753796be56ca63208111607c95f96dd65462998151855ae980fd59ae9713502a6ce55c3c62df4f60533f817b90066eba852b62c85e7478be64b5637b5ff55a18917f9e1f5c3f634f80425b7d556e95:4a4d,6d8560a867e072de51dd5b8181:d4d5d6d7d8d9dadbdcdddedfe0e1e2e4e5e6e8e9ebeeeff0f1f2f5f6f7f8f9fafdff,82:030708090a0b0e0f111315161718191a1d2024252627292e323a3c3d3f#404142434546484a4c4d4e5051525354555657595b5c5d5e606162636465666769,62e76cde725b626d94ae7ebd81136d53519c5f04597452aa6012597366968650759f632a61e67cef8bfa54e66b279e256bb485d5545550766ca4556a8db4722c5e156015743662cd6392724c5f986e436d3e65006f5876d878d076fc7554522453db4e535e9e65c180:2ad6,629b5486522870ae888d8dd16ce1547880da57f988f48d54966a914d4f696c9b55b776c6783062a870f96f8e5f6d84ec68da787c7bf781a8670b9e4f636778b0576f7812973962:79ab,528874356bd782:6a6b6c6d71757677787b7c808183858687898c90939495969a9b9ea0a2a3a7b2b5b6babbbcbfc0c2c3c5c6c9d0d6d9dadde2e7e8e9eaecedeef0f2f3f5f6f8#fafcfdfeff,83:000a0b0d1012131618191d1e1f20212223242526292a2e3032373b3d,5564813e75b276ae533975de50fb5c418b6c7bc7504f72479a9798d86f0274e27968648777a562fc98918d2b54c180584e52576a82f9840d5e7351ed74f68bc45c4f57616cfc98875a4678349b448feb7c955256625194fa4ec68386846183e984b257d467345703666e6d668c3166dd7011671f6b3a6816621a59bb4e0351c46f0667d26c8f517668cb59476b6775665d0e81109f5065d779:4841,9a918d775c824e5e4f01542f5951780c56686c148fc45f036c:7de3,8bab639083:3e3f41424445484a4b4c4d4e5355565758595d6270717273747576797a7e7f808182838487888a8b8c8d8f909194959697999a9d9fa1a2a3a4a5a6a7acadae#afb5bbbebfc2c3c4c6c8c9cbcdced0d1d2d3d5d7d9dadbdee2e3e4e6e7e8ebeced,60706d3d7275626694:8ec5,53438fc17b7e4edf8c264e7e9ed494:b1b3,524d6f5c90636d458c3458115d4c6b:2049,67aa545b81547f8c589985375f3a62a26a47953965726084686577a74e544fa85de7979864ac7fd85ced4fcf7a8d520783044e14602f7a8394a64fb54eb279e6743452e482b964d279bd5bdd6c8197528f7b6c22503e537f6e0564ce66746c3060c598778bf75e86743c7a7779cb4e1890b174036c4256da914b6cc58d8b533a86c666f28eaf5c489a716e2083:eeeff3f4f5f6f7fafbfcfeff,84:0002050708090a10121314151617191a1b1e1f20212223292a2b2c2d2e2f30323334353637393a3b3e3f404142434445474849#4a4b4c4d4e4f505253545556585d5e5f606264656667686a6e6f70727477797b7c,53d65a369f8b8da353bb570898a76743919b6cc9516875ca62f372ac52:389d,7f3a7094763853749e4a69b7786e96c088d97fa471:36c3,518967d374e458e4651856b78ba9997662707ed560f970ed58ec4e:c1ba,5fcd97e74efb8ba45203598a7eab62544ecd65e5620e833884c98363878d71946eb65bb97ed2519763c967d480898339881551125b7a59828fb14e736c5d516589258f6f962e854a745e95:10f0,6da682e55f3164926d128428816e9cc3585e8d5b4e0953c184:7d7e7f8081838485868a8d8f90919293949596989a9b9d9e9fa0a2a3a4a5a6a7a8a9aaabacadaeb0b1b3b5b6b7bbbcbec0c2c3c5c6c7c8cbcccecfd2d4d5d7#d8d9dadbdcdee1e2e4e7e8e9eaebedeeeff1f2f3f4f5f6f7f8f9fafbfdfe,85:000102,4f1e6563685155d34e2764149a9a626b5ac2745f82726da968ee50e7838e7802674052396c997eb150bb5565715e7b5b665273ca82eb67495c715220717d886b95ea965564c58d6181b355846c5562477f2e58924f2455468d4f664c4e0a5c1a88f368a2634e7a0d70e7828d52fa97f65c1154e890b57ecd59628d4a86c782:0c0d,8d6664445c0461516d89793e8bbe78377533547b4f388eab6df15a207ec5795e6c885ba15a76751a80be614e6e1758f075:1f25,727253477ef385:030405060708090a0b0d0e0f101214151618191b1c1d1e2022232425262728292a2d2e2f303132333435363e3f404142444546474b4c4d4e4f505152535455#57585a5b5c5d5f60616263656667696a6b6c6d6e6f707173757677787c7d7f8081,770176db526980dc57235e08593172ee65bd6e7f8bd75c388671534177f362fe65f64ec098df86805b9e8bc653f277e24f7f5c4e9a7659cb5f0f793a58eb4e1667ff4e8b62ed8a93901d52bf662f55dc566c90024ed54f8d91ca99706c0f5e0260435ba489c68bd56536624b99965b:88ff,6388552e53d77626517d852c67a268b36b8a62928f9353d482126dd1758f4e668d4e5b70719f85af66:91d9,7f7287009ecd9f205c5e672f8ff06811675f620d7ad658855eb665706f3185:82838688898a8b8c8d8e909192939495969798999a9d9e9fa0a1a2a3a5a6a7a9abacadb1b2b3b4b5b6b8babbbcbdbebfc0c2c3c4c5c6c7c8cacbcccdced1d2#d4d6d7d8d9dadbdddedfe0e1e2e3e5e6e7e8eaebecedeeeff0f1f2f3f4f5f6f7f8,60555237800d6454887075295e05681362f4971c53cc723d8c016c3477617a0e542e77ac987a821c8bf47855671470c165af64955636601d79c153f84e1d6b7b80865bfa55e356db4f:3a3c,99725df3677e80386002988290015b8b8b:bcf5,641c825864de55fd82cf91654fd77d20901f7c9f50f358516eaf5bbf8bc980839178849c7b97867d96:8b8f,7ee59ad3788e5c817a57904296a7795f5b59635f7b0b84d168ad55067f2974107d2295016240584c4ed65b835979585485:f9fafcfdfe,86:0001020304060708090a0b0c0d0e0f10121314151718191a1b1c1d1e1f20212223242526282a2b2c2d2e2f3031323334353637393a3b3d3e3f40#4142434445464748494a4b4c525355565758595b5c5d5f6061636465666768696a,736d631e8e:4b0f,80ce82d462ac53f06cf0915e592a60016c70574d644a8d2a762b6ee9575b6a8075f06f6d8c:2d08,57666bef889278b363a253f970ad6c645858642a580268e0819b55107cd650188eba6dcc8d9f70eb638f6d9b6ed47ee68404684390036dd896768ba85957727985e4817e75bc8a8a68af52548e22951163d098988e44557c4f5366ff568f60d56d9552435c4959296dfb586b75:301c,606c82148146631167618fe2773a8d:f334,94c15e165385542c70c386:6d6f7072737475767778838485868788898e8f90919294969798999a9b9e9fa0a1a2a5a6abadaeb2b3b7b8b9bbbcbdbebfc1c2c3c5c8cccdd2d3d5d6d7dadc#dde0e1e2e3e5e6e7e8eaebeceff5f6f7fafbfcfdff,87:010405060b0c0e0f10111416,6c405ef7505c4ead5ead633a8247901a6850916e77b3540c94dc5f647ae5687663457b527edf75db507762955934900f51f879c37a8156fe5f9290146d825c60571f541051546e4d56e263a89893817f8715892a9000541e5c6f81c062:d658,81319e3596409a:6e7c,692d59a562d3553e631654c786d96d3c5a0374e6889c6b6a59168c4c5f2f6e7e73a9987d4e3870f75b8c7897633d665a769660cb5b9b5a494e0781556c6a738b4ea167897f515f8065fa671b5fd859845a0187:191b1d1f20242627282a2b2c2d2f303233353638393a3c3d404142434445464a4b4d4f505152545556585a5b5c5d5e5f6162666768696a6b6c6d6f71727375#7778797a7f8081848687898a8c8e8f90919294959698999a9b9c9d9ea0a1a2a3a4,5dcd5fae537197e68fdd684556f4552f60df4e3a6f4d7ef482c7840e59d44f:1f2a,5c3e7eac672a851a5473754f80c355829b4f4f4d6e2d8c135c096170536b761f6e29868a658795fb7eb9543b7a337d0a95ee55e17fc174ee631d87176da17a9d621165a1536763e16c835deb545c94a84e4c6c618bec5c4b65e0829c68a754:3e34,6b:cb66,4e9463425348821e4f:0dae,575e620a96fe6664726952:ffa1,609f8bef661471996790897f785277fd6670563b54389521727a87:a5a6a7a9aaaeb0b1b2b4b6b7b8b9bbbcbebfc1c2c3c4c5c7c8c9cccdcecfd0d4d5d6d7d8d9dadcdddedfe1e2e3e4e6e7e8e9ebecedeff0f1f2f3f4f5f6f7f8#fafbfcfdff,88:0001020405060708090b0c0d0e0f101112141718191a1c1d1e1f2023,7a00606f5e0c6089819d591560dc718470ef6eaa6c5072806a8488ad5e2d4e605ab3559c94e36d177cfb9699620f7ec6778e867e5323971e8f9666875ce14fa072ed4e0b53a6590f54136380952851484ed99c9c7ea454b88d248854823795f26d8e5f265acc663e966973:b02e,53bf817a99857fa15baa96:7750,7ebf76f853a2957699997bb189446e584e617fd479658be660f354cd4eab98795df76a6150cf54118c618427785d9704524a54ee56a395006d885bb56dc6665388:2425262728292a2b2c2d2e2f30313334353637383a3b3d3e3f414243464748494a4b4e4f505152535556585a5b5c5d5e5f6066676a6d6f717374757678797a#7b7c80838687898a8c8e8f90919394959798999a9b9d9e9fa0a1a3a5a6a7a8a9aa,5c0f5b5d6821809655787b11654869544e9b6b47874e978b534f631f643a90aa659c80c18c10519968b0537887f961c86c:c4fb,8c225c5185aa82af950c6b238f9b65b05f:fbc3,4fe18845661f8165732960fa51745211578b5f6290a2884c91925e78674f602759d351:44f6,80f853086c7996c4718a4f:11ee,7f9e673d55c5950879c088967ee3589f620c9700865a5618987b5f908bb884c4915753d965ed5e8f755c60647d6e5a7f7e:eaed,8f6955a75ba360ac65cb738488:acaeafb0b2b3b4b5b6b8b9babbbdbebfc0c3c4c7c8cacbcccdcfd0d1d3d6d7dadbdcdddee0e1e6e7e9eaebecedeeeff2f5f6f7fafbfdff,89:0001030405060708#090b0c0d0e0f1114151617181c1d1e1f20222324262728292c2d2e2f3132333537,9009766377297eda9774859b5b667a7496ea884052cb718f5faa65ec8be25bfb9a6f5de16b896c5b8b:adaf,900a8fc5538b62bc9e:262d,54404e2b82bd7259869c5d1688596daf96c554d14e9a8bb6710954bd960970df6df976d04e25781487125ca95ef68a00989c960e708e6cbf594463a9773c884d6f148273583071d5538c781a96c155015f6671305bb48c1a9a8c6b83592e9e2f79e76768626c4f6f75a17f8a6d0b96336c274ef075d2517b68376f3e908081705996747689:38393a3b3c3d3e3f40424345464748494a4b4c4d4e4f505152535455565758595a5b5c5d6061626364656768696a6b6c6d6e6f707172737475767778797a7c#7d7e808284858788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1,64475c2790657a918c2359da54ac8200836f898180006930564e8036723791ce51b64e5f987563964e1a53f666f3814b591c6db24e0058f9533b63d694f14f:9d0a,886398905937905779fb4eea80f075916c825b9c59e85f5d69058681501a5df24e5977e34ee5827a6291661390915c794ebf5f7981c69038808475ab4ea688d4610f6bc55fc64e4976ca6ea28b:e3ae,8c0a8bd15f027f:fccc,7ece83:356b,56e06bb797f3963459fb541f94f66deb5bc5996e5c395f15969089:a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c3cdd3d4d5d7d8d9dbdddfe0e1e2e4e7e8e9eaecedeef0f1f2f4f5f6f7f8f9fa#fbfcfdfeff,8a:01020304050608090a0b0c0d0e0f101112131415161718191a1b1c1d,537082f16a315a749e705e947f2883b984:2425,836787478fce8d6276c85f719896786c662054df62e54f6381c375c85eb896cd8e0a86f9548f6cf36d8c6c38607f52c775285e7d4f1860a05fe75c24753190ae94c072b96cb96e389149670953:cbf3,4f5191c98bf153c85e7c8fc26de44e8e76c26986865e611a82064f:59de,903e9c7c61096e:1d14,96854e885a3196e84e0e5c7f79b95b878bed7fbd738957df828b90c15401904755bb5cea5fa161086b3272f180b28a:891e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3f4041424344454647494a4b4c4d4e4f505152535455565758595a5b5c5d5e#5f606162636465666768696a6b6c6d6e6f7071727374757677787a7b7c7d7e7f80,6d745bd388d598848c6b9a6d9e336e0a51:a443,57a38881539f63f48f9556ed54585706733f6e907f188fdc82d1613f6028966266f07ea68d:8ac3,94a55cb37ca4670860a6960580184e9190e75300966851418fd08574915d665597f55b55531d78386742683d54c9707e5bb08f7d518d572854b1651266828d:5e43,810f846c906d7cdf51ff85fb67a365e96fa186a48e81566a90207682707671e58d2362e952196cfd8d3c600e589e618e66fe8d60624e55b36e23672d8f678a:81828384858687888b8c8d8e8f9091929495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2#c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3,94e195f87728680569a8548b4e4d70b88bc86458658b5b857a84503a5be877bb6be18a797c986cbe76cf65a98f975d2d5c5586386808536062187ad96e5b7efd6a1f7ae05f706f335f20638c6da867564e085e108d264ed780c07634969c62db662d627e6cbc8d7571677f695146808753ec906e629854f286f08f998005951785178fd96d5973cd659f771f7504782781fb8d1e94884fa6679575b98bca9707632f9547963584b8632377415f8172f04e896014657462ef6b63653f8a:e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,8b:0001020304050608090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223#24252728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445,5e2775c790d18bc1829d679d652f5431871877e580a281026c414e4b7ec7804c76f4690d6b966267503c4f84574063076b628dbe53ea65e87eb85fd763:1ab7,81:f3f4,7f6e5e1c5cd95236667a79e97a1a8d28709975d46ede6cbb7a924e2d76c55fe0949f88777ec879cd80bf91cd4ef24f17821f54685dde6d328bcc7ca58f7480985e1a549276b15b99663c9aa473e0682a86db6731732a8b:f8db,90107af970db716e62c477a956314e3b845767f152a986c08d2e94f87b518b:464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f6061626364656768696a6b6d6e6f707172737475767778797a7b7c7d7e7f80818283848586#8788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9facb1bbc7d0ea,8c:091e,4f4f6ce8795d9a7b6293722a62fd4e1378168f6c64b08d5a7bc668695e8488c55986649e58ee72b6690e95258ffd8d5857607f008c0651c6634962d95353684c74228301914c55447740707c6d4a517954a88d4459ff6ecb6dc45b5c7d2b4ed47c7d6ed35b5081ea6e0d5b579b0368d58e2a5b977efc603b7eb590b98d70594f63cd79df8db3535265cf79568bc5963b7ec494bb7e825634918967007f6a5c0a907566285de64f5067de505a4f5c57505e:a7#3$,8c:38393a3b3c3d3e3f4042434445484a4b4d4e4f5051525354565758595b5c5d5e5f60636465666768696c6d6e6f707172747576777b7c7d7e7f808183848687#888b8d8e8f90919293959697999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacad,4e:8d0c,51404e105eff53454e:15981e,9b325b6c56694e2879ba4e3f53154e47592d723b536e6c1056df80e499976bd3777e9f174e:369f,9f104e:5c6993,82885b5b556c560f4ec453:8d9da3a5ae,97658d5d53:1af5262e3e,8d5c53:6663,52:02080e2d333f404c5e615c,84af52:7d82819093,51827f544e:bbc3c9c2e8e1ebde,4f1b4ef34f:2264,4ef54f:2527092b5e67,65384f:5a5d,8c:aeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebec#edeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,8d:000102030405060708090a0b0c0d,4f:5f57323d76749189838f7e7baa7cac94e6e8eac5dae3dcd1dff8,50:294c,4ff350:2c0f2e2d,4ffe50:1c0c25287e4355484e6c7ba5a7a9bad6,510650:edece6ee,51:070b,4edd6c3d4f:5865ce,9fa06c467c74516e5dfd9ec999985181591452f9530d8a07531051eb591951554ea051564eb388:6ea4,4eb5811488d279805b3488037fb851:abb1bdbc,8d:0e0f101112131415161718191a1b1c205152575f6568696a6c6e6f717278797a7b7c7d7e7f808283868788898c8d8e8f90929395969798999a9b9c9d9ea0a1#a2a4a5a6a7a8a9aaabacadaeafb0b2b6b7b9bbbdc0c1c2c5c7c8c9cacdd0d2d3d4,51:c796a2a5,8b:a0a6a7aab4b5b7c2c3cbcfced2d3d4d6d8d9dcdfe0e4e8e9eef0f3f6f9fcff,8c:000204070c0f1112141516191b181d1f202125272a2b2e2f32333536,53:697a,96:1d2221312a3d3c4249545f676c7274888d97b0,90:979b9d99aca1b4b3b6ba,8d:d5d8d9dce0e1e2e5e6e7e9edeef0f1f2f4f6fcfeff,8e:00010203040607080b0d0e1011121315161718191a1b1c202124252627282b2d303233343637383b3c3e#3f4345464c4d4e4f505354555657585a5b5c5d5e5f60616263646567686a6b6e71,90:b8b0cfc5bed0c4c7d3e6e2dcd7dbebeffe,91:04221e23312f394346,520d594252:a2acadbe,54ff52:d0d6f0,53df71ee77cd5ef451:f5fc,9b2f53b65f01755a5def57:4ca9a1,58:7ebcc5d1,57:292c2a33392e2f5c3b4269856b867c7b686d7673ada48cb2cfa7b493a0d5d8dad9d2b8f4eff8e4dd,8e:73757778797a7b7d7e808283848688898a8b8c8d8e91929395969798999a9b9d9fa0a1a2a3a4a5a6a7a8a9aaadaeb0b1b3b4b5b6b7b8b9bbbcbdbebfc0c1c2#c3c4c5c6c7c8c9cacbcccdcfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4,58:0b0d,57:fded,58:001e194420656c81899a80,99a89f1961ff82:797d7f8f8aa8848e919799abb8beb0c8cae398b7aecbccc1a9b4a1aa9fc4cea4e1,830982:f7e4,83:0f07,82:dcf4d2d8,830c82:fbd3,83:111a061415,82:e0d5,83:1c515b5c08923c34319b5e2f4f47435f4017602d3a336665,8e:e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,8f:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223#2425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f4041424344,83:681b696c6a6d6eb078b3b4a0aa939c857cb6a97db87b989ea8babcc1,840183:e5d8,580784:180b,83:ddfdd6,84:1c381106,83:d4df,84:0f03,83:f8f9eac5c0,842683:f0e1,84:5c515a597387887a89783c4669768c8e316dc1cdd0e6bdd3cabfbae0a1b9b497e5e3,850c750d853884f085:391f3a,8f:45464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f6061626364656a808c929da0a1a2a4a5a6a7aaacadaeafb2b3b4b5b7b8babbbcbfc0c3c6#c9cacbcccdcfd2d6d7dae0e1e3e7eceff1f2f4f5f6fafbfcfeff,90:07080c0e131518,85:563b,84:fffc,85:594868645e7a,77a285:43727ba4a8878f79ae9c85b9b7b0d3c1dcff,86:270529163c,5efe5f0859:3c41,803759:555a58,530f5c:22252c34,62:4c6a9fbbcadad7ee,632262f663:394b43adf6717a8eb46dac8a69aebcf2f8e0ffc4dece,645263:c6be,64:45410b1b200c26215e846d96,90:191c2324252728292a2b2c303132333437393a3d3f4043454648494a4b4c4e545556595a5c5d5e5f6061646667696a6b6c6f70717273767778797a7b7c7e81#84858687898a8c8d8e8f90929496989a9c9e9fa0a4a5a7a8a9abadb2b7bcbdbfc0,64:7ab7b899bac0d0d7e4e2,65:09252e,5f:0bd2,75195f1153:5ff1fde9e8fb,54:1216064b5253545643215759233282947771649a9b8476669dd0adc2b4d2a7a6d3d472a3d5bbbfccd9dadca9aaa4ddcfde,551b54e7552054fd551454f355:22230f11272a678fb5496d41553f503c,90:c2c3c6c8c9cbcccdd2d4d5d6d8d9dadedfe0e3e4e5e9eaeceef0f1f2f3f5f6f7f9fafbfcff,91:00010305060708090a0b0c0d0e0f1011121314151617181a1b1c#1d1f20212425262728292a2b2c2d2e30323334353637383a3b3c3d3e3f40414244,55:375675767733305c8bd283b1b988819f7ed6917bdfbdbe9499eaf7c9,561f55:d1ebecd4e6ddc4efe5f2f3cccde8f5e4,8f9456:1e080c012423,55fe56:00272d5839572c4d62595c4c548664716b7b7c8593afd4d7dde1f5ebf9ff,57:040a091c,5e:0f191411313b3c,91:454748515354555658595b5c5f606667686b6d737a7b7c808182838486888a8e8f939495969798999c9d9e9fa0a1a4a5a6a7a8a9abacb0b1b2b3b6b7b8b9bb#bcbdbebfc0c1c2c3c4c5c6c8cbd0d2d3d4d5d6d7d8d9dadbdddedfe0e1e2e3e4e5,5e:3744545b5e61,5c:8c7a8d9096889899919a9cb5a2bdacabb1a3c1b7c4d2e4cbe5,5d:020327262e241e061b583e343d6c5b6f5d6b4b4a697482999d,8c735d:b7c5,5f:73778287898c95999ca8adb5bc,88625f6172:adb0b4b7b8c3c1cecdd2e8efe9f2f4f7,730172f3730372fa91:e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,92:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324#25262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445,72fb73:1713210a1e1d152239252c3831504d57606c6f7e,821b592598e759:2402,99:636768696a6b6c74777d8084878a8d9091939495,5e:80918b96a5a0b9b5beb3,8d535e:d2d1dbe8ea,81ba5f:c4c9d6cf,60035fee60045f:e1e4fe,60:0506,5f:eaedf8,60:1935261b0f0d292b0a3f2178797b7a42,92:464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f7071727375767778797a7b7c7d7e7f808182838485#868788898a8b8c8d8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7,60:6a7d969aad9d83928c9becbbb1ddd8c6dab4,61:20261523,60f461:000e2b4a75ac94a7b7d4f5,5fdd96b395:e9ebf1f3f5f6fcfe,96:030406080a0b0c0d0f12151617191a,4e2c723f62156c:35545c4aa38590948c6869747686a9d0d4adf7f8f1d7b2e0d6faebeeb1d3effe,92:a8a9aaabacadafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8#e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,93:00010203040506070809,6d:39270c43480704190e2b4d2e351a4f525433916f9ea05e93945c607c63,6e1a6d:c7c5de,6e0e6d:bfe0,6e116d:e6ddd9,6e166dab6e0c6dae6e:2b6e4e6bb25f865354322544dfb198e0,6f2d6e:e2a5a7bdbbb7d7b4cf8fc29f,6f:6246472415,6ef96f:2f364b742a0929898d8c78727c7ad1,93:0a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3f40414243444546474849#4a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696b,6f:c9a7b9b6c2e1eedee0ef,70:1a231b39354f5e,5b:80849593a5b8,752f9a9e64345b:e4ee,89305bf08e478b078f:b6d3d5e5eee4e9e6f3e8,90:05040b26110d162135362d2f445152506858625b,66b990:747d8288838b,5f:50575658,5c3b54ab5c:5059,5b715c:6366,7fbc5f:2a292d,82745f3c9b3b5c6e59:81838da9aaa3,93:6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaab#acadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cbcccd,59:97caab9ea4d2b2afd7be,5a:0506,59dd5a0859:e3d8f9,5a:0c09323411231340674a553c6275,80ec5a:aa9b777abeebb2d2d4b8e0e3f1d6e6d8dc,5b:091716323740,5c:151c,5b:5a6573515362,9a:7577787a7f7d808185888a90929396989b9c9d9fa0a2a3a5a7,7e:9fa1a3a5a8a9,93:cecfd0d1d2d3d4d5d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,94:000102030405060708090a0b0c0d#0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e,7e:adb0bec0c1c2c9cbccd0d4d7dbe0e1e8ebeeeff1f2,7f0d7e:f6fafbfe,7f:01020307080b0c0f111217191c1b1f212223242526272a2b2c2d2f3031323335,5e7a757f5ddb753e909573:8e91aea29fcfc2d1b7b3c0c9c8e5d9,987c740a73:e9e7debaf2,74:0f2a5b262528302e2c,94:2f303132333435363738393a3b3c3d3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6c6d6e6f#707172737475767778797a7b7c7d7e7f8081828384919698c7cfd3d4dae6fb,95:1c20,74:1b1a415c575559776d7e9c8e8081878b9ea8a990a7d2ba,97:eaebec,67:4c535e4869a5876a7398a775a89ead8b777cf0,680967d8680a67:e9b0,680c67:d9b5dab3dd,680067:c3b8e2,680e67:c1fd,68:323360614e624464831d55664167403e4a4929b58f7477936bc2,696e68fc69:1f20,68f995:27333d43484b555a606e74757778797a7b7c7d7e808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aa#abacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacb,692468f069:0b0157,68e369:10713960425d846b80987834cc8788ce896663799ba7bbabadd4b1c1cadf95e08dff,6a2f69ed6a:171865,69f26a:443ea0505b358e793d28587c9190a997ab,73:3752,6b:8182878492938d9a9ba1aa,8f:6b6d71727375767877797a7c7e818284878b,95:cccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7ecff,96:0713181b1e20232425262728292b2c2d2f303738393a3e41434a4e4f5152535657#58595a5c5d5e606365666b6d6e6f70717378797a7b7c7d7e7f808182838487898a,8f:8d8e8f989a,8ece62:0b171b1f222125242c,81e774:eff4ff,75:0f1113,65:34eeeff0,66:0a19,677266:031500,708566:f71d34313635,800666:5f54414f56615777848ca79dbedbdce6e9,8d:3233363b3d4045464849474d5559,89:c7cacbcccecfd0d1,72:6e9f5d666f7e7f848b8d8f92,63:0832b0,96:8c8e91929395969a9b9d9e9fa0a1a2a3a4a5a6a8a9aaabacadaeafb1b2b4b5b7b8babbbfc2c3c8cacbd0d1d3d4d6d7d8d9dadbdcdddedfe1e2e3e4e5e6e7eb#ecedeef0f1f2f4f5f8fafbfcfdff,97:0203050a0b0c10111214151718191a1b1d1f20,64:3fd8,80046b:eaf3fdf5f9,6c:0507060d1518191a2129242a32,65:35556b,72:4d525630,8662521680:9f9c93bc,670a80:bdb1abadb4b7e7e8e9eadbc2c4d9cdd7,671080:ddebf1f4ed,81:0d0e,80:f2fc,671581128c5a81:361e2c1832484c5374595a7160697c7d6d67,584d5ab581:888291,6ed581:a3aacc,672681:cabb,97:2122232425262728292b2c2e2f3133343536373a3b3c3d3f404142434445464748494a4b4c4d4e4f5051545557585a5c5d5f63646667686a6b6c6d6e6f7071#72757778797a7b7d7e7f8081828384868788898a8c8e8f9093959697999a9b9c9d,81:c1a6,6b:243739434659,98:d1d2d3d5d9da,6bb35f406bc289f365909f5165:93bcc6c4c3ccced2d6,70:809c969dbbc0b7abb1e8ca,71:1013162f31735c6845724a787a98b3b5a8a0e0d4e7f9,72:1d28,706c71:1866b9,62:3e3d434849,79:3b4046495b5c535a6257606f677a858a9aa7b3,5f:d1d0,97:9e9fa1a2a4a5a6a7a8a9aaacaeb0b1b3b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3#e4e5e8eeeff0f1f2f4f7f8f9fafbfcfdfeff,98:000102030405060708090a0b0c0d0e,60:3c5d5a67415963ab,61:060d5da99dcbd1,620680:807f,6c:93f6,6dfc77:f6f8,78:0009171811,65ab78:2d1c1d393a3b1f3c252c23294e6d56572650474c6a9b939a879ca1a3b2b9a5d4d9c9ecf2,790578f479:13241e34,9f9b9e:f9fbfc,76f177:040d,76f977:07081a22192d263538505147435a68,98:0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d#4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e,77:62657f8d7d808c919fa0b0b5bd,75:3a404e4b485b727983,7f:58615f,8a487f:68747179817e,76:cde5,883294:8586878b8a8c8d8f909497959a9b9ca3a4abaaadacafb0b2b4b6b7b8b9babcbdbfc4c8c9cacbcccdced0d1d2d5d6d7d9d8dbdedfe0e2e4e5e7e8ea,98:6f70717273748b8e929599a3a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcfd0d4d6d7dbdcdde0e1e2e3e4#e5e6e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,99:0001020304050607,94:e9ebeeeff3f4f5f7f9fcfdff,95:03020607090a0d0e0f1213141516181b1d1e1f222a2b292c3132343637383c3e3f4235444546494c4e4f525354565758595b5e5f5d61626465666768696a6b6c6f7172733a,77:e7ec,96c979:d5ede3eb,7a065d477a:03021e14,99:08090a0b0c0e0f1112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2f303132333435363738393a3b3c3d3e3f40414243444546474849#4a4b4c4d4e4f50515253565758595a5b5c5d5e5f60616264667378797b7e828389,7a:393751,9ecf99a57a7076:888e9399a4,74:dee0,752c9e:202228292a2b2c3231363837393a3e414244464748494b4c4e5155575a5b5c5e63666768696a6b6c716d73,75:929496a09daca3b3b4b8c4b1b0c3c2d6cde3e8e6e4ebe7,760375:f1fcff,76:1000050c170a25181519,99:8c8e9a9b9c9d9e9fa0a1a2a3a4a6a7a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8#d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9,76:1b3c2220402d303f35433e334d5e545c566b6f,7fca7a:e6787980868895a6a0aca8adb3,88:6469727d7f82a2c6b7bcc9e2cee3e5f1,891a88:fce8fef0,89:2119131b0a342b3641667b,758b80e576:b2b4,77dc80:1214161c20222526272928310b3543464d526971,898398:788083,99:fafbfcfdfeff,9a:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738#393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f50515253545556575859,98:898c8d8f949a9b9e9fa1a2a5a6,86:4d546c6e7f7a7c7ba88d8bac9da7a3aa93a9b6c4b5ceb0bab1afc9cfb4e9f1f2edf3d0,871386:def4dfd8d1,87:0307,86f887:080a0d09233b1e252e1a3e48343129373f82227d7e7b60704c6e8b53637c64596593afa8d2,9a:5a5b5c5d5e5f606162636465666768696a6b7283898d8e949599a6a9aaabacadaeafb2b3b4b5b9bbbdbebfc3c4c6c7c8c9cacdcecfd0d2d4d5d6d7d9dadbdc#dddee0e2e3e4e5e7e8e9eaeceef0f1f2f3f4f5f6f7f8fafcfdfeff,9b:000102040506,87:c68885ad9783abe5acb5b3cbd3bdd1c0cadbeae0ee,88:1613,87fe88:0a1b21393c,7f:36424445,82107a:fafd,7b:080304150a2b0f47382a192e31202524333e1e585a45754c5d606e7b62727190a6a7b8ac9da885aa9ca2abb4d1c1ccdddae5e6ea,7c0c7b:fefc,7c:0f160b,9b:07090a0b0c0d0e1011121415161718191a1b1c1d1e2021222425262728292a2b2c2d2e3031333435363738393a3d3e3f40464a4b4c4e50525355565758595a#5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b,7c:1f2a26384140,81fe82:010204,81ec884482:2122232d2f282b383b33343e44494b4f5a5f68,88:7e8588d8df,895e7f:9d9fa7afb0b2,7c7c65497c:919d9c9ea2b2bcbdc1c7cccdc8c5d7e8,826e66a87f:bfced5e5e1e6e9eef3,7cf87d:77a6ae,7e:479b,9e:b8b4,8d:73849491b1676d,8c:4749,91:4a504e4f64,9b:7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9ba#bbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadb,91:626170696f7d7e7274798c85908d91a2a3aaadaeafb5b4ba,8c559e7e8d:b8eb,8e:055969,8d:b5bfbcbac4d6d7dadececfdbc6ecf7f8e3f9fbe4,8e098dfd8e:141d1f2c2e232f3a4039353d3149414251524a70767c6f74858f94909c9e,8c:78828a859894,659b89:d6dedadc,9b:dcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,9c:000102030405060708090a0b0c0d0e0f101112131415161718191a#1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b,89:e5ebef,8a3e8b26975396:e9f3ef,97:0601080f0e2a2d303e,9f:808385868788898a8c,9efe9f:0b0d,96:b9bcbdced2,77bf96e092:8eaec8,93:3e6aca8f,94:3e6b,9c:7f8285868788,7a239c:8b8e90919294959a9b9e9fa0a1a2a3a5a6a7a8a9abadaeb0b1b2b3b4b5b6b7babbbcbdc4c5c6c7cacb3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a#7b7d7e808384898a8c8f93969798999daaacafb9bebfc0c1c2c8c9d1d2dadbe0e1cccdcecfd0d3d4d5d7d8d9dcdddfe2,97:7c85919294afaba3b2b4,9a:b1b0b7,9e589a:b6babcc1c0c5c2cbccd1,9b:45434749484d51,98e899:0d2e5554,9a:dfe1e6efebfbedf9,9b:080f131f23,9e:bdbe,7e3b9e:8287888b92,93d69e:9d9fdbdcdde0dfe2e9e7e5eaef,9f:222c2f39373d3e44,9c:e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,9d:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021#22232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142#92$434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f8081#82838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2#92$a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1#e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,9e:000102#92$030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e24272e30343b3c404d5052535456595d5f606162656e6f727475767778797a7b7c7d80#8183848586898a8c8d8e8f90919495969798999a9b9c9ea0a1a2a3a4a5a7a8a9aa#92$abacadaeafb0b1b2b3b5b6b7b9babcbfc0c1c2c3c5c6c7c8cacbccd0d2d3d5d6d7d9dadee1e3e4e6e8ebecedeef0f1f2f3f4f5f6f7f8fafdff,9f:000102030405#060708090a0c0f1112141516181a1b1c1d1e1f21232425262728292a2b2d2e3031#92$3233343536383a3c3f4041424345464748494a4b4c4d4e4f52535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778#797a7b7c7d7e81828d8e8f9091929394959697989c9d9ea1a2a3a4a5,f9:2c7995e7f1#92$,fa:0c0d0e0f111314181f20212324272829,e8:15161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f40414243#4445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f6061626364"
);
let index = 0;
this.#data = dataText.match(/..../g);
for (let i2 = 129; i2 <= 254; i2++) {
for (let j2 = 64; j2 <= 254; j2++) {
this.#U2Ghash[this.#data[index++]] = `%${i2.toString(16)}%${j2.toString(16)}`.toUpperCase();
}
}
for (const key in this.#U2Ghash) {
const u2ghashValue = Reflect.get(this.#U2Ghash, key);
Reflect.set(this.#G2Uhash, u2ghashValue, key);
}
}
handleText(text) {
text = text
.replace(/#(\d+)\$/g, function (_, b2) {
return Array(+b2 + 3).join("#");
})
.replace(/#/g, "####")
.replace(/(\w\w):([\w#]+)(?:,|$)/g, function (_, hd, dt) {
return dt.replace(/../g, function (a2) {
if (a2 != "##") {
return hd + a2;
} else {
return a2;
}
});
});
return text;
}
isAscii(unicode) {
return unicode <= 127 && unicode >= 0;
}
encode(str) {
const that = this;
return [...str].reduce((result, val) => {
return result + toGBK(val);
}, "");
function toGBK(val) {
let result = "";
for (let i2 = 0; i2 < val.length; i2++) {
const codePoint = val.codePointAt(i2);
const code = String.fromCodePoint(codePoint);
let key = codePoint.toString(16);
key.length != 4 && (key = `000${key}`.match(/....$/)?.[0]);
i2 += code.length - 1;
if (that.isAscii(codePoint)) {
result += encodeURIComponent(code);
continue;
}
if (that.#U2Ghash[key]) {
result += that.#U2Ghash[key];
continue;
}
result += toGBK(`&#${codePoint};`);
}
return result;
}
}
decode(str) {
const GBKMatcher = /%[0-9A-F]{2}%[0-9A-F]{2}/;
const UTFMatcher = /%[0-9A-F]{2}/;
let utf = true;
const that = this;
while (utf) {
const gbkMatch = str.match(GBKMatcher);
const utfMatch = str.match(UTFMatcher);
utf = Boolean(utfMatch);
if (gbkMatch && gbkMatch in that.#G2Uhash) {
str = str.replace(gbkMatch, String.fromCharCode(`0x${that.#G2Uhash[gbkMatch]}`));
} else {
str = str.replace(utfMatch, decodeURIComponent(utfMatch));
}
}
return str;
}
}
const TryCatch = function (...args) {
let callbackFunction = null;
let context = null;
let handleError = () => {};
let defaultDetails = {
log: true,
};
const TryCatchCore = {
config(paramDetails) {
defaultDetails = Object.assign(defaultDetails, paramDetails);
return TryCatchCore;
},
error(handler) {
handleError = handler;
return TryCatchCore;
},
run(callback, __context__) {
callbackFunction = callback;
context = __context__ || this;
const result = executeTryCatch(callbackFunction, handleError, context);
return result !== void 0 ? result : TryCatchCore;
},
};
function executeTryCatch(callback, handleErrorFunc, funcThis) {
let result = void 0;
try {
if (typeof callback === "string") {
result = new Function(callback).apply(funcThis, args);
} else {
result = callback.apply(funcThis, args);
}
} catch (error) {
if (defaultDetails.log) {
callback = callback;
console.log(`%c ${callback?.name ? callback?.name : `${callback}`} `, "color: #f20000");
console.log(`%c ${error}`, "color: #f20000");
console.trace(callback);
}
if (handleErrorFunc) {
if (typeof handleErrorFunc === "string") {
result = new Function(handleErrorFunc).apply(funcThis, [...args, error]);
} else {
result = handleErrorFunc.apply(funcThis, [...args, error]);
}
}
}
return result;
}
return TryCatchCore;
};
let CommonUtil$1 = class CommonUtil {
assign(target = {}, source = {}, isAdd = false) {
const UtilsContext = this;
if (Array.isArray(source)) {
const canTraverse = source.filter((item) => {
return typeof item === "object";
});
if (!canTraverse.length) {
return source;
}
}
if (source == null) {
return target;
}
if (target == null) {
target = {};
}
if (isAdd) {
for (const sourceKeyName in source) {
const targetKeyName = sourceKeyName;
const targetValue = Reflect.get(target, targetKeyName);
const sourceValue = Reflect.get(source, sourceKeyName);
if (
typeof sourceValue === "object" &&
sourceValue != null &&
sourceKeyName in target &&
!UtilsContext.isDOM(sourceValue)
) {
Reflect.set(target, sourceKeyName, UtilsContext.assign(targetValue, sourceValue, isAdd));
continue;
}
Reflect.set(target, sourceKeyName, sourceValue);
}
} else {
for (const targetKeyName in target) {
if (targetKeyName in source) {
const targetValue = Reflect.get(target, targetKeyName);
const sourceValue = Reflect.get(source, targetKeyName);
if (
typeof sourceValue === "object" &&
sourceValue != null &&
!UtilsContext.isDOM(sourceValue) &&
Object.keys(sourceValue).length
) {
Reflect.set(target, targetKeyName, UtilsContext.assign(targetValue, sourceValue, isAdd));
continue;
}
Reflect.set(target, targetKeyName, sourceValue);
}
}
}
return target;
}
isNull(...args) {
let result = true;
const checkList = [...args];
for (const objItem of checkList) {
let itemResult = false;
if (objItem === null || objItem === void 0) {
itemResult = true;
} else {
switch (typeof objItem) {
case "object":
if (typeof objItem[Symbol.iterator] === "function") {
itemResult = objItem.length === 0;
} else {
itemResult = Object.keys(objItem).length === 0;
}
break;
case "number":
itemResult = objItem === 0;
break;
case "string":
itemResult = objItem.trim() === "" || objItem === "null" || objItem === "undefined";
break;
case "boolean":
itemResult = !objItem;
break;
case "function": {
const funcStr = objItem.toString().replace(/\s/g, "");
itemResult = Boolean(funcStr.match(/^\(.*?\)=>\{\}$|^function.*?\(.*?\)\{\}$/));
break;
}
}
}
result = result && itemResult;
}
return result;
}
isDOM(target) {
return target instanceof Node;
}
isNotNull(...args) {
const UtilsContext = this;
return !UtilsContext.isNull.apply(this, args);
}
deepClone(obj) {
const UtilsContext = this;
if (obj === void 0) return void 0;
if (obj === null) return null;
const clone = obj instanceof Array ? [] : {};
for (const [key, value] of Object.entries(obj)) {
if (typeof value === "object") {
Reflect.set(clone, key, UtilsContext.deepClone(value));
} else {
Reflect.set(clone, key, value);
}
}
return clone;
}
coverObjectFunctionThis(target, objectThis) {
if (typeof target !== "object" || target === null) {
throw new Error("target must be object");
}
objectThis = objectThis || target;
Object.keys(target).forEach((key) => {
if (typeof target[key] === "function") {
target[key] = target[key].bind(objectThis);
}
});
}
toJSON(data, errorCallBack) {
let result = {};
if (typeof data === "object") {
return data;
}
TryCatch()
.config({ log: false })
.error(() => {
TryCatch()
.error(() => {
try {
result = new Function(`return ${data}`)();
} catch (error2) {
if (typeof errorCallBack === "function") {
errorCallBack(error2);
}
}
})
.run(() => {
if (
data &&
/^[\],:{}\s]*$/.test(
data
.replace(/\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/g, "]")
.replace(/(?:^|:|,)(?:\s*\[)+/g, "")
)
) {
result = new Function(`return ${data}`)();
} else {
if (typeof errorCallBack === "function") {
errorCallBack(new Error("target is not JSON object"));
}
}
});
})
.run(() => {
data = data.trim();
result = JSON.parse(data);
});
return result;
}
};
const commonUtil = new CommonUtil$1();
class UtilsGMCookie {
windowApi = {
window,
document,
};
constructor(windowApiOption) {
if (windowApiOption) {
this.windowApi = Object.assign({}, windowApiOption);
}
}
getCookiesList() {
if (this.windowApi.document.cookie.trim() === "") {
return [];
}
return this.windowApi.document.cookie.split(";");
}
get(cookieName) {
if (typeof cookieName !== "string") {
throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
}
const cookies = this.getCookiesList();
let findValue = void 0;
for (const cookieItem of cookies) {
const item = cookieItem.trim();
const itemSplit = item.split("=");
const itemName = itemSplit[0];
itemSplit.splice(0, 1);
const itemValue = decodeURIComponent(itemSplit.join(""));
if (itemName === cookieName) {
findValue = {
domain: this.windowApi.window.location.hostname,
expirationDate: null,
hostOnly: true,
httpOnly: false,
name: cookieName,
path: "/",
sameSite: "unspecified",
secure: true,
session: false,
value: itemValue,
};
break;
}
}
return findValue;
}
list(option, callback) {
if (option == null) {
throw new Error("Utils.GMCookie.list 参数不能为空");
}
const resultData = [];
let error;
try {
let defaultOption = {
url: this.windowApi.window.location.href,
domain: this.windowApi.window.location.hostname,
name: "",
path: "/",
};
defaultOption = commonUtil.assign(defaultOption, option);
const cookies = this.getCookiesList();
cookies.forEach((item) => {
item = item.trim();
const itemSplit = item.split("=");
const itemName = itemSplit[0];
itemSplit.splice(0, 1);
const itemValue = decodeURIComponent(itemSplit.join(""));
const nameRegexp =
defaultOption.name instanceof RegExp ? defaultOption.name : new RegExp(`^${defaultOption.name}`, "g");
if (itemName.match(nameRegexp)) {
resultData.push({
domain: this.windowApi.window.location.hostname,
expirationDate: null,
hostOnly: true,
httpOnly: false,
name: itemName,
path: "/",
sameSite: "unspecified",
secure: true,
session: false,
value: itemValue,
});
}
});
} catch (e2) {
error = e2;
}
if (typeof callback === "function") {
callback(resultData, error);
} else {
return {
cookies: resultData,
error,
};
}
}
getList(option) {
if (option == null) {
throw new Error("Utils.GMCookie.list 参数不能为空");
}
const resultData = [];
let defaultOption = {
url: this.windowApi.window.location.href,
domain: this.windowApi.window.location.hostname,
name: "",
path: "/",
};
defaultOption = commonUtil.assign(defaultOption, option);
const cookies = this.getCookiesList();
cookies.forEach((item) => {
item = item.trim();
const itemSplit = item.split("=");
const itemName = itemSplit[0];
itemSplit.splice(0, 1);
const itemValue = decodeURIComponent(itemSplit.join(""));
const nameRegexp =
defaultOption.name instanceof RegExp ? defaultOption.name : new RegExp(`^${defaultOption.name}`, "g");
if (itemName.match(nameRegexp)) {
resultData.push({
domain: this.windowApi.window.location.hostname,
expirationDate: null,
hostOnly: true,
httpOnly: false,
name: itemName,
path: "/",
sameSite: "unspecified",
secure: true,
session: false,
value: itemValue,
});
}
});
return resultData;
}
set(option, callback) {
let errorInfo;
try {
let defaultOption = {
url: this.windowApi.window.location.href,
name: "",
value: "",
domain: "",
path: "/",
secure: true,
httpOnly: false,
expirationDate: Math.floor(Date.now()) + 60 * 60 * 24 * 30,
};
defaultOption = commonUtil.assign(defaultOption, option);
const life = defaultOption.expirationDate
? defaultOption.expirationDate
: Math.floor(Date.now()) + 60 * 60 * 24 * 30;
let cookieStr = `${defaultOption.name}=${decodeURIComponent(defaultOption.value)};expires=${new Date(life).toGMTString()}; path=/`;
if (commonUtil.isNull(defaultOption.domain)) {
cookieStr += `; domain=${defaultOption.domain}`;
}
this.windowApi.document.cookie = cookieStr;
} catch (error) {
errorInfo = error;
} finally {
if (typeof callback === "function") {
callback(errorInfo);
}
}
}
delete(option, callback) {
let errorInfo;
try {
let defaultOption = {
url: this.windowApi.window.location.href,
name: "",
path: "/",
firstPartyDomain: "",
};
defaultOption = commonUtil.assign(defaultOption, option);
let cookieStr = `${defaultOption.name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${defaultOption.path}`;
if (commonUtil.isNull(defaultOption.firstPartyDomain)) {
cookieStr += `; domain=${defaultOption.firstPartyDomain};`;
}
this.windowApi.document.cookie = cookieStr;
} catch (error) {
errorInfo = error;
} finally {
if (typeof callback === "function") {
callback(errorInfo);
}
}
}
parseCookie(cookieStr) {
if (cookieStr.trim() === "") {
return [];
}
const cookies = cookieStr.split(";");
const result = [];
for (const cookieItem of cookies) {
const item = cookieItem.trim();
const itemSplit = item.split("=");
const itemName = itemSplit[0];
itemSplit.splice(0, 1);
const itemValue = decodeURIComponent(itemSplit.join(""));
result.push({
key: itemName,
value: itemValue,
});
}
return result;
}
}
// @license GNU LGPL-3.0
const ajaxHooker = function () {
const version2 = "1.4.8";
const hookInst = {
hookFns: [],
filters: [],
};
const win = window.unsafeWindow || document.defaultView || window;
let winAh = win.__ajaxHooker;
const resProto = win.Response.prototype;
const xhrResponses = ["response", "responseText", "responseXML"];
const fetchResponses = ["arrayBuffer", "blob", "formData", "json", "text"];
const xhrExtraProps = ["responseType", "timeout", "withCredentials"];
const fetchExtraProps = [
"cache",
"credentials",
"integrity",
"keepalive",
"mode",
"priority",
"redirect",
"referrer",
"referrerPolicy",
"signal",
];
const xhrAsyncEvents = ["readystatechange", "load", "loadend"];
const getType = {}.toString.call.bind({}.toString);
const getDescriptor = Object.getOwnPropertyDescriptor.bind(Object);
const emptyFn = () => {};
const errorFn = (e2) => console.error(e2);
function isThenable(obj) {
return obj && ["object", "function"].includes(typeof obj) && typeof obj.then === "function";
}
function catchError(fn, ...args) {
try {
const result = fn(...args);
if (isThenable(result)) return result.then(null, errorFn);
return result;
} catch (err) {
console.error(err);
}
}
function defineProp(obj, prop, getter, setter) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
get: getter,
set: setter,
});
}
function readonly(obj, prop, value = obj[prop]) {
defineProp(obj, prop, () => value, emptyFn);
}
function writable(obj, prop, value = obj[prop]) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
writable: true,
value,
});
}
function parseHeaders(obj) {
const headers = {};
switch (getType(obj)) {
case "[object String]":
for (const line of obj.trim().split(/[\r\n]+/)) {
const [header, value] = line.split(new RegExp("(?<=^[^:]+)\\s*:\\s*"));
if (!value) continue;
const lheader = header.toLowerCase();
headers[lheader] = lheader in headers ? `${headers[lheader]}, ${value}` : value;
}
break;
case "[object Headers]":
for (const [key, val] of obj) {
headers[key] = val;
}
break;
case "[object Object]":
return { ...obj };
}
return headers;
}
function stopImmediatePropagation() {
this.ajaxHooker_isStopped = true;
}
class SyncThenable {
then(fn) {
fn && fn();
return new SyncThenable();
}
}
class AHRequest {
constructor(request) {
this.request = request;
this.requestClone = { ...this.request };
}
_recoverRequestKey(key) {
if (key in this.requestClone) this.request[key] = this.requestClone[key];
else delete this.request[key];
}
shouldFilter(filters) {
const { type, url, method, async } = this.request;
return (
filters.length &&
!filters.find((obj) => {
switch (true) {
case obj.type && obj.type !== type:
case getType(obj.url) === "[object String]" && !url.includes(obj.url):
case getType(obj.url) === "[object RegExp]" && !obj.url.test(url):
case obj.method && obj.method.toUpperCase() !== method.toUpperCase():
case "async" in obj && obj.async !== async:
return false;
}
return true;
})
);
}
waitForRequestKeys() {
if (!this.request.async) {
win.__ajaxHooker.hookInsts.forEach(({ hookFns, filters }) => {
if (this.shouldFilter(filters)) return;
hookFns.forEach((fn) => {
if (getType(fn) === "[object Function]") catchError(fn, this.request);
});
for (const key in this.request) {
if (isThenable(this.request[key])) this._recoverRequestKey(key);
}
});
return new SyncThenable();
}
const promises = [];
const ignoreKeys = new Set(["type", "async", "response"]);
win.__ajaxHooker.hookInsts.forEach(({ hookFns, filters }) => {
if (this.shouldFilter(filters)) return;
promises.push(
Promise.all(hookFns.map((fn) => catchError(fn, this.request))).then(() => {
const requestKeys = [];
for (const key in this.request) !ignoreKeys.has(key) && requestKeys.push(key);
return Promise.all(
requestKeys.map((key) =>
Promise.resolve(this.request[key]).then(
(val) => (this.request[key] = val),
() => this._recoverRequestKey(key)
)
)
);
})
);
});
return Promise.all(promises);
}
waitForResponseKeys(response) {
const responseKeys = this.request.type === "xhr" ? xhrResponses : fetchResponses;
if (!this.request.async) {
if (getType(this.request.response) === "[object Function]") {
catchError(this.request.response, response);
responseKeys.forEach((key) => {
if ("get" in getDescriptor(response, key) || isThenable(response[key])) {
delete response[key];
}
});
}
return new SyncThenable();
}
return Promise.resolve(catchError(this.request.response, response)).then(() =>
Promise.all(
responseKeys.map((key) => {
const descriptor = getDescriptor(response, key);
if (descriptor && "value" in descriptor) {
return Promise.resolve(descriptor.value).then(
(val) => (response[key] = val),
() => delete response[key]
);
} else {
delete response[key];
}
})
)
);
}
}
const proxyHandler = {
get(target, prop) {
const descriptor = getDescriptor(target, prop);
if (descriptor && !descriptor.configurable && !descriptor.writable && !descriptor.get) return target[prop];
const ah = target.__ajaxHooker;
if (ah && ah.proxyProps) {
if (prop in ah.proxyProps) {
const pDescriptor = ah.proxyProps[prop];
if ("get" in pDescriptor) return pDescriptor.get();
if (typeof pDescriptor.value === "function") return pDescriptor.value.bind(ah);
return pDescriptor.value;
}
if (typeof target[prop] === "function") return target[prop].bind(target);
}
return target[prop];
},
set(target, prop, value) {
const descriptor = getDescriptor(target, prop);
if (descriptor && !descriptor.configurable && !descriptor.writable && !descriptor.set) return true;
const ah = target.__ajaxHooker;
if (ah && ah.proxyProps && prop in ah.proxyProps) {
const pDescriptor = ah.proxyProps[prop];
pDescriptor.set ? pDescriptor.set(value) : (pDescriptor.value = value);
} else {
target[prop] = value;
}
return true;
},
};
class XhrHooker {
constructor(xhr) {
const ah = this;
Object.assign(ah, {
originalXhr: xhr,
proxyXhr: new Proxy(xhr, proxyHandler),
resThenable: new SyncThenable(),
proxyProps: {},
proxyEvents: {},
});
xhr.addEventListener("readystatechange", (e2) => {
if (ah.proxyXhr.readyState === 4 && ah.request && typeof ah.request.response === "function") {
const response = {
finalUrl: ah.proxyXhr.responseURL,
status: ah.proxyXhr.status,
responseHeaders: parseHeaders(ah.proxyXhr.getAllResponseHeaders()),
};
const tempValues = {};
for (const key of xhrResponses) {
try {
tempValues[key] = ah.originalXhr[key];
} catch (err) {}
defineProp(
response,
key,
() => {
return (response[key] = tempValues[key]);
},
(val) => {
delete response[key];
response[key] = val;
}
);
}
ah.resThenable = new AHRequest(ah.request).waitForResponseKeys(response).then(() => {
for (const key of xhrResponses) {
ah.proxyProps[key] = {
get: () => {
if (!(key in response)) response[key] = tempValues[key];
return response[key];
},
};
}
});
}
ah.dispatchEvent(e2);
});
xhr.addEventListener("load", (e2) => ah.dispatchEvent(e2));
xhr.addEventListener("loadend", (e2) => ah.dispatchEvent(e2));
for (const evt of xhrAsyncEvents) {
const onEvt = "on" + evt;
ah.proxyProps[onEvt] = {
get: () => ah.proxyEvents[onEvt] || null,
set: (val) => ah.addEvent(onEvt, val),
};
}
for (const method of ["setRequestHeader", "addEventListener", "removeEventListener", "open", "send"]) {
ah.proxyProps[method] = { value: ah[method] };
}
}
toJSON() {}
addEvent(type, event) {
if (type.startsWith("on")) {
this.proxyEvents[type] = typeof event === "function" ? event : null;
} else {
if (typeof event === "object" && event !== null) event = event.handleEvent;
if (typeof event !== "function") return;
this.proxyEvents[type] = this.proxyEvents[type] || new Set();
this.proxyEvents[type].add(event);
}
}
removeEvent(type, event) {
if (type.startsWith("on")) {
this.proxyEvents[type] = null;
} else {
if (typeof event === "object" && event !== null) event = event.handleEvent;
this.proxyEvents[type] && this.proxyEvents[type].delete(event);
}
}
dispatchEvent(e2) {
e2.stopImmediatePropagation = stopImmediatePropagation;
defineProp(e2, "target", () => this.proxyXhr);
defineProp(e2, "currentTarget", () => this.proxyXhr);
defineProp(e2, "srcElement", () => this.proxyXhr);
this.proxyEvents[e2.type] &&
this.proxyEvents[e2.type].forEach((fn) => {
this.resThenable.then(() => !e2.ajaxHooker_isStopped && fn.call(this.proxyXhr, e2));
});
if (e2.ajaxHooker_isStopped) return;
const onEvent = this.proxyEvents["on" + e2.type];
onEvent && this.resThenable.then(onEvent.bind(this.proxyXhr, e2));
}
setRequestHeader(header, value) {
this.originalXhr.setRequestHeader(header, value);
if (!this.request) return;
const headers = this.request.headers;
headers[header] = header in headers ? `${headers[header]}, ${value}` : value;
}
addEventListener(...args) {
if (xhrAsyncEvents.includes(args[0])) {
this.addEvent(args[0], args[1]);
} else {
this.originalXhr.addEventListener(...args);
}
}
removeEventListener(...args) {
if (xhrAsyncEvents.includes(args[0])) {
this.removeEvent(args[0], args[1]);
} else {
this.originalXhr.removeEventListener(...args);
}
}
open(method, url, async = true, ...args) {
this.request = {
type: "xhr",
url: url.toString(),
method: method.toUpperCase(),
abort: false,
headers: {},
data: null,
response: null,
async: !!async,
};
this.openArgs = args;
this.resThenable = new SyncThenable();
["responseURL", "readyState", "status", "statusText", ...xhrResponses].forEach((key) => {
delete this.proxyProps[key];
});
return this.originalXhr.open(method, url, async, ...args);
}
send(data) {
const ah = this;
const xhr = ah.originalXhr;
const request = ah.request;
if (!request) return xhr.send(data);
request.data = data;
new AHRequest(request).waitForRequestKeys().then(() => {
if (request.abort) {
if (typeof request.response === "function") {
Object.assign(ah.proxyProps, {
responseURL: { value: request.url },
readyState: { value: 4 },
status: { value: 200 },
statusText: { value: "OK" },
});
xhrAsyncEvents.forEach((evt) => xhr.dispatchEvent(new Event(evt)));
}
} else {
xhr.open(request.method, request.url, request.async, ...ah.openArgs);
for (const header in request.headers) {
xhr.setRequestHeader(header, request.headers[header]);
}
for (const prop of xhrExtraProps) {
if (prop in request) xhr[prop] = request[prop];
}
xhr.send(request.data);
}
});
}
}
function fakeXHR() {
const xhr = new winAh.realXHR();
if ("__ajaxHooker" in xhr) console.warn("检测到不同版本的ajaxHooker,可能发生冲突!");
xhr.__ajaxHooker = new XhrHooker(xhr);
return xhr.__ajaxHooker.proxyXhr;
}
fakeXHR.prototype = win.XMLHttpRequest.prototype;
Object.keys(win.XMLHttpRequest).forEach((key) => (fakeXHR[key] = win.XMLHttpRequest[key]));
function fakeFetch(url, options = {}) {
if (!url) return winAh.realFetch.call(win, url, options);
return new Promise(async (resolve, reject) => {
const init = {};
if (getType(url) === "[object Request]") {
init.method = url.method;
init.headers = url.headers;
if (url.body) init.body = await url.arrayBuffer();
for (const prop of fetchExtraProps) init[prop] = url[prop];
url = url.url;
}
url = url.toString();
Object.assign(init, options);
init.method = init.method || "GET";
init.headers = init.headers || {};
const request = {
type: "fetch",
url,
method: init.method.toUpperCase(),
abort: false,
headers: parseHeaders(init.headers),
data: init.body,
response: null,
async: true,
};
const req = new AHRequest(request);
await req.waitForRequestKeys();
if (request.abort) {
if (typeof request.response === "function") {
const response = {
finalUrl: request.url,
status: 200,
responseHeaders: {},
};
await req.waitForResponseKeys(response);
const key = fetchResponses.find((k) => k in response);
let val = response[key];
if (key === "json" && typeof val === "object") {
val = catchError(JSON.stringify.bind(JSON), val);
}
const res = new Response(val, {
status: 200,
statusText: "OK",
});
defineProp(res, "type", () => "basic");
defineProp(res, "url", () => request.url);
resolve(res);
} else {
reject(new DOMException("aborted", "AbortError"));
}
return;
}
init.method = request.method;
init.headers = request.headers;
init.body = request.data;
for (const prop of fetchExtraProps) {
if (prop in request) init[prop] = request[prop];
}
winAh.realFetch.call(win, request.url, init).then((res) => {
if (typeof request.response === "function") {
const response = {
finalUrl: res.url,
status: res.status,
responseHeaders: parseHeaders(res.headers),
};
if (res.ok) {
fetchResponses.forEach(
(key) =>
(res[key] = function () {
if (key in response) return Promise.resolve(response[key]);
return resProto[key].call(this).then((val) => {
response[key] = val;
return req.waitForResponseKeys(response).then(() => (key in response ? response[key] : val));
});
})
);
} else {
catchError(request.response, response);
}
}
resolve(res);
}, reject);
});
}
function fakeFetchClone() {
const descriptors = Object.getOwnPropertyDescriptors(this);
const res = winAh.realFetchClone.call(this);
Object.defineProperties(res, descriptors);
return res;
}
winAh = win.__ajaxHooker = winAh || {
version: version2,
fakeXHR,
fakeFetch,
fakeFetchClone,
realXHR: win.XMLHttpRequest,
realFetch: win.fetch,
realFetchClone: resProto.clone,
hookInsts: new Set(),
};
if (winAh.version !== version2) console.warn("检测到不同版本的ajaxHooker,可能发生冲突!");
win.XMLHttpRequest = winAh.fakeXHR;
win.fetch = winAh.fakeFetch;
resProto.clone = winAh.fakeFetchClone;
winAh.hookInsts.add(hookInst);
class AHFunction extends Function {
call(thisArg, ...args) {
if (thisArg && thisArg.__ajaxHooker && thisArg.__ajaxHooker.proxyXhr === thisArg) {
thisArg = thisArg.__ajaxHooker.originalXhr;
}
return Reflect.apply(this, thisArg, args);
}
apply(thisArg, args) {
if (thisArg && thisArg.__ajaxHooker && thisArg.__ajaxHooker.proxyXhr === thisArg) {
thisArg = thisArg.__ajaxHooker.originalXhr;
}
return Reflect.apply(this, thisArg, args || []);
}
}
function hookSecsdk(csrf) {
Object.setPrototypeOf(csrf.nativeXMLHttpRequestSetRequestHeader, AHFunction.prototype);
Object.setPrototypeOf(csrf.nativeXMLHttpRequestOpen, AHFunction.prototype);
Object.setPrototypeOf(csrf.nativeXMLHttpRequestSend, AHFunction.prototype);
}
if (win.secsdk) {
if (win.secsdk.csrf && win.secsdk.csrf.nativeXMLHttpRequestOpen) hookSecsdk(win.secsdk.csrf);
} else {
defineProp(win, "secsdk", emptyFn, (secsdk) => {
delete win.secsdk;
win.secsdk = secsdk;
defineProp(secsdk, "csrf", emptyFn, (csrf) => {
delete secsdk.csrf;
secsdk.csrf = csrf;
if (csrf.nativeXMLHttpRequestOpen) hookSecsdk(csrf);
});
});
}
return {
hook: (fn) => hookInst.hookFns.push(fn),
filter: (arr) => {
if (Array.isArray(arr)) hookInst.filters = arr;
},
protect: () => {
readonly(win, "XMLHttpRequest", winAh.fakeXHR);
readonly(win, "fetch", winAh.fakeFetch);
readonly(resProto, "clone", winAh.fakeFetchClone);
},
unhook: () => {
winAh.hookInsts.delete(hookInst);
if (!winAh.hookInsts.size) {
writable(win, "XMLHttpRequest", winAh.realXHR);
writable(win, "fetch", winAh.realFetch);
writable(resProto, "clone", winAh.realFetchClone);
delete win.__ajaxHooker;
}
},
};
};
const AjaxHooker1_2_4 = function () {
return (function () {
const win = window.unsafeWindow || document.defaultView || window;
const hookFns = [];
const realXhr = win.XMLHttpRequest;
const resProto = win.Response.prototype;
const toString = Object.prototype.toString;
const realFetch = win.fetch;
const xhrResponses = ["response", "responseText", "responseXML"];
const fetchResponses = ["arrayBuffer", "blob", "formData", "json", "text"];
const xhrAsyncEvents = ["readystatechange", "load", "loadend"];
let filter;
function emptyFn() {}
function errorFn(err) {
console.error(err);
}
function defineProp(obj, prop, getter, setter) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
get: getter,
set: setter,
});
}
function readonly(obj, prop, value = obj[prop]) {
defineProp(obj, prop, () => value, emptyFn);
}
function writable(obj, prop, value = obj[prop]) {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
writable: true,
value,
});
}
function toFilterObj(obj) {
return {
type: obj.type,
url: obj.url,
method: obj.method && obj.method.toUpperCase(),
};
}
function shouldFilter(type, url, method) {
return (
filter &&
!filter.find(
(obj) =>
(!obj.type || obj.type === type) &&
(!obj.url ||
(toString.call(obj.url) === "[object String]" ? url.includes(obj.url) : obj.url.test(url))) &&
(!obj.method || obj.method === method.toUpperCase())
)
);
}
function lookupGetter(obj, prop) {
let getter;
let proto = obj;
while (proto) {
const descriptor = Object.getOwnPropertyDescriptor(proto, prop);
getter = descriptor && descriptor.get;
if (getter) break;
proto = Object.getPrototypeOf(proto);
}
return getter ? getter.bind(obj) : emptyFn;
}
function waitForHookFns(request) {
return Promise.all(hookFns.map((fn) => Promise.resolve(fn(request)).then(emptyFn, errorFn)));
}
function waitForRequestKeys(request, requestClone) {
return Promise.all(
["url", "method", "abort", "headers", "data"].map((key) => {
return Promise.resolve(request[key]).then(
(val) => (request[key] = val),
() => (request[key] = requestClone[key])
);
})
);
}
function fakeEventSIP() {
this.ajaxHooker_stopped = true;
}
function xhrDelegateEvent(e2) {
const xhr = e2.target;
e2.stopImmediatePropagation = fakeEventSIP;
xhr.__ajaxHooker.hookedEvents[e2.type].forEach((fn) => !e2.ajaxHooker_stopped && fn.call(xhr, e2));
const onEvent = xhr.__ajaxHooker.hookedEvents["on" + e2.type];
typeof onEvent === "function" && onEvent.call(xhr, e2);
}
function xhrReadyStateChange(e2) {
if (e2.target.readyState === 4) {
e2.target.dispatchEvent(new CustomEvent("ajaxHooker_responseReady", { detail: e2 }));
} else {
e2.target.__ajaxHooker.delegateEvent(e2);
}
}
function xhrLoadAndLoadend(e2) {
e2.target.__ajaxHooker.delegateEvent(e2);
}
function fakeXhrOpen(method, url, ...args) {
const ah = this.__ajaxHooker;
ah.url = url.toString();
ah.method = method.toUpperCase();
ah.openArgs = args;
ah.headers = {};
return ah.originalMethods.open(method, url, ...args);
}
function fakeXhr() {
const xhr = new realXhr();
let ah = xhr.__ajaxHooker;
if (!ah) {
ah = xhr.__ajaxHooker = {
headers: {},
hookedEvents: {
readystatechange: new Set(),
load: new Set(),
loadend: new Set(),
},
delegateEvent: xhrDelegateEvent,
originalGetters: {},
originalMethods: {},
};
xhr.addEventListener("readystatechange", xhrReadyStateChange);
xhr.addEventListener("load", xhrLoadAndLoadend);
xhr.addEventListener("loadend", xhrLoadAndLoadend);
for (const key of xhrResponses) {
ah.originalGetters[key] = lookupGetter(xhr, key);
}
for (const method of ["open", "setRequestHeader", "addEventListener", "removeEventListener"]) {
ah.originalMethods[method] = xhr[method].bind(xhr);
}
xhr.open = fakeXhrOpen;
xhr.setRequestHeader = (header, value) => {
ah.originalMethods.setRequestHeader(header, value);
if (xhr.readyState === 1) {
if (ah.headers[header]) {
ah.headers[header] += ", " + value;
} else {
ah.headers[header] = value;
}
}
};
xhr.addEventListener = function (...args) {
if (xhrAsyncEvents.includes(args[0])) {
ah.hookedEvents[args[0]].add(args[1]);
} else {
ah.originalMethods.addEventListener(...args);
}
};
xhr.removeEventListener = function (...args) {
if (xhrAsyncEvents.includes(args[0])) {
ah.hookedEvents[args[0]].delete(args[1]);
} else {
ah.originalMethods.removeEventListener(...args);
}
};
xhrAsyncEvents.forEach((evt) => {
const onEvt = "on" + evt;
defineProp(
xhr,
onEvt,
() => {
return ah.hookedEvents[onEvt] || null;
},
(val) => {
ah.hookedEvents[onEvt] = typeof val === "function" ? val : null;
}
);
});
}
const realSend = xhr.send.bind(xhr);
xhr.send = function (data) {
if (xhr.readyState !== 1) return realSend(data);
ah.delegateEvent = xhrDelegateEvent;
xhrResponses.forEach((prop) => {
delete xhr[prop];
});
if (shouldFilter("xhr", ah.url, ah.method)) {
xhr.addEventListener("ajaxHooker_responseReady", (e2) => {
ah.delegateEvent(e2.detail);
});
return realSend(data);
}
try {
const request = {
type: "xhr",
url: ah.url,
method: ah.method,
abort: false,
headers: ah.headers,
data,
response: null,
};
const requestClone = { ...request };
waitForHookFns(request).then(() => {
waitForRequestKeys(request, requestClone).then(() => {
if (request.abort) return;
ah.originalMethods.open(request.method, request.url, ...ah.openArgs);
for (const header in request.headers) {
ah.originalMethods.setRequestHeader(header, request.headers[header]);
}
data = request.data;
xhr.addEventListener("ajaxHooker_responseReady", (e2) => {
try {
if (typeof request.response === "function") {
const arg = {
finalUrl: xhr.responseURL,
status: xhr.status,
responseHeaders: {},
};
for (const line of xhr
.getAllResponseHeaders()
.trim()
.split(/[\r\n]+/)) {
const parts = line.split(/:\s*/);
if (parts.length === 2) {
const lheader = parts[0].toLowerCase();
if (arg.responseHeaders[lheader]) {
arg.responseHeaders[lheader] += ", " + parts[1];
} else {
arg.responseHeaders[lheader] = parts[1];
}
}
}
xhrResponses.forEach((prop) => {
defineProp(
arg,
prop,
() => {
return (arg[prop] = ah.originalGetters[prop]());
},
(val) => {
delete arg[prop];
arg[prop] = val;
}
);
defineProp(xhr, prop, () => {
const val = ah.originalGetters[prop]();
xhr.dispatchEvent(
new CustomEvent("ajaxHooker_readResponse", {
detail: { prop, val },
})
);
return val;
});
});
xhr.addEventListener("ajaxHooker_readResponse", (e3) => {
arg[e3.detail.prop] = e3.detail.val;
});
const resPromise = Promise.resolve(request.response(arg)).then(() => {
const task = [];
xhrResponses.forEach((prop) => {
const descriptor = Object.getOwnPropertyDescriptor(arg, prop);
if (descriptor && "value" in descriptor) {
task.push(
Promise.resolve(descriptor.value).then((val) => {
arg[prop] = val;
defineProp(xhr, prop, () => {
xhr.dispatchEvent(
new CustomEvent("ajaxHooker_readResponse", {
detail: { prop, val },
})
);
return val;
});
}, emptyFn)
);
}
});
return Promise.all(task);
}, errorFn);
const eventsClone = {};
xhrAsyncEvents.forEach((type) => {
eventsClone[type] = new Set([...ah.hookedEvents[type]]);
eventsClone["on" + type] = ah.hookedEvents["on" + type];
});
ah.delegateEvent = (event) =>
resPromise.then(() => {
event.stopImmediatePropagation = fakeEventSIP;
eventsClone[event.type].forEach((fn) => !event.ajaxHooker_stopped && fn.call(xhr, event));
const onEvent = eventsClone["on" + event.type];
typeof onEvent === "function" && onEvent.call(xhr, event);
});
}
} catch (err) {
console.error(err);
}
ah.delegateEvent(e2.detail);
});
realSend(data);
});
});
} catch (err) {
console.error(err);
realSend(data);
}
};
return xhr;
}
function hookFetchResponse(response, arg, callback) {
fetchResponses.forEach((prop) => {
response[prop] = () =>
new Promise((resolve, reject) => {
resProto[prop].call(response).then((res) => {
if (prop in arg) {
resolve(arg[prop]);
} else {
try {
arg[prop] = res;
Promise.resolve(callback(arg)).then(() => {
if (prop in arg) {
Promise.resolve(arg[prop]).then(
(val) => resolve((arg[prop] = val)),
() => resolve(res)
);
} else {
resolve(res);
}
}, errorFn);
} catch (err) {
console.error(err);
resolve(res);
}
}
}, reject);
});
});
}
function fakeFetch(url, init) {
if (url && typeof url.toString === "function") {
url = url.toString();
init = init || {};
init.method = init.method || "GET";
init.headers = init.headers || {};
if (shouldFilter("fetch", url, init.method)) return realFetch.call(win, url, init);
const request = {
type: "fetch",
url,
method: init.method.toUpperCase(),
abort: false,
headers: {},
data: init.body,
response: null,
};
if (toString.call(init.headers) === "[object Headers]") {
for (const [key, val] of init.headers) {
request.headers[key] = val;
}
} else {
request.headers = { ...init.headers };
}
const requestClone = { ...request };
return new Promise((resolve, reject) => {
try {
waitForHookFns(request).then(() => {
waitForRequestKeys(request, requestClone).then(() => {
if (request.abort) return reject("aborted");
url = request.url;
init.method = request.method;
init.headers = request.headers;
init.body = request.data;
realFetch.call(win, url, init).then((response) => {
if (typeof request.response === "function") {
const arg = {
finalUrl: response.url,
status: response.status,
responseHeaders: {},
};
for (const [key, val] of response.headers) {
arg.responseHeaders[key] = val;
}
hookFetchResponse(response, arg, request.response);
response.clone = () => {
const resClone = resProto.clone.call(response);
hookFetchResponse(resClone, arg, request.response);
return resClone;
};
}
resolve(response);
}, reject);
});
});
} catch (err) {
console.error(err);
return realFetch.call(win, url, init);
}
});
} else {
return realFetch.call(win, url, init);
}
}
win.XMLHttpRequest = fakeXhr;
Object.keys(realXhr).forEach((key) => (fakeXhr[key] = realXhr[key]));
fakeXhr.prototype = realXhr.prototype;
win.fetch = fakeFetch;
return {
hook: (fn) => hookFns.push(fn),
filter: (arr) => {
filter = Array.isArray(arr) && arr.map(toFilterObj);
},
protect: () => {
readonly(win, "XMLHttpRequest", fakeXhr);
readonly(win, "fetch", fakeFetch);
},
unhook: () => {
writable(win, "XMLHttpRequest", realXhr);
writable(win, "fetch", realFetch);
},
};
})();
};
class GMMenu {
GM_Api = {
getValue: null,
setValue: null,
registerMenuCommand: null,
unregisterMenuCommand: null,
};
MenuHandle = {
context: this,
$data: {
data: [],
key: "GM_Menu_Local_Map",
},
$default: {
autoReload: true,
isStoreValue: true,
},
$emoji: {
success: "✅",
error: "❌",
},
init() {
for (let index = 0; index < this.$data.data.length; index++) {
const menuOption = this.$data.data[index]["data"];
menuOption.enable = Boolean(this.getLocalMenuData(menuOption.key, menuOption.enable));
if (typeof menuOption.showText !== "function") {
menuOption.showText = (menuText, menuEnable) => {
if (menuEnable) {
return `${this.$emoji.success} ${menuText}`;
} else {
return `${this.$emoji.error} ${menuText}`;
}
};
}
}
},
register(menuOptions) {
const that = this;
if (menuOptions == null) {
throw new TypeError("register菜单数据不能为空");
}
if (!Array.isArray(menuOptions)) {
menuOptions = [menuOptions];
}
for (let index = 0; index < menuOptions.length; index++) {
const cloneMenuOptionData = commonUtil.deepClone(menuOptions[index].data);
const { showText, clickCallBack } = this.handleMenuData(cloneMenuOptionData);
const menuId = that.context.GM_Api.registerMenuCommand(showText, clickCallBack);
menuOptions[index].id = menuId;
cloneMenuOptionData.deleteMenu = function () {
that.context.GM_Api.unregisterMenuCommand(menuId);
};
Reflect.deleteProperty(menuOptions[index], "handleData");
menuOptions[index].handleData = cloneMenuOptionData;
}
},
getLocalMenuData(key, defaultValue) {
const localData = this.context.GM_Api.getValue(this.$data.key, {});
if (key in localData) {
return localData[key];
} else {
return defaultValue;
}
},
setLocalMenuData(key, value) {
const localData = this.context.GM_Api.getValue(this.$data.key, {});
localData[key] = value;
this.context.GM_Api.setValue(this.$data.key, localData);
},
handleInitDetail(menuOption) {
menuOption.enable = Boolean(this.getLocalMenuData(menuOption.key, menuOption.enable));
if (typeof menuOption.showText !== "function") {
menuOption.showText = (menuText, menuEnable) => {
if (menuEnable) {
return `${this.$emoji.success} ${menuText}`;
} else {
return `${this.$emoji.error} ${menuText}`;
}
};
}
return menuOption;
},
handleMenuData(menuOption) {
const that = this;
const menuLocalDataItemKey = menuOption.key;
const defaultEnable = Boolean(this.getLocalMenuData(menuLocalDataItemKey, menuOption.enable));
const showText = menuOption.showText(menuOption.text, defaultEnable);
menuOption.autoReload =
typeof menuOption.autoReload !== "boolean" ? this.$default.autoReload : menuOption.autoReload;
menuOption.isStoreValue =
typeof menuOption.isStoreValue !== "boolean" ? this.$default.isStoreValue : menuOption.isStoreValue;
function clickCallBack(event) {
const localEnable = Boolean(that.getLocalMenuData(menuLocalDataItemKey, defaultEnable));
if (menuOption.isStoreValue) {
that.setLocalMenuData(menuLocalDataItemKey, !localEnable);
}
if (typeof menuOption.callback === "function") {
menuOption.callback({
key: menuLocalDataItemKey,
enable: !localEnable,
oldEnable: localEnable,
event,
storeValue(value) {
that.setLocalMenuData(menuLocalDataItemKey, value);
},
});
}
if (menuOption.autoReload) {
window.location.reload();
} else {
that.context.update();
}
}
return {
showText,
clickCallBack,
};
},
getMenuData(menuKey) {
return this.$data.data.find((item) => item.data.key === menuKey);
},
getMenuOption(menuKey) {
return this.$data.data.find((item) => item.data.key === menuKey)?.data;
},
getMenuHandledOption(menuKey) {
return this.$data.data.find((item) => item.handleData.key === menuKey)?.handleData;
},
};
constructor(details) {
this.GM_Api.getValue = details.GM_getValue;
this.GM_Api.setValue = details.GM_setValue;
this.GM_Api.registerMenuCommand = details.GM_registerMenuCommand;
this.GM_Api.unregisterMenuCommand = details.GM_unregisterMenuCommand;
this.MenuHandle.$default.autoReload = typeof details.autoReload === "boolean" ? details.autoReload : true;
for (const keyName of Object.keys(this.GM_Api)) {
if (typeof this.GM_Api[keyName] !== "function") {
throw new Error(`Utils.GM_Menu 请在脚本开头加上 @grant ${keyName},且传入该对象`);
}
}
this.add(details?.data || []);
}
__add(menuOption) {
if (Array.isArray(menuOption)) {
for (let index = 0; index < menuOption.length; index++) {
const option = menuOption[index];
this.MenuHandle.$data.data.push({
data: option,
id: void 0,
});
}
} else {
this.MenuHandle.$data.data.push({
data: menuOption,
id: void 0,
});
}
}
add(menuOption) {
this.__add(menuOption);
this.update();
}
update(options) {
let menuOptionList = [];
if (Array.isArray(options)) {
menuOptionList = [...menuOptionList, ...options];
} else if (options != null) {
menuOptionList = [...menuOptionList, options];
}
menuOptionList.forEach((menuOption) => {
const oldMenuOption = this.MenuHandle.getMenuOption(menuOption.key);
if (oldMenuOption) {
Object.assign(oldMenuOption, menuOption);
} else {
this.__add(menuOption);
}
});
this.MenuHandle.$data.data.forEach((value) => {
if (value.handleData) {
value.handleData.deleteMenu();
}
});
this.MenuHandle.init();
this.MenuHandle.register(this.MenuHandle.$data.data);
}
delete(menuId) {
this.GM_Api.unregisterMenuCommand(menuId);
}
getEnable(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey).enable;
}
getText(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey).text;
}
getShowTextValue(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey).showText(this.getText(menuKey), this.getEnable(menuKey));
}
getMenuId(menuKey) {
let result = null;
for (let index = 0; index < this.MenuHandle.$data.data.length; index++) {
const optionData = this.MenuHandle.$data.data[index];
if (optionData.handleData.key === menuKey) {
result = optionData.id;
break;
}
}
return result;
}
getAccessKey(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey)?.accessKey;
}
getAutoClose(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey)?.autoClose;
}
getAutoReload(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey)?.autoReload;
}
getCallBack(menuKey) {
return this.MenuHandle.getMenuHandledOption(menuKey)?.callback;
}
getEnableTrueEmoji() {
return this.MenuHandle.$emoji.success;
}
getEnableFalseEmoji() {
return this.MenuHandle.$emoji.error;
}
getLocalStorageKeyName() {
return this.MenuHandle.$data.key;
}
setValue(menuKey, value) {
this.MenuHandle.setLocalMenuData(menuKey, value);
}
setEnable(menuKey, value) {
this.setValue(menuKey, Boolean(value));
}
setEnableTrueEmoji(emojiString) {
if (typeof emojiString !== "string") {
throw new Error("参数emojiString必须是string类型");
}
this.MenuHandle.$emoji.success = emojiString;
}
setEnableFalseEmoji(emojiString) {
if (typeof emojiString !== "string") {
throw new Error("参数emojiString必须是string类型");
}
this.MenuHandle.$emoji.error = emojiString;
}
setLocalStorageKeyName(keyName) {
if (typeof keyName !== "string") {
throw new Error("参数keyName必须是string类型");
}
this.MenuHandle.$data.key = keyName;
}
}
class Hooks {
initEnv() {
Function.prototype.hook = function (_, hookFunc, context) {
let _context = null;
let _funcName = null;
_context = context || window;
_funcName = getFuncName(this);
_context[`realFunc_${_funcName}`] = this;
if (_context[_funcName].prototype && _context[_funcName].prototype.isHooked) {
console.log("Already has been hooked,unhook first");
return false;
}
function getFuncName(fn) {
const strFunc = fn.toString();
const _regex = /function\s+(\w+)\s*\(/;
const patten = strFunc.match(_regex);
if (patten) {
return patten[1];
}
return "";
}
try {
new Function(
"_context",
"_funcName",
"hookFunc",
`_context[_funcName] = function ${_funcName}() {
let args = Array.prototype.slice.call(arguments, 0);
let obj = this;
hookFunc.apply(obj, args);
return _context['realFunc_${_funcName}'].apply(obj, args);
};`
)(_context, _funcName, hookFunc);
_context[_funcName].prototype.isHooked = true;
return true;
} catch (e2) {
console.log("Hook failed,check the params.", e2);
return false;
}
};
Function.prototype.unhook = function (_, funcName, context) {
let _context = null;
let _funcName = null;
_context = context || window;
_funcName = funcName;
if (!_context[_funcName].prototype.isHooked) {
console.log("No function is hooked on");
return false;
}
_context[_funcName] = _context[`realFunc${_funcName}`];
Reflect.deleteProperty(_context, `realFunc_${_funcName}`);
return true;
};
}
cleanEnv() {
if (Object.prototype.hasOwnProperty.call(Function.prototype, "hook")) {
Reflect.deleteProperty(Function.prototype, "hook");
}
if (Object.prototype.hasOwnProperty.call(Function.prototype, "unhook")) {
Reflect.deleteProperty(Function.prototype, "unhook");
}
return true;
}
}
const GenerateUUID = function () {
if (typeof window?.crypto?.randomUUID === "function") {
return window.crypto.randomUUID();
} else {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (charStr) {
const randomValue = (Math.random() * 16) | 0,
randomCharValue = charStr === "x" ? randomValue : (randomValue & 3) | 8;
return randomCharValue.toString(16);
});
}
};
class Httpx {
GM_Api = {
xmlHttpRequest: null,
};
HttpxRequestHook = {
$config: {
configList: [],
},
async beforeRequestCallBack(details) {
if (typeof details.allowInterceptConfig === "boolean") {
if (!details.allowInterceptConfig) {
return details;
}
} else {
if (details.allowInterceptConfig != null) {
if (
typeof details.allowInterceptConfig.beforeRequest === "boolean" &&
!details.allowInterceptConfig.beforeRequest
) {
return details;
}
}
}
for (let index = 0; index < this.$config.configList.length; index++) {
const item = this.$config.configList[index];
if (typeof item.fn === "function") {
const result = await item.fn(details);
if (result == null) {
return;
}
}
}
return details;
},
add(fn) {
if (typeof fn === "function") {
const uuid = GenerateUUID();
this.$config.configList.push({
id: uuid,
fn,
});
return uuid;
} else {
console.warn("[Httpx-HttpxRequestHook.addBeforeRequestCallBack] fn is not a function");
}
},
delete(id) {
if (typeof id === "string") {
const findIndex = this.$config.configList.findIndex((item) => item.id === id);
if (findIndex !== -1) {
this.$config.configList.splice(findIndex, 1);
return true;
}
}
return false;
},
clearAll() {
this.$config.configList = [];
},
};
HttpxResponseHook = {
$config: {
configList: [],
},
async successResponseCallBack(response, details) {
if (typeof details.allowInterceptConfig === "boolean") {
if (!details.allowInterceptConfig) {
return details;
}
} else {
if (details.allowInterceptConfig != null) {
if (
typeof details.allowInterceptConfig.afterResponseSuccess === "boolean" &&
!details.allowInterceptConfig.afterResponseSuccess
) {
return details;
}
}
}
for (let index = 0; index < this.$config.configList.length; index++) {
const item = this.$config.configList[index];
if (typeof item.successFn === "function") {
const result = await item.successFn(response, details);
if (result == null) {
return;
}
}
}
return response;
},
async errorResponseCallBack(data) {
if (typeof data.details.allowInterceptConfig === "boolean") {
if (!data.details.allowInterceptConfig) {
return data;
}
} else {
if (data.details.allowInterceptConfig != null) {
if (
typeof data.details.allowInterceptConfig.afterResponseError === "boolean" &&
!data.details.allowInterceptConfig.afterResponseError
) {
return data;
}
}
}
for (let index = 0; index < this.$config.configList.length; index++) {
const item = this.$config.configList[index];
if (typeof item.errorFn === "function") {
const result = await item.errorFn(data);
if (result == null) {
return;
}
}
}
return data;
},
add(successFn, errorFn) {
const id = GenerateUUID();
this.$config.configList.push({
id,
successFn,
errorFn,
});
return id;
},
delete(id) {
if (typeof id === "string") {
const findIndex = this.$config.configList.findIndex((item) => item.id === id);
if (findIndex !== -1) {
this.$config.configList.splice(findIndex, 1);
return true;
}
}
return false;
},
clearAll() {
this.$config.configList = [];
},
};
HttpxRequestOption = {
context: this,
handleBeforeRequestOptionArgs(...args) {
const option = {
url: void 0,
};
if (typeof args[0] === "string") {
const url = args[0];
option.url = url;
if (typeof args[1] === "object") {
const optionArg = args[1];
commonUtil.assign(option, optionArg, true);
option.url = url;
}
} else {
const optionArg = args[0];
commonUtil.assign(option, optionArg, true);
}
return option;
},
getRequestOption(method, userRequestOption, resolve, reject) {
const that = this;
let url = userRequestOption.url || this.context.#defaultRequestOption.url;
if (typeof url === "string") {
url = url.trim();
if (url.startsWith("http://") || url.startsWith("https://"));
else {
if (typeof this.context.#defaultInitOption.baseURL === "string") {
url = this.context.#defaultInitOption.baseURL + url;
}
}
}
const requestOption = {
url,
method: (method || "GET").toString().toUpperCase().trim(),
timeout: userRequestOption.timeout || this.context.#defaultRequestOption.timeout,
responseType: userRequestOption.responseType || this.context.#defaultRequestOption.responseType,
headers: commonUtil.deepClone(this.context.#defaultRequestOption.headers),
data: userRequestOption.data || this.context.#defaultRequestOption.data,
redirect: userRequestOption.redirect || this.context.#defaultRequestOption.redirect,
cookie: userRequestOption.cookie || this.context.#defaultRequestOption.cookie,
cookiePartition: userRequestOption.cookiePartition || this.context.#defaultRequestOption.cookiePartition,
binary: userRequestOption.binary || this.context.#defaultRequestOption.binary,
nocache: userRequestOption.nocache || this.context.#defaultRequestOption.nocache,
revalidate: userRequestOption.revalidate || this.context.#defaultRequestOption.revalidate,
context: commonUtil.deepClone(userRequestOption.context || this.context.#defaultRequestOption.context),
overrideMimeType: userRequestOption.overrideMimeType || this.context.#defaultRequestOption.overrideMimeType,
anonymous: userRequestOption.anonymous || this.context.#defaultRequestOption.anonymous,
fetch: userRequestOption.fetch || this.context.#defaultRequestOption.fetch,
fetchInit: commonUtil.deepClone(this.context.#defaultRequestOption.fetchInit),
allowInterceptConfig: {
beforeRequest: this.context.#defaultRequestOption.allowInterceptConfig.beforeRequest,
afterResponseSuccess: this.context.#defaultRequestOption.allowInterceptConfig.afterResponseSuccess,
afterResponseError: this.context.#defaultRequestOption.allowInterceptConfig.afterResponseError,
},
user: userRequestOption.user || this.context.#defaultRequestOption.user,
password: userRequestOption.password || this.context.#defaultRequestOption.password,
onabort(...args) {
that.context.HttpxResponseCallBack.onAbort(userRequestOption, resolve, reject, args);
},
onerror(...args) {
that.context.HttpxResponseCallBack.onError(userRequestOption, resolve, reject, args);
},
onloadstart(...args) {
that.context.HttpxResponseCallBack.onLoadStart(userRequestOption, args);
},
onprogress(...args) {
that.context.HttpxResponseCallBack.onProgress(userRequestOption, args);
},
onreadystatechange(...args) {
that.context.HttpxResponseCallBack.onReadyStateChange(userRequestOption, args);
},
ontimeout(...args) {
that.context.HttpxResponseCallBack.onTimeout(userRequestOption, resolve, reject, args);
},
onload(...args) {
that.context.HttpxResponseCallBack.onLoad(userRequestOption, resolve, reject, args);
},
};
if (typeof userRequestOption.allowInterceptConfig === "boolean") {
const allowInterceptConfigKeys = Object.keys(requestOption.allowInterceptConfig);
allowInterceptConfigKeys.forEach((keyName) => {
Reflect.set(requestOption.allowInterceptConfig, keyName, userRequestOption.allowInterceptConfig);
});
} else {
if (
typeof userRequestOption.allowInterceptConfig === "object" &&
userRequestOption.allowInterceptConfig != null
) {
const allowInterceptConfigKeys = Object.keys(requestOption.allowInterceptConfig);
allowInterceptConfigKeys.forEach((keyName) => {
const value = Reflect.get(userRequestOption.allowInterceptConfig, keyName);
if (typeof value === "boolean" && Reflect.has(requestOption.allowInterceptConfig, keyName)) {
Reflect.set(requestOption.allowInterceptConfig, keyName, value);
}
});
}
}
if (typeof this.context.GM_Api.xmlHttpRequest !== "function") {
requestOption.fetch = true;
}
if (typeof requestOption.headers === "object") {
if (typeof userRequestOption.headers === "object") {
const headerKeys = Object.keys(requestOption.headers);
headerKeys.forEach((keyName) => {
if (keyName in requestOption.headers && userRequestOption.headers?.[keyName] == null) {
Reflect.deleteProperty(requestOption.headers, keyName);
} else {
requestOption.headers[keyName] = userRequestOption?.headers?.[keyName];
}
});
}
} else {
Reflect.set(requestOption, "headers", userRequestOption.headers);
}
if (typeof requestOption.fetchInit === "object") {
if (typeof userRequestOption.fetchInit === "object") {
const fetchInitKeys = Object.keys(requestOption.fetchInit);
fetchInitKeys.forEach((keyName) => {
if (
keyName in requestOption.fetchInit &&
Reflect.get(userRequestOption.fetchInit ?? {}, keyName) == null
) {
Reflect.deleteProperty(requestOption.fetchInit, keyName);
} else {
Reflect.set(requestOption.fetchInit, keyName, Reflect.get(userRequestOption.fetchInit, keyName));
}
});
}
} else {
Reflect.set(requestOption, "fetchInit", userRequestOption.fetchInit);
}
if (typeof requestOption.cookiePartition === "object" && requestOption.cookiePartition != null) {
if (
Reflect.has(requestOption.cookiePartition, "topLevelSite") &&
typeof requestOption.cookiePartition.topLevelSite !== "string"
) {
Reflect.deleteProperty(requestOption.cookiePartition, "topLevelSite");
}
}
try {
new URL(requestOption.url);
} catch {
if (requestOption.url.startsWith("//")) {
requestOption.url = globalThis.location.protocol + requestOption.url;
} else if (requestOption.url.startsWith("/")) {
requestOption.url = globalThis.location.origin + requestOption.url;
} else {
requestOption.url = `${globalThis.location.origin}/${requestOption.url}`;
}
}
if (requestOption.fetchInit && !requestOption.fetch) {
Reflect.deleteProperty(requestOption, "fetchInit");
}
try {
const processData = userRequestOption.processData ?? true;
if (requestOption.data != null && processData) {
const method2 = requestOption.method;
if (method2 === "GET" || method2 === "HEAD") {
const urlObj = new URL(requestOption.url);
let urlSearch = "";
let isHandler = false;
if (typeof requestOption.data === "string") {
isHandler = true;
urlSearch = requestOption.data;
} else if (typeof requestOption.data === "object") {
isHandler = true;
const searchParams = new URLSearchParams(requestOption.data);
urlSearch = searchParams.toString();
}
if (isHandler) {
Reflect.deleteProperty(requestOption, "data");
}
if (urlSearch != "") {
if (urlObj.search === "") {
urlObj.search = urlSearch;
} else {
if (urlObj.search.endsWith("&")) {
urlObj.search = urlObj.search + urlSearch;
} else {
urlObj.search = `${urlObj.search}&${urlSearch}`;
}
}
}
requestOption.url = urlObj.toString();
} else if (method2 === "POST" && requestOption.headers != null) {
const headersKeyList = Object.keys(requestOption.headers);
const ContentTypeIndex = headersKeyList.findIndex((headerKey) => {
return (
headerKey.trim().toLowerCase() === "content-type" &&
typeof requestOption.headers[headerKey] === "string"
);
});
if (ContentTypeIndex !== -1) {
const ContentTypeKey = headersKeyList[ContentTypeIndex];
const ContentType = requestOption.headers[ContentTypeKey];
if (ContentType.includes("application/json")) {
if (requestOption.data instanceof FormData) {
const entries = {};
requestOption.data.forEach((value, key) => {
entries[key] = value;
});
requestOption.data = JSON.stringify(entries);
} else if (typeof requestOption.data === "object") {
requestOption.data = JSON.stringify(requestOption.data);
}
} else if (ContentType.includes("application/x-www-form-urlencoded")) {
if (typeof requestOption.data === "object") {
requestOption.data = new URLSearchParams(requestOption.data).toString();
}
} else if (ContentType.includes("multipart/form-data")) {
if (requestOption.data instanceof FormData) {
Reflect.deleteProperty(requestOption.headers, ContentTypeKey);
}
}
}
}
}
} catch (error) {
console.warn("Httpx ==> 转换data参数错误", error);
}
return requestOption;
},
removeRequestNullOption(option) {
const optionKeys = Object.keys(option);
optionKeys.forEach((keyName) => {
const optionValue = option[keyName];
if (optionValue == null || (optionValue instanceof Function && commonUtil.isNull(optionValue))) {
Reflect.deleteProperty(option, keyName);
return;
}
});
if (commonUtil.isNull(option.url)) {
throw new TypeError(`Utils.Httpx 参数url不能为空:${option.url}`);
}
return option;
},
handleFetchOption(option) {
const fetchRequestOption = {};
if ((option.method === "GET" || option.method === "HEAD") && option.data != null) {
Reflect.deleteProperty(option, "data");
}
const abortController = new AbortController();
const signal = abortController.signal;
signal.onabort = () => {
option.onabort({
isFetch: true,
responseText: "",
response: null,
readyState: 4,
responseHeaders: "",
status: 0,
statusText: "",
error: "aborted",
});
};
fetchRequestOption.method = option.method ?? "GET";
fetchRequestOption.headers = option.headers;
fetchRequestOption.body = option.data;
fetchRequestOption.mode = "cors";
fetchRequestOption.credentials = "include";
fetchRequestOption.cache = "no-cache";
fetchRequestOption.redirect = "follow";
fetchRequestOption.referrerPolicy = "origin-when-cross-origin";
fetchRequestOption.signal = signal;
Object.assign(fetchRequestOption, option.fetchInit || {});
return {
fetchOption: option,
fetchRequestOption,
abortController,
};
},
};
HttpxResponseCallBack = {
context: this,
async onAbort(details, resolve, _reject, argsResult) {
if (typeof details?.onabort === "function") {
details.onabort.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.onabort === "function") {
this.context.#defaultRequestOption.onabort.apply(this, argsResult);
}
let response = argsResult;
if (response.length) {
response = response[0];
}
if (
(await this.context.HttpxResponseHook.errorResponseCallBack({
type: "onabort",
error: new Error("request canceled"),
response: null,
details,
})) == null
) {
return;
}
resolve({
data: response,
details,
msg: "请求被取消",
status: false,
statusCode: -1,
type: "onabort",
});
},
async onTimeout(details, resolve, _reject, argsResult) {
if (typeof details?.ontimeout === "function") {
details.ontimeout.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.ontimeout === "function") {
this.context.#defaultRequestOption.ontimeout.apply(this, argsResult);
}
let response = argsResult;
if (response.length) {
response = response[0];
}
if (
(await this.context.HttpxResponseHook.errorResponseCallBack({
type: "ontimeout",
error: new Error("request timeout"),
response,
details,
})) == null
) {
return;
}
resolve({
data: response,
details,
msg: "请求超时",
status: false,
statusCode: 0,
type: "ontimeout",
});
},
async onError(details, resolve, _reject, argsResult) {
if (typeof details?.onerror === "function") {
details.onerror.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.onerror === "function") {
this.context.#defaultRequestOption.onerror.apply(this, argsResult);
}
let response = argsResult;
if (response.length) {
response = response[0];
}
if (
(await this.context.HttpxResponseHook.errorResponseCallBack({
type: "onerror",
error: new Error("request error"),
response,
details,
})) == null
) {
return;
}
resolve({
data: response,
details,
msg: "请求异常",
status: false,
statusCode: response["status"],
type: "onerror",
});
},
async onLoad(details, resolve, _reject, argsResult) {
const originResponse = argsResult[0];
if (commonUtil.isNull(originResponse["responseText"]) && commonUtil.isNotNull(originResponse["response"])) {
if (typeof originResponse["response"] === "object") {
TryCatch().run(() => {
originResponse["responseText"] = JSON.stringify(originResponse["response"]);
});
} else {
originResponse["responseText"] = originResponse["response"];
}
}
if (
originResponse["response"] == null &&
typeof originResponse["responseText"] === "string" &&
originResponse["responseText"].trim() !== ""
) {
const httpxResponseText = originResponse.responseText;
let httpxResponse = httpxResponseText;
if (details.responseType === "json") {
httpxResponse = commonUtil.toJSON(httpxResponseText);
} else if (details.responseType === "document") {
const parser = new DOMParser();
httpxResponse = parser.parseFromString(httpxResponseText, "text/html");
} else if (details.responseType === "arraybuffer") {
const encoder = new TextEncoder();
const arrayBuffer = encoder.encode(httpxResponseText);
httpxResponse = arrayBuffer;
} else if (details.responseType === "blob") {
const encoder = new TextEncoder();
const arrayBuffer = encoder.encode(httpxResponseText);
httpxResponse = new Blob([arrayBuffer]);
}
try {
const setStatus = Reflect.set(originResponse, "response", httpxResponse);
if (!setStatus) {
console.warn("[Httpx-HttpxCallBack.oonLoad] 覆盖原始 response 失败,尝试添加新的httpxResponse");
try {
Reflect.set(originResponse, "httpxResponse", httpxResponse);
} catch {
console.warn("[Httpx-HttpxCallBack.oonLoad] httpxResponse 无法被覆盖");
}
}
} catch {
console.warn("[Httpx-HttpxCallBack.oonLoad] 原始 response 无法被覆盖,尝试添加新的httpxResponse");
try {
Reflect.set(originResponse, "httpxResponse", httpxResponse);
} catch {
console.warn("[Httpx-HttpxCallBack.oonLoad] httpxResponse 无法被覆盖");
}
}
}
const originResponseURL = Reflect.get(originResponse, "responseURL");
if (originResponse["finalUrl"] == null && originResponseURL != null) {
Reflect.set(originResponse, "finalUrl", originResponseURL);
}
if (Math.floor(originResponse.status / 100) === 2) {
if ((await this.context.HttpxResponseHook.successResponseCallBack(originResponse, details)) == null) {
return;
}
resolve({
data: originResponse,
details,
msg: "请求成功",
status: true,
statusCode: originResponse.status,
type: "onload",
});
} else {
this.context.HttpxResponseCallBack.onError(details, resolve, _reject, argsResult);
}
},
onLoadStart(details, argsResult) {
if (typeof details?.onloadstart === "function") {
details.onloadstart.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.onloadstart === "function") {
this.context.#defaultRequestOption.onloadstart.apply(this, argsResult);
}
},
onReadyStateChange(details, argsResult) {
if (typeof details?.onreadystatechange === "function") {
details.onreadystatechange.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.onreadystatechange === "function") {
this.context.#defaultRequestOption.onreadystatechange.apply(this, argsResult);
}
},
onProgress(details, argsResult) {
if (typeof details?.onprogress === "function") {
details.onprogress.apply(this, argsResult);
} else if (typeof this.context.#defaultRequestOption?.onprogress === "function") {
this.context.#defaultRequestOption.onprogress.apply(this, argsResult);
}
},
};
HttpxRequest = {
context: this,
async request(details) {
if (this.context.#defaultInitOption.logDetails) {
console.log("[Httpx-HttpxRequest.request] 请求前的配置👇", details);
}
if (typeof this.context.HttpxRequestHook.beforeRequestCallBack === "function") {
const hookResult = await this.context.HttpxRequestHook.beforeRequestCallBack(details);
if (hookResult == null) {
return;
}
}
if (details.fetch) {
const { fetchOption, fetchRequestOption, abortController } =
this.context.HttpxRequestOption.handleFetchOption(details);
return this.fetch(fetchOption, fetchRequestOption, abortController);
} else {
return this.xmlHttpRequest(details);
}
},
xmlHttpRequest(details) {
return this.context.GM_Api.xmlHttpRequest(details);
},
fetch(option, fetchRequestOption, abortController) {
fetch(option.url, fetchRequestOption)
.then(async (fetchResponse) => {
const httpxResponse = {
isFetch: true,
finalUrl: fetchResponse.url,
readyState: 4,
status: fetchResponse.status,
statusText: fetchResponse.statusText,
response: "",
responseFetchHeaders: fetchResponse.headers,
responseHeaders: "",
responseText: "",
responseType: option.responseType,
responseXML: void 0,
};
Object.assign(httpxResponse, option.context || {});
fetchResponse.headers.forEach((value, key) => {
httpxResponse.responseHeaders += `${key}: ${value}
`;
});
const fetchResponseType = fetchResponse.headers.get("Content-Type");
if (
option.responseType === "stream" ||
(fetchResponse.headers.has("Content-Type") &&
fetchResponse.headers.get("Content-Type").includes("text/event-stream"))
) {
Reflect.set(httpxResponse, "isStream", true);
Reflect.set(httpxResponse, "response", fetchResponse.body);
Reflect.deleteProperty(httpxResponse, "responseText");
Reflect.deleteProperty(httpxResponse, "responseXML");
option.onload(httpxResponse);
return;
}
let response = "";
let responseText = "";
let responseXML = "";
const arrayBuffer = await fetchResponse.arrayBuffer();
let encoding = "utf-8";
if (fetchResponse.headers.has("Content-Type")) {
const charsetMatched = fetchResponse.headers.get("Content-Type")?.match(/charset=(.+)/);
if (charsetMatched) {
encoding = charsetMatched[1];
encoding = encoding.toLowerCase();
}
}
encoding = encoding.replace(/('|")/gi, "");
const textDecoder = new TextDecoder(encoding);
responseText = textDecoder.decode(arrayBuffer);
response = responseText;
if (option.responseType === "arraybuffer") {
response = arrayBuffer;
} else if (option.responseType === "blob") {
response = new Blob([arrayBuffer]);
} else if (
option.responseType === "json" ||
(typeof fetchResponseType === "string" && fetchResponseType.includes("application/json"))
) {
response = commonUtil.toJSON(responseText);
} else if (option.responseType === "document" || option.responseType == null) {
const parser2 = new DOMParser();
response = parser2.parseFromString(responseText, "text/html");
}
const parser = new DOMParser();
responseXML = parser.parseFromString(responseText, "text/xml");
httpxResponse.response = response;
httpxResponse.responseText = responseText;
httpxResponse.responseXML = responseXML;
option.onload(httpxResponse);
})
.catch((error) => {
if (error.name === "AbortError") {
return;
}
option.onerror({
isFetch: true,
finalUrl: option.url,
readyState: 4,
status: 0,
statusText: "",
responseHeaders: "",
responseText: "",
error,
});
});
option.onloadstart({
isFetch: true,
finalUrl: option.url,
readyState: 1,
responseHeaders: "",
responseText: "",
status: 0,
statusText: "",
});
return {
abort() {
abortController.abort();
},
};
},
};
#defaultRequestOption = {
url: void 0,
timeout: 5e3,
async: false,
responseType: void 0,
headers: void 0,
data: void 0,
redirect: void 0,
cookie: void 0,
cookiePartition: void 0,
binary: void 0,
nocache: void 0,
revalidate: void 0,
context: void 0,
overrideMimeType: void 0,
anonymous: void 0,
fetch: void 0,
fetchInit: void 0,
allowInterceptConfig: {
beforeRequest: true,
afterResponseSuccess: true,
afterResponseError: true,
},
user: void 0,
password: void 0,
onabort() {},
onerror() {},
ontimeout() {},
onloadstart() {},
onreadystatechange() {},
onprogress() {},
};
#defaultInitOption = {
baseURL: void 0,
logDetails: false,
};
constructor(option = {}) {
if (typeof option.xmlHttpRequest !== "function") {
console.warn(
"[Httpx-constructor] 未传入GM_xmlhttpRequest函数或传入的GM_xmlhttpRequest不是Function,将默认使用window.fetch"
);
}
commonUtil.coverObjectFunctionThis(this);
this.interceptors.request.context = this;
this.interceptors.response.context = this;
this.config(option);
}
config(option = {}) {
if (typeof option.xmlHttpRequest === "function") {
this.GM_Api.xmlHttpRequest = option.xmlHttpRequest;
}
this.#defaultRequestOption = commonUtil.assign(this.#defaultRequestOption, option);
this.#defaultInitOption = commonUtil.assign(this.#defaultInitOption, option);
}
interceptors = {
request: {
context: null,
use(fn) {
if (typeof fn !== "function") {
console.warn("[Httpx-interceptors-request] 请传入拦截器函数");
return;
}
return this.context.HttpxRequestHook.add(fn);
},
eject(id) {
return this.context.HttpxRequestHook.delete(id);
},
ejectAll() {
this.context.HttpxRequestHook.clearAll();
},
},
response: {
context: null,
use(successFn, errorFn) {
if (typeof successFn !== "function" && typeof errorFn !== "function") {
console.warn("[Httpx-interceptors-response] 必须传入一个拦截器函数");
return;
}
return this.context.HttpxResponseHook.add(successFn, errorFn);
},
eject(id) {
return this.context.HttpxResponseHook.delete(id);
},
ejectAll() {
this.context.HttpxResponseHook.clearAll();
},
},
};
setXMLHttpRequest(httpRequest) {
this.GM_Api.xmlHttpRequest = httpRequest;
}
get(...args) {
const useRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
useRequestOption.method = "GET";
return this.request(useRequestOption, (option) => {
Reflect.deleteProperty(option, "onprogress");
});
}
post(...args) {
const useRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
useRequestOption.method = "POST";
return this.request(useRequestOption);
}
head(...args) {
const useRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
useRequestOption.method = "HEAD";
return this.request(useRequestOption, (option) => {
Reflect.deleteProperty(option, "onprogress");
});
}
options(...args) {
const useRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
useRequestOption.method = "OPTIONS";
return this.request(useRequestOption, (option) => {
Reflect.deleteProperty(option, "onprogress");
});
}
delete(...args) {
const useRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
useRequestOption.method = "DELETE";
return this.request(useRequestOption, (option) => {
Reflect.deleteProperty(option, "onprogress");
});
}
put(...args) {
const userRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(...args);
userRequestOption.method = "PUT";
return this.request(userRequestOption);
}
request(details, beforeRequestOption) {
const userRequestOption = this.HttpxRequestOption.handleBeforeRequestOptionArgs(details);
let abortFn = null;
const promise = new globalThis.Promise(async (resolve, reject) => {
let requestOption = this.HttpxRequestOption.getRequestOption(
userRequestOption.method,
userRequestOption,
(resultOption) => {
resolve(resultOption);
},
(...args) => {
reject(...args);
}
);
requestOption = this.HttpxRequestOption.removeRequestNullOption(requestOption);
if (typeof beforeRequestOption === "function") {
beforeRequestOption(requestOption);
}
const requestResult = await this.HttpxRequest.request(requestOption);
if (requestResult != null && typeof requestResult.abort === "function") {
abortFn = () => {
requestResult.abort();
};
}
});
promise.abort = () => {
if (typeof abortFn === "function") {
abortFn();
}
};
return promise;
}
}
class indexedDB {
#dbName;
#storeName;
#dbVersion;
#indexedDB =
globalThis.indexedDB || globalThis.mozIndexedDB || globalThis.webkitIndexedDB || globalThis.msIndexedDB;
#db = {};
#statusCode = {
operationSuccess: {
code: 200,
msg: "操作成功",
},
operationFailed: {
code: 401,
msg: "操作失败",
},
empty: {
code: 201,
msg: "操作成功,但是没有数据",
},
openFailed: { code: 91001, msg: "打开数据库失败" },
saveFailed: { code: 91002, msg: "保存数据失败" },
getFailed: { code: 91003, msg: "获取数据失败" },
deleteFailed: { code: 91004, msg: "删除数据失败" },
deleteAllFailed: { code: 91005, msg: "清空数据库失败" },
regexpGetFailed: { code: 91006, msg: "正则获取数据失败" },
};
constructor(dbName = "default_db", storeName = "default_form", dbVersion = 1) {
this.#dbName = dbName;
this.#storeName = storeName;
this.#dbVersion = dbVersion;
if (!this.#indexedDB) {
window.alert("很抱歉,您的浏览器不支持indexedDB");
throw new TypeError("很抱歉,您的浏览器不支持indexedDB");
}
}
createStore(dbName) {
const txn = this.#db[dbName].transaction(this.#storeName, "readwrite");
const store = txn.objectStore(this.#storeName);
return store;
}
open(callback, dbName) {
const that = this;
if (!that.#db[dbName]) {
const request = that.#indexedDB.open(dbName, that.#dbVersion);
request.onerror = function (event) {
callback(null, {
code: that.#statusCode.openFailed.code,
msg: that.#statusCode.openFailed.msg,
event,
});
};
request.onsuccess = function (event) {
if (!that.#db[dbName]) {
const target = event.target;
that.#db[dbName] = target.result;
}
const store = that.createStore(dbName);
callback(store);
};
request.onupgradeneeded = function (event) {
const target = event.target;
that.#db[dbName] = target.result;
const store = that.#db[dbName].createObjectStore(that.#storeName, {
keyPath: "key",
});
store.transaction.oncomplete = function () {
callback(store);
};
};
} else {
const store = this.createStore(dbName);
callback(store);
}
}
async save(key, value) {
const that = this;
return new Promise((resolve) => {
const dbName = this.#dbName;
const inData = {
key,
value,
};
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.saveFailed.code,
msg: that.#statusCode.saveFailed.msg,
});
} else {
const request = idbStore.put(inData);
request.onsuccess = function (event) {
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
event,
});
};
request.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.saveFailed.code,
msg: that.#statusCode.saveFailed.msg,
event,
});
};
}
}, dbName);
});
}
async has(key) {
const that = this;
return new Promise((resolve) => {
const dbName = this.#dbName;
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.getFailed.code,
msg: that.#statusCode.getFailed.msg,
});
} else {
const request = idbStore.get(key);
request.onsuccess = function (event) {
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
event,
});
};
request.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.getFailed.code,
msg: that.#statusCode.getFailed.msg,
event,
});
};
}
}, dbName);
});
}
async get(key) {
const that = this;
return new Promise((resolve) => {
const dbName = this.#dbName;
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.getFailed.code,
msg: that.#statusCode.getFailed.msg,
data: void 0,
});
} else {
const request = idbStore.get(key);
request.onsuccess = function (event) {
const target = event.target;
const result = target.result;
const data = result ? result.value : void 0;
if (data == null) {
resolve({
success: true,
code: that.#statusCode.empty.code,
msg: that.#statusCode.empty.msg,
data,
event,
result,
});
} else {
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
data,
event,
result,
});
}
};
request.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.getFailed.code,
msg: that.#statusCode.getFailed.msg,
data: void 0,
event,
});
};
}
}, dbName);
});
}
async regexpGet(key) {
let list = [];
const that = this;
return new Promise((resolve) => {
const dbName = that.#dbName;
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.regexpGetFailed.code,
msg: that.#statusCode.regexpGetFailed.msg,
data: [],
});
} else {
const request = idbStore.getAll();
request.onsuccess = function (event) {
const target = event.target;
const result = target.result;
if (result.length !== 0) {
result.forEach((dataItem) => {
const __key = dataItem["key"];
const __value = dataItem["value"];
if (__key.match(key)) {
list = list.concat(__value);
}
});
}
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
data: list,
event,
});
};
request.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.getFailed.code,
msg: that.#statusCode.getFailed.msg,
data: [],
event,
});
};
}
}, dbName);
});
}
async delete(key) {
const that = this;
return new Promise((resolve) => {
const dbName = that.#dbName;
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.deleteFailed.code,
msg: that.#statusCode.deleteFailed.msg,
});
} else {
const request = idbStore.delete(key);
request.onsuccess = function (event) {
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
event,
});
};
request.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.deleteFailed.code,
msg: that.#statusCode.deleteFailed.msg,
event,
});
};
}
}, dbName);
});
}
async deleteAll() {
const that = this;
return new Promise((resolve) => {
const dbName = that.#dbName;
this.open(function (idbStore) {
if (idbStore == null) {
resolve({
success: false,
code: that.#statusCode.deleteAllFailed.code,
msg: that.#statusCode.deleteAllFailed.msg,
});
} else {
const operateResult = idbStore.clear();
operateResult.onsuccess = function (event) {
resolve({
success: true,
code: that.#statusCode.operationSuccess.code,
msg: that.#statusCode.operationSuccess.msg,
event,
});
};
operateResult.onerror = function (event) {
resolve({
success: false,
code: that.#statusCode.deleteAllFailed.code,
msg: that.#statusCode.deleteAllFailed.msg,
event,
});
};
}
}, dbName);
});
}
}
class LockFunction {
#flag = false;
#delayTime = 0;
#callback;
#timeId = void 0;
lock;
unlock;
run;
isLock;
constructor(callback, context, delayTime) {
const that = this;
this.#callback = callback;
if (typeof context === "number") {
this.#delayTime = context;
} else {
this.#delayTime = delayTime;
}
this.lock = function () {
that.#flag = true;
clearTimeout(that.#timeId);
};
this.unlock = function () {
that.#timeId = setTimeout(() => {
that.#flag = false;
}, that.#delayTime);
};
this.isLock = function () {
return that.#flag;
};
this.run = async function (...args) {
if (that.isLock()) {
return;
}
that.lock();
await that.#callback.apply(this, args);
that.unlock();
};
}
}
class Log {
#disable = false;
tag = "Utils.Log";
#console = null;
#logCount = 0;
#details = {
tag: true,
successColor: "#0000FF",
errorColor: "#FF0000",
infoColor: "0",
warnColor: "0",
debug: false,
autoClearConsole: false,
logMaxCount: 999,
};
#msgColorDetails = [
"font-weight: bold; color: cornflowerblue",
"font-weight: bold; color: cornflowerblue",
"font-weight: bold; color: darkorange",
"font-weight: bold; color: cornflowerblue",
];
constructor(__GM_info, console2 = window.console) {
if (typeof __GM_info === "string") {
this.tag = __GM_info;
} else if (typeof __GM_info === "object" && typeof __GM_info?.script?.name === "string") {
this.tag = __GM_info.script.name;
}
this.#console = console2;
}
parseErrorStack(stack) {
const result = {
name: "",
position: "",
};
for (let stackString of stack) {
stackString = stackString.trim();
const stackFunctionNameMatch = stackString.match(/^at[\s]+(.+?)[\s]+/i);
const stackFunctionNamePositionMatch = stackString.match(/^at[\s]+.+[\s]+\((.+?)\)/i);
if (stackFunctionNameMatch == null) {
continue;
}
if (stackFunctionNamePositionMatch == null) {
continue;
}
const stackFunctionName = stackFunctionNameMatch[stackFunctionNameMatch.length - 1];
const stackFunctionNamePosition = stackFunctionNamePositionMatch[stackFunctionNamePositionMatch.length - 1];
if (
stackFunctionName === "" ||
stackFunctionName.match(/^(Utils\.|)Log(\.|)|.<anonymous>$|^Function.each|^NodeList.forEach|^k.fn.init.each/g)
) {
continue;
} else {
result.name = stackFunctionName;
result.position = stackFunctionNamePosition;
break;
}
}
if (result.position === "") {
const lastStackString = stack[stack.length - 1].trim();
if (lastStackString.startsWith("at chrome-extension://")) {
const lastStackMatch = lastStackString.match(/^at[\s]+(.+)/);
if (lastStackMatch) {
result.position = lastStackMatch[lastStackMatch.length - 1];
}
}
}
if (result.position === "") {
result.position = stack[stack.length - 1].trim().replace(/^at[\s]*/g, "");
}
return result;
}
checkClearConsole() {
this.#logCount++;
if (this.#details.autoClearConsole && this.#logCount > this.#details.logMaxCount) {
this.#console.clear();
this.#logCount = 0;
}
}
printContent(msg, color, otherStyle) {
this.checkClearConsole();
otherStyle = otherStyle || "";
const stackSplit = new Error().stack.split("\n");
stackSplit.splice(0, 2);
const { name: callerName, position: callerPosition } = this.parseErrorStack(stackSplit);
const tagName = this.tag;
const that = this;
const tagNameHTML = `%c[${tagName}%c`;
let callerNameHTML = `%c${callerName}%c]%c`;
if (callerName.trim() === "") {
callerNameHTML = `-${callerNameHTML}`;
}
function consoleMsg(message) {
if (typeof message === "string") {
that.#console.log(
`${tagNameHTML}${callerNameHTML} %s`,
...that.#msgColorDetails,
`color: ${color};${otherStyle}`,
message
);
} else if (typeof message === "number") {
that.#console.log(
`${tagNameHTML}${callerNameHTML} %d`,
...that.#msgColorDetails,
`color: ${color};${otherStyle}`,
message
);
} else if (typeof message === "object") {
that.#console.log(
`${tagNameHTML}${callerNameHTML} %o`,
...that.#msgColorDetails,
`color: ${color};${otherStyle}`,
message
);
} else {
that.#console.log(message);
}
}
if (Array.isArray(msg)) {
for (let index = 0; index < msg.length; index++) {
consoleMsg(msg[index]);
}
} else {
consoleMsg(msg);
}
if (this.#details.debug) {
this.#console.log(callerPosition);
}
}
info(...args) {
if (this.#disable) return;
this.printContent(args, this.#details.infoColor);
}
warn(...args) {
if (this.#disable) return;
this.printContent(args, this.#details.warnColor, "background: #FEF6D5;padding: 4px 6px 4px 0px;");
}
error(...args) {
if (this.#disable) return;
this.printContent(args, this.#details.errorColor);
}
success(...args) {
if (this.#disable) return;
this.printContent(args, this.#details.successColor);
}
table(msg) {
if (this.#disable) return;
this.checkClearConsole();
const stack = new Error().stack.split("\n");
stack.splice(0, 1);
const errorStackParse = this.parseErrorStack(stack);
const stackFunctionName = errorStackParse.name;
const stackFunctionNamePosition = errorStackParse.position;
const callerName = stackFunctionName;
this.#console.log(
`%c[${this.tag}%c-%c${callerName}%c]%c`,
...this.#msgColorDetails,
`color: ${this.#details.infoColor};`
);
this.#console.table(msg);
if (this.#details.debug) {
this.#console.log(stackFunctionNamePosition);
}
}
config(paramDetails) {
this.#details = Object.assign(this.#details, paramDetails);
}
disable() {
this.#disable = true;
}
recovery() {
this.#disable = false;
}
}
class Progress {
#config = {
canvasNode: null,
deg: 95,
progress: 0,
lineWidth: 10,
lineBgColor: "#1e637c",
lineColor: "#25deff",
textColor: "#000000",
fontSize: 22,
circleRadius: 50,
};
#ctx;
#width;
#height;
constructor(paramConfig) {
this.#config = commonUtil.assign(this.#config, paramConfig);
if (!(this.#config.canvasNode instanceof HTMLCanvasElement)) {
throw new Error("Utils.Progress 参数 canvasNode 必须是 HTMLCanvasElement");
}
const ctx = this.#config.canvasNode.getContext("2d");
if (ctx == null) {
throw new Error("Utils.Progress 获取画笔失败");
}
this.#ctx = ctx;
this.#width = this.#config.canvasNode.width;
this.#height = this.#config.canvasNode.height;
if (window.devicePixelRatio) {
this.#config.canvasNode.style.width = `${this.#width}px`;
this.#config.canvasNode.style.height = `${this.#height}px`;
this.#config.canvasNode.height = this.#height * window.devicePixelRatio;
this.#config.canvasNode.width = this.#width * window.devicePixelRatio;
this.#ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
}
this.#ctx.lineWidth = this.#config.lineWidth;
}
draw() {
const degActive = (this.#config.progress * 360) / 100;
this.#ctx.clearRect(0, 0, this.#width, this.#height);
this.#ctx.beginPath();
this.#ctx.arc(this.#width / 2, this.#height / 2, this.#config.circleRadius, 1, 8);
this.#ctx.strokeStyle = this.#config.lineBgColor;
this.#ctx.stroke();
this.#ctx.beginPath();
this.#ctx.arc(
this.#width / 2,
this.#height / 2,
this.#config.circleRadius,
-Math.PI / 2,
(degActive * Math.PI) / 180 - Math.PI / 2
);
this.#ctx.strokeStyle = this.#config.lineColor;
this.#ctx.stroke();
const txt = `${parseInt(this.#config.progress.toString())}%`;
this.#ctx.font = `${this.#config.fontSize}px SimHei`;
const w = this.#ctx.measureText(txt).width;
const h2 = this.#config.fontSize / 2;
this.#ctx.fillStyle = this.#config.textColor;
this.#ctx.fillText(txt, this.#width / 2 - w / 2, this.#height / 2 + h2 / 2);
}
}
class UtilsDictionary {
items;
constructor(key, value) {
this.items = new Map();
if (key != null) {
this.set(key, value);
}
}
get length() {
return this.size();
}
get entries() {
const that = this;
return function* () {
const itemKeys = Object.keys(that.getItems());
for (const keyName of itemKeys) {
yield [keyName, that.get(keyName)];
}
};
}
get [Symbol.iterator]() {
return () => {
return this.entries();
};
}
has(key) {
return this.items.has(key);
}
get(key) {
return this.items.get(key);
}
set(key, val) {
if (key === void 0) {
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
}
this.items.set(key, val);
}
delete(key) {
if (this.has(key)) {
return this.items.delete(key);
}
return false;
}
keys() {
return Array.from(this.items.keys());
}
values() {
return Array.from(this.items.values());
}
clear() {
this.items.clear();
}
size() {
return this.items.size;
}
getItems() {
return this.items;
}
concat(data) {
data.forEach((value, key) => {
this.items.set(key, value);
});
}
forEach(callbackfn) {
this.items.forEach((value, key) => {
callbackfn(value, key, this);
});
}
startsWith(key) {
const keys = this.keys();
for (const keyName of keys) {
if (String(keyName).startsWith(key)) {
return true;
}
}
return false;
}
getStartsWith(key) {
let result = void 0;
const keys = this.keys();
for (const keyName of keys) {
if (String(keyName).startsWith(String(key))) {
result = this.get(keyName);
break;
}
}
return result;
}
}
class WindowApi2 {
defaultApi = {
document,
window,
globalThis,
self,
top,
setTimeout: globalThis.setTimeout.bind(globalThis),
setInterval: globalThis.setInterval.bind(globalThis),
clearTimeout: globalThis.clearTimeout.bind(globalThis),
clearInterval: globalThis.clearInterval.bind(globalThis),
};
api;
constructor(option) {
if (option) {
if (option.globalThis == null) {
option.globalThis = option.window;
}
if (option.self == null) {
option.self = option.window;
}
}
if (!option) {
option = Object.assign({}, this.defaultApi);
}
this.api = Object.assign({}, option);
}
get document() {
return this.api.document;
}
get window() {
return this.api.window;
}
get globalThis() {
return this.api.globalThis;
}
get self() {
return this.api.self;
}
get top() {
return this.api.top;
}
get setTimeout() {
return this.api.setTimeout;
}
get setInterval() {
return this.api.setInterval;
}
get clearTimeout() {
return this.api.clearTimeout;
}
get clearInterval() {
return this.api.clearInterval;
}
}
const VueUtils = {
ReactiveFlags: {
IS_REACTIVE: Symbol("isReactive"),
},
isObject(value) {
return typeof value === "object" && value !== null;
},
isFunction(val) {
return typeof val === "function";
},
isReactive(value) {
return !!(value && value[VueUtils.ReactiveFlags.IS_REACTIVE]);
},
isArray(value) {
return Array.isArray(value);
},
};
class ReactiveEffect {
deps = [];
active = true;
fn;
scheduler;
constructor(fn, scheduler) {
this.fn = fn;
this.scheduler = scheduler;
}
run(cb) {
if (!this.active) {
this.fn();
}
try {
if (typeof cb === "function") {
cb(this);
}
return this.fn();
} finally {
if (typeof cb === "function") {
cb(void 0);
}
}
}
}
class RefImpl {
_value;
_isRef = true;
_rawValue;
_vue;
constructor(vueIns, rawValue) {
this._vue = vueIns;
this._rawValue = rawValue;
this._value = this._vue.toReactive(rawValue);
}
get value() {
return this._value;
}
set value(newValue) {
if (newValue !== this._rawValue) {
this._value = this._vue.toReactive(newValue);
this._rawValue = newValue;
}
}
}
class ObjectRefImpl {
object;
key;
constructor(object, key) {
this.object = object;
this.key = key;
}
get value() {
return this.object[this.key];
}
set value(newValue) {
this.object[this.key] = newValue;
}
}
class Vue {
reactMap = new WeakMap();
targetMap = new WeakMap();
activeEffect = void 0;
constructor() {}
reactive(target) {
const that = this;
if (!(typeof target === "object" && target !== null)) {
return void 0;
}
if (VueUtils.isReactive(target)) {
return target;
}
const exisProxy = this.reactMap.get(target);
if (exisProxy) {
return exisProxy;
}
const proxy = new Proxy(target, {
get(target2, key, receiver) {
if (key === VueUtils.ReactiveFlags.IS_REACTIVE) {
return true;
}
that.track(target2, "get", key);
return Reflect.get(target2, key, receiver);
},
set(target2, key, value, receiver) {
const oldValue = target2[key];
const result = Reflect.set(target2, key, value, receiver);
if (oldValue !== value) {
that.trigger(target2, "set", key, oldValue, value);
}
return result;
},
});
that.reactMap.set(target, proxy);
return proxy;
}
watch(source, changeCallBack) {
let getter;
if (VueUtils.isReactive(source)) {
getter = () => this.traversal(source);
} else if (VueUtils.isFunction(source)) {
getter = source;
} else {
return;
}
let oldValue;
const job = () => {
const newValue = effect.run((activeEffect) => {
this.activeEffect = activeEffect;
});
changeCallBack(newValue, oldValue);
oldValue = newValue;
};
const effect = new ReactiveEffect(getter, job);
oldValue = effect.run((activeEffect) => {
this.activeEffect = activeEffect;
});
}
toReactive(value) {
return VueUtils.isObject(value) ? this.reactive(value) : value;
}
ref(value) {
return new RefImpl(this, value);
}
toRef(object, key) {
return new ObjectRefImpl(object, key);
}
toRefs(object) {
const result = VueUtils.isArray(object) ? new Array(object.length) : {};
for (const key in object) {
result[key] = this.toRef(object, key);
}
return result;
}
trigger(target, type, key, oldValue, value) {
const depsMap = this.targetMap.get(target);
if (!depsMap) return;
const effects = depsMap.get(key);
this.triggerEffect(effects, "effects");
}
triggerEffect(effects, name) {
if (effects) {
effects.forEach((effect) => {
if (effect.scheduler) {
effect.scheduler();
} else {
effect.run();
}
});
}
}
track(target, type, key) {
if (!this.activeEffect) return;
let depsMap = this.targetMap.get(target);
if (!depsMap) {
this.targetMap.set(target, (depsMap = new Map()));
}
let dep = depsMap.get(key);
if (!dep) {
depsMap.set(key, (dep = new Set()));
}
this.trackEffect(dep);
}
trackEffect(dep) {
if (this.activeEffect) {
const shouldTrack = !dep.has(this.activeEffect);
if (shouldTrack) {
dep.add(this.activeEffect);
this.activeEffect.deps.push(dep);
}
}
}
traversal(value, set = new Set()) {
if (!VueUtils.isObject(value)) return value;
if (set.has(value)) {
return value;
}
set.add(value);
for (const key in value) {
this.traversal(value[key], set);
}
return value;
}
}
const createCache$1 = (lastNumberWeakMap) => {
return (collection, nextNumber) => {
lastNumberWeakMap.set(collection, nextNumber);
return nextNumber;
};
};
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
const TWO_TO_THE_POWER_OF_TWENTY_NINE$1 = 536870912;
const TWO_TO_THE_POWER_OF_THIRTY$1 = TWO_TO_THE_POWER_OF_TWENTY_NINE$1 * 2;
const createGenerateUniqueNumber$1 = (cache2, lastNumberWeakMap) => {
return (collection) => {
const lastNumber = lastNumberWeakMap.get(collection);
let nextNumber =
lastNumber === void 0 ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY$1 ? lastNumber + 1 : 0;
if (!collection.has(nextNumber)) {
return cache2(collection, nextNumber);
}
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE$1) {
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY$1);
}
return cache2(collection, nextNumber);
}
if (collection.size > MAX_SAFE_INTEGER$1) {
throw new Error(
"Congratulations, you created a collection of unique numbers which uses all available integers!"
);
}
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER$1);
}
return cache2(collection, nextNumber);
};
};
const LAST_NUMBER_WEAK_MAP$1 = new WeakMap();
const cache$1 = createCache$1(LAST_NUMBER_WEAK_MAP$1);
const generateUniqueNumber$1 = createGenerateUniqueNumber$1(cache$1, LAST_NUMBER_WEAK_MAP$1);
const isMessagePort$1 = (sender) => {
return typeof sender.start === "function";
};
const PORT_MAP$1 = new WeakMap();
const extendBrokerImplementation$1 = (partialBrokerImplementation) => ({
...partialBrokerImplementation,
connect: ({ call }) => {
return async () => {
const { port1, port2 } = new MessageChannel();
const portId = await call("connect", { port: port1 }, [port1]);
PORT_MAP$1.set(port2, portId);
return port2;
};
},
disconnect: ({ call }) => {
return async (port) => {
const portId = PORT_MAP$1.get(port);
if (portId === void 0) {
throw new Error("The given port is not connected.");
}
await call("disconnect", { portId });
};
},
isSupported: ({ call }) => {
return () => call("isSupported");
},
});
const ONGOING_REQUESTS$1 = new WeakMap();
const createOrGetOngoingRequests$1 = (sender) => {
if (ONGOING_REQUESTS$1.has(sender)) {
return ONGOING_REQUESTS$1.get(sender);
}
const ongoingRequests = new Map();
ONGOING_REQUESTS$1.set(sender, ongoingRequests);
return ongoingRequests;
};
const createBroker$1 = (brokerImplementation) => {
const fullBrokerImplementation = extendBrokerImplementation$1(brokerImplementation);
return (sender) => {
const ongoingRequests = createOrGetOngoingRequests$1(sender);
sender.addEventListener("message", ({ data: message }) => {
const { id } = message;
if (id !== null && ongoingRequests.has(id)) {
const { reject, resolve } = ongoingRequests.get(id);
ongoingRequests.delete(id);
if (message.error === void 0) {
resolve(message.result);
} else {
reject(new Error(message.error.message));
}
}
});
if (isMessagePort$1(sender)) {
sender.start();
}
const call = (method, params = null, transferables = []) => {
return new Promise((resolve, reject) => {
const id = generateUniqueNumber$1(ongoingRequests);
ongoingRequests.set(id, { reject, resolve });
if (params === null) {
sender.postMessage({ id, method }, transferables);
} else {
sender.postMessage({ id, method, params }, transferables);
}
});
};
const notify = (method, params, transferables = []) => {
sender.postMessage({ id: null, method, params }, transferables);
};
let functions = {};
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
functions = { ...functions, [key]: handler({ call, notify }) };
}
return { ...functions };
};
};
const scheduledIntervalsState$1 = new Map([[0, null]]);
const scheduledTimeoutsState$1 = new Map([[0, null]]);
const wrap$1 = createBroker$1({
clearInterval: ({ call }) => {
return (timerId) => {
if (typeof scheduledIntervalsState$1.get(timerId) === "symbol") {
scheduledIntervalsState$1.set(timerId, null);
call("clear", { timerId, timerType: "interval" }).then(() => {
scheduledIntervalsState$1.delete(timerId);
});
}
};
},
clearTimeout: ({ call }) => {
return (timerId) => {
if (typeof scheduledTimeoutsState$1.get(timerId) === "symbol") {
scheduledTimeoutsState$1.set(timerId, null);
call("clear", { timerId, timerType: "timeout" }).then(() => {
scheduledTimeoutsState$1.delete(timerId);
});
}
};
},
setInterval: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$1(scheduledIntervalsState$1);
scheduledIntervalsState$1.set(timerId, symbol);
const schedule = () =>
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "interval",
}).then(() => {
const state = scheduledIntervalsState$1.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
func(...args);
if (scheduledIntervalsState$1.get(timerId) === symbol) {
schedule();
}
}
});
schedule();
return timerId;
};
},
setTimeout: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber$1(scheduledTimeoutsState$1);
scheduledTimeoutsState$1.set(timerId, symbol);
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "timeout",
}).then(() => {
const state = scheduledTimeoutsState$1.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
scheduledTimeoutsState$1.delete(timerId);
func(...args);
}
});
return timerId;
};
},
});
const load$1 = (url) => {
const worker2 = new Worker(url);
return wrap$1(worker2);
};
const createLoadOrReturnBroker$1 = (loadBroker, worker2) => {
let broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker2], { type: "application/javascript; charset=utf-8" });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
const worker$1 = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`;
const loadOrReturnBroker$1 = createLoadOrReturnBroker$1(load$1, worker$1);
const clearInterval$2 = (timerId) => loadOrReturnBroker$1().clearInterval(timerId);
const clearTimeout$1$1 = (timerId) => loadOrReturnBroker$1().clearTimeout(timerId);
const setInterval$2 = (...args) => loadOrReturnBroker$1().setInterval(...args);
const setTimeout$1$1 = (...args) => loadOrReturnBroker$1().setTimeout(...args);
// @license MIT
class ModuleRaid {
constructor(opts) {
this.moduleID = Math.random().toString(36).substring(7);
this.functionArguments = [
[
[0],
[
(_e, _t, i2) => {
this.modules = i2.c;
this.constructors = i2.m;
this.get = i2;
},
],
],
[
[1e3],
{
[this.moduleID]: (_e, _t, i2) => {
this.modules = i2.c;
this.constructors = i2.m;
this.get = i2;
},
},
[[this.moduleID]],
],
];
this.arrayArguments = [
[
[this.moduleID],
{},
(e2) => {
const mCac = e2.m;
Object.keys(mCac).forEach((mod) => {
try {
this.modules[mod] = e2(mod);
} catch (err) {
this.log(`[arrayArguments/1] Failed to require(${mod}) with error:
${err}
${err.stack}`);
}
});
this.get = e2;
},
],
this.functionArguments[1],
];
this.modules = {};
this.constructors = [];
let options = {
target: window,
entrypoint: "webpackJsonp",
debug: false,
strict: false,
};
if (typeof opts === "object") {
options = Object.assign(Object.assign({}, options), opts);
}
this.target = options.target;
this.entrypoint = options.entrypoint;
this.debug = options.debug;
this.strict = options.strict;
this.detectEntrypoint();
this.fillModules();
this.replaceGet();
this.setupPushEvent();
}
log(message) {
if (this.debug) {
console.warn(`[moduleRaid] ${message}`);
}
}
replaceGet() {
if (this.get === null) {
this.get = (key) => this.modules[key];
}
}
fillModules() {
if (typeof this.target[this.entrypoint] === "function") {
this.functionArguments.forEach((argument, index) => {
try {
if (this.modules && Object.keys(this.modules).length > 0) return;
this.target[this.entrypoint](...argument);
} catch (err) {
this.log(`moduleRaid.functionArguments[${index}] failed:
${err}
${err.stack}`);
}
});
} else {
this.arrayArguments.forEach((argument, index) => {
try {
if (this.modules && Object.keys(this.modules).length > 0) return;
this.target[this.entrypoint].push(argument);
} catch (err) {
this.log(`Pushing moduleRaid.arrayArguments[${index}] into ${this.entrypoint} failed:
${err}
${err.stack}`);
}
});
}
if (this.modules && Object.keys(this.modules).length == 0) {
let moduleEnd = false;
let moduleIterator = 0;
if (
typeof this.target[this.entrypoint] != "function" ||
!this.target[this.entrypoint]([], [], [moduleIterator])
) {
throw Error("Unknown Webpack structure");
}
while (!moduleEnd) {
try {
this.modules[moduleIterator] = this.target[this.entrypoint]([], [], [moduleIterator]);
moduleIterator++;
} catch (err) {
moduleEnd = true;
}
}
}
}
setupPushEvent() {
const originalPush = this.target[this.entrypoint].push;
this.target[this.entrypoint].push = (...args) => {
const result = Reflect.apply(originalPush, this.target[this.entrypoint], args);
document.dispatchEvent(new CustomEvent("moduleraid:webpack-push", { detail: args }));
return result;
};
}
detectEntrypoint() {
if (this.target[this.entrypoint] != void 0) {
return;
}
if (this.strict) {
throw Error(
`Strict mode is enabled and entrypoint at window.${this.entrypoint} couldn't be found. Please specify the correct one!`
);
}
let windowObjects = Object.keys(this.target);
windowObjects = windowObjects
.filter((object) => object.toLowerCase().includes("chunk") || object.toLowerCase().includes("webpack"))
.filter((object) => typeof this.target[object] === "function" || Array.isArray(this.target[object]));
if (windowObjects.length > 1) {
throw Error(`Multiple possible endpoints have been detected, please create a new moduleRaid instance with a specific one:
${windowObjects.join(", ")}`);
}
if (windowObjects.length === 0) {
throw Error("No Webpack JSONP entrypoints could be detected");
}
this.log(`Entrypoint has been detected at window.${windowObjects[0]} and set for injection`);
this.entrypoint = windowObjects[0];
}
searchObject(object, query) {
for (const key in object) {
const value = object[key];
const lowerCaseQuery = query.toLowerCase();
if (typeof value != "object") {
const lowerCaseKey = key.toString().toLowerCase();
if (lowerCaseKey.includes(lowerCaseQuery)) return true;
if (typeof value != "object") {
const lowerCaseValue = value.toString().toLowerCase();
if (lowerCaseValue.includes(lowerCaseQuery)) return true;
} else {
if (this.searchObject(value, query)) return true;
}
}
}
return false;
}
findModule(query) {
const results = [];
const modules = Object.keys(this.modules);
if (modules.length === 0) {
throw new Error("There are no modules to search through!");
}
modules.forEach((key) => {
const module = this.modules[key.toString()];
if (module === void 0) return;
try {
if (typeof query === "string") {
query = query.toLowerCase();
switch (typeof module) {
case "string":
if (module.toLowerCase().includes(query)) results.push(module);
break;
case "function":
if (module.toString().toLowerCase().includes(query)) results.push(module);
break;
case "object":
if (this.searchObject(module, query)) results.push(module);
break;
}
} else if (typeof query === "function") {
if (query(module)) results.push(module);
} else {
throw new TypeError(`findModule can only find via string and function, ${typeof query} was passed`);
}
} catch (err) {
this.log(`There was an error while searching through module '${key}':
${err}
${err.stack}`);
}
});
return results;
}
findConstructor(query) {
const results = [];
const constructors = Object.keys(this.constructors);
if (constructors.length === 0) {
throw new Error("There are no constructors to search through!");
}
constructors.forEach((key) => {
const constructor = this.constructors[key];
try {
if (typeof query === "string") {
query = query.toLowerCase();
if (constructor.toString().toLowerCase().includes(query))
results.push([this.constructors[key], this.modules[key]]);
} else if (typeof query === "function") {
if (query(constructor)) results.push([this.constructors[key], this.modules[key]]);
}
} catch (err) {
this.log(`There was an error while searching through constructor '${key}':
${err}
${err.stack}`);
}
});
return results;
}
}
class DOMUtils2 {
windowApi;
constructor(option) {
this.windowApi = new WindowApi2(option);
}
selector(selector, parent) {
return this.selectorAll(selector, parent)[0];
}
selectorAll(selector, parent) {
const context = this;
parent = parent || context.windowApi.document;
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return $ele?.innerHTML?.trim() === "";
});
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return ($ele?.textContent || $ele?.innerText)?.includes(text);
});
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
return Array.from(parent.querySelectorAll(selector)).filter(($ele) => {
return Boolean(($ele?.textContent || $ele?.innerText)?.match(regexp));
});
} else {
return Array.from(parent.querySelectorAll(selector));
}
}
matches($el, selector) {
selector = selector.trim();
if ($el == null) {
return false;
}
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return $el.matches(selector) && $el?.innerHTML?.trim() === "";
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && content?.includes(text);
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && Boolean(content?.match(regexp));
} else {
return $el.matches(selector);
}
}
closest($el, selector) {
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
const $closest = $el?.closest(selector);
if ($closest && $closest?.innerHTML?.trim() === "") {
return $closest;
}
return null;
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.includes(text)) {
return $closest;
}
}
return null;
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.match(regexp)) {
return $closest;
}
}
return null;
} else {
const $closest = $el?.closest(selector);
return $closest;
}
}
}
const domUtils$1 = new DOMUtils2();
const version$1 = "2.9.0";
class Utils2 {
windowApi;
constructor(option) {
this.windowApi = new WindowApi2(option);
}
version = version$1;
assign = commonUtil.assign.bind(commonUtil);
async asyncReplaceAll(string, pattern, asyncFn) {
const that = this;
if (typeof string !== "string") {
throw new TypeError("string必须是字符串");
}
if (typeof asyncFn !== "function") {
throw new TypeError("asyncFn必须是函数");
}
let reg;
if (typeof pattern === "string") {
reg = new RegExp(that.toRegExpStr(pattern), "g");
} else if (pattern instanceof RegExp) {
if (!pattern.global) {
throw new TypeError("pattern必须是全局匹配");
}
reg = new RegExp(pattern);
} else {
throw new TypeError("pattern必须是正则对象");
}
let result = [];
let match;
let lastIndex = 0;
while ((match = reg.exec(string)) !== null) {
const item = asyncFn(match[0]);
const prefix = string.slice(lastIndex, match.index);
lastIndex = match.index + match[0].length;
result.push(item);
result.push(prefix);
}
result.push(string.slice(lastIndex));
result = await Promise.all(result);
return result.join("");
}
ajaxHooker = (useOldVersion = false) => {
if (useOldVersion) {
return AjaxHooker1_2_4();
} else {
return ajaxHooker();
}
};
canvasClickByPosition(canvasElement, clientX = 0, clientY = 0, view = this.windowApi.window) {
if (!(canvasElement instanceof HTMLCanvasElement)) {
throw new Error("Utils.canvasClickByPosition 参数canvasElement必须是canvas元素");
}
clientX = parseInt(clientX.toString());
clientY = parseInt(clientY.toString());
const eventInit = {
cancelBubble: true,
cancelable: true,
clientX,
clientY,
view,
detail: 1,
};
canvasElement.dispatchEvent(new MouseEvent("mousedown", eventInit));
canvasElement.dispatchEvent(new MouseEvent("mouseup", eventInit));
}
cloneFormData(formData, filterFn) {
const clonedFormData = new FormData();
formData.forEach((value, key) => {
const isFilter = typeof filterFn === "function" ? filterFn(key, value) : false;
if (typeof isFilter === "boolean" && isFilter) {
return;
}
clonedFormData.append(key, value);
});
return clonedFormData;
}
createOverload() {
const fnMap = new Map();
function overload(...args) {
const key = args.map((it) => typeof it).join(",");
const fn = fnMap.get(key);
if (!fn) {
throw new TypeError("没有找到对应的实现");
}
return fn.apply(this, args);
}
overload.addImpl = function (...args) {
const fn = args.pop();
if (typeof fn !== "function") {
throw new TypeError("最后一个参数必须是函数");
}
const key = args.join(",");
fnMap.set(key, fn);
};
return overload;
}
ColorConversion = ColorConversion;
deepClone = commonUtil.deepClone.bind(commonUtil);
debounce(fn, delay = 0) {
let timer = null;
const that = this;
return function (...args) {
that.workerClearTimeout(timer);
timer = that.workerSetTimeout(function () {
fn.apply(that, args);
}, delay);
};
}
Dictionary = UtilsDictionary;
downloadBase64(base64Data, fileName, isIFrame = false) {
const that = this;
if (typeof base64Data !== "string") {
throw new Error("Utils.downloadBase64 参数 base64Data 必须为 string 类型");
}
if (typeof fileName !== "string") {
throw new Error("Utils.downloadBase64 参数 fileName 必须为 string 类型");
}
if (isIFrame) {
const $iframe = this.windowApi.document.createElement("iframe");
$iframe.style.display = "none";
$iframe.src = base64Data;
(this.windowApi.document.body || this.windowApi.document.documentElement).appendChild($iframe);
that.workerSetTimeout(() => {
$iframe.contentWindow.document.execCommand("SaveAs", true, fileName);
(this.windowApi.document.body || this.windowApi.document.documentElement).removeChild($iframe);
}, 100);
} else {
const linkElement = this.windowApi.document.createElement("a");
linkElement.setAttribute("target", "_blank");
linkElement.download = fileName;
linkElement.href = base64Data;
linkElement.click();
}
}
findWebPageVisibleText(str = "", caseSensitive = false) {
let TRange = null;
let strFound;
if (this.windowApi.globalThis.find) {
const windowFind = this.windowApi.self.find;
strFound = windowFind(str, caseSensitive, true, true, false);
if (strFound && this.windowApi.self.getSelection && !this.windowApi.self.getSelection().anchorNode) {
strFound = windowFind(str, caseSensitive, true, true, false);
}
if (!strFound) {
strFound = windowFind(str, 0, 1);
while (windowFind(str, 0, 1)) continue;
}
} else if (navigator.appName.indexOf("Microsoft") != -1) {
if (TRange != null) {
TRange = TRange;
TRange.collapse(false);
strFound = TRange.findText(str);
if (strFound) TRange.select();
}
if (TRange == null || strFound == 0) {
TRange = this.windowApi.self.document.body.createTextRange();
strFound = TRange.findText(str);
if (strFound) TRange.select();
}
} else if (navigator.appName == "Opera") {
alert("Opera browsers not supported, sorry...");
return;
}
return strFound ? true : false;
}
formatByteToSize(byteSize, addType = true) {
byteSize = parseInt(byteSize.toString());
if (isNaN(byteSize)) {
throw new Error("Utils.formatByteToSize 参数 byteSize 格式不正确");
}
let result = 0;
let resultType = "KB";
const sizeData = {};
sizeData.B = 1;
sizeData.KB = 1024;
sizeData.MB = sizeData.KB * sizeData.KB;
sizeData.GB = sizeData.MB * sizeData.KB;
sizeData.TB = sizeData.GB * sizeData.KB;
sizeData.PB = sizeData.TB * sizeData.KB;
sizeData.EB = sizeData.PB * sizeData.KB;
sizeData.ZB = sizeData.EB * sizeData.KB;
sizeData.YB = sizeData.ZB * sizeData.KB;
sizeData.BB = sizeData.YB * sizeData.KB;
sizeData.NB = sizeData.BB * sizeData.KB;
sizeData.DB = sizeData.NB * sizeData.KB;
for (const key in sizeData) {
result = byteSize / sizeData[key];
resultType = key;
if (sizeData.KB >= result) {
break;
}
}
result = result.toFixed(2);
result = addType ? result + resultType.toString() : parseFloat(result.toString());
return result;
}
getNodeListValue(...args) {
let resultArray = [];
for (const arg of args) {
let value = arg;
if (typeof arg === "function") {
value = arg();
}
if (value.length !== 0) {
resultArray = [...value];
break;
}
}
return resultArray;
}
getNonNullValue(...args) {
let resultValue = args[args.length - 1];
const that = this;
for (const argValue of args) {
if (that.isNotNull(argValue)) {
resultValue = argValue;
break;
}
}
return resultValue;
}
formatTime(text = new Date(), formatType = "yyyy-MM-dd HH:mm:ss") {
const time = text == null ? new Date() : new Date(text);
function checkTime(timeNum) {
if (timeNum < 10) return `0${timeNum}`;
return timeNum;
}
function timeSystemChange(hourNum) {
return hourNum > 12 ? hourNum - 12 : hourNum;
}
const timeRegexp = {
yyyy: time.getFullYear(),
MM: checkTime(time.getMonth() + 1),
dd: checkTime(time.getDate()),
HH: checkTime(time.getHours()),
hh: checkTime(timeSystemChange(time.getHours())),
mm: checkTime(time.getMinutes()),
ss: checkTime(time.getSeconds()),
};
Object.keys(timeRegexp).forEach(function (key) {
const replaecRegexp = new RegExp(key, "g");
formatType = formatType.replace(replaecRegexp, timeRegexp[key]);
});
return formatType;
}
formatToTimeStamp(text) {
if (typeof text !== "string") {
throw new Error("Utils.formatToTimeStamp 参数 text 必须为 string 类型");
}
if (text.length === 8) {
const today = new Date();
text = `${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()} ${text}`;
}
text = text.substring(0, 19);
text = text.replace(/-/g, "/");
const timestamp = new Date(text).getTime();
return timestamp;
}
GBKEncoder = GBKEncoder;
getArrayLastValue(target) {
return target[target.length - 1];
}
getArrayRealValue(...args) {
let result = null;
for (let arg of args) {
if (typeof arg === "function") {
arg = arg();
}
if (arg != null) {
result = arg;
break;
}
}
return result;
}
getDaysDifference(timestamp1 = Date.now(), timestamp2 = Date.now(), type = "天") {
type = type.trim();
if (timestamp1.toString().length === 10) {
timestamp1 = timestamp1 * 1e3;
}
if (timestamp2.toString().length === 10) {
timestamp2 = timestamp2 * 1e3;
}
const smallTimeStamp = timestamp1 > timestamp2 ? timestamp2 : timestamp1;
const bigTimeStamp = timestamp1 > timestamp2 ? timestamp1 : timestamp2;
const oneSecond = 1e3;
const oneMinute = 60 * oneSecond;
const oneHour = 60 * oneMinute;
const oneDay = 24 * oneHour;
const oneMonth = 30 * oneDay;
const oneYear = 12 * oneMonth;
const bigDate = new Date(bigTimeStamp);
const smallDate = new Date(smallTimeStamp);
let remainderValue = 1;
if (type === "年") {
remainderValue = oneYear;
} else if (type === "月") {
remainderValue = oneMonth;
} else if (type === "天") {
remainderValue = oneDay;
} else if (type === "时") {
remainderValue = oneHour;
} else if (type === "分") {
remainderValue = oneMinute;
} else if (type === "秒") {
remainderValue = oneSecond;
}
let diffValue = Math.round(Math.abs((bigDate - smallDate) / remainderValue));
if (type === "auto") {
const timeDifference = bigTimeStamp - smallTimeStamp;
diffValue = Math.floor(timeDifference / (24 * 3600 * 1e3));
if (diffValue > 0) {
diffValue = `${diffValue}天`;
} else {
const leave1 = timeDifference % (24 * 3600 * 1e3);
const hours = Math.floor(leave1 / (3600 * 1e3));
if (hours > 0) {
diffValue = `${hours}小时`;
} else {
const leave2 = leave1 % (3600 * 1e3);
const minutes = Math.floor(leave2 / (60 * 1e3));
if (minutes > 0) {
diffValue = `${minutes}分钟`;
} else {
const leave3 = leave2 % (60 * 1e3);
const seconds = Math.round(leave3 / 1e3);
diffValue = `${seconds}秒`;
}
}
}
}
return diffValue;
}
getMaxValue(...args) {
const result = [...args];
let newResult = [];
if (result.length === 0) {
return void 0;
}
if (result.length > 1) {
if (result.length === 2 && typeof result[0] === "object" && typeof result[1] === "function") {
const data = result[0];
const handleDataFunc = result[1];
Object.keys(data).forEach((keyName) => {
newResult = [...newResult, handleDataFunc(keyName, data[keyName])];
});
} else {
result.forEach((item) => {
if (!isNaN(parseFloat(item))) {
newResult = [...newResult, parseFloat(item)];
}
});
}
return Math.max(...newResult);
} else {
result[0].forEach((item) => {
if (!isNaN(parseFloat(item))) {
newResult = [...newResult, parseFloat(item)];
}
});
return Math.max(...newResult);
}
}
getMaxZIndexNodeInfo(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
deviation = Number.isNaN(deviation) ? 1 : deviation;
const that = this;
const maxZIndexCompare = 2 * Math.pow(10, 9);
let zIndex = 0;
let maxZIndexNode = null;
function isVisibleNode($css) {
return $css.position !== "static" && $css.display !== "none";
}
function queryMaxZIndex($ele) {
if (typeof ignoreCallBack === "function") {
const ignoreResult = ignoreCallBack($ele);
if (typeof ignoreResult === "boolean" && !ignoreResult) {
return;
}
}
const nodeStyle = that.windowApi.window.getComputedStyle($ele);
if (isVisibleNode(nodeStyle)) {
const nodeZIndex = parseInt(nodeStyle.zIndex);
if (!isNaN(nodeZIndex)) {
if (nodeZIndex > zIndex) {
zIndex = nodeZIndex;
maxZIndexNode = $ele;
}
}
if ($ele.shadowRoot != null && $ele instanceof ShadowRoot) {
$ele.shadowRoot.querySelectorAll("*").forEach(($shadowEle) => {
queryMaxZIndex($shadowEle);
});
}
}
}
target.querySelectorAll("*").forEach(($ele) => {
queryMaxZIndex($ele);
});
zIndex += deviation;
if (zIndex >= maxZIndexCompare) {
zIndex = maxZIndexCompare;
}
return {
node: maxZIndexNode,
zIndex,
};
}
getMaxZIndex(deviation = 1, target = this.windowApi.document, ignoreCallBack) {
return this.getMaxZIndexNodeInfo(deviation, target, ignoreCallBack).zIndex;
}
getMinValue(...args) {
const result = [...args];
let newResult = [];
if (result.length === 0) {
return void 0;
}
if (result.length > 1) {
if (result.length === 2 && typeof result[0] === "object" && typeof result[1] === "function") {
const data = result[0];
const handleDataFunc = result[1];
Object.keys(data).forEach((keyName) => {
newResult = [...newResult, handleDataFunc(keyName, data[keyName])];
});
} else {
result.forEach((item) => {
if (!isNaN(parseFloat(item))) {
newResult = [...newResult, parseFloat(item)];
}
});
}
return Math.min(...newResult);
} else {
result[0].forEach((item) => {
if (!isNaN(parseFloat(item))) {
newResult = [...newResult, parseFloat(item)];
}
});
return Math.min(...newResult);
}
}
getRandomAndroidUA() {
const that = this;
const mobileNameList = [
"LDN-LX3",
"RNE-L03",
"ASUS_X00ID Build/NMF26F",
"WAS-LX3",
"PRA-LX3",
"MYA-L03",
"Moto G Play",
"Moto C Build/NRD90M.063",
"Redmi Note 4 Build/NRD90M",
"HUAWEI VNS-L21 Build/HUAWEIVNS-L21",
"VTR-L09",
"TRT-LX3",
"M2003J15SC Build/RP1A.200720.011; wv",
"MI 13 Build/OPR1.170623.027; wv",
];
const androidVersion = that.getRandomValue(12, 14);
const randomMobile = that.getRandomValue(mobileNameList);
const chromeVersion1 = that.getRandomValue(130, 140);
const chromeVersion2 = that.getRandomValue(0, 0);
const chromeVersion3 = that.getRandomValue(2272, 6099);
const chromeVersion4 = that.getRandomValue(1, 218);
return `Mozilla/5.0 (Linux; Android ${androidVersion}; ${randomMobile}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromeVersion1}.${chromeVersion2}.${chromeVersion3}.${chromeVersion4} Mobile Safari/537.36`;
}
getRandomPCUA() {
const that = this;
const chromeVersion1 = that.getRandomValue(130, 140);
const chromeVersion2 = that.getRandomValue(0, 0);
const chromeVersion3 = that.getRandomValue(2272, 6099);
const chromeVersion4 = that.getRandomValue(1, 218);
return `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromeVersion1}.${chromeVersion2}.${chromeVersion3}.${chromeVersion4} Safari/537.36`;
}
getRandomValue(...args) {
const result = [...args];
if (result.length > 1) {
if (result.length === 2 && typeof result[0] === "number" && typeof result[1] === "number") {
const leftNumber = result[0] > result[1] ? result[1] : result[0];
const rightNumber = result[0] > result[1] ? result[0] : result[1];
return Math.round(Math.random() * (rightNumber - leftNumber)) + leftNumber;
} else {
return result[Math.floor(Math.random() * result.length)];
}
} else if (result.length === 1) {
const paramData = result[0];
if (Array.isArray(paramData)) {
return paramData[Math.floor(Math.random() * paramData.length)];
} else if (typeof paramData === "object" && Object.keys(paramData).length > 0) {
const paramObjDataKey = Object.keys(paramData)[Math.floor(Math.random() * Object.keys(paramData).length)];
return paramData[paramObjDataKey];
} else {
return paramData;
}
}
}
getReactInstance(element) {
const result = {};
if (element == null) {
return result;
}
const keys = Object.keys(element);
keys.forEach((domPropsName) => {
if (domPropsName.startsWith("__react")) {
const propsName = domPropsName.replace(/__(.+)\$.+/i, "$1");
const propsValue = Reflect.get(element, domPropsName);
if (propsName in result) {
console.error(`重复属性 ${domPropsName}`);
} else {
Reflect.set(result, propsName, propsValue);
}
}
});
return result;
}
getSymbol(target, keyName) {
if (typeof target !== "object") {
throw new TypeError("target不是一个对象");
}
const objectsSymbols = Object.getOwnPropertySymbols(target);
if (typeof keyName === "string") {
const findSymbol = objectsSymbols.find((key) => {
return key.toString() === keyName;
});
if (findSymbol) {
return target[findSymbol];
}
} else if (typeof keyName === "symbol") {
const findSymbol = objectsSymbols.find((key) => {
return key === keyName;
});
if (findSymbol) {
return target[findSymbol];
}
} else {
const result = {};
objectsSymbols.forEach((item) => {
result[item] = target[item];
});
return result;
}
}
getTextLength(text) {
const encoder = new TextEncoder();
const bytes = encoder.encode(text);
return bytes.length;
}
getTextStorageSize(text, addType = true) {
const that = this;
return that.formatByteToSize(that.getTextLength(text), addType);
}
getThunderUrl(url) {
if (url == null) {
throw new TypeError("url不能为空");
}
if (typeof url !== "string") {
throw new TypeError("url必须是string类型");
}
if (url.trim() === "") {
throw new TypeError("url不能为空字符串或纯空格");
}
return `thunder://${this.windowApi.globalThis.btoa(`AA${url}ZZ`)}`;
}
GM_Cookie = UtilsGMCookie;
GM_Menu = GMMenu;
Hooks = Hooks;
Httpx = Httpx;
indexedDB = indexedDB;
isNativeFunc(target) {
return Boolean(target.toString().match(/^function .*\(\) { \[native code\] }$/));
}
isNearBottom(...args) {
let nearBottomHeight = 50;
const checkWindow = () => {
const scrollTop = this.windowApi.window.pageYOffset || this.windowApi.document.documentElement.scrollTop;
const viewportHeight =
this.windowApi.window.innerHeight || this.windowApi.document.documentElement.clientHeight;
const maxScrollHeight = this.windowApi.document.documentElement.scrollHeight - nearBottomHeight;
return scrollTop + viewportHeight >= maxScrollHeight;
};
const checkNode = ($ele) => {
const scrollTop = $ele.scrollTop;
const viewportHeight = $ele.clientHeight;
const maxScrollHeight = $ele.scrollHeight - viewportHeight - nearBottomHeight;
return scrollTop >= maxScrollHeight;
};
const firstArg = args[0];
if (args.length === 0 || typeof args[0] === "number") {
return checkWindow();
} else if (typeof args[0] === "object" && args[0] instanceof HTMLElement) {
if (typeof args[1] === "number" && !Number.isNaN(args[1])) {
nearBottomHeight = args[1];
}
return checkNode(args[0]);
} else {
throw new TypeError(`参数1类型错误${typeof firstArg}`);
}
}
isDOM = commonUtil.isDOM.bind(commonUtil);
isFullscreenEnabled() {
return !!(
this.windowApi.document.fullscreenEnabled ||
this.windowApi.document.webkitFullScreenEnabled ||
this.windowApi.document.mozFullScreenEnabled ||
this.windowApi.document.msFullScreenEnabled
);
}
isJQuery(target) {
let result = false;
if (typeof jQuery === "object" && target instanceof jQuery) {
result = true;
}
if (target == null) {
return false;
}
if (typeof target === "object") {
const jQueryProps = [
"add",
"addBack",
"addClass",
"after",
"ajaxComplete",
"ajaxError",
"ajaxSend",
"ajaxStart",
"ajaxStop",
"ajaxSuccess",
"animate",
"append",
"appendTo",
"attr",
"before",
"bind",
"blur",
"change",
"children",
"clearQueue",
"click",
"clone",
"closest",
"constructor",
"contents",
"contextmenu",
"css",
"data",
"dblclick",
"delay",
"delegate",
"dequeue",
"each",
"empty",
"end",
"eq",
"extend",
"fadeIn",
"fadeOut",
"fadeTo",
"fadeToggle",
"filter",
"find",
"first",
"focus",
"focusin",
"focusout",
"get",
"has",
"hasClass",
"height",
"hide",
"hover",
"html",
"index",
"init",
"innerHeight",
"innerWidth",
"insertAfter",
"insertBefore",
"is",
"jquery",
"keydown",
"keypress",
"keyup",
"last",
"load",
"map",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseout",
"mouseover",
"mouseup",
"next",
"nextAll",
"not",
"off",
"offset",
"offsetParent",
"on",
"one",
"outerHeight",
"outerWidth",
"parent",
"parents",
"position",
"prepend",
"prependTo",
"prev",
"prevAll",
"prevUntil",
"promise",
"prop",
"pushStack",
"queue",
"ready",
"remove",
"removeAttr",
"removeClass",
"removeData",
"removeProp",
"replaceAll",
"replaceWith",
"resize",
"scroll",
"scrollLeft",
"scrollTop",
"select",
"show",
"siblings",
"slice",
"slideDown",
"slideToggle",
"slideUp",
"sort",
"splice",
"text",
"toArray",
"toggle",
"toggleClass",
"trigger",
"triggerHandler",
"unbind",
"width",
"wrap",
];
for (const jQueryPropsName of jQueryProps) {
if (!(jQueryPropsName in target)) {
result = false;
break;
} else {
result = true;
}
}
}
return result;
}
isPhone(userAgent = navigator.userAgent) {
return Boolean(/(iPhone|iPad|iPod|iOS|Android|Mobile)/i.test(userAgent));
}
isSameChars(targetStr, coefficient = 1) {
if (typeof targetStr !== "string") {
throw new TypeError("参数 str 必须是 string 类型");
}
if (targetStr.length < 2) {
return false;
}
targetStr = targetStr.toLowerCase();
const targetCharMap = {};
let targetStrLength = 0;
for (const char of targetStr) {
if (Reflect.has(targetCharMap, char)) {
targetCharMap[char]++;
} else {
targetCharMap[char] = 1;
}
targetStrLength++;
}
let result = false;
for (const char in targetCharMap) {
if (targetCharMap[char] / targetStrLength >= coefficient) {
result = true;
break;
}
}
return result;
}
isNotNull = commonUtil.isNotNull.bind(commonUtil);
isNull = commonUtil.isNull.bind(commonUtil);
isThemeDark() {
return this.windowApi.globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
}
isVisible(element, inView = false) {
let needCheckDomList = [];
if (element instanceof Array || element instanceof NodeList) {
element = element;
needCheckDomList = [...element];
} else {
needCheckDomList = [element];
}
let result = true;
for (const domItem of needCheckDomList) {
const domDisplay = this.windowApi.window.getComputedStyle(domItem);
if (domDisplay.display === "none") {
result = false;
} else {
const domClientRect = domItem.getBoundingClientRect();
if (inView) {
const viewportWidth =
this.windowApi.window.innerWidth || this.windowApi.document.documentElement.clientWidth;
const viewportHeight =
this.windowApi.window.innerHeight || this.windowApi.document.documentElement.clientHeight;
result = !(
domClientRect.right < 0 ||
domClientRect.left > viewportWidth ||
domClientRect.bottom < 0 ||
domClientRect.top > viewportHeight
);
} else {
result = Boolean(domItem.getClientRects().length);
}
}
if (!result) {
break;
}
}
return result;
}
isWebView_Via() {
let result = true;
const that = this;
if (typeof this.windowApi.top.window.via === "object") {
for (const key in Object.values(this.windowApi.top.window.via)) {
if (Reflect.has(this.windowApi.top.window.via, key)) {
const objValueFunc = this.windowApi.top.window.via[key];
if (typeof objValueFunc === "function" && that.isNativeFunc(objValueFunc)) {
result = true;
} else {
result = false;
break;
}
}
}
} else {
result = false;
}
return result;
}
isWebView_X() {
let result = true;
const that = this;
if (typeof this.windowApi.top.window.mbrowser === "object") {
for (const key in Object.values(this.windowApi.top.window.mbrowser)) {
if (Reflect.has(this.windowApi.top.window.mbrowser, key)) {
const objValueFunc = this.windowApi.top.window.mbrowser[key];
if (typeof objValueFunc === "function" && that.isNativeFunc(objValueFunc)) {
result = true;
} else {
result = false;
break;
}
}
}
} else {
result = false;
}
return result;
}
parseObjectToArray(target) {
if (typeof target !== "object") {
throw new Error("Utils.parseObjectToArray 参数 target 必须为 object 类型");
}
let result = [];
const keys = Object.keys(target);
keys.forEach(function (keyName) {
const value = Reflect.get(target, keyName);
result = result.concat(value);
});
return result;
}
LockFunction = LockFunction;
Log = Log;
mergeArrayToString(data, handleFunc) {
if (!(data instanceof Array)) {
throw new Error("Utils.mergeArrayToString 参数 data 必须为 Array 类型");
}
let content = "";
if (typeof handleFunc === "function") {
data.forEach((item) => {
content += handleFunc(item);
});
} else if (typeof handleFunc === "string") {
data.forEach((item) => {
content += item[handleFunc];
});
} else {
data.forEach((item) => {
Object.values(item)
.filter((item2) => typeof item2 === "string")
.forEach((item3) => {
content += item3;
});
});
}
return content;
}
mutationObserver(target, observer_config) {
const that = this;
const default_obverser_config = {
callback: () => {},
config: {
subtree: void 0,
childList: void 0,
attributes: void 0,
attributeFilter: void 0,
attributeOldValue: void 0,
characterData: void 0,
characterDataOldValue: void 0,
},
immediate: false,
};
observer_config = that.assign(default_obverser_config, observer_config);
const windowMutationObserver =
this.windowApi.window.MutationObserver ||
this.windowApi.window.webkitMutationObserver ||
this.windowApi.window.MozMutationObserver;
const mutationObserver = new windowMutationObserver(function (mutations, observer) {
if (typeof observer_config.callback === "function") {
observer_config.callback(mutations, observer);
}
});
if (Array.isArray(target) || target instanceof NodeList) {
target.forEach((item) => {
mutationObserver.observe(item, observer_config.config);
});
} else if (that.isJQuery(target)) {
target.each((_, item) => {
mutationObserver.observe(item, observer_config.config);
});
} else {
mutationObserver.observe(target, observer_config.config);
}
if (observer_config.immediate) {
if (typeof observer_config.callback === "function") {
observer_config.callback([], mutationObserver);
}
}
return mutationObserver;
}
mutationVisible(target, callback, options) {
if (typeof IntersectionObserver === "undefined") {
throw new TypeError("IntersectionObserver is not defined");
}
if (target == null) {
throw new TypeError("mutatuinVisible target is null");
}
let defaultOptions = {
root: null,
rootMargin: "0px 0px 0px 0px",
threshold: [0.01, 0.99],
};
defaultOptions = this.assign(defaultOptions, options || {});
const intersectionObserver = new IntersectionObserver((entries, observer) => {
if (entries[0].isIntersecting) {
if (typeof callback === "function") {
callback(entries, observer);
}
}
}, defaultOptions);
if (Array.isArray(target)) {
target.forEach((item) => {
intersectionObserver.observe(item);
});
} else {
intersectionObserver.observe(target);
}
}
noConflict() {
if (this.windowApi.window.Utils) {
Reflect.deleteProperty(this.windowApi.window, "Utils");
}
this.windowApi.window.Utils = utils$1;
return utils$1;
}
noConflictFunc(needReleaseObject, needReleaseName, functionNameList = [], release = true) {
const that = this;
if (typeof needReleaseObject !== "object") {
throw new Error("Utils.noConflictFunc 参数 needReleaseObject 必须为 object 类型");
}
if (typeof needReleaseName !== "string") {
throw new Error("Utils.noConflictFunc 参数 needReleaseName 必须为 string 类型");
}
if (!Array.isArray(functionNameList)) {
throw new Error("Utils.noConflictFunc 参数 functionNameList 必须为 Array 类型");
}
const needReleaseKey = `__${needReleaseName}`;
function releaseAll() {
if (typeof that.windowApi.window[needReleaseKey] !== "undefined") {
return;
}
that.windowApi.window[needReleaseKey] = that.deepClone(needReleaseObject);
Object.values(needReleaseObject).forEach((value) => {
if (typeof value === "function") {
needReleaseObject[value.name] = () => {};
}
});
}
function releaseOne() {
Array.from(functionNameList).forEach((item) => {
Object.values(needReleaseObject).forEach((value) => {
if (typeof value === "function") {
if (typeof that.windowApi.window[needReleaseKey] === "undefined") {
that.windowApi.window[needReleaseKey] = {};
}
if (item === value.name) {
that.windowApi.window[needReleaseKey][value.name] = needReleaseObject[value.name];
needReleaseObject[value.name] = () => {};
}
}
});
});
}
function recoveryAll() {
if (typeof that.windowApi.window[needReleaseKey] === "undefined") {
return;
}
Object.assign(needReleaseObject, that.windowApi.window[needReleaseKey]);
Reflect.deleteProperty(that.windowApi.window, "needReleaseKey");
}
function recoveryOne() {
if (typeof that.windowApi.window[needReleaseKey] === "undefined") {
return;
}
Array.from(functionNameList).forEach((item) => {
if (that.windowApi.window[needReleaseKey][item]) {
needReleaseObject[item] = that.windowApi.window[needReleaseKey][item];
Reflect.deleteProperty(that.windowApi.window[needReleaseKey], item);
if (Object.keys(that.windowApi.window[needReleaseKey]).length === 0) {
Reflect.deleteProperty(window, needReleaseKey);
}
}
});
}
if (release) {
if (functionNameList.length === 0) {
releaseAll();
} else {
releaseOne();
}
} else {
if (functionNameList.length === 0) {
recoveryAll();
} else {
recoveryOne();
}
}
}
parseBase64ToBlob(dataUri) {
if (typeof dataUri !== "string") {
throw new Error("Utils.parseBase64ToBlob 参数 dataUri 必须为 string 类型");
}
const dataUriSplit = dataUri.split(","),
dataUriMime = dataUriSplit[0].match(/:(.*?);/)[1],
dataUriBase64Str = atob(dataUriSplit[1]);
let dataUriLength = dataUriBase64Str.length;
const u8arr = new Uint8Array(dataUriLength);
while (dataUriLength--) {
u8arr[dataUriLength] = dataUriBase64Str.charCodeAt(dataUriLength);
}
return new Blob([u8arr], {
type: dataUriMime,
});
}
parseBase64ToFile(dataUri, fileName = "example") {
if (typeof dataUri !== "string") {
throw new Error("Utils.parseBase64ToFile 参数 dataUri 必须为 string 类型");
}
if (typeof fileName !== "string") {
throw new Error("Utils.parseBase64ToFile 参数 fileName 必须为 string 类型");
}
const dataUriSplit = dataUri.split(","),
dataUriMime = dataUriSplit[0].match(/:(.*?);/)[1],
dataUriBase64Str = atob(dataUriSplit[1]);
let dataUriLength = dataUriBase64Str.length;
const u8arr = new Uint8Array(dataUriLength);
while (dataUriLength--) {
u8arr[dataUriLength] = dataUriBase64Str.charCodeAt(dataUriLength);
}
return new File([u8arr], fileName, {
type: dataUriMime,
});
}
parseInt(matchList = [], defaultValue = 0) {
if (matchList == null) {
return parseInt(defaultValue.toString());
}
let parseValue = parseInt(matchList[matchList.length - 1]);
if (isNaN(parseValue)) {
parseValue = parseInt(defaultValue.toString());
}
return parseValue;
}
async parseBlobToFile(blobUrl, fileName = "example") {
return new Promise((resolve, reject) => {
fetch(blobUrl)
.then((response) => response.blob())
.then((blob) => {
const file = new File([blob], fileName, { type: blob.type });
resolve(file);
})
.catch((error) => {
console.error("Error:", error);
reject(error);
});
});
}
parseCDATA(text = "") {
let result = "";
const cdataRegexp = /<!\[CDATA\[([\s\S]*)\]\]>/;
const cdataMatch = cdataRegexp.exec(text.trim());
if (cdataMatch && cdataMatch.length > 1) {
result = cdataMatch[cdataMatch.length - 1];
}
return result;
}
async parseFileToBase64(fileObj) {
const reader = new FileReader();
reader.readAsDataURL(fileObj);
return new Promise((resolve) => {
reader.onload = function (event) {
resolve(event.target.result);
};
});
}
parseFromString(text, mimeType = "text/html") {
const parser = new DOMParser();
return parser.parseFromString(text, mimeType);
}
toRegExp(text, flags = "gi") {
let regExp;
flags = flags.toLowerCase();
if (typeof text === "string") {
const pattern = this.toRegExpStr(text);
regExp = new RegExp(pattern, flags);
} else if (text instanceof RegExp) {
regExp = text;
} else {
throw new Error("Utils.toRegExp 参数text必须是string|Regexp类型");
}
return regExp;
}
toRegExpStr(text) {
if (typeof text !== "string") {
throw new TypeError("toRegExpStr 参数text必须是string类型");
}
const regExpStr = text.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
return regExpStr;
}
Progress = Progress;
hookEvent_isTrusted(isTrustValue = true, filter) {
function trustEvent(event) {
return new Proxy(event, {
get: function (target, property) {
if (property === "isTrusted") {
return isTrustValue;
} else {
return Reflect.get(target, property);
}
},
});
}
if (filter == null) {
filter = function (typeName) {
return typeName === "click";
};
}
const originalListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function (...args) {
const type = args[0];
const callback = args[1];
if (filter(type)) {
if (typeof callback === "function") {
args[1] = function (event) {
callback.call(this, trustEvent(event));
};
} else if (typeof callback === "object" && "handleEvent" in callback) {
const oldHandleEvent = callback["handleEvent"];
args[1]["handleEvent"] = function (event) {
if (event == null) {
return;
}
try {
event instanceof Proxy;
oldHandleEvent.call(this, trustEvent(event));
} catch {
Reflect.set(event, "isTrusted", isTrustValue);
}
};
}
}
return originalListener.apply(this, args);
};
}
reverseNumber(num) {
let reversedNum = 0;
let isNegative = false;
if (num < 0) {
isNegative = true;
num = Math.abs(num);
}
while (num > 0) {
reversedNum = reversedNum * 10 + (num % 10);
num = Math.floor(num / 10);
}
return isNegative ? -reversedNum : reversedNum;
}
copy(
data,
info = {
type: "text",
mimetype: "text/plain",
}
) {
if (typeof data === "object") {
if (data instanceof Element) {
data = data.outerHTML;
} else {
data = JSON.stringify(data);
}
} else if (typeof data !== "string") {
data = data.toString();
}
let textType = typeof info === "object" ? info.type : info;
if (textType.includes("html")) {
textType = "text/html";
} else {
textType = "text/plain";
}
const that = this;
class UtilsClipboard {
#resolve;
#copyData;
#copyDataType;
constructor(resolve, copyData, copyDataType) {
this.#resolve = resolve;
this.#copyData = copyData;
this.#copyDataType = copyDataType;
}
async init() {
let copyStatus = false;
const requestPermissionStatus = await this.requestClipboardPermission();
console.log(requestPermissionStatus);
if (this.hasClipboard() && (this.hasClipboardWrite() || this.hasClipboardWriteText())) {
try {
copyStatus = await this.copyDataByClipboard();
} catch (error) {
console.error("复制失败,使用第二种方式,error👉", error);
copyStatus = this.copyTextByTextArea();
}
} else {
copyStatus = this.copyTextByTextArea();
}
this.#resolve(copyStatus);
this.destroy();
}
destroy() {
this.#resolve = null;
this.#copyData = null;
this.#copyDataType = null;
}
isText() {
return this.#copyDataType.includes("text");
}
hasClipboard() {
return navigator?.clipboard != null;
}
hasClipboardWrite() {
return navigator?.clipboard?.write != null;
}
hasClipboardWriteText() {
return navigator?.clipboard?.writeText != null;
}
copyTextByTextArea() {
try {
const copyElement = that.windowApi.document.createElement("textarea");
copyElement.value = this.#copyData;
copyElement.setAttribute("type", "text");
copyElement.setAttribute("style", "opacity:0;position:absolute;");
copyElement.setAttribute("readonly", "readonly");
that.windowApi.document.body.appendChild(copyElement);
copyElement.select();
that.windowApi.document.execCommand("copy");
that.windowApi.document.body.removeChild(copyElement);
return true;
} catch (error) {
console.error("复制失败,error👉", error);
return false;
}
}
requestClipboardPermission() {
return new Promise((resolve) => {
if (navigator.permissions && navigator.permissions.query) {
navigator.permissions
.query({
name: "clipboard-write",
})
.then(() => {
resolve(true);
})
.catch((error) => {
console.error(["申请剪贴板权限失败,尝试直接写入👉", error.message ?? error.name ?? error.stack]);
resolve(false);
});
} else {
resolve(false);
}
});
}
copyDataByClipboard() {
return new Promise((resolve, reject) => {
if (this.isText()) {
navigator.clipboard
.writeText(this.#copyData)
.then(() => {
resolve(true);
})
.catch((error) => {
reject(error);
});
} else {
const textBlob = new Blob([this.#copyData], {
type: this.#copyDataType,
});
navigator.clipboard
.write([
new ClipboardItem({
[this.#copyDataType]: textBlob,
}),
])
.then(() => {
resolve(true);
})
.catch((error) => {
reject(error);
});
}
});
}
}
return new Promise((resolve) => {
const utilsClipboard = new UtilsClipboard(resolve, data, textType);
if (that.windowApi.document.hasFocus()) {
utilsClipboard.init();
} else {
that.windowApi.window.addEventListener(
"focus",
() => {
utilsClipboard.init();
},
{ once: true }
);
}
});
}
async getClipboardInfo() {
return new Promise((resolve) => {
function readClipboardText() {
navigator.clipboard
.readText()
.then((clipboardText) => {
resolve({
error: null,
content: clipboardText,
});
})
.catch((error) => {
resolve({
error,
content: "",
});
});
}
function requestPermissionsWithClipboard() {
navigator.permissions
.query({
name: "clipboard-read",
})
.then(() => {
readClipboardText();
})
.catch(() => {
readClipboardText();
});
}
function checkClipboardApi() {
if (typeof navigator?.clipboard?.readText !== "function") {
return false;
}
if (typeof navigator?.permissions?.query !== "function") {
return false;
}
return true;
}
if (!checkClipboardApi()) {
resolve({
error: new Error("当前环境不支持读取剪贴板Api"),
content: "",
});
return;
}
if (document.hasFocus()) {
requestPermissionsWithClipboard();
} else {
window.addEventListener(
"focus",
() => {
requestPermissionsWithClipboard();
},
{
once: true,
}
);
}
});
}
setTimeout(callback, delayTime = 0) {
const that = this;
if (typeof callback !== "function" && typeof callback !== "string") {
throw new TypeError("Utils.setTimeout 参数 callback 必须为 function|string 类型");
}
if (typeof delayTime !== "number") {
throw new TypeError("Utils.setTimeout 参数 delayTime 必须为 number 类型");
}
return new Promise((resolve) => {
that.workerSetTimeout(() => {
resolve(that.tryCatch().run(callback));
}, delayTime);
});
}
sleep(delayTime = 0) {
const that = this;
if (typeof delayTime !== "number") {
throw new Error("Utils.sleep 参数 delayTime 必须为 number 类型");
}
return new Promise((resolve) => {
that.workerSetTimeout(() => {
resolve(void 0);
}, delayTime);
});
}
dragSlider(selector, offsetX = this.windowApi.window.innerWidth) {
const that = this;
function initMouseEvent(eventName, offSetX, offSetY) {
const win = typeof unsafeWindow === "undefined" ? globalThis : unsafeWindow;
const mouseEvent = that.windowApi.document.createEvent("MouseEvents");
mouseEvent.initMouseEvent(
eventName,
true,
true,
win,
0,
offSetX,
offSetY,
offSetX,
offSetY,
false,
false,
false,
false,
0,
null
);
return mouseEvent;
}
const sliderElement = typeof selector === "string" ? domUtils$1.selector(selector) : selector;
if (!(sliderElement instanceof Node) || !(sliderElement instanceof Element)) {
throw new Error("Utils.dragSlider 参数selector 必须为Node/Element类型");
}
const rect = sliderElement.getBoundingClientRect(),
x0 = rect.x || rect.left,
y0 = rect.y || rect.top,
x1 = x0 + offsetX,
y1 = y0;
sliderElement.dispatchEvent(initMouseEvent("mousedown", x0, y0));
sliderElement.dispatchEvent(initMouseEvent("mousemove", x1, y1));
sliderElement.dispatchEvent(initMouseEvent("mouseleave", x1, y1));
sliderElement.dispatchEvent(initMouseEvent("mouseout", x1, y1));
}
enterFullScreen(element = this.windowApi.document.documentElement, options) {
try {
if (element.requestFullscreen) {
element.requestFullscreen(options);
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
} else {
throw new TypeError("该浏览器不支持全屏API");
}
} catch (err) {
console.error(err);
}
}
exitFullScreen($el = this.windowApi.document.documentElement) {
if ($el.exitFullscreen) {
return $el.exitFullscreen();
} else if ($el.msExitFullscreen) {
return $el.msExitFullscreen();
} else if ($el.mozCancelFullScreen) {
return $el.mozCancelFullScreen();
} else if ($el.webkitCancelFullScreen) {
return $el.webkitCancelFullScreen();
} else {
return new Promise((_, reject) => {
reject(new TypeError("该浏览器不支持全屏API"));
});
}
}
sortListByProperty(data, getPropertyValueFunc, sortByDesc = true) {
const that = this;
if (typeof getPropertyValueFunc !== "function" && typeof getPropertyValueFunc !== "string") {
throw new Error("Utils.sortListByProperty 参数 getPropertyValueFunc 必须为 function|string 类型");
}
if (typeof sortByDesc !== "boolean") {
throw new Error("Utils.sortListByProperty 参数 sortByDesc 必须为 boolean 类型");
}
const getObjValue = function (obj) {
return typeof getPropertyValueFunc === "string" ? obj[getPropertyValueFunc] : getPropertyValueFunc(obj);
};
const sortFunc = function (after_obj, before_obj) {
const beforeValue = getObjValue(before_obj);
const afterValue = getObjValue(after_obj);
if (sortByDesc) {
if (afterValue > beforeValue) {
return -1;
} else if (afterValue < beforeValue) {
return 1;
} else {
return 0;
}
} else {
if (afterValue < beforeValue) {
return -1;
} else if (afterValue > beforeValue) {
return 1;
} else {
return 0;
}
}
};
const sortNodeFunc = function (nodeList, getNodeListFunc) {
const nodeListLength = nodeList.length;
for (let i2 = 0; i2 < nodeListLength - 1; i2++) {
for (let j2 = 0; j2 < nodeListLength - 1 - i2; j2++) {
const beforeNode = nodeList[j2];
const afterNode = nodeList[j2 + 1];
const beforeValue = getObjValue(beforeNode);
const afterValue = getObjValue(afterNode);
if ((sortByDesc == true && beforeValue < afterValue) || (sortByDesc == false && beforeValue > afterValue)) {
const temp = beforeNode.nextElementSibling;
afterNode.after(beforeNode);
if (temp == null) {
temp.parentNode.appendChild(afterNode);
} else {
temp.before(afterNode);
}
nodeList = getNodeListFunc();
}
}
}
};
let result = data;
let getDataFunc = null;
if (data instanceof Function) {
getDataFunc = data;
data = data();
}
if (Array.isArray(data)) {
data.sort(sortFunc);
} else if (data instanceof NodeList || that.isJQuery(data)) {
sortNodeFunc(data, getDataFunc);
result = getDataFunc();
} else {
throw new Error("Utils.sortListByProperty 参数 data 必须为 Array|NodeList|jQuery 类型");
}
return result;
}
stringTitleToUpperCase(targetString, otherStrToLowerCase = false) {
let newTargetString = targetString.slice(0, 1).toUpperCase();
if (otherStrToLowerCase) {
newTargetString = newTargetString + targetString.slice(1).toLowerCase();
} else {
newTargetString = newTargetString + targetString.slice(1);
}
return newTargetString;
}
startsWith(target, searchString, position = 0) {
const that = this;
if (position > target.length) {
return false;
}
if (position !== 0) {
target = target.slice(position, target.length);
}
let searchStringRegexp = searchString;
if (typeof searchString === "string") {
searchStringRegexp = new RegExp(`^${searchString}`);
} else if (Array.isArray(searchString)) {
let flag = false;
for (const searcStr of searchString) {
if (!that.startsWith(target, searcStr, position)) {
flag = true;
break;
}
}
return flag;
}
return Boolean(target.match(searchStringRegexp));
}
firstLetterToLowercase(text, otherToUpperCase = false) {
let newTargetString = text.slice(0, 1).toLowerCase();
if (otherToUpperCase) {
newTargetString = newTargetString + text.slice(1).toUpperCase();
} else {
newTargetString = newTargetString + text.slice(1);
}
return newTargetString;
}
toJSON = commonUtil.toJSON.bind(commonUtil);
toSearchParamsStr(obj, addPrefix) {
const that = this;
let searhParamsStr = "";
if (Array.isArray(obj)) {
obj.forEach((item) => {
if (searhParamsStr === "") {
searhParamsStr += that.toSearchParamsStr(item);
} else {
searhParamsStr += `&${that.toSearchParamsStr(item)}`;
}
});
} else {
searhParamsStr = new URLSearchParams(Object.entries(obj)).toString();
}
if (addPrefix && !searhParamsStr.startsWith("?")) {
searhParamsStr = `?${searhParamsStr}`;
}
return searhParamsStr;
}
searchParamStrToObj(searhParamsStr) {
if (typeof searhParamsStr !== "string") {
return {};
}
return Object.fromEntries(new URLSearchParams(searhParamsStr));
}
tryCatch = TryCatch;
uniqueArray(
uniqueArrayData = [],
compareArrayData,
compareFun = (item, item2) => {
return item === item2;
}
) {
if (typeof compareArrayData === "function") {
const compareFn = compareArrayData;
const seen = new Set();
const result = [];
for (const item of uniqueArrayData) {
const identfier = compareFn(item);
if (!seen.has(identfier)) {
seen.add(identfier);
result.push(item);
}
}
return result;
} else {
return Array.from(uniqueArrayData).filter(
(item) =>
!Array.from(compareArrayData).some(function (item2) {
return compareFun(item, item2);
})
);
}
}
waitArrayLoopToEnd(data, handleFunc) {
const that = this;
if (typeof handleFunc !== "function" && typeof handleFunc !== "string") {
throw new Error("Utils.waitArrayLoopToEnd 参数 handleDataFunction 必须为 function|string 类型");
}
return Promise.all(
Array.from(data).map(async (item, index) => {
await that.tryCatch(index, item).run(handleFunc);
})
);
}
waitProperty(target, propertyName) {
return new Promise((resolve) => {
let obj = target;
if (typeof target === "function") {
obj = target();
}
if (Reflect.has(obj, propertyName)) {
resolve(obj[propertyName]);
} else {
Object.defineProperty(obj, propertyName, {
set: function (value) {
try {
resolve(value);
} catch (error) {
console.error("Error setting property:", error);
}
},
});
}
});
}
waitPropertyByInterval(checkFn, propertyName, intervalTimer = 250, maxTime = -1) {
const that = this;
if (checkFn == null) {
throw new TypeError("checkObj 不能为空对象 ");
}
let isResolve = false;
return new Promise((resolve, reject) => {
const interval = that.workerSetInterval(() => {
let inst = checkFn;
if (typeof checkFn === "function") {
inst = checkFn();
}
if (typeof inst !== "object") {
return;
}
if (inst == null) {
return;
}
if ((typeof propertyName === "function" && propertyName(inst)) || Reflect.has(inst, propertyName)) {
isResolve = true;
that.workerClearInterval(interval);
resolve(inst[propertyName]);
}
}, intervalTimer);
if (maxTime !== -1) {
that.workerSetTimeout(() => {
if (!isResolve) {
that.workerClearInterval(interval);
reject();
}
}, maxTime);
}
});
}
async waitVueByInterval($el, propertyName, timer = 250, maxTime = -1, vueName = "__vue__") {
if ($el == null) {
throw new Error("Utils.waitVueByInterval 参数element 不能为空");
}
let flag = false;
const that = this;
try {
await that.waitPropertyByInterval(
$el,
function (targetElement) {
if (targetElement == null) {
return false;
}
if (!(vueName in targetElement)) {
return false;
}
if (propertyName == null) {
return true;
}
const $vueEl = targetElement[vueName];
if (typeof propertyName === "string") {
if (propertyName in $vueEl) {
flag = true;
return true;
}
} else {
if (propertyName($vueEl)) {
flag = true;
return true;
}
}
return false;
},
timer,
maxTime
);
} catch {
return flag;
}
return flag;
}
watchObject(target, propertyName, getCallBack, setCallBack) {
if (typeof getCallBack !== "function" && typeof setCallBack !== "function") {
return;
}
if (typeof getCallBack === "function") {
Object.defineProperty(target, propertyName, {
get() {
if (typeof getCallBack === "function") {
return getCallBack(target[propertyName]);
} else {
return target[propertyName];
}
},
});
} else if (typeof setCallBack === "function") {
Object.defineProperty(target, propertyName, {
set(value) {
if (typeof setCallBack === "function") {
setCallBack(value);
}
},
});
} else {
Object.defineProperty(target, propertyName, {
get() {
if (typeof getCallBack === "function") {
return getCallBack(target[propertyName]);
} else {
return target[propertyName];
}
},
set(value) {
if (typeof setCallBack === "function") {
setCallBack(value);
}
},
});
}
}
queryProperty(target, handler) {
if (target == null) {
return;
}
const handleResult = handler(target);
if (handleResult && typeof handleResult.isFind === "boolean" && handleResult.isFind) {
return handleResult.data;
}
return this.queryProperty(handleResult.data, handler);
}
async asyncQueryProperty(target, handler) {
if (target == null) {
return;
}
const handleResult = await handler(target);
if (handleResult && typeof handleResult.isFind === "boolean" && handleResult.isFind) {
return handleResult.data;
}
return await this.asyncQueryProperty(handleResult.data, handler);
}
createUtils(option) {
return new Utils2(option);
}
toFormData(data, isEncode = false, valueAutoParseToStr = false) {
const formData = new FormData();
Object.keys(data).forEach((key) => {
let value = data[key];
if (valueAutoParseToStr) {
value = JSON.stringify(value);
}
if (typeof value === "number") {
value = value.toString();
}
if (isEncode && typeof value === "string") {
value = encodeURIComponent(value);
}
if (value instanceof File) {
formData.append(key, value, value.name);
} else {
formData.append(key, value);
}
});
return formData;
}
toUrl(text) {
if (typeof text !== "string") {
throw new TypeError("toUrl: text must be string");
}
text = text.trim();
if (text === "") {
throw new TypeError("toUrl: text must not be empty");
}
if (text.startsWith("//")) {
text = this.windowApi.globalThis.location.protocol + text;
} else if (text.startsWith("/")) {
text = this.windowApi.globalThis.location.origin + text;
}
return new URL(text);
}
coverObjectFunctionThis = commonUtil.coverObjectFunctionThis.bind(commonUtil);
generateUUID = GenerateUUID;
Vue = Vue;
ModuleRaid = ModuleRaid;
workerSetTimeout(callback, timeout = 0) {
try {
return setTimeout$1$1(callback, timeout);
} catch (error) {
return this.windowApi.setTimeout(callback, timeout);
}
}
workerClearTimeout(timeId) {
try {
if (timeId != null) {
clearTimeout$1$1(timeId);
}
} catch (error) {
} finally {
this.windowApi.clearTimeout(timeId);
}
}
workerSetInterval(callback, timeout = 0) {
try {
return setInterval$2(callback, timeout);
} catch (error) {
return this.windowApi.setInterval(callback, timeout);
}
}
workerClearInterval(timeId) {
try {
if (timeId != null) {
clearInterval$2(timeId);
}
} catch (error) {
} finally {
this.windowApi.clearInterval(timeId);
}
}
}
const utils$1 = new Utils2();
const GlobalConfig = {
config: {},
setGlobalConfig(config) {
Reflect.ownKeys(config).forEach((keyName) => {
Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
});
},
getGlobalConfig() {
const result = {};
Object.keys(GlobalConfig.config).forEach((keyName) => {
const configValue = Reflect.get(GlobalConfig.config, keyName);
if (keyName === "style") {
const style = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
if (typeof style === "string") {
result.style = style;
}
} else if (keyName === "zIndex") {
let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
if (typeof zIndex === "string") {
const newIndex = (zIndex = Number(zIndex));
if (!isNaN(newIndex)) {
result.zIndex = newIndex;
}
} else {
if (!isNaN(zIndex)) {
result.zIndex = zIndex;
}
}
} else if (keyName === "mask") {
const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
if (typeof mask === "object" && mask != null) {
result.mask = mask;
}
} else {
Reflect.set(result, keyName, configValue);
}
});
return result;
},
};
var SVG_min =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"></path>\r\n</svg>\r\n';
var SVG_mise =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M885.333333 85.333333H330.410667a53.333333 53.333333 0 0 0-53.333334 53.333334v106.666666H138.666667A53.333333 53.333333 0 0 0 85.333333 298.666667v586.666666a53.333333 53.333333 0 0 0 53.333334 53.333334H725.333333a53.333333 53.333333 0 0 0 53.333334-53.333334V746.154667h106.666666c29.44 0 53.333333-23.893333 53.333334-53.333334V138.666667A53.333333 53.333333 0 0 0 885.333333 85.333333zM725.333333 692.821333v192.512H138.666667V298.666667H725.333333v394.154666z m157.866667 0H778.666667V298.666667a53.333333 53.333333 0 0 0-53.333334-53.333334H330.410667v-106.666666h554.922666l-2.133333 554.154666z"></path>\r\n</svg>\r\n';
var SVG_max =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"></path>\r\n</svg>\r\n';
var SVG_close =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-type="close">\r\n <path\r\n fill="currentColor"\r\n d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path>\r\n</svg>\r\n';
var SVG_edit =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"></path>\r\n <path\r\n fill="currentColor"\r\n d="m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"></path>\r\n</svg>\r\n';
var SVG_share =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="m679.872 348.8-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"></path>\r\n</svg>\r\n';
var SVG_delete =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"></path>\r\n</svg>\r\n';
var SVG_search =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z"></path>\r\n</svg>\r\n';
var SVG_upload =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"></path>\r\n</svg>\r\n';
var SVG_loading =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"></path>\r\n</svg>\r\n';
var SVG_next =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>\r\n</svg>\r\n';
var SVG_prev =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>\r\n</svg>\r\n';
var SVG_eleme =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M300.032 188.8c174.72-113.28 408-63.36 522.24 109.44 5.76 10.56 11.52 20.16 17.28 30.72v.96a22.4 22.4 0 0 1-7.68 26.88l-352.32 228.48c-9.6 6.72-22.08 3.84-28.8-5.76l-18.24-27.84a54.336 54.336 0 0 1 16.32-74.88l225.6-146.88c9.6-6.72 12.48-19.2 5.76-28.8-.96-1.92-1.92-3.84-3.84-4.8a267.84 267.84 0 0 0-315.84-17.28c-123.84 81.6-159.36 247.68-78.72 371.52a268.096 268.096 0 0 0 370.56 78.72 54.336 54.336 0 0 1 74.88 16.32l17.28 26.88c5.76 9.6 3.84 21.12-4.8 27.84-8.64 7.68-18.24 14.4-28.8 21.12a377.92 377.92 0 0 1-522.24-110.4c-113.28-174.72-63.36-408 111.36-522.24zm526.08 305.28a22.336 22.336 0 0 1 28.8 5.76l23.04 35.52a63.232 63.232 0 0 1-18.24 87.36l-35.52 23.04c-9.6 6.72-22.08 3.84-28.8-5.76l-46.08-71.04c-6.72-9.6-3.84-22.08 5.76-28.8l71.04-46.08z"></path>\r\n</svg>\r\n';
var SVG_elemePlus =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n d="M839.7 734.7c0 33.3-17.9 41-17.9 41S519.7 949.8 499.2 960c-10.2 5.1-20.5 5.1-30.7 0 0 0-314.9-184.3-325.1-192-5.1-5.1-10.2-12.8-12.8-20.5V368.6c0-17.9 20.5-28.2 20.5-28.2L466 158.6c12.8-5.1 25.6-5.1 38.4 0 0 0 279 161.3 309.8 179.2 17.9 7.7 28.2 25.6 25.6 46.1-.1-5-.1 317.5-.1 350.8zM714.2 371.2c-64-35.8-217.6-125.4-217.6-125.4-7.7-5.1-20.5-5.1-30.7 0L217.6 389.1s-17.9 10.2-17.9 23v297c0 5.1 5.1 12.8 7.7 17.9 7.7 5.1 256 148.5 256 148.5 7.7 5.1 17.9 5.1 25.6 0 15.4-7.7 250.9-145.9 250.9-145.9s12.8-5.1 12.8-30.7v-74.2l-276.5 169v-64c0-17.9 7.7-30.7 20.5-46.1L745 535c5.1-7.7 10.2-20.5 10.2-30.7v-66.6l-279 169v-69.1c0-15.4 5.1-30.7 17.9-38.4l220.1-128zM919 135.7c0-5.1-5.1-7.7-7.7-7.7h-58.9V66.6c0-5.1-5.1-5.1-10.2-5.1l-30.7 5.1c-5.1 0-5.1 2.6-5.1 5.1V128h-56.3c-5.1 0-5.1 5.1-7.7 5.1v38.4h69.1v64c0 5.1 5.1 5.1 10.2 5.1l30.7-5.1c5.1 0 5.1-2.6 5.1-5.1v-56.3h64l-2.5-38.4z"\r\n fill="currentColor"></path>\r\n</svg>\r\n';
var SVG_chromeFilled =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" xml:space="preserve" data-type="chromeFilled">\r\n <path\r\n d="M938.67 512.01c0-44.59-6.82-87.6-19.54-128H682.67a212.372 212.372 0 0 1 42.67 128c.06 38.71-10.45 76.7-30.42 109.87l-182.91 316.8c235.65-.01 426.66-191.02 426.66-426.67z"\r\n fill="currentColor"></path>\r\n <path\r\n d="M576.79 401.63a127.92 127.92 0 0 0-63.56-17.6c-22.36-.22-44.39 5.43-63.89 16.38s-35.79 26.82-47.25 46.02a128.005 128.005 0 0 0-2.16 127.44l1.24 2.13a127.906 127.906 0 0 0 46.36 46.61 127.907 127.907 0 0 0 63.38 17.44c22.29.2 44.24-5.43 63.68-16.33a127.94 127.94 0 0 0 47.16-45.79v-.01l1.11-1.92a127.984 127.984 0 0 0 .29-127.46 127.957 127.957 0 0 0-46.36-46.91z"\r\n fill="currentColor"></path>\r\n <path\r\n d="M394.45 333.96A213.336 213.336 0 0 1 512 298.67h369.58A426.503 426.503 0 0 0 512 85.34a425.598 425.598 0 0 0-171.74 35.98 425.644 425.644 0 0 0-142.62 102.22l118.14 204.63a213.397 213.397 0 0 1 78.67-94.21zM512.01 938.68H512zM414.76 701.95a213.284 213.284 0 0 1-89.54-86.81L142.48 298.6c-36.35 62.81-57.13 135.68-57.13 213.42 0 203.81 142.93 374.22 333.95 416.55h.04l118.19-204.71a213.315 213.315 0 0 1-122.77-21.91z"\r\n fill="currentColor"></path>\r\n</svg>\r\n';
var SVG_cpu =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M320 256a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64V320a64 64 0 0 0-64-64H320zm0-64h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128H320a128 128 0 0 1-128-128V320a128 128 0 0 1 128-128z"></path>\r\n <path\r\n fill="currentColor"\r\n d="M512 64a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm160 0a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm-320 0a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm160 896a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zm160 0a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zm-320 0a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zM64 512a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm0-160a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm0 320a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm896-160a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32zm0-160a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32zm0 320a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32z"></path>\r\n</svg>\r\n';
var SVG_videoPlay =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768zm-48-247.616L668.608 512 464 375.616v272.768zm10.624-342.656 249.472 166.336a48 48 0 0 1 0 79.872L474.624 718.272A48 48 0 0 1 400 678.336V345.6a48 48 0 0 1 74.624-39.936z"></path>\r\n</svg>\r\n';
var SVG_videoPause =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768zm-96-544q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32zm192 0q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32z"></path>\r\n</svg>\r\n';
var SVG_headset =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M896 529.152V512a384 384 0 1 0-768 0v17.152A128 128 0 0 1 320 640v128a128 128 0 1 1-256 0V512a448 448 0 1 1 896 0v256a128 128 0 1 1-256 0V640a128 128 0 0 1 192-110.848zM896 640a64 64 0 0 0-128 0v128a64 64 0 0 0 128 0V640zm-768 0v128a64 64 0 0 0 128 0V640a64 64 0 1 0-128 0z"></path>\r\n</svg>\r\n';
var SVG_monitor =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M544 768v128h192a32 32 0 1 1 0 64H288a32 32 0 1 1 0-64h192V768H192A128 128 0 0 1 64 640V256a128 128 0 0 1 128-128h640a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128H544zM192 192a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h640a64 64 0 0 0 64-64V256a64 64 0 0 0-64-64H192z"></path>\r\n</svg>\r\n';
var SVG_documentCopy =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M128 320v576h576V320H128zm-32-64h640a32 32 0 0 1 32 32v640a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V288a32 32 0 0 1 32-32zM960 96v704a32 32 0 0 1-32 32h-96v-64h64V128H384v64h-64V96a32 32 0 0 1 32-32h576a32 32 0 0 1 32 32zM256 672h320v64H256v-64zm0-192h320v64H256v-64z"></path>\r\n</svg>\r\n';
var SVG_picture =
'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n fill="currentColor"\r\n d="M160 160v704h704V160H160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32z"></path>\r\n <path\r\n fill="currentColor"\r\n d="M384 288q64 0 64 64t-64 64q-64 0-64-64t64-64zM185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952L185.408 876.992z"></path>\r\n</svg>\r\n';
var SVG_circleClose =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" data-type="circleClose">\r\n <path\r\n fill="currentColor"\r\n d="m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"></path>\r\n <path\r\n fill="currentColor"\r\n d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"></path>\r\n</svg>\r\n';
var SVG_view =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">\r\n <path\r\n fill="currentColor"\r\n d="M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"></path>\r\n</svg>\r\n';
var SVG_hide =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">\r\n <path\r\n fill="currentColor"\r\n d="M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"></path>\r\n <path\r\n fill="currentColor"\r\n d="M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"></path>\r\n</svg>\r\n';
var SVG_keyboard =
'<svg viewBox="0 0 1123 1024" xmlns="http://www.w3.org/2000/svg">\r\n <path\r\n d="M1014.122186 1024H109.753483A109.753483 109.753483 0 0 1 0 914.246517V392.917471a109.753483 109.753483 0 0 1 109.753483-109.753484h904.368703a109.753483 109.753483 0 0 1 109.753484 109.753484v521.329046a109.753483 109.753483 0 0 1-109.753484 109.753483zM109.753483 370.966774a21.950697 21.950697 0 0 0-21.950696 21.950697v521.329046a21.950697 21.950697 0 0 0 21.950696 21.950696h904.368703a21.950697 21.950697 0 0 0 21.950697-21.950696V392.917471a21.950697 21.950697 0 0 0-21.950697-21.950697z"></path>\r\n <path\r\n d="M687.056806 891.198285H307.309753a43.901393 43.901393 0 0 1 0-87.802787h379.747053a43.901393 43.901393 0 0 1 0 87.802787zM175.605573 803.395498a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM432.428725 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM690.349411 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM947.172562 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM175.605573 546.572347a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM304.017149 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM432.428725 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM690.349411 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 803.395498a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM175.605573 678.276527a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM304.017149 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM432.428725 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM948.270096 803.395498a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394z"></path>\r\n <path\r\n d="M881.320472 766.079314H689.251876a43.901393 43.901393 0 0 1 0-87.802787h192.068596a21.950697 21.950697 0 0 0 21.950696-21.950696v-65.85209a43.901393 43.901393 0 0 1 87.802787 0v65.85209a109.753483 109.753483 0 0 1-109.753483 109.753483zM305.114684 502.670954H175.605573a43.901393 43.901393 0 0 1 0-87.802787h129.509111a43.901393 43.901393 0 0 1 0 87.802787zM563.03537 365.4791a43.901393 43.901393 0 0 1-43.901394-43.901394v-105.363344A109.753483 109.753483 0 0 1 628.88746 106.460879h61.461951a21.950697 21.950697 0 0 0 21.950696-21.950697V43.901393a43.901393 43.901393 0 0 1 87.802787 0v40.608789a109.753483 109.753483 0 0 1-109.753483 109.753484h-61.461951a21.950697 21.950697 0 0 0-21.950697 21.950696v105.363344a43.901393 43.901393 0 0 1-43.901393 43.901394z"></path>\r\n</svg>\r\n';
var SVG_arrowRight =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" data-type="arrowRight">\r\n <path\r\n d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>\r\n</svg>\r\n';
var SVG_arrowLeft =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" data-type="arrowLeft">\r\n <path\r\n d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>\r\n</svg>\r\n';
const PopsIconData = {
min: SVG_min,
mise: SVG_mise,
max: SVG_max,
close: SVG_close,
edit: SVG_edit,
share: SVG_share,
delete: SVG_delete,
search: SVG_search,
upload: SVG_upload,
loading: SVG_loading,
next: SVG_next,
prev: SVG_prev,
eleme: SVG_eleme,
elemePlus: SVG_elemePlus,
chromeFilled: SVG_chromeFilled,
cpu: SVG_cpu,
videoPlay: SVG_videoPlay,
videoPause: SVG_videoPause,
headset: SVG_headset,
monitor: SVG_monitor,
documentCopy: SVG_documentCopy,
picture: SVG_picture,
circleClose: SVG_circleClose,
view: SVG_view,
hide: SVG_hide,
keyboard: SVG_keyboard,
arrowRight: SVG_arrowRight,
arrowLeft: SVG_arrowLeft,
};
const PopsIcon = {
$data: PopsIconData,
hasIcon(iconName) {
return Object.keys(PopsIcon.$data).includes(iconName);
},
getIcon(iconName) {
return PopsIcon.$data[iconName];
},
deleteIcon(iconName) {
return Reflect.deleteProperty(PopsIcon.$data, iconName);
},
setIcon(iconName, iconHTML) {
Reflect.set(PopsIcon.$data, iconName, iconHTML);
},
};
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 65536) | 0).toString(16).substring(1));
const PopsCoreDefaultEnv = {
document,
window,
globalThis,
self,
setTimeout: globalThis.setTimeout.bind(globalThis),
setInterval: globalThis.setInterval.bind(globalThis),
clearTimeout: globalThis.clearTimeout.bind(globalThis),
clearInterval: globalThis.clearInterval.bind(globalThis),
};
const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
const PopsCore = {
init(option) {
if (!option) {
option = Object.assign({}, PopsCoreDefaultEnv);
}
Object.assign(PopsCoreEnv, option);
},
get document() {
return PopsCoreEnv.document;
},
get window() {
return PopsCoreEnv.window;
},
get globalThis() {
return PopsCoreEnv.globalThis;
},
get self() {
return PopsCoreEnv.self;
},
get setTimeout() {
return PopsCoreEnv.setTimeout;
},
get setInterval() {
return PopsCoreEnv.setInterval;
},
get clearTimeout() {
return PopsCoreEnv.clearTimeout;
},
get clearInterval() {
return PopsCoreEnv.clearInterval;
},
};
const OriginPrototype = {
Object: {
defineProperty: Object.defineProperty,
},
};
const createCache = (lastNumberWeakMap) => {
return (collection, nextNumber) => {
lastNumberWeakMap.set(collection, nextNumber);
return nextNumber;
};
};
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
const createGenerateUniqueNumber = (cache2, lastNumberWeakMap) => {
return (collection) => {
const lastNumber = lastNumberWeakMap.get(collection);
let nextNumber =
lastNumber === void 0 ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
if (!collection.has(nextNumber)) {
return cache2(collection, nextNumber);
}
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
}
return cache2(collection, nextNumber);
}
if (collection.size > MAX_SAFE_INTEGER) {
throw new Error(
"Congratulations, you created a collection of unique numbers which uses all available integers!"
);
}
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
}
return cache2(collection, nextNumber);
};
};
const LAST_NUMBER_WEAK_MAP = new WeakMap();
const cache = createCache(LAST_NUMBER_WEAK_MAP);
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
const isMessagePort = (sender) => {
return typeof sender.start === "function";
};
const PORT_MAP = new WeakMap();
const extendBrokerImplementation = (partialBrokerImplementation) => ({
...partialBrokerImplementation,
connect: ({ call }) => {
return async () => {
const { port1, port2 } = new MessageChannel();
const portId = await call("connect", { port: port1 }, [port1]);
PORT_MAP.set(port2, portId);
return port2;
};
},
disconnect: ({ call }) => {
return async (port) => {
const portId = PORT_MAP.get(port);
if (portId === void 0) {
throw new Error("The given port is not connected.");
}
await call("disconnect", { portId });
};
},
isSupported: ({ call }) => {
return () => call("isSupported");
},
});
const ONGOING_REQUESTS = new WeakMap();
const createOrGetOngoingRequests = (sender) => {
if (ONGOING_REQUESTS.has(sender)) {
return ONGOING_REQUESTS.get(sender);
}
const ongoingRequests = new Map();
ONGOING_REQUESTS.set(sender, ongoingRequests);
return ongoingRequests;
};
const createBroker = (brokerImplementation) => {
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
return (sender) => {
const ongoingRequests = createOrGetOngoingRequests(sender);
sender.addEventListener("message", ({ data: message }) => {
const { id } = message;
if (id !== null && ongoingRequests.has(id)) {
const { reject, resolve } = ongoingRequests.get(id);
ongoingRequests.delete(id);
if (message.error === void 0) {
resolve(message.result);
} else {
reject(new Error(message.error.message));
}
}
});
if (isMessagePort(sender)) {
sender.start();
}
const call = (method, params = null, transferables = []) => {
return new Promise((resolve, reject) => {
const id = generateUniqueNumber(ongoingRequests);
ongoingRequests.set(id, { reject, resolve });
if (params === null) {
sender.postMessage({ id, method }, transferables);
} else {
sender.postMessage({ id, method, params }, transferables);
}
});
};
const notify = (method, params, transferables = []) => {
sender.postMessage({ id: null, method, params }, transferables);
};
let functions = {};
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
functions = { ...functions, [key]: handler({ call, notify }) };
}
return { ...functions };
};
};
const scheduledIntervalsState = new Map([[0, null]]);
const scheduledTimeoutsState = new Map([[0, null]]);
const wrap = createBroker({
clearInterval: ({ call }) => {
return (timerId) => {
if (typeof scheduledIntervalsState.get(timerId) === "symbol") {
scheduledIntervalsState.set(timerId, null);
call("clear", { timerId, timerType: "interval" }).then(() => {
scheduledIntervalsState.delete(timerId);
});
}
};
},
clearTimeout: ({ call }) => {
return (timerId) => {
if (typeof scheduledTimeoutsState.get(timerId) === "symbol") {
scheduledTimeoutsState.set(timerId, null);
call("clear", { timerId, timerType: "timeout" }).then(() => {
scheduledTimeoutsState.delete(timerId);
});
}
};
},
setInterval: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber(scheduledIntervalsState);
scheduledIntervalsState.set(timerId, symbol);
const schedule = () =>
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "interval",
}).then(() => {
const state = scheduledIntervalsState.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
func(...args);
if (scheduledIntervalsState.get(timerId) === symbol) {
schedule();
}
}
});
schedule();
return timerId;
};
},
setTimeout: ({ call }) => {
return (func, delay = 0, ...args) => {
const symbol = Symbol();
const timerId = generateUniqueNumber(scheduledTimeoutsState);
scheduledTimeoutsState.set(timerId, symbol);
call("set", {
delay,
now: performance.timeOrigin + performance.now(),
timerId,
timerType: "timeout",
}).then(() => {
const state = scheduledTimeoutsState.get(timerId);
if (state === void 0) {
throw new Error("The timer is in an undefined state.");
}
if (state === symbol) {
scheduledTimeoutsState.delete(timerId);
func(...args);
}
});
return timerId;
};
},
});
const load = (url) => {
const worker2 = new Worker(url);
return wrap(worker2);
};
const createLoadOrReturnBroker = (loadBroker, worker2) => {
let broker = null;
return () => {
if (broker !== null) {
return broker;
}
const blob = new Blob([worker2], { type: "application/javascript; charset=utf-8" });
const url = URL.createObjectURL(blob);
broker = loadBroker(url);
setTimeout(() => URL.revokeObjectURL(url));
return broker;
};
};
const worker = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`;
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
const setInterval$1 = (...args) => loadOrReturnBroker().setInterval(...args);
const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
let t$1 = class t {
constructor() {
this.__map = {};
}
beforeEach(t3) {
this.__interceptor = t3;
}
on(t3, i2) {
const s2 = Array.isArray(t3) ? t3 : [t3];
for (const t4 of s2) {
this.__map[t4] = this.__map[t4] || [];
const s3 = this.__map[t4];
s3 && s3.push(i2);
}
return this;
}
emit(t3, i2, s2) {
void 0 !== this.__interceptor
? this.__interceptor(t3, () => {
(this.__emit(t3, i2), s2 && s2());
})
: (this.__emit(t3, i2), s2 && s2());
}
__emit(t3, i2) {
const s2 = this.__map[t3];
if (Array.isArray(s2) && (null == s2 ? void 0 : s2.length)) for (const _ of s2) _(i2, t3);
this.event = i2;
}
off(t3, i2) {
const s2 = this.__map[t3];
if (void 0 !== s2)
if (void 0 === i2) delete this.__map[t3];
else {
const t4 = s2.findIndex((t5) => t5 === i2);
s2.splice(t4, 1);
}
}
destroy() {
this.__map = {};
}
};
const n$1 = "clientX",
e$2 = "clientY",
t2 = 16,
c$3 = "start",
o$1 = "move",
s$1 = "cancel",
u$3 = "end",
a$2 = "left",
i$3 = "right",
r$4 = "up",
d$1 = "down",
m$2 = { 4: "start", 5: "move", 1: "end", 3: "cancel" };
function v$1(n2) {
return m$2[n2];
}
function b(n2, e2, t3) {
const c2 = {
1: { 0: { move: 4 }, 4: { move: 5, end: 1, cancel: 3 }, 5: { move: 5, end: 1, cancel: 3 } },
0: { 4: { move: 2, end: 1, cancel: 3 }, 5: { start: 2, move: 2, end: 1, cancel: 3 } },
}[Number(n2)][e2];
return (void 0 !== c2 && c2[t3]) || 0;
}
function g$1(n2) {
[1, 3, 2].includes(n2.state) && (n2.state = 0);
}
function h$3(n2) {
return [5, 1, 3].includes(n2);
}
function j(n2) {
if (n2.disabled) return ((n2.state = 0), true);
}
function O(n2, e2) {
return Object.assign(Object.assign(Object.assign({}, n2), e2), { state: 0, disabled: false });
}
function p$3(n2) {
return Math.round(100 * n2) / 100;
}
function r$3() {
let t3,
o2,
i2,
r2,
a2 = 0;
return function (u2) {
if (((t3 = o2), void 0 !== u2)) {
a2 = Number.MAX_SAFE_INTEGER > a2 ? ++a2 : 1;
const h2 = (function (t4, o3) {
const { phase: i3, points: r3, changedPoints: a3, nativeEvent: u3 } = t4,
h3 = r3.length,
p3 = c$3 === i3,
g3 = (u$3 === i3 && 0 === h3) || s$1 === i3,
l3 = Date.now(),
{ x: d2, y: m2 } = c$2(r3) || c$2(a3),
{ currentTarget: v2 } = u3;
return Object.assign(t4, {
id: o3,
x: d2,
y: m2,
timestamp: l3,
isStart: p3,
isEnd: g3,
pointLength: h3,
currentTarget: v2,
getOffset(t5 = v2) {
const e2 = t5.getBoundingClientRect();
return { x: d2 - Math.round(e2.left), y: m2 - Math.round(e2.top) };
},
});
})(u2, a2);
o2 = h2;
const { isStart: p2, pointLength: g2 } = h2;
return (
p2 && ((i2 = h2), (t3 = void 0), (r2 = 1 < g2 ? h2 : void 0)),
Object.assign(Object.assign({}, h2), { prevInput: t3, startMultiInput: r2, startInput: i2 })
);
}
};
}
function c$2(t3) {
const { length: e2 } = t3;
if (0 < e2) {
if (1 === e2) {
const { clientX: e3, clientY: n3 } = t3[0];
return { x: Math.round(e3), y: Math.round(n3) };
}
const n2 = t3.reduce((t4, e3) => ((t4.x += e3[n$1]), (t4.y += e3[e$2]), t4), { x: 0, y: 0 });
return { x: Math.round(n2.x / e2), y: Math.round(n2.y / e2) };
}
}
function a$1(t3, e2, n2, s2) {
const o2 = {};
for (const t4 in n2) ["target", "currentTarget", "type"].includes(t4) || (o2[t4] = n2[t4]);
let i2;
return (
document.createEvent
? ((i2 = document.createEvent("HTMLEvents")),
i2.initEvent(t3, null == s2 ? void 0 : s2.bubbles, null == s2 ? void 0 : s2.cancelable))
: (i2 = new Event(t3, s2)),
Object.assign(i2, o2, {
match: () => n2.targets && 0 < n2.targets.length && n2.targets.every((t4) => i2.currentTarget.contains(t4)),
}),
e2.dispatchEvent(i2)
);
}
function u$2(t3, e2) {
const { preventDefault: n2 } = e2;
return ((s2 = n2), "[object Function]" === Object.prototype.toString.call(s2) ? n2(t3) : !!n2);
var s2;
}
const h$2 = ["touchstart", "touchmove", "touchend", "touchcancel", "mousedown"],
p$2 = ["mousemove", "mouseup"];
const g = {
domEvents: { bubbles: true, cancelable: true },
preventDefault: (t3) => {
if (t3.target && "tagName" in t3.target) {
const { tagName: e2 } = t3.target;
return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e2);
}
return false;
},
};
let l$1 = class l extends t$1 {
constructor(t3, e2) {
(super(),
(this.v = "2.1.3"),
(this.__computeFunctionList = []),
(this.__computeFunctionCreatorList = []),
(this.__pluginContexts = []),
(this.__isIgnoreMouse = false),
(this.el = t3),
(this.c = {}),
(this.__options = Object.assign(Object.assign({}, g), e2)));
const n2 = (function (t4) {
const e3 = r$3();
return function (n3) {
const s3 = [],
o2 = [];
Array.from(n3.touches).forEach(({ clientX: e4, clientY: n4, target: i3 }) => {
(null == t4 ? void 0 : t4.contains(i3)) &&
(s3.push(i3), o2.push({ clientX: e4, clientY: n4, target: i3 }));
});
const i2 = Array.from(n3.changedTouches).map(({ clientX: t5, clientY: e4, target: n4 }) => ({
clientX: t5,
clientY: e4,
target: n4,
}));
return e3({
phase: n3.type.replace("touch", ""),
changedPoints: i2,
points: o2,
nativeEvent: n3,
target: n3.target,
targets: s3,
});
};
})(this.el),
s2 = (function () {
let t4,
e3 = false,
n3 = null;
const s3 = r$3();
return function (o2) {
const { clientX: i2, clientY: r2, type: c2, button: a2, target: u2 } = o2;
let h2,
p2 = [{ clientX: i2, clientY: r2, target: u2 }];
if ("mousedown" === c2 && 0 === a2) ((n3 = u2), (e3 = true), (h2 = "start"));
else {
if (!e3) return;
"mousemove" === c2 ? (h2 = "move") : "mouseup" === c2 && ((p2 = []), (h2 = "end"), (e3 = false));
}
const g2 = t4 || [{ clientX: i2, clientY: r2, target: u2 }];
if (((t4 = [{ clientX: i2, clientY: r2, target: u2 }]), void 0 !== h2))
return s3({ phase: h2, changedPoints: g2, points: p2, target: n3, targets: [n3], nativeEvent: o2 });
};
})();
if (
((this.__inputCreatorMap = {
touchstart: n2,
touchmove: n2,
touchend: n2,
touchcancel: n2,
mousedown: s2,
mousemove: s2,
mouseup: s2,
}),
this.on("at:after", (t4) => {
const { target: e3, __type: n3 } = t4,
{ domEvents: s3 } = this.__options;
s3 && void 0 !== this.el && e3 && (a$1(n3, e3, t4, s3), a$1("at:after", e3, t4, s3));
}),
void 0 !== t3)
) {
t3.style.webkitTapHighlightColor = "rgba(0,0,0,0)";
let e3 = false;
try {
const t4 = {};
(Object.defineProperty(t4, "passive", {
get() {
e3 = true;
},
}),
window.addEventListener("_", () => {}, t4));
} catch (t4) {}
this.on(
"u",
(function (t4, e4, n3) {
return (
h$2.forEach((s3) => {
t4.addEventListener(s3, e4, n3);
}),
p$2.forEach((t5) => {
window.addEventListener(t5, e4, n3);
}),
() => {
(h$2.forEach((n4) => {
t4.removeEventListener(n4, e4);
}),
p$2.forEach((t5) => {
window.removeEventListener(t5, e4);
}));
}
);
})(
t3,
this.catchEvent.bind(this),
false === this.__options.preventDefault && e3 ? { passive: true } : { passive: false }
)
);
}
}
use(t3, e2) {
this.__pluginContexts.push(t3(this, e2));
}
catchEvent(t3) {
const e2 = this.__inputCreatorMap[t3.type](t3);
if (void 0 !== e2) {
const n2 = () => t3.stopPropagation(),
s2 = () => t3.stopImmediatePropagation(),
o2 = () => t3.preventDefault();
if (u$2(t3, this.__options)) o2();
else if (
("touchstart" === t3.type
? (this.__isIgnoreMouse = true)
: "touchmove" === t3.type && (this.__isIgnoreMouse = false),
this.__isIgnoreMouse && t3.type.startsWith("mouse"))
)
return void ("mouseup" === t3.type && (this.__isIgnoreMouse = false));
(this.emit("input", e2), this.emit2(`at:${e2.phase}`, e2, {}));
const i2 = {};
(this.__computeFunctionList.forEach((t4) => {
const n3 = t4(e2, i2);
if (void 0 !== n3) for (const t5 in n3) i2[t5] = n3[t5];
}),
this.emit(
"computed",
Object.assign(Object.assign(Object.assign({}, e2), i2), {
stopPropagation: n2,
stopImmediatePropagation: s2,
preventDefault: o2,
})
));
}
}
compute(t3, e2) {
for (const e3 of t3)
this.__computeFunctionCreatorList.includes(e3) ||
(this.__computeFunctionCreatorList.push(e3), this.__computeFunctionList.push(e3()));
this.on("computed", e2);
}
beforeEach(t3) {
super.beforeEach((e2, n2) => {
var s2;
(null === (s2 = this.c) || void 0 === s2 ? void 0 : s2.name) ? t3(e2, n2) : n2();
});
}
get(t3) {
return this.__pluginContexts.find((e2) => t3 === e2.name);
}
set(t3) {
this.__options = Object.assign(Object.assign({}, this.__options), t3);
}
emit2(t3, e2, n2) {
((this.c = n2),
this.emit(t3, Object.assign(Object.assign({}, e2), { type: t3 }), () => {
this.emit("at:after", Object.assign(Object.assign({}, e2), { name: t3, __type: t3 }));
}));
}
destroy() {
(this.emit("u"), super.destroy());
}
};
var x = (r2) => Math.sqrt(r2.x * r2.x + r2.y * r2.y),
y = (r2, a2) => r2.x * a2.x + r2.y * a2.y,
e$1 = (r2, a2) => {
var t3 = x(r2) * x(a2);
if (0 === t3) return 0;
var h2 = y(r2, a2) / t3;
return (h2 > 1 && (h2 = 1), Math.acos(h2));
},
n = (r2, a2) => r2.x * a2.y - a2.x * r2.y,
o = (r2) => (r2 / Math.PI) * 180,
s = (r2, a2) => {
var t3 = e$1(r2, a2);
return (n(r2, a2) > 0 && (t3 *= -1), o(t3));
},
u$1 = (x2, y2) => {
if (0 !== x2 || 0 !== y2) return Math.abs(x2) >= Math.abs(y2) ? (0 < x2 ? i$3 : a$2) : 0 < y2 ? d$1 : r$4;
};
function p$1() {
let n2 = 0,
e2 = 0;
return function (o2, r2) {
const { prevVecotr: i2, startVecotr: a2, activeVecotr: c2 } = r2;
return (c2 && ((e2 = Math.round(s(c2, i2))), (n2 = Math.round(s(c2, a2)))), { angle: n2, deltaAngle: e2 });
};
}
function d() {
return function (t3) {
const { prevInput: e2 } = t3;
let o$12 = 0,
r2 = 0,
i2 = 0;
if (void 0 !== e2 && ((o$12 = t3.x - e2.x), (r2 = t3.y - e2.y), 0 !== o$12 || 0 !== r2)) {
const t4 = Math.sqrt(Math.pow(o$12, 2) + Math.pow(r2, 2));
i2 = Math.round(o(Math.acos(Math.abs(o$12) / t4)));
}
return { deltaX: o$12, deltaY: r2, deltaXYAngle: i2 };
};
}
function h$1() {
let t3,
n2 = 0,
u2 = 0,
s2 = 0,
p2 = 0,
d2 = 0;
return function (h2) {
const { phase: l3, startInput: f2 } = h2;
return (
c$3 === l3
? ((n2 = 0), (u2 = 0), (s2 = 0), (p2 = 0), (d2 = 0))
: o$1 === l3 &&
((n2 = Math.round(h2.points[0][n$1] - f2.points[0][n$1])),
(u2 = Math.round(h2.points[0][e$2] - f2.points[0][e$2])),
(s2 = Math.abs(n2)),
(p2 = Math.abs(u2)),
(d2 = Math.round(x({ x: s2, y: p2 }))),
(t3 = u$1(n2, u2))),
{ displacementX: n2, displacementY: u2, distanceX: s2, distanceY: p2, distance: d2, overallDirection: t3 }
);
};
}
function l2() {
let t3 = 1;
return function (n2, o2) {
let r2 = 1;
const { prevVecotr: i2, startVecotr: a2, activeVecotr: c2 } = o2;
return (c2 && ((r2 = p$3(x(c2) / x(i2))), (t3 = p$3(x(c2) / x(a2)))), { scale: t3, deltaScale: r2 });
};
}
function f() {
let t$12,
n2,
e2 = 0,
r2 = 0,
i2 = 0,
a2 = 0;
return function (c2) {
if (void 0 !== c2) {
n2 = n2 || c2.startInput;
const u2 = c2.timestamp - n2.timestamp;
if (t2 < u2) {
const s2 = c2.x - n2.x,
p2 = c2.y - n2.y;
((i2 = Math.round((s2 / u2) * 100) / 100),
(a2 = Math.round((p2 / u2) * 100) / 100),
(e2 = Math.abs(i2)),
(r2 = Math.abs(a2)),
(t$12 = u$1(s2, p2)),
(n2 = c2));
}
}
return { velocityX: e2, velocityY: r2, speedX: i2, speedY: a2, direction: t$12 };
};
}
function M() {
let t3 = 0;
return function (n2) {
const { phase: e2 } = n2;
return (c$3 === e2 && (t3 = n2.pointLength), { maxPointLength: t3 });
};
}
function v(t3) {
return { x: t3.points[1][n$1] - t3.points[0][n$1], y: t3.points[1][e$2] - t3.points[0][e$2] };
}
function m$1() {
let t3, n2, e2;
return function (o2) {
const { prevInput: r2, startMultiInput: i2 } = o2;
return (
void 0 !== i2 && void 0 !== r2 && o2.id !== i2.id && 1 < r2.pointLength && 1 < o2.pointLength
? ((t3 = v(i2)), (n2 = v(r2)), (e2 = v(o2)))
: (e2 = void 0),
{ startVecotr: t3, prevVecotr: n2, activeVecotr: e2 }
);
};
}
const m = {
name: "tap",
pointLength: 1,
tapTimes: 1,
waitNextTapTime: 300,
maxDistance: 2,
maxDistanceFromPrevTap: 9,
maxPressTime: 250,
};
function r$2(r2, s2) {
const c2 = O(m, s2);
let p2,
u2,
x$1,
T = 0;
function f2() {
((T = 0), (p2 = void 0), (u2 = void 0));
}
return (
r2.compute([h$1, M], (t3) => {
if (j(c2)) return;
const { phase: i2, x: o2, y: m2 } = t3;
u$3 === i2 &&
((c2.state = 0),
!(function () {
const { startInput: e2, pointLength: n2, timestamp: a2 } = t3,
i3 = a2 - e2.timestamp,
{ distance: o3, maxPointLength: m3 } = t3;
return m3 === c2.pointLength && 0 === n2 && c2.maxDistance >= o3 && c2.maxPressTime > i3;
})()
? (f2(), (c2.state = 2))
: (clearTimeout(x$1),
(function (t4, e2) {
if (void 0 !== p2) {
const n2 = x({ x: t4.x - p2.x, y: t4.y - p2.y });
return ((p2 = t4), e2.maxDistanceFromPrevTap >= n2);
}
return ((p2 = t4), true);
})({ x: o2, y: m2 }, c2) &&
(function (t4) {
const e2 = performance.now();
if (void 0 === u2) return ((u2 = e2), true);
{
const n2 = e2 - u2;
return ((u2 = e2), n2 < t4);
}
})(c2.waitNextTapTime)
? T++
: (T = 1),
0 == T % c2.tapTimes
? ((c2.state = 1), r2.emit2(c2.name, t3, c2), f2())
: (x$1 = setTimeout(() => {
((c2.state = 2), f2());
}, c2.waitNextTapTime))));
}),
c2
);
}
const p = { name: "pan", threshold: 10, pointLength: 1 };
function u(u2, d$12) {
const f$1 = O(p, d$12);
return (
u2.compute([f, h$1, d], (t3) => {
if ((g$1(f$1), j(f$1))) return;
const c2 = (function () {
const { pointLength: e2, distance: n2 } = t3;
return f$1.pointLength === e2 && f$1.threshold <= n2;
})();
if (((f$1.state = b(c2, f$1.state, t3.phase)), c2 || h$3(f$1.state))) {
const { name: e2 } = f$1;
(u2.emit2(e2, t3, f$1),
u2.emit2(e2 + v$1(f$1.state), t3, f$1),
![u$3, s$1].includes(t3.phase) && t3.direction && u2.emit2(e2 + t3.direction, t3, f$1));
}
}),
f$1
);
}
const c$1 = { name: "swipe", threshold: 10, velocity: 0.3, pointLength: 1 };
function a(a2, r2) {
const s2 = O(c$1, r2);
return (
a2.compute([h$1, f, M], (t3) => {
if (
((s2.state = 0),
!s2.disabled &&
(function () {
if (u$3 !== t3.phase) return false;
const { velocityX: o2, velocityY: n2, distance: i2, maxPointLength: c2 } = t3;
return (
c2 === s2.pointLength && 0 === t3.points.length && s2.threshold < i2 && s2.velocity < Math.max(o2, n2)
);
})())
) {
const { name: e2 } = s2;
((s2.state = 1), a2.emit2(e2, t3, s2), a2.emit2(e2 + t3.direction, t3, s2));
}
}),
s2
);
}
const r$1 = { name: "press", pointLength: 1, maxDistance: 9, minPressTime: 251 };
function c(c2, u2) {
const p2 = O(r$1, u2);
let f2 = 0;
return (
c2.compute([h$1], (t3) => {
if (j(p2)) return;
const { phase: o2, startInput: r2, pointLength: u3 } = t3;
if (c$3 === o2 && p2.pointLength === u3)
(g$1(p2),
clearTimeout(f2),
(f2 = setTimeout(() => {
((p2.state = 1), c2.emit2(p2.name, t3, p2));
}, p2.minPressTime)));
else if (u$3 === o2 && 1 === p2.state) c2.emit2(`${p2.name}${r$4}`, t3, p2);
else if (1 !== p2.state) {
const e2 = t3.timestamp - r2.timestamp;
(!(function () {
const { distance: e3 } = t3;
return e3 && p2.maxDistance > e3;
})() ||
(p2.minPressTime > e2 && [u$3, s$1].includes(o2))) &&
(clearTimeout(f2), (p2.state = 2));
}
}),
p2
);
}
const i$2 = { name: "pinch", threshold: 0, pointLength: 2 };
function r(r2, m2) {
const p2 = O(i$2, m2);
return (
r2.compute([m$1, l2], (t3) => {
if ((g$1(p2), j(p2))) return;
const c2 = (function () {
const { pointLength: e2, scale: n2, deltaScale: o2, phase: a2 } = t3;
return p2.pointLength === e2 && p2.threshold < Math.abs(n2 - 1);
})();
p2.state = b(c2, p2.state, t3.phase);
const { name: h2 } = p2;
if (c2 || h$3(p2.state)) {
r2.emit2(h2, t3, p2);
const { deltaScale: e2 } = t3;
1 !== e2 && r2.emit2(h2 + (1 < e2 ? "in" : "out"), t3, p2);
}
const i2 = v$1(p2.state);
i2 && r2.emit2(h2 + i2, t3, p2);
}),
p2
);
}
const h = { name: "rotate", threshold: 0, pointLength: 2 };
function i$1(i2, m2) {
const u2 = O(h, m2);
return (
i2.compute([m$1, p$1], (t3) => {
if (j(u2)) return;
g$1(u2);
const r2 = (function () {
const { pointLength: e2, angle: n2 } = t3;
return u2.pointLength === e2 && u2.threshold < Math.abs(n2);
})();
u2.state = b(r2, u2.state, t3.phase);
const { name: c2 } = u2;
(r2 || h$3(u2.state)) && i2.emit2(c2, t3, u2);
const h2 = v$1(u2.state);
h2 && i2.emit2(c2 + h2, t3, u2);
}),
u2
);
}
function e(e2) {
e2.use(r$2, { name: "doubletap", tapTimes: 2 });
const a2 = e2.get("doubletap");
let o2;
return (
e2.beforeEach((t3, e3) => {
"tap" === t3
? (clearTimeout(o2),
(o2 = setTimeout(() => {
[0, 2].includes(a2.state) && e3();
}, 300)))
: e3();
}),
a2
);
}
class i extends l$1 {
constructor(t3, u$12) {
(super(t3, u$12), this.use(r$2), this.use(u), this.use(a), this.use(c), this.use(r), this.use(i$1));
}
}
((i.STATE_POSSIBLE = 0),
(i.STATE_START = 4),
(i.STATE_MOVE = 5),
(i.STATE_END = 1),
(i.STATE_CANCELLED = 3),
(i.STATE_FAILED = 2),
(i.STATE_RECOGNIZED = 1),
(i.tap = r$2),
(i.pan = u),
(i.swipe = a),
(i.press = c),
(i.rotate = i$1),
(i.pinch = r),
(i.doubletap = e));
class PopsUtils {
isWin(target) {
if (typeof target !== "object") {
return false;
}
if (target instanceof Node) {
return false;
}
if (target === globalThis) {
return true;
}
if (target === window) {
return true;
}
if (target === self) {
return true;
}
if (target === PopsCore.globalThis) {
return true;
}
if (target === PopsCore.window) {
return true;
}
if (target === PopsCore.self) {
return true;
}
if (typeof unsafeWindow !== "undefined" && target === unsafeWindow) {
return true;
}
if (target?.Math?.toString() !== "[object Math]") {
return false;
}
return true;
}
isDOM(target) {
return target instanceof Node;
}
delete(target, propName) {
if (typeof Reflect === "object" && Reflect.deleteProperty) {
Reflect.deleteProperty(target, propName);
} else {
delete target[propName];
}
}
assign(target = {}, source = {}, isAdd = false) {
const UtilsContext = this;
if (source == null) {
return target;
}
if (target == null) {
target = {};
}
if (Array.isArray(source)) {
const canTraverse = source.filter((item) => {
return typeof item === "object";
});
if (!canTraverse.length) {
return source;
}
}
if (isAdd) {
for (const sourceKeyName in source) {
const targetKeyName = sourceKeyName;
const targetValue = target[targetKeyName];
const sourceValue = source[sourceKeyName];
if (
typeof sourceValue === "object" &&
sourceValue != null &&
sourceKeyName in target &&
!UtilsContext.isDOM(sourceValue)
) {
target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
continue;
}
target[sourceKeyName] = sourceValue;
}
} else {
for (const targetKeyName in target) {
if (targetKeyName in source) {
const targetValue = Reflect.get(target, targetKeyName);
const sourceValue = Reflect.get(source, targetKeyName);
if (
typeof sourceValue === "object" &&
sourceValue != null &&
!UtilsContext.isDOM(sourceValue) &&
Object.keys(sourceValue).length
) {
const childObjectValue = UtilsContext.assign(targetValue, sourceValue, isAdd);
Reflect.set(target, targetKeyName, childObjectValue);
continue;
}
Reflect.set(target, targetKeyName, sourceValue);
}
}
}
return target;
}
getRandomGUID() {
if (typeof PopsCore.globalThis?.crypto?.randomUUID === "function") {
return PopsCore.globalThis.crypto.randomUUID();
} else {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (charStr) {
const randomValue = (Math.random() * 16) | 0,
randomCharValue = charStr === "x" ? randomValue : (randomValue & 3) | 8;
return randomCharValue.toString(16);
});
}
}
contains(...args) {
const [context, target] = args;
if (args.length === 1) {
return this.contains(PopsCore.document.body || PopsCore.document.documentElement, args[0]);
} else {
if (target == null) {
return false;
}
if (typeof target[Symbol.iterator] === "function") {
let flag = true;
for (const targetNode of target) {
if (!context.contains(targetNode)) {
flag = false;
break;
}
}
return flag;
} else {
return context.contains(target);
}
}
}
formatTime(text = new Date(), formatType = "yyyy-MM-dd HH:mm:ss") {
const time = text == null ? new Date() : new Date(text);
function checkTime(timeNum) {
if (timeNum < 10) return "0" + timeNum;
return timeNum;
}
function timeSystemChange(hourNum) {
return hourNum > 12 ? hourNum - 12 : hourNum;
}
const timeRegexp = {
yyyy: time.getFullYear(),
MM: checkTime(time.getMonth() + 1),
dd: checkTime(time.getDate()),
HH: checkTime(time.getHours()),
hh: checkTime(timeSystemChange(time.getHours())),
mm: checkTime(time.getMinutes()),
ss: checkTime(time.getSeconds()),
};
Object.keys(timeRegexp).forEach(function (key) {
const replaecRegexp = new RegExp(key, "g");
formatType = formatType.replace(replaecRegexp, timeRegexp[key]);
});
return formatType;
}
formatByteToSize(byteSize, addType = true) {
byteSize = parseInt(byteSize.toString());
if (isNaN(byteSize)) {
throw new TypeError("Utils.formatByteToSize 参数 byteSize 格式不正确");
}
let result = 0;
let resultType = "KB";
const sizeData = {};
sizeData.B = 1;
sizeData.KB = 1024;
sizeData.MB = sizeData.KB * sizeData.KB;
sizeData.GB = sizeData.MB * sizeData.KB;
sizeData.TB = sizeData.GB * sizeData.KB;
sizeData.PB = sizeData.TB * sizeData.KB;
sizeData.EB = sizeData.PB * sizeData.KB;
sizeData.ZB = sizeData.EB * sizeData.KB;
sizeData.YB = sizeData.ZB * sizeData.KB;
sizeData.BB = sizeData.YB * sizeData.KB;
sizeData.NB = sizeData.BB * sizeData.KB;
sizeData.DB = sizeData.NB * sizeData.KB;
for (const key in sizeData) {
result = byteSize / sizeData[key];
resultType = key;
if (sizeData.KB >= result) {
break;
}
}
result = result.toFixed(2);
result = addType ? result + resultType.toString() : parseFloat(result.toString());
return result;
}
AnyTouch = () => {
return i;
};
isPhone(userAgent = PopsCore.globalThis.navigator.userAgent) {
return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
}
setTimeout(callback, timeout = 0) {
try {
return setTimeout$1(callback, timeout);
} catch {
return PopsCore.setTimeout(callback, timeout);
}
}
clearTimeout(timeId) {
try {
if (timeId != null) {
clearTimeout$1(timeId);
}
} catch {
} finally {
PopsCore.clearTimeout(timeId);
}
}
setInterval(callback, timeout = 0) {
try {
return setInterval$1(callback, timeout);
} catch {
return PopsCore.setInterval(callback, timeout);
}
}
clearInterval(timeId) {
try {
if (timeId != null) {
clearInterval$1(timeId);
}
} catch {
} finally {
PopsCore.clearInterval(timeId);
}
}
}
const popsUtils = new PopsUtils();
const PopsSafeUtils = {
getSafeHTML(text) {
if (window.trustedTypes) {
const policy = window.trustedTypes.createPolicy("safe-innerHTML", {
createHTML: (html) => html,
});
return policy.createHTML(text);
} else {
return text;
}
},
setSafeHTML($el, text) {
$el.innerHTML = this.getSafeHTML(text);
},
};
const PopsCommonCSSClassName = {
flexCenter: "pops-flex-items-center",
flexYCenter: "pops-flex-y-center",
hide: "pops-hide",
hideImportant: "pops-hide-important",
userSelectNone: "pops-user-select-none",
textIsDisabled: "pops-text-is-disabled",
};
class PopsDOMUtilsEvent {
on(element, eventType, selector, callback, option) {
function getOption(args2, startIndex, option2) {
const currentParam = args2[startIndex];
if (typeof currentParam === "boolean") {
option2.capture = currentParam;
if (typeof args2[startIndex + 1] === "boolean") {
option2.once = args2[startIndex + 1];
}
if (typeof args2[startIndex + 2] === "boolean") {
option2.passive = args2[startIndex + 2];
}
} else if (
typeof currentParam === "object" &&
("capture" in currentParam ||
"once" in currentParam ||
"passive" in currentParam ||
"isComposedPath" in currentParam)
) {
option2.capture = currentParam.capture;
option2.once = currentParam.once;
option2.passive = currentParam.passive;
option2.isComposedPath = currentParam.isComposedPath;
}
return option2;
}
const DOMUtilsContext = this;
const args = arguments;
if (typeof element === "string") {
element = DOMUtilsContext.selectorAll(element);
}
if (element == null) {
return;
}
let elementList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
elementList = [...element];
} else {
elementList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(
eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== "")
);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
}
let selectorList = [];
if (Array.isArray(selector)) {
selectorList = selectorList.concat(
selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== "")
);
} else if (typeof selector === "string") {
selectorList.push(selector);
}
let listenerCallBack = callback;
let listenerOption = {
capture: false,
once: false,
passive: false,
isComposedPath: false,
};
if (typeof selector === "function") {
listenerCallBack = selector;
listenerOption = getOption(args, 3, listenerOption);
} else {
listenerOption = getOption(args, 4, listenerOption);
}
function checkOptionOnceToRemoveEventListener() {
if (listenerOption.once) {
DOMUtilsContext.off(element, eventType, selector, callback, option);
}
}
elementList.forEach((elementItem) => {
function domUtilsEventCallBack(event) {
if (selectorList.length) {
let eventTarget = listenerOption.isComposedPath ? event.composedPath()[0] : event.target;
let totalParent = elementItem;
if (popsUtils.isWin(totalParent)) {
if (totalParent === PopsCore.document) {
totalParent = PopsCore.document.documentElement;
}
}
const findValue = selectorList.find((selectorItem) => {
if (DOMUtilsContext.matches(eventTarget, selectorItem)) {
return true;
}
const $closestMatches = DOMUtilsContext.closest(eventTarget, selectorItem);
if ($closestMatches && totalParent?.contains($closestMatches)) {
eventTarget = $closestMatches;
return true;
}
return false;
});
if (findValue) {
try {
OriginPrototype.Object.defineProperty(event, "target", {
get() {
return eventTarget;
},
});
} catch {}
listenerCallBack.call(eventTarget, event, eventTarget);
checkOptionOnceToRemoveEventListener();
}
} else {
listenerCallBack.call(elementItem, event);
checkOptionOnceToRemoveEventListener();
}
}
eventTypeList.forEach((eventName) => {
elementItem.addEventListener(eventName, domUtilsEventCallBack, listenerOption);
const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
elementEvents[eventName] = elementEvents[eventName] || [];
elementEvents[eventName].push({
selector: selectorList,
option: listenerOption,
callback: domUtilsEventCallBack,
originCallBack: listenerCallBack,
});
Reflect.set(elementItem, SymbolEvents, elementEvents);
});
});
}
off(element, eventType, selector, callback, option, filter) {
function getOption(args1, startIndex, option2) {
const currentParam = args1[startIndex];
if (typeof currentParam === "boolean") {
option2.capture = currentParam;
} else if (typeof currentParam === "object" && currentParam != null && "capture" in currentParam) {
option2.capture = currentParam.capture;
}
return option2;
}
const DOMUtilsContext = this;
const args = arguments;
if (typeof element === "string") {
element = DOMUtilsContext.selectorAll(element);
}
if (element == null) {
return;
}
let elementList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
elementList = [...element];
} else {
elementList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(
eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== "")
);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
}
let selectorList = [];
if (Array.isArray(selector)) {
selectorList = selectorList.concat(
selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== "")
);
} else if (typeof selector === "string") {
selectorList.push(selector);
}
let listenerCallBack = callback;
let listenerOption = {
capture: false,
};
if (typeof selector === "function") {
listenerCallBack = selector;
listenerOption = getOption(args, 3, listenerOption);
} else {
listenerOption = getOption(args, 4, listenerOption);
}
let isRemoveAll = false;
if (args.length === 2) {
isRemoveAll = true;
} else if ((args.length === 3 && typeof args[2] === "string") || Array.isArray(args[2])) {
isRemoveAll = true;
}
if (args.length === 5 && typeof args[4] === "function" && typeof filter !== "function") {
filter = option;
}
elementList.forEach((elementItem) => {
const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
eventTypeList.forEach((eventName) => {
const handlers = elementEvents[eventName] || [];
const filterHandler = typeof filter === "function" ? handlers.filter(filter) : handlers;
for (let index = 0; index < filterHandler.length; index++) {
const handler = filterHandler[index];
let flag = true;
if (flag && listenerCallBack && handler.originCallBack !== listenerCallBack) {
flag = false;
}
if (flag && selectorList.length && Array.isArray(handler.selector)) {
if (JSON.stringify(handler.selector) !== JSON.stringify(selectorList)) {
flag = false;
}
}
if (
flag &&
typeof handler.option.capture === "boolean" &&
listenerOption.capture !== handler.option.capture
) {
flag = false;
}
if (flag || isRemoveAll) {
elementItem.removeEventListener(eventName, handler.callback, handler.option);
const findIndex = handlers.findIndex((item) => item === handler);
if (findIndex !== -1) {
handlers.splice(findIndex, 1);
}
}
}
if (handlers.length === 0) {
popsUtils.delete(elementEvents, eventType);
}
});
Reflect.set(elementItem, SymbolEvents, elementEvents);
});
}
offAll(element, eventType) {
if (typeof element === "string") {
element = PopsCore.document.querySelectorAll(element);
}
if (element == null) {
return;
}
let elementList = [];
if (element instanceof NodeList || Array.isArray(element)) {
elementList = [...element];
} else {
elementList.push(element);
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventTypeList.concat(eventType);
} else if (typeof eventType === "string") {
eventTypeList = eventTypeList.concat(eventType.split(" "));
}
elementList.forEach((elementItem) => {
Object.getOwnPropertySymbols(elementItem).forEach((__symbolEvents) => {
if (!__symbolEvents.toString().startsWith("Symbol(events_")) {
return;
}
const elementEvents = elementItem[__symbolEvents] || {};
const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
iterEventNameList.forEach((eventName) => {
const handlers = elementEvents[eventName];
if (!handlers) {
return;
}
for (const handler of handlers) {
elementItem.removeEventListener(eventName, handler.callback, {
capture: handler["option"]["capture"],
});
}
popsUtils.delete(elementItem[__symbolEvents], eventName);
});
});
});
}
ready(callback) {
const that = this;
if (typeof callback !== "function") {
return;
}
function checkDOMReadyState() {
try {
if (
document.readyState === "complete" ||
(document.readyState !== "loading" && !document.documentElement.doScroll)
) {
return true;
} else {
return false;
}
} catch {
return false;
}
}
function completed() {
removeDomReadyListener();
callback();
}
const targetList = [
{
target: PopsCore.document,
eventType: "DOMContentLoaded",
callback: completed,
},
{
target: PopsCore.window,
eventType: "load",
callback: completed,
},
];
function addDomReadyListener() {
for (let index = 0; index < targetList.length; index++) {
const item = targetList[index];
that.on(item.target, item.eventType, item.callback);
}
}
function removeDomReadyListener() {
for (let index = 0; index < targetList.length; index++) {
const item = targetList[index];
that.off(item.target, item.eventType, item.callback);
}
}
if (checkDOMReadyState()) {
popsUtils.setTimeout(callback, 0);
} else {
addDomReadyListener();
}
}
trigger(element, eventType, details, useDispatchToTriggerEvent = true) {
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
let elementList = [];
if (element instanceof NodeList || Array.isArray(element)) {
element = element;
elementList = [...element];
} else {
elementList = [element];
}
let eventTypeList = [];
if (Array.isArray(eventType)) {
eventTypeList = eventType;
} else if (typeof eventType === "string") {
eventTypeList = eventType.split(" ");
}
elementList.forEach((elementItem) => {
const events = elementItem[SymbolEvents] || {};
eventTypeList.forEach((_eventType_) => {
let event = null;
if (details && details instanceof Event) {
event = details;
} else {
event = new Event(_eventType_);
if (details) {
Object.keys(details).forEach((keyName) => {
event[keyName] = details[keyName];
});
}
}
if (useDispatchToTriggerEvent == false && _eventType_ in events) {
events[_eventType_].forEach((eventsItem) => {
eventsItem.callback(event);
});
} else {
elementItem.dispatchEvent(event);
}
});
});
}
click(element, handler, details, useDispatchToTriggerEvent) {
const DOMUtilsContext = this;
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (handler == null) {
DOMUtilsContext.trigger(element, "click", details, useDispatchToTriggerEvent);
} else {
DOMUtilsContext.on(element, "click", null, handler);
}
}
blur(element, handler, details, useDispatchToTriggerEvent) {
const DOMUtilsContext = this;
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (handler === null) {
DOMUtilsContext.trigger(element, "blur", details, useDispatchToTriggerEvent);
} else {
DOMUtilsContext.on(element, "blur", null, handler);
}
}
focus(element, handler, details, useDispatchToTriggerEvent) {
const DOMUtilsContext = this;
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (handler == null) {
DOMUtilsContext.trigger(element, "focus", details, useDispatchToTriggerEvent);
} else {
DOMUtilsContext.on(element, "focus", null, handler);
}
}
hover(element, handler, option) {
const DOMUtilsContext = this;
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
DOMUtilsContext.on(element, "mouseenter", null, handler, option);
DOMUtilsContext.on(element, "mouseleave", null, handler, option);
}
keyup(target, handler, option) {
const DOMUtilsContext = this;
if (target == null) {
return;
}
if (typeof target === "string") {
target = PopsCore.document.querySelector(target);
}
DOMUtilsContext.on(target, "keyup", null, handler, option);
}
keydown(target, handler, option) {
const DOMUtilsContext = this;
if (target == null) {
return;
}
if (typeof target === "string") {
target = PopsCore.document.querySelector(target);
}
DOMUtilsContext.on(target, "keydown", null, handler, option);
}
keypress(target, handler, option) {
const DOMUtilsContext = this;
if (target == null) {
return;
}
if (typeof target === "string") {
target = PopsCore.document.querySelector(target);
}
DOMUtilsContext.on(target, "keypress", null, handler, option);
}
preventEvent(element, eventNameList = [], capture) {
function stopEvent(event) {
event?.preventDefault();
event?.stopPropagation();
event?.stopImmediatePropagation();
return false;
}
if (arguments.length === 1) {
return stopEvent(arguments[0]);
} else {
if (typeof eventNameList === "string") {
eventNameList = [eventNameList];
}
eventNameList.forEach((eventName) => {
this.on(element, eventName, stopEvent, { capture: Boolean(capture) });
});
}
}
selector(selector) {
return this.selectorAll(selector)[0];
}
selectorAll(selector) {
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return Array.from(PopsCore.document.querySelectorAll(selector)).filter(($ele) => {
return $ele?.innerHTML?.trim() === "";
});
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
return Array.from(PopsCore.document.querySelectorAll(selector)).filter(($ele) => {
return ($ele?.textContent || $ele?.innerText)?.includes(text);
});
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
return Array.from(PopsCore.document.querySelectorAll(selector)).filter(($ele) => {
return Boolean(($ele?.textContent || $ele?.innerText)?.match(regexp));
});
} else {
return Array.from(PopsCore.document.querySelectorAll(selector));
}
}
matches($el, selector) {
selector = selector.trim();
if ($el == null) {
return false;
}
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
return $el.matches(selector) && $el?.innerHTML?.trim() === "";
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && content?.includes(text);
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
let content = $el?.textContent || $el?.innerText;
if (typeof content !== "string") {
content = "";
}
return $el.matches(selector) && Boolean(content?.match(regexp));
} else {
return $el.matches(selector);
}
}
closest($el, selector) {
selector = selector.trim();
if (selector.match(/[^\s]{1}:empty$/gi)) {
selector = selector.replace(/:empty$/gi, "");
const $closest = $el?.closest(selector);
if ($closest && $closest?.innerHTML?.trim() === "") {
return $closest;
}
return null;
} else if (selector.match(/[^\s]{1}:contains\("(.*)"\)$/i) || selector.match(/[^\s]{1}:contains\('(.*)'\)$/i)) {
const textMatch = selector.match(/:contains\(("|')(.*)("|')\)$/i);
const text = textMatch[2];
selector = selector.replace(/:contains\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.includes(text)) {
return $closest;
}
}
return null;
} else if (selector.match(/[^\s]{1}:regexp\("(.*)"\)$/i) || selector.match(/[^\s]{1}:regexp\('(.*)'\)$/i)) {
const textMatch = selector.match(/:regexp\(("|')(.*)("|')\)$/i);
let pattern = textMatch[2];
const flagMatch = pattern.match(/("|'),[\s]*("|')([igm]{0,3})$/i);
let flags = "";
if (flagMatch) {
pattern = pattern.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi, "");
flags = flagMatch[3];
}
const regexp = new RegExp(pattern, flags);
selector = selector.replace(/:regexp\(("|')(.*)("|')\)$/gi, "");
const $closest = $el?.closest(selector);
if ($closest) {
const content = $el?.textContent || $el?.innerText;
if (typeof content === "string" && content.match(regexp)) {
return $closest;
}
}
return null;
} else {
const $closest = $el?.closest(selector);
return $closest;
}
}
}
class PopsDOMUtils extends PopsDOMUtilsEvent {
getAnimationEndNameList() {
return ["webkitAnimationEnd", "mozAnimationEnd", "MSAnimationEnd", "oanimationend", "animationend"];
}
getTransitionEndNameList() {
return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
}
offset(element, calcScroll = true) {
const rect = element.getBoundingClientRect();
const win = element.ownerDocument.defaultView;
const resultRect = new DOMRect(
calcScroll ? parseFloat((rect.left + (win?.pageXOffset || 0)).toString()) : rect.left,
calcScroll ? parseFloat((rect.top + (win?.pageYOffset || 0)).toString()) : rect.top,
rect.width,
rect.height
);
return resultRect;
}
width(element, isShow = false, parent) {
const DOMUtilsContext = this;
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (popsUtils.isWin(element)) {
return PopsCore.window.document.documentElement.clientWidth;
}
if (element.nodeType === 9) {
element = element;
return Math.max(
element.body.scrollWidth,
element.documentElement.scrollWidth,
element.body.offsetWidth,
element.documentElement.offsetWidth,
element.documentElement.clientWidth
);
}
if (isShow || (!isShow && popsDOMUtils.isShow(element))) {
element = element;
if (parseFloat(popsDOMUtils.getStyleValue(element, "width").toString()) > 0) {
return parseFloat(popsDOMUtils.getStyleValue(element, "width").toString());
}
if (element.offsetWidth > 0) {
const borderLeftWidth = popsDOMUtils.getStyleValue(element, "borderLeftWidth");
const borderRightWidth = popsDOMUtils.getStyleValue(element, "borderRightWidth");
const paddingLeft = popsDOMUtils.getStyleValue(element, "paddingLeft");
const paddingRight = popsDOMUtils.getStyleValue(element, "paddingRight");
const backHeight =
parseFloat(element.offsetWidth.toString()) -
parseFloat(borderLeftWidth.toString()) -
parseFloat(borderRightWidth.toString()) -
parseFloat(paddingLeft.toString()) -
parseFloat(paddingRight.toString());
return parseFloat(backHeight.toString());
}
return 0;
} else {
element = element;
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
const width = DOMUtilsContext.width(cloneNode, true, parent);
recovery();
return width;
}
}
height(element, isShow = false, parent) {
const DOMUtilsContext = this;
if (popsUtils.isWin(element)) {
return PopsCore.window.document.documentElement.clientHeight;
}
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (element.nodeType === 9) {
element = element;
return Math.max(
element.body.scrollHeight,
element.documentElement.scrollHeight,
element.body.offsetHeight,
element.documentElement.offsetHeight,
element.documentElement.clientHeight
);
}
if (isShow || (!isShow && popsDOMUtils.isShow(element))) {
element = element;
if (parseFloat(popsDOMUtils.getStyleValue(element, "height").toString()) > 0) {
return parseFloat(popsDOMUtils.getStyleValue(element, "height").toString());
}
if (element.offsetHeight > 0) {
const borderTopWidth = popsDOMUtils.getStyleValue(element, "borderTopWidth");
const borderBottomWidth = popsDOMUtils.getStyleValue(element, "borderBottomWidth");
const paddingTop = popsDOMUtils.getStyleValue(element, "paddingTop");
const paddingBottom = popsDOMUtils.getStyleValue(element, "paddingBottom");
const backHeight =
parseFloat(element.offsetHeight.toString()) -
parseFloat(borderTopWidth.toString()) -
parseFloat(borderBottomWidth.toString()) -
parseFloat(paddingTop.toString()) -
parseFloat(paddingBottom.toString());
return parseFloat(backHeight.toString());
}
return 0;
} else {
element = element;
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
const height = DOMUtilsContext.height(cloneNode, true, parent);
recovery();
return height;
}
}
outerWidth(element, isShow = false, parent) {
const DOMUtilsContext = this;
if (popsUtils.isWin(element)) {
return PopsCore.window.innerWidth;
}
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
element = element;
if (isShow || (!isShow && popsDOMUtils.isShow(element))) {
const style = getComputedStyle(element, null);
const marginLeft = popsDOMUtils.getStyleValue(style, "marginLeft");
const marginRight = popsDOMUtils.getStyleValue(style, "marginRight");
return element.offsetWidth + marginLeft + marginRight;
} else {
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
const outerWidth = DOMUtilsContext.outerWidth(cloneNode, true, parent);
recovery();
return outerWidth;
}
}
outerHeight(element, isShow = false, parent) {
const DOMUtilsContext = this;
if (popsUtils.isWin(element)) {
return PopsCore.window.innerHeight;
}
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
element = element;
if (isShow || (!isShow && popsDOMUtils.isShow(element))) {
const style = getComputedStyle(element, null);
const marginTop = popsDOMUtils.getStyleValue(style, "marginTop");
const marginBottom = popsDOMUtils.getStyleValue(style, "marginBottom");
return element.offsetHeight + marginTop + marginBottom;
} else {
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
const outerHeight = DOMUtilsContext.outerHeight(cloneNode, true, parent);
recovery();
return outerHeight;
}
}
addClassName($el, className) {
if ($el == null) {
return;
}
if (typeof className !== "string") {
return;
}
if (className.trim() === "") {
return;
}
const classNameList = className.split(" ").filter((item) => item.trim() !== "");
$el.classList.add(...classNameList);
}
removeClassName($el, className) {
if ($el == null) {
return;
}
if (typeof className !== "string") {
return;
}
if (className.trim() === "") {
return;
}
const classNameList = className.split(" ").filter((item) => item.trim() !== "");
$el.classList.remove(...classNameList);
}
containsClassName($el, className) {
if ($el == null) {
return false;
}
if (typeof className !== "string") {
return false;
}
if (className.trim() === "") {
return false;
}
return $el.classList.contains(className);
}
css(element, property, value) {
function handlePixe(propertyName, propertyValue) {
const allowAddPixe = ["width", "height", "top", "left", "right", "bottom", "font-size"];
if (typeof propertyValue === "number") {
propertyValue = propertyValue.toString();
}
if (
typeof propertyValue === "string" &&
allowAddPixe.includes(propertyName) &&
propertyValue.match(/[0-9]$/gi)
) {
propertyValue = propertyValue + "px";
}
return propertyValue;
}
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
const setStyleProperty = (propertyName, propertyValue) => {
if (typeof propertyValue === "string" && propertyValue.trim().endsWith("!important")) {
propertyValue = propertyValue
.trim()
.replace(/!important$/gi, "")
.trim();
element.style.setProperty(propertyName, propertyValue, "important");
} else {
propertyValue = handlePixe(propertyName, propertyValue);
element.style.setProperty(propertyName, propertyValue);
}
};
if (typeof property === "string") {
if (value == null) {
return getComputedStyle(element).getPropertyValue(property);
} else {
setStyleProperty(property, value);
}
} else if (typeof property === "object") {
for (const prop in property) {
const value2 = property[prop];
setStyleProperty(prop, value2);
}
}
}
createElement(tagName, property, attributes) {
const tempElement = PopsCore.document.createElement(tagName);
if (typeof property === "string") {
PopsSafeUtils.setSafeHTML(tempElement, property);
return tempElement;
}
if (property == null) {
property = {};
}
if (attributes == null) {
attributes = {};
}
Object.keys(property).forEach((key) => {
const value = property[key];
if (key === "innerHTML") {
PopsSafeUtils.setSafeHTML(tempElement, value);
return;
}
Reflect.set(tempElement, key, value);
});
Object.keys(attributes).forEach((key) => {
let value = attributes[key];
if (typeof value === "object") {
value = JSON.stringify(value);
} else if (typeof value === "function") {
value = value.toString();
}
tempElement.setAttribute(key, value);
});
return tempElement;
}
parseTextToDOM(elementString) {
elementString = elementString.replace(/^[\n|\s]*/g, "").replace(/[\n|\s]*$/g, "");
const targetElement = this.createElement("div", {
innerHTML: elementString,
});
return targetElement.firstChild;
}
getTextBoundingRect(input, selectionStart, selectionEnd, debug) {
if (!input || !("value" in input)) return input;
if (typeof selectionStart == "string") selectionStart = parseFloat(selectionStart);
if (typeof selectionStart != "number" || isNaN(selectionStart)) {
selectionStart = 0;
}
if (selectionStart < 0) selectionStart = 0;
else selectionStart = Math.min(input.value.length, selectionStart);
if (typeof selectionEnd == "string") selectionEnd = parseFloat(selectionEnd);
if (typeof selectionEnd != "number" || isNaN(selectionEnd) || selectionEnd < selectionStart) {
selectionEnd = selectionStart;
}
if (selectionEnd < 0) selectionEnd = 0;
else selectionEnd = Math.min(input.value.length, selectionEnd);
if (typeof input.createTextRange == "function") {
const range = input.createTextRange();
range.collapse(true);
range.moveStart("character", selectionStart);
range.moveEnd("character", selectionEnd - selectionStart);
return range.getBoundingClientRect();
}
const offset = getInputOffset();
let topPos = offset.top;
let leftPos = offset.left;
const width = getInputCSS("width", true);
const height = getInputCSS("height", true);
let cssDefaultStyles = "white-space:pre;padding:0;margin:0;";
const listOfModifiers = [
"direction",
"font-family",
"font-size",
"font-size-adjust",
"font-variant",
"font-weight",
"font-style",
"letter-spacing",
"line-height",
"text-align",
"text-indent",
"text-transform",
"word-wrap",
"word-spacing",
];
topPos += getInputCSS("padding-top", true);
topPos += getInputCSS("border-top-width", true);
leftPos += getInputCSS("padding-left", true);
leftPos += getInputCSS("border-left-width", true);
leftPos += 1;
for (let i2 = 0; i2 < listOfModifiers.length; i2++) {
const property = listOfModifiers[i2];
cssDefaultStyles += property + ":" + getInputCSS(property, false) + ";";
}
const text = input.value || "G",
textLen = text.length,
fakeClone = document.createElement("div");
if (selectionStart > 0) appendPart(0, selectionStart);
const fakeRange = appendPart(selectionStart, selectionEnd);
if (textLen > selectionEnd) appendPart(selectionEnd, textLen);
fakeClone.style.cssText = cssDefaultStyles;
fakeClone.style.position = "absolute";
fakeClone.style.top = topPos + "px";
fakeClone.style.left = leftPos + "px";
fakeClone.style.width = width + "px";
fakeClone.style.height = height + "px";
PopsCore.document.body.appendChild(fakeClone);
const returnValue = fakeRange.getBoundingClientRect();
if (!debug) fakeClone.parentNode.removeChild(fakeClone);
return returnValue;
function appendPart(start, end) {
const span = document.createElement("span");
span.style.cssText = cssDefaultStyles;
span.textContent = text.substring(start, end);
fakeClone.appendChild(span);
return span;
}
function getInputOffset() {
const body = document.body,
win = document.defaultView,
docElem = document.documentElement,
box = document.createElement("div");
box.style.paddingLeft = box.style.width = "1px";
body.appendChild(box);
const isBoxModel = box.offsetWidth == 2;
body.removeChild(box);
const boxRect = input.getBoundingClientRect();
const clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win?.pageYOffset || (isBoxModel && docElem.scrollTop) || body.scrollTop,
scrollLeft = win?.pageXOffset || (isBoxModel && docElem.scrollLeft) || body.scrollLeft;
return {
top: boxRect.top + scrollTop - clientTop,
left: boxRect.left + scrollLeft - clientLeft,
};
}
function getInputCSS(prop, isnumber) {
const val = PopsCore.document.defaultView.getComputedStyle(input, null).getPropertyValue(prop);
if (isnumber) {
return parseFloat(val);
} else {
return val;
}
}
}
cssHide(ele, isImportant = false) {
if (ele == null) {
return;
}
if (isImportant) {
popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hideImportant);
} else {
popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hide);
}
}
cssShow(ele) {
if (ele == null) {
return;
}
popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hide);
popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hideImportant);
}
parseHTML(html, useParser = false, isComplete = false) {
function parseHTMLByDOMParser() {
const parser = new DOMParser();
if (isComplete) {
return parser.parseFromString(html, "text/html");
} else {
return parser.parseFromString(html, "text/html").body.firstChild;
}
}
function parseHTMLByCreateDom() {
const tempDIV = PopsCore.document.createElement("div");
PopsSafeUtils.setSafeHTML(tempDIV, html);
if (isComplete) {
return tempDIV;
} else {
return tempDIV.firstChild;
}
}
if (useParser) {
return parseHTMLByDOMParser();
} else {
return parseHTMLByCreateDom();
}
}
append(element, content) {
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
function elementAppendChild(ele, text) {
if (typeof content === "string") {
ele.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(text));
} else {
ele.appendChild(text);
}
}
if (Array.isArray(content) || content instanceof NodeList) {
const fragment = PopsCore.document.createDocumentFragment();
content.forEach((ele) => {
if (typeof ele === "string") {
ele = this.parseHTML(ele, true, false);
}
fragment.appendChild(ele);
});
element.appendChild(fragment);
} else {
elementAppendChild(element, content);
}
}
appendHead($ele) {
if (PopsCore.document.head) {
PopsCore.document.head.appendChild($ele);
} else {
PopsCore.document.documentElement.appendChild($ele);
}
}
appendBody($ele) {
if (PopsCore.document.body) {
PopsCore.document.body.appendChild($ele);
} else {
PopsCore.document.documentElement.appendChild($ele);
}
}
isShow(element) {
return Boolean(element.getClientRects().length);
}
showElement($ele, ownParent) {
const $cloneNode = $ele.cloneNode(true);
$cloneNode.setAttribute("style", "visibility: hidden !important;display:block !important;");
let $parent = PopsCore.document.documentElement;
const $root = $ele.getRootNode();
if (ownParent == null) {
if ($root == $ele) {
$parent = PopsCore.document.documentElement;
} else {
$parent = $root;
}
} else {
$parent = ownParent;
}
$parent.appendChild($cloneNode);
return {
cloneNode: $cloneNode,
recovery() {
$cloneNode.remove();
},
};
}
getStyleValue(element, styleName) {
let view = null;
let styles = null;
if (element instanceof CSSStyleDeclaration) {
styles = element;
} else {
view = element.ownerDocument.defaultView;
if (!view || !view.opener) {
view = window;
}
styles = view.getComputedStyle(element);
}
const value = parseFloat(styles[styleName]);
if (isNaN(value)) {
return 0;
} else {
return value;
}
}
before(element, content) {
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (typeof content === "string") {
element.insertAdjacentHTML("beforebegin", PopsSafeUtils.getSafeHTML(content));
} else {
element.parentElement.insertBefore(content, element);
}
}
after(element, content) {
if (typeof element === "string") {
element = PopsCore.document.querySelector(element);
}
if (element == null) {
return;
}
if (typeof content === "string") {
element.insertAdjacentHTML("afterend", PopsSafeUtils.getSafeHTML(content));
} else {
element.parentElement.insertBefore(content, element.nextSibling);
}
}
getKeyFrames(sheet) {
const result = {};
Object.keys(sheet.cssRules).forEach((key) => {
if (sheet.cssRules[key].type === 7 && sheet.cssRules[key].name.startsWith("pops-anim-")) {
result[sheet.cssRules[key].name] = sheet.cssRules[key];
}
});
return result;
}
calcColor() {
function useChangeColor() {
const hexToRgb = (str) => {
let hexs = "";
const reg = /^#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
if (!reg.test(str)) {
console.warn("输入错误的hex");
return "";
}
str = str.replace("#", "");
hexs = str.match(/../g);
for (let i2 = 0; i2 < 3; i2++) hexs[i2] = parseInt(hexs[i2], 16);
return hexs;
};
const rgbToHex = (r2, g2, b2) => {
const reg = /^\d{1,3}$/;
if (!reg.test(r2) || !reg.test(g2) || !reg.test(b2)) {
console.warn("输入错误的rgb颜色值");
return "";
}
const hexs = [r2.toString(16), g2.toString(16), b2.toString(16)];
for (let i2 = 0; i2 < 3; i2++) if (hexs[i2].length == 1) hexs[i2] = `0${hexs[i2]}`;
return `#${hexs.join("")}`;
};
const getDarkColor = (color, level) => {
const reg = /^#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
if (!reg.test(color)) {
console.warn("输入错误的hex颜色值");
return "";
}
const rgb = useChangeColor().hexToRgb(color);
for (let i2 = 0; i2 < 3; i2++) rgb[i2] = Math.floor(rgb[i2] * (1 - level));
return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
};
const getLightColor = (color, level) => {
const reg = /^#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;
if (!reg.test(color)) {
console.warn("输入错误的hex颜色值");
return "";
}
const rgb = useChangeColor().hexToRgb(color);
for (let i2 = 0; i2 < 3; i2++) rgb[i2] = Math.floor((255 - rgb[i2]) * level + rgb[i2]);
return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
};
return {
hexToRgb,
rgbToHex,
getDarkColor,
getLightColor,
};
}
return useChangeColor();
}
getTransform(element) {
let transform_left = 0;
let transform_top = 0;
const elementTransform = PopsCore.globalThis.getComputedStyle(element).transform;
if (elementTransform !== "none" && elementTransform != null && elementTransform !== "") {
const elementTransformMatch = elementTransform.match(/\((.+)\)/);
const elementTransformSplit = elementTransformMatch?.[1]?.split?.(",");
transform_left = Math.abs(parseInt(elementTransformSplit[4]));
transform_top = Math.abs(parseInt(elementTransformSplit[5]));
}
return {
transformLeft: transform_left,
transformTop: transform_top,
};
}
onInput($el, callback, option) {
let isComposite = false;
const __callback = async (event) => {
if (isComposite) return;
await callback(event);
};
const __composition_start_callback = () => {
isComposite = true;
};
const __composition_end_callback = () => {
isComposite = false;
this.trigger($el, "input", {
isComposite,
});
};
this.on($el, "input", __callback, option);
this.on($el, "compositionstart", __composition_start_callback, option);
this.on($el, "compositionend", __composition_end_callback, option);
return {
off: () => {
this.off($el, "input", __callback, option);
this.off($el, "compositionstart", __composition_start_callback, option);
this.off($el, "compositionend", __composition_end_callback, option);
},
};
}
}
const popsDOMUtils = new PopsDOMUtils();
const PopsElementHandler = {
createMask(guid, zIndex = 101, style = "") {
zIndex = zIndex - 100;
if (style.startsWith(";")) {
style = style.replace(";", "");
}
return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
},
createAnim(guid, type, config, html = "", bottomBtnHTML = "", zIndex) {
const __config = config;
let popsAnimStyle = "";
let popsStyle = "";
const popsPosition = __config.position || "";
if (config.zIndex != null) {
popsAnimStyle += `z-index: ${zIndex};`;
popsStyle += `z-index: ${zIndex};`;
}
if (__config.width != null) {
popsStyle += `width: ${__config.width};`;
}
if (__config.height != null) {
popsStyle += `height: ${__config.height};`;
}
const hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
return `
<div class="pops-anim" anim="${__config.animation || ""}" style="${popsAnimStyle}" data-guid="${guid}">${config.style != null ? `<style tyle="text/css">${config.style}</style>` : ""}
<div class="pops ${config.class || ""}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
</div>`;
},
createHeader(type, config) {
if (!config.btn) {
return "";
}
const confirm_config = config;
if (type !== "iframe" && !confirm_config.btn?.close?.enable) {
return "";
}
let resultHTML = "";
let closeHTML = "";
const iframe_config = config;
if (type === "iframe" && iframe_config.topRightButton?.trim() !== "") {
let topRightButtonHTML = "";
iframe_config.topRightButton.split("|").forEach((item) => {
item = item.toLowerCase();
topRightButtonHTML += `
<button class="pops-header-control" type="button" data-type="${item}">
<i class="pops-icon">${PopsIcon.getIcon(item)}</i>
</button>`;
});
resultHTML = `
<div class="pops-header-controls" data-margin>${topRightButtonHTML}</div>`;
} else {
if (confirm_config.btn?.close?.enable) {
closeHTML = `
<div class="pops-header-controls">
<button class="pops-header-control" type="button" data-type="close" data-header>
<i class="pops-icon">${PopsIcon.getIcon("close")}</i>
</button>
</div>`;
}
resultHTML = closeHTML;
}
return resultHTML;
},
createHeaderStyle(type, config) {
return {
headerStyle: config?.title?.html ? config?.title?.style || "" : "",
headerPStyle: config?.title?.html ? "" : config?.title?.style || "",
};
},
createBottom(type, config) {
if (config.btn == null) {
return "";
}
const confirm_config = config;
if (!(config.btn?.ok?.enable || confirm_config.btn?.cancel?.enable || confirm_config.btn?.other?.enable)) {
return "";
}
let btnStyle = "";
let resultHTML = "";
let okHTML = "";
let cancelHTML = "";
let ohterHTML = "";
if (config.btn.position) {
btnStyle += `justify-content: ${config.btn.position};`;
}
if (confirm_config.btn.reverse) {
btnStyle += "flex-direction: row-reverse;";
}
if (config.btn?.ok?.enable) {
let okButtonSizeClassName = "";
if (config.btn.ok.size === "large") {
okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
} else if (config.btn.ok.size === "small") {
okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
}
let okIconHTML = "";
const okIcon = confirm_config.btn.ok.icon;
if (okIcon !== "") {
let iconHTML = "";
if (PopsIcon.hasIcon(okIcon)) {
iconHTML = PopsIcon.getIcon(okIcon);
} else {
iconHTML = okIcon;
}
iconHTML = iconHTML || "";
okIconHTML = `<i class="pops-bottom-icon" is-loading="${config.btn.ok.iconIsLoading}">${iconHTML}</i>`;
}
okHTML = `
<button
class="pops-${type}-btn-ok ${okButtonSizeClassName}"
type="button"
data-type="${confirm_config.btn.ok?.type}"
data-has-icon="${(confirm_config.btn.ok.icon || "") !== ""}"
data-rightIcon="${confirm_config.btn.ok?.rightIcon}"
>${okIconHTML}<span>${config.btn.ok.text}</span>
</button>`;
}
if (confirm_config.btn?.cancel?.enable) {
let cancelButtonSizeClassName = "";
if (confirm_config.btn.cancel.size === "large") {
cancelButtonSizeClassName = "pops-button-" + confirm_config.btn.cancel.size;
} else if (confirm_config.btn.cancel.size === "small") {
cancelButtonSizeClassName = "pops-button-" + confirm_config.btn.cancel.size;
}
let cancelIconHTML = "";
const cancelIcon = confirm_config.btn.cancel.icon;
if (cancelIcon !== "") {
let iconHTML = "";
if (PopsIcon.hasIcon(cancelIcon)) {
iconHTML = PopsIcon.getIcon(cancelIcon);
} else {
iconHTML = cancelIcon;
}
iconHTML = iconHTML || "";
cancelIconHTML = `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.cancel.iconIsLoading}">${iconHTML}</i>`;
}
cancelHTML = `
<button
class="pops-${type}-btn-cancel ${cancelButtonSizeClassName}"
type="button"
data-type="${confirm_config.btn.cancel.type}"
data-has-icon="${(confirm_config.btn.cancel.icon || "") !== ""}"
data-rightIcon="${confirm_config.btn.cancel.rightIcon}"
>${cancelIconHTML}<span>${confirm_config.btn.cancel.text}</span>
</button>`;
}
if (confirm_config.btn?.other?.enable) {
let otherButtonSizeClassName = "";
if (confirm_config.btn.other.size === "large") {
otherButtonSizeClassName = "pops-button-" + confirm_config.btn.other.size;
} else if (confirm_config.btn.other.size === "small") {
otherButtonSizeClassName = "pops-button-" + confirm_config.btn.other.size;
}
let otherIconHTML = "";
const otherIcon = confirm_config.btn.other.icon;
if (otherIcon !== "") {
let iconHTML = "";
if (PopsIcon.hasIcon(otherIcon)) {
iconHTML = PopsIcon.getIcon(otherIcon);
}
iconHTML = iconHTML || "";
otherIconHTML = `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.other.iconIsLoading}">${iconHTML}</i>`;
}
ohterHTML = `
<button
class="pops-${type}-btn-other ${otherButtonSizeClassName}"
type="button"
data-type="${confirm_config.btn.other.type}"
data-has-icon="${(confirm_config.btn.other.icon || "") !== ""}"
data-rightIcon="${confirm_config.btn.other.rightIcon}"
>${otherIconHTML}<span>${confirm_config.btn.other.text}</span>
</button>`;
}
if (confirm_config.btn.merge) {
let flexStyle = "display: flex;";
if (confirm_config.btn.mergeReverse) {
flexStyle += "flex-direction: row-reverse;";
} else {
flexStyle += "flex-direction: row;";
}
resultHTML = `
<div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${ohterHTML}<div
class="pops-${type}-btn-merge"
style="${flexStyle}">${okHTML}${cancelHTML}</div>
</div>
`;
} else {
resultHTML = `<div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${okHTML}${cancelHTML}${ohterHTML}</div>`;
}
return resultHTML;
},
createContentStyle(type, config) {
return {
contentStyle: config?.content?.html ? config?.content?.style || "" : "",
contentPStyle: config?.content?.html ? "" : config?.content?.style || "",
};
},
parseElement(html) {
return popsDOMUtils.parseTextToDOM(html);
},
};
var indexCSS =
'@charset "utf-8";\r\n.pops * {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n margin: 0;\r\n padding: 0;\r\n -webkit-tap-highlight-color: transparent;\r\n /* 代替::-webkit-scrollbar */\r\n scrollbar-width: thin;\r\n}\r\n.pops {\r\n --pops-bg-opacity: 1;\r\n --pops-bd-opacity: 1;\r\n --pops-font-size: 16px;\r\n interpolate-size: allow-keywords;\r\n --pops-color: #000000;\r\n --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));\r\n --pops-box-shadow-color: rgba(0, 0, 0, 0.12);\r\n --pops-title-color: #000000;\r\n --pops-title-border-color: var(--pops-bd-color);\r\n --pops-content-color: #000000;\r\n --pops-bottom-btn-controls-border-color: var(--pops-bd-color);\r\n --pops-components-is-disabled-text-color: #a8abb2;\r\n --pops-components-is-disabled-bg-color: #f5f7fa;\r\n}\r\n@media (prefers-color-scheme: dark) {\r\n .pops {\r\n --pops-mask-bg-opacity: 0.8;\r\n --pops-color: #ffffff;\r\n --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));\r\n --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));\r\n --pops-box-shadow-color: rgba(81, 81, 81, 0.12);\r\n --pops-title-color: #e8e8e8;\r\n --pops-title-border-color: var(--pops-bd-color);\r\n --pops-content-color: #e5e5e5;\r\n --pops-components-is-disabled-text-color: #a8abb2;\r\n --pops-components-is-disabled-bg-color: #262727;\r\n }\r\n}\r\n.pops {\r\n color: var(--pops-color);\r\n background-color: var(--pops-bg-color);\r\n border: 1px solid var(--pops-bd-color);\r\n border-radius: 4px;\r\n font-size: var(--pops-font-size);\r\n line-height: normal;\r\n box-shadow: 0 0 12px var(--pops-box-shadow-color);\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n transition: all 0.35s;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.pops-anim {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n.pops-anim[anim=""] {\r\n top: unset;\r\n right: unset;\r\n bottom: unset;\r\n left: unset;\r\n width: unset;\r\n height: unset;\r\n transition: none;\r\n}\r\n/* 底部图标动画和样式 */\r\n.pops i.pops-bottom-icon[is-loading="true"] {\r\n animation: rotating 2s linear infinite;\r\n}\r\n.pops i.pops-bottom-icon {\r\n height: 1em;\r\n width: 1em;\r\n line-height: normal;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n position: relative;\r\n fill: currentColor;\r\n color: inherit;\r\n font-size: inherit;\r\n}\r\n\r\n/* 遮罩层样式 */\r\n.pops-mask {\r\n --pops-mask-bg-opacity: 0.4;\r\n --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));\r\n}\r\n.pops-mask {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n border: 0;\r\n border-radius: 0;\r\n background-color: var(--pops-mask-bg-color);\r\n box-shadow: none;\r\n transition: none;\r\n}\r\n\r\n.pops-header-controls button.pops-header-control[type][data-header] {\r\n float: right;\r\n margin: 0 0;\r\n outline: 0;\r\n border: 0;\r\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\r\n background-color: transparent;\r\n color: #888;\r\n cursor: pointer;\r\n}\r\n.pops-header-controls button.pops-header-control[data-type="max"],\r\n.pops-header-controls button.pops-header-control[data-type="mise"],\r\n.pops-header-controls button.pops-header-control[data-type="min"] {\r\n outline: 0 !important;\r\n border: 0;\r\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\r\n background-color: transparent;\r\n color: rgb(136, 136, 136);\r\n cursor: pointer;\r\n transition: all 0.3s ease-in-out;\r\n}\r\nbutton.pops-header-control i {\r\n color: rgb(144, 147, 153);\r\n font-size: inherit;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n position: relative;\r\n fill: currentColor;\r\n}\r\nbutton.pops-header-control svg {\r\n height: 1.25em;\r\n width: 1.25em;\r\n}\r\nbutton.pops-header-control {\r\n right: 15px;\r\n padding: 0;\r\n border: none;\r\n outline: 0;\r\n background: 0 0;\r\n cursor: pointer;\r\n position: unset;\r\n line-height: normal;\r\n}\r\nbutton.pops-header-control i:hover {\r\n color: rgb(64, 158, 255);\r\n}\r\n.pops-header-controls[data-margin] button.pops-header-control {\r\n margin: 0 6px;\r\n display: flex;\r\n align-items: center;\r\n}\r\n.pops[type-value] .pops-header-controls {\r\n display: flex;\r\n gap: 6px;\r\n}\r\n\r\n/* 代码块 <code> */\r\n.pops code {\r\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\r\n font-size: 0.85em;\r\n color: #000;\r\n background-color: #f0f0f0;\r\n border-radius: 3px;\r\n border: 0;\r\n padding: 0.2em 0;\r\n white-space: normal;\r\n background: #f5f5f5;\r\n text-wrap: wrap;\r\n text-align: left;\r\n word-spacing: normal;\r\n word-break: normal;\r\n word-wrap: normal;\r\n line-height: 1.4;\r\n -moz-tab-size: 8;\r\n -o-tab-size: 8;\r\n tab-size: 8;\r\n -webkit-hyphens: none;\r\n -moz-hyphens: none;\r\n -ms-hyphens: none;\r\n hyphens: none;\r\n direction: ltr;\r\n}\r\n\r\n.pops code::before,\r\n.pops code::after {\r\n letter-spacing: -0.2em;\r\n content: "\\00a0";\r\n}\r\n\r\n/* 标题 */\r\n.pops .pops-title {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n border-bottom: 1px solid var(--pops-title-border-color);\r\n width: 100%;\r\n height: var(--container-title-height);\r\n}\r\n/* 标题-普通文本 */\r\n.pops .pops-title p[pops] {\r\n color: var(--pops-title-color);\r\n width: 100%;\r\n overflow: hidden;\r\n text-indent: 15px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n font-weight: 500;\r\n line-height: normal;\r\n}\r\n\r\n/* 内容 */\r\n.pops .pops-content {\r\n width: 100%;\r\n /*height: calc(\r\n 100% - var(--container-title-height) - var(--container-bottom-btn-height)\r\n );*/\r\n flex: 1;\r\n overflow: auto;\r\n word-break: break-word;\r\n}\r\n/* 内容-普通文本 */\r\n.pops .pops-content p[pops] {\r\n color: var(--pops-content-color);\r\n padding: 5px 10px;\r\n text-indent: 15px;\r\n}\r\n\r\n/* 底部-按钮组 */\r\n.pops .pops-botttom-btn-controls {\r\n display: flex;\r\n padding: 10px 10px 10px 10px;\r\n width: 100%;\r\n height: var(--container-bottom-btn-height);\r\n max-height: var(--container-bottom-btn-height);\r\n line-height: normal;\r\n border-top: 1px solid var(--pops-bottom-btn-controls-border-color);\r\n text-align: right;\r\n align-items: center;\r\n}\r\n';
var ninePalaceGridPositionCSS =
'.pops[position="top_left"] {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n}\r\n.pops[position="top"] {\r\n position: fixed;\r\n top: 0;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n.pops[position="top_right"] {\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n}\r\n.pops[position="center_left"] {\r\n position: fixed;\r\n top: 50%;\r\n left: 0;\r\n transform: translateY(-50%);\r\n}\r\n.pops[position="center"] {\r\n position: fixed;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n}\r\n.pops[position="center_right"] {\r\n position: fixed;\r\n top: 50%;\r\n right: 0;\r\n transform: translateY(-50%);\r\n}\r\n.pops[position="bottom_left"] {\r\n position: fixed;\r\n bottom: 0;\r\n left: 0;\r\n}\r\n.pops[position="bottom"] {\r\n position: fixed;\r\n bottom: 0;\r\n left: 50%;\r\n transform: translate(-50%, 0);\r\n}\r\n.pops[position="bottom_right"] {\r\n position: fixed;\r\n right: 0;\r\n bottom: 0;\r\n}\r\n';
var scrollbarCSS =
"/* ::-webkit-scrollbar 是非标准的css */\r\n/* https://caniuse.com/?search=%20%3A%3A-webkit-scrollbar */\r\n.pops ::-webkit-scrollbar {\r\n width: 6px;\r\n height: 0;\r\n}\r\n\r\n/* 滚动条轨道 */\r\n.pops ::-webkit-scrollbar-track {\r\n width: 0;\r\n}\r\n/* 滚动条滑块 */\r\n.pops ::-webkit-scrollbar-thumb {\r\n min-height: 28px;\r\n border-radius: 2em;\r\n background: rgb(204, 204, 204, var(--pops-bg-opacity, 1));\r\n background-clip: padding-box;\r\n}\r\n/* 滚动条滑块 */\r\n.pops ::-webkit-scrollbar-thumb:hover {\r\n background: rgb(178, 178, 178, var(--pops-bg-opacity, 1));\r\n}\r\n";
var buttonCSS =
'.pops {\r\n --button-font-size: 14px;\r\n --button-height: 32px;\r\n --button-color: rgb(51, 51, 51);\r\n --button-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));\r\n --button-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));\r\n --button-margin-top: 0px;\r\n --button-margin-bottom: 0px;\r\n --button-margin-left: 5px;\r\n --button-margin-right: 5px;\r\n --button-padding-top: 6px;\r\n --button-padding-bottom: 6px;\r\n --button-padding-left: 12px;\r\n --button-padding-right: 12px;\r\n --button-radius: 4px;\r\n\r\n --container-title-height: 55px;\r\n --container-bottom-btn-height: 55px;\r\n\r\n /* default按钮 */\r\n --button-default-color: #333333;\r\n --button-default-bd-color: #dcdfe6;\r\n --button-default-bg-color: #ffffff;\r\n --button-default-active-color: #409eff;\r\n --button-default-active-bd-color: #409eff;\r\n --button-default-active-bg-color: #ecf5ff;\r\n --button-default-hover-color: #409eff;\r\n --button-default-hover-bd-color: #c6e2ff;\r\n --button-default-hover-bg-color: #ecf5ff;\r\n --button-default-focus-visible-outline-color: #a0cfff;\r\n --button-default-focus-visible-outline: 2px solid var(--button-default-focus-visible-outline-color);\r\n --button-default-focus-visible-outline-offset: 1px;\r\n --button-default-disabled-color: #a8abb2;\r\n --button-default-disabled-bd-color: #ffffff;\r\n --button-default-disabled-bg-color: #e4e7ed;\r\n\r\n /* primary按钮 */\r\n --button-primary-color: #ffffff;\r\n --button-primary-bd-color: #409eff;\r\n --button-primary-bg-color: #409eff;\r\n --button-primary-active-color: #ffffff;\r\n --button-primary-active-bd-color: #337ecc;\r\n --button-primary-active-bg-color: #337ecc;\r\n --button-primary-hover-color: #ffffff;\r\n --button-primary-hover-bd-color: #79bbff;\r\n --button-primary-hover-bg-color: #79bbff;\r\n --button-primary-focus-visible-outline-color: #a0cfff;\r\n --button-primary-focus-visible-outline: 2px solid var(--button-primary-focus-visible-outline-color);\r\n --button-primary-focus-visible-outline-offset: 1px;\r\n --button-primary-disabled-color: #ffffff80;\r\n --button-primary-disabled-bd-color: #a0cfff;\r\n --button-primary-disabled-bg-color: #a0cfff;\r\n\r\n /* success按钮 */\r\n --button-success-color: #ffffff;\r\n --button-success-bd-color: #4cae4c;\r\n --button-success-bg-color: #5cb85c;\r\n --button-success-active-color: #ffffff;\r\n --button-success-active-bd-color: #529b2e;\r\n --button-success-active-bg-color: #529b2e;\r\n --button-success-hover-color: #ffffff;\r\n --button-success-hover-bd-color: #95d475;\r\n --button-success-hover-bg-color: #95d475;\r\n --button-success-focus-visible-outline-color: #b3e19d;\r\n --button-success-focus-visible-outline: 2px solid var(--button-success-focus-visible-outline-color);\r\n --button-success-focus-visible-outline-offset: 1px;\r\n --button-success-disabled-color: #ffffff80;\r\n --button-success-disabled-bd-color: #b3e19d;\r\n --button-success-disabled-bg-color: #b3e19d;\r\n\r\n /* info按钮 */\r\n --button-info-color: #ffffff;\r\n --button-info-bd-color: #909399;\r\n --button-info-bg-color: #909399;\r\n --button-info-active-color: #ffffff;\r\n --button-info-active-bd-color: #73767a;\r\n --button-info-active-bg-color: #73767a;\r\n --button-info-hover-color: #ffffff;\r\n --button-info-hover-bd-color: #b1b3b8;\r\n --button-info-hover-bg-color: #b1b3b8;\r\n --button-info-focus-visible-outline-color: #c8c9cc;\r\n --button-info-focus-visible-outline: 2px solid var(--button-info-focus-visible-outline-color);\r\n --button-info-focus-visible-outline-offset: 1px;\r\n --button-info-disabled-color: #ffffff80;\r\n --button-info-disabled-bd-color: #c8c9cc;\r\n --button-info-disabled-bg-color: #c8c9cc;\r\n\r\n /* warning按钮 */\r\n --button-warning-color: #ffffff;\r\n --button-warning-bd-color: #e6a23c;\r\n --button-warning-bg-color: #e6a23c;\r\n --button-warning-active-color: #ffffff;\r\n --button-warning-active-bd-color: #b88230;\r\n --button-warning-active-bg-color: #b88230;\r\n --button-warning-hover-color: #ffffff80;\r\n --button-warning-hover-bd-color: #eebe77;\r\n --button-warning-hover-bg-color: #eebe77;\r\n --button-warning-focus-visible-outline-color: #f3d19e;\r\n --button-warning-focus-visible-outline: 2px solid var(--button-warning-focus-visible-outline-color);\r\n --button-warning-focus-visible-outline-offset: 1px;\r\n --button-warning-disabled-color: #ffffff80;\r\n --button-warning-disabled-bd-color: #f3d19e;\r\n --button-warning-disabled-bg-color: #f3d19e;\r\n\r\n /* danger按钮 */\r\n --button-danger-color: #ffffff;\r\n --button-danger-bd-color: #f56c6c;\r\n --button-danger-bg-color: #f56c6c;\r\n --button-danger-active-color: #ffffff;\r\n --button-danger-active-bd-color: #c45656;\r\n --button-danger-active-bg-color: #c45656;\r\n --button-danger-hover-color: #ffffff;\r\n --button-danger-hover-bd-color: #f89898;\r\n --button-danger-hover-bg-color: #f89898;\r\n --button-danger-focus-visible-outline-color: #fab6b6;\r\n --button-danger-focus-visible-outline: 2px solid var(--button-danger-focus-visible-outline-color);\r\n --button-danger-focus-visible-outline-offset: 1px;\r\n --button-danger-disabled-color: #ffffff80;\r\n --button-danger-disabled-bd-color: #fab6b6;\r\n --button-danger-disabled-bg-color: #fab6b6;\r\n\r\n /* xiaomi-primary按钮 */\r\n --button-xiaomi-primary-color: #ffffff;\r\n --button-xiaomi-primary-bd-color: #ff5c00;\r\n --button-xiaomi-primary-bg-color: #ff5c00;\r\n --button-xiaomi-primary-active-color: #ffffff;\r\n --button-xiaomi-primary-active-bd-color: #da4f00;\r\n --button-xiaomi-primary-active-bg-color: #da4f00;\r\n --button-xiaomi-primary-hover-color: #ffffff;\r\n --button-xiaomi-primary-hover-bd-color: #ff7e29;\r\n --button-xiaomi-primary-hover-bg-color: #ff7e29;\r\n --button-xiaomi-primary-focus-visible-outline-color: #ffa061;\r\n --button-xiaomi-primary-focus-visible-outline: 2px solid var(--button-xiaomi-primary-focus-visible-outline-color);\r\n --button-xiaomi-primary-focus-visible-outline-offset: 1px;\r\n --button-xiaomi-primary-disabled-color: #ffffff80;\r\n --button-xiaomi-primary-disabled-bd-color: #fad5b6;\r\n --button-xiaomi-primary-disabled-bg-color: #fad5b6;\r\n\r\n /* violet按钮 */\r\n --button-violet-color: #ffffff;\r\n --button-violet-bd-color: #626aef;\r\n --button-violet-bg-color: #626aef;\r\n --button-violet-active-color: #ffffff;\r\n --button-violet-active-bd-color: #8188f2;\r\n --button-violet-active-bg-color: #8188f2;\r\n --button-violet-hover-color: #ffffff;\r\n --button-violet-hover-bd-color: #4b50ad;\r\n --button-violet-hover-bg-color: #4b50ad;\r\n --button-violet-focus-visible-outline-color: #2a598a;\r\n --button-violet-focus-visible-outline: 2px solid var(--button-violet-focus-visible-outline-color);\r\n --button-violet-focus-visible-outline-offset: 1px;\r\n --button-violet-disabled-color: #ffffff80;\r\n --button-violet-disabled-bd-color: #3b3f82;\r\n --button-violet-disabled-bg-color: #3b3f82;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n .pops {\r\n /* default按钮 */\r\n --button-default-color: #cfd3dc;\r\n --button-default-bd-color: #4c4d4f;\r\n --button-default-bg-color: transparent;\r\n --button-default-active-color: #409eff;\r\n --button-default-active-bd-color: #409eff;\r\n --button-default-active-bg-color: #18222c;\r\n --button-default-hover-color: #409eff;\r\n --button-default-hover-bd-color: #213d5b;\r\n --button-default-hover-bg-color: #18222c;\r\n --button-default-focus-visible-outline-color: #2a598a;\r\n --button-default-focus-visible-outline: 2px solid var(--button-default-focus-visible-outline-color);\r\n --button-default-focus-visible-outline-offset: 1px;\r\n --button-default-disabled-color: #ffffff80;\r\n --button-default-disabled-bd-color: #414243;\r\n --button-default-disabled-bg-color: transparent;\r\n\r\n /* primary按钮 */\r\n --button-primary-color: #ffffff;\r\n --button-primary-bd-color: #409eff;\r\n --button-primary-bg-color: #409eff;\r\n --button-primary-active-color: #ffffff;\r\n --button-primary-active-bd-color: #66b1ff;\r\n --button-primary-active-bg-color: #66b1ff;\r\n --button-primary-hover-color: #ffffff;\r\n --button-primary-hover-bd-color: #3375b9;\r\n --button-primary-hover-bg-color: #3375b9;\r\n --button-primary-focus-visible-outline-color: #2a598a;\r\n --button-primary-focus-visible-outline: 2px solid var(--button-primary-focus-visible-outline-color);\r\n --button-primary-focus-visible-outline-offset: 1px;\r\n --button-primary-disabled-color: #ffffff80;\r\n --button-primary-disabled-bd-color: #2a598a;\r\n --button-primary-disabled-bg-color: #2a598a;\r\n\r\n /* success按钮 */\r\n --button-success-color: #ffffff;\r\n --button-success-bd-color: #67c23a;\r\n --button-success-bg-color: #67c23a;\r\n --button-success-active-color: #ffffff;\r\n --button-success-active-bd-color: #85ce61;\r\n --button-success-active-bg-color: #85ce61;\r\n --button-success-hover-color: #ffffff;\r\n --button-success-hover-bd-color: #4e8e2f;\r\n --button-success-hover-bg-color: #4e8e2f;\r\n --button-success-focus-visible-outline-color: #3e6b27;\r\n --button-success-focus-visible-outline: 2px solid var(--button-success-focus-visible-outline-color);\r\n --button-success-focus-visible-outline-offset: 1px;\r\n --button-success-disabled-color: #ffffff80;\r\n --button-success-disabled-bd-color: #3e6b27;\r\n --button-success-disabled-bg-color: #3e6b27;\r\n\r\n /* info按钮 */\r\n --button-info-color: #ffffff;\r\n --button-info-bd-color: #909399;\r\n --button-info-bg-color: #909399;\r\n --button-info-active-color: #ffffff;\r\n --button-info-active-bd-color: #a6a9ad;\r\n --button-info-active-bg-color: #a6a9ad;\r\n --button-info-hover-color: #ffffff;\r\n --button-info-hover-bd-color: #6b6d71;\r\n --button-info-hover-bg-color: #6b6d71;\r\n --button-info-focus-visible-outline-color: #525457;\r\n --button-info-focus-visible-outline: 2px solid var(--button-info-focus-visible-outline-color);\r\n --button-info-focus-visible-outline-offset: 1px;\r\n --button-info-disabled-color: #ffffff80;\r\n --button-info-disabled-bd-color: #525457;\r\n --button-info-disabled-bg-color: #525457;\r\n\r\n /* warning按钮 */\r\n --button-warning-color: #ffffff;\r\n --button-warning-bd-color: #e6a23c;\r\n --button-warning-bg-color: #e6a23c;\r\n --button-warning-active-color: #ffffff;\r\n --button-warning-active-bd-color: #ebb563;\r\n --button-warning-active-bg-color: #ebb563;\r\n --button-warning-hover-color: #ffffff80;\r\n --button-warning-hover-bd-color: #a77730;\r\n --button-warning-hover-bg-color: #a77730;\r\n --button-warning-focus-visible-outline-color: #7d5b28;\r\n --button-warning-focus-visible-outline: 2px solid var(--button-warning-focus-visible-outline-color);\r\n --button-warning-focus-visible-outline-offset: 1px;\r\n --button-warning-disabled-color: #ffffff80;\r\n --button-warning-disabled-bd-color: #7d5b28;\r\n --button-warning-disabled-bg-color: #7d5b28;\r\n\r\n /* danger按钮 */\r\n --button-danger-color: #ffffff;\r\n --button-danger-bd-color: #f56c6c;\r\n --button-danger-bg-color: #f56c6c;\r\n --button-danger-active-color: #ffffff;\r\n --button-danger-active-bd-color: #f78989;\r\n --button-danger-active-bg-color: #f78989;\r\n --button-danger-hover-color: #ffffff;\r\n --button-danger-hover-bd-color: #b25252;\r\n --button-danger-hover-bg-color: #b25252;\r\n --button-danger-focus-visible-outline-color: #854040;\r\n --button-danger-focus-visible-outline: 2px solid var(--button-danger-focus-visible-outline-color);\r\n --button-danger-focus-visible-outline-offset: 1px;\r\n --button-danger-disabled-color: #ffffff80;\r\n --button-danger-disabled-bd-color: #854040;\r\n --button-danger-disabled-bg-color: #854040;\r\n }\r\n}\r\n.pops[data-bottom-btn="false"] {\r\n --container-bottom-btn-height: 0px;\r\n}\r\n.pops button {\r\n white-space: nowrap;\r\n float: right;\r\n display: inline-block;\r\n margin: var(--button-margin-top) var(--button-margin-right) var(--button-margin-bottom) var(--button-margin-left);\r\n padding: var(--button-padding-top) var(--button-padding-right) var(--button-padding-bottom) var(--button-padding-left);\r\n outline: 0;\r\n}\r\n.pops button[data-has-icon="false"] .pops-bottom-icon {\r\n display: none;\r\n}\r\n.pops button {\r\n border-radius: var(--button-radius);\r\n box-shadow: none;\r\n font-weight: 400;\r\n font-size: var(--button-font-size);\r\n cursor: pointer;\r\n transition: all 0.3s ease-in-out;\r\n}\r\n.pops button {\r\n display: flex;\r\n align-items: center;\r\n height: var(--button-height);\r\n line-height: normal;\r\n box-sizing: border-box;\r\n border: 1px solid var(--button-bd-color);\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops button {\r\n color: var(--button-color);\r\n border-color: var(--button-bd-color);\r\n background-color: var(--button-bg-color);\r\n}\r\n.pops button:active {\r\n color: var(--button-color);\r\n border-color: var(--button-bd-color);\r\n background-color: var(--button-bg-color);\r\n outline: 0;\r\n}\r\n.pops button:hover {\r\n color: var(--button-color);\r\n border-color: var(--button-bd-color);\r\n background-color: var(--button-bg-color);\r\n}\r\n.pops button:focus-visible {\r\n color: var(--button-color);\r\n border-color: var(--button-bd-color);\r\n background-color: var(--button-bg-color);\r\n}\r\n.pops button:disabled {\r\n cursor: not-allowed;\r\n color: var(--button-color);\r\n border-color: var(--button-bd-color);\r\n background-color: var(--button-bg-color);\r\n}\r\n.pops button.pops-button-large {\r\n --button-height: 32px;\r\n --button-padding-top: 12px;\r\n --button-padding-bottom: 12px;\r\n --button-padding-left: 19px;\r\n --button-padding-right: 19px;\r\n --button-font-size: 14px;\r\n --button-border-radius: 4px;\r\n}\r\n\r\n.pops button.pops-button-small {\r\n --button-height: 24px;\r\n --button-padding-top: 5px;\r\n --button-padding-bottom: 5px;\r\n --button-padding-left: 11px;\r\n --button-padding-right: 11px;\r\n --button-font-size: 12px;\r\n --button-border-radius: 4px;\r\n}\r\n.pops-panel-button-no-icon .pops-panel-button_inner i {\r\n display: none;\r\n}\r\n.pops-panel-button-right-icon .pops-panel-button_inner {\r\n flex-direction: row-reverse;\r\n}\r\n.pops-panel-button .pops-panel-button_inner i:has(svg),\r\n.pops-panel-button-right-icon .pops-panel-button-text {\r\n margin-right: 6px;\r\n}\r\n\r\n.pops button[data-type="default"] {\r\n --button-color: var(--button-default-color);\r\n --button-bd-color: var(--button-default-bd-color);\r\n --button-bg-color: var(--button-default-bg-color);\r\n}\r\n.pops button[data-type="default"]:active {\r\n --button-color: var(--button-default-active-color);\r\n --button-bd-color: var(--button-default-active-bd-color);\r\n --button-bg-color: var(--button-default-active-bg-color);\r\n}\r\n.pops button[data-type="default"]:hover {\r\n --button-color: var(--button-default-hover-color);\r\n --button-bd-color: var(--button-default-hover-bd-color);\r\n --button-bg-color: var(--button-default-hover-bg-color);\r\n}\r\n.pops button[data-type="default"]:focus-visible {\r\n outline: var(--button-default-focus-visible-outline);\r\n outline-offset: var(--button-default-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="default"]:disabled {\r\n --button-color: var(--button-default-disabled-color);\r\n --button-bd-color: var(--button-default-disabled-bd-color);\r\n --button-bg-color: var(--button-default-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="primary"] {\r\n --button-color: var(--button-primary-color);\r\n --button-bd-color: var(--button-primary-bd-color);\r\n --button-bg-color: var(--button-primary-bg-color);\r\n}\r\n.pops button[data-type="primary"]:active {\r\n --button-color: var(--button-primary-active-color);\r\n --button-bd-color: var(--button-primary-active-bd-color);\r\n --button-bg-color: var(--button-primary-active-bg-color);\r\n}\r\n.pops button[data-type="primary"]:hover {\r\n --button-color: var(--button-primary-hover-color);\r\n --button-bd-color: var(--button-primary-hover-bd-color);\r\n --button-bg-color: var(--button-primary-hover-bg-color);\r\n}\r\n.pops button[data-type="primary"]:focus-visible {\r\n outline: var(--button-primary-focus-visible-outline);\r\n outline-offset: var(--button-primary-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="primary"]:disabled {\r\n --button-color: var(--button-primary-disabled-color);\r\n --button-bd-color: var(--button-primary-disabled-bd-color);\r\n --button-bg-color: var(--button-primary-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="success"] {\r\n --button-color: var(--button-success-color);\r\n --button-bd-color: var(--button-success-bd-color);\r\n --button-bg-color: var(--button-success-bg-color);\r\n}\r\n.pops button[data-type="success"]:active {\r\n --button-color: var(--button-success-active-color);\r\n --button-bd-color: var(--button-success-active-bd-color);\r\n --button-bg-color: var(--button-success-active-bg-color);\r\n}\r\n.pops button[data-type="success"]:hover {\r\n --button-color: var(--button-success-hover-color);\r\n --button-bd-color: var(--button-success-hover-bd-color);\r\n --button-bg-color: var(--button-success-hover-bg-color);\r\n}\r\n.pops button[data-type="success"]:focus-visible {\r\n outline: var(--button-success-focus-visible-outline);\r\n outline-offset: var(--button-success-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="success"]:disabled {\r\n --button-color: var(--button-success-disabled-color);\r\n --button-bd-color: var(--button-success-disabled-bd-color);\r\n --button-bg-color: var(--button-success-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="info"] {\r\n --button-color: var(--button-info-color);\r\n --button-bd-color: var(--button-info-bd-color);\r\n --button-bg-color: var(--button-info-bg-color);\r\n}\r\n.pops button[data-type="info"]:active {\r\n --button-color: var(--button-info-active-color);\r\n --button-bd-color: var(--button-info-active-bd-color);\r\n --button-bg-color: var(--button-info-active-bg-color);\r\n}\r\n.pops button[data-type="info"]:hover {\r\n --button-color: var(--button-info-hover-color);\r\n --button-bd-color: var(--button-info-hover-bd-color);\r\n --button-bg-color: var(--button-info-hover-bg-color);\r\n}\r\n.pops button[data-type="info"]:focus-visible {\r\n outline: var(--button-info-focus-visible-outline);\r\n outline-offset: var(--button-info-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="info"]:disabled {\r\n --button-color: var(--button-info-disabled-color);\r\n --button-bd-color: var(--button-info-disabled-bd-color);\r\n --button-bg-color: var(--button-info-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="warning"] {\r\n --button-color: var(--button-warning-color);\r\n --button-bd-color: var(--button-warning-bd-color);\r\n --button-bg-color: var(--button-warning-bg-color);\r\n}\r\n.pops button[data-type="warning"]:active {\r\n --button-color: var(--button-warning-active-color);\r\n --button-bd-color: var(--button-warning-active-bd-color);\r\n --button-bg-color: var(--button-warning-active-bg-color);\r\n}\r\n.pops button[data-type="warning"]:hover {\r\n --button-color: var(--button-warning-hover-color);\r\n --button-bd-color: var(--button-warning-hover-bd-color);\r\n --button-bg-color: var(--button-warning-hover-bg-color);\r\n}\r\n.pops button[data-type="warning"]:focus-visible {\r\n outline: var(--button-warning-focus-visible-outline);\r\n outline-offset: var(--button-warning-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="warning"]:disabled {\r\n --button-color: var(--button-warning-disabled-color);\r\n --button-bd-color: var(--button-warning-disabled-bd-color);\r\n --button-bg-color: var(--button-warning-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="danger"] {\r\n --button-color: var(--button-danger-color);\r\n --button-bd-color: var(--button-danger-bd-color);\r\n --button-bg-color: var(--button-danger-bg-color);\r\n}\r\n.pops button[data-type="danger"]:active {\r\n --button-color: var(--button-danger-active-color);\r\n --button-bd-color: var(--button-danger-active-bd-color);\r\n --button-bg-color: var(--button-danger-active-bg-color);\r\n}\r\n.pops button[data-type="danger"]:hover {\r\n --button-color: var(--button-danger-hover-color);\r\n --button-bd-color: var(--button-danger-hover-bd-color);\r\n --button-bg-color: var(--button-danger-hover-bg-color);\r\n}\r\n.pops button[data-type="danger"]:focus-visible {\r\n outline: var(--button-danger-focus-visible-outline);\r\n outline-offset: var(--button-danger-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="danger"]:disabled {\r\n --button-color: var(--button-danger-disabled-color);\r\n --button-bd-color: var(--button-danger-disabled-bd-color);\r\n --button-bg-color: var(--button-danger-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="xiaomi-primary"] {\r\n --button-color: var(--button-xiaomi-primary-color);\r\n --button-bd-color: var(--button-xiaomi-primary-bd-color);\r\n --button-bg-color: var(--button-xiaomi-primary-bg-color);\r\n}\r\n.pops button[data-type="xiaomi-primary"]:active {\r\n --button-color: var(--button-xiaomi-primary-active-color);\r\n --button-bd-color: var(--button-xiaomi-primary-active-bd-color);\r\n --button-bg-color: var(--button-xiaomi-primary-active-bg-color);\r\n}\r\n.pops button[data-type="xiaomi-primary"]:hover {\r\n --button-color: var(--button-xiaomi-primary-hover-color);\r\n --button-bd-color: var(--button-xiaomi-primary-hover-bd-color);\r\n --button-bg-color: var(--button-xiaomi-primary-hover-bg-color);\r\n}\r\n.pops button[data-type="xiaomi-primary"]:focus-visible {\r\n outline: var(--button-xiaomi-primary-focus-visible-outline);\r\n outline-offset: var(--button-xiaomi-primary-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="xiaomi-primary"]:disabled {\r\n --button-color: var(--button-xiaomi-primary-disabled-color);\r\n --button-bd-color: var(--button-xiaomi-primary-disabled-bd-color);\r\n --button-bg-color: var(--button-xiaomi-primary-disabled-bg-color);\r\n}\r\n\r\n.pops button[data-type="violet"] {\r\n --button-color: var(--button-violet-color);\r\n --button-bd-color: var(--button-violet-bd-color);\r\n --button-bg-color: var(--button-violet-bg-color);\r\n}\r\n.pops button[data-type="violet"]:active {\r\n --button-color: var(--button-violet-active-color);\r\n --button-bd-color: var(--button-violet-active-bd-color);\r\n --button-bg-color: var(--button-violet-active-bg-color);\r\n}\r\n.pops button[data-type="violet"]:hover {\r\n --button-color: var(--button-violet-hover-color);\r\n --button-bd-color: var(--button-violet-hover-bd-color);\r\n --button-bg-color: var(--button-violet-hover-bg-color);\r\n}\r\n.pops button[data-type="violet"]:focus-visible {\r\n outline: var(--button-violet-focus-visible-outline);\r\n outline-offset: var(--button-violet-focus-visible-outline-offset);\r\n}\r\n.pops button[data-type="violet"]:disabled {\r\n --button-color: var(--button-violet-disabled-color);\r\n --button-bd-color: var(--button-violet-disabled-bd-color);\r\n --button-bg-color: var(--button-violet-disabled-bg-color);\r\n}\r\n';
var commonCSS =
".pops-flex-items-center {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.pops-flex-y-center {\r\n display: flex;\r\n justify-content: space-between;\r\n}\r\n.pops-flex-x-center {\r\n display: flex;\r\n align-content: center;\r\n}\r\n.pops-hide {\r\n display: none;\r\n}\r\n.pops-hide-important {\r\n display: none !important;\r\n}\r\n.pops-no-border {\r\n border: 0;\r\n}\r\n.pops-no-border-important {\r\n border: 0 !important;\r\n}\r\n.pops-user-select-none {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops-line-height-center {\r\n line-height: normal;\r\n align-content: center;\r\n}\r\n.pops-width-fill {\r\n width: -webkit-fill-available;\r\n width: -moz-available;\r\n}\r\n.pops-text-is-disabled {\r\n --pops-text-is-disabled-color: #a8abb2;\r\n color: var(--pops-text-is-disabled-color);\r\n --pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color);\r\n}\r\n.pops-text-is-disabled-important {\r\n --pops-text-is-disabled-color: #a8abb2;\r\n color: var(--pops-text-is-disabled-color) !important;\r\n --pops-panel-forms-container-item-left-desc-text-color: var(--pops-text-is-disabled-color) !important;\r\n}\r\n";
var animCSS =
'@keyframes rotating {\r\n 0% {\r\n transform: rotate(0);\r\n }\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n@keyframes iframeLoadingChange_85 {\r\n 0% {\r\n background: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));\r\n }\r\n 20% {\r\n background: linear-gradient(to right, #4995dd, #ead0d0, rgb(123 185 246));\r\n }\r\n 40% {\r\n background: linear-gradient(to right, #4995dd, #f4b7b7, rgb(112 178 244));\r\n }\r\n 60% {\r\n background: linear-gradient(to right, #4995dd, #ec9393, rgb(80 163 246));\r\n }\r\n 80% {\r\n background: linear-gradient(to right, #4995dd, #e87f7f, rgb(25 139 253));\r\n }\r\n 100% {\r\n background: linear-gradient(to right, #4995dd, #ee2c2c, rgb(0 124 247));\r\n }\r\n from {\r\n width: 75%;\r\n }\r\n to {\r\n width: 100%;\r\n }\r\n}\r\n@keyframes iframeLoadingChange {\r\n 0% {\r\n background: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));\r\n }\r\n 20% {\r\n background: linear-gradient(to right, #4995dd, #ead0d0, rgb(123 185 246));\r\n }\r\n 40% {\r\n background: linear-gradient(to right, #4995dd, #f4b7b7, rgb(112 178 244));\r\n }\r\n 60% {\r\n background: linear-gradient(to right, #4995dd, #ec9393, rgb(80 163 246));\r\n }\r\n 80% {\r\n background: linear-gradient(to right, #4995dd, #e87f7f, rgb(25 139 253));\r\n }\r\n 100% {\r\n background: linear-gradient(to right, #4995dd, #ee2c2c, rgb(0 124 247));\r\n }\r\n from {\r\n width: 0;\r\n }\r\n to {\r\n width: 75%;\r\n }\r\n}\r\n\r\n@keyframes searchSelectFalIn {\r\n from {\r\n opacity: 0;\r\n display: none;\r\n }\r\n to {\r\n display: block;\r\n opacity: 1;\r\n }\r\n}\r\n@keyframes searchSelectFalOut {\r\n from {\r\n display: block;\r\n opacity: 1;\r\n }\r\n to {\r\n opacity: 0;\r\n display: none;\r\n }\r\n}\r\n\r\n@keyframes pops-anim-wait-rotate {\r\n form {\r\n transform: rotate(0);\r\n }\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n@keyframes pops-anim-spread {\r\n 0% {\r\n opacity: 0;\r\n transform: scaleX(0);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: scaleX(1);\r\n }\r\n}\r\n@keyframes pops-anim-shake {\r\n 0%,\r\n 100% {\r\n transform: translateX(0);\r\n }\r\n 10%,\r\n 30%,\r\n 50%,\r\n 70%,\r\n 90% {\r\n transform: translateX(-10px);\r\n }\r\n 20%,\r\n 40%,\r\n 60%,\r\n 80% {\r\n transform: translateX(10px);\r\n }\r\n}\r\n@keyframes pops-anim-rolling-left {\r\n 0% {\r\n opacity: 0;\r\n transform: translateX(-100%) rotate(-120deg);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0) rotate(0);\r\n }\r\n}\r\n@keyframes pops-anim-rolling-right {\r\n 0% {\r\n opacity: 0;\r\n transform: translateX(100%) rotate(120deg);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0) rotate(0);\r\n }\r\n}\r\n@keyframes pops-anim-slide-top {\r\n 0% {\r\n opacity: 0;\r\n transform: translateY(-200%);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n}\r\n@keyframes pops-anim-slide-bottom {\r\n 0% {\r\n opacity: 0;\r\n transform: translateY(200%);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n}\r\n@keyframes pops-anim-slide-left {\r\n 0% {\r\n opacity: 0;\r\n transform: translateX(-200%);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-anim-slide-right {\r\n 0% {\r\n transform: translateX(200%);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-anim-fadein {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n}\r\n@keyframes pops-anim-fadein-zoom {\r\n 0% {\r\n opacity: 0;\r\n transform: scale(0.5);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n}\r\n@keyframes pops-anim-fadein-alert {\r\n 0% {\r\n transform: scale(0.5);\r\n }\r\n 45% {\r\n transform: scale(1.05);\r\n }\r\n 80% {\r\n transform: scale(0.95);\r\n }\r\n 100% {\r\n transform: scale(1);\r\n }\r\n}\r\n@keyframes pops-anim-don {\r\n 0% {\r\n opacity: 0;\r\n transform: matrix3d(0.7, 0, 0, 0, 0, 0.7, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 2.08333% {\r\n transform: matrix3d(0.75266, 0, 0, 0, 0, 0.76342, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 4.16667% {\r\n transform: matrix3d(0.81071, 0, 0, 0, 0, 0.84545, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 6.25% {\r\n transform: matrix3d(0.86808, 0, 0, 0, 0, 0.9286, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 8.33333% {\r\n transform: matrix3d(0.92038, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 10.4167% {\r\n transform: matrix3d(0.96482, 0, 0, 0, 0, 1.05202, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 12.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 1.08204, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 14.5833% {\r\n transform: matrix3d(1.02563, 0, 0, 0, 0, 1.09149, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 16.6667% {\r\n transform: matrix3d(1.04227, 0, 0, 0, 0, 1.08453, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 18.75% {\r\n transform: matrix3d(1.05102, 0, 0, 0, 0, 1.06666, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 20.8333% {\r\n transform: matrix3d(1.05334, 0, 0, 0, 0, 1.04355, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 22.9167% {\r\n transform: matrix3d(1.05078, 0, 0, 0, 0, 1.02012, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 25% {\r\n transform: matrix3d(1.04487, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 27.0833% {\r\n transform: matrix3d(1.03699, 0, 0, 0, 0, 0.98534, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 29.1667% {\r\n transform: matrix3d(1.02831, 0, 0, 0, 0, 0.97688, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 31.25% {\r\n transform: matrix3d(1.01973, 0, 0, 0, 0, 0.97422, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 33.3333% {\r\n transform: matrix3d(1.01191, 0, 0, 0, 0, 0.97618, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 35.4167% {\r\n transform: matrix3d(1.00526, 0, 0, 0, 0, 0.98122, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 37.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 0.98773, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 39.5833% {\r\n transform: matrix3d(0.99617, 0, 0, 0, 0, 0.99433, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 41.6667% {\r\n transform: matrix3d(0.99368, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 43.75% {\r\n transform: matrix3d(0.99237, 0, 0, 0, 0, 1.00413, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 45.8333% {\r\n transform: matrix3d(0.99202, 0, 0, 0, 0, 1.00651, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 47.9167% {\r\n transform: matrix3d(0.99241, 0, 0, 0, 0, 1.00726, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 50% {\r\n opacity: 1;\r\n transform: matrix3d(0.99329, 0, 0, 0, 0, 1.00671, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 52.0833% {\r\n transform: matrix3d(0.99447, 0, 0, 0, 0, 1.00529, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 54.1667% {\r\n transform: matrix3d(0.99577, 0, 0, 0, 0, 1.00346, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 56.25% {\r\n transform: matrix3d(0.99705, 0, 0, 0, 0, 1.0016, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 58.3333% {\r\n transform: matrix3d(0.99822, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 60.4167% {\r\n transform: matrix3d(0.99921, 0, 0, 0, 0, 0.99884, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 62.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 0.99816, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 64.5833% {\r\n transform: matrix3d(1.00057, 0, 0, 0, 0, 0.99795, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 66.6667% {\r\n transform: matrix3d(1.00095, 0, 0, 0, 0, 0.99811, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 68.75% {\r\n transform: matrix3d(1.00114, 0, 0, 0, 0, 0.99851, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 70.8333% {\r\n transform: matrix3d(1.00119, 0, 0, 0, 0, 0.99903, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 72.9167% {\r\n transform: matrix3d(1.00114, 0, 0, 0, 0, 0.99955, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 75% {\r\n transform: matrix3d(1.001, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 77.0833% {\r\n transform: matrix3d(1.00083, 0, 0, 0, 0, 1.00033, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 79.1667% {\r\n transform: matrix3d(1.00063, 0, 0, 0, 0, 1.00052, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 81.25% {\r\n transform: matrix3d(1.00044, 0, 0, 0, 0, 1.00058, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 83.3333% {\r\n transform: matrix3d(1.00027, 0, 0, 0, 0, 1.00053, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 85.4167% {\r\n transform: matrix3d(1.00012, 0, 0, 0, 0, 1.00042, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 87.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 1.00027, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 89.5833% {\r\n transform: matrix3d(0.99991, 0, 0, 0, 0, 1.00013, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 91.6667% {\r\n transform: matrix3d(0.99986, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 93.75% {\r\n transform: matrix3d(0.99983, 0, 0, 0, 0, 0.99991, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 95.8333% {\r\n transform: matrix3d(0.99982, 0, 0, 0, 0, 0.99985, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 97.9167% {\r\n transform: matrix3d(0.99983, 0, 0, 0, 0, 0.99984, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n}\r\n@keyframes pops-anim-roll {\r\n 0% {\r\n transform: perspective(1000px) rotate3d(1, 0, 0, 90deg);\r\n }\r\n 100% {\r\n transform: perspective(1000px) rotate3d(1, 0, 0, 0deg);\r\n }\r\n}\r\n@keyframes pops-anim-sandra {\r\n 0% {\r\n opacity: 0;\r\n transform: scale3d(1.1, 1.1, 1);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: scale3d(1, 1, 1);\r\n }\r\n}\r\n@keyframes pops-anim-gather {\r\n 0% {\r\n opacity: 0;\r\n transform: scale(5, 0);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: scale(1, 1);\r\n }\r\n}\r\n@keyframes pops-anim-spread-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: scaleX(1);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: scaleX(0);\r\n }\r\n}\r\n@keyframes pops-anim-shake-reverse {\r\n 0%,\r\n 100% {\r\n transform: translateX(10px);\r\n }\r\n 10%,\r\n 30%,\r\n 50%,\r\n 70%,\r\n 90% {\r\n transform: translateX(-10px);\r\n }\r\n 20%,\r\n 40%,\r\n 60%,\r\n 80% {\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-anim-rolling-left-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateX(0) rotate(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateX(-100%) rotate(-120deg);\r\n }\r\n}\r\n@keyframes pops-anim-rolling-right-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateX(0) rotate(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateX(100%) rotate(120deg);\r\n }\r\n}\r\n@keyframes pops-anim-slide-top-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateY(-200%);\r\n }\r\n}\r\n@keyframes pops-anim-slide-bottom-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateY(200%);\r\n }\r\n}\r\n@keyframes pops-anim-slide-left-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateX(-200%);\r\n }\r\n}\r\n@keyframes pops-anim-slide-right-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n }\r\n 100% {\r\n transform: translateX(200%);\r\n }\r\n}\r\n@keyframes pops-anim-fadein-reverse {\r\n 0% {\r\n opacity: 1;\r\n }\r\n 100% {\r\n opacity: 0;\r\n }\r\n}\r\n@keyframes pops-anim-fadein-zoom-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: scale(0.5);\r\n }\r\n}\r\n@keyframes pops-anim-fadein-alert-reverse {\r\n 0% {\r\n transform: scale(1);\r\n }\r\n 45% {\r\n transform: scale(0.95);\r\n }\r\n 80% {\r\n transform: scale(1.05);\r\n }\r\n 100% {\r\n transform: scale(0.5);\r\n }\r\n}\r\n@keyframes pops-anim-don-reverse {\r\n 100% {\r\n opacity: 0;\r\n transform: matrix3d(0.7, 0, 0, 0, 0, 0.7, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 97.9167% {\r\n transform: matrix3d(0.75266, 0, 0, 0, 0, 0.76342, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 95.8333% {\r\n transform: matrix3d(0.81071, 0, 0, 0, 0, 0.84545, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 93.75% {\r\n transform: matrix3d(0.86808, 0, 0, 0, 0, 0.9286, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 91.6667% {\r\n transform: matrix3d(0.92038, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 89.5833% {\r\n transform: matrix3d(0.96482, 0, 0, 0, 0, 1.05202, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 87.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 1.08204, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 85.4167% {\r\n transform: matrix3d(1.02563, 0, 0, 0, 0, 1.09149, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 83.3333% {\r\n transform: matrix3d(1.04227, 0, 0, 0, 0, 1.08453, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 81.25% {\r\n transform: matrix3d(1.05102, 0, 0, 0, 0, 1.06666, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 79.1667% {\r\n transform: matrix3d(1.05334, 0, 0, 0, 0, 1.04355, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 77.0833% {\r\n transform: matrix3d(1.05078, 0, 0, 0, 0, 1.02012, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 75% {\r\n transform: matrix3d(1.04487, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 72.9167% {\r\n transform: matrix3d(1.03699, 0, 0, 0, 0, 0.98534, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 70.8333% {\r\n transform: matrix3d(1.02831, 0, 0, 0, 0, 0.97688, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 68.75% {\r\n transform: matrix3d(1.01973, 0, 0, 0, 0, 0.97422, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 66.6667% {\r\n transform: matrix3d(1.01191, 0, 0, 0, 0, 0.97618, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 64.5833% {\r\n transform: matrix3d(1.00526, 0, 0, 0, 0, 0.98122, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 62.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 0.98773, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 60.4167% {\r\n transform: matrix3d(0.99617, 0, 0, 0, 0, 0.99433, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 58.3333% {\r\n transform: matrix3d(0.99368, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 56.25% {\r\n transform: matrix3d(0.99237, 0, 0, 0, 0, 1.00413, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 54.1667% {\r\n transform: matrix3d(0.99202, 0, 0, 0, 0, 1.00651, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 52.0833% {\r\n transform: matrix3d(0.99241, 0, 0, 0, 0, 1.00726, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 50% {\r\n opacity: 1;\r\n transform: matrix3d(0.99329, 0, 0, 0, 0, 1.00671, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 47.9167% {\r\n transform: matrix3d(0.99447, 0, 0, 0, 0, 1.00529, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 45.8333% {\r\n transform: matrix3d(0.99577, 0, 0, 0, 0, 1.00346, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 43.75% {\r\n transform: matrix3d(0.99705, 0, 0, 0, 0, 1.0016, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 41.6667% {\r\n transform: matrix3d(0.99822, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 39.5833% {\r\n transform: matrix3d(0.99921, 0, 0, 0, 0, 0.99884, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 37.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 0.99816, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 35.4167% {\r\n transform: matrix3d(1.00057, 0, 0, 0, 0, 0.99795, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 33.3333% {\r\n transform: matrix3d(1.00095, 0, 0, 0, 0, 0.99811, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 31.25% {\r\n transform: matrix3d(1.00114, 0, 0, 0, 0, 0.99851, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 29.1667% {\r\n transform: matrix3d(1.00119, 0, 0, 0, 0, 0.99903, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 27.0833% {\r\n transform: matrix3d(1.00114, 0, 0, 0, 0, 0.99955, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 25% {\r\n transform: matrix3d(1.001, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 22.9167% {\r\n transform: matrix3d(1.00083, 0, 0, 0, 0, 1.00033, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 20.8333% {\r\n transform: matrix3d(1.00063, 0, 0, 0, 0, 1.00052, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 18.75% {\r\n transform: matrix3d(1.00044, 0, 0, 0, 0, 1.00058, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 16.6667% {\r\n transform: matrix3d(1.00027, 0, 0, 0, 0, 1.00053, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 14.5833% {\r\n transform: matrix3d(1.00012, 0, 0, 0, 0, 1.00042, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 12.5% {\r\n transform: matrix3d(1, 0, 0, 0, 0, 1.00027, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 10.4167% {\r\n transform: matrix3d(0.99991, 0, 0, 0, 0, 1.00013, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 8.33333% {\r\n transform: matrix3d(0.99986, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 6.25% {\r\n transform: matrix3d(0.99983, 0, 0, 0, 0, 0.99991, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 4.16667% {\r\n transform: matrix3d(0.99982, 0, 0, 0, 0, 0.99985, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 2.08333% {\r\n transform: matrix3d(0.99983, 0, 0, 0, 0, 0.99984, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n 0% {\r\n opacity: 1;\r\n transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n}\r\n@keyframes pops-anim-roll-reverse {\r\n 0% {\r\n transform: perspective(1000px) rotate3d(1, 0, 0, 0deg);\r\n }\r\n 100% {\r\n transform: perspective(1000px) rotate3d(1, 0, 0, 90deg);\r\n }\r\n}\r\n@keyframes pops-anim-sandra-reverse {\r\n 0% {\r\n opacity: 1;\r\n transform: scale3d(1, 1, 1);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: scale3d(1.1, 1.1, 1);\r\n }\r\n}\r\n@keyframes pops-anim-gather-reverse {\r\n 0% {\r\n opacity: 0;\r\n transform: scale(5, 0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: scale(5, 0);\r\n }\r\n}\r\n\r\n@-webkit-keyframes pops-motion-fadeInTop {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateY(-30px);\r\n transform: translateY(-30px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-motion-fadeInTop {\r\n 0% {\r\n opacity: 0;\r\n transform: translateY(-30px);\r\n -ms-transform: translateY(-30px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: translateX(0);\r\n -ms-transform: translateX(0);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeOutTop {\r\n 0% {\r\n opacity: 10;\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateY(-30px);\r\n transform: translateY(-30px);\r\n }\r\n}\r\n@keyframes pops-motion-fadeOutTop {\r\n 0% {\r\n opacity: 1;\r\n transform: translateY(0);\r\n -ms-transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: translateY(-30px);\r\n -ms-transform: translateY(-30px);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeInBottom {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateY(20px);\r\n transform: translateY(20px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n }\r\n}\r\n@keyframes pops-motion-fadeInBottom {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateY(20px);\r\n transform: translateY(20px);\r\n -ms-transform: translateY(20px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n -ms-transform: translateY(0);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeOutBottom {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateY(20px);\r\n transform: translateY(20px);\r\n }\r\n}\r\n@keyframes pops-motion-fadeOutBottom {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n -ms-transform: translateY(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateY(20px);\r\n transform: translateY(20px);\r\n -ms-transform: translateY(20px);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeInLeft {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateX(-20px);\r\n transform: translateX(-20px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-motion-fadeInLeft {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateX(-30px);\r\n transform: translateX(-30px);\r\n -ms-transform: translateX(-30px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n -ms-transform: translateX(0);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeOutLeft {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateX(-30px);\r\n transform: translateX(-30px);\r\n }\r\n}\r\n@keyframes pops-motion-fadeOutLeft {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n -ms-transform: translateX(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateX(-20px);\r\n transform: translateX(-20px);\r\n -ms-transform: translateX(-20px);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeInRight {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateX(20px);\r\n transform: translateX(20px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n }\r\n}\r\n@keyframes pops-motion-fadeInRight {\r\n 0% {\r\n opacity: 0;\r\n -webkit-transform: translateX(20px);\r\n transform: translateX(20px);\r\n -ms-transform: translateX(20px);\r\n }\r\n 100% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n -ms-transform: translateX(0);\r\n }\r\n}\r\n@-webkit-keyframes pops-motion-fadeOutRight {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateX(20px);\r\n transform: translateX(20px);\r\n }\r\n}\r\n@keyframes pops-motion-fadeOutRight {\r\n 0% {\r\n opacity: 1;\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n -ms-transform: translateX(0);\r\n }\r\n 100% {\r\n opacity: 0;\r\n -webkit-transform: translateX(20px);\r\n transform: translateX(20px);\r\n -ms-transform: translateX(20px);\r\n }\r\n}\r\n\r\n/* 动画 */\r\n.pops-anim[anim="pops-anim-spread"] {\r\n animation: pops-anim-spread 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-shake"] {\r\n animation: pops-anim-shake 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-rolling-left"] {\r\n animation: pops-anim-rolling-left 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-rolling-right"] {\r\n animation: pops-anim-rolling-right 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-top"] {\r\n animation: pops-anim-slide-top 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-bottom"] {\r\n animation: pops-anim-slide-bottom 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-left"] {\r\n animation: pops-anim-slide-left 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-right"] {\r\n animation: pops-anim-slide-right 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein"] {\r\n animation: pops-anim-fadein 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein-zoom"] {\r\n animation: pops-anim-fadein-zoom 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein-alert"] {\r\n animation: pops-anim-fadein-alert 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-don"] {\r\n animation: pops-anim-don 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-roll"] {\r\n animation: pops-anim-roll 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-sandra"] {\r\n animation: pops-anim-sandra 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-gather"] {\r\n animation: pops-anim-gather 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-spread-reverse"] {\r\n animation: pops-anim-spread-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-shake-reverse"] {\r\n animation: pops-anim-shake-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-rolling-left-reverse"] {\r\n animation: pops-anim-rolling-left-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-rolling-right-reverse"] {\r\n animation: pops-anim-rolling-right-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-top-reverse"] {\r\n animation: pops-anim-slide-top-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-bottom-reverse"] {\r\n animation: pops-anim-slide-bottom-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-left-reverse"] {\r\n animation: pops-anim-slide-left-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-slide-right-reverse"] {\r\n animation: pops-anim-slide-right-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein-reverse"] {\r\n animation: pops-anim-fadein-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein-zoom-reverse"] {\r\n animation: pops-anim-fadein-zoom-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-fadein-alert-reverse"] {\r\n animation: pops-anim-fadein-alert-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-don-reverse"] {\r\n animation: pops-anim-don-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-roll-reverse"] {\r\n animation: pops-anim-roll-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-sandra-reverse"] {\r\n animation: pops-anim-sandra-reverse 0.3s;\r\n}\r\n.pops-anim[anim="pops-anim-gather-reverse"] {\r\n animation: pops-anim-gather-reverse 0.3s;\r\n}\r\n';
var alertCSS = "";
var confirmCSS = "";
var promptCSS =
'.pops[type-value="prompt"] {\r\n --input-color: #000000;\r\n --input-bg-color: none;\r\n --input-placeholder-color: #a1a4ac;\r\n}\r\n.pops[type-value="prompt"] input[pops],\r\n.pops[type-value="prompt"] textarea[pops] {\r\n width: 100%;\r\n height: 100%;\r\n outline: 0;\r\n border: 0;\r\n color: var(--input-color);\r\n background-color: var(--input-bg-color);\r\n}\r\n\r\n.pops[type-value="prompt"] input[pops] {\r\n padding: 5px 10px;\r\n}\r\n.pops[type-value="prompt"] textarea[pops] {\r\n padding: 5px 10px;\r\n resize: none;\r\n}\r\n\r\n.pops[type-value="prompt"] input[pops]::placeholder,\r\n.pops[type-value="prompt"] textarea[pops]::placeholder {\r\n color: var(--input-placeholder-color);\r\n}\r\n@media (prefers-color-scheme: dark) {\r\n .pops[type-value="prompt"] {\r\n --input-color: #ffffff;\r\n --input-bg-color: #333333;\r\n --input-placeholder-color: #8d9095;\r\n }\r\n}\r\n';
var loadingCSS =
'.pops[type-value="loading"] {\r\n --loading-bd-color: rgba(0, 0, 0, 0.2);\r\n --loading-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --loading-box-shadow-color: rgb(0 0 0 / 50%);\r\n --loading-icon-color: rgba(100, 149, 237, 0.1);\r\n --loading-icon-bd-top-color: rgb(100, 149, 237, var(--pops-bd-opacity));\r\n}\r\n.pops[type-value="loading"] {\r\n position: absolute;\r\n top: 272.5px;\r\n top: 50%;\r\n left: 26px;\r\n left: 50%;\r\n display: flex;\r\n overflow: hidden;\r\n padding: 10px 15px;\r\n max-width: 100%;\r\n max-height: 100%;\r\n min-width: 0;\r\n min-height: 0;\r\n border: 1px solid var(--loading-bd-color);\r\n border-radius: 5px;\r\n background-color: var(--loading-bg-color);\r\n box-shadow: 0 0 5px var(--loading-box-shadow-color);\r\n vertical-align: middle;\r\n transition: all 0.35s;\r\n transform: translate(-50%, -50%);\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n align-content: center;\r\n}\r\n.pops[type-value="loading"]:before {\r\n float: left;\r\n display: inline-block;\r\n width: 2em;\r\n height: 2em;\r\n border: 0.3em solid var(--loading-icon-color);\r\n border-top: 0.3em solid var(--loading-icon-bd-top-color);\r\n border-radius: 50%;\r\n content: " ";\r\n vertical-align: middle;\r\n font-size: inherit;\r\n animation: pops-anim-wait-rotate 1.2s linear infinite;\r\n}\r\n.pops[type-value="loading"] .pops-loading-content {\r\n position: static;\r\n top: 0;\r\n bottom: 0;\r\n float: left;\r\n overflow: hidden;\r\n width: auto;\r\n font-size: inherit;\r\n line-height: normal;\r\n align-content: center;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n .pops[type-value="loading"] {\r\n --loading-bg-color: #222222;\r\n }\r\n}\r\n';
var iframeCSS =
'.pops[type-value="iframe"] {\r\n --container-title-height: 55px;\r\n transition:\r\n width 0.35s ease,\r\n height 0.35s ease;\r\n}\r\n.pops[type-value="iframe"] .pops-content {\r\n overflow: hidden;\r\n}\r\n.pops-loading {\r\n position: absolute;\r\n top: 40px;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n z-index: 5;\r\n background-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n}\r\n.pops-loading:before {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n z-index: 3;\r\n display: block;\r\n margin: -20px 0 0 -20px;\r\n padding: 20px;\r\n border: 4px solid rgb(221, 221, 221, var(--pops-bd-opacity));\r\n border-radius: 50%;\r\n content: "";\r\n border-top-color: transparent;\r\n animation: pops-anim-wait-rotate 1.2s linear infinite;\r\n}\r\n.pops[type-value="iframe"].pops[type-module="min"] {\r\n bottom: 0;\r\n max-width: 200px;\r\n max-height: 53px;\r\n position: unset;\r\n}\r\n.pops[type-value="iframe"].pops[type-module="min"] .pops-header-control[data-type="min"] {\r\n display: none;\r\n}\r\n.pops[type-value="iframe"].pops-iframe-unset-top {\r\n top: unset !important;\r\n}\r\n.pops[type-value="iframe"].pops-iframe-unset-left {\r\n left: unset !important;\r\n}\r\n.pops[type-value="iframe"].pops-iframe-unset-transform {\r\n transform: none !important;\r\n}\r\n.pops[type-value="iframe"].pops-iframe-unset-transition {\r\n transition: none !important;\r\n}\r\n.pops[type-value="iframe"].pops[type-module="max"] {\r\n width: 100% !important;\r\n height: 100% !important;\r\n}\r\n.pops[type-value="iframe"] iframe[pops] {\r\n width: 100%;\r\n height: 100%;\r\n border: 0;\r\n}\r\n.pops-iframe-content-global-loading {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n z-index: 999999;\r\n width: 0;\r\n height: 4px;\r\n background: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));\r\n animation: iframeLoadingChange 2s forwards;\r\n}\r\n\r\n.pops-anim:has(.pops[type-value="iframe"].pops[type-module="min"]) {\r\n position: unset;\r\n}\r\n';
var tooltipCSS =
'.pops-tip {\r\n --pops-bg-opacity: 1;\r\n --tooltip-color: #4e4e4e;\r\n --tooltip-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --tooltip-bd-radius: 2px;\r\n --tooltip-box-shadow-left-color: rgba(0, 0, 0, 0.24);\r\n --tooltip-box-shadow-right-color: rgba(0, 0, 0, 0.12);\r\n --tooltip-font-size: 14px;\r\n --tooltip-padding-top: 13px;\r\n --tooltip-padding-right: 13px;\r\n --tooltip-padding-bottom: 13px;\r\n --tooltip-padding-left: 13px;\r\n\r\n --tooltip-arrow-box-shadow-left-color: rgba(0, 0, 0, 0.24);\r\n --tooltip-arrow-box-shadow-right-color: rgba(0, 0, 0, 0.12);\r\n --tooltip-arrow--after-color: rgb(78, 78, 78);\r\n --tooltip-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --tooltip-arrow--after-width: 12px;\r\n --tooltip-arrow--after-height: 12px;\r\n}\r\n.pops-tip {\r\n padding: var(--tooltip-padding-top) var(--tooltip-padding-right) var(--tooltip-padding-bottom)\r\n var(--tooltip-padding-left);\r\n max-width: 400px;\r\n max-height: 300px;\r\n border-radius: var(--tooltip-bd-radius);\r\n background-color: var(--tooltip-bg-color);\r\n box-shadow:\r\n 0 1.5px 4px var(--tooltip-box-shadow-left-color),\r\n 0 1.5px 6px var(--tooltip-box-shadow-right-color);\r\n color: var(--tooltip-color);\r\n font-size: var(--tooltip-font-size);\r\n}\r\n.pops-tip[data-position="absolute"] {\r\n position: absolute;\r\n}\r\n.pops-tip[data-position="fixed"] {\r\n position: fixed;\r\n}\r\n\r\n.pops-tip .pops-tip-arrow {\r\n position: absolute;\r\n top: 100%;\r\n left: 50%;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 12.5px;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow::after {\r\n position: absolute;\r\n top: 0;\r\n left: 50%;\r\n width: var(--tooltip-arrow--after-width);\r\n height: var(--tooltip-arrow--after-height);\r\n background: var(--tooltip-arrow--after-bg-color);\r\n color: var(--tooltip-arrow--after-color);\r\n box-shadow:\r\n 0 1px 7px var(--tooltip-arrow-box-shadow-left-color),\r\n 0 1px 7px var(--tooltip-arrow-box-shadow-right-color);\r\n content: "";\r\n transform: translateX(-50%) translateY(-50%) rotate(45deg);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="bottom"] {\r\n position: absolute;\r\n top: 100%;\r\n left: 50%;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 12.5px;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="bottom"]:after {\r\n position: absolute;\r\n top: 0;\r\n left: 50%;\r\n width: var(--tooltip-arrow--after-width);\r\n height: var(--tooltip-arrow--after-height);\r\n background: var(--tooltip-arrow--after-bg-color);\r\n box-shadow:\r\n 0 1px 7px var(--tooltip-arrow-box-shadow-left-color),\r\n 0 1px 7px var(--tooltip-arrow-box-shadow-right-color);\r\n content: "";\r\n transform: translateX(-50%) translateY(-50%) rotate(45deg);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="left"] {\r\n top: 50%;\r\n left: -12.5px;\r\n width: 12.5px;\r\n height: 50px;\r\n transform: translateY(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="left"]:after {\r\n position: absolute;\r\n top: 50%;\r\n left: 100%;\r\n content: "";\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="right"] {\r\n top: 50%;\r\n right: -12.5px;\r\n left: auto;\r\n width: 12.5px;\r\n height: 50px;\r\n transform: translateY(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="right"]:after {\r\n position: absolute;\r\n top: 50%;\r\n left: 0;\r\n content: "";\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="top"] {\r\n top: -12.5px;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position="top"]:after {\r\n position: absolute;\r\n top: 100%;\r\n left: 50%;\r\n content: "";\r\n}\r\n\r\n.pops-tip[data-motion] {\r\n -webkit-animation-duration: 0.25s;\r\n animation-duration: 0.25s;\r\n -webkit-animation-fill-mode: forwards;\r\n animation-fill-mode: forwards;\r\n}\r\n.pops-tip[data-motion="fadeOutRight"] {\r\n -webkit-animation-name: pops-motion-fadeOutRight;\r\n animation-name: pops-motion-fadeOutRight;\r\n}\r\n.pops-tip[data-motion="fadeInTop"] {\r\n -webkit-animation-name: pops-motion-fadeInTop;\r\n animation-name: pops-motion-fadeInTop;\r\n animation-timing-function: cubic-bezier(0.49, 0.49, 0.13, 1.3);\r\n}\r\n.pops-tip[data-motion="fadeOutTop"] {\r\n -webkit-animation-name: pops-motion-fadeOutTop;\r\n animation-name: pops-motion-fadeOutTop;\r\n animation-timing-function: cubic-bezier(0.32, 0.37, 0.06, 0.87);\r\n}\r\n.pops-tip[data-motion="fadeInBottom"] {\r\n -webkit-animation-name: pops-motion-fadeInBottom;\r\n animation-name: pops-motion-fadeInBottom;\r\n}\r\n.pops-tip[data-motion="fadeOutBottom"] {\r\n -webkit-animation-name: pops-motion-fadeOutBottom;\r\n animation-name: pops-motion-fadeOutBottom;\r\n}\r\n.pops-tip[data-motion="fadeInLeft"] {\r\n -webkit-animation-name: pops-motion-fadeInLeft;\r\n animation-name: pops-motion-fadeInLeft;\r\n}\r\n.pops-tip[data-motion="fadeOutLeft"] {\r\n -webkit-animation-name: pops-motion-fadeOutLeft;\r\n animation-name: pops-motion-fadeOutLeft;\r\n}\r\n.pops-tip[data-motion="fadeInRight"] {\r\n -webkit-animation-name: pops-motion-fadeInRight;\r\n animation-name: pops-motion-fadeInRight;\r\n}\r\n\r\n/* github的样式 */\r\n.pops-tip.github-tooltip {\r\n --tooltip-bg-opacity: 1;\r\n --tooltip-color: #ffffff;\r\n --tooltip-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));\r\n --tooltip-bd-radius: 6px;\r\n --tooltip-padding-top: 6px;\r\n --tooltip-padding-right: 8px;\r\n --tooltip-padding-bottom: 6px;\r\n --tooltip-padding-left: 8px;\r\n\r\n --tooltip-arrow--after-color: rgb(255, 255, 255);\r\n --tooltip-arrow--after-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));\r\n --tooltip-arrow--after-width: 8px;\r\n --tooltip-arrow--after-height: 8px;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n .pops-tip {\r\n --tooltip-color: #ffffff;\r\n --tooltip-bg-color: #fafafa;\r\n --tooltip-arrow--after-color: #fafafa;\r\n --tooltip-arrow--after-bg-color: rgb(250, 250, 250, var(--pops-bg-opacity));\r\n }\r\n}\r\n';
var drawerCSS =
'.pops[type-value="drawer"] {\r\n position: fixed;\r\n box-sizing: border-box;\r\n display: flex;\r\n flex-direction: column;\r\n box-shadow:\r\n 0px 16px 48px 16px rgba(0, 0, 0, 0.08),\r\n 0px 12px 32px rgba(0, 0, 0, 0.12),\r\n 0px 8px 16px -8px rgba(0, 0, 0, 0.16);\r\n overflow: hidden;\r\n transition: all 0.3s;\r\n}\r\n\r\n.pops[type-value="drawer"][direction="top"] {\r\n width: 100%;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n}\r\n.pops[type-value="drawer"][direction="bottom"] {\r\n width: 100%;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n}\r\n.pops[type-value="drawer"][direction="left"] {\r\n height: 100%;\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n}\r\n.pops[type-value="drawer"][direction="right"] {\r\n height: 100%;\r\n top: 0;\r\n bottom: 0;\r\n right: 0;\r\n}\r\n';
var folderCSS =
'.pops-folder-list {\r\n --folder-arrow-fill-color: #d4d7de;\r\n --folder-arrow-active-fill-color: #06a7ff;\r\n --header-breadcrumb-text-color: #06a7ff;\r\n --header-breadcrumb-all-files-text-color: var(--header-breadcrumb-text-color);\r\n --header-breadcrumb-all-files-first-text-color: var(--header-breadcrumb-text-color);\r\n --header-breadcrumb-all-files-last-text-color: #999999;\r\n --table-header-row-text-color: #818999;\r\n --table-body-td-text-color: rgb(247, 248, 250, var(--pops-bg-opacity));\r\n --table-body-th-text-color: rgb(247, 248, 250, var(--pops-bg-opacity));\r\n --table-body-row-text-color: #05082c;\r\n --table-body-row-file-name-text-color: #05082c;\r\n --table-body-row-hover-bd-color: rgb(245, 246, 247, var(--pops-bg-opacity));\r\n --table-body-row-hover-bg-color: rgb(245, 246, 247, var(--pops-bg-opacity));\r\n --table-body-row-file-name-hover-text-color: #06a7ff;\r\n --table-body-row-content-text-color: #818999;\r\n}\r\n.pops-folder-list .cursor-p {\r\n cursor: pointer;\r\n}\r\n.pops-folder-list a {\r\n background: 0 0;\r\n text-decoration: none;\r\n -webkit-tap-highlight-color: transparent;\r\n color: var(--header-breadcrumb-text-color);\r\n}\r\ntable.pops-folder-list-table__body,\r\ntable.pops-folder-list-table__header {\r\n width: 100%;\r\n table-layout: fixed;\r\n border-collapse: collapse;\r\n border-spacing: 0;\r\n padding: 0 20px;\r\n}\r\ntable.pops-folder-list-table__body,\r\ntable.pops-folder-list-table__header {\r\n height: 100%;\r\n background: 0 0;\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n -ms-flex-direction: column;\r\n -webkit-box-orient: vertical;\r\n -webkit-box-direction: normal;\r\n}\r\ntable.pops-folder-list-table__body {\r\n height: 100%;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops-folder-list table tr {\r\n line-height: normal;\r\n align-content: center;\r\n}\r\n.pops-folder-list-table__header-row {\r\n height: 50px;\r\n line-height: normal;\r\n align-content: center;\r\n color: var(--table-header-row-text-color);\r\n text-align: left;\r\n font-size: 12px;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops-folder-list-table__body-row {\r\n height: 50px;\r\n line-height: normal;\r\n align-content: center;\r\n color: var(--table-body-row-text-color);\r\n font-size: 12px;\r\n}\r\n.pops-folder-list-table__body-row:hover {\r\n background-color: var(--table-body-row-hover-bg-color);\r\n border-color: var(--table-body-row-hover-bd-color);\r\n border: 0;\r\n outline: none;\r\n}\r\n.pops-folder-list table th {\r\n border: 0;\r\n border-bottom: 1px solid var(--table-body-th-text-color);\r\n}\r\n.pops-folder-list table td {\r\n border: 0;\r\n border-bottom: 1px solid var(--table-body-td-text-color);\r\n position: relative;\r\n}\r\n.pops-folder-list .list-name-text {\r\n display: inline-block;\r\n padding-left: 12px;\r\n line-height: normal;\r\n align-content: center;\r\n max-width: 176px;\r\n}\r\n.pops-folder-list-file-name > div {\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.pops-mobile-folder-list-file-name {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.pops-mobile-folder-list-file-name > div {\r\n display: flex;\r\n flex-wrap: wrap;\r\n justify-content: flex-start;\r\n align-items: flex-start;\r\n padding: 6px 0px;\r\n flex-direction: column;\r\n}\r\n.pops-mobile-folder-list-file-name img.pops-folder-list-file-icon {\r\n width: 45px;\r\n height: 45px;\r\n}\r\n.pops-mobile-folder-list-file-name a.pops-folder-list-file-name-title-text {\r\n padding-left: unset;\r\n max-width: 250px;\r\n overflow-x: hidden;\r\n font-weight: 400;\r\n line-height: unset;\r\n margin-bottom: 4px;\r\n white-space: normal;\r\n text-overflow: unset;\r\n}\r\n\r\n/* 修改滚动 */\r\n.pops-folder-content {\r\n overflow: hidden !important;\r\n}\r\n.pops-folder-content .pops-folder-list {\r\n height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.pops-folder-content .pops-folder-list-table__body-div {\r\n height: 100%;\r\n flex: 1 auto;\r\n overflow: auto;\r\n padding-bottom: 0;\r\n}\r\n.pops-mobile-folder-content .pops-folder-list-table__body-div {\r\n height: 100%;\r\n flex: 1 auto;\r\n overflow: auto;\r\n padding-bottom: 0;\r\n}\r\n.pops-folder-content table.pops-folder-list-table__body {\r\n overflow: auto;\r\n}\r\n.pops-folder-content .pops-folder-list-table__header-div {\r\n flex: 0;\r\n}\r\n.pops-mobile-folder-content .pops-folder-list-table__header-div {\r\n display: none;\r\n}\r\n\r\n.pops-folder-list .pops-folder-list-file-name-title-text {\r\n color: var(--table-body-row-file-name-text-color);\r\n}\r\n.pops-folder-list .pops-folder-list-file-name-title-text:hover {\r\n text-decoration: none;\r\n color: var(--table-body-row-file-name-hover-text-color);\r\n}\r\n.pops-folder-list .text-ellip {\r\n overflow: hidden;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n}\r\n.pops-folder-list .content {\r\n color: var(--table-body-row-content-text-color);\r\n position: relative;\r\n width: 100%;\r\n text-align: left;\r\n}\r\n.pops-folder-list .inline-block-v-middle {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n.pops-folder-list .flex-a-i-center {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.pops-folder-list .u-file-icon {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n.pops-folder-list .u-file-icon--list {\r\n width: 32px;\r\n height: 32px;\r\n}\r\n.pops-folder-list .pops-folder-list-file-icon {\r\n line-height: normal;\r\n align-content: center;\r\n position: relative;\r\n vertical-align: middle;\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb-primary {\r\n flex: 1;\r\n display: -webkit-box;\r\n display: -webkit-flex;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -webkit-align-items: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-orient: horizontal;\r\n -webkit-box-direction: normal;\r\n -webkit-flex-direction: row;\r\n -ms-flex-direction: row;\r\n flex-direction: row;\r\n min-height: 17px;\r\n flex-wrap: wrap;\r\n}\r\n.pops-folder-list .pops-folder-list-table__sort {\r\n display: inline-flex;\r\n margin-left: 4px;\r\n flex-direction: column;\r\n}\r\n\r\n.pops-folder-list .pops-folder-icon-arrow {\r\n width: 10px;\r\n height: 10px;\r\n fill: var(--folder-arrow-fill-color);\r\n}\r\n.pops-folder-list .pops-folder-icon-active {\r\n fill: var(--folder-arrow-active-fill-color);\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb {\r\n padding: 4px 20px;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n display: -webkit-box;\r\n display: -webkit-flex;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -webkit-align-items: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-orient: horizontal;\r\n -webkit-box-direction: normal;\r\n -webkit-flex-direction: row;\r\n -ms-flex-direction: row;\r\n flex-direction: row;\r\n -webkit-box-pack: start;\r\n -webkit-justify-content: start;\r\n -ms-flex-pack: start;\r\n justify-content: flex-start;\r\n min-height: 35px;\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb-allFiles {\r\n font-size: 12px;\r\n color: var(--header-breadcrumb-all-files-text-color);\r\n line-height: normal;\r\n align-content: center;\r\n font-weight: 700;\r\n display: inline-block;\r\n max-width: 140px;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n word-wrap: normal;\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:last-child a {\r\n color: var(--header-breadcrumb-all-files-last-text-color);\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child a {\r\n font-size: 14px;\r\n color: var(--header-breadcrumb-all-files-first-text-color);\r\n}\r\n.pops-folder-list .pops-folder-file-list-breadcrumb .iconArrow {\r\n width: 16px;\r\n height: 16px;\r\n}\r\n.pops-folder-list .iconArrow {\r\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAASCAMAAABYd88+AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTOLi4uLi4t7e3uPj49/f397e3t3d3f///97e3vDw8N3d3d7e3t3d3d3d3ejo6N/f397e3t7e3t3d3d/f393d3d3d3RK+NoEAAAAWdFJOUwAnM4YPU/iQA+UIeMDaHhY41i7zX7UebpjFAAAAUElEQVQI15XOORaAIAwE0LATXHCd+x9VfCiksXCq+UUWou8oZ1vXHrt7YVBiYkW4gdMKYFIC4CSATWCNHWPuM6HuHkr1x3N0ZrBu/9gl0b9c3+kF7C7hS1YAAAAASUVORK5CYII=)\r\n 55% 50%/6px 9px no-repeat;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n .pops[type-value="folder"] {\r\n --pops-title-border-color: rgb(73, 83, 102, var(--pops-bg-opacity));\r\n --pops-bottom-btn-controls-border-color: rgb(73, 83, 102, var(--pops-bg-opacity));\r\n }\r\n .pops-folder-list {\r\n --header-breadcrumb-text-color: #06a7ff;\r\n --header-breadcrumb-all-files-text-color: var(--header-breadcrumb-text-color);\r\n --header-breadcrumb-all-files-first-text-color: var(--header-breadcrumb-text-color);\r\n --header-breadcrumb-all-files-last-text-color: #818999;\r\n --table-body-row-text-color: #f7f8fa;\r\n --table-body-td-text-color: rgb(73, 83, 102, var(--pops-bg-opacity));\r\n --table-body-th-text-color: rgb(73, 83, 102, var(--pops-bg-opacity));\r\n --table-body-td-text-color: #495366;\r\n --table-body-row-hover-bd-color: #1f2022;\r\n --table-body-row-hover-bg-color: #1f2022;\r\n --table-body-row-file-name-text-color: #f7f8fa;\r\n }\r\n}\r\n';
var panelCSS =
'.pops[type-value="panel"] {\r\n --pops-bg-color: #f2f2f2;\r\n --pops-color: #333333;\r\n --panel-title-bg-color: #ffffff;\r\n\r\n --panel-aside-bg-color: #ffffff;\r\n --panel-aside-hover-color: rgb(64, 158, 255);\r\n --panel-aside-hover-bg-color: rgba(64, 158, 255, 0.1);\r\n\r\n --pops-panel-forms-margin-top-bottom: 10px;\r\n --pops-panel-forms-margin-left-right: 20px;\r\n --pops-panel-forms-header-icon-size: calc(var(--pops-panel-forms-container-li-padding-left-right) + 1px);\r\n --pops-panel-forms-header-padding-top-bottom: 15px;\r\n --pops-panel-forms-header-padding-left-right: 10px;\r\n --pops-panel-forms-container-item-left-text-gap: 6px;\r\n --pops-panel-forms-container-item-left-desc-text-size: 0.8em;\r\n --pops-panel-forms-container-item-left-desc-text-color: #6c6c6c;\r\n --pops-panel-forms-container-item-bg-color: #ffffff;\r\n --pops-panel-forms-container-item-title-color: #333;\r\n --pops-panel-forms-container-item-border-radius: 6px;\r\n --pops-panel-forms-container-item-margin-top-bottom: 10px;\r\n --pops-panel-forms-container-item-margin-left-right: var(--pops-panel-forms-margin-left-right);\r\n --pops-panel-forms-container-li-border-color: var(--pops-bd-color);\r\n --pops-panel-forms-container-li-padding-top-bottom: 12px;\r\n --pops-panel-forms-container-li-padding-left-right: 16px;\r\n\r\n --pops-panel-forms-container-deepMenu-item-active-bg: #e9e9e9;\r\n}\r\n.pops[type-value="panel"] {\r\n color: var(--pops-color);\r\n background: var(--pops-bg-color);\r\n}\r\n.pops[type-value] .pops-panel-title {\r\n background: var(--panel-title-bg-color);\r\n}\r\n\r\n/* ↓panel的CSS↓ */\r\n/* 左侧的列表 */\r\naside.pops-panel-aside {\r\n box-sizing: border-box;\r\n flex-shrink: 0;\r\n max-width: 200px;\r\n min-width: 100px;\r\n height: 100%;\r\n background: var(--panel-aside-bg-color);\r\n border-right: 1px solid var(--panel-aside-bg-color);\r\n font-size: 0.9em;\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: space-between;\r\n}\r\naside.pops-panel-aside {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\naside.pops-panel-aside .pops-panel-aside-top-container {\r\n overflow: auto;\r\n}\r\naside.pops-panel-aside ul li {\r\n margin: 6px 8px;\r\n border-radius: 4px;\r\n padding: 6px 10px;\r\n cursor: default;\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-start;\r\n}\r\naside.pops-panel-aside .pops-is-visited,\r\naside.pops-panel-aside ul li:not(.pops-panel-disabled-aside-hover-css):hover {\r\n color: var(--panel-aside-hover-color);\r\n background: var(--panel-aside-hover-bg-color);\r\n}\r\n/* 左侧的列表 */\r\n\r\n.pops-panel-content {\r\n display: flex;\r\n flex-direction: row;\r\n flex: 1;\r\n overflow: auto;\r\n flex-basis: auto;\r\n box-sizing: border-box;\r\n min-width: 0;\r\n bottom: 0 !important;\r\n}\r\n\r\n.pops-panel-section-wrapper {\r\n width: 100%;\r\n overflow: hidden;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n\r\nsection.pops-panel-container {\r\n width: 100%;\r\n overflow: hidden;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\nsection.pops-panel-container .pops-panel-container-header-ul,\r\nsection.pops-panel-container .pops-panel-deepMenu-container-header-ul {\r\n border-bottom: 1px solid rgba(223, 223, 223, var(--pops-bg-opacity));\r\n flex: 0 auto;\r\n}\r\nsection.pops-panel-container .pops-panel-container-header-ul li,\r\nsection.pops-panel-container .pops-panel-container-header-ul li.pops-panel-container-header-title-text {\r\n display: flex;\r\n justify-content: flex-start !important;\r\n margin: 0px !important;\r\n padding: var(--pops-panel-forms-header-padding-top-bottom)\r\n calc(var(--pops-panel-forms-margin-left-right) + var(--pops-panel-forms-container-li-padding-left-right));\r\n text-align: left;\r\n}\r\nsection.pops-panel-container ul.pops-panel-container-main-ul {\r\n overflow: auto;\r\n /*flex: 1;*/\r\n}\r\nsection.pops-panel-container > ul li:not(.pops-panel-forms-container-item) {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n margin: var(--pops-panel-forms-margin-top-bottom)\r\n calc(var(--pops-panel-forms-margin-left-right) + var(--pops-panel-forms-margin-left-right));\r\n gap: 10px;\r\n}\r\nsection.pops-panel-container .pops-panel-forms-container-item-header-text {\r\n margin: 10px;\r\n margin-left: calc(\r\n var(--pops-panel-forms-margin-left-right) + var(--pops-panel-forms-container-li-padding-left-right)\r\n );\r\n font-size: 0.9em;\r\n text-align: left;\r\n color: var(--pops-panel-forms-container-item-title-color);\r\n}\r\nsection.pops-panel-container li.pops-panel-forms-container-item {\r\n /* 去除<li>左侧的圆点 */\r\n display: block;\r\n}\r\nsection.pops-panel-container .pops-panel-forms-container-item ul.pops-panel-forms-container-item-formlist {\r\n border-radius: var(--pops-panel-forms-container-item-border-radius);\r\n background: var(--pops-panel-forms-container-item-bg-color);\r\n margin: var(--pops-panel-forms-container-item-margin-top-bottom) var(--pops-panel-forms-margin-left-right);\r\n}\r\nsection.pops-panel-container .pops-panel-forms-container-item ul.pops-panel-forms-container-item-formlist li {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: var(--pops-panel-forms-container-li-padding-top-bottom)\r\n var(--pops-panel-forms-container-li-padding-left-right);\r\n margin: 0px 0px;\r\n border-bottom: 1px solid var(--pops-panel-forms-container-li-border-color);\r\n text-align: left;\r\n}\r\n/*section.pops-panel-container\r\n .pops-panel-forms-container-item\r\n ul\r\n li.pops-panel-deepMenu-nav-item {\r\n padding: var(--pops-panel-forms-container-li-padding-top-bottom) 0px;\r\n margin: 0px var(--pops-panel-forms-container-li-padding-left-right);\r\n border-bottom: 1px solid var(--pops-panel-forms-container-li-border-color);\r\n}*/\r\nsection.pops-panel-container\r\n .pops-panel-forms-container-item\r\n ul.pops-panel-forms-container-item-formlist\r\n li:last-child {\r\n border: 0px;\r\n}\r\n/* 左侧的文字 */\r\nsection.pops-panel-container .pops-panel-item-left-text {\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--pops-panel-forms-container-item-left-text-gap);\r\n}\r\n\r\n/* 左侧的主文字 */\r\n/*section.pops-panel-container .pops-panel-item-left-main-text {\r\n \r\n}*/\r\n/* 左侧的描述文字 */\r\nsection.pops-panel-container .pops-panel-item-left-desc-text {\r\n font-size: var(--pops-panel-forms-container-item-left-desc-text-size);\r\n color: var(--pops-panel-forms-container-item-left-desc-text-color);\r\n}\r\n\r\n/* 折叠面板 */\r\nsection.pops-panel-container .pops-panel-forms-fold {\r\n border-radius: var(--pops-panel-forms-container-item-border-radius);\r\n background: var(--pops-panel-forms-container-item-bg-color);\r\n margin: var(--pops-panel-forms-margin-top-bottom) var(--pops-panel-forms-margin-left-right);\r\n}\r\nsection.pops-panel-container .pops-panel-forms-fold .pops-panel-forms-fold-container {\r\n display: flex;\r\n align-items: center;\r\n fill: #6c6c6c;\r\n justify-content: space-between;\r\n margin: 0px var(--pops-panel-forms-container-li-padding-left-right) !important;\r\n padding: var(--pops-panel-forms-container-li-padding-top-bottom) 0px !important;\r\n}\r\nsection.pops-panel-container .pops-panel-forms-fold[data-fold-enable] .pops-panel-forms-fold-container-icon {\r\n transform: rotate(90deg);\r\n}\r\nsection.pops-panel-container .pops-panel-forms-fold .pops-panel-forms-fold-container-icon {\r\n width: 15px;\r\n height: 15px;\r\n display: flex;\r\n align-items: center;\r\n transform: rotate(-90deg);\r\n transition: transform 0.3s;\r\n}\r\n/* 折叠状态 */\r\nsection.pops-panel-container .pops-panel-forms-fold[data-fold-enable] .pops-panel-forms-container-item-formlist {\r\n height: 0;\r\n}\r\n/* 非折叠状态 */\r\nsection.pops-panel-container .pops-panel-forms-fold ul.pops-panel-forms-container-item-formlist {\r\n margin: 0;\r\n}\r\nsection.pops-panel-container .pops-panel-forms-fold .pops-panel-forms-container-item-formlist {\r\n transition: height 0.3s;\r\n overflow: hidden;\r\n border-radius: unset;\r\n background: unset;\r\n margin: 0;\r\n height: calc-size(auto, size);\r\n}\r\n/* 折叠面板 */\r\n\r\n/* 姑且认为小于600px的屏幕为移动端 */\r\n@media (max-width: 600px) {\r\n /* 兼容移动端CSS */\r\n .pops[type-value="panel"] {\r\n --pops-panel-forms-margin-left-right: 10px;\r\n }\r\n .pops[type-value="panel"] {\r\n width: 92%;\r\n width: 92vw;\r\n width: 92dvw;\r\n }\r\n .pops[type-value="panel"] .pops-panel-content aside.pops-panel-aside {\r\n max-width: 20%;\r\n min-width: auto;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container .pops-panel-forms-container-item > div {\r\n text-align: left;\r\n --pops-panel-forms-margin-left-right: 0px;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container .pops-panel-forms-container-item ul {\r\n margin: 0px !important;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container > ul > li {\r\n margin: 10px 10px;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container > ul > li div:nth-child(2) {\r\n max-width: 55%;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container .pops-panel-select select {\r\n min-width: 88px !important;\r\n width: -webkit-fill-available;\r\n width: -moz-available;\r\n }\r\n .pops[type-value="panel"] section.pops-panel-container .pops-panel-container-header-ul li {\r\n font-size: 16px;\r\n }\r\n .pops[type-value="panel"] .pops-panel-title p[pops],\r\n .pops[type-value="panel"] section.pops-panel-container > ul li,\r\n .pops[type-value="panel"] aside.pops-panel-aside ul li {\r\n font-size: 14px;\r\n }\r\n}\r\n/* switch的CSS */\r\n.pops-panel-switch {\r\n --panel-switch-core-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));\r\n --panel-switch-core-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));\r\n --panel-switch-circle-color: #dcdfe6;\r\n --panel-switch-circle-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --panel-switch-checked-circle-color: #409eff;\r\n --panel-switch-checked-core-bd-color: rgb(64, 158, 255, var(--pops-bd-opacity));\r\n --panel-switch-checked-core-bg-color: rgb(64, 158, 255, var(--pops-bg-opacity));\r\n}\r\n.pops-panel-switch {\r\n display: inline-flex;\r\n flex-direction: row-reverse;\r\n align-items: center;\r\n position: relative;\r\n font-size: 14px;\r\n line-height: normal;\r\n align-content: center;\r\n height: 32px;\r\n vertical-align: middle;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops-panel-switch input.pops-panel-switch__input {\r\n position: absolute;\r\n width: 0;\r\n height: 0;\r\n opacity: 0;\r\n margin: 0;\r\n}\r\n.pops-panel-switch:has(input.pops-panel-switch__input:disabled),\r\n.pops-panel-switch[data-disabled],\r\n.pops-panel-switch[data-disabled] .pops-panel-switch__core,\r\n.pops-panel-switch input.pops-panel-switch__input:disabled + .pops-panel-switch__core {\r\n cursor: not-allowed;\r\n opacity: 0.6;\r\n}\r\n.pops-panel-switch span.pops-panel-switch__core {\r\n display: inline-flex;\r\n position: relative;\r\n align-items: center;\r\n min-width: 40px;\r\n height: 20px;\r\n border: 1px solid var(--panel-switch-core-bd-color);\r\n outline: 0;\r\n border-radius: 10px;\r\n box-sizing: border-box;\r\n background: var(--panel-switch-core-bg-color);\r\n cursor: pointer;\r\n transition:\r\n border-color 0.3s,\r\n background-color 0.3s;\r\n}\r\n.pops-panel-switch .pops-panel-switch__action {\r\n position: absolute;\r\n left: 1px;\r\n border-radius: 100%;\r\n transition: all 0.3s;\r\n width: 16px;\r\n height: 16px;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n background-color: var(--panel-switch-circle-bg-color);\r\n color: var(--panel-switch-circle-color);\r\n}\r\n.pops-panel-switch.pops-panel-switch-is-checked span.pops-panel-switch__core {\r\n border-color: var(--panel-switch-checked-core-bd-color);\r\n background-color: var(--panel-switch-checked-core-bg-color);\r\n}\r\n.pops-panel-switch.pops-panel-switch-is-checked .pops-panel-switch__action {\r\n left: calc(100% - 17px);\r\n color: var(--panel-switch-checked-circle-color);\r\n}\r\n/* switch的CSS */\r\n\r\n/* slider旧的CSS */\r\nsection.pops-panel-container .pops-panel-slider:has(> input[type="range"]) {\r\n overflow: hidden;\r\n height: 25px;\r\n line-height: normal;\r\n align-content: center;\r\n display: flex;\r\n align-items: center;\r\n}\r\nsection.pops-panel-container .pops-panel-slider input[type="range"] {\r\n height: 6px;\r\n background: rgb(228, 231, 237, var(--pops-bg-opacity));\r\n outline: 0;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n width: 100%;\r\n}\r\nsection.pops-panel-container .pops-panel-slider input[type="range"]::-webkit-slider-thumb {\r\n width: 20px;\r\n height: 20px;\r\n border-radius: 50%;\r\n border: 1px solid rgb(64, 158, 255, var(--pops-bd-opacity));\r\n background-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n box-shadow:\r\n 0 0 2px rgba(0, 0, 0, 0.3),\r\n 0 3px 5px rgba(0, 0, 0, 0.2);\r\n cursor: pointer;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n border-image: linear-gradient(#409eff, #409eff) 0 fill/9 25 9 0/0 0 0 100vw;\r\n}\r\nsection.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-thumb {\r\n width: 20px;\r\n height: 20px;\r\n border-radius: 50%;\r\n border: 1px solid rgb(64, 159, 255, var(--pops-bd-opacity));\r\n background-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n box-shadow:\r\n 0 0 2px rgba(0, 0, 0, 0.3),\r\n 0 3px 5px rgba(0, 0, 0, 0.2);\r\n cursor: pointer;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n}\r\nsection.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-progress {\r\n height: 6px;\r\n border-image: linear-gradient(#409eff, #409eff) 0 fill/9 25 9 0/0 0 0 100vw;\r\n}\r\n/* slider旧的CSS */\r\n\r\n/* slider的CSS */\r\n.pops-slider {\r\n --pops-slider-color-white: #ffffff;\r\n --pops-slider-color-primary: #409eff;\r\n --pops-slider-color-info: #909399;\r\n --pops-slider-text-color-placeholder: #a8abb2;\r\n --pops-slider-border-color-light: #e4e7ed;\r\n --pops-slider-border-radius-circle: 100%;\r\n --pops-slider-transition-duration-fast: 0.2s;\r\n\r\n --pops-slider-main-bg-color: var(--pops-slider-color-primary);\r\n --pops-slider-runway-bg-color: var(--pops-slider-border-color-light);\r\n --pops-slider-stop-bg-color: var(--pops-slider-color-white);\r\n --pops-slider-disabled-color: var(--pops-slider-text-color-placeholder);\r\n --pops-slider-border-radius: 3px;\r\n --pops-slider-height: 6px;\r\n --pops-slider-button-size: 20px;\r\n --pops-slider-button-wrapper-size: 36px;\r\n --pops-slider-button-wrapper-offset: -15px;\r\n}\r\n\r\n.pops-slider {\r\n width: 100%;\r\n height: 32px;\r\n display: flex;\r\n align-items: center;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.pops-slider-width {\r\n flex: 0 0 52%;\r\n margin-left: 10px;\r\n}\r\n\r\n.pops-slider__runway {\r\n flex: 1;\r\n height: var(--pops-slider-height);\r\n background-color: var(--pops-slider-runway-bg-color);\r\n border-radius: var(--pops-slider-border-radius);\r\n position: relative;\r\n cursor: pointer;\r\n}\r\n\r\n.pops-slider__runway.show-input {\r\n margin-right: 30px;\r\n width: auto;\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled {\r\n cursor: default;\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__bar {\r\n background-color: var(--pops-slider-disabled-color);\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button {\r\n border-color: var(--pops-slider-disabled-color);\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button:hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.dragging {\r\n cursor: not-allowed;\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button:hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.dragging {\r\n transform: scale(1);\r\n}\r\n\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button:hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.hover,\r\n.pops-slider__runway.pops-slider-is-disabled .pops-slider__button.dragging {\r\n cursor: not-allowed;\r\n}\r\n\r\n.pops-slider__input {\r\n flex-shrink: 0;\r\n width: 130px;\r\n}\r\n\r\n.pops-slider__bar {\r\n height: var(--pops-slider-height);\r\n background-color: var(--pops-slider-main-bg-color);\r\n border-top-left-radius: var(--pops-slider-border-radius);\r\n border-bottom-left-radius: var(--pops-slider-border-radius);\r\n position: absolute;\r\n}\r\n\r\n.pops-slider__button-wrapper {\r\n height: var(--pops-slider-button-wrapper-size);\r\n width: var(--pops-slider-button-wrapper-size);\r\n position: absolute;\r\n z-index: 1;\r\n top: var(--pops-slider-button-wrapper-offset);\r\n transform: translate(-50%);\r\n background-color: transparent;\r\n text-align: center;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n line-height: normal;\r\n outline: none;\r\n}\r\n\r\n.pops-slider__button-wrapper:after {\r\n display: inline-block;\r\n content: "";\r\n height: 100%;\r\n vertical-align: middle;\r\n}\r\n\r\n.pops-slider__button:hover,\r\n.pops-slider__button.hover {\r\n cursor: grab;\r\n}\r\n\r\n.pops-slider__button {\r\n display: inline-block;\r\n width: var(--pops-slider-button-size);\r\n height: var(--pops-slider-button-size);\r\n vertical-align: middle;\r\n border: solid 2px var(--pops-slider-main-bg-color);\r\n background-color: var(--pops-slider-color-white);\r\n border-radius: 50%;\r\n box-sizing: border-box;\r\n transition: var(--pops-slider-transition-duration-fast);\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.pops-slider__button:hover,\r\n.pops-slider__button.hover,\r\n.pops-slider__button.dragging {\r\n transform: scale(1.2);\r\n}\r\n\r\n.pops-slider__button:hover,\r\n.pops-slider__button.hover {\r\n cursor: grab;\r\n}\r\n\r\n.pops-slider__button.dragging {\r\n cursor: grabbing;\r\n}\r\n\r\n.pops-slider__stop {\r\n position: absolute;\r\n height: var(--pops-slider-height);\r\n width: var(--pops-slider-height);\r\n border-radius: var(--pops-slider-border-radius-circle);\r\n background-color: var(--pops-slider-stop-bg-color);\r\n transform: translate(-50%);\r\n}\r\n\r\n.pops-slider__marks {\r\n top: 0;\r\n left: 12px;\r\n width: 18px;\r\n height: 100%;\r\n}\r\n\r\n.pops-slider__marks-text {\r\n position: absolute;\r\n transform: translate(-50%);\r\n font-size: 14px;\r\n color: var(--pops-slider-color-info);\r\n margin-top: 15px;\r\n white-space: pre;\r\n}\r\n\r\n.pops-slider.is-vertical {\r\n position: relative;\r\n display: inline-flex;\r\n width: auto;\r\n height: 100%;\r\n flex: 0;\r\n}\r\n\r\n.pops-slider.is-vertical .pops-slider__runway {\r\n width: var(--pops-slider-height);\r\n height: 100%;\r\n margin: 0 16px;\r\n}\r\n\r\n.pops-slider.is-vertical .pops-slider__bar {\r\n width: var(--pops-slider-height);\r\n height: auto;\r\n border-radius: 0 0 3px 3px;\r\n}\r\n\r\n.pops-slider.is-vertical .pops-slider__button-wrapper {\r\n top: auto;\r\n left: var(--pops-slider-button-wrapper-offset);\r\n transform: translateY(50%);\r\n}\r\n\r\n.pops-slider.is-vertical .pops-slider__stop {\r\n transform: translateY(50%);\r\n}\r\n\r\n.pops-slider.is-vertical .pops-slider__marks-text {\r\n margin-top: 0;\r\n left: 15px;\r\n transform: translateY(50%);\r\n}\r\n\r\n.pops-slider--large {\r\n height: 40px;\r\n}\r\n\r\n.pops-slider--small {\r\n height: 24px;\r\n}\r\n/* slider的CSS */\r\n\r\n/* input的CSS */\r\n.pops-panel-input {\r\n --el-disabled-text-color: #a8abb2;\r\n --el-disabled-bg-color: #f5f7fa;\r\n --el-disabled-border-color: #e4e7ed;\r\n\r\n --pops-panel-components-input-text-color: #000000;\r\n --pops-panel-components-input-text-bg-color: transparent;\r\n --pops-panel-components-input-text-default-padding: 8px;\r\n --pops-panel-components-input-bd-color: #dcdfe6;\r\n --pops-panel-components-input-bg-color: #ffffff;\r\n --pops-panel-components-input-hover-bd-color: #c0c4cc;\r\n --pops-panel-components-input-focus-bd-color: #409eff;\r\n --pops-panel-components-input-suffix-color: #a8abb2;\r\n --pops-panel-components-input-suffix-bg-color: #ffffff;\r\n}\r\n.pops-panel-input {\r\n display: flex;\r\n align-items: center;\r\n border: 1px solid var(--pops-panel-components-input-bd-color);\r\n border-radius: 4px;\r\n background-color: var(--pops-panel-components-input-bg-color);\r\n position: relative;\r\n box-shadow: none;\r\n}\r\n.pops-panel-input:hover {\r\n border: 1px solid var(--pops-panel-components-input-hover-bd-color);\r\n}\r\n.pops-panel-input:has(input:disabled):hover {\r\n --pops-panel-components-input-hover-bd-color: var(--pops-panel-components-input-bd-color);\r\n}\r\n.pops-panel-input:has(input:focus) {\r\n outline: 0;\r\n border: 1px solid var(--pops-panel-components-input-focus-bd-color);\r\n border-radius: 4px;\r\n box-shadow: none;\r\n}\r\n.pops-panel-input input {\r\n display: inline-flex;\r\n justify-content: center;\r\n text-align: start;\r\n align-items: center;\r\n align-content: center;\r\n white-space: nowrap;\r\n cursor: text;\r\n box-sizing: border-box;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n vertical-align: middle;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n color: var(--pops-panel-components-input-text-color);\r\n background-color: var(--pops-panel-components-input-text-bg-color);\r\n outline: 0;\r\n transition: 0.1s;\r\n border: 0;\r\n font-size: 14px;\r\n font-weight: 500;\r\n line-height: normal;\r\n height: 32px;\r\n width: 100%;\r\n flex: 1;\r\n /*margin-right: calc(1em + 8px);*/\r\n margin: 0px;\r\n padding: var(--pops-panel-components-input-text-default-padding);\r\n}\r\n.pops-panel-input span.pops-panel-input__suffix {\r\n display: inline-flex;\r\n white-space: nowrap;\r\n flex-shrink: 0;\r\n flex-wrap: nowrap;\r\n height: 100%;\r\n text-align: center;\r\n color: var(--pops-panel-components-input-suffix-color);\r\n background: var(--pops-panel-components-input-suffix-bg-color);\r\n transition: all 0.3s;\r\n pointer-events: none;\r\n padding: 0 8px;\r\n position: absolute;\r\n right: 0px;\r\n border-top-right-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n border: 1px solid transparent;\r\n}\r\n.pops-panel-input span.pops-panel-input__suffix-inner {\r\n pointer-events: all;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n/* 如果包含清空图标的按钮,则默认隐藏清空图标,当:hover、:focus、:focus-within、:active时显示清空图标 */\r\n.pops-panel-input span.pops-panel-input__suffix:has(svg[data-type="circleClose"]) {\r\n display: none;\r\n}\r\n.pops-panel-input:hover span.pops-panel-input__suffix:has(svg[data-type="circleClose"]),\r\n.pops-panel-input:focus span.pops-panel-input__suffix:has(svg[data-type="circleClose"]),\r\n.pops-panel-input:focus-within span.pops-panel-input__suffix:has(svg[data-type="circleClose"]),\r\n.pops-panel-input:active span.pops-panel-input__suffix:has(svg[data-type="circleClose"]) {\r\n display: inline-flex;\r\n}\r\n.pops-panel-input .pops-panel-icon {\r\n cursor: pointer;\r\n}\r\n.pops-panel-input .pops-panel-icon {\r\n height: inherit;\r\n line-height: normal;\r\n align-content: center;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n transition: all 0.3s;\r\n}\r\n.pops-panel-input .pops-panel-icon svg {\r\n height: 1em;\r\n width: 1em;\r\n}\r\n\r\n.pops-input-disabled {\r\n background-color: var(--pops-components-is-disabled-bg-color);\r\n}\r\n.pops-panel-input.pops-input-disabled:hover {\r\n --pops-panel-components-input-hover-bd-color: var(--pops-panel-components-input-bd-color);\r\n}\r\n.pops-panel-input input:disabled,\r\n.pops-panel-input input:disabled + .pops-panel-input__suffix {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n color: var(--el-disabled-text-color);\r\n -webkit-text-fill-color: var(--el-disabled-text-color);\r\n cursor: not-allowed;\r\n}\r\n.pops-panel-input input:disabled + .pops-panel-input__suffix {\r\n display: none;\r\n}\r\n/* input的CSS */\r\n\r\n/* textarea的CSS */\r\n.pops-panel-textarea {\r\n --pops-panel-components-textarea-text-color: #000000;\r\n --pops-panel-components-textarea-text-bg-color: #ffffff;\r\n --pops-panel-components-textarea-bd-color: #dcdfe6;\r\n --pops-panel-components-textarea-hover-bd-color: #c0c4cc;\r\n --pops-panel-components-textarea-focus-bd-color: #409eff;\r\n}\r\n.pops-panel-textarea textarea {\r\n width: 100%;\r\n /*vertical-align: bottom;*/\r\n position: relative;\r\n display: block;\r\n resize: none;\r\n padding: 5px 11px;\r\n /*line-height: 1;*/\r\n box-sizing: border-box;\r\n font-size: inherit;\r\n font-family: inherit;\r\n color: var(--pops-panel-components-textarea-text-color);\r\n background-color: var(--pops-panel-components-textarea-text-bg-color);\r\n background-image: none;\r\n -webkit-appearance: none;\r\n appearance: none;\r\n box-shadow: none;\r\n border-radius: 0;\r\n transition: box-shadow 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\r\n border: 1px solid var(--pops-panel-components-textarea-bd-color);\r\n}\r\n.pops-panel-textarea textarea:hover {\r\n border-color: var(--pops-panel-components-textarea-hover-bd-color);\r\n}\r\n.pops-panel-textarea:has(textarea:disabled):hover {\r\n --pops-panel-components-textarea-hover-bd-color: var(--pops-panel-components-textarea-bd-color);\r\n}\r\n.pops-panel-textarea-disable {\r\n --pops-panel-components-textarea-text-bg-color: var(--pops-components-is-disabled-bg-color) !important;\r\n --pops-panel-components-textarea-text-color: var(--pops-components-is-disabled-text-color);\r\n}\r\n.pops-panel-textarea-disable textarea {\r\n cursor: not-allowed;\r\n}\r\n.pops-panel-textarea textarea:focus {\r\n outline: 0;\r\n border-color: var(--pops-panel-components-textarea-focus-bd-color);\r\n}\r\n/* textarea的CSS */\r\n\r\n/* select的CSS */\r\n.pops-panel-select {\r\n --pops-panel-components-select-text-color: #000000;\r\n --pops-panel-components-select-bd-color: rgb(184, 184, 184, var(--pops-bd-opacity));\r\n --pops-panel-components-select-hover-bd-color: rgb(184, 184, 184, var(--pops-bd-opacity));\r\n --pops-panel-components-select-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n}\r\n.pops-panel-select {\r\n border: 0;\r\n}\r\n.pops-panel-select select {\r\n height: 32px;\r\n line-height: normal;\r\n align-content: center;\r\n min-width: 200px;\r\n border: 1px solid var(--pops-panel-components-select-bd-color);\r\n border-radius: 5px;\r\n text-align: center;\r\n outline: 0;\r\n color: var(--pops-panel-components-select-text-color);\r\n background-color: var(--pops-panel-components-select-bg-color);\r\n box-shadow: none;\r\n}\r\n.pops-panel-select select:hover {\r\n border: 1px solid var(--pops-panel-components-select-hover-bd-color);\r\n}\r\n.pops-panel-select-disable {\r\n --pops-panel-components-select-text-color: var(--pops-components-is-disabled-text-color);\r\n --pops-panel-components-select-bg-color: var(--pops-components-is-disabled-bg-color);\r\n}\r\n.pops-panel-select-disable select {\r\n cursor: not-allowed;\r\n}\r\n.pops-panel-select-disable select:hover {\r\n box-shadow: none;\r\n --pops-panel-components-select-hover-bd-color: var(--pops-panel-components-select-bd-color);\r\n}\r\n.pops-panel-select select:focus {\r\n border: 1px solid rgb(64, 158, 255, var(--pops-bd-opacity));\r\n box-shadow: none;\r\n}\r\n/* select的CSS */\r\n\r\n/* select-multiple的CSS*/\r\n.pops-panel-select-multiple {\r\n --el-border-radius-base: 4px;\r\n --el-fill-color-blank: #ffffff;\r\n --el-transition-duration: 0.3s;\r\n --el-border-color: #cbcbcb;\r\n --el-text-color-placeholder: #a8abb2;\r\n --color: inherit;\r\n --el-select-input-color: #a8abb2;\r\n --el-select-input-font-size: 14px;\r\n --el-text-color-regular: #606266;\r\n --el-color-info: #909399;\r\n --el-color-info-light-9: #f4f4f5;\r\n --el-color-info-light-8: #e9e9eb;\r\n --el-color-primary-light-9: #ecf5ff;\r\n --el-color-primary-light-8: #d9ecff;\r\n --el-color-primary: #409eff;\r\n --el-color-white: #ffffff;\r\n width: 200px;\r\n}\r\n.pops-panel-select-multiple .el-select__wrapper {\r\n display: flex;\r\n align-items: center;\r\n position: relative;\r\n box-sizing: border-box;\r\n cursor: pointer;\r\n text-align: left;\r\n font-size: 14px;\r\n padding: 4px 12px;\r\n gap: 6px;\r\n min-height: 32px;\r\n line-height: normal;\r\n align-content: center;\r\n border-radius: var(--el-border-radius-base);\r\n background-color: var(--el-fill-color-blank);\r\n transition: var(--el-transition-duration);\r\n transform: translateZ(0);\r\n border: 1px solid var(--el-border-color);\r\n}\r\n.pops-panel-select-multiple .el-select__wrapper.is-focused {\r\n --el-border-color: var(--el-color-primary);\r\n}\r\n.pops-panel-select-multiple .el-select__selection {\r\n position: relative;\r\n display: flex;\r\n flex-wrap: wrap;\r\n align-items: center;\r\n flex: 1;\r\n min-width: 0;\r\n gap: 6px;\r\n}\r\n.pops-panel-select-multiple .el-select__selected-item {\r\n display: flex;\r\n flex-wrap: wrap;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n.pops-panel-select-multiple .el-select__selected-item.el-select__choose_tag .el-tag {\r\n max-width: 200px;\r\n}\r\n.pops-panel-select-multiple .el-select__input-wrapper {\r\n max-width: 100%;\r\n}\r\n.pops-panel-select-multiple .el-select__selection.is-near {\r\n margin-left: -8px;\r\n}\r\n.pops-panel-select-multiple .el-select__placeholder {\r\n position: absolute;\r\n display: block;\r\n top: 50%;\r\n transform: translateY(-50%);\r\n width: 100%;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n color: var(--el-input-text-color, var(--el-text-color-regular));\r\n}\r\n.pops-panel-select-multiple .el-select__placeholder.is-transparent {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n color: var(--el-text-color-placeholder);\r\n}\r\n.pops-panel-select-multiple .el-select__prefix,\r\n.pops-panel-select-multiple .el-select__suffix {\r\n display: flex;\r\n align-items: center;\r\n flex-shrink: 0;\r\n gap: 6px;\r\n color: var(--el-input-icon-color, var(--el-text-color-placeholder));\r\n}\r\n.pops-panel-select-multiple .el-icon {\r\n --color: inherit;\r\n height: 1em;\r\n width: 1em;\r\n line-height: normal;\r\n align-content: center;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n position: relative;\r\n fill: currentColor;\r\n color: var(--color);\r\n font-size: inherit;\r\n}\r\n.pops-panel-select-multiple .el-icon svg {\r\n height: 1em;\r\n width: 1em;\r\n}\r\n.pops-panel-select-multiple .el-select__caret {\r\n color: var(--el-select-input-color);\r\n font-size: var(--el-select-input-font-size);\r\n transition: var(--el-transition-duration);\r\n transform: rotate(0);\r\n cursor: pointer;\r\n}\r\n.pops-panel-select-multiple .el-tag {\r\n --el-tag-font-size: 12px;\r\n --el-tag-border-radius: 4px;\r\n --el-tag-border-radius-rounded: 9999px;\r\n}\r\n.pops-panel-select-multiple .el-tag {\r\n background-color: var(--el-tag-bg-color);\r\n border-color: var(--el-tag-border-color);\r\n color: var(--el-tag-text-color);\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n vertical-align: middle;\r\n height: 24px;\r\n padding: 0 9px;\r\n font-size: var(--el-tag-font-size);\r\n line-height: normal;\r\n align-content: center;\r\n border-width: 1px;\r\n border-style: solid;\r\n border-radius: var(--el-tag-border-radius);\r\n box-sizing: border-box;\r\n white-space: nowrap;\r\n --el-icon-size: 14px;\r\n --el-tag-bg-color: var(--el-color-primary-light-9);\r\n --el-tag-border-color: var(--el-color-primary-light-8);\r\n --el-tag-hover-color: var(--el-color-primary);\r\n}\r\n.pops-panel-select-multiple .el-select__selection .el-tag {\r\n cursor: pointer;\r\n border-color: transparent;\r\n}\r\n.pops-panel-select-multiple .el-tag.el-tag--info {\r\n --el-tag-bg-color: var(--el-color-info-light-9);\r\n --el-tag-border-color: var(--el-color-info-light-8);\r\n --el-tag-hover-color: var(--el-color-info);\r\n}\r\n.pops-panel-select-multiple .el-tag.el-tag--info {\r\n --el-tag-text-color: var(--el-color-info);\r\n}\r\n.pops-panel-select-multiple .el-tag.is-closable {\r\n padding-right: 5px;\r\n}\r\n.pops-panel-select-multiple .el-select__selection .el-tag .el-tag__content {\r\n min-width: 0;\r\n}\r\n.pops-panel-select-multiple .el-tag .el-tag__close {\r\n flex-shrink: 0;\r\n color: var(--el-tag-text-color);\r\n}\r\n.pops-panel-select-multiple .el-tag .el-tag__close:hover {\r\n color: var(--el-color-white);\r\n background-color: var(--el-tag-hover-color);\r\n}\r\n.pops-panel-select-multiple .el-tag .el-icon {\r\n border-radius: 50%;\r\n cursor: pointer;\r\n font-size: calc(var(--el-icon-size) - 2px);\r\n height: var(--el-icon-size);\r\n width: var(--el-icon-size);\r\n}\r\n.pops-panel-select-multiple .el-tag .el-tag__close {\r\n margin-left: 6px;\r\n}\r\n.pops-panel-select-multiple .el-select__tags-text {\r\n display: block;\r\n line-height: normal;\r\n align-content: center;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n}\r\n.pops-panel-select-multiple-disable {\r\n --el-fill-color-blank: #f5f7fa;\r\n --color: #a8abb2;\r\n --el-border-color: #cbcbcb;\r\n}\r\n.pops-panel-select-multiple-disable .el-tag.el-tag--info {\r\n --el-tag-bg-color: #e7e7e7;\r\n --el-tag-text-color: var(--pops-components-is-disabled-text-color);\r\n}\r\n.pops-panel-select-multiple-disable .el-select__selection .el-tag,\r\n.pops-panel-select-multiple-disable .el-tag .el-tag__close:hover,\r\n.pops-panel-select-multiple-disable .el-select__wrapper,\r\n.pops-panel-select-multiple-disable .el-select__caret {\r\n cursor: not-allowed;\r\n}\r\n/* select-multiple的CSS*/\r\n\r\n/* deepMenu的css */\r\n.pops-panel-deepMenu-nav-item {\r\n cursor: pointer;\r\n}\r\n.pops-panel-deepMenu-nav-item:active {\r\n background: var(--pops-panel-forms-container-deepMenu-item-active-bg);\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\nsection.pops-panel-container .pops-panel-forms-container-item ul li.pops-panel-deepMenu-nav-item:active {\r\n padding: var(--pops-panel-forms-container-li-padding-top-bottom)\r\n var(--pops-panel-forms-container-li-padding-left-right);\r\n margin: 0px;\r\n}\r\n/* 去除上个兄弟item的底部边框颜色 */\r\nsection.pops-panel-container .pops-panel-forms-container-item ul li:has(+ .pops-panel-deepMenu-nav-item:active) {\r\n border-bottom: 1px solid transparent;\r\n}\r\n/* 第一个和最后一个跟随圆角 */\r\nsection.pops-panel-container .pops-panel-forms-container-item ul li.pops-panel-deepMenu-nav-item:first-child:active {\r\n border-top-left-radius: var(--pops-panel-forms-container-item-border-radius);\r\n border-top-right-radius: var(--pops-panel-forms-container-item-border-radius);\r\n}\r\nsection.pops-panel-container .pops-panel-forms-container-item ul li.pops-panel-deepMenu-nav-item:last-child:active {\r\n border-bottom-left-radius: var(--pops-panel-forms-container-item-border-radius);\r\n border-bottom-right-radius: var(--pops-panel-forms-container-item-border-radius);\r\n}\r\n.pops-panel-deepMenu-nav-item .pops-panel-deepMenu {\r\n display: flex;\r\n align-items: center;\r\n color: #6c6c6c;\r\n fill: #6c6c6c;\r\n}\r\n.pops-panel-deepMenu-nav-item .pops-panel-deepMenu-arrowRight-icon {\r\n width: 15px;\r\n height: 15px;\r\n display: flex;\r\n align-items: center;\r\n}\r\nsection.pops-panel-deepMenu-container .pops-panel-container-header-ul li.pops-panel-deepMenu-container-header {\r\n display: flex;\r\n align-items: center;\r\n width: -webkit-fill-available;\r\n width: -moz-available;\r\n padding: var(--pops-panel-forms-header-padding-top-bottom)\r\n calc(\r\n var(--pops-panel-forms-margin-left-right) + var(--pops-panel-forms-container-li-padding-left-right) -\r\n var(--pops-panel-forms-header-icon-size)\r\n );\r\n gap: 0px;\r\n}\r\n.pops-panel-deepMenu-container .pops-panel-deepMenu-container-left-arrow-icon {\r\n width: var(--pops-panel-forms-header-icon-size);\r\n height: var(--pops-panel-forms-header-icon-size);\r\n display: flex;\r\n align-items: center;\r\n cursor: pointer;\r\n}\r\n/* 修复safari上图标大小未正常显示 */\r\n.pops-panel-deepMenu-container .pops-panel-deepMenu-container-left-arrow-icon > svg {\r\n width: inherit;\r\n height: inherit;\r\n}\r\n/* deepMenu的css */\r\n\r\n/* 文字对齐 */\r\n.pops-panel-item-left-desc-text:has(code) {\r\n display: flex;\r\n align-items: baseline;\r\n flex-wrap: wrap;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n .pops[type-value="panel"] {\r\n --pops-bg-color: #000000;\r\n --pops-color: #f2f2f2;\r\n --panel-title-bg-color: #000000;\r\n --panel-aside-bg-color: #262626;\r\n --pops-panel-forms-container-item-left-desc-text-color: #6c6c6c;\r\n --pops-panel-forms-container-item-bg-color: #262626;\r\n --pops-panel-forms-container-item-title-color: #c1c1c1;\r\n\r\n --pops-panel-forms-container-li-border-color: rgb(51, 51, 51, var(--pops-bd-opacity));\r\n --pops-panel-forms-container-deepMenu-item-active-bg: #333333;\r\n }\r\n .pops[type-value="panel"] .pops-panel-deepMenu-container .pops-panel-deepMenu-container-left-arrow-icon {\r\n fill: #f2f2f2;\r\n }\r\n\r\n /* switch的CSS */\r\n .pops-panel-switch {\r\n --panel-switch-core-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));\r\n --panel-switch-core-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));\r\n --panel-switch-circle-color: #dcdfe6;\r\n --panel-switch-circle-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n --panel-switch-checked-circle-color: #409eff;\r\n --panel-switch-checked-core-bd-color: rgb(64, 158, 255, var(--pops-bd-opacity));\r\n --panel-switch-checked-core-bg-color: rgb(64, 158, 255, var(--pops-bg-opacity));\r\n }\r\n /* select的CSS */\r\n .pops-panel-select {\r\n --pops-panel-components-select-text-color: #f2f2f2;\r\n --pops-panel-components-select-bd-color: rgb(51, 51, 51, var(--pops-bd-opacity));\r\n --pops-panel-components-select-bg-color: #141414;\r\n }\r\n /* select-multiple的CSS*/\r\n .pops-panel-select-multiple {\r\n --el-fill-color-blank: #141414;\r\n --el-border-color: #4c4d4f;\r\n --el-text-color-placeholder: #a8abb2;\r\n --el-select-input-color: #a8abb2;\r\n --el-text-color-regular: #606266;\r\n --el-color-info: #909399;\r\n --el-color-info-light-8: #e9e9eb;\r\n --el-color-primary-light-9: #ecf5ff;\r\n --el-color-primary-light-8: #d9ecff;\r\n --el-color-primary: #409eff;\r\n --el-color-white: #ffffff;\r\n }\r\n .pops-panel-select-multiple .el-tag {\r\n --el-color-info-light-9: #202121;\r\n }\r\n .pops-panel-select-multiple-disable {\r\n --el-border-color: rgb(51, 51, 51, var(--pops-bd-opacity));\r\n }\r\n .pops-panel-select-multiple-disable .el-tag.el-tag--info {\r\n --el-tag-bg-color: #2f2f2f;\r\n }\r\n /* select-multiple的CSS*/\r\n /* slider的CSS */\r\n .pops-slider {\r\n --pops-slider-border-color-light: #414243;\r\n }\r\n /* input的CSS */\r\n .pops-panel-input {\r\n --pops-panel-components-input-text-color: #f2f2f2;\r\n --pops-panel-components-input-bd-color: #4f5052;\r\n --pops-panel-components-input-bg-color: #141414;\r\n --pops-panel-components-input-hover-bd-color: #6f7175;\r\n --pops-panel-components-input-focus-bd-color: #409eff;\r\n --pops-panel-components-input-suffix-color: #a8abb2;\r\n }\r\n /* textarea的CSS */\r\n .pops-panel-textarea {\r\n --pops-panel-components-textarea-text-color: #f2f2f2;\r\n --pops-panel-components-textarea-text-bg-color: #141414;\r\n --pops-panel-components-textarea-bd-color: #4f5052;\r\n --pops-panel-components-textarea-hover-bd-color: #6f7175;\r\n --pops-panel-components-textarea-focus-bd-color: #409eff;\r\n }\r\n .pops-panel-textarea-disable {\r\n --pops-panel-components-textarea-text-color: var(--pops-components-is-disabled-text-color);\r\n --pops-panel-components-textarea-text-bg-color: var(--pops-components-is-disabled-bg-color);\r\n }\r\n /* slider */\r\n .pops-slider {\r\n --pops-slider-text-color-placeholder: #8d9095;\r\n }\r\n}\r\n';
var rightClickMenuCSS =
'.pops-rightClickMenu {\r\n --pops-right-context-color: #000000;\r\n --pops-right-context-bg-color: rgb(255, 255, 255, 0.733);\r\n --pops-right-context-backdrop-filter: blur(10px);\r\n --pops-right-context-z-index: 10000;\r\n --pops-right-context-bd-radius: 6px;\r\n --pops-right-context-menu-shadow-color: rgb(114, 114, 114, 0.251);\r\n --pops-right-context-menu-row-bd-radius: 6px;\r\n --pops-right-context-menu-row-visited-color: rgb(0, 0, 0, 0.067);\r\n --pops-right-context-menu-row-hover-color: rgb(0, 0, 0, 0.067);\r\n}\r\n.pops-rightClickMenu * {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n margin: 0;\r\n padding: 0;\r\n -webkit-tap-highlight-color: transparent;\r\n scrollbar-width: thin;\r\n}\r\n.pops-rightClickMenu {\r\n position: fixed;\r\n z-index: var(--pops-right-context-z-index);\r\n text-align: center;\r\n border-radius: var(--pops-right-context-bd-radius);\r\n font-size: 16px;\r\n font-weight: 500;\r\n color: var(--pops-right-context-color);\r\n background: var(--pops-right-context-bg-color);\r\n box-shadow: 0 0.25rem 0.5rem 0.125rem var(--pops-right-context-menu-shadow-color);\r\n -webkit-backdrop-filter: var(--pops-right-context-backdrop-filter);\r\n backdrop-filter: var(--pops-right-context-backdrop-filter);\r\n}\r\n/* scale动画 */\r\n.pops-rightClickMenu-anim-scale {\r\n transition:\r\n opacity 150ms cubic-bezier(0.2, 0, 0.2, 1),\r\n transform 150ms cubic-bezier(0.2, 0, 0.2, 1);\r\n transform: scale(0.85);\r\n}\r\n.pops-rightClickMenu-anim-scale-open {\r\n transform: scale(1);\r\n}\r\n.pops-rightClickMenu-anim-scale-not-open {\r\n opacity: 0;\r\n}\r\n/* 展开动画 */\r\n.pops-rightClickMenu-anim-grid {\r\n display: grid;\r\n transition: 0.3s;\r\n grid-template-rows: 0fr;\r\n}\r\n.pops-rightClickMenu-anim-show {\r\n grid-template-rows: 1fr;\r\n}\r\n.pops-rightClickMenu-is-visited {\r\n background: var(--pops-right-context-menu-row-visited-color);\r\n}\r\ni.pops-rightClickMenu-icon {\r\n height: 1em;\r\n width: 1em;\r\n line-height: normal;\r\n align-content: center;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n position: relative;\r\n fill: currentColor;\r\n color: inherit;\r\n font-size: inherit;\r\n margin-right: 6px;\r\n}\r\ni.pops-rightClickMenu-icon[is-loading="true"] {\r\n animation: rotating 2s linear infinite;\r\n}\r\n.pops-rightClickMenu li:hover {\r\n background: var(--pops-right-context-menu-row-hover-color);\r\n cursor: pointer;\r\n}\r\n.pops-rightClickMenu ul {\r\n margin: 0;\r\n padding: 0;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: flex-start;\r\n justify-content: center;\r\n overflow: hidden;\r\n}\r\n.pops-rightClickMenu ul li {\r\n padding: 5px 10px;\r\n margin: 5px 5px;\r\n border-radius: var(--pops-right-context-menu-row-bd-radius);\r\n display: flex;\r\n width: -webkit-fill-available;\r\n width: -moz-available;\r\n text-align: left;\r\n align-items: center;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n /*.pops-rightClickMenu {\r\n --pops-right-context-menu-shadow-color: #3c3c3c;\r\n }*/\r\n}\r\n@media (hover: hover) {\r\n .pops-rightClickMenu ul li:active {\r\n transform: scale(0.98);\r\n }\r\n}\r\n';
const PopsCSS = {
index: indexCSS,
ninePalaceGridPosition: ninePalaceGridPositionCSS,
scrollbar: scrollbarCSS,
button: buttonCSS,
common: commonCSS,
anim: animCSS,
alertCSS,
confirmCSS,
promptCSS,
loadingCSS,
iframeCSS,
tooltipCSS,
drawerCSS,
folderCSS,
panelCSS,
rightClickMenu: rightClickMenuCSS,
};
const PopsAnimation = {
$data: {},
$flag: {
isInit: false,
},
init() {
if (!this.$flag.isInit) {
this.$flag.isInit = true;
const animationStyle = document.createElement("style");
PopsSafeUtils.setSafeHTML(animationStyle, PopsCSS.anim);
popsDOMUtils.appendHead(animationStyle);
this.$data = null;
this.$data = popsDOMUtils.getKeyFrames(animationStyle.sheet);
popsUtils.setTimeout(() => {
animationStyle.remove();
}, 50);
}
},
hasAnim(name) {
return Object.prototype.hasOwnProperty.call(this.$data, name);
},
};
const PopsInstData = {
alert: [],
confirm: [],
drawer: [],
folder: [],
iframe: [],
loading: [],
panel: [],
prompt: [],
rightClickMenu: [],
tooltip: [],
};
const PopsInstanceUtils = {
getMaxZIndexNodeInfo(deviation = 1, target = PopsCore.document, ignoreCallBack) {
deviation = Number.isNaN(deviation) ? 1 : deviation;
const maxZIndexCompare = 2 * Math.pow(10, 9);
let zIndex = 0;
let maxZIndexNode = null;
function isVisibleNode($css) {
return $css.position !== "static" && $css.display !== "none";
}
function queryMaxZIndex($ele) {
if (typeof ignoreCallBack === "function") {
const ignoreResult = ignoreCallBack($ele);
if (typeof ignoreResult === "boolean" && !ignoreResult) {
return;
}
}
const nodeStyle = PopsCore.window.getComputedStyle($ele);
if (isVisibleNode(nodeStyle)) {
const nodeZIndex = parseInt(nodeStyle.zIndex);
if (!isNaN(nodeZIndex)) {
if (nodeZIndex > zIndex) {
zIndex = nodeZIndex;
maxZIndexNode = $ele;
}
}
if ($ele.shadowRoot != null && $ele instanceof ShadowRoot) {
$ele.shadowRoot.querySelectorAll("*").forEach(($shadowEle) => {
queryMaxZIndex($shadowEle);
});
}
}
}
target.querySelectorAll("*").forEach(($ele) => {
queryMaxZIndex($ele);
});
zIndex += deviation;
if (zIndex >= maxZIndexCompare) {
zIndex = maxZIndexCompare;
}
return {
node: maxZIndexNode,
zIndex,
};
},
getPopsMaxZIndex(deviation = 1) {
deviation = Number.isNaN(deviation) ? 1 : deviation;
const maxZIndex = 2 * Math.pow(10, 9);
let zIndex = 0;
let maxZIndexNode = null;
function isVisibleNode($css) {
return $css.position !== "static" && $css.display !== "none";
}
Object.keys(PopsInstData).forEach((instKeyName) => {
const instData = PopsInstData[instKeyName];
for (let index = 0; index < instData.length; index++) {
const inst = instData[index];
const nodeStyle = window.getComputedStyle(inst.animElement);
if (isVisibleNode(nodeStyle)) {
const nodeZIndex = parseInt(nodeStyle.zIndex);
if (!isNaN(nodeZIndex)) {
if (nodeZIndex > zIndex) {
zIndex = nodeZIndex;
maxZIndexNode = inst.animElement;
}
}
}
}
});
zIndex += deviation;
const isOverMaxZIndex = zIndex >= maxZIndex;
if (isOverMaxZIndex) {
zIndex = maxZIndex;
}
return { zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
},
getMaxZIndex(deviation = 1) {
return this.getMaxZIndexNodeInfo(deviation).zIndex;
},
removeInstance(instConfigList, guid, isAll = false) {
function removeItem(instCommonConfig) {
if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
instCommonConfig.beforeRemoveCallBack(instCommonConfig);
}
instCommonConfig?.animElement?.remove();
instCommonConfig?.popsElement?.remove();
instCommonConfig?.maskElement?.remove();
instCommonConfig?.$shadowContainer?.remove();
}
instConfigList.forEach((instConfigList2) => {
instConfigList2.forEach((instConfigItem, index) => {
if (isAll || instConfigItem["guid"] === guid) {
const animName = instConfigItem.animElement.getAttribute("anim");
if (PopsAnimation.hasAnim(animName)) {
const reverseAnimName = animName + "-reverse";
instConfigItem.animElement.style.width = "100%";
instConfigItem.animElement.style.height = "100%";
instConfigItem.animElement.style["animation-name"] = reverseAnimName;
if (PopsAnimation.hasAnim(instConfigItem.animElement.style["animation-name"])) {
popsDOMUtils.on(
instConfigItem.animElement,
popsDOMUtils.getAnimationEndNameList(),
function () {
removeItem(instConfigItem);
},
{
capture: true,
}
);
} else {
removeItem(instConfigItem);
}
} else {
removeItem(instConfigItem);
}
instConfigList2.splice(index, 1);
}
});
});
return instConfigList;
},
hide(popsType, instConfigList, guid, config, animElement, maskElement) {
return new Promise((resolve) => {
const popsElement = animElement.querySelector(".pops[type-value]");
if (popsType === "drawer") {
const drawerConfig = config;
popsUtils.setTimeout(() => {
maskElement.style.setProperty("display", "none");
if (["top", "bottom"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("height", "0");
} else if (["left", "right"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("width", "0");
} else {
console.error("未知direction:", drawerConfig.direction);
}
resolve();
}, drawerConfig.closeDelay);
} else {
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
if (fintInst) {
const instConfigItem = fintInst;
instConfigItem.animElement.style.width = "100%";
instConfigItem.animElement.style.height = "100%";
Reflect.set(
instConfigItem.animElement.style,
"animation-name",
instConfigItem.animElement.getAttribute("anim") + "-reverse"
);
if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.animElement.style, "animation-name"))) {
let animationendCallBack2 = function () {
instConfigItem.animElement.style.display = "none";
if (instConfigItem.maskElement) {
instConfigItem.maskElement.style.display = "none";
}
popsDOMUtils.off(
instConfigItem.animElement,
popsDOMUtils.getAnimationEndNameList(),
animationendCallBack2,
{
capture: true,
}
);
resolve();
};
popsDOMUtils.on(
instConfigItem.animElement,
popsDOMUtils.getAnimationEndNameList(),
animationendCallBack2,
{
capture: true,
}
);
} else {
instConfigItem.animElement.style.display = "none";
if (instConfigItem.maskElement) {
instConfigItem.maskElement.style.display = "none";
}
resolve();
}
}
}
});
},
show(popsType, instConfigList, guid, config, animElement, maskElement) {
return new Promise((resolve) => {
const popsElement = animElement.querySelector(".pops[type-value]");
if (popsType === "drawer") {
const drawerConfig = config;
popsUtils.setTimeout(() => {
popsDOMUtils.css(maskElement, "display", "");
const direction = drawerConfig.direction;
const size = drawerConfig.size.toString();
if (["top", "bottom"].includes(direction)) {
popsElement.style.setProperty("height", size);
} else if (["left", "right"].includes(direction)) {
popsElement.style.setProperty("width", size);
} else {
console.error("未知direction:", direction);
}
resolve();
}, drawerConfig.openDelay ?? 0);
} else {
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
if (fintInst) {
const instConfigItem = fintInst;
instConfigItem.animElement.style.width = "";
instConfigItem.animElement.style.height = "";
Reflect.set(
instConfigItem.animElement.style,
"animation-name",
instConfigItem.animElement.getAttribute("anim").replace("-reverse", "")
);
if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.animElement.style, "animation-name"))) {
let animationendCallBack2 = function () {
popsDOMUtils.off(
instConfigItem.animElement,
popsDOMUtils.getAnimationEndNameList(),
animationendCallBack2,
{
capture: true,
}
);
resolve();
};
instConfigItem.animElement.style.display = "";
if (instConfigItem.maskElement) {
instConfigItem.maskElement.style.display = "";
}
popsDOMUtils.on(
instConfigItem.animElement,
popsDOMUtils.getAnimationEndNameList(),
animationendCallBack2,
{
capture: true,
}
);
} else {
instConfigItem.animElement.style.display = "";
if (instConfigItem.maskElement) {
instConfigItem.maskElement.style.display = "";
}
resolve();
}
}
}
});
},
close(popsType, instConfigList, guid, config, animElement) {
return new Promise((resolve) => {
const popsElement = animElement.querySelector(".pops[type-value]");
const drawerConfig = config;
function transitionendEvent() {
function closeCallBack(event) {
if (event.propertyName !== "transform") {
return;
}
popsDOMUtils.off(popsElement, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
PopsInstanceUtils.removeInstance([instConfigList], guid);
resolve();
}
popsDOMUtils.on(popsElement, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
const popsTransForm = getComputedStyle(popsElement).transform;
if (popsTransForm !== "none") {
popsDOMUtils.trigger(popsElement, popsDOMUtils.getTransitionEndNameList(), void 0, true);
return;
}
if (["top"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("transform", "translateY(-100%)");
} else if (["bottom"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("transform", "translateY(100%)");
} else if (["left"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("transform", "translateX(-100%)");
} else if (["right"].includes(drawerConfig.direction)) {
popsElement.style.setProperty("transform", "translateX(100%)");
} else {
console.error("未知direction:", drawerConfig.direction);
}
}
if (popsType === "drawer") {
popsUtils.setTimeout(() => {
transitionendEvent();
}, drawerConfig.closeDelay);
} else {
PopsInstanceUtils.removeInstance([instConfigList], guid);
resolve();
}
});
},
drag(moveElement, options) {
options = Object.assign(
{
limit: true,
extraDistance: 3,
container: PopsCore.globalThis,
triggerClick: true,
},
options
);
let isMove = false;
let clickElementLeftOffset = 0;
let clickElementTopOffset = 0;
const AnyTouch = popsUtils.AnyTouch();
const anyTouchElement = new AnyTouch(options.dragElement, {
preventDefault(event) {
if (typeof options.preventEvent === "function") {
return options.preventEvent(event);
} else {
return true;
}
},
});
popsDOMUtils.css(options.dragElement, {
cursor: "move",
});
function changeMoveElementStyle(element) {
const old_transitionDuration = element.style.transitionDuration;
if (globalThis.getComputedStyle(element).transitionDuration !== "0s") {
element.style.transitionDuration = "0s";
}
return () => {
element.style.transitionDuration = old_transitionDuration;
};
}
function getContainerWidthOrHeight(container) {
container = container ?? globalThis;
return {
width: popsDOMUtils.width(container),
height: popsDOMUtils.height(container),
};
}
function getContainerTopOrLeft(container) {
container = container ?? globalThis;
if (popsUtils.isWin(container)) {
return {
left: 0,
top: 0,
};
} else {
const rect = container.getBoundingClientRect();
return {
left: rect.left,
top: rect.top,
};
}
}
let transformInfo = popsDOMUtils.getTransform(moveElement);
let resumeMoveElementStyle = null;
anyTouchElement.on("pan", function (event) {
if (!isMove) {
isMove = true;
const rect = options.dragElement.getBoundingClientRect();
clickElementLeftOffset = event.x - rect.left;
clickElementTopOffset = event.y - rect.top;
transformInfo = popsDOMUtils.getTransform(moveElement);
resumeMoveElementStyle = changeMoveElementStyle(moveElement);
}
let currentMoveLeftOffset = event.x - clickElementLeftOffset + transformInfo.transformLeft;
let currentMoveTopOffset = event.y - clickElementTopOffset + transformInfo.transformTop;
if (event.phase === "move") {
if (options.limit) {
const maxLeftOffset =
getContainerWidthOrHeight(options.container).width -
popsDOMUtils.width(moveElement) +
transformInfo.transformLeft;
const { left: minLeftOffset, top: minTopOffset } = getContainerTopOrLeft(options.container);
const maxTopOffset =
getContainerWidthOrHeight(options.container).height -
popsDOMUtils.height(moveElement) +
transformInfo.transformTop;
if (currentMoveLeftOffset > maxLeftOffset) {
currentMoveLeftOffset = maxLeftOffset;
}
if (currentMoveTopOffset > maxTopOffset) {
currentMoveTopOffset = maxTopOffset;
}
if (currentMoveLeftOffset - options.extraDistance * 2 < minLeftOffset + transformInfo.transformLeft) {
currentMoveLeftOffset = minLeftOffset + transformInfo.transformLeft;
currentMoveLeftOffset += options.extraDistance;
} else {
currentMoveLeftOffset -= options.extraDistance;
}
if (currentMoveTopOffset - options.extraDistance * 2 < minTopOffset + transformInfo.transformTop) {
currentMoveTopOffset = minTopOffset + transformInfo.transformTop;
currentMoveTopOffset += options.extraDistance;
} else {
currentMoveTopOffset -= options.extraDistance;
}
}
if (typeof options.moveCallBack === "function") {
options.moveCallBack(moveElement, currentMoveLeftOffset, currentMoveTopOffset);
}
popsDOMUtils.css(moveElement, {
left: currentMoveLeftOffset + "px",
top: currentMoveTopOffset + "px",
});
}
if (event.phase === "end") {
isMove = false;
if (typeof resumeMoveElementStyle === "function") {
resumeMoveElementStyle();
resumeMoveElementStyle = null;
}
if (typeof options.endCallBack === "function") {
options.endCallBack(moveElement, currentMoveLeftOffset, currentMoveTopOffset);
}
}
});
if (options.triggerClick) {
anyTouchElement.on(["tap"], function (event) {
event.changedPoints.forEach((item) => {
popsDOMUtils.trigger(item.target, "click", void 0, true);
});
});
}
},
sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
if (typeof sortByDesc !== "boolean") {
throw new TypeError("参数 sortByDesc 必须为boolean类型");
}
if (getBeforeValueFun == null || getAfterValueFun == null) {
throw new Error("获取前面的值或后面的值的方法不能为空");
}
return function (after_obj, before_obj) {
const beforeValue = getBeforeValueFun(before_obj);
const afterValue = getAfterValueFun(after_obj);
if (sortByDesc) {
if (afterValue > beforeValue) {
return -1;
} else if (afterValue < beforeValue) {
return 1;
} else {
return 0;
}
} else {
if (afterValue < beforeValue) {
return -1;
} else if (afterValue > beforeValue) {
return 1;
} else {
return 0;
}
}
};
},
};
const PopsHandler = {
handlerShadow(config) {
const $shadowContainer = document.createElement("div");
$shadowContainer.className = "pops-shadow-container";
if (config.useShadowRoot) {
const $shadowRoot = $shadowContainer.attachShadow({ mode: "open" });
return {
$shadowContainer,
$shadowRoot,
};
} else {
return {
$shadowContainer,
$shadowRoot: $shadowContainer,
};
}
},
handleInit($styleParent, css) {
PopsAnimation.init();
if (!arguments.length) {
return;
}
if ($styleParent == null) {
return;
}
if (css == null) {
return;
}
if (typeof css === "string") {
if (css.trim() === "") {
return;
}
css = [
{
css,
},
];
} else {
css = css.map((item) => {
if (typeof item === "string") {
return {
css: item,
};
} else {
return item;
}
});
}
for (const cssItem of css) {
const $css = popsDOMUtils.createElement(
"style",
{},
{
"data-type": "PopsHandler.handleInit",
}
);
$css.textContent = cssItem.css;
if (typeof cssItem.name === "string") {
$css.setAttribute("data-name", cssItem.name);
}
$styleParent.appendChild($css);
}
},
handleMask(details = {}) {
const result = {
maskElement: popsDOMUtils.parseTextToDOM(details.maskHTML),
};
let isMaskClick = false;
function clickEvent(event) {
popsDOMUtils.preventEvent(event);
const targetInst = PopsInstData[details.type];
function originalRun() {
if (details.config.mask.clickEvent.toClose) {
return PopsInstanceUtils.close(details.type, targetInst, details.guid, details.config, details.animElement);
} else if (details.config.mask.clickEvent.toHide) {
return PopsInstanceUtils.hide(
details.type,
targetInst,
details.guid,
details.config,
details.animElement,
result.maskElement
);
}
}
if (typeof details.config.mask.clickCallBack === "function") {
details.config.mask.clickCallBack(originalRun, details.config);
} else {
originalRun();
}
return false;
}
if (details.config.mask.clickEvent.toClose || details.config.mask.clickEvent.toHide) {
let isAnimElement2 = function (element) {
return Boolean(
element?.localName?.toLowerCase() === "div" &&
element.className &&
element.className === "pops-anim" &&
element.hasAttribute("anim")
);
};
popsDOMUtils.on(details.animElement, ["touchstart", "mousedown"], void 0, (event) => {
const $click = event.composedPath()[0];
isMaskClick = isAnimElement2($click);
});
popsDOMUtils.on(details.animElement, "click", void 0, (event) => {
const $click = event.composedPath()[0];
if (isAnimElement2($click) && isMaskClick) {
return clickEvent(event);
}
});
popsDOMUtils.on(result.maskElement, "click", void 0, (event) => {
isMaskClick = true;
clickEvent(event);
});
}
return result;
},
handleQueryElement(animElement, type) {
return {
popsElement: animElement.querySelector(".pops[type-value"),
btnOkElement: animElement.querySelector(`.pops-${type}-btn-ok`),
btnCancelElement: animElement.querySelector(`.pops-${type}-btn-cancel`),
btnOtherElement: animElement.querySelector(`.pops-${type}-btn-other`),
titleElement: animElement.querySelector(`.pops-${type}-title`),
inputElement: animElement.querySelector(`.pops-${type}-content textarea[pops]`)
? animElement.querySelector(`.pops-${type}-content textarea[pops]`)
: animElement.querySelector(`.pops-${type}-content input[pops]`),
headerControlsElement: animElement.querySelector(".pops-header-controls"),
iframeElement: animElement.querySelector("iframe[pops]"),
loadingElement: animElement.querySelector(".pops-loading"),
contentElement: animElement.querySelector(`.pops-${type}-content`),
panelSectionWrapper: animElement.querySelector(`.pops-${type}-section-wrapper`),
contentAsideElement: animElement.querySelector(`.pops-${type}-content aside.pops-${type}-aside`),
contentSectionContainerElement: animElement.querySelector(
`.pops-${type}-content section.pops-${type}-container`
),
contentLoadingElement: animElement.querySelector(`.pops-${type}-content-global-loading`),
headerMinBtnElement: animElement.querySelector(".pops-header-control[data-type='min']"),
headerMaxBtnElement: animElement.querySelector(".pops-header-control[data-type='max']"),
headerMiseBtnElement: animElement.querySelector(".pops-header-control[data-type='mise']"),
headerCloseBtnElement: animElement.querySelector(".pops-header-control[data-type='close']"),
folderListElement: animElement.querySelector(".pops-folder-list"),
folderListHeaderElement: animElement.querySelector(".pops-folder-list .pops-folder-list-table__header-div"),
folderListHeaderRowElement: animElement.querySelector(
".pops-folder-list .pops-folder-list-table__header-div .pops-folder-list-table__header-row"
),
folderListBodyElement: animElement.querySelector(".pops-folder-list .pops-folder-list-table__body-div tbody"),
folderFileListBreadcrumbPrimaryElement: animElement.querySelector(
".pops-folder-list .pops-folder-file-list-breadcrumb-primary"
),
folderListSortFileNameElement: animElement.querySelector('.pops-folder-list-table__sort[data-sort="fileName"]'),
folderListSortLatestTimeElement: animElement.querySelector(
'.pops-folder-list-table__sort[data-sort="latestTime"]'
),
folderListSortFileSizeElement: animElement.querySelector('.pops-folder-list-table__sort[data-sort="fileSize"]'),
};
},
handleEventDetails(guid, $shadowContainer, $shadowRoot, mode, animElement, popsElement, maskElement, config) {
return {
$shadowContainer,
$shadowRoot,
element: animElement,
animElement,
popsElement,
maskElement,
mode,
guid,
close() {
return PopsInstanceUtils.close(mode, PopsInstData[mode], guid, config, animElement);
},
hide() {
return PopsInstanceUtils.hide(mode, PopsInstData[mode], guid, config, animElement, maskElement);
},
show() {
return PopsInstanceUtils.show(mode, PopsInstData[mode], guid, config, animElement, maskElement);
},
};
},
handleLoadingEventDetails(guid, mode, animElement, popsElement, maskElement, config) {
return {
element: animElement,
animElement,
popsElement,
maskElement,
mode,
guid,
close() {
return PopsInstanceUtils.close(mode, PopsInstData[mode], guid, config, animElement);
},
hide() {
return PopsInstanceUtils.hide(mode, PopsInstData[mode], guid, config, animElement, maskElement);
},
show() {
return PopsInstanceUtils.show(mode, PopsInstData[mode], guid, config, animElement, maskElement);
},
};
},
handleResultDetails(details) {
const resultDetails = Object.assign({}, details);
popsUtils.delete(resultDetails, "type");
popsUtils.delete(resultDetails, "function");
return resultDetails;
},
handleClickEvent(type, $btn, eventDetails, callback) {
popsDOMUtils.on(
$btn,
"click",
(event) => {
const extraParam = {
type,
};
callback(Object.assign(eventDetails, extraParam), event);
},
{
capture: true,
}
);
},
handleKeyboardEvent(keyName, otherKeyList = [], callback) {
const keyboardEvent = function (event) {
const _keyName = event.code || event.key;
const _keyValue = event.charCode || event.keyCode || event.which;
if (otherKeyList.includes("ctrl") && !event.ctrlKey) {
return;
}
if (otherKeyList.includes("alt") && !event.altKey) {
return;
}
if (otherKeyList.includes("meta") && !event.metaKey) {
return;
}
if (otherKeyList.includes("shift") && !event.shiftKey) {
return;
}
if (typeof keyName === "string" && keyName === _keyName) {
callback && callback(event);
} else if (typeof keyName === "number" && keyName === _keyValue) {
callback && callback(event);
}
};
popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
capture: true,
});
return {
removeKeyboardEvent() {
popsDOMUtils.off(globalThis, "keydown", keyboardEvent, {
capture: true,
});
},
};
},
handlePromptClickEvent(type, inputElement, $btn, eventDetails, callback) {
popsDOMUtils.on(
$btn,
"click",
(event) => {
const extraParam = {
type,
text: inputElement.value,
};
callback(Object.assign(eventDetails, extraParam), event);
},
{
capture: true,
}
);
},
handleZIndex(zIndex) {
if (typeof zIndex === "function") {
return zIndex();
} else {
return zIndex;
}
},
handleOnly(type, config) {
if (config.only) {
if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
const inst = PopsInstData[type];
if (inst) {
PopsInstanceUtils.removeInstance([inst], "", true);
}
} else {
PopsInstanceUtils.removeInstance(
[
PopsInstData.alert,
PopsInstData.confirm,
PopsInstData.prompt,
PopsInstData.iframe,
PopsInstData.drawer,
PopsInstData.folder,
PopsInstData.panel,
],
"",
true
);
}
} else {
const originZIndex = config.zIndex;
config.zIndex = () => {
const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(
PopsHandler.handleZIndex(originZIndex) + 100
);
return maxZIndex;
};
}
return config;
},
handlePush(type, value) {
PopsInstData[type].push(value);
},
};
const PopsAlertConfig = () => {
return {
title: {
text: "默认标题",
position: "left",
html: false,
style: "",
},
content: {
text: "默认内容",
html: false,
style: "",
},
btn: {
position: "flex-end",
ok: {
size: void 0,
enable: true,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "确定",
type: "primary",
callback: function (details) {
details.close();
},
},
close: {
enable: true,
callback: function (details) {
details.close();
},
},
},
useShadowRoot: true,
class: "",
only: false,
width: window.innerWidth < 550 ? "88vw" : "350px",
height: window.innerHeight < 450 ? "70vh" : "200px",
position: "center",
animation: "pops-anim-fadein-zoom",
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
drag: false,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
forbiddenScroll: false,
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsAlert = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "alert";
let config = PopsAlertConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "alertCSS",
css: PopsCSS.alertCSS,
},
]);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? config.title.text : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content" style="${contentStyle}">${config.content.html ? config.content.text : `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`}</div>${bottomBtnHTML}`,
bottomBtnHTML,
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
headerCloseBtnElement: $headerCloseBtn,
btnOkElement,
titleElement: $title,
} = PopsHandler.handleQueryElement($anim, popsType);
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
PopsHandler.handleClickEvent("close", $headerCloseBtn, eventDetails, config.btn.close.callback);
PopsHandler.handleClickEvent("ok", btnOkElement, eventDetails, config.btn.ok.callback);
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsConfirmConfig = () => {
return {
title: {
text: "默认标题",
position: "left",
html: false,
style: "",
},
content: {
text: "默认内容",
html: false,
style: "",
},
btn: {
merge: false,
mergeReverse: false,
reverse: false,
position: "flex-end",
ok: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "确定",
type: "primary",
callback(detail) {
detail.close();
},
},
cancel: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "关闭",
type: "default",
callback(detail) {
detail.close();
},
},
other: {
enable: false,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "其它按钮",
type: "default",
callback(detail) {
detail.close();
},
},
close: {
enable: true,
callback(detail) {
detail.close();
},
},
},
useShadowRoot: true,
class: "",
only: false,
width: window.innerWidth < 550 ? "88vw" : "350px",
height: window.innerHeight < 450 ? "70vh" : "200px",
position: "center",
animation: "pops-anim-fadein-zoom",
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
drag: false,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
forbiddenScroll: false,
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsConfirm = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "confirm";
let config = PopsConfirmConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "confirmCSS",
css: PopsCSS.confirmCSS,
},
]);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? config.title.text : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content" style="${contentStyle}">${config.content.html ? config.content.text : `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`}</div>${bottomBtnHTML}`,
bottomBtnHTML,
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
titleElement: $title,
headerCloseBtnElement: $btnClose,
btnOkElement: $btnOk,
btnCancelElement: $btnCancel,
btnOtherElement: $btnOther,
} = PopsHandler.handleQueryElement($anim, popsType);
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
PopsHandler.handleClickEvent("close", $btnClose, eventDetails, config.btn.close.callback);
PopsHandler.handleClickEvent("ok", $btnOk, eventDetails, config.btn.ok.callback);
PopsHandler.handleClickEvent("cancel", $btnCancel, eventDetails, config.btn.cancel.callback);
PopsHandler.handleClickEvent("other", $btnOther, eventDetails, config.btn.other.callback);
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsDrawerConfig = () => {
return {
title: {
enable: true,
position: "center",
text: "默认标题",
html: false,
style: "",
},
content: {
text: "默认内容",
html: false,
style: "",
},
btn: {
merge: false,
mergeReverse: false,
reverse: false,
position: "flex-end",
ok: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "确定",
type: "primary",
callback(detail) {
detail.close();
},
},
cancel: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "关闭",
type: "default",
callback(detail) {
detail.close();
},
},
other: {
enable: false,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "其它按钮",
type: "default",
callback(detail) {
detail.close();
},
},
close: {
enable: true,
callback(detail) {
detail.close();
},
},
},
mask: {
enable: true,
clickEvent: {
toClose: true,
toHide: false,
},
clickCallBack: null,
},
useShadowRoot: true,
class: "",
zIndex: 1e4,
only: false,
direction: "right",
size: "30%",
lockScroll: false,
closeOnPressEscape: true,
openDelay: 0,
closeDelay: 0,
borderRadius: 0,
style: null,
beforeAppendToPageCallBack() {},
forbiddenScroll: false,
};
};
const PopsDrawer = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "drawer";
let config = PopsDrawerConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "drawerCSS",
css: PopsCSS.drawerCSS,
},
]);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const { contentStyle, contentPStyle } = PopsElementHandler.createContentStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
${
config.title.enable
? `<div class="pops-title pops-${popsType}-title" style="${headerStyle}">${
config.title.html
? config.title.text
: `<p pops class="pops-${popsType}-title-text" style="width: 100%;text-align: ${config.title.position};${headerPStyle}">${config.title.text}</p>`
}${headerBtnHTML}</div>`
: ""
}
<div class="pops-content pops-${popsType}-content" style="${contentStyle}">${config.content.html ? config.content.text : `<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>`}</div>${bottomBtnHTML}`,
bottomBtnHTML,
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const { popsElement, headerCloseBtnElement, btnCancelElement, btnOkElement, btnOtherElement } =
PopsHandler.handleQueryElement($anim, popsType);
const $pops = popsElement;
const $headerCloseBtn = headerCloseBtnElement;
const $btnCancel = btnCancelElement;
const $btnOk = btnOkElement;
const $btnOther = btnOtherElement;
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
$pops.setAttribute("direction", config.direction);
if (config.direction === "top") {
$pops.style.setProperty("height", "0");
$pops.style.setProperty("border-radius", `0px 0px ${config.borderRadius}px ${config.borderRadius}px`);
} else if (config.direction === "bottom") {
$pops.style.setProperty("height", "0");
$pops.style.setProperty("border-radius", `${config.borderRadius}px ${config.borderRadius}px 0px 0px`);
} else if (config.direction === "left") {
$pops.style.setProperty("width", "0");
$pops.style.setProperty("border-radius", `0px ${config.borderRadius}px 0px ${config.borderRadius}px`);
} else if (config.direction === "right") {
$pops.style.setProperty("width", "0");
$pops.style.setProperty("border-radius", `${config.borderRadius}px 0px ${config.borderRadius}px 0px`);
}
if (config.closeOnPressEscape) {
PopsHandler.handleKeyboardEvent("Escape", [], function () {
eventDetails.close();
});
}
const needHandleClickEventList = [
{
type: "close",
ele: $headerCloseBtn,
},
{
type: "cancel",
ele: $btnCancel,
},
{
type: "ok",
ele: $btnOk,
},
{
type: "other",
ele: $btnOther,
},
];
needHandleClickEventList.forEach((item) => {
PopsHandler.handleClickEvent(item.type, item.ele, eventDetails, (_eventDetails_) => {
if (typeof config.btn[item.type].callback === "function") {
config.btn[item.type].callback(_eventDetails_);
}
});
});
elementList.forEach((element) => {
element.style.setProperty("display", "none");
if (["top"].includes(config.direction)) {
$pops.style.setProperty("height", config.size.toString());
$pops.style.setProperty("transform", "translateY(-100%)");
} else if (["bottom"].includes(config.direction)) {
$pops.style.setProperty("height", config.size.toString());
$pops.style.setProperty("transform", "translateY(100%)");
} else if (["left"].includes(config.direction)) {
$pops.style.setProperty("width", config.size.toString());
$pops.style.setProperty("transform", "translateX(-100%)");
} else if (["right"].includes(config.direction)) {
$pops.style.setProperty("width", config.size.toString());
$pops.style.setProperty("transform", "translateX(100%)");
}
element.style.setProperty("display", "");
});
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
popsUtils.setTimeout(() => {
popsUtils.setTimeout(() => {
$pops.style.setProperty("transform", "");
}, config.openDelay);
}, 50);
if ($mask != null) {
$anim.after($mask);
}
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsLoadingConfig = () => {
return {
parent: document.body,
content: {
text: "加载中...",
icon: "loading",
style: "",
},
useShadowRoot: true,
class: "",
only: false,
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
animation: "pops-anim-fadein-zoom",
forbiddenScroll: false,
isAbsolute: false,
style: null,
addIndexCSS: true,
};
};
const PopsLoading = {
init(details) {
let config = PopsLoadingConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
const guid = popsUtils.getRandomGUID();
const PopsType = "loading";
config = PopsHandler.handleOnly(PopsType, config);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
const animHTML = PopsElementHandler.createAnim(
guid,
PopsType,
config,
`
<div class="pops-content pops-${PopsType}-content">${
config.addIndexCSS
? `
<style data-model-name="index">${PopsCSS.index}</style>
<style data-model-name="anim">${PopsCSS.anim}</style>
<style data-model-name="common">${PopsCSS.common}</style>
`
: ""
}
<style data-model-name="loadingCSS">
${PopsCSS.loadingCSS}
</style>
${config.style != null ? `<style>${config.style}</style>` : ""}
<p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
</div>`,
"",
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const { popsElement: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: PopsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleLoadingEventDetails(guid, PopsType, $anim, $pops, $mask, config);
popsDOMUtils.append(config.parent, elementList);
if ($mask != null) {
$anim.after($mask);
}
PopsHandler.handlePush(PopsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
});
if (config.isAbsolute) {
popsDOMUtils.css($anim, "position", "absolute !important");
$mask && popsDOMUtils.css($mask, "position", "absolute !important");
}
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsFolderConfig = () => {
return {
title: {
text: "pops.Folder",
position: "center",
html: false,
style: "",
},
sort: {
name: "latestTime",
isDesc: false,
callback() {},
},
folder: [
{
fileName: "测试文件夹",
fileSize: 0,
fileType: "",
createTime: 0,
latestTime: 0,
isFolder: true,
index: 0,
clickEvent() {
return [
{
fileName: "测试文件夹2222",
fileSize: 0,
fileType: "",
createTime: 0,
latestTime: 0,
isFolder: true,
index: 0,
clickEvent() {
return [
{
fileName: "内部-测试文件.zip",
fileSize: 1025e3,
fileType: "zip",
createTime: 1702038410440,
latestTime: 1702039602126,
isFolder: false,
index: 1,
clickEvent() {
console.log("下载文件:", this.fileName);
return "https://update.greasyfork.org/scripts/456485/pops.js";
},
},
];
},
},
];
},
},
{
fileName: "测试文件.apk",
fileSize: 30125682,
fileType: "apk",
createTime: 1702036410440,
latestTime: 1702039410440,
isFolder: false,
index: 1,
clickEvent() {
console.log("下载文件:", this.fileName);
return "https://update.greasyfork.org/scripts/456485/pops.js";
},
},
],
btn: {
merge: false,
mergeReverse: false,
reverse: false,
position: "flex-end",
ok: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "确定",
type: "primary",
callback(detail) {
detail.close();
},
},
cancel: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "关闭",
type: "default",
callback(detail) {
detail.close();
},
},
other: {
enable: false,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "其它按钮",
type: "default",
callback(detail) {
detail.close();
},
},
close: {
enable: true,
callback(detail) {
detail.close();
},
},
},
useShadowRoot: true,
class: "",
only: false,
width: window.innerWidth < 550 ? "88vw" : "500px",
height: window.innerHeight < 450 ? "70vh" : "400px",
position: "center",
animation: "pops-anim-fadein-zoom",
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
drag: false,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
forbiddenScroll: false,
style: null,
beforeAppendToPageCallBack() {},
};
};
const Folder_ICON = {
folder:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABRUExURUxpcf++Hv/ZU//OPv/DL/+9Gv/BI/+4Bf+4Ef/XcP/LOP/TSf/RRP/WTv/JM/+3Ef+9Ff/bhf+5BP/DJf+yDv/imv/kqv/bXP/w0v/fd//calQXUgwAAAAKdFJOUwB///8d3L9enl8sr20gAAACN0lEQVRYw+2Y65abIBRGE1EzVbyNSW18/wctHA6XYw4q9Ee7Vt2AgOHbcVyTOMztdnFxcXFMWf7gKHN190VRKDpFC0iNqB5ZvqpXzJRxHoF7hrAa9/hK9j2oYIA2QA/UqXeyNg5QDBrshhHbUH8xxO+uT7sOJ/tU5a4wh0eK8KmKHTxd28Bfo16pqphep5l6I+R/p8xr668kVghVceH8M5EZYnGhnBKRceGqmaZXPPw2xbO+1xU+8axwe8NfzkIV7xVZdF0AVhi+rWdxIfgmwloE6CkrDCPwJbYUeFgK61icxFcNKyxIxE+WgnllQ0y4+HffzZ8WZtJlCDtz+CzqaaFaVGiWBNEOZZ15zihsT2CFnXk4QStsLohTU3FC+Af8I8JWV1fa1jy8u+hnOUy2vnd5SkeGrJBfHZwDbxe87pfxQvejmMZZYxxdYSoyVyixSvtXFLJ7hWq5xCRNSTozczzHCj8T54kI5d8QCtvZAodDIa7DgRkJaII2hBfaJC7EOE7D076XuIoVBu8oN3kpBLVt4YXBVaUSFSbS5Akb00znSoPn9KCJCN0am7SnGhganC4kKhR2MV0vvEn4M7bFhM3GIZqtgfiPr9BdSAYnrnCX3rQeB/2xsKcHouiBBhpO+phQL9CdjmKqsRkXpkMz57dmfTY1v3k8is26zvN2A6yIbKVqm/tMjFBMp5jpxrWKbsB1dJw/AsC3Lt/YEaK7x1t5r7aLj3ned/fRj1TK3H9wXFxc/F/8BgM0jBZ4nc19AAAAAElFTkSuQmCC",
zip: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAFQUExURUxpcYHaOWDM+pryU4TbPXLU/XHT/X3Y/nrZpIffP/+gI4La/+9QTvhycXjQL4fbQvBUUoXaQHrSMf+cJPl2dfBXVf+KMDu99IveRv+ZJf+NLv+PLIncRPdvbV7L+VnJ+P/u5HDS/P+DD1PG93fV/U3D9kTB9WfP+2vR/GLN+nvSM86bL33UNf/69f/+/XzTNP+vVf/iyf/06sOCRsGhYP2Jh/t8e4TVPX3QNat7jnzCMfxfXXrUMP/UqJPoTX/cM/aDLOVjKP/jw/9yC/98HP+GLP/Ec2C63f+iQ4TjNvOiasmpZLuTpfaQgfjEu4HGOPKGeHDC4s2YXU+02/Ozn/B0J+1oYHvSNGnM9P/r291KSNGeZIHGObeOn5zzVM6PHkS978mNUt+EO/GadPOgbZzyVJvyVNG6g66AksCer4LGOc7Mp/eWh/SZVu6adP6VKOSF/TkAAAAKdFJOUwDf39+Af5/9MKAONWYwAAADB0lEQVRYw+3Y+U/TYBjAcUDYIahlA3bCimM3Y64MERWdeExFOhDoxkTnDuTm///R9+jx9MjbtcT4S78sIVnCh+c9mjDGxry8vLz+TwGffxp2/Ql0vYJbJuXzE76AvTc1rc9//gx0vqxg+XwON+XY8+8+BO22NayQKxQKSzZiwMj5D/TgQZtORjASe9U+QKHQfplAilEuhfIxQT/g6P4bwEZbGS1FS08wQR1GzpOCYfSFX7XGEtDSJPaEQCPH2cagwmEwpdfSmQwbXIEaOlAMhsNkRvQ9jEANy9CYoA7Dt6PdqIVBtUY6rdOy2SwbVLEcvR5G8DCjWkSzA3VPAbkcJlCHZbORCBPUY+h+pKzArKZF7MAcvLf4PDUwRsDfikU1O9DwFKDzPKzFYjGMkW8yGIExQbpO9SlAB0BANQxGDDFBdbS0ctdMYMQReHn5Te0n6aIPwf7WBWoLdsEEN57PoR6RFnGSVIdgfV6J47gZHPdqVBBzG6IobutCb+w5B+dkcE5Ys0iQZJBzPOENAsvG1oQ910u+EcplvroDqvLlsrDveEJlyXvox8Xbz6BbEf2KfdcTIlA4On4KOj4SNJBzAQpmUHAxobrkE4E3gyf7YECHE1qAPAWd7+EiAXleHMI/RYYiz5/c41AQaO4+YNXKq7oHpe2dqqmd7XnXhyJJg8Hd8CtoeDcYSDPuwflOp/NOF3qjwzm42Oc/SN/ler3eer8O6q+b6jHBszfRaDSZTD7BzaI2m6UEqPTyxWqrUiwWQ6HQY9zrt1+Y4B8ZTDLASoV4o4G/EJiMat7s5un9QDKhDBLSPGGl4mTJeA+T8pLphFeleCIeTyTwK04mJJvofg9PS3GQMqGjPdSfsjVYdA82jSA6lJa7CWdNEy6QCVedLPnMYg8XQHTJFecTwottAJ3dwwcWSzaBrRY8lHEmGJQvtjbhlQWomzDI/vAIn5TRlmzzkXnSvIcfQWZw0u4D86Rhyc3uB1CXgOCUbT206uA4PJRm9z2oKz/LFBwPjvAvAi8vL69/0l8fxm2XCv5p+gAAAABJRU5ErkJggg==",
mp4: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABXUExURUxpcZKU/5eZ/4SG/5CS/5eb/6Sm/4WG/5uc/6eq/4uM/4iJ/6Ci/5ye/6eo/6Ol/46P/5mb/5eY/5GS//39/5SV//X1/6Ol/+3u/+Li/3Z498/Q/7u8/zCK/WcAAAAKdFJOUwB7Pf+fHN2gn59fp7PNAAACSElEQVRYw+3Ya3OjIBQG4FqamnDzTkT9/79zOQdUzG0PJjP7YX2DeAR5EtKZTu3X15EjR46Q851dnuY7nTtd9Kv8nlK9X60/Kl60/qh4wjUFNjx8XSznIlHMClgICadC+2PWYShFvFwpSRAvBSl0MYDyVpB7xfOyLXmVrl2h99cQPw49VTzLV7lGNVF8DW5CExNAeSaCSsHdyi9SUPi2Ds2h/KY4K+epbZANpYoKmRHBGy6qbt7qnAzKaZzU86SDtje91Z8Ddd+2renHIh6sEsFKVS64stKmhRg7rRi2yrM0MEoAW2Osrh4kFaxnEPd9/SiI+94N1jW0qu5icN13Xfl7iCBqPlsQ9y3nObyJCNYr2G9Bt28VzRPBroYWQGNMiy+Dlel116WBP24BrOlcGgC9NaNWdjjV4T0/NHAJgnF6O/Fo/l2wt6Nm4i2w6OOMExtYmQ42Tdd00BxoV85O9TCI0k26hDckgc2acgXtKIeB8WabvaCFL89xZfMuKG1vgZsa2O2dRwbdUng1vBut48bK7dZ9ezgOrC/diQSWUdg0jrhb4a3bJIOCVYrDD6N8HCLol0PP2QC7fexxTgN5yctF4Mxz8wE953gDdHQwSiDQmK9Lr3IamJCcAObPl4u9oBAL4EohRESGC+FrGoiOX+E/lYD4y3kg0CRQJOSfggwbFksZZhg2GKOAGQscrFrE+RrachaC8hfsN7uLCJ24myE9BuQb52HmGcqO3fPtc2jXB3RiTuNy+hPpKcv/mmzHfzOOHDny/+YPi6+BG+WQsHsAAAAASUVORK5CYII=",
apk: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABXUExURUxpcXnGVmm8P2q8QHzIV4bNYXXDTWu8P3nFUYfNY26/RIPLXoDJWobNYXHASH3HVnXDTXnFUfT/7onPZej/2/v/+Ov+4cDypVmtLqvjjt38y57afsvyti89dh4AAAAKdFJOUwAQ3/8n3Xugn58KiJgCAAACeElEQVRYw+2Y2ZajIBBAuxuTtIhsKgTx/79zisUlaZ0pPPM048WwBa6FkpyYj4+Li4sLNNW9PqQq133W3e+4lSqr24GpPWms08S23ZhCmnvatsxYtZE4/a229BQZ78nxk27TXWKsWwwFRhA2ITXz3FBp1maxsc6OLF1Usb6cocBYNynAnKcs55tm22CNdYPl9vmXhUhj3bA8PpaMLdUNqc1qZIQggRRUi42lPIvmEzDMZazZBiHYOy9dd4TwezPXj1Pzqgxd7dpVlwnVNAzjS0SiM4N2a893mVC6MF2BsvO+64QQzTgMfadKhSIdQvFJD9p3duyNMf3khB0G44gSLCWcUKxwBhEZM2S0Af/E5TqgVKiI18MrRnKV3mRnhNy/+QbdbQIsF3oTFmr0vGJY8sjUGaGCBEcPht65UIDK2+C3UuUhaKFKSUmngen5tCE07Z+kh7bxMp9RKZRQLYg+CgmZQqk94SaUli8jyoTSx/lmsrHUvR1TqU4KuY3zddKtFVjzOSEd9S7G8UJhDEBKAp+4Hg7Itpg+C6WSKKEMgE8Se4CnaYAsEAbo8wDC5yGFQndAd1II13AfR08JOYlfg3BTTCzD3UktRwqFHJLk/DjCcBE5Wgi6BLH7xtHHuxKG4IRACJKTdhr3sISmM0r+QAgffIaS1u3uwlnIC4WckP1tuPhKhRDjHquvdMlrSdcmncvQgRLCDEpTtr6SNjX5klGkEM+/IyTxmF/bKlkLghbGrZE2SPLFFs1dZLuXMMJ71m1m0vkMdOmI71KC+QVbkQJQjyoPvA+zYnig/8L6vpDPUhUyxgfuSSr9ifH4I/cT/2ZcXFz8v/wC1sx9JR+88xQAAAAASUVORK5CYII=",
gif: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcf+ubP+eUP+iWP+xcP+nX/+lXf+SO/uPSv+dUP6kX/+XRP+VQP+SO/+jWf+oYf+hVf///f+mXf+tav+ubf+rZ/+eUP+wcP+pZP/s3P+aSf/z6P/48v/UsvqFOf+6hP/jzf/Hmv/cwS4F5mYAAAALdFJOUwDdez2foByg/p/2onNSOQAAAh5JREFUWMPtmNuSoyAQQGeMUaZUxBveRfP/H7lc1VRJptF92Kr1INqtcKqNSSrk6+vm5uYGzMPzrTzcdYFff+I7cPV91/VfNZr6ykNb6WwMypW6tOBk9EoALka/KMtCTCr05OKi0S9AwI02YXXW+KwqMVluMqw4SimjtUGNzwoK0HgobC4Yn42iat6DanfKnPZdhCAersK0KcfXWOtYbPtrTeNBhGnapCt1n2VZX6cWnjDhjjETjNeFudrhWQpfeS7PqJ5vI0DCXJLKPVmkcMH5MQ5CBaGvIRtehIhkGVp2VmgqwgixhSEkciYeDz4jxDkWyD1F0zQhKrJZ3zzG+jKPQMLNJiAd6ogImHw1+1UngQh/8DHqefMS9/ycFhJVIC+ROAvJnrodRn7ARBfIS+TJirOwEp88JsTGx0skF4Tyfd3nZCtQ+c8KG3OXW4FZ1lJHIeUQ1dVXQzY0vMDBbLJEKjsFCxX1oOmHPe02wlHYDsewk0LWW5jPCfPZJuyZm7BTbWmtzHoMTNgpcPuBUg+CCSkfSTv2wTdXskKoUFGMdhhyqlASTcjOlLgLu3iyk0QOwjDqePsFfgeiA4VqykefCUK40KZ457wwuiaMBZFokc7EQTUTiigGCWMH/m1hAhR624TETFSh7Em8Np5DfsE+EgdAy4BQD473M9+SNYPcMV/fImh9CLiWCkKYL4SvSAMv/BXvxL8ZNzc3/y9/ADVfok94AIhIAAAAAElFTkSuQmCC",
txt: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABIUExURUxpcTOL+DSL+DqO+Veb/mKl/kmX+zWL+U6a+2ao/0aW+0CS+kyZ/GCk/mWn/1yi/lef/VGc/Pr9/+jz/2+s+46//b3a/4O3/AJIojgAAAAKdFJOUwDf//8d3U+en52O09RGAAACF0lEQVRYw+2Y63ajIBCAW8ZqHC5KrZv3f9MFhpuJTQfrjz1n/SDIbT4npw2pfXu7uLi4YNOP39O367rRvOKja/V9GHOqcTTmVGNnzLlGl6A2WvvWxGsqJo9ajKMuGP0dDcbxSWTShKlGfOOoebCNRTidYxynDXrb1dUU0ziGEF3ZdHHoza14xocMXzJyhLdpmme/e6ag2XeobqYCnBRvs98fm32meId56nnCErk+czfVhlub0CyfOyzaHhTa9XOX9aDQqnU/w7uyjULrcC3i+ocI4iUOVkQ7+8IVeptXWgUgMXD3xjv1UYCyCa6QUAiC0E64fMUBYBTOrUJnROmBryCEMEAsCbYKrSIkCSXS0LYLla8U6K4KSYi+H5ZsWmcJY1ohmpos3OLWmoSF9JajX9m8ckyIRfjIrzM8KERfq5J/yridZwrDx0HF6suOMF24QoXJGijCR/gZboB/TZgDYyd9lqU8mqGPlGQMJR8OfiDjZNjDEQ5S0hlDZ4ushWkqwxSWJCgezOKYIMsw7Ri4wi0g3HfBKuF55bBQTNod1WcKw9kv6yShTQgUQA6A6IsjAEmFJ4RXOF24W+gBcIUxAaiapChi/zolw5rfC+GYUKTqG1G11Vxo2Bn6AJLk8NiPC6JBKOjXLv0ZEruwN2AJe8GCnKzHgEGw4STonm/fub535rNUx8xx4D+RdsPP9Af+m3FxcfH/8hcLt2QJ3T9wuwAAAABJRU5ErkJggg==",
exe: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAB4UExURUxpcVq2/kOv/0uw/163/1Cz/0+x/zGp/zad+0Ku/165/Tms/zWq/zKp/1i1/1W1/1K0/0Wv/0Cu/06y//7//0qx/1q2/1y3/1+3/j6p/vf7/y+o/9zu/+r2/yqM9xCa/4LK/8De/3ay/p7P/n3B/rLW/12n+xyf/0XRgzgAAAALdFJOUwDdez2eoByg/Z+vFPUOhAAAAoZJREFUWMPtmOt2mzAMgNuEBDquhhgwgWwMQt//DSfJ3BJIJ3P6a+MLviDkDxE4OaVvbzs7OztsjgfrJUdz3flH/hXvZ1Pfe55/q9HK8iyDluOW4xz3cHcYzIxnMqSZNi3BuJHxALIsTXHLsB+nuOlzmRktbUl71RIKGhitNA3gMxEM3TgxM1rog2UB0vcoopAezIxWwIRrPM0XhX17jJgZT+ETwWwSPBzgGRfCL7C4wojSI91FEfVDJBo2hPNLcYqeCKmFs71pcuAJw0cbkCRREq1wMq4wQVnQNkAbJtuESYKWiAbUtXVVENU9p1iiT4NzrjChRQnNmqK4DBSNDuoj0NjCkbScdGgsUzlXmgplWl4eKcpkZjQVSnHv6yuqapjdhZycLKGUkI+bFK22VOW9ae79xRe5NkInWcIPSOxR5IC7292ArqYqi1qNCfKDIxyzRV7pp8W53RxstX56oMRNQqEaEpTdzVGAc+tKCjRqNLIuWYpBWOsCwScAMOoSaxIKdoWCkEI4dYm06JNkbClQO32KFAZCIWLnN9GBUOoSOwq0TjzkGAnxGhFHxU8B/RUYC2PlEGpcrobIxgpjpYmfI1OAJ4zjWOCaWN+UBTUdxyyeMB5wq8sqlTummAn9V0Jvs7BYpfS3CstqlQ1CRdnX9tcqraFQwcNB98T7/LnKp0cJ+PywhG7s9vjXVXxXp0DHE7qT0lXuK+gIR2g/ydSjV01zZSR8Xdoc26jCbxN6rut5HuZTR/s0eH03xVlCz4B/Q3hYWefDxxua7/s6CAPnL9ijv8DzX8F6DbB9Npwrhvdb5wq5V4bPYb5Lne3lrwKcYDG1+W+k54P9Vw4b/puxs7Pz//IHkvGjBU3hWj4AAAAASUVORK5CYII=",
qm: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA2UExURUxpcdbc4MzO1dTZ3dTZ3s/T2c/T083Q1tXb4NDX287R19HV2+zv8PX29/3+/uPn6b3CzcTI0ZN/xtQAAAAKdFJOUwD////dexCfoCcDaycKAAACJElEQVRYw+2Y4XaDIAyFF2gnEizy/i87SJCCa13i9m9eLAQlHxfsOdZ+fFy6dOmSWPPdvdM063GfDo500yLnG8CfEh3AnxLnQ5bVE+810XYAu4dqiK7m2wH8C4+OKbahcsSfVnQeHTSLjLLNsW0boCE6u5nYbNrNFwe1a6VEVzM3hrUjic5Qc/uUOnyqslsHhosyoutYe/Zek9rhT5oVQNzl4qv4Lgbi92QsIY5UJwRiPUoO5gpiFmDDtsbpHCIXCMsjawnAE2AzjEIgki2kFMRIOEJGLDjEOpPM4UQZvOIiaLxMBKxnGSoEjgqPTmF38QQQHoOgu2RlQDcC4wiMv3XowwgMfrg86YDl+5dvCR/lnjyWJUQ4DczfPxaRngpwDhiZ9UpwCrgcCFRATyUeAaNXOfQFGN7jwkI3O48SAb2n6cNChY7abJ1cW08SLrnIUvZGCT2yVLQKL3aYZcKhvMIhD03xiBeTHugPiNHqgWaFGN6UCKtRA31a6UkSC4BrDsrTZU3KPSzzm7QafjjFWtcJIK3J6IA8PBNJaatrf914xsiBI3KnZGiAkTrcllMcmJfiLREDeXbDKYbrSqDQdD3xXa5J1HLsa98/O164h93Kvke7Uzrguy3spASafwK8a4CSX7BzGZj6rLSL66c0oleVyfRJyYyInipacX6hvzVbae8ymX4G6bvUPA0rTa+WTv5kb1L8J8b0o+4n/s24dOnS/9UX8vFAaEzio+4AAAAASUVORK5CYII=",
php: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcTbUrDrbszvetTXYrDnasjXQqTPIojfTrDvftTTMpjPKpDnZsTPIozXOqDjXrzHGoTbRqjfUre7/++T++Pf//SfCmxm3j1fXt7Hx4UvNrNL78XHfw8T26o3o0eeFKfsAAAAKdFJOUwA9//8c3Xign5/8SMcgAAADDklEQVRYw+2Y65qjIAyGp9ppRxBERcTj/V/mJsHTtN3dMNt/66dAEsjbgE/7jPPxcerUqVNsXW7Zb3WJx12z9E/6vMbyPtP0rcQsTd9KvKbpe4k3SkneR8wWVrL0yb8SM2QkQYGZYEsITnckMUteKX2KsImvgS/EJT4B86XtXhwx2xD5kp3nCwVHaHTnbOJXsuWv2Utd+WOJ+RcLmJOSpREw30T01U7yCx9Y0H0g+W6YIZRsYRxvfODGK/KiQHtqGjsePwU/MmMCi+84GArfgEZ0izBHHecQvzAFQaGyMBTFDDzbV2iuYWhcYBEgB1Ww42Yw1fdoDHDR3I00JhaAs1ndOCCUUS2lzLa2HgNj3TT1OIKLxIruiAorFPQz1GU9muEIx+CHeRxYQFwaUih/dmCVeISTMx1EBl9t4gKD/FAjz6AJoHp2znV1U0/+Z0A/1XXdOaex1hrYvRBtT8H8J8AcUyflBO64A3sQZSmJaOdIYInXDAzbtxIdPVCxYJoWnjQ86hhgCXkgKsoYNEsPkHo0OGN6/KAZglg5E4gSdIRTT/CRqhXEhmJt1+uwKgYYTmvqwdahWr3zXDxQOyDCF2NKwEHK7IhnkdeqMhqIRD9Za6cKjhC/cnCE/cIzOgqo6SrFQhz1DP0gZElG4C1rmEAQVKiR2A1dLzos1AmtyQWepjUgFlBvAqLyvYONWjhC9HuvWiTrCOB9X66la9vWjMCzHurSBlwndTRQaIFVQJPGGUFHqJBD7r4BLbhbFmsGkiUeYbdsFPxwhTV3ToVrfQKToZlxGqbRoRlmwhTNsYFbCsg4P3rY6pNgngWUa4IMjZ6MO0TlNssDEoS6BaLgl1qtrkTRiEt4wJAm9pKUXIuSa30xFUqp5IPEY0CqEOIB1Yo8cNSjFRZxgUrReuzRRlfto5ShgVjALU+9lDyabCBXHOBtW20eLBOaMSaM4HL+gr1gmtlBmG82NjrrHFys14A7MgizGQepbQpuzo7xBfw74lnrNPdd6no3LN35b6TX2/2vuv3gvxmnTp36f/ULf0R1znQ7804AAAAASUVORK5CYII=",
pdf: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABUUExURUxpcf9zfP9ldv98gP92fP9+gf9we/9md/9yfP9/gv9/gf93fv90ff9od/9ref9ve/9ldv/x8f/q6v/8/PlYaP/g4f6lq/63vP2Ejv6Um/7Iy//S1LO+3cAAAAAKdFJOUwA93/8c3Xugn58XiwqYAAACVklEQVRYw+2Y23KjMAxAmzolxXc7tYHw//+5kmxI2tBWMDx0ZjkhMr6dkWoeSl5eDg4ODticmvZbTut151b+xNt5re9Nyl2NrZS7Gs9S7mts5M7GVu5sJKH4KhDbjS1shu2CKA36yj2ZaZ5vbGdNbT9zH+MaW8GFaeQLmcYF4XAbu37J2HKFiparyReu12ta+oOKEztDVXwKP+mKdKV3H8a7ZkWGqmxWihIEoVLT+FyA4tTc4g68VI39LHyGI3yva0WVKl1KzroOimkOvu8rhJNWmY6Eg17IcL0QcFRzkGovofZYc/C7ZahNBuHNbs+wpHKPrscH2yqt4YIBbGlOc4WPYK8rp/w4WhexhPoJem6SeJ7YKMRTDteQdxN2odDvIXRwpRBSjhD6rUJXL/xoPUBynRohjkL0Geh1nWILYblzk/cWQhx0DymGFDFCvqSDFSyhc64YCzKisBvDA1HqsoAvLBmil44khk/EXNesEhIiF1eMMaVaMWa8UahyimRLacy98xmdwM3ZTcKhbE+pG9xHIY+QaOf9JmFGW4hpIJU31npsMZgtJZMP60MJ2GDIGl/cbo3QAs5aUeqNqfe2DtVgax86bCFQE0wZ6lvSERzhpW6hE0np5r198sysEBqL5wm+D/sDlxUZep+73MMJ7CQs5/mLjys0pqSIj4uh8mdM7dTIE8KmCZLXW1MnHma5Qj4sofnrwmZhn3+I0Ph5gvMf7Am2ELjX0z21ZKozJUDDeg24eDaciuH99pXre2W+S52ZOV74b6Tn5vIrzYZfMw4ODv5f/gEm33Cvx+zPHgAAAABJRU5ErkJggg==",
Null: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA2UExURUxpcdbc4MzO1dTZ3dTZ3s/T2c/T083Q1tXb4NDX287R19HV2+zv8PX29/3+/uPn6b3CzcTI0ZN/xtQAAAAKdFJOUwD////dexCfoCcDaycKAAACJElEQVRYw+2Y4XaDIAyFF2gnEizy/i87SJCCa13i9m9eLAQlHxfsOdZ+fFy6dOmSWPPdvdM063GfDo500yLnG8CfEh3AnxLnQ5bVE+810XYAu4dqiK7m2wH8C4+OKbahcsSfVnQeHTSLjLLNsW0boCE6u5nYbNrNFwe1a6VEVzM3hrUjic5Qc/uUOnyqslsHhosyoutYe/Zek9rhT5oVQNzl4qv4Lgbi92QsIY5UJwRiPUoO5gpiFmDDtsbpHCIXCMsjawnAE2AzjEIgki2kFMRIOEJGLDjEOpPM4UQZvOIiaLxMBKxnGSoEjgqPTmF38QQQHoOgu2RlQDcC4wiMv3XowwgMfrg86YDl+5dvCR/lnjyWJUQ4DczfPxaRngpwDhiZ9UpwCrgcCFRATyUeAaNXOfQFGN7jwkI3O48SAb2n6cNChY7abJ1cW08SLrnIUvZGCT2yVLQKL3aYZcKhvMIhD03xiBeTHugPiNHqgWaFGN6UCKtRA31a6UkSC4BrDsrTZU3KPSzzm7QafjjFWtcJIK3J6IA8PBNJaatrf914xsiBI3KnZGiAkTrcllMcmJfiLREDeXbDKYbrSqDQdD3xXa5J1HLsa98/O164h93Kvke7Uzrguy3spASafwK8a4CSX7BzGZj6rLSL66c0oleVyfRJyYyInipacX6hvzVbae8ymX4G6bvUPA0rTa+WTv5kb1L8J8b0o+4n/s24dOnS/9UX8vFAaEzio+4AAAAASUVORK5CYII=",
ipa: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABUUExURUxpcUOv/zar/1K0/1Cz/0+x/1q2/jGp/0Ku/163/zGp/1a1/zus/1q2/02y/0ew/0Gu//f8/164/+/4/+f1/9fu/yek/73j/6TY/xad/43O/3nG/21bnhoAAAAKdFJOUwB7//+gJ92gn59E+c9oAAACbUlEQVRYw+2Y27aqIBRAd5iVsLiICKT//5+Hi5hmdcD2wxnjOIPF4jZdPXX5+Tk4ODjIpj41b6l3+Br5iUupsr5I+avGVB99GvcaayqpI4ioz2MWJnGl0HiiNCpfIuNeibFZ6OQ6ysdqgbGhWeQbvZDQGMjCQOYlUmZsCHFXSIoTNEWvjXu5xjNZQVOgC3Hkskv4ict+YfXa2GQJq4r4lkI1z+UoSUhj9w+p84QrSEqGvpeLaeC0QzhBTdca8bx63i+0bavGvULmG1sNUrXKIu7SxU6ZcLoV7jM2qN5ixKJwkrJMIVtRxWG0g9Z8teQpEKZbZLB2kAzf9WiNsXL9uOIKiVVd23bKDLZ3icss+UpovMWTxlYZUii8hZPcvRgfZs+MkYKFPR/YLUfI3VkP41RtfL3Ugk/brmcKw3F3YdwU2A0a0q7nnC0MmI1QUeBLbkVC4YTzKzZViS+EYLpnFOd7hOK9UO4QCi6CUsCgNkYreNp2TeQJEzCqFyWKJdlC7hvwPji6h1d1hkSVr7O0QoGNCjqlQvdDp/phT4WTcOyjxvuS+hshCKM2GATlQogd9FTign7UMD0NMoUw4S4gbZ+MvdUo7PltgDxhOu3QyARj7/Gj4RoWFFXoC0GaGacydhhsSEgoML2FYiEAvovRjuzuAPdBxe8YSiu8wpPRox0hWfvyhWgOgLHWGDnc6JLZFbJrltDfjneQv4fiEJdR3ExZlhB9BFazXxCif0aIF/ExxmQKOE94SofxQxrTqWMHig3lfIOt8Qb0dpr1U+WKs8l5xw7I9UHmb6n6+qv1xT8xrn/ltOffjIODg/+WP3HMcIG4JOLbAAAAAElFTkSuQmCC",
doc: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABIUExURUxpcTSL+DmO+VSd/k6Y/Vmg/kOT+jSL+UeW+1uh/1ig/k6a/T6R+l2i/0SU+0mX/Oz1//n8/y6G99fp/3ex/J7I/77b/4u9/gFOo+kAAAAKdFJOUwD///8n3Xugn58WcbRuAAACn0lEQVRYw+2Ya3ekIAyGCzozHQFRUPz//3RzQaSXbYPtOfthfccoCcljEM9pZ15eLl26dEms/v78q/oTvKf7SrdWZH9z7leJT+d+ldhTzQCfooH9oUw0Ee8D1qPyZXBsOxDdFuJzkKiBKAM2EIVAObEGdtlqv0SkRAB2XTfgQSMao5M/FKHpmxDYvdHO2G9S69YE/FD+5i5szxMdfq1eBDSYasiMYY8DJkcPuwuAr12uxNO2LgaHGWCM29Yhe3g7yZpfTa41xq/THJ3BNunUGZ8gMnAAs15FQBbUjHGe57W4IDfN87T44suAXUZ6WwFZCwDnZSx+S4cA1AeQnwEBp2X054DjAVxiXPclzyeAno4d6I2DwbT5/Rky0IuBnnjeH8AVrrC7PgPtniED+l0Z6D1txTwn7w8gp5wEJuLh+1KA/jRwWv2GFGwymR8CFQEH7DMmRG0ZOLYCucAyEFFx0REvWwGOcuAIgnw4qwgrRdCUVNhgMEFgQiBO4yEGkqyielB0IahEw5mBWSeBcQ1KB7fjfw5MXlmrw5rdRf8QGJegrbVqTNltBtrRVsC4agU+tLjECkhJIiA0A+koBqYBGsSI4kUD0I6cJAVSOjw12ljcEcJDi0PKQBKkSDvkfAJGeAU138PSy5iBvIYmIO1rTAu8MiUwJogYVVIkwMcBVAb+jFKDOQCL3lZ3BOyjCQhLROkKSBHVDNRQSqb28gyliOIImQioK0ExC2E5oqp5GZBrbVX3PmJ3p7nD7/TPgEpXD0oVU8XN00oGpEqsUQc5UxWb2k0EVG/F2Ix4LwnwXld+AtF1WPIfbK8aJPqq8pDzJCsG4YICV4S9NByUUFwt/C7VP7AgUBGcw0cmTQZhf/wjxuNb3c/8mnHp0qX/Vn8A5AVWOPvxckoAAAAASUVORK5CYII=",
xls: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcYXMX2m8Pmm8P3zJWYbNYXvGVGu9QHrGU4jOZITMX4fOY4HKW3fET3LBSm+/RnrGU37IV2u9QWm7P22+Q+r94PP/7dv2zfv/+GGyNlmsLsfrtaTZiLPhm5TQdN9r514AAAAKdFJOUwB/e98c3T2gn5+4KvYSAAACu0lEQVRYw+2Y63qjIBCGmzRtqhwV1Arq/V/mDgMeYtLtkM2/9ROBGWZe0aB96NvboUOHDpH1eSp+1Gc+7lKwv+njksv7YOylxIKxlxIvjL2WeGIvJhYlY1BYiRU0ZahZcqYjh1ggJCqmL8bcCVejE4tyL/awSybeA38QlXgL5PsuzyYWMYmvhfNECS3nWDCGRiw4T0lr2bjwLCOSnyjAL56hz2wg2yNuHadM4NA0vpyNCs6pa7ot8osIrGI6a76/Wx96FVZ8Asc3OmIAEVghDw7WQX47Qq8KNo+212ihjwSsFsmxjcQo1oHZdpNYIzKBVnokDmiVvgV1Q/88UPQCic0EhvZN5Cn9DDAmyb5Kt1lV8Is3TTc4k3iaDNRah/DQaOngwYWJMZgg8MYeblhrHIOWDFxl3QREmKMeuq4bVS8TLooIrDZE44bw7FpvpnGYeYvyZ6iF6cdAbCbn3J6XCxSR6JDYTb2RuzEaUKQMEbLgkH2a45A8cw0tDXgjAMve+kTc6wmgECOsPhGJ7BXA8D43ggdi05X/DsTvQ8Nc6fFN4c8AJRyhBOEXsPXKwAJHYnimOChzZihThmRxUVe9hAWORB8vJCOXBJSAk1E8vMiN186KhTjKTQAFeMVwgVn43HzpDFgKliMShwQTdOCsMgC6CXkr0as1IhMoPHxhht4kgnXKw1+9wa4R1yygMnoYJ9cvM6qdHMfB1PnAhDAufGHU5gpgoiP6FA2oIFBFGUi30UQIOmqFXaXIwK2supW1N5584C8iAu+mdW+kmga04caCQpqdLWXTwDwaeiSgzRAVWGNZzrVb12tTk4E1CKuUbdGyyZWGoijAc30nu1xhrzNl8/0o0dSPRdoGXGuTVMezNvVibioQ5Y5hf/u+JPygefiduJe6XA1JV/qO9HK+/qrzE//NOHTo0P+rP7x4jQVHYv00AAAAAElFTkSuQmCC",
ppt: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAByUExURUxpcf+ubP+iWP+SO/+nX/+lXfyPQv+SO/+dUP+xcP+ua/+VQP+jWf+XRP+cS/+eT/+UPf+ZSP+gVP+qZf+saP+SOv+mXv+wcP+ta/+ubf+oYv/79//x5f/m0vmEO//MpP/Sr/+9i//Zu/7Dl/ufY/2zfqeIp1YAAAALdFJOUwDdPXugHPygn596VuVMqAAAAl1JREFUWMPtmOtyqjAQgNuqUBQSEi9cDHJR3v8Vzy5JJHi03dAz0x+HD3LZTfIZ6tCZ+Pa2sLCwQOZjG73kw1+3ibKveN/4+t6z7J8a7f6Kp7bC27gp7mTFC7yM28nS/OfGKC9y0OSIafJi6A1FJ3IPY5SToBuj/JAfDkMxNSzHzpDN9e1jXB+IUI1/CfemjJGfcb0HDvbe23rvZGxMM673dCKqsJwsK+916SYQyn+KdemQVec7qmqy8oGtr7A5T6kfhGsP4QlLd/7aSBKeRuJueFSNUmi8nspxfJ6wuWn6Gv+gleM7neYI1fViucIeVTtLGOv5slMg5FITXGCLqo6dCTRhfIoRqLVQ2lA0Sqkujk0MGZLQrEZAqKwQ4ChspDOBIvyMR2QzEUr4plXNnQmfnkI+FbYQVf0coTRlFGZt22KgOm78UlKFckQL4VuulaHqA2dczhFWICwro6uuAfuJkDXVIJSNfvu69jLZIFnIXWHLZXKrkf52Cbi/kHOORmg4q2FbLePMvnwJw5HhA3GcU4UWK+QiQATjD/gKhRW+4idCePCZQjaihQK7nLnYyFeYjMKnPjZnh90TIfMSCsG0QrDk2lVdD5EQOoE9HDYTBE2IizRJ33RNkYgJzOkTdzgKg6zNggeh8BSGxqWF8HYEj5bkXtGEiUsa7IYWDM8IvYXf8GvCHZLglZgIG33ZLvZ2JOHOg98Vpvc2HQOHNKUJV6kHK8rh+8m64ysh6RgQpsdjaq7hhmK6OmeGIU95YjjfBkciAfEstQlpvpB+It2swm9Zzfg1Y2Fh4f/lD1FNqKcd3wCLAAAAAElFTkSuQmCC",
png: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcf+ubP+eUP+iWP+xcP+nX/+lXf+SO/uPSv+dUP6kX/+XRP+VQP+SO/+jWf+oYf+hVf///f+mXf+tav+ubf+rZ/+eUP+wcP+pZP/s3P+aSf/z6P/48v/UsvqFOf+6hP/jzf/Hmv/cwS4F5mYAAAALdFJOUwDdez2foByg/p/2onNSOQAAAh5JREFUWMPtmNuSoyAQQGeMUaZUxBveRfP/H7lc1VRJptF92Kr1INqtcKqNSSrk6+vm5uYGzMPzrTzcdYFff+I7cPV91/VfNZr6ykNb6WwMypW6tOBk9EoALka/KMtCTCr05OKi0S9AwI02YXXW+KwqMVluMqw4SimjtUGNzwoK0HgobC4Yn42iat6DanfKnPZdhCAersK0KcfXWOtYbPtrTeNBhGnapCt1n2VZX6cWnjDhjjETjNeFudrhWQpfeS7PqJ5vI0DCXJLKPVmkcMH5MQ5CBaGvIRtehIhkGVp2VmgqwgixhSEkciYeDz4jxDkWyD1F0zQhKrJZ3zzG+jKPQMLNJiAd6ogImHw1+1UngQh/8DHqefMS9/ycFhJVIC+ROAvJnrodRn7ARBfIS+TJirOwEp88JsTGx0skF4Tyfd3nZCtQ+c8KG3OXW4FZ1lJHIeUQ1dVXQzY0vMDBbLJEKjsFCxX1oOmHPe02wlHYDsewk0LWW5jPCfPZJuyZm7BTbWmtzHoMTNgpcPuBUg+CCSkfSTv2wTdXskKoUFGMdhhyqlASTcjOlLgLu3iyk0QOwjDqePsFfgeiA4VqykefCUK40KZ457wwuiaMBZFokc7EQTUTiigGCWMH/m1hAhR624TETFSh7Em8Np5DfsE+EgdAy4BQD473M9+SNYPcMV/fImh9CLiWCkKYL4SvSAMv/BXvxL8ZNzc3/y9/ADVfok94AIhIAAAAAElFTkSuQmCC",
html: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcTbUrDrbszvetTXYrDnasjXQqTPIojfTrDvftTTMpjPKpDnZsTPIozXOqDjXrzHGoTbRqjfUre7/++T++Pf//SfCmxm3j1fXt7Hx4UvNrNL78XHfw8T26o3o0eeFKfsAAAAKdFJOUwA9//8c3Xign5/8SMcgAAADDklEQVRYw+2Y65qjIAyGp9ppRxBERcTj/V/mJsHTtN3dMNt/66dAEsjbgE/7jPPxcerUqVNsXW7Zb3WJx12z9E/6vMbyPtP0rcQsTd9KvKbpe4k3SkneR8wWVrL0yb8SM2QkQYGZYEsITnckMUteKX2KsImvgS/EJT4B86XtXhwx2xD5kp3nCwVHaHTnbOJXsuWv2Utd+WOJ+RcLmJOSpREw30T01U7yCx9Y0H0g+W6YIZRsYRxvfODGK/KiQHtqGjsePwU/MmMCi+84GArfgEZ0izBHHecQvzAFQaGyMBTFDDzbV2iuYWhcYBEgB1Ww42Yw1fdoDHDR3I00JhaAs1ndOCCUUS2lzLa2HgNj3TT1OIKLxIruiAorFPQz1GU9muEIx+CHeRxYQFwaUih/dmCVeISTMx1EBl9t4gKD/FAjz6AJoHp2znV1U0/+Z0A/1XXdOaex1hrYvRBtT8H8J8AcUyflBO64A3sQZSmJaOdIYInXDAzbtxIdPVCxYJoWnjQ86hhgCXkgKsoYNEsPkHo0OGN6/KAZglg5E4gSdIRTT/CRqhXEhmJt1+uwKgYYTmvqwdahWr3zXDxQOyDCF2NKwEHK7IhnkdeqMhqIRD9Za6cKjhC/cnCE/cIzOgqo6SrFQhz1DP0gZElG4C1rmEAQVKiR2A1dLzos1AmtyQWepjUgFlBvAqLyvYONWjhC9HuvWiTrCOB9X66la9vWjMCzHurSBlwndTRQaIFVQJPGGUFHqJBD7r4BLbhbFmsGkiUeYbdsFPxwhTV3ToVrfQKToZlxGqbRoRlmwhTNsYFbCsg4P3rY6pNgngWUa4IMjZ6MO0TlNssDEoS6BaLgl1qtrkTRiEt4wJAm9pKUXIuSa30xFUqp5IPEY0CqEOIB1Yo8cNSjFRZxgUrReuzRRlfto5ShgVjALU+9lDyabCBXHOBtW20eLBOaMSaM4HL+gr1gmtlBmG82NjrrHFys14A7MgizGQepbQpuzo7xBfw74lnrNPdd6no3LN35b6TX2/2vuv3gvxmnTp36f/ULf0R1znQ7804AAAAASUVORK5CYII=",
js: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcUOv/0uw/zar/0+x/0Gj/Fq2/jOp/0ew/123/zKp/1S0/zqs/1Gz/123/02y/1i2/kWv/0mx/0Ct/1y1/vb7/1i2//7//zel+zOe+e32/9zt/5nN/ieV9oDG/avZ/83m/77h/2S6/HhIljsAAAAKdFJOUwB7Pf8c+92gn59dd850AAAC8klEQVRYw+3Yi3KjIBQG4CbGpgaMNyQIiJf3f8g9B8Rqp9mCszO7M5u/Kgj6iRrb2Le3V1555ZXgnE/Z05zjuUt2/13eL7He+/0+457zlpk/i1jRjo/ZCQC2Hx6LH+MF92EOhIJt9LtviRJPFsMgY0vPr2aUmDmFlY5i68q2ZBFiVpYcf3jpwjnDFoZ15mZsChczRKxkC86Xlc+4erCY+T34TvENnPuxh4rZdiR8M0BeLlfCwcFiRqxGcOJYJxB3AEJ4STiuEuzhYWJGvqYkz5IdA58FDnQ+AOb5bOY8/948BYAfFoEJZ6gWWraK5S5kaffLkHP+yPepxsejHep9I1nKj3iwThWAOi3y7xIIbnYuPOiHCH0Fzm6jIBC2LZZ9IJUHi2JpsYsocJeqW8Fv8g+AtQcrEOuDYF3Xbl8oNmBtJiXlONxtb23nILDepfEgmdr2AdVWGduBxz0Cpp1qARTVAFwrJSwVX3vjwapZwEI+HnLSelKtNHFgZYNYBROCLYB3BLu+F2YYWGW7YItgsK58PJjjpTRCdL0QYu2NGOFXMJ3wGqrBFEI0fwIUbJT2Jkv96R0AGw/SjuhR2Q+OjgWbBqHakAZCEZRaNKLrajPgMOUM/bBFEw5CcngqNJQilwAaATTckG6GS9kOjU8QaLekGh2dixnPWDHBBk0o3GRzEBRGoQgBTw6dgAdPDXda2D8INBqE09Mo2siRdWKQ9smDRw/GSw+MsOv0KG3UxPoOnmV7i/GzqLsVvAaPkMJTxvQ0juOgU/AoHGBSSqpxgseFokgDwSsFjuIt7fsUvlqmPXo0gWduNsbMokcPN4FFGOgCJ927oOcPsa65xIA0ARIjbsnSkMDvBZHQo+AC7ISdFgwmid8xwfqmZjtcxdWDwGQNXebniQR/zl8Eb3Za8rV2s/MtEDwlN4hdLFkbkm2LXQn5Bnu+hQbIoNeAa7B4CzljeL9NQ7008F3qEjjGa/gb6eV0/TGnA//NeOWVV/7f/AJAsosfySCrjgAAAABJRU5ErkJggg==",
css: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABaUExURUxpcXvGVGm8P3zGVXzJWYbNYXbDTWu8QHnFUofNZITMX3zHVXTCS22+Q3jEUIHKW4jOZGq9QHDAR////mi6PvP97pbRd/v++tXwx+b33afbjV2vMrznpsnquGjfsnAAAAAKdFJOUwA936wc3Xign58XA1ZcAAACuUlEQVRYw+2Y2XbjIAyGm540qc1qAl7j93/NkQTEdJsKtxdzzvg3iSVAH8JRFufp6dChQ4fYOl2aL3Wqx50b+ze9nGt5L9b+KrGx9leJZ4ppv2C11KqIlxTUUnib6akn2TXEBigY3RKtJdncgRb1VBCb9o0Ikq0Hvob4Dvil2EQukE18CzSfmlXEJoaaTDCtMYmFZ2Oo0SCP2BiTgrZWdNGjjUjTsIEP2TvIRrsv7KRTJbDtpwCaKEkb7b4EXhjA1zJgHG63YYiQfhrQG8vxVz5QECMAYRrv5Oj7OAEx9MUEJlCkJhA49cJLjJZe9BMChcnju4DjsihtBEgtC1wCAAph4sEDik0EVJpsYGqVgVk1QJOBMjkgHYFGxGbErgzl5uufZPgZUBJQ7wbqeYC6ewcc5t1AM0PdDfcMBI5coRCn2USPD9QUYMcAvGmW6FC8lj0uEcYWHc0F6igxwwW8DasjJ/ZJhynewpzmaDYQAbhh3LEuRHuGrHWaVJOh1PcplNmgMOsw3p2szRCB3vf4oq7ybYLD2HuvdwC18wvUIZRNAaSyWbyrBErasZaKCttFj9agwu6kTBeFCZQQgA2qJAJpAVQEYoeMs1hAuSkCNz8Ciwk7gMOofgi8FvHx83DrUONtV4auBIbZJldYKsPe1QJdIjpn4TtkCGHUDnvGEPCzwbo0DBOunC3jRJJ0ag30VrPo2onex6tym3jAjHPOt+sEWuMS0bY+DspaIEotvp/n2SDDeQFmr5a9GZL8QurQ7qLtdwEfQcqDusJWJY8LVBClElahMj06xRALqB5y6jtVAtU/Duw+I3TpGQ9oHOAF5r6TSo8PHYrzC/bUcQVI1m3AFSd7FpKzY7i/fQaaj0Sf0dsCNOLpeGbeS52vnY/K52R3yeji6cq/Iz1frt/qsuPfjEOHDv2/+gP0toi4gXoofgAAAABJRU5ErkJggg==",
epub: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcXXDTXvGVGm8P33HVnzJWYbNYWm7PYjOZXPBSmu8QG6/RXPBSoHKW4TMX37IV3nFUYbNYonOZOv+4fX/7/z/+1utMK3gkuL412O1OFOpJ7ripNf4xXK6TKHWhX88Tv4AAAAKdFJOUwB7Pd+gHN2gn59lNj8pAAACeklEQVRYw+3Y2XaqMBQG4GK10gxCgDII8v6P2T0kMhR7dujl4QcMCcm3Ni7tkr69HTly5Ig4pyR9mVM8d0mL3/JxifU+Xkhup5jyQudmkpuNuEjx4ii0fHlWUIt7lJiwsZVpOEZMnSQRYnpzsGH8WmyphxdcGJaL6U0WsSgFxeIStOtTGy2eeZGddmu9gq21tNMcmXi21i+adtsMQ8MdOm5M2lQMrtKUVVU2GxdO+8Cm/IJsickukL1N8SwEM9wzS2cZeVXlRT9uuZGBmfey7OmVfU9Nk3HoKhwiMFuEvaaum4XoEw8G736ve7rr8W8gfF64PqXqrsX3sv8TSF4Lns5zPWKF7ZjvAHPcYZt5jFft2Bm+RpsYpCBRVegpxqEz1p3BSzQHDhFI2JPg+3162LGjYy4CRKKt8AuM9c086BRDC+8kJwI0AxDVsPYMeNAZIsBPD/ZYYfsAIh/beX34l6c30aDOeyxrKHyB8/rKPtPxYP3AGksQDbxrw8J71FGggS033T2IpstHu/Du+OHBaZ+yClei6+7wVf7pQWSgMQYPTWJZloPt6g48N0CnJY9n5EYEhsn5JN40jJBXes+TQjBkEp33qD7ttXhwLi69kFhwJm568eAkbnpScL5IPcXJ09EVatq4CSJ5ylvabyKQpkKoEC/Cb5vg8bjhCTJQMxeCd62KQqG3jhA0k0ivCr973gvXTAz4I6qr6436ZOBVb4lqi9P6KgSV5vXzVz8YXvlEDoZlrE2KmholrVC9iN4Yk4AJLdW0XqvQeO454HXJL9iTiojoMeAq9yR3DM+371LvXfgsdRHWeJU/kV6S6z+T7PhvxpEjR/7ffAMGOojXQYbbiwAAAABJRU5ErkJggg==",
psd: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcUOv/0uw/zer/123/0+x/1q2/jOp/zSm+Uew/zKp/zys/1O0/1e1/0Ku/0+z/1q2/0mx//7//164/vf8/9vw/+r2/yie86HX/sno/7Dd/5TR/W6//H/H/Eyv911ykpAAAAAKdFJOUwB7Pf+fHN2g/p8jQekrAAACx0lEQVRYw+2Y7WKrIAyG12JXJn4xEQG193+ZJwnYOdedE7r9O74qBQyPARNb+/Jy6NChQ2ydT8W3OufjLkX/N71ecnmvff+rxC/+dT8jXnB8162sLhK7T/As4glgHR1xT0Vs0iW6PGKxYXxo35FBJGC9B37p4BOLdXhd42e9QdaxXecRi5opLpEN5BITsKL9oao8YkGoqkpIrJAIRY2azuFR8IB31bvPXQuY5zzgA8hOJwbwbTWevY3yof+GV3Hm/NZG29ab9yhjrOsq6E57C2Ub9zcWMEoP7x8yvqPOalOicoANAu0AsuCqce0j5QJNmPt+cQMQ7fwzoI7AaURNdueizgRq3CJQKiXl6GH2Xn/QyIAN1BqsdQS6BmvSAXDQO6ERF6hX4BSrAYGNnp3HqJw1eYhlDlCRh1TtcA2DmixFJkTl3ct8IE65whC3S49YSzG0PAt8H1wIAaPGeFxI46cJmiY8DYS0M4YyZZawkGaGIJpDmJs8YANbAqZk9ouUOPFwgyAapWySEQvYRBHQrI+bUSoKb+unVkoVTXTDA9LFCWiG4JxbejnKppG0mHiTa4JpKHM9TKk3Iq+RcvKDoRvUJptngBJFU1RyvM3BU14/AxQEVI1aByNxHG/OYtb8ALiqcq5SAlYTgW0+UO2BkHjWzbqZTPRQsYEwS4Xzi0BFY2Gb4R5jFGEawlMNjOAcDxgFgWzspO6S0xC/tYwNcJsQp9Q1B7h4COgNEHLOD9YO3kUeigO8rgB5629SbYljvSzLfBtH8QxQYJBsgfhdEKP8zssCAlEKsQViD4V5arGBQgmBKEGVeNBwkZpCxS4hWECRoWyg+m3gb3lYRvPyXpapsjlRZnlYpm2tf7pEmcqSBzyVDyUe9nJ+wZ73gx+jolivAdeSLc6M4f1WcnmS+S51Yfp45b+RXk7Xf+r0xL8Zhw4d+n/1B13vfAhtdKi2AAAAAElFTkSuQmCC",
dwg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABaUExURUxpcXvGVIbNYXvHVHzJWYbNYXbDTWu9QHrGU4jOZHLBSW+/RYDJWmy+QoXMYHzHVYjOZHfET2m7P4LLXf3/+/T+7u3+5MXrsaXbiVyuMZjUeNb2xOP81bPjmuZ7vy0AAAAKdFJOUwA9z1wc33ign591Bg7OAAACdUlEQVRYw+2Yi3KjIBRAm51UI4gKxMei+f/f3PsQNU3SXtzOdGfWo0W4wBGFau3b28HBwYGYU1a85JSuOxfNZ/w6p/rem895TzQWTfOtxjP1qWCDtJoLK1WyMcM+VUUu1pJ3ls6nSDEW1UpTvSLBWFRf0iQZXwn93jFuhd7fK/2SJhgL9Hh0ecp5P4tn3xzwYmPhX0En2SL7nXkirEIPNA/xspAIL9Cw9CUmsV85dG3bBcjNgSUjeVJcykeG9nrtAmX9/MNJtk9Yk7B5cqbLvymsdwjr2LOmBIVtU3OMQ9xGJIQOQHSFGzBegR5zoV4Qj7DeQiumbVGIx26gEXICpAvr4bqlHe5r04WWhB1BQvsdwo5uX4/GvxCGgejBMv4mJpwZjoY0IY7C9nSZNB+jI1DY8tXfsJGVCi3Rt8tUjBoDelrn5mbBJxVi29qqG60XXDLtqFjYXudQd1N8VqEQUUNPTNA/jhCyE0cHRUNMEiq+cbiwV2E3cFTvGKHjqQ34bB0Jespy1NlkIQwR0aG7I2iOJwmVje1BG6atbwpQxbUqZYRq3ej9NIJ1GjGHwk21SKgiFndL7xQU0jvFLlWERJhHE3ehuQnTNI2WZmOxUQuhcDsK44xzJCx5vdyRJFzRYQShf6xQ+U8J9VOh3inU4NMAaTULccWUmopUrRQ3kAkfqQJgn1TsFBpaO+77hHp+xOwXmo9DhNVoOLipMlKh0dibd8waLq7HWDBGJDQJ/IgwM3zHIm5JlpQ33CV/wZ6wj1t7UT4KaLY5R4noMyB3EXN32BRiRHLF8H2rnRAt/JY65zJfLv8iPWf5l2Q7/ptxcHDw//IHYWiLelDcDu8AAAAASUVORK5CYII=",
};
const PopsFolder = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "folder";
let config = PopsFolderConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "folderCSS",
css: PopsCSS.folderCSS,
},
]);
Reflect.set(Folder_ICON, "docx", Folder_ICON.doc);
Reflect.set(Folder_ICON, "rtf", Folder_ICON.doc);
Reflect.set(Folder_ICON, "xlsx", Folder_ICON.xls);
Reflect.set(Folder_ICON, "pptx", Folder_ICON.ppt);
Reflect.set(Folder_ICON, "dmg", Folder_ICON.ipa);
Reflect.set(Folder_ICON, "json", Folder_ICON.js);
const zipIconList = [
"rar",
"7z",
"arj",
"bz2",
"cab",
"iso",
"jar",
"lz",
"lzh",
"tar",
"uue",
"xz",
"z",
"zipx",
"zst",
"001",
];
const imageIconList = ["jpg", "jpeg", "ico", "webp"];
const codeLanguageIconList = ["htm", "py", "vue", "bat", "sh", "vbs", "java", "kt"];
const androidIconList = ["apk", "apkm", "xapk"];
zipIconList.forEach((keyName) => {
Folder_ICON[keyName] = Folder_ICON.zip;
});
imageIconList.forEach((keyName) => {
Folder_ICON[keyName] = Folder_ICON.png;
});
codeLanguageIconList.forEach((keyName) => {
Folder_ICON[keyName] = Folder_ICON.html;
});
androidIconList.forEach((keyName) => {
Folder_ICON[keyName] = Folder_ICON.apk;
});
if (details?.folder) {
Reflect.set(config, "folder", details.folder);
}
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? config.title.text : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content ${popsUtils.isPhone() ? "pops-mobile-folder-content" : ""}">
<div class="pops-folder-list">
<div class="pops-folder-file-list-breadcrumb">
<div class="pops-folder-file-list-breadcrumb-primary">
<span class="pops-folder-file-list-breadcrumb-allFiles cursor-p" title="全部文件">
<a>全部文件</a>
</span>
</div>
</div>
<div class="pops-folder-list-table__header-div">
<table class="pops-folder-list-table__header">
<colgroup>
<col width="52%">
<col width="24%">
<col width="16%">
</colgroup>
<thead>
<tr class="pops-folder-list-table__header-row">
<th class="pops-folder-list-table__header-th cursor-p">
<div class="text-ellip content flex-a-i-center">
<span>文件名</span>
<div class="pops-folder-list-table__sort" data-sort="fileName">
<div class="pops-folder-icon-arrow" data-sort="按文件名排序">
<svg
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path
d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
class="pops-folder-icon-arrow-up"></path>
<path
d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
class="pops-folder-icon-arrow-down"></path>
</svg>
</div>
</div>
</div>
</th>
<th class="pops-folder-list-table__header-th cursor-p">
<div class="text-ellip content flex-a-i-center">
<span>修改时间</span>
<div class="pops-folder-list-table__sort" data-sort="latestTime">
<div class="pops-folder-icon-arrow" title="按修改时间排序">
<svg
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path
d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
class="pops-folder-icon-arrow-up"></path>
<path
d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
class="pops-folder-icon-arrow-down"></path>
</svg>
</div>
</div>
</div>
</th>
<th class="pops-folder-list-table__header-th cursor-p">
<div class="text-ellip content flex-a-i-center">
<span>大小</span>
<div class="pops-folder-list-table__sort" data-sort="fileSize">
<div class="pops-folder-icon-arrow" title="按大小排序">
<svg
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg">
<path
d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
class="pops-folder-icon-arrow-up"></path>
<path
d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
class="pops-folder-icon-arrow-down"></path>
</svg>
</div>
</div>
</div>
</th>
</tr>
</thead>
</table>
</div>
<div class="pops-folder-list-table__body-div">
<table class="pops-folder-list-table__body">
<colgroup>
${
popsUtils.isPhone()
? `<col width="100%">`
: `
<col width="52%">
<col width="24%">
<col width="16%">`
}
</colgroup>
<tbody></tbody>
</table>
</div>
</div>
</div>${bottomBtnHTML}`,
bottomBtnHTML,
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
titleElement: $title,
contentElement: $content,
folderListBodyElement,
folderFileListBreadcrumbPrimaryElement,
headerCloseBtnElement: $btnCloseBtn,
btnOkElement,
btnCancelElement,
btnOtherElement,
folderListSortFileNameElement,
folderListSortLatestTimeElement,
folderListSortFileSizeElement,
} = PopsHandler.handleQueryElement($anim, popsType);
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
PopsHandler.handleClickEvent("close", $btnCloseBtn, eventDetails, config.btn.close.callback);
PopsHandler.handleClickEvent("ok", btnOkElement, eventDetails, config.btn.ok.callback);
PopsHandler.handleClickEvent("cancel", btnCancelElement, eventDetails, config.btn.cancel.callback);
PopsHandler.handleClickEvent("other", btnOtherElement, eventDetails, config.btn.other.callback);
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
class PopsFolder2 {
init() {
config.folder.sort();
this.initFolderView(config.folder);
const allFilesElement = folderFileListBreadcrumbPrimaryElement.querySelector(
".pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child"
);
Reflect.set(allFilesElement, "_config_", config.folder);
popsDOMUtils.on(allFilesElement, "click", (event) => {
this.setBreadcrumbClickEvent(event, true, config.folder);
});
popsDOMUtils.on(
folderListSortFileNameElement.closest("th"),
"click",
(event) => {
this.arrowToSortFolderInfoView(folderListSortFileNameElement, event, "fileName");
},
{
capture: true,
}
);
popsDOMUtils.on(
folderListSortLatestTimeElement.closest("th"),
"click",
(event) => {
this.arrowToSortFolderInfoView(folderListSortLatestTimeElement, event, "latestTime");
},
{
capture: true,
}
);
popsDOMUtils.on(
folderListSortFileSizeElement.closest("th"),
"click",
(event) => {
this.arrowToSortFolderInfoView(folderListSortFileSizeElement, event, "fileSize");
},
{
capture: true,
}
);
if (config.sort.name === "fileName") {
popsDOMUtils.trigger(folderListSortFileNameElement, "click", {
notChangeSortRule: true,
});
} else if (config.sort.name === "latestTime") {
popsDOMUtils.trigger(folderListSortLatestTimeElement, "click", {
notChangeSortRule: true,
});
} else if (config.sort.name === "fileSize") {
popsDOMUtils.trigger(folderListSortFileSizeElement, "click", {
notChangeSortRule: true,
});
}
}
createFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
const origin_fileName = fileName;
const origin_latestTime = latestTime;
const origin_fileSize = fileSize;
const folderElement = popsDOMUtils.createElement("tr");
const fileNameElement = popsDOMUtils.createElement("td");
const fileTimeElement = popsDOMUtils.createElement("td");
const fileFormatSize = popsDOMUtils.createElement("td");
let fileType = "";
let fileIcon = Folder_ICON.folder;
if (isFolder) {
latestTime = "";
fileSize = "";
} else {
fileIcon = "";
if (typeof latestTime === "number") {
latestTime = popsUtils.formatTime(latestTime);
}
if (typeof fileSize === "number") {
fileSize = popsUtils.formatByteToSize(fileSize);
}
for (const keyName in Folder_ICON) {
if (fileName.toLowerCase().endsWith("." + keyName)) {
fileType = keyName;
fileIcon = Folder_ICON[keyName];
break;
}
}
if (!fileIcon) {
fileType = "Null";
fileIcon = Folder_ICON.Null;
}
}
folderElement.className = "pops-folder-list-table__body-row";
fileNameElement.className = "pops-folder-list-table__body-td";
fileTimeElement.className = "pops-folder-list-table__body-td";
fileFormatSize.className = "pops-folder-list-table__body-td";
PopsSafeUtils.setSafeHTML(
fileNameElement,
`
<div class="pops-folder-list-file-name cursor-p">
<div>
<img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
<a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
${fileName}
</a>
</div>
</div>
`
);
PopsSafeUtils.setSafeHTML(
fileTimeElement,
`
<div class="pops-folder-list__time">
<span>${latestTime}</span>
</div>
`
);
PopsSafeUtils.setSafeHTML(
fileFormatSize,
`
<div class="pops-folder-list-format-size">
<span>${fileSize}</span>
</div>
`
);
const __value__ = {
fileName: origin_fileName,
latestTime: origin_latestTime,
fileSize: origin_fileSize,
isFolder,
};
Reflect.set(fileNameElement, "__value__", __value__);
Reflect.set(fileTimeElement, "__value__", __value__);
Reflect.set(fileFormatSize, "__value__", __value__);
Reflect.set(folderElement, "__value__", __value__);
folderElement.appendChild(fileNameElement);
folderElement.appendChild(fileTimeElement);
folderElement.appendChild(fileFormatSize);
return {
folderElement,
fileNameElement,
fileTimeElement,
fileFormatSize,
};
}
createFolderRowElementByMobile(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
const origin_fileName = fileName;
const origin_latestTime = latestTime;
const origin_fileSize = fileSize;
const folderElement = popsDOMUtils.createElement("tr");
const fileNameElement = popsDOMUtils.createElement("td");
let fileType = "";
let fileIcon = Folder_ICON.folder;
if (isFolder) {
latestTime = "";
fileSize = "";
} else {
fileIcon = "";
if (typeof latestTime === "number") {
latestTime = popsUtils.formatTime(latestTime);
}
if (typeof fileSize === "number") {
fileSize = popsUtils.formatByteToSize(fileSize);
}
for (const keyName in Folder_ICON) {
if (fileName.toLowerCase().endsWith("." + keyName)) {
fileType = keyName;
fileIcon = Folder_ICON[keyName];
break;
}
}
if (!fileIcon) {
fileType = "Null";
fileIcon = Folder_ICON.Null;
}
}
folderElement.className = "pops-folder-list-table__body-row";
fileNameElement.className = "pops-folder-list-table__body-td";
PopsSafeUtils.setSafeHTML(
fileNameElement,
`
<div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
<img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
<div>
<a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">${fileName}</a>
<span>${latestTime} ${fileSize}</span>
</div>
</div>
`
);
const __value__ = {
fileName: origin_fileName,
latestTime: origin_latestTime,
fileSize: origin_fileSize,
isFolder,
};
Reflect.set(fileNameElement, "__value__", __value__);
Reflect.set(folderElement, "__value__", __value__);
folderElement.appendChild(fileNameElement);
return {
folderElement,
fileNameElement,
};
}
clearFolderInfoView() {
PopsSafeUtils.setSafeHTML(folderListBodyElement, "");
}
createHeaderArrowIcon() {
const $arrowIcon = popsDOMUtils.createElement("div", {
className: "iconArrow",
});
return $arrowIcon;
}
createBreadcrumb(folderName, folderDataConfig) {
const $breadcrumb = popsDOMUtils.createElement(
"span",
{
className: "pops-folder-file-list-breadcrumb-allFiles cursor-p",
innerHTML: `<a>${folderName}</a>`,
_config_: folderDataConfig,
},
{
title: folderName,
}
);
return $breadcrumb;
}
setBreadcrumbClickEvent(clickEvent, isTop, dataConfigList) {
this.clearFolderInfoView();
const $click = clickEvent.target;
const currentBreadcrumb = $click.closest("span.pops-folder-file-list-breadcrumb-allFiles");
if (currentBreadcrumb) {
while (currentBreadcrumb.nextElementSibling) {
currentBreadcrumb.nextElementSibling.remove();
}
} else {
console.error("获取导航按钮失败");
}
const loadingMask = PopsLoading.init({
parent: $content,
content: {
text: "获取文件列表中...",
},
mask: {
enable: true,
clickEvent: {
toClose: false,
toHide: false,
},
},
addIndexCSS: false,
});
this.initFolderView(dataConfigList);
loadingMask.close();
}
async enterFolder(clickEvent, dataConfig) {
this.clearFolderInfoView();
const loadingMask = PopsLoading.init({
parent: $content,
content: {
text: "获取文件列表中...",
},
mask: {
enable: true,
},
addIndexCSS: false,
});
if (typeof dataConfig.clickEvent === "function") {
const childConfig = await dataConfig.clickEvent(clickEvent, dataConfig);
folderFileListBreadcrumbPrimaryElement.appendChild(this.createHeaderArrowIcon());
const breadcrumbAllFilesElement = this.createBreadcrumb(dataConfig.fileName, childConfig);
folderFileListBreadcrumbPrimaryElement.appendChild(breadcrumbAllFilesElement);
popsDOMUtils.on(breadcrumbAllFilesElement, "click", (event) => {
this.setBreadcrumbClickEvent(event, false, childConfig);
});
this.initFolderView(childConfig);
}
loadingMask.close();
}
async downloadFile(clickEvent, $row, dataConfig) {
popsDOMUtils.preventEvent(clickEvent);
const $link = $row.querySelector("a");
if (typeof dataConfig.clickEvent === "function") {
const downloadInfo = await dataConfig.clickEvent(clickEvent, dataConfig);
if (
downloadInfo != null &&
typeof downloadInfo === "object" &&
!Array.isArray(downloadInfo) &&
typeof downloadInfo.url === "string" &&
downloadInfo.url.trim() !== ""
) {
$link.setAttribute("href", downloadInfo.url);
$link.setAttribute("target", "_blank");
if (downloadInfo.autoDownload) {
if (downloadInfo.mode == null || downloadInfo.mode === "") {
downloadInfo.mode = "aBlank";
}
if (downloadInfo.mode === "a" || downloadInfo.mode === "aBlank") {
const downloadLinkElement = document.createElement("a");
if (downloadInfo.mode === "aBlank") {
downloadLinkElement.setAttribute("target", "_blank");
}
downloadLinkElement.href = downloadInfo.url;
downloadLinkElement.click();
} else if (downloadInfo.mode === "open" || downloadInfo.mode === "openBlank") {
if (downloadInfo.mode === "openBlank") {
globalThis.open(downloadInfo.url, "_blank");
} else {
globalThis.open(downloadInfo.url);
}
} else if (downloadInfo.mode === "iframe") {
const downloadIframeLinkElement = document.createElement("iframe");
downloadIframeLinkElement.src = downloadInfo.url;
downloadIframeLinkElement.onload = function () {
popsUtils.setTimeout(() => {
downloadIframeLinkElement.remove();
}, 1e3);
};
$shadowRoot.appendChild(downloadIframeLinkElement);
popsUtils.setTimeout(
() => {
downloadIframeLinkElement.remove();
},
3 * 60 * 1e3
);
} else {
console.error("未知的下载模式", downloadInfo);
}
}
}
}
}
sortFolderConfig(folderDataConfigList, sortName = "fileName", isDesc = false) {
if (sortName === "fileName") {
const onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
return value.isFolder;
});
const onlyFileDataConfigList = folderDataConfigList.filter((value) => {
return !value.isFolder;
});
onlyFolderDataConfigList.sort((leftConfig, rightConfig) => {
const beforeVal = leftConfig[sortName].toString();
const afterVal = rightConfig[sortName].toString();
let compareVal = beforeVal.localeCompare(afterVal);
if (isDesc) {
if (compareVal > 0) {
compareVal = -1;
} else if (compareVal < 0) {
compareVal = 1;
}
}
return compareVal;
});
onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
const beforeVal = leftConfig[sortName].toString();
const afterVal = rightConfig[sortName].toString();
let compareVal = beforeVal.localeCompare(afterVal);
if (isDesc) {
if (compareVal > 0) {
compareVal = -1;
} else if (compareVal < 0) {
compareVal = 1;
}
}
return compareVal;
});
if (isDesc) {
return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
} else {
return [...onlyFolderDataConfigList, ...onlyFileDataConfigList];
}
} else {
folderDataConfigList.sort((beforeConfig, afterConfig) => {
let beforeVal = beforeConfig[sortName];
let afterVal = afterConfig[sortName];
if (sortName === "fileSize") {
beforeVal = parseFloat(beforeVal.toString());
afterVal = parseFloat(afterVal.toString());
} else if (sortName === "latestTime") {
beforeVal = new Date(beforeVal).getTime();
afterVal = new Date(afterVal).getTime();
}
if (beforeVal > afterVal) {
if (isDesc) {
return -1;
} else {
return 1;
}
} else if (beforeVal < afterVal) {
if (isDesc) {
return 1;
} else {
return -1;
}
} else {
return 0;
}
});
return folderDataConfigList;
}
}
initFolderView(dataConfig) {
this.sortFolderConfig(dataConfig, config.sort.name, config.sort.isDesc);
dataConfig.forEach((item) => {
if (item.isFolder) {
const { folderElement, fileNameElement } = popsUtils.isPhone()
? this.createFolderRowElementByMobile(item.fileName, "", "", true)
: this.createFolderRowElement(item.fileName, "", "", true);
popsDOMUtils.on(fileNameElement, "click", (event) => {
this.enterFolder(event, item);
});
folderListBodyElement.appendChild(folderElement);
} else {
const { folderElement, fileNameElement } = popsUtils.isPhone()
? this.createFolderRowElementByMobile(item.fileName, item.latestTime, item.fileSize, false)
: this.createFolderRowElement(item.fileName, item.latestTime, item.fileSize, false);
popsDOMUtils.on(fileNameElement, "click", (event) => {
this.downloadFile(event, fileNameElement, item);
});
folderListBodyElement.appendChild(folderElement);
}
});
}
removeArrowActiveStatus() {
[
...Array.from(folderListSortFileNameElement.querySelectorAll(".pops-folder-icon-active")),
...Array.from(folderListSortLatestTimeElement.querySelectorAll(".pops-folder-icon-active")),
...Array.from(folderListSortFileSizeElement.querySelectorAll(".pops-folder-icon-active")),
].forEach((ele) => ele.classList.remove("pops-folder-icon-active"));
}
changeArrowActive(arrowUp, arrowDown, isDesc) {
this.removeArrowActiveStatus();
if (isDesc) {
arrowDown.classList.add("pops-folder-icon-active");
} else {
arrowUp.classList.add("pops-folder-icon-active");
}
}
arrowToSortFolderInfoView(target, event, sortName) {
const notChangeSortRule = Reflect.get(event, "notChangeSortRule");
if (!notChangeSortRule) {
config.sort.name = sortName;
config.sort.isDesc = !config.sort.isDesc;
}
const arrowUp = target.querySelector(".pops-folder-icon-arrow-up");
const arrowDown = target.querySelector(".pops-folder-icon-arrow-down");
this.changeArrowActive(arrowUp, arrowDown, config.sort.isDesc);
if (
typeof config.sort.callback === "function" &&
config.sort.callback(target, event, config.sort.name, config.sort.isDesc)
) {
return;
}
const childrenList = [];
Array.from(folderListBodyElement.children).forEach((trElement) => {
const __value__ = Reflect.get(trElement, "__value__");
Reflect.set(__value__, "target", trElement);
childrenList.push(__value__);
});
const sortedConfigList = this.sortFolderConfig(childrenList, config.sort.name, config.sort.isDesc);
sortedConfigList.forEach((item) => {
folderListBodyElement.appendChild(item.target);
});
}
}
const popsFolder = new PopsFolder2();
popsFolder.init();
Reflect.set($pops, "data-pops-folder", popsFolder);
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsIframeConfig = () => {
return {
title: {
position: "center",
text: "",
html: false,
style: "",
},
loading: {
enable: true,
icon: true,
text: "",
},
useShadowRoot: true,
class: "",
url: window.location.href,
only: false,
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
animation: "pops-anim-fadein-zoom",
position: "center",
drag: true,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
width: window.innerWidth < 550 ? "88vw" : "350px",
height: window.innerHeight < 450 ? "70vh" : "200px",
topRightButton: "min|max|mise|close",
sandbox: false,
forbiddenScroll: false,
loadEndCallBack() {},
btn: {
min: {
callback() {},
},
max: {
callback() {},
},
mise: {
callback() {},
},
close: {
callback() {},
},
},
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsIframe = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "iframe";
let config = PopsIframeConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
if (config.url == null) {
throw new Error("config.url不能为空");
}
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "iframeCSS",
css: PopsCSS.iframeCSS,
},
]);
const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const iframeLoadingHTML = '<div class="pops-loading"></div>';
const titleText = config.title.text.trim() !== "" ? config.title.text : config.url;
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? titleText : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${titleText}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content">
<div class="pops-${popsType}-content-global-loading"></div>
<iframe src="${config.url}" pops ${config.sandbox ? "sandbox='allow-forms allow-same-origin allow-scripts'" : ""}>
</iframe>
</div>${config.loading.enable ? iframeLoadingHTML : ""}`,
"",
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
headerCloseBtnElement,
headerControlsElement,
titleElement: $title,
iframeElement: $iframe,
loadingElement,
contentLoadingElement: $contentLoading,
headerMinBtnElement,
headerMaxBtnElement,
headerMiseBtnElement,
} = PopsHandler.handleQueryElement($anim, popsType);
let $iframeContainer = PopsCore.document.querySelector(".pops-iframe-container");
if (!$iframeContainer) {
$iframeContainer = PopsCore.document.createElement("div");
$iframeContainer.className = "pops-iframe-container";
$iframeContainer.style.cssText =
"display: flex;position: fixed;bottom: 0px;flex-flow: wrap-reverse;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;";
popsDOMUtils.appendBody($iframeContainer);
}
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
eventDetails["iframeElement"] = $iframe;
popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
$anim.style.width = "0%";
$anim.style.height = "0%";
});
popsDOMUtils.on($iframe, "load", () => {
loadingElement?.remove();
$contentLoading.style.animation = "iframeLoadingChange_85 0.3s forwards";
popsDOMUtils.on($contentLoading, popsDOMUtils.getAnimationEndNameList(), () => {
$contentLoading.remove();
});
if (config.title.text.trim() === "" && $iframe.contentDocument) {
$title.querySelector("p").innerText = $iframe.contentDocument.title;
}
config.loadEndCallBack(eventDetails);
});
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
$iframeContainer.appendChild($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
const TYPE_MODULE = "type-module";
let origin_left = "";
let origin_top = "";
let origin_is_max = false;
popsDOMUtils.on(
headerMinBtnElement,
"click",
(event) => {
event.preventDefault();
event.stopPropagation();
origin_left = $pops.style.left;
origin_top = $pops.style.top;
$pops.classList.add("pops-iframe-unset-top");
$pops.classList.add("pops-iframe-unset-left");
$pops.classList.add("pops-iframe-unset-transform");
$pops.style.transitionDuration = "";
$pops.setAttribute(TYPE_MODULE, "min");
headerControlsElement.setAttribute("type", "min");
headerMaxBtnElement.style.setProperty("display", "none");
headerMiseBtnElement.style.setProperty("display", "");
if (typeof config?.btn?.min?.callback === "function") {
config.btn.min.callback(eventDetails, event);
}
},
{
capture: true,
}
);
popsDOMUtils.on(
headerMaxBtnElement,
"click",
(event) => {
event.preventDefault();
event.stopPropagation();
if ($pops.getAttribute(TYPE_MODULE) !== "min") {
origin_left = $pops.style.left;
origin_top = $pops.style.top;
}
origin_is_max = true;
$pops.style.transitionDuration = "";
$pops.style.transform = "";
$pops.removeAttribute(TYPE_MODULE);
$pops.classList.add("pops-iframe-unset-transition");
$pops.classList.add("pops-iframe-unset-left");
$pops.classList.add("pops-iframe-unset-top");
$pops.classList.add("pops-iframe-unset-transform");
$pops.classList.remove("pops-iframe-unset-transition");
$pops.setAttribute(TYPE_MODULE, "max");
headerControlsElement.setAttribute("type", "max");
headerMaxBtnElement.style.setProperty("display", "none");
headerMiseBtnElement.style.setProperty("display", "");
if (typeof config?.btn?.max?.callback === "function") {
config.btn.max.callback(eventDetails, event);
}
},
{
capture: true,
}
);
headerMiseBtnElement?.style?.setProperty("display", "none");
popsDOMUtils.on(
headerMiseBtnElement,
"click",
(event) => {
event.preventDefault();
event.stopPropagation();
if (origin_is_max && $pops.getAttribute(TYPE_MODULE) === "min") {
$pops.classList.add("pops-iframe-unset-transition");
$pops.classList.add("pops-iframe-unset-left");
$pops.classList.add("pops-iframe-unset-top");
$pops.classList.add("pops-iframe-unset-transform");
$pops.classList.remove("pops-iframe-unset-transition");
$pops.setAttribute(TYPE_MODULE, "max");
headerControlsElement.setAttribute("type", "max");
} else {
origin_is_max = false;
$pops.style.left = origin_left;
$pops.style.top = origin_top;
$pops.style.transitionDuration = "";
$pops.style.transform = "";
headerControlsElement.removeAttribute("type");
$pops.removeAttribute(TYPE_MODULE);
$pops.classList.remove("pops-iframe-unset-top");
$pops.classList.remove("pops-iframe-unset-left");
$pops.classList.remove("pops-iframe-unset-transform");
headerMaxBtnElement.style.setProperty("display", "");
headerMiseBtnElement.style.setProperty("display", "none");
}
if (typeof config?.btn?.mise?.callback === "function") {
config.btn.mise.callback(eventDetails, event);
}
},
{
capture: true,
}
);
popsDOMUtils.on(
headerCloseBtnElement,
"click",
(event) => {
event.preventDefault();
event.stopPropagation();
PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
if (typeof config?.btn?.close?.callback === "function") {
config.btn.close.callback(eventDetails, event);
}
},
{
capture: true,
}
);
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const PopsPanelConfig = () => {
return {
title: {
text: "默认标题",
position: "center",
html: false,
style: "",
},
content: [
{
id: "whitesev-panel-config-1",
title: "菜单配置1",
headerTitle: "菜单配置1",
isDefault: false,
attributes: [
{
"data-test": "test",
"data-test-2": "test2",
},
],
forms: [
{
className: "forms-1",
text: "区域设置",
type: "forms",
attributes: [],
forms: [
{
className: "panel-switch",
text: "switch",
type: "switch",
props: {},
attributes: [],
getValue() {
return true;
},
callback(event, value) {
console.log("按钮开启状态:", value);
},
},
{
className: "panel-slider",
text: "slider",
type: "slider",
props: {},
attributes: [],
getValue() {
return 50;
},
callback(event, value) {
console.log("滑块当前数值:", value);
},
min: 1,
max: 100,
},
{
className: "panel-button",
text: "button",
type: "button",
props: {},
attributes: [],
buttonIcon: "view",
buttonIconIsLoading: true,
buttonType: "default",
buttonText: "default按钮",
callback(event) {
console.log("点击按钮", event);
},
},
{
className: "panel-button",
text: "button",
type: "button",
props: {},
attributes: [],
buttonIcon: "eleme",
buttonIconIsLoading: true,
buttonType: "warning",
buttonText: "warning按钮",
callback(event) {
console.log("点击按钮", event);
},
},
{
className: "panel-button",
text: "button",
props: {},
type: "button",
attributes: [],
buttonIcon: "chromeFilled",
buttonIconIsLoading: true,
buttonType: "danger",
buttonText: "danger按钮",
callback(event) {
console.log("点击按钮", event);
},
},
{
className: "panel-button",
text: "button",
type: "button",
attributes: [],
props: {},
buttonIcon: "upload",
buttonIconIsLoading: false,
buttonType: "info",
buttonText: "info按钮",
callback(event) {
console.log("点击按钮", event);
},
},
],
},
],
},
{
id: "whitesev-panel-config-2",
title: "菜单配置2",
headerTitle: "菜单配置2",
isDefault: true,
attributes: [
{
"data-value": "value",
"data-value-2": "value2",
},
],
forms: [
{
className: "panel-input",
text: "input",
type: "input",
props: {},
attributes: [],
getValue() {
return "50";
},
callback(event, value) {
popsDOMUtils.preventEvent(event);
console.log("输入框内容改变:", value);
},
placeholder: "请输入内容",
},
{
className: "panel-input-password",
text: "input-password",
type: "input",
props: {},
attributes: [],
getValue() {
return "123456";
},
callback(event, value) {
popsDOMUtils.preventEvent(event);
console.log("密码输入框内容改变:", value);
},
isPassword: true,
placeholder: "请输入密码",
},
{
className: "panel-textarea",
text: "textarea",
type: "textarea",
props: {},
attributes: [],
getValue() {
return "50";
},
callback(event, value) {
popsDOMUtils.preventEvent(event);
console.log("textarea输入框内容改变:", value);
},
placeholder: "请输入内容",
},
{
className: "panel-select",
text: "select",
type: "select",
disabled: true,
props: {},
attributes: [],
getValue() {
return 50;
},
callback(event, isSelectedValue, isSelectedText) {
console.log(`select当前选项:${isSelectedValue},当前选项文本:${isSelectedText}`);
},
data: [
{
value: "all",
text: "所有",
disable() {
return false;
},
forms: [],
},
{
value: "text",
text: "文本",
disable() {
return false;
},
forms: [],
},
{
value: "html",
text: "超文本",
disable() {
return false;
},
forms: [],
},
],
},
{
className: "panel-select-multiple",
type: "select-multiple",
text: "select-multiple",
disabled: true,
props: {},
attributes: [],
placeholder: "请至少选择一个选项",
getValue() {
return ["select-1", "select-2"];
},
callback(selectInfo) {
console.log(`select值改变,多选信息`, selectInfo);
},
clickCallBack(event, isSelectedInfo) {
console.log("点击", event, isSelectedInfo);
},
closeIconClickCallBack(event, data) {
console.log("点击关闭图标的事件", data);
},
data: [
{
value: "select-1",
text: "单选1",
isHTML: false,
disable(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-5"].includes(it.value)) !== -1;
},
},
{
value: "select-2",
text: "单选2",
isHTML: false,
disable(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-5"].includes(it.value)) !== -1;
},
},
{
value: "select-3",
text: "单选3",
isHTML: false,
disable(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-2", "select-5"].includes(it.value)) !== -1;
},
},
{
value: "select-4",
text: "单选4",
isHTML: false,
disable(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-3", "select-5"].includes(it.value)) !== -1;
},
},
{
value: "select-5",
text(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-4"].includes(it.value)) !== -1
? "单选5-禁用"
: "单选5";
},
isHTML: false,
disable(value, allSelectedInfo) {
return allSelectedInfo.findIndex((it) => ["select-4"].includes(it.value)) !== -1;
},
},
],
},
{
type: "forms",
text: "deep菜单",
forms: [
{
type: "deepMenu",
className: "panel-deepMenu",
text: "deepMenu",
description: "二级菜单",
rightText: "自定义配置",
arrowRightIcon: true,
afterAddToUListCallBack(formConfig, container) {
console.log(formConfig, container);
},
clickCallBack(event, formConfig) {
console.log("进入子配置", event, formConfig);
},
forms: [
{
className: "forms-1",
text: "区域设置",
type: "forms",
attributes: [],
forms: [
{
className: "panel-switch",
text: "switch",
type: "switch",
props: {},
attributes: [],
getValue() {
return true;
},
callback(event, value) {
console.log("按钮开启状态:", value);
},
},
{
className: "panel-slider",
text: "slider",
props: {},
type: "slider",
attributes: [],
getValue() {
return 50;
},
callback(event, value) {
console.log("滑块当前数值:", value);
},
min: 1,
max: 100,
},
{
className: "panel-button",
text: "button",
props: {},
type: "button",
attributes: [],
buttonIcon: "eleme",
buttonIconIsLoading: true,
buttonType: "warning",
buttonText: "warning按钮",
callback(event) {
console.log("点击按钮", event);
},
},
{
className: "panel-button",
text: "button",
type: "button",
props: {},
attributes: [],
buttonIcon: "chromeFilled",
buttonIconIsLoading: true,
buttonType: "danger",
buttonText: "danger按钮",
callback(event) {
console.log("点击按钮", event);
},
},
{
className: "panel-button",
text: "button",
props: {},
type: "button",
attributes: [],
buttonIcon: "upload",
buttonIconIsLoading: false,
buttonType: "info",
buttonText: "info按钮",
callback(event) {
console.log("点击按钮", event);
},
},
],
},
],
},
{
type: "deepMenu",
className: "panel-deepMenu2",
attributes: {},
props: {},
text: "deepMenu2",
description: "二级菜单",
rightText: "自定义配置",
arrowRightIcon: true,
afterAddToUListCallBack(formConfig, container) {
console.log(formConfig, container);
},
clickCallBack(event, formConfig) {
console.log("进入子配置", event, formConfig);
},
forms: [],
},
],
},
{
type: "forms",
isFold: true,
text: "折叠菜单",
afterAddToUListCallBack(formConfig, container) {
console.log(formConfig, container);
},
forms: [
{
className: "panel-switch",
text: "switch",
props: {},
type: "switch",
attributes: [],
getValue() {
return true;
},
callback(event, value) {
console.log("按钮开启状态:", value);
},
},
],
},
],
},
{
id: "whitesev-panel-bottom-config-1",
title: `
<a rel="nofollow" href="https://www.npmjs.com/package/@whitesev/pops" target="_blank"><img src="https://img.shields.io/npm/v/@whitesev/pops?label=pops" alt="npm pops version"></a>
`,
isBottom: true,
disableAsideItemHoverCSS: true,
attributes: [
{
"data-value": "value",
"data-value-2": "value2",
},
],
props: {},
forms: [],
clickFirstCallback: function () {
return false;
},
},
{
id: "whitesev-panel-bottom-config-2",
title: "版本:xxx.xx.xx",
isBottom: true,
attributes: [
{
"data-value": "value",
"data-value-2": "value2",
},
],
props: {},
forms: [],
clickFirstCallback: function () {
return false;
},
},
],
btn: {
close: {
enable: true,
callback(event) {
event.close();
},
},
},
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
useShadowRoot: true,
class: "",
mobileClassName: "pops-panel-is-mobile",
isMobile: false,
only: false,
width: window.innerWidth < 550 ? "88vw" : "700px",
height: window.innerHeight < 450 ? "70vh" : "500px",
position: "center",
animation: "pops-anim-fadein-zoom",
useDeepMenuSwtichAnimation: true,
zIndex: 1e4,
drag: false,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
forbiddenScroll: false,
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsMathFloatUtils = {
isFloat(num) {
return Number(num) === num && num % 1 !== 0;
},
add(number1, number2) {
let number1length, number2length;
try {
number1length = number1.toString().split(".")[1].length;
} catch {
number1length = 0;
}
try {
number2length = number2.toString().split(".")[1].length;
} catch {
number2length = 0;
}
const powValue = Math.pow(10, Math.max(number1length, number2length));
return Math.round(number1 * powValue + number2 * powValue) / powValue;
},
sub(number1, number2) {
let number1length, number2length;
try {
number1length = number1.toString().split(".")[1].length;
} catch {
number1length = 0;
}
try {
number2length = number2.toString().split(".")[1].length;
} catch {
number2length = 0;
}
const powValue = Math.pow(10, Math.max(number1length, number2length));
const fixedValue = number1length >= number2length ? number1length : number2length;
return (Math.round(number1 * powValue - number2 * powValue) / powValue).toFixed(fixedValue);
},
division(number1, number2) {
let number1length, number2length;
try {
number1length = number1.toString().split(".")[1].length;
} catch {
number1length = 0;
}
try {
number2length = number2.toString().split(".")[1].length;
} catch {
number2length = 0;
}
const number1ReplaceValue = Number(number1.toString().replace(".", ""));
const number2ReplaceValue = Number(number2.toString().replace(".", ""));
return (number1ReplaceValue / number2ReplaceValue) * Math.pow(10, number2length - number1length);
},
};
const PopsTooltipConfig = () => {
return {
useShadowRoot: true,
target: null,
content: "默认文字",
isDiffContent: false,
position: "top",
className: "",
isFixed: false,
alwaysShow: false,
triggerShowEventName: "mouseenter touchstart",
triggerCloseEventName: "mouseleave touchend",
zIndex: 1e4,
only: false,
eventOption: {
passive: false,
capture: true,
once: false,
},
showBeforeCallBack() {},
showAfterCallBack() {},
closeBeforeCallBack() {},
closeAfterCallBack() {},
delayCloseTime: 100,
showArrow: true,
arrowDistance: 12.5,
otherDistance: 0,
style: "",
beforeAppendToPageCallBack() {},
};
};
class ToolTip {
$el = {
$shadowContainer: null,
$shadowRoot: null,
$toolTip: null,
$content: null,
$arrow: null,
};
$data = {
config: null,
guid: null,
timeId_close_TouchEvent: [],
timeId_close_MouseEvent: [],
};
constructor(config, guid, ShadowInfo) {
this.$data.config = config;
this.$data.guid = guid;
this.$el.$shadowContainer = ShadowInfo.$shadowContainer;
this.$el.$shadowRoot = ShadowInfo.$shadowRoot;
this.show = this.show.bind(this);
this.close = this.close.bind(this);
this.toolTipAnimationFinishEvent = this.toolTipAnimationFinishEvent.bind(this);
this.toolTipMouseEnterEvent = this.toolTipMouseEnterEvent.bind(this);
this.toolTipMouseLeaveEvent = this.toolTipMouseLeaveEvent.bind(this);
this.init();
}
init() {
const toolTipInfo = this.createToolTip();
this.$el.$toolTip = toolTipInfo.$toolTipContainer;
this.$el.$content = toolTipInfo.$toolTipContent;
this.$el.$arrow = toolTipInfo.$toolTipArrow;
this.changeContent();
this.changeZIndex();
this.changePosition();
if (!this.$data.config.alwaysShow) {
this.offEvent();
this.onEvent();
}
}
createToolTip() {
const $toolTipContainer = popsDOMUtils.createElement(
"div",
{
className: "pops-tip",
innerHTML: `
<div class="pops-tip-content" style="text-align: center;"></div>
<div class="pops-tip-arrow"></div>
`,
},
{
"data-position": this.$data.config.isFixed ? "fixed" : "absolute",
"data-guid": this.$data.guid,
}
);
const $toolTipContent = $toolTipContainer.querySelector(".pops-tip-content");
const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
}
$toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
if (this.$data.config.style != null) {
const cssNode = popsDOMUtils.createElement("style", {
type: "text/css",
innerHTML: this.$data.config.style,
});
$toolTipContainer.appendChild(cssNode);
}
if (!this.$data.config.showArrow) {
$toolTipArrow.remove();
}
return {
$toolTipContainer,
$toolTipArrow,
$toolTipContent,
};
}
getContent() {
return typeof this.$data.config.content === "function" ? this.$data.config.content() : this.$data.config.content;
}
changeContent(text) {
if (text == null) {
text = this.getContent();
}
if (this.$data.config.isDiffContent) {
const contentPropKey = "data-content";
const originContentText = Reflect.get(this.$el.$content, contentPropKey);
if (typeof originContentText === "string") {
if (originContentText === text) {
return;
}
}
Reflect.set(this.$el.$content, contentPropKey, text);
}
PopsSafeUtils.setSafeHTML(this.$el.$content, text);
}
getZIndex() {
const zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex);
return zIndex;
}
changeZIndex() {
const zIndex = this.getZIndex();
this.$el.$toolTip.style.setProperty("z-index", zIndex.toString());
}
calcToolTipPosition(targetElement, arrowDistance, otherDistance, event) {
const offsetInfo = popsDOMUtils.offset(targetElement, !this.$data.config.isFixed);
const targetElement_width = offsetInfo.width;
const targetElement_height = offsetInfo.height;
const targetElement_top = offsetInfo.top;
const targetElement_left = offsetInfo.left;
const toolTipElement_width = popsDOMUtils.outerWidth(this.$el.$toolTip);
const toolTipElement_height = popsDOMUtils.outerHeight(this.$el.$toolTip);
const targetElement_X_center_pos = targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
const targetElement_Y_center_pos = targetElement_top + targetElement_height / 2 - toolTipElement_height / 2;
let mouseX = 0;
let mouseY = 0;
if (event != null) {
if (event instanceof MouseEvent || event instanceof PointerEvent) {
mouseX = event.pageX;
mouseY = event.y;
} else if (event instanceof TouchEvent) {
const touchEvent = event.touches[0];
mouseX = touchEvent.pageX;
mouseY = touchEvent.pageY;
} else {
if (typeof event.clientX === "number") {
mouseX = event.clientX;
}
if (typeof event.clientY === "number") {
mouseY = event.clientY;
}
}
}
return {
TOP: {
left: targetElement_X_center_pos - otherDistance,
top: targetElement_top - toolTipElement_height - arrowDistance,
arrow: "bottom",
motion: "fadeInTop",
},
RIGHT: {
left: targetElement_left + targetElement_width + arrowDistance,
top: targetElement_Y_center_pos + otherDistance,
arrow: "left",
motion: "fadeInRight",
},
BOTTOM: {
left: targetElement_X_center_pos - otherDistance,
top: targetElement_top + targetElement_height + arrowDistance,
arrow: "top",
motion: "fadeInBottom",
},
LEFT: {
left: targetElement_left - toolTipElement_width - arrowDistance,
top: targetElement_Y_center_pos + otherDistance,
arrow: "right",
motion: "fadeInLeft",
},
FOLLOW: {
left: mouseX + otherDistance,
top: mouseY + otherDistance,
arrow: "follow",
motion: "",
},
};
}
changePosition(event) {
const positionInfo = this.calcToolTipPosition(
this.$data.config.target,
this.$data.config.arrowDistance,
this.$data.config.otherDistance,
event
);
const positionKey = this.$data.config.position.toUpperCase();
const positionDetail = positionInfo[positionKey];
if (positionDetail) {
this.$el.$toolTip.style.left = positionDetail.left + "px";
this.$el.$toolTip.style.top = positionDetail.top + "px";
this.$el.$toolTip.setAttribute("data-motion", positionDetail.motion);
this.$el.$arrow.setAttribute("data-position", positionDetail.arrow);
} else {
console.error("不存在该位置", this.$data.config.position);
}
}
onEvent() {
this.onToolTipAnimationFinishEvent();
this.onShowEvent();
this.onCloseEvent();
this.onToolTipMouseEnterEvent();
this.onToolTipMouseLeaveEvent();
}
offEvent() {
this.offToolTipAnimationFinishEvent();
this.offShowEvent();
this.offCloseEvent();
this.offToolTipMouseEnterEvent();
this.offToolTipMouseLeaveEvent();
}
addCloseTimeoutId(type, timeId) {
if (type === "MouseEvent") {
this.$data.timeId_close_MouseEvent.push(timeId);
} else {
this.$data.timeId_close_TouchEvent.push(timeId);
}
}
clearCloseTimeoutId(type, timeId) {
const timeIdList =
type === "MouseEvent" ? this.$data.timeId_close_MouseEvent : this.$data.timeId_close_TouchEvent;
for (let index = 0; index < timeIdList.length; index++) {
const currentTimeId = timeIdList[index];
if (typeof timeId === "number") {
if (timeId == currentTimeId) {
popsUtils.clearTimeout(timeId);
timeIdList.splice(index, 1);
break;
}
} else {
popsUtils.clearTimeout(currentTimeId);
timeIdList.splice(index, 1);
index--;
}
}
}
show(...args) {
const event = args[0];
const eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
this.clearCloseTimeoutId(eventType);
if (typeof this.$data.config.showBeforeCallBack === "function") {
const result = this.$data.config.showBeforeCallBack(this.$el.$toolTip);
if (typeof result === "boolean" && !result) {
return;
}
}
if (!popsUtils.contains(this.$el.$shadowRoot, this.$el.$toolTip)) {
this.init();
popsDOMUtils.append(this.$el.$shadowRoot, this.$el.$toolTip);
}
if (!popsUtils.contains(this.$el.$shadowContainer)) {
if (typeof this.$data.config.beforeAppendToPageCallBack === "function") {
this.$data.config.beforeAppendToPageCallBack(this.$el.$shadowRoot, this.$el.$shadowContainer);
}
popsDOMUtils.append(document.body, this.$el.$shadowContainer);
}
this.changeContent();
this.changePosition(event);
if (typeof this.$data.config.showAfterCallBack === "function") {
this.$data.config.showAfterCallBack(this.$el.$toolTip);
}
}
onShowEvent() {
popsDOMUtils.on(
this.$data.config.target,
this.$data.config.triggerShowEventName,
this.show,
this.$data.config.eventOption
);
}
offShowEvent() {
popsDOMUtils.off(this.$data.config.target, this.$data.config.triggerShowEventName, this.show, {
capture: true,
});
}
close(...args) {
const event = args[0];
const eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
if (event && event instanceof MouseEvent) {
const $target = event.composedPath()[0];
if ($target != this.$data.config.target && $target != this.$el.$toolTip) {
return;
}
}
if (typeof this.$data.config.closeBeforeCallBack === "function") {
const result = this.$data.config.closeBeforeCallBack(this.$el.$toolTip);
if (typeof result === "boolean" && !result) {
return;
}
}
if (
this.$data.config.delayCloseTime == null ||
(typeof this.$data.config.delayCloseTime === "number" && this.$data.config.delayCloseTime <= 0)
) {
this.$data.config.delayCloseTime = 100;
}
const timeId = popsUtils.setTimeout(() => {
this.clearCloseTimeoutId(eventType, timeId);
if (this.$el.$toolTip == null) {
return;
}
const motion = this.$el.$toolTip.getAttribute("data-motion");
if (motion == null || motion.trim() === "") {
this.toolTipAnimationFinishEvent();
} else {
this.$el.$toolTip.setAttribute(
"data-motion",
this.$el.$toolTip.getAttribute("data-motion").replace("fadeIn", "fadeOut")
);
}
}, this.$data.config.delayCloseTime);
this.addCloseTimeoutId(eventType, timeId);
if (typeof this.$data.config.closeAfterCallBack === "function") {
this.$data.config.closeAfterCallBack(this.$el.$toolTip);
}
}
onCloseEvent() {
popsDOMUtils.on(
this.$data.config.target,
this.$data.config.triggerCloseEventName,
this.close,
this.$data.config.eventOption
);
}
offCloseEvent() {
popsDOMUtils.off(this.$data.config.target, this.$data.config.triggerCloseEventName, this.close, {
capture: true,
});
}
destory() {
if (this.$el.$toolTip) {
this.$el.$shadowRoot.removeChild(this.$el.$toolTip);
}
this.$el.$toolTip = null;
this.$el.$arrow = null;
this.$el.$content = null;
}
toolTipAnimationFinishEvent() {
if (!this.$el.$toolTip) {
return;
}
if (this.$el.$toolTip.getAttribute("data-motion").includes("In")) {
return;
}
this.destory();
}
onToolTipAnimationFinishEvent() {
popsDOMUtils.on(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.toolTipAnimationFinishEvent);
}
offToolTipAnimationFinishEvent() {
popsDOMUtils.off(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.toolTipAnimationFinishEvent);
}
toolTipMouseEnterEvent() {
this.clearCloseTimeoutId("MouseEvent");
this.clearCloseTimeoutId("TouchEvent");
}
onToolTipMouseEnterEvent() {
this.clearCloseTimeoutId("MouseEvent");
this.clearCloseTimeoutId("TouchEvent");
popsDOMUtils.on(
this.$el.$toolTip,
"mouseenter touchstart",
this.toolTipMouseEnterEvent,
this.$data.config.eventOption
);
}
offToolTipMouseEnterEvent() {
popsDOMUtils.off(
this.$el.$toolTip,
"mouseenter touchstart",
this.toolTipMouseEnterEvent,
this.$data.config.eventOption
);
}
toolTipMouseLeaveEvent(event) {
this.close(event);
}
onToolTipMouseLeaveEvent() {
popsDOMUtils.on(
this.$el.$toolTip,
"mouseleave touchend",
this.toolTipMouseLeaveEvent,
this.$data.config.eventOption
);
}
offToolTipMouseLeaveEvent() {
popsDOMUtils.off(
this.$el.$toolTip,
"mouseleave touchend",
this.toolTipMouseLeaveEvent,
this.$data.config.eventOption
);
}
}
const PopsTooltip = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "tooltip";
let config = PopsTooltipConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
if (!(config.target instanceof HTMLElement)) {
throw new TypeError("config.target 必须是HTMLElement类型");
}
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "tooltipCSS",
css: PopsCSS.tooltipCSS,
},
]);
const toolTip = new ToolTip(config, guid, {
$shadowContainer,
$shadowRoot,
});
if (config.alwaysShow) {
toolTip.show();
}
return {
guid,
config,
$shadowContainer,
$shadowRoot,
toolTip,
};
},
};
const PanelHandlerComponents = () => {
return {
asideULElement: null,
asideBottomULElement: null,
sectionContainerHeaderULElement: null,
sectionContainerULElement: null,
$el: {
$pops: null,
$content: null,
$sectionWrapper: null,
$contentAside: null,
$contentSectionContainer: null,
},
$config: {},
init(details) {
const PopsType = "panel";
this.$el = {
...details.$el,
};
this.$config = details.config;
this.asideULElement = this.$el.$contentAside.querySelector(`ul.pops-${PopsType}-aside-top-container`);
this.asideBottomULElement = this.$el.$contentAside.querySelector(`ul.pops-${PopsType}-aside-bottom-container`);
this.sectionContainerHeaderULElement = this.$el.$contentSectionContainer.querySelector(
`ul.pops-${PopsType}-container-header-ul`
);
this.sectionContainerULElement = this.$el.$contentSectionContainer.querySelector(
`ul.pops-${PopsType}-container-main-ul`
);
let $defaultAsideItem = null;
let isScrollToDefaultView = false;
details.config.content.forEach((asideItemConfig) => {
const $asideLiElement = this.createAsideItem(asideItemConfig);
this.setAsideItemClickEvent($asideLiElement, asideItemConfig);
const isBottom =
typeof asideItemConfig.isBottom === "function" ? asideItemConfig.isBottom() : asideItemConfig.isBottom;
if (isBottom) {
this.asideBottomULElement.appendChild($asideLiElement);
} else {
this.asideULElement.appendChild($asideLiElement);
}
if ($defaultAsideItem == null) {
let flag = false;
if (typeof asideItemConfig.isDefault === "function") {
flag = Boolean(asideItemConfig.isDefault());
} else {
flag = Boolean(asideItemConfig.isDefault);
}
if (flag) {
$defaultAsideItem = $asideLiElement;
isScrollToDefaultView = Boolean(asideItemConfig.scrollToDefaultView);
}
}
if (typeof asideItemConfig.afterRender === "function") {
asideItemConfig.afterRender({
asideConfig: asideItemConfig,
$asideLiElement,
});
}
});
if ($defaultAsideItem == null && this.asideULElement.children.length) {
$defaultAsideItem = this.asideULElement.children[0];
}
if ($defaultAsideItem) {
$defaultAsideItem.click();
if (isScrollToDefaultView) {
$defaultAsideItem?.scrollIntoView();
}
} else {
console.error("pops.panel:左侧容器没有项");
}
},
clearContainer() {
Reflect.deleteProperty(this.$el.$contentSectionContainer, "__formConfig__");
PopsSafeUtils.setSafeHTML(this.sectionContainerHeaderULElement, "");
PopsSafeUtils.setSafeHTML(this.sectionContainerULElement, "");
this.clearDeepMenuContainer();
},
clearDeepMenuContainer() {
this.$el.$sectionWrapper
?.querySelectorAll("section.pops-panel-deepMenu-container")
.forEach(($el) => $el.remove());
},
clearAsideItemIsVisited() {
this.$el.$contentAside.querySelectorAll(".pops-is-visited").forEach(($el) => {
popsDOMUtils.removeClassName($el, "pops-is-visited");
});
},
setAsideItemIsVisited(element) {
popsDOMUtils.addClassName(element, "pops-is-visited");
},
setElementAttributes(element, attributes) {
if (attributes == null) {
return;
}
if (Array.isArray(attributes)) {
attributes.forEach((attrObject) => {
this.setElementAttributes(element, attrObject);
});
} else {
Object.keys(attributes).forEach((attributeName) => {
element.setAttribute(attributeName, attributes[attributeName]);
});
}
},
setElementProps(element, props) {
if (props == null) {
return;
}
Object.keys(props).forEach((propName) => {
const value = props[propName];
if (propName === "innerHTML") {
PopsSafeUtils.setSafeHTML(element, value);
return;
}
Reflect.set(element, propName, value);
});
},
setElementClassName(element, className) {
if (className == null) {
return;
}
if (typeof className === "function") {
className = className();
}
if (typeof className === "string") {
const splitClassName = className.split(" ");
splitClassName.forEach((classNameStr) => {
element.classList.add(classNameStr);
});
} else if (Array.isArray(className)) {
className.forEach((classNameStr) => {
this.setElementClassName(element, classNameStr);
});
}
},
createAsideItem(asideConfig) {
const $li = document.createElement("li");
$li.id = asideConfig.id;
Reflect.set($li, "__forms__", asideConfig.forms);
const title = typeof asideConfig.title === "function" ? asideConfig.title() : asideConfig.title;
PopsSafeUtils.setSafeHTML($li, title);
this.setElementClassName($li, "pops-panel-aside-item");
this.setElementClassName($li, asideConfig.className);
this.setElementAttributes($li, asideConfig.attributes);
this.setElementProps($li, asideConfig.props);
const disableAsideItemHoverCSSClassName = "pops-panel-disabled-aside-hover-css";
const disableAsideItemHoverCSS =
typeof asideConfig.disableAsideItemHoverCSS === "function"
? asideConfig.disableAsideItemHoverCSS()
: asideConfig.disableAsideItemHoverCSS;
if (disableAsideItemHoverCSS) {
$li.classList.add(disableAsideItemHoverCSSClassName);
} else {
$li.classList.remove(disableAsideItemHoverCSSClassName);
}
return $li;
},
createSectionContainerItem_switch(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-switch">
<input class="pops-panel-switch__input" type="checkbox">
<span class="pops-panel-switch__core">
<div class="pops-panel-switch__action">
</div>
</span>
</div>`
);
const PopsPanelSwitch = {
[Symbol.toStringTag]: "PopsPanelSwitch",
$data: {
value: Boolean(formConfig.getValue()),
},
$ele: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
switch: $li.querySelector(".pops-panel-switch"),
input: $li.querySelector(".pops-panel-switch__input"),
core: $li.querySelector(".pops-panel-switch__core"),
},
init() {
this.setStatus(this.$data.value);
const disabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (disabled) {
this.disable();
}
this.setClickEvent();
},
setClickEvent() {
const that = this;
popsDOMUtils.on(this.$ele.core, "click", function (event) {
if (that.$ele.input.disabled || that.$ele.switch.hasAttribute("data-disabled")) {
return;
}
that.$data.value = that.getStatus();
that.setStatus(that.$data.value);
if (typeof formConfig.callback === "function") {
formConfig.callback(event, that.$data.value);
}
});
},
setStatus(isChecked = false) {
isChecked = Boolean(isChecked);
this.$ele.input.checked = isChecked;
if (isChecked) {
popsDOMUtils.addClassName(this.$ele.switch, "pops-panel-switch-is-checked");
} else {
popsDOMUtils.removeClassName(this.$ele.switch, "pops-panel-switch-is-checked");
}
},
getStatus() {
let checkedValue = false;
if (!popsDOMUtils.containsClassName(this.$ele.switch, "pops-panel-switch-is-checked")) {
checkedValue = true;
}
return checkedValue;
},
disable() {
this.$ele.input.disabled = true;
this.$ele.switch.setAttribute("data-disabled", "true");
popsDOMUtils.addClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
notDisable() {
this.$ele.input.disabled = false;
this.$ele.switch.removeAttribute("data-disabled");
popsDOMUtils.removeClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
};
PopsPanelSwitch.init();
Reflect.set($li, "data-switch", PopsPanelSwitch);
return $li;
},
createSectionContainerItem_slider(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-slider">
<input type="range" min="${formConfig.min}" max="${formConfig.max}">
</div>
`
);
const $rangeInput = $li.querySelector(".pops-panel-slider input[type=range]");
if (formConfig.step) {
$rangeInput.setAttribute("step", formConfig.step.toString());
}
$rangeInput.value = formConfig.getValue().toString();
const getToolTipContent = function (value) {
if (typeof formConfig.getToolTipContent === "function") {
return formConfig.getToolTipContent(value);
} else {
return value;
}
};
const tooltip = PopsTooltip.init({
target: $rangeInput.parentElement,
content: () => {
return getToolTipContent($rangeInput.value);
},
zIndex: () => {
return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
},
className: "github-tooltip",
alwaysShow: false,
only: false,
position: "top",
arrowDistance: 10,
});
popsDOMUtils.on($rangeInput, ["input", "propertychange"], void 0, function (event) {
tooltip.toolTip.changeContent(getToolTipContent($rangeInput.value));
if (typeof formConfig.callback === "function") {
formConfig.callback(event, $rangeInput.valueAsNumber);
}
});
return $li;
},
createSectionContainerItem_slider_new(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text" style="flex: 1;">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-slider pops-slider-width">
<div class="pops-slider__runway">
<div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
<div class="pops-slider__button-wrapper" style="left: 0%">
<div class="pops-slider__button"></div>
</div>
</div>
</div>`
);
const PopsPanelSlider = {
[Symbol.toStringTag]: "PopsPanelSlider",
value: formConfig.getValue(),
min: formConfig.min,
max: formConfig.max,
step: formConfig.step || 1,
$data: {
isMove: false,
isInitDragPosition: false,
isCheckingStopDragMove: false,
totalWidth: 0,
stepPx: 0,
dragWidth: 0,
dragPercent: 0,
stepBlockMap: new Map(),
tooltip: null,
},
$ele: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
slider: $li.querySelector(".pops-slider"),
runAway: $li.querySelector(".pops-slider__runway"),
bar: $li.querySelector(".pops-slider__bar"),
buttonWrapper: $li.querySelector(".pops-slider__button-wrapper"),
button: $li.querySelector(".pops-slider__button"),
},
$interval: {
isCheck: false,
},
$tooltip: null,
init() {
this.initEleData();
this.setToolTipEvent();
this.setPanEvent();
this.setRunAwayClickEvent();
this.intervalInit();
if (this.isFormConfigDisabledDrag()) {
this.disableDrag();
}
},
intervalInit(checkStepTime = 200, maxTime = 1e4) {
if (this.$interval.isCheck) {
return;
}
this.$interval.isCheck = true;
let isSuccess = false;
const oldTotalWidth = this.$data.totalWidth;
let timer = void 0;
const interval = setInterval(() => {
if (isSuccess) {
this.$interval.isCheck = false;
clearTimeout(timer);
clearInterval(interval);
} else {
this.initTotalWidth();
if (this.$data.totalWidth !== 0) {
isSuccess = true;
if (this.$data.totalWidth !== oldTotalWidth) {
if (PopsMathFloatUtils.isFloat(this.step)) {
this.initFloatStepMap();
} else {
this.initStepMap();
}
this.initSliderPosition();
}
}
}
}, checkStepTime);
timer = setTimeout(() => {
clearInterval(interval);
}, maxTime);
},
initEleData() {
this.$ele.slider.setAttribute("data-min", this.min.toString());
this.$ele.slider.setAttribute("data-max", this.max.toString());
this.$ele.slider.setAttribute("data-value", this.value.toString());
this.$ele.slider.setAttribute("data-step", this.step.toString());
Reflect.set(this.$ele.slider, "data-min", this.min);
Reflect.set(this.$ele.slider, "data-max", this.max);
Reflect.set(this.$ele.slider, "data-value", this.value);
Reflect.set(this.$ele.slider, "data-step", this.step);
},
initTotalWidth() {
this.$data.totalWidth = popsDOMUtils.width(this.$ele.runAway);
},
initStepMap() {
let index = 0;
const blockNums = (this.max - this.min) / this.step;
this.$data.stepPx = this.$data.totalWidth / blockNums;
let widthPx = 0;
for (let stepValue = this.min; stepValue <= this.max; stepValue += this.step) {
const value = this.formatValue(stepValue);
let info;
if (value === this.min) {
info = {
value,
px: 0,
pxLeft: 0,
pxRight: this.$data.stepPx / 2,
percent: 0,
};
} else {
info = {
value,
px: widthPx,
pxLeft: widthPx - this.$data.stepPx / 2,
pxRight: widthPx + this.$data.stepPx / 2,
percent: widthPx / this.$data.totalWidth,
};
}
this.$data.stepBlockMap.set(index, info);
index++;
widthPx += this.$data.stepPx;
}
},
initFloatStepMap() {
let index = 0;
const blockNums = (this.max - this.min) / this.step;
this.$data.stepPx = this.$data.totalWidth / blockNums;
let widthPx = 0;
for (
let stepValue = this.min;
stepValue <= this.max;
stepValue = PopsMathFloatUtils.add(stepValue, this.step)
) {
const value = this.formatValue(stepValue);
let info;
if (value === this.min) {
info = {
value,
px: 0,
pxLeft: 0,
pxRight: this.$data.stepPx / 2,
percent: 0,
};
} else {
info = {
value,
px: widthPx,
pxLeft: widthPx - this.$data.stepPx / 2,
pxRight: widthPx + this.$data.stepPx / 2,
percent: widthPx / this.$data.totalWidth,
};
}
this.$data.stepBlockMap.set(index, info);
index++;
widthPx += this.$data.stepPx;
}
},
initSliderPosition() {
let percent = 0;
for (const [, stepBlockInfo] of this.$data.stepBlockMap.entries()) {
if (stepBlockInfo.value == this.value) {
percent = stepBlockInfo.percent;
this.$data.dragWidth = stepBlockInfo.px;
break;
}
}
percent = this.formatValue(percent * 100);
this.setSliderPosition(percent);
},
isFloat(num) {
return Number(num) === num && num % 1 !== 0;
},
valueChangeCallBack(event, value) {
if (typeof formConfig.callback === "function") {
formConfig.callback(event, value);
}
},
getDragInfo(dragX) {
let result = this.$data.stepBlockMap.get(0);
for (const [, stepBlockInfo] of this.$data.stepBlockMap.entries()) {
if (stepBlockInfo.pxLeft <= dragX && dragX < stepBlockInfo.pxRight) {
result = stepBlockInfo;
break;
}
}
return result;
},
getSliderPositonPercent(dragWidth) {
return dragWidth / this.$data.totalWidth;
},
formatValue(num) {
if (PopsMathFloatUtils.isFloat(this.step)) {
num = parseFloat(num.toFixed(2));
} else {
num = parseInt(num.toString());
}
return num;
},
setSliderPosition(percent) {
if (parseInt(percent.toString()) === 1) {
percent = 1;
}
if (percent > 1) {
percent = percent / 100;
}
this.$ele.buttonWrapper.style.left = `${percent * 100}%`;
this.$ele.bar.style.width = `${percent * 100}%`;
},
disableDrag() {
popsDOMUtils.addClassName(this.$ele.runAway, "pops-slider-is-disabled");
popsDOMUtils.addClassName(this.$ele.runAway, PopsCommonCSSClassName.textIsDisabled);
},
allowDrag() {
popsDOMUtils.removeClassName(this.$ele.runAway, "pops-slider-is-disabled");
popsDOMUtils.removeClassName(this.$ele.runAway, PopsCommonCSSClassName.textIsDisabled);
},
isDisabledDrag() {
return popsDOMUtils.containsClassName(this.$ele.runAway, "pops-slider-is-disabled");
},
isFormConfigDisabledDrag() {
const isDisabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (typeof isDisabled === "boolean") {
return isDisabled;
} else {
return false;
}
},
setRunAwayClickEvent() {
popsDOMUtils.on(
this.$ele.runAway,
"click",
(event) => {
if (event.target !== this.$ele.runAway && event.target !== this.$ele.bar) {
return;
}
const clickX = parseFloat(event.offsetX.toString());
const dragStartResult = this.dragStartCallBack();
if (!dragStartResult) {
return;
}
this.dragMoveCallBack(event, clickX, this.value);
this.dragEndCallBack(clickX);
},
{
capture: false,
}
);
},
dragStartCallBack() {
if (this.isFormConfigDisabledDrag()) {
this.disableDrag();
return false;
}
if (!this.$data.isMove) {
if (this.isDisabledDrag()) {
this.allowDrag();
}
this.$data.isMove = true;
}
return true;
},
dragMoveCallBack(event, dragX, oldValue) {
let dragPercent = 0;
if (dragX <= 0) {
dragPercent = 0;
this.value = this.min;
} else if (dragX >= this.$data.totalWidth) {
dragPercent = 1;
this.value = this.max;
} else {
const dragInfo = this.getDragInfo(dragX);
dragPercent = dragInfo.percent;
this.value = this.formatValue(dragInfo.value);
}
this.$data.dragPercent = dragPercent;
this.setSliderPosition(this.$data.dragPercent);
this.showToolTip();
if (oldValue !== this.value) {
this.valueChangeCallBack(event, this.value);
}
},
dragEndCallBack(dragX) {
this.$data.isMove = false;
if (dragX <= 0) {
this.$data.dragWidth = 0;
} else if (dragX >= this.$data.totalWidth) {
this.$data.dragWidth = this.$data.totalWidth;
} else {
this.$data.dragWidth = dragX;
}
this.closeToolTip();
},
setPanEvent() {
const AnyTouch = popsUtils.AnyTouch();
this.$tooltip = new AnyTouch(this.$ele.button, {
preventDefault() {
return false;
},
});
let currentDragX = 0;
this.$tooltip.on("at:move", (event) => {
if (!this.dragStartCallBack()) {
return;
}
const oldValue = this.value;
const runAwayRect = this.$ele.runAway.getBoundingClientRect();
let displacementX = event.x - (runAwayRect.left + globalThis.screenX);
if (displacementX <= 0) {
displacementX = 0;
} else if (displacementX >= runAwayRect.width) {
displacementX = runAwayRect.width;
}
currentDragX = displacementX;
this.dragMoveCallBack(event, currentDragX, oldValue);
});
this.$tooltip.on("at:end", () => {
this.dragEndCallBack(currentDragX);
});
},
showToolTip() {
this.$data.tooltip.toolTip.show();
},
closeToolTip() {
this.$data.tooltip.toolTip.close();
},
checkStopDragMove() {
if (this.$data.isCheckingStopDragMove) {
return;
}
this.$data.isCheckingStopDragMove = true;
const interval = setInterval(() => {
if (!this.$data.isMove) {
this.$data.isCheckingStopDragMove = false;
this.closeToolTip();
clearInterval(interval);
}
}, 200);
setTimeout(() => {
this.$data.isCheckingStopDragMove = false;
clearInterval(interval);
}, 2e3);
},
setToolTipEvent() {
function getToolTipContent() {
if (typeof formConfig.getToolTipContent === "function") {
return formConfig.getToolTipContent(PopsPanelSlider.value);
} else {
return PopsPanelSlider.value.toString();
}
}
const tooltip = PopsTooltip.init({
target: this.$ele.button,
content: getToolTipContent,
zIndex: () => {
return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
},
isFixed: true,
className: "github-tooltip",
only: false,
eventOption: {
capture: true,
passive: true,
},
showBeforeCallBack: () => {
const isShowHoverTip =
typeof formConfig.isShowHoverTip === "function"
? formConfig.isShowHoverTip()
: typeof formConfig.isShowHoverTip === "boolean"
? formConfig.isShowHoverTip
: true;
if (!isShowHoverTip) {
return false;
}
this.intervalInit();
},
showAfterCallBack: () => {
tooltip.toolTip.changeContent(getToolTipContent());
},
closeBeforeCallBack: () => {
if (this.$data.isMove) {
this.checkStopDragMove();
return false;
}
},
alwaysShow: false,
position: "top",
arrowDistance: 10,
});
this.$data.tooltip = tooltip;
},
};
PopsPanelSlider.init();
Reflect.set($li, "data-slider", PopsPanelSlider);
return $li;
},
createSectionContainerItem_input(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let inputType = "text";
if (formConfig.isPassword) {
inputType = "password";
} else if (formConfig.isNumber) {
inputType = "number";
}
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-input">
<input type="${inputType}" placeholder="${formConfig.placeholder ?? ""}">
</div>
`
);
const PopsPanelInput = {
[Symbol.toStringTag]: "PopsPanelInput",
$ele: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
panelInput: $li.querySelector(".pops-panel-input"),
input: $li.querySelector("input"),
inputSpanIcon: document.createElement("span"),
inputSpanIconInner: null,
icon: null,
},
$data: {
value: formConfig.getValue(),
isView: false,
},
init() {
this.initEle();
this.setInputValue(this.$data.value);
if (formConfig.isPassword) {
this.setCircleIcon(PopsIcon.getIcon("view"));
this.setCircleIconClickEvent();
} else {
if (this.$ele.input.value != "") {
this.setCircleIcon(PopsIcon.getIcon("circleClose"));
this.setCircleIconClickEvent();
}
}
this.setInputChangeEvent();
const disabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (disabled) {
this.disable();
}
if (typeof formConfig.handlerCallBack === "function") {
formConfig.handlerCallBack($li, this.$ele.input);
}
},
initEle() {
this.$ele.input.parentElement.insertBefore(this.$ele.inputSpanIcon, this.$ele.input.nextSibling);
this.$ele.inputSpanIcon.className = "pops-panel-input__suffix";
PopsSafeUtils.setSafeHTML(
this.$ele.inputSpanIcon,
`
<span class="pops-panel-input__suffix-inner">
<i class="pops-panel-icon"></i>
</span>
`
);
this.$ele.inputSpanIconInner = this.$ele.inputSpanIcon.querySelector(".pops-panel-input__suffix-inner");
this.$ele.icon = this.$ele.inputSpanIcon.querySelector(".pops-panel-icon");
popsDOMUtils.addClassName(this.$ele.panelInput, PopsCommonCSSClassName.userSelectNone);
},
disable() {
this.$ele.input.disabled = true;
popsDOMUtils.addClassName(this.$ele.panelInput, "pops-input-disabled");
popsDOMUtils.addClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
notDisable() {
this.$ele.input.disabled = false;
popsDOMUtils.removeClassName(this.$ele.panelInput, "pops-input-disabled");
popsDOMUtils.removeClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
isDisabled() {
return this.$ele.input.disabled;
},
setInputValue(value = "") {
this.$ele.input.value = value;
},
setInputType(typeValue = "text") {
this.$ele.input.setAttribute("type", typeValue);
},
removeCircleIcon() {
PopsSafeUtils.setSafeHTML(this.$ele.icon, "");
},
setCircleIcon(svgHTML = PopsIcon.getIcon("circleClose")) {
PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
},
setCircleIconClickEvent() {
popsDOMUtils.on(this.$ele.icon, "click", void 0, () => {
if (this.isDisabled()) {
return;
}
this.removeCircleIcon();
if (formConfig.isPassword) {
if (this.$data.isView) {
this.$data.isView = false;
this.setInputType("text");
this.setCircleIcon(PopsIcon.getIcon("hide"));
} else {
this.$data.isView = true;
this.setInputType("password");
this.setCircleIcon(PopsIcon.getIcon("view"));
}
} else {
this.setInputValue("");
this.$ele.input.focus();
this.$ele.input.dispatchEvent(new Event("input"));
}
});
},
setInputChangeEvent() {
popsDOMUtils.on(this.$ele.input, ["input", "propertychange"], void 0, (event) => {
this.$data.value = this.$ele.input.value;
if (!formConfig.isPassword) {
if (this.$ele.input.value !== "" && this.$ele.icon.innerHTML === "") {
this.setCircleIcon(PopsIcon.getIcon("circleClose"));
this.setCircleIconClickEvent();
} else if (this.$ele.input.value === "") {
this.removeCircleIcon();
}
}
if (typeof formConfig.callback === "function") {
if (formConfig.isNumber) {
formConfig.callback(event, this.$ele.input.value, this.$ele.input.valueAsNumber);
} else {
formConfig.callback(event, this.$ele.input.value);
}
}
});
},
};
PopsPanelInput.init();
Reflect.set($li, "data-input", PopsPanelInput);
return $li;
},
createSectionContainerItem_textarea(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-textarea">
<textarea placeholder="${formConfig.placeholder ?? ""}"></textarea>
</div>
`
);
const PopsPanelTextArea = {
[Symbol.toStringTag]: "PopsPanelTextArea",
$ele: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
panelTextarea: $li.querySelector(".pops-panel-textarea"),
textarea: $li.querySelector(".pops-panel-textarea textarea"),
},
$data: {
value: formConfig.getValue(),
},
init() {
this.setValue(this.$data.value);
this.setChangeEvent();
const disabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (disabled) {
this.disable();
}
},
disable() {
this.$ele.textarea.setAttribute("disabled", "true");
popsDOMUtils.addClassName(this.$ele.panelTextarea, "pops-panel-textarea-disable");
popsDOMUtils.addClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
notDisable() {
this.$ele.textarea.removeAttribute("disabled");
popsDOMUtils.removeClassName(this.$ele.panelTextarea, "pops-panel-textarea-disable");
popsDOMUtils.removeClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
isDisabled() {
return (
this.$ele.textarea.hasAttribute("disabled") ||
popsDOMUtils.containsClassName(this.$ele.panelTextarea, "pops-panel-textarea-disable")
);
},
setValue(value) {
this.$ele.textarea.value = value;
},
setChangeEvent() {
popsDOMUtils.on(this.$ele.textarea, ["input", "propertychange"], (event) => {
const value = this.$ele.textarea.value;
this.$data.value = value;
if (typeof formConfig.callback === "function") {
formConfig.callback(event, value);
}
});
},
};
PopsPanelTextArea.init();
Reflect.set($li, "data-textarea", PopsPanelTextArea);
return $li;
},
createSectionContainerItem_select(formConfig) {
const that = this;
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-select">
<select></select>
</div>
`
);
const PopsPanelSelect = {
[Symbol.toStringTag]: "PopsPanelSelect",
$ele: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
panelSelect: $li.querySelector(".pops-panel-select"),
select: $li.querySelector(".pops-panel-select select"),
},
$eleKey: {
disable: "__disable__",
value: "__value__",
forms: "__forms__",
},
$data: {
defaultValue: formConfig.getValue(),
},
init() {
popsDOMUtils.addClassName(this.$ele.panelSelect, PopsCommonCSSClassName.userSelectNone);
this.initOption();
this.setChangeEvent();
this.setClickEvent();
const disabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (disabled) {
this.disable();
}
},
setNodeValue($ele, key, value) {
Reflect.set($ele, key, value);
},
getNodeValue($ele, key) {
return Reflect.get($ele, key);
},
disable() {
this.$ele.select.setAttribute("disabled", "true");
popsDOMUtils.addClassName(this.$ele.panelSelect, "pops-panel-select-disable");
popsDOMUtils.addClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
notDisable() {
this.$ele.select.removeAttribute("disabled");
popsDOMUtils.removeClassName(this.$ele.panelSelect, "pops-panel-select-disable");
popsDOMUtils.removeClassName(this.$ele.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
},
isDisabled() {
return (
this.$ele.select.hasAttribute("disabled") ||
popsDOMUtils.containsClassName(this.$ele.panelSelect, "pops-panel-select-disable")
);
},
initOption() {
formConfig.data.forEach((dataItem) => {
const optionElement = document.createElement("option");
this.setNodeValue(optionElement, this.$eleKey.value, dataItem.value);
this.setNodeValue(optionElement, this.$eleKey.disable, dataItem.disable);
this.setNodeValue(optionElement, this.$eleKey.forms, dataItem.forms);
if (dataItem.value === this.$data.defaultValue) {
this.setOptionSelected(optionElement);
}
optionElement.innerText = dataItem.text;
this.$ele.select.appendChild(optionElement);
});
},
setOptionSelected($option) {
$option.setAttribute("selected", "true");
},
setSelectOptionsDisableStatus() {
if (this.$ele.select.options && this.$ele.select.options.length) {
Array.from(this.$ele.select.options).forEach((optionItem) => {
this.setOptionDisableStatus(optionItem);
});
}
},
setOptionDisableStatus(optionElement) {
let disable = false;
const optionDisableAttr = this.getNodeValue(optionElement, this.$eleKey.disable);
if (optionDisableAttr === "function") {
const value = this.getNodeValue(optionElement, this.$eleKey.value);
disable = Boolean(optionDisableAttr(value));
}
if (disable) {
optionElement.setAttribute("disabled", "true");
} else {
optionElement.removeAttribute("disabled");
}
},
getSelectOptionInfo($option) {
const optionValue = this.getNodeValue($option, this.$eleKey.value);
const optionText = $option.innerText || $option.textContent;
const optionForms = this.getNodeValue($option, this.$eleKey.forms);
return {
value: optionValue,
text: optionText,
forms: optionForms,
$option,
};
},
setChangeEvent() {
popsDOMUtils.on(this.$ele.select, "change", void 0, (event) => {
const $isSelectedElement = this.$ele.select[this.$ele.select.selectedIndex];
const selectInfo = this.getSelectOptionInfo($isSelectedElement);
this.setSelectOptionsDisableStatus();
if (typeof formConfig.callback === "function") {
formConfig.callback(event, selectInfo.value, selectInfo.text);
}
const forms = typeof selectInfo.forms === "function" ? selectInfo.forms() : selectInfo.forms;
if (Array.isArray(forms)) {
const childUListClassName = "pops-panel-select-child-forms";
while ($li.nextElementSibling) {
if ($li.nextElementSibling.classList.contains(childUListClassName)) {
$li.nextElementSibling.remove();
} else {
break;
}
}
const $childUList = document.createElement("ul");
$childUList.className = childUListClassName;
popsDOMUtils.after($li, $childUList);
that.uListContainerAddItem(formConfig, {
ulElement: $childUList,
});
}
});
},
setClickEvent() {
popsDOMUtils.on(this.$ele.select, "click", void 0, (event) => {
this.setSelectOptionsDisableStatus();
if (typeof formConfig.clickCallBack === "function") {
formConfig.clickCallBack(event, this.$ele.select);
}
});
},
};
PopsPanelSelect.init();
Reflect.set($li, "data-select", PopsPanelSelect);
return $li;
},
createSectionContainerItem_select_multiple_new(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-select-multiple">
<div class="el-select__wrapper">
<div class="el-select__selection">
<!-- 这个是用于手动输入的,这里暂不适配 -->
<div class="el-select__selected-item el-select__input-wrapper">
</div>
<!-- 这个是placeholder -->
<div class="el-select__selected-item el-select__placeholder">
</div>
</div>
<!-- 下拉箭头 -->
<div class="el-select__suffix">
<i class="el-icon el-select__caret el-select__icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>
</svg>
</i>
</div>
</div>
</div>
`
);
const PopsPanelSelectMultiple = {
[Symbol.toStringTag]: "PopsPanelSelectMultiple",
$el: {
itemLeftTextContainer: $li.querySelector(".pops-panel-item-left-text"),
$container: void 0,
$wrapper: void 0,
$section: void 0,
$selectedInputWrapper: void 0,
$selectedPlaceHolderWrapper: void 0,
$suffix: void 0,
$suffixIcon: void 0,
$selectContainer: void 0,
},
$data: {
defaultValue: formConfig.getValue(),
selectInfo: [],
},
init() {
this.initDefault();
this.inintEl();
this.initPlaceHolder();
this.initTagElement();
this.setSelectContainerClickEvent();
const disabled = typeof formConfig.disabled === "function" ? formConfig.disabled() : formConfig.disabled;
if (disabled) {
this.disable();
}
},
initDefault() {
formConfig.data.forEach((dataItem) => {
if (this.$data.defaultValue.includes(dataItem.value)) {
this.$data.selectInfo.push({
text: dataItem.text,
value: dataItem.value,
isHTML: Boolean(dataItem.isHTML),
disable: dataItem.disable?.bind(dataItem),
});
}
});
},
inintEl() {
this.$el.$container = $li.querySelector(".pops-panel-select-multiple");
this.$el.$wrapper = $li.querySelector(".el-select__wrapper");
this.$el.$section = $li.querySelector(".el-select__selection");
this.$el.$selectedInputWrapper = $li.querySelector(".el-select__selected-item.el-select__input-wrapper");
this.$el.$selectedPlaceHolderWrapper = $li.querySelector(
".el-select__selected-item.el-select__placeholder"
);
this.$el.$suffix = $li.querySelector(".el-select__suffix");
this.$el.$suffixIcon = $li.querySelector(".el-select__suffix .el-icon");
this.hideInputWrapper();
},
initPlaceHolder() {
let placeholder = "";
if (typeof formConfig.placeholder === "string") {
placeholder = formConfig.placeholder;
} else if (typeof formConfig.placeholder === "function") {
const placeholderResult = formConfig.placeholder();
if (typeof placeholderResult === "string") {
placeholder = placeholderResult;
}
}
const $placeholder = popsDOMUtils.createElement("span", {
innerText: placeholder,
});
this.$el.$selectedPlaceHolderWrapper.appendChild($placeholder);
},
initTagElement() {
formConfig.data.forEach((dataItem) => {
const findValue = this.$data.selectInfo.find((item) => item.value === dataItem.value);
if (findValue) {
const selectedInfo = this.createSelectedTagItem(dataItem);
this.addSelectedTagItem(selectedInfo.$tag);
this.setSelectedItemCloseIconClickEvent({
$tag: selectedInfo.$tag,
$closeIcon: selectedInfo.$closeIcon,
value: dataItem.value,
text: dataItem.text,
});
}
});
this.checkTagEmpty();
},
createSelectedTagItem(data) {
const $selectedItem = popsDOMUtils.createElement("div", {
className: "el-select__selected-item el-select__choose_tag",
innerHTML: `
<span class="el-tag is-closable el-tag--info el-tag--default el-tag--light">
<span class="el-tag__content">
<span class="el-select__tags-text"></span>
</span>
<!-- 关闭tag的图标 -->
<i class="el-icon el-tag__close">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
<path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path>
</svg>
</i>
</span>
`,
});
const $tagText = $selectedItem.querySelector(".el-select__tags-text");
const $closeIcon = $selectedItem.querySelector(".el-icon.el-tag__close");
const text = typeof data.text === "function" ? data.text(data, this.$data.selectInfo) : data.text;
if (data.isHTML) {
PopsSafeUtils.setSafeHTML($tagText, text);
} else {
$tagText.innerText = text;
}
return {
$tag: $selectedItem,
$tagText,
$closeIcon,
};
},
addSelectedTagItem($tag) {
this.setSectionIsNear();
if (this.$el.$section.contains(this.$el.$selectedInputWrapper)) {
const $prev = this.$el.$selectedInputWrapper.previousElementSibling;
if ($prev) {
popsDOMUtils.after($prev, $tag);
} else {
popsDOMUtils.before(this.$el.$selectedInputWrapper, $tag);
}
} else if (this.$el.$section.contains(this.$el.$selectedPlaceHolderWrapper)) {
const $prev = this.$el.$selectedPlaceHolderWrapper.previousElementSibling;
if ($prev) {
popsDOMUtils.after($prev, $tag);
} else {
popsDOMUtils.before(this.$el.$selectedPlaceHolderWrapper, $tag);
}
} else {
this.$el.$section.appendChild($tag);
}
this.hideInputWrapper();
this.hidePlaceHolderWrapper();
},
updateSelectTagItem() {
this.$el.$section.querySelectorAll(".el-select__choose_tag").forEach(($ele) => {
$ele.remove();
});
this.initTagElement();
},
selectValueChangeCallBack(selectedDataList) {
this.updateSelectItem();
if (typeof formConfig.callback === "function") {
formConfig.callback(selectedDataList || this.$data.selectInfo);
}
},
updateSelectItem() {
this.getAllSelectItemInfo(false).forEach(($selectInfo) => {
const { data, $select } = $selectInfo;
this.setSelectItemText(data, $selectInfo.$select);
if (typeof data.disable === "function" && data.disable(data.value, this.$data.selectInfo)) {
this.setSelectItemDisabled($select);
this.removeSelectedInfo(data, false);
this.removeSelectItemSelected($select);
} else {
this.removeSelectItemDisabled($select);
}
const findValue = this.$data.selectInfo.find((it) => it.value === data.value);
if (findValue) {
this.setSelectItemSelected($select);
} else {
this.removeSelectItemSelected($select);
}
});
},
setSelectItemSelected($select) {
if (this.isSelectItemSelected($select)) return;
$select.classList.add("select-item-is-selected");
},
removeSelectItemSelected($select) {
$select.classList.remove("select-item-is-selected");
},
isSelectItemSelected($select) {
return $select.classList.contains("select-item-is-selected");
},
addSelectedItemInfo(dataList, $select) {
const info = this.getSelectedItemInfo($select);
const findValue = dataList.find((item) => item.value === info.value);
if (!findValue) {
dataList.push({
value: info.value,
text: info.text,
isHTML: Boolean(info.isHTML),
disable: info.disable?.bind(info),
});
}
this.selectValueChangeCallBack(dataList);
},
getSelectedItemInfo($select) {
return Reflect.get($select, "data-info");
},
removeSelectedItemInfo(dataList, $select) {
const info = this.getSelectedItemInfo($select);
const findIndex = dataList.findIndex((item) => item.value === info.value);
if (findIndex !== -1) {
dataList.splice(findIndex, 1);
}
this.selectValueChangeCallBack(dataList);
},
getAllSelectItemInfo(onlySelected = true) {
return Array.from(this.$el.$selectContainer?.querySelectorAll(".select-item") ?? [])
.map(($select) => {
const data = this.getSelectedItemInfo($select);
const result = {
data,
$select,
};
if (onlySelected) {
const isSelected = this.isSelectItemSelected($select);
if (isSelected) {
return result;
}
return;
} else {
return result;
}
})
.filter((item) => {
return item != null;
});
},
createSelectItemElement(data) {
const $select = popsDOMUtils.createElement("li", {
className: "select-item",
innerHTML: `
<span class="select-item-text"></span>
`,
});
this.setSelectItemText(data, $select);
Reflect.set($select, "data-info", data);
return $select;
},
setSelectItemText(data, $select) {
const text = typeof data.text === "function" ? data.text(data.value, this.$data.selectInfo) : data.text;
const $selectSpan = $select.querySelector(".select-item-text");
if (data.isHTML) {
PopsSafeUtils.setSafeHTML($selectSpan, text);
} else {
$selectSpan.innerText = text;
}
},
setSelectItemDisabled($select) {
$select.setAttribute("aria-disabled", "true");
$select.setAttribute("disabled", "true");
},
removeSelectItemDisabled($select) {
$select.removeAttribute("aria-disabled");
$select.removeAttribute("disabled");
},
isSelectItemDisabled($select) {
return $select.hasAttribute("disabled") || $select.ariaDisabled;
},
setSelectElementClickEvent(dataList, $select) {
popsDOMUtils.on($select, "click", (event) => {
popsDOMUtils.preventEvent(event);
if (this.isSelectItemDisabled($select)) {
return;
}
if (typeof formConfig.clickCallBack === "function") {
const allSelectedInfo = this.getAllSelectItemInfo().map((it) => it.data);
const clickResult = formConfig.clickCallBack(event, allSelectedInfo);
if (typeof clickResult === "boolean" && !clickResult) {
return;
}
}
if (this.isSelectItemSelected($select)) {
this.removeSelectItemSelected($select);
this.removeSelectedItemInfo(dataList, $select);
} else {
this.setSelectItemSelected($select);
this.addSelectedItemInfo(dataList, $select);
}
});
},
setSelectContainerClickEvent() {
const that = this;
popsDOMUtils.on(this.$el.$container, "click", () => {
if (this.isDisabled()) {
return;
}
const selectedInfo = that.$data.selectInfo;
const { style, ...userConfirmDetails } = formConfig.selectConfirmDialogDetails || {};
const confirmDetails = popsUtils.assign(
{
title: {
text: "请勾选需要选择的选项",
position: "center",
},
content: {
text: `
<ul class="select-container"></ul>
`,
html: true,
},
btn: {
ok: {
enable: false,
},
close: {
enable: true,
callback(details) {
that.$data.selectInfo = [...selectedInfo];
that.updateSelectTagItem();
that.$el.$selectContainer = null;
details.close();
},
},
},
mask: {
enable: true,
clickCallBack(originalRun) {
originalRun();
that.$data.selectInfo = [...selectedInfo];
that.updateSelectTagItem();
that.$el.$selectContainer = null;
},
clickEvent: {
toClose: true,
},
},
drag: true,
dragLimit: true,
width: "300px",
height: "300px",
style: `
.select-container{
--el-font-size-base: 14px;
--el-text-color-regular: #606266;
--el-color-primary: #409eff;
--el-fill-color-light: #f5f7fa;
--el-disable-color: #a8abb2;
}
.select-item{
cursor: pointer;
font-size: var(--el-font-size-base);
padding: 0 32px 0 20px;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--el-text-color-regular);
height: 34px;
line-height: 34px;
box-sizing: border-box;
}
.select-item[aria-disabled],
.select-item[disabled]{
cursor: not-allowed;
color: var(--el-disable-color);
background: unset;
}
.select-item:hover{
background-color: var(--el-fill-color-light);
}
.select-item.select-item-is-selected{
color: var(--el-color-primary);
font-weight: 700;
}
.select-item.select-item-is-selected::after{
content: "";
position: absolute;
top: 50%;
right: 20px;
border-top: none;
border-right: none;
background-repeat: no-repeat;
background-position: center;
background-color: var(--el-color-primary);
mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;
mask-size: 100% 100%;
-webkit-mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;
-webkit-mask-size: 100% 100%;
transform: translateY(-50%);
width: 12px;
height: 12px;
}
@media (prefers-color-scheme: dark) {
.select-container{
--el-text-color-regular: #f2f2f2;
--el-disable-color: #8D9095;
--el-fill-color-light: #262727;
}
}
${style || ""}
`,
},
userConfirmDetails
);
const $dialog = PopsAlert.init(confirmDetails);
const $selectContainer = $dialog.$shadowRoot.querySelector(".select-container");
this.$el.$selectContainer = $selectContainer;
formConfig.data.forEach((item) => {
const $select = this.createSelectItemElement(item);
$selectContainer.appendChild($select);
this.setSelectElementClickEvent(selectedInfo, $select);
});
this.updateSelectItem();
});
},
setSelectedItemCloseIconClickEvent(data) {
popsDOMUtils.on(
data.$closeIcon,
"click",
(event) => {
popsDOMUtils.preventEvent(event);
if (this.isDisabled()) {
return;
}
if (typeof formConfig.closeIconClickCallBack === "function") {
const result = formConfig.closeIconClickCallBack(event, {
$tag: data.$tag,
$closeIcon: data.$closeIcon,
value: data.value,
text: typeof data.text === "function" ? data.text.bind(data) : data.text,
});
if (typeof result === "boolean" && !result) {
return;
}
}
this.removeSelectedTagItem(data.$tag);
this.removeSelectedInfo({
value: data.value,
text: data.text,
});
},
{
capture: true,
}
);
},
checkTagEmpty() {
if (!this.$el.$section.querySelectorAll(".el-select__choose_tag").length) {
this.showPlaceHolderWrapper();
this.removeSectionIsNear();
}
},
removeSelectedTagItem($tag) {
$tag.remove();
this.checkTagEmpty();
},
removeSelectedInfo(data, triggerValueChangeCallBack = true) {
for (let index = 0; index < this.$data.selectInfo.length; index++) {
const selectInfo = this.$data.selectInfo[index];
if (selectInfo.value === data.value) {
this.$data.selectInfo.splice(index, 1);
break;
}
}
triggerValueChangeCallBack && this.selectValueChangeCallBack();
},
showInputWrapper() {
popsDOMUtils.cssShow(this.$el.$selectedInputWrapper);
},
hideInputWrapper() {
popsDOMUtils.cssHide(this.$el.$selectedInputWrapper, true);
},
showPlaceHolderWrapper() {
popsDOMUtils.cssShow(this.$el.$selectedPlaceHolderWrapper);
},
hidePlaceHolderWrapper() {
popsDOMUtils.cssHide(this.$el.$selectedPlaceHolderWrapper, true);
},
setSectionIsNear() {
this.$el.$section.classList.add("is-near");
},
removeSectionIsNear() {
this.$el.$section.classList.remove("is-near");
},
disable() {
popsDOMUtils.addClassName(this.$el.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
popsDOMUtils.addClassName(this.$el.$container, "pops-panel-select-multiple-disable");
},
isDisabled() {
return popsDOMUtils.containsClassName(this.$el.$container, "pops-panel-select-multiple-disable");
},
cancleDisable() {
popsDOMUtils.removeClassName(this.$el.itemLeftTextContainer, PopsCommonCSSClassName.textIsDisabled);
popsDOMUtils.removeClassName(this.$el.$container, "pops-panel-select-multiple-disable");
},
};
PopsPanelSelectMultiple.init();
Reflect.set($li, "data-select-multiple", PopsPanelSelectMultiple);
return $li;
},
createSectionContainerItem_button(formConfig) {
const $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-button">
<button class="pops-panel-button_inner" type="button">
<i class="pops-bottom-icon"></i>
<span class="pops-panel-button-text"></span>
</button>
</div>
`
);
const PopsPanelButton = {
[Symbol.toStringTag]: "PopsPanelButton",
$ele: {
panelButton: $li.querySelector(".pops-panel-button"),
button: $li.querySelector(".pops-panel-button .pops-panel-button_inner"),
icon: $li.querySelector(".pops-panel-button .pops-bottom-icon"),
spanText: $li.querySelector(".pops-panel-button .pops-panel-button-text"),
},
$data: {},
init() {
this.$ele.panelButton.appendChild(this.$ele.button);
this.initButton();
this.setClickEvent();
},
initButton() {
if (typeof formConfig.buttonIcon === "string" && formConfig.buttonIcon.trim() !== "") {
if (PopsIcon.hasIcon(formConfig.buttonIcon)) {
this.setIconSVG(PopsIcon.getIcon(formConfig.buttonIcon));
} else {
this.setIconSVG(formConfig.buttonIcon);
}
this.showIcon();
} else {
this.hideIcon();
}
let buttonText = formConfig.buttonText;
if (typeof formConfig.buttonText === "function") {
buttonText = formConfig.buttonText();
}
this.setButtonType(formConfig.buttonType);
if (formConfig.buttonIsRightIcon) {
this.setIconRight();
} else {
this.setIconLeft();
}
if (formConfig.disable) {
this.disable();
}
this.setButtonText(buttonText);
this.setIconLoadingStatus(formConfig.buttonIconIsLoading);
},
disable() {
this.$ele.button.setAttribute("disabled", "true");
},
notDisable() {
this.$ele.button.removeAttribute("disabled");
},
hideIcon() {
this.$ele.panelButton.classList.add("pops-panel-button-no-icon");
},
showIcon() {
this.$ele.panelButton.classList.remove("pops-panel-button-no-icon");
},
setIconSVG(svgHTML) {
PopsSafeUtils.setSafeHTML(this.$ele.icon, svgHTML);
},
setIconLoadingStatus(status) {
this.$ele.icon.setAttribute("is-loading", Boolean(status).toString());
},
setHasIcon(value) {
this.$ele.button.setAttribute("data-icon", Boolean(value).toString());
},
setButtonType(typeValue) {
this.$ele.button.setAttribute("data-type", typeValue);
},
setIconRight() {
this.$ele.button.classList.add("pops-panel-button-right-icon");
},
setIconLeft() {
this.$ele.button.classList.remove("pops-panel-button-right-icon");
},
setButtonText(text) {
PopsSafeUtils.setSafeHTML(this.$ele.spanText, text);
},
setClickEvent() {
popsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
if (typeof formConfig.callback === "function") {
formConfig.callback(event);
}
});
},
};
PopsPanelButton.init();
Reflect.set($li, "data-button", PopsPanelButton);
return $li;
},
createSectionContainerItem_deepMenu(formConfig) {
const that = this;
const $li = document.createElement("li");
popsDOMUtils.addClassName($li, "pops-panel-deepMenu-nav-item");
Reflect.set($li, "__formConfig__", formConfig);
this.setElementClassName($li, formConfig.className);
this.setElementAttributes($li, formConfig.attributes);
this.setElementProps($li, formConfig.props);
let leftDescriptionText = "";
if (formConfig.description) {
leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
}
const arrowRightIcon = typeof formConfig.arrowRightIcon === "boolean" ? formConfig.arrowRightIcon : true;
let arrowRightIconHTML = "";
if (arrowRightIcon) {
arrowRightIconHTML = `<i class="pops-panel-deepMenu-arrowRight-icon">${PopsIcon.getIcon("arrowRight")}</i>`;
}
let rightText = "";
if (formConfig.rightText) {
rightText = `<p class="pops-panel-item-right-text">${formConfig.rightText}</p>`;
}
PopsSafeUtils.setSafeHTML(
$li,
`
<div class="pops-panel-item-left-text">
<p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
<div class="pops-panel-deepMenu">${rightText}${arrowRightIconHTML}</div>
`
);
const PopsPanelDeepMenu = {
[Symbol.toStringTag]: "PopsPanelDeepMenu",
$ele: {
get parentSection() {
return that.$el.$contentSectionContainer;
},
},
init() {
this.setLiClickEvent();
},
initFormItem($container, formItemConfig) {
const formConfig_forms = formItemConfig;
if (formConfig_forms.type === "forms") {
const childForms = formConfig_forms["forms"];
const formContainerListElement = document.createElement("li");
const formContainerULElement = document.createElement("ul");
formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
formContainerListElement.classList.add("pops-panel-forms-container-item");
const formHeaderDivElement = popsDOMUtils.createElement("div", {
className: "pops-panel-forms-container-item-header-text",
});
PopsSafeUtils.setSafeHTML(formHeaderDivElement, formConfig_forms["text"]);
if (formConfig_forms.isFold) {
PopsSafeUtils.setSafeHTML(
formHeaderDivElement,
`
<p>${formConfig_forms.text}</p>
<i class="pops-panel-forms-fold-container-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
<path d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
</svg>
</i>
`
);
popsDOMUtils.on(formHeaderDivElement, "click", () => {
if (formContainerListElement.hasAttribute("data-fold-enable")) {
formContainerListElement.removeAttribute("data-fold-enable");
} else {
formContainerListElement.setAttribute("data-fold-enable", "");
}
});
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
formContainerListElement.setAttribute("data-fold-enable", "");
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
formContainerListElement.appendChild(formHeaderDivElement);
} else {
formContainerListElement.appendChild(formHeaderDivElement);
}
that.setElementClassName(formContainerListElement, formItemConfig.className);
that.setElementAttributes(formContainerListElement, formItemConfig.attributes);
that.setElementProps(formContainerListElement, formItemConfig.props);
childForms.forEach((childFormConfig) => {
that.uListContainerAddItem(childFormConfig, {
ulElement: formContainerULElement,
sectionContainerULElement: that.sectionContainerULElement,
formContainerListElement,
formHeaderDivElement,
});
});
formContainerListElement.appendChild(formContainerULElement);
$container.appendChild(formContainerListElement);
if (typeof formConfig_forms.afterAddToUListCallBack === "function") {
formConfig_forms.afterAddToUListCallBack(formConfig, {
target: formContainerListElement,
ulElement: formContainerULElement,
sectionContainerULElement: that.sectionContainerULElement,
formContainerListElement,
formHeaderDivElement,
});
}
} else {
that.uListContainerAddItem(formConfig, {
ulElement: that.sectionContainerULElement,
});
}
},
async gotoDeepMenu(event, liElement) {
const $currentSection = liElement.closest("section.pops-panel-container");
const $deepMenuSection = popsDOMUtils.createElement("section", {
className: "pops-panel-container pops-panel-deepMenu-container",
});
Reflect.set($deepMenuSection, "__formConfig__", formConfig);
const $deepMenuHeaderUL = popsDOMUtils.createElement("ul", {
className: "pops-panel-container-header-ul pops-panel-deepMenu-container-header-ul",
});
const $deepMenuMain = popsDOMUtils.createElement("ul", {
className: "pops-panel-container-main-ul",
});
const headerTitleText = formConfig.headerTitle ?? formConfig.text;
const $header = popsDOMUtils.createElement("li", {
className: "pops-panel-container-header-title-text pops-panel-deepMenu-container-header",
innerHTML: `<p class="pops-panel-deepMenu-container-header-title-text">${headerTitleText}</p>`,
});
const $headerLeftArrow = popsDOMUtils.createElement("i", {
className: "pops-panel-deepMenu-container-left-arrow-icon",
innerHTML: PopsIcon.getIcon("arrowLeft"),
});
const animOptions = {
duration: 220,
easing: "ease-in-out",
};
const enterViewTransition = () => {
popsDOMUtils.cssHide($currentSection, true);
popsDOMUtils.on(
$headerLeftArrow,
"click",
async (event2) => {
popsDOMUtils.preventEvent(event2);
const leaveViewTransition = () => {
const $prev = $currentSection;
popsDOMUtils.cssShow($prev);
$deepMenuSection.remove();
};
if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
const leaveTransition = document.startViewTransition(leaveViewTransition);
await leaveTransition.ready;
await Promise.all([
$deepMenuSection.animate(
[
{
transform: "translateX(0)",
},
{
transform: "translateX(100%)",
},
],
animOptions
).finished,
$currentSection.animate(
[
{
transform: "translateX(-100%)",
},
{
transform: "translateX(0)",
},
],
animOptions
).finished,
]);
await leaveTransition.finished;
} else {
leaveViewTransition();
}
that.triggerRenderRightContainer($currentSection);
},
{
once: true,
}
);
popsDOMUtils.before($header.firstElementChild, $headerLeftArrow);
$deepMenuHeaderUL.appendChild($header);
$deepMenuSection.appendChild($deepMenuHeaderUL);
$deepMenuSection.appendChild($deepMenuMain);
if (formConfig.forms && Array.isArray(formConfig.forms)) {
for (let index = 0; index < formConfig.forms.length; index++) {
const formItemConfig = formConfig.forms[index];
this.initFormItem($deepMenuMain, formItemConfig);
}
}
that.$el.$sectionWrapper.appendChild($deepMenuSection);
};
if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
const transition = document.startViewTransition(enterViewTransition);
await transition.ready;
await $deepMenuSection.animate(
[
{
transform: "translateX(100%)",
},
{
transform: "translateX(0)",
},
],
animOptions
).finished;
await transition.finished;
} else {
enterViewTransition();
}
if (typeof formConfig.afterEnterDeepMenuCallBack === "function") {
formConfig.afterEnterDeepMenuCallBack(formConfig, {
sectionContainer: $deepMenuSection,
sectionContainerHeaderContainer: $deepMenuHeaderUL,
sectionContainerHeader: $header,
sectionBodyContainer: $deepMenuMain,
});
}
that.triggerRenderRightContainer($deepMenuSection);
},
setLiClickEvent() {
popsDOMUtils.on($li, "click", void 0, async (event) => {
if (typeof formConfig.clickCallBack === "function") {
const result = await formConfig.clickCallBack(event, formConfig);
if (result) {
return;
}
}
await this.gotoDeepMenu(event, $li);
});
},
};
PopsPanelDeepMenu.init();
Reflect.set($li, "data-deepMenu", PopsPanelDeepMenu);
return $li;
},
createSectionContainerItem_own(formConfig) {
let $li = document.createElement("li");
Reflect.set($li, "__formConfig__", formConfig);
if (formConfig.className) {
$li.className = formConfig.className;
}
$li = formConfig.getLiElementCallBack($li);
return $li;
},
createSectionContainerItem(formConfig) {
const formType = formConfig.type;
if (formType === "switch") {
return this.createSectionContainerItem_switch(formConfig);
} else if (formType === "slider") {
return this.createSectionContainerItem_slider_new(formConfig);
} else if (formType === "input") {
return this.createSectionContainerItem_input(formConfig);
} else if (formType === "textarea") {
return this.createSectionContainerItem_textarea(formConfig);
} else if (formType === "select") {
return this.createSectionContainerItem_select(formConfig);
} else if (formType === "select-multiple") {
return this.createSectionContainerItem_select_multiple_new(formConfig);
} else if (formType === "button") {
return this.createSectionContainerItem_button(formConfig);
} else if (formType === "deepMenu") {
return this.createSectionContainerItem_deepMenu(formConfig);
} else if (formType === "own") {
return this.createSectionContainerItem_own(formConfig);
} else {
console.error("尚未实现的type类型", formConfig);
}
},
createSectionContainerItem_forms(formConfig) {
const that = this;
const formConfig_forms = formConfig;
if (formConfig_forms.type === "forms") {
const childForms = formConfig["forms"];
const formContainerListElement = document.createElement("li");
const formContainerULElement = document.createElement("ul");
formContainerListElement.classList.add("pops-panel-forms-container-item");
formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
const formHeaderDivElement = popsDOMUtils.createElement("div", {
className: "pops-panel-forms-container-item-header-text",
});
PopsSafeUtils.setSafeHTML(formHeaderDivElement, formConfig_forms["text"]);
if (formConfig_forms.isFold) {
PopsSafeUtils.setSafeHTML(
formHeaderDivElement,
`
<p>${formConfig_forms.text}</p>
<i class="pops-panel-forms-fold-container-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
<path d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
</svg>
</i>
`
);
popsDOMUtils.on(formHeaderDivElement, "click", () => {
if (formContainerListElement.hasAttribute("data-fold-enable")) {
formContainerListElement.removeAttribute("data-fold-enable");
} else {
formContainerListElement.setAttribute("data-fold-enable", "");
}
});
popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
formContainerListElement.setAttribute("data-fold-enable", "");
popsDOMUtils.addClassName(formContainerListElement, "pops-panel-forms-fold");
formContainerListElement.appendChild(formHeaderDivElement);
} else {
formContainerListElement.appendChild(formHeaderDivElement);
}
that.setElementClassName(formContainerListElement, formConfig.className);
that.setElementAttributes(formContainerListElement, formConfig.attributes);
that.setElementProps(formContainerListElement, formConfig.props);
childForms.forEach((childFormConfig) => {
that.uListContainerAddItem(childFormConfig, {
ulElement: formContainerULElement,
sectionContainerULElement: that.sectionContainerULElement,
formContainerListElement,
formHeaderDivElement,
});
});
formContainerListElement.appendChild(formContainerULElement);
that.sectionContainerULElement.appendChild(formContainerListElement);
if (typeof formConfig_forms.afterAddToUListCallBack === "function") {
formConfig_forms.afterAddToUListCallBack(formConfig_forms, {
target: formContainerListElement,
ulElement: formContainerULElement,
sectionContainerULElement: that.sectionContainerULElement,
formContainerListElement,
formHeaderDivElement,
});
}
} else {
that.uListContainerAddItem(formConfig, {
ulElement: that.sectionContainerULElement,
});
}
},
triggerRenderRightContainer($container) {
const __formConfig__ = Reflect.get($container, "__formConfig__");
this.$el.$pops.dispatchEvent(
new CustomEvent("pops:renderRightContainer", {
detail: {
formConfig: __formConfig__,
},
})
);
},
uListContainerAddItem(formConfig, containerOptions) {
const itemLiElement = this.createSectionContainerItem(formConfig);
if (itemLiElement) {
containerOptions["ulElement"].appendChild(itemLiElement);
}
if (typeof formConfig.afterAddToUListCallBack === "function") {
formConfig.afterAddToUListCallBack(formConfig, {
...containerOptions,
target: itemLiElement,
});
}
},
setAsideItemClickEvent(asideLiElement, asideConfig) {
popsDOMUtils.on(asideLiElement, "click", async (event) => {
if (typeof asideConfig.clickFirstCallback === "function") {
const clickFirstCallbackResult = await asideConfig.clickFirstCallback(
event,
this.sectionContainerHeaderULElement,
this.sectionContainerULElement
);
if (typeof clickFirstCallbackResult === "boolean" && !clickFirstCallbackResult) {
return;
}
}
this.clearContainer();
const rightContainerFormConfig = Reflect.get(asideLiElement, "__forms__");
Reflect.set(this.$el.$contentSectionContainer, "__formConfig__", rightContainerFormConfig);
popsDOMUtils.cssShow(this.$el.$contentSectionContainer);
this.clearAsideItemIsVisited();
this.setAsideItemIsVisited(asideLiElement);
const title = typeof asideConfig.title === "function" ? asideConfig.title() : asideConfig.title;
let headerTitleText =
typeof asideConfig.headerTitle === "function" ? asideConfig.headerTitle() : asideConfig.headerTitle;
headerTitleText = headerTitleText ?? title;
if (typeof headerTitleText === "string" && headerTitleText.trim() !== "") {
const $containerHeaderTitle = document.createElement("li");
$containerHeaderTitle.classList.add("pops-panel-container-header-title-text");
Reflect.set($containerHeaderTitle, "__asideConfig__", asideConfig);
PopsSafeUtils.setSafeHTML($containerHeaderTitle, headerTitleText);
this.sectionContainerHeaderULElement.appendChild($containerHeaderTitle);
}
rightContainerFormConfig.forEach((formConfig) => {
this.createSectionContainerItem_forms(formConfig);
});
if (typeof asideConfig.clickCallback === "function") {
const asideClickCallbackResult = await asideConfig.clickCallback(
event,
this.sectionContainerHeaderULElement,
this.sectionContainerULElement
);
if (typeof asideClickCallbackResult === "boolean" && !asideClickCallbackResult) {
return;
}
}
this.triggerRenderRightContainer(this.$el.$contentSectionContainer);
});
},
};
};
const PopsPanel = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "panel";
let config = PopsPanelConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
if (details && Array.isArray(details.content)) {
config.content = details.content;
}
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "panelCSS",
css: PopsCSS.panelCSS,
},
]);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? config.title.text : `<p pops class="pops-${popsType}-title-text" class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content">
<aside class="pops-${popsType}-aside">
<ul class="pops-${popsType}-aside-top-container"></ul>
<ul class="pops-${popsType}-aside-bottom-container"></ul>
</aside>
<div class="pops-${popsType}-section-wrapper">
<section class="pops-${popsType}-container">
<ul class="pops-${popsType}-container-header-ul"></ul>
<ul class="pops-${popsType}-container-main-ul"></ul>
</section>
</div>
</div>`,
"",
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
headerCloseBtnElement: $headerCloseBtn,
titleElement: $title,
contentElement: $content,
panelSectionWrapper: $panelSectionWrapper,
contentAsideElement: $contentAside,
contentSectionContainerElement: $contentSectionContainer,
} = PopsHandler.handleQueryElement($anim, popsType);
if (config.isMobile || popsUtils.isPhone()) {
popsDOMUtils.addClassName($pops, config.mobileClassName);
}
let $mask = null;
const isCreatedElementList = [$anim];
if (config.mask.enable) {
const { maskElement } = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = maskElement;
isCreatedElementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
PopsHandler.handleClickEvent("close", $headerCloseBtn, eventDetails, config.btn.close.callback);
popsDOMUtils.append($shadowRoot, isCreatedElementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
const panelHandlerComponents = PanelHandlerComponents();
panelHandlerComponents.init({
config,
$el: {
$pops,
$content,
$sectionWrapper: $panelSectionWrapper,
$contentAside,
$contentSectionContainer,
},
});
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
const result = PopsHandler.handleResultDetails(eventDetails);
return {
...result,
addEventListener: (event, listener, options) => {
$pops.addEventListener(event, listener, options);
},
removeEventListener: (event, listener, options) => {
$pops.removeEventListener(event, listener, options);
},
};
},
};
const PopsPromptConfig = () => {
return {
title: {
text: "默认标题",
position: "left",
html: false,
style: "",
},
content: {
text: "",
select: false,
password: false,
row: false,
focus: true,
placeholder: "默认提示",
style: "",
},
btn: {
merge: false,
mergeReverse: false,
reverse: false,
position: "flex-end",
ok: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "确定",
type: "success",
callback(detail) {
detail.close();
},
},
cancel: {
enable: true,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "关闭",
type: "default",
callback(detail) {
detail.close();
},
},
other: {
enable: false,
size: void 0,
icon: void 0,
rightIcon: false,
iconIsLoading: false,
text: "其它按钮",
type: "default",
callback(detail) {
detail.close();
},
},
close: {
enable: true,
callback(detail) {
detail.close();
},
},
},
useShadowRoot: true,
class: "",
only: false,
width: window.innerWidth < 550 ? "88vw" : "350px",
height: window.innerHeight < 450 ? "70vh" : "200px",
position: "center",
animation: "pops-anim-fadein-zoom",
zIndex: 1e4,
mask: {
enable: false,
clickEvent: {
toClose: false,
toHide: false,
},
clickCallBack: null,
},
drag: false,
dragLimit: true,
dragExtraDistance: 3,
dragMoveCallBack() {},
dragEndCallBack() {},
forbiddenScroll: false,
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsPrompt = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "prompt";
let config = PopsPromptConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "ninePalaceGridPosition",
css: PopsCSS.ninePalaceGridPosition,
},
{
name: "scrollbar",
css: PopsCSS.scrollbar,
},
{
name: "button",
css: PopsCSS.button,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "promptCSS",
css: PopsCSS.promptCSS,
},
]);
const zIndex = PopsHandler.handleZIndex(config.zIndex);
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
const { contentPStyle } = PopsElementHandler.createContentStyle(popsType, config);
const animHTML = PopsElementHandler.createAnim(
guid,
popsType,
config,
`
<div class="pops-title pops-${popsType}-title" style="text-align: ${config.title.position};${headerStyle}">${config.title.html ? config.title.text : `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`}${headerBtnHTML}</div>
<div class="pops-content pops-${popsType}-content" style="${contentPStyle}">${config.content.row ? '<textarea name="pops-input-text" pops="" placeholder="' + config.content.placeholder + '"></textarea>' : '<input name="pops-input-text" pops="" placeholder="' + config.content.placeholder + '" type="' + (config.content.password ? "password" : "text") + '">'}</div>${bottomBtnHTML}`,
bottomBtnHTML,
zIndex
);
const $anim = PopsElementHandler.parseElement(animHTML);
const {
popsElement: $pops,
inputElement: $input,
headerCloseBtnElement: $btnClose,
btnOkElement: $btnOk,
btnCancelElement: $btnCancel,
btnOtherElement: $btnOther,
titleElement: $title,
} = PopsHandler.handleQueryElement($anim, popsType);
let $mask = null;
const elementList = [$anim];
if (config.mask.enable) {
const _handleMask_ = PopsHandler.handleMask({
type: popsType,
guid,
config,
animElement: $anim,
maskHTML,
});
$mask = _handleMask_.maskElement;
elementList.push($mask);
}
const eventDetails = PopsHandler.handleEventDetails(
guid,
$shadowContainer,
$shadowRoot,
popsType,
$anim,
$pops,
$mask,
config
);
$input.value = config.content.text;
PopsHandler.handlePromptClickEvent("close", $input, $btnClose, eventDetails, config.btn.close.callback);
PopsHandler.handlePromptClickEvent("ok", $input, $btnOk, eventDetails, config.btn.ok.callback);
PopsHandler.handlePromptClickEvent("cancel", $input, $btnCancel, eventDetails, config.btn.cancel.callback);
PopsHandler.handlePromptClickEvent("other", $input, $btnOther, eventDetails, config.btn.other.callback);
popsDOMUtils.append($shadowRoot, elementList);
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
if ($mask != null) {
$anim.after($mask);
}
PopsHandler.handlePush(popsType, {
guid,
animElement: $anim,
popsElement: $pops,
maskElement: $mask,
$shadowContainer,
$shadowRoot,
});
if (config.drag) {
PopsInstanceUtils.drag($pops, {
dragElement: $title,
limit: config.dragLimit,
extraDistance: config.dragExtraDistance,
moveCallBack: config.dragMoveCallBack,
endCallBack: config.dragEndCallBack,
});
}
if (config.content.focus) {
$input.focus();
}
if (config.content.select) {
$input.select();
}
const result = PopsHandler.handleResultDetails(eventDetails);
return result;
},
};
const rightClickMenuConfig = () => {
return {
target: document.documentElement,
targetSelector: null,
data: [
{
icon: PopsIcon.getIcon("search"),
iconIsLoading: false,
text: "搜索",
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
},
{
icon: PopsIcon.getIcon("documentCopy"),
iconIsLoading: false,
text: "复制",
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
},
{
icon: PopsIcon.getIcon("delete"),
text: "删除",
iconIsLoading: false,
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
},
{
icon: PopsIcon.getIcon("loading"),
iconIsLoading: true,
text: "加载",
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
return false;
},
},
{
icon: PopsIcon.getIcon("elemePlus"),
iconIsLoading: true,
text: "饿了么",
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
return false;
},
item: [
{
icon: "",
iconIsLoading: false,
text: "处理文件",
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
},
{
icon: "",
iconIsLoading: false,
text: "其它处理",
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
item: [
{
icon: PopsIcon.getIcon("view"),
iconIsLoading: false,
text: "查看",
item: [],
callback(clickEvent, contextMenuEvent, liElement) {
console.log("点击:" + this.text, [clickEvent, contextMenuEvent, liElement]);
},
},
],
},
],
},
],
chileMenuLeftOrRightDistance: 0,
childMenuTopOrBottomDistance: 0,
useShadowRoot: true,
className: "",
isAnimation: false,
useScaleAnimation: true,
only: false,
zIndex: 1e4,
preventDefault: true,
style: null,
beforeAppendToPageCallBack() {},
};
};
const PopsRightClickMenu = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "rightClickMenu";
let config = rightClickMenuConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
config = PopsHandler.handleOnly(popsType, config);
if (config.target == null) {
throw new Error("config.target 不能为空");
}
if (details.data) {
Reflect.set(config, "data", details.data);
}
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
{
name: "rightClickMenu",
css: PopsCSS.rightClickMenu,
},
]);
if (config.style != null) {
const cssNode = popsDOMUtils.createElement(
"style",
{
innerHTML: config.style,
},
{
type: "text/css",
}
);
$shadowRoot.appendChild(cssNode);
}
const PopsContextMenu = {
rootElement: null,
windowCheckClickEvent(event) {
if (!PopsContextMenu.rootElement) {
return;
}
const $click = event.target;
if ($click.closest(`.pops-${popsType}`)) {
return;
}
if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
return;
}
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
},
shadowRootCheckClickEvent(event) {
if (!PopsContextMenu.rootElement) {
return;
}
const $click = event.target;
if ($click.closest(`.pops-${popsType}`)) {
return;
}
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
},
addWindowCheckClickListener() {
popsDOMUtils.on(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
capture: true,
});
if (config.target instanceof Node) {
const $shadowRoot2 = config.target.getRootNode();
if ($shadowRoot2 instanceof ShadowRoot) {
popsDOMUtils.on($shadowRoot2, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
capture: true,
});
}
}
},
removeWindowCheckClickListener() {
popsDOMUtils.off(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
capture: true,
});
if (config.target instanceof Node) {
const $shadowRoot2 = config.target.getRootNode();
if ($shadowRoot2 instanceof ShadowRoot) {
popsDOMUtils.off($shadowRoot2, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
capture: true,
});
}
}
},
contextMenuEvent(event, selectorTarget) {
if (config.preventDefault) {
popsDOMUtils.preventEvent(event);
}
PopsHandler.handleOnly(popsType, config);
if (PopsContextMenu.rootElement) {
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
}
const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
PopsContextMenu.rootElement = rootElement;
if (config.only) {
PopsHandler.handlePush(popsType, {
$shadowRoot,
$shadowContainer,
guid,
animElement: rootElement,
popsElement: rootElement,
beforeRemoveCallBack(instCommonConfig) {
PopsContextMenu.closeAllMenu(instCommonConfig.popsElement);
},
});
}
},
addContextMenuEvent(target, selector) {
popsDOMUtils.on(target, "contextmenu", selector, PopsContextMenu.contextMenuEvent);
},
removeContextMenuEvent(target, selector) {
popsDOMUtils.off(target, "contextmenu", selector, PopsContextMenu.contextMenuEvent);
},
animationCloseMenu($menu) {
const transitionEndEvent = (event) => {
popsDOMUtils.off($menu, popsDOMUtils.getTransitionEndNameList(), transitionEndEvent, {
capture: true,
});
$menu.remove();
};
popsDOMUtils.containsClassName;
if (popsDOMUtils.containsClassName($menu, `pops-${popsType}-anim-show`)) {
popsDOMUtils.on($menu, popsDOMUtils.getTransitionEndNameList(), transitionEndEvent, {
capture: true,
});
popsDOMUtils.removeClassName($menu, `pops-${popsType}-anim-show`);
} else if (
popsDOMUtils.containsClassName($menu, `pops-${popsType}-anim-scale`) &&
popsDOMUtils.containsClassName($menu, `pops-${popsType}-anim-scale-open`)
) {
popsDOMUtils.on($menu, popsDOMUtils.getTransitionEndNameList(), transitionEndEvent, {
capture: true,
});
popsDOMUtils.removeClassName($menu, `pops-${popsType}-anim-scale-open`);
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-scale-not-open`);
} else {
$menu.remove();
}
},
closeAllMenu(rootElement) {
if (rootElement == null) {
return;
}
const rootElementMenuData = Reflect.get(rootElement, "__menuData__");
if (rootElementMenuData?.root) {
rootElement = rootElementMenuData.root;
}
const childMenuList = rootElementMenuData.child;
childMenuList.forEach((childMenuElement) => {
this.animationCloseMenu(childMenuElement);
});
this.animationCloseMenu(rootElement);
PopsContextMenu.rootElement = null;
},
createMenuContainerElement(isChildren) {
const $menu = popsDOMUtils.createElement("div", {
className: `pops-${popsType}`,
innerHTML: `<ul class="pops-${popsType}-wrapper"></ul>`,
});
const zIndex = this.getMenuZIndex();
if (zIndex > 1e4) {
$menu.style.zIndex = zIndex.toString();
}
if (isChildren) {
$menu.setAttribute("is-children", "true");
}
if (config.isAnimation) {
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-grid`);
}
if (config.useScaleAnimation) {
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-scale`);
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-scale-not-open`);
}
return $menu;
},
getMenuZIndex() {
return PopsHandler.handleZIndex(config.zIndex);
},
getOffset(menuElement, mousePosition, parentInfo) {
const result = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};
const menuElementWidth = popsDOMUtils.width(menuElement);
const menuElementHeight = popsDOMUtils.height(menuElement);
const limitDistance = 1;
const maxPageLeftOffset = popsDOMUtils.width(globalThis) - limitDistance;
const maxPageTopOffset = popsDOMUtils.height(globalThis) - limitDistance;
const maxLeftOffset = maxPageLeftOffset - menuElementWidth;
const maxTopOffset = maxPageTopOffset - menuElementHeight;
const chileMenuLeftOrRightDistance = config.chileMenuLeftOrRightDistance;
const childMenuTopOrBottomDistance = config.childMenuTopOrBottomDistance;
let currentLeftOffset = mousePosition.x;
let currentTopOffset = mousePosition.y;
currentLeftOffset = currentLeftOffset < 0 ? 0 : currentLeftOffset;
if (currentLeftOffset + chileMenuLeftOrRightDistance >= maxLeftOffset) {
if (parentInfo) {
const mainMenuOffset = popsDOMUtils.offset(parentInfo.$menu);
currentLeftOffset =
maxPageLeftOffset - mainMenuOffset.left - chileMenuLeftOrRightDistance + limitDistance;
} else {
currentLeftOffset = limitDistance + chileMenuLeftOrRightDistance;
}
if (currentLeftOffset < 0) {
currentLeftOffset = 0;
} else if (currentLeftOffset > maxLeftOffset) {
currentLeftOffset = maxLeftOffset;
}
result.right = currentLeftOffset;
Reflect.deleteProperty(result, "left");
} else {
currentLeftOffset = currentLeftOffset + chileMenuLeftOrRightDistance;
result.left = currentLeftOffset;
Reflect.deleteProperty(result, "right");
}
currentTopOffset = currentTopOffset < 0 ? 0 : currentTopOffset;
if (currentTopOffset + childMenuTopOrBottomDistance >= maxTopOffset) {
if (parentInfo) {
const parentItemOffset = popsDOMUtils.offset(parentInfo.$parentItem, false);
currentTopOffset =
maxPageTopOffset - parentItemOffset.bottom - childMenuTopOrBottomDistance + limitDistance;
} else {
currentTopOffset = limitDistance + childMenuTopOrBottomDistance;
}
if (currentTopOffset < 0) {
currentTopOffset = limitDistance;
} else if (currentTopOffset > maxTopOffset) {
currentTopOffset = maxTopOffset;
}
result.bottom = currentTopOffset;
Reflect.deleteProperty(result, "top");
} else {
currentTopOffset = currentTopOffset + childMenuTopOrBottomDistance;
result.top = currentTopOffset;
Reflect.deleteProperty(result, "bottom");
}
return result;
},
showMenu(menuEvent, _config_, menuListenerRootNode) {
const menuElement = this.createMenuContainerElement(false);
Reflect.set(menuElement, "__menuData__", {
child: [],
});
PopsContextMenu.addMenuLiELement(menuEvent, menuElement, menuElement, _config_, menuListenerRootNode);
popsDOMUtils.append($shadowRoot, menuElement);
if (!document.contains($shadowContainer)) {
if (typeof config.beforeAppendToPageCallBack === "function") {
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
}
popsDOMUtils.appendBody($shadowContainer);
}
this.handlerShowMenuCSS(menuElement, menuEvent);
return menuElement;
},
showClildMenu(menuEvent, posInfo, _config_, rootElement, targetLiElement, menuListenerRootNode) {
const menuElement = this.createMenuContainerElement(true);
Reflect.set(menuElement, "__menuData__", {
parent: targetLiElement,
root: rootElement,
});
const rootElementMenuData = Reflect.get(rootElement, "__menuData__");
rootElementMenuData.child.push(menuElement);
PopsContextMenu.addMenuLiELement(menuEvent, rootElement, menuElement, _config_, menuListenerRootNode);
popsDOMUtils.append($shadowRoot, menuElement);
const $parentMenu = targetLiElement.closest(".pops-rightClickMenu");
this.handlerShowMenuCSS(menuElement, posInfo, {
$menu: $parentMenu,
$parentItem: targetLiElement,
});
return menuElement;
},
handlerShowMenuCSS($menu, posInfo, parentInfo) {
const offset = this.getOffset(
$menu,
{
x: posInfo.clientX,
y: posInfo.clientY,
},
parentInfo
);
popsDOMUtils.css($menu, {
...offset,
});
if (config.isAnimation) {
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-show`);
}
if (config.useScaleAnimation) {
popsDOMUtils.removeClassName($menu, `pops-${popsType}-anim-scale-not-open`);
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-scale-open`);
}
},
addMenuLiELement(menuEvent, rootElement, menuElement, _config_, menuListenerRootNode) {
const menuEventTarget = menuEvent.target;
const menuULElement = menuElement.querySelector("ul");
_config_.forEach((item) => {
const menuLiElement = popsDOMUtils.parseTextToDOM(`<li></li>`);
if (typeof item.icon === "string" && item.icon.trim() !== "") {
const iconSVGHTML = PopsIcon.getIcon(item.icon) ?? item.icon;
const iconElement = popsDOMUtils.parseTextToDOM(
`<i class="pops-${popsType}-icon" is-loading="${item.iconIsLoading ?? false}">${iconSVGHTML}</i>`
);
menuLiElement.appendChild(iconElement);
}
menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${item.text}</span>`));
if (item.item && Array.isArray(item.item)) {
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
}
let isTriggerTouchEvent = false;
function liElementHoverEvent(event) {
if (event.type === "touchstart") {
isTriggerTouchEvent = true;
}
if (isTriggerTouchEvent && event.type === "mouseenter") {
return;
}
Array.from(menuULElement.children).forEach((liElement) => {
popsDOMUtils.removeClassName(liElement, `pops-${popsType}-is-visited`);
const li_menuData = Reflect.get(liElement, "__menuData__");
if (!li_menuData) {
return;
}
function removeElement(element) {
element.querySelectorAll("ul li").forEach(($ele) => {
const menuData = Reflect.get($ele, "__menuData__");
if (menuData?.child) {
removeElement(menuData.child);
}
});
element.remove();
}
removeElement(li_menuData.child);
});
const root_menuData = Reflect.get(rootElement, "__menuData__");
for (let index = 0; index < root_menuData.child.length; index++) {
const element = root_menuData.child[index];
if (!$shadowRoot.contains(element)) {
root_menuData.child.splice(index, 1);
index--;
}
}
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-is-visited`);
if (!item.item) {
return;
}
const rect = menuLiElement.getBoundingClientRect();
const childMenu = PopsContextMenu.showClildMenu(
menuEvent,
{
clientX: rect.left + popsDOMUtils.outerWidth(menuLiElement),
clientY: rect.top,
},
item.item,
rootElement,
menuLiElement,
menuListenerRootNode
);
Reflect.set(menuLiElement, "__menuData__", {
child: childMenu,
});
}
async function liElementClickEvent(clickEvent) {
if (typeof item.callback === "function") {
try {
OriginPrototype.Object.defineProperty(menuEvent, "target", {
get() {
return menuEventTarget;
},
});
} catch {}
const callbackResult = await item.callback(clickEvent, menuEvent, menuLiElement, menuListenerRootNode);
if (typeof callbackResult === "boolean" && callbackResult == false) {
return;
}
}
Array.from(menuULElement.children).forEach((liEle) => {
popsDOMUtils.off(liEle, "mouseenter touchstart");
});
PopsContextMenu.closeAllMenu(rootElement);
}
popsDOMUtils.on(menuLiElement, "mouseenter touchstart", liElementHoverEvent);
popsDOMUtils.on(menuLiElement, "click", liElementClickEvent);
menuULElement.appendChild(menuLiElement);
});
},
};
PopsContextMenu.addContextMenuEvent(config.target, config.targetSelector);
PopsContextMenu.addWindowCheckClickListener();
return {
guid,
config,
removeWindowCheckClickListener: PopsContextMenu.removeWindowCheckClickListener,
addWindowCheckClickListener: PopsContextMenu.addWindowCheckClickListener,
removeContextMenuEvent: PopsContextMenu.removeContextMenuEvent,
addContextMenuEvent: PopsContextMenu.addContextMenuEvent,
};
},
};
const searchSuggestionConfig = () => {
const data = [];
for (let index = 0; index < 10; index++) {
data.push({
value: `测试${index}`,
enableDeleteButton: true,
deleteButtonClickCallback(event, $dataItem, dataItem, config) {
console.log("删除当前项", [event, $dataItem, dataItem, config]);
return true;
},
itemView(dateItem) {
return `${dateItem.value}-html`;
},
clickCallback(event, $dataItem, dataItem, config) {
console.log("item项的点击回调", [event, $dataItem, data, config]);
return index % 2 === 0 ? true : false;
},
selectCallback(event, $dataItem, dataItem, config) {
console.log("item项的选中回调", [event, $dataItem, data, config]);
},
});
}
return {
target: null,
inputTarget: null,
selfDocument: document,
data,
useShadowRoot: true,
className: "",
isAbsolute: true,
isAnimation: false,
useFoldAnimation: true,
useArrow: false,
width: "250px",
maxHeight: "300px",
followTargetWidth: true,
topDistance: 0,
position: "auto",
positionTopToReverse: true,
zIndex: 1e4,
searchingTip: "正在搜索中...",
toSearhNotResultHTML: '<li data-none="true">暂无其它数据</li>',
toHideWithNotResult: false,
followPosition: "target",
async inputTargetChangeRefreshShowDataCallback(value, data2) {
console.log("当前输入框的值是:", value);
return data2.filter((it) => it.value.includes(value));
},
style: "",
};
};
const PopsSearchSuggestion = {
init(details) {
const guid = popsUtils.getRandomGUID();
const popsType = "searchSuggestion";
let config = searchSuggestionConfig();
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
config = popsUtils.assign(config, details);
if (config.target == null) {
throw new Error("config.target 不能为空");
}
if (config.inputTarget == null) {
config.inputTarget = config.target;
}
if (details.data) {
config.data = details.data;
}
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
PopsHandler.handleInit($shadowRoot, [
{
name: "index",
css: PopsCSS.index,
},
{
name: "anim",
css: PopsCSS.anim,
},
{
name: "common",
css: PopsCSS.common,
},
]);
if (config.style != null) {
const cssNode = document.createElement("style");
popsDOMUtils.createElement(
"style",
{
innerHTML: config.style,
},
{
type: "text/css",
}
);
$shadowRoot.appendChild(cssNode);
}
const SearchSuggestion = {
selfDocument: config.selfDocument,
$el: {
root: null,
$hintULContainer: null,
$dynamicCSS: null,
},
$evt: {
offInputChangeEvtHandler: [],
},
$data: {
isEmpty: true,
},
init(parentElement = document.body || document.documentElement) {
SearchSuggestion.initEl();
SearchSuggestion.update(SearchSuggestion.getData());
SearchSuggestion.updateStyleSheet();
SearchSuggestion.hide();
$shadowRoot.appendChild(SearchSuggestion.$el.root);
parentElement.appendChild($shadowContainer);
},
initEl() {
SearchSuggestion.$el.root = SearchSuggestion.createSearchSelectElement();
Reflect.set(SearchSuggestion.$el.root, "data-SearchSuggestion", SearchSuggestion);
SearchSuggestion.$el.$dynamicCSS = SearchSuggestion.$el.root.querySelector("style[data-dynamic]");
SearchSuggestion.$el.$hintULContainer = SearchSuggestion.$el.root.querySelector("ul");
},
getData() {
return typeof config.data === "function" ? config.data() : config.data;
},
setData(data) {
config.data = data;
},
createSearchSelectElement() {
const $el = popsDOMUtils.createElement(
"div",
{
className: `pops pops-${popsType}-search-suggestion`,
innerHTML: `
<style type="text/css">
.pops-${popsType}-animation{
-moz-animation: searchSelectFalIn 0.5s 1 linear;
-webkit-animation: searchSelectFalIn 0.5s 1 linear;
-o-animation: searchSelectFalIn 0.5s 1 linear;
-ms-animation: searchSelectFalIn 0.5s 1 linear;
}
</style>
<style type="text/css">
.pops-${popsType}-search-suggestion-arrow{
--suggestion-arrow-box-shadow-left-color: rgba(0, 0, 0, 0.24);
--suggestion-arrow-box-shadow-right-color: rgba(0, 0, 0, 0.12);
--suggestion-arrow--after-color: rgb(78, 78, 78);
--suggestion-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
--suggestion-arrow--after-width: 10px;
--suggestion-arrow--after-height: 10px;
}
.pops-${popsType}-search-suggestion-arrow{
position: absolute;
top: 100%;
left: 50%;
overflow: hidden;
width: 100%;
height: 12.5px;
transform: translateX(-50%);
}
.pops-${popsType}-search-suggestion-arrow::after{
position: absolute;
top: 0;
left: 50%;
width: var(--suggestion-arrow--after-width);
height: var(--suggestion-arrow--after-height);
background: var(--suggestion-arrow--after-bg-color);
color: var(--suggestion-arrow--after-color);
box-shadow:
0 1px 7px var(--suggestion-arrow-box-shadow-left-color),
0 1px 7px var(--suggestion-arrow-box-shadow-right-color);
content: "";
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.pops-${popsType}-search-suggestion[data-popper-placement^="top"] .pops-${popsType}-search-suggestion-arrow{
position: absolute;
top: 100%;
left: 50%;
overflow: hidden;
width: 100%;
height: 12.5px;
transform: translateX(-50%);
}
.pops-${popsType}-search-suggestion[data-popper-placement^="top"] .pops-${popsType}-search-suggestion-arrow::after{
position: absolute;
top: 0;
left: 50%;
width: var(--suggestion-arrow--after-width);
height: var(--suggestion-arrow--after-height);
background: var(--suggestion-arrow--after-bg-color);
box-shadow:
0 1px 7px var(--suggestion-arrow-box-shadow-left-color),
0 1px 7px var(--suggestion-arrow-box-shadow-right-color);
content: "";
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.pops-${popsType}-search-suggestion[data-popper-placement^="bottom"] .pops-${popsType}-search-suggestion-arrow{
top: -12.5px;
left: 50%;
transform: translateX(-50%);
}
.pops-${popsType}-search-suggestion[data-popper-placement^="bottom"] .pops-${popsType}-search-suggestion-arrow::after{
position: absolute;
top: 100%;
left: 50%;
content: "";
}
</style>
<style type="text/css" data-dynamic="true">
${SearchSuggestion.getDynamicCSS()}
</style>
<style>
.el-zoom-in-top-animation{
--el-transition-md-fade: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1),
opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1);
transition: var(--el-transition-md-fade);
transform-origin: center top;
}
.el-zoom-in-top-animation[data-popper-placement^="top"] {
transform-origin: center bottom;
}
.el-zoom-in-top-animation-hide{
opacity: 0;
transform: scaleY(0);
}
.el-zoom-in-top-animation-show{
opacity: 1;
transform: scaleY(1);
}
</style>
<style type="text/css" data-user-css>
${config.style || ""}
</style>
<ul class="pops-${popsType}-search-suggestion-hint ${PopsCommonCSSClassName.userSelectNone}">${config.toSearhNotResultHTML}</ul>
${config.useArrow ? `<div class="pops-${popsType}-search-suggestion-arrow"></div>` : ""}
`,
},
{
"data-guid": guid,
"type-value": popsType,
}
);
if (config.className !== "" && config.className != null) {
popsDOMUtils.addClassName($el, config.className);
}
if (config.isAnimation) {
popsDOMUtils.addClassName($el, `pops-${popsType}-animation`);
}
if (config.useFoldAnimation) {
popsDOMUtils.addClassName($el, "el-zoom-in-top-animation");
}
return $el;
},
getDynamicCSS() {
return `
.pops-${popsType}-search-suggestion{
--search-suggestion-bg-color: #ffffff;
--search-suggestion-box-shadow-color: rgb(0 0 0 / 20%);
--search-suggestion-item-color: #515a6e;
--search-suggestion-item-none-color: #8e8e8e;
--search-suggestion-item-is-hover-bg-color: #f5f7fa;
--search-suggestion-item-is-select-bg-color: #409eff;
}
.pops-${popsType}-search-suggestion{
border: initial;
overflow: initial;
position: ${config.isAbsolute ? "absolute" : "fixed"};
z-index: ${PopsHandler.handleZIndex(config.zIndex)};
}
ul.pops-${popsType}-search-suggestion-hint{
max-height: ${config.maxHeight};
overflow-x: hidden;
overflow-y: auto;
padding: 5px 0;
background-color: var(--search-suggestion-bg-color);
box-sizing: border-box;
border-radius: 4px;
box-shadow: 0 1px 6px var(--search-suggestion-box-shadow-color);
}
/* 建议框在上面时 */
.pops-${popsType}-search-suggestion[data-top-reverse] ul.pops-${popsType}-search-suggestion-hint{
display: flex;
flex-direction: column-reverse;
}
.pops-${popsType}-search-suggestion[data-top-reverse] ul.pops-${popsType}-search-suggestion-hint li{
flex-shrink: 0;
}
ul.pops-${popsType}-search-suggestion-hint li{
padding: 7px;
margin: 0;
clear: both;
color: var(--search-suggestion-item-color);
font-size: 14px;
list-style: none;
cursor: pointer;
transition: background .2s ease-in-out;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
}
ul.pops-${popsType}-search-suggestion-hint li[data-none]{
text-align: center;
font-size: 12px;
color: var(--search-suggestion-item-none-color);
}
ul.pops-${popsType}-search-suggestion-hint li:not([data-none]):hover{
background-color: var(--search-suggestion-item-is-hover-bg-color);
}
@media (prefers-color-scheme: dark){
.pops-${popsType}-search-suggestion{
--search-suggestion-bg-color: #1d1e1f;
--search-suggestion-item-color: #cfd3d4;
--search-suggestion-item-is-hover-bg-color: rgba(175, 175, 175, .1);
}
}
`;
},
getItemDataValue(data) {
return data;
},
createSearchItemLiElement(dataItem, dateItemIndex) {
const dataValue = SearchSuggestion.getItemDataValue(dataItem);
const $li = popsDOMUtils.createElement("li", {
className: `pops-${popsType}-search-suggestion-hint-item`,
"data-index": dateItemIndex,
"data-value": dataValue,
});
Reflect.set($li, "data-index", dateItemIndex);
Reflect.set($li, "data-value", dataValue);
const $itemInner = dataItem.itemView(dataItem, $li, config);
if (typeof $itemInner === "string") {
PopsSafeUtils.setSafeHTML($li, $itemInner);
} else {
popsDOMUtils.append($li, $itemInner);
}
const enableDeleteButton = dataItem.enableDeleteButton;
if (typeof enableDeleteButton === "boolean" && enableDeleteButton) {
const $deleteIcon = SearchSuggestion.createItemDeleteIcon();
popsDOMUtils.append($li, $deleteIcon);
}
popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexCenter);
popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexYCenter);
return $li;
},
setSearchItemClickEvent($searchItem) {
popsDOMUtils.on(
$searchItem,
"click",
async (event) => {
popsDOMUtils.preventEvent(event);
const $click = event.target;
const data = SearchSuggestion.getData();
const dataItem = Reflect.get($searchItem, "data-value");
const isDelete = Boolean($click.closest(`.pops-${popsType}-delete-icon`));
if (isDelete) {
if (typeof dataItem.deleteButtonClickCallback === "function") {
const result = await dataItem.deleteButtonClickCallback(event, $searchItem, dataItem, config);
if (typeof result === "boolean" && result) {
data.splice(data.indexOf(dataItem), 1);
$searchItem.remove();
}
}
if (!SearchSuggestion.$el.$hintULContainer.children.length) {
SearchSuggestion.clear();
}
SearchSuggestion.updateStyleSheet();
} else {
if (typeof dataItem.clickCallback === "function") {
const result = await dataItem.clickCallback(event, $searchItem, dataItem, config);
if (typeof result === "boolean" && result) {
if (
config.inputTarget instanceof HTMLInputElement ||
config.inputTarget instanceof HTMLTextAreaElement
) {
config.inputTarget.value = String(dataItem.value);
}
}
}
}
},
{
capture: true,
}
);
},
setSearchItemSelectEvent(liElement) {},
setInputChangeEvent(
option = {
capture: true,
}
) {
if (!(config.inputTarget instanceof HTMLInputElement || config.inputTarget instanceof HTMLTextAreaElement)) {
return;
}
config.inputTarget.setAttribute("autocomplete", "off");
const listenerHandler = popsDOMUtils.onInput(
config.inputTarget,
async (_event) => {
const data = SearchSuggestion.getData();
const queryDataResult = await config.inputTargetChangeRefreshShowDataCallback(
config.inputTarget.value,
data,
config
);
SearchSuggestion.update(queryDataResult);
SearchSuggestion.updateStyleSheet();
},
option
);
SearchSuggestion.$evt.offInputChangeEvtHandler.push(listenerHandler.off);
},
removeInputChangeEvent(
option = {
capture: true,
}
) {
for (let index = 0; index < SearchSuggestion.$evt.offInputChangeEvtHandler.length; index++) {
const handler = SearchSuggestion.$evt.offInputChangeEvtHandler[index];
handler();
SearchSuggestion.$evt.offInputChangeEvtHandler.splice(index, 1);
index--;
}
},
showEvent() {
SearchSuggestion.updateStyleSheet();
if (config.toHideWithNotResult) {
if (SearchSuggestion.$data.isEmpty) {
SearchSuggestion.hide(true);
} else {
SearchSuggestion.show();
}
} else {
SearchSuggestion.show();
}
},
setShowEvent(
option = {
capture: true,
}
) {
if (config.followPosition === "target") {
popsDOMUtils.on([config.target], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
} else if (config.followPosition === "input") {
popsDOMUtils.on([config.inputTarget], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
} else if (config.followPosition === "inputCursor") {
popsDOMUtils.on(
[config.inputTarget],
["focus", "click", "input"],
void 0,
SearchSuggestion.showEvent,
option
);
} else {
throw new Error("未知followPosition:" + config.followPosition);
}
},
removeShowEvent(
option = {
capture: true,
}
) {
popsDOMUtils.off(
[config.target, config.inputTarget],
["focus", "click"],
void 0,
SearchSuggestion.showEvent,
option
);
popsDOMUtils.off([config.inputTarget], ["input"], void 0, SearchSuggestion.showEvent, option);
},
hideEvent(event) {
if (event.target instanceof Node) {
if ($shadowContainer.contains(event.target)) {
return;
}
if (config.target.contains(event.target)) {
return;
}
if (config.inputTarget.contains(event.target)) {
return;
}
SearchSuggestion.hide(true);
}
},
setHideEvent(
option = {
capture: true,
}
) {
if (Array.isArray(SearchSuggestion.selfDocument)) {
SearchSuggestion.selfDocument.forEach(($checkParent) => {
popsDOMUtils.on($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
});
} else {
popsDOMUtils.on(
SearchSuggestion.selfDocument,
["click", "touchstart"],
void 0,
SearchSuggestion.hideEvent,
option
);
}
},
removeHideEvent(
option = {
capture: true,
}
) {
if (Array.isArray(SearchSuggestion.selfDocument)) {
SearchSuggestion.selfDocument.forEach(($checkParent) => {
popsDOMUtils.off($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
});
} else {
popsDOMUtils.off(
SearchSuggestion.selfDocument,
["click", "touchstart"],
void 0,
SearchSuggestion.hideEvent,
option
);
}
},
setAllEvent(
option = {
capture: true,
}
) {
SearchSuggestion.setInputChangeEvent(option);
SearchSuggestion.setHideEvent(option);
SearchSuggestion.setShowEvent(option);
},
removeAllEvent(
option = {
capture: true,
}
) {
SearchSuggestion.removeInputChangeEvent(option);
SearchSuggestion.removeHideEvent(option);
SearchSuggestion.removeShowEvent(option);
},
createItemDeleteIcon(size = 16, fill = "#bababa") {
const $svg = popsDOMUtils.parseTextToDOM(
`
<svg class="pops-${popsType}-delete-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="${fill}">
<path d="M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z"></path>
<path d="M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z"></path>
</svg>
`
);
return $svg;
},
setPromptsInSearch() {
const $isSearching = popsDOMUtils.createElement("li", {
className: `pops-${popsType}-search-suggestion-hint-searching-item`,
innerHTML: config.searchingTip,
});
SearchSuggestion.addItem($isSearching);
},
removePromptsInSearch() {
SearchSuggestion.$el.$hintULContainer
.querySelector(`li.pops-${popsType}-search-suggestion-hint-searching-item`)
?.remove();
},
changeHintULElementPosition(target = config.target ?? config.inputTarget, checkPositonAgain = true) {
let targetRect = null;
if (config.followPosition === "inputCursor") {
targetRect = popsDOMUtils.getTextBoundingRect(
config.inputTarget,
config.inputTarget.selectionStart || 0,
config.inputTarget.selectionEnd || 0,
false
);
} else {
targetRect = config.isAbsolute ? popsDOMUtils.offset(target) : target.getBoundingClientRect();
}
if (targetRect == null) {
return;
}
let documentHeight = document.documentElement.clientHeight;
if (config.isAbsolute) {
documentHeight = popsDOMUtils.height(document);
}
const documentWidth = popsDOMUtils.width(document);
let position = config.position;
if (config.position === "auto") {
const targetBottom = targetRect.bottom;
const searchSuggestionContainerHeight = popsDOMUtils.height(SearchSuggestion.$el.$hintULContainer);
if (targetBottom + searchSuggestionContainerHeight > documentHeight) {
position = "top";
} else {
position = "bottom";
}
}
if (position === "top") {
if (config.positionTopToReverse) {
SearchSuggestion.$el.root.setAttribute("data-top-reverse", "true");
}
if (config.useFoldAnimation) {
SearchSuggestion.$el.root.setAttribute("data-popper-placement", "top");
}
const bottom = documentHeight - targetRect.top + config.topDistance;
SearchSuggestion.$el.root.style.top = "";
SearchSuggestion.$el.root.style.bottom = bottom + "px";
} else if (position === "bottom") {
if (config.useFoldAnimation) {
SearchSuggestion.$el.root.setAttribute("data-popper-placement", "bottom-center");
}
const top2 = targetRect.height + targetRect.top + config.topDistance;
SearchSuggestion.$el.root.removeAttribute("data-top-reverse");
SearchSuggestion.$el.root.style.bottom = "";
SearchSuggestion.$el.root.style.top = top2 + "px";
}
let left = targetRect.left;
const hintUIWidth = popsDOMUtils.width(SearchSuggestion.$el.$hintULContainer);
if (hintUIWidth > documentWidth) {
left = left + documentWidth - hintUIWidth;
}
SearchSuggestion.$el.root.style.left = left + "px";
if (checkPositonAgain) {
SearchSuggestion.changeHintULElementPosition(target, !checkPositonAgain);
}
},
changeHintULElementWidth(target = config.target ?? config.inputTarget) {
const targetRect = target.getBoundingClientRect();
if (config.followTargetWidth) {
SearchSuggestion.$el.$hintULContainer.style.width = targetRect.width + "px";
} else {
SearchSuggestion.$el.$hintULContainer.style.width = config.width;
}
},
updateDynamicCSS() {
const cssText = SearchSuggestion.getDynamicCSS();
PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$dynamicCSS, cssText);
},
updateStyleSheet() {
SearchSuggestion.updateDynamicCSS();
SearchSuggestion.changeHintULElementWidth();
SearchSuggestion.changeHintULElementPosition();
},
addItem($item) {
SearchSuggestion.$el.$hintULContainer.appendChild($item);
},
update(updateData = []) {
if (!Array.isArray(updateData)) {
throw new TypeError("传入的数据不是数组");
}
const data = updateData;
if (data.length) {
SearchSuggestion.$data.isEmpty = false;
if (config.toHideWithNotResult) {
SearchSuggestion.show();
}
SearchSuggestion.clear(true);
const fragment = document.createDocumentFragment();
data.forEach((item, index) => {
const $item = SearchSuggestion.createSearchItemLiElement(item, index);
SearchSuggestion.setSearchItemClickEvent($item);
SearchSuggestion.setSearchItemSelectEvent($item);
fragment.appendChild($item);
});
SearchSuggestion.addItem(fragment);
} else {
SearchSuggestion.clear();
}
},
clear(onlyClearView = false) {
PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$hintULContainer, "");
if (onlyClearView) {
return;
}
SearchSuggestion.$data.isEmpty = true;
let $noResult;
if (typeof config.toSearhNotResultHTML === "string") {
$noResult = popsDOMUtils.parseTextToDOM(config.toSearhNotResultHTML);
} else {
$noResult = config.toSearhNotResultHTML();
}
SearchSuggestion.addItem($noResult);
if (config.toHideWithNotResult) {
SearchSuggestion.hide();
}
},
hide(useAnimationToHide = false) {
if (config.useFoldAnimation) {
if (!useAnimationToHide) {
popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
}
popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-hide");
popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-show");
} else {
SearchSuggestion.$el.root.style.display = "none";
}
},
show() {
SearchSuggestion.$el.root.style.display = "";
if (config.useFoldAnimation) {
popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-hide");
popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-show");
}
},
};
return SearchSuggestion;
},
};
const version = "2.5.0";
class Pops {
config = {
version,
cssText: PopsCSS,
iconSVG: PopsIcon.$data,
animation: PopsAnimation.$data,
instData: PopsInstData,
forbiddenScroll: {
event(event) {
return popsDOMUtils.preventEvent(event);
},
},
Utils: popsUtils,
DOMUtils: popsDOMUtils,
InstanceUtils: PopsInstanceUtils,
MathFloatUtils: PopsMathFloatUtils,
PanelHandlerComponents,
};
init() {}
noConflict() {
if (typeof PopsCore.globalThis.pops === "object") {
popsUtils.delete(PopsCore.globalThis, "pops");
}
if (typeof unsafeWindow === "object" && unsafeWindow != null && typeof unsafeWindow.pops === "object") {
popsUtils.delete(unsafeWindow, "pops");
}
return new Pops();
}
isPhone(userAgent) {
return popsUtils.isPhone(userAgent);
}
GlobalConfig = GlobalConfig;
alert = (details) => {
const dialog = PopsAlert.init(details);
return dialog;
};
confirm = (details) => {
const dialog = PopsConfirm.init(details);
return dialog;
};
prompt = (details) => {
const dialog = PopsPrompt.init(details);
return dialog;
};
loading = (details) => {
const popsLoading = PopsLoading.init(details);
return popsLoading;
};
iframe = (details) => {
const dialog = PopsIframe.init(details);
return dialog;
};
tooltip = (details) => {
const popsTooltip = PopsTooltip.init(details);
return popsTooltip;
};
drawer = (details) => {
const dialog = PopsDrawer.init(details);
return dialog;
};
folder = (details) => {
const dialog = PopsFolder.init(details);
return dialog;
};
panel = (details) => {
const dialog = PopsPanel.init(details);
return dialog;
};
rightClickMenu = (details) => {
const popsRightClickMenu = PopsRightClickMenu.init(details);
return popsRightClickMenu;
};
searchSuggestion = (details) => {
const popsSearchSuggestion = PopsSearchSuggestion.init(details);
return popsSearchSuggestion;
};
}
const pops = new Pops();
const CommonUtil2 = {
waitRemove(...args) {
args.forEach((selector) => {
if (typeof selector !== "string") {
return;
}
domUtils$2.waitNodeList(selector).then((nodeList) => {
nodeList.forEach(($el) => $el.remove());
});
});
},
createBlockCSSNode(...args) {
let selectorList = [];
if (args.length === 0) {
return;
}
if (args.length === 1 && typeof args[0] === "string" && args[0].trim() === "") {
return;
}
args.forEach((selector) => {
if (Array.isArray(selector)) {
selectorList = selectorList.concat(selector);
} else {
selectorList.push(selector);
}
});
return domUtils$2.createElement("style", {
type: "text/css",
innerHTML: `${selectorList.join(",\n")}{display: none !important;}`,
});
},
addBlockCSS(...args) {
let selectorList = [];
if (args.length === 0) {
return;
}
if (args.length === 1 && typeof args[0] === "string" && args[0].trim() === "") {
return;
}
args.forEach((selector) => {
if (Array.isArray(selector)) {
selectorList = selectorList.concat(selector);
} else {
selectorList.push(selector);
}
});
return addStyle(`${selectorList.join(",\n")}{display: none !important;}`);
},
setGMResourceCSS(resourceMapData) {
let cssText = typeof _GM_getResourceText === "function" ? _GM_getResourceText(resourceMapData.keyName) : null;
if (typeof cssText === "string" && cssText) {
addStyle(cssText);
} else {
CommonUtil2.loadStyleLink(resourceMapData.url);
}
},
async loadStyleLink(url) {
let $link = document.createElement("link");
$link.rel = "stylesheet";
$link.type = "text/css";
$link.href = url;
domUtils$2.ready(() => {
document.head.appendChild($link);
});
},
async loadScript(url) {
let $script = document.createElement("script");
$script.src = url;
return new Promise((resolve) => {
$script.onload = () => {
resolve(null);
};
(document.head || document.documentElement).appendChild($script);
});
},
fixUrl(url) {
url = url.trim();
if (url.startsWith("data:")) {
return url;
}
if (url.match(/^http(s|):\/\//i)) {
return url;
} else if (url.startsWith("//")) {
if (url.startsWith("///"));
else {
url = window.location.protocol + url;
}
return url;
} else {
if (!url.startsWith("/")) {
url += "/";
}
url = window.location.origin + url;
return url;
}
},
fixHttps(url) {
if (url.startsWith("https://")) {
return url;
}
if (!url.startsWith("http://")) {
return url;
}
try {
let urlInstance = new URL(url);
urlInstance.protocol = "https:";
return urlInstance.toString();
} catch {
return url;
}
},
lockScroll(...args) {
let $hidden = document.createElement("style");
$hidden.innerHTML = `
.pops-overflow-hidden-important {
overflow: hidden !important;
}
`;
let $elList = [document.documentElement, document.body].concat(...(args || []));
$elList.forEach(($el) => {
$el.classList.add("pops-overflow-hidden-important");
});
(document.head || document.documentElement).appendChild($hidden);
return {
recovery() {
$elList.forEach(($el) => {
$el.classList.remove("pops-overflow-hidden-important");
});
$hidden.remove();
},
};
},
async getClipboardText() {
function readClipboardText(resolve) {
navigator.clipboard
.readText()
.then((clipboardText) => {
resolve(clipboardText);
})
.catch((error) => {
log.error("读取剪贴板内容失败👉", error);
resolve("");
});
}
function requestPermissionsWithClipboard(resolve) {
navigator.permissions
.query({
name: "clipboard-read",
})
.then((permissionStatus) => {
readClipboardText(resolve);
})
.catch((error) => {
log.error("申请剪贴板权限失败,尝试直接读取👉", error.message ?? error.name ?? error.stack);
readClipboardText(resolve);
});
}
function checkClipboardApi() {
if (typeof navigator?.clipboard?.readText !== "function") {
return false;
}
if (typeof navigator?.permissions?.query !== "function") {
return false;
}
return true;
}
return new Promise((resolve) => {
if (!checkClipboardApi()) {
resolve("");
return;
}
if (document.hasFocus()) {
requestPermissionsWithClipboard(resolve);
} else {
window.addEventListener(
"focus",
() => {
requestPermissionsWithClipboard(resolve);
},
{
once: true,
}
);
}
});
},
escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'")
.replace(/©/g, "©")
.replace(/®/g, "®")
.replace(/™/g, "™")
.replace(/→/g, "→")
.replace(/←/g, "←")
.replace(/↑/g, "↑")
.replace(/↓/g, "↓")
.replace(/—/g, "—")
.replace(/–/g, "–")
.replace(/…/g, "…")
.replace(/ /g, " ")
.replace(/\r\n/g, "<br>")
.replace(/\r/g, "<br>")
.replace(/\n/g, "<br>")
.replace(/\t/g, " ");
},
interval(fn, intervalTime, timeout = 5e3) {
let timeId;
let maxTimeout = timeout - intervalTime;
let intervalTimeCount = intervalTime;
let loop = async (isTimeout) => {
let result = await fn(isTimeout);
if ((typeof result === "boolean" && !result) || isTimeout) {
utils.workerClearTimeout(timeId);
return;
}
intervalTimeCount += intervalTime;
if (intervalTimeCount > maxTimeout) {
loop(true);
return;
}
timeId = utils.workerSetTimeout(() => {
loop(false);
}, intervalTime);
};
loop(false);
},
findParentNode($el, selector, parentSelector) {
if (parentSelector) {
let $parent = domUtils$2.closest($el, parentSelector);
if ($parent) {
let $target = $parent.querySelector(selector);
return $target;
}
} else {
if (domUtils$2.matches($el, selector)) {
return $el;
}
let $parent = domUtils$2.closest($el, selector);
return $parent;
}
},
};
const PanelSettingConfig = {
qmsg_config_position: {
key: "qmsg-config-position",
defaultValue: "bottom",
},
qmsg_config_maxnums: {
key: "qmsg-config-maxnums",
defaultValue: 3,
},
qmsg_config_showreverse: {
key: "qmsg-config-showreverse",
defaultValue: false,
},
};
const utils = utils$1.noConflict();
const domUtils = domUtils$2.noConflict();
const __pops = pops;
const log = new utils.Log(_GM_info, _unsafeWindow.console || _monkeyWindow.console);
let SCRIPT_NAME = _GM_info?.script?.name || void 0;
pops.config.Utils.AnyTouch();
const DEBUG = false;
log.config({
debug: false,
logMaxCount: 250,
autoClearConsole: true,
tag: true,
});
qmsg.config({
isHTML: true,
autoClose: true,
showClose: false,
consoleLogContent(qmsgInst) {
const qmsgType = qmsgInst.getSetting().type;
if (qmsgType === "loading") {
return false;
}
const content = qmsgInst.getSetting().content;
if (qmsgType === "warning") {
log.warn(content);
} else if (qmsgType === "error") {
log.error(content);
} else {
log.info(content);
}
return true;
},
get position() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_position.key,
PanelSettingConfig.qmsg_config_position.defaultValue
);
},
get maxNums() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_maxnums.key,
PanelSettingConfig.qmsg_config_maxnums.defaultValue
);
},
get showReverse() {
return Panel.getValue(
PanelSettingConfig.qmsg_config_showreverse.key,
PanelSettingConfig.qmsg_config_showreverse.defaultValue
);
},
get zIndex() {
let maxZIndex = utils$1.getMaxZIndex();
let popsMaxZIndex = pops.config.InstanceUtils.getPopsMaxZIndex().zIndex;
return utils$1.getMaxValue(maxZIndex, popsMaxZIndex) + 100;
},
});
__pops.GlobalConfig.setGlobalConfig({
zIndex: () => {
let maxZIndex = utils$1.getMaxZIndex(void 0, void 0, ($ele) => {
if ($ele?.classList?.contains("qmsg-shadow-container")) {
return false;
}
if ($ele?.closest("qmsg") && $ele.getRootNode() instanceof ShadowRoot) {
return false;
}
});
let popsMaxZIndex = pops.config.InstanceUtils.getPopsMaxZIndex().zIndex;
return utils$1.getMaxValue(maxZIndex, popsMaxZIndex) + 100;
},
mask: {
enable: true,
clickEvent: {
toClose: false,
toHide: false,
},
},
drag: true,
});
const GM_Menu = new utils.GM_Menu({
GM_getValue: _GM_getValue,
GM_setValue: _GM_setValue,
GM_registerMenuCommand: _GM_registerMenuCommand,
GM_unregisterMenuCommand: _GM_unregisterMenuCommand,
});
const httpx = new utils.Httpx({
xmlHttpRequest: _GM_xmlhttpRequest,
logDetails: DEBUG,
});
httpx.interceptors.request.use((data) => {
return data;
});
httpx.interceptors.response.use(void 0, (data) => {
log.error("拦截器-请求错误", data);
if (data.type === "onabort") {
qmsg.warning("请求取消", { consoleLogContent: true });
} else if (data.type === "onerror") {
qmsg.error("请求异常", { consoleLogContent: true });
} else if (data.type === "ontimeout") {
qmsg.error("请求超时", { consoleLogContent: true });
} else {
qmsg.error("其它错误", { consoleLogContent: true });
}
return data;
});
({
Object: {
defineProperty: _unsafeWindow.Object.defineProperty,
},
Function: {
apply: _unsafeWindow.Function.prototype.apply,
call: _unsafeWindow.Function.prototype.call,
},
Element: {
appendChild: _unsafeWindow.Element.prototype.appendChild,
},
setTimeout: _unsafeWindow.setTimeout,
});
const addStyle = domUtils.addStyle.bind(domUtils);
domUtils$2.selector.bind(domUtils$2);
domUtils$2.selectorAll.bind(domUtils$2);
new utils.GM_Cookie();
const KEY = "GM_Panel";
const ATTRIBUTE_INIT = "data-init";
const ATTRIBUTE_KEY = "data-key";
const ATTRIBUTE_DEFAULT_VALUE = "data-default-value";
const ATTRIBUTE_INIT_MORE_VALUE = "data-init-more-value";
const PanelSizeUtil = {
get width() {
return globalThis.innerWidth;
},
get height() {
return globalThis.innerHeight;
},
};
const PanelUISize = {
setting: {
get width() {
if (PanelSizeUtil.width < 550) {
return "88vw";
} else if (PanelSizeUtil.width < 700) {
return "550px";
} else {
return "700px";
}
},
get height() {
if (PanelSizeUtil.height < 450) {
return "70vh";
} else if (PanelSizeUtil.height < 550) {
return "450px";
} else {
return "550px";
}
},
},
settingMiddle: {
get width() {
return PanelSizeUtil.width < 350 ? "88vw" : "350px";
},
get height() {
return PanelSizeUtil.height < 450 ? "88vh" : "450px";
},
},
settingBig: {
get width() {
return PanelSizeUtil.width < 800 ? "92vw" : "800px";
},
get height() {
return PanelSizeUtil.height < 600 ? "80vh" : "600px";
},
},
info: {
get width() {
return PanelSizeUtil.width < 350 ? "88vw" : "350px";
},
get height() {
return PanelSizeUtil.height < 250 ? "88vh" : "250px";
},
},
};
class StorageUtils {
storageKey;
listenerData;
constructor(key) {
if (typeof key === "string") {
let trimKey = key.trim();
if (trimKey == "") {
throw new Error("key参数不能为空字符串");
}
this.storageKey = trimKey;
} else {
throw new Error("key参数类型错误,必须是字符串");
}
this.listenerData = new utils$1.Dictionary();
}
getLocalValue() {
let localValue = _GM_getValue(this.storageKey);
if (localValue == null) {
localValue = {};
this.setLocalValue(localValue);
}
return localValue;
}
setLocalValue(value) {
_GM_setValue(this.storageKey, value);
}
set(key, value) {
let oldValue = this.get(key);
let localValue = this.getLocalValue();
Reflect.set(localValue, key, value);
this.setLocalValue(localValue);
this.triggerValueChangeListener(key, oldValue, value);
}
get(key, defaultValue) {
let localValue = this.getLocalValue();
return Reflect.get(localValue, key) ?? defaultValue;
}
getAll() {
let localValue = this.getLocalValue();
return localValue;
}
delete(key) {
let oldValue = this.get(key);
let localValue = this.getLocalValue();
Reflect.deleteProperty(localValue, key);
this.setLocalValue(localValue);
this.triggerValueChangeListener(key, oldValue, void 0);
}
has(key) {
let localValue = this.getLocalValue();
return Reflect.has(localValue, key);
}
keys() {
let localValue = this.getLocalValue();
return Reflect.ownKeys(localValue);
}
values() {
let localValue = this.getLocalValue();
return Reflect.ownKeys(localValue).map((key) => Reflect.get(localValue, key));
}
clear() {
_GM_deleteValue(this.storageKey);
}
addValueChangeListener(key, callback) {
let listenerId = Math.random();
let listenerData = this.listenerData.get(key) || [];
listenerData.push({
id: listenerId,
key,
callback,
});
this.listenerData.set(key, listenerData);
return listenerId;
}
removeValueChangeListener(listenerId) {
let flag = false;
for (const [key, listenerData] of this.listenerData.entries()) {
for (let index = 0; index < listenerData.length; index++) {
const value = listenerData[index];
if (
(typeof listenerId === "string" && value.key === listenerId) ||
(typeof listenerId === "number" && value.id === listenerId)
) {
listenerData.splice(index, 1);
index--;
flag = true;
}
}
this.listenerData.set(key, listenerData);
}
return flag;
}
triggerValueChangeListener(key, oldValue, newValue) {
if (!this.listenerData.has(key)) {
return;
}
let listenerData = this.listenerData.get(key);
for (let index = 0; index < listenerData.length; index++) {
const data = listenerData[index];
if (typeof data.callback === "function") {
let value = this.get(key);
let __newValue;
let __oldValue;
if (typeof oldValue !== "undefined" && arguments.length >= 2) {
__oldValue = oldValue;
} else {
__oldValue = value;
}
if (typeof newValue !== "undefined" && arguments.length > 2) {
__newValue = newValue;
} else {
__newValue = value;
}
data.callback(key, __oldValue, __newValue);
}
}
}
}
const PopsPanelStorageApi = new StorageUtils(KEY);
const PanelContent = {
$data: {
__contentConfig: null,
get contentConfig() {
if (this.__contentConfig == null) {
this.__contentConfig = new utils.Dictionary();
}
return this.__contentConfig;
},
},
addContentConfig(configList) {
if (!Array.isArray(configList)) {
configList = [configList];
}
let index = this.$data.contentConfig.keys().length;
this.$data.contentConfig.set(index, configList);
},
getAllContentConfig() {
return this.$data.contentConfig.values().flat();
},
getConfig(index = 0) {
return this.$data.contentConfig.get(index) ?? [];
},
getDefaultBottomContentConfig() {
return [
{
id: "script-version",
title: `版本:${_GM_info?.script?.version || "未知"}`,
isBottom: true,
forms: [],
clickFirstCallback(event, rightHeaderElement, rightContainerElement) {
let supportURL = _GM_info?.script?.supportURL || _GM_info?.script?.namespace;
if (typeof supportURL === "string" && utils.isNotNull(supportURL)) {
window.open(supportURL, "_blank");
}
return false;
},
},
];
},
};
const PanelMenu = {
$data: {
__menuOption: [
{
key: "show_pops_panel_setting",
text: "⚙ 设置",
autoReload: false,
isStoreValue: false,
showText(text) {
return text;
},
callback: () => {
Panel.showPanel(PanelContent.getConfig(0));
},
},
],
get menuOption() {
return this.__menuOption;
},
},
init() {
this.initExtensionsMenu();
},
initExtensionsMenu() {
if (!Panel.isTopWindow()) {
return;
}
GM_Menu.add(this.$data.menuOption);
},
addMenuOption(option) {
if (!Array.isArray(option)) {
option = [option];
}
this.$data.menuOption.push(...option);
},
updateMenuOption(option) {
if (!Array.isArray(option)) {
option = [option];
}
option.forEach((optionItem) => {
let findIndex = this.$data.menuOption.findIndex((it) => {
return it.key === optionItem.key;
});
if (findIndex !== -1) {
this.$data.menuOption[findIndex] = optionItem;
}
});
},
getMenuOption(index = 0) {
return this.$data.menuOption[index];
},
deleteMenuOption(index = 0) {
this.$data.menuOption.splice(index, 1);
},
};
const Panel = {
$data: {
__contentConfigInitDefaultValue: null,
__onceExecMenuData: null,
__urlChangeReloadMenuExecOnce: null,
__onceExecData: null,
__panelConfig: {},
$panel: null,
panelContent: [],
get contentConfigInitDefaultValue() {
if (this.__contentConfigInitDefaultValue == null) {
this.__contentConfigInitDefaultValue = new utils.Dictionary();
}
return this.__contentConfigInitDefaultValue;
},
contentConfigInitDisabledKeys: [],
get onceExecMenuData() {
if (this.__onceExecMenuData == null) {
this.__onceExecMenuData = new utils.Dictionary();
}
return this.__onceExecMenuData;
},
get urlChangeReloadMenuExecOnce() {
if (this.__urlChangeReloadMenuExecOnce == null) {
this.__urlChangeReloadMenuExecOnce = new utils.Dictionary();
}
return this.__urlChangeReloadMenuExecOnce;
},
get onceExecData() {
if (this.__onceExecData == null) {
this.__onceExecData = new utils.Dictionary();
}
return this.__onceExecData;
},
get scriptName() {
return SCRIPT_NAME;
},
get panelConfig() {
return this.__panelConfig;
},
set panelConfig(value) {
this.__panelConfig = value;
},
key: KEY,
attributeKeyName: ATTRIBUTE_KEY,
attributeDefaultValueName: ATTRIBUTE_DEFAULT_VALUE,
},
init() {
this.initContentDefaultValue();
PanelMenu.init();
},
isTopWindow() {
return _unsafeWindow.top === _unsafeWindow.self;
},
initContentDefaultValue() {
const initDefaultValue = (config) => {
if (!config.attributes) {
return;
}
if (config.type === "button" || config.type === "forms" || config.type === "deepMenu") {
return;
}
let __attr_init__ = config.attributes[ATTRIBUTE_INIT];
if (typeof __attr_init__ === "function") {
let __attr_result__ = __attr_init__();
if (typeof __attr_result__ === "boolean" && !__attr_result__) {
return;
}
}
let menuDefaultConfig = new Map();
let key = config.attributes[ATTRIBUTE_KEY];
if (key != null) {
const defaultValue = config.attributes[ATTRIBUTE_DEFAULT_VALUE];
menuDefaultConfig.set(key, defaultValue);
}
let moreMenuDefaultConfig = config.attributes[ATTRIBUTE_INIT_MORE_VALUE];
if (typeof moreMenuDefaultConfig === "object" && moreMenuDefaultConfig) {
Object.keys(moreMenuDefaultConfig).forEach((key2) => {
menuDefaultConfig.set(key2, moreMenuDefaultConfig[key2]);
});
}
if (!menuDefaultConfig.size) {
log.warn(["请先配置键", config]);
return;
}
if (config.type === "switch") {
let disabled = typeof config.disabled === "function" ? config.disabled() : config.disabled;
if (typeof disabled === "boolean" && disabled) {
this.$data.contentConfigInitDisabledKeys.push(...menuDefaultConfig.keys());
}
}
for (const [__key, __defaultValue] of menuDefaultConfig.entries()) {
this.setDefaultValue(__key, __defaultValue);
}
};
const loopInitDefaultValue = (configList) => {
for (let index = 0; index < configList.length; index++) {
let configItem = configList[index];
initDefaultValue(configItem);
let child_forms = configItem.forms;
if (child_forms && Array.isArray(child_forms)) {
loopInitDefaultValue(child_forms);
}
}
};
const contentConfigList = [...PanelContent.getAllContentConfig()];
for (let index = 0; index < contentConfigList.length; index++) {
let leftContentConfigItem = contentConfigList[index];
if (!leftContentConfigItem.forms) {
continue;
}
const rightContentConfigList = leftContentConfigItem.forms;
if (rightContentConfigList && Array.isArray(rightContentConfigList)) {
loopInitDefaultValue(rightContentConfigList);
}
}
this.$data.contentConfigInitDisabledKeys = [...new Set(this.$data.contentConfigInitDisabledKeys)];
},
setDefaultValue(key, defaultValue) {
if (this.$data.contentConfigInitDefaultValue.has(key)) {
log.warn("请检查该key(已存在): " + key);
}
this.$data.contentConfigInitDefaultValue.set(key, defaultValue);
},
getDefaultValue(key) {
return this.$data.contentConfigInitDefaultValue.get(key);
},
setValue(key, value) {
PopsPanelStorageApi.set(key, value);
},
getValue(key, defaultValue) {
let localValue = PopsPanelStorageApi.get(key);
if (localValue == null) {
if (this.$data.contentConfigInitDefaultValue.has(key)) {
return this.$data.contentConfigInitDefaultValue.get(key);
}
return defaultValue;
}
return localValue;
},
deleteValue(key) {
PopsPanelStorageApi.delete(key);
},
hasKey(key) {
return PopsPanelStorageApi.has(key);
},
addValueChangeListener(key, callback) {
let listenerId = PopsPanelStorageApi.addValueChangeListener(key, (__key, __newValue, __oldValue) => {
callback(key, __oldValue, __newValue);
});
return listenerId;
},
removeValueChangeListener(listenerId) {
PopsPanelStorageApi.removeValueChangeListener(listenerId);
},
triggerMenuValueChange(key, newValue, oldValue) {
PopsPanelStorageApi.triggerValueChangeListener(key, oldValue, newValue);
},
exec(queryKey, callback, checkExec, once = true) {
const that = this;
let queryKeyFn;
if (typeof queryKey === "string" || Array.isArray(queryKey)) {
queryKeyFn = () => queryKey;
} else {
queryKeyFn = queryKey;
}
let isArrayKey = false;
let queryKeyResult = queryKeyFn();
let keyList = [];
if (Array.isArray(queryKeyResult)) {
isArrayKey = true;
keyList = queryKeyResult;
} else {
keyList.push(queryKeyResult);
}
let findNotInDataKey = keyList.find((it) => !this.$data.contentConfigInitDefaultValue.has(it));
if (findNotInDataKey) {
log.warn(`${findNotInDataKey} 键不存在`);
return;
}
let storageKey = JSON.stringify(keyList);
if (once) {
if (this.$data.onceExecMenuData.has(storageKey)) {
return this.$data.onceExecMenuData.get(storageKey);
}
}
let storeValueList = [];
let listenerIdList = [];
let dynamicAddStyleNodeCallback = (value, $style) => {
let dynamicResultList = [];
if (!Array.isArray($style)) {
$style = [$style];
}
$style.forEach(($styleItem) => {
if ($styleItem == null) {
return;
}
if ($styleItem instanceof HTMLStyleElement) {
dynamicResultList.push($styleItem);
return;
}
});
{
storeValueList = storeValueList.concat(dynamicResultList);
}
};
let getMenuValue = (key) => {
let value = this.getValue(key);
return value;
};
let clearBeforeStoreValue = () => {
for (let index = 0; index < storeValueList.length; index++) {
let $css = storeValueList[index];
$css.remove();
storeValueList.splice(index, 1);
index--;
}
};
let checkMenuExec = () => {
let flag = false;
if (typeof checkExec === "function") {
flag = checkExec(keyList);
} else {
flag = keyList.every((key) => getMenuValue(key));
}
return flag;
};
let valueChangeCallback = (valueOption) => {
let execFlag = checkMenuExec();
let resultList = [];
if (execFlag) {
let valueList = keyList.map((key) => this.getValue(key));
let callbackResult = callback({
value: isArrayKey ? valueList : valueList[0],
addStyleElement: (...args) => {
return dynamicAddStyleNodeCallback(true, ...args);
},
});
if (!Array.isArray(callbackResult)) {
callbackResult = [callbackResult];
}
callbackResult.forEach((it) => {
if (it == null) {
return;
}
if (it instanceof HTMLStyleElement) {
resultList.push(it);
return;
}
});
}
clearBeforeStoreValue();
storeValueList = [...resultList];
};
once &&
keyList.forEach((key) => {
let listenerId = this.addValueChangeListener(key, (key2, newValue, oldValue) => {
valueChangeCallback();
});
listenerIdList.push(listenerId);
});
valueChangeCallback();
let result = {
reload() {
valueChangeCallback();
},
clear() {
this.clearStoreStyleElements();
this.removeValueChangeListener();
once && that.$data.onceExecMenuData.delete(storageKey);
},
clearStoreStyleElements: () => {
return clearBeforeStoreValue();
},
removeValueChangeListener: () => {
listenerIdList.forEach((listenerId) => {
this.removeValueChangeListener(listenerId);
});
},
};
this.$data.onceExecMenuData.set(storageKey, result);
return result;
},
execMenu(key, callback, isReverse = false, once = false) {
return this.exec(
key,
(option) => {
return callback(option);
},
(keyList) => {
let execFlag = keyList.every((__key__) => {
let flag = !!this.getValue(__key__);
let disabled = Panel.$data.contentConfigInitDisabledKeys.includes(__key__);
if (disabled) {
flag = false;
log.warn(`.execMenu${once ? "Once" : ""} ${__key__} 被禁用`);
}
isReverse && (flag = !flag);
return flag;
});
return execFlag;
},
once
);
},
execMenuOnce(key, callback, isReverse = false, listenUrlChange = false) {
const result = this.execMenu(key, callback, isReverse, true);
if (listenUrlChange) {
if (result) {
const urlChangeEvent = () => {
result.reload();
};
this.removeUrlChangeWithExecMenuOnceListener(key);
this.addUrlChangeWithExecMenuOnceListener(key, urlChangeEvent);
const originClear = result.clear;
result.clear = () => {
originClear();
this.removeUrlChangeWithExecMenuOnceListener(key);
};
}
}
return result;
},
deleteExecMenuOnce(key) {
key = this.transformKey(key);
this.$data.onceExecMenuData.delete(key);
this.$data.urlChangeReloadMenuExecOnce.delete(key);
let flag = PopsPanelStorageApi.removeValueChangeListener(key);
return flag;
},
onceExec(key, callback) {
key = this.transformKey(key);
if (typeof key !== "string") {
throw new TypeError("key 必须是字符串");
}
if (this.$data.onceExecData.has(key)) {
return;
}
callback();
this.$data.onceExecData.set(key, 1);
},
deleteOnceExec(key) {
key = this.transformKey(key);
this.$data.onceExecData.delete(key);
},
addUrlChangeWithExecMenuOnceListener(key, callback) {
key = this.transformKey(key);
this.$data.urlChangeReloadMenuExecOnce.set(key, callback);
},
removeUrlChangeWithExecMenuOnceListener(key) {
key = this.transformKey(key);
this.$data.urlChangeReloadMenuExecOnce.delete(key);
},
triggerUrlChangeWithExecMenuOnceEvent(config) {
this.$data.urlChangeReloadMenuExecOnce.forEach((callback, key) => {
callback(config);
});
},
showPanel(
content,
title = `${SCRIPT_NAME}-设置`,
preventDefaultContentConfig = false,
preventRegisterSearchPlugin = false
) {
this.$data.$panel = null;
this.$data.panelContent = [];
let checkHasBottomVersionContentConfig =
content.findIndex((it) => {
let isBottom = typeof it.isBottom === "function" ? it.isBottom() : Boolean(it.isBottom);
return isBottom && it.id === "script-version";
}) !== -1;
if (!preventDefaultContentConfig && !checkHasBottomVersionContentConfig) {
content.push(...PanelContent.getDefaultBottomContentConfig());
}
let $panel = __pops.panel({
...{
title: {
text: title,
position: "center",
html: false,
style: "",
},
content,
btn: {
close: {
enable: true,
callback: (details, event) => {
details.close();
this.$data.$panel = null;
},
},
},
mask: {
enable: true,
clickEvent: {
toClose: true,
toHide: false,
},
clickCallBack: (originalRun, config) => {
originalRun();
this.$data.$panel = null;
},
},
width: PanelUISize.setting.width,
height: PanelUISize.setting.height,
drag: true,
only: true,
},
...this.$data.panelConfig,
});
this.$data.$panel = $panel;
this.$data.panelContent = content;
if (!preventRegisterSearchPlugin) {
this.registerConfigSearch({ $panel, content });
}
},
registerConfigSearch(config) {
const { $panel, content } = config;
let asyncQueryProperty = async (target, handler) => {
if (target == null) {
return;
}
let handleResult = await handler(target);
if (handleResult && typeof handleResult.isFind === "boolean" && handleResult.isFind) {
return handleResult.data;
}
return await asyncQueryProperty(handleResult.data, handler);
};
let scrollToElementAndListen = ($el, callback) => {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
callback?.();
observer.disconnect();
}
});
},
{
root: null,
threshold: 1,
}
);
observer.observe($el);
$el.scrollIntoView({ behavior: "smooth", block: "center" });
};
let addFlashingClass = ($el) => {
const flashingClassName = "pops-flashing";
domUtils.animationend($el, () => {
$el.classList.remove(flashingClassName);
});
$el.classList.add(flashingClassName);
};
let dbclick_event = (evt, selectorTarget) => {
domUtils.preventEvent(evt);
let $alert = __pops.alert({
title: {
text: "搜索配置",
position: "center",
},
content: {
text: `
<div class="search-wrapper">
<input class="search-config-text" name="search-config" type="text" placeholder="请输入需要搜素的配置名称">
</div>
<div class="search-result-wrapper"></div>
`,
html: true,
},
btn: {
ok: { enable: false },
},
mask: {
clickEvent: {
toClose: true,
},
},
width: PanelUISize.settingMiddle.width,
height: "auto",
drag: true,
style: `
${__pops.config.cssText.panelCSS}
.search-wrapper{
border-bottom: 1px solid rgb(235, 238, 245, 1);
}
.pops-content:has(.search-result-wrapper:empty) .search-wrapper{
border-bottom: 0;
}
.search-config-text{
width: 100%;
border: 0;
height: 32px;
padding: 0px 10px;
outline: none;
}
.search-result-wrapper{
max-height: 400px;
overflow: auto;
}
.search-result-item{
cursor: pointer;
padding: 5px 10px;
display: flex;
flex-direction: column;
}
.search-result-item:hover{
background-color: #D8F1FD;
}
.search-result-item-path{
display: flex;
align-items: center;
}
.search-result-item-description{
font-size: 0.8em;
color: #6c6c6c;
}
${config.searchDialogStyle ?? ""}
`,
});
$alert.$shadowRoot.querySelector(".search-wrapper");
let $searchInput = $alert.$shadowRoot.querySelector(".search-config-text");
let $searchResultWrapper = $alert.$shadowRoot.querySelector(".search-result-wrapper");
$searchInput.focus();
let clearSearchResult = () => {
domUtils.empty($searchResultWrapper);
};
let createSearchResultItem = (pathInfo) => {
const searchPath = utils.queryProperty(pathInfo, (target) => {
if (target?.next) {
return {
isFind: false,
data: target.next,
};
} else {
return {
isFind: true,
data: target,
};
}
});
let $item = domUtils.createElement("div", {
className: "search-result-item",
innerHTML: `
<div class="search-result-item-path">${searchPath.matchedData?.path}</div>
<div class="search-result-item-description">${searchPath.matchedData?.description ?? ""}</div>
`,
});
domUtils.on($item, "click", (clickItemEvent) => {
let $asideItems = $panel.$shadowRoot.querySelectorAll(
"aside.pops-panel-aside .pops-panel-aside-top-container li"
);
let $targetAsideItem = $asideItems[pathInfo.index];
if (!$targetAsideItem) {
qmsg.error(`左侧项下标${pathInfo.index}不存在`);
return;
}
$targetAsideItem.scrollIntoView({
behavior: "smooth",
block: "center",
});
$targetAsideItem.click();
asyncQueryProperty(pathInfo.next, async (target) => {
if (target?.next) {
let $findDeepMenu = await domUtils.waitNode(() => {
return Array.from($panel.$shadowRoot.querySelectorAll(".pops-panel-deepMenu-nav-item")).find(
($deepMenu) => {
const __formConfig__ = Reflect.get($deepMenu, "__formConfig__");
return (
typeof __formConfig__ === "object" &&
__formConfig__ != null &&
__formConfig__.text === target.name
);
}
);
}, 2500);
if ($findDeepMenu) {
$findDeepMenu.click();
} else {
qmsg.error("未找到对应的二级菜单");
return {
isFind: true,
data: target,
};
}
return {
isFind: false,
data: target.next,
};
} else {
let $findTargetMenu = await domUtils.waitNode(() => {
return Array.from($panel.$shadowRoot.querySelectorAll(`li:not(.pops-panel-deepMenu-nav-item)`)).find(
($menuItem) => {
const __formConfig__ = Reflect.get($menuItem, "__formConfig__");
return __formConfig__ === target.matchedData?.formConfig;
}
);
}, 2500);
if ($findTargetMenu) {
scrollToElementAndListen($findTargetMenu);
let $fold = $findTargetMenu.closest(`.pops-panel-forms-fold[data-fold-enable]`);
if ($fold) {
let $foldWrapper = $fold.querySelector(".pops-panel-forms-fold-container");
$foldWrapper.click();
await utils.sleep(500);
}
scrollToElementAndListen($findTargetMenu, () => {
addFlashingClass($findTargetMenu);
});
} else {
qmsg.error("未找到对应的菜单项");
}
return {
isFind: true,
data: target,
};
}
});
});
return $item;
};
let execSearch = (searchText) => {
const searchTextRegExp = new RegExp(searchText, "i");
const searchConfigResult = [];
const loopContentConfig = (configList, path) => {
for (let index = 0; index < configList.length; index++) {
const configItem = configList[index];
let child_forms = configItem.forms;
if (child_forms && Array.isArray(child_forms)) {
const deepMenuPath = utils.deepClone(path);
if (configItem.type === "deepMenu") {
const deepNext = utils.queryProperty(deepMenuPath, (target) => {
if (target?.next) {
return {
isFind: false,
data: target.next,
};
} else {
return {
isFind: true,
data: target,
};
}
});
deepNext.next = {
name: configItem.text,
};
}
loopContentConfig(child_forms, deepMenuPath);
} else {
let text = Reflect.get(configItem, "text");
let description = Reflect.get(configItem, "description");
const delayMatchedTextList = [text, description];
let matchedIndex = delayMatchedTextList.findIndex((configText) => {
if (typeof configText !== "string") {
return;
}
return configText.match(searchTextRegExp);
});
if (matchedIndex !== -1) {
const matchedPath = utils.deepClone(path);
const deepNext = utils.queryProperty(matchedPath, (target) => {
if (target?.next) {
return {
isFind: false,
data: target.next,
};
} else {
return {
isFind: true,
data: target,
};
}
});
deepNext.next = {
name: text,
matchedData: {
path: "",
formConfig: configItem,
matchedText: delayMatchedTextList[matchedIndex],
description,
},
};
const pathList = [];
utils.queryProperty(matchedPath, (target) => {
const name = target?.name;
if (typeof name === "string" && name.trim() !== "") {
pathList.push(name);
}
if (target?.next) {
return {
isFind: false,
data: target.next,
};
} else {
return {
isFind: true,
data: target,
};
}
});
const pathStr = pathList.join(CommonUtil2.escapeHtml(" - "));
deepNext.next.matchedData.path = pathStr;
searchConfigResult.push(matchedPath);
}
}
}
};
for (let index = 0; index < content.length; index++) {
const leftContentConfigItem = content[index];
if (!leftContentConfigItem.forms) {
continue;
}
if (leftContentConfigItem.isBottom && leftContentConfigItem.id === "script-version") {
continue;
}
const rightContentConfigList = leftContentConfigItem.forms;
if (rightContentConfigList && Array.isArray(rightContentConfigList)) {
let text = leftContentConfigItem.title;
if (typeof text === "function") {
text = text();
}
loopContentConfig(rightContentConfigList, {
index,
name: text,
});
}
}
let fragment = document.createDocumentFragment();
for (const pathInfo of searchConfigResult) {
let $resultItem = createSearchResultItem(pathInfo);
fragment.appendChild($resultItem);
}
clearSearchResult();
$searchResultWrapper.append(fragment);
};
domUtils.on(
$searchInput,
"input",
utils.debounce((evt2) => {
domUtils.preventEvent(evt2);
let searchText = domUtils.val($searchInput).trim();
if (searchText === "") {
clearSearchResult();
return;
}
execSearch(searchText);
}, 200)
);
};
let clickElement = null;
let isDoubleClick = false;
let timer = void 0;
domUtils.on(
$panel.$shadowRoot,
"dblclick",
`aside.pops-panel-aside .pops-panel-aside-item:not(#script-version)`,
dbclick_event
);
domUtils.on(
$panel.$shadowRoot,
"touchend",
`aside.pops-panel-aside .pops-panel-aside-item:not(#script-version)`,
(evt, selectorTarget) => {
clearTimeout(timer);
timer = void 0;
if (isDoubleClick && clickElement === selectorTarget) {
isDoubleClick = false;
clickElement = null;
dbclick_event(evt);
} else {
timer = setTimeout(() => {
isDoubleClick = false;
}, 200);
isDoubleClick = true;
clickElement = selectorTarget;
}
},
{
capture: true,
}
);
$panel.$shadowRoot.appendChild(
domUtils.createElement("style", {
type: "text/css",
textContent: `
.pops-flashing{
animation: double-blink 1.5s ease-in-out;
}
@keyframes double-blink {
0% {
background-color: initial;
}
25% {
background-color: yellow;
}
50% {
background-color: initial;
}
75% {
background-color: yellow;
}
100% {
background-color: initial;
}
}
`,
})
);
},
transformKey(key) {
if (Array.isArray(key)) {
const keyArray = key.sort();
return JSON.stringify(keyArray);
} else {
return key;
}
},
};
let injectDocumentTime = "";
if (document.documentElement) {
if (document.head) {
if (document.body) {
injectDocumentTime = `<html>
<head>
...${document.head.childNodes.length} nodes
</head>
<body>
...${document.body.childNodes.length} nodes
</body>
</html>
注入速度等级:4
`;
} else {
if (document.head.childNodes.length) {
injectDocumentTime = `<html>
<head>
...${document.head.childNodes.length} nodes
</head>
</html>
注入速度等级:3`;
} else {
injectDocumentTime = `<html>
<head></head>
</html>
注入速度等级:2`;
}
}
} else {
injectDocumentTime = `<html>
</html>
注入速度等级:1`;
}
} else {
injectDocumentTime = `document.documentElement is null
注入速度等级:0`;
}
const setTimeoutLog = (handler, timeout, ...args) => {
return setTimeout(async () => {
try {
await handler(...args);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
}, timeout);
};
const Tag = {
success: "√ ",
error: "× ",
warn: "!!! ",
info: "",
};
const TagUtil = {
setTagList($el, tagList) {
domUtils.html($el, "");
let tagHTML = "";
tagList.forEach((tagItem) => {
tagHTML += `
<p class="${tagItem.tag}">${tagItem.text ?? ""}</p>
`;
});
domUtils.html($el, tagHTML);
},
setTag($el, tag, text) {
TagUtil.clearTag($el);
domUtils.addClass($el, tag);
if (typeof text === "string") {
domUtils.html($el, text);
}
},
clearTag($el) {
Object.keys(Tag).forEach((tagName) => {
domUtils.removeClass($el, tagName);
});
},
};
const UIInfo = (config) => {
let result = {
type: "own",
getLiElementCallBack($li) {
let $item = domUtils.createElement("div", {
className: "pops-panel-item-left-text",
innerHTML: `
<p class="pops-panel-item-left-main-text"></p>
<p class="pops-panel-item-left-desc-text"></p>
`,
});
$li.appendChild($item);
return $li;
},
async afterAddToUListCallBack(formConfig, container) {
let $target = container.target;
let $leftContainer = $target.querySelector(".pops-panel-item-left-text");
let $text = $target.querySelector(".pops-panel-item-left-main-text");
let $desc = $target.querySelector(".pops-panel-item-left-desc-text");
let detail = await config();
if (detail.tag == null) {
domUtils.html($text, detail.text);
} else {
domUtils.html($text, Tag[detail.tag] + detail.text);
}
if (detail.description == null || detail.description === "") {
domUtils.hide($desc, false);
}
domUtils.html($desc, detail.description || "");
let classNameList = ["support-info"];
if (detail.tag != null) {
classNameList.push(detail.tag);
}
domUtils.addClass($text, classNameList);
if (typeof detail.afterRender === "function") {
try {
detail.afterRender({
...container,
$leftContainer,
$leftText: $text,
$leftDesc: $desc,
});
} catch (error) {
console.log(error);
TagUtil.setTag($text, "error", "afterRender 函数执行错误" + error);
}
}
},
};
return result;
};
const PanelKeyConfig = {
asideLastVisit: "aside-last-visit",
};
const GlobalUtil = {
getWindow() {
return GMTotal.unsafeWindow.isSupport() ? _unsafeWindow : window;
},
};
class TestUIBase {}
class ApiTestBase extends TestUIBase {
isSupportGM() {
return typeof _GM === "object" && _GM != null;
}
}
class ApiAsyncTestBase extends ApiTestBase {}
const TamperMonkeyUtils = {
getApiDocUrl(navName, text) {
text = text ?? navName;
return `<a href="https://www.tampermonkey.net/documentation.php?ext=gcal&version=#api:${navName}" target="_blank">${text}</a>`;
},
};
class ApiTest_addElement extends ApiAsyncTestBase {
getApiName() {
return "GM_addElement";
}
getAsyncApiOption() {
return {
name: "GM.addElement",
isSupport: this.isSupportGM() && typeof _GM.addElement === "function",
};
}
isSupport() {
return typeof _GM_addElement === "function";
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
let fnResult = Reflect.apply(_GM_addElement, this, args);
resolve(fnResult);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.addElement,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name.replace(".", "__async__");
data.formList.push(
UIInfo(async () => {
let $script = null;
let $script_page = null;
let win = GlobalUtil.getWindow();
let el_script_id = apiNameTag + "_test_script_exec";
let winPropName = `${el_script_id}_test_str`;
try {
$script = await data.fn("script", {
id: el_script_id,
textContent: `window["${winPropName}"] = "bar";`,
});
$script_page = document.querySelector("#" + el_script_id);
if ($script == null) {
return {
text: `${data.name} returns is null`,
tag: "error",
};
}
if (!($script instanceof HTMLElement)) {
return {
text: `${data.name} returns is not style element`,
tag: "error",
};
}
if (typeof win[winPropName] !== "string") {
return {
text: `${data.name} script element is not work`,
tag: "error",
};
}
Reflect.deleteProperty(win, winPropName);
return {
text: CommonUtil2.escapeHtml("支持添加<script>元素且执行js"),
tag: "success",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
if ($script_page) {
$script_page.remove();
}
}
}),
UIInfo(async () => {
let $el_div = null;
let $el_page = null;
let el_id = apiNameTag + "_test2";
try {
$el_div = await data.fn(document.body, "div", {
"data-src": "https://example.com/image.png",
id: el_id,
});
if ($el_div == null) {
return {
text: data.name + " returns is null",
tag: "error",
};
}
if (!($el_div instanceof HTMLElement)) {
return {
text: data.name + " returns is not style element",
tag: "error",
};
}
$el_page = document.querySelector("#" + el_id);
if (!$el_page) {
return {
text: "不支持3个参数",
tag: "error",
};
}
const shadowRoot = $el_page.attachShadow({
mode: "closed",
});
await data.fn(shadowRoot, "style", {
textContent: "div { color: black; };",
});
if (!shadowRoot.querySelector("style")) {
return {
text: "不支持3个参数的shadowRoot",
tag: "error",
};
}
if ($el_div == null) {
return {
text: "传入3个参数但是返回为空",
tag: "error",
};
}
if (!$el_page.hasAttribute("data-src")) {
return {
text: "不支持设置自定义属性data-src",
tag: "error",
};
}
return {
text: "支持3个参数并返回元素对象",
tag: "success",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
if ($el_page) {
$el_page.remove();
}
}
})
);
});
}
return result;
}
}
class ApiTest_addStyle extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_addStyle === "function";
}
getApiName() {
return "GM_addStyle";
}
getAsyncApiOption() {
return {
name: "GM.addStyle",
isSupport: this.isSupportGM() && typeof _GM.addStyle === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-GM_addStyle" + apiName,
title: apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
let fnResult = Reflect.apply(_GM_addStyle, this, args);
resolve(fnResult);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.addStyle,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name.replace(".", "__async__");
data.formList.push(
UIInfo(async () => {
let $test = null;
let $testCSS = null;
try {
$test = domUtils.createElement("div", {
id: apiNameTag,
innerText: apiNameTag + " test",
});
document.body.appendChild($test);
$testCSS = await data.fn(
`
#${apiNameTag} {
background-color: rgb(255, 0, 0);
}
`
);
if ($testCSS == null) {
return {
text: `${data.name} returns is null`,
tag: "error",
};
}
if (!($testCSS instanceof HTMLStyleElement)) {
return {
text: `${data.name} returns is not HTMLStyleElement`,
tag: "error",
};
}
const computedStyle = window.getComputedStyle($test);
if (computedStyle.backgroundColor !== "rgb(255, 0, 0)") {
return {
text: `${data.name} test element background is not rgb(255, 0, 0)`,
tag: "error",
};
}
return {
text: CommonUtil2.escapeHtml("支持添加CSS字符串并返回元素对象"),
tag: "success",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
$test?.remove();
$testCSS?.remove();
}
})
);
});
}
return result;
}
}
class ApiTest_addValueChangeListener extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_addValueChangeListener === "function";
}
getApiName() {
return "GM_addValueChangeListener";
}
getAsyncApiOption() {
return {
name: "GM.addValueChangeListener",
isSupport: this.isSupportGM() && typeof _GM.addValueChangeListener === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_addValueChangeListener(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.addValueChangeListener,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name;
data.formList.push(
(() => {
let localStorageDataKey = apiNameTag + "_key_1";
return UIInfo(() => {
return {
text: "测试监听数据存储改变",
description: ``,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeoutId = void 0;
let listenerId = void 0;
let tagTextList = [];
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
tagTextList = [];
clearTimeout(timeoutId);
TagUtil.setTag(container.$leftText, "info", "等待触发回调");
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let delaySetValue = utils.formatTime(Date.now());
listenerId =
listenerId ??
(await data.fn(localStorageDataKey, function (key, oldValue, newValue, remote) {
console.log(arguments);
clearTimeout(timeoutId);
tagTextList.push({
tag: "success",
text: "支持触发回调",
});
if (typeof key !== "string") {
tagTextList.push({
tag: "error",
text: `不支持回调参数key,当前类型:${typeof key}`,
});
} else {
tagTextList.push({
tag: "success",
text: `支持回调参数key,当前类型:${typeof key}`,
});
}
if (typeof newValue !== typeof delaySetValue) {
tagTextList.push({
tag: "error",
text: `不支持回调参数newValue,当前类型:${typeof delaySetValue}`,
});
} else {
tagTextList.push({
tag: "success",
text: `支持回调参数newValue,当前类型:${typeof delaySetValue}`,
});
}
if (typeof remote !== "boolean") {
tagTextList.push({
tag: "error",
text: `不支持回调参数remote,当前类型:${typeof remote}`,
});
} else {
tagTextList.push({
tag: "success",
text: `支持回调参数remote,当前类型:${typeof remote}`,
});
}
TagUtil.setTagList(container.$leftText, tagTextList);
}));
console.log(data.name + " listenerId:" + listenerId + " typeof:" + typeof listenerId);
if (typeof listenerId !== "number" && typeof listenerId !== "string") {
tagTextList.push({
tag: "warn",
text: "listenerId类型不是number或string",
});
} else {
tagTextList.push({
tag: "success",
text: "listenerId类型:" + typeof listenerId,
});
}
timeoutId = setTimeout(() => {
tagTextList.push({
tag: "error",
text: "不支持触发回调",
});
TagUtil.setTagList(container.$leftText, tagTextList);
}, 3e3);
_GM_setValue(localStorageDataKey, delaySetValue);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_cookie extends ApiAsyncTestBase {
isSupport() {
return (typeof _GM_cookie === "object" || typeof _GM_cookie === "function") && _GM_cookie != null;
}
getApiOption() {
let isSupport = this.isSupport();
return {
isSupportList: isSupport && typeof _GM_cookie.list === "function",
isSupportSet: isSupport && typeof _GM_cookie.set === "function",
isSupportDelete: isSupport && typeof _GM_cookie.delete === "function",
};
}
getApiName() {
return "GM_cookie";
}
getAsyncApiOption() {
let isSupportAsync =
this.isSupportGM() &&
(typeof _GM.cookie === "object" || typeof _GM.cookie === "function") &&
_GM.cookie != null;
return {
name: "GM.cookie",
isSupport: isSupportAsync,
isSupportList: isSupportAsync && typeof _GM.cookie.list === "function",
isSupportSet: isSupportAsync && typeof _GM.cookie.set === "function",
isSupportDelete: isSupportAsync && typeof _GM.cookie.delete === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiInfo = this.getApiOption();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName + ".list", `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: `支持 ${apiName},类型 ${typeof _GM_cookie}`,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
let firstFormList = result["forms"][0].forms;
if (this.isSupport()) {
firstFormList.push(
UIInfo(() => {
return apiInfo.isSupportList
? {
text: `支持 ${apiName}.list`,
tag: "success",
}
: {
text: `不支持 ${apiName}.list`,
tag: "error",
};
}),
UIInfo(() => {
return apiInfo.isSupportSet
? {
text: `支持 ${apiName}.set`,
tag: "success",
}
: {
text: `不支持 ${apiName}.set`,
tag: "error",
};
}),
UIInfo(() => {
return apiInfo.isSupportDelete
? {
text: `支持 ${apiName}.delete`,
tag: "success",
}
: {
text: `不支持 ${apiName}.delete`,
tag: "error",
};
})
);
}
if (apiAsyncInfo.isSupport) {
firstFormList.push(
UIInfo(() => {
return apiAsyncInfo.isSupportList
? {
text: `支持 ${apiAsyncInfo.name}.list`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.list`,
tag: "error",
};
}),
UIInfo(() => {
return apiAsyncInfo.isSupportSet
? {
text: `支持 ${apiAsyncInfo.name}.set`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.set`,
tag: "error",
};
}),
UIInfo(() => {
return apiAsyncInfo.isSupportDelete
? {
text: `支持 ${apiAsyncInfo.name}.delete`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.delete`,
tag: "error",
};
})
);
} else {
firstFormList.push(
UIInfo(() => {
return { text: "不支持 " + apiAsyncInfo.name, tag: "error" };
})
);
}
if (this.isSupport()) {
let newCookieInfo = {
name: "test",
value: "1",
expirationDate: (Date.now() + 24 * 60 * 60 * 1e3) / 1e3,
};
[
{
name: apiName,
list: async (...args) => {
return new Promise((resolve, reject) => {
const [details, cb] = args;
_GM_cookie.list(details, (cookies, error) => {
if (error) {
reject(error);
} else {
resolve(cookies);
}
});
});
},
set: async (...args) => {
return new Promise((resolve, reject) => {
const [details, cb] = args;
_GM_cookie.set(details, (error) => {
if (error) {
reject(error);
} else {
resolve(void 0);
}
});
});
},
delete: async (...args) => {
return new Promise((resolve, reject) => {
const [details, cb] = args;
_GM_cookie.delete(details, (error) => {
if (error) {
reject(error);
} else {
resolve(void 0);
}
});
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
list: _GM.cookie?.list,
set: _GM.cookie?.set,
delete: _GM.cookie?.delete,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试list获取所有Cookie"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
const cookies = await data.list({});
console.log(cookies);
if (Array.isArray(cookies)) {
__pops.alert({
title: {
text: data.name + ".list",
position: "center",
},
content: {
text: JSON.stringify(cookies, null, 4),
html: true,
},
drag: true,
mask: {
enable: true,
},
width: PanelUISize.setting.width,
height: PanelUISize.setting.height,
style: `
.pops-alert-content{
white-space: pre-wrap;
}
`,
});
} else {
alert("获取的cookie信息不是数组");
}
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试set新增Cookie"),
tag: "info",
description: JSON.stringify(newCookieInfo),
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
await data.set(newCookieInfo);
qmsg.success(data.name + " set cookie success");
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
let deleteCookieInfo = {
name: "test",
};
return {
text: CommonUtil2.escapeHtml("测试delete删除Cookie"),
tag: "info",
description: JSON.stringify(deleteCookieInfo),
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
await data.delete(deleteCookieInfo);
qmsg.success(data.name + " delete cookie success");
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_deleteValue extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_deleteValue === "function";
}
getApiName() {
return "GM_deleteValue";
}
getAsyncApiOption() {
return {
name: "GM.deleteValue",
isSupport: this.isSupportGM() && typeof _GM.deleteValue === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.name
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_deleteValue(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.deleteValue,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name;
data.formList.push(
(() => {
let localStorageDataKey = `Test ${apiNameTag} null`;
let localStorageDataValue = null;
return UIInfo(() => {
return {
text: "测试存储null值并删除",
description: `"${localStorageDataKey}": ${localStorageDataValue}`,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
_GM_setValue(localStorageDataKey, localStorageDataValue);
await data.fn(localStorageDataKey);
let value = _GM_getValue(localStorageDataKey);
if (typeof value === "object" && value === null) {
qmsg.error("该值未删除,读取的值:" + value);
} else {
qmsg.success("成功删除该值");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_deleteValues extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_deleteValues === "function";
}
getApiName() {
return "GM_deleteValues";
}
getAsyncApiOption() {
return {
name: "GM.deleteValues",
isSupport: this.isSupportGM() && typeof _GM.deleteValues === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_deleteValues(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.deleteValues,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
(() => {
let localStorageDataValue = {
GM_deleteValues_key_1: 555,
"GM.deleteValues_key_2": 666,
};
return UIInfo(() => {
return {
text: "测试存储对象然后删除再读取",
description: `${JSON.stringify(localStorageDataValue)}`,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
_GM_setValues(localStorageDataValue);
let localKeys = Object.keys(localStorageDataValue);
let values = _GM_getValues(localKeys);
if (JSON.stringify(values) !== JSON.stringify(localStorageDataValue)) {
qmsg.error("写入失败,写入的数据和读取的数据不相同");
return;
}
await data.fn(localKeys);
let values2 = _GM_getValues(localKeys);
if (values2 == null) {
qmsg.warning("删除情况未知,因为读取到的数据为null");
} else if (typeof values2 === "object" && JSON.stringify(values2) === "{}") {
qmsg.success("删除成功,读取的数据为{}");
} else {
qmsg.error("删除情况未知,因为读取到的数据类型不是object");
console.log(values2);
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_download extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_download === "function";
}
getApiName() {
return "GM_download";
}
getAsyncApiOption() {
return {
name: "GM.download",
isSupport: this.isSupportGM() && typeof _GM.download === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
],
};
if (this.isSupport()) {
result["forms"][1].forms.push(
UIInfo(() => {
return {
text: CommonUtil2.escapeHtml("TODO"),
tag: "info",
afterRender(container) {
container.target?.querySelector(".support-info");
},
};
})
);
}
return result;
}
}
class ApiTest_getResourceText extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getResourceText === "function";
}
getApiName() {
return "GM_getResourceText";
}
getAsyncApiOption() {
return {
name: "GM.getResourceText",
isSupport: this.isSupportGM() && typeof _GM.getResourceText === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_getResourceText(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getResourceText,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name.replace(".", "__async__");
data.formList.push(
UIInfo(async () => {
try {
let resourceText = await data.fn("ViewerCSS");
if (typeof resourceText === "string") {
return {
text: CommonUtil2.escapeHtml("支持通过@resource引用资源字符串"),
tag: "success",
};
} else {
return {
text: CommonUtil2.escapeHtml(data.name + " return is not string"),
tag: "error",
};
}
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_getResourceUrl extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getResourceURL === "function";
}
getApiName() {
return "GM_getResourceURL";
}
getAsyncApiOption() {
return {
name: "GM.getResourceUrl",
isSupport: this.isSupportGM() && typeof _GM.getResourceUrl === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
let fnResult = Reflect.apply(_GM_getResourceURL, this, args);
resolve(fnResult);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getResourceUrl,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name.replace(".", "__async__");
data.formList.push(
UIInfo(async () => {
try {
let resourceBase64Data = await data.fn("ViewerCSS");
if (typeof resourceBase64Data !== "string") {
return {
text: CommonUtil2.escapeHtml(`${data.name} return is not string`),
tag: "error",
};
}
resourceBase64Data = resourceBase64Data.trim();
if (resourceBase64Data.startsWith("data:text/css;base64")) {
if (
resourceBase64Data.startsWith(
"data:text/css;base64,LyohCiAqIFZpZXdlci5qcyB2MS4xMS43CiAqIGh0dHBzOi8vZmVuZ3"
)
) {
return {
text: CommonUtil2.escapeHtml("支持通过@resource引用资源并进行base64编码"),
tag: "success",
};
} else {
return {
text: CommonUtil2.escapeHtml(
"支持通过@resource引用资源并进行base64编码,但是base64编码的实现方式不同"
),
tag: "warn",
};
}
} else {
return {
text: CommonUtil2.escapeHtml("支持通过@resource引用资源,但是未对资源进行base64编码"),
tag: "warn",
};
}
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_getTab extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getTab === "function";
}
getApiName() {
return "GM_getTab";
}
getAsyncApiOption() {
return {
name: "GM.getTab",
isSupport: this.isSupportGM() && typeof _GM.getTab === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async () => {
return new Promise((resolve) => {
_GM_getTab((...args) => {
resolve(...args);
});
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getTab,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name.replace(".", "__async__");
data.formList.push(
UIInfo(() => {
return {
text: "测试获取当前Tab",
description: "",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "error", "等待3s内触发回调函数");
timeId = setTimeoutLog(() => {
TagUtil.setTag(container.$leftText, "error", "超时,不支持触发回调函数");
}, 3e3);
let tab = await data.fn();
clearTimeout(timeId);
console.log(data.name + " callback tab", tab);
if (typeof tab === "object" && tab != null) {
TagUtil.setTagList(container.$leftText, [
{
tag: "success",
text: "支持触发回调函数",
},
{
tag: "success",
text: "入参tab为object类型",
},
]);
} else {
TagUtil.setTagList(container.$leftText, [
{
tag: "success",
text: "支持触发回调函数",
},
{
tag: "error",
text: "入参tab不为object类型",
},
]);
}
alert(JSON.stringify(tab));
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
})
);
});
}
return result;
}
}
class ApiTest_getTabs extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getTabs === "function";
}
getApiName() {
return "GM_getTabs";
}
getAsyncApiOption() {
return {
name: "GM.getTabs",
isSupport: this.isSupportGM() && typeof _GM.getTabs === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async () => {
return new Promise((resolve) => {
_GM_getTabs((...args) => {
resolve(...args);
});
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getTabs,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name.replace(".", "__async__");
data.formList.push(
UIInfo(() => {
return {
text: "测试获取所有Tab",
description: "",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "error", "等待3s内触发回调函数");
timeId = setTimeoutLog(() => {
TagUtil.setTag(container.$leftText, "error", "超时,不支持触发回调函数");
}, 3e3);
let tabs = await data.fn();
clearTimeout(timeId);
console.log(data.name + " callback tabs", tabs);
if (typeof tabs === "object" && tabs != null) {
TagUtil.setTagList(container.$leftText, [
{
tag: "success",
text: "支持触发回调函数",
},
{
tag: "success",
text: "入参tab为object类型",
},
]);
} else {
TagUtil.setTagList(container.$leftText, [
{
tag: "success",
text: "支持触发回调函数",
},
{
tag: "error",
text: "入参tab不为object类型",
},
]);
}
alert(JSON.stringify(tabs));
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
})
);
});
}
return result;
}
}
class ApiTest_getValue extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getValue === "function";
}
getApiName() {
return "GM_getValue";
}
getAsyncApiOption() {
return {
name: "GM.getValue",
isSupport: this.isSupportGM() && typeof _GM.getValue === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_getValue(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getValue,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name;
data.formList.push(
...[
{
key: `Test ${apiNameTag} boolean`,
value: true,
text: function () {
return `存储boolean类型并读取`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} number`,
value: 1,
text: function () {
return `存储number类型并读取`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} string`,
value: "测试字符串",
text: function () {
return `存储string类型并读取`;
},
desc: function () {
return `"${this.key}": "${this.value}"`;
},
},
{
key: `Test ${apiNameTag} undefined`,
value: void 0,
text: function () {
return `存储undefined类型并读取`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} null`,
value: null,
text: function () {
return `存储object类型的null并读取`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} object`,
value: { "object key": "object value" },
text: function () {
return `存储object类型并读取`;
},
desc: function () {
return `"${this.key}": ${JSON.stringify(this.value)}`;
},
},
].map((it) => {
return (() => {
let localStorageDataKey = it.key;
let localStorageDataValue = it.value;
return UIInfo(() => {
return {
text: it.text(),
description: it.desc(),
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
_GM_setValue(localStorageDataKey, localStorageDataValue);
let value = await data.fn(localStorageDataKey);
if (typeof value === typeof localStorageDataValue) {
if (localStorageDataValue === null && localStorageDataValue != value) {
qmsg.error("读取成功,但存储类型和读取类型不同,存储类型为null,但读取类型不为null");
return;
}
qmsg.success("读取成功,存储类型和读取类型一致");
} else {
qmsg.error("读取成功,但存储类型和读取类型不同");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})();
}),
(() => {
let localStorageDataKey = `Test ${apiNameTag} null with defaultValue`;
let localStorageDefaultValue = 123;
return UIInfo(() => {
return {
text: "存储object类型的null,读取时指定默认值为" + localStorageDefaultValue,
description: `${apiNameTag}("${localStorageDataKey}", ${localStorageDefaultValue})`,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
await data.fn(localStorageDataKey, null);
let value = await data.fn(localStorageDataKey, localStorageDefaultValue);
if (typeof value === "object" && value == null) {
qmsg.success("读取的值是存储的值:" + value);
} else {
qmsg.error("读取的值不是存储的值:" + value);
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})(),
(() => {
let localStorageDataKey = `Test ${apiNameTag} defaultValue`;
let localStorageDefaultValue = 123;
return UIInfo(() => {
return {
text: "不存储,测试调用默认值",
description: `${apiNameTag}("${localStorageDataKey}", ${localStorageDefaultValue})`,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
let value = await data.fn(localStorageDataKey, localStorageDefaultValue);
if (typeof value === typeof localStorageDefaultValue) {
qmsg.success("读取的值是默认值:" + value);
} else {
qmsg.error("读取的值不是默认值:" + value);
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_getValues extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_getValues === "function";
}
getApiName() {
return "GM_getValues";
}
getAsyncApiOption() {
return {
name: "GM.getValues",
isSupport: this.isSupportGM() && typeof _GM.getValues === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_getValues(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.getValues,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name;
data.formList.push(
(() => {
return UIInfo(() => {
return {
text: "测试直接读取",
description: "没有入参",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
let value = await data.fn();
qmsg.info("请在控制台查看读取的数据");
console.log(value);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})(),
(() => {
return UIInfo(() => {
let localStorageDataValue = utils.toJSON(`{
"${apiNameTag}-test-key-non-exists-1": 1111,
"${apiNameTag}-test-key-non-exists-2": 2222,
}`);
return {
text: "测试读取不存在的数据",
description: "数据默认值:" + JSON.stringify(localStorageDataValue),
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
let value = await data.fn(localStorageDataValue);
console.log(value);
if (value == null) {
qmsg.error("读取失败,读取的数据为null");
} else if (JSON.stringify(value) === JSON.stringify(localStorageDataValue)) {
qmsg.success("读取成功,读取的数据和默认值相同");
} else {
qmsg.error("读取成功,但读取的数据和默认值不同");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})(),
(() => {
let localStorageDataValue = utils.toJSON(`{
"${apiNameTag}-test-key-1": 1,
"${apiNameTag}-test-key-2": 2,
}`);
return UIInfo(() => {
return {
text: "测试存储对象并读取",
description: JSON.stringify(localStorageDataValue),
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
_GM_setValues(localStorageDataValue);
let keys = Object.keys(localStorageDataValue);
let value = await data.fn(keys);
console.log(value);
if (value == null) {
qmsg.error("读取失败,读取的数据为null");
} else if (JSON.stringify(value) === JSON.stringify(localStorageDataValue)) {
qmsg.success("读取成功,写入的数据和读取的数据相同");
} else {
qmsg.error("读取成功,但写入的数据和读取的数据不同");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_info extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_info === "object" && _GM_info != null;
}
getApiName() {
return "GM_info";
}
getAsyncApiOption() {
return {
name: "GM.info",
isSupport: this.isSupportGM() && typeof _GM.info === "object",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(GM)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: _GM_info,
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.info,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
...[
{
value: data.fn?.downloadMode,
type: "string",
text: `${data.name}.downloadMode`,
notExistsTag: "error",
},
{
value: data.fn?.scriptHandler,
type: "string",
text: `${data.name}.scriptHandler`,
},
{
value: data.fn?.scriptMetaStr,
type: "string",
text: `${data.name}.scriptMetaStr`,
},
{
value: data.fn?.version,
type: "string",
text: `${data.name}.version`,
},
{
value: data.fn?.script,
type: "object",
text: `${data.name}.script`,
},
{
value: data.fn?.script?.name,
type: "string",
text: `${data.name}.script.name`,
},
{
value: data.fn?.script?.author,
type: "string",
text: `${data.name}.script.author`,
},
{
value: data.fn?.script?.description,
type: "string",
text: `${data.name}.script.description`,
},
{
value: data.fn?.script?.version,
type: "string",
text: `${data.name}.script.version`,
},
].map((it) =>
UIInfo(() => {
try {
if (it.value != null && typeof it.value === it.type) {
return {
text: "支持 " + it.text + " 类型:" + it.type,
tag: "success",
};
} else {
return {
text: "不支持 " + it.text + " 类型:" + it.type,
tag: it.notExistsTag ?? "error",
};
}
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
)
);
});
}
return result;
}
}
class ApiTest_listValues extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_listValues === "function";
}
getApiName() {
return "GM_listValues";
}
getAsyncApiOption() {
return {
name: "GM.listValues",
isSupport: this.isSupportGM() && typeof _GM.listValues === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_listValues(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.listValues,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
UIInfo(() => {
return {
text: "查看存储的所有键名",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
let ret = await data.fn();
console.log(data.name + " call result", ret);
if (Array.isArray(ret)) {
let isNotTotalStr = ret.find((it) => typeof it !== "string");
if (isNotTotalStr) {
qmsg.error("返回值数组中存在非string类型");
} else {
alert(JSON.stringify(ret, null, 4));
}
} else {
qmsg.error("返回值不是数组");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
})
);
});
}
return result;
}
}
class ApiTest_log extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_log === "function";
}
getApiName() {
return "GM_log";
}
getAsyncApiOption() {
return {
name: "GM.log",
isSupport: this.isSupportGM() && typeof _GM.log === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_log(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.log,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
UIInfo(() => {
try {
let logText = "test " + data.name;
return {
text: CommonUtil2.escapeHtml("请在控制台查看输出"),
tag: "info",
description: "test " + data.name,
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
await data.fn(logText);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_notification extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_notification === "function";
}
getApiName() {
return "GM_notification";
}
getAsyncApiOption() {
return {
name: "GM.notification",
isSupport: this.isSupportGM() && typeof _GM.notification === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (details) => {
return new Promise((resolve) => {
let originClick = details.onclick;
let fnResult = _GM_notification({
...details,
onclick(...args) {
if (typeof originClick === "function") {
Reflect.apply(originClick, this, args);
}
resolve(fnResult ?? true);
},
});
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.notification,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name.replace(".", "__async__");
data.formList.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("点击通知的内容测试url"),
tag: "info",
description: "https://example.com/",
afterRender(container) {
let $target = container.target;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
await data.fn({
title: `测试 ${data.name} 标题`,
text: `测试 ${data.name} 内容`,
url: "https://example.com/",
});
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
}
}),
UIInfo(() => {
try {
let $target = void 0;
let $info = void 0;
let isClick = false;
let isDone = false;
return {
text: "测试通知的timeout",
description: "请勿点击通知",
tag: "info",
afterRender(container) {
$target = container.target;
$info = container.$leftContainer;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId = void 0;
let updateText = utils.debounce(() => {
try {
clearTimeout(timeId);
let clickText = "测试成功,触发";
let clickTag = "success";
domUtils.html(container.$leftText, `<p class="${clickTag}">${clickText}</p>`);
isClick = false;
isDone = false;
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
}, 800);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
let timeCount = 10;
let calcTimeCount = timeCount;
let tipInfoText = () => {
let result2 = `正在等待触发超时:5000ms`;
calcTimeCount--;
return result2;
};
TagUtil.setTag(container.$leftText, "info", tipInfoText());
timeId = setTimeoutLog(() => {
TagUtil.setTag(container.$leftText, "error", "测试超时,未触发ondone回调");
}, timeCount * 1e3);
const clicked = await data.fn({
title: `测试 ${data.name} 标题`,
text: `测试 ${data.name} 内容`,
url: "https://example.com/",
timeout: 5e3,
ondone() {
updateText();
},
});
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after($info, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
let $target = void 0;
let $info = void 0;
let isClick = false;
let isPrevent = false;
let isDone = false;
let text = "点击通知的内容测试onclick、ondone函数";
let desc = "https://example.com/";
return {
text,
description: desc,
tag: "info",
afterRender(container) {
$target = container.target;
$info = container.$leftContainer;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId = void 0;
let intervalId = void 0;
let updateText = utils.debounce(() => {
try {
clearTimeout(timeId);
clearInterval(intervalId);
let clickText = "";
let clickTag = "success";
let doneText = "";
let doneTag = "success";
if (isClick) {
clickText += "支持 onclick 函数";
if (isPrevent) {
clickText = clickText.trim();
clickText += "且支持提供 event 参数";
} else {
clickText += "但是不支持提供 event 参数";
clickTag = "warn";
}
} else {
clickText += "不支持 onclick 函数";
clickTag = "error";
}
if (isDone) {
doneText += "支持 ondone 函数";
} else {
doneText += "不支持 ondone 函数";
doneTag = "error";
}
domUtils.html(
container.$leftText,
`
<p class="${clickTag}">${clickText}</p>
<p class="${doneTag}">${doneText}</p>`
);
isClick = false;
isDone = false;
isPrevent = false;
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
}, 800);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
clearInterval(intervalId);
let timeCount = 10;
let calcTimeCount = timeCount;
let tipInfoText = () => {
let result2 = `正在等待触发回调,请在规定时间内点击弹窗的【关闭】按钮或者内容:${calcTimeCount}s`;
calcTimeCount--;
return result2;
};
domUtils.text(container.$leftText, tipInfoText());
domUtils.text(container.$leftDesc, text);
domUtils.show(container.$leftDesc, false);
timeId = setTimeoutLog(() => {
clearInterval(intervalId);
TagUtil.setTag(container.$leftText, "error", "测试超时,未触发回调");
}, timeCount * 1e3);
intervalId = setInterval(() => {
domUtils.text(container.$leftText, tipInfoText());
}, 1e3);
await data.fn({
title: `测试 ${data.name} 标题`,
text: `测试 ${data.name} 内容`,
url: "https://example.com/",
onclick: (event2) => {
console.log(event2);
isClick = true;
if (event2 && typeof event2.preventDefault === "function") {
isPrevent = true;
event2.preventDefault();
}
updateText();
},
ondone() {
isDone = true;
updateText();
},
});
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after($info, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
let $target = void 0;
let $info = void 0;
let isClick = false;
let isPrevent = false;
let isDone = false;
let beforeContent = "123";
let afterContent = "456";
let tag = "notification_tag_" + Date.now();
let notificationOption = {
title: "测试通知的内容更新(tag)",
text: beforeContent,
tag,
};
let desc = `更新前:${beforeContent},更新后:${afterContent}`;
return {
text: notificationOption.title,
description: desc,
tag: "info",
afterRender(container) {
$target = container.target;
$info = container.$leftContainer;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId = void 0;
let intervalId = void 0;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
clearInterval(intervalId);
let timeCount = 5;
let calcTimeCount = timeCount;
let tipInfoText = () => {
let result2 = `${calcTimeCount}s后通知的内容将更新为:${afterContent}`;
calcTimeCount--;
return result2;
};
domUtils.text(container.$leftDesc, tipInfoText());
domUtils.show(container.$leftDesc, false);
timeId = setTimeout(async () => {
clearInterval(intervalId);
domUtils.text(container.$leftDesc, desc);
data.fn({
...notificationOption,
text: afterContent,
});
}, timeCount * 1e3);
intervalId = setInterval(() => {
domUtils.text(container.$leftDesc, tipInfoText());
}, 1e3);
await data.fn(notificationOption);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after($info, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_openInTab extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_openInTab === "function";
}
getApiName() {
return "GM_openInTab";
}
getAsyncApiOption() {
return {
name: "GM.openInTab",
isSupport: this.isSupportGM() && typeof _GM.openInTab === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_openInTab(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.openInTab,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.formList.push(
UIInfo(() => {
try {
return {
text: "后台打开:https://www.example.com/",
tag: "info",
afterRender(container) {
let $target = container.target;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let result2 = await data.fn("https://www.example.com/");
if (typeof result2 === "object") {
if (result2 == null) {
TagUtil.setTag(container.$leftText, "error", "返回值为null");
} else {
let support_close = "close" in result2 && typeof result2.close === "function";
let support_closed = "closed" in result2 && typeof result2.closed === "boolean";
let support_onclose = "onclose" in result2;
domUtils.html(
container.$leftText,
`
${support_close ? `<p class="success">支持 .close()</p>` : `<p class="error">不支持 .close()</p>`}
${support_closed ? `<p class="success">支持 .closed</p>` : `<p class="error">不支持 .closed</p>`}
${support_onclose ? `<p class="success">支持设置属性 .onclose</p>` : `<p class="error">不支持设置属性 .onclose</p>`}
`
);
}
} else {
TagUtil.setTag(container.$leftText, "error", "返回值不是对象:" + typeof result2);
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
}
}),
UIInfo(() => {
try {
return {
text: "配置 active: true",
description: "",
tag: "info",
afterRender(container) {
let $target = container.target;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId;
let blurEvent = () => {
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "success", "测试新标签页打开成功");
};
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
domUtils.off(_unsafeWindow, "blur", blurEvent, {
capture: true,
});
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "info", "等待页面失去焦点...");
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
domUtils.on(_unsafeWindow, "blur", blurEvent, {
capture: true,
once: true,
});
await data.fn("https://www.example.com/", {
active: true,
});
timeId = setTimeoutLog(() => {
domUtils.off(_unsafeWindow, "blur", blurEvent, {
capture: true,
});
TagUtil.setTag(container.$leftText, "error", "测试超时,未打开新标签页并获取焦点");
}, 3e3);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
}
}),
UIInfo(() => {
try {
return {
text: "测试调用返回值 .close()",
tag: "info",
afterRender(container) {
let $target = container.target;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "info", "等待调用 .close()");
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let result2 = await data.fn("https://www.example.com/");
if (result2 && typeof result2?.close === "function") {
timeId = setTimeoutLog(() => {
try {
result2.close();
TagUtil.setTag(container.$leftText, "success", "成功调用 .close()");
} catch (error) {
TagUtil.setTag(container.$leftText, "error", "调用 .close() 方法失败 " + error);
}
}, 1e3);
} else {
TagUtil.setTag(container.$leftText, "error", "返回对象中不支持 .close() 方法");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
}
}),
UIInfo(() => {
try {
return {
text: "测试监听关闭是否生效 .onclose",
tag: "info",
afterRender(container) {
let $target = container.target;
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
let timeId;
let timeId2;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId2);
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "info", "等待触发监听 .onclose");
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let result2 = await data.fn("https://www.example.com/");
if (typeof result2 === "object" && result2 != null) {
result2.onclose = () => {
clearTimeout(timeId);
clearTimeout(timeId2);
TagUtil.setTag(container.$leftText, "success", "成功触发 .onclose");
};
}
if (result2 && typeof result2?.close === "function") {
timeId = setTimeoutLog(() => {
try {
result2.close();
timeId2 = setTimeoutLog(() => {
TagUtil.setTag(container.$leftText, "error", "测试超时,未触发回调 .onclose");
}, 2e3);
} catch (error) {
TagUtil.setTag(container.$leftText, "error", "调用 .close() 方法失败 " + error);
}
}, 1e3);
} else {
TagUtil.setTag(container.$leftText, "error", "返回对象中不支持 .close() 方法");
}
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
}
})
);
});
}
return result;
}
}
class ApiTest_registerMenuCommand extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_registerMenuCommand === "function";
}
getApiName() {
return "GM_registerMenuCommand";
}
getAsyncApiOption() {
return {
name: "GM.registerMenuCommand",
isSupport: this.isSupportGM() && typeof _GM.registerMenuCommand === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_registerMenuCommand(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.registerMenuCommand,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.formList.push(
UIInfo(() => {
try {
return {
text: "注册菜单 ==> Test Menu",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
let intervalId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
clearInterval(intervalId);
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let intervalCheckCount = 10;
let setCheckText = () => {
let result2 = `已执行注册菜单,请在${intervalCheckCount}s内点击菜单项`;
intervalCheckCount--;
return result2;
};
TagUtil.setTag(container.$leftText, "info", setCheckText());
intervalId = setInterval(() => {
TagUtil.setTag(container.$leftText, "info", setCheckText());
}, 1e3);
timeId = setTimeoutLog(() => {
clearInterval(intervalId);
TagUtil.setTag(container.$leftText, "error", "测试超时,未触发回调");
}, 10 * 1e3);
const menuCommandId = await data.fn("Test Menu", (event2) => {
try {
clearInterval(intervalId);
clearTimeout(timeId);
TagUtil.clearTag(container.$leftText);
let checkResultText = [];
checkResultText.push({
tag: "success",
text: "支持注册菜单",
});
if (event2) {
checkResultText.push({
tag: "success",
text: "支持点击回调且有event参数",
});
} else {
checkResultText.push({
tag: "warn",
text: "支持点击回调但是没有event参数",
});
}
if (typeof menuCommandId === "number" || typeof menuCommandId === "string") {
checkResultText.push({
tag: "success",
text: "函数返回值是string|number",
});
} else {
checkResultText.push({
tag: "error",
text: "函数返回值不是string|number:" + typeof menuCommandId,
});
}
domUtils.html(
container.$leftText,
checkResultText.map((it) => `<p class="${it.tag}">${it.text}</p>`).join("\n")
);
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: "注册并更新菜单 ==> Test Update Menu",
description: "请自行验证是否成功更新菜单文字为:Test Update Menu Success!!!",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
const menuCommandId = await data.fn("Test Update Menu", (event2) => {});
qmsg.info("已注册菜单,3s后自动更新", {
timeout: 3e3,
});
clearTimeout(timeId);
timeId = setTimeoutLog(async () => {
await data.fn("Test Update Menu Success!!!", () => {}, {
id: menuCommandId,
});
qmsg.success("已执行更新菜单命令,请自行验证");
}, 3e3);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_removeValueChangeListener extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_removeValueChangeListener === "function";
}
getApiName() {
return "GM_removeValueChangeListener";
}
getAsyncApiOption() {
return {
name: "GM.removeValueChangeListener",
isSupport: this.isSupportGM() && typeof _GM.removeValueChangeListener === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_removeValueChangeListener(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.removeValueChangeListener,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
(() => {
let localStorageDataKey = apiName + "_key_1";
return UIInfo(() => {
return {
text: "测试移除监听器",
description: ``,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let tagTextList = [];
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
tagTextList = [];
TagUtil.setTag(container.$leftText, "info", "等待移除监听器");
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
let delaySetValue = utils.formatTime(Date.now());
let listenerId = _GM_addValueChangeListener(
localStorageDataKey,
function (key, oldValue, newValue, remote) {
console.log(arguments);
tagTextList.push({
tag: "error",
text: "未成功移除监听器",
});
TagUtil.setTagList(container.$leftText, tagTextList);
}
);
await data.fn(listenerId);
tagTextList.push({
tag: "success",
text: "支持移除监听器",
});
TagUtil.setTagList(container.$leftText, tagTextList);
_GM_setValue(localStorageDataKey, delaySetValue);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_saveTab extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_saveTab === "function";
}
getApiName() {
return "GM_saveTab";
}
getAsyncApiOption() {
return {
name: "GM.saveTab",
isSupport: this.isSupportGM() && typeof _GM.saveTab === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
],
};
if (this.isSupport()) {
result["forms"][1].forms.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("TODO"),
tag: "info",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
}
return result;
}
}
class ApiTest_setClipboard extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_setClipboard === "function";
}
getApiName() {
return "GM_setClipboard";
}
getAsyncApiOption() {
return {
name: "GM.setClipboard",
isSupport: this.isSupportGM() && typeof _GM.setClipboard === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
if (typeof args[2] === "function") {
const cb = args[2];
args[2] = (...args2) => {
cb(...args2);
resolve(void 0);
};
}
_GM_setClipboard(...args);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: async (...args) => {
const cb = args[2];
await _GM.setClipboard(...args);
if (typeof cb === "function") {
cb();
}
},
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.formList.push(
UIInfo(() => {
return {
text: "复制内容到剪贴板:Test " + data.name,
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
qmsg.info("等待3s内触发成功复制的回调");
timeId = setTimeoutLog(() => {
TagUtil.setTag(container.$leftText, "error", "不支持触发回调函数");
}, 3e3);
await data.fn("Test " + data.name, "text", () => {
clearTimeout(timeId);
TagUtil.setTag(container.$leftText, "success", "支持触发回调函数");
});
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
})
);
});
}
return result;
}
}
class ApiTest_setValue extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_setValue === "function";
}
getApiName() {
return "GM_setValue";
}
getAsyncApiOption() {
return {
name: "GM.setValue",
isSupport: this.isSupportGM() && typeof _GM.setValue === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_setValue(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.setValue,
formList: result["forms"][2].forms,
},
].forEach((data) => {
let apiNameTag = data.name;
data.formList.push(
...[
{
key: `Test ${apiNameTag} boolean`,
value: true,
text: function () {
return `存储boolean类型`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} number`,
value: 1,
text: function () {
return `存储number类型`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} string`,
value: "测试字符串",
text: function () {
return `存储string类型`;
},
desc: function () {
return `"${this.key}": "${this.value}"`;
},
},
{
key: `Test ${apiNameTag} undefined`,
value: void 0,
text: function () {
return `存储undefined类型`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} null`,
value: null,
text: function () {
return `存储object类型的null`;
},
desc: function () {
return `"${this.key}": ${this.value}`;
},
},
{
key: `Test ${apiNameTag} object`,
value: { "object key": "object value" },
text: function () {
return `存储object类型`;
},
desc: function () {
return `"${this.key}": ${JSON.stringify(this.value)}`;
},
},
].map((it) => {
return (() => {
let localStorageDataKey = it.key;
let localStorageDataValue = it.value;
return UIInfo(() => {
return {
text: it.text(),
description: it.desc(),
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
await data.fn(localStorageDataKey, localStorageDataValue);
qmsg.info("执行写入完毕,请自行查看是否成功写入");
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})();
})
);
});
}
return result;
}
}
class ApiTest_setValues extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_setValues === "function";
}
getApiName() {
return "GM_setValues";
}
getAsyncApiOption() {
return {
name: "GM.setValues",
isSupport: this.isSupportGM() && typeof _GM.setValues === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_setValues(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.setValues,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
(() => {
let localStorageDataValue = { foo: 1, bar: 2 };
return UIInfo(() => {
return {
text: "测试存储对象",
description: JSON.stringify(localStorageDataValue),
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
domUtils.on($button, "click", async (event) => {
domUtils.preventEvent(event);
try {
await data.fn(localStorageDataValue);
qmsg.info("执行写入完毕,请自行查看是否成功写入");
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
});
})()
);
});
}
return result;
}
}
class ApiTest_unregisterMenuCommand extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_unregisterMenuCommand === "function";
}
getApiName() {
return "GM_unregisterMenuCommand";
}
getAsyncApiOption() {
return {
name: "GM.unregisterMenuCommand",
isSupport: this.isSupportGM() && typeof _GM.unregisterMenuCommand === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
if (this.isSupport()) {
[
{
name: apiName,
fn: async (...args) => {
return new Promise((resolve) => {
const ret = _GM_unregisterMenuCommand(...args);
resolve(ret);
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
fn: _GM.unregisterMenuCommand,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.formList.push(
UIInfo(() => {
try {
return {
text: "注册并卸载菜单 ==> Test UnRegister Menu",
description: "请自行验证是否成功卸载菜单",
tag: "info",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击测试</span>
</button>
</div>
`,
false,
false
);
domUtils.after(container.$leftContainer, $button);
let timeId;
domUtils.on($button, "click", (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
const menuCommandId = _GM_registerMenuCommand("Test UnRegister Menu", (event2) => {});
qmsg.info("已注册菜单,10s后自动执行卸载", {
timeout: 10 * 1e3,
});
clearTimeout(timeId);
timeId = setTimeoutLog(async () => {
await data.fn(menuCommandId);
qmsg.success("已执行卸载菜单命令,请自行验证");
}, 10 * 1e3);
} catch (error) {
qmsg.error(error.toString(), { consoleLogContent: true });
}
});
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
class ApiTest_unsafeWindow extends ApiAsyncTestBase {
getApiName() {
return "unsafeWindow";
}
getAsyncApiOption() {
return void 0;
}
isSupport() {
return typeof _unsafeWindow === "object" && _unsafeWindow != null;
}
getUIOption() {
let apiName = this.getApiName();
let result = {
id: "aside-" + apiName,
title: apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
],
};
if (this.isSupport()) {
result["forms"][1].forms.push(
UIInfo(() => {
let key = "test-gm-window";
let flag = _monkeyWindow == _unsafeWindow;
_monkeyWindow[key] = key;
flag = typeof _unsafeWindow[key] !== "string";
Reflect.deleteProperty(_monkeyWindow, key);
if (flag) {
return {
text: "window已被Proxy代理",
tag: "success",
};
} else {
return {
text: "window未被Proxy代理,定义全局变量时会影响到页面变量",
tag: "warn",
};
}
})
);
}
return result;
}
}
class ApiTest_webRequest extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_webRequest === "function";
}
getApiName() {
return "GM_webRequest";
}
getAsyncApiOption() {
return {
name: "GM.webRequest",
isSupport: this.isSupportGM() && typeof _GM.webRequest === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
],
};
if (this.isSupport()) {
result["forms"][1].forms.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("TODO"),
tag: "info",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
}
return result;
}
}
class ApiTest_xmlHttpRequest extends ApiAsyncTestBase {
isSupport() {
return typeof _GM_xmlhttpRequest === "function";
}
getApiName() {
return "GM_xmlhttpRequest";
}
getAsyncApiOption() {
return {
name: "GM.xmlHttpRequest",
isSupport: this.isSupportGM() && typeof _GM.xmlHttpRequest === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName, `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: "支持 " + apiName,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
UIInfo(() =>
apiAsyncInfo.isSupport
? {
text: "支持 " + apiAsyncInfo.name,
tag: "success",
}
: {
text: "不支持 " + apiAsyncInfo.name,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
],
};
if (this.isSupport()) {
result["forms"][1].forms.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("TODO"),
tag: "info",
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
}
return result;
}
}
class ApiTest_GM extends ApiAsyncTestBase {
getApiName() {
return "GM";
}
getAsyncApiOption() {
return void 0;
}
isSupport() {
return typeof _GM === "object" && _GM != null;
}
getUIOption() {
return void 0;
}
}
class ApiTest_audio extends ApiAsyncTestBase {
isSupport() {
return (
(typeof _GM_audio === "object" || typeof _GM_audio === "function") &&
_GM_audio != null &&
typeof _GM_audio?.setMute === "function" &&
typeof _GM_audio?.getState === "function" &&
typeof _GM_audio?.addStateChangeListener === "function" &&
typeof _GM_audio?.removeStateChangeListener === "function"
);
}
getApiOption() {
let isSupport = this.isSupport();
return {
isSupport_setMute: isSupport && typeof _GM_audio?.setMute === "function",
isSupport_getState: isSupport && typeof _GM_audio?.getState === "function",
isSupport_addStateChangeListener: isSupport && typeof _GM_audio?.addStateChangeListener === "function",
isSupport_removeStateChangeListener: isSupport && typeof _GM_audio?.removeStateChangeListener === "function",
};
}
getApiName() {
return "GM_audio";
}
getAsyncApiOption() {
let isSupportAsync =
this.isSupportGM() &&
(typeof _GM.audio === "object" || typeof _GM.audio === "function") &&
_GM.audio != null &&
typeof _GM.audio?.setMute === "function" &&
typeof _GM.audio?.getState === "function" &&
typeof _GM.audio?.addStateChangeListener === "function" &&
typeof _GM.audio?.removeStateChangeListener === "function";
return {
name: "GM.audio",
isSupport: isSupportAsync,
isSupport_setMute: isSupportAsync && typeof _GM.audio?.setMute === "function",
isSupport_getState: isSupportAsync && typeof _GM.audio?.getState === "function",
isSupport_addStateChangeListener: isSupportAsync && typeof _GM.audio?.addStateChangeListener === "function",
isSupport_removeStateChangeListener:
isSupportAsync && typeof _GM.audio?.removeStateChangeListener === "function",
};
}
getUIOption() {
let apiName = this.getApiName();
let apiInfo = this.getApiOption();
let apiAsyncInfo = this.getAsyncApiOption();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName + ".setMute", `${apiName} & ${apiAsyncInfo.name}`)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "函数测试",
forms: [
UIInfo(() =>
this.isSupport()
? {
text: `支持 ${apiName},类型:${typeof _GM_audio}`,
tag: "success",
}
: {
text: "不支持 " + apiName,
tag: "error",
}
),
],
},
{
type: "forms",
text: "功能测试",
forms: [],
},
{
type: "forms",
text: "功能测试(异步)",
forms: [],
},
],
};
let firstFormList = result["forms"][0].forms;
if (this.isSupport()) {
firstFormList.push(
UIInfo(() => {
return apiInfo.isSupport_setMute
? {
text: `支持 ${apiName}.setMute`,
tag: "success",
}
: {
text: `不支持 ${apiName}.setMute`,
tag: "error",
};
}),
UIInfo(() => {
return apiInfo.isSupport_getState
? {
text: `支持 ${apiName}.getState`,
tag: "success",
}
: {
text: `不支持 ${apiName}.getState`,
tag: "error",
};
}),
UIInfo(() => {
return apiInfo.isSupport_addStateChangeListener
? {
text: `支持 ${apiName}.addStateChangeListener`,
tag: "success",
}
: {
text: `不支持 ${apiName}.addStateChangeListener`,
tag: "error",
};
}),
UIInfo(() => {
return apiInfo.isSupport_removeStateChangeListener
? {
text: `支持 ${apiName}.removeStateChangeListener`,
tag: "success",
}
: {
text: `不支持 ${apiName}.removeStateChangeListener`,
tag: "error",
};
})
);
}
if (apiAsyncInfo.isSupport) {
firstFormList.push(
UIInfo(() => {
return apiAsyncInfo.isSupport_setMute
? {
text: `支持 ${apiAsyncInfo.name}.setMute`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.setMute`,
tag: "error",
};
}),
UIInfo(() => {
return apiAsyncInfo.isSupport_getState
? {
text: `支持 ${apiAsyncInfo.name}.getState`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.getState`,
tag: "error",
};
}),
UIInfo(() => {
return apiAsyncInfo.isSupport_addStateChangeListener
? {
text: `支持 ${apiAsyncInfo.name}.addStateChangeListener`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.addStateChangeListener`,
tag: "error",
};
}),
UIInfo(() => {
return apiAsyncInfo.isSupport_removeStateChangeListener
? {
text: `支持 ${apiAsyncInfo.name}.removeStateChangeListener`,
tag: "success",
}
: {
text: `不支持 ${apiAsyncInfo.name}.removeStateChangeListener`,
tag: "error",
};
})
);
} else {
firstFormList.push(
UIInfo(() => {
return { text: "不支持 " + apiAsyncInfo.name, tag: "error" };
})
);
}
if (this.isSupport()) {
[
{
name: apiName,
setMute: async (...args) => {
return new Promise((resolve, reject) => {
const [details, cb] = args;
_GM_audio.setMute(details, (error) => {
if (error) {
reject(error);
} else {
resolve(void 0);
}
});
});
},
getState: async (...args) => {
return new Promise((resolve, reject) => {
const [details, cb] = args;
_GM_audio.getState((info) => {
if (!info) reject(new Error("failed to read state"));
resolve(info);
});
});
},
addStateChangeListener: async (...args) => {
return new Promise((resolve, reject) => {
const [cb] = args;
_GM_audio.addStateChangeListener(cb, (err) => {
if (err) {
reject(err);
} else {
resolve(void 0);
}
});
});
},
removeStateChangeListener: async (...args) => {
return new Promise((resolve, reject) => {
const [cb] = args;
_GM_audio.removeStateChangeListener(cb, (err) => {
if (err) {
reject(err);
} else {
resolve(void 0);
}
});
});
},
formList: result["forms"][1].forms,
},
{
name: apiAsyncInfo.name,
setMute: async (...args) => {
const [details] = args;
const stat = await _GM.audio?.setMute(details);
return stat;
},
getState: async (...args) => {
const stat = await _GM.audio?.getState();
if (typeof stat === "object" && stat != null) {
if (typeof stat?.isMuted !== "boolean") {
throw new Error("GM.audio.getState 返回值类型错误");
}
return stat;
} else {
throw new Error("返回值不是一个对象");
}
},
addStateChangeListener: _GM.audio?.addStateChangeListener,
removeStateChangeListener: _GM.audio?.removeStateChangeListener,
formList: result["forms"][2].forms,
},
].forEach((data) => {
data.name;
data.formList.push(
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试设置当前tab静音"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
const stat = await data.setMute({ isMuted: true });
console.log(data.name + ".setMute result:", stat);
if (stat === void 0) {
TagUtil.setTag(container.$leftText, "success", "执行成功");
} else {
TagUtil.setTag(container.$leftText, "warn", "执行成功,但返回值类型不同:" + stat);
}
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试取消当前tab静音"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
const state = await data.setMute({ isMuted: false });
console.log(data.name + ".setMute result:", state);
if (state === void 0) {
TagUtil.setTag(container.$leftText, "success", "执行成功");
} else {
TagUtil.setTag(container.$leftText, "warn", "执行成功,但返回值类型不同:" + state);
}
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("获取当前tab静音状态信息"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
const stateInfo = await data.getState();
console.log(data.name + ".getState result:", stateInfo);
if (typeof stateInfo === "object" && stateInfo !== null) {
const propSupport = [];
if (typeof stateInfo?.isMuted === "boolean") {
propSupport.push(
`
<p class="support-info success">支持属性:isMuted,当前类型:${typeof stateInfo?.isMuted}</p>
`
);
} else {
propSupport.push(
`
<p class="support-info error">不支持属性:isMuted,当前类型:${typeof stateInfo?.isMuted}</p>
`
);
}
if (
("muteReason" in stateInfo && typeof stateInfo?.muteReason === "string") ||
stateInfo?.muteReason === void 0
) {
propSupport.push(
`
<p class="support-info success">支持属性:muteReason,当前类型:${typeof stateInfo?.muteReason}</p>
`
);
} else {
propSupport.push(
`
<p class="support-info error">不支持属性:muteReason,当前类型:${typeof stateInfo?.muteReason}</p>
`
);
}
if (typeof stateInfo?.isAudible === "boolean") {
propSupport.push(
`
<p class="support-info success">支持属性:isAudible,当前类型:${typeof stateInfo?.isAudible}</p>
`
);
} else {
propSupport.push(
`
<p class="support-info error">不支持属性:isAudible,当前类型:${typeof stateInfo?.isAudible}</p>
`
);
}
TagUtil.setTag(container.$leftText, "success", propSupport.join("\n"));
} else {
TagUtil.setTag(container.$leftText, "error", "返回值类型错误:" + typeof stateInfo);
}
domUtils.text(container.$leftDesc, this.text);
domUtils.show(container.$leftDesc, false);
alert(JSON.stringify(stateInfo, null, 4));
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试监听静音状态改变"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
let timeId;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
await data.addStateChangeListener((statusInfo) => {
console.log(data.name + ".addStateChangeListener callback change value:", statusInfo);
alert(JSON.stringify(statusInfo, null, 4));
});
await utils.sleep(500);
await data.setMute({ isMuted: true });
await utils.sleep(500);
await data.setMute({ isMuted: false });
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试移除监听器"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
let isSuccessRemove = true;
let $loading;
domUtils.on($button, "click", async (event) => {
try {
domUtils.preventEvent(event);
let listener = (statusInfo) => {
isSuccessRemove = false;
qmsg.error("移除监听器失败");
};
$loading = qmsg.loading("处理监听器中...");
await data.addStateChangeListener(listener);
await data.removeStateChangeListener(listener);
$loading.setText("等待500ms,设置当前Tab静音");
await utils.sleep(500);
await data.setMute({ isMuted: true });
$loading.setText("等待500ms,设置当前Tab取消静音");
await utils.sleep(500);
await data.setMute({ isMuted: false });
$loading.close();
if (isSuccessRemove) {
qmsg.success("移除监听器成功");
}
} catch (error) {
$loading?.close();
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
})
);
});
}
return result;
}
}
const GMTotal = {
unsafeWindow: new ApiTest_unsafeWindow(),
GM: new ApiTest_GM(),
addElement: new ApiTest_addElement(),
addStyle: new ApiTest_addStyle(),
download: new ApiTest_download(),
getResourceText: new ApiTest_getResourceText(),
getResourceUrl: new ApiTest_getResourceUrl(),
info: new ApiTest_info(),
log: new ApiTest_log(),
notification: new ApiTest_notification(),
openInTab: new ApiTest_openInTab(),
registerMenuCommand: new ApiTest_registerMenuCommand(),
unregisterMenuCommand: new ApiTest_unregisterMenuCommand(),
setClipboard: new ApiTest_setClipboard(),
getTab: new ApiTest_getTab(),
saveTab: new ApiTest_saveTab(),
getTabs: new ApiTest_getTabs(),
setValue: new ApiTest_setValue(),
getValue: new ApiTest_getValue(),
deleteValue: new ApiTest_deleteValue(),
listValues: new ApiTest_listValues(),
setValues: new ApiTest_setValues(),
getValues: new ApiTest_getValues(),
deleteValues: new ApiTest_deleteValues(),
addValueChangeListener: new ApiTest_addValueChangeListener(),
removeValueChangeListener: new ApiTest_removeValueChangeListener(),
xmlHttpRequest: new ApiTest_xmlHttpRequest(),
webRequest: new ApiTest_webRequest(),
cookie: new ApiTest_cookie(),
audio: new ApiTest_audio(),
};
const LocalStorageApi = {
$storageKey: "gm-api-test-storage-config",
set(key, value) {
let config = window.localStorage.getItem(LocalStorageApi.$storageKey) ?? "{}";
let configJSON = utils.toJSON(config);
configJSON[key] = value;
window.localStorage.setItem(
LocalStorageApi.$storageKey,
JSON.stringify(configJSON, (key2, value2) => {
return typeof value2 === "function" ? value2.tString() : value2;
})
);
},
get(key, defaultValue) {
let config = window.localStorage.getItem(LocalStorageApi.$storageKey) ?? "{}";
let configJSON = utils.toJSON(config);
return configJSON[key] ?? defaultValue;
},
delete(key) {
let config = window.localStorage.getItem(LocalStorageApi.$storageKey) ?? "{}";
let configJSON = utils.toJSON(config);
Reflect.deleteProperty(configJSON, key);
window.localStorage.setItem(
LocalStorageApi.$storageKey,
JSON.stringify(configJSON, (key2, value) => {
return typeof value === "function" ? value.tString() : value;
})
);
},
};
const StorageApi = {
set(key, value) {
if (GMTotal.setValue.isSupport() && GMTotal.getValue.isSupport() && GMTotal.deleteValue.isSupport()) {
_GM_setValue(key, value);
} else {
LocalStorageApi.set(key, value);
}
},
get(key, defaultValue) {
if (GMTotal.setValue.isSupport() && GMTotal.getValue.isSupport() && GMTotal.deleteValue.isSupport()) {
return _GM_getValue(key, defaultValue);
} else {
return LocalStorageApi.get(key, defaultValue);
}
},
delete(key) {
if (GMTotal.setValue.isSupport() && GMTotal.getValue.isSupport() && GMTotal.deleteValue.isSupport()) {
_GM_deleteValue(key);
} else {
LocalStorageApi.delete(key);
}
},
};
const Component_Common = () => {
let supportApiNameList = [];
let notSupportApiNameList = [];
Object.keys(GMTotal).forEach((keyName) => {
let value = GMTotal[keyName];
let apiName = value.getApiName();
let isSupport = value.isSupport();
let apiAsyncInfo = value.getAsyncApiOption();
if (isSupport) {
supportApiNameList.push({
name: apiName,
isSupport,
});
} else {
notSupportApiNameList.push({
name: apiName,
isSupport,
});
}
if (apiAsyncInfo) {
if (apiAsyncInfo.isSupport) {
supportApiNameList.push({
name: apiAsyncInfo.name,
isSupport: apiAsyncInfo.isSupport,
leftTargetSelector: "#aside-" + apiName,
});
} else {
notSupportApiNameList.push({
name: apiAsyncInfo.name,
isSupport: apiAsyncInfo.isSupport,
leftTargetSelector: "#aside-" + apiName,
});
}
}
});
let createFeatureItem = (config) => {
let $item = domUtils.createElement("div", {
className: "gm-api-features-item",
innerHTML: `
<div class="gm-api-features-item__label">${config.name}</div>
<div class="gm-api-features-item__value">
<span style="font-size: 16px; font-weight: 700;">
${
config.isSupport
? `
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512" fill="currentColor">
<path d="M448 71.9c-17.3-13.4-41.5-9.3-54.1 9.1L214 344.2l-99.1-107.3c-14.6-16.6-39.1-17.4-54.7-1.8-15.6 15.5-16.4 41.6-1.7 58.1 0 0 120.4 133.6 137.7 147 17.3 13.4 41.5 9.3 54.1-9.1l206.3-301.7c12.6-18.5 8.7-44.2-8.6-57.5z" fill="#3b9f04"></path>
</svg>
`
: `
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512" fill="currentColor">
<path fill="#FF473E" d="m330.443 256l136.765-136.765c14.058-14.058 14.058-36.85 0-50.908l-23.535-23.535c-14.058-14.058-36.85-14.058-50.908 0L256 181.557L119.235 44.792c-14.058-14.058-36.85-14.058-50.908 0L44.792 68.327c-14.058 14.058-14.058 36.85 0 50.908L181.557 256L44.792 392.765c-14.058 14.058-14.058 36.85 0 50.908l23.535 23.535c14.058 14.058 36.85 14.058 50.908 0L256 330.443l136.765 136.765c14.058 14.058 36.85 14.058 50.908 0l23.535-23.535c14.058-14.058 14.058-36.85 0-50.908L330.443 256z"></path>
</svg>
`
}
</span>
</div>
`,
});
domUtils.on($item, "click", (event) => {
domUtils.preventEvent(event);
let shadowRoot = $item.getRootNode();
let selector = utils.isNotNull(config.leftTargetSelector) ? config.leftTargetSelector : "#aside-" + config.name;
let $left = shadowRoot.querySelector(selector);
if ($left) {
$left.click();
$left.scrollIntoView({ behavior: "smooth" });
}
});
return $item;
};
return {
id: "component-common",
title: "通用",
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === "component-common";
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, "component-common");
},
forms: [
{
type: "forms",
text: "@run-at document-start<br>注:注入速度等级越低,注入的速度越快<br>范围:0~4",
forms: [
UIInfo(() => {
return {
text: CommonUtil2.escapeHtml(injectDocumentTime),
tag: "info",
};
}),
],
},
{
type: "forms",
text: "特性",
afterAddToUListCallBack(formConfig, container) {
container.formHeaderDivElement.style.fontSize = "1.2em";
container.formHeaderDivElement.style.fontWeight = "700";
},
forms: [],
},
{
type: "forms",
text: "不支持列表",
afterAddToUListCallBack(formConfig, container) {
container.formHeaderDivElement.style.color = "rgb(216, 30, 6)";
container.formHeaderDivElement.style.fontWeight = "600";
if (notSupportApiNameList.length === 0) {
container.formContainerListElement?.remove();
}
},
forms: [
{
type: "own",
getLiElementCallBack(liElement) {
let $container = domUtils.createElement("div", {
className: "gm-api-features-not-support",
});
let $fragment = document.createDocumentFragment();
notSupportApiNameList.forEach((config) => {
$fragment.append(createFeatureItem(config));
});
$container.appendChild($fragment);
liElement.appendChild($container);
return liElement;
},
},
],
},
{
type: "forms",
text: "支持列表",
afterAddToUListCallBack(formConfig, container) {
container.formHeaderDivElement.style.fontWeight = "600";
if (supportApiNameList.length === 0) {
container.formContainerListElement?.remove();
}
},
forms: [
{
type: "own",
getLiElementCallBack(liElement) {
let $container = domUtils.createElement("div", {
className: "gm-api-features-support",
});
let $fragment = document.createDocumentFragment();
supportApiNameList.forEach((config) => {
$fragment.append(createFeatureItem(config));
});
$container.appendChild($fragment);
liElement.appendChild($container);
return liElement;
},
},
],
},
],
};
};
class GrantTest_onurlchange extends ApiTestBase {
getApiName() {
return "window.onurlchange ";
}
getAsyncApiOption() {
return void 0;
}
isSupport() {
return true;
}
getUIOption() {
let apiName = this.getApiName();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "功能测试",
forms: [
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试window.onurlchange"),
tag: "info",
description: "点击按钮进行测试",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
let urlChangeEvent = (info) => {
clearTimeout(timeId);
console.log("urlchange event info ==> ", info);
qmsg.success("urlchange event ==> url is changed");
};
let timeId;
domUtils.on($button, "click", (event) => {
try {
domUtils.preventEvent(event);
clearTimeout(timeId);
if (_monkeyWindow.onurlchange === null) {
_monkeyWindow.removeEventListener("urlchange", urlChangeEvent);
_monkeyWindow.addEventListener("urlchange", urlChangeEvent);
window.history.pushState({}, "", "#/onurlchange");
timeId = setTimeout(() => {
qmsg.error("urlchange event is not trigger");
}, 1e3);
} else {
qmsg.error("window.onurlchange is not null");
}
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
],
},
],
};
return result;
}
}
class GrantTest_close extends ApiTestBase {
getApiName() {
return "window.close ";
}
getAsyncApiOption() {
return void 0;
}
isSupport() {
return true;
}
getUIOption() {
let apiName = this.getApiName();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "功能测试",
forms: [
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试window.close"),
tag: "info",
description: "点击按钮执行该函数",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
domUtils.on($button, "click", (event) => {
domUtils.preventEvent(event);
try {
_monkeyWindow.close();
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
],
},
],
};
return result;
}
}
class GrantTest_focus extends ApiTestBase {
getApiName() {
return "window.focus ";
}
getAsyncApiOption() {
return void 0;
}
isSupport() {
return true;
}
getUIOption() {
let apiName = this.getApiName();
let result = {
id: "aside-" + apiName,
title: "" + apiName,
headerTitle: `${TamperMonkeyUtils.getApiDocUrl(apiName)}`,
scrollToDefaultView: true,
isDefault() {
return StorageApi.get(PanelKeyConfig.asideLastVisit) === apiName;
},
clickCallback(data) {
StorageApi.set(PanelKeyConfig.asideLastVisit, apiName);
},
forms: [
{
type: "forms",
text: "功能测试",
forms: [
UIInfo(() => {
try {
return {
text: CommonUtil2.escapeHtml("测试window.focus"),
tag: "info",
description: "点击按钮执行该函数",
afterRender(container) {
let $button = domUtils.toElement(
`
<div class="pops-panel-button pops-panel-button-no-icon">
<button class="pops-panel-button_inner" type="button" data-type="default">
<i class="pops-bottom-icon" is-loading="false"></i>
<span class="pops-panel-button-text">点击执行</span>
</button>
</div>
`,
false,
false
);
let blurEvent = () => {
setTimeout(() => {
_monkeyWindow.focus();
}, 3e3);
};
domUtils.on($button, "click", (event) => {
domUtils.preventEvent(event);
window.removeEventListener("blur", blurEvent, {
capture: true,
});
window.addEventListener("blur", blurEvent, {
capture: true,
once: true,
});
try {
qmsg.info("请切换至其它Tab页面,切换完毕3秒后会自动调用该函数");
} catch (error) {
qmsg.error(error.toString(), {
consoleLogContent: true,
});
}
});
domUtils.after(container.$leftContainer, $button);
},
};
} catch (error) {
console.error(error);
return {
text: "执行错误 " + error,
tag: "error",
};
} finally {
}
}),
],
},
],
};
return result;
}
}
if (Panel.isTopWindow()) {
let showPanel = () => {
Panel.showPanel(PanelContent.getConfig(0), void 0, void 0, true);
};
let defaultMenuOption = PanelMenu.getMenuOption(0);
defaultMenuOption.callback = () => {
showPanel();
};
PanelMenu.updateMenuOption(defaultMenuOption);
let configList = [Component_Common()];
Object.keys(GMTotal).forEach((keyName) => {
let value = GMTotal[keyName];
let option = value.getUIOption();
if (option) {
configList.push(option);
}
});
configList.push(new GrantTest_onurlchange().getUIOption());
configList.push(new GrantTest_close().getUIOption());
configList.push(new GrantTest_focus().getUIOption());
PanelContent.addContentConfig(configList);
Panel.$data.panelConfig = {
style: `
.success{
color: green;
}
.error{
color: red;
}
.warn,.warning{
color: orange;
}
.info{
color: #909090;
}
.support-info{
font-weight: bold;
}
.gm-api-features-not-support,
.gm-api-features-support{
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.gm-api-features-item{
display: flex;
align-items: center;
width: 200px;
max-width: 200px !important;
justify-content: space-between;
cursor: pointer;
transition: all ease-out .1s;
padding: 8px 16px;
border-radius: 4px;
font-size: 14px;
}
.gm-api-features-item:hover{
box-shadow: 0 2px 5px 3px #0000001a;
}
.gm-api-features-item__label{
}
.gm-api-features-item__value span{
display: flex;
align-items: center;
}
`,
};
Panel.init();
showPanel();
}
})();