diff --git a/.eslintignore b/.eslintignore
index 6b0e422c..eabd6182 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -4,3 +4,4 @@ node_modules
**/dist/**
.eslintrc.js
./packages/client/src/tiptap/wrappers/mind/mind-elixir/iconfont/iconfont.js
+./packages/client/public/drawio.embed.js
diff --git a/packages/client/global.d.ts b/packages/client/global.d.ts
index 820cc6e9..7e89cbc9 100644
--- a/packages/client/global.d.ts
+++ b/packages/client/global.d.ts
@@ -1,3 +1,8 @@
interface Window {
+ // 思维导图
MindElixir: any;
+ // drawio 绘图
+ mxGraph: any;
+ mxUtils: any;
+ mxCodec: any;
}
diff --git a/packages/client/next.config.js b/packages/client/next.config.js
index 8609c764..a38d0f6c 100644
--- a/packages/client/next.config.js
+++ b/packages/client/next.config.js
@@ -11,6 +11,7 @@ const nextConfig = semi({
SERVER_API_URL: config.client.apiUrl,
COLLABORATION_API_URL: config.client.collaborationUrl,
ENABLE_ALIYUN_OSS: !!config.oss.aliyun.accessKeyId,
+ DRAWIO_URL: config.client.drawioUrl || 'https://embed.diagrams.net',
},
webpack: (config, { dev, isServer }) => {
config.resolve.plugins.push(new TsconfigPathsPlugin());
diff --git a/packages/client/package.json b/packages/client/package.json
index bfe92824..311d1f84 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -70,6 +70,7 @@
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"next": "12.0.10",
+ "pako": "^2.0.4",
"prosemirror-markdown": "^1.7.0",
"prosemirror-tables": "^1.1.1",
"prosemirror-utils": "^0.9.6",
diff --git a/packages/client/public/drawio.embed.js b/packages/client/public/drawio.embed.js
new file mode 100644
index 00000000..6be63e96
--- /dev/null
+++ b/packages/client/public/drawio.embed.js
@@ -0,0 +1,35878 @@
+/* eslint-disable */
+/*
+ @license DOMPurify 2.3.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.6/LICENSE */
+!(function (a, b) {
+ 'object' == typeof exports && 'undefined' != typeof module
+ ? (module.exports = b())
+ : 'function' == typeof define && define.amd
+ ? define(b)
+ : ((a = 'undefined' != typeof globalThis ? globalThis : a || self).DOMPurify = b());
+})(this, function () {
+ function a(b) {
+ return (a =
+ 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
+ ? function (a) {
+ return typeof a;
+ }
+ : function (a) {
+ return a && 'function' == typeof Symbol && a.constructor === Symbol && a !== Symbol.prototype
+ ? 'symbol'
+ : typeof a;
+ })(b);
+ }
+ function b(a, c) {
+ return (b =
+ Object.setPrototypeOf ||
+ function (a, b) {
+ return (a.__proto__ = b), a;
+ })(a, c);
+ }
+ function c() {
+ if ('undefined' == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1;
+ if ('function' == typeof Proxy) return !0;
+ try {
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
+ } catch (Ca) {
+ return !1;
+ }
+ }
+ function d(a, e, f) {
+ return (d = c()
+ ? Reflect.construct
+ : function (a, c, d) {
+ var e = [null];
+ e.push.apply(e, c);
+ a = new (Function.bind.apply(a, e))();
+ return d && b(a, d.prototype), a;
+ }).apply(null, arguments);
+ }
+ function e(a) {
+ var b;
+ (b = (function (a) {
+ if (Array.isArray(a)) return f(a);
+ })(a)) ||
+ (b =
+ ('undefined' != typeof Symbol && null != a[Symbol.iterator]) || null != a['@@iterator']
+ ? Array.from(a)
+ : void 0);
+ if (
+ !(a =
+ b ||
+ (function (a, b) {
+ if (a) {
+ if ('string' == typeof a) return f(a, b);
+ var c = Object.prototype.toString.call(a).slice(8, -1);
+ 'Object' === c && a.constructor && (c = a.constructor.name);
+ if ('Map' === c || 'Set' === c) return Array.from(a);
+ if ('Arguments' === c || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)) return f(a, b);
+ }
+ })(a))
+ )
+ throw new TypeError(
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ return a;
+ }
+ function f(a, b) {
+ (null == b || b > a.length) && (b = a.length);
+ for (var c = 0, d = Array(b); c < b; c++) d[c] = a[c];
+ return d;
+ }
+ function g(a) {
+ return function (b) {
+ for (var c = arguments.length, d = Array(1 < c ? c - 1 : 0), e = 1; e < c; e++) d[e - 1] = arguments[e];
+ return B(a, b, d);
+ };
+ }
+ function k(a, b) {
+ n && n(a, null);
+ for (var c = b.length; c--; ) {
+ var d = b[c];
+ if ('string' == typeof d) {
+ var e = T(d);
+ e !== d && (p(b) || (b[c] = e), (d = e));
+ }
+ a[d] = !0;
+ }
+ return a;
+ }
+ function h(a) {
+ var b,
+ c = z(null);
+ for (b in a) B(m, a, [b]) && (c[b] = a[b]);
+ return c;
+ }
+ function l(a, b) {
+ for (; null !== a; ) {
+ var c = t(a, b);
+ if (c) {
+ if (c.get) return g(c.get);
+ if ('function' == typeof c.value) return g(c.value);
+ }
+ a = r(a);
+ }
+ return function (a) {
+ return console.warn('fallback value for', a), null;
+ };
+ }
+ var m = Object.hasOwnProperty,
+ n = Object.setPrototypeOf,
+ p = Object.isFrozen,
+ r = Object.getPrototypeOf,
+ t = Object.getOwnPropertyDescriptor,
+ u = Object.freeze,
+ x = Object.seal,
+ z = Object.create,
+ D = 'undefined' != typeof Reflect && Reflect,
+ B = D.apply,
+ C = D.construct;
+ B ||
+ (B = function (a, b, c) {
+ return a.apply(b, c);
+ });
+ u ||
+ (u = function (a) {
+ return a;
+ });
+ x ||
+ (x = function (a) {
+ return a;
+ });
+ C ||
+ (C = function (a, b) {
+ return d(a, e(b));
+ });
+ var J,
+ v = g(Array.prototype.forEach),
+ K = g(Array.prototype.pop),
+ O = g(Array.prototype.push),
+ T = g(String.prototype.toLowerCase),
+ M = g(String.prototype.match),
+ U = g(String.prototype.replace),
+ da = g(String.prototype.indexOf),
+ ha = g(String.prototype.trim),
+ Y = g(RegExp.prototype.test),
+ P =
+ ((J = TypeError),
+ function () {
+ for (var a = arguments.length, b = Array(a), c = 0; c < a; c++) b[c] = arguments[c];
+ return C(J, b);
+ }),
+ Oa = u(
+ 'a abbr acronym address area article aside audio b bdi bdo big blink blockquote body br button canvas caption center cite code col colgroup content data datalist dd decorator del details dfn dialog dir div dl dt element em fieldset figcaption figure font footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i img input ins kbd label legend li main map mark marquee menu menuitem meter nav nobr ol optgroup option output p picture pre progress q rp rt ruby s samp section select shadow small source spacer span strike strong style sub summary sup table tbody td template textarea tfoot th thead time tr track tt u ul var video wbr'.split(
+ ' '
+ )
+ ),
+ Da = u(
+ 'svg a altglyph altglyphdef altglyphitem animatecolor animatemotion animatetransform circle clippath defs desc ellipse filter font g glyph glyphref hkern image line lineargradient marker mask metadata mpath path pattern polygon polyline radialgradient rect stop style switch symbol text textpath title tref tspan view vkern'.split(
+ ' '
+ )
+ ),
+ Pa = u(
+ 'feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence'.split(
+ ' '
+ )
+ ),
+ Wa = u(
+ 'animate color-profile cursor discard fedropshadow font-face font-face-format font-face-name font-face-src font-face-uri foreignobject hatch hatchpath mesh meshgradient meshpatch meshrow missing-glyph script set solidcolor unknown use'.split(
+ ' '
+ )
+ ),
+ Ea = u(
+ 'math menclose merror mfenced mfrac mglyph mi mlabeledtr mmultiscripts mn mo mover mpadded mphantom mroot mrow ms mspace msqrt mstyle msub msup msubsup mtable mtd mtext mtr munder munderover'.split(
+ ' '
+ )
+ ),
+ qa = u(
+ 'maction maligngroup malignmark mlongdiv mscarries mscarry msgroup mstack msline msrow semantics annotation annotation-xml mprescripts none'.split(
+ ' '
+ )
+ ),
+ ia = u(['#text']),
+ Ka = u(
+ 'accept action align alt autocapitalize autocomplete autopictureinpicture autoplay background bgcolor border capture cellpadding cellspacing checked cite class clear color cols colspan controls controlslist coords crossorigin datetime decoding default dir disabled disablepictureinpicture disableremoteplayback download draggable enctype enterkeyhint face for headers height hidden high href hreflang id inputmode integrity ismap kind label lang list loading loop low max maxlength media method min minlength multiple muted name nonce noshade novalidate nowrap open optimum pattern placeholder playsinline poster preload pubdate radiogroup readonly rel required rev reversed role rows rowspan spellcheck scope selected shape size sizes span srclang start src srcset step style summary tabindex title translate type usemap valign value width xmlns slot'.split(
+ ' '
+ )
+ ),
+ ua = u(
+ 'accent-height accumulate additive alignment-baseline ascent attributename attributetype azimuth basefrequency baseline-shift begin bias by class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering cx cy d dx dy diffuseconstant direction display divisor dur edgemode elevation end fill fill-opacity fill-rule filter filterunits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight fx fy g1 g2 glyph-name glyphref gradientunits gradienttransform height href id image-rendering in in2 k k1 k2 k3 k4 kerning keypoints keysplines keytimes lang lengthadjust letter-spacing kernelmatrix kernelunitlength lighting-color local marker-end marker-mid marker-start markerheight markerunits markerwidth maskcontentunits maskunits max mask media method mode min name numoctaves offset operator opacity order orient orientation origin overflow paint-order path pathlength patterncontentunits patterntransform patternunits points preservealpha preserveaspectratio primitiveunits r rx ry radius refx refy repeatcount repeatdur restart result rotate scale seed shape-rendering specularconstant specularexponent spreadmethod startoffset stddeviation stitchtiles stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke stroke-width style surfacescale systemlanguage tabindex targetx targety transform transform-origin text-anchor text-decoration text-rendering textlength type u1 u2 unicode values viewbox visibility version vert-adv-y vert-origin-x vert-origin-y width word-spacing wrap writing-mode xchannelselector ychannelselector x x1 x2 xmlns y y1 y2 z zoomandpan'.split(
+ ' '
+ )
+ ),
+ Xa = u(
+ 'accent accentunder align bevelled close columnsalign columnlines columnspan denomalign depth dir display displaystyle encoding fence frame height href id largeop length linethickness lspace lquote mathbackground mathcolor mathsize mathvariant maxsize minsize movablelimits notation numalign open rowalign rowlines rowspacing rowspan rspace rquote scriptlevel scriptminsize scriptsizemultiplier selection separator separators stretchy subscriptshift supscriptshift symmetric voffset width xmlns'.split(
+ ' '
+ )
+ ),
+ Z = u(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']),
+ ea = x(/\{\{[\s\S]*|[\s\S]*\}\}/gm),
+ L = x(/<%[\s\S]*|[\s\S]*%>/gm),
+ db = x(/^data-[\-\w.\u00B7-\uFFFF]/),
+ sa = x(/^aria-[\-\w]+$/),
+ eb = x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),
+ ta = x(/^(?:\w+script|data):/i),
+ Fa = x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),
+ La = x(/^html$/i),
+ la = function (b, c) {
+ if ('object' !== a(b) || 'function' != typeof b.createPolicy) return null;
+ var d = null;
+ c.currentScript &&
+ c.currentScript.hasAttribute('data-tt-policy-suffix') &&
+ (d = c.currentScript.getAttribute('data-tt-policy-suffix'));
+ d = 'dompurify' + (d ? '#' + d : '');
+ try {
+ return b.createPolicy(d, {
+ createHTML: function (a) {
+ return a;
+ },
+ });
+ } catch (ba) {
+ return console.warn('TrustedTypes policy ' + d + ' could not be created.'), null;
+ }
+ };
+ return (function pa() {
+ var b =
+ 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 'undefined' == typeof window ? null : window,
+ c = function (a) {
+ return pa(a);
+ };
+ if (((c.version = '2.3.6'), (c.removed = []), !b || !b.document || 9 !== b.document.nodeType))
+ return (c.isSupported = !1), c;
+ var d = b.document,
+ f = b.document,
+ g = b.DocumentFragment,
+ m = b.HTMLTemplateElement,
+ n = b.Node,
+ p = b.Element,
+ r = b.NodeFilter,
+ t = b.NamedNodeMap,
+ x = void 0 === t ? b.NamedNodeMap || b.MozNamedAttrMap : t,
+ C = b.HTMLFormElement,
+ z = b.DOMParser,
+ t = b.trustedTypes,
+ B = p.prototype,
+ D = l(B, 'cloneNode'),
+ J = l(B, 'nextSibling'),
+ fa = l(B, 'childNodes'),
+ S = l(B, 'parentNode');
+ 'function' == typeof m &&
+ ((m = f.createElement('template')), m.content && m.content.ownerDocument && (f = m.content.ownerDocument));
+ var ma = la(t, d),
+ R = ma ? ma.createHTML('') : '',
+ m = f,
+ ra = m.implementation,
+ ib = m.createNodeIterator,
+ Ta = m.createDocumentFragment,
+ za = m.getElementsByTagName,
+ tb = d.importNode,
+ m = {};
+ try {
+ m = h(f).documentMode ? f.documentMode : {};
+ } catch (Jb) {}
+ var Aa = {};
+ c.isSupported = 'function' == typeof S && ra && void 0 !== ra.createHTMLDocument && 9 !== m;
+ var ab,
+ Ba,
+ jb = eb,
+ ga = null,
+ kb = k({}, [].concat(e(Oa), e(Da), e(Pa), e(Ea), e(ia))),
+ aa = null,
+ Ha = k({}, [].concat(e(Ka), e(ua), e(Xa), e(Z))),
+ ca = Object.seal(
+ Object.create(null, {
+ tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null },
+ attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null },
+ allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 },
+ })
+ ),
+ Ua = null,
+ Ya = null,
+ pb = !0,
+ Za = !0,
+ Ia = !1,
+ W = !1,
+ va = !1,
+ qb = !1,
+ bb = !1,
+ Na = !1,
+ fb = !1,
+ gb = !1,
+ ub = !0,
+ q = !0,
+ w = !1,
+ y = {},
+ A = null,
+ G = k(
+ {},
+ 'annotation-xml audio colgroup desc foreignobject head iframe math mi mn mo ms mtext noembed noframes noscript plaintext script style svg template thead title video xmp'.split(
+ ' '
+ )
+ ),
+ H = null,
+ oa = k({}, 'audio video img source image track'.split(' ')),
+ xa = null,
+ ka = k({}, 'alt class for id label name pattern placeholder role summary title value style xmlns'.split(' ')),
+ wa = 'http://www.w3.org/1999/xhtml',
+ lb = !1,
+ Db = ['application/xhtml+xml', 'text/html'],
+ mb = null,
+ Eb = f.createElement('form'),
+ yb = function (a) {
+ return a instanceof RegExp || a instanceof Function;
+ },
+ rb = function (b) {
+ (mb && mb === b) ||
+ ((b && 'object' === a(b)) || (b = {}),
+ (b = h(b)),
+ (ga = 'ALLOWED_TAGS' in b ? k({}, b.ALLOWED_TAGS) : kb),
+ (aa = 'ALLOWED_ATTR' in b ? k({}, b.ALLOWED_ATTR) : Ha),
+ (xa = 'ADD_URI_SAFE_ATTR' in b ? k(h(ka), b.ADD_URI_SAFE_ATTR) : ka),
+ (H = 'ADD_DATA_URI_TAGS' in b ? k(h(oa), b.ADD_DATA_URI_TAGS) : oa),
+ (A = 'FORBID_CONTENTS' in b ? k({}, b.FORBID_CONTENTS) : G),
+ (Ua = 'FORBID_TAGS' in b ? k({}, b.FORBID_TAGS) : {}),
+ (Ya = 'FORBID_ATTR' in b ? k({}, b.FORBID_ATTR) : {}),
+ (y = 'USE_PROFILES' in b && b.USE_PROFILES),
+ (pb = !1 !== b.ALLOW_ARIA_ATTR),
+ (Za = !1 !== b.ALLOW_DATA_ATTR),
+ (Ia = b.ALLOW_UNKNOWN_PROTOCOLS || !1),
+ (W = b.SAFE_FOR_TEMPLATES || !1),
+ (va = b.WHOLE_DOCUMENT || !1),
+ (Na = b.RETURN_DOM || !1),
+ (fb = b.RETURN_DOM_FRAGMENT || !1),
+ (gb = b.RETURN_TRUSTED_TYPE || !1),
+ (bb = b.FORCE_BODY || !1),
+ (ub = !1 !== b.SANITIZE_DOM),
+ (q = !1 !== b.KEEP_CONTENT),
+ (w = b.IN_PLACE || !1),
+ (jb = b.ALLOWED_URI_REGEXP || jb),
+ (wa = b.NAMESPACE || 'http://www.w3.org/1999/xhtml'),
+ b.CUSTOM_ELEMENT_HANDLING &&
+ yb(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck) &&
+ (ca.tagNameCheck = b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),
+ b.CUSTOM_ELEMENT_HANDLING &&
+ yb(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) &&
+ (ca.attributeNameCheck = b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),
+ b.CUSTOM_ELEMENT_HANDLING &&
+ 'boolean' == typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements &&
+ (ca.allowCustomizedBuiltInElements = b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),
+ (ab = ab = -1 === Db.indexOf(b.PARSER_MEDIA_TYPE) ? 'text/html' : b.PARSER_MEDIA_TYPE),
+ (Ba =
+ 'application/xhtml+xml' === ab
+ ? function (a) {
+ return a;
+ }
+ : T),
+ W && (Za = !1),
+ fb && (Na = !0),
+ y &&
+ ((ga = k({}, e(ia))),
+ (aa = []),
+ !0 === y.html && (k(ga, Oa), k(aa, Ka)),
+ !0 === y.svg && (k(ga, Da), k(aa, ua), k(aa, Z)),
+ !0 === y.svgFilters && (k(ga, Pa), k(aa, ua), k(aa, Z)),
+ !0 === y.mathMl && (k(ga, Ea), k(aa, Xa), k(aa, Z))),
+ b.ADD_TAGS && (ga === kb && (ga = h(ga)), k(ga, b.ADD_TAGS)),
+ b.ADD_ATTR && (aa === Ha && (aa = h(aa)), k(aa, b.ADD_ATTR)),
+ b.ADD_URI_SAFE_ATTR && k(xa, b.ADD_URI_SAFE_ATTR),
+ b.FORBID_CONTENTS && (A === G && (A = h(A)), k(A, b.FORBID_CONTENTS)),
+ q && (ga['#text'] = !0),
+ va && k(ga, ['html', 'head', 'body']),
+ ga.table && (k(ga, ['tbody']), delete Ua.tbody),
+ u && u(b),
+ (mb = b));
+ },
+ vb = k({}, ['mi', 'mo', 'mn', 'ms', 'mtext']),
+ na = k({}, ['foreignobject', 'desc', 'title', 'annotation-xml']),
+ sb = k({}, Da);
+ k(sb, Pa);
+ k(sb, Wa);
+ var wb = k({}, Ea);
+ k(wb, qa);
+ var Fb = function (a) {
+ var b = S(a);
+ (b && b.tagName) || (b = { namespaceURI: 'http://www.w3.org/1999/xhtml', tagName: 'template' });
+ var c = T(a.tagName),
+ d = T(b.tagName);
+ if ('http://www.w3.org/2000/svg' === a.namespaceURI)
+ return 'http://www.w3.org/1999/xhtml' === b.namespaceURI
+ ? 'svg' === c
+ : 'http://www.w3.org/1998/Math/MathML' === b.namespaceURI
+ ? 'svg' === c && ('annotation-xml' === d || vb[d])
+ : !!sb[c];
+ if ('http://www.w3.org/1998/Math/MathML' === a.namespaceURI)
+ return 'http://www.w3.org/1999/xhtml' === b.namespaceURI
+ ? 'math' === c
+ : 'http://www.w3.org/2000/svg' === b.namespaceURI
+ ? 'math' === c && na[d]
+ : !!wb[c];
+ if ('http://www.w3.org/1999/xhtml' === a.namespaceURI) {
+ if (
+ ('http://www.w3.org/2000/svg' === b.namespaceURI && !na[d]) ||
+ ('http://www.w3.org/1998/Math/MathML' === b.namespaceURI && !vb[d])
+ )
+ return !1;
+ a = k({}, ['title', 'style', 'font', 'a', 'script']);
+ return !wb[c] && (a[c] || !sb[c]);
+ }
+ return !1;
+ },
+ cb = function (a) {
+ O(c.removed, { element: a });
+ try {
+ a.parentNode.removeChild(a);
+ } catch (zb) {
+ try {
+ a.outerHTML = R;
+ } catch (Ab) {
+ a.remove();
+ }
+ }
+ },
+ Bb = function (a, b) {
+ try {
+ O(c.removed, { attribute: b.getAttributeNode(a), from: b });
+ } catch (Ab) {
+ O(c.removed, { attribute: null, from: b });
+ }
+ if ((b.removeAttribute(a), 'is' === a && !aa[a]))
+ if (Na || fb)
+ try {
+ cb(b);
+ } catch (Ab) {}
+ else
+ try {
+ b.setAttribute(a, '');
+ } catch (Ab) {}
+ },
+ Va = function (a) {
+ var b, c;
+ bb ? (a = '' + a) : (c = (c = M(a, /^[\r\n\t ]+/)) && c[0]);
+ 'application/xhtml+xml' === ab &&
+ (a = '
' + a + '');
+ var d = ma ? ma.createHTML(a) : a;
+ if ('http://www.w3.org/1999/xhtml' === wa)
+ try {
+ b = new z().parseFromString(d, ab);
+ } catch (Gb) {}
+ if (!b || !b.documentElement) {
+ b = ra.createDocument(wa, 'template', null);
+ try {
+ b.documentElement.innerHTML = lb ? '' : d;
+ } catch (Gb) {}
+ }
+ d = b.body || b.documentElement;
+ return (
+ a && c && d.insertBefore(f.createTextNode(c), d.childNodes[0] || null),
+ 'http://www.w3.org/1999/xhtml' === wa ? za.call(b, va ? 'html' : 'body')[0] : va ? b.documentElement : d
+ );
+ },
+ Hb = function (a) {
+ return ib.call(a.ownerDocument || a, a, r.SHOW_ELEMENT | r.SHOW_COMMENT | r.SHOW_TEXT, null, !1);
+ },
+ nb = function (b) {
+ return 'object' === a(n)
+ ? b instanceof n
+ : b && 'object' === a(b) && 'number' == typeof b.nodeType && 'string' == typeof b.nodeName;
+ },
+ $a = function (a, b, d) {
+ Aa[a] &&
+ v(Aa[a], function (a) {
+ a.call(c, b, d, mb);
+ });
+ },
+ Ib = function (a) {
+ var b;
+ if (
+ ($a('beforeSanitizeElements', a, null),
+ a instanceof C &&
+ ('string' != typeof a.nodeName ||
+ 'string' != typeof a.textContent ||
+ 'function' != typeof a.removeChild ||
+ !(a.attributes instanceof x) ||
+ 'function' != typeof a.removeAttribute ||
+ 'function' != typeof a.setAttribute ||
+ 'string' != typeof a.namespaceURI ||
+ 'function' != typeof a.insertBefore)) ||
+ M(a.nodeName, /[\u0080-\uFFFF]/)
+ )
+ return cb(a), !0;
+ var d = Ba(a.nodeName);
+ if (
+ ($a('uponSanitizeElement', a, { tagName: d, allowedTags: ga }),
+ !(nb(a.firstElementChild) || (nb(a.content) && nb(a.content.firstElementChild))) &&
+ Y(/<[/\w]/g, a.innerHTML) &&
+ Y(/<[/\w]/g, a.textContent)) ||
+ ('select' === d && Y(//i, d)) Bb(h, a);
+ else if ((W && ((d = U(d, ea, ' ')), (d = U(d, L, ' '))), (b = Ba(a.nodeName)), ob(b, e, d)))
+ try {
+ k ? a.setAttributeNS(k, h, d) : a.setAttribute(h, d), K(c.removed);
+ } catch (hb) {}
+ }
+ $a('afterSanitizeAttributes', a, null);
+ }
+ },
+ Cb = function zb(a) {
+ var b,
+ c = Hb(a);
+ for ($a('beforeSanitizeShadowDOM', a, null); (b = c.nextNode()); )
+ $a('uponSanitizeShadowNode', b, null), Ib(b) || (b.content instanceof g && zb(b.content), xb(b));
+ $a('afterSanitizeShadowDOM', a, null);
+ };
+ return (
+ (c.sanitize = function (e, f) {
+ var q, k, h;
+ if (((lb = !e) && (e = '\x3c!--\x3e'), 'string' != typeof e && !nb(e))) {
+ if ('function' != typeof e.toString) throw P('toString is not a function');
+ if ('string' != typeof (e = e.toString())) throw P('dirty is not a string, aborting');
+ }
+ if (!c.isSupported) {
+ if ('object' === a(b.toStaticHTML) || 'function' == typeof b.toStaticHTML) {
+ if ('string' == typeof e) return b.toStaticHTML(e);
+ if (nb(e)) return b.toStaticHTML(e.outerHTML);
+ }
+ return e;
+ }
+ if ((qb || rb(f), (c.removed = []), 'string' == typeof e && (w = !1), w)) {
+ if (e.nodeName && ((k = Ba(e.nodeName)), !ga[k] || Ua[k]))
+ throw P('root node is forbidden and cannot be sanitized in-place');
+ } else if (e instanceof n)
+ (1 === (k = (q = Va('\x3c!----\x3e')).ownerDocument.importNode(e, !0)).nodeType && 'BODY' === k.nodeName) ||
+ 'HTML' === k.nodeName
+ ? (q = k)
+ : q.appendChild(k);
+ else {
+ if (!Na && !W && !va && -1 === e.indexOf('<')) return ma && gb ? ma.createHTML(e) : e;
+ if (!(q = Va(e))) return Na ? null : gb ? R : '';
+ }
+ q && bb && cb(q.firstChild);
+ for (var A = Hb(w ? e : q); (k = A.nextNode()); )
+ (3 === k.nodeType && k === h) || Ib(k) || (k.content instanceof g && Cb(k.content), xb(k), (h = k));
+ if (w) return e;
+ if (Na) {
+ if (fb) for (h = Ta.call(q.ownerDocument); q.firstChild; ) h.appendChild(q.firstChild);
+ else h = q;
+ return aa.shadowroot && (h = tb.call(d, h, !0)), h;
+ }
+ h = va ? q.outerHTML : q.innerHTML;
+ return (
+ va &&
+ ga['!doctype'] &&
+ q.ownerDocument &&
+ q.ownerDocument.doctype &&
+ q.ownerDocument.doctype.name &&
+ Y(La, q.ownerDocument.doctype.name) &&
+ (h = '\n' + h),
+ W && ((h = U(h, ea, ' ')), (h = U(h, L, ' '))),
+ ma && gb ? ma.createHTML(h) : h
+ );
+ }),
+ (c.setConfig = function (a) {
+ rb(a);
+ qb = !0;
+ }),
+ (c.clearConfig = function () {
+ mb = null;
+ qb = !1;
+ }),
+ (c.isValidAttribute = function (a, b, c) {
+ mb || rb({});
+ a = Ba(a);
+ b = Ba(b);
+ return ob(a, b, c);
+ }),
+ (c.addHook = function (a, b) {
+ 'function' == typeof b && ((Aa[a] = Aa[a] || []), O(Aa[a], b));
+ }),
+ (c.removeHook = function (a) {
+ if (Aa[a]) return K(Aa[a]);
+ }),
+ (c.removeHooks = function (a) {
+ Aa[a] && (Aa[a] = []);
+ }),
+ (c.removeAllHooks = function () {
+ Aa = {};
+ }),
+ c
+ );
+ })();
+});
+var Base64 = {
+ _keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
+ encode: function (a, b) {
+ var c = '',
+ d,
+ e,
+ f,
+ g,
+ k,
+ h,
+ l = 0;
+ for ((null != b && b) || (a = Base64._utf8_encode(a)); l < a.length; )
+ (d = a.charCodeAt(l++)),
+ (e = a.charCodeAt(l++)),
+ (f = a.charCodeAt(l++)),
+ (g = d >> 2),
+ (d = ((d & 3) << 4) | (e >> 4)),
+ (k = ((e & 15) << 2) | (f >> 6)),
+ (h = f & 63),
+ isNaN(e) ? (k = h = 64) : isNaN(f) && (h = 64),
+ (c = c + this._keyStr.charAt(g) + this._keyStr.charAt(d) + this._keyStr.charAt(k) + this._keyStr.charAt(h));
+ return c;
+ },
+ decode: function (a, b) {
+ b = null != b ? b : !1;
+ var c = '',
+ d,
+ e,
+ f,
+ g,
+ k,
+ h = 0;
+ for (a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ''); h < a.length; )
+ (d = this._keyStr.indexOf(a.charAt(h++))),
+ (e = this._keyStr.indexOf(a.charAt(h++))),
+ (g = this._keyStr.indexOf(a.charAt(h++))),
+ (k = this._keyStr.indexOf(a.charAt(h++))),
+ (d = (d << 2) | (e >> 4)),
+ (e = ((e & 15) << 4) | (g >> 2)),
+ (f = ((g & 3) << 6) | k),
+ (c += String.fromCharCode(d)),
+ 64 != g && (c += String.fromCharCode(e)),
+ 64 != k && (c += String.fromCharCode(f));
+ b || (c = Base64._utf8_decode(c));
+ return c;
+ },
+ _utf8_encode: function (a) {
+ a = a.replace(/\r\n/g, '\n');
+ for (var b = '', c = 0; c < a.length; c++) {
+ var d = a.charCodeAt(c);
+ 128 > d
+ ? (b += String.fromCharCode(d))
+ : (127 < d && 2048 > d
+ ? (b += String.fromCharCode((d >> 6) | 192))
+ : ((b += String.fromCharCode((d >> 12) | 224)), (b += String.fromCharCode(((d >> 6) & 63) | 128))),
+ (b += String.fromCharCode((d & 63) | 128)));
+ }
+ return b;
+ },
+ _utf8_decode: function (a) {
+ var b = '',
+ c = 0,
+ d;
+ for (c1 = c2 = 0; c < a.length; )
+ (d = a.charCodeAt(c)),
+ 128 > d
+ ? ((b += String.fromCharCode(d)), c++)
+ : 191 < d && 224 > d
+ ? ((c2 = a.charCodeAt(c + 1)), (b += String.fromCharCode(((d & 31) << 6) | (c2 & 63))), (c += 2))
+ : ((c2 = a.charCodeAt(c + 1)),
+ (c3 = a.charCodeAt(c + 2)),
+ (b += String.fromCharCode(((d & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63))),
+ (c += 3));
+ return b;
+ },
+}; /*
+ pako 2.0.3 https://github.com/nodeca/pako @license (MIT AND Zlib) */
+!(function (a, b) {
+ 'object' == typeof exports && 'undefined' != typeof module
+ ? b(exports)
+ : 'function' == typeof define && define.amd
+ ? define(['exports'], b)
+ : b(((a = 'undefined' != typeof globalThis ? globalThis : a || self).pako = {}));
+})(this, function (a) {
+ function b(a) {
+ for (var b = a.length; 0 <= --b; ) a[b] = 0;
+ }
+ function c(a, b, c, d, e) {
+ this.static_tree = a;
+ this.extra_bits = b;
+ this.extra_base = c;
+ this.elems = d;
+ this.max_length = e;
+ this.has_stree = a && a.length;
+ }
+ function d(a, b) {
+ this.dyn_tree = a;
+ this.max_code = 0;
+ this.stat_desc = b;
+ }
+ function e(a, b, c, d, e) {
+ this.good_length = a;
+ this.max_lazy = b;
+ this.nice_length = c;
+ this.max_chain = d;
+ this.func = e;
+ }
+ function f() {
+ this.strm = null;
+ this.status = 0;
+ this.pending_buf = null;
+ this.wrap = this.pending = this.pending_out = this.pending_buf_size = 0;
+ this.gzhead = null;
+ this.gzindex = 0;
+ this.method = Ga;
+ this.last_flush = -1;
+ this.w_mask = this.w_bits = this.w_size = 0;
+ this.window = null;
+ this.window_size = 0;
+ this.head = this.prev = null;
+ this.nice_match =
+ this.good_match =
+ this.strategy =
+ this.level =
+ this.max_lazy_match =
+ this.max_chain_length =
+ this.prev_length =
+ this.lookahead =
+ this.match_start =
+ this.strstart =
+ this.match_available =
+ this.prev_match =
+ this.match_length =
+ this.block_start =
+ this.hash_shift =
+ this.hash_mask =
+ this.hash_bits =
+ this.hash_size =
+ this.ins_h =
+ 0;
+ this.dyn_ltree = new Uint16Array(1146);
+ this.dyn_dtree = new Uint16Array(122);
+ this.bl_tree = new Uint16Array(78);
+ Sa(this.dyn_ltree);
+ Sa(this.dyn_dtree);
+ Sa(this.bl_tree);
+ this.bl_desc = this.d_desc = this.l_desc = null;
+ this.bl_count = new Uint16Array(16);
+ this.heap = new Uint16Array(573);
+ Sa(this.heap);
+ this.heap_max = this.heap_len = 0;
+ this.depth = new Uint16Array(573);
+ Sa(this.depth);
+ this.bi_valid =
+ this.bi_buf =
+ this.insert =
+ this.matches =
+ this.static_len =
+ this.opt_len =
+ this.d_buf =
+ this.last_lit =
+ this.lit_bufsize =
+ this.l_buf =
+ 0;
+ }
+ function g(a) {
+ return (g =
+ 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
+ ? function (a) {
+ return typeof a;
+ }
+ : function (a) {
+ return a && 'function' == typeof Symbol && a.constructor === Symbol && a !== Symbol.prototype
+ ? 'symbol'
+ : typeof a;
+ })(a);
+ }
+ function k(a) {
+ a = this.options = jb(
+ { level: bb, method: fb, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Na },
+ a || {}
+ );
+ a.raw && 0 < a.windowBits
+ ? (a.windowBits = -a.windowBits)
+ : a.gzip && 0 < a.windowBits && 16 > a.windowBits && (a.windowBits += 16);
+ this.err = 0;
+ this.msg = '';
+ this.ended = !1;
+ this.chunks = [];
+ this.strm = new Ua();
+ this.strm.avail_out = 0;
+ var b = Ba.deflateInit2(this.strm, a.level, a.method, a.windowBits, a.memLevel, a.strategy);
+ if (b !== va) throw Error(ea[b]);
+ if ((a.header && Ba.deflateSetHeader(this.strm, a.header), a.dictionary)) {
+ var c;
+ if (
+ ((c =
+ 'string' == typeof a.dictionary
+ ? ca(a.dictionary)
+ : '[object ArrayBuffer]' === Ya.call(a.dictionary)
+ ? new Uint8Array(a.dictionary)
+ : a.dictionary),
+ (b = Ba.deflateSetDictionary(this.strm, c)) !== va)
+ )
+ throw Error(ea[b]);
+ this._dict_set = !0;
+ }
+ }
+ function h(a, b) {
+ var c = new k(b);
+ if ((c.push(a, !0), c.err)) throw c.msg || ea[c.err];
+ return c.result;
+ }
+ function l() {
+ this.mode = 0;
+ this.last = !1;
+ this.wrap = 0;
+ this.havedict = !1;
+ this.total = this.check = this.dmax = this.flags = 0;
+ this.head = null;
+ this.wnext = this.whave = this.wsize = this.wbits = 0;
+ this.window = null;
+ this.extra = this.offset = this.length = this.bits = this.hold = 0;
+ this.distcode = this.lencode = null;
+ this.have = this.ndist = this.nlen = this.ncode = this.distbits = this.lenbits = 0;
+ this.next = null;
+ this.lens = new Uint16Array(320);
+ this.work = new Uint16Array(288);
+ this.distdyn = this.lendyn = null;
+ this.was = this.back = this.sane = 0;
+ }
+ function m(a) {
+ var b = (this.options = jb({ chunkSize: 65536, windowBits: 15, to: '' }, a || {}));
+ b.raw &&
+ 0 <= b.windowBits &&
+ 16 > b.windowBits &&
+ ((b.windowBits = -b.windowBits), 0 === b.windowBits && (b.windowBits = -15));
+ !(0 <= b.windowBits && 16 > b.windowBits) || (a && a.windowBits) || (b.windowBits += 32);
+ 15 < b.windowBits && 48 > b.windowBits && 0 == (15 & b.windowBits) && (b.windowBits |= 15);
+ this.err = 0;
+ this.msg = '';
+ this.ended = !1;
+ this.chunks = [];
+ this.strm = new Ua();
+ this.strm.avail_out = 0;
+ a = Va.inflateInit2(this.strm, b.windowBits);
+ if (a !== ob) throw Error(ea[a]);
+ if (
+ ((this.header = new Hb()),
+ Va.inflateGetHeader(this.strm, this.header),
+ b.dictionary &&
+ ('string' == typeof b.dictionary
+ ? (b.dictionary = ca(b.dictionary))
+ : '[object ArrayBuffer]' === nb.call(b.dictionary) && (b.dictionary = new Uint8Array(b.dictionary)),
+ b.raw && (a = Va.inflateSetDictionary(this.strm, b.dictionary)) !== ob))
+ )
+ throw Error(ea[a]);
+ }
+ function n(a, b) {
+ var c = new m(b);
+ if ((c.push(a), c.err)) throw c.msg || ea[c.err];
+ return c.result;
+ }
+ var p = new Uint8Array([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]),
+ r = new Uint8Array([
+ 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,
+ ]),
+ t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]),
+ u = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]),
+ x = Array(576);
+ b(x);
+ var z = Array(60);
+ b(z);
+ var D = Array(512);
+ b(D);
+ var B = Array(256);
+ b(B);
+ var C = Array(29);
+ b(C);
+ var J,
+ v,
+ K,
+ O = Array(30);
+ b(O);
+ var T = function (a, b) {
+ a.pending_buf[a.pending++] = 255 & b;
+ a.pending_buf[a.pending++] = (b >>> 8) & 255;
+ },
+ M = function (a, b, c) {
+ a.bi_valid > 16 - c
+ ? ((a.bi_buf |= (b << a.bi_valid) & 65535),
+ T(a, a.bi_buf),
+ (a.bi_buf = b >> (16 - a.bi_valid)),
+ (a.bi_valid += c - 16))
+ : ((a.bi_buf |= (b << a.bi_valid) & 65535), (a.bi_valid += c));
+ },
+ U = function (a, b, c) {
+ M(a, c[2 * b], c[2 * b + 1]);
+ },
+ da = function (a, b) {
+ var c = 0;
+ do (c |= 1 & a), (a >>>= 1), (c <<= 1);
+ while (0 < --b);
+ return c >>> 1;
+ },
+ ha = function (a, b, c) {
+ var d,
+ e = Array(16),
+ f = 0;
+ for (d = 1; 15 >= d; d++) e[d] = f = (f + c[d - 1]) << 1;
+ for (c = 0; c <= b; c++) (d = a[2 * c + 1]), 0 !== d && (a[2 * c] = da(e[d]++, d));
+ },
+ Y = function (a) {
+ var b;
+ for (b = 0; 286 > b; b++) a.dyn_ltree[2 * b] = 0;
+ for (b = 0; 30 > b; b++) a.dyn_dtree[2 * b] = 0;
+ for (b = 0; 19 > b; b++) a.bl_tree[2 * b] = 0;
+ a.dyn_ltree[512] = 1;
+ a.opt_len = a.static_len = 0;
+ a.last_lit = a.matches = 0;
+ },
+ P = function (a) {
+ 8 < a.bi_valid ? T(a, a.bi_buf) : 0 < a.bi_valid && (a.pending_buf[a.pending++] = a.bi_buf);
+ a.bi_buf = 0;
+ a.bi_valid = 0;
+ },
+ Oa = function (a, b, c, d) {
+ var e = 2 * b,
+ f = 2 * c;
+ return a[e] < a[f] || (a[e] === a[f] && d[b] <= d[c]);
+ },
+ Da = function (a, b, c) {
+ for (
+ var d = a.heap[c], e = c << 1;
+ e <= a.heap_len &&
+ (e < a.heap_len && Oa(b, a.heap[e + 1], a.heap[e], a.depth) && e++, !Oa(b, d, a.heap[e], a.depth));
+
+ )
+ (a.heap[c] = a.heap[e]), (c = e), (e <<= 1);
+ a.heap[c] = d;
+ },
+ Pa = function (a, b, c) {
+ var d,
+ e,
+ f,
+ g,
+ q = 0;
+ if (0 !== a.last_lit) {
+ do
+ (d = (a.pending_buf[a.d_buf + 2 * q] << 8) | a.pending_buf[a.d_buf + 2 * q + 1]),
+ (e = a.pending_buf[a.l_buf + q]),
+ q++,
+ 0 === d
+ ? U(a, e, b)
+ : ((f = B[e]),
+ U(a, f + 256 + 1, b),
+ 0 !== (g = p[f]) && ((e -= C[f]), M(a, e, g)),
+ d--,
+ (f = 256 > d ? D[d] : D[256 + (d >>> 7)]),
+ U(a, f, c),
+ 0 !== (g = r[f]) && ((d -= O[f]), M(a, d, g)));
+ while (q < a.last_lit);
+ }
+ U(a, 256, b);
+ },
+ Wa = function (a, b) {
+ var c,
+ d,
+ e,
+ f = b.dyn_tree;
+ d = b.stat_desc.static_tree;
+ var g = b.stat_desc.has_stree,
+ q = b.stat_desc.elems,
+ k = -1;
+ a.heap_len = 0;
+ a.heap_max = 573;
+ for (c = 0; c < q; c++) 0 !== f[2 * c] ? ((a.heap[++a.heap_len] = k = c), (a.depth[c] = 0)) : (f[2 * c + 1] = 0);
+ for (; 2 > a.heap_len; )
+ (f[2 * (e = a.heap[++a.heap_len] = 2 > k ? ++k : 0)] = 1),
+ (a.depth[e] = 0),
+ a.opt_len--,
+ g && (a.static_len -= d[2 * e + 1]);
+ b.max_code = k;
+ for (c = a.heap_len >> 1; 1 <= c; c--) Da(a, f, c);
+ e = q;
+ do
+ (c = a.heap[1]),
+ (a.heap[1] = a.heap[a.heap_len--]),
+ Da(a, f, 1),
+ (d = a.heap[1]),
+ (a.heap[--a.heap_max] = c),
+ (a.heap[--a.heap_max] = d),
+ (f[2 * e] = f[2 * c] + f[2 * d]),
+ (a.depth[e] = (a.depth[c] >= a.depth[d] ? a.depth[c] : a.depth[d]) + 1),
+ (f[2 * c + 1] = f[2 * d + 1] = e),
+ (a.heap[1] = e++),
+ Da(a, f, 1);
+ while (2 <= a.heap_len);
+ a.heap[--a.heap_max] = a.heap[1];
+ var h,
+ w,
+ A,
+ g = b.dyn_tree,
+ q = b.max_code,
+ G = b.stat_desc.static_tree,
+ y = b.stat_desc.has_stree,
+ l = b.stat_desc.extra_bits,
+ H = b.stat_desc.extra_base,
+ m = b.stat_desc.max_length,
+ oa = 0;
+ for (d = 0; 15 >= d; d++) a.bl_count[d] = 0;
+ g[2 * a.heap[a.heap_max] + 1] = 0;
+ for (c = a.heap_max + 1; 573 > c; c++)
+ (d = g[2 * g[2 * (e = a.heap[c]) + 1] + 1] + 1) > m && ((d = m), oa++),
+ (g[2 * e + 1] = d),
+ e > q ||
+ (a.bl_count[d]++,
+ (w = 0),
+ e >= H && (w = l[e - H]),
+ (A = g[2 * e]),
+ (a.opt_len += A * (d + w)),
+ y && (a.static_len += A * (G[2 * e + 1] + w)));
+ if (0 !== oa) {
+ do {
+ for (d = m - 1; 0 === a.bl_count[d]; ) d--;
+ a.bl_count[d]--;
+ a.bl_count[d + 1] += 2;
+ a.bl_count[m]--;
+ oa -= 2;
+ } while (0 < oa);
+ for (d = m; 0 !== d; d--)
+ for (e = a.bl_count[d]; 0 !== e; )
+ (h = a.heap[--c]) > q ||
+ (g[2 * h + 1] !== d && ((a.opt_len += (d - g[2 * h + 1]) * g[2 * h]), (g[2 * h + 1] = d)), e--);
+ }
+ ha(f, k, a.bl_count);
+ },
+ Ea = function (a, b, c) {
+ var d,
+ e,
+ f = -1,
+ g = b[1],
+ q = 0,
+ k = 7,
+ h = 4;
+ 0 === g && ((k = 138), (h = 3));
+ b[2 * (c + 1) + 1] = 65535;
+ for (d = 0; d <= c; d++)
+ (e = g),
+ (g = b[2 * (d + 1) + 1]),
+ (++q < k && e === g) ||
+ (q < h
+ ? (a.bl_tree[2 * e] += q)
+ : 0 !== e
+ ? (e !== f && a.bl_tree[2 * e]++, a.bl_tree[32]++)
+ : 10 >= q
+ ? a.bl_tree[34]++
+ : a.bl_tree[36]++,
+ (q = 0),
+ (f = e),
+ 0 === g ? ((k = 138), (h = 3)) : e === g ? ((k = 6), (h = 3)) : ((k = 7), (h = 4)));
+ },
+ qa = function (a, b, c) {
+ var d,
+ e,
+ f = -1,
+ g = b[1],
+ q = 0,
+ k = 7,
+ h = 4;
+ 0 === g && ((k = 138), (h = 3));
+ for (d = 0; d <= c; d++)
+ if (((e = g), (g = b[2 * (d + 1) + 1]), !(++q < k && e === g))) {
+ if (q < h) {
+ do U(a, e, a.bl_tree);
+ while (0 != --q);
+ } else
+ 0 !== e
+ ? (e !== f && (U(a, e, a.bl_tree), q--), U(a, 16, a.bl_tree), M(a, q - 3, 2))
+ : 10 >= q
+ ? (U(a, 17, a.bl_tree), M(a, q - 3, 3))
+ : (U(a, 18, a.bl_tree), M(a, q - 11, 7));
+ q = 0;
+ f = e;
+ 0 === g ? ((k = 138), (h = 3)) : e === g ? ((k = 6), (h = 3)) : ((k = 7), (h = 4));
+ }
+ },
+ ia = !1,
+ Ka = function (a, b, c, d) {
+ M(a, 0 + (d ? 1 : 0), 3);
+ P(a);
+ T(a, c);
+ T(a, ~c);
+ a.pending_buf.set(a.window.subarray(b, b + c), a.pending);
+ a.pending += c;
+ },
+ ua = function (a, b, c, d) {
+ var e = (65535 & a) | 0;
+ a = ((a >>> 16) & 65535) | 0;
+ for (var f; 0 !== c; ) {
+ c -= f = 2e3 < c ? 2e3 : c;
+ do a = (a + (e = (e + b[d++]) | 0)) | 0;
+ while (--f);
+ e %= 65521;
+ a %= 65521;
+ }
+ return e | (a << 16) | 0;
+ },
+ Xa = new Uint32Array(
+ (function () {
+ for (var a, b = [], c = 0; 256 > c; c++) {
+ a = c;
+ for (var d = 0; 8 > d; d++) a = 1 & a ? 3988292384 ^ (a >>> 1) : a >>> 1;
+ b[c] = a;
+ }
+ return b;
+ })()
+ ),
+ Z = function (a, b, c, d) {
+ c = d + c;
+ for (a ^= -1; d < c; d++) a = (a >>> 8) ^ Xa[255 & (a ^ b[d])];
+ return -1 ^ a;
+ },
+ ea = {
+ '2': 'need dictionary',
+ '1': 'stream end',
+ '0': '',
+ '-1': 'file error',
+ '-2': 'stream error',
+ '-3': 'data error',
+ '-4': 'insufficient memory',
+ '-5': 'buffer error',
+ '-6': 'incompatible version',
+ },
+ L = {
+ Z_NO_FLUSH: 0,
+ Z_PARTIAL_FLUSH: 1,
+ Z_SYNC_FLUSH: 2,
+ Z_FULL_FLUSH: 3,
+ Z_FINISH: 4,
+ Z_BLOCK: 5,
+ Z_TREES: 6,
+ Z_OK: 0,
+ Z_STREAM_END: 1,
+ Z_NEED_DICT: 2,
+ Z_ERRNO: -1,
+ Z_STREAM_ERROR: -2,
+ Z_DATA_ERROR: -3,
+ Z_MEM_ERROR: -4,
+ Z_BUF_ERROR: -5,
+ Z_NO_COMPRESSION: 0,
+ Z_BEST_SPEED: 1,
+ Z_BEST_COMPRESSION: 9,
+ Z_DEFAULT_COMPRESSION: -1,
+ Z_FILTERED: 1,
+ Z_HUFFMAN_ONLY: 2,
+ Z_RLE: 3,
+ Z_FIXED: 4,
+ Z_DEFAULT_STRATEGY: 0,
+ Z_BINARY: 0,
+ Z_TEXT: 1,
+ Z_UNKNOWN: 2,
+ Z_DEFLATED: 8,
+ },
+ db = function (a, b, c, d) {
+ var e,
+ f,
+ g = 0;
+ 0 < a.level
+ ? (2 === a.strm.data_type &&
+ (a.strm.data_type = (function (a) {
+ var b,
+ c = 4093624447;
+ for (b = 0; 31 >= b; b++, c >>>= 1) if (1 & c && 0 !== a.dyn_ltree[2 * b]) return 0;
+ if (0 !== a.dyn_ltree[18] || 0 !== a.dyn_ltree[20] || 0 !== a.dyn_ltree[26]) return 1;
+ for (b = 32; 256 > b; b++) if (0 !== a.dyn_ltree[2 * b]) return 1;
+ return 0;
+ })(a)),
+ Wa(a, a.l_desc),
+ Wa(a, a.d_desc),
+ (g = (function (a) {
+ var b;
+ Ea(a, a.dyn_ltree, a.l_desc.max_code);
+ Ea(a, a.dyn_dtree, a.d_desc.max_code);
+ Wa(a, a.bl_desc);
+ for (b = 18; 3 <= b && 0 === a.bl_tree[2 * u[b] + 1]; b--);
+ return (a.opt_len += 3 * (b + 1) + 14), b;
+ })(a)),
+ (e = (a.opt_len + 3 + 7) >>> 3),
+ (f = (a.static_len + 3 + 7) >>> 3) <= e && (e = f))
+ : (e = f = c + 5);
+ c + 4 <= e && -1 !== b
+ ? Ka(a, b, c, d)
+ : 4 === a.strategy || f === e
+ ? (M(a, 2 + (d ? 1 : 0), 3), Pa(a, x, z))
+ : (M(a, 4 + (d ? 1 : 0), 3),
+ (function (a, b, c, d) {
+ var e;
+ M(a, b - 257, 5);
+ M(a, c - 1, 5);
+ M(a, d - 4, 4);
+ for (e = 0; e < d; e++) M(a, a.bl_tree[2 * u[e] + 1], 3);
+ qa(a, a.dyn_ltree, b - 1);
+ qa(a, a.dyn_dtree, c - 1);
+ })(a, a.l_desc.max_code + 1, a.d_desc.max_code + 1, g + 1),
+ Pa(a, a.dyn_ltree, a.dyn_dtree));
+ Y(a);
+ d && P(a);
+ },
+ sa = function (a, b, c) {
+ return (
+ (a.pending_buf[a.d_buf + 2 * a.last_lit] = (b >>> 8) & 255),
+ (a.pending_buf[a.d_buf + 2 * a.last_lit + 1] = 255 & b),
+ (a.pending_buf[a.l_buf + a.last_lit] = 255 & c),
+ a.last_lit++,
+ 0 === b
+ ? a.dyn_ltree[2 * c]++
+ : (a.matches++,
+ b--,
+ a.dyn_ltree[2 * (B[c] + 256 + 1)]++,
+ a.dyn_dtree[2 * (256 > b ? D[b] : D[256 + (b >>> 7)])]++),
+ a.last_lit === a.lit_bufsize - 1
+ );
+ },
+ eb = function (a) {
+ M(a, 2, 3);
+ U(a, 256, x);
+ 16 === a.bi_valid
+ ? (T(a, a.bi_buf), (a.bi_buf = 0), (a.bi_valid = 0))
+ : 8 <= a.bi_valid && ((a.pending_buf[a.pending++] = 255 & a.bi_buf), (a.bi_buf >>= 8), (a.bi_valid -= 8));
+ },
+ ta = L.Z_NO_FLUSH,
+ Fa = L.Z_PARTIAL_FLUSH,
+ La = L.Z_FULL_FLUSH,
+ la = L.Z_FINISH,
+ Ca = L.Z_BLOCK,
+ pa = L.Z_OK,
+ Ja = L.Z_STREAM_END,
+ ba = L.Z_STREAM_ERROR,
+ E = L.Z_DATA_ERROR,
+ I = L.Z_BUF_ERROR,
+ F = L.Z_DEFAULT_COMPRESSION,
+ N = L.Z_FILTERED,
+ V = L.Z_HUFFMAN_ONLY,
+ Q = L.Z_RLE,
+ X = L.Z_FIXED,
+ ja = L.Z_DEFAULT_STRATEGY,
+ Qa = L.Z_UNKNOWN,
+ Ga = L.Z_DEFLATED,
+ Ra = function (a, b) {
+ return (a.msg = ea[b]), b;
+ },
+ Sa = function (a) {
+ for (var b = a.length; 0 <= --b; ) a[b] = 0;
+ },
+ ya = function (a, b, c) {
+ return ((b << a.hash_shift) ^ c) & a.hash_mask;
+ },
+ Ma = function (a) {
+ var b = a.state,
+ c = b.pending;
+ c > a.avail_out && (c = a.avail_out);
+ 0 !== c &&
+ (a.output.set(b.pending_buf.subarray(b.pending_out, b.pending_out + c), a.next_out),
+ (a.next_out += c),
+ (b.pending_out += c),
+ (a.total_out += c),
+ (a.avail_out -= c),
+ (b.pending -= c),
+ 0 === b.pending && (b.pending_out = 0));
+ },
+ fa = function (a, b) {
+ db(a, 0 <= a.block_start ? a.block_start : -1, a.strstart - a.block_start, b);
+ a.block_start = a.strstart;
+ Ma(a.strm);
+ },
+ S = function (a, b) {
+ a.pending_buf[a.pending++] = b;
+ },
+ ma = function (a, b) {
+ a.pending_buf[a.pending++] = (b >>> 8) & 255;
+ a.pending_buf[a.pending++] = 255 & b;
+ },
+ R = function (a, b) {
+ var c,
+ d,
+ e = a.max_chain_length,
+ f = a.strstart,
+ g = a.prev_length,
+ q = a.nice_match,
+ k = a.strstart > a.w_size - 262 ? a.strstart - (a.w_size - 262) : 0,
+ h = a.window,
+ w = a.w_mask,
+ A = a.prev,
+ G = a.strstart + 258,
+ y = h[f + g - 1],
+ l = h[f + g];
+ a.prev_length >= a.good_match && (e >>= 2);
+ q > a.lookahead && (q = a.lookahead);
+ do
+ if (h[(c = b) + g] === l && h[c + g - 1] === y && h[c] === h[f] && h[++c] === h[f + 1]) {
+ f += 2;
+ for (
+ c++;
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ h[++f] === h[++c] &&
+ f < G;
+
+ );
+ if (((d = 258 - (G - f)), (f = G - 258), d > g)) {
+ if (((a.match_start = b), (g = d), d >= q)) break;
+ y = h[f + g - 1];
+ l = h[f + g];
+ }
+ }
+ while ((b = A[b & w]) > k && 0 != --e);
+ return g <= a.lookahead ? g : a.lookahead;
+ },
+ ra = function (a) {
+ var b,
+ c,
+ d,
+ e,
+ f,
+ g,
+ q,
+ k,
+ h,
+ w = a.w_size;
+ do {
+ if (((e = a.window_size - a.lookahead - a.strstart), a.strstart >= w + (w - 262))) {
+ a.window.set(a.window.subarray(w, w + w), 0);
+ a.match_start -= w;
+ a.strstart -= w;
+ a.block_start -= w;
+ b = c = a.hash_size;
+ do (d = a.head[--b]), (a.head[b] = d >= w ? d - w : 0);
+ while (--c);
+ b = c = w;
+ do (d = a.prev[--b]), (a.prev[b] = d >= w ? d - w : 0);
+ while (--c);
+ e += w;
+ }
+ if (0 === a.strm.avail_in) break;
+ if (
+ ((f = a.strm),
+ (g = a.window),
+ (q = a.strstart + a.lookahead),
+ (k = e),
+ (h = void 0),
+ (h = f.avail_in) > k && (h = k),
+ (c =
+ 0 === h
+ ? 0
+ : ((f.avail_in -= h),
+ g.set(f.input.subarray(f.next_in, f.next_in + h), q),
+ 1 === f.state.wrap
+ ? (f.adler = ua(f.adler, g, h, q))
+ : 2 === f.state.wrap && (f.adler = Z(f.adler, g, h, q)),
+ (f.next_in += h),
+ (f.total_in += h),
+ h)),
+ (a.lookahead += c),
+ 3 <= a.lookahead + a.insert)
+ )
+ for (
+ b = a.strstart - a.insert, a.ins_h = a.window[b], a.ins_h = ya(a, a.ins_h, a.window[b + 1]);
+ a.insert &&
+ ((a.ins_h = ya(a, a.ins_h, a.window[b + 3 - 1])),
+ (a.prev[b & a.w_mask] = a.head[a.ins_h]),
+ (a.head[a.ins_h] = b),
+ b++,
+ a.insert--,
+ !(3 > a.lookahead + a.insert));
+
+ );
+ } while (262 > a.lookahead && 0 !== a.strm.avail_in);
+ },
+ ib = function (a, b) {
+ for (var c, d; ; ) {
+ if (262 > a.lookahead) {
+ if ((ra(a), 262 > a.lookahead && b === ta)) return 1;
+ if (0 === a.lookahead) break;
+ }
+ if (
+ ((c = 0),
+ 3 <= a.lookahead &&
+ ((a.ins_h = ya(a, a.ins_h, a.window[a.strstart + 3 - 1])),
+ (c = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h]),
+ (a.head[a.ins_h] = a.strstart)),
+ 0 !== c && a.strstart - c <= a.w_size - 262 && (a.match_length = R(a, c)),
+ 3 <= a.match_length)
+ )
+ if (
+ ((d = sa(a, a.strstart - a.match_start, a.match_length - 3)),
+ (a.lookahead -= a.match_length),
+ a.match_length <= a.max_lazy_match && 3 <= a.lookahead)
+ ) {
+ a.match_length--;
+ do
+ a.strstart++,
+ (a.ins_h = ya(a, a.ins_h, a.window[a.strstart + 3 - 1])),
+ (c = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h]),
+ (a.head[a.ins_h] = a.strstart);
+ while (0 != --a.match_length);
+ a.strstart++;
+ } else
+ (a.strstart += a.match_length),
+ (a.match_length = 0),
+ (a.ins_h = a.window[a.strstart]),
+ (a.ins_h = ya(a, a.ins_h, a.window[a.strstart + 1]));
+ else (d = sa(a, 0, a.window[a.strstart])), a.lookahead--, a.strstart++;
+ if (d && (fa(a, !1), 0 === a.strm.avail_out)) return 1;
+ }
+ return (
+ (a.insert = 2 > a.strstart ? a.strstart : 2),
+ b === la
+ ? (fa(a, !0), 0 === a.strm.avail_out ? 3 : 4)
+ : a.last_lit && (fa(a, !1), 0 === a.strm.avail_out)
+ ? 1
+ : 2
+ );
+ },
+ Ta = function (a, b) {
+ for (var c, d, e; ; ) {
+ if (262 > a.lookahead) {
+ if ((ra(a), 262 > a.lookahead && b === ta)) return 1;
+ if (0 === a.lookahead) break;
+ }
+ if (
+ ((c = 0),
+ 3 <= a.lookahead &&
+ ((a.ins_h = ya(a, a.ins_h, a.window[a.strstart + 3 - 1])),
+ (c = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h]),
+ (a.head[a.ins_h] = a.strstart)),
+ (a.prev_length = a.match_length),
+ (a.prev_match = a.match_start),
+ (a.match_length = 2),
+ 0 !== c &&
+ a.prev_length < a.max_lazy_match &&
+ a.strstart - c <= a.w_size - 262 &&
+ ((a.match_length = R(a, c)),
+ 5 >= a.match_length &&
+ (a.strategy === N || (3 === a.match_length && 4096 < a.strstart - a.match_start)) &&
+ (a.match_length = 2)),
+ 3 <= a.prev_length && a.match_length <= a.prev_length)
+ ) {
+ e = a.strstart + a.lookahead - 3;
+ d = sa(a, a.strstart - 1 - a.prev_match, a.prev_length - 3);
+ a.lookahead -= a.prev_length - 1;
+ a.prev_length -= 2;
+ do
+ ++a.strstart <= e &&
+ ((a.ins_h = ya(a, a.ins_h, a.window[a.strstart + 3 - 1])),
+ (c = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h]),
+ (a.head[a.ins_h] = a.strstart));
+ while (0 != --a.prev_length);
+ if (((a.match_available = 0), (a.match_length = 2), a.strstart++, d && (fa(a, !1), 0 === a.strm.avail_out)))
+ return 1;
+ } else if (a.match_available) {
+ if ((sa(a, 0, a.window[a.strstart - 1]) && fa(a, !1), a.strstart++, a.lookahead--, 0 === a.strm.avail_out))
+ return 1;
+ } else (a.match_available = 1), a.strstart++, a.lookahead--;
+ }
+ return (
+ a.match_available && (sa(a, 0, a.window[a.strstart - 1]), (a.match_available = 0)),
+ (a.insert = 2 > a.strstart ? a.strstart : 2),
+ b === la
+ ? (fa(a, !0), 0 === a.strm.avail_out ? 3 : 4)
+ : a.last_lit && (fa(a, !1), 0 === a.strm.avail_out)
+ ? 1
+ : 2
+ );
+ },
+ za = [
+ new e(0, 0, 0, 0, function (a, b) {
+ var c = 65535;
+ for (c > a.pending_buf_size - 5 && (c = a.pending_buf_size - 5); ; ) {
+ if (1 >= a.lookahead) {
+ if ((ra(a), 0 === a.lookahead && b === ta)) return 1;
+ if (0 === a.lookahead) break;
+ }
+ a.strstart += a.lookahead;
+ a.lookahead = 0;
+ var d = a.block_start + c;
+ if (
+ ((0 === a.strstart || a.strstart >= d) &&
+ ((a.lookahead = a.strstart - d), (a.strstart = d), fa(a, !1), 0 === a.strm.avail_out)) ||
+ (a.strstart - a.block_start >= a.w_size - 262 && (fa(a, !1), 0 === a.strm.avail_out))
+ )
+ return 1;
+ }
+ return (
+ (a.insert = 0),
+ b === la
+ ? (fa(a, !0), 0 === a.strm.avail_out ? 3 : 4)
+ : (a.strstart > a.block_start && (fa(a, !1), a.strm.avail_out), 1)
+ );
+ }),
+ new e(4, 4, 8, 4, ib),
+ new e(4, 5, 16, 8, ib),
+ new e(4, 6, 32, 32, ib),
+ new e(4, 4, 16, 16, Ta),
+ new e(8, 16, 32, 32, Ta),
+ new e(8, 16, 128, 128, Ta),
+ new e(8, 32, 128, 256, Ta),
+ new e(32, 128, 258, 1024, Ta),
+ new e(32, 258, 258, 4096, Ta),
+ ],
+ tb = function (a) {
+ if (!a || !a.state) return Ra(a, ba);
+ a.total_in = a.total_out = 0;
+ a.data_type = Qa;
+ var b = a.state;
+ b.pending = 0;
+ b.pending_out = 0;
+ 0 > b.wrap && (b.wrap = -b.wrap);
+ b.status = b.wrap ? 42 : 113;
+ a.adler = 2 === b.wrap ? 0 : 1;
+ b.last_flush = ta;
+ if (!ia) {
+ var e, f, g;
+ a = Array(16);
+ for (g = f = 0; 28 > g; g++) for (C[g] = f, e = 0; e < 1 << p[g]; e++) B[f++] = g;
+ B[f - 1] = g;
+ for (g = f = 0; 16 > g; g++) for (O[g] = f, e = 0; e < 1 << r[g]; e++) D[f++] = g;
+ for (f >>= 7; 30 > g; g++) for (O[g] = f << 7, e = 0; e < 1 << (r[g] - 7); e++) D[256 + f++] = g;
+ for (e = 0; 15 >= e; e++) a[e] = 0;
+ for (e = 0; 143 >= e; ) (x[2 * e + 1] = 8), e++, a[8]++;
+ for (; 255 >= e; ) (x[2 * e + 1] = 9), e++, a[9]++;
+ for (; 279 >= e; ) (x[2 * e + 1] = 7), e++, a[7]++;
+ for (; 287 >= e; ) (x[2 * e + 1] = 8), e++, a[8]++;
+ ha(x, 287, a);
+ for (e = 0; 30 > e; e++) (z[2 * e + 1] = 5), (z[2 * e] = da(e, 5));
+ J = new c(x, p, 257, 286, 15);
+ v = new c(z, r, 0, 30, 15);
+ K = new c([], t, 0, 19, 7);
+ !0;
+ ia = !0;
+ }
+ b.l_desc = new d(b.dyn_ltree, J);
+ b.d_desc = new d(b.dyn_dtree, v);
+ b.bl_desc = new d(b.bl_tree, K);
+ b.bi_buf = 0;
+ b.bi_valid = 0;
+ Y(b);
+ return pa;
+ },
+ Aa = function (a) {
+ var b,
+ c = tb(a);
+ return (
+ c === pa &&
+ (((b = a.state).window_size = 2 * b.w_size),
+ Sa(b.head),
+ (b.max_lazy_match = za[b.level].max_lazy),
+ (b.good_match = za[b.level].good_length),
+ (b.nice_match = za[b.level].nice_length),
+ (b.max_chain_length = za[b.level].max_chain),
+ (b.strstart = 0),
+ (b.block_start = 0),
+ (b.lookahead = 0),
+ (b.insert = 0),
+ (b.match_length = b.prev_length = 2),
+ (b.match_available = 0),
+ (b.ins_h = 0)),
+ c
+ );
+ },
+ ab = function (a, b, c, d, e, g) {
+ if (!a) return ba;
+ var q = 1;
+ if (
+ (b === F && (b = 6),
+ 0 > d ? ((q = 0), (d = -d)) : 15 < d && ((q = 2), (d -= 16)),
+ 1 > e || 9 < e || c !== Ga || 8 > d || 15 < d || 0 > b || 9 < b || 0 > g || g > X)
+ )
+ return Ra(a, ba);
+ 8 === d && (d = 9);
+ var k = new f();
+ return (
+ (a.state = k),
+ (k.strm = a),
+ (k.wrap = q),
+ (k.gzhead = null),
+ (k.w_bits = d),
+ (k.w_size = 1 << k.w_bits),
+ (k.w_mask = k.w_size - 1),
+ (k.hash_bits = e + 7),
+ (k.hash_size = 1 << k.hash_bits),
+ (k.hash_mask = k.hash_size - 1),
+ (k.hash_shift = ~~((k.hash_bits + 3 - 1) / 3)),
+ (k.window = new Uint8Array(2 * k.w_size)),
+ (k.head = new Uint16Array(k.hash_size)),
+ (k.prev = new Uint16Array(k.w_size)),
+ (k.lit_bufsize = 1 << (e + 6)),
+ (k.pending_buf_size = 4 * k.lit_bufsize),
+ (k.pending_buf = new Uint8Array(k.pending_buf_size)),
+ (k.d_buf = 1 * k.lit_bufsize),
+ (k.l_buf = 3 * k.lit_bufsize),
+ (k.level = b),
+ (k.strategy = g),
+ (k.method = c),
+ Aa(a)
+ );
+ },
+ Ba = {
+ deflateInit: function (a, b) {
+ return ab(a, b, Ga, 15, 8, ja);
+ },
+ deflateInit2: ab,
+ deflateReset: Aa,
+ deflateResetKeep: tb,
+ deflateSetHeader: function (a, b) {
+ return a && a.state ? (2 !== a.state.wrap ? ba : ((a.state.gzhead = b), pa)) : ba;
+ },
+ deflate: function (a, b) {
+ var c, d;
+ if (!a || !a.state || b > Ca || 0 > b) return a ? Ra(a, ba) : ba;
+ var e = a.state;
+ if (!a.output || (!a.input && 0 !== a.avail_in) || (666 === e.status && b !== la))
+ return Ra(a, 0 === a.avail_out ? I : ba);
+ e.strm = a;
+ var f = e.last_flush;
+ if (((e.last_flush = b), 42 === e.status))
+ 2 === e.wrap
+ ? ((a.adler = 0),
+ S(e, 31),
+ S(e, 139),
+ S(e, 8),
+ e.gzhead
+ ? (S(
+ e,
+ (e.gzhead.text ? 1 : 0) +
+ (e.gzhead.hcrc ? 2 : 0) +
+ (e.gzhead.extra ? 4 : 0) +
+ (e.gzhead.name ? 8 : 0) +
+ (e.gzhead.comment ? 16 : 0)
+ ),
+ S(e, 255 & e.gzhead.time),
+ S(e, (e.gzhead.time >> 8) & 255),
+ S(e, (e.gzhead.time >> 16) & 255),
+ S(e, (e.gzhead.time >> 24) & 255),
+ S(e, 9 === e.level ? 2 : e.strategy >= V || 2 > e.level ? 4 : 0),
+ S(e, 255 & e.gzhead.os),
+ e.gzhead.extra &&
+ e.gzhead.extra.length &&
+ (S(e, 255 & e.gzhead.extra.length), S(e, (e.gzhead.extra.length >> 8) & 255)),
+ e.gzhead.hcrc && (a.adler = Z(a.adler, e.pending_buf, e.pending, 0)),
+ (e.gzindex = 0),
+ (e.status = 69))
+ : (S(e, 0),
+ S(e, 0),
+ S(e, 0),
+ S(e, 0),
+ S(e, 0),
+ S(e, 9 === e.level ? 2 : e.strategy >= V || 2 > e.level ? 4 : 0),
+ S(e, 3),
+ (e.status = 113)))
+ : ((c = (Ga + ((e.w_bits - 8) << 4)) << 8),
+ (c |= (e.strategy >= V || 2 > e.level ? 0 : 6 > e.level ? 1 : 6 === e.level ? 2 : 3) << 6),
+ 0 !== e.strstart && (c |= 32),
+ (e.status = 113),
+ ma(e, c + (31 - (c % 31))),
+ 0 !== e.strstart && (ma(e, a.adler >>> 16), ma(e, 65535 & a.adler)),
+ (a.adler = 1));
+ if (69 === e.status)
+ if (e.gzhead.extra) {
+ for (
+ c = e.pending;
+ e.gzindex < (65535 & e.gzhead.extra.length) &&
+ (e.pending !== e.pending_buf_size ||
+ (e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c)),
+ Ma(a),
+ (c = e.pending),
+ e.pending !== e.pending_buf_size));
+
+ )
+ S(e, 255 & e.gzhead.extra[e.gzindex]), e.gzindex++;
+ e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c));
+ e.gzindex === e.gzhead.extra.length && ((e.gzindex = 0), (e.status = 73));
+ } else e.status = 73;
+ if (73 === e.status)
+ if (e.gzhead.name) {
+ c = e.pending;
+ do {
+ if (
+ e.pending === e.pending_buf_size &&
+ (e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c)),
+ Ma(a),
+ (c = e.pending),
+ e.pending === e.pending_buf_size)
+ ) {
+ d = 1;
+ break;
+ }
+ d = e.gzindex < e.gzhead.name.length ? 255 & e.gzhead.name.charCodeAt(e.gzindex++) : 0;
+ S(e, d);
+ } while (0 !== d);
+ e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c));
+ 0 === d && ((e.gzindex = 0), (e.status = 91));
+ } else e.status = 91;
+ if (91 === e.status)
+ if (e.gzhead.comment) {
+ c = e.pending;
+ do {
+ if (
+ e.pending === e.pending_buf_size &&
+ (e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c)),
+ Ma(a),
+ (c = e.pending),
+ e.pending === e.pending_buf_size)
+ ) {
+ d = 1;
+ break;
+ }
+ d = e.gzindex < e.gzhead.comment.length ? 255 & e.gzhead.comment.charCodeAt(e.gzindex++) : 0;
+ S(e, d);
+ } while (0 !== d);
+ e.gzhead.hcrc && e.pending > c && (a.adler = Z(a.adler, e.pending_buf, e.pending - c, c));
+ 0 === d && (e.status = 103);
+ } else e.status = 103;
+ if (
+ (103 === e.status &&
+ (e.gzhead.hcrc
+ ? (e.pending + 2 > e.pending_buf_size && Ma(a),
+ e.pending + 2 <= e.pending_buf_size &&
+ (S(e, 255 & a.adler), S(e, (a.adler >> 8) & 255), (a.adler = 0), (e.status = 113)))
+ : (e.status = 113)),
+ 0 !== e.pending)
+ ) {
+ if ((Ma(a), 0 === a.avail_out)) return (e.last_flush = -1), pa;
+ } else if (0 === a.avail_in && (b << 1) - (4 < b ? 9 : 0) <= (f << 1) - (4 < f ? 9 : 0) && b !== la)
+ return Ra(a, I);
+ if (666 === e.status && 0 !== a.avail_in) return Ra(a, I);
+ if (0 !== a.avail_in || 0 !== e.lookahead || (b !== ta && 666 !== e.status)) {
+ f =
+ e.strategy === V
+ ? (function (a, b) {
+ for (var c; ; ) {
+ if (0 === a.lookahead && (ra(a), 0 === a.lookahead)) {
+ if (b === ta) return 1;
+ break;
+ }
+ if (
+ ((a.match_length = 0),
+ (c = sa(a, 0, a.window[a.strstart])),
+ a.lookahead--,
+ a.strstart++,
+ c && (fa(a, !1), 0 === a.strm.avail_out))
+ )
+ return 1;
+ }
+ return (
+ (a.insert = 0),
+ b === la
+ ? (fa(a, !0), 0 === a.strm.avail_out ? 3 : 4)
+ : a.last_lit && (fa(a, !1), 0 === a.strm.avail_out)
+ ? 1
+ : 2
+ );
+ })(e, b)
+ : e.strategy === Q
+ ? (function (a, b) {
+ for (var c, d, e, f, g = a.window; ; ) {
+ if (258 >= a.lookahead) {
+ if ((ra(a), 258 >= a.lookahead && b === ta)) return 1;
+ if (0 === a.lookahead) break;
+ }
+ if (
+ ((a.match_length = 0),
+ 3 <= a.lookahead &&
+ 0 < a.strstart &&
+ (d = g[(e = a.strstart - 1)]) === g[++e] &&
+ d === g[++e] &&
+ d === g[++e])
+ ) {
+ for (
+ f = a.strstart + 258;
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ d === g[++e] &&
+ e < f;
+
+ );
+ a.match_length = 258 - (f - e);
+ a.match_length > a.lookahead && (a.match_length = a.lookahead);
+ }
+ if (
+ (3 <= a.match_length
+ ? ((c = sa(a, 1, a.match_length - 3)),
+ (a.lookahead -= a.match_length),
+ (a.strstart += a.match_length),
+ (a.match_length = 0))
+ : ((c = sa(a, 0, a.window[a.strstart])), a.lookahead--, a.strstart++),
+ c && (fa(a, !1), 0 === a.strm.avail_out))
+ )
+ return 1;
+ }
+ return (
+ (a.insert = 0),
+ b === la
+ ? (fa(a, !0), 0 === a.strm.avail_out ? 3 : 4)
+ : a.last_lit && (fa(a, !1), 0 === a.strm.avail_out)
+ ? 1
+ : 2
+ );
+ })(e, b)
+ : za[e.level].func(e, b);
+ if (((3 !== f && 4 !== f) || (e.status = 666), 1 === f || 3 === f))
+ return 0 === a.avail_out && (e.last_flush = -1), pa;
+ if (
+ 2 === f &&
+ (b === Fa
+ ? eb(e)
+ : b !== Ca &&
+ (Ka(e, 0, 0, !1),
+ b === La && (Sa(e.head), 0 === e.lookahead && ((e.strstart = 0), (e.block_start = 0), (e.insert = 0)))),
+ Ma(a),
+ 0 === a.avail_out)
+ )
+ return (e.last_flush = -1), pa;
+ }
+ return b !== la
+ ? pa
+ : 0 >= e.wrap
+ ? Ja
+ : (2 === e.wrap
+ ? (S(e, 255 & a.adler),
+ S(e, (a.adler >> 8) & 255),
+ S(e, (a.adler >> 16) & 255),
+ S(e, (a.adler >> 24) & 255),
+ S(e, 255 & a.total_in),
+ S(e, (a.total_in >> 8) & 255),
+ S(e, (a.total_in >> 16) & 255),
+ S(e, (a.total_in >> 24) & 255))
+ : (ma(e, a.adler >>> 16), ma(e, 65535 & a.adler)),
+ Ma(a),
+ 0 < e.wrap && (e.wrap = -e.wrap),
+ 0 !== e.pending ? pa : Ja);
+ },
+ deflateEnd: function (a) {
+ if (!a || !a.state) return ba;
+ var b = a.state.status;
+ return 42 !== b && 69 !== b && 73 !== b && 91 !== b && 103 !== b && 113 !== b && 666 !== b
+ ? Ra(a, ba)
+ : ((a.state = null), 113 === b ? Ra(a, E) : pa);
+ },
+ deflateSetDictionary: function (a, b) {
+ var c = b.length;
+ if (!a || !a.state) return ba;
+ var d = a.state,
+ e = d.wrap;
+ if (2 === e || (1 === e && 42 !== d.status) || d.lookahead) return ba;
+ if ((1 === e && (a.adler = ua(a.adler, b, c, 0)), (d.wrap = 0), c >= d.w_size)) {
+ 0 === e && (Sa(d.head), (d.strstart = 0), (d.block_start = 0), (d.insert = 0));
+ var f = new Uint8Array(d.w_size);
+ f.set(b.subarray(c - d.w_size, c), 0);
+ b = f;
+ c = d.w_size;
+ }
+ var f = a.avail_in,
+ g = a.next_in,
+ q = a.input;
+ a.avail_in = c;
+ a.next_in = 0;
+ a.input = b;
+ for (ra(d); 3 <= d.lookahead; ) {
+ var c = d.strstart,
+ k = d.lookahead - 2;
+ do
+ (d.ins_h = ya(d, d.ins_h, d.window[c + 3 - 1])),
+ (d.prev[c & d.w_mask] = d.head[d.ins_h]),
+ (d.head[d.ins_h] = c),
+ c++;
+ while (--k);
+ d.strstart = c;
+ d.lookahead = 2;
+ ra(d);
+ }
+ return (
+ (d.strstart += d.lookahead),
+ (d.block_start = d.strstart),
+ (d.insert = d.lookahead),
+ (d.lookahead = 0),
+ (d.match_length = d.prev_length = 2),
+ (d.match_available = 0),
+ (a.next_in = g),
+ (a.input = q),
+ (a.avail_in = f),
+ (d.wrap = e),
+ pa
+ );
+ },
+ deflateInfo: 'pako deflate (from Nodeca project)',
+ },
+ jb = function (a) {
+ for (var b = Array.prototype.slice.call(arguments, 1); b.length; ) {
+ var c = b.shift();
+ if (c) {
+ if ('object' !== g(c)) throw new TypeError(c + 'must be non-object');
+ for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d]);
+ }
+ }
+ return a;
+ },
+ ga = function (a) {
+ for (var b = 0, c = 0, d = a.length; c < d; c++) b += a[c].length;
+ for (var b = new Uint8Array(b), d = (c = 0), e = a.length; c < e; c++) {
+ var f = a[c];
+ b.set(f, d);
+ d += f.length;
+ }
+ return b;
+ },
+ kb = !0;
+ try {
+ String.fromCharCode.apply(null, new Uint8Array(1));
+ } catch (Nb) {
+ kb = !1;
+ }
+ for (var aa = new Uint8Array(256), Ha = 0; 256 > Ha; Ha++)
+ aa[Ha] = 252 <= Ha ? 6 : 248 <= Ha ? 5 : 240 <= Ha ? 4 : 224 <= Ha ? 3 : 192 <= Ha ? 2 : 1;
+ aa[254] = aa[254] = 1;
+ var ca = function (a) {
+ var b,
+ c,
+ d,
+ e,
+ f,
+ g = a.length,
+ q = 0;
+ for (e = 0; e < g; e++)
+ 55296 == (64512 & (c = a.charCodeAt(e))) &&
+ e + 1 < g &&
+ 56320 == (64512 & (d = a.charCodeAt(e + 1))) &&
+ ((c = 65536 + ((c - 55296) << 10) + (d - 56320)), e++),
+ (q += 128 > c ? 1 : 2048 > c ? 2 : 65536 > c ? 3 : 4);
+ b = new Uint8Array(q);
+ for (e = f = 0; f < q; e++)
+ 55296 == (64512 & (c = a.charCodeAt(e))) &&
+ e + 1 < g &&
+ 56320 == (64512 & (d = a.charCodeAt(e + 1))) &&
+ ((c = 65536 + ((c - 55296) << 10) + (d - 56320)), e++),
+ 128 > c
+ ? (b[f++] = c)
+ : 2048 > c
+ ? ((b[f++] = 192 | (c >>> 6)), (b[f++] = 128 | (63 & c)))
+ : 65536 > c
+ ? ((b[f++] = 224 | (c >>> 12)), (b[f++] = 128 | ((c >>> 6) & 63)), (b[f++] = 128 | (63 & c)))
+ : ((b[f++] = 240 | (c >>> 18)),
+ (b[f++] = 128 | ((c >>> 12) & 63)),
+ (b[f++] = 128 | ((c >>> 6) & 63)),
+ (b[f++] = 128 | (63 & c)));
+ return b;
+ },
+ Ua = function () {
+ this.input = null;
+ this.total_in = this.avail_in = this.next_in = 0;
+ this.output = null;
+ this.total_out = this.avail_out = this.next_out = 0;
+ this.msg = '';
+ this.state = null;
+ this.data_type = 2;
+ this.adler = 0;
+ },
+ Ya = Object.prototype.toString,
+ pb = L.Z_NO_FLUSH,
+ Za = L.Z_SYNC_FLUSH,
+ Ia = L.Z_FULL_FLUSH,
+ W = L.Z_FINISH,
+ va = L.Z_OK,
+ qb = L.Z_STREAM_END,
+ bb = L.Z_DEFAULT_COMPRESSION,
+ Na = L.Z_DEFAULT_STRATEGY,
+ fb = L.Z_DEFLATED;
+ k.prototype.push = function (a, b) {
+ var c,
+ d,
+ e = this.strm,
+ f = this.options.chunkSize;
+ if (this.ended) return !1;
+ d = b === ~~b ? b : !0 === b ? W : pb;
+ 'string' == typeof a
+ ? (e.input = ca(a))
+ : '[object ArrayBuffer]' === Ya.call(a)
+ ? (e.input = new Uint8Array(a))
+ : (e.input = a);
+ e.next_in = 0;
+ for (e.avail_in = e.input.length; ; )
+ if (
+ (0 === e.avail_out && ((e.output = new Uint8Array(f)), (e.next_out = 0), (e.avail_out = f)),
+ (d === Za || d === Ia) && 6 >= e.avail_out)
+ )
+ this.onData(e.output.subarray(0, e.next_out)), (e.avail_out = 0);
+ else {
+ if ((c = Ba.deflate(e, d)) === qb)
+ return (
+ 0 < e.next_out && this.onData(e.output.subarray(0, e.next_out)),
+ (c = Ba.deflateEnd(this.strm)),
+ this.onEnd(c),
+ (this.ended = !0),
+ c === va
+ );
+ if (0 !== e.avail_out)
+ if (0 < d && 0 < e.next_out) this.onData(e.output.subarray(0, e.next_out)), (e.avail_out = 0);
+ else {
+ if (0 === e.avail_in) break;
+ }
+ else this.onData(e.output);
+ }
+ return !0;
+ };
+ k.prototype.onData = function (a) {
+ this.chunks.push(a);
+ };
+ k.prototype.onEnd = function (a) {
+ a === va && (this.result = ga(this.chunks));
+ this.chunks = [];
+ this.err = a;
+ this.msg = this.strm.msg;
+ };
+ var gb = new Uint16Array([
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258,
+ 0, 0,
+ ]),
+ ub = new Uint8Array([
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21,
+ 16, 72, 78,
+ ]),
+ q = new Uint16Array([
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577, 0, 0,
+ ]),
+ w = new Uint8Array([
+ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28,
+ 29, 29, 64, 64,
+ ]),
+ y = function (a, b, c, d, e, f, g, k) {
+ var h,
+ A,
+ G,
+ y,
+ l,
+ H,
+ m,
+ oa,
+ E = k.bits,
+ n,
+ ka,
+ I,
+ F,
+ p,
+ N,
+ r = 0,
+ xa,
+ V = null,
+ t = 0,
+ hb = new Uint16Array(16);
+ y = new Uint16Array(16);
+ var Q = null,
+ lb = 0;
+ for (n = 0; 15 >= n; n++) hb[n] = 0;
+ for (ka = 0; ka < d; ka++) hb[b[c + ka]]++;
+ F = E;
+ for (I = 15; 1 <= I && 0 === hb[I]; I--);
+ if ((F > I && (F = I), 0 === I)) return (e[f++] = 20971520), (e[f++] = 20971520), (k.bits = 1), 0;
+ for (E = 1; E < I && 0 === hb[E]; E++);
+ F < E && (F = E);
+ for (n = h = 1; 15 >= n; n++) if (((h <<= 1), 0 > (h -= hb[n]))) return -1;
+ if (0 < h && (0 === a || 1 !== I)) return -1;
+ y[1] = 0;
+ for (n = 1; 15 > n; n++) y[n + 1] = y[n] + hb[n];
+ for (ka = 0; ka < d; ka++) 0 !== b[c + ka] && (g[y[b[c + ka]]++] = ka);
+ if (
+ (0 === a
+ ? ((V = Q = g), (l = 19))
+ : 1 === a
+ ? ((V = gb), (t -= 257), (Q = ub), (lb -= 257), (l = 256))
+ : ((V = q), (Q = w), (l = -1)),
+ (xa = 0),
+ (ka = 0),
+ (n = E),
+ (y = f),
+ (p = F),
+ (N = 0),
+ (G = -1),
+ (d = (r = 1 << F) - 1),
+ (1 === a && 852 < r) || (2 === a && 592 < r))
+ )
+ return 1;
+ for (;;) {
+ H = n - N;
+ g[ka] < l
+ ? ((m = 0), (oa = g[ka]))
+ : g[ka] > l
+ ? ((m = Q[lb + g[ka]]), (oa = V[t + g[ka]]))
+ : ((m = 96), (oa = 0));
+ h = 1 << (n - N);
+ E = A = 1 << p;
+ do e[y + (xa >> N) + (A -= h)] = (H << 24) | (m << 16) | oa | 0;
+ while (0 !== A);
+ for (h = 1 << (n - 1); xa & h; ) h >>= 1;
+ if ((0 !== h ? ((xa &= h - 1), (xa += h)) : (xa = 0), ka++, 0 == --hb[n])) {
+ if (n === I) break;
+ n = b[c + g[ka]];
+ }
+ if (n > F && (xa & d) !== G) {
+ 0 === N && (N = F);
+ y += E;
+ for (h = 1 << (p = n - N); p + N < I && !(0 >= (h -= hb[p + N])); ) p++, (h <<= 1);
+ if (((r += 1 << p), (1 === a && 852 < r) || (2 === a && 592 < r))) return 1;
+ e[(G = xa & d)] = (F << 24) | (p << 16) | (y - f) | 0;
+ }
+ }
+ return 0 !== xa && (e[y + xa] = ((n - N) << 24) | 4194304), (k.bits = F), 0;
+ },
+ A = L.Z_FINISH,
+ G = L.Z_BLOCK,
+ H = L.Z_TREES,
+ oa = L.Z_OK,
+ xa = L.Z_STREAM_END,
+ ka = L.Z_NEED_DICT,
+ wa = L.Z_STREAM_ERROR,
+ lb = L.Z_DATA_ERROR,
+ Db = L.Z_MEM_ERROR,
+ mb = L.Z_BUF_ERROR,
+ Eb = L.Z_DEFLATED,
+ yb = function (a) {
+ return ((a >>> 24) & 255) + ((a >>> 8) & 65280) + ((65280 & a) << 8) + ((255 & a) << 24);
+ },
+ rb,
+ vb,
+ na = function (a) {
+ if (!a || !a.state) return wa;
+ var b = a.state;
+ return (
+ (a.total_in = a.total_out = b.total = 0),
+ (a.msg = ''),
+ b.wrap && (a.adler = 1 & b.wrap),
+ (b.mode = 1),
+ (b.last = 0),
+ (b.havedict = 0),
+ (b.dmax = 32768),
+ (b.head = null),
+ (b.hold = 0),
+ (b.bits = 0),
+ (b.lencode = b.lendyn = new Int32Array(852)),
+ (b.distcode = b.distdyn = new Int32Array(592)),
+ (b.sane = 1),
+ (b.back = -1),
+ oa
+ );
+ },
+ sb = function (a) {
+ if (!a || !a.state) return wa;
+ var b = a.state;
+ return (b.wsize = 0), (b.whave = 0), (b.wnext = 0), na(a);
+ },
+ wb = function (a, b) {
+ var c;
+ if (!a || !a.state) return wa;
+ var d = a.state;
+ return (
+ 0 > b ? ((c = 0), (b = -b)) : ((c = 1 + (b >> 4)), 48 > b && (b &= 15)),
+ b && (8 > b || 15 < b)
+ ? wa
+ : (null !== d.window && d.wbits !== b && (d.window = null), (d.wrap = c), (d.wbits = b), sb(a))
+ );
+ },
+ Fb = function (a, b) {
+ if (!a) return wa;
+ var c = new l();
+ a.state = c;
+ c.window = null;
+ c = wb(a, b);
+ return c !== oa && (a.state = null), c;
+ },
+ cb = !0,
+ Bb = function (a, b, c, d) {
+ var e;
+ a = a.state;
+ return (
+ null === a.window &&
+ ((a.wsize = 1 << a.wbits), (a.wnext = 0), (a.whave = 0), (a.window = new Uint8Array(a.wsize))),
+ d >= a.wsize
+ ? (a.window.set(b.subarray(c - a.wsize, c), 0), (a.wnext = 0), (a.whave = a.wsize))
+ : ((e = a.wsize - a.wnext) > d && (e = d),
+ a.window.set(b.subarray(c - d, c - d + e), a.wnext),
+ (d -= e)
+ ? (a.window.set(b.subarray(c - d, c), 0), (a.wnext = d), (a.whave = a.wsize))
+ : ((a.wnext += e), a.wnext === a.wsize && (a.wnext = 0), a.whave < a.wsize && (a.whave += e))),
+ 0
+ );
+ },
+ Va = {
+ inflateReset: sb,
+ inflateReset2: wb,
+ inflateResetKeep: na,
+ inflateInit: function (a) {
+ return Fb(a, 15);
+ },
+ inflateInit2: Fb,
+ inflate: function (a, b) {
+ var c,
+ d,
+ e,
+ f,
+ g,
+ q,
+ k,
+ h,
+ w,
+ l,
+ m,
+ E,
+ n,
+ I,
+ F,
+ p,
+ N,
+ r,
+ V,
+ t,
+ Q,
+ u,
+ v = 0,
+ X = new Uint8Array(4),
+ x = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
+ if (!a || !a.state || !a.output || (!a.input && 0 !== a.avail_in)) return wa;
+ 12 === (c = a.state).mode && (c.mode = 13);
+ g = a.next_out;
+ e = a.output;
+ k = a.avail_out;
+ f = a.next_in;
+ d = a.input;
+ q = a.avail_in;
+ h = c.hold;
+ w = c.bits;
+ l = q;
+ m = k;
+ Q = oa;
+ a: for (;;)
+ switch (c.mode) {
+ case 1:
+ if (0 === c.wrap) {
+ c.mode = 13;
+ break;
+ }
+ for (; 16 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (2 & c.wrap && 35615 === h) {
+ c.check = 0;
+ X[0] = 255 & h;
+ X[1] = (h >>> 8) & 255;
+ c.check = Z(c.check, X, 2, 0);
+ w = h = 0;
+ c.mode = 2;
+ break;
+ }
+ if (((c.flags = 0), c.head && (c.head.done = !1), !(1 & c.wrap) || (((255 & h) << 8) + (h >> 8)) % 31)) {
+ a.msg = 'incorrect header check';
+ c.mode = 30;
+ break;
+ }
+ if ((15 & h) !== Eb) {
+ a.msg = 'unknown compression method';
+ c.mode = 30;
+ break;
+ }
+ if (((w -= 4), (t = 8 + (15 & (h >>>= 4))), 0 === c.wbits)) c.wbits = t;
+ else if (t > c.wbits) {
+ a.msg = 'invalid window size';
+ c.mode = 30;
+ break;
+ }
+ c.dmax = 1 << c.wbits;
+ a.adler = c.check = 1;
+ c.mode = 512 & h ? 10 : 12;
+ w = h = 0;
+ break;
+ case 2:
+ for (; 16 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (((c.flags = h), (255 & c.flags) !== Eb)) {
+ a.msg = 'unknown compression method';
+ c.mode = 30;
+ break;
+ }
+ if (57344 & c.flags) {
+ a.msg = 'unknown header flags set';
+ c.mode = 30;
+ break;
+ }
+ c.head && (c.head.text = (h >> 8) & 1);
+ 512 & c.flags && ((X[0] = 255 & h), (X[1] = (h >>> 8) & 255), (c.check = Z(c.check, X, 2, 0)));
+ w = h = 0;
+ c.mode = 3;
+ case 3:
+ for (; 32 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.head && (c.head.time = h);
+ 512 & c.flags &&
+ ((X[0] = 255 & h),
+ (X[1] = (h >>> 8) & 255),
+ (X[2] = (h >>> 16) & 255),
+ (X[3] = (h >>> 24) & 255),
+ (c.check = Z(c.check, X, 4, 0)));
+ w = h = 0;
+ c.mode = 4;
+ case 4:
+ for (; 16 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.head && ((c.head.xflags = 255 & h), (c.head.os = h >> 8));
+ 512 & c.flags && ((X[0] = 255 & h), (X[1] = (h >>> 8) & 255), (c.check = Z(c.check, X, 2, 0)));
+ w = h = 0;
+ c.mode = 5;
+ case 5:
+ if (1024 & c.flags) {
+ for (; 16 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.length = h;
+ c.head && (c.head.extra_len = h);
+ 512 & c.flags && ((X[0] = 255 & h), (X[1] = (h >>> 8) & 255), (c.check = Z(c.check, X, 2, 0)));
+ w = h = 0;
+ } else c.head && (c.head.extra = null);
+ c.mode = 6;
+ case 6:
+ if (
+ 1024 & c.flags &&
+ ((E = c.length) > q && (E = q),
+ E &&
+ (c.head &&
+ ((t = c.head.extra_len - c.length),
+ c.head.extra || (c.head.extra = new Uint8Array(c.head.extra_len)),
+ c.head.extra.set(d.subarray(f, f + E), t)),
+ 512 & c.flags && (c.check = Z(c.check, d, E, f)),
+ (q -= E),
+ (f += E),
+ (c.length -= E)),
+ c.length)
+ )
+ break a;
+ c.length = 0;
+ c.mode = 7;
+ case 7:
+ if (2048 & c.flags) {
+ if (0 === q) break a;
+ E = 0;
+ do (t = d[f + E++]), c.head && t && 65536 > c.length && (c.head.name += String.fromCharCode(t));
+ while (t && E < q);
+ if ((512 & c.flags && (c.check = Z(c.check, d, E, f)), (q -= E), (f += E), t)) break a;
+ } else c.head && (c.head.name = null);
+ c.length = 0;
+ c.mode = 8;
+ case 8:
+ if (4096 & c.flags) {
+ if (0 === q) break a;
+ E = 0;
+ do (t = d[f + E++]), c.head && t && 65536 > c.length && (c.head.comment += String.fromCharCode(t));
+ while (t && E < q);
+ if ((512 & c.flags && (c.check = Z(c.check, d, E, f)), (q -= E), (f += E), t)) break a;
+ } else c.head && (c.head.comment = null);
+ c.mode = 9;
+ case 9:
+ if (512 & c.flags) {
+ for (; 16 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (h !== (65535 & c.check)) {
+ a.msg = 'header crc mismatch';
+ c.mode = 30;
+ break;
+ }
+ w = h = 0;
+ }
+ c.head && ((c.head.hcrc = (c.flags >> 9) & 1), (c.head.done = !0));
+ a.adler = c.check = 0;
+ c.mode = 12;
+ break;
+ case 10:
+ for (; 32 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ a.adler = c.check = yb(h);
+ w = h = 0;
+ c.mode = 11;
+ case 11:
+ if (0 === c.havedict)
+ return (
+ (a.next_out = g), (a.avail_out = k), (a.next_in = f), (a.avail_in = q), (c.hold = h), (c.bits = w), ka
+ );
+ a.adler = c.check = 1;
+ c.mode = 12;
+ case 12:
+ if (b === G || b === H) break a;
+ case 13:
+ if (c.last) {
+ h >>>= 7 & w;
+ w -= 7 & w;
+ c.mode = 27;
+ break;
+ }
+ for (; 3 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ switch (((c.last = 1 & h), --w, 3 & (h >>>= 1))) {
+ case 0:
+ c.mode = 14;
+ break;
+ case 1:
+ I = c;
+ if (cb) {
+ rb = new Int32Array(512);
+ vb = new Int32Array(32);
+ for (F = 0; 144 > F; ) I.lens[F++] = 8;
+ for (; 256 > F; ) I.lens[F++] = 9;
+ for (; 280 > F; ) I.lens[F++] = 7;
+ for (; 288 > F; ) I.lens[F++] = 8;
+ y(1, I.lens, 0, 288, rb, 0, I.work, { bits: 9 });
+ for (F = 0; 32 > F; ) I.lens[F++] = 5;
+ y(2, I.lens, 0, 32, vb, 0, I.work, { bits: 5 });
+ cb = !1;
+ }
+ I.lencode = rb;
+ I.lenbits = 9;
+ I.distcode = vb;
+ I.distbits = 5;
+ if (((c.mode = 20), b === H)) {
+ h >>>= 2;
+ w -= 2;
+ break a;
+ }
+ break;
+ case 2:
+ c.mode = 17;
+ break;
+ case 3:
+ (a.msg = 'invalid block type'), (c.mode = 30);
+ }
+ h >>>= 2;
+ w -= 2;
+ break;
+ case 14:
+ h >>>= 7 & w;
+ for (w -= 7 & w; 32 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if ((65535 & h) != ((h >>> 16) ^ 65535)) {
+ a.msg = 'invalid stored block lengths';
+ c.mode = 30;
+ break;
+ }
+ if (((c.length = 65535 & h), (h = 0), (w = 0), (c.mode = 15), b === H)) break a;
+ case 15:
+ c.mode = 16;
+ case 16:
+ if ((E = c.length)) {
+ if ((E > q && (E = q), E > k && (E = k), 0 === E)) break a;
+ e.set(d.subarray(f, f + E), g);
+ q -= E;
+ f += E;
+ k -= E;
+ g += E;
+ c.length -= E;
+ break;
+ }
+ c.mode = 12;
+ break;
+ case 17:
+ for (; 14 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (
+ ((c.nlen = 257 + (31 & h)),
+ (h >>>= 5),
+ (w -= 5),
+ (c.ndist = 1 + (31 & h)),
+ (h >>>= 5),
+ (w -= 5),
+ (c.ncode = 4 + (15 & h)),
+ (h >>>= 4),
+ (w -= 4),
+ 286 < c.nlen || 30 < c.ndist)
+ ) {
+ a.msg = 'too many length or distance symbols';
+ c.mode = 30;
+ break;
+ }
+ c.have = 0;
+ c.mode = 18;
+ case 18:
+ for (; c.have < c.ncode; ) {
+ for (; 3 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.lens[x[c.have++]] = 7 & h;
+ h >>>= 3;
+ w -= 3;
+ }
+ for (; 19 > c.have; ) c.lens[x[c.have++]] = 0;
+ if (
+ ((c.lencode = c.lendyn),
+ (c.lenbits = 7),
+ (u = { bits: c.lenbits }),
+ (Q = y(0, c.lens, 0, 19, c.lencode, 0, c.work, u)),
+ (c.lenbits = u.bits),
+ Q)
+ ) {
+ a.msg = 'invalid code lengths set';
+ c.mode = 30;
+ break;
+ }
+ c.have = 0;
+ c.mode = 19;
+ case 19:
+ for (; c.have < c.nlen + c.ndist; ) {
+ for (; (v = c.lencode[h & ((1 << c.lenbits) - 1)]), (p = 65535 & v), !((I = v >>> 24) <= w); ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (16 > p) (h >>>= I), (w -= I), (c.lens[c.have++] = p);
+ else {
+ if (16 === p) {
+ for (F = I + 2; w < F; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (((h >>>= I), (w -= I), 0 === c.have)) {
+ a.msg = 'invalid bit length repeat';
+ c.mode = 30;
+ break;
+ }
+ t = c.lens[c.have - 1];
+ E = 3 + (3 & h);
+ h >>>= 2;
+ w -= 2;
+ } else if (17 === p) {
+ for (F = I + 3; w < F; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ w -= I;
+ t = 0;
+ E = 3 + (7 & (h >>>= I));
+ h >>>= 3;
+ w -= 3;
+ } else {
+ for (F = I + 7; w < F; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ w -= I;
+ t = 0;
+ E = 11 + (127 & (h >>>= I));
+ h >>>= 7;
+ w -= 7;
+ }
+ if (c.have + E > c.nlen + c.ndist) {
+ a.msg = 'invalid bit length repeat';
+ c.mode = 30;
+ break;
+ }
+ for (; E--; ) c.lens[c.have++] = t;
+ }
+ }
+ if (30 === c.mode) break;
+ if (0 === c.lens[256]) {
+ a.msg = 'invalid code -- missing end-of-block';
+ c.mode = 30;
+ break;
+ }
+ if (
+ ((c.lenbits = 9),
+ (u = { bits: c.lenbits }),
+ (Q = y(1, c.lens, 0, c.nlen, c.lencode, 0, c.work, u)),
+ (c.lenbits = u.bits),
+ Q)
+ ) {
+ a.msg = 'invalid literal/lengths set';
+ c.mode = 30;
+ break;
+ }
+ if (
+ ((c.distbits = 6),
+ (c.distcode = c.distdyn),
+ (u = { bits: c.distbits }),
+ (Q = y(2, c.lens, c.nlen, c.ndist, c.distcode, 0, c.work, u)),
+ (c.distbits = u.bits),
+ Q)
+ ) {
+ a.msg = 'invalid distances set';
+ c.mode = 30;
+ break;
+ }
+ if (((c.mode = 20), b === H)) break a;
+ case 20:
+ c.mode = 21;
+ case 21:
+ if (6 <= q && 258 <= k) {
+ a.next_out = g;
+ a.avail_out = k;
+ a.next_in = f;
+ a.avail_in = q;
+ c.hold = h;
+ c.bits = w;
+ var C, z;
+ q = f = void 0;
+ var B,
+ Y,
+ Qa,
+ da,
+ P,
+ Ga,
+ na,
+ ja = a,
+ D = ja.state;
+ na = ja.next_in;
+ e = ja.input;
+ Ga = na + (ja.avail_in - 5);
+ P = ja.next_out;
+ d = ja.output;
+ da = P - (m - ja.avail_out);
+ Qa = P + (ja.avail_out - 257);
+ Y = D.dmax;
+ B = D.wsize;
+ V = D.whave;
+ r = D.wnext;
+ N = D.window;
+ p = D.hold;
+ F = D.bits;
+ I = D.lencode;
+ w = D.distcode;
+ h = (1 << D.lenbits) - 1;
+ k = (1 << D.distbits) - 1;
+ b: do
+ c: for (15 > F && ((p += e[na++] << F), (F += 8), (p += e[na++] << F), (F += 8)), C = I[p & h]; ; ) {
+ if (((p >>>= q = C >>> 24), (F -= q), 0 === (q = (C >>> 16) & 255))) d[P++] = 65535 & C;
+ else {
+ if (!(16 & q)) {
+ if (0 == (64 & q)) {
+ C = I[(65535 & C) + (p & ((1 << q) - 1))];
+ continue c;
+ }
+ if (32 & q) {
+ D.mode = 12;
+ break b;
+ }
+ ja.msg = 'invalid literal/length code';
+ D.mode = 30;
+ break b;
+ }
+ g = 65535 & C;
+ (q &= 15) &&
+ (F < q && ((p += e[na++] << F), (F += 8)), (g += p & ((1 << q) - 1)), (p >>>= q), (F -= q));
+ 15 > F && ((p += e[na++] << F), (F += 8), (p += e[na++] << F), (F += 8));
+ C = w[p & k];
+ d: for (;;) {
+ if (((p >>>= q = C >>> 24), (F -= q), !(16 & (q = (C >>> 16) & 255)))) {
+ if (0 == (64 & q)) {
+ C = w[(65535 & C) + (p & ((1 << q) - 1))];
+ continue d;
+ }
+ ja.msg = 'invalid distance code';
+ D.mode = 30;
+ break b;
+ }
+ if (
+ ((f = 65535 & C),
+ F < (q &= 15) && ((p += e[na++] << F), (F += 8) < q && ((p += e[na++] << F), (F += 8))),
+ (f += p & ((1 << q) - 1)) > Y)
+ ) {
+ ja.msg = 'invalid distance too far back';
+ D.mode = 30;
+ break b;
+ }
+ if (((p >>>= q), (F -= q), f > (q = P - da))) {
+ if ((q = f - q) > V && D.sane) {
+ ja.msg = 'invalid distance too far back';
+ D.mode = 30;
+ break b;
+ }
+ if (((z = 0), (C = N), 0 === r)) {
+ if (((z += B - q), q < g)) {
+ g -= q;
+ do d[P++] = N[z++];
+ while (--q);
+ z = P - f;
+ C = d;
+ }
+ } else if (r < q) {
+ if (((z += B + r - q), (q -= r) < g)) {
+ g -= q;
+ do d[P++] = N[z++];
+ while (--q);
+ if (((z = 0), r < g)) {
+ g -= q = r;
+ do d[P++] = N[z++];
+ while (--q);
+ z = P - f;
+ C = d;
+ }
+ }
+ } else if (((z += r - q), q < g)) {
+ g -= q;
+ do d[P++] = N[z++];
+ while (--q);
+ z = P - f;
+ C = d;
+ }
+ for (; 2 < g; ) (d[P++] = C[z++]), (d[P++] = C[z++]), (d[P++] = C[z++]), (g -= 3);
+ g && ((d[P++] = C[z++]), 1 < g && (d[P++] = C[z++]));
+ } else {
+ z = P - f;
+ do (d[P++] = d[z++]), (d[P++] = d[z++]), (d[P++] = d[z++]), (g -= 3);
+ while (2 < g);
+ g && ((d[P++] = d[z++]), 1 < g && (d[P++] = d[z++]));
+ }
+ break;
+ }
+ }
+ break;
+ }
+ while (na < Ga && P < Qa);
+ na -= g = F >> 3;
+ p &= (1 << (F -= g << 3)) - 1;
+ ja.next_in = na;
+ ja.next_out = P;
+ ja.avail_in = na < Ga ? Ga - na + 5 : 5 - (na - Ga);
+ ja.avail_out = P < Qa ? Qa - P + 257 : 257 - (P - Qa);
+ D.hold = p;
+ D.bits = F;
+ g = a.next_out;
+ e = a.output;
+ k = a.avail_out;
+ f = a.next_in;
+ d = a.input;
+ q = a.avail_in;
+ h = c.hold;
+ w = c.bits;
+ 12 === c.mode && (c.back = -1);
+ break;
+ }
+ for (
+ c.back = 0;
+ (F = ((v = c.lencode[h & ((1 << c.lenbits) - 1)]) >>> 16) & 255),
+ (p = 65535 & v),
+ !((I = v >>> 24) <= w);
+
+ ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (F && 0 == (240 & F)) {
+ N = I;
+ r = F;
+ for (
+ V = p;
+ (F = ((v = c.lencode[V + ((h & ((1 << (N + r)) - 1)) >> N)]) >>> 16) & 255),
+ (p = 65535 & v),
+ !(N + (I = v >>> 24) <= w);
+
+ ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ h >>>= N;
+ w -= N;
+ c.back += N;
+ }
+ if (((h >>>= I), (w -= I), (c.back += I), (c.length = p), 0 === F)) {
+ c.mode = 26;
+ break;
+ }
+ if (32 & F) {
+ c.back = -1;
+ c.mode = 12;
+ break;
+ }
+ if (64 & F) {
+ a.msg = 'invalid literal/length code';
+ c.mode = 30;
+ break;
+ }
+ c.extra = 15 & F;
+ c.mode = 22;
+ case 22:
+ if (c.extra) {
+ for (F = c.extra; w < F; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.length += h & ((1 << c.extra) - 1);
+ h >>>= c.extra;
+ w -= c.extra;
+ c.back += c.extra;
+ }
+ c.was = c.length;
+ c.mode = 23;
+ case 23:
+ for (
+ ;
+ (F = ((v = c.distcode[h & ((1 << c.distbits) - 1)]) >>> 16) & 255),
+ (p = 65535 & v),
+ !((I = v >>> 24) <= w);
+
+ ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (0 == (240 & F)) {
+ N = I;
+ r = F;
+ for (
+ V = p;
+ (F = ((v = c.distcode[V + ((h & ((1 << (N + r)) - 1)) >> N)]) >>> 16) & 255),
+ (p = 65535 & v),
+ !(N + (I = v >>> 24) <= w);
+
+ ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ h >>>= N;
+ w -= N;
+ c.back += N;
+ }
+ if (((h >>>= I), (w -= I), (c.back += I), 64 & F)) {
+ a.msg = 'invalid distance code';
+ c.mode = 30;
+ break;
+ }
+ c.offset = p;
+ c.extra = 15 & F;
+ c.mode = 24;
+ case 24:
+ if (c.extra) {
+ for (F = c.extra; w < F; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ c.offset += h & ((1 << c.extra) - 1);
+ h >>>= c.extra;
+ w -= c.extra;
+ c.back += c.extra;
+ }
+ if (c.offset > c.dmax) {
+ a.msg = 'invalid distance too far back';
+ c.mode = 30;
+ break;
+ }
+ c.mode = 25;
+ case 25:
+ if (0 === k) break a;
+ if (((E = m - k), c.offset > E)) {
+ if ((E = c.offset - E) > c.whave && c.sane) {
+ a.msg = 'invalid distance too far back';
+ c.mode = 30;
+ break;
+ }
+ E > c.wnext ? ((E -= c.wnext), (n = c.wsize - E)) : (n = c.wnext - E);
+ E > c.length && (E = c.length);
+ I = c.window;
+ } else (I = e), (n = g - c.offset), (E = c.length);
+ E > k && (E = k);
+ k -= E;
+ c.length -= E;
+ do e[g++] = I[n++];
+ while (--E);
+ 0 === c.length && (c.mode = 21);
+ break;
+ case 26:
+ if (0 === k) break a;
+ e[g++] = c.length;
+ k--;
+ c.mode = 21;
+ break;
+ case 27:
+ if (c.wrap) {
+ for (; 32 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h |= d[f++] << w;
+ w += 8;
+ }
+ if (
+ ((m -= k),
+ (a.total_out += m),
+ (c.total += m),
+ m && (a.adler = c.check = c.flags ? Z(c.check, e, m, g - m) : ua(c.check, e, m, g - m)),
+ (m = k),
+ (c.flags ? h : yb(h)) !== c.check)
+ ) {
+ a.msg = 'incorrect data check';
+ c.mode = 30;
+ break;
+ }
+ w = h = 0;
+ }
+ c.mode = 28;
+ case 28:
+ if (c.wrap && c.flags) {
+ for (; 32 > w; ) {
+ if (0 === q) break a;
+ q--;
+ h += d[f++] << w;
+ w += 8;
+ }
+ if (h !== (4294967295 & c.total)) {
+ a.msg = 'incorrect length check';
+ c.mode = 30;
+ break;
+ }
+ w = h = 0;
+ }
+ c.mode = 29;
+ case 29:
+ Q = xa;
+ break a;
+ case 30:
+ Q = lb;
+ break a;
+ case 31:
+ return Db;
+ default:
+ return wa;
+ }
+ return (
+ (a.next_out = g),
+ (a.avail_out = k),
+ (a.next_in = f),
+ (a.avail_in = q),
+ (c.hold = h),
+ (c.bits = w),
+ (c.wsize || (m !== a.avail_out && 30 > c.mode && (27 > c.mode || b !== A))) &&
+ Bb(a, a.output, a.next_out, m - a.avail_out),
+ (l -= a.avail_in),
+ (m -= a.avail_out),
+ (a.total_in += l),
+ (a.total_out += m),
+ (c.total += m),
+ c.wrap &&
+ m &&
+ (a.adler = c.check = c.flags ? Z(c.check, e, m, a.next_out - m) : ua(c.check, e, m, a.next_out - m)),
+ (a.data_type =
+ c.bits + (c.last ? 64 : 0) + (12 === c.mode ? 128 : 0) + (20 === c.mode || 15 === c.mode ? 256 : 0)),
+ ((0 === l && 0 === m) || b === A) && Q === oa && (Q = mb),
+ Q
+ );
+ },
+ inflateEnd: function (a) {
+ if (!a || !a.state) return wa;
+ var b = a.state;
+ return b.window && (b.window = null), (a.state = null), oa;
+ },
+ inflateGetHeader: function (a, b) {
+ if (!a || !a.state) return wa;
+ var c = a.state;
+ return 0 == (2 & c.wrap) ? wa : ((c.head = b), (b.done = !1), oa);
+ },
+ inflateSetDictionary: function (a, b) {
+ var c,
+ d = b.length;
+ return a && a.state
+ ? 0 !== (c = a.state).wrap && 11 !== c.mode
+ ? wa
+ : 11 === c.mode && ua(1, b, d, 0) !== c.check
+ ? lb
+ : Bb(a, b, d, d)
+ ? ((c.mode = 31), Db)
+ : ((c.havedict = 1), oa)
+ : wa;
+ },
+ inflateInfo: 'pako inflate (from Nodeca project)',
+ },
+ Hb = function () {
+ this.os = this.xflags = this.time = this.text = 0;
+ this.extra = null;
+ this.extra_len = 0;
+ this.comment = this.name = '';
+ this.hcrc = 0;
+ this.done = !1;
+ },
+ nb = Object.prototype.toString,
+ $a = L.Z_NO_FLUSH,
+ Ib = L.Z_FINISH,
+ ob = L.Z_OK,
+ xb = L.Z_STREAM_END,
+ Cb = L.Z_NEED_DICT,
+ Jb = L.Z_STREAM_ERROR,
+ zb = L.Z_DATA_ERROR,
+ Ab = L.Z_MEM_ERROR;
+ m.prototype.push = function (a, b) {
+ var c,
+ d,
+ e,
+ f = this.strm,
+ g = this.options.chunkSize,
+ q = this.options.dictionary;
+ if (this.ended) return !1;
+ d = b === ~~b ? b : !0 === b ? Ib : $a;
+ '[object ArrayBuffer]' === nb.call(a) ? (f.input = new Uint8Array(a)) : (f.input = a);
+ f.next_in = 0;
+ for (f.avail_in = f.input.length; ; ) {
+ 0 === f.avail_out && ((f.output = new Uint8Array(g)), (f.next_out = 0), (f.avail_out = g));
+ for (
+ (c = Va.inflate(f, d)) === Cb &&
+ q &&
+ ((c = Va.inflateSetDictionary(f, q)) === ob ? (c = Va.inflate(f, d)) : c === zb && (c = Cb));
+ 0 < f.avail_in && c === xb && 0 < f.state.wrap && 0 !== a[f.next_in];
+
+ )
+ Va.inflateReset(f), (c = Va.inflate(f, d));
+ switch (c) {
+ case Jb:
+ case zb:
+ case Cb:
+ case Ab:
+ return this.onEnd(c), (this.ended = !0), !1;
+ }
+ if (((e = f.avail_out), f.next_out && (0 === f.avail_out || c === xb)))
+ if ('string' === this.options.to) {
+ var k;
+ k = f.output;
+ var h = f.next_out;
+ (h = h || k.length) > k.length && (h = k.length);
+ for (var w = h - 1; 0 <= w && 128 == (192 & k[w]); ) w--;
+ k = 0 > w || 0 === w ? h : w + aa[k[w]] > h ? w : h;
+ var h = f.next_out - k,
+ A,
+ G,
+ y = f.output,
+ l = k || y.length,
+ w = Array(2 * l);
+ for (G = A = 0; G < l; ) {
+ var H = y[G++];
+ if (128 > H) w[A++] = H;
+ else {
+ var m = aa[H];
+ if (4 < m) (w[A++] = 65533), (G += m - 1);
+ else {
+ for (H &= 2 === m ? 31 : 3 === m ? 15 : 7; 1 < m && G < l; ) (H = (H << 6) | (63 & y[G++])), m--;
+ 1 < m
+ ? (w[A++] = 65533)
+ : 65536 > H
+ ? (w[A++] = H)
+ : ((H -= 65536), (w[A++] = 55296 | ((H >> 10) & 1023)), (w[A++] = 56320 | (1023 & H)));
+ }
+ }
+ }
+ if (65534 > A && w.subarray && kb) w = String.fromCharCode.apply(null, w.length === A ? w : w.subarray(0, A));
+ else {
+ G = '';
+ for (y = 0; y < A; y++) G += String.fromCharCode(w[y]);
+ w = G;
+ }
+ f.next_out = h;
+ f.avail_out = g - h;
+ h && f.output.set(f.output.subarray(k, k + h), 0);
+ this.onData(w);
+ } else this.onData(f.output.length === f.next_out ? f.output : f.output.subarray(0, f.next_out));
+ if (c !== ob || 0 !== e) {
+ if (c === xb) return (c = Va.inflateEnd(this.strm)), this.onEnd(c), (this.ended = !0), !0;
+ if (0 === f.avail_in) break;
+ }
+ }
+ return !0;
+ };
+ m.prototype.onData = function (a) {
+ this.chunks.push(a);
+ };
+ m.prototype.onEnd = function (a) {
+ a === ob && ('string' === this.options.to ? (this.result = this.chunks.join('')) : (this.result = ga(this.chunks)));
+ this.chunks = [];
+ this.err = a;
+ this.msg = this.strm.msg;
+ };
+ var Kb = function (a, b) {
+ return ((b = b || {}).raw = !0), h(a, b);
+ },
+ Gb = function (a, b) {
+ return ((b = b || {}).gzip = !0), h(a, b);
+ },
+ Lb = function (a, b) {
+ return ((b = b || {}).raw = !0), n(a, b);
+ },
+ Mb = {
+ Deflate: k,
+ deflate: h,
+ deflateRaw: Kb,
+ gzip: Gb,
+ Inflate: m,
+ inflate: n,
+ inflateRaw: Lb,
+ ungzip: n,
+ constants: L,
+ };
+ a.Deflate = k;
+ a.Inflate = m;
+ a.constants = L;
+ a['default'] = Mb;
+ a.deflate = h;
+ a.deflateRaw = Kb;
+ a.gzip = Gb;
+ a.inflate = n;
+ a.inflateRaw = Lb;
+ a.ungzip = n;
+ Object.defineProperty(a, '__esModule', { value: !0 });
+});
+'undefined' === typeof window.mxBasePath &&
+ ((window.mxBasePath = 'https://viewer.diagrams.net/mxgraph/'),
+ (window.mxImageBasePath = 'https://viewer.diagrams.net/mxgraph/images'));
+window.mxLoadStylesheets = window.mxLoadStylesheets || !1;
+window.mxLoadResources = window.mxLoadResources || !1;
+window.mxLanguage = window.mxLanguage || 'en';
+window.urlParams = window.urlParams || {};
+window.MAX_REQUEST_SIZE = window.MAX_REQUEST_SIZE || 10485760;
+window.MAX_AREA = window.MAX_AREA || 225e6;
+window.EXPORT_URL = window.EXPORT_URL || '/export';
+window.SAVE_URL = window.SAVE_URL || '/save';
+window.OPEN_URL = window.OPEN_URL || '/open';
+window.RESOURCES_PATH = window.RESOURCES_PATH || 'resources';
+window.RESOURCE_BASE = window.RESOURCE_BASE || window.RESOURCES_PATH + '/grapheditor';
+window.STENCIL_PATH = window.STENCIL_PATH || 'stencils';
+window.IMAGE_PATH = window.IMAGE_PATH || 'images';
+window.STYLE_PATH = window.STYLE_PATH || 'styles';
+window.CSS_PATH = window.CSS_PATH || 'styles';
+window.OPEN_FORM = window.OPEN_FORM || 'open.html';
+window.mxBasePath = window.mxBasePath || 'mxgraph';
+window.mxImageBasePath = window.mxImageBasePath || 'mxgraph/images';
+window.mxLanguage = window.mxLanguage || urlParams.lang;
+window.mxLanguages = window.mxLanguages || ['de', 'se'];
+var mxClient = {
+ VERSION: '18.0.2',
+ IS_IE: null != navigator.userAgent && 0 <= navigator.userAgent.indexOf('MSIE'),
+ IS_IE11: null != navigator.userAgent && !!navigator.userAgent.match(/Trident\/7\./),
+ IS_EDGE: null != navigator.userAgent && !!navigator.userAgent.match(/Edge\//),
+ IS_EM: 'spellcheck' in document.createElement('textarea') && 8 == document.documentMode,
+ VML_PREFIX: 'v',
+ OFFICE_PREFIX: 'o',
+ IS_NS:
+ null != navigator.userAgent &&
+ 0 <= navigator.userAgent.indexOf('Mozilla/') &&
+ 0 > navigator.userAgent.indexOf('MSIE') &&
+ 0 > navigator.userAgent.indexOf('Edge/'),
+ IS_OP:
+ null != navigator.userAgent &&
+ (0 <= navigator.userAgent.indexOf('Opera/') || 0 <= navigator.userAgent.indexOf('OPR/')),
+ IS_OT:
+ null != navigator.userAgent &&
+ 0 <= navigator.userAgent.indexOf('Presto/') &&
+ 0 > navigator.userAgent.indexOf('Presto/2.4.') &&
+ 0 > navigator.userAgent.indexOf('Presto/2.3.') &&
+ 0 > navigator.userAgent.indexOf('Presto/2.2.') &&
+ 0 > navigator.userAgent.indexOf('Presto/2.1.') &&
+ 0 > navigator.userAgent.indexOf('Presto/2.0.') &&
+ 0 > navigator.userAgent.indexOf('Presto/1.'),
+ IS_SF: /Apple Computer, Inc/.test(navigator.vendor),
+ IS_ANDROID: 0 <= navigator.appVersion.indexOf('Android'),
+ IS_IOS:
+ /iP(hone|od|ad)/.test(navigator.platform) ||
+ (navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && 2 < navigator.maxTouchPoints),
+ IS_WEBVIEW: /((iPhone|iPod|iPad).*AppleWebKit(?!.*Version)|; wv)/i.test(navigator.userAgent),
+ IS_GC: /Google Inc/.test(navigator.vendor),
+ IS_CHROMEAPP: null != window.chrome && null != chrome.app && null != chrome.app.runtime,
+ IS_FF: 'undefined' !== typeof InstallTrigger,
+ IS_MT:
+ (0 <= navigator.userAgent.indexOf('Firefox/') &&
+ 0 > navigator.userAgent.indexOf('Firefox/1.') &&
+ 0 > navigator.userAgent.indexOf('Firefox/2.')) ||
+ (0 <= navigator.userAgent.indexOf('Iceweasel/') &&
+ 0 > navigator.userAgent.indexOf('Iceweasel/1.') &&
+ 0 > navigator.userAgent.indexOf('Iceweasel/2.')) ||
+ (0 <= navigator.userAgent.indexOf('SeaMonkey/') && 0 > navigator.userAgent.indexOf('SeaMonkey/1.')) ||
+ (0 <= navigator.userAgent.indexOf('Iceape/') && 0 > navigator.userAgent.indexOf('Iceape/1.')),
+ IS_SVG: 'MICROSOFT INTERNET EXPLORER' != navigator.appName.toUpperCase(),
+ NO_FO:
+ !document.createElementNS ||
+ '[object SVGForeignObjectElement]' !==
+ document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject').toString() ||
+ 0 <= navigator.userAgent.indexOf('Opera/'),
+ IS_WIN: 0 < navigator.appVersion.indexOf('Win'),
+ IS_MAC: 0 < navigator.appVersion.indexOf('Mac'),
+ IS_CHROMEOS: /\bCrOS\b/.test(navigator.appVersion),
+ IS_LINUX: /\bLinux\b/.test(navigator.appVersion),
+ IS_TOUCH: 'ontouchstart' in document.documentElement,
+ IS_POINTER: null != window.PointerEvent && !(0 < navigator.appVersion.indexOf('Mac')),
+ IS_LOCAL: 0 > document.location.href.indexOf('http://') && 0 > document.location.href.indexOf('https://'),
+ defaultBundles: [],
+ isBrowserSupported: function () {
+ return mxClient.IS_SVG;
+ },
+ link: function (a, b, c, d) {
+ c = c || document;
+ var e = c.createElement('link');
+ e.setAttribute('rel', a);
+ e.setAttribute('href', b);
+ e.setAttribute('charset', 'UTF-8');
+ e.setAttribute('type', 'text/css');
+ d && e.setAttribute('id', d);
+ c.getElementsByTagName('head')[0].appendChild(e);
+ },
+ loadResources: function (a, b) {
+ function c() {
+ 0 == --d && a();
+ }
+ for (var d = mxClient.defaultBundles.length, e = 0; e < mxClient.defaultBundles.length; e++)
+ mxResources.add(mxClient.defaultBundles[e], b, c);
+ },
+ include: function (a) {
+ document.write('
>
diff --git a/packages/client/src/tiptap/core/extensions/flow.ts b/packages/client/src/tiptap/core/extensions/flow.ts
new file mode 100644
index 00000000..3265532e
--- /dev/null
+++ b/packages/client/src/tiptap/core/extensions/flow.ts
@@ -0,0 +1,106 @@
+import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
+import { ReactNodeViewRenderer } from '@tiptap/react';
+import { FlowWrapper } from 'tiptap/core/wrappers/flow';
+import { getDatasetAttribute } from 'tiptap/prose-utils';
+
+export interface IFlowAttrs {
+ width?: number | string;
+ height?: number;
+ data?: string;
+}
+
+declare module '@tiptap/core' {
+ interface Commands {
+ flow: {
+ setFlow: (attrs?: IFlowAttrs) => ReturnType;
+ };
+ }
+}
+
+export const Flow = Node.create({
+ name: 'flow',
+ group: 'block',
+ selectable: true,
+ atom: true,
+ inline: false,
+
+ addAttributes() {
+ return {
+ width: {
+ default: null,
+ parseHTML: getDatasetAttribute('width'),
+ },
+ height: {
+ default: 240,
+ parseHTML: getDatasetAttribute('height'),
+ },
+ data: {
+ default: '',
+ parseHTML: getDatasetAttribute('data'),
+ },
+ };
+ },
+
+ addOptions() {
+ return {
+ HTMLAttributes: {
+ class: 'flow',
+ },
+ };
+ },
+
+ parseHTML() {
+ return [
+ {
+ tag: 'div',
+ },
+ ];
+ },
+
+ renderHTML({ HTMLAttributes }) {
+ return ['div', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
+ },
+
+ addCommands() {
+ return {
+ setFlow:
+ (options) =>
+ ({ tr, commands, chain, editor }) => {
+ options = options || {};
+ options.data = options.data || '';
+
+ // @ts-ignore
+ if (tr.selection?.node?.type?.name == this.name) {
+ return commands.updateAttributes(this.name, options);
+ }
+
+ const { selection } = editor.state;
+ const pos = selection.$head;
+ return chain()
+ .insertContentAt(pos.before(), [
+ {
+ type: this.name,
+ attrs: options,
+ },
+ ])
+ .run();
+ },
+ };
+ },
+
+ addNodeView() {
+ return ReactNodeViewRenderer(FlowWrapper);
+ },
+
+ addInputRules() {
+ return [
+ nodeInputRule({
+ find: /^\$flow $/,
+ type: this.type,
+ getAttributes: (match) => {
+ return { type: match[1] };
+ },
+ }),
+ ];
+ },
+});
diff --git a/packages/client/src/tiptap/core/styles/node.scss b/packages/client/src/tiptap/core/styles/node.scss
index a19a46a7..3f3f0244 100644
--- a/packages/client/src/tiptap/core/styles/node.scss
+++ b/packages/client/src/tiptap/core/styles/node.scss
@@ -34,6 +34,7 @@
.node-image,
.node-katex,
.node-mind,
+ .node-flow,
.node-codeBlock,
.node-documentChildren,
.node-documentReference {
diff --git a/packages/client/src/tiptap/core/styles/selection.scss b/packages/client/src/tiptap/core/styles/selection.scss
index 277a578c..82879583 100644
--- a/packages/client/src/tiptap/core/styles/selection.scss
+++ b/packages/client/src/tiptap/core/styles/selection.scss
@@ -26,6 +26,7 @@
.node-iframe,
.node-katex,
.node-mind,
+ .node-flow,
.node-codeBlock,
.node-documentChildren,
.node-documentReference,
diff --git a/packages/client/src/tiptap/core/wrappers/flow/decode.ts b/packages/client/src/tiptap/core/wrappers/flow/decode.ts
new file mode 100644
index 00000000..2c5e361e
--- /dev/null
+++ b/packages/client/src/tiptap/core/wrappers/flow/decode.ts
@@ -0,0 +1,75 @@
+import pako from 'pako';
+
+function parseXml(xml) {
+ if (window.DOMParser) {
+ const parser = new DOMParser();
+
+ return parser.parseFromString(xml, 'text/xml');
+ } else {
+ const result = createXmlDocument();
+
+ result.async = 'false';
+ result.loadXML(xml);
+
+ return result;
+ }
+}
+
+function createXmlDocument() {
+ let doc = null;
+
+ if (document.implementation && document.implementation.createDocument) {
+ doc = document.implementation.createDocument('', '', null);
+ }
+
+ return doc;
+}
+
+function getTextContent(node) {
+ return node != null ? node[node.textContent === undefined ? 'text' : 'textContent'] : '';
+}
+
+export function decode(data) {
+ try {
+ const node = parseXml(data).documentElement;
+ if (node != null && node.nodeName == 'mxfile') {
+ const diagrams = node.getElementsByTagName('diagram');
+ if (diagrams.length > 0) {
+ data = getTextContent(diagrams[0]);
+ }
+ }
+ } catch (e) {
+ // ignore
+ }
+
+ try {
+ data = atob(data);
+ } catch (e) {
+ console.log(e);
+ alert('atob failed: ' + e);
+ return;
+ }
+
+ try {
+ data = pako.inflateRaw(
+ Uint8Array.from(data, (c) => String(c).charCodeAt(0)),
+ {
+ to: 'string',
+ }
+ );
+ } catch (e) {
+ console.log(e);
+ alert('inflateRaw failed: ' + e);
+ return;
+ }
+
+ try {
+ data = decodeURIComponent(data);
+ } catch (e) {
+ console.log(e);
+ alert('decodeURIComponent failed: ' + e);
+ return;
+ }
+
+ return data;
+}
diff --git a/packages/client/src/tiptap/core/wrappers/flow/index.module.scss b/packages/client/src/tiptap/core/wrappers/flow/index.module.scss
new file mode 100644
index 00000000..d8782273
--- /dev/null
+++ b/packages/client/src/tiptap/core/wrappers/flow/index.module.scss
@@ -0,0 +1,31 @@
+.wrap {
+ position: relative;
+ max-width: 100%;
+ overflow: visible;
+ line-height: 0;
+
+ .renderWrap {
+ border: 1px solid var(--node-border-color);
+ border-radius: var(--border-radius);
+
+ &::after {
+ background-color: transparent !important;
+ }
+ }
+
+ .toolbarWrap {
+ position: absolute;
+ right: 20px;
+ bottom: 20px;
+ z-index: 1000;
+ display: flex;
+ padding: 2px 4px;
+ overflow-x: auto;
+ color: #fff;
+ background-color: var(--semi-color-nav-bg);
+ border: 1px solid var(--semi-color-border);
+ border-radius: 3px;
+ align-items: center;
+ box-shadow: var(--box-shadow);
+ }
+}
diff --git a/packages/client/src/tiptap/core/wrappers/flow/index.tsx b/packages/client/src/tiptap/core/wrappers/flow/index.tsx
new file mode 100644
index 00000000..3c5956d2
--- /dev/null
+++ b/packages/client/src/tiptap/core/wrappers/flow/index.tsx
@@ -0,0 +1,120 @@
+import { NodeViewWrapper } from '@tiptap/react';
+import cls from 'classnames';
+import { Button, Space } from '@douyinfe/semi-ui';
+import { IconMindCenter, IconZoomOut, IconZoomIn } from 'components/icons';
+import { useCallback, useEffect, useRef } from 'react';
+import { Resizeable } from 'components/resizeable';
+import { getEditorContainerDOMSize, uuid } from 'tiptap/prose-utils';
+import { Flow } from 'tiptap/core/extensions/flow';
+import { decode } from './decode';
+import styles from './index.module.scss';
+
+const INHERIT_SIZE_STYLE = { width: '100%', height: '100%', maxWidth: '100%' };
+
+export const FlowWrapper = ({ editor, node, updateAttributes }) => {
+ const $container = useRef();
+ const $graph = useRef(null);
+ const containerId = useRef(`js-flow-container-${uuid()}`);
+ const isEditable = editor.isEditable;
+ const isActive = editor.isActive(Flow.name);
+ const { width: maxWidth } = getEditorContainerDOMSize(editor);
+ const { data, width, height } = node.attrs;
+
+ const center = useCallback(() => {
+ const graph = $graph.current;
+ if (!graph) return;
+ graph.fit();
+ graph.center(true, false);
+ }, []);
+
+ const zoomOut = useCallback(() => {
+ const graph = $graph.current;
+ if (!graph) return;
+ graph.zoomOut();
+ }, []);
+
+ const zoomIn = useCallback(() => {
+ const graph = $graph.current;
+ if (!graph) return;
+ graph.zoomIn();
+ }, []);
+
+ const onResize = useCallback(
+ (size) => {
+ updateAttributes({ width: size.width, height: size.height });
+ setTimeout(() => {
+ const graph = $graph.current;
+ if (!graph) return;
+ graph.fit();
+ graph.center(true, false);
+ }, 0);
+ },
+ [updateAttributes]
+ );
+
+ useEffect(() => {
+ let graph = $graph.current;
+
+ if (!graph) {
+ // @ts-ignore
+ graph = new mxGraph($container.current);
+ graph.resetViewOnRootChange = false;
+ graph.foldingEnabled = false;
+ graph.setTooltips(false);
+ graph.setEnabled(false);
+ graph.centerZoom = true;
+ $graph.current = graph;
+ }
+
+ const text = decode(data);
+ // @ts-ignore
+ const xmlDoc = mxUtils.parseXml(text);
+ // @ts-ignore
+ const codec = new mxCodec(xmlDoc);
+ codec.decode(codec.document.documentElement, graph.getModel());
+ setTimeout(() => {
+ graph.fit();
+ graph.center(true, false);
+ }, 0);
+ }, [data]);
+
+ return (
+
+
+
+
+
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+
+
+
+
+ );
+};
diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx b/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx
index 97cb53d2..89377b1c 100644
--- a/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx
+++ b/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx
@@ -39,6 +39,7 @@ import { CodeBlock } from 'tiptap/editor/menus/code-block';
import { Countdonw } from 'tiptap/editor/menus/countdown';
import { DocumentChildren } from 'tiptap/editor/menus/document-children';
import { DocumentReference } from 'tiptap/editor/menus/document-reference';
+import { Flow } from 'tiptap/editor/menus/flow';
import { Image } from 'tiptap/editor/menus/image';
import { Iframe } from 'tiptap/editor/menus/iframe';
import { Table } from 'tiptap/editor/menus/table';
@@ -106,6 +107,7 @@ const _MenuBar: React.FC<{ editor: Editor }> = ({ editor }) => {
+
diff --git a/packages/client/src/tiptap/editor/collaboration/kit.ts b/packages/client/src/tiptap/editor/collaboration/kit.ts
index 40acdbb2..57f542b7 100644
--- a/packages/client/src/tiptap/editor/collaboration/kit.ts
+++ b/packages/client/src/tiptap/editor/collaboration/kit.ts
@@ -52,6 +52,7 @@ import { Countdown } from 'tiptap/core/extensions/countdown';
import { DocumentChildren } from 'tiptap/core/extensions/document-children';
import { DocumentReference } from 'tiptap/core/extensions/document-reference';
import { Emoji } from 'tiptap/core/extensions/emoji';
+import { Flow } from 'tiptap/core/extensions/flow';
import { Iframe } from 'tiptap/core/extensions/iframe';
import { Katex } from 'tiptap/core/extensions/katex';
import { Mention } from 'tiptap/core/extensions/mention';
@@ -134,6 +135,7 @@ export const CollaborationKit = [
DocumentChildren,
DocumentReference,
Emoji,
+ Flow,
Iframe,
Katex,
Mention,
diff --git a/packages/client/src/tiptap/editor/menus/_event.ts b/packages/client/src/tiptap/editor/menus/_event.ts
index 71286e40..c3f46c44 100644
--- a/packages/client/src/tiptap/editor/menus/_event.ts
+++ b/packages/client/src/tiptap/editor/menus/_event.ts
@@ -12,6 +12,7 @@ const getEventEmitter = (editor: Editor): EventEmitter => {
export const OPEN_COUNT_SETTING_MODAL = 'OPEN_COUNT_SETTING_MODAL';
export const OPEN_LINK_SETTING_MODAL = 'OPEN_LINK_SETTING_MODAL';
+export const OPEN_FLOW_SETTING_MODAL = 'OPEN_FLOW_SETTING_MODAL';
export const subject = (editor: Editor, eventName, handler) => {
const event = getEventEmitter(editor);
@@ -32,3 +33,8 @@ export const triggerOpenLinkSettingModal = (editor: Editor, data) => {
const event = getEventEmitter(editor);
event.emit(OPEN_LINK_SETTING_MODAL, data);
};
+
+export const triggerOpenFlowSettingModal = (editor: Editor, data) => {
+ const event = getEventEmitter(editor);
+ event.emit(OPEN_FLOW_SETTING_MODAL, data);
+};
diff --git a/packages/client/src/tiptap/editor/menus/flow/bubble.tsx b/packages/client/src/tiptap/editor/menus/flow/bubble.tsx
new file mode 100644
index 00000000..5bee435e
--- /dev/null
+++ b/packages/client/src/tiptap/editor/menus/flow/bubble.tsx
@@ -0,0 +1,47 @@
+import { useCallback } from 'react';
+import { Space, Button } from '@douyinfe/semi-ui';
+import { IconEdit, IconCopy, IconDelete } from '@douyinfe/semi-icons';
+import { Tooltip } from 'components/tooltip';
+import { BubbleMenu } from 'tiptap/editor/views/bubble-menu';
+import { Flow } from 'tiptap/core/extensions/flow';
+import { Divider } from 'tiptap/components/divider';
+import { copyNode, deleteNode } from 'tiptap/prose-utils';
+import { useAttributes } from 'tiptap/editor/hooks/use-attributes';
+import { triggerOpenFlowSettingModal } from '../_event';
+
+export const FlowBubbleMenu = ({ editor }) => {
+ const attrs = useAttributes(editor, Flow.name, {});
+
+ const openEditLinkModal = useCallback(() => {
+ triggerOpenFlowSettingModal(editor, attrs);
+ }, [editor, attrs]);
+ const shouldShow = useCallback(() => editor.isActive(Flow.name), [editor]);
+ const copyMe = useCallback(() => copyNode(Flow.name, editor), [editor]);
+ const deleteMe = useCallback(() => deleteNode(Flow.name, editor), [editor]);
+
+ return (
+
+
+
+ } type="tertiary" theme="borderless" size="small" />
+
+
+
+ } onClick={openEditLinkModal} />
+
+
+
+
+
+ } type="tertiary" theme="borderless" size="small" />
+
+
+
+ );
+};
diff --git a/packages/client/src/tiptap/editor/menus/flow/index.tsx b/packages/client/src/tiptap/editor/menus/flow/index.tsx
new file mode 100644
index 00000000..3aecfc34
--- /dev/null
+++ b/packages/client/src/tiptap/editor/menus/flow/index.tsx
@@ -0,0 +1,13 @@
+import React from 'react';
+import { Editor } from 'tiptap/editor';
+import { FlowBubbleMenu } from './bubble';
+import { FlowSettingModal } from './modal';
+
+export const Flow: React.FC<{ editor: Editor }> = ({ editor }) => {
+ return (
+ <>
+
+
+ >
+ );
+};
diff --git a/packages/client/src/tiptap/editor/menus/flow/modal.tsx b/packages/client/src/tiptap/editor/menus/flow/modal.tsx
new file mode 100644
index 00000000..ba4c8385
--- /dev/null
+++ b/packages/client/src/tiptap/editor/menus/flow/modal.tsx
@@ -0,0 +1,63 @@
+import { useEffect, useRef, useState } from 'react';
+import { Modal } from '@douyinfe/semi-ui';
+import { Editor } from 'tiptap/editor';
+import { useToggle } from 'hooks/use-toggle';
+import { OPEN_FLOW_SETTING_MODAL, subject, cancelSubject } from '../_event';
+
+type IProps = { editor: Editor };
+
+export const FlowSettingModal: React.FC = ({ editor }) => {
+ const $iframe = useRef();
+ const [initialData, setInitialData] = useState('');
+ const [visible, toggleVisible] = useToggle(false);
+
+ useEffect(() => {
+ const handler = (data) => {
+ toggleVisible(true);
+ data && setInitialData(data.data);
+ };
+
+ subject(editor, OPEN_FLOW_SETTING_MODAL, handler);
+
+ return () => {
+ cancelSubject(editor, OPEN_FLOW_SETTING_MODAL, handler);
+ };
+ }, [editor, toggleVisible]);
+
+ useEffect(() => {
+ const receiver = (evt) => {
+ if (!evt.data) {
+ toggleVisible(false);
+ return;
+ }
+
+ if (evt.data == 'ready') {
+ $iframe.current.contentWindow.postMessage(initialData, '*');
+ } else {
+ if (evt.data.length > 0) {
+ const data = evt.data;
+ editor.chain().focus().setFlow({ data }).run();
+ }
+ }
+ };
+
+ window.addEventListener('message', receiver);
+
+ return () => {
+ window.removeEventListener('message', receiver);
+ };
+ }, [editor, toggleVisible, initialData]);
+
+ return (
+
+
+
+
+
+ );
+};
diff --git a/packages/client/src/tiptap/editor/menus/insert/index.tsx b/packages/client/src/tiptap/editor/menus/insert/index.tsx
index c921c1b2..d522f809 100644
--- a/packages/client/src/tiptap/editor/menus/insert/index.tsx
+++ b/packages/client/src/tiptap/editor/menus/insert/index.tsx
@@ -16,6 +16,7 @@ import {
IconCountdown,
IconCallout,
IconTableOfContents,
+ IconFlow,
} from 'components/icons';
import { GridSelect } from 'components/grid-select';
import { useToggle } from 'hooks/use-toggle';
@@ -95,6 +96,13 @@ const COMMANDS = [
{
title: '卡片',
},
+ {
+ icon: ,
+ label: '流程图',
+ action: (editor) => {
+ editor.chain().focus().setFlow({ width: '100%' }).run();
+ },
+ },
{
icon: ,
label: '思维导图',
diff --git a/packages/client/src/tiptap/editor/menus/quick-insert.tsx b/packages/client/src/tiptap/editor/menus/quick-insert.tsx
index a1b2928d..cd1ebde4 100644
--- a/packages/client/src/tiptap/editor/menus/quick-insert.tsx
+++ b/packages/client/src/tiptap/editor/menus/quick-insert.tsx
@@ -20,6 +20,7 @@ import {
IconCountdown,
IconCallout,
IconTableOfContents,
+ IconFlow,
} from 'components/icons';
import { createCountdown } from './countdown/service';
import { createOrToggleLink } from './link/service';
@@ -201,6 +202,17 @@ export const QUICK_INSERT_ITEMS = [
command: (editor: Editor) => editor.chain().focus().setIframe({ url: '' }).run(),
},
+ {
+ key: '流程图',
+ label: (
+
+
+ 流程图
+
+ ),
+ command: (editor: Editor) => editor.chain().focus().setFlow({ width: '100%' }).run(),
+ },
+
{
key: '思维导图',
label: (
diff --git a/packages/client/src/tiptap/editor/menus/text/index.tsx b/packages/client/src/tiptap/editor/menus/text/index.tsx
index b9ac51ad..b3d57307 100644
--- a/packages/client/src/tiptap/editor/menus/text/index.tsx
+++ b/packages/client/src/tiptap/editor/menus/text/index.tsx
@@ -19,6 +19,7 @@ import { Image } from 'tiptap/core/extensions/image';
import { Callout } from 'tiptap/core/extensions/callout';
import { CodeBlock } from 'tiptap/core/extensions/code-block';
import { Iframe } from 'tiptap/core/extensions/iframe';
+import { Flow } from 'tiptap/core/extensions/flow';
import { Mind } from 'tiptap/core/extensions/mind';
import { Table } from 'tiptap/core/extensions/table';
import { TableOfContents } from 'tiptap/core/extensions/table-of-contents';
@@ -35,6 +36,7 @@ const OTHER_BUBBLE_MENU_TYPES = [
Callout.name,
CodeBlock.name,
Iframe.name,
+ Flow.name,
Mind.name,
Table.name,
TableOfContents.name,
diff --git a/packages/config/yaml/dev.yaml b/packages/config/yaml/dev.yaml
index 612ff9e0..f3662586 100644
--- a/packages/config/yaml/dev.yaml
+++ b/packages/config/yaml/dev.yaml
@@ -10,6 +10,7 @@ client:
assetPrefix: '/'
apiUrl: 'http://localhost:5001/api'
collaborationUrl: 'ws://localhost:5003'
+ drawioUrl: 'https://embed.diagrams.net'
# 数据库配置
db:
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b3121ac1..e14ee447 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -122,6 +122,7 @@ importers:
markdown-it-sub: ^1.0.0
markdown-it-sup: ^1.0.0
next: 12.0.10
+ pako: ^2.0.4
prosemirror-markdown: ^1.7.0
prosemirror-tables: ^1.1.1
prosemirror-utils: ^0.9.6
@@ -206,6 +207,7 @@ importers:
markdown-it-sub: 1.0.0
markdown-it-sup: 1.0.0
next: 12.0.10_react-dom@17.0.2+react@17.0.2
+ pako: 2.0.4
prosemirror-markdown: 1.7.0
prosemirror-tables: 1.1.1
prosemirror-utils: 0.9.6_prosemirror-tables@1.1.1
@@ -6986,6 +6988,10 @@ packages:
netmask: 2.0.2
dev: false
+ /pako/2.0.4:
+ resolution: {integrity: sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==}
+ dev: false
+
/parent-module/1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'}