@opentiny/utils 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @opentiny/utils
@@ -0,0 +1,1011 @@
1
+ var He = Object.defineProperty;
2
+ var Xe = (e, r, t) => r in e ? He(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var b = (e, r, t) => (Xe(e, typeof r != "symbol" ? r + "" : r, t), t);
4
+ const Y = () => typeof window < "u" && typeof document < "u" && window.document === document, j = () => Y() ? window : global, je = j(), Ne = "tcirzywvqlkjhgfbZQG_FLOWHSUBDNIMYREVKCAJxp57XP043891T62-modnaesu", pe = Ne.split("").reverse().join("");
5
+ let T, L;
6
+ const Ge = (e) => new Uint8Array(new ArrayBuffer(e)), se = (e) => je.crypto.getRandomValues(e), he = (e) => {
7
+ !T || T.length < e ? (T = Ge(e * 128), se(T), L = 0) : L + e > T.length && (se(T), L = 0), L += e;
8
+ }, Me = (e = 21) => {
9
+ he(e -= 0);
10
+ let r = "";
11
+ for (let t = L - e; t < L; t++)
12
+ r += pe[T[t] & 63];
13
+ return r;
14
+ }, qe = (e) => (he(e -= 0), T.subarray(L - e, L)), Qe = (e, r, t) => {
15
+ const s = (2 << 31 - Math.clz32(e.length - 1 | 1)) - 1, a = Math.ceil(1.6 * s * r / e.length);
16
+ return (n = r) => {
17
+ let o = "";
18
+ for (; ; ) {
19
+ const i = t(a);
20
+ let l = a;
21
+ for (; l--; )
22
+ if (o += e[i[l] & s] || "", o.length === n)
23
+ return o;
24
+ }
25
+ };
26
+ }, Ze = (e, r = 21) => Qe(e, r, qe);
27
+ function Je(e) {
28
+ return Y() && (e.document.all || e.document.documentMode) && !e.crypto && e.msCrypto;
29
+ }
30
+ function Ke(e) {
31
+ if (Je(e)) {
32
+ e.crypto = e.msCrypto;
33
+ const r = e.crypto.getRandomValues;
34
+ e.crypto.getRandomValues = function(t) {
35
+ const s = r.call(e.crypto, t), a = [];
36
+ for (let n = 0; n < t.length; n++)
37
+ a[n] = s[n];
38
+ return a;
39
+ };
40
+ }
41
+ }
42
+ const Q = j();
43
+ Ke(Q);
44
+ const Ye = 4294967296, et = pe, tt = Me, rt = Ze, st = () => Y() ? Q.crypto.getRandomValues(new Q.Uint32Array(1))[0] / Ye : 0, ae = {
45
+ urlAlphabet: et,
46
+ nanoid: tt,
47
+ customAlphabet: rt
48
+ }, ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49
+ __proto__: null,
50
+ api: ae,
51
+ default: ae,
52
+ random: st
53
+ }, Symbol.toStringTag, { value: "Module" }));
54
+ var Z = { exports: {} }, p = {}, J = { exports: {} }, I = {};
55
+ function me() {
56
+ var e = {};
57
+ return e["align-content"] = !1, e["align-items"] = !1, e["align-self"] = !1, e["alignment-adjust"] = !1, e["alignment-baseline"] = !1, e.all = !1, e["anchor-point"] = !1, e.animation = !1, e["animation-delay"] = !1, e["animation-direction"] = !1, e["animation-duration"] = !1, e["animation-fill-mode"] = !1, e["animation-iteration-count"] = !1, e["animation-name"] = !1, e["animation-play-state"] = !1, e["animation-timing-function"] = !1, e.azimuth = !1, e["backface-visibility"] = !1, e.background = !0, e["background-attachment"] = !0, e["background-clip"] = !0, e["background-color"] = !0, e["background-image"] = !0, e["background-origin"] = !0, e["background-position"] = !0, e["background-repeat"] = !0, e["background-size"] = !0, e["baseline-shift"] = !1, e.binding = !1, e.bleed = !1, e["bookmark-label"] = !1, e["bookmark-level"] = !1, e["bookmark-state"] = !1, e.border = !0, e["border-bottom"] = !0, e["border-bottom-color"] = !0, e["border-bottom-left-radius"] = !0, e["border-bottom-right-radius"] = !0, e["border-bottom-style"] = !0, e["border-bottom-width"] = !0, e["border-collapse"] = !0, e["border-color"] = !0, e["border-image"] = !0, e["border-image-outset"] = !0, e["border-image-repeat"] = !0, e["border-image-slice"] = !0, e["border-image-source"] = !0, e["border-image-width"] = !0, e["border-left"] = !0, e["border-left-color"] = !0, e["border-left-style"] = !0, e["border-left-width"] = !0, e["border-radius"] = !0, e["border-right"] = !0, e["border-right-color"] = !0, e["border-right-style"] = !0, e["border-right-width"] = !0, e["border-spacing"] = !0, e["border-style"] = !0, e["border-top"] = !0, e["border-top-color"] = !0, e["border-top-left-radius"] = !0, e["border-top-right-radius"] = !0, e["border-top-style"] = !0, e["border-top-width"] = !0, e["border-width"] = !0, e.bottom = !1, e["box-decoration-break"] = !0, e["box-shadow"] = !0, e["box-sizing"] = !0, e["box-snap"] = !0, e["box-suppress"] = !0, e["break-after"] = !0, e["break-before"] = !0, e["break-inside"] = !0, e["caption-side"] = !1, e.chains = !1, e.clear = !0, e.clip = !1, e["clip-path"] = !1, e["clip-rule"] = !1, e.color = !0, e["color-interpolation-filters"] = !0, e["column-count"] = !1, e["column-fill"] = !1, e["column-gap"] = !1, e["column-rule"] = !1, e["column-rule-color"] = !1, e["column-rule-style"] = !1, e["column-rule-width"] = !1, e["column-span"] = !1, e["column-width"] = !1, e.columns = !1, e.contain = !1, e.content = !1, e["counter-increment"] = !1, e["counter-reset"] = !1, e["counter-set"] = !1, e.crop = !1, e.cue = !1, e["cue-after"] = !1, e["cue-before"] = !1, e.cursor = !1, e.direction = !1, e.display = !0, e["display-inside"] = !0, e["display-list"] = !0, e["display-outside"] = !0, e["dominant-baseline"] = !1, e.elevation = !1, e["empty-cells"] = !1, e.filter = !1, e.flex = !1, e["flex-basis"] = !1, e["flex-direction"] = !1, e["flex-flow"] = !1, e["flex-grow"] = !1, e["flex-shrink"] = !1, e["flex-wrap"] = !1, e.float = !1, e["float-offset"] = !1, e["flood-color"] = !1, e["flood-opacity"] = !1, e["flow-from"] = !1, e["flow-into"] = !1, e.font = !0, e["font-family"] = !0, e["font-feature-settings"] = !0, e["font-kerning"] = !0, e["font-language-override"] = !0, e["font-size"] = !0, e["font-size-adjust"] = !0, e["font-stretch"] = !0, e["font-style"] = !0, e["font-synthesis"] = !0, e["font-variant"] = !0, e["font-variant-alternates"] = !0, e["font-variant-caps"] = !0, e["font-variant-east-asian"] = !0, e["font-variant-ligatures"] = !0, e["font-variant-numeric"] = !0, e["font-variant-position"] = !0, e["font-weight"] = !0, e.grid = !1, e["grid-area"] = !1, e["grid-auto-columns"] = !1, e["grid-auto-flow"] = !1, e["grid-auto-rows"] = !1, e["grid-column"] = !1, e["grid-column-end"] = !1, e["grid-column-start"] = !1, e["grid-row"] = !1, e["grid-row-end"] = !1, e["grid-row-start"] = !1, e["grid-template"] = !1, e["grid-template-areas"] = !1, e["grid-template-columns"] = !1, e["grid-template-rows"] = !1, e["hanging-punctuation"] = !1, e.height = !0, e.hyphens = !1, e.icon = !1, e["image-orientation"] = !1, e["image-resolution"] = !1, e["ime-mode"] = !1, e["initial-letters"] = !1, e["inline-box-align"] = !1, e["justify-content"] = !1, e["justify-items"] = !1, e["justify-self"] = !1, e.left = !1, e["letter-spacing"] = !0, e["lighting-color"] = !0, e["line-box-contain"] = !1, e["line-break"] = !1, e["line-grid"] = !1, e["line-height"] = !1, e["line-snap"] = !1, e["line-stacking"] = !1, e["line-stacking-ruby"] = !1, e["line-stacking-shift"] = !1, e["line-stacking-strategy"] = !1, e["list-style"] = !0, e["list-style-image"] = !0, e["list-style-position"] = !0, e["list-style-type"] = !0, e.margin = !0, e["margin-bottom"] = !0, e["margin-left"] = !0, e["margin-right"] = !0, e["margin-top"] = !0, e["marker-offset"] = !1, e["marker-side"] = !1, e.marks = !1, e.mask = !1, e["mask-box"] = !1, e["mask-box-outset"] = !1, e["mask-box-repeat"] = !1, e["mask-box-slice"] = !1, e["mask-box-source"] = !1, e["mask-box-width"] = !1, e["mask-clip"] = !1, e["mask-image"] = !1, e["mask-origin"] = !1, e["mask-position"] = !1, e["mask-repeat"] = !1, e["mask-size"] = !1, e["mask-source-type"] = !1, e["mask-type"] = !1, e["max-height"] = !0, e["max-lines"] = !1, e["max-width"] = !0, e["min-height"] = !0, e["min-width"] = !0, e["move-to"] = !1, e["nav-down"] = !1, e["nav-index"] = !1, e["nav-left"] = !1, e["nav-right"] = !1, e["nav-up"] = !1, e["object-fit"] = !1, e["object-position"] = !1, e.opacity = !1, e.order = !1, e.orphans = !1, e.outline = !1, e["outline-color"] = !1, e["outline-offset"] = !1, e["outline-style"] = !1, e["outline-width"] = !1, e.overflow = !1, e["overflow-wrap"] = !1, e["overflow-x"] = !1, e["overflow-y"] = !1, e.padding = !0, e["padding-bottom"] = !0, e["padding-left"] = !0, e["padding-right"] = !0, e["padding-top"] = !0, e.page = !1, e["page-break-after"] = !1, e["page-break-before"] = !1, e["page-break-inside"] = !1, e["page-policy"] = !1, e.pause = !1, e["pause-after"] = !1, e["pause-before"] = !1, e.perspective = !1, e["perspective-origin"] = !1, e.pitch = !1, e["pitch-range"] = !1, e["play-during"] = !1, e.position = !1, e["presentation-level"] = !1, e.quotes = !1, e["region-fragment"] = !1, e.resize = !1, e.rest = !1, e["rest-after"] = !1, e["rest-before"] = !1, e.richness = !1, e.right = !1, e.rotation = !1, e["rotation-point"] = !1, e["ruby-align"] = !1, e["ruby-merge"] = !1, e["ruby-position"] = !1, e["shape-image-threshold"] = !1, e["shape-outside"] = !1, e["shape-margin"] = !1, e.size = !1, e.speak = !1, e["speak-as"] = !1, e["speak-header"] = !1, e["speak-numeral"] = !1, e["speak-punctuation"] = !1, e["speech-rate"] = !1, e.stress = !1, e["string-set"] = !1, e["tab-size"] = !1, e["table-layout"] = !1, e["text-align"] = !0, e["text-align-last"] = !0, e["text-combine-upright"] = !0, e["text-decoration"] = !0, e["text-decoration-color"] = !0, e["text-decoration-line"] = !0, e["text-decoration-skip"] = !0, e["text-decoration-style"] = !0, e["text-emphasis"] = !0, e["text-emphasis-color"] = !0, e["text-emphasis-position"] = !0, e["text-emphasis-style"] = !0, e["text-height"] = !0, e["text-indent"] = !0, e["text-justify"] = !0, e["text-orientation"] = !0, e["text-overflow"] = !0, e["text-shadow"] = !0, e["text-space-collapse"] = !0, e["text-transform"] = !0, e["text-underline-position"] = !0, e["text-wrap"] = !0, e.top = !1, e.transform = !1, e["transform-origin"] = !1, e["transform-style"] = !1, e.transition = !1, e["transition-delay"] = !1, e["transition-duration"] = !1, e["transition-property"] = !1, e["transition-timing-function"] = !1, e["unicode-bidi"] = !1, e["vertical-align"] = !1, e.visibility = !1, e["voice-balance"] = !1, e["voice-duration"] = !1, e["voice-family"] = !1, e["voice-pitch"] = !1, e["voice-range"] = !1, e["voice-rate"] = !1, e["voice-stress"] = !1, e["voice-volume"] = !1, e.volume = !1, e["white-space"] = !1, e.widows = !1, e.width = !0, e["will-change"] = !1, e["word-break"] = !0, e["word-spacing"] = !0, e["word-wrap"] = !0, e["wrap-flow"] = !1, e["wrap-through"] = !1, e["writing-mode"] = !1, e["z-index"] = !1, e;
58
+ }
59
+ function at(e, r, t) {
60
+ }
61
+ function nt(e, r, t) {
62
+ }
63
+ var it = /javascript\s*\:/img;
64
+ function lt(e, r) {
65
+ return it.test(r) ? "" : r;
66
+ }
67
+ I.whiteList = me();
68
+ I.getDefaultWhiteList = me;
69
+ I.onAttr = at;
70
+ I.onIgnoreAttr = nt;
71
+ I.safeAttrValue = lt;
72
+ var ot = {
73
+ indexOf: function(e, r) {
74
+ var t, s;
75
+ if (Array.prototype.indexOf)
76
+ return e.indexOf(r);
77
+ for (t = 0, s = e.length; t < s; t++)
78
+ if (e[t] === r)
79
+ return t;
80
+ return -1;
81
+ },
82
+ forEach: function(e, r, t) {
83
+ var s, a;
84
+ if (Array.prototype.forEach)
85
+ return e.forEach(r, t);
86
+ for (s = 0, a = e.length; s < a; s++)
87
+ r.call(t, e[s], s, e);
88
+ },
89
+ trim: function(e) {
90
+ return String.prototype.trim ? e.trim() : e.replace(/(^\s*)|(\s*$)/g, "");
91
+ },
92
+ trimRight: function(e) {
93
+ return String.prototype.trimRight ? e.trimRight() : e.replace(/(\s*$)/g, "");
94
+ }
95
+ }, R = ot;
96
+ function ft(e, r) {
97
+ e = R.trimRight(e), e[e.length - 1] !== ";" && (e += ";");
98
+ var t = e.length, s = !1, a = 0, n = 0, o = "";
99
+ function i() {
100
+ if (!s) {
101
+ var u = R.trim(e.slice(a, n)), f = u.indexOf(":");
102
+ if (f !== -1) {
103
+ var d = R.trim(u.slice(0, f)), g = R.trim(u.slice(f + 1));
104
+ if (d) {
105
+ var h = r(a, o.length, d, g, u);
106
+ h && (o += h + "; ");
107
+ }
108
+ }
109
+ }
110
+ a = n + 1;
111
+ }
112
+ for (; n < t; n++) {
113
+ var l = e[n];
114
+ if (l === "/" && e[n + 1] === "*") {
115
+ var c = e.indexOf("*/", n + 2);
116
+ if (c === -1)
117
+ break;
118
+ n = c + 1, a = n + 1, s = !1;
119
+ } else
120
+ l === "(" ? s = !0 : l === ")" ? s = !1 : l === ";" ? s || i() : l === `
121
+ ` && i();
122
+ }
123
+ return R.trim(o);
124
+ }
125
+ var ct = ft, W = I, ut = ct;
126
+ function ne(e) {
127
+ return e == null;
128
+ }
129
+ function gt(e) {
130
+ var r = {};
131
+ for (var t in e)
132
+ r[t] = e[t];
133
+ return r;
134
+ }
135
+ function be(e) {
136
+ e = gt(e || {}), e.whiteList = e.whiteList || W.whiteList, e.onAttr = e.onAttr || W.onAttr, e.onIgnoreAttr = e.onIgnoreAttr || W.onIgnoreAttr, e.safeAttrValue = e.safeAttrValue || W.safeAttrValue, this.options = e;
137
+ }
138
+ be.prototype.process = function(e) {
139
+ if (e = e || "", e = e.toString(), !e)
140
+ return "";
141
+ var r = this, t = r.options, s = t.whiteList, a = t.onAttr, n = t.onIgnoreAttr, o = t.safeAttrValue, i = ut(e, function(l, c, u, f, d) {
142
+ var g = s[u], h = !1;
143
+ if (g === !0 ? h = g : typeof g == "function" ? h = g(f) : g instanceof RegExp && (h = g.test(f)), h !== !0 && (h = !1), f = o(u, f), !!f) {
144
+ var m = {
145
+ position: c,
146
+ sourcePosition: l,
147
+ source: d,
148
+ isWhite: h
149
+ };
150
+ if (h) {
151
+ var y = a(u, f, m);
152
+ return ne(y) ? u + ":" + f : y;
153
+ } else {
154
+ var y = n(u, f, m);
155
+ if (!ne(y))
156
+ return y;
157
+ }
158
+ }
159
+ });
160
+ return i;
161
+ };
162
+ var dt = be;
163
+ (function(e, r) {
164
+ var t = I, s = dt;
165
+ function a(o, i) {
166
+ var l = new s(i);
167
+ return l.process(o);
168
+ }
169
+ r = e.exports = a, r.FilterCSS = s;
170
+ for (var n in t)
171
+ r[n] = t[n];
172
+ typeof window < "u" && (window.filterCSS = e.exports);
173
+ })(J, J.exports);
174
+ var ee = J.exports, te = {
175
+ indexOf: function(e, r) {
176
+ var t, s;
177
+ if (Array.prototype.indexOf)
178
+ return e.indexOf(r);
179
+ for (t = 0, s = e.length; t < s; t++)
180
+ if (e[t] === r)
181
+ return t;
182
+ return -1;
183
+ },
184
+ forEach: function(e, r, t) {
185
+ var s, a;
186
+ if (Array.prototype.forEach)
187
+ return e.forEach(r, t);
188
+ for (s = 0, a = e.length; s < a; s++)
189
+ r.call(t, e[s], s, e);
190
+ },
191
+ trim: function(e) {
192
+ return String.prototype.trim ? e.trim() : e.replace(/(^\s*)|(\s*$)/g, "");
193
+ },
194
+ spaceIndex: function(e) {
195
+ var r = /\s|\n|\t/, t = r.exec(e);
196
+ return t ? t.index : -1;
197
+ }
198
+ }, pt = ee.FilterCSS, ht = ee.getDefaultWhiteList, H = te;
199
+ function ve() {
200
+ return {
201
+ a: ["target", "href", "title"],
202
+ abbr: ["title"],
203
+ address: [],
204
+ area: ["shape", "coords", "href", "alt"],
205
+ article: [],
206
+ aside: [],
207
+ audio: [
208
+ "autoplay",
209
+ "controls",
210
+ "crossorigin",
211
+ "loop",
212
+ "muted",
213
+ "preload",
214
+ "src"
215
+ ],
216
+ b: [],
217
+ bdi: ["dir"],
218
+ bdo: ["dir"],
219
+ big: [],
220
+ blockquote: ["cite"],
221
+ br: [],
222
+ caption: [],
223
+ center: [],
224
+ cite: [],
225
+ code: [],
226
+ col: ["align", "valign", "span", "width"],
227
+ colgroup: ["align", "valign", "span", "width"],
228
+ dd: [],
229
+ del: ["datetime"],
230
+ details: ["open"],
231
+ div: [],
232
+ dl: [],
233
+ dt: [],
234
+ em: [],
235
+ figcaption: [],
236
+ figure: [],
237
+ font: ["color", "size", "face"],
238
+ footer: [],
239
+ h1: [],
240
+ h2: [],
241
+ h3: [],
242
+ h4: [],
243
+ h5: [],
244
+ h6: [],
245
+ header: [],
246
+ hr: [],
247
+ i: [],
248
+ img: ["src", "alt", "title", "width", "height"],
249
+ ins: ["datetime"],
250
+ li: [],
251
+ mark: [],
252
+ nav: [],
253
+ ol: [],
254
+ p: [],
255
+ pre: [],
256
+ s: [],
257
+ section: [],
258
+ small: [],
259
+ span: [],
260
+ sub: [],
261
+ summary: [],
262
+ sup: [],
263
+ strong: [],
264
+ strike: [],
265
+ table: ["width", "border", "align", "valign"],
266
+ tbody: ["align", "valign"],
267
+ td: ["width", "rowspan", "colspan", "align", "valign"],
268
+ tfoot: ["align", "valign"],
269
+ th: ["width", "rowspan", "colspan", "align", "valign"],
270
+ thead: ["align", "valign"],
271
+ tr: ["rowspan", "align", "valign"],
272
+ tt: [],
273
+ u: [],
274
+ ul: [],
275
+ video: [
276
+ "autoplay",
277
+ "controls",
278
+ "crossorigin",
279
+ "loop",
280
+ "muted",
281
+ "playsinline",
282
+ "poster",
283
+ "preload",
284
+ "src",
285
+ "height",
286
+ "width"
287
+ ]
288
+ };
289
+ }
290
+ var we = new pt();
291
+ function yt(e, r, t) {
292
+ }
293
+ function mt(e, r, t) {
294
+ }
295
+ function bt(e, r, t) {
296
+ }
297
+ function vt(e, r, t) {
298
+ }
299
+ function Ae(e) {
300
+ return e.replace(At, "&lt;").replace(_t, "&gt;");
301
+ }
302
+ function wt(e, r, t, s) {
303
+ if (t = Le(t), r === "href" || r === "src") {
304
+ if (t = H.trim(t), t === "#")
305
+ return "#";
306
+ if (!(t.substr(0, 7) === "http://" || t.substr(0, 8) === "https://" || t.substr(0, 7) === "mailto:" || t.substr(0, 4) === "tel:" || t.substr(0, 11) === "data:image/" || t.substr(0, 6) === "ftp://" || t.substr(0, 2) === "./" || t.substr(0, 3) === "../" || t[0] === "#" || t[0] === "/"))
307
+ return "";
308
+ } else if (r === "background") {
309
+ if (z.lastIndex = 0, z.test(t))
310
+ return "";
311
+ } else if (r === "style") {
312
+ if (ie.lastIndex = 0, ie.test(t) || (le.lastIndex = 0, le.test(t) && (z.lastIndex = 0, z.test(t))))
313
+ return "";
314
+ s !== !1 && (s = s || we, t = s.process(t));
315
+ }
316
+ return t = Ee(t), t;
317
+ }
318
+ var At = /</g, _t = />/g, xt = /"/g, St = /&quot;/g, Tt = /&#([a-zA-Z0-9]*);?/gim, kt = /&colon;?/gim, Lt = /&newline;?/gim, z = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi, ie = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi, le = /u\s*r\s*l\s*\(.*/gi;
319
+ function _e(e) {
320
+ return e.replace(xt, "&quot;");
321
+ }
322
+ function xe(e) {
323
+ return e.replace(St, '"');
324
+ }
325
+ function Se(e) {
326
+ return e.replace(Tt, function(t, s) {
327
+ return s[0] === "x" || s[0] === "X" ? String.fromCharCode(parseInt(s.substr(1), 16)) : String.fromCharCode(parseInt(s, 10));
328
+ });
329
+ }
330
+ function Te(e) {
331
+ return e.replace(kt, ":").replace(Lt, " ");
332
+ }
333
+ function ke(e) {
334
+ for (var r = "", t = 0, s = e.length; t < s; t++)
335
+ r += e.charCodeAt(t) < 32 ? " " : e.charAt(t);
336
+ return H.trim(r);
337
+ }
338
+ function Le(e) {
339
+ return e = xe(e), e = Se(e), e = Te(e), e = ke(e), e;
340
+ }
341
+ function Ee(e) {
342
+ return e = _e(e), e = Ae(e), e;
343
+ }
344
+ function Et() {
345
+ return "";
346
+ }
347
+ function Ct(e, r) {
348
+ typeof r != "function" && (r = function() {
349
+ });
350
+ var t = !Array.isArray(e);
351
+ function s(o) {
352
+ return t ? !0 : H.indexOf(e, o) !== -1;
353
+ }
354
+ var a = [], n = !1;
355
+ return {
356
+ onIgnoreTag: function(o, i, l) {
357
+ if (s(o))
358
+ if (l.isClosing) {
359
+ var c = "[/removed]", u = l.position + c.length;
360
+ return a.push([
361
+ n !== !1 ? n : l.position,
362
+ u
363
+ ]), n = !1, c;
364
+ } else
365
+ return n || (n = l.position), "[removed]";
366
+ else
367
+ return r(o, i, l);
368
+ },
369
+ remove: function(o) {
370
+ var i = "", l = 0;
371
+ return H.forEach(a, function(c) {
372
+ i += o.slice(l, c[0]), l = c[1];
373
+ }), i += o.slice(l), i;
374
+ }
375
+ };
376
+ }
377
+ function Bt(e) {
378
+ for (var r = "", t = 0; t < e.length; ) {
379
+ var s = e.indexOf("<!--", t);
380
+ if (s === -1) {
381
+ r += e.slice(t);
382
+ break;
383
+ }
384
+ r += e.slice(t, s);
385
+ var a = e.indexOf("-->", s);
386
+ if (a === -1)
387
+ break;
388
+ t = a + 3;
389
+ }
390
+ return r;
391
+ }
392
+ function It(e) {
393
+ var r = e.split("");
394
+ return r = r.filter(function(t) {
395
+ var s = t.charCodeAt(0);
396
+ return s === 127 ? !1 : s <= 31 ? s === 10 || s === 13 : !0;
397
+ }), r.join("");
398
+ }
399
+ p.whiteList = ve();
400
+ p.getDefaultWhiteList = ve;
401
+ p.onTag = yt;
402
+ p.onIgnoreTag = mt;
403
+ p.onTagAttr = bt;
404
+ p.onIgnoreTagAttr = vt;
405
+ p.safeAttrValue = wt;
406
+ p.escapeHtml = Ae;
407
+ p.escapeQuote = _e;
408
+ p.unescapeQuote = xe;
409
+ p.escapeHtmlEntities = Se;
410
+ p.escapeDangerHtml5Entities = Te;
411
+ p.clearNonPrintableCharacter = ke;
412
+ p.friendlyAttrValue = Le;
413
+ p.escapeAttrValue = Ee;
414
+ p.onIgnoreTagStripAll = Et;
415
+ p.StripTagBody = Ct;
416
+ p.stripCommentTag = Bt;
417
+ p.stripBlankChar = It;
418
+ p.cssFilter = we;
419
+ p.getDefaultCSSWhiteList = ht;
420
+ var N = {}, k = te;
421
+ function Ot(e) {
422
+ var r = k.spaceIndex(e), t;
423
+ return r === -1 ? t = e.slice(1, -1) : t = e.slice(1, r + 1), t = k.trim(t).toLowerCase(), t.slice(0, 1) === "/" && (t = t.slice(1)), t.slice(-1) === "/" && (t = t.slice(0, -1)), t;
424
+ }
425
+ function Ft(e) {
426
+ return e.slice(0, 2) === "</";
427
+ }
428
+ function Rt(e, r, t) {
429
+ var s = "", a = 0, n = !1, o = !1, i = 0, l = e.length, c = "", u = "";
430
+ e:
431
+ for (i = 0; i < l; i++) {
432
+ var f = e.charAt(i);
433
+ if (n === !1) {
434
+ if (f === "<") {
435
+ n = i;
436
+ continue;
437
+ }
438
+ } else if (o === !1) {
439
+ if (f === "<") {
440
+ s += t(e.slice(a, i)), n = i, a = i;
441
+ continue;
442
+ }
443
+ if (f === ">" || i === l - 1) {
444
+ s += t(e.slice(a, n)), u = e.slice(n, i + 1), c = Ot(u), s += r(
445
+ n,
446
+ s.length,
447
+ c,
448
+ u,
449
+ Ft(u)
450
+ ), a = i + 1, n = !1;
451
+ continue;
452
+ }
453
+ if (f === '"' || f === "'")
454
+ for (var d = 1, g = e.charAt(i - d); g.trim() === "" || g === "="; ) {
455
+ if (g === "=") {
456
+ o = f;
457
+ continue e;
458
+ }
459
+ g = e.charAt(i - ++d);
460
+ }
461
+ } else if (f === o) {
462
+ o = !1;
463
+ continue;
464
+ }
465
+ }
466
+ return a < l && (s += t(e.substr(a))), s;
467
+ }
468
+ var Pt = /[^a-zA-Z0-9\\_:.-]/gim;
469
+ function Ut(e, r) {
470
+ var t = 0, s = 0, a = [], n = !1, o = e.length;
471
+ function i(d, g) {
472
+ if (d = k.trim(d), d = d.replace(Pt, "").toLowerCase(), !(d.length < 1)) {
473
+ var h = r(d, g || "");
474
+ h && a.push(h);
475
+ }
476
+ }
477
+ for (var l = 0; l < o; l++) {
478
+ var c = e.charAt(l), u, f;
479
+ if (n === !1 && c === "=") {
480
+ n = e.slice(t, l), t = l + 1, s = e.charAt(t) === '"' || e.charAt(t) === "'" ? t : zt(e, l + 1);
481
+ continue;
482
+ }
483
+ if (n !== !1 && l === s) {
484
+ if (f = e.indexOf(c, l + 1), f === -1)
485
+ break;
486
+ u = k.trim(e.slice(s + 1, f)), i(n, u), n = !1, l = f, t = l + 1;
487
+ continue;
488
+ }
489
+ if (/\s|\n|\t/.test(c))
490
+ if (e = e.replace(/\s|\n|\t/g, " "), n === !1)
491
+ if (f = Wt(e, l), f === -1) {
492
+ u = k.trim(e.slice(t, l)), i(u), n = !1, t = l + 1;
493
+ continue;
494
+ } else {
495
+ l = f - 1;
496
+ continue;
497
+ }
498
+ else if (f = $t(e, l - 1), f === -1) {
499
+ u = k.trim(e.slice(t, l)), u = oe(u), i(n, u), n = !1, t = l + 1;
500
+ continue;
501
+ } else
502
+ continue;
503
+ }
504
+ return t < e.length && (n === !1 ? i(e.slice(t)) : i(n, oe(k.trim(e.slice(t))))), k.trim(a.join(" "));
505
+ }
506
+ function Wt(e, r) {
507
+ for (; r < e.length; r++) {
508
+ var t = e[r];
509
+ if (t !== " ")
510
+ return t === "=" ? r : -1;
511
+ }
512
+ }
513
+ function zt(e, r) {
514
+ for (; r < e.length; r++) {
515
+ var t = e[r];
516
+ if (t !== " ")
517
+ return t === "'" || t === '"' ? r : -1;
518
+ }
519
+ }
520
+ function $t(e, r) {
521
+ for (; r > 0; r--) {
522
+ var t = e[r];
523
+ if (t !== " ")
524
+ return t === "=" ? r : -1;
525
+ }
526
+ }
527
+ function Vt(e) {
528
+ return e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'";
529
+ }
530
+ function oe(e) {
531
+ return Vt(e) ? e.substr(1, e.length - 2) : e;
532
+ }
533
+ N.parseTag = Rt;
534
+ N.parseAttr = Ut;
535
+ var Dt = ee.FilterCSS, w = p, Ce = N, Ht = Ce.parseTag, Xt = Ce.parseAttr, D = te;
536
+ function $(e) {
537
+ return e == null;
538
+ }
539
+ function jt(e) {
540
+ var r = D.spaceIndex(e);
541
+ if (r === -1)
542
+ return {
543
+ html: "",
544
+ closing: e[e.length - 2] === "/"
545
+ };
546
+ e = D.trim(e.slice(r + 1, -1));
547
+ var t = e[e.length - 1] === "/";
548
+ return t && (e = D.trim(e.slice(0, -1))), {
549
+ html: e,
550
+ closing: t
551
+ };
552
+ }
553
+ function Nt(e) {
554
+ var r = {};
555
+ for (var t in e)
556
+ r[t] = e[t];
557
+ return r;
558
+ }
559
+ function Gt(e) {
560
+ var r = {};
561
+ for (var t in e)
562
+ Array.isArray(e[t]) ? r[t.toLowerCase()] = e[t].map(function(s) {
563
+ return s.toLowerCase();
564
+ }) : r[t.toLowerCase()] = e[t];
565
+ return r;
566
+ }
567
+ function Be(e) {
568
+ e = Nt(e || {}), e.stripIgnoreTag && (e.onIgnoreTag && console.error(
569
+ 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'
570
+ ), e.onIgnoreTag = w.onIgnoreTagStripAll), e.whiteList || e.allowList ? e.whiteList = Gt(e.whiteList || e.allowList) : e.whiteList = w.whiteList, e.onTag = e.onTag || w.onTag, e.onTagAttr = e.onTagAttr || w.onTagAttr, e.onIgnoreTag = e.onIgnoreTag || w.onIgnoreTag, e.onIgnoreTagAttr = e.onIgnoreTagAttr || w.onIgnoreTagAttr, e.safeAttrValue = e.safeAttrValue || w.safeAttrValue, e.escapeHtml = e.escapeHtml || w.escapeHtml, this.options = e, e.css === !1 ? this.cssFilter = !1 : (e.css = e.css || {}, this.cssFilter = new Dt(e.css));
571
+ }
572
+ Be.prototype.process = function(e) {
573
+ if (e = e || "", e = e.toString(), !e)
574
+ return "";
575
+ var r = this, t = r.options, s = t.whiteList, a = t.onTag, n = t.onIgnoreTag, o = t.onTagAttr, i = t.onIgnoreTagAttr, l = t.safeAttrValue, c = t.escapeHtml, u = r.cssFilter;
576
+ t.stripBlankChar && (e = w.stripBlankChar(e)), t.allowCommentTag || (e = w.stripCommentTag(e));
577
+ var f = !1;
578
+ t.stripIgnoreTagBody && (f = w.StripTagBody(
579
+ t.stripIgnoreTagBody,
580
+ n
581
+ ), n = f.onIgnoreTag);
582
+ var d = Ht(
583
+ e,
584
+ function(g, h, m, y, G) {
585
+ var E = {
586
+ sourcePosition: g,
587
+ position: h,
588
+ isClosing: G,
589
+ isWhite: Object.prototype.hasOwnProperty.call(s, m)
590
+ }, C = a(m, y, E);
591
+ if (!$(C))
592
+ return C;
593
+ if (E.isWhite) {
594
+ if (E.isClosing)
595
+ return "</" + m + ">";
596
+ var _ = jt(y), M = s[m], x = Xt(_.html, function(S, O) {
597
+ var q = D.indexOf(M, S) !== -1, F = o(m, S, O, q);
598
+ return $(F) ? q ? (O = l(m, S, O, u), O ? S + '="' + O + '"' : S) : (F = i(m, S, O, q), $(F) ? void 0 : F) : F;
599
+ });
600
+ return y = "<" + m, x && (y += " " + x), _.closing && (y += " /"), y += ">", y;
601
+ } else
602
+ return C = n(m, y, E), $(C) ? c(y) : C;
603
+ },
604
+ c
605
+ );
606
+ return f && (d = f.remove(d)), d;
607
+ };
608
+ var Mt = Be;
609
+ (function(e, r) {
610
+ var t = p, s = N, a = Mt;
611
+ function n(i, l) {
612
+ var c = new a(l);
613
+ return c.process(i);
614
+ }
615
+ r = e.exports = n, r.filterXSS = n, r.FilterXSS = a, function() {
616
+ for (var i in t)
617
+ r[i] = t[i];
618
+ for (var l in s)
619
+ r[l] = s[l];
620
+ }(), typeof window < "u" && (window.filterXSS = e.exports);
621
+ function o() {
622
+ return typeof self < "u" && typeof DedicatedWorkerGlobalScope < "u" && self instanceof DedicatedWorkerGlobalScope;
623
+ }
624
+ o() && (self.filterXSS = e.exports);
625
+ })(Z, Z.exports);
626
+ var X = Z.exports;
627
+ let v = {
628
+ enableAttrs: !0,
629
+ enableHtml: !0,
630
+ enableUrl: !0,
631
+ html: {
632
+ whiteList: {
633
+ a: ["class", "style", "contenteditable", "data-id", "data-title", "data-size", "data-last-modified"],
634
+ address: ["class", "style"],
635
+ area: ["class", "style"],
636
+ article: ["class", "style"],
637
+ aside: ["class", "style"],
638
+ audio: ["class", "style"],
639
+ b: ["class", "style"],
640
+ bdi: ["class", "style"],
641
+ bdo: ["class", "style"],
642
+ big: ["class", "style"],
643
+ blockquote: ["class", "style"],
644
+ br: ["class", "style"],
645
+ caption: ["class", "style"],
646
+ center: ["class", "style"],
647
+ cite: ["class", "style"],
648
+ code: ["class", "style"],
649
+ col: ["class", "style"],
650
+ colgroup: ["class", "style"],
651
+ dd: ["class", "style"],
652
+ del: ["class", "style"],
653
+ details: ["class", "style"],
654
+ div: [
655
+ "class",
656
+ "style",
657
+ "spellcheck",
658
+ "data-gramm",
659
+ "spellcheck",
660
+ "data-mode",
661
+ "data-position",
662
+ "data-row",
663
+ "data-cell",
664
+ "data-rowspan",
665
+ "data-colspan",
666
+ "data-cell-bg",
667
+ "data-parent-bg"
668
+ ],
669
+ dl: ["class", "style"],
670
+ dt: ["class", "style"],
671
+ em: ["class", "style"],
672
+ figcaption: ["class", "style"],
673
+ figure: ["class", "style"],
674
+ font: ["class", "style"],
675
+ footer: ["class", "style"],
676
+ h1: ["class", "style"],
677
+ h2: ["class", "style"],
678
+ h3: ["class", "style"],
679
+ h4: ["class", "style"],
680
+ h5: ["class", "style"],
681
+ h6: ["class", "style"],
682
+ header: ["class", "style"],
683
+ hr: ["class", "style"],
684
+ i: ["class", "style", "data-image-id", "data-image"],
685
+ img: ["class", "style", "devui-editorx-image", "style", "data-image-id"],
686
+ input: ["class", "style", "data-formula", "data-link", "data-video"],
687
+ ins: ["class", "style"],
688
+ li: ["class", "style"],
689
+ mark: ["class", "style"],
690
+ nav: ["class", "style"],
691
+ ol: ["class", "style"],
692
+ p: ["class", "style"],
693
+ pre: ["class", "style"],
694
+ s: ["class", "style"],
695
+ section: ["class", "style"],
696
+ small: ["class", "style"],
697
+ span: ["class", "style", "contenteditable", "color", "style"],
698
+ sub: ["class", "style"],
699
+ summary: ["class", "style"],
700
+ sup: ["class", "style"],
701
+ strong: ["class", "style"],
702
+ strike: ["class", "style"],
703
+ svg: ["class", "style", "t", "viewBox", "viewbox", "version", "xmlns", "p-id", "xmlns:xlink"],
704
+ path: ["d", "p-id"],
705
+ table: ["class", "style"],
706
+ tbody: ["class", "style"],
707
+ td: ["class", "style", "data-row", "data-cell", "data-cell-bg", "data-parent-bg"],
708
+ tfoot: ["class", "style"],
709
+ th: ["class", "style"],
710
+ thead: ["class", "style"],
711
+ tr: ["class", "style", "data-row"],
712
+ tt: ["class", "style"],
713
+ u: ["class", "style"],
714
+ ul: ["class", "style"],
715
+ video: ["class", "style"]
716
+ }
717
+ }
718
+ };
719
+ const qt = X.getDefaultWhiteList && X.getDefaultWhiteList() || {};
720
+ v.html.whiteList = Object.assign(qt, v.html.whiteList);
721
+ let Ie = new X.FilterXSS(v.html);
722
+ const Qt = () => v, Zt = (e) => {
723
+ var t;
724
+ let r;
725
+ (t = e == null ? void 0 : e.html) != null && t.whiteList && (r = Object.assign(v.html.whiteList, e.html.whiteList)), v = Object.assign(v, e), r && (v.html.whiteList = r), Ie = new X.FilterXSS(v.html);
726
+ };
727
+ let Oe = (e) => !v.enableHtml || typeof e != "string" ? e : Ie.process(e);
728
+ const Jt = (e) => {
729
+ Oe = e;
730
+ };
731
+ let Fe = (e) => !v.enableAttrs || typeof e != "string" ? e : e.replace(/<.*?>/gi, "").replace(/on[a-z]+=/gi, "");
732
+ const Kt = (e) => {
733
+ Fe = e;
734
+ };
735
+ let Re = (e) => {
736
+ if (!v.enableUrl || typeof e != "string")
737
+ return e;
738
+ const r = e.replace(/&#(\w+)(^\w|;)?/g, (s, a) => String.fromCharCode(a)).replace(/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim, "").trim();
739
+ if (!r)
740
+ return "";
741
+ if ([".", "/"].includes(r[0]))
742
+ return r;
743
+ const t = r.match(/^([^:]+):/gm);
744
+ return t && /^([^\w]*)(javascript|data|vbscript)/im.test(t[0]) ? "" : r;
745
+ };
746
+ const Yt = (e) => {
747
+ Re = e;
748
+ }, Pe = {
749
+ getXssOption: Qt,
750
+ setXssOption: Zt,
751
+ filterHtml: Oe,
752
+ setFilterHtml: Jt,
753
+ filterAttrs: Fe,
754
+ setFilterAttrs: Kt,
755
+ filterUrl: Re,
756
+ setFilterUrl: Yt
757
+ }, er = j(), tr = "console", rr = er[tr] || {};
758
+ let Ue = !0;
759
+ const U = {}, sr = (e, r) => function(...t) {
760
+ Ue && e[r] && typeof e[r] == "function" && e[r](...t);
761
+ }, ar = (e) => (Object.keys(e).forEach((r) => {
762
+ U[r] = sr(e, r);
763
+ }), U), nr = (e) => {
764
+ Ue = !!e;
765
+ }, ir = (e, r) => {
766
+ U && Object.hasOwnProperty.call(U, e) && (U[e] = r);
767
+ }, fe = ar(rr), We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
768
+ __proto__: null,
769
+ default: fe,
770
+ logger: fe,
771
+ setLogger: ir,
772
+ switchLogger: nr
773
+ }, Symbol.toStringTag, { value: "Module" })), ce = j().crypto;
774
+ let K;
775
+ ce ? K = (e) => {
776
+ const r = [];
777
+ for (let t = 0; t < e; t += 4)
778
+ r.push(ce.getRandomValues(new Uint32Array(1))[0]);
779
+ return new A(r, e);
780
+ } : K = (e) => {
781
+ const r = [], t = (s) => {
782
+ let a = s, n = 987654321;
783
+ const o = 4294967295;
784
+ return () => {
785
+ n = 36969 * (n & 65535) + (n >> 16) & o, a = 18e3 * (a & 65535) + (a >> 16) & o;
786
+ let i = (n << 16) + a & o;
787
+ return i /= 4294967296, i += 0.5, i * (Math.random() > 0.5 ? 1 : -1);
788
+ };
789
+ };
790
+ for (let s = 0, a; s < e; s += 4) {
791
+ const n = t((a || Math.random()) * 4294967296);
792
+ a = n() * 987654071, r.push(n() * 4294967296 | 0);
793
+ }
794
+ return new A(r, e);
795
+ };
796
+ class re {
797
+ // @ts-ignore
798
+ static create(...r) {
799
+ return new this(...r);
800
+ }
801
+ clone() {
802
+ const r = new this.constructor();
803
+ return Object.assign(r, this), r;
804
+ }
805
+ mixIn(r) {
806
+ return Object.assign(this, r);
807
+ }
808
+ }
809
+ class A extends re {
810
+ constructor(t = [], s = t.length * 4) {
811
+ super();
812
+ b(this, "words");
813
+ b(this, "sigBytes");
814
+ let a = t;
815
+ if (a instanceof ArrayBuffer && (a = new Uint8Array(a)), (a instanceof Int8Array || a instanceof Uint8ClampedArray || a instanceof Int16Array || a instanceof Uint16Array || a instanceof Int32Array || a instanceof Uint32Array || a instanceof Float32Array || a instanceof Float64Array) && (a = new Uint8Array(a.buffer, a.byteOffset, a.byteLength)), a instanceof Uint8Array) {
816
+ const n = a.byteLength, o = [];
817
+ for (let i = 0; i < n; i += 1)
818
+ o[i >>> 2] |= a[i] << 24 - i % 4 * 8;
819
+ this.words = o, this.sigBytes = n;
820
+ } else
821
+ this.words = t, this.sigBytes = s;
822
+ }
823
+ toString(t = lr) {
824
+ return t.stringify(this);
825
+ }
826
+ concat(t) {
827
+ const s = this.words, a = t.words, n = this.sigBytes, o = t.sigBytes;
828
+ if (this.clamp(), n % 4)
829
+ for (let i = 0; i < o; i += 1) {
830
+ const l = a[i >>> 2] >>> 24 - i % 4 * 8 & 255;
831
+ s[n + i >>> 2] |= l << 24 - (n + i) % 4 * 8;
832
+ }
833
+ else
834
+ for (let i = 0; i < o; i += 4)
835
+ s[n + i >>> 2] = a[i >>> 2];
836
+ return this.sigBytes += o, this;
837
+ }
838
+ clone() {
839
+ const t = super.clone.call(this);
840
+ return t.words = this.words.slice(0), t;
841
+ }
842
+ clamp() {
843
+ const { words: t, sigBytes: s } = this;
844
+ t[s >>> 2] &= 4294967295 << 32 - s % 4 * 8, t.length = Math.ceil(s / 4);
845
+ }
846
+ }
847
+ b(A, "random", K);
848
+ const ue = {
849
+ stringify(e) {
850
+ const { words: r, sigBytes: t } = e, s = [];
851
+ for (let a = 0; a < t; a += 1) {
852
+ const n = r[a >>> 2] >>> 24 - a % 4 * 8 & 255;
853
+ s.push(String.fromCharCode(n));
854
+ }
855
+ return s.join("");
856
+ },
857
+ parse(e) {
858
+ const r = e.length, t = [];
859
+ for (let s = 0; s < r; s += 1)
860
+ t[s >>> 2] |= (e.charCodeAt(s) & 255) << 24 - s % 4 * 8;
861
+ return new A(t, r);
862
+ }
863
+ }, lr = {
864
+ stringify(e) {
865
+ const { words: r, sigBytes: t } = e, s = [];
866
+ for (let a = 0; a < t; a += 1) {
867
+ const n = r[a >>> 2] >>> 24 - a % 4 * 8 & 255;
868
+ s.push((n >>> 4).toString(16)), s.push((n & 15).toString(16));
869
+ }
870
+ return s.join("");
871
+ },
872
+ parse(e) {
873
+ const r = e.length, t = [];
874
+ for (let s = 0; s < r; s += 2)
875
+ t[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
876
+ return new A(t, r / 2);
877
+ }
878
+ }, or = {
879
+ stringify(e) {
880
+ try {
881
+ return decodeURIComponent(escape(ue.stringify(e)));
882
+ } catch {
883
+ throw new Error("The UTF-8 data format is incorrect.");
884
+ }
885
+ },
886
+ parse(e) {
887
+ return ue.parse(unescape(encodeURIComponent(e)));
888
+ }
889
+ };
890
+ class fr extends re {
891
+ constructor() {
892
+ super();
893
+ b(this, "_minBufferSize");
894
+ b(this, "_nDataBytes", 0);
895
+ b(this, "_data");
896
+ b(this, "blockSize", 0);
897
+ this._minBufferSize = 0;
898
+ }
899
+ _append(t) {
900
+ let s = t;
901
+ typeof s == "string" && (s = or.parse(s)), this._data.concat(s), this._nDataBytes += s.sigBytes;
902
+ }
903
+ reset() {
904
+ this._data = new A(), this._nDataBytes = 0;
905
+ }
906
+ _process(t) {
907
+ let s;
908
+ const { _data: a, blockSize: n } = this, o = a.words, i = a.sigBytes, l = n * 4;
909
+ let c = i / l;
910
+ t ? c = Math.ceil(c) : c = Math.max((c | 0) - this._minBufferSize, 0);
911
+ const u = c * n, f = Math.min(u * 4, i);
912
+ if (u) {
913
+ for (let d = 0; d < u; d += n)
914
+ this._doProcessBlock(o, d);
915
+ s = o.splice(0, u), a.sigBytes -= f;
916
+ }
917
+ return new A(s, f);
918
+ }
919
+ clone() {
920
+ const t = super.clone.call(this);
921
+ return t._data = this._data.clone(), t;
922
+ }
923
+ }
924
+ class ze extends fr {
925
+ constructor(t) {
926
+ super();
927
+ b(this, "cfg");
928
+ b(this, "_process");
929
+ this.cfg = Object.assign(new re(), t), this.blockSize = 512 / 32, this.reset();
930
+ }
931
+ static _createHelper(t) {
932
+ return (s, a) => new t(a).finalize(s);
933
+ }
934
+ update(t) {
935
+ return this._append(t), this._process(), this;
936
+ }
937
+ reset() {
938
+ super.reset.call(this), this._doReset();
939
+ }
940
+ finalize(t) {
941
+ return t && this._append(t), this._doFinalize();
942
+ }
943
+ }
944
+ const $e = [], Ve = [], B = [];
945
+ let V = 2, P = 0;
946
+ const cr = (e) => {
947
+ const r = Math.sqrt(e);
948
+ for (let t = 2; t <= r; t += 1)
949
+ if (!(e % t))
950
+ return !1;
951
+ return !0;
952
+ }, ge = (e) => (e - (e | 0)) * 4294967296 | 0;
953
+ for (; P < 64; )
954
+ cr(V) && (P < 8 && ($e[P] = ge(V ** (1 / 2))), Ve[P] = ge(V ** (1 / 3)), P += 1), V += 1;
955
+ class ur extends ze {
956
+ constructor() {
957
+ super(...arguments);
958
+ b(this, "_hash");
959
+ b(this, "_data");
960
+ }
961
+ _doReset() {
962
+ this._hash = new A($e.slice(0));
963
+ }
964
+ _doProcessBlock(t, s) {
965
+ const a = this._hash.words;
966
+ let n = a[0], o = a[1], i = a[2], l = a[3], c = a[4], u = a[5], f = a[6], d = a[7];
967
+ for (let g = 0; g < 64; g += 1) {
968
+ if (g < 16)
969
+ B[g] = t[s + g] | 0;
970
+ else {
971
+ const _ = B[g - 15], M = (_ << 25 | _ >>> 7) ^ (_ << 14 | _ >>> 18) ^ _ >>> 3, x = B[g - 2], S = (x << 15 | x >>> 17) ^ (x << 13 | x >>> 19) ^ x >>> 10;
972
+ B[g] = M + B[g - 7] + S + B[g - 16];
973
+ }
974
+ const h = (n << 30 | n >>> 2) ^ (n << 19 | n >>> 13) ^ (n << 10 | n >>> 22), m = (c << 26 | c >>> 6) ^ (c << 21 | c >>> 11) ^ (c << 7 | c >>> 25), y = c & u ^ ~c & f, G = n & o ^ n & i ^ o & i, E = d + m + y + Ve[g] + B[g], C = h + G;
975
+ d = f, f = u, u = c, c = l + E | 0, l = i, i = o, o = n, n = E + C | 0;
976
+ }
977
+ a[0] = a[0] + n | 0, a[1] = a[1] + o | 0, a[2] = a[2] + i | 0, a[3] = a[3] + l | 0, a[4] = a[4] + c | 0, a[5] = a[5] + u | 0, a[6] = a[6] + f | 0, a[7] = a[7] + d | 0;
978
+ }
979
+ _doFinalize() {
980
+ const t = this._data, s = t.words, a = this._nDataBytes * 8, n = t.sigBytes * 8;
981
+ return s[n >>> 5] |= 128 << 24 - n % 32, s[(n + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296), s[(n + 64 >>> 9 << 4) + 15] = a, t.sigBytes = s.length * 4, this._process(), this._hash;
982
+ }
983
+ clone() {
984
+ const t = super.clone.call(this);
985
+ return t._hash = this._hash.clone(), t;
986
+ }
987
+ }
988
+ const de = ze._createHelper(ur);
989
+ async function gr(e, r) {
990
+ const s = Object.prototype.toString.call(r) === "[object ArrayBuffer]" ? r : new TextEncoder().encode(r), a = await window.crypto.subtle.digest(e, s);
991
+ return Array.from(new Uint8Array(a)).map((i) => i.toString(16).padStart(2, "0")).join("");
992
+ }
993
+ function dr(e) {
994
+ return window.crypto.subtle ? gr("SHA-256", e) : Object.prototype.toString.call(e) === "[object ArrayBuffer]" ? de(new A(e), "").toString() : de(e, "").toStrsha256;
995
+ }
996
+ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
997
+ __proto__: null,
998
+ sha256: dr
999
+ }, Symbol.toStringTag, { value: "Module" })), hr = {
1000
+ nanoid: ye,
1001
+ xss: Pe,
1002
+ log: We,
1003
+ crypt: De
1004
+ }, yr = ye, mr = Pe, br = We, vr = De;
1005
+ export {
1006
+ vr as crypt,
1007
+ hr as default,
1008
+ br as log,
1009
+ yr as nanoid,
1010
+ mr as xss
1011
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@opentiny/utils",
3
+ "version": "1.0.0",
4
+ "description": "nanoid console xss",
5
+ "author": "",
6
+ "license": "ISC",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git@github.com:opentiny/tiny-vue.git"
10
+ },
11
+ "main": "dist/opentiny-utils.es.js",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "dependencies": {
16
+ "xss": "1.0.14"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.2.2",
20
+ "vite": "^6.0.0"
21
+ },
22
+ "scripts": {
23
+ "build": "vite build",
24
+ "pub": "pnpm publish --no-git-checks --access=public"
25
+ }
26
+ }