xframelib 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -10
- package/dist/assets/worker-XXTEA-BTkdAuVi.js +6 -0
- package/dist/assets/worker-webcache-JMcB6mHT.js +6 -0
- package/dist/assets/worker-xmath-DUFCrWrO.js +15 -0
- package/dist/controls/vuewindow/window/index.vue.d.ts +1 -1
- package/dist/index.css +53 -53
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/public/mitm.html +2 -2
- package/dist/utils/WebCacheTool.d.ts +72 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/workers/index.d.ts +7 -1
- package/dist/workers/worker-webcache.d.ts +13 -0
- package/dist/workerservice/frontWorker.d.ts +3 -0
- package/dist/workerservice/index.d.ts +9 -0
- package/package.json +71 -69
- package/dist/assets/worker-XXTEA-lcP6QMJU.js +0 -6
- package/dist/assets/worker-xmath-C-79xQSy.js +0 -15
package/dist/public/mitm.html
CHANGED
|
@@ -161,10 +161,10 @@
|
|
|
161
161
|
return sw.postMessage(data, transferable);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if (
|
|
164
|
+
if (globalThis.opener) {
|
|
165
165
|
// The opener can't listen to onload event, so we need to help em out!
|
|
166
166
|
// (telling them that we are ready to accept postMessage's)
|
|
167
|
-
|
|
167
|
+
globalThis.opener.postMessage('StreamSaver::loadedPopup', '*');
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (navigator.serviceWorker) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LRUCache } from 'lru-cache';
|
|
2
|
+
declare class WebCacheTool {
|
|
3
|
+
static defaultOptions: {
|
|
4
|
+
max: number;
|
|
5
|
+
maxAge: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 当前默认集合对象
|
|
9
|
+
*/
|
|
10
|
+
static readonly cache: LRUCache<{}, {}, unknown>;
|
|
11
|
+
static createCache(options?: any): LRUCache<{}, {}, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* 加入缓存
|
|
14
|
+
* @param key
|
|
15
|
+
* @param value
|
|
16
|
+
* @param cacheObj
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
static set(key: string, value: any, cacheObj?: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* 获取某个缓存值
|
|
22
|
+
* @param key
|
|
23
|
+
* @param cacheObj
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
static get(key: string, cacheObj?: any): any;
|
|
27
|
+
/**
|
|
28
|
+
* 删除某KEY的缓存
|
|
29
|
+
* @param key
|
|
30
|
+
* @param cacheObj
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
static remove(key: string, cacheObj?: any): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 是否包含某个KEY
|
|
36
|
+
* @param key
|
|
37
|
+
* @param cacheObj
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static has(key: string, cacheObj?: any): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 获取已经存储的个数
|
|
43
|
+
* @param cacheObj
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
static count(cacheObj?: any): number;
|
|
47
|
+
/**
|
|
48
|
+
* 最大数量
|
|
49
|
+
* @param cacheObj
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
static maxSize(cacheObj?: any): number;
|
|
53
|
+
/**
|
|
54
|
+
* 获取缓存,但不更新时间
|
|
55
|
+
* @param key
|
|
56
|
+
* @param cacheObj
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
static peek(key: string, cacheObj?: any): any;
|
|
60
|
+
/**
|
|
61
|
+
* 返回所有键集合
|
|
62
|
+
* @param cacheObj
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
static keys(cacheObj?: any): Generator<any, void, unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* 清空缓存
|
|
68
|
+
* @param cacheObj
|
|
69
|
+
*/
|
|
70
|
+
static clear(cacheObj?: any): void;
|
|
71
|
+
}
|
|
72
|
+
export default WebCacheTool;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { default as XXTEA } from './XXTEA';
|
|
|
9
9
|
import { default as WaterMark } from './WaterMark';
|
|
10
10
|
import { GetSignalRClient } from './SignalrClient';
|
|
11
11
|
import { default as iconv } from 'iconv-lite';
|
|
12
|
+
import { default as WebCacheTool } from './WebCacheTool';
|
|
12
13
|
export * from './Color';
|
|
13
14
|
export * from './FileDownload';
|
|
14
15
|
export * from './Time';
|
|
@@ -26,4 +27,4 @@ export * from './WidgetsTool';
|
|
|
26
27
|
export * from './CommonTool';
|
|
27
28
|
export * from './FilenameUtils';
|
|
28
29
|
export * from './AutoUpdate';
|
|
29
|
-
export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool };
|
|
30
|
+
export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool, WebCacheTool };
|
package/dist/workers/index.d.ts
CHANGED
|
@@ -10,4 +10,10 @@ declare const xxteaWorker: {
|
|
|
10
10
|
declare const xmathWorker: {
|
|
11
11
|
readonly [x: number]: Worker;
|
|
12
12
|
} & import('comlink').RemoteObject<typeof import("./worker-xmath")> & import('comlink').ProxyMethods;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 前端缓存层-webworker
|
|
15
|
+
*/
|
|
16
|
+
declare const webCacheWorker: {
|
|
17
|
+
readonly [x: number]: Worker;
|
|
18
|
+
} & import('comlink').RemoteObject<typeof import("./worker-webcache")> & import('comlink').ProxyMethods;
|
|
19
|
+
export { xmathWorker, xxteaWorker, webCacheWorker };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LRUCache } from 'lru-cache';
|
|
2
|
+
declare function createCache(cacheKey: string, options?: any): Promise<LRUCache<{}, {}, unknown>>;
|
|
3
|
+
declare function getCacheObject(cacheObjKey?: string): Promise<LRUCache<any, any, unknown> | undefined>;
|
|
4
|
+
declare function set(key: string, value: any, cacheObjKey?: string): Promise<boolean>;
|
|
5
|
+
declare function get(key: string, cacheObjKey?: string): Promise<any>;
|
|
6
|
+
declare function remove(key: string, cacheObjKey?: string): Promise<boolean | undefined>;
|
|
7
|
+
declare function has(key: string, cacheObjKey?: string): Promise<boolean>;
|
|
8
|
+
declare function count(cacheObjKey?: string): Promise<number>;
|
|
9
|
+
declare function maxSize(cacheObjKey?: string): Promise<number>;
|
|
10
|
+
declare function peek(key: string, cacheObjKey?: string): Promise<any>;
|
|
11
|
+
declare function clear(cacheObjKey?: string): Promise<boolean>;
|
|
12
|
+
declare function keys(cacheObjKey?: string): Promise<Generator<any, void, unknown> | undefined>;
|
|
13
|
+
export { clear, count, maxSize, createCache, get, getCacheObject, has, keys, peek, remove, set, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { initWorker } from './frontWorker';
|
|
2
|
+
/**
|
|
3
|
+
* 注册 webworker的相关方法
|
|
4
|
+
* @param components Webworker Service的相关方法
|
|
5
|
+
* @param worker
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
declare function registerWorkerSerivces(components: Record<string, unknown>, worker: Worker): any;
|
|
9
|
+
export { initWorker, registerWorkerSerivces };
|
package/package.json
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xframelib",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"common": "dist/index.cjs",
|
|
7
|
-
"typings": "dist/index.d.ts",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "vite build",
|
|
11
|
-
"lib": "rollup -c ",
|
|
12
|
-
"clean": "rimraf dist && rimraf package-lock.json && rimraf node_modules/.cache && rimraf node_modules/.vite"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"hprose",
|
|
16
|
-
"rpc",
|
|
17
|
-
"typescript"
|
|
18
|
-
],
|
|
19
|
-
"author": {
|
|
20
|
-
"name": "zorrowm",
|
|
21
|
-
"email": "zorrowm@126.com"
|
|
22
|
-
},
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "https://github.com/zorrowm/vue-widget-template.git"
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://zorrowm.github.io/doc/template.html",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@hprose/io": "^3.0.10",
|
|
31
|
-
"@hprose/rpc-core": "^3.0.10",
|
|
32
|
-
"@hprose/rpc-html5": "^3.0.10",
|
|
33
|
-
"@iconify/
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@rollup/plugin-
|
|
48
|
-
"@rollup/plugin-
|
|
49
|
-
"@rollup/plugin-
|
|
50
|
-
"@rollup/plugin-
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"rollup-plugin-
|
|
56
|
-
"rollup-plugin-
|
|
57
|
-
"rollup-plugin-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"vite
|
|
63
|
-
"vite-plugin-
|
|
64
|
-
"vite-plugin-
|
|
65
|
-
"vite-plugin-
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "xframelib",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "积累的前端开发基础库,来源于项目,服务于项目。",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"common": "dist/index.cjs",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "vite build",
|
|
11
|
+
"lib": "rollup -c ",
|
|
12
|
+
"clean": "rimraf dist && rimraf package-lock.json && rimraf node_modules/.cache && rimraf node_modules/.vite"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"hprose",
|
|
16
|
+
"rpc",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "zorrowm",
|
|
21
|
+
"email": "zorrowm@126.com"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/zorrowm/vue-widget-template.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://zorrowm.github.io/doc/template.html",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@hprose/io": "^3.0.10",
|
|
31
|
+
"@hprose/rpc-core": "^3.0.10",
|
|
32
|
+
"@hprose/rpc-html5": "^3.0.10",
|
|
33
|
+
"@iconify-icons/ant-design": "^1.2.7",
|
|
34
|
+
"@iconify/vue": "^5.0.0",
|
|
35
|
+
"@microsoft/signalr": "^9.0.6",
|
|
36
|
+
"axios": "^1.11.0",
|
|
37
|
+
"fflate": "^0.8.2",
|
|
38
|
+
"iconv-lite": "^0.6.3",
|
|
39
|
+
"localforage": "^1.10.0",
|
|
40
|
+
"loglevel": "^1.9.2",
|
|
41
|
+
"lru-cache": "^11.1.0",
|
|
42
|
+
"qs": "^6.14.0",
|
|
43
|
+
"spark-md5": "^3.0.2",
|
|
44
|
+
"xhr": "^2.6.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
48
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
49
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
50
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
51
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
52
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
53
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
54
|
+
"esbuild": "^0.25.8",
|
|
55
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
56
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
57
|
+
"rollup-plugin-scss": "^4.0.1",
|
|
58
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
59
|
+
"rollup-plugin-vue": "^6.0.0",
|
|
60
|
+
"sass": "^1.90.0",
|
|
61
|
+
"typescript": "^5.9.2",
|
|
62
|
+
"vite": "^7.1.1",
|
|
63
|
+
"vite-plugin-comlink": "^5.3.0",
|
|
64
|
+
"vite-plugin-commonjs": "^0.10.4",
|
|
65
|
+
"vite-plugin-dts": "^4.5.4",
|
|
66
|
+
"vite-plugin-node-polyfills": "^0.24.0",
|
|
67
|
+
"vite-plugin-static-copy": "^3.1.1",
|
|
68
|
+
"vue": "^3.5.18",
|
|
69
|
+
"vue-router": "^4.5.1"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
const e=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),t=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),o=e=>"object"==typeof e&&null!==e||"function"==typeof e,i={canHandle:r=>o(r)&&r[e],serialize(e){const{port1:r,port2:n}=new MessageChannel;return c(e,r),[n,[n]]},deserialize:e=>(e.start(),function(e,r){const n=new Map;return e.addEventListener("message",(function(e){const{data:r}=e;if(!r||!r.id)return;const t=n.get(r.id);if(t)try{t(r)}finally{n.delete(r.id)}})),p(e,n,[],r)}(e))},s=new Map([["proxy",i],["throw",{canHandle:e=>o(e)&&a in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function c(r,n=globalThis,o=["*"]){n.addEventListener("message",(function i(s){if(!s||!s.data)return;if(!function(e,r){for(const n of e){if(r===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(r))return!0}return!1}(o,s.origin))return void console.warn(`Invalid origin '${s.origin}' for comlink proxy`);const{id:f,type:l,path:g}=Object.assign({path:[]},s.data),h=(s.data.argumentList||[]).map(v);let p;try{const n=g.slice(0,-1).reduce(((e,r)=>e[r]),r),t=g.reduce(((e,r)=>e[r]),r);switch(l){case"GET":p=t;break;case"SET":n[g.slice(-1)[0]]=v(s.data.value),p=!0;break;case"APPLY":p=t.apply(n,h);break;case"CONSTRUCT":p=function(r){return Object.assign(r,{[e]:!0})}(new t(...h));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;c(r,n),p=function(e,r){return d.set(e,r),e}(e,[e])}break;case"RELEASE":p=void 0;break;default:return}}catch(e){p={value:e,[a]:0}}Promise.resolve(p).catch((e=>({value:e,[a]:0}))).then((e=>{const[a,o]=w(e);n.postMessage(Object.assign(Object.assign({},a),{id:f}),o),"RELEASE"===l&&(n.removeEventListener("message",i),u(n),t in r&&"function"==typeof r[t]&&r[t]())})).catch((e=>{const[r,t]=w({value:new TypeError("Unserializable return value"),[a]:0});n.postMessage(Object.assign(Object.assign({},r),{id:f}),t)}))})),n.start&&n.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function f(e){if(e)throw new Error("Proxy has been released and is not useable")}function l(e){return m(e,new Map,{type:"RELEASE"}).then((()=>{u(e)}))}const g=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(g.get(e)||0)-1;g.set(e,r),0===r&&l(e)}));function p(e,t,a=[],o=function(){}){let i=!1;const s=new Proxy(o,{get(r,o){if(f(i),o===n)return()=>{!function(e){h&&h.unregister(e)}(s),l(e),t.clear(),i=!0};if("then"===o){if(0===a.length)return{then:()=>s};const r=m(e,t,{type:"GET",path:a.map((e=>e.toString()))}).then(v);return r.then.bind(r)}return p(e,t,[...a,o])},set(r,n,o){f(i);const[s,c]=w(o);return m(e,t,{type:"SET",path:[...a,n].map((e=>e.toString())),value:s},c).then(v)},apply(n,o,s){f(i);const c=a[a.length-1];if(c===r)return m(e,t,{type:"ENDPOINT"}).then(v);if("bind"===c)return p(e,t,a.slice(0,-1));const[u,l]=y(s);return m(e,t,{type:"APPLY",path:a.map((e=>e.toString())),argumentList:u},l).then(v)},construct(r,n){f(i);const[o,s]=y(n);return m(e,t,{type:"CONSTRUCT",path:a.map((e=>e.toString())),argumentList:o},s).then(v)}});return function(e,r){const n=(g.get(r)||0)+1;g.set(r,n),h&&h.register(e,r,e)}(s,e),s}function y(e){const r=e.map(w);return[r.map((e=>e[0])),(n=r.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const d=new WeakMap;function w(e){for(const[r,n]of s)if(n.canHandle(e)){const[t,a]=n.serialize(e);return[{type:"HANDLER",name:r,value:t},a]}return[{type:"RAW",value:e},d.get(e)||[]]}function v(e){switch(e.type){case"HANDLER":return s.get(e.name).deserialize(e.value);case"RAW":return e.value}}function m(e,r,n,t){return new Promise((a=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");r.set(o,a),e.start&&e.start(),e.postMessage(Object.assign({id:o},n),t)}))}let b=!0;try{String.fromCharCode.apply(String,[1,2])}catch(e){b=!1,Object.defineProperty(Array.prototype,"subarray",{value:Array.prototype.slice})}var E=2654435769;function S(e,r){var n=e.length,t=n<<2;if(r){var a=e[n-1];if(a<(t-=4)-3||a>t)return null;t=a}for(var o=new Uint8Array(t),i=0;i<t;++i)o[i]=e[i>>2]>>((3&i)<<3);return o}function C(e,r){var n,t=e.length,a=t>>2;3&t&&++a,r?(n=new Uint32Array(a+1))[a]=t:n=new Uint32Array(a);for(var o=0;o<t;++o)n[o>>2]|=e[o]<<((3&o)<<3);return n}function A(e){return 4294967295&e}function U(e,r,n,t,a,o){return(n>>>5^r<<2)+(r>>>3^n<<4)^(e^r)+(o[3&t^a]^n)}function k(e){if(e.length<16){var r=new Uint8Array(16);r.set(e),e=r}return e}function T(e){for(var r=e.length,n=new Uint8Array(3*r),t=0,a=0;a<r;a++){var o=e.charCodeAt(a);if(o<128)n[t++]=o;else if(o<2048)n[t++]=192|o>>6,n[t++]=128|63&o;else{if(!(o<55296||o>57343)){if(a+1<r){var i=e.charCodeAt(a+1);if(o<56320&&56320<=i&&i<=57343){var s=65536+((1023&o)<<10|1023&i);n[t++]=240|s>>18,n[t++]=128|s>>12&63,n[t++]=128|s>>6&63,n[t++]=128|63&s,a++;continue}}throw new Error("Malformed string")}n[t++]=224|o>>12,n[t++]=128|o>>6&63,n[t++]=128|63&o}}return n.subarray(0,t)}function M(e){var r=e.length;return 0===r?"":r<32767?function(e,r){for(var n=new Array(r),t=0,a=0,o=e.length;t<r&&a<o;t++){var i=e[a++];switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n[t]=i;break;case 12:case 13:if(!(a<o))throw new Error("Unfinished UTF-8 octet sequence");n[t]=(31&i)<<6|63&e[a++];break;case 14:if(!(a+1<o))throw new Error("Unfinished UTF-8 octet sequence");n[t]=(15&i)<<12|(63&e[a++])<<6|63&e[a++];break;case 15:if(!(a+2<o))throw new Error("Unfinished UTF-8 octet sequence");var s=((7&i)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++])-65536;if(!(0<=s&&s<=1048575))throw new Error("Character outside valid Unicode range: 0x"+s.toString(16));n[t++]=s>>10&1023|55296,n[t]=1023&s|56320;break;default:throw new Error("Bad UTF-8 encoding 0x"+i.toString(16))}}return t<r&&(n.length=t),String.fromCharCode.apply(String,n)}(e,r):function(e,r){for(var n=[],t=new Array(32768),a=0,o=0,i=e.length;a<r&&o<i;a++){var s=e[o++];switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t[a]=s;break;case 12:case 13:if(!(o<i))throw new Error("Unfinished UTF-8 octet sequence");t[a]=(31&s)<<6|63&e[o++];break;case 14:if(!(o+1<i))throw new Error("Unfinished UTF-8 octet sequence");t[a]=(15&s)<<12|(63&e[o++])<<6|63&e[o++];break;case 15:if(!(o+2<i))throw new Error("Unfinished UTF-8 octet sequence");var c=((7&s)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])-65536;if(!(0<=c&&c<=1048575))throw new Error("Character outside valid Unicode range: 0x"+c.toString(16));t[a++]=c>>10&1023|55296,t[a]=1023&c|56320;break;default:throw new Error("Bad UTF-8 encoding 0x"+s.toString(16))}if(a>=32766){var u=a+1;t.length=u,n.push(String.fromCharCode.apply(String,t)),r-=u,a=-1}}return a>0&&(t.length=a,n.push(String.fromCharCode.apply(String,t))),n.join("")}(e,r)}function j(e){var r=e.length;if(0===r)return"";var n=b?e:function(e){for(var r=e.length,n=new Array(e.length),t=0;t<r;++t)n[t]=e[t];return n}(e);if(r<65535)return String.fromCharCode.apply(String,n);for(var t=32767&r,a=r>>15,o=new Array(t?a+1:a),i=0;i<a;++i)o[i]=String.fromCharCode.apply(String,n.subarray(i<<15,i+1<<15));return t&&(o[a]=String.fromCharCode.apply(String,n.subarray(a<<15,r))),o.join("")}function O(e,r){return"string"==typeof e&&(e=T(e)),"string"==typeof r&&(r=T(r)),null==e||0===e.length?e:S(function(e,r){var n,t,a,o,i,s,c=e.length,u=c-1;for(t=e[u],a=0,s=0|Math.floor(6+52/c);s>0;--s){for(o=(a=A(a+E))>>>2&3,i=0;i<u;++i)n=e[i+1],t=e[i]=A(e[i]+U(a,n,t,i,o,r));n=e[0],t=e[u]=A(e[u]+U(a,n,t,u,o,r))}return e}(C(e,!0),C(k(r),!1)),!1)}function L(e,r){return"string"==typeof e&&(e=function(e){for(var r=window.atob(e),n=r.length,t=new Uint8Array(n),a=0;a<n;a++)t[a]=r.charCodeAt(a);return t}(e)),"string"==typeof r&&(r=T(r)),null==e||0===e.length?e:S(function(e,r){var n,t,a,o,i,s=e.length,c=s-1;for(n=e[0],a=A(Math.floor(6+52/s)*E);0!==a;a=A(a-E)){for(o=a>>>2&3,i=c;i>0;--i)t=e[i-1],n=e[i]=A(e[i]-U(a,n,t,i,o,r));t=e[c],n=e[0]=A(e[0]-U(a,n,t,0,o,r))}return e}(C(e,!1),C(k(r),!1)),!0)}c(Object.freeze({__proto__:null,decrypt:L,decryptToString:function(e,r){return M(L(e,r))},encrypt:O,encryptToString:function(e,r){return window.btoa(j(O(e,r)))},toBytes:T,toString:M}));
|