diff --git a/build-common.ts b/build-common.ts index bb145e1..718c333 100644 --- a/build-common.ts +++ b/build-common.ts @@ -3,6 +3,7 @@ import { userscriptMetadataGenerator, } from "esm.sh/userscript-metadata-generator@0.2.4"; import packageJson from "./package.json" with { type: "json" }; +import { requiredLibs } from "./src/userscript-meta.ts"; export function meta(): string { const metadata: Metadata = { name: "notion-kroki", @@ -16,6 +17,7 @@ export function meta(): string { license: "MIT", match: ["*://www.notion.so/*", "*://*.notion.site/*", "*://*.super.site/*"], supportURL: "https://github.com/zuisong/notion-kroki/issues", + require: requiredLibs, "run-at": "document-idle", author: "zuisong", description: "Render notion code block as graph by kroki", diff --git a/deno.lock b/deno.lock index 37cd943..2d5af3c 100644 --- a/deno.lock +++ b/deno.lock @@ -79,14 +79,14 @@ "https://deno.land/std@0.208.0/assert/assert_equals.ts": "d8ec8a22447fbaf2fc9d7c3ed2e66790fdb74beae3e482855d75782218d68227", "https://deno.land/std@0.208.0/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56", "https://deno.land/std@0.208.0/assert/equal.ts": "9f1a46d5993966d2596c44e5858eec821859b45f783a5ee2f7a695dfc12d8ece", + "https://deno.land/std@0.208.0/async/delay.ts": "a6142eb44cdd856b645086af2b811b1fcce08ec06bb7d50969e6a872ee9b8659", "https://deno.land/std@0.208.0/fmt/colors.ts": "34b3f77432925eb72cf0bfb351616949746768620b8e5ead66da532f93d10ba2", "https://deno.land/std@0.208.0/testing/_test_suite.ts": "30f018feeb3835f12ab198d8a518f9089b1bcb2e8c838a8b615ab10d5005465c", "https://deno.land/std@0.208.0/testing/bdd.ts": "c41f019786c4a9112aadb7e5a7bbcc711f58429ac5904b3855fa248ba5fa0ba6", "https://esm.sh/v135/@jridgewell/resolve-uri@3.1.1": "1cece3c73bc8b5c594f8fbf00fb83b7ac29a16a1a991caa2dd3c67f3e9d70212", "https://esm.sh/v135/@jridgewell/resolve-uri@3.1.1/denonext/resolve-uri.mjs": "239f11fbc4483ded7e3bc97eeaf942760d5e83d2e15cb8199e48ea61b6b49948", - "https://esm.sh/v135/fflate@0.8.0": "e20470221a57b1448d1cb5105d7afd1cb6dc8e30cb963b99ec70dc5e28497d59", - "https://esm.sh/v135/fflate@0.8.0/denonext/fflate.mjs": "2792676fe3ccd7b23597f69e7601ef914ccf1883465609ae2788d5dd75548937", "https://esm.sh/v135/userscript-metadata-generator@0.2.4": "8ff8d708cdbcb1729923d8ff5ac61936b34bf8156529fb0898c76aed0fa1b31a", - "https://esm.sh/v135/userscript-metadata-generator@0.2.4/denonext/userscript-metadata-generator.mjs": "b3246c2052e813b22630b51f9df2cd8b34b3d57223deae4690196fe74d3976e5" + "https://esm.sh/v135/userscript-metadata-generator@0.2.4/denonext/userscript-metadata-generator.mjs": "b3246c2052e813b22630b51f9df2cd8b34b3d57223deae4690196fe74d3976e5", + "https://unpkg.com/fflate@0.8.0/umd/index.js": "d0177b5ab8b6059fe1f3317c2bf448318d9beb336a04317ec7cc9bc8cb7d00ab" } } diff --git a/index.html b/index.html index 3722e2a..4c70780 100644 --- a/index.html +++ b/index.html @@ -18,10 +18,10 @@ -
+
- \ No newline at end of file + diff --git a/notion-kroki.user.js b/notion-kroki.user.js index 16c1c55..ae438bd 100644 --- a/notion-kroki.user.js +++ b/notion-kroki.user.js @@ -12,6 +12,7 @@ // @match *://*.notion.site/* // @match *://*.super.site/* // @supportURL https://github.com/zuisong/notion-kroki/issues +// @require https://unpkg.com/fflate@0.8.0/umd/index.js // @run-at document-idle // @author zuisong // @description Render notion code block as graph by kroki @@ -41,367 +42,6 @@ function isDebugMode() { return !!localStorage.getItem("debug"); } -/* esm.sh - esbuild bundle(fflate@0.8.0) denonext production */ var U = Uint8Array, Y = Uint16Array, Zr = Int32Array, wr = new U([ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 2, - 2, - 2, - 3, - 3, - 3, - 3, - 4, - 4, - 4, - 4, - 5, - 5, - 5, - 5, - 0, - 0, - 0, - 0 -]), mr = new U([ - 0, - 0, - 0, - 0, - 1, - 1, - 2, - 2, - 3, - 3, - 4, - 4, - 5, - 5, - 6, - 6, - 7, - 7, - 8, - 8, - 9, - 9, - 10, - 10, - 11, - 11, - 12, - 12, - 13, - 13, - 0, - 0 -]), Cr = new U([ - 16, - 17, - 18, - 0, - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15 -]), An = function(n, r) { - for(var t = new Y(31), e = 0; e < 31; ++e)t[e] = r += 1 << n[e - 1]; - for(var i = new Zr(t[30]), e = 1; e < 30; ++e)for(var a = t[e]; a < t[e + 1]; ++a)i[a] = a - t[e] << 5 | e; - return { - b: t, - r: i - }; -}, Mn = An(wr, 2), tn = Mn.b, qr = Mn.r; -tn[28] = 258, qr[258] = 28; -var Un = An(mr, 0), Qr = Un.r, Ir = new Y(32768); -for(C = 0; C < 32768; ++C)nr = (C & 43690) >> 1 | (C & 21845) << 1, nr = (nr & 52428) >> 2 | (nr & 13107) << 2, nr = (nr & 61680) >> 4 | (nr & 3855) << 4, Ir[C] = ((nr & 65280) >> 8 | (nr & 255) << 8) >> 1; -var nr, C, V = function(n, r, t) { - for(var e = n.length, i = 0, a = new Y(r); i < e; ++i)n[i] && ++a[n[i] - 1]; - var o = new Y(r); - for(i = 1; i < r; ++i)o[i] = o[i - 1] + a[i - 1] << 1; - var s; - if (t) { - s = new Y(1 << r); - var l = 15 - r; - for(i = 0; i < e; ++i)if (n[i]) for(var h = i << 4 | n[i], f = r - n[i], u = o[n[i] - 1]++ << f, p = u | (1 << f) - 1; u <= p; ++u)s[Ir[u] >> l] = h; - } else for(s = new Y(e), i = 0; i < e; ++i)n[i] && (s[i] = Ir[o[n[i] - 1]++] >> 15 - n[i]); - return s; -}, tr = new U(288); -for(C = 0; C < 144; ++C)tr[C] = 8; -var C; -for(C = 144; C < 256; ++C)tr[C] = 9; -var C; -for(C = 256; C < 280; ++C)tr[C] = 7; -var C; -for(C = 280; C < 288; ++C)tr[C] = 8; -var C, gr = new U(32); -for(C = 0; C < 32; ++C)gr[C] = 5; -var C, Dn = V(tr, 9, 0); V(tr, 9, 1); var Tn = V(gr, 5, 0); V(gr, 5, 1); var xr = function(n) { - return (n + 7) / 8 | 0; -}, X = function(n, r, t) { - (r == null || r < 0) && (r = 0), (t == null || t > n.length) && (t = n.length); - var e = new U(t - r); - return e.set(n.subarray(r, t)), e; -}, _ = function(n, r, t) { - t <<= r & 7; - var e = r / 8 | 0; - n[e] |= t, n[e + 1] |= t >> 8; -}, cr = function(n, r, t) { - t <<= r & 7; - var e = r / 8 | 0; - n[e] |= t, n[e + 1] |= t >> 8, n[e + 2] |= t >> 16; -}, $r = function(n, r) { - for(var t = [], e = 0; e < n.length; ++e)n[e] && t.push({ - s: e, - f: n[e] - }); - var i = t.length, a = t.slice(); - if (!i) return { - t: ir, - l: 0 - }; - if (i == 1) { - var o = new U(t[0].s + 1); - return o[t[0].s] = 1, { - t: o, - l: 1 - }; - } - t.sort(function(I, B) { - return I.f - B.f; - }), t.push({ - s: -1, - f: 25001 - }); - var s = t[0], l = t[1], h = 0, f = 1, u = 2; - for(t[0] = { - s: -1, - f: s.f + l.f, - l: s, - r: l - }; f != i - 1;)s = t[t[h].f < t[u].f ? h++ : u++], l = t[h != f && t[h].f < t[u].f ? h++ : u++], t[f++] = { - s: -1, - f: s.f + l.f, - l: s, - r: l - }; - for(var p = a[0].s, e = 1; e < i; ++e)a[e].s > p && (p = a[e].s); - var F = new Y(p + 1), m = Hr(t[f - 1], F, 0); - if (m > r) { - var e = 0, z = 0, c = m - r, x = 1 << c; - for(a.sort(function(B, S) { - return F[S.s] - F[B.s] || B.f - S.f; - }); e < i; ++e){ - var M = a[e].s; - if (F[M] > r) z += x - (1 << m - F[M]), F[M] = r; - else break; - } - for(z >>= c; z > 0;){ - var D = a[e].s; - F[D] < r ? z -= 1 << r - F[D]++ - 1 : ++e; - } - for(; e >= 0 && z; --e){ - var w = a[e].s; - F[w] == r && (--F[w], ++z); - } - m = r; - } - return { - t: new U(F), - l: m - }; -}, Hr = function(n, r, t) { - return n.s == -1 ? Math.max(Hr(n.l, r, t + 1), Hr(n.r, r, t + 1)) : r[n.s] = t; -}, Vr = function(n) { - for(var r = n.length; r && !n[--r];); - for(var t = new Y(++r), e = 0, i = n[0], a = 1, o = function(l) { - t[e++] = l; - }, s = 1; s <= r; ++s)if (n[s] == i && s != r) ++a; - else { - if (!i && a > 2) { - for(; a > 138; a -= 138)o(32754); - a > 2 && (o(a > 10 ? a - 11 << 5 | 28690 : a - 3 << 5 | 12305), a = 0); - } else if (a > 3) { - for(o(i), --a; a > 6; a -= 6)o(8304); - a > 2 && (o(a - 3 << 5 | 8208), a = 0); - } - for(; a--;)o(i); - a = 1, i = n[s]; - } - return { - c: t.subarray(0, e), - n: r - }; -}, pr = function(n, r) { - for(var t = 0, e = 0; e < r.length; ++e)t += n[e] * r[e]; - return t; -}, en = function(n, r, t) { - var e = t.length, i = xr(r + 2); - n[i] = e & 255, n[i + 1] = e >> 8, n[i + 2] = n[i] ^ 255, n[i + 3] = n[i + 1] ^ 255; - for(var a = 0; a < e; ++a)n[i + a + 4] = t[a]; - return (i + 4 + e) * 8; -}, Xr = function(n, r, t, e, i, a, o, s, l, h, f) { - _(r, f++, t), ++i[256]; - for(var u = $r(i, 15), p = u.t, F = u.l, m = $r(a, 15), z = m.t, c = m.l, x = Vr(p), M = x.c, D = x.n, w = Vr(z), I = w.c, B = w.n, S = new Y(19), y = 0; y < M.length; ++y)++S[M[y] & 31]; - for(var y = 0; y < I.length; ++y)++S[I[y] & 31]; - for(var g = $r(S, 7), A = g.t, $ = g.l, O = 19; O > 4 && !A[Cr[O - 1]]; --O); - var H = h + 5 << 3, Z = pr(i, tr) + pr(a, gr) + o, E = pr(i, p) + pr(a, z) + o + 14 + 3 * O + pr(S, A) + 2 * S[16] + 3 * S[17] + 7 * S[18]; - if (l >= 0 && H <= Z && H <= E) return en(r, f, n.subarray(l, l + h)); - var P, G, L, J; - if (_(r, f, 1 + (E < Z)), f += 2, E < Z) { - P = V(p, F, 0), G = p, L = V(z, c, 0), J = z; - var sr = V(A, $, 0); - _(r, f, D - 257), _(r, f + 5, B - 1), _(r, f + 10, O - 4), f += 14; - for(var y = 0; y < O; ++y)_(r, f + 3 * y, A[Cr[y]]); - f += 3 * O; - for(var N = [ - M, - I - ], K = 0; K < 2; ++K)for(var rr = N[K], y = 0; y < rr.length; ++y){ - var R = rr[y] & 31; - _(r, f, sr[R]), f += A[R], R > 15 && (_(r, f, rr[y] >> 5 & 127), f += rr[y] >> 12); - } - } else P = Dn, G = tr, L = Tn, J = gr; - for(var y = 0; y < s; ++y){ - var k = e[y]; - if (k > 255) { - var R = k >> 18 & 31; - cr(r, f, P[R + 257]), f += G[R + 257], R > 7 && (_(r, f, k >> 23 & 31), f += wr[R]); - var b = k & 31; - cr(r, f, L[b]), f += J[b], b > 3 && (cr(r, f, k >> 5 & 8191), f += mr[b]); - } else cr(r, f, P[k]), f += G[k]; - } - return cr(r, f, P[256]), f + G[256]; -}, Zn = new Zr([ - 65540, - 131080, - 131088, - 131104, - 262176, - 1048704, - 1048832, - 2114560, - 2117632 -]), ir = new U(0), Bn = function(n, r, t, e, i, a) { - var o = a.z || n.length, s = new U(e + o + 5 * (1 + Math.ceil(o / 7e3)) + i), l = s.subarray(e, s.length - i), h = a.l, f = (a.r || 0) & 7; - if (r) { - f && (l[0] = a.r >> 3); - for(var u = Zn[r - 1], p = u >> 13, F = u & 8191, m = (1 << t) - 1, z = a.p || new Y(32768), c = a.h || new Y(m + 1), x = Math.ceil(t / 3), M = 2 * x, D = function(Jr) { - return (n[Jr] ^ n[Jr + 1] << x ^ n[Jr + 2] << M) & m; - }, w = new Zr(25e3), I = new Y(288), B = new Y(32), S = 0, y = 0, g = a.i || 0, A = 0, $ = a.w || 0, O = 0; g + 2 < o; ++g){ - var H = D(g), Z = g & 32767, E = c[H]; - if (z[Z] = E, c[H] = Z, $ <= g) { - var P = o - g; - if ((S > 7e3 || A > 24576) && (P > 423 || !h)) { - f = Xr(n, l, 0, w, I, B, y, A, O, g - O, f), A = S = y = 0, O = g; - for(var G = 0; G < 286; ++G)I[G] = 0; - for(var G = 0; G < 30; ++G)B[G] = 0; - } - var L = 2, J = 0, sr = F, N = Z - E & 32767; - if (P > 2 && H == D(g - N)) for(var K = Math.min(p, P) - 1, rr = Math.min(32767, g), R = Math.min(258, P); N <= rr && --sr && Z != E;){ - if (n[g + L] == n[g + L - N]) { - for(var k = 0; k < R && n[g + k] == n[g + k - N]; ++k); - if (k > L) { - if (L = k, J = N, k > K) break; - for(var b = Math.min(N, k - 2), lr = 0, G = 0; G < b; ++G){ - var vr = g - N + G & 32767, Yr = z[vr], Dr = vr - Yr & 32767; - Dr > lr && (lr = Dr, E = vr); - } - } - } - Z = E, E = z[Z], N += Z - E & 32767; - } - if (J) { - w[A++] = 268435456 | qr[L] << 18 | Qr[J]; - var Sr = qr[L] & 31, Tr = Qr[J] & 31; - y += wr[Sr] + mr[Tr], ++I[257 + Sr], ++B[Tr], $ = g + L, ++S; - } else w[A++] = n[g], ++I[n[g]]; - } - } - for(g = Math.max(g, $); g < o; ++g)w[A++] = n[g], ++I[n[g]]; - f = Xr(n, l, h, w, I, B, y, A, O, g - O, f), h || (a.r = f & 7 | l[f / 8 | 0] << 3, f -= 7, a.h = c, a.p = z, a.i = g, a.w = $); - } else { - for(var g = a.w || 0; g < o + h; g += 65535){ - var jr = g + 65535; - jr >= o && (l[f / 8 | 0] = h, jr = o), f = en(l, f + 1, n.subarray(g, jr)); - } - a.i = o; - } - return X(s, 0, e + xr(f) + i); -}; (function() { - for(var n = new Int32Array(256), r = 0; r < 256; ++r){ - for(var t = r, e = 9; --e;)t = (t & 1 && -306674912) ^ t >>> 1; - n[r] = t; - } - return n; -})(); var Rr = function() { - var n = 1, r = 0; - return { - p: function(t) { - for(var e = n, i = r, a = t.length | 0, o = 0; o != a;){ - for(var s = Math.min(o + 2655, a); o < s; ++o)i += e += t[o]; - e = (e & 65535) + 15 * (e >> 16), i = (i & 65535) + 15 * (i >> 16); - } - n = e, r = i; - }, - d: function() { - return n %= 65521, r %= 65521, (n & 255) << 24 | (n & 65280) << 8 | (r & 255) << 8 | r >> 8; - } - }; -}, hr = function(n, r, t, e, i) { - if (!i && (i = { - l: 1 - }, r.dictionary)) { - var a = r.dictionary.subarray(-32768), o = new U(a.length + n.length); - o.set(a), o.set(n, a.length), n = o, i.w = a.length; - } - return Bn(n, r.level == null ? 6 : r.level, r.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(n.length))) * 1.5) : 12 + r.mem, t, e, i); -}, T = function(n, r, t) { - for(; t; ++r)n[r] = t, t >>>= 8; -}, hn = function(n, r) { - var t = r.level, e = t == 0 ? 0 : t < 6 ? 1 : t == 9 ? 3 : 2; - if (n[0] = 120, n[1] = e << 6 | (r.dictionary && 32), n[1] |= 31 - (n[0] << 8 | n[1]) % 31, r.dictionary) { - var i = Rr(); - i.p(r.dictionary), T(n, 2, i.d()); - } -}; -function mn(n, r) { - r || (r = {}); - var t = Rr(); - t.p(n); - var e = hr(n, r, r.dictionary ? 6 : 2, 4); - return hn(e, r), T(e, e.length - 4, t.d()), e; -} -typeof TextEncoder < "u" && new TextEncoder; var nn = typeof TextDecoder < "u" && new TextDecoder, Nn = 0; -try { - nn.decode(ir, { - stream: !0 - }), Nn = 1; -} catch (e) {} - const defaultConfig = { serverPath: "https://kroki.io/" }; @@ -442,7 +82,7 @@ function plant(content, type, config) { _debug(`kroki render content:\n${content}`); const urlPrefix = `${config.serverPath + type}/svg/`; const data = textEncode(content); - const compressed = strFromU8(mn(data, { + const compressed = strFromU8(fflate.zlibSync(data, { level: 9 })); const result = btoa(compressed).replace(/\+/g, "-").replace(/\//g, "_"); diff --git a/notion-kroki.user.js.map b/notion-kroki.user.js.map index 25ccf28..e750a43 100644 --- a/notion-kroki.user.js.map +++ b/notion-kroki.user.js.map @@ -1 +1 @@ -{"version":3,"file":"notion-kroki.user.js","sources":["src/common/utils.ts","https:/esm.sh/v135/fflate@0.8.0/denonext/fflate.mjs","src/main.ts","src/index.ts"],"sourcesContent":["export function debounce<\n T extends (...args: Parameters) => void,\n P extends Parameters,\n>(func: T, wait: number): (...args: P) => void {\n let timeoutId: ReturnType | undefined;\n return (...args: P) => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n timeoutId = undefined;\n func(...args);\n }, wait);\n };\n}\n\nexport function _debug(...data: Parameters): void {\n if (isDebugMode()) {\n console.log(...data);\n }\n}\n\nexport function isDebugMode(): boolean {\n return !!localStorage.getItem(\"debug\");\n}\n","/* esm.sh - esbuild bundle(fflate@0.8.0) denonext production */\nvar cn={},Qn=function(n,r,t,e,i){var a=new Worker(cn[r]||(cn[r]=URL.createObjectURL(new Blob([n+';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:\"text/javascript\"}))));return a.onmessage=function(o){var s=o.data,l=s.$e$;if(l){var h=new Error(l[0]);h.code=l[1],h.stack=l[2],i(h,null)}else i(null,s)},a.postMessage(t,e),a},U=Uint8Array,Y=Uint16Array,Zr=Int32Array,wr=new U([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mr=new U([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Cr=new U([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),An=function(n,r){for(var t=new Y(31),e=0;e<31;++e)t[e]=r+=1<>1|(C&21845)<<1,nr=(nr&52428)>>2|(nr&13107)<<2,nr=(nr&61680)>>4|(nr&3855)<<4,Ir[C]=((nr&65280)>>8|(nr&255)<<8)>>1;var nr,C,V=function(n,r,t){for(var e=n.length,i=0,a=new Y(r);i>l]=h}else for(s=new Y(e),i=0;i>15-n[i]);return s},tr=new U(288);for(C=0;C<144;++C)tr[C]=8;var C;for(C=144;C<256;++C)tr[C]=9;var C;for(C=256;C<280;++C)tr[C]=7;var C;for(C=280;C<288;++C)tr[C]=8;var C,gr=new U(32);for(C=0;C<32;++C)gr[C]=5;var C,Dn=V(tr,9,0),Sn=V(tr,9,1),Tn=V(gr,5,0),Cn=V(gr,5,1),Lr=function(n){for(var r=n[0],t=1;tr&&(r=n[t]);return r},Q=function(n,r,t){var e=r/8|0;return(n[e]|n[e+1]<<8)>>(r&7)&t},Pr=function(n,r){var t=r/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(r&7)},xr=function(n){return(n+7)/8|0},X=function(n,r,t){(r==null||r<0)&&(r=0),(t==null||t>n.length)&&(t=n.length);var e=new U(t-r);return e.set(n.subarray(r,t)),e},et={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},In=[\"unexpected EOF\",\"invalid block type\",\"invalid length/literal\",\"invalid distance\",\"stream finished\",\"no stream handler\",,\"no callback\",\"invalid UTF-8 data\",\"extra field too long\",\"date not in range 1980-2099\",\"filename too long\",\"stream finishing\",\"invalid zip data\"],v=function(n,r,t){var e=new Error(r||In[n]);if(e.code=n,Error.captureStackTrace&&Error.captureStackTrace(e,v),!t)throw e;return e},Br=function(n,r,t,e){var i=n.length,a=e?e.length:0;if(!i||r.f&&!r.l)return t||new U(0);var o=!t||r.i!=2,s=r.i;t||(t=new U(i*3));var l=function(Dr){var Sr=t.length;if(Dr>Sr){var Tr=new U(Math.max(Sr*2,Dr));Tr.set(t),t=Tr}},h=r.f||0,f=r.p||0,u=r.b||0,p=r.l,F=r.d,m=r.m,z=r.n,c=i*8;do{if(!p){h=Q(n,f,1);var x=Q(n,f+1,3);if(f+=3,x)if(x==1)p=Sn,F=Cn,m=9,z=5;else if(x==2){var I=Q(n,f,31)+257,B=Q(n,f+10,15)+4,S=I+Q(n,f+5,31)+1;f+=14;for(var y=new U(S),g=new U(19),A=0;A>4;if(M<16)y[A++]=M;else{var E=0,P=0;for(M==16?(P=3+Q(n,f,3),f+=2,E=y[A-1]):M==17?(P=3+Q(n,f,7),f+=3):M==18&&(P=11+Q(n,f,127),f+=7);P--;)y[A++]=E}}var G=y.subarray(0,I),L=y.subarray(I);m=Lr(G),z=Lr(L),p=V(G,m,1),F=V(L,z,1)}else v(1);else{var M=xr(f)+4,D=n[M-4]|n[M-3]<<8,w=M+D;if(w>i){s&&v(0);break}o&&l(u+D),t.set(n.subarray(M,w),u),r.b=u+=D,r.p=f=w*8,r.f=h;continue}if(f>c){s&&v(0);break}}o&&l(u+131072);for(var J=(1<>4;if(f+=E&15,f>c){s&&v(0);break}if(E||v(2),K<256)t[u++]=K;else if(K==256){N=f,p=null;break}else{var rr=K-254;if(K>264){var A=K-257,R=wr[A];rr=Q(n,f,(1<>4;k||v(3),f+=k&15;var L=Fn[b];if(b>3){var R=mr[b];L+=Pr(n,f)&(1<c){s&&v(0);break}o&&l(u+131072);var lr=u+rr;if(u>8},cr=function(n,r,t){t<<=r&7;var e=r/8|0;n[e]|=t,n[e+1]|=t>>8,n[e+2]|=t>>16},$r=function(n,r){for(var t=[],e=0;ep&&(p=a[e].s);var F=new Y(p+1),m=Hr(t[f-1],F,0);if(m>r){var e=0,z=0,c=m-r,x=1<r)z+=x-(1<>=c;z>0;){var D=a[e].s;F[D]=0&&z;--e){var w=a[e].s;F[w]==r&&(--F[w],++z)}m=r}return{t:new U(F),l:m}},Hr=function(n,r,t){return n.s==-1?Math.max(Hr(n.l,r,t+1),Hr(n.r,r,t+1)):r[n.s]=t},Vr=function(n){for(var r=n.length;r&&!n[--r];);for(var t=new Y(++r),e=0,i=n[0],a=1,o=function(l){t[e++]=l},s=1;s<=r;++s)if(n[s]==i&&s!=r)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=n[s]}return{c:t.subarray(0,e),n:r}},pr=function(n,r){for(var t=0,e=0;e>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var a=0;a4&&!A[Cr[O-1]];--O);var H=h+5<<3,Z=pr(i,tr)+pr(a,gr)+o,E=pr(i,p)+pr(a,z)+o+14+3*O+pr(S,A)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&H<=Z&&H<=E)return en(r,f,n.subarray(l,l+h));var P,G,L,J;if(_(r,f,1+(E15&&(_(r,f,rr[y]>>5&127),f+=rr[y]>>12)}}else P=Dn,G=tr,L=Tn,J=gr;for(var y=0;y255){var R=k>>18&31;cr(r,f,P[R+257]),f+=G[R+257],R>7&&(_(r,f,k>>23&31),f+=wr[R]);var b=k&31;cr(r,f,L[b]),f+=J[b],b>3&&(cr(r,f,k>>5&8191),f+=mr[b])}else cr(r,f,P[k]),f+=G[k]}return cr(r,f,P[256]),f+G[256]},Zn=new Zr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ir=new U(0),Bn=function(n,r,t,e,i,a){var o=a.z||n.length,s=new U(e+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(e,s.length-i),h=a.l,f=(a.r||0)&7;if(r){f&&(l[0]=a.r>>3);for(var u=Zn[r-1],p=u>>13,F=u&8191,m=(1<7e3||A>24576)&&(P>423||!h)){f=Xr(n,l,0,w,I,B,y,A,O,g-O,f),A=S=y=0,O=g;for(var G=0;G<286;++G)I[G]=0;for(var G=0;G<30;++G)B[G]=0}var L=2,J=0,sr=F,N=Z-E&32767;if(P>2&&H==D(g-N))for(var K=Math.min(p,P)-1,rr=Math.min(32767,g),R=Math.min(258,P);N<=rr&&--sr&&Z!=E;){if(n[g+L]==n[g+L-N]){for(var k=0;kL){if(L=k,J=N,k>K)break;for(var b=Math.min(N,k-2),lr=0,G=0;Glr&&(lr=Dr,E=vr)}}}Z=E,E=z[Z],N+=Z-E&32767}if(J){w[A++]=268435456|qr[L]<<18|Qr[J];var Sr=qr[L]&31,Tr=Qr[J]&31;y+=wr[Sr]+mr[Tr],++I[257+Sr],++B[Tr],$=g+L,++S}else w[A++]=n[g],++I[n[g]]}}for(g=Math.max(g,$);g=o&&(l[f/8|0]=h,jr=o),f=en(l,f+1,n.subarray(g,jr))}a.i=o}return X(s,0,e+xr(f)+i)},En=function(){for(var n=new Int32Array(256),r=0;r<256;++r){for(var t=r,e=9;--e;)t=(t&1&&-306674912)^t>>>1;n[r]=t}return n}(),zr=function(){var n=-1;return{p:function(r){for(var t=n,e=0;e>>8;n=t},d:function(){return~n}}},Rr=function(){var n=1,r=0;return{p:function(t){for(var e=n,i=r,a=t.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o>16),i=(i&65535)+15*(i>>16)}n=e,r=i},d:function(){return n%=65521,r%=65521,(n&255)<<24|(n&65280)<<8|(r&255)<<8|r>>8}}},hr=function(n,r,t,e,i){if(!i&&(i={l:1},r.dictionary)){var a=r.dictionary.subarray(-32768),o=new U(a.length+n.length);o.set(a),o.set(n,a.length),n=o,i.w=a.length}return Bn(n,r.level==null?6:r.level,r.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+r.mem,t,e,i)},Er=function(n,r){var t={};for(var e in n)t[e]=n[e];for(var e in r)t[e]=r[e];return t},pn=function(n,r,t){for(var e=n(),i=n.toString(),a=i.slice(i.indexOf(\"[\")+1,i.lastIndexOf(\"]\")).replace(/\\s+/g,\"\").split(\",\"),o=0;o>>0},Kr=function(n,r){return q(n,r)+q(n,r+4)*4294967296},T=function(n,r,t){for(;t;++r)n[r]=t,t>>>=8},on=function(n,r){var t=r.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=r.level<2?4:r.level==9?2:0,n[9]=3,r.mtime!=0&&T(n,4,Math.floor(new Date(r.mtime||Date.now())/1e3)),t){n[3]=8;for(var e=0;e<=t.length;++e)n[e+10]=t.charCodeAt(e)}},sn=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&v(6,\"invalid gzip data\");var r=n[3],t=10;r&4&&(t+=(n[10]|n[11]<<8)+2);for(var e=(r>>3&1)+(r>>4&1);e>0;e-=!n[t++]);return t+(r&2)},qn=function(n){var r=n.length;return(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0},fn=function(n){return 10+(n.filename?n.filename.length+1:0)},hn=function(n,r){var t=r.level,e=t==0?0:t<6?1:t==9?3:2;if(n[0]=120,n[1]=e<<6|(r.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,r.dictionary){var i=Rr();i.p(r.dictionary),T(n,2,i.d())}},un=function(n,r){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&v(6,\"invalid zlib data\"),(n[1]>>5&1)==+!r&&v(6,\"invalid zlib data: \"+(n[1]&32?\"need\":\"unexpected\")+\" dictionary\"),(n[1]>>3&4)+2};function ur(n,r){return typeof n==\"function\"&&(r=n,n={}),this.ondata=r,n}var er=function(){function n(r,t){if(typeof r==\"function\"&&(t=r,r={}),this.ondata=t,this.o=r||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new U(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(r,t){this.ondata(hr(r,this.o,0,0,this.s),t)},n.prototype.push=function(r,t){this.ondata||v(5),this.s.l&&v(4);var e=r.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new U(e&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(r.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(r.subarray(a),32768),this.s.z=r.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(r,this.s.z),this.s.z+=r.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var Xn=function(){function n(r,t){Fr([Mr,function(){return[d,er]}],this,ur.call(this,r,t),function(e){var i=new er(e.data);onmessage=d(i)},6)}return n}();function dn(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Mr],function(e){return or(Wr(e.data[0],e.data[1]))},0,t)}function Wr(n,r){return hr(n,r||{},0,0)}var j=function(){function n(r,t){typeof r==\"function\"&&(t=r,r={}),this.ondata=t;var e=r&&r.dictionary&&r.dictionary.subarray(-32768);this.s={i:0,b:e?e.length:0},this.o=new U(32768),this.p=new U(0),e&&this.o.set(e)}return n.prototype.e=function(r){if(this.ondata||v(5),this.d&&v(4),!this.p.length)this.p=r;else if(r.length){var t=new U(this.p.length+r.length);t.set(this.p),t.set(r,this.p.length),this.p=t}},n.prototype.c=function(r){this.s.i=+(this.d=r||!1);var t=this.s.b,e=Br(this.p,this.s,this.o);this.ondata(X(e,t,this.s.b),this.d),this.o=X(e,this.s.b-32768),this.s.b=this.o.length,this.p=X(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(r,t){this.e(r),this.c(t)},n}();var Hn=function(){function n(r,t){Fr([Ar,function(){return[d,j]}],this,ur.call(this,r,t),function(e){var i=new j(e.data);onmessage=d(i)},7)}return n}();function kn(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Ar],function(e){return or(Gr(e.data[0],an(e.data[1])))},1,t)}function Gr(n,r){return Br(n,{i:2},r&&r.out,r&&r.dictionary)}var gn=function(){function n(r,t){this.c=zr(),this.l=0,this.v=1,er.call(this,r,t)}return n.prototype.push=function(r,t){this.c.p(r),this.l+=r.length,er.prototype.push.call(this,r,t)},n.prototype.p=function(r,t){var e=hr(r,this.o,this.v&&fn(this.o),t&&8,this.s);this.v&&(on(e,this.o),this.v=0),t&&(T(e,e.length-8,this.c.d()),T(e,e.length-4,this.l)),this.ondata(e,t)},n}();var it=function(){function n(r,t){Fr([Mr,On,function(){return[d,er,gn]}],this,ur.call(this,r,t),function(e){var i=new gn(e.data);onmessage=d(i)},8)}return n}();function at(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Mr,On,function(){return[yn]}],function(e){return or(yn(e.data[0],e.data[1]))},2,t)}function yn(n,r){r||(r={});var t=zr(),e=n.length;t.p(n);var i=hr(n,r,fn(r),8),a=i.length;return on(i,r),T(i,a-8,t.d()),T(i,a-4,e),i}var dr=function(){function n(r,t){this.v=1,this.r=0,j.call(this,r,t)}return n.prototype.push=function(r,t){if(j.prototype.e.call(this,r),this.r+=r.length,this.v){var e=this.p.subarray(this.v-1),i=e.length>3?sn(e):4;if(i>e.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-e.length);this.p=e.subarray(i),this.v=0}j.prototype.c.call(this,t),this.s.f&&!this.s.l&&(this.v=xr(this.s.p)+9,this.s={i:0},this.o=new U(0),this.p.length&&this.push(new U(0),t))},n}();var bn=function(){function n(r,t){var e=this;Fr([Ar,Ln,function(){return[d,j,dr]}],this,ur.call(this,r,t),function(i){var a=new dr(i.data);a.onmember=function(o){return postMessage(o)},onmessage=d(a)},9,function(i){return e.onmember&&e.onmember(i)})}return n}();function _n(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Ar,Ln,function(){return[br]}],function(e){return or(br(e.data[0],e.data[1]))},3,t)}function br(n,r){var t=sn(n);return t+8>n.length&&v(6,\"invalid gzip data\"),Br(n.subarray(t,-8),{i:2},r&&r.out||new U(qn(n)),r&&r.dictionary)}var wn=function(){function n(r,t){this.c=Rr(),this.v=1,er.call(this,r,t)}return n.prototype.push=function(r,t){this.c.p(r),er.prototype.push.call(this,r,t)},n.prototype.p=function(r,t){var e=hr(r,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(hn(e,this.o),this.v=0),t&&T(e,e.length-4,this.c.d()),this.ondata(e,t)},n}();var ot=function(){function n(r,t){Fr([Mr,Pn,function(){return[d,er,wn]}],this,ur.call(this,r,t),function(e){var i=new wn(e.data);onmessage=d(i)},10)}return n}();function st(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Mr,Pn,function(){return[mn]}],function(e){return or(mn(e.data[0],e.data[1]))},4,t)}function mn(n,r){r||(r={});var t=Rr();t.p(n);var e=hr(n,r,r.dictionary?6:2,4);return hn(e,r),T(e,e.length-4,t.d()),e}var _r=function(){function n(r,t){j.call(this,r,t),this.v=r&&r.dictionary?2:1}return n.prototype.push=function(r,t){if(j.prototype.e.call(this,r),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(un(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&v(6,\"invalid zlib data\"),this.p=this.p.subarray(0,-4)),j.prototype.c.call(this,t)},n}();var rt=function(){function n(r,t){Fr([Ar,$n,function(){return[d,j,_r]}],this,ur.call(this,r,t),function(e){var i=new _r(e.data);onmessage=d(i)},11)}return n}();function nt(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),Ur(n,r,[Ar,$n,function(){return[rn]}],function(e){return or(rn(e.data[0],an(e.data[1])))},5,t)}function rn(n,r){return Br(n.subarray(un(n,r&&r.dictionary),-4),{i:2},r&&r.out,r&&r.dictionary)}var xn=function(){function n(r,t){this.G=dr,this.I=j,this.Z=_r,this.o=ur.call(this,r,t)||{}}return n.prototype.push=function(r,t){if(this.ondata||v(5),this.s)this.s.push(r,t);else{if(this.p&&this.p.length){var e=new U(this.p.length+r.length);e.set(this.p),e.set(r,this.p.length)}else this.p=r;if(this.p.length>2){var i=this,a=function(){i.ondata.apply(i,arguments)};this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o,a):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o,a):new this.Z(this.o,a),this.s.push(this.p,t),this.p=null}}},n}();var ft=function(){function n(r,t){this.G=bn,this.I=Hn,this.Z=rt,xn.call(this,r,t)}return n.prototype.push=function(r,t){xn.prototype.push.call(this,r,t)},n}();function ht(n,r,t){return t||(t=r,r={}),typeof t!=\"function\"&&v(7),n[0]==31&&n[1]==139&&n[2]==8?_n(n,r,t):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?kn(n,r,t):nt(n,r,t)}function ut(n,r){return n[0]==31&&n[1]==139&&n[2]==8?br(n,r):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?Gr(n,r):rn(n,r)}var ln=function(n,r,t,e){for(var i in n){var a=n[i],o=r+i,s=e;Array.isArray(a)&&(s=Er(e,a[1]),a=a[0]),a instanceof U?t[o]=[a,s]:(t[o+=\"/\"]=[new U(0),s],ln(a,o,t,e))}},zn=typeof TextEncoder<\"u\"&&new TextEncoder,nn=typeof TextDecoder<\"u\"&&new TextDecoder,Nn=0;try{nn.decode(ir,{stream:!0}),Nn=1}catch{}var Rn=function(n){for(var r=\"\",t=0;;){var e=n[t++],i=(e>127)+(e>223)+(e>239);if(t+i>n.length)return{s:r,r:X(n,t-1)};i?i==3?(e=((e&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,r+=String.fromCharCode(55296|e>>10,56320|e&1023)):i&1?r+=String.fromCharCode((e&31)<<6|n[t++]&63):r+=String.fromCharCode((e&15)<<12|(n[t++]&63)<<6|n[t++]&63):r+=String.fromCharCode(e)}},lt=function(){function n(r){this.ondata=r,Nn?this.t=new TextDecoder:this.p=ir}return n.prototype.push=function(r,t){if(this.ondata||v(5),t=!!t,this.t){this.ondata(this.t.decode(r,{stream:!0}),t),t&&(this.t.decode().length&&v(8),this.t=null);return}this.p||v(4);var e=new U(this.p.length+r.length);e.set(this.p),e.set(r,this.p.length);var i=Rn(e),a=i.s,o=i.r;t?(o.length&&v(8),this.p=null):this.p=o,this.ondata(a,t)},n}();var vt=function(){function n(r){this.ondata=r}return n.prototype.push=function(r,t){this.ondata||v(5),this.d&&v(4),this.ondata(fr(r),this.d=t||!1)},n}();function fr(n,r){if(r){for(var t=new U(n.length),e=0;e>1)),o=0,s=function(f){a[o++]=f},e=0;ea.length){var l=new U(o+8+(i-e<<1));l.set(a),a=l}var h=n.charCodeAt(e);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|h&63)):h>55295&&h<57344?(h=65536+(h&1047552)|n.charCodeAt(++e)&1023,s(240|h>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|h&63)):(s(224|h>>12),s(128|h>>6&63),s(128|h&63))}return X(a,0,o)}function Wn(n,r){if(r){for(var t=\"\",e=0;e65535&&v(9),r+=e+4}return r},yr=function(n,r,t,e,i,a,o,s){var l=e.length,h=t.extra,f=s&&s.length,u=ar(h);T(n,r,o!=null?33639248:67324752),r+=4,o!=null&&(n[r++]=20,n[r++]=t.os),n[r]=20,r+=2,n[r++]=t.flag<<1|(a<0&&8),n[r++]=i&&8,n[r++]=t.compression&255,n[r++]=t.compression>>8;var p=new Date(t.mtime==null?Date.now():t.mtime),F=p.getFullYear()-1980;if((F<0||F>119)&&v(10),T(n,r,F<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1),r+=4,a!=-1&&(T(n,r,t.crc),T(n,r+4,a<0?-a-2:a),T(n,r+8,t.size)),T(n,r+12,l),T(n,r+14,u),r+=16,o!=null&&(T(n,r,f),T(n,r+6,t.attrs),T(n,r+10,o),r+=14),n.set(e,r),r+=l,u)for(var m in h){var z=h[m],c=z.length;T(n,r,+m),T(n,r+2,c),n.set(z,r+4),r+=4+c}return f&&(n.set(s,r),r+=f),r},vn=function(n,r,t,e,i){T(n,r,101010256),T(n,r+8,t),T(n,r+10,t),T(n,r+12,e),T(n,r+16,i)},kr=function(){function n(r){this.filename=r,this.c=zr(),this.size=0,this.compression=0}return n.prototype.process=function(r,t){this.ondata(null,r,t)},n.prototype.push=function(r,t){this.ondata||v(5),this.c.p(r),this.size+=r.length,t&&(this.crc=this.c.d()),this.process(r,t||!1)},n}();var ct=function(){function n(r,t){var e=this;t||(t={}),kr.call(this,r),this.d=new er(t,function(i,a){e.ondata(null,i,a)}),this.compression=8,this.flag=Yn(t.level)}return n.prototype.process=function(r,t){try{this.d.push(r,t)}catch(e){this.ondata(e,null,t)}},n.prototype.push=function(r,t){kr.prototype.push.call(this,r,t)},n}();var pt=function(){function n(r,t){var e=this;t||(t={}),kr.call(this,r),this.d=new Xn(t,function(i,a,o){e.ondata(i,a,o)}),this.compression=8,this.flag=Yn(t.level),this.terminate=this.d.terminate}return n.prototype.process=function(r,t){this.d.push(r,t)},n.prototype.push=function(r,t){kr.prototype.push.call(this,r,t)},n}();var gt=function(){function n(r){this.ondata=r,this.u=[],this.d=1}return n.prototype.add=function(r){var t=this;if(this.ondata||v(5),this.d&2)this.ondata(v(4+(this.d&1)*8,0,1),null,!1);else{var e=fr(r.filename),i=e.length,a=r.comment,o=a&&fr(a),s=i!=r.filename.length||o&&a.length!=o.length,l=i+ar(r.extra)+30;i>65535&&this.ondata(v(11,0,1),null,!1);var h=new U(l);yr(h,0,r,e,s,-1);var f=[h],u=function(){for(var c=0,x=f;c65535&&Z(v(11,0,1),null),!H)Z(null,D);else if(B<16e4)try{Z(null,Wr(D,w))}catch(E){Z(E,null)}else f.push(dn(D,w,Z))},z=0;z65535&&v(11);var x=f?Wr(l,h):l,M=x.length,D=zr();D.p(l),e.push(Er(h,{size:l.length,crc:D.d(),c:x,f:u,m,u:p!=o.length||m&&F.length!=z,o:i,compression:f})),i+=30+p+c+M,a+=76+2*(p+c)+(z||0)+M}for(var w=new U(a+22),I=i,B=a-i,S=0;S0){var i=Math.min(this.c,r.length),a=r.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),r=r.subarray(i),r.length)return this.push(r,t)}else{var o=0,s=0,l=void 0,h=void 0;this.p.length?r.length?(h=new U(this.p.length+r.length),h.set(this.p),h.set(r,this.p.length)):h=this.p:h=r;for(var f=h.length,u=this.c,p=u&&this.d,F=function(){var x,M=q(h,s);if(M==67324752){o=1,l=s,m.d=null,m.c=0;var D=W(h,s+6),w=W(h,s+8),I=D&2048,B=D&8,S=W(h,s+26),y=W(h,s+28);if(f>s+30+S+y){var g=[];m.k.unshift(g),o=2;var A=q(h,s+18),$=q(h,s+22),O=Wn(h.subarray(s+30,s+=30+S),!I);A==4294967295?(x=B?[-2]:Kn(h,s),A=x[0],$=x[1]):B&&(A=-1),s+=y,m.c=A;var H,Z={name:O,compression:w,start:function(){if(Z.ondata||v(5),!A)Z.ondata(null,ir,!0);else{var E=e.o[w];E||Z.ondata(v(14,\"unknown compression type \"+w,1),null,!1),H=A<0?new E(O):new E(O,A,$),H.ondata=function(J,sr,N){Z.ondata(J,sr,N)};for(var P=0,G=g;P=0&&(Z.size=A,Z.originalSize=$),m.onfile(Z)}return\"break\"}else if(u){if(M==134695760)return l=s+=12+(u==-2&&8),o=3,m.c=0,\"break\";if(M==33639248)return l=s-=4,o=3,m.c=0,\"break\"}},m=this;s65558)return o(v(13,0,1),null),i;var l=W(n,s+8);if(l){var h=l,f=q(n,s+16),u=f==4294967295||h==65535;if(u){var p=q(n,s-12);u=q(n,p)==101075792,u&&(h=l=q(n,p+32),f=q(n,p+48))}for(var F=r&&r.filter,m=function(c){var x=Jn(n,f,u),M=x[0],D=x[1],w=x[2],I=x[3],B=x[4],S=x[5],y=jn(n,S);f=B;var g=function($,O){$?(i(),o($,null)):(O&&(a[I]=O),--l||o(null,a))};if(!F||F({name:I,size:D,originalSize:w,compression:M}))if(!M)g(null,X(n,y,y+D));else if(M==8){var A=n.subarray(y,y+D);if(D<32e4)try{g(null,Gr(A,{out:new U(w)}))}catch($){g($,null)}else e.push(kn(A,{size:w},g))}else g(v(14,\"unknown compression type \"+M,1),null);else g(null,null)},z=0;z65558)&&v(13);var i=W(n,e+8);if(!i)return{};var a=q(n,e+16),o=a==4294967295||i==65535;if(o){var s=q(n,e-12);o=q(n,s)==101075792,o&&(i=q(n,s+32),a=q(n,s+48))}for(var l=r&&r.filter,h=0;h it.innerHTML.trim().startsWith(\"//kroki \")) as HTMLElement[];\n for (const codeDiv of blocks) {\n const lines = codeDiv.textContent!.split(\"\\n\");\n const type = lines[0].replace(\"//kroki\", \"\").trim();\n if (!type.trim()) continue;\n const data = lines.filter((_value, index) => index !== 0).join(\"\\n\");\n if (!data.trim()) continue;\n const svgUrl = plant(data, type, defaultConfig);\n const div = document.createElement(\"div\");\n div.setAttribute(\n \"style\",\n \"display: flex; flex-direction: row; place-content: center;\",\n );\n div.setAttribute(\"notion-kroki\", \"true\");\n div.innerHTML =\n ``;\n\n const parentElement = codeDiv.parentElement!.parentElement!;\n const preCreatedNode = parentElement.querySelector(\"div[notion-kroki]\");\n if (preCreatedNode) {\n const preSvgUrl = preCreatedNode.firstElementChild!.getAttribute(\"data\");\n _debug(`preSvgUrl:${preSvgUrl}`);\n _debug(`svgUrl:${svgUrl}`);\n if (preSvgUrl === svgUrl) {\n continue;\n } else {\n parentElement.removeChild(preCreatedNode);\n }\n }\n\n parentElement.appendChild(div);\n }\n}\n\nfunction textEncode(str: string) {\n return new TextEncoder().encode(str);\n}\n\nfunction plant(content: string, type: string, config: KrokiOption) {\n _debug(`kroki render type: ${type}`);\n _debug(`kroki render content:\\n${content}`);\n\n const urlPrefix = `${config.serverPath + type}/svg/`;\n const data: Uint8Array = textEncode(content);\n const compressed: string = strFromU8(zlibSync(data, { level: 9 }));\n const result: string = btoa(compressed)\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n const svgUrl: string = urlPrefix + result;\n\n return svgUrl;\n}\n\nexport function init_listener() {\n if (typeof MutationObserver !== typeof undefined) {\n new MutationObserver(check).observe(document, {\n childList: true,\n subtree: true,\n });\n }\n}\n\nconst render = debounce(main, 100);\n\nfunction check(mutations: MutationRecord[], _observer: MutationObserver) {\n // _debug(\"mutations\", mutations);\n render();\n}\n\nfunction strFromU8(dat: Uint8Array) {\n let r = \"\";\n const s = 2 ** 15;\n for (let i = 0; i < dat.length; i += s) {\n r += String.fromCharCode(...dat.subarray(i, i + s));\n }\n return r;\n}\n","import { init_listener, main } from \"./main.ts\";\nmain();\ninit_listener();\n"],"names":["debounce","func","wait","timeoutId","args","clearTimeout","setTimeout","undefined","_debug","data","isDebugMode","console","log","localStorage","getItem","U","Uint8Array","Y","Uint16Array","Zr","Int32Array","wr","mr","Cr","An","n","r","t","e","i","a","b","Mn","tn","qr","Un","Qr","Ir","C","nr","V","length","o","s","l","h","f","u","p","tr","gr","Dn","Sn","Tn","xr","X","set","subarray","_","cr","$r","push","slice","ir","sort","I","B","F","m","Hr","z","c","x","S","M","D","w","Math","max","Vr","pr","en","Xr","y","g","A","$","O","H","Z","E","P","G","L","J","sr","N","K","rr","R","k","Zn","Bn","ceil","Jr","min","lr","vr","Yr","Dr","Sr","Tr","jr","Rr","d","hr","dictionary","level","mem","T","hn","mn","TextEncoder","nn","TextDecoder","Nn","decode","stream","defaultConfig","serverPath","main","element","blocks","Array","from","document","body","querySelectorAll","filter","it","innerHTML","trim","startsWith","codeDiv","lines","textContent","split","type","replace","_value","index","join","svgUrl","plant","div","createElement","setAttribute","parentElement","preCreatedNode","querySelector","preSvgUrl","firstElementChild","getAttribute","removeChild","appendChild","textEncode","str","encode","content","config","urlPrefix","compressed","strFromU8","zlibSync","result","btoa","init_listener","MutationObserver","check","observe","childList","subtree","render","mutations","_observer","dat","String","fromCharCode"],"mappings":";;;;;;;;;;;;;;;;;;AAAO,SAASA,QAAAA,CAGdC,IAAO,EAAEC,IAAY,EAAA;IACrB,IAAIC,SAAAA,CAAAA;IACJ,OAAO,WAAA;AAAIC,QAAAA,IAAAA,IAAAA,IAAAA,GAAAA,SAAAA,CAAAA,MAAAA,EAAAA,IAAAA,GAAAA,IAAAA,KAAAA,CAAAA,IAAAA,CAAAA,EAAAA,I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,OAAOtB,MAAAA,CAAAA;AACT,CAAA;AAEO,SAASwB,aAAAA,GAAAA;IACd,IAAI,OAAOC,gBAAqB,KAAA,OAAO1K,SAAW,EAAA;AAChD,QAAA,IAAI0K,gBAAiBC,CAAAA,KAAAA,CAAAA,CAAOC,OAAO,CAAC5C,QAAU,EAAA;YAC5C6C,SAAW,EAAA,IAAA;YACXC,OAAS,EAAA,IAAA;AACX,SAAA,CAAA,CAAA;AACF,KAAA;AACF,CAAA;AAEA,MAAMC,MAAAA,GAAStL,SAASkI,IAAM,EAAA,GAAA,CAAA,CAAA;AAE9B,SAASgD,KAAAA,CAAMK,SAA2B,EAAEC,SAA2B,EAAA;;AAErEF,IAAAA,MAAAA,EAAAA,CAAAA;AACF,CAAA;AAEA,SAASV,UAAUa,GAAe,EAAA;AAChC,IAAA,IAAI/J,CAAI,GAAA,EAAA,CAAA;AACR,IAAA,MAAMiB,IAAI,CAAK,IAAA,EAAA,CAAA;IACf,IAAK,IAAId,IAAI,CAAGA,EAAAA,CAAAA,GAAI4J,IAAIhJ,MAAM,EAAEZ,KAAKc,CAAG,CAAA;AACtCjB,QAAAA,CAAAA,IAAKgK,OAAOC,YAAY,CAAA,GAAIF,IAAIhI,QAAQ,CAAC5B,GAAGA,CAAIc,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAClD,KAAA;IACA,OAAOjB,CAAAA,CAAAA;AACT;;ACrFAwG,IAAAA,EAAAA,CAAAA;AACA8C,aAAAA,EAAAA"} \ No newline at end of file +{"version":3,"file":"notion-kroki.user.js","sources":["src/common/utils.ts","src/main.ts","src/index.ts"],"sourcesContent":["export type Any = Parameters[0];\n\nexport function debounce<\n T extends (...args: Any[]) => void,\n P extends Parameters,\n>(func: T, wait: number): (...args: P) => void {\n let timeoutId: ReturnType | undefined;\n return (...args: P) => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n timeoutId = undefined;\n func(...args);\n }, wait);\n };\n}\n\nexport function _debug(...data: Any[]): void {\n if (isDebugMode()) {\n console.log(...data);\n }\n}\n\nexport function isDebugMode(): boolean {\n return !!localStorage.getItem(\"debug\");\n}\n","import type { KrokiOption } from \"./@types/types.ts\";\nimport { _debug, debounce } from \"./common/utils.ts\";\nconst defaultConfig: KrokiOption = {\n serverPath: \"https://kroki.io/\",\n};\n\nexport function main(element: HTMLElement | null = null) {\n const blocks: HTMLElement[] = Array.from(\n (element || document.body).querySelectorAll(\"*\"),\n ).filter((it) => it.innerHTML.trim().startsWith(\"//kroki \")) as HTMLElement[];\n for (const codeDiv of blocks) {\n const lines = codeDiv.textContent!.split(\"\\n\");\n const type = lines[0].replace(\"//kroki\", \"\").trim();\n if (!type.trim()) continue;\n const data = lines.filter((_value, index) => index !== 0).join(\"\\n\");\n if (!data.trim()) continue;\n const svgUrl = plant(data, type, defaultConfig);\n const div = document.createElement(\"div\");\n div.setAttribute(\n \"style\",\n \"display: flex; flex-direction: row; place-content: center;\",\n );\n div.setAttribute(\"notion-kroki\", \"true\");\n div.innerHTML =\n ``;\n\n const parentElement = codeDiv.parentElement!.parentElement!;\n const preCreatedNode = parentElement.querySelector(\"div[notion-kroki]\");\n if (preCreatedNode) {\n const preSvgUrl = preCreatedNode.firstElementChild!.getAttribute(\"data\");\n _debug(`preSvgUrl:${preSvgUrl}`);\n _debug(`svgUrl:${svgUrl}`);\n if (preSvgUrl === svgUrl) {\n continue;\n } else {\n parentElement.removeChild(preCreatedNode);\n }\n }\n\n parentElement.appendChild(div);\n }\n}\n\nfunction textEncode(str: string) {\n return new TextEncoder().encode(str);\n}\n\nfunction plant(content: string, type: string, config: KrokiOption) {\n _debug(`kroki render type: ${type}`);\n _debug(`kroki render content:\\n${content}`);\n\n const urlPrefix = `${config.serverPath + type}/svg/`;\n const data: Uint8Array = textEncode(content);\n const compressed: string = strFromU8(fflate.zlibSync(data, { level: 9 }));\n const result: string = btoa(compressed)\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n const svgUrl: string = urlPrefix + result;\n\n return svgUrl;\n}\n\nexport function init_listener() {\n if (typeof MutationObserver !== typeof undefined) {\n new MutationObserver(check).observe(document, {\n childList: true,\n subtree: true,\n });\n }\n}\n\nconst render = debounce(main, 100);\n\nfunction check(mutations: MutationRecord[], _observer: MutationObserver) {\n // _debug(\"mutations\", mutations);\n render();\n}\n\nfunction strFromU8(dat: Uint8Array) {\n let r = \"\";\n const s = 2 ** 15;\n for (let i = 0; i < dat.length; i += s) {\n r += String.fromCharCode(...dat.subarray(i, i + s));\n }\n return r;\n}\n","import { init_listener, main } from \"./main.ts\";\nmain();\ninit_listener();\n"],"names":["debounce","func","wait","timeoutId","args","clearTimeout","setTimeout","undefined","_debug","data","isDebugMode","console","log","localStorage","getItem","defaultConfig","serverPath","main","element","blocks","Array","from","document","body","querySelectorAll","filter","it","innerHTML","trim","startsWith","codeDiv","lines","textContent","split","type","replace","_value","index","join","svgUrl","plant","div","createElement","setAttribute","parentElement","preCreatedNode","querySelector","preSvgUrl","firstElementChild","getAttribute","removeChild","appendChild","textEncode","str","TextEncoder","encode","content","config","urlPrefix","compressed","strFromU8","fflate","zlibSync","level","result","btoa","init_listener","MutationObserver","check","observe","childList","subtree","render","mutations","_observer","dat","r","s","i","length","String","fromCharCode","subarray"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,SAASA,QAAAA,CAGdC,IAAO,EAAEC,IAAY,EAAA;IACrB,IAAIC,SAAAA,CAAAA;IACJ,OAAO,WAAA;AAAIC,QAAAA,IAAAA,IAAAA,IAAAA,GAAAA,SAAAA,CAAAA,MAAAA,EAAAA,IAAAA,GAAAA,IAAAA,KAAAA,CAAAA,IAAAA,CAAAA,EAAAA,IAAAA,GAAAA,CAAAA,EAAAA,IAAAA,GAAAA,IAAAA,EAAAA,IAAAA,EAAAA,CAAAA;AAAAA,YAAAA,IAAAA,CAAAA,IAAAA,CAAAA,GAAAA,SAAAA,CAAAA,IAAAA,CAAAA,CAAAA;;QACTC,YAAaF,CAAAA,SAAAA,CAAAA,CAA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AOzB,MAAAA,CAAAA;AACT,CAAA;AAEO,SAAS2B,aAAAA,GAAAA;IACd,IAAI,OAAOC,gBAAqB,KAAA,OAAO5D,SAAW,EAAA;AAChD,QAAA,IAAI4D,gBAAiBC,CAAAA,KAAAA,CAAAA,CAAOC,OAAO,CAAC/C,QAAU,EAAA;YAC5CgD,SAAW,EAAA,IAAA;YACXC,OAAS,EAAA,IAAA;AACX,SAAA,CAAA,CAAA;AACF,KAAA;AACF,CAAA;AAEA,MAAMC,MAAAA,GAASxE,SAASiB,IAAM,EAAA,GAAA,CAAA,CAAA;AAE9B,SAASmD,KAAAA,CAAMK,SAA2B,EAAEC,SAA2B,EAAA;;AAErEF,IAAAA,MAAAA,EAAAA,CAAAA;AACF,CAAA;AAEA,SAASZ,UAAUe,GAAe,EAAA;AAChC,IAAA,IAAIC,CAAI,GAAA,EAAA,CAAA;AACR,IAAA,MAAMC,IAAI,CAAK,IAAA,EAAA,CAAA;IACf,IAAK,IAAIC,IAAI,CAAGA,EAAAA,CAAAA,GAAIH,IAAII,MAAM,EAAED,KAAKD,CAAG,CAAA;AACtCD,QAAAA,CAAAA,IAAKI,OAAOC,YAAY,CAAA,GAAIN,IAAIO,QAAQ,CAACJ,GAAGA,CAAID,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAClD,KAAA;IACA,OAAOD,CAAAA,CAAAA;AACT;;ACpFA3D,IAAAA,EAAAA,CAAAA;AACAiD,aAAAA,EAAAA"} \ No newline at end of file diff --git a/rollup.config.ts b/rollup.config.ts index ceec094..a52815b 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -21,6 +21,7 @@ const config: rollup.InputOptions & { output: rollup.OutputOptions } = { jsc: { parser: { syntax: "typescript" } }, env: { targets: "chrome>=60,safari>=13,firefox>=60" }, sourceMaps: true, + minify: false, }); }, }, diff --git a/src/@types/types.ts b/src/@types/types.ts index d2edc4b..e7fe084 100644 --- a/src/@types/types.ts +++ b/src/@types/types.ts @@ -1,4 +1,4 @@ -import * as fflateAlias from "fflate"; +import * as fflateAlias from "esm.sh/fflate"; declare global { interface Window { fflate: typeof fflateAlias; diff --git a/src/common/utils.ts b/src/common/utils.ts index f98d916..feaa77f 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -1,5 +1,7 @@ +export type Any = Parameters[0]; + export function debounce< - T extends (...args: Parameters) => void, + T extends (...args: Any[]) => void, P extends Parameters, >(func: T, wait: number): (...args: P) => void { let timeoutId: ReturnType | undefined; @@ -12,7 +14,7 @@ export function debounce< }; } -export function _debug(...data: Parameters): void { +export function _debug(...data: Any[]): void { if (isDebugMode()) { console.log(...data); } diff --git a/src/main.ts b/src/main.ts index 47f83d4..f6e177d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,5 @@ import type { KrokiOption } from "./@types/types.ts"; import { _debug, debounce } from "./common/utils.ts"; -import { zlibSync } from "esm.sh/fflate@0.8.0"; const defaultConfig: KrokiOption = { serverPath: "https://kroki.io/", }; @@ -52,7 +51,7 @@ function plant(content: string, type: string, config: KrokiOption) { const urlPrefix = `${config.serverPath + type}/svg/`; const data: Uint8Array = textEncode(content); - const compressed: string = strFromU8(zlibSync(data, { level: 9 })); + const compressed: string = strFromU8(fflate.zlibSync(data, { level: 9 })); const result: string = btoa(compressed) .replace(/\+/g, "-") .replace(/\//g, "_"); diff --git a/src/userscript-meta.ts b/src/userscript-meta.ts new file mode 100644 index 0000000..5db2670 --- /dev/null +++ b/src/userscript-meta.ts @@ -0,0 +1 @@ +export const requiredLibs = ["https://unpkg.com/fflate@0.8.0/umd/index.js"]; diff --git a/test/common/dom-env-init.ts b/test/common/dom-env-init.ts index f6d8767..413865c 100644 --- a/test/common/dom-env-init.ts +++ b/test/common/dom-env-init.ts @@ -1,6 +1,7 @@ -import { Any, sleep } from "../utils.ts"; - import { GlobalRegistrator } from "@happy-dom/global-registrator"; +import { Any } from "../../src/common/utils.ts"; +import { requiredLibs } from "../../src/userscript-meta.ts"; +import { sleep } from "../utils.ts"; export async function init() { // deno-lint-ignore ban-ts-comment @@ -10,6 +11,7 @@ export async function init() { document.body.innerHTML = '
'; globalThis.TextDecoder = undefined as Any; await sleep(1); + await Promise.all(requiredLibs.map((lib) => import(lib))); } export async function tearDown() { diff --git a/test/jsdom_test.ts b/test/jsdom_test.ts index 7aec289..fe1a57a 100644 --- a/test/jsdom_test.ts +++ b/test/jsdom_test.ts @@ -1,6 +1,7 @@ import { assertEquals } from "deno_std/assert/assert_equals.ts"; import { it } from "deno_std/testing/bdd.ts"; import { baseTest } from "./common/base-test.ts"; +import { sleep } from "./utils.ts"; it(baseTest, "render docsify normal", async () => { localStorage.setItem("debug", "123"); @@ -52,7 +53,3 @@ ${document.documentElement.outerHTML} await sleep(1000); } - -function sleep(ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/test/utils.ts b/test/utils.ts index d858743..7ac9e65 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,7 +1 @@ -export type Any = Parameters[0]; - -export function sleep(ms: number) { - const defer = Promise.withResolvers(); - setTimeout(defer.resolve, ms); - return defer.promise; -} +export { delay as sleep } from "deno_std/async/delay.ts";