xframelib 1.0.4 → 1.0.5

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.
@@ -6,3 +6,73 @@
6
6
  * @returns
7
7
  */
8
8
  export declare function filterObj(obj: any, arr: string[]): {};
9
+ /**
10
+ * 随机整数 ,默认:0-100(包括)
11
+ * @param max
12
+ * @param min
13
+ * @returns
14
+ */
15
+ export declare function getRandomInt(max?: number, min?: number): number;
16
+ /**
17
+ * 获取数组中个随机一个
18
+ * @param array
19
+ * @returns
20
+ */
21
+ export declare function getRandomItem<T>(array: T[]): T | undefined;
22
+ /**
23
+ * 把 Base64编码文本转为Blob
24
+ * @param fileDataBase64 Base64编码文本字符串
25
+ * @param mimeType
26
+ * @returns
27
+ */
28
+ export declare function base64ToBlob(fileDataBase64: string, mimeType?: string): Blob;
29
+ /**
30
+ * 将Blob内容转为 DataURL
31
+ * @param blob
32
+ * @returns
33
+ */
34
+ export declare function blobToDataURL(blob: Blob): Promise<string>;
35
+ /**
36
+ * 字符串全部替换
37
+ * @param str 字符串
38
+ * @param search 旧字符
39
+ * @param replacement 新字符
40
+ * @returns
41
+ */
42
+ export declare function replaceAll(str: string, search: string, replacement: string): string;
43
+ /**
44
+ * 保留小数数据
45
+ * @param value
46
+ * @param digit
47
+ * @returns
48
+ */
49
+ export declare function reserveDecimal(value: number, digit?: number): number;
50
+ /**
51
+ * 十进制转度分秒
52
+ */
53
+ export declare function convertDecimalism(value: number, isString?: boolean, isLng?: boolean): string | {
54
+ degree: number;
55
+ minute: number;
56
+ second: number;
57
+ };
58
+ /**
59
+ * 十进制转度分秒 空格区分
60
+ */
61
+ export declare function convertDecimalismSpacing(value: number, digit?: number): string;
62
+ export declare function convertDecimalismData(value: number, digit?: number): {
63
+ degree: number;
64
+ minute: number;
65
+ second: number;
66
+ };
67
+ /**
68
+ * 转成十进制
69
+ */
70
+ export declare function convertToDecimalism(degree: number, minute: number, second: number): number;
71
+ /**
72
+ * 空格区分的度分秒字符串 转成十进制
73
+ */
74
+ export declare function convertToDecimalismByString(value: string, digit?: number): number;
75
+ /**
76
+ * 方位的度分秒字符串 转成十进制
77
+ */
78
+ export declare function convertToDecimalismByString2(value: string): number;
@@ -378,4 +378,12 @@ export default class H5Tool {
378
378
  * @param jscode JS代码
379
379
  */
380
380
  static loadJsCode(jscode: string): void;
381
+ /**
382
+ * 对象深拷贝
383
+ * 更可靠的
384
+ * 支持循环引用;支持大多数内置类型(Date、RegExp、Map、Set等);性能优于JSON方法
385
+ * @param original
386
+ * @returns
387
+ */
388
+ static deepCopy(original: any): any;
381
389
  }
@@ -0,0 +1,162 @@
1
+ interface DMSValue {
2
+ degrees: number;
3
+ minutes: number;
4
+ seconds: number;
5
+ direction: string;
6
+ }
7
+ declare class WarGridTool {
8
+ private static readonly CharCodes;
9
+ private static readonly matrix2;
10
+ private static readonly matrix3;
11
+ private static readonly matrix4;
12
+ private static readonly matrix5;
13
+ /**
14
+ * 将度分秒格式转换为十进制度
15
+ * @param {number} degrees - 度
16
+ * @param {number} minutes - 分
17
+ * @param {number} seconds - 秒
18
+ * @returns {number} 十进制度
19
+ */
20
+ static dmsToDecimal(dms: DMSValue): number;
21
+ /**
22
+ * 将经度X转为 度分秒 对象
23
+ * @param decimal 十进制度
24
+ * @param direct 方向E或W,默认为E
25
+ * @returns
26
+ */
27
+ static xToDMS(decimal: number, direct?: string): DMSValue;
28
+ /**
29
+ * 将纬度y转为 度分秒 对象
30
+ * @param decimal 十进制度
31
+ * @param direct 方向N或S,默认为N
32
+ * @returns
33
+ */
34
+ static yToDMS(decimal: number, direct?: string): DMSValue;
35
+ /**
36
+ * 将十进制度转换为度分秒格式
37
+ * @param {number} decimal - 十进制度
38
+ * @returns {Object} 包含度、分、秒的对象
39
+ */
40
+ static decimalToDms(decimal: number, direction: string): DMSValue;
41
+ private static prefixInteger;
42
+ /**
43
+ * 解析第一级编码
44
+ * @param dmsValueX
45
+ * @param dmsValueY
46
+ * @returns
47
+ */
48
+ static serializeGrid1(dmsValueX: DMSValue, dmsValueY: DMSValue): string;
49
+ /**
50
+ * 解码第1级编码
51
+ * @param code6
52
+ * @returns
53
+ */
54
+ private static deserializeGrid1;
55
+ /**
56
+ * 解析第二级编码
57
+ * @param dmsValueX
58
+ * @param dmsValueY
59
+ * @returns
60
+ */
61
+ private static serializeGrid2;
62
+ /**
63
+ * 解码第2级编码 1-4
64
+ * @param code6
65
+ * @returns
66
+ */
67
+ private static deserializeGrid2;
68
+ /**
69
+ * 解析第三级编码
70
+ * @param dmsValueX
71
+ * @param dmsValueY
72
+ * @returns
73
+ */
74
+ private static serializeGrid3;
75
+ /**
76
+ * 解码第3级编码 1-9
77
+ * @param code3
78
+ * @returns
79
+ */
80
+ private static deserializeGrid3;
81
+ /**
82
+ * 解析第4级编码 01-25
83
+ * @param dmsValueX
84
+ * @param dmsValueY
85
+ * @returns
86
+ */
87
+ private static serializeGrid4;
88
+ /**
89
+ * 解码第4级编码 01-25
90
+ * @param code4
91
+ * @returns
92
+ */
93
+ private static deserializeGrid4;
94
+ /**
95
+ * 解析第5级编码 A-D
96
+ * @param dmsValueX
97
+ * @param dmsValueY
98
+ * @returns
99
+ */
100
+ private static serializeGrid5;
101
+ /**
102
+ * 解码第5级编码 A-D
103
+ * @param code6
104
+ * @returns
105
+ */
106
+ private static deserializeGrid5;
107
+ /**
108
+ * 解析第6级编码 1-4
109
+ * @param dmsValueX
110
+ * @param dmsValueY
111
+ * @returns
112
+ */
113
+ private static serializeGrid6;
114
+ /**
115
+ * 解码第6级编码 1-4
116
+ * @param code6
117
+ * @returns
118
+ */
119
+ private static deserializeGrid6;
120
+ /**
121
+ * 解析第7级 编码 1-9
122
+ * @param dmsValueX
123
+ * @param dmsValueY
124
+ * @returns
125
+ */
126
+ private static serializeGrid7;
127
+ /**
128
+ * 解码第7级编码 1-9
129
+ * @param code7
130
+ * @returns
131
+ */
132
+ private static deserializeGrid7;
133
+ /**
134
+ * 解析第8级编码 01-25
135
+ * @param dmsValueX
136
+ * @param dmsValueY
137
+ * @returns
138
+ */
139
+ private static serializeGrid8;
140
+ /**
141
+ * 解码第8级编码 01-25
142
+ * @param code8
143
+ * @returns
144
+ */
145
+ private static deserializeGrid8;
146
+ /**
147
+ * 解析第9级编码
148
+ * @param dmsValueX
149
+ * @param dmsValueY
150
+ * @returns
151
+ */
152
+ private static serializeGrid9;
153
+ /**
154
+ * 解码第9级编码
155
+ * @param code9
156
+ * @returns
157
+ */
158
+ private static deserializeGrid9;
159
+ static serializeWarGrid(dmsValueX: DMSValue, dmsValueY: DMSValue, level?: number): string;
160
+ static deserializeWarGrid(gridCode: string): DMSValue[];
161
+ }
162
+ export default WarGridTool;
@@ -10,6 +10,8 @@ import { default as WaterMark } from './WaterMark';
10
10
  import { GetSignalRClient } from './SignalrClient';
11
11
  import { default as iconv } from 'iconv-lite';
12
12
  import { default as WebCacheTool } from './WebCacheTool';
13
+ import { default as WarGridTool } from './WarGridTool';
14
+ import * as CommonTool from './CommonTool';
13
15
  export * from './Color';
14
16
  export * from './FileDownload';
15
17
  export * from './Time';
@@ -27,4 +29,4 @@ export * from './WidgetsTool';
27
29
  export * from './CommonTool';
28
30
  export * from './FilenameUtils';
29
31
  export * from './AutoUpdate';
30
- export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool, WebCacheTool };
32
+ export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool, WebCacheTool, WarGridTool, CommonTool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xframelib",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "积累的前端开发基础库,来源于项目,服务于项目。",
5
5
  "main": "dist/index.js",
6
6
  "common": "dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  "type": "git",
25
25
  "url": "https://github.com/zorrowm/vue-widget-template.git"
26
26
  },
27
- "homepage": "https://zorrowm.github.io/doc/template.html",
27
+ "homepage": "http://www.ysgis.com",
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
30
  "@hprose/io": "^3.0.10",
@@ -33,12 +33,12 @@
33
33
  "@iconify-icons/ant-design": "^1.2.7",
34
34
  "@iconify/vue": "^5.0.0",
35
35
  "@microsoft/signalr": "^9.0.6",
36
- "axios": "^1.11.0",
36
+ "axios": "^1.12.2",
37
37
  "fflate": "^0.8.2",
38
38
  "iconv-lite": "^0.7.0",
39
39
  "localforage": "^1.10.0",
40
40
  "loglevel": "^1.9.2",
41
- "lru-cache": "^11.1.0",
41
+ "lru-cache": "^11.2.2",
42
42
  "qs": "^6.14.0",
43
43
  "spark-md5": "^3.0.2",
44
44
  "xhr": "^2.6.0"
@@ -47,25 +47,25 @@
47
47
  "@rollup/plugin-alias": "^5.1.1",
48
48
  "@rollup/plugin-commonjs": "^28.0.6",
49
49
  "@rollup/plugin-json": "^6.1.0",
50
- "@rollup/plugin-node-resolve": "^16.0.1",
50
+ "@rollup/plugin-node-resolve": "^16.0.2",
51
51
  "@rollup/plugin-terser": "^0.4.4",
52
52
  "@rollup/plugin-typescript": "^12.1.4",
53
53
  "@vitejs/plugin-vue": "^6.0.1",
54
- "esbuild": "^0.25.9",
54
+ "esbuild": "^0.25.10",
55
55
  "rollup-plugin-copy": "^3.5.0",
56
56
  "rollup-plugin-esbuild": "^6.2.1",
57
57
  "rollup-plugin-scss": "^4.0.1",
58
58
  "rollup-plugin-typescript2": "^0.36.0",
59
59
  "rollup-plugin-vue": "^6.0.0",
60
- "sass": "^1.90.0",
61
- "typescript": "^5.9.2",
62
- "vite": "^7.1.3",
60
+ "sass": "^1.93.2",
61
+ "typescript": "^5.9.3",
62
+ "vite": "^7.1.9",
63
63
  "vite-plugin-comlink": "^5.3.0",
64
64
  "vite-plugin-commonjs": "^0.10.4",
65
65
  "vite-plugin-dts": "^4.5.4",
66
66
  "vite-plugin-node-polyfills": "^0.24.0",
67
- "vite-plugin-static-copy": "^3.1.2",
68
- "vue": "^3.5.19",
67
+ "vite-plugin-static-copy": "^3.1.3",
68
+ "vue": "^3.5.22",
69
69
  "vue-router": "^4.5.1"
70
70
  }
71
71
  }
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- const t=Symbol("Comlink.proxy"),e=Symbol("Comlink.endpoint"),i=Symbol("Comlink.releaseProxy"),s=Symbol("Comlink.finalizer"),n=Symbol("Comlink.thrown"),o=t=>"object"==typeof t&&null!==t||"function"==typeof t,a={canHandle:e=>o(e)&&e[t],serialize(t){const{port1:e,port2:i}=new MessageChannel;return h(t,e),[i,[i]]},deserialize:t=>(t.start(),function(t,e){const i=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const s=i.get(e.id);if(s)try{s(e)}finally{i.delete(e.id)}}),p(t,i,[],e)}(t))},r=new Map([["proxy",a],["throw",{canHandle:t=>o(t)&&n in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function h(e,i=globalThis,o=["*"]){i.addEventListener("message",function a(r){if(!r||!r.data)return;if(!function(t,e){for(const i of t){if(e===i||"*"===i)return!0;if(i instanceof RegExp&&i.test(e))return!0}return!1}(o,r.origin))return void console.warn(`Invalid origin '${r.origin}' for comlink proxy`);const{id:c,type:u,path:d}=Object.assign({path:[]},r.data),f=(r.data.argumentList||[]).map(y);let p;try{const i=d.slice(0,-1).reduce((t,e)=>t[e],e),s=d.reduce((t,e)=>t[e],e);switch(u){case"GET":p=s;break;case"SET":i[d.slice(-1)[0]]=y(r.data.value),p=!0;break;case"APPLY":p=s.apply(i,f);break;case"CONSTRUCT":p=function(e){return Object.assign(e,{[t]:!0})}(new s(...f));break;case"ENDPOINT":{const{port1:t,port2:i}=new MessageChannel;h(e,i),p=function(t,e){return m.set(t,e),t}(t,[t])}break;case"RELEASE":p=void 0;break;default:return}}catch(t){p={value:t,[n]:0}}Promise.resolve(p).catch(t=>({value:t,[n]:0})).then(t=>{const[n,o]=v(t);i.postMessage(Object.assign(Object.assign({},n),{id:c}),o),"RELEASE"===u&&(i.removeEventListener("message",a),l(i),s in e&&"function"==typeof e[s]&&e[s]())}).catch(t=>{const[e,s]=v({value:new TypeError("Unserializable return value"),[n]:0});i.postMessage(Object.assign(Object.assign({},e),{id:c}),s)})}),i.start&&i.start()}function l(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function c(t){if(t)throw new Error("Proxy has been released and is not useable")}function u(t){return w(t,new Map,{type:"RELEASE"}).then(()=>{l(t)})}const d=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(d.get(t)||0)-1;d.set(t,e),0===e&&u(t)});function p(t,s,n=[],o=function(){}){let a=!1;const r=new Proxy(o,{get(e,o){if(c(a),o===i)return()=>{!function(t){f&&f.unregister(t)}(r),u(t),s.clear(),a=!0};if("then"===o){if(0===n.length)return{then:()=>r};const e=w(t,s,{type:"GET",path:n.map(t=>t.toString())}).then(y);return e.then.bind(e)}return p(t,s,[...n,o])},set(e,i,o){c(a);const[r,h]=v(o);return w(t,s,{type:"SET",path:[...n,i].map(t=>t.toString()),value:r},h).then(y)},apply(i,o,r){c(a);const h=n[n.length-1];if(h===e)return w(t,s,{type:"ENDPOINT"}).then(y);if("bind"===h)return p(t,s,n.slice(0,-1));const[l,u]=g(r);return w(t,s,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},u).then(y)},construct(e,i){c(a);const[o,r]=g(i);return w(t,s,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:o},r).then(y)}});return function(t,e){const i=(d.get(e)||0)+1;d.set(e,i),f&&f.register(t,e,t)}(r,t),r}function g(t){const e=t.map(v);return[e.map(t=>t[0]),(i=e.map(t=>t[1]),Array.prototype.concat.apply([],i))];var i}const m=new WeakMap;function v(t){for(const[e,i]of r)if(i.canHandle(t)){const[s,n]=i.serialize(t);return[{type:"HANDLER",name:e,value:s},n]}return[{type:"RAW",value:t},m.get(t)||[]]}function y(t){switch(t.type){case"HANDLER":return r.get(t.name).deserialize(t.value);case"RAW":return t.value}}function w(t,e,i,s){return new Promise(n=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,n),t.start&&t.start(),t.postMessage(Object.assign({id:o},i),s)})}function S(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z,T,L={exports:{}},b=L.exports={};function x(){throw new Error("setTimeout has not been defined")}function k(){throw new Error("clearTimeout has not been defined")}function A(t){if(z===setTimeout)return setTimeout(t,0);if((z===x||!z)&&setTimeout)return z=setTimeout,setTimeout(t,0);try{return z(t,0)}catch(e){try{return z.call(null,t,0)}catch(e){return z.call(this,t,0)}}}!function(){try{z="function"==typeof setTimeout?setTimeout:x}catch(t){z=x}try{T="function"==typeof clearTimeout?clearTimeout:k}catch(t){T=k}}();var F,_=[],E=!1,O=-1;function M(){E&&F&&(E=!1,F.length?_=F.concat(_):O=-1,_.length&&D())}function D(){if(!E){var t=A(M);E=!0;for(var e=_.length;e;){for(F=_,_=[];++O<e;)F&&F[O].run();O=-1,e=_.length}F=null,E=!1,function(t){if(T===clearTimeout)return clearTimeout(t);if((T===k||!T)&&clearTimeout)return T=clearTimeout,clearTimeout(t);try{return T(t)}catch(e){try{return T.call(null,t)}catch(e){return T.call(this,t)}}}(t)}}function C(t,e){this.fun=t,this.array=e}function R(){}b.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];_.push(new C(t,e)),1!==_.length||E||A(D)},C.prototype.run=function(){this.fun.apply(null,this.array)},b.title="browser",b.browser=!0,b.env={},b.argv=[],b.version="",b.versions={},b.on=R,b.addListener=R,b.once=R,b.off=R,b.removeListener=R,b.removeAllListeners=R,b.emit=R,b.prependListener=R,b.prependOnceListener=R,b.listeners=function(t){return[]},b.binding=function(t){throw new Error("process.binding is not supported")},b.cwd=function(){return"/"},b.chdir=function(t){throw new Error("process.chdir is not supported")},b.umask=function(){return 0};const I=S(L.exports),W="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,j=new Set,B="object"==typeof I&&I?I:{},G=(t,e,i,s)=>{"function"==typeof B.emitWarning?B.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)};let U=globalThis.AbortController,N=globalThis.AbortSignal;if(void 0===U){N=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},U=class{constructor(){e()}signal=new N;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==B.env?.LRU_CACHE_IGNORE_AC_WARNING;const e=()=>{t&&(t=!1,G("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const P=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),H=t=>P(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?q:null:null;class q extends Array{constructor(t){super(t),this.fill(0)}}class V{heap;length;static#t=!1;static create(t){const e=H(t);if(!e)return[];V.#t=!0;const i=new V(t,e);return V.#t=!1,i}constructor(t,e){if(!V.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class ${#e;#i;#s;#n;#o;#a;#r;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#l;#c;#u;#d;#f;#p;#g;#m;#v;#y;#w;#S;#z;#T;#L;#b;#x;static unsafeExposeInternals(t){return{starts:t.#S,ttls:t.#z,sizes:t.#w,keyMap:t.#c,keyList:t.#u,valList:t.#d,next:t.#f,prev:t.#p,get head(){return t.#g},get tail(){return t.#m},free:t.#v,isBackgroundFetch:e=>t.#k(e),backgroundFetch:(e,i,s,n)=>t.#A(e,i,s,n),moveToTail:e=>t.#F(e),indexes:e=>t.#_(e),rindexes:e=>t.#E(e),isStale:e=>t.#O(e)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#l}get size(){return this.#h}get fetchMethod(){return this.#a}get memoMethod(){return this.#r}get dispose(){return this.#s}get onInsert(){return this.#n}get disposeAfter(){return this.#o}constructor(t){const{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:r,dispose:h,onInsert:l,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:d,maxSize:f=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:m,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:z,ignoreFetchAbort:T}=t;if(0!==e&&!P(e))throw new TypeError("max option must be a nonnegative integer");const L=e?H(e):Array;if(!L)throw new Error("invalid max value: "+e);if(this.#e=e,this.#i=f,this.maxEntrySize=p||this.#i,this.sizeCalculation=g,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==v&&"function"!=typeof v)throw new TypeError("memoMethod must be a function if defined");if(this.#r=v,void 0!==m&&"function"!=typeof m)throw new TypeError("fetchMethod must be a function if specified");if(this.#a=m,this.#L=!!m,this.#c=new Map,this.#u=new Array(e).fill(void 0),this.#d=new Array(e).fill(void 0),this.#f=new L(e),this.#p=new L(e),this.#g=0,this.#m=0,this.#v=V.create(e),this.#h=0,this.#l=0,"function"==typeof h&&(this.#s=h),"function"==typeof l&&(this.#n=l),"function"==typeof c?(this.#o=c,this.#y=[]):(this.#o=void 0,this.#y=void 0),this.#T=!!this.#s,this.#x=!!this.#n,this.#b=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!z,this.ignoreFetchAbort=!!T,0!==this.maxEntrySize){if(0!==this.#i&&!P(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!P(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#M()}if(this.allowStale=!!r,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=P(s)||0===s?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!P(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(0===this.#e&&0===this.ttl&&0===this.#i)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#i){const t="LRU_CACHE_UNBOUNDED";if((t=>!j.has(t))(t)){j.add(t);G("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,$)}}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#D(){const t=new q(this.#e),e=new q(this.#e);this.#z=t,this.#S=e,this.#C=(i,s,n=W.now())=>{if(e[i]=0!==s?n:0,t[i]=s,0!==s&&this.ttlAutopurge){const t=setTimeout(()=>{this.#O(i)&&this.#R(this.#u[i],"expire")},s+1);t.unref&&t.unref()}},this.#I=i=>{e[i]=0!==t[i]?W.now():0},this.#W=(n,o)=>{if(t[o]){const a=t[o],r=e[o];if(!a||!r)return;n.ttl=a,n.start=r,n.now=i||s();const h=n.now-r;n.remainingTTL=a-h}};let i=0;const s=()=>{const t=W.now();if(this.ttlResolution>0){i=t;const e=setTimeout(()=>i=0,this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=n=>{const o=this.#c.get(n);if(void 0===o)return 0;const a=t[o],r=e[o];if(!a||!r)return 1/0;return a-((i||s())-r)},this.#O=n=>{const o=e[n],a=t[n];return!!a&&!!o&&(i||s())-o>a}}#I=()=>{};#W=()=>{};#C=()=>{};#O=()=>!1;#M(){const t=new q(this.#e);this.#l=0,this.#w=t,this.#j=e=>{this.#l-=t[e],t[e]=0},this.#B=(t,e,i,s)=>{if(this.#k(e))return 0;if(!P(i)){if(!s)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof s)throw new TypeError("sizeCalculation must be a function");if(i=s(e,t),!P(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return i},this.#G=(e,i,s)=>{if(t[e]=i,this.#i){const i=this.#i-t[e];for(;this.#l>i;)this.#U(!0)}this.#l+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#l)}}#j=t=>{};#G=(t,e,i)=>{};#B=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;this.#N(e)&&(!t&&this.#O(e)||(yield e),e!==this.#g);)e=this.#p[e]}*#E({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#g;this.#N(e)&&(!t&&this.#O(e)||(yield e),e!==this.#m);)e=this.#f[e]}#N(t){return void 0!==t&&this.#c.get(this.#u[t])===t}*entries(){for(const t of this.#_())void 0===this.#d[t]||void 0===this.#u[t]||this.#k(this.#d[t])||(yield[this.#u[t],this.#d[t]])}*rentries(){for(const t of this.#E())void 0===this.#d[t]||void 0===this.#u[t]||this.#k(this.#d[t])||(yield[this.#u[t],this.#d[t]])}*keys(){for(const t of this.#_()){const e=this.#u[t];void 0===e||this.#k(this.#d[t])||(yield e)}}*rkeys(){for(const t of this.#E()){const e=this.#u[t];void 0===e||this.#k(this.#d[t])||(yield e)}}*values(){for(const t of this.#_()){void 0===this.#d[t]||this.#k(this.#d[t])||(yield this.#d[t])}}*rvalues(){for(const t of this.#E()){void 0===this.#d[t]||this.#k(this.#d[t])||(yield this.#d[t])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const i of this.#_()){const s=this.#d[i],n=this.#k(s)?s.__staleWhileFetching:s;if(void 0!==n&&t(n,this.#u[i],this))return this.get(this.#u[i],e)}}forEach(t,e=this){for(const i of this.#_()){const s=this.#d[i],n=this.#k(s)?s.__staleWhileFetching:s;void 0!==n&&t.call(e,n,this.#u[i],this)}}rforEach(t,e=this){for(const i of this.#E()){const s=this.#d[i],n=this.#k(s)?s.__staleWhileFetching:s;void 0!==n&&t.call(e,n,this.#u[i],this)}}purgeStale(){let t=!1;for(const e of this.#E({allowStale:!0}))this.#O(e)&&(this.#R(this.#u[e],"expire"),t=!0);return t}info(t){const e=this.#c.get(t);if(void 0===e)return;const i=this.#d[e],s=this.#k(i)?i.__staleWhileFetching:i;if(void 0===s)return;const n={value:s};if(this.#z&&this.#S){const t=this.#z[e],i=this.#S[e];if(t&&i){const e=t-(W.now()-i);n.ttl=e,n.start=Date.now()}}return this.#w&&(n.size=this.#w[e]),n}dump(){const t=[];for(const e of this.#_({allowStale:!0})){const i=this.#u[e],s=this.#d[e],n=this.#k(s)?s.__staleWhileFetching:s;if(void 0===n||void 0===i)continue;const o={value:n};if(this.#z&&this.#S){o.ttl=this.#z[e];const t=W.now()-this.#S[e];o.start=Math.floor(Date.now()-t)}this.#w&&(o.size=this.#w[e]),t.unshift([i,o])}return t}load(t){this.clear();for(const[e,i]of t){if(i.start){const t=Date.now()-i.start;i.start=W.now()-t}this.set(e,i.value,i)}}set(t,e,i={}){if(void 0===e)return this.delete(t),this;const{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:r}=i;let{noUpdateTTL:h=this.noUpdateTTL}=i;const l=this.#B(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return r&&(r.set="miss",r.maxEntrySizeExceeded=!0),this.#R(t,"set"),this;let c=0===this.#h?void 0:this.#c.get(t);if(void 0===c)c=0===this.#h?this.#m:0!==this.#v.length?this.#v.pop():this.#h===this.#e?this.#U(!1):this.#h,this.#u[c]=t,this.#d[c]=e,this.#c.set(t,c),this.#f[this.#m]=c,this.#p[c]=this.#m,this.#m=c,this.#h++,this.#G(c,l,r),r&&(r.set="add"),h=!1,this.#x&&this.#n?.(e,t,"add");else{this.#F(c);const i=this.#d[c];if(e!==i){if(this.#L&&this.#k(i)){i.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=i;void 0===e||o||(this.#T&&this.#s?.(e,t,"set"),this.#b&&this.#y?.push([e,t,"set"]))}else o||(this.#T&&this.#s?.(i,t,"set"),this.#b&&this.#y?.push([i,t,"set"]));if(this.#j(c),this.#G(c,l,r),this.#d[c]=e,r){r.set="replace";const t=i&&this.#k(i)?i.__staleWhileFetching:i;void 0!==t&&(r.oldValue=t)}}else r&&(r.set="update");this.#x&&this.onInsert?.(e,t,e===i?"update":"replace")}if(0===s||this.#z||this.#D(),this.#z&&(h||this.#C(c,s,n),r&&this.#W(r,c)),!o&&this.#b&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}return this}pop(){try{for(;this.#h;){const t=this.#d[this.#g];if(this.#U(!0),this.#k(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#b&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}}}#U(t){const e=this.#g,i=this.#u[e],s=this.#d[e];return this.#L&&this.#k(s)?s.__abortController.abort(new Error("evicted")):(this.#T||this.#b)&&(this.#T&&this.#s?.(s,i,"evict"),this.#b&&this.#y?.push([s,i,"evict"])),this.#j(e),t&&(this.#u[e]=void 0,this.#d[e]=void 0,this.#v.push(e)),1===this.#h?(this.#g=this.#m=0,this.#v.length=0):this.#g=this.#f[e],this.#c.delete(i),this.#h--,e}has(t,e={}){const{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#c.get(t);if(void 0!==n){const t=this.#d[n];if(this.#k(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#O(n))return i&&this.#I(n),s&&(s.has="hit",this.#W(s,n)),!0;s&&(s.has="stale",this.#W(s,n))}else s&&(s.has="miss");return!1}peek(t,e={}){const{allowStale:i=this.allowStale}=e,s=this.#c.get(t);if(void 0===s||!i&&this.#O(s))return;const n=this.#d[s];return this.#k(n)?n.__staleWhileFetching:n}#A(t,e,i,s){const n=void 0===e?void 0:this.#d[e];if(this.#k(n))return n;const o=new U,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});const r={signal:o.signal,options:i,context:s},h=(s,n=!1)=>{const{aborted:a}=o.signal,h=i.ignoreFetchAbort&&void 0!==s;if(i.status&&(a&&!n?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,h&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!h&&!n)return l(o.signal.reason);const u=c;return this.#d[e]===c&&(void 0===s?u.__staleWhileFetching?this.#d[e]=u.__staleWhileFetching:this.#R(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,s,r.options))),s},l=s=>{const{aborted:n}=o.signal,a=n&&i.allowStaleOnFetchAbort,r=a||i.allowStaleOnFetchRejection,h=r||i.noDeleteOnFetchRejection,l=c;if(this.#d[e]===c){!h||void 0===l.__staleWhileFetching?this.#R(t,"fetch"):a||(this.#d[e]=l.__staleWhileFetching)}if(r)return i.status&&void 0!==l.__staleWhileFetching&&(i.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw s};i.status&&(i.status.fetchDispatched=!0);const c=new Promise((e,s)=>{const a=this.#a?.(t,n,r);a&&a instanceof Promise&&a.then(t=>e(void 0===t?void 0:t),s),o.signal.addEventListener("abort",()=>{i.ignoreFetchAbort&&!i.allowStaleOnFetchAbort||(e(void 0),i.allowStaleOnFetchAbort&&(e=t=>h(t,!0)))})}).then(h,t=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=t),l(t))),u=Object.assign(c,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return void 0===e?(this.set(t,u,{...r.options,status:void 0}),e=this.#c.get(t)):this.#d[e]=u,u}#k(t){if(!this.#L)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof U}async fetch(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:r=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=!1,status:m,signal:v}=e;if(!this.#L)return m&&(m.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:m});const y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:r,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:m,signal:v};let w=this.#c.get(t);if(void 0===w){m&&(m.fetch="miss");const e=this.#A(t,w,y,p);return e.__returned=e}{const e=this.#d[w];if(this.#k(e)){const t=i&&void 0!==e.__staleWhileFetching;return m&&(m.fetch="inflight",t&&(m.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const n=this.#O(w);if(!g&&!n)return m&&(m.fetch="hit"),this.#F(w),s&&this.#I(w),m&&this.#W(m,w),e;const o=this.#A(t,w,y,p),a=void 0!==o.__staleWhileFetching&&i;return m&&(m.fetch=n?"stale":"refresh",a&&n&&(m.returnedStale=!0)),a?o.__staleWhileFetching:o.__returned=o}}async forceFetch(t,e={}){const i=await this.fetch(t,e);if(void 0===i)throw new Error("fetch() returned undefined");return i}memo(t,e={}){const i=this.#r;if(!i)throw new Error("no memoMethod provided to constructor");const{context:s,forceRefresh:n,...o}=e,a=this.get(t,o);if(!n&&void 0!==a)return a;const r=i(t,a,{options:o,context:s});return this.set(t,r,o),r}get(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,a=this.#c.get(t);if(void 0!==a){const e=this.#d[a],r=this.#k(e);return o&&this.#W(o,a),this.#O(a)?(o&&(o.get="stale"),r?(o&&i&&void 0!==e.__staleWhileFetching&&(o.returnedStale=!0),i?e.__staleWhileFetching:void 0):(n||this.#R(t,"expire"),o&&i&&(o.returnedStale=!0),i?e:void 0)):(o&&(o.get="hit"),r?e.__staleWhileFetching:(this.#F(a),s&&this.#I(a),e))}o&&(o.get="miss")}#P(t,e){this.#p[e]=t,this.#f[t]=e}#F(t){t!==this.#m&&(t===this.#g?this.#g=this.#f[t]:this.#P(this.#p[t],this.#f[t]),this.#P(this.#m,t),this.#m=t)}delete(t){return this.#R(t,"delete")}#R(t,e){let i=!1;if(0!==this.#h){const s=this.#c.get(t);if(void 0!==s)if(i=!0,1===this.#h)this.#H(e);else{this.#j(s);const i=this.#d[s];if(this.#k(i)?i.__abortController.abort(new Error("deleted")):(this.#T||this.#b)&&(this.#T&&this.#s?.(i,t,e),this.#b&&this.#y?.push([i,t,e])),this.#c.delete(t),this.#u[s]=void 0,this.#d[s]=void 0,s===this.#m)this.#m=this.#p[s];else if(s===this.#g)this.#g=this.#f[s];else{const t=this.#p[s];this.#f[t]=this.#f[s];const e=this.#f[s];this.#p[e]=this.#p[s]}this.#h--,this.#v.push(s)}}if(this.#b&&this.#y?.length){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}return i}clear(){return this.#H("delete")}#H(t){for(const e of this.#E({allowStale:!0})){const i=this.#d[e];if(this.#k(i))i.__abortController.abort(new Error("deleted"));else{const s=this.#u[e];this.#T&&this.#s?.(i,s,t),this.#b&&this.#y?.push([i,s,t])}}if(this.#c.clear(),this.#d.fill(void 0),this.#u.fill(void 0),this.#z&&this.#S&&(this.#z.fill(0),this.#S.fill(0)),this.#w&&this.#w.fill(0),this.#g=0,this.#m=0,this.#v.length=0,this.#l=0,this.#h=0,this.#b&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}}}class Y{static defaultOptions={max:1e3,maxAge:18e5};static cache=new $(this.defaultOptions);static createCache(t=this.defaultOptions){return new $(t)}static set(t,e,i=this.cache){let s=i;s||(s=this.cache),s.set(t,e)}static get(t,e=this.cache){let i=e;return i||(i=this.cache),i.get(t)}static remove(t,e=this.cache){let i=e;return i||(i=this.cache),i.del(t)}static has(t,e=this.cache){let i=e;return i||(i=this.cache),i.has(t)}static count(t=this.cache){let e=t;return e||(e=this.cache),e.size}static maxSize(t=this.cache){let e=t;return e||(e=this.cache),e.max}static peek(t,e=this.cache){let i=e;return i||(i=this.cache),i.peek(t)}static keys(t=this.cache){let e=t;return e||(e=this.cache),e.keys()}static clear(t=this.cache){let e=t;e||(e=this.cache),e.clear()}}const X=new Map;async function J(t,e=void 0){const i={max:1e3,maxAage:18e5};let s=i;e&&(s={...i,...e});const n=Y.createCache(s);return X.set(t,n),n}async function K(t=""){let e;return e=X.has(t)?X.get(t):await J(t),e}h(Object.freeze({__proto__:null,clear:async function(t=""){const e=await K(t);return e&&Y.clear(e),!1},count:async function(t=""){const e=await K(t);return e?Y.count(e):0},createCache:J,get:async function(t,e=""){const i=await K(e);if(i){const e=Y.get(t,i);return console.log("666000",t,e),e}},getCacheObject:K,has:async function(t,e=""){const i=await K(e);return!!i&&Y.has(t,i)},keys:async function(t=""){const e=await K(t);if(e)return Y.keys(e)},maxSize:async function(t=""){const e=await K(t);return e?Y.maxSize(e):0},peek:async function(t,e=""){const i=await K(e);return!!i&&Y.peek(t,i)},remove:async function(t,e=""){const i=await K(e);if(i)return Y.remove(t,i)},set:async function(t,e,i=""){const s=await K(i);return!!s&&(Y.set(t,e,s),!0)}}));