1(function(global2, factory) { 2 typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.docx = {})); 3})(this, function(exports2) { 4 "use strict";var __defProp = Object.defineProperty; 5var __defProps = Object.defineProperties; 6var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 7var __getOwnPropSymbols = Object.getOwnPropertySymbols; 8var __hasOwnProp = Object.prototype.hasOwnProperty; 9var __propIsEnum = Object.prototype.propertyIsEnumerable; 10var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 11var __spreadValues = (a, b) => { 12 for (var prop in b || (b = {})) 13 if (__hasOwnProp.call(b, prop)) 14 __defNormalProp(a, prop, b[prop]); 15 if (__getOwnPropSymbols) 16 for (var prop of __getOwnPropSymbols(b)) { 17 if (__propIsEnum.call(b, prop)) 18 __defNormalProp(a, prop, b[prop]); 19 } 20 return a; 21}; 22var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 23var __publicField = (obj, key, value) => { 24 __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 25 return value; 26}; 27var __async = (__this, __arguments, generator) => { 28 return new Promise((resolve, reject) => { 29 var fulfilled = (value) => { 30 try { 31 step(generator.next(value)); 32 } catch (e) { 33 reject(e); 34 } 35 }; 36 var rejected = (value) => { 37 try { 38 step(generator.throw(value)); 39 } catch (e) { 40 reject(e); 41 } 42 }; 43 var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); 44 step((generator = generator.apply(__this, __arguments)).next()); 45 }); 46}; 47 48 class BaseXmlComponent { 49 constructor(rootKey) { 50 __publicField(this, "rootKey");
51 this.rootKey = rootKey; 52 } 53 } 54 const EMPTY_OBJECT = Object.seal({}); 55 class XmlComponent extends BaseXmlComponent { 56 constructor(rootKey) { 57 super(rootKey); 58 // eslint-disable-next-line functional/prefer-readonly-type, @typescript-eslint/no-explicit-any 59 __publicField(this, "root"); 60 this.root = new Array(); 61 } 62 // This method is called by the formatter to get the XML representation of this component. 63 // It is called recursively for all child components. 64 // It is a serializer to be used in the xml library. 65 // https://www.npmjs.com/package/xml 66 // Child components can override this method to customize the XML representation, or execute side effects. 67 prepForXml(context) { 68 var _a; 69 context.stack.push(this); 70 const children = this.root.map((comp) => { 71 if (comp instanceof BaseXmlComponent) { 72 return comp.prepForXml(context); 73 } 74 return comp; 75 }).filter((comp) => comp !== void 0); 76 context.stack.pop(); 77 return { 78 [this.rootKey]: children.length ? children.length === 1 && ((_a = children[0]) == null ? void 0 : _a._attr) ? children[0] : children : EMPTY_OBJECT 79 }; 80 } 81 /** 82 * @deprecated Do not use this method. It is only used internally by the library. It will be removed in a future version. 83 */ 84 addChildElement(child) { 85 this.root.push(child); 86 return this; 87 } 88 } 89 class IgnoreIfEmptyXmlComponent extends XmlComponent { 90 prepForXml(context) { 91 const result = super.prepForXml(context); 92 if (result && (typeof result[this.rootKey] !== "object" || Object.keys(result[this.rootKey]).length)) { 93 return result; 94 } 95 return void 0; 96 } 97 } 98 class XmlAttributeComponent extends BaseXmlComponent { 99 constructor(root) { 100 super("_attr"); 101 __publicField(this, "xmlKeys"); 102 this.root = root; 103 } 104 prepForXml(_) { 105 const attrs = {}; 106 Object.keys(this.root).forEach((key) => { 107 const value = this.root[key]; 108 if (value !== void 0) { 109 const newKey = this.xmlKeys && this.xmlKeys[key] || key; 110 attrs[newKey] = value; 111 } 112 }); 113 return { _attr: attrs }; 114 } 115 } 116 class NextAttributeComponent extends BaseXmlComponent { 117 constructor(root) { 118 super("_attr"); 119 this.root = root; 120 } 121 prepForXml(_) { 122 const attrs = Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {}); 123 return { _attr: attrs }; 124 } 125 } 126 class Attributes extends XmlAttributeComponent { 127 constructor() { 128 super(...arguments); 129 __publicField(this, "xmlKeys", { 130 val: "w:val", 131 color: "w:color", 132 fill: "w:fill", 133 space: "w:space", 134 sz: "w:sz", 135 type: "w:type", 136 rsidR: "w:rsidR", 137 rsidRPr: "w:rsidRPr", 138 rsidSect: "w:rsidSect", 139 w: "w:w", 140 h: "w:h", 141 top: "w:top", 142 right: "w:right", 143 bottom: "w:bottom", 144 left: "w:left", 145 header: "w:header", 146 footer: "w:footer", 147 gutter: "w:gutter", 148 linePitch: "w:linePitch", 149 pos: "w:pos" 150 }); 151 } 152 } 153 var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; 154 function getDefaultExportFromCjs$1(x) { 155 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; 156 } 157 var sax$1 = {}; 158 var events = { exports: {} }; 159 var R = typeof Reflect === "object" ? Reflect : null; 160 var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { 161 return Function.prototype.apply.call(target, receiver, args); 162 }; 163 var ReflectOwnKeys; 164 if (R && typeof R.ownKeys === "function") { 165 ReflectOwnKeys = R.ownKeys; 166 } else if (Object.getOwnPropertySymbols) { 167 ReflectOwnKeys = function ReflectOwnKeys2(target) { 168 return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); 169 }; 170 } else { 171 ReflectOwnKeys = function ReflectOwnKeys2(target) { 172 return Object.getOwnPropertyNames(target); 173 }; 174 } 175 function ProcessEmitWarning(warning) { 176 if (console && console.warn) 177 console.warn(warning); 178 } 179 var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { 180 return value !== value; 181 }; 182 function EventEmitter() { 183 EventEmitter.init.call(this); 184 } 185 events.exports = EventEmitter; 186 events.exports.once = once; 187 EventEmitter.EventEmitter = EventEmitter; 188 EventEmitter.prototype._events = void 0; 189 EventEmitter.prototype._eventsCount = 0; 190 EventEmitter.prototype._maxListeners = void 0; 191 var defaultMaxListeners = 10; 192 function checkListener(listener) { 193 if (typeof listener !== "function") { 194 throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); 195 } 196 } 197 Object.defineProperty(EventEmitter, "defaultMaxListeners", { 198 enumerable: true, 199 get: function() { 200 return defaultMaxListeners; 201 }, 202 set: function(arg) { 203 if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { 204 throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); 205 } 206 defaultMaxListeners = arg;
vendor: 10,602 bytes, lines 207-525
207 } 208 }); 209 EventEmitter.init = function() { 210 if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { 211 this._events = /* @__PURE__ */ Object.create(null); 212 this._eventsCount = 0; 213 } 214 this._maxListeners = this._maxListeners || void 0; 215 }; 216 EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { 217 if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { 218 throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); 219 } 220 this._maxListeners = n; 221 return this; 222 }; 223 function _getMaxListeners(that) { 224 if (that._maxListeners === void 0) 225 return EventEmitter.defaultMaxListeners; 226 return that._maxListeners; 227 } 228 EventEmitter.prototype.getMaxListeners = function getMaxListeners() { 229 return _getMaxListeners(this); 230 }; 231 EventEmitter.prototype.emit = function emit(type) { 232 var args = []; 233 for (var i = 1; i < arguments.length; i++) 234 args.push(arguments[i]); 235 var doError = type === "error"; 236 var events2 = this._events; 237 if (events2 !== void 0) 238 doError = doError && events2.error === void 0; 239 else if (!doError) 240 return false; 241 if (doError) { 242 var er; 243 if (args.length > 0) 244 er = args[0]; 245 if (er instanceof Error) { 246 throw er; 247 } 248 var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); 249 err.context = er; 250 throw err; 251 } 252 var handler = events2[type]; 253 if (handler === void 0) 254 return false; 255 if (typeof handler === "function") { 256 ReflectApply(handler, this, args); 257 } else { 258 var len = handler.length; 259 var listeners = arrayClone(handler, len); 260 for (var i = 0; i < len; ++i) 261 ReflectApply(listeners[i], this, args); 262 } 263 return true; 264 }; 265 function _addListener(target, type, listener, prepend) { 266 var m; 267 var events2; 268 var existing; 269 checkListener(listener); 270 events2 = target._events; 271 if (events2 === void 0) { 272 events2 = target._events = /* @__PURE__ */ Object.create(null); 273 target._eventsCount = 0; 274 } else { 275 if (events2.newListener !== void 0) { 276 target.emit( 277 "newListener", 278 type, 279 listener.listener ? listener.listener : listener 280 ); 281 events2 = target._events; 282 } 283 existing = events2[type]; 284 } 285 if (existing === void 0) { 286 existing = events2[type] = listener; 287 ++target._eventsCount; 288 } else { 289 if (typeof existing === "function") { 290 existing = events2[type] = prepend ? [listener, existing] : [existing, listener]; 291 } else if (prepend) { 292 existing.unshift(listener); 293 } else { 294 existing.push(listener); 295 } 296 m = _getMaxListeners(target); 297 if (m > 0 && existing.length > m && !existing.warned) { 298 existing.warned = true; 299 var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); 300 w.name = "MaxListenersExceededWarning"; 301 w.emitter = target; 302 w.type = type; 303 w.count = existing.length; 304 ProcessEmitWarning(w); 305 } 306 } 307 return target; 308 } 309 EventEmitter.prototype.addListener = function addListener(type, listener) { 310 return _addListener(this, type, listener, false); 311 }; 312 EventEmitter.prototype.on = EventEmitter.prototype.addListener; 313 EventEmitter.prototype.prependListener = function prependListener(type, listener) { 314 return _addListener(this, type, listener, true); 315 }; 316 function onceWrapper() { 317 if (!this.fired) { 318 this.target.removeListener(this.type, this.wrapFn); 319 this.fired = true; 320 if (arguments.length === 0) 321 return this.listener.call(this.target); 322 return this.listener.apply(this.target, arguments); 323 } 324 } 325 function _onceWrap(target, type, listener) { 326 var state2 = { fired: false, wrapFn: void 0, target, type, listener }; 327 var wrapped = onceWrapper.bind(state2); 328 wrapped.listener = listener; 329 state2.wrapFn = wrapped; 330 return wrapped; 331 } 332 EventEmitter.prototype.once = function once2(type, listener) { 333 checkListener(listener); 334 this.on(type, _onceWrap(this, type, listener)); 335 return this; 336 }; 337 EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { 338 checkListener(listener); 339 this.prependListener(type, _onceWrap(this, type, listener)); 340 return this; 341 }; 342 EventEmitter.prototype.removeListener = function removeListener(type, listener) { 343 var list, events2, position, i, originalListener; 344 checkListener(listener); 345 events2 = this._events; 346 if (events2 === void 0) 347 return this; 348 list = events2[type]; 349 if (list === void 0) 350 return this; 351 if (list === listener || list.listener === listener) { 352 if (--this._eventsCount === 0) 353 this._events = /* @__PURE__ */ Object.create(null); 354 else { 355 delete events2[type]; 356 if (events2.removeListener) 357 this.emit("removeListener", type, list.listener || listener); 358 } 359 } else if (typeof list !== "function") { 360 position = -1; 361 for (i = list.length - 1; i >= 0; i--) { 362 if (list[i] === listener || list[i].listener === listener) { 363 originalListener = list[i].listener; 364 position = i; 365 break; 366 } 367 } 368 if (position < 0) 369 return this; 370 if (position === 0) 371 list.shift(); 372 else { 373 spliceOne(list, position); 374 } 375 if (list.length === 1) 376 events2[type] = list[0]; 377 if (events2.removeListener !== void 0) 378 this.emit("removeListener", type, originalListener || listener); 379 } 380 return this; 381 }; 382 EventEmitter.prototype.off = EventEmitter.prototype.removeListener; 383 EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { 384 var listeners, events2, i; 385 events2 = this._events; 386 if (events2 === void 0) 387 return this; 388 if (events2.removeListener === void 0) { 389 if (arguments.length === 0) { 390 this._events = /* @__PURE__ */ Object.create(null); 391 this._eventsCount = 0; 392 } else if (events2[type] !== void 0) { 393 if (--this._eventsCount === 0) 394 this._events = /* @__PURE__ */ Object.create(null); 395 else 396 delete events2[type]; 397 } 398 return this; 399 } 400 if (arguments.length === 0) { 401 var keys = Object.keys(events2); 402 var key; 403 for (i = 0; i < keys.length; ++i) { 404 key = keys[i]; 405 if (key === "removeListener") 406 continue; 407 this.removeAllListeners(key); 408 } 409 this.removeAllListeners("removeListener"); 410 this._events = /* @__PURE__ */ Object.create(null); 411 this._eventsCount = 0; 412 return this; 413 } 414 listeners = events2[type]; 415 if (typeof listeners === "function") { 416 this.removeListener(type, listeners); 417 } else if (listeners !== void 0) { 418 for (i = listeners.length - 1; i >= 0; i--) { 419 this.removeListener(type, listeners[i]); 420 } 421 } 422 return this; 423 }; 424 function _listeners(target, type, unwrap) { 425 var events2 = target._events; 426 if (events2 === void 0) 427 return []; 428 var evlistener = events2[type]; 429 if (evlistener === void 0) 430 return []; 431 if (typeof evlistener === "function") 432 return unwrap ? [evlistener.listener || evlistener] : [evlistener]; 433 return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); 434 } 435 EventEmitter.prototype.listeners = function listeners(type) { 436 return _listeners(this, type, true); 437 }; 438 EventEmitter.prototype.rawListeners = function rawListeners(type) { 439 return _listeners(this, type, false); 440 }; 441 EventEmitter.listenerCount = function(emitter, type) { 442 if (typeof emitter.listenerCount === "function") { 443 return emitter.listenerCount(type); 444 } else { 445 return listenerCount.call(emitter, type); 446 } 447 }; 448 EventEmitter.prototype.listenerCount = listenerCount; 449 function listenerCount(type) { 450 var events2 = this._events; 451 if (events2 !== void 0) { 452 var evlistener = events2[type]; 453 if (typeof evlistener === "function") { 454 return 1; 455 } else if (evlistener !== void 0) { 456 return evlistener.length; 457 } 458 } 459 return 0; 460 } 461 EventEmitter.prototype.eventNames = function eventNames() { 462 return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; 463 }; 464 function arrayClone(arr, n) { 465 var copy = new Array(n); 466 for (var i = 0; i < n; ++i) 467 copy[i] = arr[i]; 468 return copy; 469 } 470 function spliceOne(list, index) { 471 for (; index + 1 < list.length; index++) 472 list[index] = list[index + 1]; 473 list.pop(); 474 } 475 function unwrapListeners(arr) { 476 var ret = new Array(arr.length); 477 for (var i = 0; i < ret.length; ++i) { 478 ret[i] = arr[i].listener || arr[i]; 479 } 480 return ret; 481 } 482 function once(emitter, name) { 483 return new Promise(function(resolve2, reject) { 484 function errorListener(err) { 485 emitter.removeListener(name, resolver); 486 reject(err); 487 } 488 function resolver() { 489 if (typeof emitter.removeListener === "function") { 490 emitter.removeListener("error", errorListener); 491 } 492 resolve2([].slice.call(arguments)); 493 } 494 eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); 495 if (name !== "error") { 496 addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); 497 } 498 }); 499 } 500 function addErrorHandlerIfEventEmitter(emitter, handler, flags) { 501 if (typeof emitter.on === "function") { 502 eventTargetAgnosticAddListener(emitter, "error", handler, flags); 503 } 504 } 505 function eventTargetAgnosticAddListener(emitter, name, listener, flags) { 506 if (typeof emitter.on === "function") { 507 if (flags.once) { 508 emitter.once(name, listener); 509 } else { 510 emitter.on(name, listener); 511 } 512 } else if (typeof emitter.addEventListener === "function") { 513 emitter.addEventListener(name, function wrapListener(arg) { 514 if (flags.once) { 515 emitter.removeEventListener(name, wrapListener); 516 } 517 listener(arg); 518 }); 519 } else { 520 throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); 521 } 522 } 523 var eventsExports = events.exports; 524 var inherits_browser = { exports: {} }; 525 if (typeof Object.create === "function") {
vendor: 5,750 bytes, lines 526-736
526 inherits_browser.exports = function inherits2(ctor, superCtor) { 527 if (superCtor) { 528 ctor.super_ = superCtor; 529 ctor.prototype = Object.create(superCtor.prototype, { 530 constructor: { 531 value: ctor, 532 enumerable: false, 533 writable: true, 534 configurable: true 535 } 536 }); 537 } 538 }; 539 } else { 540 inherits_browser.exports = function inherits2(ctor, superCtor) { 541 if (superCtor) { 542 ctor.super_ = superCtor; 543 var TempCtor = function() { 544 }; 545 TempCtor.prototype = superCtor.prototype; 546 ctor.prototype = new TempCtor(); 547 ctor.prototype.constructor = ctor; 548 } 549 }; 550 } 551 var inherits_browserExports = inherits_browser.exports; 552 function getDefaultExportFromCjs(x) { 553 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; 554 } 555 var browser$1 = { exports: {} }; 556 var process = browser$1.exports = {}; 557 var cachedSetTimeout; 558 var cachedClearTimeout; 559 function defaultSetTimout() { 560 throw new Error("setTimeout has not been defined"); 561 } 562 function defaultClearTimeout() { 563 throw new Error("clearTimeout has not been defined"); 564 } 565 (function() { 566 try { 567 if (typeof setTimeout === "function") { 568 cachedSetTimeout = setTimeout; 569 } else { 570 cachedSetTimeout = defaultSetTimout; 571 } 572 } catch (e) { 573 cachedSetTimeout = defaultSetTimout; 574 } 575 try { 576 if (typeof clearTimeout === "function") { 577 cachedClearTimeout = clearTimeout; 578 } else { 579 cachedClearTimeout = defaultClearTimeout; 580 } 581 } catch (e) { 582 cachedClearTimeout = defaultClearTimeout; 583 } 584 })(); 585 function runTimeout(fun) { 586 if (cachedSetTimeout === setTimeout) { 587 return setTimeout(fun, 0); 588 } 589 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 590 cachedSetTimeout = setTimeout; 591 return setTimeout(fun, 0); 592 } 593 try { 594 return cachedSetTimeout(fun, 0); 595 } catch (e) { 596 try { 597 return cachedSetTimeout.call(null, fun, 0); 598 } catch (e2) { 599 return cachedSetTimeout.call(this, fun, 0); 600 } 601 } 602 } 603 function runClearTimeout(marker) { 604 if (cachedClearTimeout === clearTimeout) { 605 return clearTimeout(marker); 606 } 607 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 608 cachedClearTimeout = clearTimeout; 609 return clearTimeout(marker); 610 } 611 try { 612 return cachedClearTimeout(marker); 613 } catch (e) { 614 try { 615 return cachedClearTimeout.call(null, marker); 616 } catch (e2) { 617 return cachedClearTimeout.call(this, marker); 618 } 619 } 620 } 621 var queue = []; 622 var draining = false; 623 var currentQueue; 624 var queueIndex = -1; 625 function cleanUpNextTick() { 626 if (!draining || !currentQueue) { 627 return; 628 } 629 draining = false; 630 if (currentQueue.length) { 631 queue = currentQueue.concat(queue); 632 } else { 633 queueIndex = -1; 634 } 635 if (queue.length) { 636 drainQueue(); 637 } 638 } 639 function drainQueue() { 640 if (draining) { 641 return; 642 } 643 var timeout = runTimeout(cleanUpNextTick); 644 draining = true; 645 var len = queue.length; 646 while (len) { 647 currentQueue = queue; 648 queue = []; 649 while (++queueIndex < len) { 650 if (currentQueue) { 651 currentQueue[queueIndex].run(); 652 } 653 } 654 queueIndex = -1; 655 len = queue.length; 656 } 657 currentQueue = null; 658 draining = false; 659 runClearTimeout(timeout); 660 } 661 process.nextTick = function(fun) { 662 var args = new Array(arguments.length - 1); 663 if (arguments.length > 1) { 664 for (var i = 1; i < arguments.length; i++) { 665 args[i - 1] = arguments[i]; 666 } 667 } 668 queue.push(new Item(fun, args)); 669 if (queue.length === 1 && !draining) { 670 runTimeout(drainQueue); 671 } 672 }; 673 function Item(fun, array) { 674 this.fun = fun; 675 this.array = array; 676 } 677 Item.prototype.run = function() { 678 this.fun.apply(null, this.array); 679 }; 680 process.title = "browser"; 681 process.browser = true; 682 process.env = {}; 683 process.argv = []; 684 process.version = ""; 685 process.versions = {}; 686 function noop() { 687 } 688 process.on = noop; 689 process.addListener = noop; 690 process.once = noop; 691 process.off = noop; 692 process.removeListener = noop; 693 process.removeAllListeners = noop; 694 process.emit = noop; 695 process.prependListener = noop; 696 process.prependOnceListener = noop; 697 process.listeners = function(name) { 698 return []; 699 }; 700 process.binding = function(name) { 701 throw new Error("process.binding is not supported"); 702 }; 703 process.cwd = function() { 704 return "/"; 705 }; 706 process.chdir = function(dir) { 707 throw new Error("process.chdir is not supported"); 708 }; 709 process.umask = function() { 710 return 0; 711 }; 712 var browserExports = browser$1.exports; 713 const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports); 714 var streamBrowser; 715 var hasRequiredStreamBrowser; 716 function requireStreamBrowser() { 717 if (hasRequiredStreamBrowser) 718 return streamBrowser; 719 hasRequiredStreamBrowser = 1; 720 streamBrowser = eventsExports.EventEmitter; 721 return streamBrowser; 722 } 723 var buffer = {}; 724 var base64Js = {}; 725 var hasRequiredBase64Js; 726 function requireBase64Js() { 727 if (hasRequiredBase64Js) 728 return base64Js; 729 hasRequiredBase64Js = 1; 730 base64Js.byteLength = byteLength; 731 base64Js.toByteArray = toByteArray; 732 base64Js.fromByteArray = fromByteArray; 733 var lookup = []; 734 var revLookup = []; 735 var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; 736 var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 5,801 bytes, lines 736-905
736+/"; 737 for (var i = 0, len = code.length; i < len; ++i) { 738 lookup[i] = code[i]; 739 revLookup[code.charCodeAt(i)] = i; 740 } 741 revLookup["-".charCodeAt(0)] = 62; 742 revLookup["_".charCodeAt(0)] = 63; 743 function getLens(b64) { 744 var len2 = b64.length; 745 if (len2 % 4 > 0) { 746 throw new Error("Invalid string. Length must be a multiple of 4"); 747 } 748 var validLen = b64.indexOf("="); 749 if (validLen === -1) 750 validLen = len2; 751 var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; 752 return [validLen, placeHoldersLen]; 753 } 754 function byteLength(b64) { 755 var lens = getLens(b64); 756 var validLen = lens[0]; 757 var placeHoldersLen = lens[1]; 758 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 759 } 760 function _byteLength(b64, validLen, placeHoldersLen) { 761 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 762 } 763 function toByteArray(b64) { 764 var tmp; 765 var lens = getLens(b64); 766 var validLen = lens[0]; 767 var placeHoldersLen = lens[1]; 768 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); 769 var curByte = 0; 770 var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; 771 var i2; 772 for (i2 = 0; i2 < len2; i2 += 4) { 773 tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)]; 774 arr[curByte++] = tmp >> 16 & 255; 775 arr[curByte++] = tmp >> 8 & 255; 776 arr[curByte++] = tmp & 255; 777 } 778 if (placeHoldersLen === 2) { 779 tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4; 780 arr[curByte++] = tmp & 255; 781 } 782 if (placeHoldersLen === 1) { 783 tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2; 784 arr[curByte++] = tmp >> 8 & 255; 785 arr[curByte++] = tmp & 255; 786 } 787 return arr; 788 } 789 function tripletToBase64(num) { 790 return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; 791 } 792 function encodeChunk(uint8, start, end) { 793 var tmp; 794 var output = []; 795 for (var i2 = start; i2 < end; i2 += 3) { 796 tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255); 797 output.push(tripletToBase64(tmp)); 798 } 799 return output.join(""); 800 } 801 function fromByteArray(uint8) { 802 var tmp; 803 var len2 = uint8.length; 804 var extraBytes = len2 % 3; 805 var parts = []; 806 var maxChunkLength = 16383; 807 for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) { 808 parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength)); 809 } 810 if (extraBytes === 1) { 811 tmp = uint8[len2 - 1]; 812 parts.push( 813 lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" 814 ); 815 } else if (extraBytes === 2) { 816 tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; 817 parts.push( 818 lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" 819 ); 820 } 821 return parts.join(""); 822 } 823 return base64Js; 824 } 825 var ieee754 = {}; 826 /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ 827 var hasRequiredIeee754; 828 function requireIeee754() { 829 if (hasRequiredIeee754) 830 return ieee754; 831 hasRequiredIeee754 = 1; 832 ieee754.read = function(buffer2, offset, isLE, mLen, nBytes) { 833 var e, m; 834 var eLen = nBytes * 8 - mLen - 1; 835 var eMax = (1 << eLen) - 1; 836 var eBias = eMax >> 1; 837 var nBits = -7; 838 var i = isLE ? nBytes - 1 : 0; 839 var d = isLE ? -1 : 1; 840 var s = buffer2[offset + i]; 841 i += d; 842 e = s & (1 << -nBits) - 1; 843 s >>= -nBits; 844 nBits += eLen; 845 for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) { 846 } 847 m = e & (1 << -nBits) - 1; 848 e >>= -nBits; 849 nBits += mLen; 850 for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) { 851 } 852 if (e === 0) { 853 e = 1 - eBias; 854 } else if (e === eMax) { 855 return m ? NaN : (s ? -1 : 1) * Infinity; 856 } else { 857 m = m + Math.pow(2, mLen); 858 e = e - eBias; 859 } 860 return (s ? -1 : 1) * m * Math.pow(2, e - mLen); 861 }; 862 ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) { 863 var e, m, c; 864 var eLen = nBytes * 8 - mLen - 1; 865 var eMax = (1 << eLen) - 1; 866 var eBias = eMax >> 1; 867 var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; 868 var i = isLE ? 0 : nBytes - 1; 869 var d = isLE ? 1 : -1; 870 var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; 871 value = Math.abs(value); 872 if (isNaN(value) || value === Infinity) { 873 m = isNaN(value) ? 1 : 0; 874 e = eMax; 875 } else { 876 e = Math.floor(Math.log(value) / Math.LN2); 877 if (value * (c = Math.pow(2, -e)) < 1) { 878 e--; 879 c *= 2; 880 } 881 if (e + eBias >= 1) { 882 value += rt / c; 883 } else { 884 value += rt * Math.pow(2, 1 - eBias); 885 } 886 if (value * c >= 2) { 887 e++; 888 c /= 2; 889 } 890 if (e + eBias >= eMax) { 891 m = 0; 892 e = eMax; 893 } else if (e + eBias >= 1) { 894 m = (value * c - 1) * Math.pow(2, mLen); 895 e = e + eBias; 896 } else { 897 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); 898 e = 0; 899 } 900 } 901 for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) { 902 } 903 e = e << mLen | m; 904 eLen += mLen; 905 for (; eLen > 0;
vendor: 10,075 bytes, lines 905-1187
905 buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) { 906 } 907 buffer2[offset + i - d] |= s * 128; 908 }; 909 return ieee754; 910 } 911 /*! 912 * The buffer module from node.js, for the browser. 913 * 914 * @author Feross Aboukhadijeh <https://feross.org> 915 * @license MIT 916 */ 917 var hasRequiredBuffer; 918 function requireBuffer() { 919 if (hasRequiredBuffer) 920 return buffer; 921 hasRequiredBuffer = 1; 922 (function(exports3) { 923 var base64 = requireBase64Js(); 924 var ieee7542 = requireIeee754(); 925 var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; 926 exports3.Buffer = Buffer2; 927 exports3.SlowBuffer = SlowBuffer; 928 exports3.INSPECT_MAX_BYTES = 50; 929 var K_MAX_LENGTH = 2147483647; 930 exports3.kMaxLength = K_MAX_LENGTH; 931 Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport(); 932 if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { 933 console.error( 934 "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support." 935 ); 936 } 937 function typedArraySupport() { 938 try { 939 var arr = new Uint8Array(1); 940 var proto = { foo: function() { 941 return 42; 942 } }; 943 Object.setPrototypeOf(proto, Uint8Array.prototype); 944 Object.setPrototypeOf(arr, proto); 945 return arr.foo() === 42; 946 } catch (e) { 947 return false; 948 } 949 } 950 Object.defineProperty(Buffer2.prototype, "parent", { 951 enumerable: true, 952 get: function() { 953 if (!Buffer2.isBuffer(this)) 954 return void 0; 955 return this.buffer; 956 } 957 }); 958 Object.defineProperty(Buffer2.prototype, "offset", { 959 enumerable: true, 960 get: function() { 961 if (!Buffer2.isBuffer(this)) 962 return void 0; 963 return this.byteOffset; 964 } 965 }); 966 function createBuffer(length) { 967 if (length > K_MAX_LENGTH) { 968 throw new RangeError('The value "' + length + '" is invalid for option "size"'); 969 } 970 var buf = new Uint8Array(length); 971 Object.setPrototypeOf(buf, Buffer2.prototype); 972 return buf; 973 } 974 function Buffer2(arg, encodingOrOffset, length) { 975 if (typeof arg === "number") { 976 if (typeof encodingOrOffset === "string") { 977 throw new TypeError( 978 'The "string" argument must be of type string. Received type number' 979 ); 980 } 981 return allocUnsafe(arg); 982 } 983 return from(arg, encodingOrOffset, length); 984 } 985 Buffer2.poolSize = 8192; 986 function from(value, encodingOrOffset, length) { 987 if (typeof value === "string") { 988 return fromString(value, encodingOrOffset); 989 } 990 if (ArrayBuffer.isView(value)) { 991 return fromArrayView(value); 992 } 993 if (value == null) { 994 throw new TypeError( 995 "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value 996 ); 997 } 998 if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { 999 return fromArrayBuffer(value, encodingOrOffset, length); 1000 } 1001 if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { 1002 return fromArrayBuffer(value, encodingOrOffset, length); 1003 } 1004 if (typeof value === "number") { 1005 throw new TypeError( 1006 'The "value" argument must not be of type number. Received type number' 1007 ); 1008 } 1009 var valueOf = value.valueOf && value.valueOf(); 1010 if (valueOf != null && valueOf !== value) { 1011 return Buffer2.from(valueOf, encodingOrOffset, length); 1012 } 1013 var b = fromObject(value); 1014 if (b) 1015 return b; 1016 if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { 1017 return Buffer2.from( 1018 value[Symbol.toPrimitive]("string"), 1019 encodingOrOffset, 1020 length 1021 ); 1022 } 1023 throw new TypeError( 1024 "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value 1025 ); 1026 } 1027 Buffer2.from = function(value, encodingOrOffset, length) { 1028 return from(value, encodingOrOffset, length); 1029 }; 1030 Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype); 1031 Object.setPrototypeOf(Buffer2, Uint8Array); 1032 function assertSize(size) { 1033 if (typeof size !== "number") { 1034 throw new TypeError('"size" argument must be of type number'); 1035 } else if (size < 0) { 1036 throw new RangeError('The value "' + size + '" is invalid for option "size"'); 1037 } 1038 } 1039 function alloc(size, fill, encoding) { 1040 assertSize(size); 1041 if (size <= 0) { 1042 return createBuffer(size); 1043 } 1044 if (fill !== void 0) { 1045 return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); 1046 } 1047 return createBuffer(size); 1048 } 1049 Buffer2.alloc = function(size, fill, encoding) { 1050 return alloc(size, fill, encoding); 1051 }; 1052 function allocUnsafe(size) { 1053 assertSize(size); 1054 return createBuffer(size < 0 ? 0 : checked(size) | 0); 1055 } 1056 Buffer2.allocUnsafe = function(size) { 1057 return allocUnsafe(size); 1058 }; 1059 Buffer2.allocUnsafeSlow = function(size) { 1060 return allocUnsafe(size); 1061 }; 1062 function fromString(string, encoding) { 1063 if (typeof encoding !== "string" || encoding === "") { 1064 encoding = "utf8"; 1065 } 1066 if (!Buffer2.isEncoding(encoding)) { 1067 throw new TypeError("Unknown encoding: " + encoding); 1068 } 1069 var length = byteLength(string, encoding) | 0; 1070 var buf = createBuffer(length); 1071 var actual = buf.write(string, encoding); 1072 if (actual !== length) { 1073 buf = buf.slice(0, actual); 1074 } 1075 return buf; 1076 } 1077 function fromArrayLike(array) { 1078 var length = array.length < 0 ? 0 : checked(array.length) | 0; 1079 var buf = createBuffer(length); 1080 for (var i = 0; i < length; i += 1) { 1081 buf[i] = array[i] & 255; 1082 } 1083 return buf; 1084 } 1085 function fromArrayView(arrayView) { 1086 if (isInstance(arrayView, Uint8Array)) { 1087 var copy = new Uint8Array(arrayView); 1088 return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); 1089 } 1090 return fromArrayLike(arrayView); 1091 } 1092 function fromArrayBuffer(array, byteOffset, length) { 1093 if (byteOffset < 0 || array.byteLength < byteOffset) { 1094 throw new RangeError('"offset" is outside of buffer bounds'); 1095 } 1096 if (array.byteLength < byteOffset + (length || 0)) { 1097 throw new RangeError('"length" is outside of buffer bounds'); 1098 } 1099 var buf; 1100 if (byteOffset === void 0 && length === void 0) { 1101 buf = new Uint8Array(array); 1102 } else if (length === void 0) { 1103 buf = new Uint8Array(array, byteOffset); 1104 } else { 1105 buf = new Uint8Array(array, byteOffset, length); 1106 } 1107 Object.setPrototypeOf(buf, Buffer2.prototype); 1108 return buf; 1109 } 1110 function fromObject(obj) { 1111 if (Buffer2.isBuffer(obj)) { 1112 var len = checked(obj.length) | 0; 1113 var buf = createBuffer(len); 1114 if (buf.length === 0) { 1115 return buf; 1116 } 1117 obj.copy(buf, 0, 0, len); 1118 return buf; 1119 } 1120 if (obj.length !== void 0) { 1121 if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { 1122 return createBuffer(0); 1123 } 1124 return fromArrayLike(obj); 1125 } 1126 if (obj.type === "Buffer" && Array.isArray(obj.data)) { 1127 return fromArrayLike(obj.data); 1128 } 1129 } 1130 function checked(length) { 1131 if (length >= K_MAX_LENGTH) { 1132 throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); 1133 } 1134 return length | 0; 1135 } 1136 function SlowBuffer(length) { 1137 if (+length != length) { 1138 length = 0; 1139 } 1140 return Buffer2.alloc(+length); 1141 } 1142 Buffer2.isBuffer = function isBuffer(b) { 1143 return b != null && b._isBuffer === true && b !== Buffer2.prototype; 1144 }; 1145 Buffer2.compare = function compare(a, b) { 1146 if (isInstance(a, Uint8Array)) 1147 a = Buffer2.from(a, a.offset, a.byteLength); 1148 if (isInstance(b, Uint8Array)) 1149 b = Buffer2.from(b, b.offset, b.byteLength); 1150 if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) { 1151 throw new TypeError( 1152 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' 1153 ); 1154 } 1155 if (a === b) 1156 return 0; 1157 var x = a.length; 1158 var y = b.length; 1159 for (var i = 0, len = Math.min(x, y); i < len; ++i) { 1160 if (a[i] !== b[i]) { 1161 x = a[i]; 1162 y = b[i]; 1163 break; 1164 } 1165 } 1166 if (x < y) 1167 return -1; 1168 if (y < x) 1169 return 1; 1170 return 0; 1171 }; 1172 Buffer2.isEncoding = function isEncoding(encoding) { 1173 switch (String(encoding).toLowerCase()) { 1174 case "hex": 1175 case "utf8": 1176 case "utf-8": 1177 case "ascii": 1178 case "latin1": 1179 case "binary": 1180 case "base64": 1181 case "ucs2": 1182 case "ucs-2": 1183 case "utf16le": 1184 case "utf-16le": 1185 return true; 1186 default: 1187 return false;
vendor: 5,590 bytes, lines 1188-1367
1188 } 1189 }; 1190 Buffer2.concat = function concat(list, length) { 1191 if (!Array.isArray(list)) { 1192 throw new TypeError('"list" argument must be an Array of Buffers'); 1193 } 1194 if (list.length === 0) { 1195 return Buffer2.alloc(0); 1196 } 1197 var i; 1198 if (length === void 0) { 1199 length = 0; 1200 for (i = 0; i < list.length; ++i) { 1201 length += list[i].length; 1202 } 1203 } 1204 var buffer2 = Buffer2.allocUnsafe(length); 1205 var pos = 0; 1206 for (i = 0; i < list.length; ++i) { 1207 var buf = list[i]; 1208 if (isInstance(buf, Uint8Array)) { 1209 if (pos + buf.length > buffer2.length) { 1210 Buffer2.from(buf).copy(buffer2, pos); 1211 } else { 1212 Uint8Array.prototype.set.call( 1213 buffer2, 1214 buf, 1215 pos 1216 ); 1217 } 1218 } else if (!Buffer2.isBuffer(buf)) { 1219 throw new TypeError('"list" argument must be an Array of Buffers'); 1220 } else { 1221 buf.copy(buffer2, pos); 1222 } 1223 pos += buf.length; 1224 } 1225 return buffer2; 1226 }; 1227 function byteLength(string, encoding) { 1228 if (Buffer2.isBuffer(string)) { 1229 return string.length; 1230 } 1231 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { 1232 return string.byteLength; 1233 } 1234 if (typeof string !== "string") { 1235 throw new TypeError( 1236 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string 1237 ); 1238 } 1239 var len = string.length; 1240 var mustMatch = arguments.length > 2 && arguments[2] === true; 1241 if (!mustMatch && len === 0) 1242 return 0; 1243 var loweredCase = false; 1244 for (; ; ) { 1245 switch (encoding) { 1246 case "ascii": 1247 case "latin1": 1248 case "binary": 1249 return len; 1250 case "utf8": 1251 case "utf-8": 1252 return utf8ToBytes(string).length; 1253 case "ucs2": 1254 case "ucs-2": 1255 case "utf16le": 1256 case "utf-16le": 1257 return len * 2; 1258 case "hex": 1259 return len >>> 1; 1260 case "base64": 1261 return base64ToBytes(string).length; 1262 default: 1263 if (loweredCase) { 1264 return mustMatch ? -1 : utf8ToBytes(string).length; 1265 } 1266 encoding = ("" + encoding).toLowerCase(); 1267 loweredCase = true; 1268 } 1269 } 1270 } 1271 Buffer2.byteLength = byteLength; 1272 function slowToString(encoding, start, end) { 1273 var loweredCase = false; 1274 if (start === void 0 || start < 0) { 1275 start = 0; 1276 } 1277 if (start > this.length) { 1278 return ""; 1279 } 1280 if (end === void 0 || end > this.length) { 1281 end = this.length; 1282 } 1283 if (end <= 0) { 1284 return ""; 1285 } 1286 end >>>= 0; 1287 start >>>= 0; 1288 if (end <= start) { 1289 return ""; 1290 } 1291 if (!encoding) 1292 encoding = "utf8"; 1293 while (true) { 1294 switch (encoding) { 1295 case "hex": 1296 return hexSlice(this, start, end); 1297 case "utf8": 1298 case "utf-8": 1299 return utf8Slice(this, start, end); 1300 case "ascii": 1301 return asciiSlice(this, start, end); 1302 case "latin1": 1303 case "binary": 1304 return latin1Slice(this, start, end); 1305 case "base64": 1306 return base64Slice(this, start, end); 1307 case "ucs2": 1308 case "ucs-2": 1309 case "utf16le": 1310 case "utf-16le": 1311 return utf16leSlice(this, start, end); 1312 default: 1313 if (loweredCase) 1314 throw new TypeError("Unknown encoding: " + encoding); 1315 encoding = (encoding + "").toLowerCase(); 1316 loweredCase = true; 1317 } 1318 } 1319 } 1320 Buffer2.prototype._isBuffer = true; 1321 function swap(b, n, m) { 1322 var i = b[n]; 1323 b[n] = b[m]; 1324 b[m] = i; 1325 } 1326 Buffer2.prototype.swap16 = function swap16() { 1327 var len = this.length; 1328 if (len % 2 !== 0) { 1329 throw new RangeError("Buffer size must be a multiple of 16-bits"); 1330 } 1331 for (var i = 0; i < len; i += 2) { 1332 swap(this, i, i + 1); 1333 } 1334 return this; 1335 }; 1336 Buffer2.prototype.swap32 = function swap32() { 1337 var len = this.length; 1338 if (len % 4 !== 0) { 1339 throw new RangeError("Buffer size must be a multiple of 32-bits"); 1340 } 1341 for (var i = 0; i < len; i += 4) { 1342 swap(this, i, i + 3); 1343 swap(this, i + 1, i + 2); 1344 } 1345 return this; 1346 }; 1347 Buffer2.prototype.swap64 = function swap64() { 1348 var len = this.length; 1349 if (len % 8 !== 0) { 1350 throw new RangeError("Buffer size must be a multiple of 64-bits"); 1351 } 1352 for (var i = 0; i < len; i += 8) { 1353 swap(this, i, i + 7); 1354 swap(this, i + 1, i + 6); 1355 swap(this, i + 2, i + 5); 1356 swap(this, i + 3, i + 4); 1357 } 1358 return this; 1359 }; 1360 Buffer2.prototype.toString = function toString() { 1361 var length = this.length; 1362 if (length === 0) 1363 return ""; 1364 if (arguments.length === 0) 1365 return utf8Slice(this, 0, length); 1366 return slowToString.apply(this, arguments); 1367 };
vendor: 16,378 bytes, lines 1368-1837
1368 Buffer2.prototype.toLocaleString = Buffer2.prototype.toString; 1369 Buffer2.prototype.equals = function equals(b) { 1370 if (!Buffer2.isBuffer(b)) 1371 throw new TypeError("Argument must be a Buffer"); 1372 if (this === b) 1373 return true; 1374 return Buffer2.compare(this, b) === 0; 1375 }; 1376 Buffer2.prototype.inspect = function inspect() { 1377 var str = ""; 1378 var max = exports3.INSPECT_MAX_BYTES; 1379 str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); 1380 if (this.length > max) 1381 str += " ... "; 1382 return "<Buffer " + str + ">"; 1383 }; 1384 if (customInspectSymbol) { 1385 Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect; 1386 } 1387 Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { 1388 if (isInstance(target, Uint8Array)) { 1389 target = Buffer2.from(target, target.offset, target.byteLength); 1390 } 1391 if (!Buffer2.isBuffer(target)) { 1392 throw new TypeError( 1393 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target 1394 ); 1395 } 1396 if (start === void 0) { 1397 start = 0; 1398 } 1399 if (end === void 0) { 1400 end = target ? target.length : 0; 1401 } 1402 if (thisStart === void 0) { 1403 thisStart = 0; 1404 } 1405 if (thisEnd === void 0) { 1406 thisEnd = this.length; 1407 } 1408 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { 1409 throw new RangeError("out of range index"); 1410 } 1411 if (thisStart >= thisEnd && start >= end) { 1412 return 0; 1413 } 1414 if (thisStart >= thisEnd) { 1415 return -1; 1416 } 1417 if (start >= end) { 1418 return 1; 1419 } 1420 start >>>= 0; 1421 end >>>= 0; 1422 thisStart >>>= 0; 1423 thisEnd >>>= 0; 1424 if (this === target) 1425 return 0; 1426 var x = thisEnd - thisStart; 1427 var y = end - start; 1428 var len = Math.min(x, y); 1429 var thisCopy = this.slice(thisStart, thisEnd); 1430 var targetCopy = target.slice(start, end); 1431 for (var i = 0; i < len; ++i) { 1432 if (thisCopy[i] !== targetCopy[i]) { 1433 x = thisCopy[i]; 1434 y = targetCopy[i]; 1435 break; 1436 } 1437 } 1438 if (x < y) 1439 return -1; 1440 if (y < x) 1441 return 1; 1442 return 0; 1443 }; 1444 function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) { 1445 if (buffer2.length === 0) 1446 return -1; 1447 if (typeof byteOffset === "string") { 1448 encoding = byteOffset; 1449 byteOffset = 0; 1450 } else if (byteOffset > 2147483647) { 1451 byteOffset = 2147483647; 1452 } else if (byteOffset < -2147483648) { 1453 byteOffset = -2147483648; 1454 } 1455 byteOffset = +byteOffset; 1456 if (numberIsNaN(byteOffset)) { 1457 byteOffset = dir ? 0 : buffer2.length - 1; 1458 } 1459 if (byteOffset < 0) 1460 byteOffset = buffer2.length + byteOffset; 1461 if (byteOffset >= buffer2.length) { 1462 if (dir) 1463 return -1; 1464 else 1465 byteOffset = buffer2.length - 1; 1466 } else if (byteOffset < 0) { 1467 if (dir) 1468 byteOffset = 0; 1469 else 1470 return -1; 1471 } 1472 if (typeof val === "string") { 1473 val = Buffer2.from(val, encoding); 1474 } 1475 if (Buffer2.isBuffer(val)) { 1476 if (val.length === 0) { 1477 return -1; 1478 } 1479 return arrayIndexOf(buffer2, val, byteOffset, encoding, dir); 1480 } else if (typeof val === "number") { 1481 val = val & 255; 1482 if (typeof Uint8Array.prototype.indexOf === "function") { 1483 if (dir) { 1484 return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset); 1485 } else { 1486 return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset); 1487 } 1488 } 1489 return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir); 1490 } 1491 throw new TypeError("val must be string, number or Buffer"); 1492 } 1493 function arrayIndexOf(arr, val, byteOffset, encoding, dir) { 1494 var indexSize = 1; 1495 var arrLength = arr.length; 1496 var valLength = val.length; 1497 if (encoding !== void 0) { 1498 encoding = String(encoding).toLowerCase(); 1499 if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { 1500 if (arr.length < 2 || val.length < 2) { 1501 return -1; 1502 } 1503 indexSize = 2; 1504 arrLength /= 2; 1505 valLength /= 2; 1506 byteOffset /= 2; 1507 } 1508 } 1509 function read(buf, i2) { 1510 if (indexSize === 1) { 1511 return buf[i2]; 1512 } else { 1513 return buf.readUInt16BE(i2 * indexSize); 1514 } 1515 } 1516 var i; 1517 if (dir) { 1518 var foundIndex = -1; 1519 for (i = byteOffset; i < arrLength; i++) { 1520 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { 1521 if (foundIndex === -1) 1522 foundIndex = i; 1523 if (i - foundIndex + 1 === valLength) 1524 return foundIndex * indexSize; 1525 } else { 1526 if (foundIndex !== -1) 1527 i -= i - foundIndex; 1528 foundIndex = -1; 1529 } 1530 } 1531 } else { 1532 if (byteOffset + valLength > arrLength) 1533 byteOffset = arrLength - valLength; 1534 for (i = byteOffset; i >= 0; i--) { 1535 var found = true; 1536 for (var j = 0; j < valLength; j++) { 1537 if (read(arr, i + j) !== read(val, j)) { 1538 found = false; 1539 break; 1540 } 1541 } 1542 if (found) 1543 return i; 1544 } 1545 } 1546 return -1; 1547 } 1548 Buffer2.prototype.includes = function includes(val, byteOffset, encoding) { 1549 return this.indexOf(val, byteOffset, encoding) !== -1; 1550 }; 1551 Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) { 1552 return bidirectionalIndexOf(this, val, byteOffset, encoding, true); 1553 }; 1554 Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { 1555 return bidirectionalIndexOf(this, val, byteOffset, encoding, false); 1556 }; 1557 function hexWrite(buf, string, offset, length) { 1558 offset = Number(offset) || 0; 1559 var remaining = buf.length - offset; 1560 if (!length) { 1561 length = remaining; 1562 } else { 1563 length = Number(length); 1564 if (length > remaining) { 1565 length = remaining; 1566 } 1567 } 1568 var strLen = string.length; 1569 if (length > strLen / 2) { 1570 length = strLen / 2; 1571 } 1572 for (var i = 0; i < length; ++i) { 1573 var parsed = parseInt(string.substr(i * 2, 2), 16); 1574 if (numberIsNaN(parsed)) 1575 return i; 1576 buf[offset + i] = parsed; 1577 } 1578 return i; 1579 } 1580 function utf8Write(buf, string, offset, length) { 1581 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); 1582 } 1583 function asciiWrite(buf, string, offset, length) { 1584 return blitBuffer(asciiToBytes(string), buf, offset, length); 1585 } 1586 function base64Write(buf, string, offset, length) { 1587 return blitBuffer(base64ToBytes(string), buf, offset, length); 1588 } 1589 function ucs2Write(buf, string, offset, length) { 1590 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); 1591 } 1592 Buffer2.prototype.write = function write(string, offset, length, encoding) { 1593 if (offset === void 0) { 1594 encoding = "utf8"; 1595 length = this.length; 1596 offset = 0; 1597 } else if (length === void 0 && typeof offset === "string") { 1598 encoding = offset; 1599 length = this.length; 1600 offset = 0; 1601 } else if (isFinite(offset)) { 1602 offset = offset >>> 0; 1603 if (isFinite(length)) { 1604 length = length >>> 0; 1605 if (encoding === void 0) 1606 encoding = "utf8"; 1607 } else { 1608 encoding = length; 1609 length = void 0; 1610 } 1611 } else { 1612 throw new Error( 1613 "Buffer.write(string, encoding, offset[, length]) is no longer supported" 1614 ); 1615 } 1616 var remaining = this.length - offset; 1617 if (length === void 0 || length > remaining) 1618 length = remaining; 1619 if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { 1620 throw new RangeError("Attempt to write outside buffer bounds"); 1621 } 1622 if (!encoding) 1623 encoding = "utf8"; 1624 var loweredCase = false; 1625 for (; ; ) { 1626 switch (encoding) { 1627 case "hex": 1628 return hexWrite(this, string, offset, length); 1629 case "utf8": 1630 case "utf-8": 1631 return utf8Write(this, string, offset, length); 1632 case "ascii": 1633 case "latin1": 1634 case "binary": 1635 return asciiWrite(this, string, offset, length); 1636 case "base64": 1637 return base64Write(this, string, offset, length); 1638 case "ucs2": 1639 case "ucs-2": 1640 case "utf16le": 1641 case "utf-16le": 1642 return ucs2Write(this, string, offset, length); 1643 default: 1644 if (loweredCase) 1645 throw new TypeError("Unknown encoding: " + encoding); 1646 encoding = ("" + encoding).toLowerCase(); 1647 loweredCase = true; 1648 } 1649 } 1650 }; 1651 Buffer2.prototype.toJSON = function toJSON() { 1652 return { 1653 type: "Buffer", 1654 data: Array.prototype.slice.call(this._arr || this, 0) 1655 }; 1656 }; 1657 function base64Slice(buf, start, end) { 1658 if (start === 0 && end === buf.length) { 1659 return base64.fromByteArray(buf); 1660 } else { 1661 return base64.fromByteArray(buf.slice(start, end)); 1662 } 1663 } 1664 function utf8Slice(buf, start, end) { 1665 end = Math.min(buf.length, end); 1666 var res = []; 1667 var i = start; 1668 while (i < end) { 1669 var firstByte = buf[i]; 1670 var codePoint = null; 1671 var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; 1672 if (i + bytesPerSequence <= end) { 1673 var secondByte, thirdByte, fourthByte, tempCodePoint; 1674 switch (bytesPerSequence) { 1675 case 1: 1676 if (firstByte < 128) { 1677 codePoint = firstByte; 1678 } 1679 break; 1680 case 2: 1681 secondByte = buf[i + 1]; 1682 if ((secondByte & 192) === 128) { 1683 tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; 1684 if (tempCodePoint > 127) { 1685 codePoint = tempCodePoint; 1686 } 1687 } 1688 break; 1689 case 3: 1690 secondByte = buf[i + 1]; 1691 thirdByte = buf[i + 2]; 1692 if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { 1693 tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; 1694 if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { 1695 codePoint = tempCodePoint; 1696 } 1697 } 1698 break; 1699 case 4: 1700 secondByte = buf[i + 1]; 1701 thirdByte = buf[i + 2]; 1702 fourthByte = buf[i + 3]; 1703 if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { 1704 tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; 1705 if (tempCodePoint > 65535 && tempCodePoint < 1114112) { 1706 codePoint = tempCodePoint; 1707 } 1708 } 1709 } 1710 } 1711 if (codePoint === null) { 1712 codePoint = 65533; 1713 bytesPerSequence = 1; 1714 } else if (codePoint > 65535) { 1715 codePoint -= 65536; 1716 res.push(codePoint >>> 10 & 1023 | 55296); 1717 codePoint = 56320 | codePoint & 1023; 1718 } 1719 res.push(codePoint); 1720 i += bytesPerSequence; 1721 } 1722 return decodeCodePointsArray(res); 1723 } 1724 var MAX_ARGUMENTS_LENGTH = 4096; 1725 function decodeCodePointsArray(codePoints) { 1726 var len = codePoints.length; 1727 if (len <= MAX_ARGUMENTS_LENGTH) { 1728 return String.fromCharCode.apply(String, codePoints); 1729 } 1730 var res = ""; 1731 var i = 0; 1732 while (i < len) { 1733 res += String.fromCharCode.apply( 1734 String, 1735 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) 1736 ); 1737 } 1738 return res; 1739 } 1740 function asciiSlice(buf, start, end) { 1741 var ret = ""; 1742 end = Math.min(buf.length, end); 1743 for (var i = start; i < end; ++i) { 1744 ret += String.fromCharCode(buf[i] & 127); 1745 } 1746 return ret; 1747 } 1748 function latin1Slice(buf, start, end) { 1749 var ret = ""; 1750 end = Math.min(buf.length, end); 1751 for (var i = start; i < end; ++i) { 1752 ret += String.fromCharCode(buf[i]); 1753 } 1754 return ret; 1755 } 1756 function hexSlice(buf, start, end) { 1757 var len = buf.length; 1758 if (!start || start < 0) 1759 start = 0; 1760 if (!end || end < 0 || end > len) 1761 end = len; 1762 var out = ""; 1763 for (var i = start; i < end; ++i) { 1764 out += hexSliceLookupTable[buf[i]]; 1765 } 1766 return out; 1767 } 1768 function utf16leSlice(buf, start, end) { 1769 var bytes = buf.slice(start, end); 1770 var res = ""; 1771 for (var i = 0; i < bytes.length - 1; i += 2) { 1772 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); 1773 } 1774 return res; 1775 } 1776 Buffer2.prototype.slice = function slice(start, end) { 1777 var len = this.length; 1778 start = ~~start; 1779 end = end === void 0 ? len : ~~end; 1780 if (start < 0) { 1781 start += len; 1782 if (start < 0) 1783 start = 0; 1784 } else if (start > len) { 1785 start = len; 1786 } 1787 if (end < 0) { 1788 end += len; 1789 if (end < 0) 1790 end = 0; 1791 } else if (end > len) { 1792 end = len; 1793 } 1794 if (end < start) 1795 end = start; 1796 var newBuf = this.subarray(start, end); 1797 Object.setPrototypeOf(newBuf, Buffer2.prototype); 1798 return newBuf; 1799 }; 1800 function checkOffset(offset, ext, length) { 1801 if (offset % 1 !== 0 || offset < 0) 1802 throw new RangeError("offset is not uint"); 1803 if (offset + ext > length) 1804 throw new RangeError("Trying to access beyond buffer length"); 1805 } 1806 Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { 1807 offset = offset >>> 0; 1808 byteLength2 = byteLength2 >>> 0; 1809 if (!noAssert) 1810 checkOffset(offset, byteLength2, this.length); 1811 var val = this[offset]; 1812 var mul = 1; 1813 var i = 0; 1814 while (++i < byteLength2 && (mul *= 256)) { 1815 val += this[offset + i] * mul; 1816 } 1817 return val; 1818 }; 1819 Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { 1820 offset = offset >>> 0; 1821 byteLength2 = byteLength2 >>> 0; 1822 if (!noAssert) { 1823 checkOffset(offset, byteLength2, this.length); 1824 } 1825 var val = this[offset + --byteLength2]; 1826 var mul = 1; 1827 while (byteLength2 > 0 && (mul *= 256)) { 1828 val += this[offset + --byteLength2] * mul; 1829 } 1830 return val; 1831 }; 1832 Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) { 1833 offset = offset >>> 0; 1834 if (!noAssert) 1835 checkOffset(offset, 1, this.length); 1836 return this[offset]; 1837 };
vendor: 20,454 bytes, lines 1838-2383
1838 Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { 1839 offset = offset >>> 0; 1840 if (!noAssert) 1841 checkOffset(offset, 2, this.length); 1842 return this[offset] | this[offset + 1] << 8; 1843 }; 1844 Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { 1845 offset = offset >>> 0; 1846 if (!noAssert) 1847 checkOffset(offset, 2, this.length); 1848 return this[offset] << 8 | this[offset + 1]; 1849 }; 1850 Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { 1851 offset = offset >>> 0; 1852 if (!noAssert) 1853 checkOffset(offset, 4, this.length); 1854 return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; 1855 }; 1856 Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { 1857 offset = offset >>> 0; 1858 if (!noAssert) 1859 checkOffset(offset, 4, this.length); 1860 return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); 1861 }; 1862 Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { 1863 offset = offset >>> 0; 1864 byteLength2 = byteLength2 >>> 0; 1865 if (!noAssert) 1866 checkOffset(offset, byteLength2, this.length); 1867 var val = this[offset]; 1868 var mul = 1; 1869 var i = 0; 1870 while (++i < byteLength2 && (mul *= 256)) { 1871 val += this[offset + i] * mul; 1872 } 1873 mul *= 128; 1874 if (val >= mul) 1875 val -= Math.pow(2, 8 * byteLength2); 1876 return val; 1877 }; 1878 Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { 1879 offset = offset >>> 0; 1880 byteLength2 = byteLength2 >>> 0; 1881 if (!noAssert) 1882 checkOffset(offset, byteLength2, this.length); 1883 var i = byteLength2; 1884 var mul = 1; 1885 var val = this[offset + --i]; 1886 while (i > 0 && (mul *= 256)) { 1887 val += this[offset + --i] * mul; 1888 } 1889 mul *= 128; 1890 if (val >= mul) 1891 val -= Math.pow(2, 8 * byteLength2); 1892 return val; 1893 }; 1894 Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) { 1895 offset = offset >>> 0; 1896 if (!noAssert) 1897 checkOffset(offset, 1, this.length); 1898 if (!(this[offset] & 128)) 1899 return this[offset]; 1900 return (255 - this[offset] + 1) * -1; 1901 }; 1902 Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) { 1903 offset = offset >>> 0; 1904 if (!noAssert) 1905 checkOffset(offset, 2, this.length); 1906 var val = this[offset] | this[offset + 1] << 8; 1907 return val & 32768 ? val | 4294901760 : val; 1908 }; 1909 Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) { 1910 offset = offset >>> 0; 1911 if (!noAssert) 1912 checkOffset(offset, 2, this.length); 1913 var val = this[offset + 1] | this[offset] << 8; 1914 return val & 32768 ? val | 4294901760 : val; 1915 }; 1916 Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) { 1917 offset = offset >>> 0; 1918 if (!noAssert) 1919 checkOffset(offset, 4, this.length); 1920 return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; 1921 }; 1922 Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) { 1923 offset = offset >>> 0; 1924 if (!noAssert) 1925 checkOffset(offset, 4, this.length); 1926 return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; 1927 }; 1928 Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) { 1929 offset = offset >>> 0; 1930 if (!noAssert) 1931 checkOffset(offset, 4, this.length); 1932 return ieee7542.read(this, offset, true, 23, 4); 1933 }; 1934 Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) { 1935 offset = offset >>> 0; 1936 if (!noAssert) 1937 checkOffset(offset, 4, this.length); 1938 return ieee7542.read(this, offset, false, 23, 4); 1939 }; 1940 Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { 1941 offset = offset >>> 0; 1942 if (!noAssert) 1943 checkOffset(offset, 8, this.length); 1944 return ieee7542.read(this, offset, true, 52, 8); 1945 }; 1946 Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { 1947 offset = offset >>> 0; 1948 if (!noAssert) 1949 checkOffset(offset, 8, this.length); 1950 return ieee7542.read(this, offset, false, 52, 8); 1951 }; 1952 function checkInt(buf, value, offset, ext, max, min) { 1953 if (!Buffer2.isBuffer(buf)) 1954 throw new TypeError('"buffer" argument must be a Buffer instance'); 1955 if (value > max || value < min) 1956 throw new RangeError('"value" argument is out of bounds'); 1957 if (offset + ext > buf.length) 1958 throw new RangeError("Index out of range"); 1959 } 1960 Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { 1961 value = +value; 1962 offset = offset >>> 0; 1963 byteLength2 = byteLength2 >>> 0; 1964 if (!noAssert) { 1965 var maxBytes = Math.pow(2, 8 * byteLength2) - 1; 1966 checkInt(this, value, offset, byteLength2, maxBytes, 0); 1967 } 1968 var mul = 1; 1969 var i = 0; 1970 this[offset] = value & 255; 1971 while (++i < byteLength2 && (mul *= 256)) { 1972 this[offset + i] = value / mul & 255; 1973 } 1974 return offset + byteLength2; 1975 }; 1976 Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { 1977 value = +value; 1978 offset = offset >>> 0; 1979 byteLength2 = byteLength2 >>> 0; 1980 if (!noAssert) { 1981 var maxBytes = Math.pow(2, 8 * byteLength2) - 1; 1982 checkInt(this, value, offset, byteLength2, maxBytes, 0); 1983 } 1984 var i = byteLength2 - 1; 1985 var mul = 1; 1986 this[offset + i] = value & 255; 1987 while (--i >= 0 && (mul *= 256)) { 1988 this[offset + i] = value / mul & 255; 1989 } 1990 return offset + byteLength2; 1991 }; 1992 Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { 1993 value = +value; 1994 offset = offset >>> 0; 1995 if (!noAssert) 1996 checkInt(this, value, offset, 1, 255, 0); 1997 this[offset] = value & 255; 1998 return offset + 1; 1999 }; 2000 Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { 2001 value = +value; 2002 offset = offset >>> 0; 2003 if (!noAssert) 2004 checkInt(this, value, offset, 2, 65535, 0); 2005 this[offset] = value & 255; 2006 this[offset + 1] = value >>> 8; 2007 return offset + 2; 2008 }; 2009 Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { 2010 value = +value; 2011 offset = offset >>> 0; 2012 if (!noAssert) 2013 checkInt(this, value, offset, 2, 65535, 0); 2014 this[offset] = value >>> 8; 2015 this[offset + 1] = value & 255; 2016 return offset + 2; 2017 }; 2018 Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { 2019 value = +value; 2020 offset = offset >>> 0; 2021 if (!noAssert) 2022 checkInt(this, value, offset, 4, 4294967295, 0); 2023 this[offset + 3] = value >>> 24; 2024 this[offset + 2] = value >>> 16; 2025 this[offset + 1] = value >>> 8; 2026 this[offset] = value & 255; 2027 return offset + 4; 2028 }; 2029 Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { 2030 value = +value; 2031 offset = offset >>> 0; 2032 if (!noAssert) 2033 checkInt(this, value, offset, 4, 4294967295, 0); 2034 this[offset] = value >>> 24; 2035 this[offset + 1] = value >>> 16; 2036 this[offset + 2] = value >>> 8; 2037 this[offset + 3] = value & 255; 2038 return offset + 4; 2039 }; 2040 Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { 2041 value = +value; 2042 offset = offset >>> 0; 2043 if (!noAssert) { 2044 var limit = Math.pow(2, 8 * byteLength2 - 1); 2045 checkInt(this, value, offset, byteLength2, limit - 1, -limit); 2046 } 2047 var i = 0; 2048 var mul = 1; 2049 var sub = 0; 2050 this[offset] = value & 255; 2051 while (++i < byteLength2 && (mul *= 256)) { 2052 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { 2053 sub = 1; 2054 } 2055 this[offset + i] = (value / mul >> 0) - sub & 255; 2056 } 2057 return offset + byteLength2; 2058 }; 2059 Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { 2060 value = +value; 2061 offset = offset >>> 0; 2062 if (!noAssert) { 2063 var limit = Math.pow(2, 8 * byteLength2 - 1); 2064 checkInt(this, value, offset, byteLength2, limit - 1, -limit); 2065 } 2066 var i = byteLength2 - 1; 2067 var mul = 1; 2068 var sub = 0; 2069 this[offset + i] = value & 255; 2070 while (--i >= 0 && (mul *= 256)) { 2071 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { 2072 sub = 1; 2073 } 2074 this[offset + i] = (value / mul >> 0) - sub & 255; 2075 } 2076 return offset + byteLength2; 2077 }; 2078 Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { 2079 value = +value; 2080 offset = offset >>> 0; 2081 if (!noAssert) 2082 checkInt(this, value, offset, 1, 127, -128); 2083 if (value < 0) 2084 value = 255 + value + 1; 2085 this[offset] = value & 255; 2086 return offset + 1; 2087 }; 2088 Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { 2089 value = +value; 2090 offset = offset >>> 0; 2091 if (!noAssert) 2092 checkInt(this, value, offset, 2, 32767, -32768); 2093 this[offset] = value & 255; 2094 this[offset + 1] = value >>> 8; 2095 return offset + 2; 2096 }; 2097 Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { 2098 value = +value; 2099 offset = offset >>> 0; 2100 if (!noAssert) 2101 checkInt(this, value, offset, 2, 32767, -32768); 2102 this[offset] = value >>> 8; 2103 this[offset + 1] = value & 255; 2104 return offset + 2; 2105 }; 2106 Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { 2107 value = +value; 2108 offset = offset >>> 0; 2109 if (!noAssert) 2110 checkInt(this, value, offset, 4, 2147483647, -2147483648); 2111 this[offset] = value & 255; 2112 this[offset + 1] = value >>> 8; 2113 this[offset + 2] = value >>> 16; 2114 this[offset + 3] = value >>> 24; 2115 return offset + 4; 2116 }; 2117 Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { 2118 value = +value; 2119 offset = offset >>> 0; 2120 if (!noAssert) 2121 checkInt(this, value, offset, 4, 2147483647, -2147483648); 2122 if (value < 0) 2123 value = 4294967295 + value + 1; 2124 this[offset] = value >>> 24; 2125 this[offset + 1] = value >>> 16; 2126 this[offset + 2] = value >>> 8; 2127 this[offset + 3] = value & 255; 2128 return offset + 4; 2129 }; 2130 function checkIEEE754(buf, value, offset, ext, max, min) { 2131 if (offset + ext > buf.length) 2132 throw new RangeError("Index out of range"); 2133 if (offset < 0) 2134 throw new RangeError("Index out of range"); 2135 } 2136 function writeFloat(buf, value, offset, littleEndian, noAssert) { 2137 value = +value; 2138 offset = offset >>> 0; 2139 if (!noAssert) { 2140 checkIEEE754(buf, value, offset, 4); 2141 } 2142 ieee7542.write(buf, value, offset, littleEndian, 23, 4); 2143 return offset + 4; 2144 } 2145 Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { 2146 return writeFloat(this, value, offset, true, noAssert); 2147 }; 2148 Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { 2149 return writeFloat(this, value, offset, false, noAssert); 2150 }; 2151 function writeDouble(buf, value, offset, littleEndian, noAssert) { 2152 value = +value; 2153 offset = offset >>> 0; 2154 if (!noAssert) { 2155 checkIEEE754(buf, value, offset, 8); 2156 } 2157 ieee7542.write(buf, value, offset, littleEndian, 52, 8); 2158 return offset + 8; 2159 } 2160 Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { 2161 return writeDouble(this, value, offset, true, noAssert); 2162 }; 2163 Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { 2164 return writeDouble(this, value, offset, false, noAssert); 2165 }; 2166 Buffer2.prototype.copy = function copy(target, targetStart, start, end) { 2167 if (!Buffer2.isBuffer(target)) 2168 throw new TypeError("argument should be a Buffer"); 2169 if (!start) 2170 start = 0; 2171 if (!end && end !== 0) 2172 end = this.length; 2173 if (targetStart >= target.length) 2174 targetStart = target.length; 2175 if (!targetStart) 2176 targetStart = 0; 2177 if (end > 0 && end < start) 2178 end = start; 2179 if (end === start) 2180 return 0; 2181 if (target.length === 0 || this.length === 0) 2182 return 0; 2183 if (targetStart < 0) { 2184 throw new RangeError("targetStart out of bounds"); 2185 } 2186 if (start < 0 || start >= this.length) 2187 throw new RangeError("Index out of range"); 2188 if (end < 0) 2189 throw new RangeError("sourceEnd out of bounds"); 2190 if (end > this.length) 2191 end = this.length; 2192 if (target.length - targetStart < end - start) { 2193 end = target.length - targetStart + start; 2194 } 2195 var len = end - start; 2196 if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { 2197 this.copyWithin(targetStart, start, end); 2198 } else { 2199 Uint8Array.prototype.set.call( 2200 target, 2201 this.subarray(start, end), 2202 targetStart 2203 ); 2204 } 2205 return len; 2206 }; 2207 Buffer2.prototype.fill = function fill(val, start, end, encoding) { 2208 if (typeof val === "string") { 2209 if (typeof start === "string") { 2210 encoding = start; 2211 start = 0; 2212 end = this.length; 2213 } else if (typeof end === "string") { 2214 encoding = end; 2215 end = this.length; 2216 } 2217 if (encoding !== void 0 && typeof encoding !== "string") { 2218 throw new TypeError("encoding must be a string"); 2219 } 2220 if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) { 2221 throw new TypeError("Unknown encoding: " + encoding); 2222 } 2223 if (val.length === 1) { 2224 var code = val.charCodeAt(0); 2225 if (encoding === "utf8" && code < 128 || encoding === "latin1") { 2226 val = code; 2227 } 2228 } 2229 } else if (typeof val === "number") { 2230 val = val & 255; 2231 } else if (typeof val === "boolean") { 2232 val = Number(val); 2233 } 2234 if (start < 0 || this.length < start || this.length < end) { 2235 throw new RangeError("Out of range index"); 2236 } 2237 if (end <= start) { 2238 return this; 2239 } 2240 start = start >>> 0; 2241 end = end === void 0 ? this.length : end >>> 0; 2242 if (!val) 2243 val = 0; 2244 var i; 2245 if (typeof val === "number") { 2246 for (i = start; i < end; ++i) { 2247 this[i] = val; 2248 } 2249 } else { 2250 var bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding); 2251 var len = bytes.length; 2252 if (len === 0) { 2253 throw new TypeError('The value "' + val + '" is invalid for argument "value"'); 2254 } 2255 for (i = 0; i < end - start; ++i) { 2256 this[i + start] = bytes[i % len]; 2257 } 2258 } 2259 return this; 2260 }; 2261 var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; 2262 function base64clean(str) { 2263 str = str.split("=")[0]; 2264 str = str.trim().replace(INVALID_BASE64_RE, ""); 2265 if (str.length < 2) 2266 return ""; 2267 while (str.length % 4 !== 0) { 2268 str = str + "="; 2269 } 2270 return str; 2271 } 2272 function utf8ToBytes(string, units) { 2273 units = units || Infinity; 2274 var codePoint; 2275 var length = string.length; 2276 var leadSurrogate = null; 2277 var bytes = []; 2278 for (var i = 0; i < length; ++i) { 2279 codePoint = string.charCodeAt(i); 2280 if (codePoint > 55295 && codePoint < 57344) { 2281 if (!leadSurrogate) { 2282 if (codePoint > 56319) { 2283 if ((units -= 3) > -1) 2284 bytes.push(239, 191, 189); 2285 continue; 2286 } else if (i + 1 === length) { 2287 if ((units -= 3) > -1) 2288 bytes.push(239, 191, 189); 2289 continue; 2290 } 2291 leadSurrogate = codePoint; 2292 continue; 2293 } 2294 if (codePoint < 56320) { 2295 if ((units -= 3) > -1) 2296 bytes.push(239, 191, 189); 2297 leadSurrogate = codePoint; 2298 continue; 2299 } 2300 codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; 2301 } else if (leadSurrogate) { 2302 if ((units -= 3) > -1) 2303 bytes.push(239, 191, 189); 2304 } 2305 leadSurrogate = null; 2306 if (codePoint < 128) { 2307 if ((units -= 1) < 0) 2308 break; 2309 bytes.push(codePoint); 2310 } else if (codePoint < 2048) { 2311 if ((units -= 2) < 0) 2312 break; 2313 bytes.push( 2314 codePoint >> 6 | 192, 2315 codePoint & 63 | 128 2316 ); 2317 } else if (codePoint < 65536) { 2318 if ((units -= 3) < 0) 2319 break; 2320 bytes.push( 2321 codePoint >> 12 | 224, 2322 codePoint >> 6 & 63 | 128, 2323 codePoint & 63 | 128 2324 ); 2325 } else if (codePoint < 1114112) { 2326 if ((units -= 4) < 0) 2327 break; 2328 bytes.push( 2329 codePoint >> 18 | 240, 2330 codePoint >> 12 & 63 | 128, 2331 codePoint >> 6 & 63 | 128, 2332 codePoint & 63 | 128 2333 ); 2334 } else { 2335 throw new Error("Invalid code point"); 2336 } 2337 } 2338 return bytes; 2339 } 2340 function asciiToBytes(str) { 2341 var byteArray = []; 2342 for (var i = 0; i < str.length; ++i) { 2343 byteArray.push(str.charCodeAt(i) & 255); 2344 } 2345 return byteArray; 2346 } 2347 function utf16leToBytes(str, units) { 2348 var c, hi, lo; 2349 var byteArray = []; 2350 for (var i = 0; i < str.length; ++i) { 2351 if ((units -= 2) < 0) 2352 break; 2353 c = str.charCodeAt(i); 2354 hi = c >> 8; 2355 lo = c % 256; 2356 byteArray.push(lo); 2357 byteArray.push(hi); 2358 } 2359 return byteArray; 2360 } 2361 function base64ToBytes(str) { 2362 return base64.toByteArray(base64clean(str)); 2363 } 2364 function blitBuffer(src, dst, offset, length) { 2365 for (var i = 0; i < length; ++i) { 2366 if (i + offset >= dst.length || i >= src.length) 2367 break; 2368 dst[i + offset] = src[i]; 2369 } 2370 return i; 2371 } 2372 function isInstance(obj, type) { 2373 return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; 2374 } 2375 function numberIsNaN(obj) { 2376 return obj !== obj; 2377 } 2378 var hexSliceLookupTable = function() { 2379 var alphabet = "0123456789abcdef"; 2380 var table = new Array(256); 2381 for (var i = 0; i < 16; ++i) { 2382 var i16 = i * 16; 2383 for (var j = 0; j < 16; ++j) {
vendor: 6,503 bytes, lines 2384-2608
2384 table[i16 + j] = alphabet[i] + alphabet[j]; 2385 } 2386 } 2387 return table; 2388 }(); 2389 })(buffer); 2390 return buffer; 2391 } 2392 var util = {}; 2393 var types = {}; 2394 var shams$1; 2395 var hasRequiredShams$1; 2396 function requireShams$1() { 2397 if (hasRequiredShams$1) 2398 return shams$1; 2399 hasRequiredShams$1 = 1; 2400 shams$1 = function hasSymbols2() { 2401 if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { 2402 return false; 2403 } 2404 if (typeof Symbol.iterator === "symbol") { 2405 return true; 2406 } 2407 var obj = {}; 2408 var sym = Symbol("test"); 2409 var symObj = Object(sym); 2410 if (typeof sym === "string") { 2411 return false; 2412 } 2413 if (Object.prototype.toString.call(sym) !== "[object Symbol]") { 2414 return false; 2415 } 2416 if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { 2417 return false; 2418 } 2419 var symVal = 42; 2420 obj[sym] = symVal; 2421 for (sym in obj) { 2422 return false; 2423 } 2424 if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { 2425 return false; 2426 } 2427 if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { 2428 return false; 2429 } 2430 var syms = Object.getOwnPropertySymbols(obj); 2431 if (syms.length !== 1 || syms[0] !== sym) { 2432 return false; 2433 } 2434 if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { 2435 return false; 2436 } 2437 if (typeof Object.getOwnPropertyDescriptor === "function") { 2438 var descriptor = Object.getOwnPropertyDescriptor(obj, sym); 2439 if (descriptor.value !== symVal || descriptor.enumerable !== true) { 2440 return false; 2441 } 2442 } 2443 return true; 2444 }; 2445 return shams$1; 2446 } 2447 var shams; 2448 var hasRequiredShams; 2449 function requireShams() { 2450 if (hasRequiredShams) 2451 return shams; 2452 hasRequiredShams = 1; 2453 var hasSymbols2 = requireShams$1(); 2454 shams = function hasToStringTagShams() { 2455 return hasSymbols2() && !!Symbol.toStringTag; 2456 }; 2457 return shams; 2458 } 2459 var hasSymbols; 2460 var hasRequiredHasSymbols; 2461 function requireHasSymbols() { 2462 if (hasRequiredHasSymbols) 2463 return hasSymbols; 2464 hasRequiredHasSymbols = 1; 2465 var origSymbol = typeof Symbol !== "undefined" && Symbol; 2466 var hasSymbolSham = requireShams$1(); 2467 hasSymbols = function hasNativeSymbols() { 2468 if (typeof origSymbol !== "function") { 2469 return false; 2470 } 2471 if (typeof Symbol !== "function") { 2472 return false; 2473 } 2474 if (typeof origSymbol("foo") !== "symbol") { 2475 return false; 2476 } 2477 if (typeof Symbol("bar") !== "symbol") { 2478 return false; 2479 } 2480 return hasSymbolSham(); 2481 }; 2482 return hasSymbols; 2483 } 2484 var hasProto; 2485 var hasRequiredHasProto; 2486 function requireHasProto() { 2487 if (hasRequiredHasProto) 2488 return hasProto; 2489 hasRequiredHasProto = 1; 2490 var test = { 2491 foo: {} 2492 }; 2493 var $Object = Object; 2494 hasProto = function hasProto2() { 2495 return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); 2496 }; 2497 return hasProto; 2498 } 2499 var implementation; 2500 var hasRequiredImplementation; 2501 function requireImplementation() { 2502 if (hasRequiredImplementation) 2503 return implementation; 2504 hasRequiredImplementation = 1; 2505 var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; 2506 var toStr = Object.prototype.toString; 2507 var max = Math.max; 2508 var funcType = "[object Function]"; 2509 var concatty = function concatty2(a, b) { 2510 var arr = []; 2511 for (var i = 0; i < a.length; i += 1) { 2512 arr[i] = a[i]; 2513 } 2514 for (var j = 0; j < b.length; j += 1) { 2515 arr[j + a.length] = b[j]; 2516 } 2517 return arr; 2518 }; 2519 var slicy = function slicy2(arrLike, offset) { 2520 var arr = []; 2521 for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { 2522 arr[j] = arrLike[i]; 2523 } 2524 return arr; 2525 }; 2526 var joiny = function(arr, joiner) { 2527 var str = ""; 2528 for (var i = 0; i < arr.length; i += 1) { 2529 str += arr[i]; 2530 if (i + 1 < arr.length) { 2531 str += joiner; 2532 } 2533 } 2534 return str; 2535 }; 2536 implementation = function bind(that) { 2537 var target = this; 2538 if (typeof target !== "function" || toStr.apply(target) !== funcType) { 2539 throw new TypeError(ERROR_MESSAGE + target); 2540 } 2541 var args = slicy(arguments, 1); 2542 var bound; 2543 var binder = function() { 2544 if (this instanceof bound) { 2545 var result = target.apply( 2546 this, 2547 concatty(args, arguments) 2548 ); 2549 if (Object(result) === result) { 2550 return result; 2551 } 2552 return this; 2553 } 2554 return target.apply( 2555 that, 2556 concatty(args, arguments) 2557 ); 2558 }; 2559 var boundLength = max(0, target.length - args.length); 2560 var boundArgs = []; 2561 for (var i = 0; i < boundLength; i++) { 2562 boundArgs[i] = "$" + i; 2563 } 2564 bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder); 2565 if (target.prototype) { 2566 var Empty = function Empty2() { 2567 }; 2568 Empty.prototype = target.prototype; 2569 bound.prototype = new Empty(); 2570 Empty.prototype = null; 2571 } 2572 return bound; 2573 }; 2574 return implementation; 2575 } 2576 var functionBind; 2577 var hasRequiredFunctionBind; 2578 function requireFunctionBind() { 2579 if (hasRequiredFunctionBind) 2580 return functionBind; 2581 hasRequiredFunctionBind = 1; 2582 var implementation2 = requireImplementation(); 2583 functionBind = Function.prototype.bind || implementation2; 2584 return functionBind; 2585 } 2586 var hasown; 2587 var hasRequiredHasown; 2588 function requireHasown() { 2589 if (hasRequiredHasown) 2590 return hasown; 2591 hasRequiredHasown = 1; 2592 var call = Function.prototype.call; 2593 var $hasOwn = Object.prototype.hasOwnProperty; 2594 var bind = requireFunctionBind(); 2595 hasown = bind.call(call, $hasOwn); 2596 return hasown; 2597 } 2598 var getIntrinsic; 2599 var hasRequiredGetIntrinsic; 2600 function requireGetIntrinsic() { 2601 if (hasRequiredGetIntrinsic) 2602 return getIntrinsic; 2603 hasRequiredGetIntrinsic = 1; 2604 var undefined$1; 2605 var $SyntaxError = SyntaxError; 2606 var $Function = Function; 2607 var $TypeError = TypeError; 2608 var getEvalledConstructor = function(expressionSyntax) {
vendor: 12,019 bytes, lines 2609-2857
2609 try { 2610 return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); 2611 } catch (e) { 2612 } 2613 }; 2614 var $gOPD = Object.getOwnPropertyDescriptor; 2615 if ($gOPD) { 2616 try { 2617 $gOPD({}, ""); 2618 } catch (e) { 2619 $gOPD = null; 2620 } 2621 } 2622 var throwTypeError = function() { 2623 throw new $TypeError(); 2624 }; 2625 var ThrowTypeError = $gOPD ? function() { 2626 try { 2627 arguments.callee; 2628 return throwTypeError; 2629 } catch (calleeThrows) { 2630 try { 2631 return $gOPD(arguments, "callee").get; 2632 } catch (gOPDthrows) { 2633 return throwTypeError; 2634 } 2635 } 2636 }() : throwTypeError; 2637 var hasSymbols2 = requireHasSymbols()(); 2638 var hasProto2 = requireHasProto()(); 2639 var getProto = Object.getPrototypeOf || (hasProto2 ? function(x) { 2640 return x.__proto__; 2641 } : null); 2642 var needsEval = {}; 2643 var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array); 2644 var INTRINSICS = { 2645 "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError, 2646 "%Array%": Array, 2647 "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer, 2648 "%ArrayIteratorPrototype%": hasSymbols2 && getProto ? getProto([][Symbol.iterator]()) : undefined$1, 2649 "%AsyncFromSyncIteratorPrototype%": undefined$1, 2650 "%AsyncFunction%": needsEval, 2651 "%AsyncGenerator%": needsEval, 2652 "%AsyncGeneratorFunction%": needsEval, 2653 "%AsyncIteratorPrototype%": needsEval, 2654 "%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics, 2655 "%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt, 2656 "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array, 2657 "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array, 2658 "%Boolean%": Boolean, 2659 "%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView, 2660 "%Date%": Date, 2661 "%decodeURI%": decodeURI, 2662 "%decodeURIComponent%": decodeURIComponent, 2663 "%encodeURI%": encodeURI, 2664 "%encodeURIComponent%": encodeURIComponent, 2665 "%Error%": Error, 2666 "%eval%": eval, 2667 // eslint-disable-line no-eval 2668 "%EvalError%": EvalError, 2669 "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array, 2670 "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array, 2671 "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry, 2672 "%Function%": $Function, 2673 "%GeneratorFunction%": needsEval, 2674 "%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array, 2675 "%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array, 2676 "%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array, 2677 "%isFinite%": isFinite, 2678 "%isNaN%": isNaN, 2679 "%IteratorPrototype%": hasSymbols2 && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1, 2680 "%JSON%": typeof JSON === "object" ? JSON : undefined$1, 2681 "%Map%": typeof Map === "undefined" ? undefined$1 : Map, 2682 "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols2 || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), 2683 "%Math%": Math, 2684 "%Number%": Number, 2685 "%Object%": Object, 2686 "%parseFloat%": parseFloat, 2687 "%parseInt%": parseInt, 2688 "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise, 2689 "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy, 2690 "%RangeError%": RangeError, 2691 "%ReferenceError%": ReferenceError, 2692 "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect, 2693 "%RegExp%": RegExp, 2694 "%Set%": typeof Set === "undefined" ? undefined$1 : Set, 2695 "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols2 || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), 2696 "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer, 2697 "%String%": String, 2698 "%StringIteratorPrototype%": hasSymbols2 && getProto ? getProto(""[Symbol.iterator]()) : undefined$1, 2699 "%Symbol%": hasSymbols2 ? Symbol : undefined$1, 2700 "%SyntaxError%": $SyntaxError, 2701 "%ThrowTypeError%": ThrowTypeError, 2702 "%TypedArray%": TypedArray, 2703 "%TypeError%": $TypeError, 2704 "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array, 2705 "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray, 2706 "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array, 2707 "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array, 2708 "%URIError%": URIError, 2709 "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap, 2710 "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef, 2711 "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet 2712 }; 2713 if (getProto) { 2714 try { 2715 null.error; 2716 } catch (e) { 2717 var errorProto = getProto(getProto(e)); 2718 INTRINSICS["%Error.prototype%"] = errorProto; 2719 } 2720 } 2721 var doEval = function doEval2(name) { 2722 var value; 2723 if (name === "%AsyncFunction%") { 2724 value = getEvalledConstructor("async function () {}"); 2725 } else if (name === "%GeneratorFunction%") { 2726 value = getEvalledConstructor("function* () {}"); 2727 } else if (name === "%AsyncGeneratorFunction%") { 2728 value = getEvalledConstructor("async function* () {}"); 2729 } else if (name === "%AsyncGenerator%") { 2730 var fn = doEval2("%AsyncGeneratorFunction%"); 2731 if (fn) { 2732 value = fn.prototype; 2733 } 2734 } else if (name === "%AsyncIteratorPrototype%") { 2735 var gen = doEval2("%AsyncGenerator%"); 2736 if (gen && getProto) { 2737 value = getProto(gen.prototype); 2738 } 2739 } 2740 INTRINSICS[name] = value; 2741 return value; 2742 }; 2743 var LEGACY_ALIASES = { 2744 "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], 2745 "%ArrayPrototype%": ["Array", "prototype"], 2746 "%ArrayProto_entries%": ["Array", "prototype", "entries"], 2747 "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], 2748 "%ArrayProto_keys%": ["Array", "prototype", "keys"], 2749 "%ArrayProto_values%": ["Array", "prototype", "values"], 2750 "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], 2751 "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], 2752 "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], 2753 "%BooleanPrototype%": ["Boolean", "prototype"], 2754 "%DataViewPrototype%": ["DataView", "prototype"], 2755 "%DatePrototype%": ["Date", "prototype"], 2756 "%ErrorPrototype%": ["Error", "prototype"], 2757 "%EvalErrorPrototype%": ["EvalError", "prototype"], 2758 "%Float32ArrayPrototype%": ["Float32Array", "prototype"], 2759 "%Float64ArrayPrototype%": ["Float64Array", "prototype"], 2760 "%FunctionPrototype%": ["Function", "prototype"], 2761 "%Generator%": ["GeneratorFunction", "prototype"], 2762 "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], 2763 "%Int8ArrayPrototype%": ["Int8Array", "prototype"], 2764 "%Int16ArrayPrototype%": ["Int16Array", "prototype"], 2765 "%Int32ArrayPrototype%": ["Int32Array", "prototype"], 2766 "%JSONParse%": ["JSON", "parse"], 2767 "%JSONStringify%": ["JSON", "stringify"], 2768 "%MapPrototype%": ["Map", "prototype"], 2769 "%NumberPrototype%": ["Number", "prototype"], 2770 "%ObjectPrototype%": ["Object", "prototype"], 2771 "%ObjProto_toString%": ["Object", "prototype", "toString"], 2772 "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], 2773 "%PromisePrototype%": ["Promise", "prototype"], 2774 "%PromiseProto_then%": ["Promise", "prototype", "then"], 2775 "%Promise_all%": ["Promise", "all"], 2776 "%Promise_reject%": ["Promise", "reject"], 2777 "%Promise_resolve%": ["Promise", "resolve"], 2778 "%RangeErrorPrototype%": ["RangeError", "prototype"], 2779 "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], 2780 "%RegExpPrototype%": ["RegExp", "prototype"], 2781 "%SetPrototype%": ["Set", "prototype"], 2782 "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], 2783 "%StringPrototype%": ["String", "prototype"], 2784 "%SymbolPrototype%": ["Symbol", "prototype"], 2785 "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], 2786 "%TypedArrayPrototype%": ["TypedArray", "prototype"], 2787 "%TypeErrorPrototype%": ["TypeError", "prototype"], 2788 "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], 2789 "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], 2790 "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], 2791 "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], 2792 "%URIErrorPrototype%": ["URIError", "prototype"], 2793 "%WeakMapPrototype%": ["WeakMap", "prototype"], 2794 "%WeakSetPrototype%": ["WeakSet", "prototype"] 2795 }; 2796 var bind = requireFunctionBind(); 2797 var hasOwn = requireHasown(); 2798 var $concat = bind.call(Function.call, Array.prototype.concat); 2799 var $spliceApply = bind.call(Function.apply, Array.prototype.splice); 2800 var $replace = bind.call(Function.call, String.prototype.replace); 2801 var $strSlice = bind.call(Function.call, String.prototype.slice); 2802 var $exec = bind.call(Function.call, RegExp.prototype.exec); 2803 var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; 2804 var reEscapeChar = /\\(\\)?/g; 2805 var stringToPath = function stringToPath2(string) { 2806 var first = $strSlice(string, 0, 1); 2807 var last = $strSlice(string, -1); 2808 if (first === "%" && last !== "%") { 2809 throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); 2810 } else if (last === "%" && first !== "%") { 2811 throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); 2812 } 2813 var result = []; 2814 $replace(string, rePropName, function(match, number, quote, subString) { 2815 result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; 2816 }); 2817 return result; 2818 }; 2819 var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { 2820 var intrinsicName = name; 2821 var alias; 2822 if (hasOwn(LEGACY_ALIASES, intrinsicName)) { 2823 alias = LEGACY_ALIASES[intrinsicName]; 2824 intrinsicName = "%" + alias[0] + "%"; 2825 } 2826 if (hasOwn(INTRINSICS, intrinsicName)) { 2827 var value = INTRINSICS[intrinsicName]; 2828 if (value === needsEval) { 2829 value = doEval(intrinsicName); 2830 } 2831 if (typeof value === "undefined" && !allowMissing) { 2832 throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); 2833 } 2834 return { 2835 alias, 2836 name: intrinsicName, 2837 value 2838 }; 2839 } 2840 throw new $SyntaxError("intrinsic " + name + " does not exist!"); 2841 }; 2842 getIntrinsic = function GetIntrinsic(name, allowMissing) { 2843 if (typeof name !== "string" || name.length === 0) { 2844 throw new $TypeError("intrinsic name must be a non-empty string"); 2845 } 2846 if (arguments.length > 1 && typeof allowMissing !== "boolean") { 2847 throw new $TypeError('"allowMissing" argument must be a boolean'); 2848 } 2849 if ($exec(/^%?[^%]*%?$/, name) === null) { 2850 throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); 2851 } 2852 var parts = stringToPath(name); 2853 var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; 2854 var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); 2855 var intrinsicRealName = intrinsic.name; 2856 var value = intrinsic.value; 2857 var skipFurtherCaching = false;
2858 var alias = intrinsic.alias; 2859 if (alias) { 2860 intrinsicBaseName = alias[0]; 2861 $spliceApply(parts, $concat([0, 1], alias)); 2862 } 2863 for (var i = 1, isOwn = true; i < parts.length; i += 1) { 2864 var part = parts[i]; 2865 var first = $strSlice(part, 0, 1); 2866 var last = $strSlice(part, -1); 2867 if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { 2868 throw new $SyntaxError("property names with quotes must have matching quotes"); 2869 } 2870 if (part === "constructor" || !isOwn) { 2871 skipFurtherCaching = true; 2872 } 2873 intrinsicBaseName += "." + part; 2874 intrinsicRealName = "%" + intrinsicBaseName + "%"; 2875 if (hasOwn(INTRINSICS, intrinsicRealName)) { 2876 value = INTRINSICS[intrinsicRealName]; 2877 } else if (value != null) { 2878 if (!(part in value)) { 2879 if (!allowMissing) { 2880 throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); 2881 } 2882 return void 0; 2883 } 2884 if ($gOPD && i + 1 >= parts.length) { 2885 var desc = $gOPD(value, part); 2886 isOwn = !!desc; 2887 if (isOwn && "get" in desc && !("originalValue" in desc.get)) { 2888 value = desc.get; 2889 } else { 2890 value = value[part]; 2891 } 2892 } else { 2893 isOwn = hasOwn(value, part); 2894 value = value[part]; 2895 } 2896 if (isOwn && !skipFurtherCaching) { 2897 INTRINSICS[intrinsicRealName] = value; 2898 } 2899 } 2900 } 2901 return value; 2902 }; 2903 return getIntrinsic; 2904 } 2905 var callBind = { exports: {} }; 2906 var hasPropertyDescriptors_1; 2907 var hasRequiredHasPropertyDescriptors; 2908 function requireHasPropertyDescriptors() { 2909 if (hasRequiredHasPropertyDescriptors) 2910 return hasPropertyDescriptors_1; 2911 hasRequiredHasPropertyDescriptors = 1; 2912 var GetIntrinsic = requireGetIntrinsic(); 2913 var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); 2914 var hasPropertyDescriptors = function hasPropertyDescriptors2() { 2915 if ($defineProperty) { 2916 try { 2917 $defineProperty({}, "a", { value: 1 }); 2918 return true; 2919 } catch (e) { 2920 return false; 2921 } 2922 } 2923 return false; 2924 }; 2925 hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { 2926 if (!hasPropertyDescriptors()) { 2927 return null; 2928 } 2929 try { 2930 return $defineProperty([], "length", { value: 1 }).length !== 1; 2931 } catch (e) { 2932 return true; 2933 } 2934 }; 2935 hasPropertyDescriptors_1 = hasPropertyDescriptors; 2936 return hasPropertyDescriptors_1; 2937 } 2938 var gopd; 2939 var hasRequiredGopd; 2940 function requireGopd() { 2941 if (hasRequiredGopd) 2942 return gopd; 2943 hasRequiredGopd = 1; 2944 var GetIntrinsic = requireGetIntrinsic(); 2945 var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); 2946 if ($gOPD) { 2947 try { 2948 $gOPD([], "length"); 2949 } catch (e) { 2950 $gOPD = null; 2951 } 2952 } 2953 gopd = $gOPD; 2954 return gopd; 2955 } 2956 var defineDataProperty; 2957 var hasRequiredDefineDataProperty; 2958 function requireDefineDataProperty() { 2959 if (hasRequiredDefineDataProperty) 2960 return defineDataProperty; 2961 hasRequiredDefineDataProperty = 1; 2962 var hasPropertyDescriptors = requireHasPropertyDescriptors()(); 2963 var GetIntrinsic = requireGetIntrinsic(); 2964 var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true); 2965 if ($defineProperty) { 2966 try { 2967 $defineProperty({}, "a", { value: 1 }); 2968 } catch (e) { 2969 $defineProperty = false; 2970 } 2971 } 2972 var $SyntaxError = GetIntrinsic("%SyntaxError%"); 2973 var $TypeError = GetIntrinsic("%TypeError%"); 2974 var gopd2 = requireGopd(); 2975 defineDataProperty = function defineDataProperty2(obj, property, value) { 2976 if (!obj || typeof obj !== "object" && typeof obj !== "function") { 2977 throw new $TypeError("`obj` must be an object or a function`"); 2978 } 2979 if (typeof property !== "string" && typeof property !== "symbol") { 2980 throw new $TypeError("`property` must be a string or a symbol`"); 2981 } 2982 if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) { 2983 throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null"); 2984 } 2985 if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) { 2986 throw new $TypeError("`nonWritable`, if provided, must be a boolean or null"); 2987 } 2988 if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) { 2989 throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null"); 2990 } 2991 if (arguments.length > 6 && typeof arguments[6] !== "boolean") { 2992 throw new $TypeError("`loose`, if provided, must be a boolean"); 2993 } 2994 var nonEnumerable = arguments.length > 3 ? arguments[3] : null; 2995 var nonWritable = arguments.length > 4 ? arguments[4] : null; 2996 var nonConfigurable = arguments.length > 5 ? arguments[5] : null; 2997 var loose = arguments.length > 6 ? arguments[6] : false;
vendor: 5,032 bytes, lines 2998-3129
2998 var desc = !!gopd2 && gopd2(obj, property); 2999 if ($defineProperty) { 3000 $defineProperty(obj, property, { 3001 configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, 3002 enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, 3003 value, 3004 writable: nonWritable === null && desc ? desc.writable : !nonWritable 3005 }); 3006 } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) { 3007 obj[property] = value; 3008 } else { 3009 throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable."); 3010 } 3011 }; 3012 return defineDataProperty; 3013 } 3014 var setFunctionLength; 3015 var hasRequiredSetFunctionLength; 3016 function requireSetFunctionLength() { 3017 if (hasRequiredSetFunctionLength) 3018 return setFunctionLength; 3019 hasRequiredSetFunctionLength = 1; 3020 var GetIntrinsic = requireGetIntrinsic(); 3021 var define2 = requireDefineDataProperty(); 3022 var hasDescriptors = requireHasPropertyDescriptors()(); 3023 var gOPD = requireGopd(); 3024 var $TypeError = GetIntrinsic("%TypeError%"); 3025 var $floor = GetIntrinsic("%Math.floor%"); 3026 setFunctionLength = function setFunctionLength2(fn, length) { 3027 if (typeof fn !== "function") { 3028 throw new $TypeError("`fn` is not a function"); 3029 } 3030 if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) { 3031 throw new $TypeError("`length` must be a positive 32-bit integer"); 3032 } 3033 var loose = arguments.length > 2 && !!arguments[2]; 3034 var functionLengthIsConfigurable = true; 3035 var functionLengthIsWritable = true; 3036 if ("length" in fn && gOPD) { 3037 var desc = gOPD(fn, "length"); 3038 if (desc && !desc.configurable) { 3039 functionLengthIsConfigurable = false; 3040 } 3041 if (desc && !desc.writable) { 3042 functionLengthIsWritable = false; 3043 } 3044 } 3045 if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { 3046 if (hasDescriptors) { 3047 define2(fn, "length", length, true, true); 3048 } else { 3049 define2(fn, "length", length); 3050 } 3051 } 3052 return fn; 3053 }; 3054 return setFunctionLength; 3055 } 3056 var hasRequiredCallBind; 3057 function requireCallBind() { 3058 if (hasRequiredCallBind) 3059 return callBind.exports; 3060 hasRequiredCallBind = 1; 3061 (function(module2) { 3062 var bind = requireFunctionBind(); 3063 var GetIntrinsic = requireGetIntrinsic(); 3064 var setFunctionLength2 = requireSetFunctionLength(); 3065 var $TypeError = GetIntrinsic("%TypeError%"); 3066 var $apply = GetIntrinsic("%Function.prototype.apply%"); 3067 var $call = GetIntrinsic("%Function.prototype.call%"); 3068 var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); 3069 var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); 3070 var $max = GetIntrinsic("%Math.max%"); 3071 if ($defineProperty) { 3072 try { 3073 $defineProperty({}, "a", { value: 1 }); 3074 } catch (e) { 3075 $defineProperty = null; 3076 } 3077 } 3078 module2.exports = function callBind2(originalFunction) { 3079 if (typeof originalFunction !== "function") { 3080 throw new $TypeError("a function is required"); 3081 } 3082 var func = $reflectApply(bind, $call, arguments); 3083 return setFunctionLength2( 3084 func, 3085 1 + $max(0, originalFunction.length - (arguments.length - 1)), 3086 true 3087 ); 3088 }; 3089 var applyBind = function applyBind2() { 3090 return $reflectApply(bind, $apply, arguments); 3091 }; 3092 if ($defineProperty) { 3093 $defineProperty(module2.exports, "apply", { value: applyBind }); 3094 } else { 3095 module2.exports.apply = applyBind; 3096 } 3097 })(callBind); 3098 return callBind.exports; 3099 } 3100 var callBound; 3101 var hasRequiredCallBound; 3102 function requireCallBound() { 3103 if (hasRequiredCallBound) 3104 return callBound; 3105 hasRequiredCallBound = 1; 3106 var GetIntrinsic = requireGetIntrinsic(); 3107 var callBind2 = requireCallBind(); 3108 var $indexOf = callBind2(GetIntrinsic("String.prototype.indexOf")); 3109 callBound = function callBoundIntrinsic(name, allowMissing) { 3110 var intrinsic = GetIntrinsic(name, !!allowMissing); 3111 if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { 3112 return callBind2(intrinsic); 3113 } 3114 return intrinsic; 3115 }; 3116 return callBound; 3117 } 3118 var isArguments; 3119 var hasRequiredIsArguments; 3120 function requireIsArguments() { 3121 if (hasRequiredIsArguments) 3122 return isArguments; 3123 hasRequiredIsArguments = 1; 3124 var hasToStringTag = requireShams()(); 3125 var callBound2 = requireCallBound(); 3126 var $toString = callBound2("Object.prototype.toString"); 3127 var isStandardArguments = function isArguments2(value) { 3128 if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { 3129 return false;
vendor: 4,450 bytes, lines 3130-3261
3130 } 3131 return $toString(value) === "[object Arguments]"; 3132 }; 3133 var isLegacyArguments = function isArguments2(value) { 3134 if (isStandardArguments(value)) { 3135 return true; 3136 } 3137 return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; 3138 }; 3139 var supportsStandardArguments = function() { 3140 return isStandardArguments(arguments); 3141 }(); 3142 isStandardArguments.isLegacyArguments = isLegacyArguments; 3143 isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments; 3144 return isArguments; 3145 } 3146 var isGeneratorFunction; 3147 var hasRequiredIsGeneratorFunction; 3148 function requireIsGeneratorFunction() { 3149 if (hasRequiredIsGeneratorFunction) 3150 return isGeneratorFunction; 3151 hasRequiredIsGeneratorFunction = 1; 3152 var toStr = Object.prototype.toString; 3153 var fnToStr = Function.prototype.toString; 3154 var isFnRegex = /^\s*(?:function)?\*/; 3155 var hasToStringTag = requireShams()(); 3156 var getProto = Object.getPrototypeOf; 3157 var getGeneratorFunc = function() { 3158 if (!hasToStringTag) { 3159 return false; 3160 } 3161 try { 3162 return Function("return function*() {}")(); 3163 } catch (e) { 3164 } 3165 }; 3166 var GeneratorFunction; 3167 isGeneratorFunction = function isGeneratorFunction2(fn) { 3168 if (typeof fn !== "function") { 3169 return false; 3170 } 3171 if (isFnRegex.test(fnToStr.call(fn))) { 3172 return true; 3173 } 3174 if (!hasToStringTag) { 3175 var str = toStr.call(fn); 3176 return str === "[object GeneratorFunction]"; 3177 } 3178 if (!getProto) { 3179 return false; 3180 } 3181 if (typeof GeneratorFunction === "undefined") { 3182 var generatorFunc = getGeneratorFunc(); 3183 GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; 3184 } 3185 return getProto(fn) === GeneratorFunction; 3186 }; 3187 return isGeneratorFunction; 3188 } 3189 var isCallable; 3190 var hasRequiredIsCallable; 3191 function requireIsCallable() { 3192 if (hasRequiredIsCallable) 3193 return isCallable; 3194 hasRequiredIsCallable = 1; 3195 var fnToStr = Function.prototype.toString; 3196 var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; 3197 var badArrayLike; 3198 var isCallableMarker; 3199 if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { 3200 try { 3201 badArrayLike = Object.defineProperty({}, "length", { 3202 get: function() { 3203 throw isCallableMarker; 3204 } 3205 }); 3206 isCallableMarker = {}; 3207 reflectApply(function() { 3208 throw 42; 3209 }, null, badArrayLike); 3210 } catch (_) { 3211 if (_ !== isCallableMarker) { 3212 reflectApply = null; 3213 } 3214 } 3215 } else { 3216 reflectApply = null; 3217 } 3218 var constructorRegex = /^\s*class\b/; 3219 var isES6ClassFn = function isES6ClassFunction(value) { 3220 try { 3221 var fnStr = fnToStr.call(value); 3222 return constructorRegex.test(fnStr); 3223 } catch (e) { 3224 return false; 3225 } 3226 }; 3227 var tryFunctionObject = function tryFunctionToStr(value) { 3228 try { 3229 if (isES6ClassFn(value)) { 3230 return false; 3231 } 3232 fnToStr.call(value); 3233 return true; 3234 } catch (e) { 3235 return false; 3236 } 3237 }; 3238 var toStr = Object.prototype.toString; 3239 var objectClass = "[object Object]"; 3240 var fnClass = "[object Function]"; 3241 var genClass = "[object GeneratorFunction]"; 3242 var ddaClass = "[object HTMLAllCollection]"; 3243 var ddaClass2 = "[object HTML document.all class]"; 3244 var ddaClass3 = "[object HTMLCollection]"; 3245 var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; 3246 var isIE68 = !(0 in [,]); 3247 var isDDA = function isDocumentDotAll() { 3248 return false; 3249 }; 3250 if (typeof document === "object") { 3251 var all = document.all; 3252 if (toStr.call(all) === toStr.call(document.all)) { 3253 isDDA = function isDocumentDotAll(value) { 3254 if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) { 3255 try { 3256 var str = toStr.call(value); 3257 return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null; 3258 } catch (e) { 3259 } 3260 } 3261 return false;
vendor: 8,437 bytes, lines 3262-3532
3262 }; 3263 } 3264 } 3265 isCallable = reflectApply ? function isCallable2(value) { 3266 if (isDDA(value)) { 3267 return true; 3268 } 3269 if (!value) { 3270 return false; 3271 } 3272 if (typeof value !== "function" && typeof value !== "object") { 3273 return false; 3274 } 3275 try { 3276 reflectApply(value, null, badArrayLike); 3277 } catch (e) { 3278 if (e !== isCallableMarker) { 3279 return false; 3280 } 3281 } 3282 return !isES6ClassFn(value) && tryFunctionObject(value); 3283 } : function isCallable2(value) { 3284 if (isDDA(value)) { 3285 return true; 3286 } 3287 if (!value) { 3288 return false; 3289 } 3290 if (typeof value !== "function" && typeof value !== "object") { 3291 return false; 3292 } 3293 if (hasToStringTag) { 3294 return tryFunctionObject(value); 3295 } 3296 if (isES6ClassFn(value)) { 3297 return false; 3298 } 3299 var strClass = toStr.call(value); 3300 if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) { 3301 return false; 3302 } 3303 return tryFunctionObject(value); 3304 }; 3305 return isCallable; 3306 } 3307 var forEach_1; 3308 var hasRequiredForEach; 3309 function requireForEach() { 3310 if (hasRequiredForEach) 3311 return forEach_1; 3312 hasRequiredForEach = 1; 3313 var isCallable2 = requireIsCallable(); 3314 var toStr = Object.prototype.toString; 3315 var hasOwnProperty = Object.prototype.hasOwnProperty; 3316 var forEachArray = function forEachArray2(array, iterator, receiver) { 3317 for (var i = 0, len = array.length; i < len; i++) { 3318 if (hasOwnProperty.call(array, i)) { 3319 if (receiver == null) { 3320 iterator(array[i], i, array); 3321 } else { 3322 iterator.call(receiver, array[i], i, array); 3323 } 3324 } 3325 } 3326 }; 3327 var forEachString = function forEachString2(string, iterator, receiver) { 3328 for (var i = 0, len = string.length; i < len; i++) { 3329 if (receiver == null) { 3330 iterator(string.charAt(i), i, string); 3331 } else { 3332 iterator.call(receiver, string.charAt(i), i, string); 3333 } 3334 } 3335 }; 3336 var forEachObject = function forEachObject2(object, iterator, receiver) { 3337 for (var k in object) { 3338 if (hasOwnProperty.call(object, k)) { 3339 if (receiver == null) { 3340 iterator(object[k], k, object); 3341 } else { 3342 iterator.call(receiver, object[k], k, object); 3343 } 3344 } 3345 } 3346 }; 3347 var forEach = function forEach2(list, iterator, thisArg) { 3348 if (!isCallable2(iterator)) { 3349 throw new TypeError("iterator must be a function"); 3350 } 3351 var receiver; 3352 if (arguments.length >= 3) { 3353 receiver = thisArg; 3354 } 3355 if (toStr.call(list) === "[object Array]") { 3356 forEachArray(list, iterator, receiver); 3357 } else if (typeof list === "string") { 3358 forEachString(list, iterator, receiver); 3359 } else { 3360 forEachObject(list, iterator, receiver); 3361 } 3362 }; 3363 forEach_1 = forEach; 3364 return forEach_1; 3365 } 3366 var availableTypedArrays; 3367 var hasRequiredAvailableTypedArrays; 3368 function requireAvailableTypedArrays() { 3369 if (hasRequiredAvailableTypedArrays) 3370 return availableTypedArrays; 3371 hasRequiredAvailableTypedArrays = 1; 3372 var possibleNames = [ 3373 "BigInt64Array", 3374 "BigUint64Array", 3375 "Float32Array", 3376 "Float64Array", 3377 "Int16Array", 3378 "Int32Array", 3379 "Int8Array", 3380 "Uint16Array", 3381 "Uint32Array", 3382 "Uint8Array", 3383 "Uint8ClampedArray" 3384 ]; 3385 var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis; 3386 availableTypedArrays = function availableTypedArrays2() { 3387 var out = []; 3388 for (var i = 0; i < possibleNames.length; i++) { 3389 if (typeof g[possibleNames[i]] === "function") { 3390 out[out.length] = possibleNames[i]; 3391 } 3392 } 3393 return out; 3394 }; 3395 return availableTypedArrays; 3396 } 3397 var whichTypedArray; 3398 var hasRequiredWhichTypedArray; 3399 function requireWhichTypedArray() { 3400 if (hasRequiredWhichTypedArray) 3401 return whichTypedArray; 3402 hasRequiredWhichTypedArray = 1; 3403 var forEach = requireForEach(); 3404 var availableTypedArrays2 = requireAvailableTypedArrays(); 3405 var callBind2 = requireCallBind(); 3406 var callBound2 = requireCallBound(); 3407 var gOPD = requireGopd(); 3408 var $toString = callBound2("Object.prototype.toString"); 3409 var hasToStringTag = requireShams()(); 3410 var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis; 3411 var typedArrays = availableTypedArrays2(); 3412 var $slice = callBound2("String.prototype.slice"); 3413 var getPrototypeOf = Object.getPrototypeOf; 3414 var $indexOf = callBound2("Array.prototype.indexOf", true) || function indexOf(array, value) { 3415 for (var i = 0; i < array.length; i += 1) { 3416 if (array[i] === value) { 3417 return i; 3418 } 3419 } 3420 return -1; 3421 }; 3422 var cache = { __proto__: null }; 3423 if (hasToStringTag && gOPD && getPrototypeOf) { 3424 forEach(typedArrays, function(typedArray) { 3425 var arr = new g[typedArray](); 3426 if (Symbol.toStringTag in arr) { 3427 var proto = getPrototypeOf(arr); 3428 var descriptor = gOPD(proto, Symbol.toStringTag); 3429 if (!descriptor) { 3430 var superProto = getPrototypeOf(proto); 3431 descriptor = gOPD(superProto, Symbol.toStringTag); 3432 } 3433 cache["$" + typedArray] = callBind2(descriptor.get); 3434 } 3435 }); 3436 } else { 3437 forEach(typedArrays, function(typedArray) { 3438 var arr = new g[typedArray](); 3439 var fn = arr.slice || arr.set; 3440 if (fn) { 3441 cache["$" + typedArray] = callBind2(fn); 3442 } 3443 }); 3444 } 3445 var tryTypedArrays = function tryAllTypedArrays(value) { 3446 var found = false; 3447 forEach(cache, function(getter, typedArray) { 3448 if (!found) { 3449 try { 3450 if ("$" + getter(value) === typedArray) { 3451 found = $slice(typedArray, 1); 3452 } 3453 } catch (e) { 3454 } 3455 } 3456 }); 3457 return found; 3458 }; 3459 var trySlices = function tryAllSlices(value) { 3460 var found = false; 3461 forEach(cache, function(getter, name) { 3462 if (!found) { 3463 try { 3464 getter(value); 3465 found = $slice(name, 1); 3466 } catch (e) { 3467 } 3468 } 3469 }); 3470 return found; 3471 }; 3472 whichTypedArray = function whichTypedArray2(value) { 3473 if (!value || typeof value !== "object") { 3474 return false; 3475 } 3476 if (!hasToStringTag) { 3477 var tag = $slice($toString(value), 8, -1); 3478 if ($indexOf(typedArrays, tag) > -1) { 3479 return tag; 3480 } 3481 if (tag !== "Object") { 3482 return false; 3483 } 3484 return trySlices(value); 3485 } 3486 if (!gOPD) { 3487 return null; 3488 } 3489 return tryTypedArrays(value); 3490 }; 3491 return whichTypedArray; 3492 } 3493 var isTypedArray; 3494 var hasRequiredIsTypedArray; 3495 function requireIsTypedArray() { 3496 if (hasRequiredIsTypedArray) 3497 return isTypedArray; 3498 hasRequiredIsTypedArray = 1; 3499 var whichTypedArray2 = requireWhichTypedArray(); 3500 isTypedArray = function isTypedArray2(value) { 3501 return !!whichTypedArray2(value); 3502 }; 3503 return isTypedArray; 3504 } 3505 var hasRequiredTypes; 3506 function requireTypes() { 3507 if (hasRequiredTypes) 3508 return types; 3509 hasRequiredTypes = 1; 3510 (function(exports3) { 3511 var isArgumentsObject = requireIsArguments(); 3512 var isGeneratorFunction2 = requireIsGeneratorFunction(); 3513 var whichTypedArray2 = requireWhichTypedArray(); 3514 var isTypedArray2 = requireIsTypedArray(); 3515 function uncurryThis(f) { 3516 return f.call.bind(f); 3517 } 3518 var BigIntSupported = typeof BigInt !== "undefined"; 3519 var SymbolSupported = typeof Symbol !== "undefined"; 3520 var ObjectToString = uncurryThis(Object.prototype.toString); 3521 var numberValue = uncurryThis(Number.prototype.valueOf); 3522 var stringValue = uncurryThis(String.prototype.valueOf); 3523 var booleanValue = uncurryThis(Boolean.prototype.valueOf); 3524 if (BigIntSupported) { 3525 var bigIntValue = uncurryThis(BigInt.prototype.valueOf); 3526 } 3527 if (SymbolSupported) { 3528 var symbolValue = uncurryThis(Symbol.prototype.valueOf); 3529 } 3530 function checkBoxedPrimitive(value, prototypeValueOf) { 3531 if (typeof value !== "object") { 3532 return false;
vendor: 4,599 bytes, lines 3533-3646
3533 } 3534 try { 3535 prototypeValueOf(value); 3536 return true; 3537 } catch (e) { 3538 return false; 3539 } 3540 } 3541 exports3.isArgumentsObject = isArgumentsObject; 3542 exports3.isGeneratorFunction = isGeneratorFunction2; 3543 exports3.isTypedArray = isTypedArray2; 3544 function isPromise(input) { 3545 return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; 3546 } 3547 exports3.isPromise = isPromise; 3548 function isArrayBufferView(value) { 3549 if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { 3550 return ArrayBuffer.isView(value); 3551 } 3552 return isTypedArray2(value) || isDataView(value); 3553 } 3554 exports3.isArrayBufferView = isArrayBufferView; 3555 function isUint8Array(value) { 3556 return whichTypedArray2(value) === "Uint8Array"; 3557 } 3558 exports3.isUint8Array = isUint8Array; 3559 function isUint8ClampedArray(value) { 3560 return whichTypedArray2(value) === "Uint8ClampedArray"; 3561 } 3562 exports3.isUint8ClampedArray = isUint8ClampedArray; 3563 function isUint16Array(value) { 3564 return whichTypedArray2(value) === "Uint16Array"; 3565 } 3566 exports3.isUint16Array = isUint16Array; 3567 function isUint32Array(value) { 3568 return whichTypedArray2(value) === "Uint32Array"; 3569 } 3570 exports3.isUint32Array = isUint32Array; 3571 function isInt8Array(value) { 3572 return whichTypedArray2(value) === "Int8Array"; 3573 } 3574 exports3.isInt8Array = isInt8Array; 3575 function isInt16Array(value) { 3576 return whichTypedArray2(value) === "Int16Array"; 3577 } 3578 exports3.isInt16Array = isInt16Array; 3579 function isInt32Array(value) { 3580 return whichTypedArray2(value) === "Int32Array"; 3581 } 3582 exports3.isInt32Array = isInt32Array; 3583 function isFloat32Array(value) { 3584 return whichTypedArray2(value) === "Float32Array"; 3585 } 3586 exports3.isFloat32Array = isFloat32Array; 3587 function isFloat64Array(value) { 3588 return whichTypedArray2(value) === "Float64Array"; 3589 } 3590 exports3.isFloat64Array = isFloat64Array; 3591 function isBigInt64Array(value) { 3592 return whichTypedArray2(value) === "BigInt64Array"; 3593 } 3594 exports3.isBigInt64Array = isBigInt64Array; 3595 function isBigUint64Array(value) { 3596 return whichTypedArray2(value) === "BigUint64Array"; 3597 } 3598 exports3.isBigUint64Array = isBigUint64Array; 3599 function isMapToString(value) { 3600 return ObjectToString(value) === "[object Map]"; 3601 } 3602 isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); 3603 function isMap(value) { 3604 if (typeof Map === "undefined") { 3605 return false; 3606 } 3607 return isMapToString.working ? isMapToString(value) : value instanceof Map; 3608 } 3609 exports3.isMap = isMap; 3610 function isSetToString(value) { 3611 return ObjectToString(value) === "[object Set]"; 3612 } 3613 isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); 3614 function isSet(value) { 3615 if (typeof Set === "undefined") { 3616 return false; 3617 } 3618 return isSetToString.working ? isSetToString(value) : value instanceof Set; 3619 } 3620 exports3.isSet = isSet; 3621 function isWeakMapToString(value) { 3622 return ObjectToString(value) === "[object WeakMap]"; 3623 } 3624 isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); 3625 function isWeakMap(value) { 3626 if (typeof WeakMap === "undefined") { 3627 return false; 3628 } 3629 return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; 3630 } 3631 exports3.isWeakMap = isWeakMap; 3632 function isWeakSetToString(value) { 3633 return ObjectToString(value) === "[object WeakSet]"; 3634 } 3635 isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); 3636 function isWeakSet(value) { 3637 return isWeakSetToString(value); 3638 } 3639 exports3.isWeakSet = isWeakSet; 3640 function isArrayBufferToString(value) { 3641 return ObjectToString(value) === "[object ArrayBuffer]"; 3642 } 3643 isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); 3644 function isArrayBuffer(value) { 3645 if (typeof ArrayBuffer === "undefined") { 3646 return false;
vendor: 6,376 bytes, lines 3647-3810
3647 } 3648 return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; 3649 } 3650 exports3.isArrayBuffer = isArrayBuffer; 3651 function isDataViewToString(value) { 3652 return ObjectToString(value) === "[object DataView]"; 3653 } 3654 isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); 3655 function isDataView(value) { 3656 if (typeof DataView === "undefined") { 3657 return false; 3658 } 3659 return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; 3660 } 3661 exports3.isDataView = isDataView; 3662 var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; 3663 function isSharedArrayBufferToString(value) { 3664 return ObjectToString(value) === "[object SharedArrayBuffer]"; 3665 } 3666 function isSharedArrayBuffer(value) { 3667 if (typeof SharedArrayBufferCopy === "undefined") { 3668 return false; 3669 } 3670 if (typeof isSharedArrayBufferToString.working === "undefined") { 3671 isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); 3672 } 3673 return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; 3674 } 3675 exports3.isSharedArrayBuffer = isSharedArrayBuffer; 3676 function isAsyncFunction(value) { 3677 return ObjectToString(value) === "[object AsyncFunction]"; 3678 } 3679 exports3.isAsyncFunction = isAsyncFunction; 3680 function isMapIterator(value) { 3681 return ObjectToString(value) === "[object Map Iterator]"; 3682 } 3683 exports3.isMapIterator = isMapIterator; 3684 function isSetIterator(value) { 3685 return ObjectToString(value) === "[object Set Iterator]"; 3686 } 3687 exports3.isSetIterator = isSetIterator; 3688 function isGeneratorObject(value) { 3689 return ObjectToString(value) === "[object Generator]"; 3690 } 3691 exports3.isGeneratorObject = isGeneratorObject; 3692 function isWebAssemblyCompiledModule(value) { 3693 return ObjectToString(value) === "[object WebAssembly.Module]"; 3694 } 3695 exports3.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; 3696 function isNumberObject(value) { 3697 return checkBoxedPrimitive(value, numberValue); 3698 } 3699 exports3.isNumberObject = isNumberObject; 3700 function isStringObject(value) { 3701 return checkBoxedPrimitive(value, stringValue); 3702 } 3703 exports3.isStringObject = isStringObject; 3704 function isBooleanObject(value) { 3705 return checkBoxedPrimitive(value, booleanValue); 3706 } 3707 exports3.isBooleanObject = isBooleanObject; 3708 function isBigIntObject(value) { 3709 return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); 3710 } 3711 exports3.isBigIntObject = isBigIntObject; 3712 function isSymbolObject(value) { 3713 return SymbolSupported && checkBoxedPrimitive(value, symbolValue); 3714 } 3715 exports3.isSymbolObject = isSymbolObject; 3716 function isBoxedPrimitive(value) { 3717 return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); 3718 } 3719 exports3.isBoxedPrimitive = isBoxedPrimitive; 3720 function isAnyArrayBuffer(value) { 3721 return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); 3722 } 3723 exports3.isAnyArrayBuffer = isAnyArrayBuffer; 3724 ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { 3725 Object.defineProperty(exports3, method, { 3726 enumerable: false, 3727 value: function() { 3728 throw new Error(method + " is not supported in userland"); 3729 } 3730 }); 3731 }); 3732 })(types); 3733 return types; 3734 } 3735 var isBufferBrowser; 3736 var hasRequiredIsBufferBrowser; 3737 function requireIsBufferBrowser() { 3738 if (hasRequiredIsBufferBrowser) 3739 return isBufferBrowser; 3740 hasRequiredIsBufferBrowser = 1; 3741 isBufferBrowser = function isBuffer(arg) { 3742 return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; 3743 }; 3744 return isBufferBrowser; 3745 } 3746 var hasRequiredUtil; 3747 function requireUtil() { 3748 if (hasRequiredUtil) 3749 return util; 3750 hasRequiredUtil = 1; 3751 (function(exports3) { 3752 var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { 3753 var keys = Object.keys(obj); 3754 var descriptors = {}; 3755 for (var i = 0; i < keys.length; i++) { 3756 descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); 3757 } 3758 return descriptors; 3759 }; 3760 var formatRegExp = /%[sdj%]/g; 3761 exports3.format = function(f) { 3762 if (!isString(f)) { 3763 var objects = []; 3764 for (var i = 0; i < arguments.length; i++) { 3765 objects.push(inspect(arguments[i])); 3766 } 3767 return objects.join(" "); 3768 } 3769 var i = 1; 3770 var args = arguments; 3771 var len = args.length; 3772 var str = String(f).replace(formatRegExp, function(x2) { 3773 if (x2 === "%%") 3774 return "%"; 3775 if (i >= len) 3776 return x2; 3777 switch (x2) { 3778 case "%s": 3779 return String(args[i++]); 3780 case "%d": 3781 return Number(args[i++]); 3782 case "%j": 3783 try { 3784 return JSON.stringify(args[i++]); 3785 } catch (_) { 3786 return "[Circular]"; 3787 } 3788 default: 3789 return x2; 3790 } 3791 }); 3792 for (var x = args[i]; i < len; x = args[++i]) { 3793 if (isNull(x) || !isObject(x)) { 3794 str += " " + x; 3795 } else { 3796 str += " " + inspect(x); 3797 } 3798 } 3799 return str; 3800 }; 3801 exports3.deprecate = function(fn, msg) { 3802 if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) { 3803 return fn; 3804 } 3805 if (typeof process$1 === "undefined") { 3806 return function() { 3807 return exports3.deprecate(fn, msg).apply(this, arguments); 3808 }; 3809 } 3810 var warned = false;
vendor: 8,131 bytes, lines 3811-4054
3811 function deprecated() { 3812 if (!warned) { 3813 if (process$1.throwDeprecation) { 3814 throw new Error(msg); 3815 } else if (process$1.traceDeprecation) { 3816 console.trace(msg); 3817 } else { 3818 console.error(msg); 3819 } 3820 warned = true; 3821 } 3822 return fn.apply(this, arguments); 3823 } 3824 return deprecated; 3825 }; 3826 var debugs = {}; 3827 var debugEnvRegex = /^$/; 3828 if (process$1.env.NODE_DEBUG) { 3829 var debugEnv = process$1.env.NODE_DEBUG; 3830 debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); 3831 debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); 3832 } 3833 exports3.debuglog = function(set) { 3834 set = set.toUpperCase(); 3835 if (!debugs[set]) { 3836 if (debugEnvRegex.test(set)) { 3837 var pid = process$1.pid; 3838 debugs[set] = function() { 3839 var msg = exports3.format.apply(exports3, arguments); 3840 console.error("%s %d: %s", set, pid, msg); 3841 }; 3842 } else { 3843 debugs[set] = function() { 3844 }; 3845 } 3846 } 3847 return debugs[set]; 3848 }; 3849 function inspect(obj, opts) { 3850 var ctx = { 3851 seen: [], 3852 stylize: stylizeNoColor 3853 }; 3854 if (arguments.length >= 3) 3855 ctx.depth = arguments[2]; 3856 if (arguments.length >= 4) 3857 ctx.colors = arguments[3]; 3858 if (isBoolean(opts)) { 3859 ctx.showHidden = opts; 3860 } else if (opts) { 3861 exports3._extend(ctx, opts); 3862 } 3863 if (isUndefined(ctx.showHidden)) 3864 ctx.showHidden = false; 3865 if (isUndefined(ctx.depth)) 3866 ctx.depth = 2; 3867 if (isUndefined(ctx.colors)) 3868 ctx.colors = false; 3869 if (isUndefined(ctx.customInspect)) 3870 ctx.customInspect = true; 3871 if (ctx.colors) 3872 ctx.stylize = stylizeWithColor; 3873 return formatValue(ctx, obj, ctx.depth); 3874 } 3875 exports3.inspect = inspect; 3876 inspect.colors = { 3877 "bold": [1, 22], 3878 "italic": [3, 23], 3879 "underline": [4, 24], 3880 "inverse": [7, 27], 3881 "white": [37, 39], 3882 "grey": [90, 39], 3883 "black": [30, 39], 3884 "blue": [34, 39], 3885 "cyan": [36, 39], 3886 "green": [32, 39], 3887 "magenta": [35, 39], 3888 "red": [31, 39], 3889 "yellow": [33, 39] 3890 }; 3891 inspect.styles = { 3892 "special": "cyan", 3893 "number": "yellow", 3894 "boolean": "yellow", 3895 "undefined": "grey", 3896 "null": "bold", 3897 "string": "green", 3898 "date": "magenta", 3899 // "name": intentionally not styling 3900 "regexp": "red" 3901 }; 3902 function stylizeWithColor(str, styleType) { 3903 var style = inspect.styles[styleType]; 3904 if (style) { 3905 return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; 3906 } else { 3907 return str; 3908 } 3909 } 3910 function stylizeNoColor(str, styleType) { 3911 return str; 3912 } 3913 function arrayToHash(array) { 3914 var hash = {}; 3915 array.forEach(function(val, idx) { 3916 hash[val] = true; 3917 }); 3918 return hash; 3919 } 3920 function formatValue(ctx, value, recurseTimes) { 3921 if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special 3922 value.inspect !== exports3.inspect && // Also filter out any prototype objects using the circular check. 3923 !(value.constructor && value.constructor.prototype === value)) { 3924 var ret = value.inspect(recurseTimes, ctx); 3925 if (!isString(ret)) { 3926 ret = formatValue(ctx, ret, recurseTimes); 3927 } 3928 return ret; 3929 } 3930 var primitive = formatPrimitive(ctx, value); 3931 if (primitive) { 3932 return primitive; 3933 } 3934 var keys = Object.keys(value); 3935 var visibleKeys = arrayToHash(keys); 3936 if (ctx.showHidden) { 3937 keys = Object.getOwnPropertyNames(value); 3938 } 3939 if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { 3940 return formatError(value); 3941 } 3942 if (keys.length === 0) { 3943 if (isFunction(value)) { 3944 var name = value.name ? ": " + value.name : ""; 3945 return ctx.stylize("[Function" + name + "]", "special"); 3946 } 3947 if (isRegExp(value)) { 3948 return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); 3949 } 3950 if (isDate(value)) { 3951 return ctx.stylize(Date.prototype.toString.call(value), "date"); 3952 } 3953 if (isError(value)) { 3954 return formatError(value); 3955 } 3956 } 3957 var base = "", array = false, braces = ["{", "}"]; 3958 if (isArray2(value)) { 3959 array = true; 3960 braces = ["[", "]"]; 3961 } 3962 if (isFunction(value)) { 3963 var n = value.name ? ": " + value.name : ""; 3964 base = " [Function" + n + "]"; 3965 } 3966 if (isRegExp(value)) { 3967 base = " " + RegExp.prototype.toString.call(value); 3968 } 3969 if (isDate(value)) { 3970 base = " " + Date.prototype.toUTCString.call(value); 3971 } 3972 if (isError(value)) { 3973 base = " " + formatError(value); 3974 } 3975 if (keys.length === 0 && (!array || value.length == 0)) { 3976 return braces[0] + base + braces[1]; 3977 } 3978 if (recurseTimes < 0) { 3979 if (isRegExp(value)) { 3980 return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); 3981 } else { 3982 return ctx.stylize("[Object]", "special"); 3983 } 3984 } 3985 ctx.seen.push(value); 3986 var output; 3987 if (array) { 3988 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); 3989 } else { 3990 output = keys.map(function(key) { 3991 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); 3992 }); 3993 } 3994 ctx.seen.pop(); 3995 return reduceToSingleString(output, base, braces); 3996 } 3997 function formatPrimitive(ctx, value) { 3998 if (isUndefined(value)) 3999 return ctx.stylize("undefined", "undefined"); 4000 if (isString(value)) { 4001 var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; 4002 return ctx.stylize(simple, "string"); 4003 } 4004 if (isNumber(value)) 4005 return ctx.stylize("" + value, "number"); 4006 if (isBoolean(value)) 4007 return ctx.stylize("" + value, "boolean"); 4008 if (isNull(value)) 4009 return ctx.stylize("null", "null"); 4010 } 4011 function formatError(value) { 4012 return "[" + Error.prototype.toString.call(value) + "]"; 4013 } 4014 function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { 4015 var output = []; 4016 for (var i = 0, l = value.length; i < l; ++i) { 4017 if (hasOwnProperty(value, String(i))) { 4018 output.push(formatProperty( 4019 ctx, 4020 value, 4021 recurseTimes, 4022 visibleKeys, 4023 String(i), 4024 true 4025 )); 4026 } else { 4027 output.push(""); 4028 } 4029 } 4030 keys.forEach(function(key) { 4031 if (!key.match(/^\d+$/)) { 4032 output.push(formatProperty( 4033 ctx, 4034 value, 4035 recurseTimes, 4036 visibleKeys, 4037 key, 4038 true 4039 )); 4040 } 4041 }); 4042 return output; 4043 } 4044 function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { 4045 var name, str, desc; 4046 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; 4047 if (desc.get) { 4048 if (desc.set) { 4049 str = ctx.stylize("[Getter/Setter]", "special"); 4050 } else { 4051 str = ctx.stylize("[Getter]", "special"); 4052 } 4053 } else { 4054 if (desc.set) {
vendor: 5,107 bytes, lines 4055-4209
4055 str = ctx.stylize("[Setter]", "special"); 4056 } 4057 } 4058 if (!hasOwnProperty(visibleKeys, key)) { 4059 name = "[" + key + "]"; 4060 } 4061 if (!str) { 4062 if (ctx.seen.indexOf(desc.value) < 0) { 4063 if (isNull(recurseTimes)) { 4064 str = formatValue(ctx, desc.value, null); 4065 } else { 4066 str = formatValue(ctx, desc.value, recurseTimes - 1); 4067 } 4068 if (str.indexOf("\n") > -1) { 4069 if (array) { 4070 str = str.split("\n").map(function(line) { 4071 return " " + line; 4072 }).join("\n").slice(2); 4073 } else { 4074 str = "\n" + str.split("\n").map(function(line) { 4075 return " " + line; 4076 }).join("\n"); 4077 } 4078 } 4079 } else { 4080 str = ctx.stylize("[Circular]", "special"); 4081 } 4082 } 4083 if (isUndefined(name)) { 4084 if (array && key.match(/^\d+$/)) { 4085 return str; 4086 } 4087 name = JSON.stringify("" + key); 4088 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { 4089 name = name.slice(1, -1); 4090 name = ctx.stylize(name, "name"); 4091 } else { 4092 name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); 4093 name = ctx.stylize(name, "string"); 4094 } 4095 } 4096 return name + ": " + str; 4097 } 4098 function reduceToSingleString(output, base, braces) { 4099 var length = output.reduce(function(prev, cur) { 4100 if (cur.indexOf("\n") >= 0) 4101 ; 4102 return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; 4103 }, 0); 4104 if (length > 60) { 4105 return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; 4106 } 4107 return braces[0] + base + " " + output.join(", ") + " " + braces[1]; 4108 } 4109 exports3.types = requireTypes(); 4110 function isArray2(ar) { 4111 return Array.isArray(ar); 4112 } 4113 exports3.isArray = isArray2; 4114 function isBoolean(arg) { 4115 return typeof arg === "boolean"; 4116 } 4117 exports3.isBoolean = isBoolean; 4118 function isNull(arg) { 4119 return arg === null; 4120 } 4121 exports3.isNull = isNull; 4122 function isNullOrUndefined(arg) { 4123 return arg == null; 4124 } 4125 exports3.isNullOrUndefined = isNullOrUndefined; 4126 function isNumber(arg) { 4127 return typeof arg === "number"; 4128 } 4129 exports3.isNumber = isNumber; 4130 function isString(arg) { 4131 return typeof arg === "string"; 4132 } 4133 exports3.isString = isString; 4134 function isSymbol(arg) { 4135 return typeof arg === "symbol"; 4136 } 4137 exports3.isSymbol = isSymbol; 4138 function isUndefined(arg) { 4139 return arg === void 0; 4140 } 4141 exports3.isUndefined = isUndefined; 4142 function isRegExp(re) { 4143 return isObject(re) && objectToString(re) === "[object RegExp]"; 4144 } 4145 exports3.isRegExp = isRegExp; 4146 exports3.types.isRegExp = isRegExp; 4147 function isObject(arg) { 4148 return typeof arg === "object" && arg !== null; 4149 } 4150 exports3.isObject = isObject; 4151 function isDate(d) { 4152 return isObject(d) && objectToString(d) === "[object Date]"; 4153 } 4154 exports3.isDate = isDate; 4155 exports3.types.isDate = isDate; 4156 function isError(e) { 4157 return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); 4158 } 4159 exports3.isError = isError; 4160 exports3.types.isNativeError = isError; 4161 function isFunction(arg) { 4162 return typeof arg === "function"; 4163 } 4164 exports3.isFunction = isFunction; 4165 function isPrimitive(arg) { 4166 return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol 4167 typeof arg === "undefined"; 4168 } 4169 exports3.isPrimitive = isPrimitive; 4170 exports3.isBuffer = requireIsBufferBrowser(); 4171 function objectToString(o) { 4172 return Object.prototype.toString.call(o); 4173 } 4174 function pad(n) { 4175 return n < 10 ? "0" + n.toString(10) : n.toString(10); 4176 } 4177 var months = [ 4178 "Jan", 4179 "Feb", 4180 "Mar", 4181 "Apr", 4182 "May", 4183 "Jun", 4184 "Jul", 4185 "Aug", 4186 "Sep", 4187 "Oct", 4188 "Nov", 4189 "Dec" 4190 ]; 4191 function timestamp() { 4192 var d = /* @__PURE__ */ new Date(); 4193 var time = [ 4194 pad(d.getHours()), 4195 pad(d.getMinutes()), 4196 pad(d.getSeconds()) 4197 ].join(":"); 4198 return [d.getDate(), months[d.getMonth()], time].join(" "); 4199 } 4200 exports3.log = function() { 4201 console.log("%s - %s", timestamp(), exports3.format.apply(exports3, arguments)); 4202 }; 4203 exports3.inherits = inherits_browserExports; 4204 exports3._extend = function(origin, add) { 4205 if (!add || !isObject(add)) 4206 return origin; 4207 var keys = Object.keys(add); 4208 var i = keys.length; 4209 while (i--) {
vendor: 4,749 bytes, lines 4210-4344
4210 origin[keys[i]] = add[keys[i]]; 4211 } 4212 return origin; 4213 }; 4214 function hasOwnProperty(obj, prop) { 4215 return Object.prototype.hasOwnProperty.call(obj, prop); 4216 } 4217 var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; 4218 exports3.promisify = function promisify(original) { 4219 if (typeof original !== "function") 4220 throw new TypeError('The "original" argument must be of type Function'); 4221 if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { 4222 var fn = original[kCustomPromisifiedSymbol]; 4223 if (typeof fn !== "function") { 4224 throw new TypeError('The "util.promisify.custom" argument must be of type Function'); 4225 } 4226 Object.defineProperty(fn, kCustomPromisifiedSymbol, { 4227 value: fn, 4228 enumerable: false, 4229 writable: false, 4230 configurable: true 4231 }); 4232 return fn; 4233 } 4234 function fn() { 4235 var promiseResolve, promiseReject; 4236 var promise = new Promise(function(resolve2, reject) { 4237 promiseResolve = resolve2; 4238 promiseReject = reject; 4239 }); 4240 var args = []; 4241 for (var i = 0; i < arguments.length; i++) { 4242 args.push(arguments[i]); 4243 } 4244 args.push(function(err, value) { 4245 if (err) { 4246 promiseReject(err); 4247 } else { 4248 promiseResolve(value); 4249 } 4250 }); 4251 try { 4252 original.apply(this, args); 4253 } catch (err) { 4254 promiseReject(err); 4255 } 4256 return promise; 4257 } 4258 Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); 4259 if (kCustomPromisifiedSymbol) 4260 Object.defineProperty(fn, kCustomPromisifiedSymbol, { 4261 value: fn, 4262 enumerable: false, 4263 writable: false, 4264 configurable: true 4265 }); 4266 return Object.defineProperties( 4267 fn, 4268 getOwnPropertyDescriptors(original) 4269 ); 4270 }; 4271 exports3.promisify.custom = kCustomPromisifiedSymbol; 4272 function callbackifyOnRejected(reason, cb) { 4273 if (!reason) { 4274 var newReason = new Error("Promise was rejected with a falsy value"); 4275 newReason.reason = reason; 4276 reason = newReason; 4277 } 4278 return cb(reason); 4279 } 4280 function callbackify(original) { 4281 if (typeof original !== "function") { 4282 throw new TypeError('The "original" argument must be of type Function'); 4283 } 4284 function callbackified() { 4285 var args = []; 4286 for (var i = 0; i < arguments.length; i++) { 4287 args.push(arguments[i]); 4288 } 4289 var maybeCb = args.pop(); 4290 if (typeof maybeCb !== "function") { 4291 throw new TypeError("The last argument must be of type Function"); 4292 } 4293 var self2 = this; 4294 var cb = function() { 4295 return maybeCb.apply(self2, arguments); 4296 }; 4297 original.apply(this, args).then( 4298 function(ret) { 4299 process$1.nextTick(cb.bind(null, null, ret)); 4300 }, 4301 function(rej) { 4302 process$1.nextTick(callbackifyOnRejected.bind(null, rej, cb)); 4303 } 4304 ); 4305 } 4306 Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); 4307 Object.defineProperties( 4308 callbackified, 4309 getOwnPropertyDescriptors(original) 4310 ); 4311 return callbackified; 4312 } 4313 exports3.callbackify = callbackify; 4314 })(util); 4315 return util; 4316 } 4317 var buffer_list; 4318 var hasRequiredBuffer_list; 4319 function requireBuffer_list() { 4320 if (hasRequiredBuffer_list) 4321 return buffer_list; 4322 hasRequiredBuffer_list = 1; 4323 function ownKeys(object, enumerableOnly) { 4324 var keys = Object.keys(object); 4325 if (Object.getOwnPropertySymbols) { 4326 var symbols = Object.getOwnPropertySymbols(object); 4327 if (enumerableOnly) 4328 symbols = symbols.filter(function(sym) { 4329 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 4330 }); 4331 keys.push.apply(keys, symbols); 4332 } 4333 return keys; 4334 } 4335 function _objectSpread(target) { 4336 for (var i = 1; i < arguments.length; i++) { 4337 var source = arguments[i] != null ? arguments[i] : {}; 4338 if (i % 2) { 4339 ownKeys(Object(source), true).forEach(function(key) { 4340 _defineProperty(target, key, source[key]); 4341 }); 4342 } else if (Object.getOwnPropertyDescriptors) { 4343 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 4344 } else {
vendor: 8,703 bytes, lines 4345-4630
4345 ownKeys(Object(source)).forEach(function(key) { 4346 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 4347 }); 4348 } 4349 } 4350 return target; 4351 } 4352 function _defineProperty(obj, key, value) { 4353 if (key in obj) { 4354 Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); 4355 } else { 4356 obj[key] = value; 4357 } 4358 return obj; 4359 } 4360 function _classCallCheck(instance, Constructor) { 4361 if (!(instance instanceof Constructor)) { 4362 throw new TypeError("Cannot call a class as a function"); 4363 } 4364 } 4365 function _defineProperties(target, props) { 4366 for (var i = 0; i < props.length; i++) { 4367 var descriptor = props[i]; 4368 descriptor.enumerable = descriptor.enumerable || false; 4369 descriptor.configurable = true; 4370 if ("value" in descriptor) 4371 descriptor.writable = true; 4372 Object.defineProperty(target, descriptor.key, descriptor); 4373 } 4374 } 4375 function _createClass(Constructor, protoProps, staticProps) { 4376 if (protoProps) 4377 _defineProperties(Constructor.prototype, protoProps); 4378 if (staticProps) 4379 _defineProperties(Constructor, staticProps); 4380 return Constructor; 4381 } 4382 var _require = requireBuffer(), Buffer2 = _require.Buffer; 4383 var _require2 = requireUtil(), inspect = _require2.inspect; 4384 var custom = inspect && inspect.custom || "inspect"; 4385 function copyBuffer(src, target, offset) { 4386 Buffer2.prototype.copy.call(src, target, offset); 4387 } 4388 buffer_list = /* @__PURE__ */ function() { 4389 function BufferList() { 4390 _classCallCheck(this, BufferList); 4391 this.head = null; 4392 this.tail = null; 4393 this.length = 0; 4394 } 4395 _createClass(BufferList, [{ 4396 key: "push", 4397 value: function push(v) { 4398 var entry = { 4399 data: v, 4400 next: null 4401 }; 4402 if (this.length > 0) 4403 this.tail.next = entry; 4404 else 4405 this.head = entry; 4406 this.tail = entry; 4407 ++this.length; 4408 } 4409 }, { 4410 key: "unshift", 4411 value: function unshift(v) { 4412 var entry = { 4413 data: v, 4414 next: this.head 4415 }; 4416 if (this.length === 0) 4417 this.tail = entry; 4418 this.head = entry; 4419 ++this.length; 4420 } 4421 }, { 4422 key: "shift", 4423 value: function shift() { 4424 if (this.length === 0) 4425 return; 4426 var ret = this.head.data; 4427 if (this.length === 1) 4428 this.head = this.tail = null; 4429 else 4430 this.head = this.head.next; 4431 --this.length; 4432 return ret; 4433 } 4434 }, { 4435 key: "clear", 4436 value: function clear() { 4437 this.head = this.tail = null; 4438 this.length = 0; 4439 } 4440 }, { 4441 key: "join", 4442 value: function join(s) { 4443 if (this.length === 0) 4444 return ""; 4445 var p = this.head; 4446 var ret = "" + p.data; 4447 while (p = p.next) { 4448 ret += s + p.data; 4449 } 4450 return ret; 4451 } 4452 }, { 4453 key: "concat", 4454 value: function concat(n) { 4455 if (this.length === 0) 4456 return Buffer2.alloc(0); 4457 var ret = Buffer2.allocUnsafe(n >>> 0); 4458 var p = this.head; 4459 var i = 0; 4460 while (p) { 4461 copyBuffer(p.data, ret, i); 4462 i += p.data.length; 4463 p = p.next; 4464 } 4465 return ret; 4466 } 4467 // Consumes a specified amount of bytes or characters from the buffered data. 4468 }, { 4469 key: "consume", 4470 value: function consume(n, hasStrings) { 4471 var ret; 4472 if (n < this.head.data.length) { 4473 ret = this.head.data.slice(0, n); 4474 this.head.data = this.head.data.slice(n); 4475 } else if (n === this.head.data.length) { 4476 ret = this.shift(); 4477 } else { 4478 ret = hasStrings ? this._getString(n) : this._getBuffer(n); 4479 } 4480 return ret; 4481 } 4482 }, { 4483 key: "first", 4484 value: function first() { 4485 return this.head.data; 4486 } 4487 // Consumes a specified amount of characters from the buffered data. 4488 }, { 4489 key: "_getString", 4490 value: function _getString(n) { 4491 var p = this.head; 4492 var c = 1; 4493 var ret = p.data; 4494 n -= ret.length; 4495 while (p = p.next) { 4496 var str = p.data; 4497 var nb = n > str.length ? str.length : n; 4498 if (nb === str.length) 4499 ret += str; 4500 else 4501 ret += str.slice(0, n); 4502 n -= nb; 4503 if (n === 0) { 4504 if (nb === str.length) { 4505 ++c; 4506 if (p.next) 4507 this.head = p.next; 4508 else 4509 this.head = this.tail = null; 4510 } else { 4511 this.head = p; 4512 p.data = str.slice(nb); 4513 } 4514 break; 4515 } 4516 ++c; 4517 } 4518 this.length -= c; 4519 return ret; 4520 } 4521 // Consumes a specified amount of bytes from the buffered data. 4522 }, { 4523 key: "_getBuffer", 4524 value: function _getBuffer(n) { 4525 var ret = Buffer2.allocUnsafe(n); 4526 var p = this.head; 4527 var c = 1; 4528 p.data.copy(ret); 4529 n -= p.data.length; 4530 while (p = p.next) { 4531 var buf = p.data; 4532 var nb = n > buf.length ? buf.length : n; 4533 buf.copy(ret, ret.length - n, 0, nb); 4534 n -= nb; 4535 if (n === 0) { 4536 if (nb === buf.length) { 4537 ++c; 4538 if (p.next) 4539 this.head = p.next; 4540 else 4541 this.head = this.tail = null; 4542 } else { 4543 this.head = p; 4544 p.data = buf.slice(nb); 4545 } 4546 break; 4547 } 4548 ++c; 4549 } 4550 this.length -= c; 4551 return ret; 4552 } 4553 // Make sure the linked list only shows the minimal necessary information. 4554 }, { 4555 key: custom, 4556 value: function value(_, options2) { 4557 return inspect(this, _objectSpread({}, options2, { 4558 // Only inspect one level. 4559 depth: 0, 4560 // It should not recurse. 4561 customInspect: false 4562 })); 4563 } 4564 }]); 4565 return BufferList; 4566 }(); 4567 return buffer_list; 4568 } 4569 var destroy_1; 4570 var hasRequiredDestroy; 4571 function requireDestroy() { 4572 if (hasRequiredDestroy) 4573 return destroy_1; 4574 hasRequiredDestroy = 1; 4575 function destroy(err, cb) { 4576 var _this = this; 4577 var readableDestroyed = this._readableState && this._readableState.destroyed; 4578 var writableDestroyed = this._writableState && this._writableState.destroyed; 4579 if (readableDestroyed || writableDestroyed) { 4580 if (cb) { 4581 cb(err); 4582 } else if (err) { 4583 if (!this._writableState) { 4584 process$1.nextTick(emitErrorNT, this, err); 4585 } else if (!this._writableState.errorEmitted) { 4586 this._writableState.errorEmitted = true; 4587 process$1.nextTick(emitErrorNT, this, err); 4588 } 4589 } 4590 return this; 4591 } 4592 if (this._readableState) { 4593 this._readableState.destroyed = true; 4594 } 4595 if (this._writableState) { 4596 this._writableState.destroyed = true; 4597 } 4598 this._destroy(err || null, function(err2) { 4599 if (!cb && err2) { 4600 if (!_this._writableState) { 4601 process$1.nextTick(emitErrorAndCloseNT, _this, err2); 4602 } else if (!_this._writableState.errorEmitted) { 4603 _this._writableState.errorEmitted = true; 4604 process$1.nextTick(emitErrorAndCloseNT, _this, err2); 4605 } else { 4606 process$1.nextTick(emitCloseNT, _this); 4607 } 4608 } else if (cb) { 4609 process$1.nextTick(emitCloseNT, _this); 4610 cb(err2); 4611 } else { 4612 process$1.nextTick(emitCloseNT, _this); 4613 } 4614 }); 4615 return this; 4616 } 4617 function emitErrorAndCloseNT(self2, err) { 4618 emitErrorNT(self2, err); 4619 emitCloseNT(self2); 4620 } 4621 function emitCloseNT(self2) { 4622 if (self2._writableState && !self2._writableState.emitClose) 4623 return; 4624 if (self2._readableState && !self2._readableState.emitClose) 4625 return; 4626 self2.emit("close"); 4627 } 4628 function undestroy() { 4629 if (this._readableState) { 4630 this._readableState.destroyed = false;
vendor: 4,362 bytes, lines 4631-4754
4631 this._readableState.reading = false; 4632 this._readableState.ended = false; 4633 this._readableState.endEmitted = false; 4634 } 4635 if (this._writableState) { 4636 this._writableState.destroyed = false; 4637 this._writableState.ended = false; 4638 this._writableState.ending = false; 4639 this._writableState.finalCalled = false; 4640 this._writableState.prefinished = false; 4641 this._writableState.finished = false; 4642 this._writableState.errorEmitted = false; 4643 } 4644 } 4645 function emitErrorNT(self2, err) { 4646 self2.emit("error", err); 4647 } 4648 function errorOrDestroy(stream, err) { 4649 var rState = stream._readableState; 4650 var wState = stream._writableState; 4651 if (rState && rState.autoDestroy || wState && wState.autoDestroy) 4652 stream.destroy(err); 4653 else 4654 stream.emit("error", err); 4655 } 4656 destroy_1 = { 4657 destroy, 4658 undestroy, 4659 errorOrDestroy 4660 }; 4661 return destroy_1; 4662 } 4663 var errorsBrowser = {}; 4664 var hasRequiredErrorsBrowser; 4665 function requireErrorsBrowser() { 4666 if (hasRequiredErrorsBrowser) 4667 return errorsBrowser; 4668 hasRequiredErrorsBrowser = 1; 4669 function _inheritsLoose(subClass, superClass) { 4670 subClass.prototype = Object.create(superClass.prototype); 4671 subClass.prototype.constructor = subClass; 4672 subClass.__proto__ = superClass; 4673 } 4674 var codes = {}; 4675 function createErrorType(code, message, Base) { 4676 if (!Base) { 4677 Base = Error; 4678 } 4679 function getMessage(arg1, arg2, arg3) { 4680 if (typeof message === "string") { 4681 return message; 4682 } else { 4683 return message(arg1, arg2, arg3); 4684 } 4685 } 4686 var NodeError = /* @__PURE__ */ function(_Base) { 4687 _inheritsLoose(NodeError2, _Base); 4688 function NodeError2(arg1, arg2, arg3) { 4689 return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; 4690 } 4691 return NodeError2; 4692 }(Base); 4693 NodeError.prototype.name = Base.name; 4694 NodeError.prototype.code = code; 4695 codes[code] = NodeError; 4696 } 4697 function oneOf(expected, thing) { 4698 if (Array.isArray(expected)) { 4699 var len = expected.length; 4700 expected = expected.map(function(i) { 4701 return String(i); 4702 }); 4703 if (len > 2) { 4704 return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; 4705 } else if (len === 2) { 4706 return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); 4707 } else { 4708 return "of ".concat(thing, " ").concat(expected[0]); 4709 } 4710 } else { 4711 return "of ".concat(thing, " ").concat(String(expected)); 4712 } 4713 } 4714 function startsWith(str, search, pos) { 4715 return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; 4716 } 4717 function endsWith(str, search, this_len) { 4718 if (this_len === void 0 || this_len > str.length) { 4719 this_len = str.length; 4720 } 4721 return str.substring(this_len - search.length, this_len) === search; 4722 } 4723 function includes(str, search, start) { 4724 if (typeof start !== "number") { 4725 start = 0; 4726 } 4727 if (start + search.length > str.length) { 4728 return false; 4729 } else { 4730 return str.indexOf(search, start) !== -1; 4731 } 4732 } 4733 createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { 4734 return 'The value "' + value + '" is invalid for option "' + name + '"'; 4735 }, TypeError); 4736 createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { 4737 var determiner; 4738 if (typeof expected === "string" && startsWith(expected, "not ")) { 4739 determiner = "must not be"; 4740 expected = expected.replace(/^not /, ""); 4741 } else { 4742 determiner = "must be"; 4743 } 4744 var msg; 4745 if (endsWith(name, " argument")) { 4746 msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); 4747 } else { 4748 var type = includes(name, ".") ? "property" : "argument"; 4749 msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); 4750 } 4751 msg += ". Received type ".concat(typeof actual); 4752 return msg; 4753 }, TypeError); 4754 createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
4755 createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { 4756 return "The " + name + " method is not implemented"; 4757 }); 4758 createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); 4759 createErrorType("ERR_STREAM_DESTROYED", function(name) { 4760 return "Cannot call " + name + " after a stream was destroyed"; 4761 }); 4762 createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); 4763 createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); 4764 createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); 4765 createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); 4766 createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { 4767 return "Unknown encoding: " + arg; 4768 }, TypeError); 4769 createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); 4770 errorsBrowser.codes = codes; 4771 return errorsBrowser; 4772 } 4773 var state; 4774 var hasRequiredState; 4775 function requireState() { 4776 if (hasRequiredState) 4777 return state; 4778 hasRequiredState = 1; 4779 var ERR_INVALID_OPT_VALUE = requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE; 4780 function highWaterMarkFrom(options2, isDuplex, duplexKey) { 4781 return options2.highWaterMark != null ? options2.highWaterMark : isDuplex ? options2[duplexKey] : null; 4782 } 4783 function getHighWaterMark(state2, options2, duplexKey, isDuplex) { 4784 var hwm = highWaterMarkFrom(options2, isDuplex, duplexKey); 4785 if (hwm != null) { 4786 if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { 4787 var name = isDuplex ? duplexKey : "highWaterMark"; 4788 throw new ERR_INVALID_OPT_VALUE(name, hwm); 4789 } 4790 return Math.floor(hwm); 4791 } 4792 return state2.objectMode ? 16 : 16 * 1024; 4793 } 4794 state = { 4795 getHighWaterMark 4796 }; 4797 return state; 4798 } 4799 var browser; 4800 var hasRequiredBrowser; 4801 function requireBrowser() { 4802 if (hasRequiredBrowser) 4803 return browser; 4804 hasRequiredBrowser = 1; 4805 browser = deprecate; 4806 function deprecate(fn, msg) { 4807 if (config("noDeprecation")) { 4808 return fn; 4809 } 4810 var warned = false; 4811 function deprecated() { 4812 if (!warned) { 4813 if (config("throwDeprecation")) { 4814 throw new Error(msg); 4815 } else if (config("traceDeprecation")) { 4816 console.trace(msg); 4817 } else { 4818 console.warn(msg); 4819 } 4820 warned = true; 4821 } 4822 return fn.apply(this, arguments); 4823 } 4824 return deprecated; 4825 } 4826 function config(name) { 4827 try { 4828 if (!commonjsGlobal.localStorage) 4829 return false; 4830 } catch (_) { 4831 return false; 4832 } 4833 var val = commonjsGlobal.localStorage[name]; 4834 if (null == val) 4835 return false; 4836 return String(val).toLowerCase() === "true"; 4837 } 4838 return browser; 4839 } 4840 var _stream_writable; 4841 var hasRequired_stream_writable; 4842 function require_stream_writable() { 4843 if (hasRequired_stream_writable) 4844 return _stream_writable; 4845 hasRequired_stream_writable = 1; 4846 _stream_writable = Writable; 4847 function CorkedRequest(state2) { 4848 var _this = this; 4849 this.next = null; 4850 this.entry = null; 4851 this.finish = function() { 4852 onCorkedFinish(_this, state2); 4853 }; 4854 } 4855 var Duplex; 4856 Writable.WritableState = WritableState; 4857 var internalUtil = { 4858 deprecate: requireBrowser() 4859 }; 4860 var Stream2 = requireStreamBrowser(); 4861 var Buffer2 = requireBuffer().Buffer; 4862 var OurUint8Array = commonjsGlobal.Uint8Array || function() { 4863 }; 4864 function _uint8ArrayToBuffer(chunk) { 4865 return Buffer2.from(chunk); 4866 } 4867 function _isUint8Array(obj) { 4868 return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; 4869 } 4870 var destroyImpl = requireDestroy(); 4871 var _require = requireState(), getHighWaterMark = _require.getHighWaterMark; 4872 var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENT
vendor: 4,649 bytes, lines 4872-4988
4872ED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; 4873 var errorOrDestroy = destroyImpl.errorOrDestroy; 4874 inherits_browserExports(Writable, Stream2); 4875 function nop() { 4876 } 4877 function WritableState(options2, stream, isDuplex) { 4878 Duplex = Duplex || require_stream_duplex(); 4879 options2 = options2 || {}; 4880 if (typeof isDuplex !== "boolean") 4881 isDuplex = stream instanceof Duplex; 4882 this.objectMode = !!options2.objectMode; 4883 if (isDuplex) 4884 this.objectMode = this.objectMode || !!options2.writableObjectMode; 4885 this.highWaterMark = getHighWaterMark(this, options2, "writableHighWaterMark", isDuplex); 4886 this.finalCalled = false; 4887 this.needDrain = false; 4888 this.ending = false; 4889 this.ended = false; 4890 this.finished = false; 4891 this.destroyed = false; 4892 var noDecode = options2.decodeStrings === false; 4893 this.decodeStrings = !noDecode; 4894 this.defaultEncoding = options2.defaultEncoding || "utf8"; 4895 this.length = 0; 4896 this.writing = false; 4897 this.corked = 0; 4898 this.sync = true; 4899 this.bufferProcessing = false; 4900 this.onwrite = function(er) { 4901 onwrite(stream, er); 4902 }; 4903 this.writecb = null; 4904 this.writelen = 0; 4905 this.bufferedRequest = null; 4906 this.lastBufferedRequest = null; 4907 this.pendingcb = 0; 4908 this.prefinished = false; 4909 this.errorEmitted = false; 4910 this.emitClose = options2.emitClose !== false; 4911 this.autoDestroy = !!options2.autoDestroy; 4912 this.bufferedRequestCount = 0; 4913 this.corkedRequestsFree = new CorkedRequest(this); 4914 } 4915 WritableState.prototype.getBuffer = function getBuffer() { 4916 var current = this.bufferedRequest; 4917 var out = []; 4918 while (current) { 4919 out.push(current); 4920 current = current.next; 4921 } 4922 return out; 4923 }; 4924 (function() { 4925 try { 4926 Object.defineProperty(WritableState.prototype, "buffer", { 4927 get: internalUtil.deprecate(function writableStateBufferGetter() { 4928 return this.getBuffer(); 4929 }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") 4930 }); 4931 } catch (_) { 4932 } 4933 })(); 4934 var realHasInstance; 4935 if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { 4936 realHasInstance = Function.prototype[Symbol.hasInstance]; 4937 Object.defineProperty(Writable, Symbol.hasInstance, { 4938 value: function value(object) { 4939 if (realHasInstance.call(this, object)) 4940 return true; 4941 if (this !== Writable) 4942 return false; 4943 return object && object._writableState instanceof WritableState; 4944 } 4945 }); 4946 } else { 4947 realHasInstance = function realHasInstance2(object) { 4948 return object instanceof this; 4949 }; 4950 } 4951 function Writable(options2) { 4952 Duplex = Duplex || require_stream_duplex(); 4953 var isDuplex = this instanceof Duplex; 4954 if (!isDuplex && !realHasInstance.call(Writable, this)) 4955 return new Writable(options2); 4956 this._writableState = new WritableState(options2, this, isDuplex); 4957 this.writable = true; 4958 if (options2) { 4959 if (typeof options2.write === "function") 4960 this._write = options2.write; 4961 if (typeof options2.writev === "function") 4962 this._writev = options2.writev; 4963 if (typeof options2.destroy === "function") 4964 this._destroy = options2.destroy; 4965 if (typeof options2.final === "function") 4966 this._final = options2.final; 4967 } 4968 Stream2.call(this); 4969 } 4970 Writable.prototype.pipe = function() { 4971 errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); 4972 }; 4973 function writeAfterEnd(stream, cb) { 4974 var er = new ERR_STREAM_WRITE_AFTER_END(); 4975 errorOrDestroy(stream, er); 4976 process$1.nextTick(cb, er); 4977 } 4978 function validChunk(stream, state2, chunk, cb) { 4979 var er; 4980 if (chunk === null) { 4981 er = new ERR_STREAM_NULL_VALUES(); 4982 } else if (typeof chunk !== "string" && !state2.objectMode) { 4983 er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); 4984 } 4985 if (er) { 4986 errorOrDestroy(stream, er); 4987 process$1.nextTick(cb, er); 4988 return false;
vendor: 4,201 bytes, lines 4989-5110
4989 } 4990 return true; 4991 } 4992 Writable.prototype.write = function(chunk, encoding, cb) { 4993 var state2 = this._writableState; 4994 var ret = false; 4995 var isBuf = !state2.objectMode && _isUint8Array(chunk); 4996 if (isBuf && !Buffer2.isBuffer(chunk)) { 4997 chunk = _uint8ArrayToBuffer(chunk); 4998 } 4999 if (typeof encoding === "function") { 5000 cb = encoding; 5001 encoding = null; 5002 } 5003 if (isBuf) 5004 encoding = "buffer"; 5005 else if (!encoding) 5006 encoding = state2.defaultEncoding; 5007 if (typeof cb !== "function") 5008 cb = nop; 5009 if (state2.ending) 5010 writeAfterEnd(this, cb); 5011 else if (isBuf || validChunk(this, state2, chunk, cb)) { 5012 state2.pendingcb++; 5013 ret = writeOrBuffer(this, state2, isBuf, chunk, encoding, cb); 5014 } 5015 return ret; 5016 }; 5017 Writable.prototype.cork = function() { 5018 this._writableState.corked++; 5019 }; 5020 Writable.prototype.uncork = function() { 5021 var state2 = this._writableState; 5022 if (state2.corked) { 5023 state2.corked--; 5024 if (!state2.writing && !state2.corked && !state2.bufferProcessing && state2.bufferedRequest) 5025 clearBuffer(this, state2); 5026 } 5027 }; 5028 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { 5029 if (typeof encoding === "string") 5030 encoding = encoding.toLowerCase(); 5031 if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) 5032 throw new ERR_UNKNOWN_ENCODING(encoding); 5033 this._writableState.defaultEncoding = encoding; 5034 return this; 5035 }; 5036 Object.defineProperty(Writable.prototype, "writableBuffer", { 5037 // making it explicit this property is not enumerable 5038 // because otherwise some prototype manipulation in 5039 // userland will fail 5040 enumerable: false, 5041 get: function get() { 5042 return this._writableState && this._writableState.getBuffer(); 5043 } 5044 }); 5045 function decodeChunk(state2, chunk, encoding) { 5046 if (!state2.objectMode && state2.decodeStrings !== false && typeof chunk === "string") { 5047 chunk = Buffer2.from(chunk, encoding); 5048 } 5049 return chunk; 5050 } 5051 Object.defineProperty(Writable.prototype, "writableHighWaterMark", { 5052 // making it explicit this property is not enumerable 5053 // because otherwise some prototype manipulation in 5054 // userland will fail 5055 enumerable: false, 5056 get: function get() { 5057 return this._writableState.highWaterMark; 5058 } 5059 }); 5060 function writeOrBuffer(stream, state2, isBuf, chunk, encoding, cb) { 5061 if (!isBuf) { 5062 var newChunk = decodeChunk(state2, chunk, encoding); 5063 if (chunk !== newChunk) { 5064 isBuf = true; 5065 encoding = "buffer"; 5066 chunk = newChunk; 5067 } 5068 } 5069 var len = state2.objectMode ? 1 : chunk.length; 5070 state2.length += len; 5071 var ret = state2.length < state2.highWaterMark; 5072 if (!ret) 5073 state2.needDrain = true; 5074 if (state2.writing || state2.corked) { 5075 var last = state2.lastBufferedRequest; 5076 state2.lastBufferedRequest = { 5077 chunk, 5078 encoding, 5079 isBuf, 5080 callback: cb, 5081 next: null 5082 }; 5083 if (last) { 5084 last.next = state2.lastBufferedRequest; 5085 } else { 5086 state2.bufferedRequest = state2.lastBufferedRequest; 5087 } 5088 state2.bufferedRequestCount += 1; 5089 } else { 5090 doWrite(stream, state2, false, len, chunk, encoding, cb); 5091 } 5092 return ret; 5093 } 5094 function doWrite(stream, state2, writev, len, chunk, encoding, cb) { 5095 state2.writelen = len; 5096 state2.writecb = cb; 5097 state2.writing = true; 5098 state2.sync = true; 5099 if (state2.destroyed) 5100 state2.onwrite(new ERR_STREAM_DESTROYED("write")); 5101 else if (writev) 5102 stream._writev(chunk, state2.onwrite); 5103 else 5104 stream._write(chunk, encoding, state2.onwrite); 5105 state2.sync = false; 5106 } 5107 function onwriteError(stream, state2, sync, er, cb) { 5108 --state2.pendingcb; 5109 if (sync) { 5110 process$1.nextTick(cb, er);
vendor: 5,894 bytes, lines 5111-5294
5111 process$1.nextTick(finishMaybe, stream, state2); 5112 stream._writableState.errorEmitted = true; 5113 errorOrDestroy(stream, er); 5114 } else { 5115 cb(er); 5116 stream._writableState.errorEmitted = true; 5117 errorOrDestroy(stream, er); 5118 finishMaybe(stream, state2); 5119 } 5120 } 5121 function onwriteStateUpdate(state2) { 5122 state2.writing = false; 5123 state2.writecb = null; 5124 state2.length -= state2.writelen; 5125 state2.writelen = 0; 5126 } 5127 function onwrite(stream, er) { 5128 var state2 = stream._writableState; 5129 var sync = state2.sync; 5130 var cb = state2.writecb; 5131 if (typeof cb !== "function") 5132 throw new ERR_MULTIPLE_CALLBACK(); 5133 onwriteStateUpdate(state2); 5134 if (er) 5135 onwriteError(stream, state2, sync, er, cb); 5136 else { 5137 var finished = needFinish(state2) || stream.destroyed; 5138 if (!finished && !state2.corked && !state2.bufferProcessing && state2.bufferedRequest) { 5139 clearBuffer(stream, state2); 5140 } 5141 if (sync) { 5142 process$1.nextTick(afterWrite, stream, state2, finished, cb); 5143 } else { 5144 afterWrite(stream, state2, finished, cb); 5145 } 5146 } 5147 } 5148 function afterWrite(stream, state2, finished, cb) { 5149 if (!finished) 5150 onwriteDrain(stream, state2); 5151 state2.pendingcb--; 5152 cb(); 5153 finishMaybe(stream, state2); 5154 } 5155 function onwriteDrain(stream, state2) { 5156 if (state2.length === 0 && state2.needDrain) { 5157 state2.needDrain = false; 5158 stream.emit("drain"); 5159 } 5160 } 5161 function clearBuffer(stream, state2) { 5162 state2.bufferProcessing = true; 5163 var entry = state2.bufferedRequest; 5164 if (stream._writev && entry && entry.next) { 5165 var l = state2.bufferedRequestCount; 5166 var buffer2 = new Array(l); 5167 var holder = state2.corkedRequestsFree; 5168 holder.entry = entry; 5169 var count = 0; 5170 var allBuffers = true; 5171 while (entry) { 5172 buffer2[count] = entry; 5173 if (!entry.isBuf) 5174 allBuffers = false; 5175 entry = entry.next; 5176 count += 1; 5177 } 5178 buffer2.allBuffers = allBuffers; 5179 doWrite(stream, state2, true, state2.length, buffer2, "", holder.finish); 5180 state2.pendingcb++; 5181 state2.lastBufferedRequest = null; 5182 if (holder.next) { 5183 state2.corkedRequestsFree = holder.next; 5184 holder.next = null; 5185 } else { 5186 state2.corkedRequestsFree = new CorkedRequest(state2); 5187 } 5188 state2.bufferedRequestCount = 0; 5189 } else { 5190 while (entry) { 5191 var chunk = entry.chunk; 5192 var encoding = entry.encoding; 5193 var cb = entry.callback; 5194 var len = state2.objectMode ? 1 : chunk.length; 5195 doWrite(stream, state2, false, len, chunk, encoding, cb); 5196 entry = entry.next; 5197 state2.bufferedRequestCount--; 5198 if (state2.writing) { 5199 break; 5200 } 5201 } 5202 if (entry === null) 5203 state2.lastBufferedRequest = null; 5204 } 5205 state2.bufferedRequest = entry; 5206 state2.bufferProcessing = false; 5207 } 5208 Writable.prototype._write = function(chunk, encoding, cb) { 5209 cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); 5210 }; 5211 Writable.prototype._writev = null; 5212 Writable.prototype.end = function(chunk, encoding, cb) { 5213 var state2 = this._writableState; 5214 if (typeof chunk === "function") { 5215 cb = chunk; 5216 chunk = null; 5217 encoding = null; 5218 } else if (typeof encoding === "function") { 5219 cb = encoding; 5220 encoding = null; 5221 } 5222 if (chunk !== null && chunk !== void 0) 5223 this.write(chunk, encoding); 5224 if (state2.corked) { 5225 state2.corked = 1; 5226 this.uncork(); 5227 } 5228 if (!state2.ending) 5229 endWritable(this, state2, cb); 5230 return this; 5231 }; 5232 Object.defineProperty(Writable.prototype, "writableLength", { 5233 // making it explicit this property is not enumerable 5234 // because otherwise some prototype manipulation in 5235 // userland will fail 5236 enumerable: false, 5237 get: function get() { 5238 return this._writableState.length; 5239 } 5240 }); 5241 function needFinish(state2) { 5242 return state2.ending && state2.length === 0 && state2.bufferedRequest === null && !state2.finished && !state2.writing; 5243 } 5244 function callFinal(stream, state2) { 5245 stream._final(function(err) { 5246 state2.pendingcb--; 5247 if (err) { 5248 errorOrDestroy(stream, err); 5249 } 5250 state2.prefinished = true; 5251 stream.emit("prefinish"); 5252 finishMaybe(stream, state2); 5253 }); 5254 } 5255 function prefinish(stream, state2) { 5256 if (!state2.prefinished && !state2.finalCalled) { 5257 if (typeof stream._final === "function" && !state2.destroyed) { 5258 state2.pendingcb++; 5259 state2.finalCalled = true; 5260 process$1.nextTick(callFinal, stream, state2); 5261 } else { 5262 state2.prefinished = true; 5263 stream.emit("prefinish"); 5264 } 5265 } 5266 } 5267 function finishMaybe(stream, state2) { 5268 var need = needFinish(state2); 5269 if (need) { 5270 prefinish(stream, state2); 5271 if (state2.pendingcb === 0) { 5272 state2.finished = true; 5273 stream.emit("finish"); 5274 if (state2.autoDestroy) { 5275 var rState = stream._readableState; 5276 if (!rState || rState.autoDestroy && rState.endEmitted) { 5277 stream.destroy(); 5278 } 5279 } 5280 } 5281 } 5282 return need; 5283 } 5284 function endWritable(stream, state2, cb) { 5285 state2.ending = true; 5286 finishMaybe(stream, state2); 5287 if (cb) { 5288 if (state2.finished) 5289 process$1.nextTick(cb); 5290 else 5291 stream.once("finish", cb); 5292 } 5293 state2.ended = true; 5294 stream.writable = false;
vendor: 5,446 bytes, lines 5295-5461
5295 } 5296 function onCorkedFinish(corkReq, state2, err) { 5297 var entry = corkReq.entry; 5298 corkReq.entry = null; 5299 while (entry) { 5300 var cb = entry.callback; 5301 state2.pendingcb--; 5302 cb(err); 5303 entry = entry.next; 5304 } 5305 state2.corkedRequestsFree.next = corkReq; 5306 } 5307 Object.defineProperty(Writable.prototype, "destroyed", { 5308 // making it explicit this property is not enumerable 5309 // because otherwise some prototype manipulation in 5310 // userland will fail 5311 enumerable: false, 5312 get: function get() { 5313 if (this._writableState === void 0) { 5314 return false; 5315 } 5316 return this._writableState.destroyed; 5317 }, 5318 set: function set(value) { 5319 if (!this._writableState) { 5320 return; 5321 } 5322 this._writableState.destroyed = value; 5323 } 5324 }); 5325 Writable.prototype.destroy = destroyImpl.destroy; 5326 Writable.prototype._undestroy = destroyImpl.undestroy; 5327 Writable.prototype._destroy = function(err, cb) { 5328 cb(err); 5329 }; 5330 return _stream_writable; 5331 } 5332 var _stream_duplex; 5333 var hasRequired_stream_duplex; 5334 function require_stream_duplex() { 5335 if (hasRequired_stream_duplex) 5336 return _stream_duplex; 5337 hasRequired_stream_duplex = 1; 5338 var objectKeys = Object.keys || function(obj) { 5339 var keys2 = []; 5340 for (var key in obj) { 5341 keys2.push(key); 5342 } 5343 return keys2; 5344 }; 5345 _stream_duplex = Duplex; 5346 var Readable = require_stream_readable(); 5347 var Writable = require_stream_writable(); 5348 inherits_browserExports(Duplex, Readable); 5349 { 5350 var keys = objectKeys(Writable.prototype); 5351 for (var v = 0; v < keys.length; v++) { 5352 var method = keys[v]; 5353 if (!Duplex.prototype[method]) 5354 Duplex.prototype[method] = Writable.prototype[method]; 5355 } 5356 } 5357 function Duplex(options2) { 5358 if (!(this instanceof Duplex)) 5359 return new Duplex(options2); 5360 Readable.call(this, options2); 5361 Writable.call(this, options2); 5362 this.allowHalfOpen = true; 5363 if (options2) { 5364 if (options2.readable === false) 5365 this.readable = false; 5366 if (options2.writable === false) 5367 this.writable = false; 5368 if (options2.allowHalfOpen === false) { 5369 this.allowHalfOpen = false; 5370 this.once("end", onend); 5371 } 5372 } 5373 } 5374 Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { 5375 // making it explicit this property is not enumerable 5376 // because otherwise some prototype manipulation in 5377 // userland will fail 5378 enumerable: false, 5379 get: function get() { 5380 return this._writableState.highWaterMark; 5381 } 5382 }); 5383 Object.defineProperty(Duplex.prototype, "writableBuffer", { 5384 // making it explicit this property is not enumerable 5385 // because otherwise some prototype manipulation in 5386 // userland will fail 5387 enumerable: false, 5388 get: function get() { 5389 return this._writableState && this._writableState.getBuffer(); 5390 } 5391 }); 5392 Object.defineProperty(Duplex.prototype, "writableLength", { 5393 // making it explicit this property is not enumerable 5394 // because otherwise some prototype manipulation in 5395 // userland will fail 5396 enumerable: false, 5397 get: function get() { 5398 return this._writableState.length; 5399 } 5400 }); 5401 function onend() { 5402 if (this._writableState.ended) 5403 return; 5404 process$1.nextTick(onEndNT, this); 5405 } 5406 function onEndNT(self2) { 5407 self2.end(); 5408 } 5409 Object.defineProperty(Duplex.prototype, "destroyed", { 5410 // making it explicit this property is not enumerable 5411 // because otherwise some prototype manipulation in 5412 // userland will fail 5413 enumerable: false, 5414 get: function get() { 5415 if (this._readableState === void 0 || this._writableState === void 0) { 5416 return false; 5417 } 5418 return this._readableState.destroyed && this._writableState.destroyed; 5419 }, 5420 set: function set(value) { 5421 if (this._readableState === void 0 || this._writableState === void 0) { 5422 return; 5423 } 5424 this._readableState.destroyed = value; 5425 this._writableState.destroyed = value; 5426 } 5427 }); 5428 return _stream_duplex; 5429 } 5430 var string_decoder = {}; 5431 var safeBuffer = { exports: {} }; 5432 var hasRequiredSafeBuffer; 5433 function requireSafeBuffer() { 5434 if (hasRequiredSafeBuffer) 5435 return safeBuffer.exports; 5436 hasRequiredSafeBuffer = 1; 5437 (function(module2, exports3) { 5438 var buffer2 = requireBuffer(); 5439 var Buffer2 = buffer2.Buffer; 5440 function copyProps(src, dst) { 5441 for (var key in src) { 5442 dst[key] = src[key]; 5443 } 5444 } 5445 if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) { 5446 module2.exports = buffer2; 5447 } else { 5448 copyProps(buffer2, exports3); 5449 exports3.Buffer = SafeBuffer; 5450 } 5451 function SafeBuffer(arg, encodingOrOffset, length) { 5452 return Buffer2(arg, encodingOrOffset, length); 5453 } 5454 copyProps(Buffer2, SafeBuffer); 5455 SafeBuffer.from = function(arg, encodingOrOffset, length) { 5456 if (typeof arg === "number") { 5457 throw new TypeError("Argument must not be a number"); 5458 } 5459 return Buffer2(arg, encodingOrOffset, length); 5460 }; 5461 SafeBuffer.alloc = function(size, fill, encoding) {
vendor: 6,836 bytes, lines 5462-5703
5462 if (typeof size !== "number") { 5463 throw new TypeError("Argument must be a number"); 5464 } 5465 var buf = Buffer2(size); 5466 if (fill !== void 0) { 5467 if (typeof encoding === "string") { 5468 buf.fill(fill, encoding); 5469 } else { 5470 buf.fill(fill); 5471 } 5472 } else { 5473 buf.fill(0); 5474 } 5475 return buf; 5476 }; 5477 SafeBuffer.allocUnsafe = function(size) { 5478 if (typeof size !== "number") { 5479 throw new TypeError("Argument must be a number"); 5480 } 5481 return Buffer2(size); 5482 }; 5483 SafeBuffer.allocUnsafeSlow = function(size) { 5484 if (typeof size !== "number") { 5485 throw new TypeError("Argument must be a number"); 5486 } 5487 return buffer2.SlowBuffer(size); 5488 }; 5489 })(safeBuffer, safeBuffer.exports); 5490 return safeBuffer.exports; 5491 } 5492 var hasRequiredString_decoder; 5493 function requireString_decoder() { 5494 if (hasRequiredString_decoder) 5495 return string_decoder; 5496 hasRequiredString_decoder = 1; 5497 var Buffer2 = requireSafeBuffer().Buffer; 5498 var isEncoding = Buffer2.isEncoding || function(encoding) { 5499 encoding = "" + encoding; 5500 switch (encoding && encoding.toLowerCase()) { 5501 case "hex": 5502 case "utf8": 5503 case "utf-8": 5504 case "ascii": 5505 case "binary": 5506 case "base64": 5507 case "ucs2": 5508 case "ucs-2": 5509 case "utf16le": 5510 case "utf-16le": 5511 case "raw": 5512 return true; 5513 default: 5514 return false; 5515 } 5516 }; 5517 function _normalizeEncoding(enc) { 5518 if (!enc) 5519 return "utf8"; 5520 var retried; 5521 while (true) { 5522 switch (enc) { 5523 case "utf8": 5524 case "utf-8": 5525 return "utf8"; 5526 case "ucs2": 5527 case "ucs-2": 5528 case "utf16le": 5529 case "utf-16le": 5530 return "utf16le"; 5531 case "latin1": 5532 case "binary": 5533 return "latin1"; 5534 case "base64": 5535 case "ascii": 5536 case "hex": 5537 return enc; 5538 default: 5539 if (retried) 5540 return; 5541 enc = ("" + enc).toLowerCase(); 5542 retried = true; 5543 } 5544 } 5545 } 5546 function normalizeEncoding(enc) { 5547 var nenc = _normalizeEncoding(enc); 5548 if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) 5549 throw new Error("Unknown encoding: " + enc); 5550 return nenc || enc; 5551 } 5552 string_decoder.StringDecoder = StringDecoder; 5553 function StringDecoder(encoding) { 5554 this.encoding = normalizeEncoding(encoding); 5555 var nb; 5556 switch (this.encoding) { 5557 case "utf16le": 5558 this.text = utf16Text; 5559 this.end = utf16End; 5560 nb = 4; 5561 break; 5562 case "utf8": 5563 this.fillLast = utf8FillLast; 5564 nb = 4; 5565 break; 5566 case "base64": 5567 this.text = base64Text; 5568 this.end = base64End; 5569 nb = 3; 5570 break; 5571 default: 5572 this.write = simpleWrite; 5573 this.end = simpleEnd; 5574 return; 5575 } 5576 this.lastNeed = 0; 5577 this.lastTotal = 0; 5578 this.lastChar = Buffer2.allocUnsafe(nb); 5579 } 5580 StringDecoder.prototype.write = function(buf) { 5581 if (buf.length === 0) 5582 return ""; 5583 var r; 5584 var i; 5585 if (this.lastNeed) { 5586 r = this.fillLast(buf); 5587 if (r === void 0) 5588 return ""; 5589 i = this.lastNeed; 5590 this.lastNeed = 0; 5591 } else { 5592 i = 0; 5593 } 5594 if (i < buf.length) 5595 return r ? r + this.text(buf, i) : this.text(buf, i); 5596 return r || ""; 5597 }; 5598 StringDecoder.prototype.end = utf8End; 5599 StringDecoder.prototype.text = utf8Text; 5600 StringDecoder.prototype.fillLast = function(buf) { 5601 if (this.lastNeed <= buf.length) { 5602 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); 5603 return this.lastChar.toString(this.encoding, 0, this.lastTotal); 5604 } 5605 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); 5606 this.lastNeed -= buf.length; 5607 }; 5608 function utf8CheckByte(byte) { 5609 if (byte <= 127) 5610 return 0; 5611 else if (byte >> 5 === 6) 5612 return 2; 5613 else if (byte >> 4 === 14) 5614 return 3; 5615 else if (byte >> 3 === 30) 5616 return 4; 5617 return byte >> 6 === 2 ? -1 : -2; 5618 } 5619 function utf8CheckIncomplete(self2, buf, i) { 5620 var j = buf.length - 1; 5621 if (j < i) 5622 return 0; 5623 var nb = utf8CheckByte(buf[j]); 5624 if (nb >= 0) { 5625 if (nb > 0) 5626 self2.lastNeed = nb - 1; 5627 return nb; 5628 } 5629 if (--j < i || nb === -2) 5630 return 0; 5631 nb = utf8CheckByte(buf[j]); 5632 if (nb >= 0) { 5633 if (nb > 0) 5634 self2.lastNeed = nb - 2; 5635 return nb; 5636 } 5637 if (--j < i || nb === -2) 5638 return 0; 5639 nb = utf8CheckByte(buf[j]); 5640 if (nb >= 0) { 5641 if (nb > 0) { 5642 if (nb === 2) 5643 nb = 0; 5644 else 5645 self2.lastNeed = nb - 3; 5646 } 5647 return nb; 5648 } 5649 return 0; 5650 } 5651 function utf8CheckExtraBytes(self2, buf, p) { 5652 if ((buf[0] & 192) !== 128) { 5653 self2.lastNeed = 0; 5654 return "�"; 5655 } 5656 if (self2.lastNeed > 1 && buf.length > 1) { 5657 if ((buf[1] & 192) !== 128) { 5658 self2.lastNeed = 1; 5659 return "�"; 5660 } 5661 if (self2.lastNeed > 2 && buf.length > 2) { 5662 if ((buf[2] & 192) !== 128) { 5663 self2.lastNeed = 2; 5664 return "�"; 5665 } 5666 } 5667 } 5668 } 5669 function utf8FillLast(buf) { 5670 var p = this.lastTotal - this.lastNeed; 5671 var r = utf8CheckExtraBytes(this, buf); 5672 if (r !== void 0) 5673 return r; 5674 if (this.lastNeed <= buf.length) { 5675 buf.copy(this.lastChar, p, 0, this.lastNeed); 5676 return this.lastChar.toString(this.encoding, 0, this.lastTotal); 5677 } 5678 buf.copy(this.lastChar, p, 0, buf.length); 5679 this.lastNeed -= buf.length; 5680 } 5681 function utf8Text(buf, i) { 5682 var total = utf8CheckIncomplete(this, buf, i); 5683 if (!this.lastNeed) 5684 return buf.toString("utf8", i); 5685 this.lastTotal = total; 5686 var end = buf.length - (total - this.lastNeed); 5687 buf.copy(this.lastChar, 0, end); 5688 return buf.toString("utf8", i, end); 5689 } 5690 function utf8End(buf) { 5691 var r = buf && buf.length ? this.write(buf) : ""; 5692 if (this.lastNeed) 5693 return r + "�"; 5694 return r; 5695 } 5696 function utf16Text(buf, i) { 5697 if ((buf.length - i) % 2 === 0) { 5698 var r = buf.toString("utf16le", i); 5699 if (r) { 5700 var c = r.charCodeAt(r.length - 1); 5701 if (c >= 55296 && c <= 56319) { 5702 this.lastNeed = 2; 5703 this.lastTotal = 4;
vendor: 9,211 bytes, lines 5704-5977
5704 this.lastChar[0] = buf[buf.length - 2]; 5705 this.lastChar[1] = buf[buf.length - 1]; 5706 return r.slice(0, -1); 5707 } 5708 } 5709 return r; 5710 } 5711 this.lastNeed = 1; 5712 this.lastTotal = 2; 5713 this.lastChar[0] = buf[buf.length - 1]; 5714 return buf.toString("utf16le", i, buf.length - 1); 5715 } 5716 function utf16End(buf) { 5717 var r = buf && buf.length ? this.write(buf) : ""; 5718 if (this.lastNeed) { 5719 var end = this.lastTotal - this.lastNeed; 5720 return r + this.lastChar.toString("utf16le", 0, end); 5721 } 5722 return r; 5723 } 5724 function base64Text(buf, i) { 5725 var n = (buf.length - i) % 3; 5726 if (n === 0) 5727 return buf.toString("base64", i); 5728 this.lastNeed = 3 - n; 5729 this.lastTotal = 3; 5730 if (n === 1) { 5731 this.lastChar[0] = buf[buf.length - 1]; 5732 } else { 5733 this.lastChar[0] = buf[buf.length - 2]; 5734 this.lastChar[1] = buf[buf.length - 1]; 5735 } 5736 return buf.toString("base64", i, buf.length - n); 5737 } 5738 function base64End(buf) { 5739 var r = buf && buf.length ? this.write(buf) : ""; 5740 if (this.lastNeed) 5741 return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); 5742 return r; 5743 } 5744 function simpleWrite(buf) { 5745 return buf.toString(this.encoding); 5746 } 5747 function simpleEnd(buf) { 5748 return buf && buf.length ? this.write(buf) : ""; 5749 } 5750 return string_decoder; 5751 } 5752 var endOfStream; 5753 var hasRequiredEndOfStream; 5754 function requireEndOfStream() { 5755 if (hasRequiredEndOfStream) 5756 return endOfStream; 5757 hasRequiredEndOfStream = 1; 5758 var ERR_STREAM_PREMATURE_CLOSE = requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE; 5759 function once2(callback) { 5760 var called = false; 5761 return function() { 5762 if (called) 5763 return; 5764 called = true; 5765 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 5766 args[_key] = arguments[_key]; 5767 } 5768 callback.apply(this, args); 5769 }; 5770 } 5771 function noop2() { 5772 } 5773 function isRequest(stream) { 5774 return stream.setHeader && typeof stream.abort === "function"; 5775 } 5776 function eos(stream, opts, callback) { 5777 if (typeof opts === "function") 5778 return eos(stream, null, opts); 5779 if (!opts) 5780 opts = {}; 5781 callback = once2(callback || noop2); 5782 var readable = opts.readable || opts.readable !== false && stream.readable; 5783 var writable = opts.writable || opts.writable !== false && stream.writable; 5784 var onlegacyfinish = function onlegacyfinish2() { 5785 if (!stream.writable) 5786 onfinish(); 5787 }; 5788 var writableEnded = stream._writableState && stream._writableState.finished; 5789 var onfinish = function onfinish2() { 5790 writable = false; 5791 writableEnded = true; 5792 if (!readable) 5793 callback.call(stream); 5794 }; 5795 var readableEnded = stream._readableState && stream._readableState.endEmitted; 5796 var onend = function onend2() { 5797 readable = false; 5798 readableEnded = true; 5799 if (!writable) 5800 callback.call(stream); 5801 }; 5802 var onerror = function onerror2(err) { 5803 callback.call(stream, err); 5804 }; 5805 var onclose = function onclose2() { 5806 var err; 5807 if (readable && !readableEnded) { 5808 if (!stream._readableState || !stream._readableState.ended) 5809 err = new ERR_STREAM_PREMATURE_CLOSE(); 5810 return callback.call(stream, err); 5811 } 5812 if (writable && !writableEnded) { 5813 if (!stream._writableState || !stream._writableState.ended) 5814 err = new ERR_STREAM_PREMATURE_CLOSE(); 5815 return callback.call(stream, err); 5816 } 5817 }; 5818 var onrequest = function onrequest2() { 5819 stream.req.on("finish", onfinish); 5820 }; 5821 if (isRequest(stream)) { 5822 stream.on("complete", onfinish); 5823 stream.on("abort", onclose); 5824 if (stream.req) 5825 onrequest(); 5826 else 5827 stream.on("request", onrequest); 5828 } else if (writable && !stream._writableState) { 5829 stream.on("end", onlegacyfinish); 5830 stream.on("close", onlegacyfinish); 5831 } 5832 stream.on("end", onend); 5833 stream.on("finish", onfinish); 5834 if (opts.error !== false) 5835 stream.on("error", onerror); 5836 stream.on("close", onclose); 5837 return function() { 5838 stream.removeListener("complete", onfinish); 5839 stream.removeListener("abort", onclose); 5840 stream.removeListener("request", onrequest); 5841 if (stream.req) 5842 stream.req.removeListener("finish", onfinish); 5843 stream.removeListener("end", onlegacyfinish); 5844 stream.removeListener("close", onlegacyfinish); 5845 stream.removeListener("finish", onfinish); 5846 stream.removeListener("end", onend); 5847 stream.removeListener("error", onerror); 5848 stream.removeListener("close", onclose); 5849 }; 5850 } 5851 endOfStream = eos; 5852 return endOfStream; 5853 } 5854 var async_iterator; 5855 var hasRequiredAsync_iterator; 5856 function requireAsync_iterator() { 5857 if (hasRequiredAsync_iterator) 5858 return async_iterator; 5859 hasRequiredAsync_iterator = 1; 5860 var _Object$setPrototypeO; 5861 function _defineProperty(obj, key, value) { 5862 if (key in obj) { 5863 Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); 5864 } else { 5865 obj[key] = value; 5866 } 5867 return obj; 5868 } 5869 var finished = requireEndOfStream(); 5870 var kLastResolve = Symbol("lastResolve"); 5871 var kLastReject = Symbol("lastReject"); 5872 var kError = Symbol("error"); 5873 var kEnded = Symbol("ended"); 5874 var kLastPromise = Symbol("lastPromise"); 5875 var kHandlePromise = Symbol("handlePromise"); 5876 var kStream = Symbol("stream"); 5877 function createIterResult(value, done) { 5878 return { 5879 value, 5880 done 5881 }; 5882 } 5883 function readAndResolve(iter) { 5884 var resolve2 = iter[kLastResolve]; 5885 if (resolve2 !== null) { 5886 var data = iter[kStream].read(); 5887 if (data !== null) { 5888 iter[kLastPromise] = null; 5889 iter[kLastResolve] = null; 5890 iter[kLastReject] = null; 5891 resolve2(createIterResult(data, false)); 5892 } 5893 } 5894 } 5895 function onReadable(iter) { 5896 process$1.nextTick(readAndResolve, iter); 5897 } 5898 function wrapForNext(lastPromise, iter) { 5899 return function(resolve2, reject) { 5900 lastPromise.then(function() { 5901 if (iter[kEnded]) { 5902 resolve2(createIterResult(void 0, true)); 5903 return; 5904 } 5905 iter[kHandlePromise](resolve2, reject); 5906 }, reject); 5907 }; 5908 } 5909 var AsyncIteratorPrototype = Object.getPrototypeOf(function() { 5910 }); 5911 var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { 5912 get stream() { 5913 return this[kStream]; 5914 }, 5915 next: function next() { 5916 var _this = this; 5917 var error = this[kError]; 5918 if (error !== null) { 5919 return Promise.reject(error); 5920 } 5921 if (this[kEnded]) { 5922 return Promise.resolve(createIterResult(void 0, true)); 5923 } 5924 if (this[kStream].destroyed) { 5925 return new Promise(function(resolve2, reject) { 5926 process$1.nextTick(function() { 5927 if (_this[kError]) { 5928 reject(_this[kError]); 5929 } else { 5930 resolve2(createIterResult(void 0, true)); 5931 } 5932 }); 5933 }); 5934 } 5935 var lastPromise = this[kLastPromise]; 5936 var promise; 5937 if (lastPromise) { 5938 promise = new Promise(wrapForNext(lastPromise, this)); 5939 } else { 5940 var data = this[kStream].read(); 5941 if (data !== null) { 5942 return Promise.resolve(createIterResult(data, false)); 5943 } 5944 promise = new Promise(this[kHandlePromise]); 5945 } 5946 this[kLastPromise] = promise; 5947 return promise; 5948 } 5949 }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { 5950 return this; 5951 }), _defineProperty(_Object$setPrototypeO, "return", function _return() { 5952 var _this2 = this; 5953 return new Promise(function(resolve2, reject) { 5954 _this2[kStream].destroy(null, function(err) { 5955 if (err) { 5956 reject(err); 5957 return; 5958 } 5959 resolve2(createIterResult(void 0, true)); 5960 }); 5961 }); 5962 }), _Object$setPrototypeO), AsyncIteratorPrototype); 5963 var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { 5964 var _Object$create; 5965 var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { 5966 value: stream, 5967 writable: true 5968 }), _defineProperty(_Object$create, kLastResolve, { 5969 value: null, 5970 writable: true 5971 }), _defineProperty(_Object$create, kLastReject, { 5972 value: null, 5973 writable: true 5974 }), _defineProperty(_Object$create, kError, { 5975 value: null, 5976 writable: true 5977 }), _defineProperty(_Object$create, kEnded, {
vendor: 4,671 bytes, lines 5978-6099
5978 value: stream._readableState.endEmitted, 5979 writable: true 5980 }), _defineProperty(_Object$create, kHandlePromise, { 5981 value: function value(resolve2, reject) { 5982 var data = iterator[kStream].read(); 5983 if (data) { 5984 iterator[kLastPromise] = null; 5985 iterator[kLastResolve] = null; 5986 iterator[kLastReject] = null; 5987 resolve2(createIterResult(data, false)); 5988 } else { 5989 iterator[kLastResolve] = resolve2; 5990 iterator[kLastReject] = reject; 5991 } 5992 }, 5993 writable: true 5994 }), _Object$create)); 5995 iterator[kLastPromise] = null; 5996 finished(stream, function(err) { 5997 if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { 5998 var reject = iterator[kLastReject]; 5999 if (reject !== null) { 6000 iterator[kLastPromise] = null; 6001 iterator[kLastResolve] = null; 6002 iterator[kLastReject] = null; 6003 reject(err); 6004 } 6005 iterator[kError] = err; 6006 return; 6007 } 6008 var resolve2 = iterator[kLastResolve]; 6009 if (resolve2 !== null) { 6010 iterator[kLastPromise] = null; 6011 iterator[kLastResolve] = null; 6012 iterator[kLastReject] = null; 6013 resolve2(createIterResult(void 0, true)); 6014 } 6015 iterator[kEnded] = true; 6016 }); 6017 stream.on("readable", onReadable.bind(null, iterator)); 6018 return iterator; 6019 }; 6020 async_iterator = createReadableStreamAsyncIterator; 6021 return async_iterator; 6022 } 6023 var fromBrowser; 6024 var hasRequiredFromBrowser; 6025 function requireFromBrowser() { 6026 if (hasRequiredFromBrowser) 6027 return fromBrowser; 6028 hasRequiredFromBrowser = 1; 6029 fromBrowser = function() { 6030 throw new Error("Readable.from is not available in the browser"); 6031 }; 6032 return fromBrowser; 6033 } 6034 var _stream_readable; 6035 var hasRequired_stream_readable; 6036 function require_stream_readable() { 6037 if (hasRequired_stream_readable) 6038 return _stream_readable; 6039 hasRequired_stream_readable = 1; 6040 _stream_readable = Readable; 6041 var Duplex; 6042 Readable.ReadableState = ReadableState; 6043 eventsExports.EventEmitter; 6044 var EElistenerCount = function EElistenerCount2(emitter, type) { 6045 return emitter.listeners(type).length; 6046 }; 6047 var Stream2 = requireStreamBrowser(); 6048 var Buffer2 = requireBuffer().Buffer; 6049 var OurUint8Array = commonjsGlobal.Uint8Array || function() { 6050 }; 6051 function _uint8ArrayToBuffer(chunk) { 6052 return Buffer2.from(chunk); 6053 } 6054 function _isUint8Array(obj) { 6055 return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; 6056 } 6057 var debugUtil = requireUtil(); 6058 var debug; 6059 if (debugUtil && debugUtil.debuglog) { 6060 debug = debugUtil.debuglog("stream"); 6061 } else { 6062 debug = function debug2() { 6063 }; 6064 } 6065 var BufferList = requireBuffer_list(); 6066 var destroyImpl = requireDestroy(); 6067 var _require = requireState(), getHighWaterMark = _require.getHighWaterMark; 6068 var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; 6069 var StringDecoder; 6070 var createReadableStreamAsyncIterator; 6071 var from; 6072 inherits_browserExports(Readable, Stream2); 6073 var errorOrDestroy = destroyImpl.errorOrDestroy; 6074 var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; 6075 function prependListener(emitter, event, fn) { 6076 if (typeof emitter.prependListener === "function") 6077 return emitter.prependListener(event, fn); 6078 if (!emitter._events || !emitter._events[event]) 6079 emitter.on(event, fn); 6080 else if (Array.isArray(emitter._events[event])) 6081 emitter._events[event].unshift(fn); 6082 else 6083 emitter._events[event] = [fn, emitter._events[event]]; 6084 } 6085 function ReadableState(options2, stream, isDuplex) { 6086 Duplex = Duplex || require_stream_duplex(); 6087 options2 = options2 || {}; 6088 if (typeof isDuplex !== "boolean") 6089 isDuplex = stream instanceof Duplex; 6090 this.objectMode = !!options2.objectMode; 6091 if (isDuplex) 6092 this.objectMode = this.objectMode || !!options2.readableObjectMode; 6093 this.highWaterMark = getHighWaterMark(this, options2, "readableHighWaterMark", isDuplex); 6094 this.buffer = new BufferList(); 6095 this.length = 0; 6096 this.pipes = null; 6097 this.pipesCount = 0; 6098 this.flowing = null; 6099 this.ended = false;
vendor: 8,894 bytes, lines 6100-6363
6100 this.endEmitted = false; 6101 this.reading = false; 6102 this.sync = true; 6103 this.needReadable = false; 6104 this.emittedReadable = false; 6105 this.readableListening = false; 6106 this.resumeScheduled = false; 6107 this.paused = true; 6108 this.emitClose = options2.emitClose !== false; 6109 this.autoDestroy = !!options2.autoDestroy; 6110 this.destroyed = false; 6111 this.defaultEncoding = options2.defaultEncoding || "utf8"; 6112 this.awaitDrain = 0; 6113 this.readingMore = false; 6114 this.decoder = null; 6115 this.encoding = null; 6116 if (options2.encoding) { 6117 if (!StringDecoder) 6118 StringDecoder = requireString_decoder().StringDecoder; 6119 this.decoder = new StringDecoder(options2.encoding); 6120 this.encoding = options2.encoding; 6121 } 6122 } 6123 function Readable(options2) { 6124 Duplex = Duplex || require_stream_duplex(); 6125 if (!(this instanceof Readable)) 6126 return new Readable(options2); 6127 var isDuplex = this instanceof Duplex; 6128 this._readableState = new ReadableState(options2, this, isDuplex); 6129 this.readable = true; 6130 if (options2) { 6131 if (typeof options2.read === "function") 6132 this._read = options2.read; 6133 if (typeof options2.destroy === "function") 6134 this._destroy = options2.destroy; 6135 } 6136 Stream2.call(this); 6137 } 6138 Object.defineProperty(Readable.prototype, "destroyed", { 6139 // making it explicit this property is not enumerable 6140 // because otherwise some prototype manipulation in 6141 // userland will fail 6142 enumerable: false, 6143 get: function get() { 6144 if (this._readableState === void 0) { 6145 return false; 6146 } 6147 return this._readableState.destroyed; 6148 }, 6149 set: function set(value) { 6150 if (!this._readableState) { 6151 return; 6152 } 6153 this._readableState.destroyed = value; 6154 } 6155 }); 6156 Readable.prototype.destroy = destroyImpl.destroy; 6157 Readable.prototype._undestroy = destroyImpl.undestroy; 6158 Readable.prototype._destroy = function(err, cb) { 6159 cb(err); 6160 }; 6161 Readable.prototype.push = function(chunk, encoding) { 6162 var state2 = this._readableState; 6163 var skipChunkCheck; 6164 if (!state2.objectMode) { 6165 if (typeof chunk === "string") { 6166 encoding = encoding || state2.defaultEncoding; 6167 if (encoding !== state2.encoding) { 6168 chunk = Buffer2.from(chunk, encoding); 6169 encoding = ""; 6170 } 6171 skipChunkCheck = true; 6172 } 6173 } else { 6174 skipChunkCheck = true; 6175 } 6176 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); 6177 }; 6178 Readable.prototype.unshift = function(chunk) { 6179 return readableAddChunk(this, chunk, null, true, false); 6180 }; 6181 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { 6182 debug("readableAddChunk", chunk); 6183 var state2 = stream._readableState; 6184 if (chunk === null) { 6185 state2.reading = false; 6186 onEofChunk(stream, state2); 6187 } else { 6188 var er; 6189 if (!skipChunkCheck) 6190 er = chunkInvalid(state2, chunk); 6191 if (er) { 6192 errorOrDestroy(stream, er); 6193 } else if (state2.objectMode || chunk && chunk.length > 0) { 6194 if (typeof chunk !== "string" && !state2.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) { 6195 chunk = _uint8ArrayToBuffer(chunk); 6196 } 6197 if (addToFront) { 6198 if (state2.endEmitted) 6199 errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); 6200 else 6201 addChunk(stream, state2, chunk, true); 6202 } else if (state2.ended) { 6203 errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); 6204 } else if (state2.destroyed) { 6205 return false; 6206 } else { 6207 state2.reading = false; 6208 if (state2.decoder && !encoding) { 6209 chunk = state2.decoder.write(chunk); 6210 if (state2.objectMode || chunk.length !== 0) 6211 addChunk(stream, state2, chunk, false); 6212 else 6213 maybeReadMore(stream, state2); 6214 } else { 6215 addChunk(stream, state2, chunk, false); 6216 } 6217 } 6218 } else if (!addToFront) { 6219 state2.reading = false; 6220 maybeReadMore(stream, state2); 6221 } 6222 } 6223 return !state2.ended && (state2.length < state2.highWaterMark || state2.length === 0); 6224 } 6225 function addChunk(stream, state2, chunk, addToFront) { 6226 if (state2.flowing && state2.length === 0 && !state2.sync) { 6227 state2.awaitDrain = 0; 6228 stream.emit("data", chunk); 6229 } else { 6230 state2.length += state2.objectMode ? 1 : chunk.length; 6231 if (addToFront) 6232 state2.buffer.unshift(chunk); 6233 else 6234 state2.buffer.push(chunk); 6235 if (state2.needReadable) 6236 emitReadable(stream); 6237 } 6238 maybeReadMore(stream, state2); 6239 } 6240 function chunkInvalid(state2, chunk) { 6241 var er; 6242 if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state2.objectMode) { 6243 er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); 6244 } 6245 return er; 6246 } 6247 Readable.prototype.isPaused = function() { 6248 return this._readableState.flowing === false; 6249 }; 6250 Readable.prototype.setEncoding = function(enc) { 6251 if (!StringDecoder) 6252 StringDecoder = requireString_decoder().StringDecoder; 6253 var decoder = new StringDecoder(enc); 6254 this._readableState.decoder = decoder; 6255 this._readableState.encoding = this._readableState.decoder.encoding; 6256 var p = this._readableState.buffer.head; 6257 var content = ""; 6258 while (p !== null) { 6259 content += decoder.write(p.data); 6260 p = p.next; 6261 } 6262 this._readableState.buffer.clear(); 6263 if (content !== "") 6264 this._readableState.buffer.push(content); 6265 this._readableState.length = content.length; 6266 return this; 6267 }; 6268 var MAX_HWM = 1073741824; 6269 function computeNewHighWaterMark(n) { 6270 if (n >= MAX_HWM) { 6271 n = MAX_HWM; 6272 } else { 6273 n--; 6274 n |= n >>> 1; 6275 n |= n >>> 2; 6276 n |= n >>> 4; 6277 n |= n >>> 8; 6278 n |= n >>> 16; 6279 n++; 6280 } 6281 return n; 6282 } 6283 function howMuchToRead(n, state2) { 6284 if (n <= 0 || state2.length === 0 && state2.ended) 6285 return 0; 6286 if (state2.objectMode) 6287 return 1; 6288 if (n !== n) { 6289 if (state2.flowing && state2.length) 6290 return state2.buffer.head.data.length; 6291 else 6292 return state2.length; 6293 } 6294 if (n > state2.highWaterMark) 6295 state2.highWaterMark = computeNewHighWaterMark(n); 6296 if (n <= state2.length) 6297 return n; 6298 if (!state2.ended) { 6299 state2.needReadable = true; 6300 return 0; 6301 } 6302 return state2.length; 6303 } 6304 Readable.prototype.read = function(n) { 6305 debug("read", n); 6306 n = parseInt(n, 10); 6307 var state2 = this._readableState; 6308 var nOrig = n; 6309 if (n !== 0) 6310 state2.emittedReadable = false; 6311 if (n === 0 && state2.needReadable && ((state2.highWaterMark !== 0 ? state2.length >= state2.highWaterMark : state2.length > 0) || state2.ended)) { 6312 debug("read: emitReadable", state2.length, state2.ended); 6313 if (state2.length === 0 && state2.ended) 6314 endReadable(this); 6315 else 6316 emitReadable(this); 6317 return null; 6318 } 6319 n = howMuchToRead(n, state2); 6320 if (n === 0 && state2.ended) { 6321 if (state2.length === 0) 6322 endReadable(this); 6323 return null; 6324 } 6325 var doRead = state2.needReadable; 6326 debug("need readable", doRead); 6327 if (state2.length === 0 || state2.length - n < state2.highWaterMark) { 6328 doRead = true; 6329 debug("length less than watermark", doRead); 6330 } 6331 if (state2.ended || state2.reading) { 6332 doRead = false; 6333 debug("reading or ended", doRead); 6334 } else if (doRead) { 6335 debug("do read"); 6336 state2.reading = true; 6337 state2.sync = true; 6338 if (state2.length === 0) 6339 state2.needReadable = true; 6340 this._read(state2.highWaterMark); 6341 state2.sync = false; 6342 if (!state2.reading) 6343 n = howMuchToRead(nOrig, state2); 6344 } 6345 var ret; 6346 if (n > 0) 6347 ret = fromList(n, state2); 6348 else 6349 ret = null; 6350 if (ret === null) { 6351 state2.needReadable = state2.length <= state2.highWaterMark; 6352 n = 0; 6353 } else { 6354 state2.length -= n; 6355 state2.awaitDrain = 0; 6356 } 6357 if (state2.length === 0) { 6358 if (!state2.ended) 6359 state2.needReadable = true; 6360 if (nOrig !== n && state2.ended) 6361 endReadable(this); 6362 } 6363 if (ret !== null)
vendor: 5,131 bytes, lines 6364-6518
6364 this.emit("data", ret); 6365 return ret; 6366 }; 6367 function onEofChunk(stream, state2) { 6368 debug("onEofChunk"); 6369 if (state2.ended) 6370 return; 6371 if (state2.decoder) { 6372 var chunk = state2.decoder.end(); 6373 if (chunk && chunk.length) { 6374 state2.buffer.push(chunk); 6375 state2.length += state2.objectMode ? 1 : chunk.length; 6376 } 6377 } 6378 state2.ended = true; 6379 if (state2.sync) { 6380 emitReadable(stream); 6381 } else { 6382 state2.needReadable = false; 6383 if (!state2.emittedReadable) { 6384 state2.emittedReadable = true; 6385 emitReadable_(stream); 6386 } 6387 } 6388 } 6389 function emitReadable(stream) { 6390 var state2 = stream._readableState; 6391 debug("emitReadable", state2.needReadable, state2.emittedReadable); 6392 state2.needReadable = false; 6393 if (!state2.emittedReadable) { 6394 debug("emitReadable", state2.flowing); 6395 state2.emittedReadable = true; 6396 process$1.nextTick(emitReadable_, stream); 6397 } 6398 } 6399 function emitReadable_(stream) { 6400 var state2 = stream._readableState; 6401 debug("emitReadable_", state2.destroyed, state2.length, state2.ended); 6402 if (!state2.destroyed && (state2.length || state2.ended)) { 6403 stream.emit("readable"); 6404 state2.emittedReadable = false; 6405 } 6406 state2.needReadable = !state2.flowing && !state2.ended && state2.length <= state2.highWaterMark; 6407 flow(stream); 6408 } 6409 function maybeReadMore(stream, state2) { 6410 if (!state2.readingMore) { 6411 state2.readingMore = true; 6412 process$1.nextTick(maybeReadMore_, stream, state2); 6413 } 6414 } 6415 function maybeReadMore_(stream, state2) { 6416 while (!state2.reading && !state2.ended && (state2.length < state2.highWaterMark || state2.flowing && state2.length === 0)) { 6417 var len = state2.length; 6418 debug("maybeReadMore read 0"); 6419 stream.read(0); 6420 if (len === state2.length) 6421 break; 6422 } 6423 state2.readingMore = false; 6424 } 6425 Readable.prototype._read = function(n) { 6426 errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); 6427 }; 6428 Readable.prototype.pipe = function(dest, pipeOpts) { 6429 var src = this; 6430 var state2 = this._readableState; 6431 switch (state2.pipesCount) { 6432 case 0: 6433 state2.pipes = dest; 6434 break; 6435 case 1: 6436 state2.pipes = [state2.pipes, dest]; 6437 break; 6438 default: 6439 state2.pipes.push(dest); 6440 break; 6441 } 6442 state2.pipesCount += 1; 6443 debug("pipe count=%d opts=%j", state2.pipesCount, pipeOpts); 6444 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process$1.stdout && dest !== process$1.stderr; 6445 var endFn = doEnd ? onend : unpipe; 6446 if (state2.endEmitted) 6447 process$1.nextTick(endFn); 6448 else 6449 src.once("end", endFn); 6450 dest.on("unpipe", onunpipe); 6451 function onunpipe(readable, unpipeInfo) { 6452 debug("onunpipe"); 6453 if (readable === src) { 6454 if (unpipeInfo && unpipeInfo.hasUnpiped === false) { 6455 unpipeInfo.hasUnpiped = true; 6456 cleanup(); 6457 } 6458 } 6459 } 6460 function onend() { 6461 debug("onend"); 6462 dest.end(); 6463 } 6464 var ondrain = pipeOnDrain(src); 6465 dest.on("drain", ondrain); 6466 var cleanedUp = false; 6467 function cleanup() { 6468 debug("cleanup"); 6469 dest.removeListener("close", onclose); 6470 dest.removeListener("finish", onfinish); 6471 dest.removeListener("drain", ondrain); 6472 dest.removeListener("error", onerror); 6473 dest.removeListener("unpipe", onunpipe); 6474 src.removeListener("end", onend); 6475 src.removeListener("end", unpipe); 6476 src.removeListener("data", ondata); 6477 cleanedUp = true; 6478 if (state2.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) 6479 ondrain(); 6480 } 6481 src.on("data", ondata); 6482 function ondata(chunk) { 6483 debug("ondata"); 6484 var ret = dest.write(chunk); 6485 debug("dest.write", ret); 6486 if (ret === false) { 6487 if ((state2.pipesCount === 1 && state2.pipes === dest || state2.pipesCount > 1 && indexOf(state2.pipes, dest) !== -1) && !cleanedUp) { 6488 debug("false write response, pause", state2.awaitDrain); 6489 state2.awaitDrain++; 6490 } 6491 src.pause(); 6492 } 6493 } 6494 function onerror(er) { 6495 debug("onerror", er); 6496 unpipe(); 6497 dest.removeListener("error", onerror); 6498 if (EElistenerCount(dest, "error") === 0) 6499 errorOrDestroy(dest, er); 6500 } 6501 prependListener(dest, "error", onerror); 6502 function onclose() { 6503 dest.removeListener("finish", onfinish); 6504 unpipe(); 6505 } 6506 dest.once("close", onclose); 6507 function onfinish() { 6508 debug("onfinish"); 6509 dest.removeListener("close", onclose); 6510 unpipe(); 6511 } 6512 dest.once("finish", onfinish); 6513 function unpipe() { 6514 debug("unpipe"); 6515 src.unpipe(dest); 6516 } 6517 dest.emit("pipe", src); 6518 if (!state2.flowing) {
vendor: 4,162 bytes, lines 6519-6649
6519 debug("pipe resume"); 6520 src.resume(); 6521 } 6522 return dest; 6523 }; 6524 function pipeOnDrain(src) { 6525 return function pipeOnDrainFunctionResult() { 6526 var state2 = src._readableState; 6527 debug("pipeOnDrain", state2.awaitDrain); 6528 if (state2.awaitDrain) 6529 state2.awaitDrain--; 6530 if (state2.awaitDrain === 0 && EElistenerCount(src, "data")) { 6531 state2.flowing = true; 6532 flow(src); 6533 } 6534 }; 6535 } 6536 Readable.prototype.unpipe = function(dest) { 6537 var state2 = this._readableState; 6538 var unpipeInfo = { 6539 hasUnpiped: false 6540 }; 6541 if (state2.pipesCount === 0) 6542 return this; 6543 if (state2.pipesCount === 1) { 6544 if (dest && dest !== state2.pipes) 6545 return this; 6546 if (!dest) 6547 dest = state2.pipes; 6548 state2.pipes = null; 6549 state2.pipesCount = 0; 6550 state2.flowing = false; 6551 if (dest) 6552 dest.emit("unpipe", this, unpipeInfo); 6553 return this; 6554 } 6555 if (!dest) { 6556 var dests = state2.pipes; 6557 var len = state2.pipesCount; 6558 state2.pipes = null; 6559 state2.pipesCount = 0; 6560 state2.flowing = false; 6561 for (var i = 0; i < len; i++) { 6562 dests[i].emit("unpipe", this, { 6563 hasUnpiped: false 6564 }); 6565 } 6566 return this; 6567 } 6568 var index = indexOf(state2.pipes, dest); 6569 if (index === -1) 6570 return this; 6571 state2.pipes.splice(index, 1); 6572 state2.pipesCount -= 1; 6573 if (state2.pipesCount === 1) 6574 state2.pipes = state2.pipes[0]; 6575 dest.emit("unpipe", this, unpipeInfo); 6576 return this; 6577 }; 6578 Readable.prototype.on = function(ev, fn) { 6579 var res = Stream2.prototype.on.call(this, ev, fn); 6580 var state2 = this._readableState; 6581 if (ev === "data") { 6582 state2.readableListening = this.listenerCount("readable") > 0; 6583 if (state2.flowing !== false) 6584 this.resume(); 6585 } else if (ev === "readable") { 6586 if (!state2.endEmitted && !state2.readableListening) { 6587 state2.readableListening = state2.needReadable = true; 6588 state2.flowing = false; 6589 state2.emittedReadable = false; 6590 debug("on readable", state2.length, state2.reading); 6591 if (state2.length) { 6592 emitReadable(this); 6593 } else if (!state2.reading) { 6594 process$1.nextTick(nReadingNextTick, this); 6595 } 6596 } 6597 } 6598 return res; 6599 }; 6600 Readable.prototype.addListener = Readable.prototype.on; 6601 Readable.prototype.removeListener = function(ev, fn) { 6602 var res = Stream2.prototype.removeListener.call(this, ev, fn); 6603 if (ev === "readable") { 6604 process$1.nextTick(updateReadableListening, this); 6605 } 6606 return res; 6607 }; 6608 Readable.prototype.removeAllListeners = function(ev) { 6609 var res = Stream2.prototype.removeAllListeners.apply(this, arguments); 6610 if (ev === "readable" || ev === void 0) { 6611 process$1.nextTick(updateReadableListening, this); 6612 } 6613 return res; 6614 }; 6615 function updateReadableListening(self2) { 6616 var state2 = self2._readableState; 6617 state2.readableListening = self2.listenerCount("readable") > 0; 6618 if (state2.resumeScheduled && !state2.paused) { 6619 state2.flowing = true; 6620 } else if (self2.listenerCount("data") > 0) { 6621 self2.resume(); 6622 } 6623 } 6624 function nReadingNextTick(self2) { 6625 debug("readable nexttick read 0"); 6626 self2.read(0); 6627 } 6628 Readable.prototype.resume = function() { 6629 var state2 = this._readableState; 6630 if (!state2.flowing) { 6631 debug("resume"); 6632 state2.flowing = !state2.readableListening; 6633 resume(this, state2); 6634 } 6635 state2.paused = false; 6636 return this; 6637 }; 6638 function resume(stream, state2) { 6639 if (!state2.resumeScheduled) { 6640 state2.resumeScheduled = true; 6641 process$1.nextTick(resume_, stream, state2); 6642 } 6643 } 6644 function resume_(stream, state2) { 6645 debug("resume", state2.reading); 6646 if (!state2.reading) { 6647 stream.read(0); 6648 } 6649 state2.resumeScheduled = false;
vendor: 5,027 bytes, lines 6650-6800
6650 stream.emit("resume"); 6651 flow(stream); 6652 if (state2.flowing && !state2.reading) 6653 stream.read(0); 6654 } 6655 Readable.prototype.pause = function() { 6656 debug("call pause flowing=%j", this._readableState.flowing); 6657 if (this._readableState.flowing !== false) { 6658 debug("pause"); 6659 this._readableState.flowing = false; 6660 this.emit("pause"); 6661 } 6662 this._readableState.paused = true; 6663 return this; 6664 }; 6665 function flow(stream) { 6666 var state2 = stream._readableState; 6667 debug("flow", state2.flowing); 6668 while (state2.flowing && stream.read() !== null) { 6669 } 6670 } 6671 Readable.prototype.wrap = function(stream) { 6672 var _this = this; 6673 var state2 = this._readableState; 6674 var paused = false; 6675 stream.on("end", function() { 6676 debug("wrapped end"); 6677 if (state2.decoder && !state2.ended) { 6678 var chunk = state2.decoder.end(); 6679 if (chunk && chunk.length) 6680 _this.push(chunk); 6681 } 6682 _this.push(null); 6683 }); 6684 stream.on("data", function(chunk) { 6685 debug("wrapped data"); 6686 if (state2.decoder) 6687 chunk = state2.decoder.write(chunk); 6688 if (state2.objectMode && (chunk === null || chunk === void 0)) 6689 return; 6690 else if (!state2.objectMode && (!chunk || !chunk.length)) 6691 return; 6692 var ret = _this.push(chunk); 6693 if (!ret) { 6694 paused = true; 6695 stream.pause(); 6696 } 6697 }); 6698 for (var i in stream) { 6699 if (this[i] === void 0 && typeof stream[i] === "function") { 6700 this[i] = /* @__PURE__ */ function methodWrap(method) { 6701 return function methodWrapReturnFunction() { 6702 return stream[method].apply(stream, arguments); 6703 }; 6704 }(i); 6705 } 6706 } 6707 for (var n = 0; n < kProxyEvents.length; n++) { 6708 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); 6709 } 6710 this._read = function(n2) { 6711 debug("wrapped _read", n2); 6712 if (paused) { 6713 paused = false; 6714 stream.resume(); 6715 } 6716 }; 6717 return this; 6718 }; 6719 if (typeof Symbol === "function") { 6720 Readable.prototype[Symbol.asyncIterator] = function() { 6721 if (createReadableStreamAsyncIterator === void 0) { 6722 createReadableStreamAsyncIterator = requireAsync_iterator(); 6723 } 6724 return createReadableStreamAsyncIterator(this); 6725 }; 6726 } 6727 Object.defineProperty(Readable.prototype, "readableHighWaterMark", { 6728 // making it explicit this property is not enumerable 6729 // because otherwise some prototype manipulation in 6730 // userland will fail 6731 enumerable: false, 6732 get: function get() { 6733 return this._readableState.highWaterMark; 6734 } 6735 }); 6736 Object.defineProperty(Readable.prototype, "readableBuffer", { 6737 // making it explicit this property is not enumerable 6738 // because otherwise some prototype manipulation in 6739 // userland will fail 6740 enumerable: false, 6741 get: function get() { 6742 return this._readableState && this._readableState.buffer; 6743 } 6744 }); 6745 Object.defineProperty(Readable.prototype, "readableFlowing", { 6746 // making it explicit this property is not enumerable 6747 // because otherwise some prototype manipulation in 6748 // userland will fail 6749 enumerable: false, 6750 get: function get() { 6751 return this._readableState.flowing; 6752 }, 6753 set: function set(state2) { 6754 if (this._readableState) { 6755 this._readableState.flowing = state2; 6756 } 6757 } 6758 }); 6759 Readable._fromList = fromList; 6760 Object.defineProperty(Readable.prototype, "readableLength", { 6761 // making it explicit this property is not enumerable 6762 // because otherwise some prototype manipulation in 6763 // userland will fail 6764 enumerable: false, 6765 get: function get() { 6766 return this._readableState.length; 6767 } 6768 }); 6769 function fromList(n, state2) { 6770 if (state2.length === 0) 6771 return null; 6772 var ret; 6773 if (state2.objectMode) 6774 ret = state2.buffer.shift(); 6775 else if (!n || n >= state2.length) { 6776 if (state2.decoder) 6777 ret = state2.buffer.join(""); 6778 else if (state2.buffer.length === 1) 6779 ret = state2.buffer.first(); 6780 else 6781 ret = state2.buffer.concat(state2.length); 6782 state2.buffer.clear(); 6783 } else { 6784 ret = state2.buffer.consume(n, state2.decoder); 6785 } 6786 return ret; 6787 } 6788 function endReadable(stream) { 6789 var state2 = stream._readableState; 6790 debug("endReadable", state2.endEmitted); 6791 if (!state2.endEmitted) { 6792 state2.ended = true; 6793 process$1.nextTick(endReadableNT, state2, stream); 6794 } 6795 } 6796 function endReadableNT(state2, stream) { 6797 debug("endReadableNT", state2.endEmitted, state2.length); 6798 if (!state2.endEmitted && state2.length === 0) { 6799 state2.endEmitted = true; 6800 stream.readable = false;
vendor: 4,236 bytes, lines 6801-6924
6801 stream.emit("end"); 6802 if (state2.autoDestroy) { 6803 var wState = stream._writableState; 6804 if (!wState || wState.autoDestroy && wState.finished) { 6805 stream.destroy(); 6806 } 6807 } 6808 } 6809 } 6810 if (typeof Symbol === "function") { 6811 Readable.from = function(iterable, opts) { 6812 if (from === void 0) { 6813 from = requireFromBrowser(); 6814 } 6815 return from(Readable, iterable, opts); 6816 }; 6817 } 6818 function indexOf(xs, x) { 6819 for (var i = 0, l = xs.length; i < l; i++) { 6820 if (xs[i] === x) 6821 return i; 6822 } 6823 return -1; 6824 } 6825 return _stream_readable; 6826 } 6827 var _stream_transform; 6828 var hasRequired_stream_transform; 6829 function require_stream_transform() { 6830 if (hasRequired_stream_transform) 6831 return _stream_transform; 6832 hasRequired_stream_transform = 1; 6833 _stream_transform = Transform; 6834 var _require$codes = requireErrorsBrowser().codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; 6835 var Duplex = require_stream_duplex(); 6836 inherits_browserExports(Transform, Duplex); 6837 function afterTransform(er, data) { 6838 var ts = this._transformState; 6839 ts.transforming = false; 6840 var cb = ts.writecb; 6841 if (cb === null) { 6842 return this.emit("error", new ERR_MULTIPLE_CALLBACK()); 6843 } 6844 ts.writechunk = null; 6845 ts.writecb = null; 6846 if (data != null) 6847 this.push(data); 6848 cb(er); 6849 var rs = this._readableState; 6850 rs.reading = false; 6851 if (rs.needReadable || rs.length < rs.highWaterMark) { 6852 this._read(rs.highWaterMark); 6853 } 6854 } 6855 function Transform(options2) { 6856 if (!(this instanceof Transform)) 6857 return new Transform(options2); 6858 Duplex.call(this, options2); 6859 this._transformState = { 6860 afterTransform: afterTransform.bind(this), 6861 needTransform: false, 6862 transforming: false, 6863 writecb: null, 6864 writechunk: null, 6865 writeencoding: null 6866 }; 6867 this._readableState.needReadable = true; 6868 this._readableState.sync = false; 6869 if (options2) { 6870 if (typeof options2.transform === "function") 6871 this._transform = options2.transform; 6872 if (typeof options2.flush === "function") 6873 this._flush = options2.flush; 6874 } 6875 this.on("prefinish", prefinish); 6876 } 6877 function prefinish() { 6878 var _this = this; 6879 if (typeof this._flush === "function" && !this._readableState.destroyed) { 6880 this._flush(function(er, data) { 6881 done(_this, er, data); 6882 }); 6883 } else { 6884 done(this, null, null); 6885 } 6886 } 6887 Transform.prototype.push = function(chunk, encoding) { 6888 this._transformState.needTransform = false; 6889 return Duplex.prototype.push.call(this, chunk, encoding); 6890 }; 6891 Transform.prototype._transform = function(chunk, encoding, cb) { 6892 cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); 6893 }; 6894 Transform.prototype._write = function(chunk, encoding, cb) { 6895 var ts = this._transformState; 6896 ts.writecb = cb; 6897 ts.writechunk = chunk; 6898 ts.writeencoding = encoding; 6899 if (!ts.transforming) { 6900 var rs = this._readableState; 6901 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) 6902 this._read(rs.highWaterMark); 6903 } 6904 }; 6905 Transform.prototype._read = function(n) { 6906 var ts = this._transformState; 6907 if (ts.writechunk !== null && !ts.transforming) { 6908 ts.transforming = true; 6909 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); 6910 } else { 6911 ts.needTransform = true; 6912 } 6913 }; 6914 Transform.prototype._destroy = function(err, cb) { 6915 Duplex.prototype._destroy.call(this, err, function(err2) { 6916 cb(err2); 6917 }); 6918 }; 6919 function done(stream, er, data) { 6920 if (er) 6921 return stream.emit("error", er); 6922 if (data != null) 6923 stream.push(data); 6924 if (stream._writableState.length)
6925 throw new ERR_TRANSFORM_WITH_LENGTH_0(); 6926 if (stream._transformState.transforming) 6927 throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); 6928 return stream.push(null); 6929 } 6930 return _stream_transform; 6931 } 6932 var _stream_passthrough; 6933 var hasRequired_stream_passthrough; 6934 function require_stream_passthrough() { 6935 if (hasRequired_stream_passthrough) 6936 return _stream_passthrough; 6937 hasRequired_stream_passthrough = 1; 6938 _stream_passthrough = PassThrough; 6939 var Transform = require_stream_transform(); 6940 inherits_browserExports(PassThrough, Transform); 6941 function PassThrough(options2) { 6942 if (!(this instanceof PassThrough)) 6943 return new PassThrough(options2); 6944 Transform.call(this, options2); 6945 } 6946 PassThrough.prototype._transform = function(chunk, encoding, cb) { 6947 cb(null, chunk); 6948 }; 6949 return _stream_passthrough; 6950 } 6951 var pipeline_1; 6952 var hasRequiredPipeline; 6953 function requirePipeline() { 6954 if (hasRequiredPipeline) 6955 return pipeline_1; 6956 hasRequiredPipeline = 1; 6957 var eos; 6958 function once2(callback) { 6959 var called = false; 6960 return function() { 6961 if (called) 6962 return; 6963 called = true; 6964 callback.apply(void 0, arguments); 6965 }; 6966 } 6967 var _require$codes = requireErrorsBrowser().codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; 6968 function noop2(err) { 6969 if (err) 6970 throw err; 6971 } 6972 function isRequest(stream) { 6973 return stream.setHeader && typeof stream.abort === "function"; 6974 } 6975 function destroyer(stream, reading, writing, callback) { 6976 callback = once2(callback); 6977 var closed = false; 6978 stream.on("close", function() { 6979 closed = true; 6980 }); 6981 if (eos === void 0) 6982 eos = requireEndOfStream(); 6983 eos(stream, { 6984 readable: reading, 6985 writable: writing 6986 }, function(err) { 6987 if (err) 6988 return callback(err); 6989 closed = true; 6990 callback(); 6991 }); 6992 var destroyed = false; 6993 return function(err) { 6994 if (closed) 6995 return; 6996 if (destroyed) 6997 return; 6998 destroyed = true; 6999 if (isRequest(stream)) 7000 return stream.abort(); 7001 if (typeof stream.destroy === "function") 7002 return stream.destroy(); 7003 callback(err || new ERR_STREAM_DESTROYED("pipe")); 7004 }; 7005 } 7006 function call(fn) { 7007 fn(); 7008 } 7009 function pipe(from, to) { 7010 return from.pipe(to); 7011 } 7012 function popCallback(streams) { 7013 if (!streams.length) 7014 return noop2; 7015 if (typeof streams[streams.length - 1] !== "function") 7016 return noop2; 7017 return streams.pop(); 7018 } 7019 function pipeline() { 7020 for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { 7021 streams[_key] = arguments[_key]; 7022 } 7023 var callback = popCallback(streams); 7024 if (Array.isArray(streams[0])) 7025 streams = streams[0]; 7026 if (streams.length < 2) { 7027 throw new ERR_MISSING_ARGS("streams"); 7028 } 7029 var error; 7030 var destroys = streams.map(function(stream, i) { 7031 var reading = i < streams.length - 1; 7032 var writing = i > 0; 7033 return destroyer(stream, reading, writing, function(err) { 7034 if (!error) 7035 error = err; 7036 if (err) 7037 destroys.forEach(call); 7038 if (reading) 7039 return; 7040 destroys.forEach(call); 7041 callback(error); 7042 }); 7043 }); 7044 return streams.reduce(pipe); 7045 } 7046 pipeline_1 = pipeline; 7047 return pipeline_1; 7048 } 7049 var streamBrowserify = Stream$1; 7050 var EE = eventsExports.EventEmitter; 7051 var inherits = inherits_browserExports; 7052 inherits(Stream$1, EE); 7053 Stream$1.Readable = require_stream_readable(); 7054 Stream$1.Writable = require_stream_writable(); 7055 Stream$1.Duplex = require_stream_duplex(); 7056 Stream$1.Transform = require_stream_transform(); 7057 Stream$1.PassThrough = require_stream_passthrough(); 7058 Stream$1.finished = requireEndOfStream(); 7059 Stream$1.pipeline = requirePipeline(); 7060 Stream$1.Stream = Stream$1; 7061 function Stream$1() { 7062 EE.call(this); 7063 } 7064 Stream$1.prototype.pipe = function(dest, options2) { 7065 var source = this; 7066 function ondata(chunk) { 7067 if (dest.writable) {
vendor: 5,962 bytes, lines 7068-7272
7068 if (false === dest.write(chunk) && source.pause) { 7069 source.pause(); 7070 } 7071 } 7072 } 7073 source.on("data", ondata); 7074 function ondrain() { 7075 if (source.readable && source.resume) { 7076 source.resume(); 7077 } 7078 } 7079 dest.on("drain", ondrain); 7080 if (!dest._isStdio && (!options2 || options2.end !== false)) { 7081 source.on("end", onend); 7082 source.on("close", onclose); 7083 } 7084 var didOnEnd = false; 7085 function onend() { 7086 if (didOnEnd) 7087 return; 7088 didOnEnd = true; 7089 dest.end(); 7090 } 7091 function onclose() { 7092 if (didOnEnd) 7093 return; 7094 didOnEnd = true; 7095 if (typeof dest.destroy === "function") 7096 dest.destroy(); 7097 } 7098 function onerror(er) { 7099 cleanup(); 7100 if (EE.listenerCount(this, "error") === 0) { 7101 throw er; 7102 } 7103 } 7104 source.on("error", onerror); 7105 dest.on("error", onerror); 7106 function cleanup() { 7107 source.removeListener("data", ondata); 7108 dest.removeListener("drain", ondrain); 7109 source.removeListener("end", onend); 7110 source.removeListener("close", onclose); 7111 source.removeListener("error", onerror); 7112 dest.removeListener("error", onerror); 7113 source.removeListener("end", cleanup); 7114 source.removeListener("close", cleanup); 7115 dest.removeListener("close", cleanup); 7116 } 7117 source.on("end", cleanup); 7118 source.on("close", cleanup); 7119 dest.on("close", cleanup); 7120 dest.emit("pipe", source); 7121 return dest; 7122 }; 7123 (function(exports3) { 7124 (function(sax2) { 7125 sax2.parser = function(strict, opt) { 7126 return new SAXParser(strict, opt); 7127 }; 7128 sax2.SAXParser = SAXParser; 7129 sax2.SAXStream = SAXStream; 7130 sax2.createStream = createStream; 7131 sax2.MAX_BUFFER_LENGTH = 64 * 1024; 7132 var buffers = [ 7133 "comment", 7134 "sgmlDecl", 7135 "textNode", 7136 "tagName", 7137 "doctype", 7138 "procInstName", 7139 "procInstBody", 7140 "entity", 7141 "attribName", 7142 "attribValue", 7143 "cdata", 7144 "script" 7145 ]; 7146 sax2.EVENTS = [ 7147 "text", 7148 "processinginstruction", 7149 "sgmldeclaration", 7150 "doctype", 7151 "comment", 7152 "opentagstart", 7153 "attribute", 7154 "opentag", 7155 "closetag", 7156 "opencdata", 7157 "cdata", 7158 "closecdata", 7159 "error", 7160 "end", 7161 "ready", 7162 "script", 7163 "opennamespace", 7164 "closenamespace" 7165 ]; 7166 function SAXParser(strict, opt) { 7167 if (!(this instanceof SAXParser)) { 7168 return new SAXParser(strict, opt); 7169 } 7170 var parser = this; 7171 clearBuffers(parser); 7172 parser.q = parser.c = ""; 7173 parser.bufferCheckPosition = sax2.MAX_BUFFER_LENGTH; 7174 parser.opt = opt || {}; 7175 parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags; 7176 parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase"; 7177 parser.tags = []; 7178 parser.closed = parser.closedRoot = parser.sawRoot = false; 7179 parser.tag = parser.error = null; 7180 parser.strict = !!strict; 7181 parser.noscript = !!(strict || parser.opt.noscript); 7182 parser.state = S.BEGIN; 7183 parser.strictEntities = parser.opt.strictEntities; 7184 parser.ENTITIES = parser.strictEntities ? Object.create(sax2.XML_ENTITIES) : Object.create(sax2.ENTITIES); 7185 parser.attribList = []; 7186 if (parser.opt.xmlns) { 7187 parser.ns = Object.create(rootNS); 7188 } 7189 parser.trackPosition = parser.opt.position !== false; 7190 if (parser.trackPosition) { 7191 parser.position = parser.line = parser.column = 0; 7192 } 7193 emit(parser, "onready"); 7194 } 7195 if (!Object.create) { 7196 Object.create = function(o) { 7197 function F() { 7198 } 7199 F.prototype = o; 7200 var newf = new F(); 7201 return newf; 7202 }; 7203 } 7204 if (!Object.keys) { 7205 Object.keys = function(o) { 7206 var a = []; 7207 for (var i in o) 7208 if (o.hasOwnProperty(i)) 7209 a.push(i); 7210 return a; 7211 }; 7212 } 7213 function checkBufferLength(parser) { 7214 var maxAllowed = Math.max(sax2.MAX_BUFFER_LENGTH, 10); 7215 var maxActual = 0; 7216 for (var i = 0, l = buffers.length; i < l; i++) { 7217 var len = parser[buffers[i]].length; 7218 if (len > maxAllowed) { 7219 switch (buffers[i]) { 7220 case "textNode": 7221 closeText(parser); 7222 break; 7223 case "cdata": 7224 emitNode(parser, "oncdata", parser.cdata); 7225 parser.cdata = ""; 7226 break; 7227 case "script": 7228 emitNode(parser, "onscript", parser.script); 7229 parser.script = ""; 7230 break; 7231 default: 7232 error(parser, "Max buffer length exceeded: " + buffers[i]); 7233 } 7234 } 7235 maxActual = Math.max(maxActual, len); 7236 } 7237 var m = sax2.MAX_BUFFER_LENGTH - maxActual; 7238 parser.bufferCheckPosition = m + parser.position; 7239 } 7240 function clearBuffers(parser) { 7241 for (var i = 0, l = buffers.length; i < l; i++) { 7242 parser[buffers[i]] = ""; 7243 } 7244 } 7245 function flushBuffers(parser) { 7246 closeText(parser); 7247 if (parser.cdata !== "") { 7248 emitNode(parser, "oncdata", parser.cdata); 7249 parser.cdata = ""; 7250 } 7251 if (parser.script !== "") { 7252 emitNode(parser, "onscript", parser.script); 7253 parser.script = ""; 7254 } 7255 } 7256 SAXParser.prototype = { 7257 end: function() { 7258 end(this); 7259 }, 7260 write, 7261 resume: function() { 7262 this.error = null; 7263 return this; 7264 }, 7265 close: function() { 7266 return this.write(null); 7267 }, 7268 flush: function() { 7269 flushBuffers(this); 7270 } 7271 }; 7272 var Stream2;
vendor: 6,106 bytes, lines 7273-7461
7273 try { 7274 Stream2 = streamBrowserify.Stream; 7275 } catch (ex) { 7276 Stream2 = function() { 7277 }; 7278 } 7279 var streamWraps = sax2.EVENTS.filter(function(ev) { 7280 return ev !== "error" && ev !== "end"; 7281 }); 7282 function createStream(strict, opt) { 7283 return new SAXStream(strict, opt); 7284 } 7285 function SAXStream(strict, opt) { 7286 if (!(this instanceof SAXStream)) { 7287 return new SAXStream(strict, opt); 7288 } 7289 Stream2.apply(this); 7290 this._parser = new SAXParser(strict, opt); 7291 this.writable = true; 7292 this.readable = true; 7293 var me = this; 7294 this._parser.onend = function() { 7295 me.emit("end"); 7296 }; 7297 this._parser.onerror = function(er) { 7298 me.emit("error", er); 7299 me._parser.error = null; 7300 }; 7301 this._decoder = null; 7302 streamWraps.forEach(function(ev) { 7303 Object.defineProperty(me, "on" + ev, { 7304 get: function() { 7305 return me._parser["on" + ev]; 7306 }, 7307 set: function(h) { 7308 if (!h) { 7309 me.removeAllListeners(ev); 7310 me._parser["on" + ev] = h; 7311 return h; 7312 } 7313 me.on(ev, h); 7314 }, 7315 enumerable: true, 7316 configurable: false 7317 }); 7318 }); 7319 } 7320 SAXStream.prototype = Object.create(Stream2.prototype, { 7321 constructor: { 7322 value: SAXStream 7323 } 7324 }); 7325 SAXStream.prototype.write = function(data) { 7326 if (typeof Buffer === "function" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(data)) { 7327 if (!this._decoder) { 7328 var SD = requireString_decoder().StringDecoder; 7329 this._decoder = new SD("utf8"); 7330 } 7331 data = this._decoder.write(data); 7332 } 7333 this._parser.write(data.toString()); 7334 this.emit("data", data); 7335 return true; 7336 }; 7337 SAXStream.prototype.end = function(chunk) { 7338 if (chunk && chunk.length) { 7339 this.write(chunk); 7340 } 7341 this._parser.end(); 7342 return true; 7343 }; 7344 SAXStream.prototype.on = function(ev, handler) { 7345 var me = this; 7346 if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) { 7347 me._parser["on" + ev] = function() { 7348 var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments); 7349 args.splice(0, 0, ev); 7350 me.emit.apply(me, args); 7351 }; 7352 } 7353 return Stream2.prototype.on.call(me, ev, handler); 7354 }; 7355 var CDATA = "[CDATA["; 7356 var DOCTYPE = "DOCTYPE"; 7357 var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; 7358 var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"; 7359 var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }; 7360 var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; 7361 var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/; 7362 var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; 7363 var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/; 7364 function isWhitespace(c) { 7365 return c === " " || c === "\n" || c === "\r" || c === " "; 7366 } 7367 function isQuote(c) { 7368 return c === '"' || c === "'"; 7369 } 7370 function isAttribEnd(c) { 7371 return c === ">" || isWhitespace(c); 7372 } 7373 function isMatch(regex, c) { 7374 return regex.test(c); 7375 } 7376 function notMatch(regex, c) { 7377 return !isMatch(regex, c); 7378 } 7379 var S = 0; 7380 sax2.STATE = { 7381 BEGIN: S++, 7382 // leading byte order mark or whitespace 7383 BEGIN_WHITESPACE: S++, 7384 // leading whitespace 7385 TEXT: S++, 7386 // general stuff 7387 TEXT_ENTITY: S++, 7388 // & and such. 7389 OPEN_WAKA: S++, 7390 // < 7391 SGML_DECL: S++, 7392 // <!BLARG 7393 SGML_DECL_QUOTED: S++, 7394 // <!BLARG foo "bar 7395 DOCTYPE: S++, 7396 // <!DOCTYPE 7397 DOCTYPE_QUOTED: S++, 7398 // <!DOCTYPE "//blah 7399 DOCTYPE_DTD: S++, 7400 // <!DOCTYPE "//blah" [ ... 7401 DOCTYPE_DTD_QUOTED: S++, 7402 // <!DOCTYPE "//blah" [ "foo 7403 COMMENT_STARTING: S++, 7404 // <!- 7405 COMMENT: S++, 7406 // <!-- 7407 COMMENT_ENDING: S++, 7408 // <!-- blah - 7409 COMMENT_ENDED: S++, 7410 // <!-- blah -- 7411 CDATA: S++, 7412 // <![CDATA[ something 7413 CDATA_ENDING: S++, 7414 // ] 7415 CDATA_ENDING_2: S++, 7416 // ]] 7417 PROC_INST: S++, 7418 // <?hi 7419 PROC_INST_BODY: S++, 7420 // <?hi there 7421 PROC_INST_ENDING: S++, 7422 // <?hi "there" ? 7423 OPEN_TAG: S++, 7424 // <strong 7425 OPEN_TAG_SLASH: S++, 7426 // <strong / 7427 ATTRIB: S++, 7428 // <a 7429 ATTRIB_NAME: S++, 7430 // <a foo 7431 ATTRIB_NAME_SAW_WHITE: S++, 7432 // <a foo _ 7433 ATTRIB_VALUE: S++, 7434 // <a foo= 7435 ATTRIB_VALUE_QUOTED: S++, 7436 // <a foo="bar 7437 ATTRIB_VALUE_CLOSED: S++, 7438 // <a foo="bar" 7439 ATTRIB_VALUE_UNQUOTED: S++, 7440 // <a foo=bar 7441 ATTRIB_VALUE_ENTITY_Q: S++, 7442 // <foo bar=""" 7443 ATTRIB_VALUE_ENTITY_U: S++, 7444 // <foo bar=" 7445 CLOSE_TAG: S++, 7446 // </a 7447 CLOSE_TAG_SAW_WHITE: S++, 7448 // </a > 7449 SCRIPT: S++, 7450 // <script> ... 7451 SCRIPT_ENDING: S++ 7452 // <script> ... < 7453 }; 7454 sax2.XML_ENTITIES = { 7455 "amp": "&", 7456 "gt": ">", 7457 "lt": "<", 7458 "quot": '"', 7459 "apos": "'" 7460 }; 7461 sax2
vendor: 5,604 bytes, lines 7461-7716
7461.ENTITIES = { 7462 "amp": "&", 7463 "gt": ">", 7464 "lt": "<", 7465 "quot": '"', 7466 "apos": "'", 7467 "AElig": 198, 7468 "Aacute": 193, 7469 "Acirc": 194, 7470 "Agrave": 192, 7471 "Aring": 197, 7472 "Atilde": 195, 7473 "Auml": 196, 7474 "Ccedil": 199, 7475 "ETH": 208, 7476 "Eacute": 201, 7477 "Ecirc": 202, 7478 "Egrave": 200, 7479 "Euml": 203, 7480 "Iacute": 205, 7481 "Icirc": 206, 7482 "Igrave": 204, 7483 "Iuml": 207, 7484 "Ntilde": 209, 7485 "Oacute": 211, 7486 "Ocirc": 212, 7487 "Ograve": 210, 7488 "Oslash": 216, 7489 "Otilde": 213, 7490 "Ouml": 214, 7491 "THORN": 222, 7492 "Uacute": 218, 7493 "Ucirc": 219, 7494 "Ugrave": 217, 7495 "Uuml": 220, 7496 "Yacute": 221, 7497 "aacute": 225, 7498 "acirc": 226, 7499 "aelig": 230, 7500 "agrave": 224, 7501 "aring": 229, 7502 "atilde": 227, 7503 "auml": 228, 7504 "ccedil": 231, 7505 "eacute": 233, 7506 "ecirc": 234, 7507 "egrave": 232, 7508 "eth": 240, 7509 "euml": 235, 7510 "iacute": 237, 7511 "icirc": 238, 7512 "igrave": 236, 7513 "iuml": 239, 7514 "ntilde": 241, 7515 "oacute": 243, 7516 "ocirc": 244, 7517 "ograve": 242, 7518 "oslash": 248, 7519 "otilde": 245, 7520 "ouml": 246, 7521 "szlig": 223, 7522 "thorn": 254, 7523 "uacute": 250, 7524 "ucirc": 251, 7525 "ugrave": 249, 7526 "uuml": 252, 7527 "yacute": 253, 7528 "yuml": 255, 7529 "copy": 169, 7530 "reg": 174, 7531 "nbsp": 160, 7532 "iexcl": 161, 7533 "cent": 162, 7534 "pound": 163, 7535 "curren": 164, 7536 "yen": 165, 7537 "brvbar": 166, 7538 "sect": 167, 7539 "uml": 168, 7540 "ordf": 170, 7541 "laquo": 171, 7542 "not": 172, 7543 "shy": 173, 7544 "macr": 175, 7545 "deg": 176, 7546 "plusmn": 177, 7547 "sup1": 185, 7548 "sup2": 178, 7549 "sup3": 179, 7550 "acute": 180, 7551 "micro": 181, 7552 "para": 182, 7553 "middot": 183, 7554 "cedil": 184, 7555 "ordm": 186, 7556 "raquo": 187, 7557 "frac14": 188, 7558 "frac12": 189, 7559 "frac34": 190, 7560 "iquest": 191, 7561 "times": 215, 7562 "divide": 247, 7563 "OElig": 338, 7564 "oelig": 339, 7565 "Scaron": 352, 7566 "scaron": 353, 7567 "Yuml": 376, 7568 "fnof": 402, 7569 "circ": 710, 7570 "tilde": 732, 7571 "Alpha": 913, 7572 "Beta": 914, 7573 "Gamma": 915, 7574 "Delta": 916, 7575 "Epsilon": 917, 7576 "Zeta": 918, 7577 "Eta": 919, 7578 "Theta": 920, 7579 "Iota": 921, 7580 "Kappa": 922, 7581 "Lambda": 923, 7582 "Mu": 924, 7583 "Nu": 925, 7584 "Xi": 926, 7585 "Omicron": 927, 7586 "Pi": 928, 7587 "Rho": 929, 7588 "Sigma": 931, 7589 "Tau": 932, 7590 "Upsilon": 933, 7591 "Phi": 934, 7592 "Chi": 935, 7593 "Psi": 936, 7594 "Omega": 937, 7595 "alpha": 945, 7596 "beta": 946, 7597 "gamma": 947, 7598 "delta": 948, 7599 "epsilon": 949, 7600 "zeta": 950, 7601 "eta": 951, 7602 "theta": 952, 7603 "iota": 953, 7604 "kappa": 954, 7605 "lambda": 955, 7606 "mu": 956, 7607 "nu": 957, 7608 "xi": 958, 7609 "omicron": 959, 7610 "pi": 960, 7611 "rho": 961, 7612 "sigmaf": 962, 7613 "sigma": 963, 7614 "tau": 964, 7615 "upsilon": 965, 7616 "phi": 966, 7617 "chi": 967, 7618 "psi": 968, 7619 "omega": 969, 7620 "thetasym": 977, 7621 "upsih": 978, 7622 "piv": 982, 7623 "ensp": 8194, 7624 "emsp": 8195, 7625 "thinsp": 8201, 7626 "zwnj": 8204, 7627 "zwj": 8205, 7628 "lrm": 8206, 7629 "rlm": 8207, 7630 "ndash": 8211, 7631 "mdash": 8212, 7632 "lsquo": 8216, 7633 "rsquo": 8217, 7634 "sbquo": 8218, 7635 "ldquo": 8220, 7636 "rdquo": 8221, 7637 "bdquo": 8222, 7638 "dagger": 8224, 7639 "Dagger": 8225, 7640 "bull": 8226, 7641 "hellip": 8230, 7642 "permil": 8240, 7643 "prime": 8242, 7644 "Prime": 8243, 7645 "lsaquo": 8249, 7646 "rsaquo": 8250, 7647 "oline": 8254, 7648 "frasl": 8260, 7649 "euro": 8364, 7650 "image": 8465, 7651 "weierp": 8472, 7652 "real": 8476, 7653 "trade": 8482, 7654 "alefsym": 8501, 7655 "larr": 8592, 7656 "uarr": 8593, 7657 "rarr": 8594, 7658 "darr": 8595, 7659 "harr": 8596, 7660 "crarr": 8629, 7661 "lArr": 8656, 7662 "uArr": 8657, 7663 "rArr": 8658, 7664 "dArr": 8659, 7665 "hArr": 8660, 7666 "forall": 8704, 7667 "part": 8706, 7668 "exist": 8707, 7669 "empty": 8709, 7670 "nabla": 8711, 7671 "isin": 8712, 7672 "notin": 8713, 7673 "ni": 8715, 7674 "prod": 8719, 7675 "sum": 8721, 7676 "minus": 8722, 7677 "lowast": 8727, 7678 "radic": 8730, 7679 "prop": 8733, 7680 "infin": 8734, 7681 "ang": 8736, 7682 "and": 8743, 7683 "or": 8744, 7684 "cap": 8745, 7685 "cup": 8746, 7686 "int": 8747, 7687 "there4": 8756, 7688 "sim": 8764, 7689 "cong": 8773, 7690 "asymp": 8776, 7691 "ne": 8800, 7692 "equiv": 8801, 7693 "le": 8804, 7694 "ge": 8805, 7695 "sub": 8834, 7696 "sup": 8835, 7697 "nsub": 8836, 7698 "sube": 8838, 7699 "supe": 8839, 7700 "oplus": 8853, 7701 "otimes": 8855, 7702 "perp": 8869, 7703 "sdot": 8901, 7704 "lceil": 8968, 7705 "rceil": 8969, 7706 "lfloor": 8970, 7707 "rfloor": 8971, 7708 "lang": 9001, 7709 "rang": 9002, 7710 "loz": 9674, 7711 "spades": 9824, 7712 "clubs": 9827, 7713 "hearts": 9829, 7714 "diams": 9830 7715 }; 7716 Object.keys(sax
vendor: 7,541 bytes, lines 7716-7926
77162.ENTITIES).forEach(function(key) { 7717 var e = sax2.ENTITIES[key]; 7718 var s2 = typeof e === "number" ? String.fromCharCode(e) : e; 7719 sax2.ENTITIES[key] = s2; 7720 }); 7721 for (var s in sax2.STATE) { 7722 sax2.STATE[sax2.STATE[s]] = s; 7723 } 7724 S = sax2.STATE; 7725 function emit(parser, event, data) { 7726 parser[event] && parser[event](data); 7727 } 7728 function emitNode(parser, nodeType, data) { 7729 if (parser.textNode) 7730 closeText(parser); 7731 emit(parser, nodeType, data); 7732 } 7733 function closeText(parser) { 7734 parser.textNode = textopts(parser.opt, parser.textNode); 7735 if (parser.textNode) 7736 emit(parser, "ontext", parser.textNode); 7737 parser.textNode = ""; 7738 } 7739 function textopts(opt, text) { 7740 if (opt.trim) 7741 text = text.trim(); 7742 if (opt.normalize) 7743 text = text.replace(/\s+/g, " "); 7744 return text; 7745 } 7746 function error(parser, er) { 7747 closeText(parser); 7748 if (parser.trackPosition) { 7749 er += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c; 7750 } 7751 er = new Error(er); 7752 parser.error = er; 7753 emit(parser, "onerror", er); 7754 return parser; 7755 } 7756 function end(parser) { 7757 if (parser.sawRoot && !parser.closedRoot) 7758 strictFail(parser, "Unclosed root tag"); 7759 if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) { 7760 error(parser, "Unexpected end"); 7761 } 7762 closeText(parser); 7763 parser.c = ""; 7764 parser.closed = true; 7765 emit(parser, "onend"); 7766 SAXParser.call(parser, parser.strict, parser.opt); 7767 return parser; 7768 } 7769 function strictFail(parser, message) { 7770 if (typeof parser !== "object" || !(parser instanceof SAXParser)) { 7771 throw new Error("bad call to strictFail"); 7772 } 7773 if (parser.strict) { 7774 error(parser, message); 7775 } 7776 } 7777 function newTag(parser) { 7778 if (!parser.strict) 7779 parser.tagName = parser.tagName[parser.looseCase](); 7780 var parent = parser.tags[parser.tags.length - 1] || parser; 7781 var tag = parser.tag = { name: parser.tagName, attributes: {} }; 7782 if (parser.opt.xmlns) { 7783 tag.ns = parent.ns; 7784 } 7785 parser.attribList.length = 0; 7786 emitNode(parser, "onopentagstart", tag); 7787 } 7788 function qname(name, attribute2) { 7789 var i = name.indexOf(":"); 7790 var qualName = i < 0 ? ["", name] : name.split(":"); 7791 var prefix = qualName[0]; 7792 var local = qualName[1]; 7793 if (attribute2 && name === "xmlns") { 7794 prefix = "xmlns"; 7795 local = ""; 7796 } 7797 return { prefix, local }; 7798 } 7799 function attrib(parser) { 7800 if (!parser.strict) { 7801 parser.attribName = parser.attribName[parser.looseCase](); 7802 } 7803 if (parser.attribList.indexOf(parser.attribName) !== -1 || parser.tag.attributes.hasOwnProperty(parser.attribName)) { 7804 parser.attribName = parser.attribValue = ""; 7805 return; 7806 } 7807 if (parser.opt.xmlns) { 7808 var qn = qname(parser.attribName, true); 7809 var prefix = qn.prefix; 7810 var local = qn.local; 7811 if (prefix === "xmlns") { 7812 if (local === "xml" && parser.attribValue !== XML_NAMESPACE) { 7813 strictFail( 7814 parser, 7815 "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue 7816 ); 7817 } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) { 7818 strictFail( 7819 parser, 7820 "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue 7821 ); 7822 } else { 7823 var tag = parser.tag; 7824 var parent = parser.tags[parser.tags.length - 1] || parser; 7825 if (tag.ns === parent.ns) { 7826 tag.ns = Object.create(parent.ns); 7827 } 7828 tag.ns[local] = parser.attribValue; 7829 } 7830 } 7831 parser.attribList.push([parser.attribName, parser.attribValue]); 7832 } else { 7833 parser.tag.attributes[parser.attribName] = parser.attribValue; 7834 emitNode(parser, "onattribute", { 7835 name: parser.attribName, 7836 value: parser.attribValue 7837 }); 7838 } 7839 parser.attribName = parser.attribValue = ""; 7840 } 7841 function openTag(parser, selfClosing) { 7842 if (parser.opt.xmlns) { 7843 var tag = parser.tag; 7844 var qn = qname(parser.tagName); 7845 tag.prefix = qn.prefix; 7846 tag.local = qn.local; 7847 tag.uri = tag.ns[qn.prefix] || ""; 7848 if (tag.prefix && !tag.uri) { 7849 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName)); 7850 tag.uri = qn.prefix; 7851 } 7852 var parent = parser.tags[parser.tags.length - 1] || parser; 7853 if (tag.ns && parent.ns !== tag.ns) { 7854 Object.keys(tag.ns).forEach(function(p) { 7855 emitNode(parser, "onopennamespace", { 7856 prefix: p, 7857 uri: tag.ns[p] 7858 }); 7859 }); 7860 } 7861 for (var i = 0, l = parser.attribList.length; i < l; i++) { 7862 var nv = parser.attribList[i]; 7863 var name = nv[0]; 7864 var value = nv[1]; 7865 var qualName = qname(name, true); 7866 var prefix = qualName.prefix; 7867 var local = qualName.local; 7868 var uri = prefix === "" ? "" : tag.ns[prefix] || ""; 7869 var a = { 7870 name, 7871 value, 7872 prefix, 7873 local, 7874 uri 7875 }; 7876 if (prefix && prefix !== "xmlns" && !uri) { 7877 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix)); 7878 a.uri = prefix; 7879 } 7880 parser.tag.attributes[name] = a; 7881 emitNode(parser, "onattribute", a); 7882 } 7883 parser.attribList.length = 0; 7884 } 7885 parser.tag.isSelfClosing = !!selfClosing; 7886 parser.sawRoot = true; 7887 parser.tags.push(parser.tag); 7888 emitNode(parser, "onopentag", parser.tag); 7889 if (!selfClosing) { 7890 if (!parser.noscript && parser.tagName.toLowerCase() === "script") { 7891 parser.state = S.SCRIPT; 7892 } else { 7893 parser.state = S.TEXT; 7894 } 7895 parser.tag = null; 7896 parser.tagName = ""; 7897 } 7898 parser.attribName = parser.attribValue = ""; 7899 parser.attribList.length = 0; 7900 } 7901 function closeTag(parser) { 7902 if (!parser.tagName) { 7903 strictFail(parser, "Weird empty close tag."); 7904 parser.textNode += "</>"; 7905 parser.state = S.TEXT; 7906 return; 7907 } 7908 if (parser.script) { 7909 if (parser.tagName !== "script") { 7910 parser.script += "</" + parser.tagName + ">"; 7911 parser.tagName = ""; 7912 parser.state = S.SCRIPT; 7913 return; 7914 } 7915 emitNode(parser, "onscript", parser.script); 7916 parser.script = ""; 7917 } 7918 var t = parser.tags.length; 7919 var tagName = parser.tagName; 7920 if (!parser.strict) { 7921 tagName = tagName[parser.looseCase](); 7922 } 7923 var closeTo = tagName; 7924 while (t--) { 7925 var close = parser.tags[t]; 7926 if (close.name !== closeTo) {
vendor: 18,889 bytes, lines 7927-8465
7927 strictFail(parser, "Unexpected close tag"); 7928 } else { 7929 break; 7930 } 7931 } 7932 if (t < 0) { 7933 strictFail(parser, "Unmatched closing tag: " + parser.tagName); 7934 parser.textNode += "</" + parser.tagName + ">"; 7935 parser.state = S.TEXT; 7936 return; 7937 } 7938 parser.tagName = tagName; 7939 var s2 = parser.tags.length; 7940 while (s2-- > t) { 7941 var tag = parser.tag = parser.tags.pop(); 7942 parser.tagName = parser.tag.name; 7943 emitNode(parser, "onclosetag", parser.tagName); 7944 var x = {}; 7945 for (var i in tag.ns) { 7946 x[i] = tag.ns[i]; 7947 } 7948 var parent = parser.tags[parser.tags.length - 1] || parser; 7949 if (parser.opt.xmlns && tag.ns !== parent.ns) { 7950 Object.keys(tag.ns).forEach(function(p) { 7951 var n = tag.ns[p]; 7952 emitNode(parser, "onclosenamespace", { prefix: p, uri: n }); 7953 }); 7954 } 7955 } 7956 if (t === 0) 7957 parser.closedRoot = true; 7958 parser.tagName = parser.attribValue = parser.attribName = ""; 7959 parser.attribList.length = 0; 7960 parser.state = S.TEXT; 7961 } 7962 function parseEntity(parser) { 7963 var entity = parser.entity; 7964 var entityLC = entity.toLowerCase(); 7965 var num; 7966 var numStr = ""; 7967 if (parser.ENTITIES[entity]) { 7968 return parser.ENTITIES[entity]; 7969 } 7970 if (parser.ENTITIES[entityLC]) { 7971 return parser.ENTITIES[entityLC]; 7972 } 7973 entity = entityLC; 7974 if (entity.charAt(0) === "#") { 7975 if (entity.charAt(1) === "x") { 7976 entity = entity.slice(2); 7977 num = parseInt(entity, 16); 7978 numStr = num.toString(16); 7979 } else { 7980 entity = entity.slice(1); 7981 num = parseInt(entity, 10); 7982 numStr = num.toString(10); 7983 } 7984 } 7985 entity = entity.replace(/^0+/, ""); 7986 if (isNaN(num) || numStr.toLowerCase() !== entity) { 7987 strictFail(parser, "Invalid character entity"); 7988 return "&" + parser.entity + ";"; 7989 } 7990 return String.fromCodePoint(num); 7991 } 7992 function beginWhiteSpace(parser, c) { 7993 if (c === "<") { 7994 parser.state = S.OPEN_WAKA; 7995 parser.startTagPosition = parser.position; 7996 } else if (!isWhitespace(c)) { 7997 strictFail(parser, "Non-whitespace before first tag."); 7998 parser.textNode = c; 7999 parser.state = S.TEXT; 8000 } 8001 } 8002 function charAt(chunk, i) { 8003 var result = ""; 8004 if (i < chunk.length) { 8005 result = chunk.charAt(i); 8006 } 8007 return result; 8008 } 8009 function write(chunk) { 8010 var parser = this; 8011 if (this.error) { 8012 throw this.error; 8013 } 8014 if (parser.closed) { 8015 return error( 8016 parser, 8017 "Cannot write after close. Assign an onready handler." 8018 ); 8019 } 8020 if (chunk === null) { 8021 return end(parser); 8022 } 8023 if (typeof chunk === "object") { 8024 chunk = chunk.toString(); 8025 } 8026 var i = 0; 8027 var c = ""; 8028 while (true) { 8029 c = charAt(chunk, i++); 8030 parser.c = c; 8031 if (!c) { 8032 break; 8033 } 8034 if (parser.trackPosition) { 8035 parser.position++; 8036 if (c === "\n") { 8037 parser.line++; 8038 parser.column = 0; 8039 } else { 8040 parser.column++; 8041 } 8042 } 8043 switch (parser.state) { 8044 case S.BEGIN: 8045 parser.state = S.BEGIN_WHITESPACE; 8046 if (c === "\uFEFF") { 8047 continue; 8048 } 8049 beginWhiteSpace(parser, c); 8050 continue; 8051 case S.BEGIN_WHITESPACE: 8052 beginWhiteSpace(parser, c); 8053 continue; 8054 case S.TEXT: 8055 if (parser.sawRoot && !parser.closedRoot) { 8056 var starti = i - 1; 8057 while (c && c !== "<" && c !== "&") { 8058 c = charAt(chunk, i++); 8059 if (c && parser.trackPosition) { 8060 parser.position++; 8061 if (c === "\n") { 8062 parser.line++; 8063 parser.column = 0; 8064 } else { 8065 parser.column++; 8066 } 8067 } 8068 } 8069 parser.textNode += chunk.substring(starti, i - 1); 8070 } 8071 if (c === "<" && !(parser.sawRoot && parser.closedRoot && !parser.strict)) { 8072 parser.state = S.OPEN_WAKA; 8073 parser.startTagPosition = parser.position; 8074 } else { 8075 if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) { 8076 strictFail(parser, "Text data outside of root node."); 8077 } 8078 if (c === "&") { 8079 parser.state = S.TEXT_ENTITY; 8080 } else { 8081 parser.textNode += c; 8082 } 8083 } 8084 continue; 8085 case S.SCRIPT: 8086 if (c === "<") { 8087 parser.state = S.SCRIPT_ENDING; 8088 } else { 8089 parser.script += c; 8090 } 8091 continue; 8092 case S.SCRIPT_ENDING: 8093 if (c === "/") { 8094 parser.state = S.CLOSE_TAG; 8095 } else { 8096 parser.script += "<" + c; 8097 parser.state = S.SCRIPT; 8098 } 8099 continue; 8100 case S.OPEN_WAKA: 8101 if (c === "!") { 8102 parser.state = S.SGML_DECL; 8103 parser.sgmlDecl = ""; 8104 } else if (isWhitespace(c)) 8105 ; 8106 else if (isMatch(nameStart, c)) { 8107 parser.state = S.OPEN_TAG; 8108 parser.tagName = c; 8109 } else if (c === "/") { 8110 parser.state = S.CLOSE_TAG; 8111 parser.tagName = ""; 8112 } else if (c === "?") { 8113 parser.state = S.PROC_INST; 8114 parser.procInstName = parser.procInstBody = ""; 8115 } else { 8116 strictFail(parser, "Unencoded <"); 8117 if (parser.startTagPosition + 1 < parser.position) { 8118 var pad = parser.position - parser.startTagPosition; 8119 c = new Array(pad).join(" ") + c; 8120 } 8121 parser.textNode += "<" + c; 8122 parser.state = S.TEXT; 8123 } 8124 continue; 8125 case S.SGML_DECL: 8126 if ((parser.sgmlDecl + c).toUpperCase() === CDATA) { 8127 emitNode(parser, "onopencdata"); 8128 parser.state = S.CDATA; 8129 parser.sgmlDecl = ""; 8130 parser.cdata = ""; 8131 } else if (parser.sgmlDecl + c === "--") { 8132 parser.state = S.COMMENT; 8133 parser.comment = ""; 8134 parser.sgmlDecl = ""; 8135 } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) { 8136 parser.state = S.DOCTYPE; 8137 if (parser.doctype || parser.sawRoot) { 8138 strictFail( 8139 parser, 8140 "Inappropriately located doctype declaration" 8141 ); 8142 } 8143 parser.doctype = ""; 8144 parser.sgmlDecl = ""; 8145 } else if (c === ">") { 8146 emitNode(parser, "onsgmldeclaration", parser.sgmlDecl); 8147 parser.sgmlDecl = ""; 8148 parser.state = S.TEXT; 8149 } else if (isQuote(c)) { 8150 parser.state = S.SGML_DECL_QUOTED; 8151 parser.sgmlDecl += c; 8152 } else { 8153 parser.sgmlDecl += c; 8154 } 8155 continue; 8156 case S.SGML_DECL_QUOTED: 8157 if (c === parser.q) { 8158 parser.state = S.SGML_DECL; 8159 parser.q = ""; 8160 } 8161 parser.sgmlDecl += c; 8162 continue; 8163 case S.DOCTYPE: 8164 if (c === ">") { 8165 parser.state = S.TEXT; 8166 emitNode(parser, "ondoctype", parser.doctype); 8167 parser.doctype = true; 8168 } else { 8169 parser.doctype += c; 8170 if (c === "[") { 8171 parser.state = S.DOCTYPE_DTD; 8172 } else if (isQuote(c)) { 8173 parser.state = S.DOCTYPE_QUOTED; 8174 parser.q = c; 8175 } 8176 } 8177 continue; 8178 case S.DOCTYPE_QUOTED: 8179 parser.doctype += c; 8180 if (c === parser.q) { 8181 parser.q = ""; 8182 parser.state = S.DOCTYPE; 8183 } 8184 continue; 8185 case S.DOCTYPE_DTD: 8186 parser.doctype += c; 8187 if (c === "]") { 8188 parser.state = S.DOCTYPE; 8189 } else if (isQuote(c)) { 8190 parser.state = S.DOCTYPE_DTD_QUOTED; 8191 parser.q = c; 8192 } 8193 continue; 8194 case S.DOCTYPE_DTD_QUOTED: 8195 parser.doctype += c; 8196 if (c === parser.q) { 8197 parser.state = S.DOCTYPE_DTD; 8198 parser.q = ""; 8199 } 8200 continue; 8201 case S.COMMENT: 8202 if (c === "-") { 8203 parser.state = S.COMMENT_ENDING; 8204 } else { 8205 parser.comment += c; 8206 } 8207 continue; 8208 case S.COMMENT_ENDING: 8209 if (c === "-") { 8210 parser.state = S.COMMENT_ENDED; 8211 parser.comment = textopts(parser.opt, parser.comment); 8212 if (parser.comment) { 8213 emitNode(parser, "oncomment", parser.comment); 8214 } 8215 parser.comment = ""; 8216 } else { 8217 parser.comment += "-" + c; 8218 parser.state = S.COMMENT; 8219 } 8220 continue; 8221 case S.COMMENT_ENDED: 8222 if (c !== ">") { 8223 strictFail(parser, "Malformed comment"); 8224 parser.comment += "--" + c; 8225 parser.state = S.COMMENT; 8226 } else { 8227 parser.state = S.TEXT; 8228 } 8229 continue; 8230 case S.CDATA: 8231 if (c === "]") { 8232 parser.state = S.CDATA_ENDING; 8233 } else { 8234 parser.cdata += c; 8235 } 8236 continue; 8237 case S.CDATA_ENDING: 8238 if (c === "]") { 8239 parser.state = S.CDATA_ENDING_2; 8240 } else { 8241 parser.cdata += "]" + c; 8242 parser.state = S.CDATA; 8243 } 8244 continue; 8245 case S.CDATA_ENDING_2: 8246 if (c === ">") { 8247 if (parser.cdata) { 8248 emitNode(parser, "oncdata", parser.cdata); 8249 } 8250 emitNode(parser, "onclosecdata"); 8251 parser.cdata = ""; 8252 parser.state = S.TEXT; 8253 } else if (c === "]") { 8254 parser.cdata += "]"; 8255 } else { 8256 parser.cdata += "]]" + c; 8257 parser.state = S.CDATA; 8258 } 8259 continue; 8260 case S.PROC_INST: 8261 if (c === "?") { 8262 parser.state = S.PROC_INST_ENDING; 8263 } else if (isWhitespace(c)) { 8264 parser.state = S.PROC_INST_BODY; 8265 } else { 8266 parser.procInstName += c; 8267 } 8268 continue; 8269 case S.PROC_INST_BODY: 8270 if (!parser.procInstBody && isWhitespace(c)) { 8271 continue; 8272 } else if (c === "?") { 8273 parser.state = S.PROC_INST_ENDING; 8274 } else { 8275 parser.procInstBody += c; 8276 } 8277 continue; 8278 case S.PROC_INST_ENDING: 8279 if (c === ">") { 8280 emitNode(parser, "onprocessinginstruction", { 8281 name: parser.procInstName, 8282 body: parser.procInstBody 8283 }); 8284 parser.procInstName = parser.procInstBody = ""; 8285 parser.state = S.TEXT; 8286 } else { 8287 parser.procInstBody += "?" + c; 8288 parser.state = S.PROC_INST_BODY; 8289 } 8290 continue; 8291 case S.OPEN_TAG: 8292 if (isMatch(nameBody, c)) { 8293 parser.tagName += c; 8294 } else { 8295 newTag(parser); 8296 if (c === ">") { 8297 openTag(parser); 8298 } else if (c === "/") { 8299 parser.state = S.OPEN_TAG_SLASH; 8300 } else { 8301 if (!isWhitespace(c)) { 8302 strictFail(parser, "Invalid character in tag name"); 8303 } 8304 parser.state = S.ATTRIB; 8305 } 8306 } 8307 continue; 8308 case S.OPEN_TAG_SLASH: 8309 if (c === ">") { 8310 openTag(parser, true); 8311 closeTag(parser); 8312 } else { 8313 strictFail(parser, "Forward-slash in opening tag not followed by >"); 8314 parser.state = S.ATTRIB; 8315 } 8316 continue; 8317 case S.ATTRIB: 8318 if (isWhitespace(c)) { 8319 continue; 8320 } else if (c === ">") { 8321 openTag(parser); 8322 } else if (c === "/") { 8323 parser.state = S.OPEN_TAG_SLASH; 8324 } else if (isMatch(nameStart, c)) { 8325 parser.attribName = c; 8326 parser.attribValue = ""; 8327 parser.state = S.ATTRIB_NAME; 8328 } else { 8329 strictFail(parser, "Invalid attribute name"); 8330 } 8331 continue; 8332 case S.ATTRIB_NAME: 8333 if (c === "=") { 8334 parser.state = S.ATTRIB_VALUE; 8335 } else if (c === ">") { 8336 strictFail(parser, "Attribute without value"); 8337 parser.attribValue = parser.attribName; 8338 attrib(parser); 8339 openTag(parser); 8340 } else if (isWhitespace(c)) { 8341 parser.state = S.ATTRIB_NAME_SAW_WHITE; 8342 } else if (isMatch(nameBody, c)) { 8343 parser.attribName += c; 8344 } else { 8345 strictFail(parser, "Invalid attribute name"); 8346 } 8347 continue; 8348 case S.ATTRIB_NAME_SAW_WHITE: 8349 if (c === "=") { 8350 parser.state = S.ATTRIB_VALUE; 8351 } else if (isWhitespace(c)) { 8352 continue; 8353 } else { 8354 strictFail(parser, "Attribute without value"); 8355 parser.tag.attributes[parser.attribName] = ""; 8356 parser.attribValue = ""; 8357 emitNode(parser, "onattribute", { 8358 name: parser.attribName, 8359 value: "" 8360 }); 8361 parser.attribName = ""; 8362 if (c === ">") { 8363 openTag(parser); 8364 } else if (isMatch(nameStart, c)) { 8365 parser.attribName = c; 8366 parser.state = S.ATTRIB_NAME; 8367 } else { 8368 strictFail(parser, "Invalid attribute name"); 8369 parser.state = S.ATTRIB; 8370 } 8371 } 8372 continue; 8373 case S.ATTRIB_VALUE: 8374 if (isWhitespace(c)) { 8375 continue; 8376 } else if (isQuote(c)) { 8377 parser.q = c; 8378 parser.state = S.ATTRIB_VALUE_QUOTED; 8379 } else { 8380 strictFail(parser, "Unquoted attribute value"); 8381 parser.state = S.ATTRIB_VALUE_UNQUOTED; 8382 parser.attribValue = c; 8383 } 8384 continue; 8385 case S.ATTRIB_VALUE_QUOTED: 8386 if (c !== parser.q) { 8387 if (c === "&") { 8388 parser.state = S.ATTRIB_VALUE_ENTITY_Q; 8389 } else { 8390 parser.attribValue += c; 8391 } 8392 continue; 8393 } 8394 attrib(parser); 8395 parser.q = ""; 8396 parser.state = S.ATTRIB_VALUE_CLOSED; 8397 continue; 8398 case S.ATTRIB_VALUE_CLOSED: 8399 if (isWhitespace(c)) { 8400 parser.state = S.ATTRIB; 8401 } else if (c === ">") { 8402 openTag(parser); 8403 } else if (c === "/") { 8404 parser.state = S.OPEN_TAG_SLASH; 8405 } else if (isMatch(nameStart, c)) { 8406 strictFail(parser, "No whitespace between attributes"); 8407 parser.attribName = c; 8408 parser.attribValue = ""; 8409 parser.state = S.ATTRIB_NAME; 8410 } else { 8411 strictFail(parser, "Invalid attribute name"); 8412 } 8413 continue; 8414 case S.ATTRIB_VALUE_UNQUOTED: 8415 if (!isAttribEnd(c)) { 8416 if (c === "&") { 8417 parser.state = S.ATTRIB_VALUE_ENTITY_U; 8418 } else { 8419 parser.attribValue += c; 8420 } 8421 continue; 8422 } 8423 attrib(parser); 8424 if (c === ">") { 8425 openTag(parser); 8426 } else { 8427 parser.state = S.ATTRIB; 8428 } 8429 continue; 8430 case S.CLOSE_TAG: 8431 if (!parser.tagName) { 8432 if (isWhitespace(c)) { 8433 continue; 8434 } else if (notMatch(nameStart, c)) { 8435 if (parser.script) { 8436 parser.script += "</" + c; 8437 parser.state = S.SCRIPT; 8438 } else { 8439 strictFail(parser, "Invalid tagname in closing tag."); 8440 } 8441 } else { 8442 parser.tagName = c; 8443 } 8444 } else if (c === ">") { 8445 closeTag(parser); 8446 } else if (isMatch(nameBody, c)) { 8447 parser.tagName += c; 8448 } else if (parser.script) { 8449 parser.script += "</" + parser.tagName; 8450 parser.tagName = ""; 8451 parser.state = S.SCRIPT; 8452 } else { 8453 if (!isWhitespace(c)) { 8454 strictFail(parser, "Invalid tagname in closing tag"); 8455 } 8456 parser.state = S.CLOSE_TAG_SAW_WHITE; 8457 } 8458 continue; 8459 case S.CLOSE_TAG_SAW_WHITE: 8460 if (isWhitespace(c)) { 8461 continue; 8462 } 8463 if (c === ">") { 8464 closeTag(parser); 8465 } else {
8466 strictFail(parser, "Invalid characters in closing tag"); 8467 } 8468 continue; 8469 case S.TEXT_ENTITY: 8470 case S.ATTRIB_VALUE_ENTITY_Q: 8471 case S.ATTRIB_VALUE_ENTITY_U: 8472 var returnState; 8473 var buffer2; 8474 switch (parser.state) { 8475 case S.TEXT_ENTITY: 8476 returnState = S.TEXT; 8477 buffer2 = "textNode"; 8478 break; 8479 case S.ATTRIB_VALUE_ENTITY_Q: 8480 returnState = S.ATTRIB_VALUE_QUOTED; 8481 buffer2 = "attribValue"; 8482 break; 8483 case S.ATTRIB_VALUE_ENTITY_U: 8484 returnState = S.ATTRIB_VALUE_UNQUOTED; 8485 buffer2 = "attribValue"; 8486 break; 8487 } 8488 if (c === ";") { 8489 parser[buffer2] += parseEntity(parser); 8490 parser.entity = ""; 8491 parser.state = returnState; 8492 } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) { 8493 parser.entity += c; 8494 } else { 8495 strictFail(parser, "Invalid character in entity name"); 8496 parser[buffer2] += "&" + parser.entity + c; 8497 parser.entity = ""; 8498 parser.state = returnState; 8499 } 8500 continue; 8501 default: 8502 throw new Error(parser, "Unknown state: " + parser.state); 8503 } 8504 } 8505 if (parser.position >= parser.bufferCheckPosition) { 8506 checkBufferLength(parser); 8507 } 8508 return parser; 8509 } 8510 /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */ 8511 if (!String.fromCodePoint) { 8512 (function() { 8513 var stringFromCharCode = String.fromCharCode; 8514 var floor = Math.floor; 8515 var fromCodePoint = function() { 8516 var MAX_SIZE = 16384; 8517 var codeUnits = []; 8518 var highSurrogate; 8519 var lowSurrogate; 8520 var index = -1; 8521 var length = arguments.length; 8522 if (!length) { 8523 return ""; 8524 } 8525 var result = ""; 8526 while (++index < length) { 8527 var codePoint = Number(arguments[index]); 8528 if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` 8529 codePoint < 0 || // not a valid Unicode code point 8530 codePoint > 1114111 || // not a valid Unicode code point 8531 floor(codePoint) !== codePoint) { 8532 throw RangeError("Invalid code point: " + codePoint); 8533 } 8534 if (codePoint <= 65535) { 8535 codeUnits.push(codePoint); 8536 } else { 8537 codePoint -= 65536; 8538 highSurrogate = (codePoint >> 10) + 55296; 8539 lowSurrogate = codePoint % 1024 + 56320; 8540 codeUnits.push(highSurrogate, lowSurrogate); 8541 } 8542 if (index + 1 === length || codeUnits.length > MAX_SIZE) { 8543 result += stringFromCharCode.apply(null, codeUnits); 8544 codeUnits.length = 0; 8545 } 8546 } 8547 return result; 8548 }; 8549 if (Object.defineProperty) { 8550 Object.defineProperty(String, "fromCodePoint", { 8551 value: fromCodePoint, 8552 configurable: true, 8553 writable: true 8554 }); 8555 } else { 8556 String.fromCodePoint = fromCodePoint; 8557 } 8558 })(); 8559 } 8560 })(exports3); 8561 })(sax$1); 8562 var arrayHelper = { 8563 isArray: function(value) { 8564 if (Array.isArray) { 8565 return Array.isArray(value); 8566 } 8567 return Object.prototype.toString.call(value) === "[object Array]"; 8568 } 8569 }; 8570 var isArray$2 = arrayHelper.isArray; 8571 var optionsHelper = { 8572 copyOptions: function(options2) { 8573 var key, copy = {}; 8574 for (key in options2) { 8575 if (options2.hasOwnProperty(key)) { 8576 copy[key] = options2[key]; 8577 } 8578 } 8579 return copy; 8580 }, 8581 ensureFlagExists: function(item, options2) { 8582 if (!(item in options2) || typeof options2[item] !== "boolean") { 8583 options2[item] = false;
vendor: 27,669 bytes, lines 8584-9279
8584 } 8585 }, 8586 ensureSpacesExists: function(options2) { 8587 if (!("spaces" in options2) || typeof options2.spaces !== "number" && typeof options2.spaces !== "string") { 8588 options2.spaces = 0; 8589 } 8590 }, 8591 ensureAlwaysArrayExists: function(options2) { 8592 if (!("alwaysArray" in options2) || typeof options2.alwaysArray !== "boolean" && !isArray$2(options2.alwaysArray)) { 8593 options2.alwaysArray = false; 8594 } 8595 }, 8596 ensureKeyExists: function(key, options2) { 8597 if (!(key + "Key" in options2) || typeof options2[key + "Key"] !== "string") { 8598 options2[key + "Key"] = options2.compact ? "_" + key : key; 8599 } 8600 }, 8601 checkFnExists: function(key, options2) { 8602 return key + "Fn" in options2; 8603 } 8604 }; 8605 var sax = sax$1; 8606 var helper$2 = optionsHelper; 8607 var isArray$1 = arrayHelper.isArray; 8608 var options; 8609 var currentElement$1; 8610 function validateOptions$2(userOptions) { 8611 options = helper$2.copyOptions(userOptions); 8612 helper$2.ensureFlagExists("ignoreDeclaration", options); 8613 helper$2.ensureFlagExists("ignoreInstruction", options); 8614 helper$2.ensureFlagExists("ignoreAttributes", options); 8615 helper$2.ensureFlagExists("ignoreText", options); 8616 helper$2.ensureFlagExists("ignoreComment", options); 8617 helper$2.ensureFlagExists("ignoreCdata", options); 8618 helper$2.ensureFlagExists("ignoreDoctype", options); 8619 helper$2.ensureFlagExists("compact", options); 8620 helper$2.ensureFlagExists("alwaysChildren", options); 8621 helper$2.ensureFlagExists("addParent", options); 8622 helper$2.ensureFlagExists("trim", options); 8623 helper$2.ensureFlagExists("nativeType", options); 8624 helper$2.ensureFlagExists("nativeTypeAttributes", options); 8625 helper$2.ensureFlagExists("sanitize", options); 8626 helper$2.ensureFlagExists("instructionHasAttributes", options); 8627 helper$2.ensureFlagExists("captureSpacesBetweenElements", options); 8628 helper$2.ensureAlwaysArrayExists(options); 8629 helper$2.ensureKeyExists("declaration", options); 8630 helper$2.ensureKeyExists("instruction", options); 8631 helper$2.ensureKeyExists("attributes", options); 8632 helper$2.ensureKeyExists("text", options); 8633 helper$2.ensureKeyExists("comment", options); 8634 helper$2.ensureKeyExists("cdata", options); 8635 helper$2.ensureKeyExists("doctype", options); 8636 helper$2.ensureKeyExists("type", options); 8637 helper$2.ensureKeyExists("name", options); 8638 helper$2.ensureKeyExists("elements", options); 8639 helper$2.ensureKeyExists("parent", options); 8640 helper$2.checkFnExists("doctype", options); 8641 helper$2.checkFnExists("instruction", options); 8642 helper$2.checkFnExists("cdata", options); 8643 helper$2.checkFnExists("comment", options); 8644 helper$2.checkFnExists("text", options); 8645 helper$2.checkFnExists("instructionName", options); 8646 helper$2.checkFnExists("elementName", options); 8647 helper$2.checkFnExists("attributeName", options); 8648 helper$2.checkFnExists("attributeValue", options); 8649 helper$2.checkFnExists("attributes", options); 8650 return options; 8651 } 8652 function nativeType(value) { 8653 var nValue = Number(value); 8654 if (!isNaN(nValue)) { 8655 return nValue; 8656 } 8657 var bValue = value.toLowerCase(); 8658 if (bValue === "true") { 8659 return true; 8660 } else if (bValue === "false") { 8661 return false; 8662 } 8663 return value; 8664 } 8665 function addField(type, value) { 8666 var key; 8667 if (options.compact) { 8668 if (!currentElement$1[options[type + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type + "Key"]) !== -1 : options.alwaysArray)) { 8669 currentElement$1[options[type + "Key"]] = []; 8670 } 8671 if (currentElement$1[options[type + "Key"]] && !isArray$1(currentElement$1[options[type + "Key"]])) { 8672 currentElement$1[options[type + "Key"]] = [currentElement$1[options[type + "Key"]]]; 8673 } 8674 if (type + "Fn" in options && typeof value === "string") { 8675 value = options[type + "Fn"](value, currentElement$1); 8676 } 8677 if (type === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) { 8678 for (key in value) { 8679 if (value.hasOwnProperty(key)) { 8680 if ("instructionFn" in options) { 8681 value[key] = options.instructionFn(value[key], key, currentElement$1); 8682 } else { 8683 var temp = value[key]; 8684 delete value[key]; 8685 value[options.instructionNameFn(key, temp, currentElement$1)] = temp; 8686 } 8687 } 8688 } 8689 } 8690 if (isArray$1(currentElement$1[options[type + "Key"]])) { 8691 currentElement$1[options[type + "Key"]].push(value); 8692 } else { 8693 currentElement$1[options[type + "Key"]] = value; 8694 } 8695 } else { 8696 if (!currentElement$1[options.elementsKey]) { 8697 currentElement$1[options.elementsKey] = []; 8698 } 8699 var element2 = {}; 8700 element2[options.typeKey] = type; 8701 if (type === "instruction") { 8702 for (key in value) { 8703 if (value.hasOwnProperty(key)) { 8704 break; 8705 } 8706 } 8707 element2[options.nameKey] = "instructionNameFn" in options ? options.instructionNameFn(key, value, currentElement$1) : key; 8708 if (options.instructionHasAttributes) { 8709 element2[options.attributesKey] = value[key][options.attributesKey]; 8710 if ("instructionFn" in options) { 8711 element2[options.attributesKey] = options.instructionFn(element2[options.attributesKey], key, currentElement$1); 8712 } 8713 } else { 8714 if ("instructionFn" in options) { 8715 value[key] = options.instructionFn(value[key], key, currentElement$1); 8716 } 8717 element2[options.instructionKey] = value[key]; 8718 } 8719 } else { 8720 if (type + "Fn" in options) { 8721 value = options[type + "Fn"](value, currentElement$1); 8722 } 8723 element2[options[type + "Key"]] = value; 8724 } 8725 if (options.addParent) { 8726 element2[options.parentKey] = currentElement$1; 8727 } 8728 currentElement$1[options.elementsKey].push(element2); 8729 } 8730 } 8731 function manipulateAttributes(attributes) { 8732 if ("attributesFn" in options && attributes) { 8733 attributes = options.attributesFn(attributes, currentElement$1); 8734 } 8735 if ((options.trim || "attributeValueFn" in options || "attributeNameFn" in options || options.nativeTypeAttributes) && attributes) { 8736 var key; 8737 for (key in attributes) { 8738 if (attributes.hasOwnProperty(key)) { 8739 if (options.trim) 8740 attributes[key] = attributes[key].trim(); 8741 if (options.nativeTypeAttributes) { 8742 attributes[key] = nativeType(attributes[key]); 8743 } 8744 if ("attributeValueFn" in options) 8745 attributes[key] = options.attributeValueFn(attributes[key], key, currentElement$1); 8746 if ("attributeNameFn" in options) { 8747 var temp = attributes[key]; 8748 delete attributes[key]; 8749 attributes[options.attributeNameFn(key, attributes[key], currentElement$1)] = temp; 8750 } 8751 } 8752 } 8753 } 8754 return attributes; 8755 } 8756 function onInstruction(instruction) { 8757 var attributes = {}; 8758 if (instruction.body && (instruction.name.toLowerCase() === "xml" || options.instructionHasAttributes)) { 8759 var attrsRegExp = /([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g; 8760 var match; 8761 while ((match = attrsRegExp.exec(instruction.body)) !== null) { 8762 attributes[match[1]] = match[2] || match[3] || match[4]; 8763 } 8764 attributes = manipulateAttributes(attributes); 8765 } 8766 if (instruction.name.toLowerCase() === "xml") { 8767 if (options.ignoreDeclaration) { 8768 return; 8769 } 8770 currentElement$1[options.declarationKey] = {}; 8771 if (Object.keys(attributes).length) { 8772 currentElement$1[options.declarationKey][options.attributesKey] = attributes; 8773 } 8774 if (options.addParent) { 8775 currentElement$1[options.declarationKey][options.parentKey] = currentElement$1; 8776 } 8777 } else { 8778 if (options.ignoreInstruction) { 8779 return; 8780 } 8781 if (options.trim) { 8782 instruction.body = instruction.body.trim(); 8783 } 8784 var value = {}; 8785 if (options.instructionHasAttributes && Object.keys(attributes).length) { 8786 value[instruction.name] = {}; 8787 value[instruction.name][options.attributesKey] = attributes; 8788 } else { 8789 value[instruction.name] = instruction.body; 8790 } 8791 addField("instruction", value); 8792 } 8793 } 8794 function onStartElement(name, attributes) { 8795 var element2; 8796 if (typeof name === "object") { 8797 attributes = name.attributes; 8798 name = name.name; 8799 } 8800 attributes = manipulateAttributes(attributes); 8801 if ("elementNameFn" in options) { 8802 name = options.elementNameFn(name, currentElement$1); 8803 } 8804 if (options.compact) { 8805 element2 = {}; 8806 if (!options.ignoreAttributes && attributes && Object.keys(attributes).length) { 8807 element2[options.attributesKey] = {}; 8808 var key; 8809 for (key in attributes) { 8810 if (attributes.hasOwnProperty(key)) { 8811 element2[options.attributesKey][key] = attributes[key]; 8812 } 8813 } 8814 } 8815 if (!(name in currentElement$1) && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(name) !== -1 : options.alwaysArray)) { 8816 currentElement$1[name] = []; 8817 } 8818 if (currentElement$1[name] && !isArray$1(currentElement$1[name])) { 8819 currentElement$1[name] = [currentElement$1[name]]; 8820 } 8821 if (isArray$1(currentElement$1[name])) { 8822 currentElement$1[name].push(element2); 8823 } else { 8824 currentElement$1[name] = element2; 8825 } 8826 } else { 8827 if (!currentElement$1[options.elementsKey]) { 8828 currentElement$1[options.elementsKey] = []; 8829 } 8830 element2 = {}; 8831 element2[options.typeKey] = "element"; 8832 element2[options.nameKey] = name; 8833 if (!options.ignoreAttributes && attributes && Object.keys(attributes).length) { 8834 element2[options.attributesKey] = attributes; 8835 } 8836 if (options.alwaysChildren) { 8837 element2[options.elementsKey] = []; 8838 } 8839 currentElement$1[options.elementsKey].push(element2); 8840 } 8841 element2[options.parentKey] = currentElement$1; 8842 currentElement$1 = element2; 8843 } 8844 function onText(text) { 8845 if (options.ignoreText) { 8846 return; 8847 } 8848 if (!text.trim() && !options.captureSpacesBetweenElements) { 8849 return; 8850 } 8851 if (options.trim) { 8852 text = text.trim(); 8853 } 8854 if (options.nativeType) { 8855 text = nativeType(text); 8856 } 8857 if (options.sanitize) { 8858 text = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); 8859 } 8860 addField("text", text); 8861 } 8862 function onComment(comment) { 8863 if (options.ignoreComment) { 8864 return; 8865 } 8866 if (options.trim) { 8867 comment = comment.trim(); 8868 } 8869 addField("comment", comment); 8870 } 8871 function onEndElement(name) { 8872 var parentElement = currentElement$1[options.parentKey]; 8873 if (!options.addParent) { 8874 delete currentElement$1[options.parentKey]; 8875 } 8876 currentElement$1 = parentElement; 8877 } 8878 function onCdata(cdata) { 8879 if (options.ignoreCdata) { 8880 return; 8881 } 8882 if (options.trim) { 8883 cdata = cdata.trim(); 8884 } 8885 addField("cdata", cdata); 8886 } 8887 function onDoctype(doctype) { 8888 if (options.ignoreDoctype) { 8889 return; 8890 } 8891 doctype = doctype.replace(/^ /, ""); 8892 if (options.trim) { 8893 doctype = doctype.trim(); 8894 } 8895 addField("doctype", doctype); 8896 } 8897 function onError(error) { 8898 error.note = error; 8899 } 8900 var xml2js$2 = function(xml2, userOptions) { 8901 var parser = sax.parser(true, {}); 8902 var result = {}; 8903 currentElement$1 = result; 8904 options = validateOptions$2(userOptions); 8905 { 8906 parser.opt = { strictEntities: true }; 8907 parser.onopentag = onStartElement; 8908 parser.ontext = onText; 8909 parser.oncomment = onComment; 8910 parser.onclosetag = onEndElement; 8911 parser.onerror = onError; 8912 parser.oncdata = onCdata; 8913 parser.ondoctype = onDoctype; 8914 parser.onprocessinginstruction = onInstruction; 8915 } 8916 { 8917 parser.write(xml2).close(); 8918 } 8919 if (result[options.elementsKey]) { 8920 var temp = result[options.elementsKey]; 8921 delete result[options.elementsKey]; 8922 result[options.elementsKey] = temp; 8923 delete result.text; 8924 } 8925 return result; 8926 }; 8927 var helper$1 = optionsHelper; 8928 var xml2js$1 = xml2js$2; 8929 function validateOptions$1(userOptions) { 8930 var options2 = helper$1.copyOptions(userOptions); 8931 helper$1.ensureSpacesExists(options2); 8932 return options2; 8933 } 8934 var xml2json$1 = function(xml2, userOptions) { 8935 var options2, js, json, parentKey; 8936 options2 = validateOptions$1(userOptions); 8937 js = xml2js$1(xml2, options2); 8938 parentKey = "compact" in options2 && options2.compact ? "_parent" : "parent"; 8939 if ("addParent" in options2 && options2.addParent) { 8940 json = JSON.stringify(js, function(k, v) { 8941 return k === parentKey ? "_" : v; 8942 }, options2.spaces); 8943 } else { 8944 json = JSON.stringify(js, null, options2.spaces); 8945 } 8946 return json.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); 8947 }; 8948 var helper = optionsHelper; 8949 var isArray = arrayHelper.isArray; 8950 var currentElement, currentElementName; 8951 function validateOptions(userOptions) { 8952 var options2 = helper.copyOptions(userOptions); 8953 helper.ensureFlagExists("ignoreDeclaration", options2); 8954 helper.ensureFlagExists("ignoreInstruction", options2); 8955 helper.ensureFlagExists("ignoreAttributes", options2); 8956 helper.ensureFlagExists("ignoreText", options2); 8957 helper.ensureFlagExists("ignoreComment", options2); 8958 helper.ensureFlagExists("ignoreCdata", options2); 8959 helper.ensureFlagExists("ignoreDoctype", options2); 8960 helper.ensureFlagExists("compact", options2); 8961 helper.ensureFlagExists("indentText", options2); 8962 helper.ensureFlagExists("indentCdata", options2); 8963 helper.ensureFlagExists("indentAttributes", options2); 8964 helper.ensureFlagExists("indentInstruction", options2); 8965 helper.ensureFlagExists("fullTagEmptyElement", options2); 8966 helper.ensureFlagExists("noQuotesForNativeAttributes", options2); 8967 helper.ensureSpacesExists(options2); 8968 if (typeof options2.spaces === "number") { 8969 options2.spaces = Array(options2.spaces + 1).join(" "); 8970 } 8971 helper.ensureKeyExists("declaration", options2); 8972 helper.ensureKeyExists("instruction", options2); 8973 helper.ensureKeyExists("attributes", options2); 8974 helper.ensureKeyExists("text", options2); 8975 helper.ensureKeyExists("comment", options2); 8976 helper.ensureKeyExists("cdata", options2); 8977 helper.ensureKeyExists("doctype", options2); 8978 helper.ensureKeyExists("type", options2); 8979 helper.ensureKeyExists("name", options2); 8980 helper.ensureKeyExists("elements", options2); 8981 helper.checkFnExists("doctype", options2); 8982 helper.checkFnExists("instruction", options2); 8983 helper.checkFnExists("cdata", options2); 8984 helper.checkFnExists("comment", options2); 8985 helper.checkFnExists("text", options2); 8986 helper.checkFnExists("instructionName", options2); 8987 helper.checkFnExists("elementName", options2); 8988 helper.checkFnExists("attributeName", options2); 8989 helper.checkFnExists("attributeValue", options2); 8990 helper.checkFnExists("attributes", options2); 8991 helper.checkFnExists("fullTagEmptyElement", options2); 8992 return options2; 8993 } 8994 function writeIndentation(options2, depth, firstLine) { 8995 return (!firstLine && options2.spaces ? "\n" : "") + Array(depth + 1).join(options2.spaces); 8996 } 8997 function writeAttributes(attributes, options2, depth) { 8998 if (options2.ignoreAttributes) { 8999 return ""; 9000 } 9001 if ("attributesFn" in options2) { 9002 attributes = options2.attributesFn(attributes, currentElementName, currentElement); 9003 } 9004 var key, attr, attrName, quote, result = []; 9005 for (key in attributes) { 9006 if (attributes.hasOwnProperty(key) && attributes[key] !== null && attributes[key] !== void 0) { 9007 quote = options2.noQuotesForNativeAttributes && typeof attributes[key] !== "string" ? "" : '"'; 9008 attr = "" + attributes[key]; 9009 attr = attr.replace(/"/g, """); 9010 attrName = "attributeNameFn" in options2 ? options2.attributeNameFn(key, attr, currentElementName, currentElement) : key; 9011 result.push(options2.spaces && options2.indentAttributes ? writeIndentation(options2, depth + 1, false) : " "); 9012 result.push(attrName + "=" + quote + ("attributeValueFn" in options2 ? options2.attributeValueFn(attr, key, currentElementName, currentElement) : attr) + quote); 9013 } 9014 } 9015 if (attributes && Object.keys(attributes).length && options2.spaces && options2.indentAttributes) { 9016 result.push(writeIndentation(options2, depth, false)); 9017 } 9018 return result.join(""); 9019 } 9020 function writeDeclaration(declaration, options2, depth) { 9021 currentElement = declaration; 9022 currentElementName = "xml"; 9023 return options2.ignoreDeclaration ? "" : "<?xml" + writeAttributes(declaration[options2.attributesKey], options2, depth) + "?>"; 9024 } 9025 function writeInstruction(instruction, options2, depth) { 9026 if (options2.ignoreInstruction) { 9027 return ""; 9028 } 9029 var key; 9030 for (key in instruction) { 9031 if (instruction.hasOwnProperty(key)) { 9032 break; 9033 } 9034 } 9035 var instructionName = "instructionNameFn" in options2 ? options2.instructionNameFn(key, instruction[key], currentElementName, currentElement) : key; 9036 if (typeof instruction[key] === "object") { 9037 currentElement = instruction; 9038 currentElementName = instructionName; 9039 return "<?" + instructionName + writeAttributes(instruction[key][options2.attributesKey], options2, depth) + "?>"; 9040 } else { 9041 var instructionValue = instruction[key] ? instruction[key] : ""; 9042 if ("instructionFn" in options2) 9043 instructionValue = options2.instructionFn(instructionValue, key, currentElementName, currentElement); 9044 return "<?" + instructionName + (instructionValue ? " " + instructionValue : "") + "?>"; 9045 } 9046 } 9047 function writeComment(comment, options2) { 9048 return options2.ignoreComment ? "" : "<!--" + ("commentFn" in options2 ? options2.commentFn(comment, currentElementName, currentElement) : comment) + "-->"; 9049 } 9050 function writeCdata(cdata, options2) { 9051 return options2.ignoreCdata ? "" : "<![CDATA[" + ("cdataFn" in options2 ? options2.cdataFn(cdata, currentElementName, currentElement) : cdata.replace("]]>", "]]]]><![CDATA[>")) + "]]>"; 9052 } 9053 function writeDoctype(doctype, options2) { 9054 return options2.ignoreDoctype ? "" : "<!DOCTYPE " + ("doctypeFn" in options2 ? options2.doctypeFn(doctype, currentElementName, currentElement) : doctype) + ">"; 9055 } 9056 function writeText(text, options2) { 9057 if (options2.ignoreText) 9058 return ""; 9059 text = "" + text; 9060 text = text.replace(/&/g, "&"); 9061 text = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); 9062 return "textFn" in options2 ? options2.textFn(text, currentElementName, currentElement) : text; 9063 } 9064 function hasContent(element2, options2) { 9065 var i; 9066 if (element2.elements && element2.elements.length) { 9067 for (i = 0; i < element2.elements.length; ++i) { 9068 switch (element2.elements[i][options2.typeKey]) { 9069 case "text": 9070 if (options2.indentText) { 9071 return true; 9072 } 9073 break; 9074 case "cdata": 9075 if (options2.indentCdata) { 9076 return true; 9077 } 9078 break; 9079 case "instruction": 9080 if (options2.indentInstruction) { 9081 return true; 9082 } 9083 break; 9084 case "doctype": 9085 case "comment": 9086 case "element": 9087 return true; 9088 default: 9089 return true; 9090 } 9091 } 9092 } 9093 return false; 9094 } 9095 function writeElement(element2, options2, depth) { 9096 currentElement = element2; 9097 currentElementName = element2.name; 9098 var xml2 = [], elementName = "elementNameFn" in options2 ? options2.elementNameFn(element2.name, element2) : element2.name; 9099 xml2.push("<" + elementName); 9100 if (element2[options2.attributesKey]) { 9101 xml2.push(writeAttributes(element2[options2.attributesKey], options2, depth)); 9102 } 9103 var withClosingTag = element2[options2.elementsKey] && element2[options2.elementsKey].length || element2[options2.attributesKey] && element2[options2.attributesKey]["xml:space"] === "preserve"; 9104 if (!withClosingTag) { 9105 if ("fullTagEmptyElementFn" in options2) { 9106 withClosingTag = options2.fullTagEmptyElementFn(element2.name, element2); 9107 } else { 9108 withClosingTag = options2.fullTagEmptyElement; 9109 } 9110 } 9111 if (withClosingTag) { 9112 xml2.push(">"); 9113 if (element2[options2.elementsKey] && element2[options2.elementsKey].length) { 9114 xml2.push(writeElements(element2[options2.elementsKey], options2, depth + 1)); 9115 currentElement = element2; 9116 currentElementName = element2.name; 9117 } 9118 xml2.push(options2.spaces && hasContent(element2, options2) ? "\n" + Array(depth + 1).join(options2.spaces) : ""); 9119 xml2.push("</" + elementName + ">"); 9120 } else { 9121 xml2.push("/>"); 9122 } 9123 return xml2.join(""); 9124 } 9125 function writeElements(elements, options2, depth, firstLine) { 9126 return elements.reduce(function(xml2, element2) { 9127 var indent = writeIndentation(options2, depth, firstLine && !xml2); 9128 switch (element2.type) { 9129 case "element": 9130 return xml2 + indent + writeElement(element2, options2, depth); 9131 case "comment": 9132 return xml2 + indent + writeComment(element2[options2.commentKey], options2); 9133 case "doctype": 9134 return xml2 + indent + writeDoctype(element2[options2.doctypeKey], options2); 9135 case "cdata": 9136 return xml2 + (options2.indentCdata ? indent : "") + writeCdata(element2[options2.cdataKey], options2); 9137 case "text": 9138 return xml2 + (options2.indentText ? indent : "") + writeText(element2[options2.textKey], options2); 9139 case "instruction": 9140 var instruction = {}; 9141 instruction[element2[options2.nameKey]] = element2[options2.attributesKey] ? element2 : element2[options2.instructionKey]; 9142 return xml2 + (options2.indentInstruction ? indent : "") + writeInstruction(instruction, options2, depth); 9143 } 9144 }, ""); 9145 } 9146 function hasContentCompact(element2, options2, anyContent) { 9147 var key; 9148 for (key in element2) { 9149 if (element2.hasOwnProperty(key)) { 9150 switch (key) { 9151 case options2.parentKey: 9152 case options2.attributesKey: 9153 break; 9154 case options2.textKey: 9155 if (options2.indentText || anyContent) { 9156 return true; 9157 } 9158 break; 9159 case options2.cdataKey: 9160 if (options2.indentCdata || anyContent) { 9161 return true; 9162 } 9163 break; 9164 case options2.instructionKey: 9165 if (options2.indentInstruction || anyContent) { 9166 return true; 9167 } 9168 break; 9169 case options2.doctypeKey: 9170 case options2.commentKey: 9171 return true; 9172 default: 9173 return true; 9174 } 9175 } 9176 } 9177 return false; 9178 } 9179 function writeElementCompact(element2, name, options2, depth, indent) { 9180 currentElement = element2; 9181 currentElementName = name; 9182 var elementName = "elementNameFn" in options2 ? options2.elementNameFn(name, element2) : name; 9183 if (typeof element2 === "undefined" || element2 === null || element2 === "") { 9184 return "fullTagEmptyElementFn" in options2 && options2.fullTagEmptyElementFn(name, element2) || options2.fullTagEmptyElement ? "<" + elementName + "></" + elementName + ">" : "<" + elementName + "/>"; 9185 } 9186 var xml2 = []; 9187 if (name) { 9188 xml2.push("<" + elementName); 9189 if (typeof element2 !== "object") { 9190 xml2.push(">" + writeText(element2, options2) + "</" + elementName + ">"); 9191 return xml2.join(""); 9192 } 9193 if (element2[options2.attributesKey]) { 9194 xml2.push(writeAttributes(element2[options2.attributesKey], options2, depth)); 9195 } 9196 var withClosingTag = hasContentCompact(element2, options2, true) || element2[options2.attributesKey] && element2[options2.attributesKey]["xml:space"] === "preserve"; 9197 if (!withClosingTag) { 9198 if ("fullTagEmptyElementFn" in options2) { 9199 withClosingTag = options2.fullTagEmptyElementFn(name, element2); 9200 } else { 9201 withClosingTag = options2.fullTagEmptyElement; 9202 } 9203 } 9204 if (withClosingTag) { 9205 xml2.push(">"); 9206 } else { 9207 xml2.push("/>"); 9208 return xml2.join(""); 9209 } 9210 } 9211 xml2.push(writeElementsCompact(element2, options2, depth + 1, false)); 9212 currentElement = element2; 9213 currentElementName = name; 9214 if (name) { 9215 xml2.push((indent ? writeIndentation(options2, depth, false) : "") + "</" + elementName + ">"); 9216 } 9217 return xml2.join(""); 9218 } 9219 function writeElementsCompact(element2, options2, depth, firstLine) { 9220 var i, key, nodes, xml2 = []; 9221 for (key in element2) { 9222 if (element2.hasOwnProperty(key)) { 9223 nodes = isArray(element2[key]) ? element2[key] : [element2[key]]; 9224 for (i = 0; i < nodes.length; ++i) { 9225 switch (key) { 9226 case options2.declarationKey: 9227 xml2.push(writeDeclaration(nodes[i], options2, depth)); 9228 break; 9229 case options2.instructionKey: 9230 xml2.push((options2.indentInstruction ? writeIndentation(options2, depth, firstLine) : "") + writeInstruction(nodes[i], options2, depth)); 9231 break; 9232 case options2.attributesKey: 9233 case options2.parentKey: 9234 break; 9235 case options2.textKey: 9236 xml2.push((options2.indentText ? writeIndentation(options2, depth, firstLine) : "") + writeText(nodes[i], options2)); 9237 break; 9238 case options2.cdataKey: 9239 xml2.push((options2.indentCdata ? writeIndentation(options2, depth, firstLine) : "") + writeCdata(nodes[i], options2)); 9240 break; 9241 case options2.doctypeKey: 9242 xml2.push(writeIndentation(options2, depth, firstLine) + writeDoctype(nodes[i], options2)); 9243 break; 9244 case options2.commentKey: 9245 xml2.push(writeIndentation(options2, depth, firstLine) + writeComment(nodes[i], options2)); 9246 break; 9247 default: 9248 xml2.push(writeIndentation(options2, depth, firstLine) + writeElementCompact(nodes[i], key, options2, depth, hasContentCompact(nodes[i], options2))); 9249 } 9250 firstLine = firstLine && !xml2.length; 9251 } 9252 } 9253 } 9254 return xml2.join(""); 9255 } 9256 var js2xml$2 = function(js, options2) { 9257 options2 = validateOptions(options2); 9258 var xml2 = []; 9259 currentElement = js; 9260 currentElementName = "_root_"; 9261 if (options2.compact) { 9262 xml2.push(writeElementsCompact(js, options2, 0, true)); 9263 } else { 9264 if (js[options2.declarationKey]) { 9265 xml2.push(writeDeclaration(js[options2.declarationKey], options2, 0)); 9266 } 9267 if (js[options2.elementsKey] && js[options2.elementsKey].length) { 9268 xml2.push(writeElements(js[options2.elementsKey], options2, 0, !xml2.length)); 9269 } 9270 } 9271 return xml2.join(""); 9272 }; 9273 var js2xml$1 = js2xml$2; 9274 var json2xml$1 = function(json, options2) { 9275 if (json instanceof Buffer) { 9276 json = json.toString(); 9277 } 9278 var js = null; 9279 if (typeof json === "string") {
9280 try { 9281 js = JSON.parse(json); 9282 } catch (e) { 9283 throw new Error("The JSON structure is invalid"); 9284 } 9285 } else { 9286 js = json; 9287 } 9288 return js2xml$1(js, options2); 9289 }; 9290 var xml2js = xml2js$2; 9291 var xml2json = xml2json$1; 9292 var js2xml = js2xml$2; 9293 var json2xml = json2xml$1; 9294 var lib = { 9295 xml2js, 9296 xml2json, 9297 js2xml, 9298 json2xml 9299 }; 9300 const convertToXmlComponent = (element2) => { 9301 switch (element2.type) { 9302 case void 0: 9303 case "element": 9304 const xmlComponent = new ImportedXmlComponent(element2.name, element2.attributes); 9305 const childElements = element2.elements || []; 9306 for (const childElm of childElements) { 9307 const child = convertToXmlComponent(childElm); 9308 if (child !== void 0) { 9309 xmlComponent.push(child); 9310 } 9311 } 9312 return xmlComponent; 9313 case "text": 9314 return element2.text; 9315 default: 9316 return void 0; 9317 } 9318 }; 9319 class ImportedXmlComponentAttributes extends XmlAttributeComponent { 9320 // noop 9321 } 9322 class ImportedXmlComponent extends XmlComponent { 9323 /** 9324 * Converts the xml string to a XmlComponent tree. 9325 * 9326 * @param importedContent xml content of the imported component 9327 */ 9328 static fromXmlString(importedContent) { 9329 const xmlObj = lib.xml2js(importedContent, { compact: false }); 9330 return convertToXmlComponent(xmlObj); 9331 } 9332 /** 9333 * Converts the xml string to a XmlComponent tree. 9334 * 9335 * @param importedContent xml content of the imported component 9336 */ 9337 // eslint-disable-next-line @typescript-eslint/no-explicit-any 9338 constructor(rootKey, _attr) { 9339 super(rootKey); 9340 if (_attr) { 9341 this.root.push(new ImportedXmlComponentAttributes(_attr)); 9342 } 9343 } 9344 push(xmlComponent) { 9345 this.root.push(xmlComponent); 9346 } 9347 } 9348 class ImportedRootElementAttributes extends XmlComponent { 9349 // eslint-disable-next-line @typescript-eslint/no-explicit-any 9350 constructor(_attr) { 9351 super(""); 9352 this._attr = _attr; 9353 } 9354 prepForXml(_) { 9355 return { 9356 _attr: this._attr 9357 }; 9358 } 9359 } 9360 const WORKAROUND3 = ""; 9361 class InitializableXmlComponent extends XmlComponent { 9362 constructor(rootKey, initComponent) { 9363 super(rootKey); 9364 if (initComponent) { 9365 this.root = initComponent.root; 9366 } 9367 } 9368 } 9369 const decimalNumber = (val) => { 9370 if (isNaN(val)) { 9371 throw new Error(`Invalid value '${val}' specified. Must be an integer.`); 9372 } 9373 return Math.floor(val); 9374 }; 9375 const unsignedDecimalNumber = (val) => { 9376 const value = decimalNumber(val); 9377 if (value < 0) { 9378 throw new Error(`Invalid value '${val}' specified. Must be a positive integer.`); 9379 } 9380 return value; 9381 }; 9382 const hexBinary = (val, length) => { 9383 const expectedLength = length * 2; 9384 if (val.length !== expectedLength || isNaN(Number(`0x${val}`))) { 9385 throw new Error(`Invalid hex value '${val}'. Expected ${expectedLength} digit hex value`); 9386 } 9387 return val; 9388 }; 9389 const longHexNumber = (val) => hexBinary(val, 4); 9390 const shortHexNumber = (val) => hexBinary(val, 2); 9391 const uCharHexNumber = (val) => hexBinary(val, 1); 9392 const universalMeasureValue = (val) => { 9393 const unit = val.slice(-2); 9394 const amount = val.substring(0, val.length - 2); 9395 return `${Number(amount)}${unit}`; 9396 }; 9397 const positiveUniversalMeasureValue = (val) => { 9398 const value = universalMeasureValue(val); 9399 if (parseFloat(value) < 0) { 9400 throw new Error(`Invalid value '${value}' specified. Expected a positive number.`); 9401 } 9402 return value; 9403 }; 9404 const hexColorValue = (val) => { 9405 if (val === "auto") { 9406 return val; 9407 } 9408 const color = val.charAt(0) === "#" ? val.substring(1) : val; 9409 return hexBinary(color, 3); 9410 }; 9411 const signedTwipsMeasureValue = (val) => typeof val === "string" ? universalMeasureValue(val) : decimalNumber(val); 9412 const hpsMeasureValue = (val) => typeof val === "string" ? positiveUniversalMeasureValue(val) : unsignedDecimalNumber(val); 9413 const signedHpsMeasureValue = (val) =>
9413 typeof val === "string" ? universalMeasureValue(val) : decimalNumber(val); 9414 const twipsMeasureValue = (val) => typeof val === "string" ? positiveUniversalMeasureValue(val) : unsignedDecimalNumber(val); 9415 const percentageValue = (val) => { 9416 const percent = val.substring(0, val.length - 1); 9417 return `${Number(percent)}%`; 9418 }; 9419 const measurementOrPercentValue = (val) => { 9420 if (typeof val === "number") { 9421 return decimalNumber(val); 9422 } 9423 if (val.slice(-1) === "%") { 9424 return percentageValue(val); 9425 } 9426 return universalMeasureValue(val); 9427 }; 9428 const eighthPointMeasureValue = unsignedDecimalNumber; 9429 const pointMeasureValue = unsignedDecimalNumber; 9430 const dateTimeValue = (val) => val.toISOString(); 9431 class OnOffElement extends XmlComponent { 9432 constructor(name, val = true) { 9433 super(name); 9434 if (val !== true) { 9435 this.root.push(new Attributes({ val })); 9436 } 9437 } 9438 } 9439 class HpsMeasureElement extends XmlComponent { 9440 constructor(name, val) { 9441 super(name); 9442 this.root.push(new Attributes({ val: hpsMeasureValue(val) })); 9443 } 9444 } 9445 class EmptyElement extends XmlComponent { 9446 } 9447 class StringValueElement extends XmlComponent { 9448 constructor(name, val) { 9449 super(name); 9450 this.root.push(new Attributes({ val })); 9451 } 9452 } 9453 const createStringElement = (name, value) => new BuilderElement({ 9454 name, 9455 attributes: { 9456 value: { key: "w:val", value } 9457 } 9458 }); 9459 class NumberValueElement extends XmlComponent { 9460 constructor(name, val) { 9461 super(name); 9462 this.root.push(new Attributes({ val })); 9463 } 9464 } 9465 class StringEnumValueElement extends XmlComponent { 9466 constructor(name, val) { 9467 super(name); 9468 this.root.push(new Attributes({ val })); 9469 } 9470 } 9471 class StringContainer extends XmlComponent { 9472 constructor(name, val) { 9473 super(name); 9474 this.root.push(val); 9475 } 9476 } 9477 class BuilderElement extends XmlComponent { 9478 constructor({ 9479 name, 9480 attributes, 9481 children 9482 }) { 9483 super(name); 9484 if (attributes) { 9485 this.root.push(new NextAttributeComponent(attributes)); 9486 } 9487 if (children) { 9488 this.root.push(...children); 9489 } 9490 } 9491 } 9492 const AlignmentType = { 9493 /** Align Start */ 9494 START: "start", 9495 /** Align Center */ 9496 CENTER: "center", 9497 /** End */ 9498 END: "end", 9499 /** Justified */ 9500 BOTH: "both", 9501 /** Medium Kashida Length */ 9502 MEDIUM_KASHIDA: "mediumKashida", 9503 /** Distribute All Characters Equally */ 9504 DISTRIBUTE: "distribute", 9505 /** Align to List Tab */ 9506 NUM_TAB: "numTab", 9507 /** Widest Kashida Length */ 9508 HIGH_KASHIDA: "highKashida", 9509 /** Low Kashida Length */ 9510 LOW_KASHIDA: "lowKashida", 9511 /** Thai Language Justification */ 9512 THAI_DISTRIBUTE: "thaiDistribute", 9513 /** Align Left */ 9514 LEFT: "left", 9515 /** Align Right */ 9516 RIGHT: "right", 9517 /** Justified */ 9518 JUSTIFIED: "both" 9519 }; 9520 class AlignmentAttributes extends XmlAttributeComponent { 9521 constructor() { 9522 super(...arguments); 9523 __publicField(this, "xmlKeys", { val: "w:val" }); 9524 } 9525 } 9526 class Alignment extends XmlComponent { 9527 constructor(type) { 9528 super("w:jc"); 9529 this.root.push(new AlignmentAttributes({ val: type })); 9530 } 9531 } 9532 class BorderElement extends XmlComponent { 9533 constructor(elementName, { color, size, space, style }) { 9534 super(elementName); 9535 this.root.push( 9536 new BordersAttributes({ 9537 style, 9538 color: color === void 0 ? void 0 : hexColorValue(color), 9539 size: size === void 0 ? void 0 : eighthPointMeasureValue(size), 9540 space: space === void 0 ? void 0 : pointMeasureValue(space) 9541 }) 9542 ); 9543 } 9544 } 9545 class BordersAttributes extends XmlAttributeComponent { 9546 constructor() { 9547 super(...arguments); 9548 __publicField(this, "xmlKeys", { 9549 style: "w:val", 9550 color: "w:color", 9551 size: "w:sz", 9552 space: "w:space" 9553 }); 9554 } 9555 } 9556 const BorderStyle = { 9557 SINGLE: "single", 9558 DASH_DOT_STROKED: "dashDotStroked", 9559 DASHED: "dashed", 9560 DASH_SMALL_GAP: "dashSmallGap", 9561 DOT_DASH: "dotDash", 9562 DOT_DOT_DASH: "dotDotDash", 9563 DOTTED: "dotted", 9564 DOUBLE: "double", 9565 DOUBLE_WAVE: "doubleWave", 9566 INSET: "inset", 9567 NIL: "nil", 9568 NONE: "none", 9569 OUTSET: "outset", 9570 THICK: "thick", 9571 THICK_THIN_LARGE_GAP: "thickThinLargeGap", 9572 THICK_THIN_MEDIUM_GAP: "thickThinMediumGap", 9573 THICK_THIN_SMALL_GAP: "thickThinSmallGap", 9574 THIN_THICK_LARGE_GAP: "thinThickLargeGap", 9575 THIN_THICK_MEDIUM_GAP: "thinThickMediumGap", 9576 THIN_THICK_SMALL_GAP: "thinThickSmallGap", 9577 THIN_THICK_THIN_LARGE_GAP: "thinThickThinLargeGap", 9578 THIN_THICK_THIN_MEDIUM_GAP: "thinThickThinMediumGap", 9579 THIN_THICK_THIN_SMALL_GAP: "thinThickThinSmallGap", 9580 THREE_D_EMBOSS: "threeDEmboss", 9581 THREE_D_ENGRAVE: "threeDEngrave", 9582 TRIPLE: "triple", 9583 WAVE: "wave" 9584 }; 9585 class Border extends IgnoreIfEmptyXmlComponent { 9586 constructor(options2) { 9587 super("w:pBdr"); 9588 if (options2.top) { 9589 this.root.push(new BorderElement("w:top", options2.top)); 9590 } 9591 if (options2.bottom) { 9592 this.root.push(new BorderElement("w:bottom", options2.bottom)); 9593 } 9594 if (options2.left) { 9595 this.root.push(new BorderElement("w:left", options2.left)); 9596 } 9597 if (options2.right) { 9598 this.root.push(new BorderElement("w:right", options2.right)); 9599 } 9600 } 9601 } 9602 class ThematicBreak extends XmlComponent { 9603 constructor() { 9604 super("w:pBdr"); 9605 const bottom = new BorderElement("w:bottom", { 9606 color: "auto", 9607 space: 1, 9608 style: BorderStyle.SINGLE, 9609 size: 6 9610 }); 9611 this.root.push(bottom); 9612 } 9613 } 9614 class Indent extends XmlComponent { 9615 constructor({ start, end, left, right, hanging, firstLine }) { 9616 super("w:ind"); 9617 this.root.push( 9618 new NextAttributeComponent({ 9619 start: { 9620 key: "w:start", 9621 value: start === void 0 ? void 0 : signedTwipsMeasureValue(start) 9622 }, 9623 end: { 9624 key: "w:end", 9625 value: end === void 0 ? void 0 : signedTwipsMeasureValue(end) 9626 }, 9627 left: { 9628 key: "w:left", 9629 value: left === void 0 ? void 0 : signedTwipsMeasureValue(left) 9630 }, 9631 right: { 9632 key: "w:right", 9633 value: right === void 0 ? void 0 : signedTwipsMeasureValue(right) 9634 }, 9635 hanging: { 9636 key: "w:hanging", 9637 value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging) 9638 }, 9639 firstLine: { 9640 key: "w:firstLine", 9641 value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine) 9642 } 9643 }) 9644 ); 9645 } 9646 } 9647 let Break$1 = class Break extends XmlComponent { 9648 constructor() { 9649 super("w:br"); 9650 } 9651 }; 9652 const FieldCharacterType = { 9653 BEGIN: "begin", 9654 END: "end", 9655 SEPARATE: "separate" 9656 }; 9657 class FidCharAttrs extends XmlAttributeComponent { 9658 constructor() { 9659 super(...arguments); 9660 __publicField(this, "xmlKeys", { type: "w:fldCharType", dirty: "w:dirty" }); 9661 } 9662 } 9663 class Begin extends XmlComponent { 9664 constructor(dirty) { 9665 super("w:fldChar");
9666 this.root.push(new FidCharAttrs({ type: FieldCharacterType.BEGIN, dirty })); 9667 } 9668 } 9669 class Separate extends XmlComponent { 9670 constructor(dirty) { 9671 super("w:fldChar"); 9672 this.root.push(new FidCharAttrs({ type: FieldCharacterType.SEPARATE, dirty })); 9673 } 9674 } 9675 class End extends XmlComponent { 9676 constructor(dirty) { 9677 super("w:fldChar"); 9678 this.root.push(new FidCharAttrs({ type: FieldCharacterType.END, dirty })); 9679 } 9680 } 9681 const HorizontalPositionAlign = { 9682 CENTER: "center", 9683 INSIDE: "inside", 9684 LEFT: "left", 9685 OUTSIDE: "outside", 9686 RIGHT: "right" 9687 }; 9688 const VerticalPositionAlign = { 9689 BOTTOM: "bottom", 9690 CENTER: "center", 9691 INSIDE: "inside", 9692 OUTSIDE: "outside", 9693 TOP: "top" 9694 }; 9695 const NumberFormat$1 = { 9696 DECIMAL: "decimal", 9697 UPPER_ROMAN: "upperRoman", 9698 LOWER_ROMAN: "lowerRoman", 9699 UPPER_LETTER: "upperLetter", 9700 LOWER_LETTER: "lowerLetter", 9701 ORDINAL: "ordinal", 9702 CARDINAL_TEXT: "cardinalText", 9703 ORDINAL_TEXT: "ordinalText", 9704 HEX: "hex", 9705 CHICAGO: "chicago", 9706 IDEOGRAPH_DIGITAL: "ideographDigital", 9707 JAPANESE_COUNTING: "japaneseCounting", 9708 AIUEO: "aiueo", 9709 IROHA: "iroha", 9710 DECIMAL_FULL_WIDTH: "decimalFullWidth", 9711 DECIMAL_HALF_WIDTH: "decimalHalfWidth", 9712 JAPANESE_LEGAL: "japaneseLegal", 9713 JAPANESE_DIGITAL_TEN_THOUSAND: "japaneseDigitalTenThousand", 9714 DECIMAL_ENCLOSED_CIRCLE: "decimalEnclosedCircle", 9715 DECIMAL_FULL_WIDTH_2: "decimalFullWidth2", 9716 AIUEO_FULL_WIDTH: "aiueoFullWidth", 9717 IROHA_FULL_WIDTH: "irohaFullWidth", 9718 DECIMAL_ZERO: "decimalZero", 9719 BULLET: "bullet", 9720 GANADA: "ganada", 9721 CHOSUNG: "chosung", 9722 DECIMAL_ENCLOSED_FULL_STOP: "decimalEnclosedFullstop", 9723 DECIMAL_ENCLOSED_PAREN: "decimalEnclosedParen", 9724 DECIMAL_ENCLOSED_CIRCLE_CHINESE: "decimalEnclosedCircleChinese", 9725 IDEOGRAPH_ENCLOSED_CIRCLE: "ideographEnclosedCircle", 9726 IDEOGRAPH_TRADITIONAL: "ideographTraditional", 9727 IDEOGRAPH_ZODIAC: "ideographZodiac", 9728 IDEOGRAPH_ZODIAC_TRADITIONAL: "ideographZodiacTraditional", 9729 TAIWANESE_COUNTING: "taiwaneseCounting", 9730 IDEOGRAPH_LEGAL_TRADITIONAL: "ideographLegalTraditional", 9731 TAIWANESE_COUNTING_THOUSAND: "taiwaneseCountingThousand", 9732 TAIWANESE_DIGITAL: "taiwaneseDigital", 9733 CHINESE_COUNTING: "chineseCounting", 9734 CHINESE_LEGAL_SIMPLIFIED: "chineseLegalSimplified", 9735 CHINESE_COUNTING_TEN_THOUSAND: "chineseCountingThousand", 9736 KOREAN_DIGITAL: "koreanDigital", 9737 KOREAN_COUNTING: "koreanCounting", 9738 KOREAN_LEGAL: "koreanLegal", 9739 KOREAN_DIGITAL_2: "koreanDigital2", 9740 VIETNAMESE_COUNTING: "vietnameseCounting", 9741 RUSSIAN_LOWER: "russianLower", 9742 RUSSIAN_UPPER: "russianUpper", 9743 NONE: "none", 9744 NUMBER_IN_DASH: "numberInDash", 9745 HEBREW_1: "hebrew1", 9746 HEBREW_2: "hebrew2", 9747 ARABIC_ALPHA: "arabicAlpha", 9748 ARABIC_ABJAD: "arabicAbjad", 9749 HINDI_VOWELS: "hindiVowels", 9750 HINDI_CONSONANTS: "hindiConsonants", 9751 HINDI_NUMBERS: "hindiNumbers", 9752 HINDI_COUNTING: "hindiCounting", 9753 THAI_LETTERS: "thaiLetters", 9754 THAI_NUMBERS: "thaiNumbers", 9755 THAI_COUNTING: "thaiCounting", 9756 BAHT_TEXT: "bahtText", 9757 DOLLAR_TEXT: "dollarText" 9758 // <xsd:enumeration value="custom"/> 9759 }; 9760 const SpaceType = { 9761 DEFAULT: "default", 9762 PRESERVE: "preserve" 9763 }; 9764 class TextAttributes extends XmlAttributeComponent { 9765 constructor() { 9766 super(...arguments); 9767 __publicField(this, "xmlKeys", { space: "xml:space" }); 9768 } 9769 } 9770 class Page extends XmlComponent { 9771 constructor() { 9772 super("w:instrText"); 9773 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 9774 this.root.push("PAGE"); 9775 } 9776 } 9777 class NumberOfPages extends XmlComponent { 9778 constructor() { 9779 super("w:instrText"); 9780 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 9781 this.root.push("NUMPAGES"); 9782 } 9783 } 9784 class NumberOfPagesSection extends XmlComponent { 9785 constructor() { 9786 super("w:instrText"); 9787 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 9788 this.root.push("SECTIONPAGES"); 9789 } 9790 } 9791 class CurrentSection extends XmlComponent { 9792 constructor() { 9793 super("w:instrText"); 9794 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 9795 this.root.push("SECTION"); 9796 } 9797 } 9798 class ShadingAttributes extends XmlAttributeComponent { 9799 constructor() { 9800 super(...arguments); 9801 __publicField(this, "xmlKeys", { 9802 fill: "w:fill", 9803 color: "w:color", 9804 type: "w:val" 9805 }); 9806 } 9807 } 9808 class Shading extends XmlComponent { 9809 constructor({ fill, color, type }) { 9810 super("w:shd"); 9811 this.root.push( 9812 new ShadingAttributes({ 9813 fill: fill === void 0 ? void 0 : hexColorValue(fill), 9814 color: color === void 0 ? void 0 : hexColorValue(color), 9815 type 9816 }) 9817 ); 9818 } 9819 } 9820 const ShadingType = { 9821 CLEAR: "clear", 9822 DIAGONAL_CROSS: "diagCross", 9823 DIAGONAL_STRIPE: "diagStripe", 9824 HORIZONTAL_CROSS: "horzCross", 9825 HORIZONTAL_STRIPE: "horzStripe", 9826 NIL: "nil", 9827 PERCENT_5: "pct5", 9828 PERCENT_10: "pct10", 9829 PERCENT_12: "pct12", 9830 PERCENT_15: "pct15", 9831 PERCENT_20: "pct20", 9832 PERCENT_25: "pct25", 9833 PERCENT_30: "pct30", 9834 PERCENT_35: "pct35", 9835 PERCENT_37: "pct37", 9836 PERCENT_40: "pct40", 9837 PERCENT_45: "pct45", 9838 PERCENT_50: "pct50", 9839 PERCENT_55: "pct55", 9840 PERCENT_60: "pct60", 9841 PERCENT_62: "pct62", 9842 PERCENT_65: "pct65", 9843 PERCENT_70: "pct70", 9844 PERCENT_75: "pct75", 9845 PERCENT_80: "pct80", 9846 PERCENT_85: "pct85", 9847 PERCENT_87: "pct87", 9848 PERCENT_90: "pct90", 9849 PERCENT_95: "pct95", 9850 REVERSE_DIAGONAL_STRIPE: "reverseDiagStripe", 9851 SOLID: "solid", 9852 THIN_DIAGONAL_CROSS: "thinDiagCross", 9853 THIN_DIAGONAL_STRIPE: "thinDiagStripe", 9854 THIN_HORIZONTAL_CROSS: "thinHorzCross", 9855 THIN_REVERSE_DIAGONAL_STRIPE: "thinReverseDiagStripe", 9856 THIN_VERTICAL_STRIPE: "thinVertStripe", 9857 VERTICAL_STRIPE: "vertStripe" 9858 }; 9859 class ChangeAttributes extends XmlAttributeComponent { 9860 constructor() { 9861 super(...arguments); 9862 __publicField(this, "xmlKeys", { 9863 id: "w:id", 9864 author: "w:author", 9865 date: "w:date" 9866 }); 9867 } 9868 } 9869 const EmphasisMarkType = { 9870 DOT: "dot" 9871 }; 9872 class BaseEmphasisMark extends XmlComponent { 9873 constructor(emphasisMarkType) { 9874 super("w:em"); 9875 this.root.push( 9876 new Attributes({
9877 val: emphasisMarkType 9878 }) 9879 ); 9880 } 9881 } 9882 class EmphasisMark extends BaseEmphasisMark { 9883 constructor(emphasisMarkType = EmphasisMarkType.DOT) { 9884 super(emphasisMarkType); 9885 } 9886 } 9887 class DotEmphasisMark extends BaseEmphasisMark { 9888 constructor() { 9889 super(EmphasisMarkType.DOT); 9890 } 9891 } 9892 class CharacterSpacing extends XmlComponent { 9893 constructor(value) { 9894 super("w:spacing"); 9895 this.root.push( 9896 new Attributes({ 9897 val: signedTwipsMeasureValue(value) 9898 }) 9899 ); 9900 } 9901 } 9902 class Color extends XmlComponent { 9903 constructor(color) { 9904 super("w:color"); 9905 this.root.push( 9906 new Attributes({ 9907 val: hexColorValue(color) 9908 }) 9909 ); 9910 } 9911 } 9912 class Highlight extends XmlComponent { 9913 constructor(color) { 9914 super("w:highlight"); 9915 this.root.push( 9916 new Attributes({ 9917 val: color 9918 }) 9919 ); 9920 } 9921 } 9922 class HighlightComplexScript extends XmlComponent { 9923 constructor(color) { 9924 super("w:highlightCs"); 9925 this.root.push( 9926 new Attributes({ 9927 val: color 9928 }) 9929 ); 9930 } 9931 } 9932 const createLanguageComponent = (options2) => new BuilderElement({ 9933 name: "w:lang", 9934 attributes: { 9935 value: { 9936 key: "w:val", 9937 value: options2.value 9938 }, 9939 eastAsia: { 9940 key: "w:eastAsia", 9941 value: options2.eastAsia 9942 }, 9943 bidirectional: { 9944 key: "w:bidi", 9945 value: options2.bidirectional 9946 } 9947 } 9948 }); 9949 class RunFontAttributes extends XmlAttributeComponent { 9950 constructor() { 9951 super(...arguments); 9952 __publicField(this, "xmlKeys", { 9953 ascii: "w:ascii", 9954 cs: "w:cs", 9955 eastAsia: "w:eastAsia", 9956 hAnsi: "w:hAnsi", 9957 hint: "w:hint" 9958 }); 9959 } 9960 } 9961 class RunFonts extends XmlComponent { 9962 constructor(nameOrAttrs, hint) { 9963 super("w:rFonts"); 9964 if (typeof nameOrAttrs === "string") { 9965 const name = nameOrAttrs; 9966 this.root.push( 9967 new RunFontAttributes({ 9968 ascii: name, 9969 cs: name, 9970 eastAsia: name, 9971 hAnsi: name, 9972 hint 9973 }) 9974 ); 9975 } else {
9976 const attrs = nameOrAttrs; 9977 this.root.push(new RunFontAttributes(attrs)); 9978 } 9979 } 9980 } 9981 let VerticalAlign$1 = class VerticalAlign extends XmlComponent { 9982 constructor(type) { 9983 super("w:vertAlign"); 9984 this.root.push( 9985 new Attributes({ 9986 val: type 9987 }) 9988 ); 9989 } 9990 }; 9991 class SuperScript extends VerticalAlign$1 { 9992 constructor() { 9993 super("superscript"); 9994 } 9995 } 9996 class SubScript extends VerticalAlign$1 { 9997 constructor() { 9998 super("subscript"); 9999 } 10000 } 10001 const UnderlineType = { 10002 SINGLE: "single", 10003 WORDS: "words", 10004 DOUBLE: "double", 10005 THICK: "thick", 10006 DOTTED: "dotted", 10007 DOTTEDHEAVY: "dottedHeavy", 10008 DASH: "dash", 10009 DASHEDHEAVY: "dashedHeavy", 10010 DASHLONG: "dashLong", 10011 DASHLONGHEAVY: "dashLongHeavy", 10012 DOTDASH: "dotDash", 10013 DASHDOTHEAVY: "dashDotHeavy", 10014 DOTDOTDASH: "dotDotDash", 10015 DASHDOTDOTHEAVY: "dashDotDotHeavy", 10016 WAVE: "wave", 10017 WAVYHEAVY: "wavyHeavy", 10018 WAVYDOUBLE: "wavyDouble", 10019 NONE: "none" 10020 }; 10021 class Underline extends XmlComponent { 10022 constructor(underlineType = UnderlineType.SINGLE, color) { 10023 super("w:u"); 10024 this.root.push( 10025 new Attributes({ 10026 val: underlineType, 10027 color: color === void 0 ? void 0 : hexColorValue(color) 10028 }) 10029 ); 10030 } 10031 } 10032 const TextEffect = { 10033 BLINK_BACKGROUND: "blinkBackground", 10034 LIGHTS: "lights", 10035 ANTS_BLACK: "antsBlack", 10036 ANTS_RED: "antsRed", 10037 SHIMMER: "shimmer", 10038 SPARKLE: "sparkle", 10039 NONE: "none" 10040 }; 10041 class RunProperties extends IgnoreIfEmptyXmlComponent { 10042 constructor(options2) { 10043 var _a, _b; 10044 super("w:rPr"); 10045 if (!options2) { 10046 return; 10047 } 10048 if (options2.noProof !== void 0) { 10049 this.push(new OnOffElement("w:noProof", options2.noProof)); 10050 } 10051 if (options2.bold !== void 0) { 10052 this.push(new OnOffElement("w:b", options2.bold)); 10053 } 10054 if (options2.boldComplexScript === void 0 && options2.bold !== void 0 || options2.boldComplexScript) { 10055 this.push(new OnOffElement("w:bCs", (_a = options2.boldComplexScript) != null ? _a : options2.bold)); 10056 } 10057 if (options2.italics !== void 0) { 10058 this.push(new OnOffElement("w:i", options2.italics)); 10059 } 10060 if (options2.italicsComplexScript === void 0 && options2.italics !== void 0 || options2.italicsComplexScript) { 10061 this.push(new OnOffElement("w:iCs", (_b = options2.italicsComplexScript) != null ? _b : options2.italics)); 10062 } 10063 if (options2.underline) { 10064 this.push(new Underline(options2.underline.type, options2.underline.color)); 10065 } 10066 if (options2.effect) { 10067 this.push(new StringValueElement("w:effect", options2.effect)); 10068 } 10069 if (options2.emphasisMark) { 10070 this.push(new EmphasisMark(options2.emphasisMark.type)); 10071 } 10072 if (options2.color) { 10073 this.push(new Color(options2.color)); 10074 } 10075 if (options2.kern) { 10076 this.push(new HpsMeasureElement("w:kern", options2.kern)); 10077 } 10078 if (options2.position) { 10079 this.push(new StringValueElement("w:position", options2.position)); 10080 } 10081 if (options2.size !== void 0) { 10082 this.push(new HpsMeasureElement("w:sz", options2.size)); 10083 } 10084 const szCs = options2.sizeComplexScript === void 0 || options2.sizeComplexScript === true ? options2.size : options2.sizeComplexScript; 10085 if (szCs) { 10086 this.push(new HpsMeasureElement("w:szCs", szCs)); 10087 } 10088 if (options2.rightToLeft !== void 0) { 10089 this.push(new OnOffElement("w:rtl", options2.rightToLeft)); 10090 } 10091 if (options2.smallCaps !== void 0) { 10092 this.push(new OnOffElement("w:smallCaps", options2.smallCaps)); 10093 } else if (options2.allCaps !== void 0) { 10094 this.push(new OnOffElement("w:caps", options2.allCaps)); 10095 } 10096 if (options2.strike !== void 0) { 10097 this.push(new OnOffElement("w:strike", options2.strike)); 10098 } 10099 if (options2.doubleStrike !== void 0) { 10100 this.push(new OnOffElement("w:dstrike", options2.doubleStrike)); 10101 } 10102 if (options2.subScript) { 10103 this.push(new SubScript()); 10104 } 10105 if (options2.superScript) { 10106 this.push(new SuperScript()); 10107 } 10108 if (options2.style) { 10109 this.push(new StringValueElement("w:rStyle", options2.style)); 10110 } 10111 if (options2.font) { 10112 if (typeof options2.font === "string") { 10113 this.push(new RunFonts(options2.font)); 10114 } else if ("name" in options2.font) { 10115 this.push(new RunFonts(options2.font.name, options2.font.hint)); 10116 } else { 10117 this.push(new RunFonts(options2.font)); 10118 } 10119 } 10120 if (options2.highlight) { 10121 this.push(new Highlight(options2.highlight)); 10122 } 10123 const highlightCs = options2.highlightComplexScript === void 0 || options2.highlightComplexScript === true ? options2.highlight : options2.highlightComplexScript; 10124 if (highlightCs) { 10125 this.push(new HighlightComplexScript(highlightCs)); 10126 } 10127 if (options2.characterSpacing) { 10128 this.push(new CharacterSpacing(options2.characterSpacing)); 10129 } 10130 if (options2.emboss !== void 0) { 10131 this.push(new OnOffElement("w:emboss", options2.emboss)); 10132 } 10133 if (options2.imprint !== void 0) { 10134 this.push(new OnOffElement("w:imprint", options2.imprint)); 10135 } 10136 if (options2.shading) { 10137 this.push(new Shading(options2.shading)); 10138 } 10139 if (options2.revision) { 10140 this.push(new RunPropertiesChange(options2.revision)); 10141 } 10142 if (options2.border) { 10143 this.push(new BorderElement("w:bdr", options2.border)); 10144 }
10145 if (options2.snapToGrid !== void 0) { 10146 this.push(new OnOffElement("w:snapToGrid", options2.snapToGrid)); 10147 } 10148 if (options2.vanish) { 10149 this.push(new OnOffElement("w:vanish", options2.vanish)); 10150 } 10151 if (options2.specVanish) { 10152 this.push(new OnOffElement("w:specVanish", options2.vanish)); 10153 } 10154 if (options2.scale !== void 0) { 10155 this.push(new NumberValueElement("w:w", options2.scale)); 10156 } 10157 if (options2.language) { 10158 this.push(createLanguageComponent(options2.language)); 10159 } 10160 if (options2.math) { 10161 this.push(new OnOffElement("w:oMath", options2.math)); 10162 } 10163 } 10164 push(item) { 10165 this.root.push(item); 10166 } 10167 } 10168 class RunPropertiesChange extends XmlComponent { 10169 constructor(options2) { 10170 super("w:rPrChange"); 10171 this.root.push( 10172 new ChangeAttributes({ 10173 id: options2.id, 10174 author: options2.author, 10175 date: options2.date 10176 }) 10177 ); 10178 this.addChildElement(new RunProperties(options2)); 10179 } 10180 } 10181 class Text extends XmlComponent { 10182 constructor(options2) { 10183 var _a; 10184 super("w:t"); 10185 if (typeof options2 === "string") { 10186 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 10187 this.root.push(options2); 10188 return this; 10189 } else { 10190 this.root.push(new TextAttributes({ space: (_a = options2.space) != null ? _a : SpaceType.DEFAULT })); 10191 this.root.push(options2.text); 10192 return this; 10193 } 10194 } 10195 } 10196 const PageNumber = { 10197 CURRENT: "CURRENT", 10198 TOTAL_PAGES: "TOTAL_PAGES", 10199 TOTAL_PAGES_IN_SECTION: "TOTAL_PAGES_IN_SECTION", 10200 CURRENT_SECTION: "SECTION" 10201 }; 10202 class Run extends XmlComponent { 10203 constructor(options2) { 10204 super("w:r"); 10205 __publicField(this, "properties"); 10206 this.properties = new RunProperties(options2); 10207 this.root.push(this.properties); 10208 if (options2.break) { 10209 for (let i = 0; i < options2.break; i++) { 10210 this.root.push(new Break$1()); 10211 } 10212 } 10213 if (options2.children) { 10214 for (const child of options2.children) { 10215 if (typeof child === "string") { 10216 switch (child) { 10217 case PageNumber.CURRENT: 10218 this.root.push(new Begin()); 10219 this.root.push(new Page()); 10220 this.root.push(new Separate()); 10221 this.root.push(new End()); 10222 break; 10223 case PageNumber.TOTAL_PAGES: 10224 this.root.push(new Begin()); 10225 this.root.push(new NumberOfPages()); 10226 this.root.push(new Separate()); 10227 this.root.push(new End()); 10228 break; 10229 case PageNumber.TOTAL_PAGES_IN_SECTION: 10230 this.root.push(new Begin()); 10231 this.root.push(new NumberOfPagesSection()); 10232 this.root.push(new Separate()); 10233 this.root.push(new End()); 10234 break; 10235 case PageNumber.CURRENT_SECTION: 10236 this.root.push(new Begin()); 10237 this.root.push(new CurrentSection()); 10238 this.root.push(new Separate()); 10239 this.root.push(new End()); 10240 break; 10241 default: 10242 this.root.push(new Text(child)); 10243 break; 10244 } 10245 continue; 10246 } 10247 this.root.push(child); 10248 } 10249 } else if (options2.text) { 10250 this.root.push(new Text(options2.text)); 10251 } 10252 } 10253 } 10254 class TextRun extends Run { 10255 constructor(options2) { 10256 if (typeof options2 === "string") { 10257 super({}); 10258 this.root.push(new Text(options2)); 10259 return this; 10260 } 10261 super(options2); 10262 } 10263 } 10264 class SymbolAttributes extends XmlAttributeComponent { 10265 constructor() { 10266 super(...arguments); 10267 __publicField(this, "xmlKeys", { 10268 char: "w:char", 10269 symbolfont: "w:font" 10270 }); 10271 } 10272 } 10273 let Symbol$1 = class Symbol extends XmlComponent { 10274 constructor(char = "", symbolfont = "Wingdings") { 10275 super("w:sym"); 10276 this.root.push(new SymbolAttributes({ char, symbolfont })); 10277 } 10278 }; 10279 class SymbolRun extends Run { 10280 constructor(options2) { 10281 if (typeof options2 === "string") { 10282 super({}); 10283 this.root.push(new Symbol$1(options2)); 10284 return this; 10285 } 10286 super(options2); 10287 this.root.push(new Symbol$1(options2.char, options2.symbolfont)); 10288 } 10289 } 10290 let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; 10291 let customAlphabet = (alphabet, defaultSize = 21) => { 10292 return (size = defaultSize) => { 10293 let id = ""; 10294 let i = size; 10295 while (i--) { 10296 id += alphabet[Math.random() * alphabet.length | 0]; 10297 } 10298 return id; 10299 }; 10300 }; 10301 let nanoid = (size = 21) => { 10302 let id = ""; 10303 let i = size; 10304 while (i--) { 10305 id += urlAlphabet[Math.random() * 64 | 0]; 10306 } 10307 return id; 10308 }; 10309 const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
10310 const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20); 10311 const uniqueNumericIdCreator = (initial = 0) => { 10312 let currentCount = initial; 10313 return () => ++currentCount; 10314 }; 10315 const abstractNumUniqueNumericIdGen = () => uniqueNumericIdCreator(); 10316 const concreteNumUniqueNumericIdGen = () => uniqueNumericIdCreator(1); 10317 const docPropertiesUniqueNumericIdGen = () => uniqueNumericIdCreator(); 10318 const bookmarkUniqueNumericIdGen = () => uniqueNumericIdCreator(); 10319 const uniqueId = () => nanoid().toLowerCase(); 10320 const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)(); 10321 const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`; 10322 const HorizontalPositionRelativeFrom = { 10323 CHARACTER: "character", 10324 COLUMN: "column", 10325 INSIDE_MARGIN: "insideMargin", 10326 LEFT_MARGIN: "leftMargin", 10327 MARGIN: "margin", 10328 OUTSIDE_MARGIN: "outsideMargin", 10329 PAGE: "page", 10330 RIGHT_MARGIN: "rightMargin" 10331 }; 10332 const VerticalPositionRelativeFrom = { 10333 BOTTOM_MARGIN: "bottomMargin", 10334 INSIDE_MARGIN: "insideMargin", 10335 LINE: "line", 10336 MARGIN: "margin", 10337 OUTSIDE_MARGIN: "outsideMargin", 10338 PAGE: "page", 10339 PARAGRAPH: "paragraph", 10340 TOP_MARGIN: "topMargin" 10341 }; 10342 class SimplePosAttributes extends XmlAttributeComponent { 10343 constructor() { 10344 super(...arguments); 10345 __publicField(this, "xmlKeys", { 10346 x: "x", 10347 y: "y" 10348 }); 10349 } 10350 } 10351 class SimplePos extends XmlComponent { 10352 constructor() { 10353 super("wp:simplePos"); 10354 this.root.push( 10355 new SimplePosAttributes({ 10356 x: 0, 10357 y: 0 10358 }) 10359 ); 10360 } 10361 } 10362 class Align extends XmlComponent { 10363 constructor(value) { 10364 super("wp:align"); 10365 this.root.push(value); 10366 } 10367 } 10368 class PositionOffset extends XmlComponent { 10369 constructor(offsetValue) { 10370 super("wp:posOffset"); 10371 this.root.push(offsetValue.toString()); 10372 } 10373 } 10374 class HorizontalPositionAttributes extends XmlAttributeComponent { 10375 constructor() { 10376 super(...arguments); 10377 __publicField(this, "xmlKeys", { 10378 relativeFrom: "relativeFrom" 10379 }); 10380 } 10381 } 10382 class HorizontalPosition extends XmlComponent { 10383 constructor(horizontalPosition) { 10384 super("wp:positionH"); 10385 this.root.push( 10386 new HorizontalPositionAttributes({ 10387 relativeFrom: horizontalPosition.relative || HorizontalPositionRelativeFrom.PAGE 10388 }) 10389 ); 10390 if (horizontalPosition.align) { 10391 this.root.push(new Align(horizontalPosition.align)); 10392 } else if (horizontalPosition.offset !== void 0) { 10393 this.root.push(new PositionOffset(horizontalPosition.offset)); 10394 } else { 10395 throw new Error("There is no configuration provided for floating position (Align or offset)"); 10396 } 10397 } 10398 } 10399 class VerticalPositionAttributes extends XmlAttributeComponent { 10400 constructor() { 10401 super(...arguments); 10402 __publicField(this, "xmlKeys", { 10403 relativeFrom: "relativeFrom" 10404 }); 10405 } 10406 } 10407 class VerticalPosition extends XmlComponent { 10408 constructor(verticalPosition) { 10409 super("wp:positionV"); 10410 this.root.push( 10411 new VerticalPositionAttributes({ 10412 relativeFrom: verticalPosition.relative || VerticalPositionRelativeFrom.PAGE 10413 }) 10414 ); 10415 if (verticalPosition.align) { 10416 this.root.push(new Align(verticalPosition.align)); 10417 } else if (verticalPosition.offset !== void 0) { 10418 this.root.push(new PositionOffset(verticalPosition.offset)); 10419 } else { 10420 throw new Error("There is no configuration provided for floating position (Align or offset)"); 10421 } 10422 } 10423 } 10424 class GraphicDataAttributes extends XmlAttributeComponent { 10425 constructor() { 10426 super(...arguments); 10427 __publicField(this, "xmlKeys", { 10428 uri: "uri" 10429 }); 10430 } 10431 } 10432 class BlipAttributes extends XmlAttributeComponent { 10433 constructor() { 10434 super(...arguments); 10435 __publicField(this, "xmlKeys", { 10436 embed: "r:embed", 10437 cstate: "cstate" 10438 }); 10439 } 10440 } 10441 class Blip extends XmlComponent { 10442 constructor(mediaData) { 10443 super("a:blip"); 10444 this.root.push( 10445 new BlipAttributes({ 10446 embed: `rId{${mediaData.fileName}}`, 10447 cstate: "none" 10448 }) 10449 ); 10450 } 10451 } 10452 class SourceRectangle extends XmlComponent { 10453 constructor() { 10454 super("a:srcRect"); 10455 } 10456 } 10457 class FillRectangle extends XmlComponent { 10458 constructor() { 10459 super("a:fillRect"); 10460 } 10461 } 10462 class Stretch extends XmlComponent { 10463 constructor() { 10464 super("a:stretch"); 10465 this.root.push(new FillRectangle()); 10466 } 10467 } 10468 class BlipFill extends XmlComponent { 10469 constructor(mediaData) { 10470 super("pic:blipFill"); 10471 this.root.push(new Blip(mediaData)); 10472 this.root.push(new SourceRectangle()); 10473 this.root.push(new Stretch()); 10474 } 10475 } 10476 class PicLocksAttributes extends XmlAttributeComponent { 10477 constructor() { 10478 super(...arguments); 10479 __publicField(this, "xmlKeys", { 10480 noChangeAspect: "noChangeAspect", 10481 noChangeArrowheads: "noChangeArrowheads" 10482 }); 10483 } 10484 } 10485 class PicLocks extends XmlComponent { 10486 constructor() { 10487 super("a:picLocks"); 10488 this.root.push( 10489 new PicLocksAttributes({ 10490 noChangeAspect: 1, 10491 noChangeArrowheads: 1 10492 }) 10493 ); 10494 } 10495 } 10496 class ChildNonVisualProperties extends XmlComponent { 10497 constructor() { 10498 super("pic:cNvPicPr"); 10499 this.root.push(new PicLocks()); 10500 } 10501 }
10502 const createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({ 10503 name: "a:hlinkClick", 10504 attributes: __spreadProps(__spreadValues({}, hasXmlNs ? { 10505 xmlns: { 10506 key: "xmlns:a", 10507 value: "http://schemas.openxmlformats.org/drawingml/2006/main" 10508 } 10509 } : {}), { 10510 id: { 10511 key: "r:id", 10512 value: `rId${linkId}` 10513 } 10514 }) 10515 }); 10516 class NonVisualPropertiesAttributes extends XmlAttributeComponent { 10517 constructor() { 10518 super(...arguments); 10519 __publicField(this, "xmlKeys", { 10520 id: "id", 10521 name: "name", 10522 descr: "descr" 10523 }); 10524 } 10525 } 10526 class NonVisualProperties extends XmlComponent { 10527 constructor() { 10528 super("pic:cNvPr"); 10529 this.root.push( 10530 new NonVisualPropertiesAttributes({ 10531 id: 0, 10532 name: "", 10533 descr: "" 10534 }) 10535 ); 10536 } 10537 prepForXml(context) { 10538 for (let i = context.stack.length - 1; i >= 0; i--) { 10539 const element2 = context.stack[i]; 10540 if (!(element2 instanceof ConcreteHyperlink)) { 10541 continue; 10542 } 10543 this.root.push(createHyperlinkClick(element2.linkId, false)); 10544 break; 10545 } 10546 return super.prepForXml(context); 10547 } 10548 } 10549 class NonVisualPicProperties extends XmlComponent { 10550 constructor() { 10551 super("pic:nvPicPr"); 10552 this.root.push(new NonVisualProperties()); 10553 this.root.push(new ChildNonVisualProperties()); 10554 } 10555 } 10556 class PicAttributes extends XmlAttributeComponent { 10557 constructor() { 10558 super(...arguments); 10559 __publicField(this, "xmlKeys", { 10560 xmlns: "xmlns:pic" 10561 }); 10562 } 10563 } 10564 class ExtentsAttributes extends XmlAttributeComponent { 10565 constructor() { 10566 super(...arguments); 10567 __publicField(this, "xmlKeys", { 10568 cx: "cx", 10569 cy: "cy" 10570 }); 10571 } 10572 } 10573 class Extents extends XmlComponent { 10574 constructor(x, y) { 10575 super("a:ext"); 10576 __publicField(this, "attributes"); 10577 this.attributes = new ExtentsAttributes({ 10578 cx: x, 10579 cy: y 10580 }); 10581 this.root.push(this.attributes); 10582 } 10583 } 10584 class OffsetAttributes extends XmlAttributeComponent { 10585 constructor() { 10586 super(...arguments); 10587 __publicField(this, "xmlKeys", { 10588 x: "x", 10589 y: "y" 10590 }); 10591 } 10592 } 10593 class Offset extends XmlComponent { 10594 constructor() { 10595 super("a:off"); 10596 this.root.push( 10597 new OffsetAttributes({ 10598 x: 0, 10599 y: 0 10600 }) 10601 ); 10602 } 10603 } 10604 class FormAttributes extends XmlAttributeComponent { 10605 constructor() { 10606 super(...arguments); 10607 __publicField(this, "xmlKeys", { 10608 flipVertical: "flipV", 10609 flipHorizontal: "flipH", 10610 rotation: "rot" 10611 }); 10612 } 10613 } 10614 class Form extends XmlComponent { 10615 constructor(options2) { 10616 var _a, _b; 10617 super("a:xfrm"); 10618 __publicField(this, "extents"); 10619 this.root.push( 10620 new FormAttributes({ 10621 flipVertical: (_a = options2.flip) == null ? void 0 : _a.vertical, 10622 flipHorizontal: (_b = options2.flip) == null ? void 0 : _b.horizontal, 10623 rotation: options2.rotation 10624 }) 10625 ); 10626 this.extents = new Extents(options2.emus.x, options2.emus.y); 10627 this.root.push(new Offset()); 10628 this.root.push(this.extents); 10629 } 10630 } 10631 const createNoFill = () => new BuilderElement({ name: "a:noFill" }); 10632 const createSchemeColor = (options2) => new BuilderElement({ 10633 name: "a:schemeClr", 10634 attributes: { 10635 value: { 10636 key: "val", 10637 value: options2.value 10638 } 10639 } 10640 }); 10641 const createSolidRgbColor = (options2) => new BuilderElement({ 10642 name: "a:srgbClr", 10643 attributes: { 10644 value: { 10645 key: "val", 10646 value: options2.value 10647 } 10648 } 10649 }); 10650 const createSolidFill = (options2) => new BuilderElement({ 10651 name: "a:solidFill", 10652 children: [options2.type === "rgb" ? createSolidRgbColor(options2) : createSchemeColor(options2)] 10653 }); 10654 const createOutline = (options2) => new BuilderElement({ 10655 name: "a:ln", 10656 attributes: { 10657 width: { 10658 key: "w", 10659 value: options2.width 10660 }, 10661 cap: { 10662 key: "cap", 10663 value: options2.cap 10664 }, 10665 compoundLine: { 10666 key: "cmpd", 10667 value: options2.compoundLine 10668 }, 10669 align: { 10670 key: "algn", 10671 value: options2.align 10672 } 10673 }, 10674 children: [ 10675 options2.type === "noFill" ? createNoFill() : options2.solidFillType === "rgb" ? createSolidFill({ 10676 type: "rgb", 10677 value: options2.value 10678 }) : createSolidFill({ 10679 type: "scheme", 10680 value: options2.value 10681 }) 10682 ] 10683 }); 10684 class AdjustmentValues extends XmlComponent { 10685 constructor() { 10686 super("a:avLst"); 10687 } 10688 } 10689 class PresetGeometryAttributes extends XmlAttributeComponent { 10690 constructor() { 10691 super(...arguments); 10692 __publicField(this, "xmlKeys", { 10693 prst: "prst" 10694 }); 10695 } 10696 } 10697 class PresetGeometry extends XmlComponent { 10698 constructor() { 10699 super("a:prstGeom"); 10700 this.root.push( 10701 new PresetGeometryAttributes({ 10702 prst: "rect" 10703 }) 10704 ); 10705 this.root.push(new AdjustmentValues()); 10706 } 10707 } 10708 class ShapePropertiesAttributes extends XmlAttributeComponent { 10709 constructor() { 10710 super(...arguments); 10711 __publicField(this, "xmlKeys", { 10712 bwMode: "bwMode" 10713 }); 10714 } 10715 } 10716 class ShapeProperties extends XmlComponent { 10717 constructor({ outline, transform }) { 10718 super("pic:spPr"); 10719 __publicField(this, "form"); 10720 this.root.push( 10721 new ShapePropertiesAttributes({ 10722 bwMode: "auto" 10723 }) 10724 ); 10725 this.form = new Form(transform); 10726 this.root.push(this.form); 10727 this.root.push(new PresetGeometry()); 10728 if (outline) { 10729 this.root.push(createNoFill()); 10730 this.root.push(createOutline(outline)); 10731 } 10732 } 10733 } 10734 class Pic extends XmlComponent { 10735 constructor({ 10736 mediaData, 10737 transform, 10738 outline 10739 }) { 10740 super("pic:pic"); 10741 this.root.push( 10742 new PicAttributes({ 10743 xmlns: "http://schemas.openxmlformats.org/drawingml/2006/picture" 10744 }) 10745 ); 10746 this.root.push(new NonVisualPicProperties()); 10747 this.root.push(new BlipFill(mediaData)); 10748 this.root.push(new ShapeProperties({ transform, outline })); 10749 } 10750 } 10751 class GraphicData extends XmlComponent { 10752 constructor({ 10753 mediaData, 10754 transform, 10755 outline 10756 }) { 10757 super("a:graphicData"); 10758 __publicField(this, "pic"); 10759 this.root.push( 10760 new GraphicDataAttributes({ 10761 uri: "http://schemas.openxmlformats.org/drawingml/2006/picture" 10762 }) 10763 ); 10764 this.pic = new Pic({ mediaData, transform, outline }); 10765 this.root.push(this.pic); 10766 } 10767 } 10768 class GraphicAttributes extends XmlAttributeComponent { 10769 constructor() { 10770 super(...arguments); 10771 __publicField(this, "xmlKeys", { 10772 a: "xmlns:a" 10773 }); 10774 } 10775 } 10776 class Graphic extends XmlComponent { 10777 constructor({ 10778 mediaData, 10779 transform, 10780 outline 10781 }) { 10782 super("a:graphic"); 10783 __publicField(this, "data"); 10784 this.root.push( 10785 new GraphicAttributes({ 10786 a: "http://schemas.openxmlformats.org/drawingml/2006/main" 10787 }) 10788 ); 10789 this.data = new GraphicData({ mediaData, transform, outline }); 10790 this.root.push(this.data); 10791 } 10792 } 10793 const TextWrappingType = { 10794 NONE: 0, 10795 SQUARE: 1, 10796 TIGHT: 2, 10797 TOP_AND_BOTTOM: 3 10798 }; 10799 const TextWrappingSide = { 10800 BOTH_SIDES: "bothSides", 10801 LEFT: "left", 10802 RIGHT: "right", 10803 LARGEST: "largest" 10804 }; 10805 class WrapNone extends XmlComponent { 10806 constructor() { 10807 super("wp:wrapNone"); 10808 } 10809 } 10810 class WrapSquareAttributes extends XmlAttributeComponent { 10811 constructor() { 10812 super(...arguments); 10813 __publicField(this, "xmlKeys", { 10814 distT: "distT", 10815 distB: "distB", 10816 distL: "distL", 10817 distR: "distR", 10818 wrapText: "wrapText" 10819 }); 10820 } 10821 } 10822 class WrapSquare extends XmlComponent { 10823 constructor(textWrapping, margins = { 10824 top: 0, 10825 bottom: 0, 10826 left: 0, 10827 right: 0 10828 }) { 10829 super("wp:wrapSquare"); 10830 this.root.push( 10831 new WrapSquareAttributes({ 10832 wrapText: textWrapping.side || TextWrappingSide.BOTH_SIDES, 10833 distT: margins.top, 10834 distB: margins.bottom, 10835 distL: margins.left, 10836 distR: margins.right 10837 }) 10838 ); 10839 } 10840 } 10841 class WrapTightAttributes extends XmlAttributeComponent { 10842 constructor() { 10843 super(...arguments); 10844 __publicField(this, "xmlKeys", { 10845 distT: "distT", 10846 distB: "distB" 10847 }); 10848 } 10849 } 10850 class WrapTight extends XmlComponent { 10851 constructor(margins = { 10852 top: 0, 10853 bottom: 0 10854 }) { 10855 super("wp:wrapTight"); 10856 this.root.push( 10857 new WrapTightAttributes({ 10858 distT: margins.top, 10859 distB: margins.bottom 10860 }) 10861 ); 10862 } 10863 } 10864 class WrapTopAndBottomAttributes extends XmlAttributeComponent { 10865 constructor() { 10866 super(...arguments); 10867 __publicField(this, "xmlKeys", { 10868 distT: "distT", 10869 distB: "distB" 10870 }); 10871 } 10872 } 10873 class WrapTopAndBottom extends XmlComponent { 10874 constructor(margins = { 10875 top: 0, 10876 bottom: 0 10877 }) { 10878 super("wp:wrapTopAndBottom"); 10879 this.root.push( 10880 new WrapTopAndBottomAttributes({ 10881 distT: margins.top, 10882 distB: margins.bottom 10883 }) 10884 ); 10885 } 10886 } 10887 class DocProperties extends XmlComponent { 10888 constructor({ name, description, title } = { name: "", description: "", title: "" }) { 10889 super("wp:docPr"); 10890 __publicField(this, "docPropertiesUniqueNumericId", docPropertiesUniqueNumericIdGen()); 10891 this.root.push( 10892 new NextAttributeComponent({ 10893 id: { 10894 key: "id", 10895 value: this.docPropertiesUniqueNumericId() 10896 }, 10897 name: { 10898 key: "name", 10899 value: name 10900 }, 10901 description: {
10902 key: "descr", 10903 value: description 10904 }, 10905 title: { 10906 key: "title", 10907 value: title 10908 } 10909 }) 10910 ); 10911 } 10912 prepForXml(context) { 10913 for (let i = context.stack.length - 1; i >= 0; i--) { 10914 const element2 = context.stack[i]; 10915 if (!(element2 instanceof ConcreteHyperlink)) { 10916 continue; 10917 } 10918 this.root.push(createHyperlinkClick(element2.linkId, true)); 10919 break; 10920 } 10921 return super.prepForXml(context); 10922 } 10923 } 10924 const createEffectExtent = ({ top, right, bottom, left }) => new BuilderElement({ 10925 name: "wp:effectExtent", 10926 attributes: { 10927 top: { 10928 key: "t", 10929 value: top 10930 }, 10931 right: { 10932 key: "r", 10933 value: right 10934 }, 10935 bottom: { 10936 key: "b", 10937 value: bottom 10938 }, 10939 left: { 10940 key: "l", 10941 value: left 10942 } 10943 } 10944 }); 10945 class ExtentAttributes extends XmlAttributeComponent { 10946 constructor() { 10947 super(...arguments); 10948 __publicField(this, "xmlKeys", { 10949 cx: "cx", 10950 cy: "cy" 10951 }); 10952 } 10953 } 10954 class Extent extends XmlComponent { 10955 constructor(x, y) { 10956 super("wp:extent"); 10957 __publicField(this, "attributes"); 10958 this.attributes = new ExtentAttributes({ 10959 cx: x, 10960 cy: y 10961 }); 10962 this.root.push(this.attributes); 10963 } 10964 } 10965 class GraphicFrameLockAttributes extends XmlAttributeComponent { 10966 constructor() { 10967 super(...arguments); 10968 __publicField(this, "xmlKeys", { 10969 xmlns: "xmlns:a", 10970 noChangeAspect: "noChangeAspect" 10971 }); 10972 } 10973 } 10974 class GraphicFrameLocks extends XmlComponent { 10975 constructor() { 10976 super("a:graphicFrameLocks"); 10977 this.root.push( 10978 new GraphicFrameLockAttributes({ 10979 xmlns: "http://schemas.openxmlformats.org/drawingml/2006/main", 10980 noChangeAspect: 1 10981 }) 10982 ); 10983 } 10984 } 10985 class GraphicFrameProperties extends XmlComponent { 10986 constructor() { 10987 super("wp:cNvGraphicFramePr"); 10988 this.root.push(new GraphicFrameLocks()); 10989 } 10990 } 10991 class AnchorAttributes extends XmlAttributeComponent { 10992 constructor() { 10993 super(...arguments); 10994 __publicField(this, "xmlKeys", { 10995 distT: "distT", 10996 distB: "distB", 10997 distL: "distL", 10998 distR: "distR", 10999 allowOverlap: "allowOverlap", 11000 behindDoc: "behindDoc", 11001 layoutInCell: "layoutInCell", 11002 locked: "locked", 11003 relativeHeight: "relativeHeight", 11004 simplePos: "simplePos" 11005 }); 11006 } 11007 } 11008 class Anchor extends XmlComponent { 11009 constructor({ 11010 mediaData, 11011 transform, 11012 drawingOptions 11013 }) { 11014 super("wp:anchor"); 11015 const floating = __spreadValues({ 11016 allowOverlap: true, 11017 behindDocument: false, 11018 lockAnchor: false, 11019 layoutInCell: true, 11020 verticalPosition: {}, 11021 horizontalPosition: {} 11022 }, drawingOptions.floating); 11023 this.root.push( 11024 new AnchorAttributes({ 11025 distT: floating.margins ? floating.margins.top || 0 : 0, 11026 distB: floating.margins ? floating.margins.bottom || 0 : 0, 11027 distL: floating.margins ? floating.margins.left || 0 : 0, 11028 distR: floating.margins ? floating.margins.right || 0 : 0, 11029 simplePos: "0", 11030 // note: word doesn't fully support - so we use 0 11031 allowOverlap: floating.allowOverlap === true ? "1" : "0", 11032 behindDoc: floating.behindDocument === true ? "1" : "0", 11033 locked: floating.lockAnchor === true ? "1" : "0", 11034 layoutInCell: floating.layoutInCell === true ? "1" : "0", 11035 relativeHeight: floating.zIndex ? floating.zIndex : transform.emus.y 11036 }) 11037 ); 11038 this.root.push(new SimplePos()); 11039 this.root.push(new HorizontalPosition(floating.horizontalPosition)); 11040 this.root.push(new VerticalPosition(floating.verticalPosition)); 11041 this.root.push(new Extent(transform.emus.x, transform.emus.y)); 11042 this.root.push(createEffectExtent({ top: 0, right: 0, bottom: 0, left: 0 })); 11043 if (drawingOptions.floating !== void 0 && drawingOptions.floating.wrap !== void 0) { 11044 switch (drawingOptions.floating.wrap.type) { 11045 case TextWrappingType.SQUARE: 11046 this.root.push(new WrapSquare(drawingOptions.floating.wrap, drawingOptions.floating.margins)); 11047 break; 11048 case TextWrappingType.TIGHT: 11049 this.root.push(new WrapTight(drawingOptions.floating.margins)); 11050 break; 11051 case TextWrappingType.TOP_AND_BOTTOM: 11052 this.root.push(new WrapTopAndBottom(drawingOptions.floating.margins)); 11053 break; 11054 case TextWrappingType.NONE: 11055 default: 11056 this.root.push(new WrapNone()); 11057 } 11058 } else { 11059 this.root.push(new WrapNone()); 11060 } 11061 this.root.push(new DocProperties(drawingOptions.docProperties)); 11062 this.root.push(new GraphicFrameProperties()); 11063 this.root.push(new Graphic({ mediaData, transform, outline: drawingOptions.outline })); 11064 } 11065 } 11066 const createInline = ({ mediaData, transform, docProperties, outline }) => { 11067 var _a, _b, _c, _d; 11068 return new BuilderElement({
11069 name: "wp:inline", 11070 attributes: { 11071 distanceTop: { 11072 key: "distT", 11073 value: 0 11074 }, 11075 distanceBottom: { 11076 key: "distB", 11077 value: 0 11078 }, 11079 distanceLeft: { 11080 key: "distL", 11081 value: 0 11082 }, 11083 distanceRight: { 11084 key: "distR", 11085 value: 0 11086 } 11087 }, 11088 children: [ 11089 new Extent(transform.emus.x, transform.emus.y), 11090 createEffectExtent( 11091 outline ? { 11092 top: ((_a = outline.width) != null ? _a : 9525) * 2, 11093 right: ((_b = outline.width) != null ? _b : 9525) * 2, 11094 bottom: ((_c = outline.width) != null ? _c : 9525) * 2, 11095 left: ((_d = outline.width) != null ? _d : 9525) * 2 11096 } : { top: 0, right: 0, bottom: 0, left: 0 } 11097 ), 11098 new DocProperties(docProperties), 11099 new GraphicFrameProperties(), 11100 new Graphic({ mediaData, transform, outline }) 11101 ] 11102 }); 11103 }; 11104 class Drawing extends XmlComponent { 11105 constructor(imageData, drawingOptions = {}) { 11106 super("w:drawing"); 11107 if (!drawingOptions.floating) { 11108 this.root.push( 11109 createInline({ 11110 mediaData: imageData, 11111 transform: imageData.transformation, 11112 docProperties: drawingOptions.docProperties, 11113 outline: drawingOptions.outline 11114 }) 11115 ); 11116 } else { 11117 this.root.push(new Anchor({ mediaData: imageData, transform: imageData.transformation, drawingOptions })); 11118 } 11119 } 11120 } 11121 class ImageRun extends Run { 11122 constructor(options2) { 11123 super({}); 11124 __publicField(this, "key", `${uniqueId()}.png`); 11125 __publicField(this, "imageData"); 11126 const newData = typeof options2.data === "string" ? this.convertDataURIToBinary(options2.data) : options2.data; 11127 this.imageData = { 11128 stream: newData, 11129 fileName: this.key, 11130 transformation: { 11131 pixels: { 11132 x: Math.round(options2.transformation.width), 11133 y: Math.round(options2.transformation.height) 11134 }, 11135 emus: { 11136 x: Math.round(options2.transformation.width * 9525), 11137 y: Math.round(options2.transformation.height * 9525) 11138 }, 11139 flip: options2.transformation.flip, 11140 rotation: options2.transformation.rotation ? options2.transformation.rotation * 6e4 : void 0 11141 } 11142 }; 11143 const drawing = new Drawing(this.imageData, { 11144 floating: options2.floating, 11145 docProperties: options2.altText, 11146 outline: options2.outline 11147 }); 11148 this.root.push(drawing); 11149 } 11150 prepForXml(context) { 11151 context.file.Media.addImage(this.key, this.imageData); 11152 return super.prepForXml(context); 11153 } 11154 convertDataURIToBinary(dataURI) { 11155 if (typeof atob === "function") { 11156 const BASE64_MARKER = ";base64,"; 11157 const base64Index = dataURI.indexOf(BASE64_MARKER); 11158 const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + BASE64_MARKER.length; 11159 return new Uint8Array( 11160 atob(dataURI.substring(base64IndexWithOffset)).split("").map((c) => c.charCodeAt(0)) 11161 ); 11162 } else { 11163 const b = require("buffer"); 11164 return new b.Buffer(dataURI, "base64"); 11165 } 11166 } 11167 } 11168 class SequentialIdentifierInstruction extends XmlComponent { 11169 constructor(identifier) { 11170 super("w:instrText"); 11171 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 11172 this.root.push(`SEQ ${identifier}`); 11173 } 11174 } 11175 class SequentialIdentifier extends Run { 11176 constructor(identifier) { 11177 super({}); 11178 this.root.push(new Begin(true)); 11179 this.root.push(new SequentialIdentifierInstruction(identifier)); 11180 this.root.push(new Separate()); 11181 this.root.push(new End()); 11182 } 11183 } 11184 class FldSimpleAttrs extends XmlAttributeComponent { 11185 constructor() { 11186 super(...arguments); 11187 __publicField(this, "xmlKeys", { instr: "w:instr" }); 11188 } 11189 } 11190 class SimpleField extends XmlComponent { 11191 constructor(instruction, cachedValue) { 11192 super("w:fldSimple"); 11193 this.root.push(new FldSimpleAttrs({ instr: instruction })); 11194 if (cachedValue !== void 0) { 11195 this.root.push(new TextRun(cachedValue)); 11196 } 11197 } 11198 } 11199 class SimpleMailMergeField extends SimpleField { 11200 constructor(fieldName) { 11201 super(` MERGEFIELD ${fieldName} `, `«${fieldName}»`); 11202 } 11203 } 11204 class CommentAttributes extends XmlAttributeComponent { 11205 constructor() { 11206 super(...arguments); 11207 __publicField(this, "xmlKeys", { id: "w:id", initials: "w:initials", author: "w:author", date: "w:date" }); 11208 } 11209 } 11210 class CommentRangeAttributes extends XmlAttributeComponent { 11211 constructor() { 11212 super(...arguments); 11213 __publicField(this, "xmlKeys", { id: "w:id" }); 11214 } 11215 } 11216 class RootCommentsAttributes extends XmlAttributeComponent { 11217 constructor() { 11218 super(...arguments); 11219 __publicField(this, "xmlKeys", { 11220 "xmlns:cx": "xmlns:cx", 11221 "xmlns:cx1": "xmlns:cx1", 11222 "xmlns:cx2": "xmlns:cx2", 11223 "xmlns:cx3": "xmlns:cx3", 11224 "xmlns:cx4": "xmlns:cx4", 11225 "xmlns:cx5": "xmlns:cx5", 11226 "xmlns:cx6": "xmlns:cx6", 11227 "xmlns:cx7": "xmlns:cx7", 11228 "xmlns:cx8": "xmlns:cx8", 11229 "xmlns:mc": "xmlns:mc", 11230 "xmlns:aink": "xmlns:aink", 11231 "xmlns:am3d": "xmlns:am3d", 11232 "xmlns:o": "xmlns:o", 11233 "xmlns:r": "xmlns:r", 11234 "xmlns:m": "xmlns:m", 11235 "xmlns:v": "xmlns:v", 11236 "xmlns:wp14": "xmlns:wp14", 11237 "xmlns:wp": "xmlns:wp", 11238 "xmlns:w10": "xmlns:w10", 11239 "xmlns:w": "xmlns:w", 11240 "xmlns:w14": "xmlns:w14", 11241 "xmlns:w15": "xmlns:w15", 11242 "xmlns:w16cex": "xmlns:w16cex", 11243 "xmlns:w16cid": "xmlns:w16cid", 11244 "xmlns:w16": "xmlns:w16", 11245 "xmlns:w16sdtdh": "xmlns:w16sdtdh", 11246 "xmlns:w16se": "xmlns:w16se", 11247 "xmlns:wpg": "xmlns:wpg", 11248 "xmlns:wpi": "xmlns:wpi", 11249 "xmlns:wne": "xmlns:wne", 11250 "xmlns:wps": "xmlns:wps" 11251 }); 11252 } 11253 } 11254 class CommentRangeStart extends XmlComponent { 11255 constructor(id) { 11256 super("w:commentRangeStart"); 11257 this.root.push(new CommentRangeAttributes({ id })); 11258 } 11259 } 11260 class CommentRangeEnd extends XmlComponent { 11261 constructor(id) { 11262 super("w:commentRangeEnd"); 11263 this.root.push(new CommentRangeAttributes({ id })); 11264 } 11265 } 11266 class CommentReference extends XmlComponent { 11267 constructor(id) { 11268 super("w:commentReference"); 11269 this.root.push(new CommentRangeAttributes({ id })); 11270 } 11271 } 11272 class Comment extends XmlComponent { 11273 constructor({ id, initials, author, date = /* @__PURE__ */ new Date(), children }) { 11274 super("w:comment"); 11275 this.root.push( 11276 new CommentAttributes({ 11277 id, 11278 initials, 11279 author, 11280 date: date.toISOString() 11281 }) 11282 ); 11283 for (const child of children) { 11284 this.root.push(child); 11285 } 11286 } 11287 } 11288 class Comments extends XmlComponent { 11289 constructor({ children }) { 11290 super("w:comments"); 11291 this.root.push( 11292 new RootCommentsAttributes({ 11293 "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex", 11294 "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex", 11295 "xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex", 11296 "xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex", 11297 "xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex", 11298 "xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex", 11299 "xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex", 11300 "xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex", 11301 "xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex", 11302 "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006", 11303 "xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink", 11304 "xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d", 11305 "xmlns:o": "urn:schemas-microsoft-com:office:office", 11306 "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 11307 "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math", 11308 "xmlns:v": "urn:schemas-microsoft-com:vml", 11309 "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 11310 "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 11311 "xmlns:w10": "urn:schemas-microsoft-com:office:word", 11312 "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 11313 "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml", 11314 "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml", 11315 "xmlns:w16cex": "http://schemas.microsoft.com/office/word/2018/wordml/cex", 11316 "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid", 11317 "xmlns:w16": "http://schemas.microsoft.com/office/word/2018/wordml", 11318 "xmlns:w16sdtdh": "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash", 11319 "xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex", 11320 "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 11321 "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 11322 "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml", 11323 "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" 11324 }) 11325 ); 11326 for (const child of children) { 11327 this.root.push(new Comment(child)); 11328 } 11329 } 11330 }
11331 class NoBreakHyphen extends EmptyElement { 11332 constructor() { 11333 super("w:noBreakHyphen"); 11334 } 11335 } 11336 class SoftHyphen extends EmptyElement { 11337 constructor() { 11338 super("w:softHyphen"); 11339 } 11340 } 11341 class DayShort extends EmptyElement { 11342 constructor() { 11343 super("w:dayShort"); 11344 } 11345 } 11346 class MonthShort extends EmptyElement { 11347 constructor() { 11348 super("w:monthShort"); 11349 } 11350 } 11351 class YearShort extends EmptyElement { 11352 constructor() { 11353 super("w:yearShort"); 11354 } 11355 } 11356 class DayLong extends EmptyElement { 11357 constructor() { 11358 super("w:dayLong"); 11359 } 11360 } 11361 class MonthLong extends EmptyElement { 11362 constructor() { 11363 super("w:monthLong"); 11364 } 11365 } 11366 class YearLong extends EmptyElement { 11367 constructor() { 11368 super("w:yearLong"); 11369 } 11370 } 11371 class AnnotationReference extends EmptyElement { 11372 constructor() { 11373 super("w:annotationRef"); 11374 } 11375 } 11376 class FootnoteReferenceElement extends EmptyElement { 11377 constructor() { 11378 super("w:footnoteRef"); 11379 } 11380 } 11381 class EndnoteReference extends EmptyElement { 11382 constructor() { 11383 super("w:endnoteRef"); 11384 } 11385 } 11386 class Separator extends EmptyElement { 11387 constructor() { 11388 super("w:separator"); 11389 } 11390 } 11391 class ContinuationSeparator extends EmptyElement { 11392 constructor() { 11393 super("w:continuationSeparator"); 11394 } 11395 } 11396 class PageNumberElement extends EmptyElement { 11397 constructor() { 11398 super("w:pgNum"); 11399 } 11400 } 11401 class CarriageReturn extends EmptyElement { 11402 constructor() { 11403 super("w:cr"); 11404 } 11405 } 11406 class Tab extends EmptyElement { 11407 constructor() { 11408 super("w:tab"); 11409 } 11410 } 11411 class LastRenderedPageBreak extends EmptyElement { 11412 constructor() { 11413 super("w:lastRenderedPageBreak"); 11414 } 11415 } 11416 const PositionalTabAlignment = { 11417 LEFT: "left", 11418 CENTER: "center", 11419 RIGHT: "right" 11420 }; 11421 const PositionalTabRelativeTo = { 11422 MARGIN: "margin", 11423 INDENT: "indent" 11424 }; 11425 const PositionalTabLeader = { 11426 NONE: "none", 11427 DOT: "dot", 11428 HYPHEN: "hyphen", 11429 UNDERSCORE: "underscore", 11430 // eslint-disable-next-line @typescript-eslint/naming-convention 11431 MIDDLE_DOT: "middleDot" 11432 }; 11433 class PositionalTab extends XmlComponent { 11434 constructor(options2) { 11435 super("w:ptab"); 11436 this.root.push( 11437 new NextAttributeComponent({ 11438 alignment: { 11439 key: "w:alignment", 11440 value: options2.alignment 11441 }, 11442 relativeTo: { 11443 key: "w:relativeTo", 11444 value: options2.relativeTo 11445 }, 11446 leader: { 11447 key: "w:leader", 11448 value: options2.leader 11449 } 11450 }) 11451 ); 11452 } 11453 } 11454 const BreakType = { 11455 COLUMN: "column", 11456 PAGE: "page" 11457 // textWrapping breaks are the default and already exposed via the "Run" class 11458 }; 11459 class Break extends XmlComponent { 11460 constructor(type) { 11461 super("w:br"); 11462 this.root.push( 11463 new Attributes({ 11464 type 11465 }) 11466 ); 11467 } 11468 } 11469 class PageBreak extends Run { 11470 constructor() { 11471 super({}); 11472 this.root.push(new Break(BreakType.PAGE)); 11473 } 11474 } 11475 class ColumnBreak extends Run { 11476 constructor() { 11477 super({}); 11478 this.root.push(new Break(BreakType.COLUMN)); 11479 } 11480 } 11481 class PageBreakBefore extends XmlComponent { 11482 constructor() { 11483 super("w:pageBreakBefore"); 11484 } 11485 } 11486 const LineRuleType = { 11487 // eslint-disable-next-line @typescript-eslint/naming-convention 11488 AT_LEAST: "atLeast", 11489 EXACTLY: "exactly", 11490 EXACT: "exact", 11491 AUTO: "auto" 11492 }; 11493 class SpacingAttributes extends XmlAttributeComponent { 11494 constructor() { 11495 super(...arguments); 11496 __publicField(this, "xmlKeys", { 11497 after: "w:after", 11498 before: "w:before", 11499 line: "w:line", 11500 lineRule: "w:lineRule" 11501 }); 11502 } 11503 } 11504 class Spacing extends XmlComponent { 11505 constructor(options2) { 11506 super("w:spacing"); 11507 this.root.push(new SpacingAttributes(options2)); 11508 } 11509 } 11510 const HeadingLevel = { 11511 HEADING_1: "Heading1", 11512 HEADING_2: "Heading2", 11513 HEADING_3: "Heading3", 11514 HEADING_4: "Heading4", 11515 HEADING_5: "Heading5", 11516 HEADING_6: "Heading6", 11517 TITLE: "Title" 11518 }; 11519 let Style$1 = class Style extends XmlComponent { 11520 constructor(styleId) { 11521 super("w:pStyle"); 11522 this.root.push( 11523 new Attributes({ 11524 val: styleId 11525 }) 11526 ); 11527 } 11528 }; 11529 class TabStop extends XmlComponent { 11530 constructor(tabDefinitions) { 11531 super("w:tabs"); 11532 for (const tabDefinition of tabDefinitions) { 11533 this.root.push(new TabStopItem(tabDefinition)); 11534 } 11535 } 11536 } 11537 const TabStopType = { 11538 LEFT: "left", 11539 RIGHT: "right", 11540 CENTER: "center", 11541 BAR: "bar", 11542 CLEAR: "clear", 11543 DECIMAL: "decimal", 11544 END: "end", 11545 NUM: "num", 11546 START: "start" 11547 }; 11548 const LeaderType = { 11549 DOT: "dot", 11550 HYPHEN: "hyphen", 11551 // eslint-disable-next-line @typescript-eslint/naming-convention 11552 MIDDLE_DOT: "middleDot", 11553 NONE: "none", 11554 UNDERSCORE: "underscore" 11555 }; 11556 const TabStopPosition = { 11557 MAX: 9026 11558 }; 11559 class TabAttributes extends XmlAttributeComponent { 11560 constructor() { 11561 super(...arguments); 11562 __publicField(this, "xmlKeys", { val: "w:val", pos: "w:pos", leader: "w:leader" }); 11563 } 11564 } 11565 class TabStopItem extends XmlComponent { 11566 constructor({ type, position, leader }) { 11567 super("w:tab"); 11568 this.root.push( 11569 new TabAttributes({ 11570 val: type, 11571 pos: position, 11572 leader 11573 }) 11574 ); 11575 } 11576 } 11577 class NumberProperties extends XmlComponent { 11578 constructor(numberId, indentLevel) { 11579 super("w:numPr"); 11580 this.root.push(new IndentLevel(indentLevel)); 11581 this.root.push(new NumberId(numberId)); 11582 } 11583 } 11584 class IndentLevel extends XmlComponent { 11585 constructor(level) { 11586 super("w:ilvl"); 11587 if (level > 9) { 11588 throw new Error( 11589 "Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us
11589/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7" 11590 ); 11591 } 11592 this.root.push( 11593 new Attributes({ 11594 val: level 11595 }) 11596 ); 11597 } 11598 } 11599 class NumberId extends XmlComponent { 11600 constructor(id) { 11601 super("w:numId"); 11602 this.root.push( 11603 new Attributes({ 11604 val: typeof id === "string" ? `{${id}}` : id 11605 }) 11606 ); 11607 } 11608 } 11609 class FileChild extends XmlComponent { 11610 constructor() { 11611 super(...arguments); 11612 __publicField(this, "fileChild", Symbol()); 11613 } 11614 } 11615 class RelationshipAttributes extends XmlAttributeComponent { 11616 constructor() { 11617 super(...arguments); 11618 __publicField(this, "xmlKeys", { 11619 id: "Id", 11620 type: "Type", 11621 target: "Target", 11622 targetMode: "TargetMode" 11623 }); 11624 } 11625 } 11626 const TargetModeType = { 11627 EXTERNAL: "External" 11628 }; 11629 class Relationship extends XmlComponent { 11630 constructor(id, type, target, targetMode) { 11631 super("Relationship"); 11632 this.root.push( 11633 new RelationshipAttributes({ 11634 id, 11635 type, 11636 target, 11637 targetMode 11638 }) 11639 ); 11640 } 11641 } 11642 class HyperlinkAttributes extends XmlAttributeComponent { 11643 constructor() { 11644 super(...arguments); 11645 __publicField(this, "xmlKeys", { 11646 id: "r:id", 11647 history: "w:history", 11648 anchor: "w:anchor" 11649 }); 11650 } 11651 } 11652 const HyperlinkType = { 11653 INTERNAL: "INTERNAL", 11654 EXTERNAL: "EXTERNAL" 11655 }; 11656 class ConcreteHyperlink extends XmlComponent { 11657 constructor(children, relationshipId, anchor) { 11658 super("w:hyperlink"); 11659 __publicField(this, "linkId"); 11660 this.linkId = relationshipId; 11661 const props = { 11662 history: 1, 11663 anchor: anchor ? anchor : void 0, 11664 id: !anchor ? `rId${this.linkId}` : void 0 11665 }; 11666 const attributes = new HyperlinkAttributes(props); 11667 this.root.push(attributes); 11668 children.forEach((child) => { 11669 this.root.push(child); 11670 }); 11671 } 11672 } 11673 class InternalHyperlink extends ConcreteHyperlink { 11674 constructor(options2) { 11675 super(options2.children, uniqueId(), options2.anchor); 11676 } 11677 } 11678 class ExternalHyperlink extends XmlComponent { 11679 constructor(options2) { 11680 super("w:externalHyperlink"); 11681 this.options = options2; 11682 } 11683 } 11684 class BookmarkStartAttributes extends XmlAttributeComponent { 11685 constructor() { 11686 super(...arguments); 11687 __publicField(this, "xmlKeys", { 11688 id: "w:id", 11689 name: "w:name" 11690 }); 11691 } 11692 } 11693 class BookmarkEndAttributes extends XmlAttributeComponent { 11694 constructor() { 11695 super(...arguments); 11696 __publicField(this, "xmlKeys", { 11697 id: "w:id" 11698 }); 11699 } 11700 } 11701 class Bookmark { 11702 constructor(options2) { 11703 __publicField(this, "bookmarkUniqueNumericId", bookmarkUniqueNumericIdGen()); 11704 __publicField(this, "start"); 11705 __publicField(this, "children"); 11706 __publicField(this, "end"); 11707 const linkId = this.bookmarkUniqueNumericId(); 11708 this.start = new BookmarkStart(options2.id, linkId); 11709 this.children = options2.children; 11710 this.end = new BookmarkEnd(linkId); 11711 } 11712 } 11713 class BookmarkStart extends XmlComponent { 11714 constructor(id, linkId) { 11715 super("w:bookmarkStart"); 11716 const attributes = new BookmarkStartAttributes({ 11717 name: id, 11718 id: linkId 11719 }); 11720 this.root.push(attributes); 11721 } 11722 } 11723 class BookmarkEnd extends XmlComponent { 11724 constructor(linkId) { 11725 super("w:bookmarkEnd"); 11726 const attributes = new BookmarkEndAttributes({ 11727 id: linkId 11728 }); 11729 this.root.push(attributes); 11730 } 11731 } 11732 class OutlineLevel extends XmlComponent { 11733 constructor(level) { 11734 super("w:outlineLvl"); 11735 this.level = level; 11736 this.root.push( 11737 new Attributes({ 11738 val: level 11739 }) 11740 ); 11741 } 11742 } 11743 class PageReferenceFieldInstruction extends XmlComponent { 11744 constructor(bookmarkId, options2 = {}) { 11745 super("w:instrText"); 11746 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 11747 let instruction = `PAGEREF ${bookmarkId}`; 11748 if (options2.hyperlink) { 11749 instruction = `${instruction} \\h`; 11750 } 11751 if (options2.useRelativePosition) { 11752 instruction = `${instruction} \\p`; 11753 } 11754 this.root.push(instruction); 11755 } 11756 } 11757 class PageReference extends Run { 11758 constructor(bookmarkId, options2 = {}) { 11759 super({ 11760 children: [new Begin(true), new PageReferenceFieldInstruction(bookmarkId, options2), new End()] 11761 }); 11762 } 11763 } 11764 const VerticalAlign = { 11765 BOTTOM: "bottom", 11766 CENTER: "center", 11767 TOP: "top" 11768 }; 11769 class VerticalAlignAttributes extends XmlAttributeComponent { 11770 constructor() { 11771 super(...arguments); 11772 __publicField(this, "xmlKeys", { 11773 verticalAlign: "w:val" 11774 }); 11775 } 11776 } 11777 class VerticalAlignElement extends XmlComponent { 11778 constructor(value) { 11779 super("w:vAlign"); 11780 this.root.push(new VerticalAlignAttributes({ verticalAlign: value })); 11781 } 11782 } 11783 const HeaderFooterReferenceType = { 11784 DEFAULT: "default", 11785 FIRST: "first", 11786 EVEN: "even" 11787 }; 11788 class FooterReferenceAttributes extends XmlAttributeComponent { 11789 constructor() { 11790 super(...arguments); 11791 __publicField(this, "xmlKeys", { 11792 type: "w:type", 11793 id: "r:id" 11794 }); 11795 } 11796 } 11797 const HeaderFooterType = { 11798 HEADER: "w:headerReference", 11799 FOOTER: "w:footerReference" 11800 }; 11801 class HeaderFooterReference extends XmlComponent { 11802 constructor(type, options2) { 11803 super(type); 11804 this.root.push( 11805 new FooterReferenceAttributes({ 11806 type: options2.type || HeaderFooterReferenceType.DEFAULT, 11807 id: `rId${options2.id}` 11808 }) 11809 ); 11810 } 11811 } 11812 class Columns extends XmlComponent { 11813 constructor({ space, count, separate, equalWidth, children }) { 11814 super("w:cols"); 11815 this.root.push( 11816 new NextAttributeComponent({ 11817 space: { key: "w:space", value: space === void 0 ? void 0 : twipsMeasureValue(space) }, 11818 count: { key: "w:num", value: count === void 0 ? void 0 : decimalNumber(count) }, 11819 separate: { key: "w:sep", value: separate }, 11820 equalWidth: { key: "w:equalWidth", value: equalWidth } 11821 }) 11822 ); 11823 if (!equalWidth && children) {
11824 children.forEach((column) => this.addChildElement(column)); 11825 } 11826 } 11827 } 11828 const DocumentGridType = { 11829 DEFAULT: "default", 11830 LINES: "lines", 11831 LINES_AND_CHARS: "linesAndChars", 11832 SNAP_TO_CHARS: "snapToChars" 11833 }; 11834 class DocGridAttributes extends XmlAttributeComponent { 11835 constructor() { 11836 super(...arguments); 11837 __publicField(this, "xmlKeys", { 11838 type: "w:type", 11839 linePitch: "w:linePitch", 11840 charSpace: "w:charSpace" 11841 }); 11842 } 11843 } 11844 class DocumentGrid extends XmlComponent { 11845 constructor(linePitch, charSpace, type) { 11846 super("w:docGrid"); 11847 this.root.push( 11848 new DocGridAttributes({ 11849 type, 11850 linePitch: decimalNumber(linePitch), 11851 charSpace: charSpace ? decimalNumber(charSpace) : void 0 11852 }) 11853 ); 11854 } 11855 } 11856 const LineNumberRestartFormat = { 11857 NEW_PAGE: "newPage", 11858 NEW_SECTION: "newSection", 11859 CONTINUOUS: "continuous" 11860 }; 11861 const createLineNumberType = ({ countBy, start, restart, distance }) => new BuilderElement({ 11862 name: "w:lnNumType", 11863 attributes: { 11864 countBy: { key: "w:countBy", value: countBy === void 0 ? void 0 : decimalNumber(countBy) }, 11865 start: { key: "w:start", value: start === void 0 ? void 0 : decimalNumber(start) }, 11866 restart: { key: "w:restart", value: restart }, 11867 distance: { 11868 key: "w:distance", 11869 value: distance === void 0 ? void 0 : twipsMeasureValue(distance) 11870 } 11871 } 11872 }); 11873 const PageBorderDisplay = { 11874 ALL_PAGES: "allPages", 11875 FIRST_PAGE: "firstPage", 11876 NOT_FIRST_PAGE: "notFirstPage" 11877 }; 11878 const PageBorderOffsetFrom = { 11879 PAGE: "page", 11880 TEXT: "text" 11881 }; 11882 const PageBorderZOrder = { 11883 BACK: "back", 11884 FRONT: "front" 11885 }; 11886 class PageBordersAttributes extends XmlAttributeComponent { 11887 constructor() { 11888 super(...arguments); 11889 __publicField(this, "xmlKeys", { 11890 display: "w:display", 11891 offsetFrom: "w:offsetFrom", 11892 zOrder: "w:zOrder" 11893 }); 11894 } 11895 } 11896 class PageBorders extends IgnoreIfEmptyXmlComponent { 11897 constructor(options2) { 11898 super("w:pgBorders"); 11899 if (!options2) { 11900 return this; 11901 } 11902 if (options2.pageBorders) { 11903 this.root.push( 11904 new PageBordersAttributes({ 11905 display: options2.pageBorders.display, 11906 offsetFrom: options2.pageBorders.offsetFrom, 11907 zOrder: options2.pageBorders.zOrder 11908 }) 11909 ); 11910 } else { 11911 this.root.push(new PageBordersAttributes({})); 11912 } 11913 if (options2.pageBorderTop) { 11914 this.root.push(new BorderElement("w:top", options2.pageBorderTop)); 11915 } 11916 if (options2.pageBorderLeft) { 11917 this.root.push(new BorderElement("w:left", options2.pageBorderLeft)); 11918 } 11919 if (options2.pageBorderBottom) { 11920 this.root.push(new BorderElement("w:bottom", options2.pageBorderBottom)); 11921 } 11922 if (options2.pageBorderRight) { 11923 this.root.push(new BorderElement("w:right", options2.pageBorderRight)); 11924 } 11925 } 11926 } 11927 class PageMargin extends XmlComponent { 11928 constructor(top, right, bottom, left, header, footer, gutter) { 11929 super("w:pgMar"); 11930 this.root.push( 11931 new NextAttributeComponent({ 11932 top: { key: "w:top", value: signedTwipsMeasureValue(top) }, 11933 right: { key: "w:right", value: twipsMeasureValue(right) }, 11934 bottom: { key: "w:bottom", value: signedTwipsMeasureValue(bottom) }, 11935 left: { key: "w:left", value: twipsMeasureValue(left) }, 11936 header: { key: "w:header", value: twipsMeasureValue(header) }, 11937 footer: { key: "w:footer", value: twipsMeasureValue(footer) }, 11938 gutter: { key: "w:gutter", value: twipsMeasureValue(gutter) } 11939 }) 11940 ); 11941 } 11942 } 11943 const PageNumberSeparator = { 11944 HYPHEN: "hyphen", 11945 PERIOD: "period", 11946 COLON: "colon", 11947 EM_DASH: "emDash", 11948 EN_DASH: "endash" 11949 }; 11950 class PageNumberTypeAttributes extends XmlAttributeComponent { 11951 constructor() { 11952 super(...arguments); 11953 __publicField(this, "xmlKeys", { 11954 start: "w:start", 11955 formatType: "w:fmt", 11956 separator: "w:chapSep" 11957 }); 11958 } 11959 } 11960 class PageNumberType extends XmlComponent { 11961 constructor({ start, formatType, separator }) { 11962 super("w:pgNumType"); 11963 this.root.push( 11964 new PageNumberTypeAttributes({ 11965 start: start === void 0 ? void 0 : decimalNumber(start), 11966 formatType, 11967 separator 11968 }) 11969 ); 11970 } 11971 } 11972 const PageOrientation = { 11973 PORTRAIT: "portrait", 11974 LANDSCAPE: "landscape" 11975 }; 11976 class PageSize extends XmlComponent { 11977 constructor(width, height, orientation) { 11978 super("w:pgSz"); 11979 const flip = orientation === PageOrientation.LANDSCAPE; 11980 const widthTwips = twipsMeasureValue(width); 11981 const heightTwips = twipsMeasureValue(height); 11982 this.root.push( 11983 new NextAttributeComponent({ 11984 width: { key: "w:w", value: flip ? heightTwips : widthTwips }, 11985 height: { key: "w:h", value: flip ? widthTwips : heightTwips }, 11986 orientation: { key: "w:orient", value: orientation } 11987 }) 11988 ); 11989 } 11990 } 11991 const PageTextDirectionType = { 11992 LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb", 11993 TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl" 11994 }; 11995 class PageTextDirectionAttributes extends XmlAttributeComponent { 11996 constructor() { 11997 super(...arguments); 11998 __publicField(this, "xmlKeys", { val: "w:val" }); 11999 } 12000 } 12001 class PageTextDirection extends XmlComponent { 12002 constructor(value) { 12003 super("w:textDirection"); 12004 this.root.push( 12005 new PageTextDirectionAttributes({ 12006 val: value 12007 }) 12008 ); 12009 } 12010 } 12011 const SectionType = { 12012 NEXT_PAGE: "nextPage",
12013 NEXT_COLUMN: "nextColumn", 12014 CONTINUOUS: "continuous", 12015 EVEN_PAGE: "evenPage", 12016 ODD_PAGE: "oddPage" 12017 }; 12018 class SectionTypeAttributes extends XmlAttributeComponent { 12019 constructor() { 12020 super(...arguments); 12021 __publicField(this, "xmlKeys", { 12022 val: "w:val" 12023 }); 12024 } 12025 } 12026 class Type extends XmlComponent { 12027 constructor(value) { 12028 super("w:type"); 12029 this.root.push(new SectionTypeAttributes({ val: value })); 12030 } 12031 } 12032 const sectionMarginDefaults = { 12033 TOP: 1440, 12034 RIGHT: 1440, 12035 BOTTOM: 1440, 12036 LEFT: 1440, 12037 HEADER: 708, 12038 FOOTER: 708, 12039 GUTTER: 0 12040 }; 12041 const sectionPageSizeDefaults = { 12042 WIDTH: 11906, 12043 HEIGHT: 16838, 12044 ORIENTATION: PageOrientation.PORTRAIT 12045 }; 12046 class SectionProperties extends XmlComponent { 12047 constructor({ 12048 page: { 12049 size: { 12050 width = sectionPageSizeDefaults.WIDTH, 12051 height = sectionPageSizeDefaults.HEIGHT, 12052 orientation = sectionPageSizeDefaults.ORIENTATION 12053 } = {}, 12054 margin: { 12055 top = sectionMarginDefaults.TOP, 12056 right = sectionMarginDefaults.RIGHT, 12057 bottom = sectionMarginDefaults.BOTTOM, 12058 left = sectionMarginDefaults.LEFT, 12059 header = sectionMarginDefaults.HEADER, 12060 footer = sectionMarginDefaults.FOOTER, 12061 gutter = sectionMarginDefaults.GUTTER 12062 } = {}, 12063 pageNumbers = {}, 12064 borders, 12065 textDirection 12066 } = {}, 12067 grid: { linePitch = 360, charSpace, type: gridType } = {}, 12068 headerWrapperGroup = {}, 12069 footerWrapperGroup = {}, 12070 lineNumbers, 12071 titlePage, 12072 verticalAlign, 12073 column, 12074 type 12075 } = {}) { 12076 super("w:sectPr"); 12077 this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup); 12078 this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup); 12079 if (type) { 12080 this.root.push(new Type(type)); 12081 } 12082 this.root.push(new PageSize(width, height, orientation)); 12083 this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter)); 12084 if (borders) { 12085 this.root.push(new PageBorders(borders)); 12086 } 12087 if (lineNumbers) { 12088 this.root.push(createLineNumberType(lineNumbers)); 12089 } 12090 this.root.push(new PageNumberType(pageNumbers)); 12091 if (column) { 12092 this.root.push(new Columns(column)); 12093 } 12094 if (verticalAlign) { 12095 this.root.push(new VerticalAlignElement(verticalAlign)); 12096 } 12097 if (titlePage !== void 0) { 12098 this.root.push(new OnOffElement("w:titlePg", titlePage)); 12099 } 12100 if (textDirection) { 12101 this.root.push(new PageTextDirection(textDirection)); 12102 } 12103 this.root.push(new DocumentGrid(linePitch, charSpace, gridType)); 12104 } 12105 addHeaderFooterGroup(type, group) { 12106 if (group.default) { 12107 this.root.push( 12108 new HeaderFooterReference(type, { 12109 type: HeaderFooterReferenceType.DEFAULT, 12110 id: group.default.View.ReferenceId 12111 }) 12112 ); 12113 } 12114 if (group.first) { 12115 this.root.push( 12116 new HeaderFooterReference(type, { 12117 type: HeaderFooterReferenceType.FIRST, 12118 id: group.first.View.ReferenceId 12119 }) 12120 ); 12121 } 12122 if (group.even) { 12123 this.root.push( 12124 new HeaderFooterReference(type, { 12125 type: HeaderFooterReferenceType.EVEN, 12126 id: group.even.View.ReferenceId 12127 }) 12128 ); 12129 } 12130 } 12131 } 12132 class Body extends XmlComponent { 12133 constructor() { 12134 super("w:body"); 12135 // eslint-disable-next-line functional/prefer-readonly-type 12136 __publicField(this, "sections", []); 12137 } 12138 /** 12139 * Adds new section properties. 12140 * Note: Previous section is created in paragraph after the current element, and then new section will be added. 12141 * The spec says: 12142 * - section element should be in the last paragraph of the section 12143 * - last section should be direct child of body 12144 * 12145 * @param options new section options 12146 */ 12147 addSection(options2) { 12148 const currentSection = this.sections.pop(); 12149 this.root.push(this.createSectionParagraph(currentSection)); 12150 this.sections.push(new SectionProperties(options2)); 12151 } 12152 prepForXml(context) { 12153 if (this.sections.length === 1) { 12154 this.root.splice(0, 1); 12155 this.root.push(this.sections.pop()); 12156 } 12157 return super.prepForXml(context); 12158 } 12159 push(component) { 12160 this.root.push(component); 12161 } 12162 createSectionParagraph(section) { 12163 const paragraph = new Paragraph({}); 12164 const properties = new ParagraphProperties({}); 12165 properties.push(section); 12166 paragraph.addChildElement(properties); 12167 return paragraph; 12168 } 12169 } 12170 class Column extends XmlComponent { 12171 constructor({ width, space }) { 12172 super("w:col"); 12173 this.root.push( 12174 new NextAttributeComponent({ 12175 width: { key: "w:w", value: twipsMeasureValue(width) }, 12176 space: { key: "w:space", value: space === void 0 ? void 0 : twipsMeasureValue(space) } 12177 }) 12178 ); 12179 } 12180 } 12181 class DocumentAttributes extends XmlAttributeComponent { 12182 constructor() { 12183 super(...arguments); 12184 __publicField(this, "xmlKeys", { 12185 wpc: "xmlns:wpc", 12186 mc: "xmlns:mc", 12187 o: "xmlns:o", 12188 r: "xmlns:r", 12189 m: "xmlns:m", 12190 v: "xmlns:v", 12191 wp14: "xmlns:wp14", 12192 wp: "xmlns:wp", 12193 w10: "xmlns:w10", 12194 w: "xmlns:w", 12195 w14: "xmlns:w14", 12196 w15: "xmlns:w15", 12197 wpg: "xmlns:wpg", 12198 wpi: "xmlns:wpi", 12199 wne: "xmlns:wne", 12200 wps: "xmlns:wps", 12201 Ignorable: "mc:Ignorable", 12202 cp: "xmlns:cp", 12203 dc: "xmlns:dc", 12204 dcterms: "xmlns:dcterms", 12205 dcmitype: "xmlns:dcmitype", 12206 xsi: "xmlns:xsi", 12207 type: "xsi:type", 12208 cx: "xmlns:cx", 12209 cx1: "xmlns:cx1", 12210 cx2: "xmlns:cx2", 12211 cx3: "xmlns:cx3", 12212 cx4: "xmlns:cx4", 12213 cx5: "xmlns:cx5", 12214 cx6: "xmlns:cx6", 12215 cx7: "xmlns:cx7", 12216 cx8: "xmlns:cx8", 12217 aink: "xmlns:aink", 12218 am3d: "xmlns:am3d", 12219 w16cex: "xmlns:w16cex", 12220 w16cid: "xmlns:w16cid", 12221 w16: "xmlns:w16", 12222 w16sdtdh: "xmlns:w16sdtdh", 12223 w16se: "xmlns:w16se" 12224 }); 12225 } 12226 }
12227 class DocumentBackgroundAttributes extends XmlAttributeComponent { 12228 constructor() { 12229 super(...arguments); 12230 __publicField(this, "xmlKeys", { 12231 color: "w:color", 12232 themeColor: "w:themeColor", 12233 themeShade: "w:themeShade", 12234 themeTint: "w:themeTint" 12235 }); 12236 } 12237 } 12238 class DocumentBackground extends XmlComponent { 12239 constructor(options2) { 12240 super("w:background"); 12241 this.root.push( 12242 new DocumentBackgroundAttributes({ 12243 color: options2.color === void 0 ? void 0 : hexColorValue(options2.color), 12244 themeColor: options2.themeColor, 12245 themeShade: options2.themeShade === void 0 ? void 0 : uCharHexNumber(options2.themeShade), 12246 themeTint: options2.themeTint === void 0 ? void 0 : uCharHexNumber(options2.themeTint) 12247 }) 12248 ); 12249 } 12250 } 12251 class Document extends XmlComponent { 12252 constructor(options2) { 12253 super("w:document"); 12254 __publicField(this, "body"); 12255 this.root.push( 12256 new DocumentAttributes({ 12257 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 12258 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 12259 o: "urn:schemas-microsoft-com:office:office", 12260 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 12261 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 12262 v: "urn:schemas-microsoft-com:vml", 12263 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 12264 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 12265 w10: "urn:schemas-microsoft-com:office:word", 12266 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 12267 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 12268 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 12269 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 12270 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 12271 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 12272 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 12273 cx: "http://schemas.microsoft.com/office/drawing/2014/chartex", 12274 cx1: "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex", 12275 cx2: "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex", 12276 cx3: "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex", 12277 cx4: "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex", 12278 cx5: "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex", 12279 cx6: "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex", 12280 cx7: "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex", 12281 cx8: "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex", 12282 aink: "http://schemas.microsoft.com/office/drawing/2016/ink", 12283 am3d: "http://schemas.microsoft.com/office/drawing/2017/model3d", 12284 w16cex: "http://schemas.microsoft.com/office/word/2018/wordml/cex", 12285 w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid", 12286 w16: "http://schemas.microsoft.com/office/word/2018/wordml", 12287 w16sdtdh: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash", 12288 w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex", 12289 Ignorable: "w14 w15 wp14" 12290 }) 12291 ); 12292 this.body = new Body(); 12293 if (options2.background) { 12294 this.root.push(new DocumentBackground(options2.background)); 12295 } 12296 this.root.push(this.body); 12297 } 12298 add(item) { 12299 this.body.push(item); 12300 return this; 12301 } 12302 get Body() { 12303 return this.body; 12304 } 12305 } 12306 class RelationshipsAttributes extends XmlAttributeComponent { 12307 constructor() { 12308 super(...arguments); 12309 __publicField(this, "xmlKeys", { 12310 xmlns: "xmlns" 12311 }); 12312 } 12313 } 12314 class Relationships extends XmlComponent { 12315 constructor() { 12316 super("Relationships"); 12317 this.root.push( 12318 new RelationshipsAttributes({ 12319 xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" 12320 }) 12321 ); 12322 } 12323 createRelationship(id, type, target, targetMode) { 12324 const relationship = new Relationship(`rId${id}`, type, target, targetMode);
12325 this.root.push(relationship); 12326 return relationship; 12327 } 12328 get RelationshipCount() { 12329 return this.root.length - 1; 12330 } 12331 } 12332 class DocumentWrapper { 12333 constructor(options2) { 12334 __publicField(this, "document"); 12335 __publicField(this, "relationships"); 12336 this.document = new Document(options2); 12337 this.relationships = new Relationships(); 12338 } 12339 get View() { 12340 return this.document; 12341 } 12342 get Relationships() { 12343 return this.relationships; 12344 } 12345 } 12346 class WordWrapAttributes extends XmlAttributeComponent { 12347 constructor() { 12348 super(...arguments); 12349 __publicField(this, "xmlKeys", { val: "w:val" }); 12350 } 12351 } 12352 class WordWrap extends XmlComponent { 12353 constructor() { 12354 super("w:wordWrap"); 12355 this.root.push(new WordWrapAttributes({ val: 0 })); 12356 } 12357 } 12358 const DropCapType = { 12359 NONE: "none", 12360 DROP: "drop", 12361 MARGIN: "margin" 12362 }; 12363 const FrameAnchorType = { 12364 MARGIN: "margin", 12365 PAGE: "page", 12366 TEXT: "text" 12367 }; 12368 const FrameWrap = { 12369 AROUND: "around", 12370 AUTO: "auto", 12371 NONE: "none", 12372 // eslint-disable-next-line @typescript-eslint/naming-convention 12373 NOT_BESIDE: "notBeside", 12374 THROUGH: "through", 12375 TIGHT: "tight" 12376 }; 12377 const createFrameProperties = (options2) => { 12378 var _a, _b; 12379 return new BuilderElement({ 12380 name: "w:framePr", 12381 attributes: { 12382 anchorLock: { 12383 key: "w:anchorLock", 12384 value: options2.anchorLock 12385 }, 12386 dropCap: { 12387 key: "w:dropCap", 12388 value: options2.dropCap 12389 }, 12390 width: { 12391 key: "w:w", 12392 value: options2.width 12393 }, 12394 height: { 12395 key: "w:h", 12396 value: options2.height 12397 }, 12398 x: { 12399 key: "w:x", 12400 value: options2.position ? options2.position.x : void 0 12401 }, 12402 y: { 12403 key: "w:y", 12404 value: options2.position ? options2.position.y : void 0 12405 }, 12406 anchorHorizontal: { 12407 key: "w:hAnchor", 12408 value: options2.anchor.horizontal 12409 }, 12410 anchorVertical: { 12411 key: "w:vAnchor", 12412 value: options2.anchor.vertical 12413 }, 12414 spaceHorizontal: { 12415 key: "w:hSpace", 12416 value: (_a = options2.space) == null ? void 0 : _a.horizontal 12417 }, 12418 spaceVertical: { 12419 key: "w:vSpace", 12420 value: (_b = options2.space) == null ? void 0 : _b.vertical 12421 }, 12422 rule: { 12423 key: "w:hRule", 12424 value: options2.rule 12425 }, 12426 alignmentX: { 12427 key: "w:xAlign", 12428 value: options2.alignment ? options2.alignment.x : void 0 12429 }, 12430 alignmentY: { 12431 key: "w:yAlign", 12432 value: options2.alignment ? options2.alignment.y : void 0 12433 }, 12434 lines: { 12435 key: "w:lines", 12436 value: options2.lines 12437 }, 12438 wrap: { 12439 key: "w:wrap", 12440 value: options2.wrap 12441 } 12442 } 12443 }); 12444 }; 12445 class ParagraphProperties extends IgnoreIfEmptyXmlComponent { 12446 constructor(options2) { 12447 var _a, _b; 12448 super("w:pPr"); 12449 // eslint-disable-next-line functional/prefer-readonly-type 12450 __publicField(this, "numberingReferences", []); 12451 if (!options2) { 12452 return this; 12453 } 12454 if (options2.heading) { 12455 this.push(new Style$1(options2.heading)); 12456 } 12457 if (options2.bullet) { 12458 this.push(new Style$1("ListParagraph")); 12459 } 12460 if (options2.numbering) { 12461 if (!options2.style && !options2.heading) { 12462 if (!options2.numbering.custom) { 12463 this.push(new Style$1("ListParagraph")); 12464 } 12465 } 12466 } 12467 if (options2.style) { 12468 this.push(new Style$1(options2.style)); 12469 } 12470 if (options2.keepNext !== void 0) { 12471 this.push(new OnOffElement("w:keepNext", options2.keepNext)); 12472 } 12473 if (options2.keepLines !== void 0) { 12474 this.push(new OnOffElement("w:keepLines", options2.keepLines)); 12475 } 12476 if (options2.pageBreakBefore) { 12477 this.push(new PageBreakBefore()); 12478 } 12479 if (options2.frame) { 12480 this.push(createFrameProperties(options2.frame)); 12481 } 12482 if (options2.widowControl !== void 0) { 12483 this.push(new OnOffElement("w:widowControl", options2.widowControl)); 12484 } 12485 if (options2.bullet) { 12486 this.push(new NumberProperties(1, options2.bullet.level)); 12487 } 12488 if (options2.numbering) { 12489 this.numberingReferences.push({ 12490 reference: options2.numbering.reference, 12491 instance: (_a = options2.numbering.instance) != null ? _a : 0 12492 }); 12493 this.push(new NumberProperties(`${options2.numbering.reference}-${(_b = options2.numbering.instance) != null ? _b : 0}`, options2.numbering.level)); 12494 } 12495 if (options2.border) { 12496 this.push(new Border(options2.border)); 12497 } 12498 if (options2.thematicBreak) { 12499 this.push(new ThematicBreak()); 12500 } 12501 if (options2.shading) { 12502 this.push(new Shading(options2.shading)); 12503 } 12504 if (options2.wordWrap) { 12505 this.push(new WordWrap()); 12506 } 12507 if (options2.overflowPunctuation) { 12508 this.push(new OnOffElement("w:overflowPunct", options2.overflowPunctuation)); 12509 } 12510 const tabDefinitions = [ 12511 ...options2.rightTabStop !== void 0 ? [{ type: TabStopType.RIGHT, position: options2.rightTabStop }] : [], 12512 ...options2.tabStops ? options2.tabStops : [], 12513 ...options2.leftTabStop !== void 0 ? [{ type: TabStopType.LEFT, position: options2.leftTabStop }] : [] 12514 ]; 12515 if (tabDefinitions.length > 0) { 12516 this.push(new TabStop(tabDefinitions)); 12517 } 12518 if (options2.bidirectional !== void 0) { 12519 this.push(new OnOffElement("w:bidi", options2.bidirectional)); 12520 } 12521 if (options2.spacing) { 12522 this.push(new Spacing(options2.spacing)); 12523 } 12524 if (options2.indent) { 12525 this.push(new Indent(options2.indent)); 12526 } 12527 if (options2.contextualSpacing !== void 0) { 12528 this.push(new OnOffElement("w:contextualSpacing", options2.contextualSpacing)); 12529 } 12530 if (options2.alignment) { 12531 this.push(new Alignment(options2.alignment)); 12532 } 12533 if (options2.outlineLevel !== void 0) { 12534 this.push(new OutlineLevel(options2.outlineLevel)); 12535 } 12536 if (options2.suppressLineNumbers !== void 0) { 12537 this.push(new OnOffElement("w:suppressLineNumbers", options2.suppressLineNumbers)); 12538 } 12539 if (options2.autoSpaceEastAsianText !== void 0) { 12540 this.push(new OnOffElement("w:autoSpaceDN", options2.autoSpaceEastAsianText)); 12541 } 12542 if (options2.run) { 12543 this.push(new RunProperties(options2.run)); 12544 } 12545 } 12546 push(item) { 12547 this.root.push(item); 12548 } 12549 prepForXml(context) { 12550 if (context.viewWrapper instanceof DocumentWrapper) { 12551 for (const reference of this.numberingReferences) { 12552 context.file.Numbering.createConcreteNumberingInstance(reference.reference, reference.instance); 12553 } 12554 } 12555 return super.prepForXml(context); 12556 } 12557 } 12558 class Paragraph extends FileChild { 12559 constructor(options2) { 12560 super("w:p"); 12561 __publicField(this, "properties"); 12562 if (typeof options2 === "string") { 12563 this.properties = new ParagraphProperties({}); 12564 this.root.push(this.properties); 12565 this.root.push(new TextRun(options2)); 12566 return this; 12567 } 12568 this.properties = new ParagraphProperties(options2); 12569 this.root.push(this.properties); 12570 if (options2.text) { 12571 this.root.push(new TextRun(options2.text)); 12572 } 12573 if (options2.children) { 12574 for (const child of options2.children) { 12575 if (child instanceof Bookmark) { 12576 this.root.push(child.start);
12577 for (const textRun of child.children) { 12578 this.root.push(textRun); 12579 } 12580 this.root.push(child.end); 12581 continue; 12582 } 12583 this.root.push(child); 12584 } 12585 } 12586 } 12587 prepForXml(context) { 12588 for (const element2 of this.root) { 12589 if (element2 instanceof ExternalHyperlink) { 12590 const index = this.root.indexOf(element2); 12591 const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId()); 12592 context.viewWrapper.Relationships.createRelationship( 12593 concreteHyperlink.linkId, 12594 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", 12595 element2.options.link, 12596 TargetModeType.EXTERNAL 12597 ); 12598 this.root[index] = concreteHyperlink; 12599 } 12600 } 12601 return super.prepForXml(context); 12602 } 12603 addRunToFront(run) { 12604 this.root.splice(1, 0, run); 12605 return this; 12606 } 12607 } 12608 let Math$1 = class Math extends XmlComponent { 12609 constructor(options2) { 12610 super("m:oMath"); 12611 for (const child of options2.children) { 12612 this.root.push(child); 12613 } 12614 } 12615 }; 12616 class MathText extends XmlComponent { 12617 constructor(text) { 12618 super("m:t"); 12619 this.root.push(text); 12620 } 12621 } 12622 class MathRun extends XmlComponent { 12623 constructor(text) { 12624 super("m:r"); 12625 this.root.push(new MathText(text)); 12626 } 12627 } 12628 class MathDenominator extends XmlComponent { 12629 constructor(children) { 12630 super("m:den"); 12631 for (const child of children) { 12632 this.root.push(child); 12633 } 12634 } 12635 } 12636 class MathNumerator extends XmlComponent { 12637 constructor(children) { 12638 super("m:num"); 12639 for (const child of children) { 12640 this.root.push(child); 12641 } 12642 } 12643 } 12644 class MathFraction extends XmlComponent { 12645 constructor(options2) { 12646 super("m:f"); 12647 this.root.push(new MathNumerator(options2.numerator)); 12648 this.root.push(new MathDenominator(options2.denominator)); 12649 } 12650 } 12651 class MathAccentCharacterAttributes extends XmlAttributeComponent { 12652 constructor() { 12653 super(...arguments); 12654 __publicField(this, "xmlKeys", { accent: "m:val" }); 12655 } 12656 } 12657 class MathAccentCharacter extends XmlComponent { 12658 constructor(accent) { 12659 super("m:chr"); 12660 this.root.push(new MathAccentCharacterAttributes({ accent })); 12661 } 12662 } 12663 class MathBase extends XmlComponent { 12664 constructor(children) { 12665 super("m:e"); 12666 for (const child of children) { 12667 this.root.push(child); 12668 } 12669 } 12670 } 12671 class MathLimitLocationAttributes extends XmlAttributeComponent { 12672 constructor() { 12673 super(...arguments); 12674 __publicField(this, "xmlKeys", { value: "m:val" }); 12675 } 12676 } 12677 class MathLimitLocation extends XmlComponent { 12678 constructor() { 12679 super("m:limLoc"); 12680 this.root.push(new MathLimitLocationAttributes({ value: "undOvr" })); 12681 } 12682 } 12683 class MathSubScriptHideAttributes extends XmlAttributeComponent { 12684 constructor() { 12685 super(...arguments); 12686 __publicField(this, "xmlKeys", { hide: "m:val" }); 12687 } 12688 } 12689 class MathSubScriptHide extends XmlComponent { 12690 constructor() { 12691 super("m:subHide"); 12692 this.root.push(new MathSubScriptHideAttributes({ hide: 1 })); 12693 } 12694 } 12695 class MathSuperScriptHideAttributes extends XmlAttributeComponent { 12696 constructor() { 12697 super(...arguments); 12698 __publicField(this, "xmlKeys", { hide: "m:val" }); 12699 } 12700 } 12701 class MathSuperScriptHide extends XmlComponent { 12702 constructor() { 12703 super("m:supHide"); 12704 this.root.push(new MathSuperScriptHideAttributes({ hide: 1 })); 12705 } 12706 } 12707 class MathNAryProperties extends XmlComponent { 12708 constructor(accent, hasSuperScript, hasSubScript) { 12709 super("m:naryPr"); 12710 if (!!accent) { 12711 this.root.push(new MathAccentCharacter(accent)); 12712 } 12713 this.root.push(new MathLimitLocation()); 12714 if (!hasSuperScript) { 12715 this.root.push(new MathSuperScriptHide()); 12716 } 12717 if (!hasSubScript) { 12718 this.root.push(new MathSubScriptHide()); 12719 } 12720 } 12721 } 12722 class MathSubScriptElement extends XmlComponent { 12723 constructor(children) { 12724 super("m:sub"); 12725 for (const child of children) { 12726 this.root.push(child); 12727 } 12728 } 12729 } 12730 class MathSuperScriptElement extends XmlComponent { 12731 constructor(children) { 12732 super("m:sup"); 12733 for (const child of children) { 12734 this.root.push(child); 12735 } 12736 } 12737 } 12738 class MathSum extends XmlComponent { 12739 constructor(options2) { 12740 super("m:nary"); 12741 this.root.push(new MathNAryProperties("â", !!options2.superScript, !!options2.subScript)); 12742 if (!!options2.subScript) { 12743 this.root.push(new MathSubScriptElement(options2.subScript)); 12744 } 12745 if (!!options2.superScript) { 12746 this.root.push(new MathSuperScriptElement(options2.superScript)); 12747 } 12748 this.root.push(new MathBase(options2.children)); 12749 } 12750 } 12751 class MathIntegral extends XmlComponent { 12752 constructor(options2) { 12753 super("m:nary"); 12754 this.root.push(new MathNAryProperties("", !!options2.superScript, !!options2.subScript)); 12755 if (!!options2.subScript) { 12756 this.root.push(new MathSubScriptElement(options2.subScript)); 12757 } 12758 if (!!options2.superScript) { 12759 this.root.push(new MathSuperScriptElement(options2.superScript)); 12760 } 12761 this.root.push(new MathBase(options2.children)); 12762 } 12763 } 12764 class MathSuperScriptProperties extends XmlComponent { 12765 constructor() { 12766 super("m:sSupPr"); 12767 } 12768 } 12769 class MathSuperScript extends XmlComponent { 12770 constructor(options2) { 12771 super("m:sSup"); 12772 this.root.push(new MathSuperScriptProperties()); 12773 this.root.push(new MathBase(options2.children)); 12774 this.root.push(new MathSuperScriptElement(options2.superScript)); 12775 } 12776 } 12777 class MathSubScriptProperties extends XmlComponent { 12778 constructor() { 12779 super("m:sSubPr"); 12780 } 12781 } 12782 class MathSubScript extends XmlComponent { 12783 constructor(options2) { 12784 super("m:sSub"); 12785 this.root.push(new MathSubScriptProperties()); 12786 this.root.push(new MathBase(options2.children)); 12787 this.root.push(new MathSubScriptElement(options2.subScript)); 12788 } 12789 } 12790 class MathSubSuperScriptProperties extends XmlComponent { 12791 constructor() { 12792 super("m:sSubSupPr"); 12793 } 12794 } 12795 class MathSubSuperScript extends XmlComponent { 12796 constructor(options2) { 12797 super("m:sSubSup"); 12798 this.root.push(new MathSubSuperScriptProperties()); 12799 this.root.push(new MathBase(options2.children)); 12800 this.root.push(new MathSubScriptElement(options2.subScript)); 12801 this.root.push(new MathSuperScriptElement(options2.superScript)); 12802 } 12803 } 12804 class MathPreSubSuperScriptProperties extends XmlComponent { 12805 constructor() { 12806 super("m:sPrePr"); 12807 } 12808 } 12809 class MathPreSubSuperScript extends XmlComponent { 12810 constructor(options2) { 12811 super("m:sPre"); 12812 this.root.push(new MathPreSubSuperScriptProperties()); 12813 this.root.push(new MathBase(options2.children)); 12814 this.root.push(new MathSubScriptElement(options2.subScript)); 12815 this.root.push(new MathSuperScriptElement(options2.superScript)); 12816 } 12817 } 12818 const WORKAROUND4 = "";
12819 class MathDegree extends XmlComponent { 12820 constructor(children) { 12821 super("m:deg"); 12822 if (!!children) { 12823 for (const child of children) { 12824 this.root.push(child); 12825 } 12826 } 12827 } 12828 } 12829 class MathDegreeHideAttributes extends XmlAttributeComponent { 12830 constructor() { 12831 super(...arguments); 12832 __publicField(this, "xmlKeys", { hide: "m:val" }); 12833 } 12834 } 12835 class MathDegreeHide extends XmlComponent { 12836 constructor() { 12837 super("m:degHide"); 12838 this.root.push(new MathDegreeHideAttributes({ hide: 1 })); 12839 } 12840 } 12841 class MathRadicalProperties extends XmlComponent { 12842 constructor(hasDegree) { 12843 super("m:radPr"); 12844 if (!hasDegree) { 12845 this.root.push(new MathDegreeHide()); 12846 } 12847 } 12848 } 12849 class MathRadical extends XmlComponent { 12850 constructor(options2) { 12851 super("m:rad"); 12852 this.root.push(new MathRadicalProperties(!!options2.degree)); 12853 this.root.push(new MathDegree(options2.degree)); 12854 this.root.push(new MathBase(options2.children)); 12855 } 12856 } 12857 class MathFunctionName extends XmlComponent { 12858 constructor(children) { 12859 super("m:fName"); 12860 for (const child of children) { 12861 this.root.push(child); 12862 } 12863 } 12864 } 12865 class MathFunctionProperties extends XmlComponent { 12866 constructor() { 12867 super("m:funcPr"); 12868 } 12869 } 12870 class MathFunction extends XmlComponent { 12871 constructor(options2) { 12872 super("m:func"); 12873 this.root.push(new MathFunctionProperties()); 12874 this.root.push(new MathFunctionName(options2.name)); 12875 this.root.push(new MathBase(options2.children)); 12876 } 12877 } 12878 class MathBeginningCharacterAttributes extends XmlAttributeComponent { 12879 constructor() { 12880 super(...arguments); 12881 __publicField(this, "xmlKeys", { character: "m:val" }); 12882 } 12883 } 12884 class MathBeginningCharacter extends XmlComponent { 12885 constructor(character) { 12886 super("m:begChr"); 12887 this.root.push(new MathBeginningCharacterAttributes({ character })); 12888 } 12889 } 12890 class MathEndingCharacterAttributes extends XmlAttributeComponent { 12891 constructor() { 12892 super(...arguments); 12893 __publicField(this, "xmlKeys", { character: "m:val" }); 12894 } 12895 } 12896 class MathEndingCharacter extends XmlComponent { 12897 constructor(character) { 12898 super("m:endChr"); 12899 this.root.push(new MathEndingCharacterAttributes({ character })); 12900 } 12901 } 12902 class MathBracketProperties extends XmlComponent { 12903 constructor(options2) { 12904 super("m:dPr"); 12905 if (!!options2) { 12906 this.root.push(new MathBeginningCharacter(options2.beginningCharacter)); 12907 this.root.push(new MathEndingCharacter(options2.endingCharacter)); 12908 } 12909 } 12910 } 12911 class MathRoundBrackets extends XmlComponent { 12912 constructor(options2) { 12913 super("m:d"); 12914 this.root.push(new MathBracketProperties()); 12915 this.root.push(new MathBase(options2.children)); 12916 } 12917 } 12918 class MathSquareBrackets extends XmlComponent { 12919 constructor(options2) { 12920 super("m:d"); 12921 this.root.push( 12922 new MathBracketProperties({ 12923 beginningCharacter: "[", 12924 endingCharacter: "]" 12925 }) 12926 ); 12927 this.root.push(new MathBase(options2.children)); 12928 } 12929 } 12930 class MathCurlyBrackets extends XmlComponent { 12931 constructor(options2) { 12932 super("m:d"); 12933 this.root.push( 12934 new MathBracketProperties({ 12935 beginningCharacter: "{", 12936 endingCharacter: "}" 12937 }) 12938 ); 12939 this.root.push(new MathBase(options2.children)); 12940 } 12941 } 12942 class MathAngledBrackets extends XmlComponent { 12943 constructor(options2) { 12944 super("m:d"); 12945 this.root.push( 12946 new MathBracketProperties({ 12947 beginningCharacter: "â©", 12948 endingCharacter: "âª" 12949 }) 12950 ); 12951 this.root.push(new MathBase(options2.children)); 12952 } 12953 } 12954 class TableGrid extends XmlComponent { 12955 constructor(widths) { 12956 super("w:tblGrid"); 12957 for (const width of widths) { 12958 this.root.push(new GridCol(width)); 12959 } 12960 } 12961 } 12962 class GridCol extends XmlComponent { 12963 constructor(width) { 12964 super("w:gridCol"); 12965 if (width !== void 0) { 12966 this.root.push( 12967 new NextAttributeComponent({ 12968 width: { key: "w:w", value: twipsMeasureValue(width) } 12969 }) 12970 ); 12971 } 12972 } 12973 } 12974 const TableCellMarginElementType = { 12975 TABLE: "w:tblCellMar", 12976 // eslint-disable-next-line @typescript-eslint/naming-convention 12977 TABLE_CELL: "w:tcMar" 12978 }; 12979 class TableCellMargin extends IgnoreIfEmptyXmlComponent { 12980 constructor(type, { marginUnitType = WidthType.DXA, top, left, bottom, right }) { 12981 super(type); 12982 if (top !== void 0) { 12983 this.root.push(new TableWidthElement("w:top", { type: marginUnitType, size: top })); 12984 } 12985 if (left !== void 0) { 12986 this.root.push(new TableWidthElement("w:left", { type: marginUnitType, size: left })); 12987 } 12988 if (bottom !== void 0) { 12989 this.root.push(new TableWidthElement("w:bottom", { type: marginUnitType, size: bottom })); 12990 } 12991 if (right !== void 0) { 12992 this.root.push(new TableWidthElement("w:right", { type: marginUnitType, size: right })); 12993 } 12994 } 12995 } 12996 const WidthType = { 12997 /** Auto. */ 12998 AUTO: "auto", 12999 /** Value is in twentieths of a point */ 13000 DXA: "dxa", 13001 /** No (empty) value. */ 13002 NIL: "nil", 13003 /** Value is in percentage. */ 13004 PERCENTAGE: "pct" 13005 }; 13006 class TableWidthElement extends XmlComponent {
13007 constructor(name, { type = WidthType.AUTO, size }) { 13008 super(name); 13009 let tableWidthValue = size; 13010 if (type === WidthType.PERCENTAGE && typeof size === "number") { 13011 tableWidthValue = `${size}%`; 13012 } 13013 this.root.push( 13014 new NextAttributeComponent({ 13015 type: { key: "w:type", value: type }, 13016 size: { key: "w:w", value: measurementOrPercentValue(tableWidthValue) } 13017 }) 13018 ); 13019 } 13020 } 13021 class TableCellBorders extends IgnoreIfEmptyXmlComponent { 13022 constructor(options2) { 13023 super("w:tcBorders"); 13024 if (options2.top) { 13025 this.root.push(new BorderElement("w:top", options2.top)); 13026 } 13027 if (options2.start) { 13028 this.root.push(new BorderElement("w:start", options2.start)); 13029 } 13030 if (options2.left) { 13031 this.root.push(new BorderElement("w:left", options2.left)); 13032 } 13033 if (options2.bottom) { 13034 this.root.push(new BorderElement("w:bottom", options2.bottom)); 13035 } 13036 if (options2.end) { 13037 this.root.push(new BorderElement("w:end", options2.end)); 13038 } 13039 if (options2.right) { 13040 this.root.push(new BorderElement("w:right", options2.right)); 13041 } 13042 } 13043 } 13044 class GridSpanAttributes extends XmlAttributeComponent { 13045 constructor() { 13046 super(...arguments); 13047 __publicField(this, "xmlKeys", { val: "w:val" }); 13048 } 13049 } 13050 class GridSpan extends XmlComponent { 13051 constructor(value) { 13052 super("w:gridSpan"); 13053 this.root.push( 13054 new GridSpanAttributes({ 13055 val: decimalNumber(value) 13056 }) 13057 ); 13058 } 13059 } 13060 const VerticalMergeType = { 13061 /** 13062 * Cell that is merged with upper one. 13063 */ 13064 CONTINUE: "continue", 13065 /** 13066 * Cell that is starting the vertical merge. 13067 */ 13068 RESTART: "restart" 13069 }; 13070 class VerticalMergeAttributes extends XmlAttributeComponent { 13071 constructor() { 13072 super(...arguments); 13073 __publicField(this, "xmlKeys", { val: "w:val" }); 13074 } 13075 } 13076 class VerticalMerge extends XmlComponent { 13077 constructor(value) { 13078 super("w:vMerge"); 13079 this.root.push( 13080 new VerticalMergeAttributes({ 13081 val: value 13082 }) 13083 ); 13084 } 13085 } 13086 const TextDirection = { 13087 // eslint-disable-next-line @typescript-eslint/naming-convention 13088 BOTTOM_TO_TOP_LEFT_TO_RIGHT: "btLr", 13089 // eslint-disable-next-line @typescript-eslint/naming-convention 13090 LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb", 13091 // eslint-disable-next-line @typescript-eslint/naming-convention 13092 TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl" 13093 }; 13094 class TDirectionAttributes extends XmlAttributeComponent { 13095 constructor() { 13096 super(...arguments); 13097 __publicField(this, "xmlKeys", { val: "w:val" }); 13098 } 13099 } 13100 class TDirection extends XmlComponent { 13101 constructor(value) { 13102 super("w:textDirection"); 13103 this.root.push( 13104 new TDirectionAttributes({ 13105 val: value 13106 }) 13107 ); 13108 } 13109 } 13110 class TableCellProperties extends IgnoreIfEmptyXmlComponent { 13111 constructor(options2) { 13112 super("w:tcPr"); 13113 if (options2.width) { 13114 this.root.push(new TableWidthElement("w:tcW", options2.width)); 13115 } 13116 if (options2.columnSpan) { 13117 this.root.push(new GridSpan(options2.columnSpan)); 13118 } 13119 if (options2.verticalMerge) { 13120 this.root.push(new VerticalMerge(options2.verticalMerge)); 13121 } else if (options2.rowSpan && options2.rowSpan > 1) { 13122 this.root.push(new VerticalMerge(VerticalMergeType.RESTART)); 13123 } 13124 if (options2.borders) { 13125 this.root.push(new TableCellBorders(options2.borders)); 13126 } 13127 if (options2.shading) { 13128 this.root.push(new Shading(options2.shading)); 13129 } 13130 if (options2.margins) { 13131 this.root.push(new TableCellMargin(TableCellMarginElementType.TABLE_CELL, options2.margins)); 13132 } 13133 if (options2.textDirection) { 13134 this.root.push(new TDirection(options2.textDirection)); 13135 } 13136 if (options2.verticalAlign) { 13137 this.root.push(new VerticalAlignElement(options2.verticalAlign)); 13138 } 13139 } 13140 } 13141 class TableCell extends XmlComponent { 13142 constructor(options2) { 13143 super("w:tc"); 13144 this.options = options2; 13145 this.root.push(new TableCellProperties(options2)); 13146 for (const child of options2.children) { 13147 this.root.push(child); 13148 } 13149 } 13150 prepForXml(context) { 13151 if (!(this.root[this.root.length - 1] instanceof Paragraph)) { 13152 this.root.push(new Paragraph({})); 13153 } 13154 return super.prepForXml(context); 13155 } 13156 } 13157 const NONE_BORDER = { 13158 style: BorderStyle.NONE, 13159 size: 0, 13160 color: "auto" 13161 }; 13162 const DEFAULT_BORDER = { 13163 style: BorderStyle.SINGLE, 13164 size: 4, 13165 color: "auto" 13166 }; 13167 class TableBorders extends XmlComponent { 13168 constructor(options2) { 13169 super("w:tblBorders"); 13170 if (options2.top) { 13171 this.root.push(new BorderElement("w:top", options2.top)); 13172 } else { 13173 this.root.push(new BorderElement("w:top", DEFAULT_BORDER)); 13174 } 13175 if (options2.left) { 13176 this.root.push(new BorderElement("w:left", options2.left)); 13177 } else { 13178 this.root.push(new BorderElement("w:left", DEFAULT_BORDER)); 13179 } 13180 if (options2.bottom) { 13181 this.root.push(new BorderElement("w:bottom", options2.bottom)); 13182 } else { 13183 this.root.push(new BorderElement("w:bottom", DEFAULT_BORDER)); 13184 } 13185 if (options2.right) { 13186 this.root.push(new BorderElement("w:right", options2.right)); 13187 } else { 13188 this.root.push(new BorderElement("w:right", DEFAULT_BORDER)); 13189 } 13190 if (options2.insideHorizontal) { 13191 this.root.push(new BorderElement("w:insideH", options2.insideHorizontal)); 13192 } else { 13193 this.root.push(new BorderElement("w:insideH", DEFAULT_BORDER)); 13194 } 13195 if (options2.insideVertical) { 13196 this.root.push(new BorderElement("w:insideV", options2.insideVertical)); 13197 } else { 13198 this.root.push(new BorderElement("w:insideV", DEFAULT_BORDER)); 13199 } 13200 } 13201 } 13202 __publicField(TableBorders, "NONE", { 13203 top: NONE_BORDER, 13204 bottom: NONE_BORDER, 13205 left: NONE_BORDER, 13206 right: NONE_BORDER, 13207 insideHorizontal: NONE_BORDER, 13208 insideVertical: NONE_BORDER 13209 }); 13210 const TableAnchorType = { 13211 MARGIN: "margin", 13212 PAGE: "page", 13213 TEXT: "text" 13214 }; 13215 const RelativeHorizontalPosition = { 13216 CENTER: "center", 13217 INSIDE: "inside", 13218 LEFT: "left", 13219 OUTSIDE: "outside", 13220 RIGHT: "right" 13221 }; 13222 const RelativeVerticalPosition = { 13223 CENTER: "center", 13224 INSIDE: "inside", 13225 BOTTOM: "bottom", 13226 OUTSIDE: "outside", 13227 INLINE: "inline", 13228 TOP: "top" 13229 }; 13230 const OverlapType = { 13231 NEVER: "never", 13232 OVERLAP: "overlap" 13233 }; 13234 class TableFloatProperties extends XmlComponent { 13235 constructor({ 13236 horizontalAnchor, 13237 verticalAnchor, 13238 absoluteHorizontalPosition, 13239 relativeHorizontalPosition, 13240 absoluteVerticalPosition, 13241 relativeVerticalPosition, 13242 bottomFromText, 13243 topFromText, 13244 leftFromText, 13245 rightFromText, 13246 overlap 13247 }) { 13248 super("w:tblpPr"); 13249 this.root.push( 13250 new NextAttributeComponent({ 13251 leftFromText: { 13252 key: "w:leftFromText", 13253 value: leftFromText === void 0 ? void 0 : twipsMeasureValue(leftFromText) 13254 }, 13255 rightFromText: { 13256 key: "w:rightFromText", 13257 value: rightFromText === void 0 ? void 0 : twipsMeasureValue(rightFromText) 13258 }, 13259 topFromText: { 13260 key: "w:topFromText", 13261 value: topFromText === void 0 ? void 0 : twipsMeasureValue(topFromText) 13262 }, 13263 bottomFromText: { 13264 key: "w:bottomFromText", 13265 value: bottomFromText === void 0 ? void 0 : twipsMeasureValue(bottomFromText) 13266 }, 13267 absoluteHorizontalPosition: { 13268 key: "w:tblpX", 13269 value: absoluteHorizontalPosition === void 0 ? void 0 : signedTwipsMeasureValue(absoluteHorizontalPosition) 13270 }, 13271 absoluteVerticalPosition: { 13272 key: "w:tblpY", 13273 value: absoluteVerticalPosition === void 0 ? void 0 : signedTwipsMeasureValue(absoluteVerticalPosition) 13274 }, 13275 horizontalAnchor: { 13276 key: "w:horzAnchor", 13277 value: horizontalAnchor === void 0 ? void 0 : horizontalAnchor 13278 }, 13279 relativeHorizontalPosition: {
13280 key: "w:tblpXSpec", 13281 value: relativeHorizontalPosition 13282 }, 13283 relativeVerticalPosition: { 13284 key: "w:tblpYSpec", 13285 value: relativeVerticalPosition 13286 }, 13287 verticalAnchor: { 13288 key: "w:vertAnchor", 13289 value: verticalAnchor 13290 } 13291 }) 13292 ); 13293 if (overlap) { 13294 this.root.push(new StringEnumValueElement("w:tblOverlap", overlap)); 13295 } 13296 } 13297 } 13298 const TableLayoutType = { 13299 AUTOFIT: "autofit", 13300 FIXED: "fixed" 13301 }; 13302 class TableLayoutAttributes extends XmlAttributeComponent { 13303 constructor() { 13304 super(...arguments); 13305 __publicField(this, "xmlKeys", { type: "w:type" }); 13306 } 13307 } 13308 class TableLayout extends XmlComponent { 13309 constructor(type) { 13310 super("w:tblLayout"); 13311 this.root.push(new TableLayoutAttributes({ type })); 13312 } 13313 } 13314 class TableProperties extends IgnoreIfEmptyXmlComponent { 13315 constructor(options2) { 13316 super("w:tblPr"); 13317 if (options2.style) { 13318 this.root.push(new StringValueElement("w:tblStyle", options2.style)); 13319 } 13320 if (options2.float) { 13321 this.root.push(new TableFloatProperties(options2.float)); 13322 } 13323 if (options2.visuallyRightToLeft !== void 0) { 13324 this.root.push(new OnOffElement("w:bidiVisual", options2.visuallyRightToLeft)); 13325 } 13326 if (options2.width) { 13327 this.root.push(new TableWidthElement("w:tblW", options2.width)); 13328 } 13329 if (options2.alignment) { 13330 this.root.push(new Alignment(options2.alignment)); 13331 } 13332 if (options2.indent) { 13333 this.root.push(new TableWidthElement("w:tblInd", options2.indent)); 13334 } 13335 if (options2.borders) { 13336 this.root.push(new TableBorders(options2.borders)); 13337 } 13338 if (options2.shading) { 13339 this.root.push(new Shading(options2.shading)); 13340 } 13341 if (options2.layout) { 13342 this.root.push(new TableLayout(options2.layout)); 13343 } 13344 if (options2.cellMargin) { 13345 this.root.push(new TableCellMargin(TableCellMarginElementType.TABLE, options2.cellMargin)); 13346 } 13347 } 13348 } 13349 class Table extends FileChild { 13350 constructor({ 13351 rows, 13352 width, 13353 // eslint-disable-next-line functional/immutable-data 13354 columnWidths = Array(Math.max(...rows.map((row) => row.CellCount))).fill(100), 13355 margins, 13356 indent, 13357 float, 13358 layout, 13359 style, 13360 borders, 13361 alignment, 13362 visuallyRightToLeft 13363 }) { 13364 super("w:tbl"); 13365 this.root.push( 13366 new TableProperties({ 13367 borders: borders != null ? borders : {}, 13368 width: width != null ? width : { size: 100 }, 13369 indent, 13370 float, 13371 layout, 13372 style, 13373 alignment, 13374 cellMargin: margins, 13375 visuallyRightToLeft 13376 }) 13377 ); 13378 this.root.push(new TableGrid(columnWidths)); 13379 for (const row of rows) { 13380 this.root.push(row); 13381 } 13382 rows.forEach((row, rowIndex) => { 13383 if (rowIndex === rows.length - 1) { 13384 return; 13385 } 13386 let columnIndex = 0; 13387 row.cells.forEach((cell) => { 13388 if (cell.options.rowSpan && cell.options.rowSpan > 1) { 13389 const continueCell = new TableCell({ 13390 // the inserted CONTINUE cell has rowSpan, and will be handled when process the next row 13391 rowSpan: cell.options.rowSpan - 1, 13392 columnSpan: cell.options.columnSpan, 13393 borders: cell.options.borders, 13394 children: [], 13395 verticalMerge: VerticalMergeType.CONTINUE 13396 }); 13397 rows[rowIndex + 1].addCellToColumnIndex(continueCell, columnIndex); 13398 } 13399 columnIndex += cell.options.columnSpan || 1; 13400 }); 13401 }); 13402 } 13403 } 13404 const HeightRule = { 13405 /** Height is determined based on the content, so value is ignored. */ 13406 AUTO: "auto", 13407 /** At least the value specified */ 13408 ATLEAST: "atLeast", 13409 /** Exactly the value specified */ 13410 EXACT: "exact" 13411 }; 13412 class TableRowHeightAttributes extends XmlAttributeComponent { 13413 constructor() { 13414 super(...arguments); 13415 __publicField(this, "xmlKeys", { value: "w:val", rule: "w:hRule" }); 13416 } 13417 } 13418 class TableRowHeight extends XmlComponent { 13419 constructor(value, rule) { 13420 super("w:trHeight"); 13421 this.root.push( 13422 new TableRowHeightAttributes({ 13423 value: twipsMeasureValue(value), 13424 rule 13425 }) 13426 ); 13427 } 13428 } 13429 class TableRowProperties extends IgnoreIfEmptyXmlComponent { 13430 constructor(options2) { 13431 super("w:trPr"); 13432 if (options2.cantSplit !== void 0) { 13433 this.root.push(new OnOffElement("w:cantSplit", options2.cantSplit)); 13434 } 13435 if (options2.tableHeader !== void 0) { 13436 this.root.push(new OnOffElement("w:tblHeader", options2.tableHeader)); 13437 } 13438 if (options2.height) { 13439 this.root.push(new TableRowHeight(options2.height.value, options2.height.rule)); 13440 } 13441 } 13442 } 13443 class TableRow extends XmlComponent { 13444 constructor(options2) { 13445 super("w:tr"); 13446 this.options = options2; 13447 this.root.push(new TableRowProperties(options2)); 13448 for (const child of options2.children) { 13449 this.root.push(child); 13450 } 13451 } 13452 get CellCount() { 13453 return this.options.children.length; 13454 } 13455 get cells() { 13456 return this.root.filter((xmlComponent) => xmlComponent instanceof TableCell); 13457 } 13458 addCellToIndex(cell, index) { 13459 this.root.splice(index + 1, 0, cell); 13460 } 13461 addCellToColumnIndex(cell, columnIndex) { 13462 const rootIndex = this.columnIndexToRootIndex(columnIndex, true); 13463 this.addCellToIndex(cell, rootIndex - 1); 13464 } 13465 rootIndexToColumnIndex(rootIndex) { 13466 if (rootIndex < 1 || rootIndex >= this.root.length) { 13467 throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length - 1}`); 13468 } 13469 let colIdx = 0; 13470 for (let rootIdx = 1; rootIdx < rootIndex; rootIdx++) { 13471 const cell = this.root[rootIdx]; 13472 colIdx += cell.options.columnSpan || 1; 13473 } 13474 return colIdx; 13475 } 13476 columnIndexToRootIndex(columnIndex, allowEndNewCell = false) { 13477 if (columnIndex < 0) { 13478 throw new Error(`cell 'columnIndex' should not less than zero`); 13479 } 13480 let colIdx = 0; 13481 let rootIdx = 1; 13482 while (colIdx <= columnIndex) { 13483 if (rootIdx >= this.root.length) { 13484 if (allowEndNewCell) { 13485 return this.root.length; 13486 } else { 13487 throw new Error(`cell 'columnIndex' should not great than ${colIdx - 1}`); 13488 } 13489 } 13490 const cell = this.root[rootIdx]; 13491 rootIdx += 1; 13492 colIdx += cell && cell.options.columnSpan || 1; 13493 } 13494 return rootIdx - 1; 13495 } 13496 } 13497 class AppPropertiesAttributes extends XmlAttributeComponent { 13498 constructor() { 13499 super(...arguments); 13500 __publicField(this, "xmlKeys", { 13501 xmlns: "xmlns", 13502 vt: "xmlns:vt" 13503 }); 13504 } 13505 } 13506 class AppProperties extends XmlComponent { 13507 constructor() { 13508 super("Properties"); 13509 this.root.push( 13510 new AppPropertiesAttributes({ 13511 xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", 13512 vt: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" 13513 }) 13514 ); 13515 } 13516 } 13517 class ContentTypeAttributes extends XmlAttributeComponent { 13518 constructor() { 13519 super(...arguments); 13520 __publicField(this, "xmlKeys", { 13521 xmlns: "xmlns" 13522 }); 13523 } 13524 } 13525 class DefaultAttributes extends XmlAttributeComponent { 13526 constructor() { 13527 super(...arguments); 13528 __publicField(this, "xmlKeys", { 13529 contentType: "ContentType", 13530 extension: "Extension" 13531 }); 13532 } 13533 } 13534 class Default extends XmlComponent { 13535 constructor(contentType, extension) { 13536 super("Default"); 13537 this.root.push( 13538 new DefaultAttributes({ 13539 contentType, 13540 extension 13541 }) 13542 ); 13543 } 13544 } 13545 class OverrideAttributes extends XmlAttributeComponent { 13546 constructor() { 13547 super(...arguments); 13548 __publicField(this, "xmlKeys", { 13549 contentType: "ContentType", 13550 partName: "PartName" 13551 }); 13552 } 13553 } 13554 class Override extends XmlComponent { 13555 constructor(contentType, partName) { 13556 super("Override"); 13557 this.root.push( 13558 new OverrideAttributes({ 13559 contentType, 13560 partName 13561 }) 13562 ); 13563 } 13564 } 13565 class ContentTypes extends XmlComponent { 13566 constructor() { 13567 super("Types"); 13568 this.root.push( 13569 new ContentTypeAttributes({ 13570 xmlns: "http://schemas.openxmlformats.org/package/2006/content-types" 13571 }) 13572 ); 13573 this.root.push(new Default("image/png", "png")); 13574 this.root.push(new Default("image/jpeg", "jpeg")); 13575 this.root.push(new Default("image/jpeg", "jpg")); 13576 this.root.push(new Default("image/bmp", "bmp")); 13577 this.root.push(new Default("image/gif", "gif")); 13578 this.root.push(new Default("application/vnd.openxmlformats-package.relationships+xml", "rels")); 13579 this.root.push(new Default("application/xml", "xml")); 13580 this.root.push(new Default("application/vnd.openxmlformats-officedocument.obfuscatedFont", "odttf")); 13581 this.root.push( 13582 new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "/word/document.xml") 13583 ); 13584 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", "/word/styles.xml")); 13585 this.root.push(new Override("application/vnd.openxmlformats-package.core-properties+xml", "/docProps/core.xml")); 13586 this.root.push(new Override("application/vnd.openxmlformats-officedocument.custom-properties+xml", "/docProps/custom.xml")); 13587 this.root.push(new Override("application/vnd.openxmlformats-officedocument.extended-properties+xml", "/docProps/app.xml")); 13588 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", "/word/numbering.xml")); 13589 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", "/word/footnotes.xml")); 13590 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", "/word/settings.xml")); 13591 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", "/word/comments.xml")); 13592 this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", "/word/fontTable.xml")); 13593 } 13594 addFooter(index) { 13595 this.root.push( 13596 new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", `/word/footer${index}.xml`) 13597 ); 13598 } 13599 addHeader(index) { 13600 this.root.push( 13601 new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", `/word/header${index}.xml`) 13602 ); 13603 } 13604 } 13605 class CoreProperties extends XmlComponent { 13606 constructor(options2) { 13607 super("cp:coreProperties"); 13608 this.root.push( 13609 new DocumentAttributes({ 13610 cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 13611 dc: "http://purl.org/dc/elements/1.1/", 13612 dcterms: "http://purl.org/dc/terms/", 13613 dcmitype: "http://purl.org/dc/dcmitype/", 13614 xsi: "http://www.w3.org/2001/XMLSchema-instance" 13615 }) 13616 ); 13617 if (options2.title) { 13618 this.root.push(new StringContainer("dc:title", options2.title)); 13619 } 13620 if (options2.subject) { 13621 this.root.push(new StringContainer("dc:subject", options2.subject)); 13622 } 13623 if (options2.creator) { 13624 this.root.push(new StringContainer("dc:creator", options2.creator)); 13625 } 13626 if (options2.keywords) { 13627 this.root.push(new StringContainer("cp:keywords", options2.keywords)); 13628 } 13629 if (options2.description) { 13630 this.root.push(new StringContainer("dc:description", options2.description)); 13631 } 13632 if (options2.lastModifiedBy) { 13633 this.root.push(new StringContainer("cp:lastModifiedBy", options2.lastModifiedBy)); 13634 } 13635 if (options2.revision) { 13636 this.root.push(new StringContainer("cp:revision", String(options2.revision))); 13637 } 13638 this.root.push(new TimestampElement("dcterms:created")); 13639 this.root.push(new TimestampElement("dcterms:modified")); 13640 } 13641 } 13642 class TimestampElement extends XmlComponent { 13643 constructor(name) { 13644 super(name); 13645 this.root.push( 13646 new DocumentAttributes({ 13647 type: "dcterms:W3CDTF" 13648 }) 13649 ); 13650 this.root.push(dateTimeValue(/* @__PURE__ */ new Date())); 13651 } 13652 } 13653 class CustomPropertiesAttributes extends XmlAttributeComponent { 13654 constructor() { 13655 super(...arguments); 13656 __publicField(this, "xmlKeys", { 13657 xmlns: "xmlns", 13658 vt: "xmlns:vt" 13659 }); 13660 } 13661 } 13662 class CustomPropertyAttributes extends XmlAttributeComponent { 13663 constructor() { 13664 super(...arguments); 13665 __publicField(this, "xmlKeys", { 13666 fmtid: "fmtid", 13667 pid: "pid", 13668 name: "name" 13669 }); 13670 } 13671 } 13672 class CustomProperty extends XmlComponent { 13673 constructor(id, properties) { 13674 super("property"); 13675 this.root.push( 13676 new CustomPropertyAttributes({ 13677 fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}", 13678 pid: id.toString(), 13679 name: properties.name 13680 }) 13681 ); 13682 this.root.push(new CustomPropertyValue(properties.value)); 13683 } 13684 } 13685 class CustomPropertyValue extends XmlComponent { 13686 constructor(value) { 13687 super("vt:lpwstr"); 13688 this.root.push(value); 13689 } 13690 } 13691 class CustomProperties extends XmlComponent { 13692 constructor(properties) { 13693 super("Properties"); 13694 // eslint-disable-next-line functional/prefer-readonly-type 13695 __publicField(this, "nextId"); 13696 // eslint-disable-next-line functional/prefer-readonly-type 13697 __publicField(this, "properties", []); 13698 this.root.push( 13699 new CustomPropertiesAttributes({ 13700 xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", 13701 vt: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" 13702 }) 13703 ); 13704 this.nextId = 2; 13705 for (const property of properties) { 13706 this.addCustomProperty(property); 13707 } 13708 } 13709 prepForXml(context) {
13710 this.properties.forEach((x) => this.root.push(x)); 13711 return super.prepForXml(context); 13712 } 13713 addCustomProperty(property) { 13714 this.properties.push(new CustomProperty(this.nextId++, property)); 13715 } 13716 } 13717 class FooterAttributes extends XmlAttributeComponent { 13718 constructor() { 13719 super(...arguments); 13720 __publicField(this, "xmlKeys", { 13721 wpc: "xmlns:wpc", 13722 mc: "xmlns:mc", 13723 o: "xmlns:o", 13724 r: "xmlns:r", 13725 m: "xmlns:m", 13726 v: "xmlns:v", 13727 wp14: "xmlns:wp14", 13728 wp: "xmlns:wp", 13729 w10: "xmlns:w10", 13730 w: "xmlns:w", 13731 w14: "xmlns:w14", 13732 w15: "xmlns:w15", 13733 wpg: "xmlns:wpg", 13734 wpi: "xmlns:wpi", 13735 wne: "xmlns:wne", 13736 wps: "xmlns:wps", 13737 cp: "xmlns:cp", 13738 dc: "xmlns:dc", 13739 dcterms: "xmlns:dcterms", 13740 dcmitype: "xmlns:dcmitype", 13741 xsi: "xmlns:xsi", 13742 type: "xsi:type" 13743 }); 13744 } 13745 } 13746 let Footer$1 = class Footer extends InitializableXmlComponent { 13747 constructor(referenceNumber, initContent) { 13748 super("w:ftr", initContent); 13749 __publicField(this, "refId"); 13750 this.refId = referenceNumber; 13751 if (!initContent) { 13752 this.root.push( 13753 new FooterAttributes({ 13754 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 13755 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 13756 o: "urn:schemas-microsoft-com:office:office", 13757 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 13758 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 13759 v: "urn:schemas-microsoft-com:vml", 13760 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 13761 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 13762 w10: "urn:schemas-microsoft-com:office:word", 13763 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 13764 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 13765 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 13766 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 13767 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 13768 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 13769 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" 13770 }) 13771 ); 13772 } 13773 } 13774 get ReferenceId() { 13775 return this.refId; 13776 } 13777 add(item) { 13778 this.root.push(item); 13779 } 13780 }; 13781 class FooterWrapper { 13782 constructor(media, referenceId, initContent) { 13783 __publicField(this, "footer"); 13784 __publicField(this, "relationships"); 13785 this.media = media; 13786 this.footer = new Footer$1(referenceId, initContent); 13787 this.relationships = new Relationships(); 13788 } 13789 add(item) { 13790 this.footer.add(item); 13791 } 13792 addChildElement(childElement) { 13793 this.footer.addChildElement(childElement); 13794 } 13795 get View() { 13796 return this.footer; 13797 } 13798 get Relationships() { 13799 return this.relationships; 13800 } 13801 get Media() { 13802 return this.media; 13803 } 13804 } 13805 class FootnoteAttributes extends XmlAttributeComponent { 13806 constructor() { 13807 super(...arguments); 13808 __publicField(this, "xmlKeys", { 13809 type: "w:type", 13810 id: "w:id" 13811 }); 13812 } 13813 } 13814 class FootnoteRef extends XmlComponent { 13815 constructor() { 13816 super("w:footnoteRef"); 13817 } 13818 } 13819 class FootnoteRefRun extends Run { 13820 constructor() { 13821 super({ 13822 style: "FootnoteReference" 13823 }); 13824 this.root.push(new FootnoteRef()); 13825 } 13826 } 13827 const FootnoteType = { 13828 SEPERATOR: "separator", 13829 // eslint-disable-next-line @typescript-eslint/naming-convention 13830 CONTINUATION_SEPERATOR: "continuationSeparator" 13831 }; 13832 class Footnote extends XmlComponent { 13833 constructor(options2) { 13834 super("w:footnote"); 13835 this.root.push( 13836 new FootnoteAttributes({ 13837 type: options2.type, 13838 id: options2.id 13839 }) 13840 ); 13841 for (let i = 0; i < options2.children.length; i++) { 13842 const child = options2.children[i]; 13843 if (i === 0) { 13844 child.addRunToFront(new FootnoteRefRun()); 13845 } 13846 this.root.push(child); 13847 } 13848 } 13849 } 13850 class ContinuationSeperator extends XmlComponent { 13851 constructor() { 13852 super("w:continuationSeparator"); 13853 } 13854 } 13855 class ContinuationSeperatorRun extends Run { 13856 constructor() { 13857 super({}); 13858 this.root.push(new ContinuationSeperator()); 13859 } 13860 } 13861 class Seperator extends XmlComponent { 13862 constructor() { 13863 super("w:separator"); 13864 } 13865 } 13866 class SeperatorRun extends Run { 13867 constructor() { 13868 super({}); 13869 this.root.push(new Seperator()); 13870 } 13871 } 13872 class FootnotesAttributes extends XmlAttributeComponent { 13873 constructor() { 13874 super(...arguments); 13875 __publicField(this, "xmlKeys", { 13876 wpc: "xmlns:wpc", 13877 mc: "xmlns:mc", 13878 o: "xmlns:o", 13879 r: "xmlns:r", 13880 m: "xmlns:m", 13881 v: "xmlns:v", 13882 wp14: "xmlns:wp14", 13883 wp: "xmlns:wp", 13884 w10: "xmlns:w10", 13885 w: "xmlns:w", 13886 w14: "xmlns:w14", 13887 w15: "xmlns:w15", 13888 wpg: "xmlns:wpg", 13889 wpi: "xmlns:wpi", 13890 wne: "xmlns:wne", 13891 wps: "xmlns:wps", 13892 Ignorable: "mc:Ignorable" 13893 }); 13894 } 13895 } 13896 class FootNotes extends XmlComponent { 13897 constructor() { 13898 super("w:footnotes"); 13899 this.root.push( 13900 new FootnotesAttributes({ 13901 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 13902 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 13903 o: "urn:schemas-microsoft-com:office:office", 13904 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 13905 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 13906 v: "urn:schemas-microsoft-com:vml", 13907 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 13908 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 13909 w10: "urn:schemas-microsoft-com:office:word", 13910 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 13911 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 13912 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 13913 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 13914 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 13915 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 13916 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 13917 Ignorable: "w14 w15 wp14" 13918 }) 13919 ); 13920 const begin = new Footnote({ 13921 id: -1, 13922 type: FootnoteType.SEPERATOR, 13923 children: [ 13924 new Paragraph({ 13925 spacing: { 13926 after: 0, 13927 line: 240, 13928 lineRule: LineRuleType.AUTO 13929 }, 13930 children: [new SeperatorRun()] 13931 }) 13932 ] 13933 }); 13934 this.root.push(begin); 13935 const spacing = new Footnote({ 13936 id: 0, 13937 type: FootnoteType.CONTINUATION_SEPERATOR, 13938 children: [ 13939 new Paragraph({ 13940 spacing: { 13941 after: 0, 13942 line: 240, 13943 lineRule: LineRuleType.AUTO 13944 }, 13945 children: [new ContinuationSeperatorRun()] 13946 }) 13947 ] 13948 }); 13949 this.root.push(spacing); 13950 } 13951 createFootNote(id, paragraph) { 13952 const footnote = new Footnote({ 13953 id, 13954 children: paragraph 13955 }); 13956 this.root.push(footnote); 13957 } 13958 } 13959 class FootnotesWrapper { 13960 constructor() { 13961 __publicField(this, "footnotess"); 13962 __publicField(this, "relationships"); 13963 this.footnotess = new FootNotes(); 13964 this.relationships = new Relationships(); 13965 } 13966 get View() { 13967 return this.footnotess; 13968 } 13969 get Relationships() { 13970 return this.relationships; 13971 } 13972 } 13973 class HeaderAttributes extends XmlAttributeComponent { 13974 constructor() { 13975 super(...arguments); 13976 __publicField(this, "xmlKeys", { 13977 wpc: "xmlns:wpc", 13978 mc: "xmlns:mc", 13979 o: "xmlns:o", 13980 r: "xmlns:r", 13981 m: "xmlns:m", 13982 v: "xmlns:v", 13983 wp14: "xmlns:wp14", 13984 wp: "xmlns:wp", 13985 w10: "xmlns:w10", 13986 w: "xmlns:w", 13987 w14: "xmlns:w14", 13988 w15: "xmlns:w15", 13989 wpg: "xmlns:wpg", 13990 wpi: "xmlns:wpi", 13991 wne: "xmlns:wne", 13992 wps: "xmlns:wps", 13993 cp: "xmlns:cp", 13994 dc: "xmlns:dc", 13995 dcterms: "xmlns:dcterms", 13996 dcmitype: "xmlns:dcmitype", 13997 xsi: "xmlns:xsi", 13998 type: "xsi:type", 13999 cx: "xmlns:cx", 14000 cx1: "xmlns:cx1", 14001 cx2: "xmlns:cx2", 14002 cx3: "xmlns:cx3", 14003 cx4: "xmlns:cx4", 14004 cx5: "xmlns:cx5", 14005 cx6: "xmlns:cx6", 14006 cx7: "xmlns:cx7", 14007 cx8: "xmlns:cx8", 14008 w16cid: "xmlns:w16cid", 14009 w16se: "xmlns:w16se" 14010 }); 14011 } 14012 } 14013 let Header$1 = class Header extends InitializableXmlComponent { 14014 constructor(referenceNumber, initContent) { 14015 super("w:hdr", initContent); 14016 __publicField(this, "refId"); 14017 this.refId = referenceNumber; 14018 if (!initContent) { 14019 this.root.push( 14020 new HeaderAttributes({ 14021 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 14022 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 14023 o: "urn:schemas-microsoft-com:office:office", 14024 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 14025 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 14026 v: "urn:schemas-microsoft-com:vml", 14027 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 14028 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 14029 w10: "urn:schemas-microsoft-com:office:word", 14030 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 14031 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 14032 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 14033 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 14034 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 14035 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 14036 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 14037 cx: "http://schemas.microsoft.com/office/drawing/2014/chartex", 14038 cx1: "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex", 14039 cx2: "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex", 14040 cx3: "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex", 14041 cx4: "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex", 14042 cx5: "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex", 14043 cx6: "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex", 14044 cx7: "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex", 14045 cx8: "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex", 14046 w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid", 14047 w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex" 14048 }) 14049 ); 14050 } 14051 } 14052 get ReferenceId() { 14053 return this.refId; 14054 } 14055 add(item) { 14056 this.root.push(item); 14057 } 14058 }; 14059 class HeaderWrapper { 14060 constructor(media, referenceId, initContent) { 14061 __publicField(this, "header"); 14062 __publicField(this, "relationships"); 14063 this.media = media; 14064 this.header = new Header$1(referenceId, initContent); 14065 this.relationships = new Relationships(); 14066 } 14067 add(item) { 14068 this.header.add(item); 14069 return this; 14070 } 14071 addChildElement(childElement) { 14072 this.header.addChildElement(childElement); 14073 } 14074 get View() { 14075 return this.header; 14076 } 14077 get Relationships() { 14078 return this.relationships; 14079 } 14080 get Media() { 14081 return this.media; 14082 } 14083 } 14084 class Media { 14085 constructor() { 14086 // eslint-disable-next-line functional/prefer-readonly-type 14087 __publicField(this, "map"); 14088 this.map = /* @__PURE__ */ new Map(); 14089 } 14090 addImage(key, mediaData) { 14091 this.map.set(key, mediaData); 14092 } 14093 get Array() { 14094 return Array.from(this.map.values()); 14095 } 14096 } 14097 const WORKAROUND2 = "";
14098 const LevelFormat = { 14099 DECIMAL: "decimal", 14100 UPPER_ROMAN: "upperRoman", 14101 LOWER_ROMAN: "lowerRoman", 14102 UPPER_LETTER: "upperLetter", 14103 LOWER_LETTER: "lowerLetter", 14104 ORDINAL: "ordinal", 14105 CARDINAL_TEXT: "cardinalText", 14106 ORDINAL_TEXT: "ordinalText", 14107 HEX: "hex", 14108 CHICAGO: "chicago", 14109 IDEOGRAPH__DIGITAL: "ideographDigital", 14110 JAPANESE_COUNTING: "japaneseCounting", 14111 AIUEO: "aiueo", 14112 IROHA: "iroha", 14113 DECIMAL_FULL_WIDTH: "decimalFullWidth", 14114 DECIMAL_HALF_WIDTH: "decimalHalfWidth", 14115 JAPANESE_LEGAL: "japaneseLegal", 14116 JAPANESE_DIGITAL_TEN_THOUSAND: "japaneseDigitalTenThousand", 14117 DECIMAL_ENCLOSED_CIRCLE: "decimalEnclosedCircle", 14118 DECIMAL_FULL_WIDTH2: "decimalFullWidth2", 14119 AIUEO_FULL_WIDTH: "aiueoFullWidth", 14120 IROHA_FULL_WIDTH: "irohaFullWidth", 14121 DECIMAL_ZERO: "decimalZero", 14122 BULLET: "bullet", 14123 GANADA: "ganada", 14124 CHOSUNG: "chosung", 14125 DECIMAL_ENCLOSED_FULLSTOP: "decimalEnclosedFullstop", 14126 DECIMAL_ENCLOSED_PARENTHESES: "decimalEnclosedParen", 14127 DECIMAL_ENCLOSED_CIRCLE_CHINESE: "decimalEnclosedCircleChinese", 14128 IDEOGRAPH_ENCLOSED_CIRCLE: "ideographEnclosedCircle", 14129 IDEOGRAPH_TRADITIONAL: "ideographTraditional", 14130 IDEOGRAPH_ZODIAC: "ideographZodiac", 14131 IDEOGRAPH_ZODIAC_TRADITIONAL: "ideographZodiacTraditional", 14132 TAIWANESE_COUNTING: "taiwaneseCounting", 14133 IDEOGRAPH_LEGAL_TRADITIONAL: "ideographLegalTraditional", 14134 TAIWANESE_COUNTING_THOUSAND: "taiwaneseCountingThousand", 14135 TAIWANESE_DIGITAL: "taiwaneseDigital", 14136 CHINESE_COUNTING: "chineseCounting", 14137 CHINESE_LEGAL_SIMPLIFIED: "chineseLegalSimplified", 14138 CHINESE_COUNTING_THOUSAND: "chineseCountingThousand", 14139 KOREAN_DIGITAL: "koreanDigital", 14140 KOREAN_COUNTING: "koreanCounting", 14141 KOREAN_LEGAL: "koreanLegal", 14142 KOREAN_DIGITAL2: "koreanDigital2", 14143 VIETNAMESE_COUNTING: "vietnameseCounting", 14144 RUSSIAN_LOWER: "russianLower", 14145 RUSSIAN_UPPER: "russianUpper", 14146 NONE: "none", 14147 NUMBER_IN_DASH: "numberInDash", 14148 HEBREW1: "hebrew1", 14149 HEBREW2: "hebrew2", 14150 ARABIC_ALPHA: "arabicAlpha", 14151 ARABIC_ABJAD: "arabicAbjad", 14152 HINDI_VOWELS: "hindiVowels", 14153 HINDI_CONSONANTS: "hindiConsonants", 14154 HINDI_NUMBERS: "hindiNumbers", 14155 HINDI_COUNTING: "hindiCounting", 14156 THAI_LETTERS: "thaiLetters", 14157 THAI_NUMBERS: "thaiNumbers", 14158 THAI_COUNTING: "thaiCounting", 14159 BAHT_TEXT: "bahtText", 14160 DOLLAR_TEXT: "dollarText", 14161 CUSTOM: "custom" 14162 }; 14163 class LevelAttributes extends XmlAttributeComponent { 14164 constructor() { 14165 super(...arguments); 14166 __publicField(this, "xmlKeys", { 14167 ilvl: "w:ilvl", 14168 tentative: "w15:tentative" 14169 }); 14170 } 14171 } 14172 class NumberFormat extends XmlComponent { 14173 constructor(value) { 14174 super("w:numFmt"); 14175 this.root.push( 14176 new Attributes({ 14177 val: value 14178 }) 14179 ); 14180 } 14181 } 14182 class LevelText extends XmlComponent { 14183 constructor(value) { 14184 super("w:lvlText"); 14185 this.root.push( 14186 new Attributes({ 14187 val: value 14188 }) 14189 ); 14190 } 14191 } 14192 class LevelJc extends XmlComponent { 14193 constructor(value) { 14194 super("w:lvlJc"); 14195 this.root.push( 14196 new Attributes({ 14197 val: value 14198 }) 14199 ); 14200 } 14201 } 14202 const LevelSuffix = { 14203 NOTHING: "nothing", 14204 SPACE: "space", 14205 TAB: "tab" 14206 }; 14207 class Suffix extends XmlComponent { 14208 constructor(value) { 14209 super("w:suff"); 14210 this.root.push( 14211 new Attributes({ 14212 val: value 14213 }) 14214 ); 14215 } 14216 } 14217 class IsLegalNumberingStyle extends XmlComponent { 14218 constructor() { 14219 super("w:isLgl"); 14220 } 14221 } 14222 class LevelBase extends XmlComponent { 14223 constructor({ 14224 level, 14225 format: format2, 14226 text, 14227 alignment = AlignmentType.START, 14228 start = 1, 14229 style, 14230 suffix, 14231 isLegalNumberingStyle 14232 }) { 14233 super("w:lvl"); 14234 __publicField(this, "paragraphProperties"); 14235 __publicField(this, "runProperties"); 14236 this.root.push(new NumberValueElement("w:start", decimalNumber(start))); 14237 if (format2) { 14238 this.root.push(new NumberFormat(format2)); 14239 } 14240 if (suffix) { 14241 this.root.push(new Suffix(suffix)); 14242 } 14243 if (isLegalNumberingStyle) { 14244 this.root.push(new IsLegalNumberingStyle()); 14245 } 14246 if (text) { 14247 this.root.push(new LevelText(text)); 14248 } 14249 this.root.push(new LevelJc(alignment)); 14250 this.paragraphProperties = new ParagraphProperties(style && style.paragraph); 14251 this.runProperties = new RunProperties(style && style.run); 14252 this.root.push(this.paragraphProperties); 14253 this.root.push(this.runProperties); 14254 if (level > 9) { 14255 throw new Error( 14256 "Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us
14256/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7" 14257 ); 14258 } 14259 this.root.push( 14260 new LevelAttributes({ 14261 ilvl: decimalNumber(level), 14262 tentative: 1 14263 }) 14264 ); 14265 } 14266 } 14267 class Level extends LevelBase { 14268 // This is the level that sits under abstractNum. We make a 14269 // handful of properties required 14270 } 14271 class LevelForOverride extends LevelBase { 14272 } 14273 class MultiLevelType extends XmlComponent { 14274 constructor(value) { 14275 super("w:multiLevelType"); 14276 this.root.push( 14277 new Attributes({ 14278 val: value 14279 }) 14280 ); 14281 } 14282 } 14283 class AbstractNumberingAttributes extends XmlAttributeComponent { 14284 constructor() { 14285 super(...arguments); 14286 __publicField(this, "xmlKeys", { 14287 abstractNumId: "w:abstractNumId", 14288 restartNumberingAfterBreak: "w15:restartNumberingAfterBreak" 14289 }); 14290 } 14291 } 14292 class AbstractNumbering extends XmlComponent { 14293 constructor(id, levelOptions) { 14294 super("w:abstractNum"); 14295 __publicField(this, "id"); 14296 this.root.push( 14297 new AbstractNumberingAttributes({ 14298 abstractNumId: decimalNumber(id), 14299 restartNumberingAfterBreak: 0 14300 }) 14301 ); 14302 this.root.push(new MultiLevelType("hybridMultilevel")); 14303 this.id = id; 14304 for (const option of levelOptions) { 14305 this.root.push(new Level(option)); 14306 } 14307 } 14308 } 14309 class AbstractNumId extends XmlComponent { 14310 constructor(value) { 14311 super("w:abstractNumId"); 14312 this.root.push( 14313 new Attributes({ 14314 val: value 14315 }) 14316 ); 14317 } 14318 } 14319 class NumAttributes extends XmlAttributeComponent { 14320 constructor() { 14321 super(...arguments); 14322 __publicField(this, "xmlKeys", { numId: "w:numId" }); 14323 } 14324 } 14325 class ConcreteNumbering extends XmlComponent { 14326 constructor(options2) { 14327 super("w:num"); 14328 __publicField(this, "numId"); 14329 __publicField(this, "reference"); 14330 __publicField(this, "instance"); 14331 this.numId = options2.numId; 14332 this.reference = options2.reference; 14333 this.instance = options2.instance; 14334 this.root.push( 14335 new NumAttributes({ 14336 numId: decimalNumber(options2.numId) 14337 }) 14338 ); 14339 this.root.push(new AbstractNumId(decimalNumber(options2.abstractNumId))); 14340 if (options2.overrideLevels && options2.overrideLevels.length) { 14341 for (const level of options2.overrideLevels) { 14342 this.root.push(new LevelOverride(level.num, level.start)); 14343 } 14344 } 14345 } 14346 } 14347 class LevelOverrideAttributes extends XmlAttributeComponent { 14348 constructor() { 14349 super(...arguments); 14350 __publicField(this, "xmlKeys", { ilvl: "w:ilvl" }); 14351 } 14352 } 14353 class LevelOverride extends XmlComponent { 14354 constructor(levelNum, start) { 14355 super("w:lvlOverride"); 14356 this.root.push(new LevelOverrideAttributes({ ilvl: levelNum })); 14357 if (start !== void 0) { 14358 this.root.push(new StartOverride(start)); 14359 } 14360 } 14361 } 14362 class StartOverrideAttributes extends XmlAttributeComponent { 14363 constructor() { 14364 super(...arguments); 14365 __publicField(this, "xmlKeys", { val: "w:val" }); 14366 } 14367 } 14368 class StartOverride extends XmlComponent { 14369 constructor(start) { 14370 super("w:startOverride"); 14371 this.root.push(new StartOverrideAttributes({ val: start })); 14372 } 14373 } 14374 class Numbering extends XmlComponent { 14375 constructor(options2) { 14376 super("w:numbering"); 14377 __publicField(this, "abstractNumberingMap", /* @__PURE__ */ new Map()); 14378 __publicField(this, "concreteNumberingMap", /* @__PURE__ */ new Map()); 14379 // eslint-disable-next-line @typescript-eslint/no-explicit-any 14380 __publicField(this, "referenceConfigMap", /* @__PURE__ */ new Map()); 14381 __publicField(this, "abstractNumUniqueNumericId", abstractNumUniqueNumericIdGen()); 14382 __publicField(this, "concreteNumUniqueNumericId", concreteNumUniqueNumericIdGen()); 14383 this.root.push( 14384 new DocumentAttributes({ 14385 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 14386 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 14387 o: "urn:schemas-microsoft-com:office:office", 14388 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 14389 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 14390 v: "urn:schemas-microsoft-com:vml", 14391 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 14392 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 14393 w10: "urn:schemas-microsoft-com:office:word", 14394 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 14395 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 14396 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 14397 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 14398 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 14399 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 14400 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 14401 Ignorable: "w14 w15 wp14" 14402 }) 14403 ); 14404 const abstractNumbering = new AbstractNumbering(this.abstractNumUniqueNumericId(), [ 14405 { 14406 level: 0, 14407 format: LevelFormat.BULLET, 14408 text: "â", 14409 alignment: AlignmentType.LEFT, 14410 style: { 14411 paragraph: { 14412 indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) } 14413 } 14414 } 14415 }, 14416 { 14417 level: 1, 14418 format: LevelFormat.BULLET, 14419 text: "â", 14420 alignment: AlignmentType.LEFT, 14421 style: { 14422 paragraph: { 14423 indent: { left: convertInchesToTwip(1), hanging: convertInchesToTwip(0.25) } 14424 } 14425 } 14426 }, 14427 { 14428 level: 2, 14429 format: LevelFormat.BULLET, 14430 text: "â ", 14431 alignment: AlignmentType.LEFT, 14432 style: { 14433 paragraph: { 14434 indent: { left: 2160, hanging: convertInchesToTwip(0.25) } 14435 } 14436 } 14437 }, 14438 { 14439 level: 3, 14440 format: LevelFormat.BULLET, 14441 text: "â", 14442 alignment: AlignmentType.LEFT, 14443 style: { 14444 paragraph: { 14445 indent: { left: 2880, hanging: convertInchesToTwip(0.25) } 14446 } 14447 } 14448 }, 14449 { 14450 level: 4, 14451 format: LevelFormat.BULLET, 14452 text: "â", 14453 alignment: AlignmentType.LEFT, 14454 style: { 14455 paragraph: { 14456 indent: { left: 3600, hanging: convertInchesToTwip(0.25) } 14457 } 14458 } 14459 }, 14460 { 14461 level: 5, 14462 format: LevelFormat.BULLET, 14463 text: "â ", 14464 alignment: AlignmentType.LEFT, 14465 style: { 14466 paragraph: { 14467 indent: { left: 4320, hanging: convertInchesToTwip(0.25) } 14468 } 14469 } 14470 }, 14471 { 14472 level: 6, 14473 format: LevelFormat.BULLET, 14474 text: "â", 14475 alignment: AlignmentType.LEFT, 14476 style: { 14477 paragraph: { 14478 indent: { left: 5040, hanging: convertInchesToTwip(0.25) } 14479 } 14480 } 14481 }, 14482 { 14483 level: 7, 14484 format: LevelFormat.BULLET, 14485 text: "â", 14486 alignment: AlignmentType.LEFT, 14487 style: { 14488 paragraph: { 14489 indent: { left: 5760, hanging: convertInchesToTwip(0.25) } 14490 } 14491 } 14492 }, 14493 { 14494 level: 8, 14495 format: LevelFormat.BULLET, 14496 text: "â", 14497 alignment: AlignmentType.LEFT, 14498 style: { 14499 paragraph: { 14500 indent: { left: 6480, hanging: convertInchesToTwip(0.25) } 14501 } 14502 } 14503 } 14504 ]); 14505 this.concreteNumberingMap.set( 14506 "default-bullet-numbering", 14507 new ConcreteNumbering({ 14508 numId: 1, 14509 abstractNumId: abstractNumbering.id, 14510 reference: "default-bullet-numbering", 14511 instance: 0, 14512 overrideLevels: [ 14513 { 14514 num: 0, 14515 start: 1 14516 } 14517 ] 14518 }) 14519 ); 14520 this.abstractNumberingMap.set("default-bullet-numbering", abstractNumbering); 14521 for (const con of options2.config) { 14522 this.abstractNumberingMap.set(con.reference, new AbstractNumbering(this.abstractNumUniqueNumericId(), con.levels)); 14523 this.referenceConfigMap.set(con.reference, con.levels); 14524 } 14525 } 14526 prepForXml(context) { 14527 for (const numbering of this.abstractNumberingMap.values()) { 14528 this.root.push(numbering); 14529 } 14530 for (const numbering of this.concreteNumberingMap.values()) { 14531 this.root.push(numbering); 14532 } 14533 return super.prepForXml(context); 14534 } 14535 createConcreteNumberingInstance(reference, instance) { 14536 const abstractNumbering = this.abstractNumberingMap.get(reference); 14537 if (!abstractNumbering) { 14538 return; 14539 } 14540 const fullReference = `${reference}-${instance}`; 14541 if (this.concreteNumberingMap.has(fullReference)) { 14542 return; 14543 } 14544 const referenceConfigLevels = this.referenceConfigMap.get(reference); 14545 const firstLevelStartNumber = referenceConfigLevels && referenceConfigLevels[0].start; 14546 const concreteNumberingSettings = { 14547 numId: this.concreteNumUniqueNumericId(), 14548 abstractNumId: abstractNumbering.id, 14549 reference, 14550 instance, 14551 overrideLevels: [ 14552 firstLevelStartNumber && Number.isInteger(firstLevelStartNumber) ? { 14553 num: 0, 14554 start: firstLevelStartNumber 14555 } : { 14556 num: 0, 14557 start: 1 14558 } 14559 ] 14560 }; 14561 this.concreteNumberingMap.set(fullReference, new ConcreteNumbering(concreteNumberingSettings)); 14562 } 14563 get ConcreteNumbering() { 14564 return Array.from(this.concreteNumberingMap.values()); 14565 } 14566 // eslint-disable-next-line @typescript-eslint/no-explicit-any 14567 get ReferenceConfig() { 14568 return Array.from(this.referenceConfigMap.values()); 14569 } 14570 } 14571 class CompatibilitySettingAttributes extends XmlAttributeComponent { 14572 constructor() { 14573 super(...arguments); 14574 __publicField(this, "xmlKeys", { 14575 version: "w:val",
14576 name: "w:name", 14577 uri: "w:uri" 14578 }); 14579 } 14580 } 14581 class CompatibilitySetting extends XmlComponent { 14582 constructor(version) { 14583 super("w:compatSetting"); 14584 this.root.push( 14585 new CompatibilitySettingAttributes({ 14586 version, 14587 uri: "http://schemas.microsoft.com/office/word", 14588 name: "compatibilityMode" 14589 }) 14590 ); 14591 } 14592 } 14593 class Compatibility extends XmlComponent { 14594 constructor(options2) { 14595 super("w:compat"); 14596 if (options2.version) { 14597 this.root.push(new CompatibilitySetting(options2.version)); 14598 } 14599 if (options2.useSingleBorderforContiguousCells) { 14600 this.root.push(new OnOffElement("w:useSingleBorderforContiguousCells", options2.useSingleBorderforContiguousCells)); 14601 } 14602 if (options2.wordPerfectJustification) { 14603 this.root.push(new OnOffElement("w:wpJustification", options2.wordPerfectJustification)); 14604 } 14605 if (options2.noTabStopForHangingIndent) { 14606 this.root.push(new OnOffElement("w:noTabHangInd", options2.noTabStopForHangingIndent)); 14607 } 14608 if (options2.noLeading) { 14609 this.root.push(new OnOffElement("w:noLeading", options2.noLeading)); 14610 } 14611 if (options2.spaceForUnderline) { 14612 this.root.push(new OnOffElement("w:spaceForUL", options2.spaceForUnderline)); 14613 } 14614 if (options2.noColumnBalance) { 14615 this.root.push(new OnOffElement("w:noColumnBalance", options2.noColumnBalance)); 14616 } 14617 if (options2.balanceSingleByteDoubleByteWidth) { 14618 this.root.push(new OnOffElement("w:balanceSingleByteDoubleByteWidth", options2.balanceSingleByteDoubleByteWidth)); 14619 } 14620 if (options2.noExtraLineSpacing) { 14621 this.root.push(new OnOffElement("w:noExtraLineSpacing", options2.noExtraLineSpacing)); 14622 } 14623 if (options2.doNotLeaveBackslashAlone) { 14624 this.root.push(new OnOffElement("w:doNotLeaveBackslashAlone", options2.doNotLeaveBackslashAlone)); 14625 } 14626 if (options2.underlineTrailingSpaces) { 14627 this.root.push(new OnOffElement("w:ulTrailSpace", options2.underlineTrailingSpaces)); 14628 } 14629 if (options2.doNotExpandShiftReturn) { 14630 this.root.push(new OnOffElement("w:doNotExpandShiftReturn", options2.doNotExpandShiftReturn)); 14631 } 14632 if (options2.spacingInWholePoints) { 14633 this.root.push(new OnOffElement("w:spacingInWholePoints", options2.spacingInWholePoints)); 14634 } 14635 if (options2.lineWrapLikeWord6) { 14636 this.root.push(new OnOffElement("w:lineWrapLikeWord6", options2.lineWrapLikeWord6)); 14637 } 14638 if (options2.printBodyTextBeforeHeader) { 14639 this.root.push(new OnOffElement("w:printBodyTextBeforeHeader", options2.printBodyTextBeforeHeader)); 14640 } 14641 if (options2.printColorsBlack) { 14642 this.root.push(new OnOffElement("w:printColBlack", options2.printColorsBlack)); 14643 } 14644 if (options2.spaceWidth) { 14645 this.root.push(new OnOffElement("w:wpSpaceWidth", options2.spaceWidth)); 14646 } 14647 if (options2.showBreaksInFrames) { 14648 this.root.push(new OnOffElement("w:showBreaksInFrames", options2.showBreaksInFrames)); 14649 } 14650 if (options2.subFontBySize) { 14651 this.root.push(new OnOffElement("w:subFontBySize", options2.subFontBySize)); 14652 } 14653 if (options2.suppressBottomSpacing) { 14654 this.root.push(new OnOffElement("w:suppressBottomSpacing", options2.suppressBottomSpacing)); 14655 } 14656 if (options2.suppressTopSpacing) { 14657 this.root.push(new OnOffElement("w:suppressTopSpacing", options2.suppressTopSpacing)); 14658 } 14659 if (options2.suppressSpacingAtTopOfPage) { 14660 this.root.push(new OnOffElement("w:suppressSpacingAtTopOfPage", options2.suppressSpacingAtTopOfPage)); 14661 } 14662 if (options2.suppressTopSpacingWP) { 14663 this.root.push(new OnOffElement("w:suppressTopSpacingWP", options2.suppressTopSpacingWP)); 14664 } 14665 if (options2.suppressSpBfAfterPgBrk) { 14666 this.root.push(new OnOffElement("w:suppressSpBfAfterPgBrk", options2.suppressSpBfAfterPgBrk)); 14667 } 14668 if (options2.swapBordersFacingPages) { 14669 this.root.push(new OnOffElement("w:swapBordersFacingPages", options2.swapBordersFacingPages)); 14670 } 14671 if (options2.convertMailMergeEsc) { 14672 this.root.push(new OnOffElement("w:convMailMergeEsc", options2.convertMailMergeEsc)); 14673 } 14674 if (options2.truncateFontHeightsLikeWP6) { 14675 this.root.push(new OnOffElement("w:truncateFontHeightsLikeWP6", options2.truncateFontHeightsLikeWP6)); 14676 } 14677 if (options2.macWordSmallCaps) { 14678 this.root.push(new OnOffElement("w:mwSmallCaps", options2.macWordSmallCaps)); 14679 } 14680 if (options2.usePrinterMetrics) { 14681 this.root.push(new OnOffElement("w:usePrinterMetrics", options2.usePrinterMetrics)); 14682 } 14683 if (options2.doNotSuppressParagraphBorders) { 14684 this.root.push(new OnOffElement("w:doNotSuppressParagraphBorders", options2.doNotSuppressParagraphBorders)); 14685 } 14686 if (options2.wrapTrailSpaces) { 14687 this.root.push(new OnOffElement("w:wrapTrailSpaces", options2.wrapTrailSpaces)); 14688 } 14689 if (options2.footnoteLayoutLikeWW8) { 14690 this.root.push(new OnOffElement("w:footnoteLayoutLikeWW8", options2.footnoteLayoutLikeWW8)); 14691 } 14692 if (options2.shapeLayoutLikeWW8) { 14693 this.root.push(new OnOffElement("w:shapeLayoutLikeWW8", options2.shapeLayoutLikeWW8)); 14694 } 14695 if (options2.alignTablesRowByRow) { 14696 this.root.push(new OnOffElement("w:alignTablesRowByRow", options2.alignTablesRowByRow)); 14697 } 14698 if (options2.forgetLastTabAlignment) { 14699 this.root.push(new OnOffElement("w:forgetLastTabAlignment", options2.forgetLastTabAlignment)); 14700 } 14701 if (options2.adjustLineHeightInTable) { 14702 this.root.push(new OnOffElement("w:adjustLineHeightInTable", options2.adjustLineHeightInTable)); 14703 } 14704 if (options2.autoSpaceLikeWord95) { 14705 this.root.push(new OnOffElement("w:autoSpaceLikeWord95", options2.autoSpaceLikeWord95)); 14706 } 14707 if (options2.noSpaceRaiseLower) { 14708 this.root.push(new OnOffElement("w:noSpaceRaiseLower", options2.noSpaceRaiseLower)); 14709 } 14710 if (options2.doNotUseHTMLParagraphAutoSpacing) { 14711 this.root.push(new OnOffElement("w:doNotUseHTMLParagraphAutoSpacing", options2.doNotUseHTMLParagraphAutoSpacing)); 14712 } 14713 if (options2.layoutRawTableWidth) { 14714 this.root.push(new OnOffElement("w:layoutRawTableWidth", options2.layoutRawTableWidth)); 14715 } 14716 if (options2.layoutTableRowsApart) { 14717 this.root.push(new OnOffElement("w:layoutTableRowsApart", options2.layoutTableRowsApart)); 14718 } 14719 if (options2.useWord97LineBreakRules) { 14720 this.root.push(new OnOffElement("w:useWord97LineBreakRules", options2.useWord97LineBreakRules)); 14721 } 14722 if (options2.doNotBreakWrappedTables) { 14723 this.root.push(new OnOffElement("w:doNotBreakWrappedTables", options2.doNotBreakWrappedTables)); 14724 }
14725 if (options2.doNotSnapToGridInCell) { 14726 this.root.push(new OnOffElement("w:doNotSnapToGridInCell", options2.doNotSnapToGridInCell)); 14727 } 14728 if (options2.selectFieldWithFirstOrLastCharacter) { 14729 this.root.push(new OnOffElement("w:selectFldWithFirstOrLastChar", options2.selectFieldWithFirstOrLastCharacter)); 14730 } 14731 if (options2.applyBreakingRules) { 14732 this.root.push(new OnOffElement("w:applyBreakingRules", options2.applyBreakingRules)); 14733 } 14734 if (options2.doNotWrapTextWithPunctuation) { 14735 this.root.push(new OnOffElement("w:doNotWrapTextWithPunct", options2.doNotWrapTextWithPunctuation)); 14736 } 14737 if (options2.doNotUseEastAsianBreakRules) { 14738 this.root.push(new OnOffElement("w:doNotUseEastAsianBreakRules", options2.doNotUseEastAsianBreakRules)); 14739 } 14740 if (options2.useWord2002TableStyleRules) { 14741 this.root.push(new OnOffElement("w:useWord2002TableStyleRules", options2.useWord2002TableStyleRules)); 14742 } 14743 if (options2.growAutofit) { 14744 this.root.push(new OnOffElement("w:growAutofit", options2.growAutofit)); 14745 } 14746 if (options2.useFELayout) { 14747 this.root.push(new OnOffElement("w:useFELayout", options2.useFELayout)); 14748 } 14749 if (options2.useNormalStyleForList) { 14750 this.root.push(new OnOffElement("w:useNormalStyleForList", options2.useNormalStyleForList)); 14751 } 14752 if (options2.doNotUseIndentAsNumberingTabStop) { 14753 this.root.push(new OnOffElement("w:doNotUseIndentAsNumberingTabStop", options2.doNotUseIndentAsNumberingTabStop)); 14754 } 14755 if (options2.useAlternateEastAsianLineBreakRules) { 14756 this.root.push(new OnOffElement("w:useAltKinsokuLineBreakRules", options2.useAlternateEastAsianLineBreakRules)); 14757 } 14758 if (options2.allowSpaceOfSameStyleInTable) { 14759 this.root.push(new OnOffElement("w:allowSpaceOfSameStyleInTable", options2.allowSpaceOfSameStyleInTable)); 14760 } 14761 if (options2.doNotSuppressIndentation) { 14762 this.root.push(new OnOffElement("w:doNotSuppressIndentation", options2.doNotSuppressIndentation)); 14763 } 14764 if (options2.doNotAutofitConstrainedTables) { 14765 this.root.push(new OnOffElement("w:doNotAutofitConstrainedTables", options2.doNotAutofitConstrainedTables)); 14766 } 14767 if (options2.autofitToFirstFixedWidthCell) { 14768 this.root.push(new OnOffElement("w:autofitToFirstFixedWidthCell", options2.autofitToFirstFixedWidthCell)); 14769 } 14770 if (options2.underlineTabInNumberingList) { 14771 this.root.push(new OnOffElement("w:underlineTabInNumList", options2.underlineTabInNumberingList)); 14772 } 14773 if (options2.displayHangulFixedWidth) { 14774 this.root.push(new OnOffElement("w:displayHangulFixedWidth", options2.displayHangulFixedWidth)); 14775 } 14776 if (options2.splitPgBreakAndParaMark) { 14777 this.root.push(new OnOffElement("w:splitPgBreakAndParaMark", options2.splitPgBreakAndParaMark)); 14778 } 14779 if (options2.doNotVerticallyAlignCellWithSp) { 14780 this.root.push(new OnOffElement("w:doNotVertAlignCellWithSp", options2.doNotVerticallyAlignCellWithSp)); 14781 } 14782 if (options2.doNotBreakConstrainedForcedTable) { 14783 this.root.push(new OnOffElement("w:doNotBreakConstrainedForcedTable", options2.doNotBreakConstrainedForcedTable)); 14784 } 14785 if (options2.ignoreVerticalAlignmentInTextboxes) { 14786 this.root.push(new OnOffElement("w:doNotVertAlignInTxbx", options2.ignoreVerticalAlignmentInTextboxes)); 14787 } 14788 if (options2.useAnsiKerningPairs) { 14789 this.root.push(new OnOffElement("w:useAnsiKerningPairs", options2.useAnsiKerningPairs)); 14790 } 14791 if (options2.cachedColumnBalance) { 14792 this.root.push(new OnOffElement("w:cachedColBalance", options2.cachedColumnBalance)); 14793 } 14794 } 14795 } 14796 class SettingsAttributes extends XmlAttributeComponent { 14797 constructor() { 14798 super(...arguments); 14799 __publicField(this, "xmlKeys", { 14800 wpc: "xmlns:wpc", 14801 mc: "xmlns:mc", 14802 o: "xmlns:o", 14803 r: "xmlns:r", 14804 m: "xmlns:m", 14805 v: "xmlns:v", 14806 wp14: "xmlns:wp14", 14807 wp: "xmlns:wp", 14808 w10: "xmlns:w10", 14809 w: "xmlns:w", 14810 w14: "xmlns:w14", 14811 w15: "xmlns:w15", 14812 wpg: "xmlns:wpg", 14813 wpi: "xmlns:wpi", 14814 wne: "xmlns:wne", 14815 wps: "xmlns:wps", 14816 Ignorable: "mc:Ignorable" 14817 }); 14818 } 14819 } 14820 class Settings extends XmlComponent { 14821 constructor(options2) { 14822 var _a, _b, _c, _d; 14823 super("w:settings"); 14824 this.root.push( 14825 new SettingsAttributes({ 14826 wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 14827 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 14828 o: "urn:schemas-microsoft-com:office:office", 14829 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 14830 m: "http://schemas.openxmlformats.org/officeDocument/2006/math", 14831 v: "urn:schemas-microsoft-com:vml", 14832 wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 14833 wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 14834 w10: "urn:schemas-microsoft-com:office:word", 14835 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 14836 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 14837 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 14838 wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 14839 wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 14840 wne: "http://schemas.microsoft.com/office/word/2006/wordml", 14841 wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 14842 Ignorable: "w14 w15 wp14" 14843 }) 14844 );
14845 this.root.push(new OnOffElement("w:displayBackgroundShape", true)); 14846 if (options2.trackRevisions !== void 0) { 14847 this.root.push(new OnOffElement("w:trackRevisions", options2.trackRevisions)); 14848 } 14849 if (options2.evenAndOddHeaders !== void 0) { 14850 this.root.push(new OnOffElement("w:evenAndOddHeaders", options2.evenAndOddHeaders)); 14851 } 14852 if (options2.updateFields !== void 0) { 14853 this.root.push(new OnOffElement("w:updateFields", options2.updateFields)); 14854 } 14855 if (options2.defaultTabStop !== void 0) { 14856 this.root.push(new NumberValueElement("w:defaultTabStop", options2.defaultTabStop)); 14857 } 14858 this.root.push( 14859 new Compatibility(__spreadProps(__spreadValues({}, (_a = options2.compatibility) != null ? _a : {}), { 14860 version: (_d = (_c = (_b = options2.compatibility) == null ? void 0 : _b.version) != null ? _c : options2.compatibilityModeVersion) != null ? _d : 15 14861 })) 14862 ); 14863 } 14864 } 14865 class ComponentAttributes extends XmlAttributeComponent { 14866 constructor() { 14867 super(...arguments); 14868 __publicField(this, "xmlKeys", { val: "w:val" }); 14869 } 14870 } 14871 class Name extends XmlComponent { 14872 constructor(value) { 14873 super("w:name"); 14874 this.root.push(new ComponentAttributes({ val: value })); 14875 } 14876 } 14877 class UiPriority extends XmlComponent { 14878 constructor(value) { 14879 super("w:uiPriority"); 14880 this.root.push(new ComponentAttributes({ val: decimalNumber(value) })); 14881 } 14882 } 14883 class StyleAttributes extends XmlAttributeComponent { 14884 constructor() { 14885 super(...arguments); 14886 __publicField(this, "xmlKeys", { 14887 type: "w:type", 14888 styleId: "w:styleId", 14889 default: "w:default", 14890 customStyle: "w:customStyle" 14891 }); 14892 } 14893 } 14894 class Style extends XmlComponent { 14895 constructor(attributes, options2) { 14896 super("w:style"); 14897 this.root.push(new StyleAttributes(attributes)); 14898 if (options2.name) { 14899 this.root.push(new Name(options2.name)); 14900 } 14901 if (options2.basedOn) { 14902 this.root.push(new StringValueElement("w:basedOn", options2.basedOn)); 14903 } 14904 if (options2.next) { 14905 this.root.push(new StringValueElement("w:next", options2.next)); 14906 } 14907 if (options2.link) { 14908 this.root.push(new StringValueElement("w:link", options2.link)); 14909 } 14910 if (options2.uiPriority !== void 0) { 14911 this.root.push(new UiPriority(options2.uiPriority)); 14912 } 14913 if (options2.semiHidden !== void 0) { 14914 this.root.push(new OnOffElement("w:semiHidden", options2.semiHidden)); 14915 } 14916 if (options2.unhideWhenUsed !== void 0) { 14917 this.root.push(new OnOffElement("w:unhideWhenUsed", options2.unhideWhenUsed)); 14918 } 14919 if (options2.quickFormat !== void 0) { 14920 this.root.push(new OnOffElement("w:qFormat", options2.quickFormat)); 14921 } 14922 } 14923 } 14924 class StyleForParagraph extends Style { 14925 constructor(options2) { 14926 super({ type: "paragraph", styleId: options2.id }, options2); 14927 __publicField(this, "paragraphProperties"); 14928 __publicField(this, "runProperties"); 14929 this.paragraphProperties = new ParagraphProperties(options2.paragraph); 14930 this.runProperties = new RunProperties(options2.run); 14931 this.root.push(this.paragraphProperties); 14932 this.root.push(this.runProperties); 14933 } 14934 } 14935 class StyleForCharacter extends Style { 14936 constructor(options2) { 14937 super( 14938 { type: "character", styleId: options2.id }, 14939 __spreadValues({ 14940 uiPriority: 99, 14941 unhideWhenUsed: true 14942 }, options2) 14943 ); 14944 __publicField(this, "runProperties"); 14945 this.runProperties = new RunProperties(options2.run); 14946 this.root.push(this.runProperties); 14947 } 14948 } 14949 class HeadingStyle extends StyleForParagraph { 14950 constructor(options2) { 14951 super(__spreadValues({ 14952 basedOn: "Normal", 14953 next: "Normal", 14954 quickFormat: true 14955 }, options2)); 14956 } 14957 } 14958 class TitleStyle extends HeadingStyle { 14959 constructor(options2) { 14960 super(__spreadValues({ 14961 id: "Title", 14962 name: "Title" 14963 }, options2)); 14964 } 14965 } 14966 class Heading1Style extends HeadingStyle { 14967 constructor(options2) { 14968 super(__spreadValues({ 14969 id: "Heading1", 14970 name: "Heading 1" 14971 }, options2)); 14972 } 14973 } 14974 class Heading2Style extends HeadingStyle { 14975 constructor(options2) { 14976 super(__spreadValues({ 14977 id: "Heading2", 14978 name: "Heading 2" 14979 }, options2)); 14980 } 14981 } 14982 class Heading3Style extends HeadingStyle { 14983 constructor(options2) { 14984 super(__spreadValues({ 14985 id: "Heading3", 14986 name: "Heading 3" 14987 }, options2)); 14988 } 14989 } 14990 class Heading4Style extends HeadingStyle { 14991 constructor(options2) { 14992 super(__spreadValues({ 14993 id: "Heading4", 14994 name: "Heading 4" 14995 }, options2)); 14996 } 14997 } 14998 class Heading5Style extends HeadingStyle { 14999 constructor(options2) { 15000 super(__spreadValues({ 15001 id: "Heading5", 15002 name: "Heading 5" 15003 }, options2)); 15004 } 15005 } 15006 class Heading6Style extends HeadingStyle { 15007 constructor(options2) { 15008 super(__spreadValues({ 15009 id: "Heading6", 15010 name: "Heading 6" 15011 }, options2)); 15012 } 15013 } 15014 class StrongStyle extends HeadingStyle { 15015 constructor(options2) { 15016 super(__spreadValues({ 15017 id: "Strong", 15018 name: "Strong" 15019 }, options2)); 15020 } 15021 } 15022 class ListParagraph extends StyleForParagraph { 15023 constructor(options2) { 15024 super(__spreadValues({ 15025 id: "ListParagraph", 15026 name: "List Paragraph", 15027 basedOn: "Normal", 15028 quickFormat: true 15029 }, options2)); 15030 } 15031 } 15032 class FootnoteText extends StyleForParagraph { 15033 constructor(options2) { 15034 super(__spreadValues({ 15035 id: "FootnoteText", 15036 name: "footnote text", 15037 link: "FootnoteTextChar", 15038 basedOn: "Normal", 15039 uiPriority: 99, 15040 semiHidden: true, 15041 unhideWhenUsed: true, 15042 paragraph: { 15043 spacing: { 15044 after: 0, 15045 line: 240, 15046 lineRule: LineRuleType.AUTO 15047 } 15048 }, 15049 run: { 15050 size: 20 15051 } 15052 }, options2)); 15053 } 15054 } 15055 class FootnoteReferenceStyle extends StyleForCharacter { 15056 constructor(options2) { 15057 super(__spreadValues({ 15058 id: "FootnoteReference", 15059 name: "footnote reference", 15060 basedOn: "DefaultParagraphFont", 15061 semiHidden: true, 15062 run: { 15063 superScript: true 15064 } 15065 }, options2)); 15066 } 15067 } 15068 class FootnoteTextChar extends StyleForCharacter { 15069 constructor(options2) { 15070 super(__spreadValues({ 15071 id: "FootnoteTextChar", 15072 name: "Footnote Text Char", 15073 basedOn: "DefaultParagraphFont", 15074 link: "FootnoteText", 15075 semiHidden: true, 15076 run: { 15077 size: 20 15078 } 15079 }, options2)); 15080 } 15081 } 15082 class HyperlinkStyle extends StyleForCharacter { 15083 constructor(options2) { 15084 super(__spreadValues({ 15085 id: "Hyperlink", 15086 name: "Hyperlink", 15087 basedOn: "DefaultParagraphFont", 15088 run: { 15089 color: "0563C1", 15090 underline: { 15091 type: UnderlineType.SINGLE 15092 } 15093 } 15094 }, options2)); 15095 } 15096 } 15097 class Styles extends XmlComponent { 15098 constructor(options2) { 15099 super("w:styles"); 15100 if (options2.initialStyles) { 15101 this.root.push(options2.initialStyles); 15102 } 15103 if (options2.importedStyles) { 15104 for (const style of options2.importedStyles) { 15105 this.root.push(style); 15106 } 15107 } 15108 if (options2.paragraphStyles) { 15109 for (const style of options2.paragraphStyles) { 15110 this.root.push(new StyleForParagraph(style)); 15111 } 15112 } 15113 if (options2.characterStyles) { 15114 for (const style of options2.characterStyles) { 15115 this.root.push(new StyleForCharacter(style)); 15116 } 15117 } 15118 } 15119 } 15120 class ParagraphPropertiesDefaults extends XmlComponent { 15121 constructor(options2) { 15122 super("w:pPrDefault"); 15123 this.root.push(new ParagraphProperties(options2)); 15124 } 15125 } 15126 class RunPropertiesDefaults extends XmlComponent { 15127 constructor(options2) { 15128 super("w:rPrDefault"); 15129 this.root.push(new RunProperties(options2)); 15130 } 15131 } 15132 class DocumentDefaults extends XmlComponent { 15133 constructor(options2) { 15134 super("w:docDefaults"); 15135 __publicField(this, "runPropertiesDefaults"); 15136 __publicField(this, "paragraphPropertiesDefaults"); 15137 this.runPropertiesDefaults = new RunPropertiesDefaults(options2.run); 15138 this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options2.paragraph); 15139 this.root.push(this.runPropertiesDefaults); 15140 this.root.push(this.paragraphPropertiesDefaults); 15141 } 15142 } 15143 class ExternalStylesFactory { 15144 /** 15145 * Creates new Style based on the given styles. 15146 * Parses the styles and convert them to XmlComponent. 15147 * Example content from styles.xml: 15148 * <?xml version="1.0"> 15149 * <w:styles xmlns:mc="some schema" ...> 15150 * 15151 * <w:style w:type="paragraph" w:styleId="Heading1"> 15152 * <w:name w:val="heading 1"/> 15153 * ..... 15154 * </w:style> 15155 * 15156 * <w:style w:type="paragraph" w:styleId="Heading2"> 15157 * <w:name w:val="heading 2"/> 15158 * ..... 15159 * </w:style> 15160 * 15161 * <w:docDefaults>Or any other element will be parsed to</w:docDefaults> 15162 * 15163 * </w:styles> 15164 * 15165 * @param externalStyles context from styles.xml 15166 */ 15167 newInstance(xmlData) { 15168 const xmlObj = lib.xml2js(xmlData, { compact: false }); 15169 let stylesXmlElement; 15170 for (const xmlElm of xmlObj.elements || []) { 15171 if (xmlElm.name === "w:styles") { 15172 stylesXmlElement = xmlElm; 15173 } 15174 } 15175 if (stylesXmlElement === void 0) { 15176 throw new Error("can not find styles element"); 15177 } 15178 const stylesElements = stylesXmlElement.elements || []; 15179 const importedStyle = new Styles({ 15180 initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes), 15181 importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm)) 15182 }); 15183 return importedStyle; 15184 } 15185 } 15186 class DefaultStylesFactory { 15187 newInstance(options2 = {}) { 15188 var _a; 15189 const documentAttributes = new DocumentAttributes({ 15190 mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", 15191 r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 15192 w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 15193 w14: "http://schemas.microsoft.com/office/word/2010/wordml", 15194 w15: "http://schemas.microsoft.com/office/word/2012/wordml", 15195 Ignorable: "w14 w15" 15196 }); 15197 return { 15198 initialStyles: documentAttributes, 15199 importedStyles: [ 15200 new DocumentDefaults((_a = options2.document) != null ? _a : {}), 15201 new TitleStyle(__spreadValues({ 15202 run: { 15203 size: 56 15204 } 15205 }, options2.title)), 15206 new Heading1Style(__spreadValues({ 15207 run: { 15208 color: "2E74B5", 15209 size: 32 15210 } 15211 }, options2.heading1)), 15212 new Heading2Style(__spreadValues({ 15213 run: { 15214 color: "2E74B5", 15215 size: 26 15216 } 15217 }, options2.heading2)), 15218 new Heading3Style(__spreadValues({ 15219 run: { 15220 color: "1F4D78", 15221 size: 24 15222 } 15223 }, options2.heading3)), 15224 new Heading4Style(__spreadValues({ 15225 run: { 15226 color: "2E74B5", 15227 italics: true 15228 } 15229 }, options2.heading4)), 15230 new Heading5Style(__spreadValues({ 15231 run: { 15232 color: "2E74B5" 15233 } 15234 }, options2.heading5)), 15235 new Heading6Style(__spreadValues({ 15236 run: { 15237 color: "1F4D78" 15238 } 15239 }, options2.heading6)), 15240 new StrongStyle(__spreadValues({ 15241 run: { 15242 bold: true 15243 } 15244 }, options2.strong)), 15245 new ListParagraph(options2.listParagraph || {}),
15246 new HyperlinkStyle(options2.hyperlink || {}), 15247 new FootnoteReferenceStyle(options2.footnoteReference || {}), 15248 new FootnoteText(options2.footnoteText || {}), 15249 new FootnoteTextChar(options2.footnoteTextChar || {}) 15250 ] 15251 }; 15252 } 15253 } 15254 const CharacterSet = { 15255 ANSI: "00", 15256 DEFAULT: "01", 15257 SYMBOL: "02", 15258 MAC: "4D", 15259 JIS: "80", 15260 HANGUL: "81", 15261 JOHAB: "82", 15262 GB_2312: "86", 15263 CHINESEBIG5: "88", 15264 GREEK: "A1", 15265 TURKISH: "A2", 15266 VIETNAMESE: "A3", 15267 HEBREW: "B1", 15268 ARABIC: "B2", 15269 BALTIC: "BA", 15270 RUSSIAN: "CC", 15271 THAI: "DE", 15272 EASTEUROPE: "EE", 15273 OEM: "FF" 15274 }; 15275 const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({ 15276 name, 15277 attributes: __spreadValues({ 15278 id: { key: "r:id", value: id } 15279 }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}), 15280 children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []] 15281 }); 15282 const createFont = ({ 15283 name, 15284 altName, 15285 panose1, 15286 charset, 15287 family, 15288 notTrueType, 15289 pitch, 15290 sig, 15291 embedRegular, 15292 embedBold, 15293 embedItalic, 15294 embedBoldItalic 15295 }) => ( 15296 // http://www.datypic.com/sc/ooxml/e-w_font-1.html 15297 new BuilderElement({ 15298 name: "w:font", 15299 attributes: { 15300 name: { key: "w:name", value: name } 15301 }, 15302 children: [ 15303 // http://www.datypic.com/sc/ooxml/e-w_altName-1.html 15304 ...altName ? [createStringElement("w:altName", altName)] : [], 15305 // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html 15306 ...panose1 ? [createStringElement("w:panose1", panose1)] : [], 15307 // http://www.datypic.com/sc/ooxml/e-w_charset-1.html 15308 ...charset ? [createStringElement("w:charset", charset)] : [], 15309 // http://www.datypic.com/sc/ooxml/e-w_family-1.html 15310 ...family ? [createStringElement("w:family", family)] : [], 15311 // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html 15312 ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [], 15313 ...pitch ? [createStringElement("w:pitch", pitch)] : [], 15314 // http://www.datypic.com/sc/ooxml/e-w_sig-1.html 15315 ...sig ? [ 15316 new BuilderElement({ 15317 name: "w:sig", 15318 attributes: { 15319 usb0: { key: "w:usb0", value: sig.usb0 }, 15320 usb1: { key: "w:usb1", value: sig.usb1 }, 15321 usb2: { key: "w:usb2", value: sig.usb2 }, 15322 usb3: { key: "w:usb3", value: sig.usb3 }, 15323 csb0: { key: "w:csb0", value: sig.csb0 }, 15324 csb1: { key: "w:csb1", value: sig.csb1 } 15325 } 15326 }) 15327 ] : [], 15328 // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html 15329 ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [], 15330 // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html 15331 ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [], 15332 // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html 15333 ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [], 15334 // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html 15335 ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : [] 15336 ] 15337 }) 15338 ); 15339 const createRegularFont = ({ 15340 name, 15341 index, 15342 fontKey, 15343 characterSet 15344 }) => createFont({ 15345 name, 15346 sig: { 15347 usb0: "E0002AFF", 15348 usb1: "C000247B", 15349 usb2: "00000009", 15350 usb3: "00000000", 15351 csb0: "000001FF", 15352 csb1: "00000000" 15353 }, 15354 charset: characterSet, 15355 family: "auto", 15356 pitch: "variable", 15357 embedRegular: { 15358 fontKey, 15359 id: `rId${index}` 15360 } 15361 }); 15362 const createFontTable = (fonts) => ( 15363 // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html 15364 // http://www.datypic.com/sc/ooxml/e-w_fonts.html 15365 new BuilderElement({ 15366 name: "w:fonts", 15367 attributes: { 15368 mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" }, 15369 r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" }, 15370 w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" }, 15371 w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" }, 15372 w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" }, 15373 w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" }, 15374 w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" }, 15375 w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" }, 15376 w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" }, 15377 w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" }, 15378 Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" } 15379 }, 15380 children: fonts.map( 15381 (font, i) => createRegularFont({ 15382 name: font.name, 15383 index: i + 1, 15384 fontKey: font.fontKey 15385 }) 15386 ) 15387 }) 15388 ); 15389 class FontWrapper { 15390 constructor(options2) { 15391 __publicField(this, "fontTable"); 15392 __publicField(this, "relationships"); 15393 __publicField(this, "fontOptionsWithKey", []); 15394 this.options = options2; 15395 this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() })); 15396 this.fontTable = createFontTable(this.fontOptionsWithKey); 15397 this.relationships = new Relationships(); 15398 for (let i = 0; i < options2.length; i++) { 15399 this.relationships.createRelationship( 15400 i + 1, 15401 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font", 15402 `fonts/${options2[i].name}.odttf` 15403 ); 15404 } 15405 } 15406 get View() { 15407 return this.fontTable; 15408 } 15409 get Relationships() { 15410 return this.relationships; 15411 } 15412 } 15413 class File { 15414 constructor(options2) { 15415 // eslint-disable-next-line functional/prefer-readonly-type 15416 __publicField(this, "currentRelationshipId", 1); 15417 __publicField(this, "documentWrapper"); 15418 // eslint-disable-next-line functional/prefer-readonly-type 15419 __publicField(this, "headers", []); 15420 // eslint-disable-next-line functional/prefer-readonly-type 15421 __publicField(this, "footers", []); 15422 __publicField(this, "coreProperties"); 15423 __publicField(this, "numbering"); 15424 __publicField(this, "media"); 15425 __publicField(this, "fileRelationships"); 15426 __publicField(this, "footnotesWrapper"); 15427 __publicField(this, "settings"); 15428 __publicField(this, "contentTypes"); 15429 __publicField(this, "customProperties"); 15430 __publicField(this, "appProperties"); 15431 __publicField(this, "styles"); 15432 __publicField(this, "comments"); 15433 __publicField(this, "fontWrapper"); 15434 var _a, _b, _c, _d, _e, _f, _g, _h; 15435 this.coreProperties = new CoreProperties(__spreadProps(__spreadValues({}, options2), { 15436 creator: (_a = options2.creator) != null ? _a : "Un-named", 15437 revision: (_b = options2.revision) != null ? _b : 1, 15438 lastModifiedBy: (_c = options2.lastModifiedBy) != null ? _c : "Un-named" 15439 }));
15440 this.numbering = new Numbering(options2.numbering ? options2.numbering : { config: [] }); 15441 this.comments = new Comments((_d = options2.comments) != null ? _d : { children: [] }); 15442 this.fileRelationships = new Relationships(); 15443 this.customProperties = new CustomProperties((_e = options2.customProperties) != null ? _e : []); 15444 this.appProperties = new AppProperties(); 15445 this.footnotesWrapper = new FootnotesWrapper(); 15446 this.contentTypes = new ContentTypes(); 15447 this.documentWrapper = new DocumentWrapper({ background: options2.background }); 15448 this.settings = new Settings({ 15449 compatibilityModeVersion: options2.compatabilityModeVersion, 15450 compatibility: options2.compatibility, 15451 evenAndOddHeaders: options2.evenAndOddHeaderAndFooters ? true : false, 15452 trackRevisions: (_f = options2.features) == null ? void 0 : _f.trackRevisions, 15453 updateFields: (_g = options2.features) == null ? void 0 : _g.updateFields, 15454 defaultTabStop: options2.defaultTabStop 15455 }); 15456 this.media = new Media(); 15457 if (options2.externalStyles) { 15458 const stylesFactory = new ExternalStylesFactory(); 15459 this.styles = stylesFactory.newInstance(options2.externalStyles); 15460 } else if (options2.styles) { 15461 const stylesFactory = new DefaultStylesFactory(); 15462 const defaultStyles = stylesFactory.newInstance(options2.styles.default); 15463 this.styles = new Styles(__spreadValues(__spreadValues({}, defaultStyles), options2.styles)); 15464 } else { 15465 const stylesFactory = new DefaultStylesFactory(); 15466 this.styles = new Styles(stylesFactory.newInstance()); 15467 } 15468 this.addDefaultRelationships(); 15469 for (const section of options2.sections) { 15470 this.addSection(section); 15471 } 15472 if (options2.footnotes) { 15473 for (const key in options2.footnotes) { 15474 this.footnotesWrapper.View.createFootNote(parseFloat(key), options2.footnotes[key].children); 15475 } 15476 } 15477 this.fontWrapper = new FontWrapper((_h = options2.fonts) != null ? _h : []); 15478 } 15479 addSection({ headers = {}, footers = {}, children, properties }) { 15480 this.documentWrapper.View.Body.addSection(__spreadProps(__spreadValues({}, properties), { 15481 headerWrapperGroup: { 15482 default: headers.default ? this.createHeader(headers.default) : void 0, 15483 first: headers.first ? this.createHeader(headers.first) : void 0, 15484 even: headers.even ? this.createHeader(headers.even) : void 0 15485 }, 15486 footerWrapperGroup: { 15487 default: footers.default ? this.createFooter(footers.default) : void 0, 15488 first: footers.first ? this.createFooter(footers.first) : void 0, 15489 even: footers.even ? this.createFooter(footers.even) : void 0 15490 } 15491 })); 15492 for (const child of children) { 15493 this.documentWrapper.View.add(child); 15494 } 15495 } 15496 createHeader(header) { 15497 const wrapper = new HeaderWrapper(this.media, this.currentRelationshipId++); 15498 for (const child of header.options.children) { 15499 wrapper.add(child); 15500 } 15501 this.addHeaderToDocument(wrapper); 15502 return wrapper; 15503 } 15504 createFooter(footer) { 15505 const wrapper = new FooterWrapper(this.media, this.currentRelationshipId++); 15506 for (const child of footer.options.children) { 15507 wrapper.add(child); 15508 } 15509 this.addFooterToDocument(wrapper); 15510 return wrapper; 15511 } 15512 addHeaderToDocument(header, type = HeaderFooterReferenceType.DEFAULT) { 15513 this.headers.push({ header, type }); 15514 this.documentWrapper.Relationships.createRelationship( 15515 header.View.ReferenceId, 15516 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", 15517 `header${this.headers.length}.xml` 15518 ); 15519 this.contentTypes.addHeader(this.headers.length); 15520 } 15521 addFooterToDocument(footer, type = HeaderFooterReferenceType.DEFAULT) { 15522 this.footers.push({ footer, type }); 15523 this.documentWrapper.Relationships.createRelationship( 15524 footer.View.ReferenceId, 15525 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", 15526 `footer${this.footers.length}.xml` 15527 ); 15528 this.contentTypes.addFooter(this.footers.length); 15529 } 15530 addDefaultRelationships() { 15531 this.fileRelationships.createRelationship( 15532 1, 15533 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", 15534 "word/document.xml" 15535 ); 15536 this.fileRelationships.createRelationship( 15537 2, 15538 "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", 15539 "docProps/core.xml" 15540 ); 15541 this.fileRelationships.createRelationship( 15542 3, 15543 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", 15544 "docProps/app.xml" 15545 ); 15546 this.fileRelationships.createRelationship( 15547 4, 15548 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties", 15549 "docProps/custom.xml" 15550 ); 15551 this.documentWrapper.Relationships.createRelationship( 15552 // eslint-disable-next-line functional/immutable-data 15553 this.currentRelationshipId++, 15554 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", 15555 "styles.xml" 15556 ); 15557 this.documentWrapper.Relationships.createRelationship( 15558 // eslint-disable-next-line functional/immutable-data 15559 this.currentRelationshipId++, 15560 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", 15561 "numbering.xml" 15562 ); 15563 this.documentWrapper.Relationships.createRelationship( 15564 // eslint-disable-next-line functional/immutable-data 15565 this.currentRelationshipId++, 15566 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", 15567 "footnotes.xml" 15568 ); 15569 this.documentWrapper.Relationships.createRelationship( 15570 // eslint-disable-next-line functional/immutable-data 15571 this.currentRelationshipId++, 15572 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", 15573 "settings.xml" 15574 ); 15575 this.documentWrapper.Relationships.createRelationship( 15576 // eslint-disable-next-line functional/immutable-data 15577 this.currentRelationshipId++, 15578 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", 15579 "comments.xml" 15580 ); 15581 } 15582 get Document() { 15583 return this.documentWrapper; 15584 } 15585 get Styles() { 15586 return this.styles; 15587 } 15588 get CoreProperties() { 15589 return this.coreProperties; 15590 } 15591 get Numbering() { 15592 return this.numbering; 15593 } 15594 get Media() { 15595 return this.media; 15596 } 15597 get FileRelationships() { 15598 return this.fileRelationships; 15599 } 15600 get Headers() { 15601 return this.headers.map((item) => item.header); 15602 } 15603 get Footers() { 15604 return this.footers.map((item) => item.footer); 15605 } 15606 get ContentTypes() { 15607 return this.contentTypes; 15608 } 15609 get CustomProperties() { 15610 return this.customProperties; 15611 } 15612 get AppProperties() { 15613 return this.appProperties; 15614 } 15615 get FootNotes() { 15616 return this.footnotesWrapper; 15617 } 15618 get Settings() { 15619 return this.settings; 15620 } 15621 get Comments() { 15622 return this.comments; 15623 } 15624 get FontTable() { 15625 return this.fontWrapper; 15626 } 15627 } 15628 class FieldInstruction extends XmlComponent { 15629 constructor(properties = {}) { 15630 super("w:instrText"); 15631 __publicField(this, "properties"); 15632 this.properties = properties; 15633 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 15634 let instruction = "TOC"; 15635 if (this.properties.captionLabel) { 15636 instruction = `${instruction} \\a "${this.properties.captionLabel}"`; 15637 } 15638 if (this.properties.entriesFromBookmark) { 15639 instruction = `${instruction} \\b "${this.properties.entriesFromBookmark}"`; 15640 } 15641 if (this.properties.captionLabelIncludingNumbers) { 15642 instruction = `${instruction} \\c "${this.properties.captionLabelIncludingNumbers}"`; 15643 } 15644 if (this.properties.sequenceAndPageNumbersSeparator) { 15645 instruction = `${instruction} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`; 15646 } 15647 if (this.properties.tcFieldIdentifier) { 15648 instruction = `${instruction} \\f "${this.properties.tcFieldIdentifier}"`; 15649 } 15650 if (this.properties.hyperlink) { 15651 instruction = `${instruction} \\h`; 15652 } 15653 if (this.properties.tcFieldLevelRange) { 15654 instruction = `${instruction} \\l "${this.properties.tcFieldLevelRange}"`; 15655 } 15656 if (this.properties.pageNumbersEntryLevelsRange) { 15657 instruction = `${instruction} \\n "${this.properties.pageNumbersEntryLevelsRange}"`; 15658 } 15659 if (this.properties.headingStyleRange) { 15660 instruction = `${instruction} \\o "${this.properties.headingStyleRange}"`; 15661 } 15662 if (this.properties.entryAndPageNumberSeparator) { 15663 instruction = `${instruction} \\p "${this.properties.entryAndPageNumberSeparator}"`; 15664 } 15665 if (this.properties.seqFieldIdentifierForPrefix) { 15666 instruction = `${instruction} \\s "${this.properties.seqFieldIdentifierForPrefix}"`; 15667 } 15668 if (this.properties.stylesWithLevels && this.properties.stylesWithLevels.length) { 15669 const styles = this.properties.stylesWithLevels.map((sl) => `${sl.styleName},${sl.level}`).join(","); 15670 instruction = `${instruction} \\t "${styles}"`; 15671 } 15672 if (this.properties.useAppliedParagraphOutlineLevel) { 15673 instruction = `${instruction} \\u`; 15674 } 15675 if (this.properties.preserveTabInEntries) { 15676 instruction = `${instruction} \\w`; 15677 } 15678 if (this.properties.preserveNewLineInEntries) { 15679 instruction = `${instruction} \\x`; 15680 } 15681 if (this.properties.hideTabAndPageNumbersInWebView) { 15682 instruction = `${instruction} \\z`; 15683 } 15684 this.root.push(instruction); 15685 } 15686 } 15687 class StructuredDocumentTagContent extends XmlComponent { 15688 constructor() { 15689 super("w:sdtContent"); 15690 } 15691 } 15692 class StructuredDocumentTagProperties extends XmlComponent { 15693 constructor(alias) { 15694 super("w:sdtPr"); 15695 if (alias) { 15696 this.root.push(new StringValueElement("w:alias", alias)); 15697 } 15698 } 15699 } 15700 class TableOfContents extends FileChild { 15701 constructor(alias = "Table of Contents", properties) { 15702 super("w:sdt"); 15703 this.root.push(new StructuredDocumentTagProperties(alias)); 15704 const content = new StructuredDocumentTagContent(); 15705 const beginParagraph = new Paragraph({ 15706 children: [ 15707 new Run({ 15708 children: [new Begin(true), new FieldInstruction(properties), new Separate()] 15709 }) 15710 ] 15711 }); 15712 content.addChildElement(beginParagraph); 15713 const endParagraph = new Paragraph({ 15714 children: [ 15715 new Run({ 15716 children: [new End()] 15717 }) 15718 ] 15719 }); 15720 content.addChildElement(endParagraph); 15721 this.root.push(content); 15722 } 15723 } 15724 class StyleLevel { 15725 constructor(styleName, level) { 15726 __publicField(this, "styleName"); 15727 __publicField(this, "level"); 15728 this.styleName = styleName; 15729 this.level = level; 15730 } 15731 } 15732 class Header { 15733 constructor(options2 = { children: [] }) { 15734 __publicField(this, "options"); 15735 this.options = options2; 15736 } 15737 } 15738 class Footer { 15739 constructor(options2 = { children: [] }) { 15740 __publicField(this, "options"); 15741 this.options = options2; 15742 } 15743 } 15744 class FootNoteReferenceRunAttributes extends XmlAttributeComponent { 15745 constructor() { 15746 super(...arguments); 15747 __publicField(this, "xmlKeys", { 15748 id: "w:id" 15749 }); 15750 } 15751 } 15752 class FootnoteReference extends XmlComponent { 15753 constructor(id) { 15754 super("w:footnoteReference"); 15755 this.root.push( 15756 new FootNoteReferenceRunAttributes({ 15757 id 15758 }) 15759 ); 15760 } 15761 } 15762 class FootnoteReferenceRun extends Run { 15763 constructor(id) { 15764 super({ style: "FootnoteReference" }); 15765 this.root.push(new FootnoteReference(id)); 15766 } 15767 } 15768 class InsertedTextRun extends XmlComponent { 15769 constructor(options2) { 15770 super("w:ins"); 15771 this.root.push( 15772 new ChangeAttributes({ 15773 id: options2.id, 15774 author: options2.author, 15775 date: options2.date 15776 }) 15777 ); 15778 this.addChildElement(new TextRun(options2)); 15779 } 15780 } 15781 class DeletedPage extends XmlComponent { 15782 constructor() { 15783 super("w:delInstrText"); 15784 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 15785 this.root.push("PAGE"); 15786 } 15787 } 15788 class DeletedNumberOfPages extends XmlComponent { 15789 constructor() { 15790 super("w:delInstrText"); 15791 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 15792 this.root.push("NUMPAGES"); 15793 } 15794 } 15795 class DeletedNumberOfPagesSection extends XmlComponent { 15796 constructor() { 15797 super("w:delInstrText"); 15798 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 15799 this.root.push("SECTIONPAGES"); 15800 } 15801 } 15802 class DeletedText extends XmlComponent { 15803 constructor(text) { 15804 super("w:delText"); 15805 this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); 15806 this.root.push(text); 15807 } 15808 } 15809 class DeletedTextRun extends XmlComponent { 15810 constructor(options2) { 15811 super("w:del"); 15812 __publicField(this, "deletedTextRunWrapper"); 15813 this.root.push( 15814 new ChangeAttributes({ 15815 id: options2.id, 15816 author: options2.author, 15817 date: options2.date 15818 }) 15819 ); 15820 this.deletedTextRunWrapper = new DeletedTextRunWrapper(options2); 15821 this.addChildElement(this.deletedTextRunWrapper); 15822 } 15823 } 15824 class DeletedTextRunWrapper extends XmlComponent { 15825 constructor(options2) { 15826 super("w:r"); 15827 this.root.push(new RunProperties(options2)); 15828 if (options2.children) { 15829 for (const child of options2.children) { 15830 if (typeof child === "string") { 15831 switch (child) { 15832 case PageNumber.CURRENT: 15833 this.root.push(new Begin()); 15834 this.root.push(new DeletedPage()); 15835 this.root.push(new Separate()); 15836 this.root.push(new End()); 15837 break; 15838 case PageNumber.TOTAL_PAGES: 15839 this.root.push(new Begin()); 15840 this.root.push(new DeletedNumberOfPages()); 15841 this.root.push(new Separate()); 15842 this.root.push(new End()); 15843 break; 15844 case PageNumber.TOTAL_PAGES_IN_SECTION: 15845 this.root.push(new Begin()); 15846 this.root.push(new DeletedNumberOfPagesSection()); 15847 this.root.push(new Separate()); 15848 this.root.push(new End()); 15849 break; 15850 default: 15851 this.root.push(new DeletedText(child)); 15852 break; 15853 } 15854 continue; 15855 } 15856 this.root.push(child); 15857 } 15858 } else if (options2.text) { 15859 this.root.push(new DeletedText(options2.text)); 15860 } 15861 if (options2.break) { 15862 for (let i = 0; i < options2.break; i++) { 15863 this.root.splice(1, 0, new Break$1()); 15864 } 15865 } 15866 } 15867 } 15868 class CheckboxSymbolAttributes extends XmlAttributeComponent { 15869 constructor() { 15870 super(...arguments); 15871 __publicField(this, "xmlKeys", { 15872 val: "w14:val", 15873 symbolfont: "w14:font" 15874 }); 15875 } 15876 } 15877 class CheckBoxSymbolElement extends XmlComponent { 15878 constructor(name, val, font) { 15879 super(name); 15880 if (font) { 15881 this.root.push(new CheckboxSymbolAttributes({ val: shortHexNumber(val), symbolfont: font })); 15882 } else { 15883 this.root.push(new CheckboxSymbolAttributes({ val })); 15884 } 15885 } 15886 } 15887 class CheckBoxUtil extends XmlComponent { 15888 constructor(options2) { 15889 var _a, _b, _c, _d, _e, _f, _g, _h; 15890 super("w14:checkbox"); 15891 __publicField(this, "DEFAULT_UNCHECKED_SYMBOL", "2610"); 15892 __publicField(this, "DEFAULT_CHECKED_SYMBOL", "2612"); 15893 __publicField(this, "DEFAULT_FONT", "MS Gothic"); 15894 const value = (options2 == null ? void 0 : options2.checked) ? "1" : "0"; 15895 let symbol; 15896 let font; 15897 this.root.push(new Chec
15897kBoxSymbolElement("w14:checked", value)); 15898 symbol = ((_a = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _a.value) ? (_b = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _b.value : this.DEFAULT_CHECKED_SYMBOL; 15899 font = ((_c = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _c.font) ? (_d = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _d.font : this.DEFAULT_FONT; 15900 this.root.push(new CheckBoxSymbolElement("w14:checkedState", symbol, font)); 15901 symbol = ((_e = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _e.value) ? (_f = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _f.value : this.DEFAULT_UNCHECKED_SYMBOL; 15902 font = ((_g = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _g.font) ? (_h = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _h.font : this.DEFAULT_FONT; 15903 this.root.push(new CheckBoxSymbolElement("w14:uncheckedState", symbol, font)); 15904 } 15905 } 15906 class CheckBox extends XmlComponent { 15907 constructor(options2) { 15908 var _a, _b, _c, _d; 15909 super("w:sdt"); 15910 // default values per Microsoft 15911 __publicField(this, "DEFAULT_UNCHECKED_SYMBOL", "2610"); 15912 __publicField(this, "DEFAULT_CHECKED_SYMBOL", "2612"); 15913 __publicField(this, "DEFAULT_FONT", "MS Gothic"); 15914 const properties = new StructuredDocumentTagProperties(options2 == null ? void 0 : options2.alias); 15915 properties.addChildElement(new CheckBoxUtil(options2)); 15916 this.root.push(properties); 15917 const content = new StructuredDocumentTagContent(); 15918 const checkedFont = (_a = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _a.font; 15919 const checkedText = (_b = options2 == null ? void 0 : options2.checkedState) == null ? void 0 : _b.value; 15920 const uncheckedFont = (_c = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _c.font; 15921 const uncheckedText = (_d = options2 == null ? void 0 : options2.uncheckedState) == null ? void 0 : _d.value; 15922 let symbolFont; 15923 let char; 15924 if (options2 == null ? void 0 : options2.checked) { 15925 symbolFont = checkedFont ? checkedFont : this.DEFAULT_FONT; 15926 char = checkedText ? checkedText : this.DEFAULT_CHECKED_SYMBOL; 15927 } else { 15928 symbolFont = uncheckedFont ? uncheckedFont : this.DEFAULT_FONT; 15929 char = uncheckedText ? uncheckedText : this.DEFAULT_UNCHECKED_SYMBOL; 15930 } 15931 const initialRenderedChar = new SymbolRun({ 15932 char, 15933 symbolfont: symbolFont 15934 }); 15935 content.addChildElement(initialRenderedChar); 15936 this.root.push(content); 15937 } 15938 } 15939 function commonjsRequire(path) { 15940 throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); 15941 } 15942 var jszip_min = { exports: {} }; 15943 (function(module2, exports3) { 15944 !function(e) { 15945 module2.exports = e(); 15946 }(function() { 15947 return function s(a, o, h) { 15948 function u(r, e2) { 15949 if (!o[r]) { 15950 if (!a[r]) { 15951 var t = "function" == typeof commonjsRequire && commonjsRequire; 15952 if (!e2 && t) 15953 return t(r, true); 15954 if (l) 15955 return l(r, true); 15956 var n = new Error("Cannot find module '" + r + "'"); 15957 throw n.code = "MODULE_NOT_FOUND", n; 15958 } 15959 var i = o[r] = { exports: {} }; 15960 a[r][0].call(i.exports, function(e3) { 15961 var t2 = a[r][1][e3]; 15962 return u(t2 || e3); 15963 }, i, i.exports, s, a, o, h); 15964 } 15965 return o[r].exports; 15966 } 15967 for (var l = "function" == typeof commonjsRequire && commonjsRequire, e = 0; e < h.length; e++) 15968 u(h[e]); 15969 return u; 15970 }({ 1: [function(e, t, r) { 15971 var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 18,855 bytes, lines 15971-16267
15971+/="; 15972 r.encode = function(e2) { 15973 for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) 15974 f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o)); 15975 return h.join(""); 15976 }, r.decode = function(e2) { 15977 var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:"; 15978 if (e2.substr(0, u.length) === u) 15979 throw new Error("Invalid base64 input, it looks like a data url."); 15980 var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; 15981 if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) 15982 throw new Error("Invalid base64 input, bad content length."); 15983 for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) 15984 t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n); 15985 return l; 15986 }; 15987 }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) { 15988 var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe"); 15989 function o(e2, t2, r2, n2, i2) { 15990 this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2; 15991 } 15992 o.prototype = { getContentWorker: function() { 15993 var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this; 15994 return e2.on("end", function() { 15995 if (this.streamInfo.data_length !== t2.uncompressedSize) 15996 throw new Error("Bug : uncompressed data size mismatch"); 15997 }), e2; 15998 }, getCompressedWorker: function() { 15999 return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); 16000 } }, o.createWorkerFrom = function(e2, t2, r2) { 16001 return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2); 16002 }, t.exports = o; 16003 }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) { 16004 var n = e("./stream/GenericWorker"); 16005 r.STORE = { magic: "\0\0", compressWorker: function() { 16006 return new n("STORE compression"); 16007 }, uncompressWorker: function() { 16008 return new n("STORE decompression"); 16009 } }, r.DEFLATE = e("./flate"); 16010 }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) { 16011 var n = e("./utils"); 16012 var o = function() { 16013 for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { 16014 e2 = r2; 16015 for (var n2 = 0; n2 < 8; n2++) 16016 e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; 16017 t2[r2] = e2; 16018 } 16019 return t2; 16020 }(); 16021 t.exports = function(e2, t2) { 16022 return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) { 16023 var i = o, s = n2 + r2; 16024 e3 ^= -1; 16025 for (var a = n2; a < s; a++) 16026 e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])]; 16027 return -1 ^ e3; 16028 }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) { 16029 var i = o, s = n2 + r2; 16030 e3 ^= -1; 16031 for (var a = n2; a < s; a++) 16032 e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))]; 16033 return -1 ^ e3; 16034 }(0 | t2, e2, e2.length, 0) : 0; 16035 }; 16036 }, { "./utils": 32 }], 5: [function(e, t, r) { 16037 r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null; 16038 }, {}], 6: [function(e, t, r) { 16039 var n = null; 16040 n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n }; 16041 }, { lie: 37 }], 7: [function(e, t, r) { 16042 var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array"; 16043 function h(e2, t2) { 16044 a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {}; 16045 } 16046 r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) { 16047 this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false); 16048 }, h.prototype.flush = function() { 16049 a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); 16050 }, h.prototype.cleanUp = function() { 16051 a.prototype.cleanUp.call(this), this._pako = null; 16052 }, h.prototype._createPako = function() { 16053 this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); 16054 var t2 = this; 16055 this._pako.onData = function(e2) { 16056 t2.push({ data: e2, meta: t2.meta }); 16057 }; 16058 }, r.compressWorker = function(e2) { 16059 return new h("Deflate", e2); 16060 }, r.uncompressWorker = function() { 16061 return new h("Inflate", {}); 16062 }; 16063 }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) { 16064 function A(e2, t2) { 16065 var r2, n2 = ""; 16066 for (r2 = 0; r2 < t2; r2++) 16067 n2 += String.fromCharCode(255 & e2), e2 >>>= 8; 16068 return n2; 16069 } 16070 function n(e2, t2, r2, n2, i2, s2) { 16071 var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; 16072 t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize); 16073 var S = 0; 16074 t2 && (S |= 8), l || !_ && !g || (S |= 2048); 16075 var z = 0, C = 0; 16076 w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) { 16077 var r3 = e3; 16078 return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16; 16079 }(h.unixPermissions, w)) : (C = 20, z |= function(e3) { 16080 return 63 & (e3 || 0); 16081 }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y); 16082 var E = ""; 16083 return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R2.LOCAL_FILE_HEADER + E + f + b, dirRecord: R2.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p }; 16084 } 16085 var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R2 = e("../signature"); 16086 function s(e2, t2, r2, n2) { 16087 i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; 16088 } 16089 I.inherits(s, i), s.prototype.push = function(e2) { 16090 var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length; 16091 this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } })); 16092 }, s.prototype.openedSource = function(e2) { 16093 this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name; 16094 var t2 = this.streamFiles && !e2.file.dir; 16095 if (t2) { 16096 var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); 16097 this.push({ data: r2.fileRecord, meta: { percent: 0 } }); 16098 } else 16099 this.accumulate = true; 16100 }, s.prototype.closedSource = function(e2) { 16101 this.accumulate = false; 16102 var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); 16103 if (this.dirRecords.push(r2.dirRecord), t2) 16104 this.push({ data: function(e3) { 16105 return R2.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4); 16106 }(e2), meta: { percent: 100 } }); 16107 else 16108 for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) 16109 this.push(this.contentBuffer.shift()); 16110 this.currentFile = null; 16111 }, s.prototype.flush = function() { 16112 for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) 16113 this.push({ data: this.dirRecords[t2], meta: { percent: 100 } }); 16114 var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) { 16115 var s2 = I.transformTo("string", i2(n3)); 16116 return R2.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2; 16117 }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName); 16118 this.push({ data: n2, meta: { percent: 100 } }); 16119 }, s.prototype.prepareNextSource = function() { 16120 this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); 16121 }, s.prototype.registerPrevious = function(e2) { 16122 this._sources.push(e2); 16123 var t2 = this; 16124 return e2.on("data", function(e3) { 16125 t2.processChunk(e3); 16126 }), e2.on("end", function() { 16127 t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end(); 16128 }), e2.on("error", function(e3) { 16129 t2.error(e3); 16130 }), this; 16131 }, s.prototype.resume = function() { 16132 return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); 16133 }, s.prototype.error = function(e2) { 16134 var t2 = this._sources; 16135 if (!i.prototype.error.call(this, e2)) 16136 return false; 16137 for (var r2 = 0; r2 < t2.length; r2++) 16138 try { 16139 t2[r2].error(e2); 16140 } catch (e3) { 16141 } 16142 return true; 16143 }, s.prototype.lock = function() { 16144 i.prototype.lock.call(this); 16145 for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) 16146 e2[t2].lock(); 16147 }, t.exports = s; 16148 }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) { 16149 var u = e("../compressions"), n = e("./ZipFileWorker"); 16150 r.generateWorker = function(e2, a, t2) { 16151 var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0; 16152 try { 16153 e2.forEach(function(e3, t3) { 16154 h++; 16155 var r2 = function(e4, t4) { 16156 var r3 = e4 || t4, n3 = u[r3]; 16157 if (!n3) 16158 throw new Error(r3 + " is not a valid compression method !"); 16159 return n3; 16160 }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date; 16161 t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o); 16162 }), o.entriesCount = h; 16163 } catch (e3) { 16164 o.error(e3); 16165 } 16166 return o; 16167 }; 16168 }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) { 16169 function n() { 16170 if (!(this instanceof n)) 16171 return new n(); 16172 if (arguments.length) 16173 throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); 16174 this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { 16175 var e2 = new n(); 16176 for (var t2 in this) 16177 "function" != typeof this[t2] && (e2[t2] = this[t2]); 16178 return e2; 16179 }; 16180 } 16181 (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) { 16182 return new n().loadAsync(e2, t2); 16183 }, n.external = e("./external"), t.exports = n; 16184 }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) { 16185 var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils"); 16186 function f(n2) { 16187 return new i.Promise(function(e2, t2) { 16188 var r2 = n2.decompressed.getContentWorker().pipe(new a()); 16189 r2.on("error", function(e3) { 16190 t2(e3); 16191 }).on("end", function() { 16192 r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2(); 16193 }).resume(); 16194 }); 16195 } 16196 t.exports = function(e2, o) { 16197 var h = this; 16198 return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) { 16199 var t2 = new s(o); 16200 return t2.load(e3), t2; 16201 }).then(function(e3) { 16202 var t2 = [i.Promise.resolve(e3)], r2 = e3.files; 16203 if (o.checkCRC32) 16204 for (var n2 = 0; n2 < r2.length; n2++) 16205 t2.push(f(r2[n2])); 16206 return i.Promise.all(t2); 16207 }).then(function(e3) { 16208 for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) { 16209 var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr); 16210 h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2); 16211 } 16212 return t2.zipComment.length && (h.comment = t2.zipComment), h; 16213 }); 16214 }; 16215 }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) { 16216 var n = e("../utils"), i = e("../stream/GenericWorker"); 16217 function s(e2, t2) { 16218 i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2); 16219 } 16220 n.inherits(s, i), s.prototype._bindStream = function(e2) { 16221 var t2 = this; 16222 (this._stream = e2).pause(), e2.on("data", function(e3) { 16223 t2.push({ data: e3, meta: { percent: 0 } }); 16224 }).on("error", function(e3) { 16225 t2.isPaused ? this.generatedError = e3 : t2.error(e3); 16226 }).on("end", function() { 16227 t2.isPaused ? t2._upstreamEnded = true : t2.end(); 16228 }); 16229 }, s.prototype.pause = function() { 16230 return !!i.prototype.pause.call(this) && (this._stream.pause(), true); 16231 }, s.prototype.resume = function() { 16232 return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); 16233 }, t.exports = s; 16234 }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) { 16235 var i = e("readable-stream").Readable; 16236 function n(e2, t2, r2) { 16237 i.call(this, t2), this._helper = e2; 16238 var n2 = this; 16239 e2.on("data", function(e3, t3) { 16240 n2.push(e3) || n2._helper.pause(), r2 && r2(t3); 16241 }).on("error", function(e3) { 16242 n2.emit("error", e3); 16243 }).on("end", function() { 16244 n2.push(null); 16245 }); 16246 } 16247 e("../utils").inherits(n, i), n.prototype._read = function() { 16248 this._helper.resume(); 16249 }, t.exports = n; 16250 }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) { 16251 t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) { 16252 if (Buffer.from && Buffer.from !== Uint8Array.from) 16253 return Buffer.from(e2, t2); 16254 if ("number" == typeof e2) 16255 throw new Error('The "data" argument must not be a number'); 16256 return new Buffer(e2, t2); 16257 }, allocBuffer: function(e2) { 16258 if (Buffer.alloc) 16259 return Buffer.alloc(e2); 16260 var t2 = new Buffer(e2); 16261 return t2.fill(0), t2; 16262 }, isBuffer: function(e2) { 16263 return Buffer.isBuffer(e2); 16264 }, isStream: function(e2) { 16265 return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume; 16266 } }; 16267 }, {}], 15: [function(e, t, r) {
vendor: 5,468 bytes, lines 16267-16353
16267 16268 function s(e2, t2, r2) { 16269 var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f); 16270 s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true); 16271 var a2 = "string" === i2 && false === s2.binary && false === s2.base64; 16272 r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string"); 16273 var o2 = null; 16274 o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64); 16275 var h2 = new d(e2, o2, s2); 16276 this.files[e2] = h2; 16277 } 16278 var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) { 16279 "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1)); 16280 var t2 = e2.lastIndexOf("/"); 16281 return 0 < t2 ? e2.substring(0, t2) : ""; 16282 }, g = function(e2) { 16283 return "/" !== e2.slice(-1) && (e2 += "/"), e2; 16284 }, b = function(e2, t2) { 16285 return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2]; 16286 }; 16287 function h(e2) { 16288 return "[object RegExp]" === Object.prototype.toString.call(e2); 16289 } 16290 var n = { load: function() { 16291 throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); 16292 }, forEach: function(e2) { 16293 var t2, r2, n2; 16294 for (t2 in this.files) 16295 n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2); 16296 }, filter: function(r2) { 16297 var n2 = []; 16298 return this.forEach(function(e2, t2) { 16299 r2(e2, t2) && n2.push(t2); 16300 }), n2; 16301 }, file: function(e2, t2, r2) { 16302 if (1 !== arguments.length) 16303 return e2 = this.root + e2, s.call(this, e2, t2, r2), this; 16304 if (h(e2)) { 16305 var n2 = e2; 16306 return this.filter(function(e3, t3) { 16307 return !t3.dir && n2.test(e3); 16308 }); 16309 } 16310 var i2 = this.files[this.root + e2]; 16311 return i2 && !i2.dir ? i2 : null; 16312 }, folder: function(r2) { 16313 if (!r2) 16314 return this; 16315 if (h(r2)) 16316 return this.filter(function(e3, t3) { 16317 return t3.dir && r2.test(e3); 16318 }); 16319 var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone(); 16320 return n2.root = t2.name, n2; 16321 }, remove: function(r2) { 16322 r2 = this.root + r2; 16323 var e2 = this.files[r2]; 16324 if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) 16325 delete this.files[r2]; 16326 else 16327 for (var t2 = this.filter(function(e3, t3) { 16328 return t3.name.slice(0, r2.length) === r2; 16329 }), n2 = 0; n2 < t2.length; n2++) 16330 delete this.files[t2[n2].name]; 16331 return this; 16332 }, generate: function() { 16333 throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); 16334 }, generateInternalStream: function(e2) { 16335 var t2, r2 = {}; 16336 try { 16337 if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) 16338 throw new Error("No output type specified."); 16339 u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS"); 16340 var n2 = r2.comment || this.comment || ""; 16341 t2 = o.generateWorker(this, r2, n2); 16342 } catch (e3) { 16343 (t2 = new l("error")).error(e3); 16344 } 16345 return new a(t2, r2.type || "string", r2.mimeType); 16346 }, generateAsync: function(e2, t2) { 16347 return this.generateInternalStream(e2).accumulate(t2); 16348 }, generateNodeStream: function(e2, t2) { 16349 return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2); 16350 } }; 16351 t.exports = n; 16352 }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) { 16353
vendor: 4,461 bytes, lines 16353-16443
16353t.exports = e("stream"); 16354 }, { stream: void 0 }], 17: [function(e, t, r) { 16355 var n = e("./DataReader"); 16356 function i(e2) { 16357 n.call(this, e2); 16358 for (var t2 = 0; t2 < this.data.length; t2++) 16359 e2[t2] = 255 & e2[t2]; 16360 } 16361 e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { 16362 return this.data[this.zero + e2]; 16363 }, i.prototype.lastIndexOfSignature = function(e2) { 16364 for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) 16365 if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) 16366 return s - this.zero; 16367 return -1; 16368 }, i.prototype.readAndCheckSignature = function(e2) { 16369 var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4); 16370 return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3]; 16371 }, i.prototype.readData = function(e2) { 16372 if (this.checkOffset(e2), 0 === e2) 16373 return []; 16374 var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); 16375 return this.index += e2, t2; 16376 }, t.exports = i; 16377 }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) { 16378 var n = e("../utils"); 16379 function i(e2) { 16380 this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0; 16381 } 16382 i.prototype = { checkOffset: function(e2) { 16383 this.checkIndex(this.index + e2); 16384 }, checkIndex: function(e2) { 16385 if (this.length < this.zero + e2 || e2 < 0) 16386 throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?"); 16387 }, setIndex: function(e2) { 16388 this.checkIndex(e2), this.index = e2; 16389 }, skip: function(e2) { 16390 this.setIndex(this.index + e2); 16391 }, byteAt: function() { 16392 }, readInt: function(e2) { 16393 var t2, r2 = 0; 16394 for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) 16395 r2 = (r2 << 8) + this.byteAt(t2); 16396 return this.index += e2, r2; 16397 }, readString: function(e2) { 16398 return n.transformTo("string", this.readData(e2)); 16399 }, readData: function() { 16400 }, lastIndexOfSignature: function() { 16401 }, readAndCheckSignature: function() { 16402 }, readDate: function() { 16403 var e2 = this.readInt(4); 16404 return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1)); 16405 } }, t.exports = i; 16406 }, { "../utils": 32 }], 19: [function(e, t, r) { 16407 var n = e("./Uint8ArrayReader"); 16408 function i(e2) { 16409 n.call(this, e2); 16410 } 16411 e("../utils").inherits(i, n), i.prototype.readData = function(e2) { 16412 this.checkOffset(e2); 16413 var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); 16414 return this.index += e2, t2; 16415 }, t.exports = i; 16416 }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) { 16417 var n = e("./DataReader"); 16418 function i(e2) { 16419 n.call(this, e2); 16420 } 16421 e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) { 16422 return this.data.charCodeAt(this.zero + e2); 16423 }, i.prototype.lastIndexOfSignature = function(e2) { 16424 return this.data.lastIndexOf(e2) - this.zero; 16425 }, i.prototype.readAndCheckSignature = function(e2) { 16426 return e2 === this.readData(4); 16427 }, i.prototype.readData = function(e2) { 16428 this.checkOffset(e2); 16429 var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2); 16430 return this.index += e2, t2; 16431 }, t.exports = i; 16432 }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) { 16433 var n = e("./ArrayReader"); 16434 function i(e2) { 16435 n.call(this, e2); 16436 } 16437 e("../utils").inherits(i, n), i.prototype.readData = function(e2) { 16438 if (this.checkOffset(e2), 0 === e2) 16439 return new Uint8Array(0); 16440 var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2); 16441 return this.index += e2, t2; 16442 }, t.exports = i; 16443 }, { "../utils": 32, "./ArrayReader": 17 }
vendor: 70,975 bytes, lines 16443-17606
16443], 22: [function(e, t, r) { 16444 var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader"); 16445 t.exports = function(e2) { 16446 var t2 = n.getTypeOf(e2); 16447 return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2); 16448 }; 16449 }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) { 16450 r.LOCAL_FILE_HEADER = "PK��", r.CENTRAL_FILE_HEADER = "PK��", r.CENTRAL_DIRECTORY_END = "PK��", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK�\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK��", r.DATA_DESCRIPTOR = "PK\x07\b"; 16451 }, {}], 24: [function(e, t, r) { 16452 var n = e("./GenericWorker"), i = e("../utils"); 16453 function s(e2) { 16454 n.call(this, "ConvertWorker to " + e2), this.destType = e2; 16455 } 16456 i.inherits(s, n), s.prototype.processChunk = function(e2) { 16457 this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta }); 16458 }, t.exports = s; 16459 }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) { 16460 var n = e("./GenericWorker"), i = e("../crc32"); 16461 function s() { 16462 n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); 16463 } 16464 e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) { 16465 this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2); 16466 }, t.exports = s; 16467 }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) { 16468 var n = e("../utils"), i = e("./GenericWorker"); 16469 function s(e2) { 16470 i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0); 16471 } 16472 n.inherits(s, i), s.prototype.processChunk = function(e2) { 16473 if (e2) { 16474 var t2 = this.streamInfo[this.propName] || 0; 16475 this.streamInfo[this.propName] = t2 + e2.data.length; 16476 } 16477 i.prototype.processChunk.call(this, e2); 16478 }, t.exports = s; 16479 }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) { 16480 var n = e("../utils"), i = e("./GenericWorker"); 16481 function s(e2) { 16482 i.call(this, "DataWorker"); 16483 var t2 = this; 16484 this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) { 16485 t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat(); 16486 }, function(e3) { 16487 t2.error(e3); 16488 }); 16489 } 16490 n.inherits(s, i), s.prototype.cleanUp = function() { 16491 i.prototype.cleanUp.call(this), this.data = null; 16492 }, s.prototype.resume = function() { 16493 return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true); 16494 }, s.prototype._tickAndRepeat = function() { 16495 this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); 16496 }, s.prototype._tick = function() { 16497 if (this.isPaused || this.isFinished) 16498 return false; 16499 var e2 = null, t2 = Math.min(this.max, this.index + 16384); 16500 if (this.index >= this.max) 16501 return this.end(); 16502 switch (this.type) { 16503 case "string": 16504 e2 = this.data.substring(this.index, t2); 16505 break; 16506 case "uint8array": 16507 e2 = this.data.subarray(this.index, t2); 16508 break; 16509 case "array": 16510 case "nodebuffer": 16511 e2 = this.data.slice(this.index, t2); 16512 } 16513 return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); 16514 }, t.exports = s; 16515 }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) { 16516 function n(e2) { 16517 this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; 16518 } 16519 n.prototype = { push: function(e2) { 16520 this.emit("data", e2); 16521 }, end: function() { 16522 if (this.isFinished) 16523 return false; 16524 this.flush(); 16525 try { 16526 this.emit("end"), this.cleanUp(), this.isFinished = true; 16527 } catch (e2) { 16528 this.emit("error", e2); 16529 } 16530 return true; 16531 }, error: function(e2) { 16532 return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true); 16533 }, on: function(e2, t2) { 16534 return this._listeners[e2].push(t2), this; 16535 }, cleanUp: function() { 16536 this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; 16537 }, emit: function(e2, t2) { 16538 if (this._listeners[e2]) 16539 for (var r2 = 0; r2 < this._listeners[e2].length; r2++) 16540 this._listeners[e2][r2].call(this, t2); 16541 }, pipe: function(e2) { 16542 return e2.registerPrevious(this); 16543 }, registerPrevious: function(e2) { 16544 if (this.isLocked) 16545 throw new Error("The stream '" + this + "' has already been used."); 16546 this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2; 16547 var t2 = this; 16548 return e2.on("data", function(e3) { 16549 t2.processChunk(e3); 16550 }), e2.on("end", function() { 16551 t2.end(); 16552 }), e2.on("error", function(e3) { 16553 t2.error(e3); 16554 }), this; 16555 }, pause: function() { 16556 return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); 16557 }, resume: function() { 16558 if (!this.isPaused || this.isFinished) 16559 return false; 16560 var e2 = this.isPaused = false; 16561 return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2; 16562 }, flush: function() { 16563 }, processChunk: function(e2) { 16564 this.push(e2); 16565 }, withStreamInfo: function(e2, t2) { 16566 return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this; 16567 }, mergeStreamInfo: function() { 16568 for (var e2 in this.extraStreamInfo) 16569 Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]); 16570 }, lock: function() { 16571 if (this.isLocked) 16572 throw new Error("The stream '" + this + "' has already been used."); 16573 this.isLocked = true, this.previous && this.previous.lock(); 16574 }, toString: function() { 16575 var e2 = "Worker " + this.name; 16576 return this.previous ? this.previous + " -> " + e2 : e2; 16577 } }, t.exports = n; 16578 }, {}], 29: [function(e, t, r) { 16579 var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null; 16580 if (n.nodestream) 16581 try { 16582 o = e("../nodejs/NodejsStreamOutputAdapter"); 16583 } catch (e2) { 16584 } 16585 function l(e2, o2) { 16586 return new a.Promise(function(t2, r2) { 16587 var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType; 16588 e2.on("data", function(e3, t3) { 16589 n2.push(e3), o2 && o2(t3); 16590 }).on("error", function(e3) { 16591 n2 = [], r2(e3); 16592 }).on("end", function() { 16593 try { 16594 var e3 = function(e4, t3, r3) { 16595 switch (e4) { 16596 case "blob": 16597 return h.newBlob(h.transformTo("arraybuffer", t3), r3); 16598 case "base64": 16599 return u.encode(t3); 16600 default: 16601 return h.transformTo(e4, t3); 16602 } 16603 }(s2, function(e4, t3) { 16604 var r3, n3 = 0, i3 = null, s3 = 0; 16605 for (r3 = 0; r3 < t3.length; r3++) 16606 s3 += t3[r3].length; 16607 switch (e4) { 16608 case "string": 16609 return t3.join(""); 16610 case "array": 16611 return Array.prototype.concat.apply([], t3); 16612 case "uint8array": 16613 for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) 16614 i3.set(t3[r3], n3), n3 += t3[r3].length; 16615 return i3; 16616 case "nodebuffer": 16617 return Buffer.concat(t3); 16618 default: 16619 throw new Error("concat : unsupported type '" + e4 + "'"); 16620 } 16621 }(i2, n2), a2); 16622 t2(e3); 16623 } catch (e4) { 16624 r2(e4); 16625 } 16626 n2 = []; 16627 }).resume(); 16628 }); 16629 } 16630 function f(e2, t2, r2) { 16631 var n2 = t2; 16632 switch (t2) { 16633 case "blob": 16634 case "arraybuffer": 16635 n2 = "uint8array"; 16636 break; 16637 case "base64": 16638 n2 = "string"; 16639 } 16640 try { 16641 this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock(); 16642 } catch (e3) { 16643 this._worker = new s("error"), this._worker.error(e3); 16644 } 16645 } 16646 f.prototype = { accumulate: function(e2) { 16647 return l(this, e2); 16648 }, on: function(e2, t2) { 16649 var r2 = this; 16650 return "data" === e2 ? this._worker.on(e2, function(e3) { 16651 t2.call(r2, e3.data, e3.meta); 16652 }) : this._worker.on(e2, function() { 16653 h.delay(t2, arguments, r2); 16654 }), this; 16655 }, resume: function() { 16656 return h.delay(this._worker.resume, [], this._worker), this; 16657 }, pause: function() { 16658 return this._worker.pause(), this; 16659 }, toNodejsStream: function(e2) { 16660 if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) 16661 throw new Error(this._outputType + " is not supported by this method"); 16662 return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2); 16663 } }, t.exports = f; 16664 }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) { 16665 if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) 16666 r.blob = false; 16667 else { 16668 var n = new ArrayBuffer(0); 16669 try { 16670 r.blob = 0 === new Blob([n], { type: "application/zip" }).size; 16671 } catch (e2) { 16672 try { 16673 var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); 16674 i.append(n), r.blob = 0 === i.getBlob("application/zip").size; 16675 } catch (e3) { 16676 r.blob = false; 16677 } 16678 } 16679 } 16680 try { 16681 r.nodestream = !!e("readable-stream").Readable; 16682 } catch (e2) { 16683 r.nodestream = false; 16684 } 16685 }, { "readable-stream": 16 }], 31: [function(e, t, s) { 16686 for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) 16687 u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1; 16688 u[254] = u[254] = 1; 16689 function a() { 16690 n.call(this, "utf-8 decode"), this.leftOver = null; 16691 } 16692 function l() { 16693 n.call(this, "utf-8 encode"); 16694 } 16695 s.utf8encode = function(e2) { 16696 return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) { 16697 var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0; 16698 for (i2 = 0; i2 < a2; i2++) 16699 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; 16700 for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) 16701 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); 16702 return t2; 16703 }(e2); 16704 }, s.utf8decode = function(e2) { 16705 return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) { 16706 var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2); 16707 for (t2 = r2 = 0; t2 < s2; ) 16708 if ((n2 = e3[t2++]) < 128) 16709 a2[r2++] = n2; 16710 else if (4 < (i2 = u[n2])) 16711 a2[r2++] = 65533, t2 += i2 - 1; 16712 else { 16713 for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) 16714 n2 = n2 << 6 | 63 & e3[t2++], i2--; 16715 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2); 16716 } 16717 return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2); 16718 }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2)); 16719 }, o.inherits(a, n), a.prototype.processChunk = function(e2) { 16720 var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data); 16721 if (this.leftOver && this.leftOver.length) { 16722 if (h.uint8array) { 16723 var r2 = t2; 16724 (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length); 16725 } else 16726 t2 = this.leftOver.concat(t2); 16727 this.leftOver = null; 16728 } 16729 var n2 = function(e3, t3) { 16730 var r3; 16731 for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) 16732 r3--; 16733 return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3; 16734 }(t2), i2 = t2; 16735 n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta }); 16736 }, a.prototype.flush = function() { 16737 this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); 16738 }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) { 16739 this.push({ data: s.utf8encode(e2.data), meta: e2.meta }); 16740 }, s.Utf8EncodeWorker = l; 16741 }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) { 16742 var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external"); 16743 function n(e2) { 16744 return e2; 16745 } 16746 function l(e2, t2) { 16747 for (var r2 = 0; r2 < e2.length; ++r2) 16748 t2[r2] = 255 & e2.charCodeAt(r2); 16749 return t2; 16750 } 16751 e("setimmediate"), a.newBlob = function(t2, r2) { 16752 a.checkSupport("blob"); 16753 try { 16754 return new Blob([t2], { type: r2 }); 16755 } catch (e2) { 16756 try { 16757 var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); 16758 return n2.append(t2), n2.getBlob(r2); 16759 } catch (e3) { 16760 throw new Error("Bug : can't construct the Blob."); 16761 } 16762 } 16763 }; 16764 var i = { stringifyByChunk: function(e2, t2, r2) { 16765 var n2 = [], i2 = 0, s2 = e2.length; 16766 if (s2 <= r2) 16767 return String.fromCharCode.apply(null, e2); 16768 for (; i2 < s2; ) 16769 "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2; 16770 return n2.join(""); 16771 }, stringifyByChar: function(e2) { 16772 for (var t2 = "", r2 = 0; r2 < e2.length; r2++) 16773 t2 += String.fromCharCode(e2[r2]); 16774 return t2; 16775 }, applyCanBeUsed: { uint8array: function() { 16776 try { 16777 return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; 16778 } catch (e2) { 16779 return false; 16780 } 16781 }(), nodebuffer: function() { 16782 try { 16783 return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length; 16784 } catch (e2) { 16785 return false; 16786 } 16787 }() } }; 16788 function s(e2) { 16789 var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true; 16790 if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) 16791 for (; 1 < t2; ) 16792 try { 16793 return i.stringifyByChunk(e2, r2, t2); 16794 } catch (e3) { 16795 t2 = Math.floor(t2 / 2); 16796 } 16797 return i.stringifyByChar(e2); 16798 } 16799 function f(e2, t2) { 16800 for (var r2 = 0; r2 < e2.length; r2++) 16801 t2[r2] = e2[r2]; 16802 return t2; 16803 } 16804 a.applyFromCharCode = s; 16805 var c = {}; 16806 c.string = { string: n, array: function(e2) { 16807 return l(e2, new Array(e2.length)); 16808 }, arraybuffer: function(e2) { 16809 return c.string.uint8array(e2).buffer; 16810 }, uint8array: function(e2) { 16811 return l(e2, new Uint8Array(e2.length)); 16812 }, nodebuffer: function(e2) { 16813 return l(e2, r.allocBuffer(e2.length)); 16814 } }, c.array = { string: s, array: n, arraybuffer: function(e2) { 16815 return new Uint8Array(e2).buffer; 16816 }, uint8array: function(e2) { 16817 return new Uint8Array(e2); 16818 }, nodebuffer: function(e2) { 16819 return r.newBufferFrom(e2); 16820 } }, c.arraybuffer = { string: function(e2) { 16821 return s(new Uint8Array(e2)); 16822 }, array: function(e2) { 16823 return f(new Uint8Array(e2), new Array(e2.byteLength)); 16824 }, arraybuffer: n, uint8array: function(e2) { 16825 return new Uint8Array(e2); 16826 }, nodebuffer: function(e2) { 16827 return r.newBufferFrom(new Uint8Array(e2)); 16828 } }, c.uint8array = { string: s, array: function(e2) { 16829 return f(e2, new Array(e2.length)); 16830 }, arraybuffer: function(e2) { 16831 return e2.buffer; 16832 }, uint8array: n, nodebuffer: function(e2) { 16833 return r.newBufferFrom(e2); 16834 } }, c.nodebuffer = { string: s, array: function(e2) { 16835 return f(e2, new Array(e2.length)); 16836 }, arraybuffer: function(e2) { 16837 return c.nodebuffer.uint8array(e2).buffer; 16838 }, uint8array: function(e2) { 16839 return f(e2, new Uint8Array(e2.length)); 16840 }, nodebuffer: n }, a.transformTo = function(e2, t2) { 16841 if (t2 = t2 || "", !e2) 16842 return t2; 16843 a.checkSupport(e2); 16844 var r2 = a.getTypeOf(t2); 16845 return c[r2][e2](t2); 16846 }, a.resolve = function(e2) { 16847 for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) { 16848 var i2 = t2[n2]; 16849 "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2)); 16850 } 16851 return r2.join("/"); 16852 }, a.getTypeOf = function(e2) { 16853 return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0; 16854 }, a.checkSupport = function(e2) { 16855 if (!o[e2.toLowerCase()]) 16856 throw new Error(e2 + " is not supported by this platform"); 16857 }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) { 16858 var t2, r2, n2 = ""; 16859 for (r2 = 0; r2 < (e2 || "").length; r2++) 16860 n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase(); 16861 return n2; 16862 }, a.delay = function(e2, t2, r2) { 16863 setImmediate(function() { 16864 e2.apply(r2 || null, t2 || []); 16865 }); 16866 }, a.inherits = function(e2, t2) { 16867 function r2() { 16868 } 16869 r2.prototype = t2.prototype, e2.prototype = new r2(); 16870 }, a.extend = function() { 16871 var e2, t2, r2 = {}; 16872 for (e2 = 0; e2 < arguments.length; e2++) 16873 for (t2 in arguments[e2]) 16874 Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]); 16875 return r2; 16876 }, a.prepareContent = function(r2, e2, n2, i2, s2) { 16877 return u.Promise.resolve(e2).then(function(n3) { 16878 return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) { 16879 var e3 = new FileReader(); 16880 e3.onload = function(e4) { 16881 t2(e4.target.result); 16882 }, e3.onerror = function(e4) { 16883 r3(e4.target.error); 16884 }, e3.readAsArrayBuffer(n3); 16885 }) : n3; 16886 }).then(function(e3) { 16887 var t2 = a.getTypeOf(e3); 16888 return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) { 16889 return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length)); 16890 }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); 16891 }); 16892 }; 16893 }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) { 16894 var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support"); 16895 function h(e2) { 16896 this.files = [], this.loadOptions = e2; 16897 } 16898 h.prototype = { checkSignature: function(e2) { 16899 if (!this.reader.readAndCheckSignature(e2)) { 16900 this.reader.index -= 4; 16901 var t2 = this.reader.readString(4); 16902 throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")"); 16903 } 16904 }, isSignature: function(e2, t2) { 16905 var r2 = this.reader.index; 16906 this.reader.setIndex(e2); 16907 var n2 = this.reader.readString(4) === t2; 16908 return this.reader.setIndex(r2), n2; 16909 }, readBlockEndOfCentral: function() { 16910 this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); 16911 var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2); 16912 this.zipComment = this.loadOptions.decodeFileName(r2); 16913 }, readBlockZip64EndOfCentral: function() { 16914 this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; 16915 for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) 16916 e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 }; 16917 }, readBlockZip64EndOfCentralLocator: function() { 16918 if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) 16919 throw new Error("Multi-volumes zip are not supported"); 16920 }, readLocalFiles: function() { 16921 var e2, t2; 16922 for (e2 = 0; e2 < this.files.length; e2++) 16923 t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes(); 16924 }, readCentralDir: function() { 16925 var e2; 16926 for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) 16927 (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2); 16928 if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) 16929 throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); 16930 }, readEndOfCentral: function() { 16931 var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END); 16932 if (e2 < 0) 16933 throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); 16934 this.reader.setIndex(e2); 16935 var t2 = e2; 16936 if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) { 16937 if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) 16938 throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); 16939 if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) 16940 throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); 16941 this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); 16942 } 16943 var r2 = this.centralDirOffset + this.centralDirSize; 16944 this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize); 16945 var n2 = t2 - r2; 16946 if (0 < n2) 16947 this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2); 16948 else if (n2 < 0) 16949 throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes."); 16950 }, prepareReader: function(e2) { 16951 this.reader = n(e2); 16952 }, load: function(e2) { 16953 this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); 16954 } }, t.exports = h; 16955 }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) { 16956 var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support"); 16957 function l(e2, t2) { 16958 this.options = e2, this.loadOptions = t2; 16959 } 16960 l.prototype = { isEncrypted: function() { 16961 return 1 == (1 & this.bitFlag); 16962 }, useUTF8: function() { 16963 return 2048 == (2048 & this.bitFlag); 16964 }, readLocalPart: function(e2) { 16965 var t2, r2; 16966 if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) 16967 throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); 16968 if (null === (t2 = function(e3) { 16969 for (var t3 in h) 16970 if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) 16971 return h[t3]; 16972 return null; 16973 }(this.compressionMethod))) 16974 throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")"); 16975 this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize)); 16976 }, readCentralPart: function(e2) { 16977 this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4); 16978 var t2 = e2.readInt(2); 16979 if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) 16980 throw new Error("Encrypted zip are not supported"); 16981 e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength); 16982 }, processAttributes: function() { 16983 this.unixPermissions = null, this.dosPermissions = null; 16984 var e2 = this.versionMadeBy >> 8; 16985 this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); 16986 }, parseZIP64ExtraField: function() { 16987 if (this.extraFields[1]) { 16988 var e2 = n(this.extraFields[1].value); 16989 this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4)); 16990 } 16991 }, readExtraFields: function(e2) { 16992 var t2, r2, n2, i2 = e2.index + this.extraFieldsLength; 16993 for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) 16994 t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 }; 16995 e2.setIndex(i2); 16996 }, handleUTF8: function() { 16997 var e2 = u.uint8array ? "uint8array" : "array"; 16998 if (this.useUTF8()) 16999 this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment); 17000 else { 17001 var t2 = this.findExtraFieldUnicodePath(); 17002 if (null !== t2) 17003 this.fileNameStr = t2; 17004 else { 17005 var r2 = s.transformTo(e2, this.fileName); 17006 this.fileNameStr = this.loadOptions.decodeFileName(r2); 17007 } 17008 var n2 = this.findExtraFieldUnicodeComment(); 17009 if (null !== n2) 17010 this.fileCommentStr = n2; 17011 else { 17012 var i2 = s.transformTo(e2, this.fileComment); 17013 this.fileCommentStr = this.loadOptions.decodeFileName(i2); 17014 } 17015 } 17016 }, findExtraFieldUnicodePath: function() { 17017 var e2 = this.extraFields[28789]; 17018 if (e2) { 17019 var t2 = n(e2.value); 17020 return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); 17021 } 17022 return null; 17023 }, findExtraFieldUnicodeComment: function() { 17024 var e2 = this.extraFields[25461]; 17025 if (e2) { 17026 var t2 = n(e2.value); 17027 return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5)); 17028 } 17029 return null; 17030 } }, t.exports = l; 17031 }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) { 17032 function n(e2, t2, r2) { 17033 this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions }; 17034 } 17035 var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker"); 17036 n.prototype = { internalStream: function(e2) { 17037 var t2 = null, r2 = "string"; 17038 try { 17039 if (!e2) 17040 throw new Error("No output type specified."); 17041 var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2; 17042 "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker(); 17043 var i2 = !this._dataBinary; 17044 i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker())); 17045 } catch (e3) { 17046 (t2 = new h("error")).error(e3); 17047 } 17048 return new s(t2, r2, ""); 17049 }, async: function(e2, t2) { 17050 return this.internalStream(e2).accumulate(t2); 17051 }, nodeStream: function(e2, t2) { 17052 return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2); 17053 }, _compressWorker: function(e2, t2) { 17054 if (this._data instanceof o && this._data.compression.magic === e2.magic) 17055 return this._data.getCompressedWorker(); 17056 var r2 = this._decompressWorker(); 17057 return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2); 17058 }, _decompressWorker: function() { 17059 return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data); 17060 } }; 17061 for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() { 17062 throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); 17063 }, f = 0; f < u.length; f++) 17064 n.prototype[u[f]] = l; 17065 t.exports = n; 17066 }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) { 17067 (function(t2) { 17068 var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver; 17069 if (e2) { 17070 var i = 0, s = new e2(u), a = t2.document.createTextNode(""); 17071 s.observe(a, { characterData: true }), r = function() { 17072 a.data = i = ++i % 2; 17073 }; 17074 } else if (t2.setImmediate || void 0 === t2.MessageChannel) 17075 r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() { 17076 var e3 = t2.document.createElement("script"); 17077 e3.onreadystatechange = function() { 17078 u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null; 17079 }, t2.document.documentElement.appendChild(e3); 17080 } : function() { 17081 setTimeout(u, 0); 17082 }; 17083 else { 17084 var o = new t2.MessageChannel(); 17085 o.port1.onmessage = u, r = function() { 17086 o.port2.postMessage(0); 17087 }; 17088 } 17089 var h = []; 17090 function u() { 17091 var e3, t3; 17092 n = true; 17093 for (var r2 = h.length; r2; ) { 17094 for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) 17095 t3[e3](); 17096 r2 = h.length; 17097 } 17098 n = false; 17099 } 17100 l.exports = function(e3) { 17101 1 !== h.push(e3) || n || r(); 17102 }; 17103 }).call(this, "undefined" != typeof commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); 17104 }, {}], 37: [function(e, t, r) { 17105 var i = e("immediate"); 17106 function u() { 17107 } 17108 var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"]; 17109 function o(e2) { 17110 if ("function" != typeof e2) 17111 throw new TypeError("resolver must be a function"); 17112 this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2); 17113 } 17114 function h(e2, t2, r2) { 17115 this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected); 17116 } 17117 function f(t2, r2, n2) { 17118 i(function() { 17119 var e2; 17120 try { 17121 e2 = r2(n2); 17122 } catch (e3) { 17123 return l.reject(t2, e3); 17124 } 17125 e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2); 17126 }); 17127 } 17128 function c(e2) { 17129 var t2 = e2 && e2.then; 17130 if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) 17131 return function() { 17132 t2.apply(e2, arguments); 17133 }; 17134 } 17135 function d(t2, e2) { 17136 var r2 = false; 17137 function n2(e3) { 17138 r2 || (r2 = true, l.reject(t2, e3)); 17139 } 17140 function i2(e3) { 17141 r2 || (r2 = true, l.resolve(t2, e3)); 17142 } 17143 var s2 = p(function() { 17144 e2(i2, n2); 17145 }); 17146 "error" === s2.status && n2(s2.value); 17147 } 17148 function p(e2, t2) { 17149 var r2 = {}; 17150 try { 17151 r2.value = e2(t2), r2.status = "success"; 17152 } catch (e3) { 17153 r2.status = "error", r2.value = e3; 17154 } 17155 return r2; 17156 } 17157 (t.exports = o).prototype.finally = function(t2) { 17158 if ("function" != typeof t2) 17159 return this; 17160 var r2 = this.constructor; 17161 return this.then(function(e2) { 17162 return r2.resolve(t2()).then(function() { 17163 return e2; 17164 }); 17165 }, function(e2) { 17166 return r2.resolve(t2()).then(function() { 17167 throw e2; 17168 }); 17169 }); 17170 }, o.prototype.catch = function(e2) { 17171 return this.then(null, e2); 17172 }, o.prototype.then = function(e2, t2) { 17173 if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) 17174 return this; 17175 var r2 = new this.constructor(u); 17176 this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2)); 17177 return r2; 17178 }, h.prototype.callFulfilled = function(e2) { 17179 l.resolve(this.promise, e2); 17180 }, h.prototype.otherCallFulfilled = function(e2) { 17181 f(this.promise, this.onFulfilled, e2); 17182 }, h.prototype.callRejected = function(e2) { 17183 l.reject(this.promise, e2); 17184 }, h.prototype.otherCallRejected = function(e2) { 17185 f(this.promise, this.onRejected, e2); 17186 }, l.resolve = function(e2, t2) { 17187 var r2 = p(c, t2); 17188 if ("error" === r2.status) 17189 return l.reject(e2, r2.value); 17190 var n2 = r2.value; 17191 if (n2) 17192 d(e2, n2); 17193 else { 17194 e2.state = a, e2.outcome = t2; 17195 for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) 17196 e2.queue[i2].callFulfilled(t2); 17197 } 17198 return e2; 17199 }, l.reject = function(e2, t2) { 17200 e2.state = s, e2.outcome = t2; 17201 for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) 17202 e2.queue[r2].callRejected(t2); 17203 return e2; 17204 }, o.resolve = function(e2) { 17205 if (e2 instanceof this) 17206 return e2; 17207 return l.resolve(new this(u), e2); 17208 }, o.reject = function(e2) { 17209 var t2 = new this(u); 17210 return l.reject(t2, e2); 17211 }, o.all = function(e2) { 17212 var r2 = this; 17213 if ("[object Array]" !== Object.prototype.toString.call(e2)) 17214 return this.reject(new TypeError("must be an array")); 17215 var n2 = e2.length, i2 = false; 17216 if (!n2) 17217 return this.resolve([]); 17218 var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u); 17219 for (; ++t2 < n2; ) 17220 h2(e2[t2], t2); 17221 return o2; 17222 function h2(e3, t3) { 17223 r2.resolve(e3).then(function(e4) { 17224 s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2)); 17225 }, function(e4) { 17226 i2 || (i2 = true, l.reject(o2, e4)); 17227 }); 17228 } 17229 }, o.race = function(e2) { 17230 var t2 = this; 17231 if ("[object Array]" !== Object.prototype.toString.call(e2)) 17232 return this.reject(new TypeError("must be an array")); 17233 var r2 = e2.length, n2 = false; 17234 if (!r2) 17235 return this.resolve([]); 17236 var i2 = -1, s2 = new this(u); 17237 for (; ++i2 < r2; ) 17238 a2 = e2[i2], t2.resolve(a2).then(function(e3) { 17239 n2 || (n2 = true, l.resolve(s2, e3)); 17240 }, function(e3) { 17241 n2 || (n2 = true, l.reject(s2, e3)); 17242 }); 17243 var a2; 17244 return s2; 17245 }; 17246 }, { immediate: 36 }], 38: [function(e, t, r) { 17247 var n = {}; 17248 (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n; 17249 }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) { 17250 var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8; 17251 function p(e2) { 17252 if (!(this instanceof p)) 17253 return new p(e2); 17254 this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {}); 17255 var t2 = this.options; 17256 t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0; 17257 var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy); 17258 if (r2 !== l) 17259 throw new Error(i[r2]); 17260 if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) { 17261 var n2; 17262 if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) 17263 throw new Error(i[r2]); 17264 this._dict_set = true; 17265 } 17266 } 17267 function n(e2, t2) { 17268 var r2 = new p(t2); 17269 if (r2.push(e2, true), r2.err) 17270 throw r2.msg || i[r2.err]; 17271 return r2.result; 17272 } 17273 p.prototype.push = function(e2, t2) { 17274 var r2, n2, i2 = this.strm, s2 = this.options.chunkSize; 17275 if (this.ended) 17276 return false; 17277 n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length; 17278 do { 17279 if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) 17280 return this.onEnd(r2), !(this.ended = true); 17281 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out))); 17282 } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2); 17283 return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0)); 17284 }, p.prototype.onData = function(e2) { 17285 this.chunks.push(e2); 17286 }, p.prototype.onEnd = function(e2) { 17287 e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; 17288 }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) { 17289 return (t2 = t2 || {}).raw = true, n(e2, t2); 17290 }, r.gzip = function(e2, t2) { 17291 return (t2 = t2 || {}).gzip = true, n(e2, t2); 17292 }; 17293 }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) { 17294 var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString; 17295 function a(e2) { 17296 if (!(this instanceof a)) 17297 return new a(e2); 17298 this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); 17299 var t2 = this.options; 17300 t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0; 17301 var r2 = c.inflateInit2(this.strm, t2.windowBits); 17302 if (r2 !== m.Z_OK) 17303 throw new Error(n[r2]); 17304 this.header = new s(), c.inflateGetHeader(this.strm, this.header); 17305 } 17306 function o(e2, t2) { 17307 var r2 = new a(t2); 17308 if (r2.push(e2, true), r2.err) 17309 throw r2.msg || n[r2.err]; 17310 return r2.result; 17311 } 17312 a.prototype.push = function(e2, t2) { 17313 var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false; 17314 if (this.ended) 17315 return false; 17316 n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length; 17317 do { 17318 if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) 17319 return this.onEnd(r2), !(this.ended = true); 17320 h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true); 17321 } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END); 17322 return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0)); 17323 }, a.prototype.onData = function(e2) { 17324 this.chunks.push(e2); 17325 }, a.prototype.onEnd = function(e2) { 17326 e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; 17327 }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) { 17328 return (t2 = t2 || {}).raw = true, o(e2, t2); 17329 }, r.ungzip = o; 17330 }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) { 17331 var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; 17332 r.assign = function(e2) { 17333 for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) { 17334 var r2 = t2.shift(); 17335 if (r2) { 17336 if ("object" != typeof r2) 17337 throw new TypeError(r2 + "must be non-object"); 17338 for (var n2 in r2) 17339 r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]); 17340 } 17341 } 17342 return e2; 17343 }, r.shrinkBuf = function(e2, t2) { 17344 return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2); 17345 }; 17346 var i = { arraySet: function(e2, t2, r2, n2, i2) { 17347 if (t2.subarray && e2.subarray) 17348 e2.set(t2.subarray(r2, r2 + n2), i2); 17349 else 17350 for (var s2 = 0; s2 < n2; s2++) 17351 e2[i2 + s2] = t2[r2 + s2]; 17352 }, flattenChunks: function(e2) { 17353 var t2, r2, n2, i2, s2, a; 17354 for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) 17355 n2 += e2[t2].length; 17356 for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) 17357 s2 = e2[t2], a.set(s2, i2), i2 += s2.length; 17358 return a; 17359 } }, s = { arraySet: function(e2, t2, r2, n2, i2) { 17360 for (var s2 = 0; s2 < n2; s2++) 17361 e2[i2 + s2] = t2[r2 + s2]; 17362 }, flattenChunks: function(e2) { 17363 return [].concat.apply([], e2); 17364 } }; 17365 r.setTyped = function(e2) { 17366 e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s)); 17367 }, r.setTyped(n); 17368 }, {}], 42: [function(e, t, r) { 17369 var h = e("./common"), i = true, s = true; 17370 try { 17371 String.fromCharCode.apply(null, [0]); 17372 } catch (e2) { 17373 i = false; 17374 } 17375 try { 17376 String.fromCharCode.apply(null, new Uint8Array(1)); 17377 } catch (e2) { 17378 s = false; 17379 } 17380 for (var u = new h.Buf8(256), n = 0; n < 256; n++) 17381 u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1; 17382 function l(e2, t2) { 17383 if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) 17384 return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2)); 17385 for (var r2 = "", n2 = 0; n2 < t2; n2++) 17386 r2 += String.fromCharCode(e2[n2]); 17387 return r2; 17388 } 17389 u[254] = u[254] = 1, r.string2buf = function(e2) { 17390 var t2, r2, n2, i2, s2, a = e2.length, o = 0; 17391 for (i2 = 0; i2 < a; i2++) 17392 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4; 17393 for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) 17394 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2); 17395 return t2; 17396 }, r.buf2binstring = function(e2) { 17397 return l(e2, e2.length); 17398 }, r.binstring2buf = function(e2) { 17399 for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) 17400 t2[r2] = e2.charCodeAt(r2); 17401 return t2; 17402 }, r.buf2string = function(e2, t2) { 17403 var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a); 17404 for (r2 = n2 = 0; r2 < a; ) 17405 if ((i2 = e2[r2++]) < 128) 17406 o[n2++] = i2; 17407 else if (4 < (s2 = u[i2])) 17408 o[n2++] = 65533, r2 += s2 - 1; 17409 else { 17410 for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) 17411 i2 = i2 << 6 | 63 & e2[r2++], s2--; 17412 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2); 17413 } 17414 return l(o, n2); 17415 }, r.utf8border = function(e2, t2) { 17416 var r2; 17417 for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) 17418 r2--; 17419 return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2; 17420 }; 17421 }, { "./common": 41 }], 43: [function(e, t, r) { 17422 t.exports = function(e2, t2, r2, n) { 17423 for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) { 17424 for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) 17425 ; 17426 i %= 65521, s %= 65521; 17427 } 17428 return i | s << 16 | 0; 17429 }; 17430 }, {}], 44: [function(e, t, r) { 17431 t.exports = { 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_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 }; 17432 }, {}], 45: [function(e, t, r) { 17433 var o = function() { 17434 for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) { 17435 e2 = r2; 17436 for (var n = 0; n < 8; n++) 17437 e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1; 17438 t2[r2] = e2; 17439 } 17440 return t2; 17441 }(); 17442 t.exports = function(e2, t2, r2, n) { 17443 var i = o, s = n + r2; 17444 e2 ^= -1; 17445 for (var a = n; a < s; a++) 17446 e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])]; 17447 return -1 ^ e2; 17448 }; 17449 }, {}], 46: [function(e, t, r) { 17450 var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4; 17451 function R2(e2, t2) { 17452 return e2.msg = n[t2], t2; 17453 } 17454 function T(e2) { 17455 return (e2 << 1) - (4 < e2 ? 9 : 0); 17456 } 17457 function D(e2) { 17458 for (var t2 = e2.length; 0 <= --t2; ) 17459 e2[t2] = 0; 17460 } 17461 function F(e2) { 17462 var t2 = e2.state, r2 = t2.pending; 17463 r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0)); 17464 } 17465 function N(e2, t2) { 17466 u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm); 17467 } 17468 function U(e2, t2) { 17469 e2.pending_buf[e2.pending++] = t2; 17470 } 17471 function P(e2, t2) { 17472 e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2; 17473 } 17474 function L(e2, t2) { 17475 var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; 17476 e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead); 17477 do { 17478 if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) { 17479 s2 += 2, r2++; 17480 do { 17481 } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2); 17482 if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) { 17483 if (e2.match_start = t2, o2 <= (a2 = n2)) 17484 break; 17485 d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2]; 17486 } 17487 } 17488 } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2); 17489 return a2 <= e2.lookahead ? a2 : e2.lookahead; 17490 } 17491 function j(e2) { 17492 var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size; 17493 do { 17494 if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) { 17495 for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) 17496 ; 17497 for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) 17498 ; 17499 i2 += f2; 17500 } 17501 if (0 === e2.strm.avail_in) 17502 break; 17503 if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) 17504 for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) 17505 ; 17506 } while (e2.lookahead < z && 0 !== e2.strm.avail_in); 17507 } 17508 function Z(e2, t2) { 17509 for (var r2, n2; ; ) { 17510 if (e2.lookahead < z) { 17511 if (j(e2), e2.lookahead < z && t2 === l) 17512 return A; 17513 if (0 === e2.lookahead) 17514 break; 17515 } 17516 if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) 17517 if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) { 17518 for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) 17519 ; 17520 e2.strstart++; 17521 } else 17522 e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask; 17523 else 17524 n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++; 17525 if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) 17526 return A; 17527 } 17528 return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; 17529 } 17530 function W(e2, t2) { 17531 for (var r2, n2, i2; ; ) { 17532 if (e2.lookahead < z) { 17533 if (j(e2), e2.lookahead < z && t2 === l) 17534 return A; 17535 if (0 === e2.lookahead) 17536 break; 17537 } 17538 if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) { 17539 for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) 17540 ; 17541 if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) 17542 return A; 17543 } else if (e2.match_available) { 17544 if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) 17545 return A; 17546 } else 17547 e2.match_available = 1, e2.strstart++, e2.lookahead--; 17548 } 17549 return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I; 17550 } 17551 function M(e2, t2, r2, n2, i2) { 17552 this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2; 17553 } 17554 function H() { 17555 this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; 17556 } 17557 function G(e2) { 17558 var t2; 17559 return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R2(e2, _); 17560 } 17561 function K(e2) { 17562 var t2 = G(e2); 17563 return t2 === m && function(e3) { 17564 e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0; 17565 }(e2.state), t2; 17566 } 17567 function Y(e2, t2, r2, n2, i2, s2) { 17568 if (!e2) 17569 return _; 17570 var a2 = 1; 17571 if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) 17572 return R2(e2, _); 17573 8 === n2 && (n2 = 9); 17574 var o2 = new H(); 17575 return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2); 17576 } 17577 h = [new M(0, 0, 0, 0, function(e2, t2) { 17578 var r2 = 65535; 17579 for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) { 17580 if (e2.lookahead <= 1) { 17581 if (j(e2), 0 === e2.lookahead && t2 === l) 17582 return A; 17583 if (0 === e2.lookahead) 17584 break; 17585 } 17586 e2.strstart += e2.lookahead, e2.lookahead = 0; 17587 var n2 = e2.block_start + r2; 17588 if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) 17589 return A; 17590 if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) 17591 return A; 17592 } 17593 return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A); 17594 }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) { 17595 return Y(e2, t2, v, 15, 8, 0); 17596 }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) { 17597 return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _; 17598 }, r.deflate = function(e2, t2) { 17599 var r2, n2, i2, s2; 17600 if (!e2 || !e2.state || 5 < t2 || t2 < 0) 17601 return e2 ? R2(e2, _) : _; 17602 if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) 17603 return R2(e2, 0 === e2.avail_out ? -5 : _); 17604 if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) 17605 if (2 === n2.wrap) 17606 e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69)
vendor: 3,675 bytes, lines 17606-17659
17606: (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E); 17607 else { 17608 var a2 = v + (n2.w_bits - 8 << 4) << 8; 17609 a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1; 17610 } 17611 if (69 === n2.status) 17612 if (n2.gzhead.extra) { 17613 for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) 17614 U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++; 17615 n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73); 17616 } else 17617 n2.status = 73; 17618 if (73 === n2.status) 17619 if (n2.gzhead.name) { 17620 i2 = n2.pending; 17621 do { 17622 if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { 17623 s2 = 1; 17624 break; 17625 } 17626 s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2); 17627 } while (0 !== s2); 17628 n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91); 17629 } else 17630 n2.status = 91; 17631 if (91 === n2.status) 17632 if (n2.gzhead.comment) { 17633 i2 = n2.pending; 17634 do { 17635 if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) { 17636 s2 = 1; 17637 break; 17638 } 17639 s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2); 17640 } while (0 !== s2); 17641 n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103); 17642 } else 17643 n2.status = 103; 17644 if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) { 17645 if (F(e2), 0 === e2.avail_out) 17646 return n2.last_flush = -1, m; 17647 } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) 17648 return R2(e2, -5); 17649 if (666 === n2.status && 0 !== e2.avail_in) 17650 return R2(e2, -5); 17651 if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) { 17652 var o2 = 2 === n2.strategy ? function(e3, t3) { 17653 for (var r3; ; ) { 17654 if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) { 17655 if (t3 === l) 17656 return A; 17657 break; 17658 } 17659 if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.
vendor: 13,070 bytes, lines 17659-17841
17659window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) 17660 return A; 17661 } 17662 return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; 17663 }(n2, t2) : 3 === n2.strategy ? function(e3, t3) { 17664 for (var r3, n3, i3, s3, a3 = e3.window; ; ) { 17665 if (e3.lookahead <= S) { 17666 if (j(e3), e3.lookahead <= S && t3 === l) 17667 return A; 17668 if (0 === e3.lookahead) 17669 break; 17670 } 17671 if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) { 17672 s3 = e3.strstart + S; 17673 do { 17674 } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3); 17675 e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead); 17676 } 17677 if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) 17678 return A; 17679 } 17680 return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I; 17681 }(n2, t2) : h[n2.level].func(n2, t2); 17682 if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) 17683 return 0 === e2.avail_out && (n2.last_flush = -1), m; 17684 if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) 17685 return n2.last_flush = -1, m; 17686 } 17687 return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1); 17688 }, r.deflateEnd = function(e2) { 17689 var t2; 17690 return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R2(e2, _) : (e2.state = null, t2 === E ? R2(e2, -3) : m) : _; 17691 }, r.deflateSetDictionary = function(e2, t2) { 17692 var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length; 17693 if (!e2 || !e2.state) 17694 return _; 17695 if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) 17696 return _; 17697 for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) { 17698 for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) 17699 ; 17700 r2.strstart = n2, r2.lookahead = x - 1, j(r2); 17701 } 17702 return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m; 17703 }, r.deflateInfo = "pako deflate (from Nodeca project)"; 17704 }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) { 17705 t.exports = function() { 17706 this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; 17707 }; 17708 }, {}], 48: [function(e, t, r) { 17709 t.exports = function(e2, t2) { 17710 var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C; 17711 r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1; 17712 e: 17713 do { 17714 p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g]; 17715 t: 17716 for (; ; ) { 17717 if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) 17718 C[s++] = 65535 & v; 17719 else { 17720 if (!(16 & y)) { 17721 if (0 == (64 & y)) { 17722 v = m[(65535 & v) + (d & (1 << y) - 1)]; 17723 continue t; 17724 } 17725 if (32 & y) { 17726 r2.mode = 12; 17727 break e; 17728 } 17729 e2.msg = "invalid literal/length code", r2.mode = 30; 17730 break e; 17731 } 17732 w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b]; 17733 r: 17734 for (; ; ) { 17735 if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) { 17736 if (0 == (64 & y)) { 17737 v = _[(65535 & v) + (d & (1 << y) - 1)]; 17738 continue r; 17739 } 17740 e2.msg = "invalid distance code", r2.mode = 30; 17741 break e; 17742 } 17743 if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) { 17744 e2.msg = "invalid distance too far back", r2.mode = 30; 17745 break e; 17746 } 17747 if (d >>>= y, p -= y, (y = s - a) < k) { 17748 if (l < (y = k - y) && r2.sane) { 17749 e2.msg = "invalid distance too far back", r2.mode = 30; 17750 break e; 17751 } 17752 if (S = c, (x = 0) === f) { 17753 if (x += u - y, y < w) { 17754 for (w -= y; C[s++] = c[x++], --y; ) 17755 ; 17756 x = s - k, S = C; 17757 } 17758 } else if (f < y) { 17759 if (x += u + f - y, (y -= f) < w) { 17760 for (w -= y; C[s++] = c[x++], --y; ) 17761 ; 17762 if (x = 0, f < w) { 17763 for (w -= y = f; C[s++] = c[x++], --y; ) 17764 ; 17765 x = s - k, S = C; 17766 } 17767 } 17768 } else if (x += f - y, y < w) { 17769 for (w -= y; C[s++] = c[x++], --y; ) 17770 ; 17771 x = s - k, S = C; 17772 } 17773 for (; 2 < w; ) 17774 C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3; 17775 w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++])); 17776 } else { 17777 for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) 17778 ; 17779 w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++])); 17780 } 17781 break; 17782 } 17783 } 17784 break; 17785 } 17786 } while (n < i && s < o); 17787 n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p; 17788 }; 17789 }, {}], 49: [function(e, t, r) { 17790 var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R2 = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592; 17791 function L(e2) { 17792 return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); 17793 } 17794 function s() { 17795 this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; 17796 } 17797 function a(e2) { 17798 var t2; 17799 return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U; 17800 } 17801 function o(e2) { 17802 var t2; 17803 return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U; 17804 } 17805 function h(e2, t2) { 17806 var r2, n2; 17807 return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U; 17808 } 17809 function u(e2, t2) { 17810 var r2, n2; 17811 return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U; 17812 } 17813 var l, f, c = true; 17814 function j(e2) { 17815 if (c) { 17816 var t2; 17817 for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) 17818 e2.lens[t2++] = 8; 17819 for (; t2 < 256; ) 17820 e2.lens[t2++] = 9; 17821 for (; t2 < 280; ) 17822 e2.lens[t2++] = 7; 17823 for (; t2 < 288; ) 17824 e2.lens[t2++] = 8; 17825 for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) 17826 e2.lens[t2++] = 5; 17827 T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false; 17828 } 17829 e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5; 17830 } 17831 function Z(e2, t2, r2, n2) { 17832 var i2, s2 = e2.state; 17833 return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0; 17834 } 17835 r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) { 17836 return u(e2, 15); 17837 }, r.inflateInit2 = u, r.inflate = function(e2, t2) { 17838 var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; 17839 if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) 17840 return U; 17841 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x
vendor: 9,115 bytes, lines 17841-18038
17841 = N; 17842 e: 17843 for (; ; ) 17844 switch (r2.mode) { 17845 case P: 17846 if (0 === r2.wrap) { 17847 r2.mode = 13; 17848 break; 17849 } 17850 for (; l2 < 16; ) { 17851 if (0 === o2) 17852 break e; 17853 o2--, u2 += n2[s2++] << l2, l2 += 8; 17854 } 17855 if (2 & r2.wrap && 35615 === u2) { 17856 E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2; 17857 break; 17858 } 17859 if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) { 17860 e2.msg = "incorrect header check", r2.mode = 30; 17861 break; 17862 } 17863 if (8 != (15 & u2)) { 17864 e2.msg = "unknown compression method", r2.mode = 30; 17865 break; 17866 } 17867 if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) 17868 r2.wbits = k; 17869 else if (k > r2.wbits) { 17870 e2.msg = "invalid window size", r2.mode = 30; 17871 break; 17872 } 17873 r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0; 17874 break; 17875 case 2: 17876 for (; l2 < 16; ) { 17877 if (0 === o2) 17878 break e; 17879 o2--, u2 += n2[s2++] << l2, l2 += 8; 17880 } 17881 if (r2.flags = u2, 8 != (255 & r2.flags)) { 17882 e2.msg = "unknown compression method", r2.mode = 30; 17883 break; 17884 } 17885 if (57344 & r2.flags) { 17886 e2.msg = "unknown header flags set", r2.mode = 30; 17887 break; 17888 } 17889 r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3; 17890 case 3: 17891 for (; l2 < 32; ) { 17892 if (0 === o2) 17893 break e; 17894 o2--, u2 += n2[s2++] << l2, l2 += 8; 17895 } 17896 r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4; 17897 case 4: 17898 for (; l2 < 16; ) { 17899 if (0 === o2) 17900 break e; 17901 o2--, u2 += n2[s2++] << l2, l2 += 8; 17902 } 17903 r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5; 17904 case 5: 17905 if (1024 & r2.flags) { 17906 for (; l2 < 16; ) { 17907 if (0 === o2) 17908 break e; 17909 o2--, u2 += n2[s2++] << l2, l2 += 8; 17910 } 17911 r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0; 17912 } else 17913 r2.head && (r2.head.extra = null); 17914 r2.mode = 6; 17915 case 6: 17916 if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) 17917 break e; 17918 r2.length = 0, r2.mode = 7; 17919 case 7: 17920 if (2048 & r2.flags) { 17921 if (0 === o2) 17922 break e; 17923 for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) 17924 ; 17925 if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) 17926 break e; 17927 } else 17928 r2.head && (r2.head.name = null); 17929 r2.length = 0, r2.mode = 8; 17930 case 8: 17931 if (4096 & r2.flags) { 17932 if (0 === o2) 17933 break e; 17934 for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) 17935 ; 17936 if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) 17937 break e; 17938 } else 17939 r2.head && (r2.head.comment = null); 17940 r2.mode = 9; 17941 case 9: 17942 if (512 & r2.flags) { 17943 for (; l2 < 16; ) { 17944 if (0 === o2) 17945 break e; 17946 o2--, u2 += n2[s2++] << l2, l2 += 8; 17947 } 17948 if (u2 !== (65535 & r2.check)) { 17949 e2.msg = "header crc mismatch", r2.mode = 30; 17950 break; 17951 } 17952 l2 = u2 = 0; 17953 } 17954 r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12; 17955 break; 17956 case 10: 17957 for (; l2 < 32; ) { 17958 if (0 === o2) 17959 break e; 17960 o2--, u2 += n2[s2++] << l2, l2 += 8; 17961 } 17962 e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11; 17963 case 11: 17964 if (0 === r2.havedict) 17965 return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2; 17966 e2.adler = r2.check = 1, r2.mode = 12; 17967 case 12: 17968 if (5 === t2 || 6 === t2) 17969 break e; 17970 case 13: 17971 if (r2.last) { 17972 u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27; 17973 break; 17974 } 17975 for (; l2 < 3; ) { 17976 if (0 === o2) 17977 break e; 17978 o2--, u2 += n2[s2++] << l2, l2 += 8; 17979 } 17980 switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) { 17981 case 0: 17982 r2.mode = 14; 17983 break; 17984 case 1: 17985 if (j(r2), r2.mode = 20, 6 !== t2) 17986 break; 17987 u2 >>>= 2, l2 -= 2; 17988 break e; 17989 case 2: 17990 r2.mode = 17; 17991 break; 17992 case 3: 17993 e2.msg = "invalid block type", r2.mode = 30; 17994 } 17995 u2 >>>= 2, l2 -= 2; 17996 break; 17997 case 14: 17998 for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) { 17999 if (0 === o2) 18000 break e; 18001 o2--, u2 += n2[s2++] << l2, l2 += 8; 18002 } 18003 if ((65535 & u2) != (u2 >>> 16 ^ 65535)) { 18004 e2.msg = "invalid stored block lengths", r2.mode = 30; 18005 break; 18006 } 18007 if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) 18008 break e; 18009 case 15: 18010 r2.mode = 16; 18011 case 16: 18012 if (d = r2.length) { 18013 if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) 18014 break e; 18015 I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d; 18016 break; 18017 } 18018 r2.mode = 12; 18019 break; 18020 case 17: 18021 for (; l2 < 14; ) { 18022 if (0 === o2) 18023 break e; 18024 o2--, u2 += n2[s2++] << l2, l2 += 8; 18025 } 18026 if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) { 18027 e2.msg = "too many length or distance symbols", r2.mode = 30; 18028 break; 18029 } 18030 r2.have = 0, r2.mode = 18; 18031 case 18: 18032 for (; r2.have < r2.ncode; ) { 18033 for (; l2 < 3; ) { 18034 if (0 === o2) 18035 break e; 18036 o2--, u2 += n2[s2++] << l2, l2 += 8; 18037 } 18038 r2.lens[A
vendor: 6,363 bytes, lines 18038-18164
18038[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3; 18039 } 18040 for (; r2.have < 19; ) 18041 r2.lens[A[r2.have++]] = 0; 18042 if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { 18043 e2.msg = "invalid code lengths set", r2.mode = 30; 18044 break; 18045 } 18046 r2.have = 0, r2.mode = 19; 18047 case 19: 18048 for (; r2.have < r2.nlen + r2.ndist; ) { 18049 for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { 18050 if (0 === o2) 18051 break e; 18052 o2--, u2 += n2[s2++] << l2, l2 += 8; 18053 } 18054 if (b < 16) 18055 u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b; 18056 else { 18057 if (16 === b) { 18058 for (z = _ + 2; l2 < z; ) { 18059 if (0 === o2) 18060 break e; 18061 o2--, u2 += n2[s2++] << l2, l2 += 8; 18062 } 18063 if (u2 >>>= _, l2 -= _, 0 === r2.have) { 18064 e2.msg = "invalid bit length repeat", r2.mode = 30; 18065 break; 18066 } 18067 k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2; 18068 } else if (17 === b) { 18069 for (z = _ + 3; l2 < z; ) { 18070 if (0 === o2) 18071 break e; 18072 o2--, u2 += n2[s2++] << l2, l2 += 8; 18073 } 18074 l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3; 18075 } else { 18076 for (z = _ + 7; l2 < z; ) { 18077 if (0 === o2) 18078 break e; 18079 o2--, u2 += n2[s2++] << l2, l2 += 8; 18080 } 18081 l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7; 18082 } 18083 if (r2.have + d > r2.nlen + r2.ndist) { 18084 e2.msg = "invalid bit length repeat", r2.mode = 30; 18085 break; 18086 } 18087 for (; d--; ) 18088 r2.lens[r2.have++] = k; 18089 } 18090 } 18091 if (30 === r2.mode) 18092 break; 18093 if (0 === r2.lens[256]) { 18094 e2.msg = "invalid code -- missing end-of-block", r2.mode = 30; 18095 break; 18096 } 18097 if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) { 18098 e2.msg = "invalid literal/lengths set", r2.mode = 30; 18099 break; 18100 } 18101 if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) { 18102 e2.msg = "invalid distances set", r2.mode = 30; 18103 break; 18104 } 18105 if (r2.mode = 20, 6 === t2) 18106 break e; 18107 case 20: 18108 r2.mode = 21; 18109 case 21: 18110 if (6 <= o2 && 258 <= h2) { 18111 e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R2(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1); 18112 break; 18113 } 18114 for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { 18115 if (0 === o2) 18116 break e; 18117 o2--, u2 += n2[s2++] << l2, l2 += 8; 18118 } 18119 if (g && 0 == (240 & g)) { 18120 for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { 18121 if (0 === o2) 18122 break e; 18123 o2--, u2 += n2[s2++] << l2, l2 += 8; 18124 } 18125 u2 >>>= v, l2 -= v, r2.back += v; 18126 } 18127 if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) { 18128 r2.mode = 26; 18129 break; 18130 } 18131 if (32 & g) { 18132 r2.back = -1, r2.mode = 12; 18133 break; 18134 } 18135 if (64 & g) { 18136 e2.msg = "invalid literal/length code", r2.mode = 30; 18137 break; 18138 } 18139 r2.extra = 15 & g, r2.mode = 22; 18140 case 22: 18141 if (r2.extra) { 18142 for (z = r2.extra; l2 < z; ) { 18143 if (0 === o2) 18144 break e; 18145 o2--, u2 += n2[s2++] << l2, l2 += 8; 18146 } 18147 r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; 18148 } 18149 r2.was = r2.length, r2.mode = 23; 18150 case 23: 18151 for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) { 18152 if (0 === o2) 18153 break e; 18154 o2--, u2 += n2[s2++] << l2, l2 += 8; 18155 } 18156 if (0 == (240 & g)) { 18157 for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) { 18158 if (0 === o2) 18159 break e; 18160 o2--, u2 += n2[s2++] << l2, l2 += 8; 18161 } 18162 u2 >>>= v, l2 -= v, r2.back += v; 18163 } 18164 if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) {
vendor: 5,951 bytes, lines 18165-18269
18165 e2.msg = "invalid distance code", r2.mode = 30; 18166 break; 18167 } 18168 r2.offset = b, r2.extra = 15 & g, r2.mode = 24; 18169 case 24: 18170 if (r2.extra) { 18171 for (z = r2.extra; l2 < z; ) { 18172 if (0 === o2) 18173 break e; 18174 o2--, u2 += n2[s2++] << l2, l2 += 8; 18175 } 18176 r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra; 18177 } 18178 if (r2.offset > r2.dmax) { 18179 e2.msg = "invalid distance too far back", r2.mode = 30; 18180 break; 18181 } 18182 r2.mode = 25; 18183 case 25: 18184 if (0 === h2) 18185 break e; 18186 if (d = c2 - h2, r2.offset > d) { 18187 if ((d = r2.offset - d) > r2.whave && r2.sane) { 18188 e2.msg = "invalid distance too far back", r2.mode = 30; 18189 break; 18190 } 18191 p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window; 18192 } else 18193 m = i2, p = a2 - r2.offset, d = r2.length; 18194 for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) 18195 ; 18196 0 === r2.length && (r2.mode = 21); 18197 break; 18198 case 26: 18199 if (0 === h2) 18200 break e; 18201 i2[a2++] = r2.length, h2--, r2.mode = 21; 18202 break; 18203 case 27: 18204 if (r2.wrap) { 18205 for (; l2 < 32; ) { 18206 if (0 === o2) 18207 break e; 18208 o2--, u2 |= n2[s2++] << l2, l2 += 8; 18209 } 18210 if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) { 18211 e2.msg = "incorrect data check", r2.mode = 30; 18212 break; 18213 } 18214 l2 = u2 = 0; 18215 } 18216 r2.mode = 28; 18217 case 28: 18218 if (r2.wrap && r2.flags) { 18219 for (; l2 < 32; ) { 18220 if (0 === o2) 18221 break e; 18222 o2--, u2 += n2[s2++] << l2, l2 += 8; 18223 } 18224 if (u2 !== (4294967295 & r2.total)) { 18225 e2.msg = "incorrect length check", r2.mode = 30; 18226 break; 18227 } 18228 l2 = u2 = 0; 18229 } 18230 r2.mode = 29; 18231 case 29: 18232 x = 1; 18233 break e; 18234 case 30: 18235 x = -3; 18236 break e; 18237 case 31: 18238 return -4; 18239 case 32: 18240 default: 18241 return U; 18242 } 18243 return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x); 18244 }, r.inflateEnd = function(e2) { 18245 if (!e2 || !e2.state) 18246 return U; 18247 var t2 = e2.state; 18248 return t2.window && (t2.window = null), e2.state = null, N; 18249 }, r.inflateGetHeader = function(e2, t2) { 18250 var r2; 18251 return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U; 18252 }, r.inflateSetDictionary = function(e2, t2) { 18253 var r2, n2 = t2.length; 18254 return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U; 18255 }, r.inflateInfo = "pako inflate (from Nodeca project)"; 18256 }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) { 18257 var D = e("../utils/common"), F = [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], N = [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], U = [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], P = [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]; 18258 t.exports = function(e2, t2, r2, n, i, s, a, o) { 18259 var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R2 = null, T = 0; 18260 for (b = 0; b <= 15; b++) 18261 O[b] = 0; 18262 for (v = 0; v < n; v++) 18263 O[t2[r2 + v]]++; 18264 for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) 18265 ; 18266 if (w < k && (k = w), 0 === w) 18267 return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0; 18268 for (y = 1; y < w && 0 === O[y]; y++) 18269 ;
vendor: 7,035 bytes, lines 18270-18393
18270 for (k < y && (k = y), b = z = 1; b <= 15; b++) 18271 if (z <<= 1, (z -= O[b]) < 0) 18272 return -1; 18273 if (0 < z && (0 === e2 || 1 !== w)) 18274 return -1; 18275 for (B[1] = 0, b = 1; b < 15; b++) 18276 B[b + 1] = B[b] + O[b]; 18277 for (v = 0; v < n; v++) 18278 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v); 18279 if (d = 0 === e2 ? (A = R2 = a, 19) : 1 === e2 ? (A = F, I -= 257, R2 = N, T -= 257, 256) : (A = U, R2 = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) 18280 return 1; 18281 for (; ; ) { 18282 for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R2[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) 18283 ; 18284 for (h = 1 << b - 1; E & h; ) 18285 h >>= 1; 18286 if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) { 18287 if (b === w) 18288 break; 18289 b = t2[r2 + a[v]]; 18290 } 18291 if (k < b && (E & f) !== l) { 18292 for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) 18293 x++, z <<= 1; 18294 if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) 18295 return 1; 18296 i[l = E & f] = k << 24 | x << 16 | c - s | 0; 18297 } 18298 } 18299 return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0; 18300 }; 18301 }, { "../utils/common": 41 }], 51: [function(e, t, r) { 18302 t.exports = { 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" }; 18303 }, {}], 52: [function(e, t, r) { 18304 var i = e("../utils/common"), o = 0, h = 1; 18305 function n(e2) { 18306 for (var t2 = e2.length; 0 <= --t2; ) 18307 e2[t2] = 0; 18308 } 18309 var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [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], k = [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], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2)); 18310 n(z); 18311 var C = new Array(2 * f); 18312 n(C); 18313 var E = new Array(512); 18314 n(E); 18315 var A = new Array(256); 18316 n(A); 18317 var I = new Array(a); 18318 n(I); 18319 var O, B, R2, T = new Array(f); 18320 function D(e2, t2, r2, n2, i2) { 18321 this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length; 18322 } 18323 function F(e2, t2) { 18324 this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2; 18325 } 18326 function N(e2) { 18327 return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)]; 18328 } 18329 function U(e2, t2) { 18330 e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255; 18331 } 18332 function P(e2, t2, r2) { 18333 e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2); 18334 } 18335 function L(e2, t2, r2) { 18336 P(e2, r2[2 * t2], r2[2 * t2 + 1]); 18337 } 18338 function j(e2, t2) { 18339 for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) 18340 ; 18341 return r2 >>> 1; 18342 } 18343 function Z(e2, t2, r2) { 18344 var n2, i2, s2 = new Array(g + 1), a2 = 0; 18345 for (n2 = 1; n2 <= g; n2++) 18346 s2[n2] = a2 = a2 + r2[n2 - 1] << 1; 18347 for (i2 = 0; i2 <= t2; i2++) { 18348 var o2 = e2[2 * i2 + 1]; 18349 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2)); 18350 } 18351 } 18352 function W(e2) { 18353 var t2; 18354 for (t2 = 0; t2 < l; t2++) 18355 e2.dyn_ltree[2 * t2] = 0; 18356 for (t2 = 0; t2 < f; t2++) 18357 e2.dyn_dtree[2 * t2] = 0; 18358 for (t2 = 0; t2 < c; t2++) 18359 e2.bl_tree[2 * t2] = 0; 18360 e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0; 18361 } 18362 function M(e2) { 18363 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0; 18364 } 18365 function H(e2, t2, r2, n2) { 18366 var i2 = 2 * t2, s2 = 2 * r2; 18367 return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2]; 18368 } 18369 function G(e2, t2, r2) { 18370 for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) 18371 e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1; 18372 e2.heap[r2] = n2; 18373 } 18374 function K(e2, t2, r2) { 18375 var n2, i2, s2, a2, o2 = 0; 18376 if (0 !== e2.last_lit) 18377 for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) 18378 ; 18379 L(e2, m, t2); 18380 } 18381 function Y(e2, t2) { 18382 var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1; 18383 for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) 18384 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0; 18385 for (; e2.heap_len < 2; ) 18386 s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]); 18387 for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) 18388 G(e2, s2, r2); 18389 for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) 18390 ; 18391 e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) { 18392 var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0; 18393 for (s3 = 0; s3 <= g; s3++)
vendor: 7,299 bytes, lines 18394-18507
18394 e3.bl_count[s3] = 0; 18395 for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) 18396 p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3))); 18397 if (0 !== m2) { 18398 do { 18399 for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) 18400 s3--; 18401 e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2; 18402 } while (0 < m2); 18403 for (s3 = p2; 0 !== s3; s3--) 18404 for (n3 = e3.bl_count[s3]; 0 !== n3; ) 18405 u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--); 18406 } 18407 }(e2, t2), Z(s2, u2, e2.bl_count); 18408 } 18409 function X(e2, t2, r2) { 18410 var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; 18411 for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) 18412 i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4)); 18413 } 18414 function V(e2, t2, r2) { 18415 var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4; 18416 for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) 18417 if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) { 18418 if (o2 < u2) 18419 for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) 18420 ; 18421 else 18422 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7)); 18423 s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4); 18424 } 18425 } 18426 n(T); 18427 var q = false; 18428 function J(e2, t2, r2, n2) { 18429 P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { 18430 M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3; 18431 }(e2, t2, r2, true); 18432 } 18433 r._tr_init = function(e2) { 18434 q || (function() { 18435 var e3, t2, r2, n2, i2, s2 = new Array(g + 1); 18436 for (n2 = r2 = 0; n2 < a - 1; n2++) 18437 for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) 18438 A[r2++] = n2; 18439 for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) 18440 for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) 18441 E[i2++] = n2; 18442 for (i2 >>= 7; n2 < f; n2++) 18443 for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) 18444 E[256 + i2++] = n2; 18445 for (t2 = 0; t2 <= g; t2++) 18446 s2[t2] = 0; 18447 for (e3 = 0; e3 <= 143; ) 18448 z[2 * e3 + 1] = 8, e3++, s2[8]++; 18449 for (; e3 <= 255; ) 18450 z[2 * e3 + 1] = 9, e3++, s2[9]++; 18451 for (; e3 <= 279; ) 18452 z[2 * e3 + 1] = 7, e3++, s2[7]++; 18453 for (; e3 <= 287; ) 18454 z[2 * e3 + 1] = 8, e3++, s2[8]++; 18455 for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) 18456 C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5); 18457 O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R2 = new D(new Array(0), x, 0, c, p); 18458 }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R2), e2.bi_buf = 0, e2.bi_valid = 0, W(e2); 18459 }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) { 18460 var i2, s2, a2 = 0; 18461 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) { 18462 var t3, r3 = 4093624447; 18463 for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) 18464 if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) 18465 return o; 18466 if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) 18467 return h; 18468 for (t3 = 32; t3 < u; t3++) 18469 if (0 !== e3.dyn_ltree[2 * t3]) 18470 return h; 18471 return o; 18472 }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) { 18473 var t3; 18474 for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) 18475 ; 18476 return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3; 18477 }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) { 18478 var i3; 18479 for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) 18480 P(e3, e3.bl_tree[2 * S[i3] + 1], 3); 18481 V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1); 18482 }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2); 18483 }, r._tr_tally = function(e2, t2, r2) { 18484 return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1; 18485 }, r._tr_align = function(e2) { 18486 P(e2, 2, 3), L(e2, m, z), function(e3) { 18487 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8); 18488 }(e2); 18489 }; 18490 }, { "../utils/common": 41 }], 53: [function(e, t, r) { 18491 t.exports = function() { 18492 this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; 18493 }; 18494 }, {}], 54: [function(e, t, r) { 18495 (function(e2) { 18496 !function(r2, n) { 18497 if (!r2.setImmediate) { 18498 var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2); 18499 e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) { 18500 process$1.nextTick(function() { 18501 c(e4); 18502 }); 18503 } : function() { 18504 if (r2.postMessage && !r2.importScripts) { 18505 var e4 = true, t3 = r2.onmessage; 18506 return r2.onmessage = function() { 18507 e4 = false;
18508 }, r2.postMessage("", "*"), r2.onmessage = t3, e4; 18509 } 18510 }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) { 18511 r2.postMessage(a + e4, "*"); 18512 }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) { 18513 c(e4.data); 18514 }, function(e4) { 18515 t2.port2.postMessage(e4); 18516 }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) { 18517 var t3 = l.createElement("script"); 18518 t3.onreadystatechange = function() { 18519 c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null; 18520 }, s.appendChild(t3); 18521 }) : function(e4) { 18522 setTimeout(c, 0, e4); 18523 }, e3.setImmediate = function(e4) { 18524 "function" != typeof e4 && (e4 = new Function("" + e4)); 18525 for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) 18526 t3[r3] = arguments[r3 + 1]; 18527 var n2 = { callback: e4, args: t3 }; 18528 return h[o] = n2, i(o), o++; 18529 }, e3.clearImmediate = f; 18530 } 18531 function f(e4) { 18532 delete h[e4]; 18533 } 18534 function c(e4) { 18535 if (u) 18536 setTimeout(c, 0, e4); 18537 else { 18538 var t3 = h[e4]; 18539 if (t3) { 18540 u = true; 18541 try { 18542 !function(e5) { 18543 var t4 = e5.callback, r3 = e5.args; 18544 switch (r3.length) { 18545 case 0: 18546 t4(); 18547 break; 18548 case 1: 18549 t4(r3[0]); 18550 break; 18551 case 2: 18552 t4(r3[0], r3[1]); 18553 break; 18554 case 3: 18555 t4(r3[0], r3[1], r3[2]); 18556 break; 18557 default: 18558 t4.apply(n, r3); 18559 } 18560 }(t3); 18561 } finally { 18562 f(e4), u = false; 18563 } 18564 } 18565 } 18566 } 18567 function d(e4) { 18568 e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length)); 18569 } 18570 }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self); 18571 }).call(this, "undefined" != typeof commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); 18572 }, {}] }, {}, [10])(10); 18573 }); 18574 })(jszip_min); 18575 var jszip_minExports = jszip_min.exports; 18576 const JSZip = /* @__PURE__ */ getDefaultExportFromCjs$1(jszip_minExports); 18577 var xml$2 = { exports: {} }; 18578 var XML_CHARACTER_MAP = { 18579 "&": "&", 18580 '"': """, 18581 "'": "'", 18582 "<": "<", 18583 ">": ">" 18584 }; 18585 function escapeForXML$1(string) { 18586 return string && string.replace ? string.replace(/([&"<>'])/g, function(str, item) { 18587 return XML_CHARACTER_MAP[item]; 18588 }) : string; 18589 } 18590 var escapeForXML_1 = escapeForXML$1; 18591 var escapeForXML = escapeForXML_1; 18592 var Stream = streamBrowserify.Stream; 18593 var DEFAULT_INDENT = " "; 18594 function xml(input, options2) { 18595 if (typeof options2 !== "object") { 18596 options2 = { 18597 indent: options2 18598 }; 18599 } 18600 var stream = options2.stream ? new Stream() : null, output = "", interrupted = false, indent = !options2.indent ? "" : options2.indent === true ? DEFAULT_INDENT : options2.indent, instant = true; 18601 function delay(func) { 18602 if (!instant) { 18603 func(); 18604 } else { 18605 process$1.nextTick(func); 18606 } 18607 } 18608 function append(interrupt, out) { 18609 if (out !== void 0) { 18610 output += out; 18611 } 18612 if (interrupt && !interrupted) { 18613 stream = stream || new Stream(); 18614 interrupted = true; 18615 } 18616 if (interrupt && interrupted) { 18617 var data = output; 18618 delay(function() { 18619 stream.emit("data", data); 18620 }); 18621 output = ""; 18622 } 18623 } 18624 function add(value, last) { 18625 format(append, resolve(value, indent, indent ? 1 : 0), last); 18626 } 18627 function end() { 18628 if (stream) { 18629 var data = output; 18630 delay(function() { 18631 stream.emit("data", data); 18632 stream.emit("end"); 18633 stream.readable = false;
18634 stream.emit("close"); 18635 }); 18636 } 18637 } 18638 function addXmlDeclaration(declaration) { 18639 var encoding = declaration.encoding || "UTF-8", attr = { version: "1.0", encoding }; 18640 if (declaration.standalone) { 18641 attr.standalone = declaration.standalone; 18642 } 18643 add({ "?xml": { _attr: attr } }); 18644 output = output.replace("/>", "?>"); 18645 } 18646 delay(function() { 18647 instant = false; 18648 }); 18649 if (options2.declaration) { 18650 addXmlDeclaration(options2.declaration); 18651 } 18652 if (input && input.forEach) { 18653 input.forEach(function(value, i) { 18654 var last; 18655 if (i + 1 === input.length) 18656 last = end; 18657 add(value, last); 18658 }); 18659 } else { 18660 add(input, end); 18661 } 18662 if (stream) { 18663 stream.readable = true; 18664 return stream; 18665 } 18666 return output; 18667 } 18668 function element() { 18669 var input = Array.prototype.slice.call(arguments), self2 = { 18670 _elem: resolve(input) 18671 }; 18672 self2.push = function(input2) { 18673 if (!this.append) { 18674 throw new Error("not assigned to a parent!"); 18675 } 18676 var that = this; 18677 var indent = this._elem.indent; 18678 format( 18679 this.append, 18680 resolve( 18681 input2, 18682 indent, 18683 this._elem.icount + (indent ? 1 : 0) 18684 ), 18685 function() { 18686 that.append(true); 18687 } 18688 ); 18689 }; 18690 self2.close = function(input2) { 18691 if (input2 !== void 0) { 18692 this.push(input2); 18693 } 18694 if (this.end) { 18695 this.end(); 18696 } 18697 }; 18698 return self2; 18699 } 18700 function create_indent(character, count) { 18701 return new Array(count || 0).join(character || ""); 18702 } 18703 function resolve(data, indent, indent_count) { 18704 indent_count = indent_count || 0; 18705 var indent_spaces = create_indent(indent, indent_count); 18706 var name; 18707 var values = data; 18708 var interrupt = false; 18709 if (typeof data === "object") { 18710 var keys = Object.keys(data); 18711 name = keys[0]; 18712 values = data[name]; 18713 if (values && values._elem) { 18714 values._elem.name = name; 18715 values._elem.icount = indent_count; 18716 values._elem.indent = indent; 18717 values._elem.indents = indent_spaces; 18718 values._elem.interrupt = values; 18719 return values._elem; 18720 } 18721 } 18722 var attributes = [], content = []; 18723 var isStringContent; 18724 function get_attributes(obj) { 18725 var keys2 = Object.keys(obj); 18726 keys2.forEach(function(key) { 18727 attributes.push(attribute(key, obj[key])); 18728 }); 18729 } 18730 switch (typeof values) { 18731 case "object": 18732 if (values === null) 18733 break; 18734 if (values._attr) { 18735 get_attributes(values._attr); 18736 } 18737 if (values._cdata) { 18738 content.push( 18739 ("<![CDATA[" + values._cdata).replace(/\]\]>/g, "]]]]><![CDATA[>") + "]]>" 18740 ); 18741 } 18742 if (values.forEach) { 18743 isStringContent = false; 18744 content.push(""); 18745 values.forEach(function(value) { 18746 if (typeof value == "object") { 18747 var _name = Object.keys(value)[0]; 18748 if (_name == "_attr") { 18749 get_attributes(value._attr); 18750 } else { 18751 content.push(resolve( 18752 value, 18753 indent, 18754 indent_count + 1 18755 )); 18756 } 18757 } else { 18758 content.pop(); 18759 isStringContent = true; 18760 content.push(escapeForXML(value)); 18761 } 18762 }); 18763 if (!isStringContent) { 18764 content.push(""); 18765 } 18766 } 18767 break; 18768 default: 18769 content.push(escapeForXML(values)); 18770 } 18771 return { 18772 name, 18773 interrupt, 18774 attributes, 18775 content, 18776 icount: indent_count, 18777 indents: indent_spaces, 18778 indent 18779 }; 18780 } 18781 function format(append, elem, end) { 18782 if (typeof elem != "object") { 18783 return append(false, elem); 18784 } 18785 var len = elem.interrupt ? 1 : elem.content.length; 18786 function proceed() { 18787 while (elem.content.length) { 18788 var value = elem.content.shift(); 18789 if (value === void 0) 18790 continue; 18791 if (interrupt(value)) 18792 return; 18793 format(append, value); 18794 } 18795 append(false, (len > 1 ? elem.indents : "") + (elem.name ? "</" + elem.name + ">" : "") + (elem.indent && !end ? "\n" : "")); 18796 if (end) { 18797 end(); 18798 } 18799 } 18800 function interrupt(value) { 18801 if (value.interrupt) { 18802 value.interrupt.append = append; 18803 value.interrupt.end = proceed; 18804 value.interrupt = false;
18805 append(true); 18806 return true; 18807 } 18808 return false; 18809 } 18810 append(false, elem.indents + (elem.name ? "<" + elem.name : "") + (elem.attributes.length ? " " + elem.attributes.join(" ") : "") + (len ? elem.name ? ">" : "" : elem.name ? "/>" : "") + (elem.indent && len > 1 ? "\n" : "")); 18811 if (!len) { 18812 return append(false, elem.indent ? "\n" : ""); 18813 } 18814 if (!interrupt(elem)) { 18815 proceed(); 18816 } 18817 } 18818 function attribute(key, value) { 18819 return key + '="' + escapeForXML(value) + '"'; 18820 } 18821 xml$2.exports = xml; 18822 xml$2.exports.element = xml$2.exports.Element = element; 18823 var xmlExports = xml$2.exports; 18824 const xml$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(xmlExports); 18825 const obfuscatedStartOffset = 0; 18826 const obfuscatedEndOffset = 32; 18827 const guidSize = 32; 18828 const obfuscate = (buf, fontKey) => { 18829 const guid = fontKey.replace(/-/g, ""); 18830 if (guid.length !== guidSize) { 18831 throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`); 18832 } 18833 const hexStrings = guid.replace(/(..)/g, "$1 ").trim().split(" "); 18834 const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16)); 18835 hexNumbers.reverse(); 18836 const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset); 18837 const obfuscatedBytes = bytesToObfuscate.map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]); 18838 const out = Buffer.concat([buf.slice(0, obfuscatedStartOffset), obfuscatedBytes, buf.slice(obfuscatedEndOffset)]); 18839 return out; 18840 }; 18841 class Formatter { 18842 // tslint:disable-next-line: no-object-literal-type-assertion 18843 format(input, context = { stack: [] }) { 18844 const output = input.prepForXml(context); 18845 if (output) { 18846 return output; 18847 } else { 18848 throw Error("XMLComponent did not format correctly"); 18849 } 18850 } 18851 } 18852 class ImageReplacer { 18853 replace(xmlData, mediaData, offset) { 18854 let currentXmlData = xmlData; 18855 mediaData.forEach((image, i) => { 18856 currentXmlData = currentXmlData.replace(new RegExp(`{${image.fileName}}`, "g"), (offset + i).toString()); 18857 }); 18858 return currentXmlData; 18859 } 18860 getMediaData(xmlData, media) { 18861 return media.Array.filter((image) => xmlData.search(`{${image.fileName}}`) > 0); 18862 } 18863 } 18864 class NumberingReplacer { 18865 replace(xmlData, concreteNumberings) { 18866 let currentXmlData = xmlData; 18867 for (const concreteNumbering of concreteNumberings) { 18868 currentXmlData = currentXmlData.replace( 18869 new RegExp(`{${concreteNumbering.reference}-${concreteNumbering.instance}}`, "g"), 18870 concreteNumbering.numId.toString() 18871 ); 18872 } 18873 return currentXmlData; 18874 } 18875 } 18876 class Compiler { 18877 constructor() { 18878 __publicField(this, "formatter"); 18879 __publicField(this, "imageReplacer"); 18880 __publicField(this, "numberingReplacer"); 18881 this.formatter = new Formatter(); 18882 this.imageReplacer = new ImageReplacer(); 18883 this.numberingReplacer = new NumberingReplacer(); 18884 } 18885 compile(file, prettifyXml) { 18886 const zip = new JSZip(); 18887 const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml); 18888 const map = new Map(Object.entries(xmlifiedFileMapping)); 18889 for (const [, obj] of map) { 18890 if (Array.isArray(obj)) { 18891 for (const subFile of obj) { 18892 zip.file(subFile.path, subFile.data); 18893 } 18894 } else { 18895 zip.file(obj.path, obj.data); 18896 } 18897 } 18898 for (const { stream, fileName } of file.Media.Array) { 18899 zip.file(`word/media/${fileName}`, stream); 18900 } 18901 for (const { data: buffer2, name, fontKey } of file.FontTable.fontOptionsWithKey) { 18902 const [nameWithoutExtension] = name.split("."); 18903 zip.file(`word/fonts/${nameWithoutExtension}.odttf`, obfuscate(buffer2, fontKey)); 18904 } 18905 return zip; 18906 } 18907 xmlifyFile(file, prettify) { 18908 const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1; 18909 const documentXmlData = xml$1( 18910 this.formatter.format(file.Document.View, { 18911 viewWrapper: file.Document, 18912 file, 18913 stack: [] 18914 }), 18915 { 18916 indent: prettify, 18917 declaration: { 18918 standalone: "yes", 18919 encoding: "UTF-8" 18920 } 18921 } 18922 ); 18923 const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media); 18924 return { 18925 Relationships: { 18926 data: (() => { 18927 documentMediaDatas.forEach((mediaData, i) => { 18928 file.Document.Relationships.createRelationship( 18929 documentRelationshipCount + i, 18930 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", 18931 `media/${mediaData.fileName}` 18932 ); 18933 }); 18934 return xml$1( 18935 this.formatter.format(file.Document.Relationships, { 18936 viewWrapper: file.Document, 18937 file, 18938 stack: [] 18939 }), 18940 { 18941 indent: prettify, 18942 declaration: { 18943 encoding: "UTF-8" 18944 } 18945 } 18946 ); 18947 })(), 18948 path: "word/_rels/document.xml.rels" 18949 }, 18950 Document: { 18951 data: (() => { 18952 const xmlData = this.imageReplacer.replace(documentXmlData, documentMediaDatas, documentRelationshipCount); 18953 const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering); 18954 return referenedXmlData; 18955 })(), 18956 path: "word/document.xml" 18957 }, 18958 Styles: { 18959 data: (() => { 18960 const xmlStyles = xml$1( 18961 this.formatter.format(file.Styles, { 18962 viewWrapper: file.Document, 18963 file, 18964 stack: [] 18965 }), 18966 { 18967 indent: prettify, 18968 declaration: { 18969 standalone: "yes", 18970 encoding: "UTF-8" 18971 } 18972 } 18973 ); 18974 const referencedXmlStyles = this.numberingReplacer.replace(xmlStyles, file.Numbering.ConcreteNumbering); 18975 return referencedXmlStyles; 18976 })(), 18977 path: "word/styles.xml" 18978 }, 18979 Properties: { 18980 data: xml$1( 18981 this.formatter.format(file.CoreProperties, { 18982 viewWrapper: file.Document, 18983 file, 18984 stack: [] 18985 }), 18986 { 18987 indent: prettify, 18988 declaration: { 18989 standalone: "yes", 18990 encoding: "UTF-8" 18991 } 18992 } 18993 ), 18994 path: "docProps/core.xml" 18995 }, 18996 Numbering: { 18997 data: xml$1( 18998 this.formatter.format(file.Numbering, { 18999 viewWrapper: file.Document, 19000 file, 19001 stack: [] 19002 }), 19003 { 19004 indent: prettify, 19005 declaration: { 19006 standalone: "yes", 19007 encoding: "UTF-8" 19008 } 19009 } 19010 ), 19011 path: "word/numbering.xml" 19012 }, 19013 FileRelationships: { 19014 data: xml$1( 19015 this.formatter.format(file.FileRelationships, { 19016 viewWrapper: file.Document, 19017 file, 19018 stack: [] 19019 }), 19020 { 19021 indent: prettify, 19022 declaration: { 19023 encoding: "UTF-8" 19024 } 19025 } 19026 ), 19027 path: "_rels/.rels" 19028 }, 19029 HeaderRelationships: file.Headers.map((headerWrapper, index) => { 19030 const xmlData = xml$1( 19031 this.formatter.format(headerWrapper.View, { 19032 viewWrapper: headerWrapper, 19033 file, 19034 stack: [] 19035 }), 19036 { 19037 indent: prettify, 19038 declaration: { 19039 encoding: "UTF-8" 19040 } 19041 } 19042 ); 19043 const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); 19044 mediaDatas.forEach((mediaData, i) => { 19045 headerWrapper.Relationships.createRelationship( 19046 i, 19047 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", 19048 `media/${mediaData.fileName}` 19049 ); 19050 }); 19051 return { 19052 data: xml$1( 19053 this.formatter.format(headerWrapper.Relationships, { 19054 viewWrapper: headerWrapper, 19055 file, 19056 stack: [] 19057 }), 19058 { 19059 indent: prettify, 19060 declaration: { 19061 encoding: "UTF-8" 19062 } 19063 } 19064 ), 19065 path: `word/_rels/header${index + 1}.xml.rels` 19066 }; 19067 }), 19068 FooterRelationships: file.Footers.map((footerWrapper, index) => { 19069 const xmlData = xml$1( 19070 this.formatter.format(footerWrapper.View, { 19071 viewWrapper: footerWrapper, 19072 file, 19073 stack: [] 19074 }), 19075 { 19076 indent: prettify, 19077 declaration: { 19078 encoding: "UTF-8" 19079 } 19080 } 19081 ); 19082 const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); 19083 mediaDatas.forEach((mediaData, i) => { 19084 footerWrapper.Relationships.createRelationship( 19085 i, 19086 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", 19087 `media/${mediaData.fileName}` 19088 ); 19089 }); 19090 return { 19091 data: xml$1( 19092 this.formatter.format(footerWrapper.Relationships, { 19093 viewWrapper: footerWrapper, 19094 file, 19095 stack: [] 19096 }), 19097 { 19098 indent: prettify, 19099 declaration: { 19100 encoding: "UTF-8" 19101 } 19102 } 19103 ), 19104 path: `word/_rels/footer${index + 1}.xml.rels` 19105 }; 19106 }), 19107 Headers: file.Headers.map((headerWrapper, index) => { 19108 const tempXmlData = xml$1( 19109 this.formatter.format(headerWrapper.View, { 19110 viewWrapper: headerWrapper, 19111 file, 19112 stack: [] 19113 }), 19114 { 19115 indent: prettify, 19116 declaration: { 19117 encoding: "UTF-8" 19118 } 19119 } 19120 ); 19121 const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); 19122 const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); 19123 const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering); 19124 return { 19125 data: referenedXmlData, 19126 path: `word/header${index + 1}.xml` 19127 }; 19128 }), 19129 Footers: file.Footers.map((footerWrapper, index) => { 19130 const tempXmlData = xml$1( 19131 this.formatter.format(footerWrapper.View, { 19132 viewWrapper: footerWrapper, 19133 file, 19134 stack: [] 19135 }), 19136 { 19137 indent: prettify, 19138 declaration: { 19139 encoding: "UTF-8" 19140 } 19141 } 19142 ); 19143 const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); 19144 const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); 19145 const referenedXmlData = this.numberingReplacer.replace(xmlData, file.Numbering.ConcreteNumbering); 19146 return { 19147 data: referenedXmlData, 19148 path: `word/footer${index + 1}.xml` 19149 }; 19150 }), 19151 ContentTypes: { 19152 data: xml$1( 19153 this.formatter.format(file.ContentTypes, { 19154 viewWrapper: file.Document, 19155 file, 19156 stack: [] 19157 }), 19158 { 19159 indent: prettify, 19160 declaration: { 19161 encoding: "UTF-8" 19162 } 19163 } 19164 ), 19165 path: "[Content_Types].xml" 19166 }, 19167 CustomProperties: { 19168 data: xml$1( 19169 this.formatter.format(file.CustomProperties, { 19170 viewWrapper: file.Document, 19171 file, 19172 stack: [] 19173 }), 19174 { 19175 indent: prettify, 19176 declaration: { 19177 standalone: "yes", 19178 encoding: "UTF-8" 19179 } 19180 } 19181 ), 19182 path: "docProps/custom.xml" 19183 }, 19184 AppProperties: { 19185 data: xml$1( 19186 this.formatter.format(file.AppProperties, { 19187 viewWrapper: file.Document, 19188 file, 19189 stack: [] 19190 }), 19191 { 19192 indent: prettify, 19193 declaration: { 19194 standalone: "yes", 19195 encoding: "UTF-8" 19196 } 19197 } 19198 ), 19199 path: "docProps/app.xml" 19200 }, 19201 FootNotes: { 19202 data: xml$1( 19203 this.formatter.format(file.FootNotes.View, { 19204 viewWrapper: file.FootNotes, 19205 file, 19206 stack: [] 19207 }), 19208 { 19209 indent: prettify, 19210 declaration: { 19211 encoding: "UTF-8" 19212 } 19213 } 19214 ), 19215 path: "word/footnotes.xml" 19216 }, 19217 FootNotesRelationships: { 19218 data: xml$1( 19219 this.formatter.format(file.FootNotes.Relationships, { 19220 viewWrapper: file.FootNotes, 19221 file, 19222 stack: [] 19223 }), 19224 { 19225 indent: prettify, 19226 declaration: { 19227 encoding: "UTF-8" 19228 } 19229 } 19230 ), 19231 path: "word/_rels/footnotes.xml.rels" 19232 }, 19233 Settings: { 19234 data: xml$1( 19235 this.formatter.format(file.Settings, { 19236 viewWrapper: file.Document, 19237 file, 19238 stack: [] 19239 }), 19240 { 19241 indent: prettify, 19242 declaration: { 19243 standalone: "yes", 19244 encoding: "UTF-8" 19245 } 19246 } 19247 ), 19248 path: "word/settings.xml" 19249 }, 19250 Comments: { 19251 data: xml$1( 19252 this.formatter.format(file.Comments, { 19253 viewWrapper: file.Document, 19254 file, 19255 stack: [] 19256 }), 19257 { 19258 indent: prettify, 19259 declaration: { 19260 standalone: "yes", 19261 encoding: "UTF-8" 19262 } 19263 } 19264 ), 19265 path: "word/comments.xml" 19266 }, 19267 FontTable: { 19268 data: xml$1( 19269 this.formatter.format(file.FontTable.View, { 19270 viewWrapper: file.Document, 19271 file, 19272 stack: [] 19273 }), 19274 { 19275 indent: prettify, 19276 declaration: { 19277 standalone: "yes", 19278 encoding: "UTF-8" 19279 } 19280 } 19281 ), 19282 path: "word/fontTable.xml" 19283 }, 19284 FontTableRelationships: { 19285 data: (() => xml$1( 19286 this.formatter.format(file.FontTable.Relationships, { 19287 viewWrapper: file.Document, 19288 file, 19289 stack: [] 19290 }), 19291 { 19292 indent: prettify, 19293 declaration: { 19294 encoding: "UTF-8" 19295 } 19296 } 19297 ))(), 19298 path: "word/_rels/fontTable.xml.rels" 19299 } 19300 }; 19301 } 19302 } 19303 const PrettifyType = { 19304 NONE: "", 19305 WITH_2_BLANKS: " ", 19306 WITH_4_BLANKS: " ", 19307 // eslint-disable-next-line @typescript-eslint/naming-convention 19308 WITH_TAB: " " 19309 }; 19310 const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify; 19311 class Packer { 19312 static toString(file, prettify) { 19313 return __async(this, null, function* () { 19314 const zip = this.compiler.compile(file, convertPrettifyType(prettify)); 19315 const zipData = yield zip.generateAsync({ 19316 type: "string", 19317 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19318 compression: "DEFLATE" 19319 }); 19320 return zipData; 19321 }); 19322 } 19323 static toBuffer(file, pre
19323ttify) { 19324 return __async(this, null, function* () { 19325 const zip = this.compiler.compile(file, convertPrettifyType(prettify)); 19326 const zipData = yield zip.generateAsync({ 19327 type: "nodebuffer", 19328 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19329 compression: "DEFLATE" 19330 }); 19331 return zipData; 19332 }); 19333 } 19334 static toBase64String(file, prettify) { 19335 return __async(this, null, function* () { 19336 const zip = this.compiler.compile(file, convertPrettifyType(prettify)); 19337 const zipData = yield zip.generateAsync({ 19338 type: "base64", 19339 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19340 compression: "DEFLATE" 19341 }); 19342 return zipData; 19343 }); 19344 } 19345 static toBlob(file, prettify) { 19346 return __async(this, null, function* () { 19347 const zip = this.compiler.compile(file, convertPrettifyType(prettify)); 19348 const zipData = yield zip.generateAsync({ 19349 type: "blob", 19350 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19351 compression: "DEFLATE" 19352 }); 19353 return zipData; 19354 }); 19355 } 19356 static toStream(file, prettify) { 19357 const stream = new streamBrowserify.Stream(); 19358 const zip = this.compiler.compile(file, convertPrettifyType(prettify)); 19359 zip.generateAsync({ 19360 type: "nodebuffer", 19361 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19362 compression: "DEFLATE" 19363 }).then((z) => { 19364 stream.emit("data", z); 19365 stream.emit("end"); 19366 }); 19367 return stream; 19368 } 19369 } 19370 __publicField(Packer, "compiler", new Compiler()); 19371 const formatter$1 = new Formatter(); 19372 const toJson = (xmlData) => { 19373 const xmlObj = lib.xml2js(xmlData, { compact: false, captureSpacesBetweenElements: true }); 19374 return xmlObj; 19375 }; 19376 const createTextElementContents = (text) => { 19377 var _a; 19378 const textJson = toJson(xml$1(formatter$1.format(new Text({ text })))); 19379 return (_a = textJson.elements[0].elements) != null ? _a : []; 19380 }; 19381 const patchSpaceAttribute = (element2) => __spreadProps(__spreadValues({}, element2), { 19382 attributes: { 19383 "xml:space": "preserve" 19384 } 19385 }); 19386 const getFirstLevelElements = (relationships, id) => { 19387 var _a, _b; 19388 return (_b = (_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) != null ? _b : []; 19389 }; 19390 const ReplaceMode = { 19391 START: 0, 19392 MIDDLE: 1, 19393 END: 2 19394 }; 19395 const replaceTokenInParagraphElement = ({ 19396 paragraphElement, 19397 renderedParagraph, 19398 originalText, 19399 replacementText 19400 }) => { 19401 const startIndex = renderedParagraph.text.indexOf(originalText); 19402 const endIndex = startIndex + originalText.length - 1; 19403 let replaceMode = ReplaceMode.START; 19404 for (const run of renderedParagraph.runs) { 19405 for (const { text, index, start, end } of run.parts) { 19406 switch (replaceMode) { 19407 case ReplaceMode.START: 19408 if (startIndex >= start) { 19409 const offsetStartIndex = startIndex - start; 19410 const offsetEndIndex = Math.min(endIndex, end) - start; 19411 const partToReplace = run.text.substring(offsetStartIndex, offsetEndIndex + 1); 19412 if (partToReplace === "") { 19413 continue; 19414 } 19415 const firstPart = text.replace(partToReplace, replacementText); 19416 patchTextElement(paragraphElement.elements[run.index].elements[index], firstPart); 19417 replaceMode = ReplaceMode.MIDDLE; 19418 continue; 19419 } 19420 break; 19421 case ReplaceMode.MIDDLE: 19422 if (endIndex <= end) { 19423 const lastPart = text.substring(endIndex - start + 1); 19424 patchTextElement(paragraphElement.elements[run.index].elements[index], lastPart); 19425 const currentElement2 = paragraphElement.elements[run.index].elements[index]; 19426 paragraphElement.elements[run.index].elements[index] = patchSpaceAttribute(currentElement2); 19427 replaceMode = ReplaceMode.END; 19428 } else { 19429 patchTextElement(paragraphElement.elements[run.index].elements[index], ""); 19430 } 19431 break; 19432 } 19433 } 19434 } 19435 return paragraphElement; 19436 }; 19437 const patchTextElement = (element2, text) => { 19438 element2.elements = createTextElementContents(text); 19439 return element2; 19440 }; 19441 const findRunElementIndexWithToken = (paragraphElement, token) => { 19442 var _a, _b, _c, _d; 19443 for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) { 19444 const element2 = paragraphElement.elements[i]; 19445 if (element2.type === "element" && element2.name === "w:r") { 19446 const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t"); 19447 for (const text of textElement) { 19448 if (!((_c = text.elements) == null ? void 0 : _c[0])) { 19449 continue; 19450 } 19451 if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) { 19452 return i; 19453 } 19454 } 19455 } 19456 } 19457 throw new Error("Token not found"); 19458 }; 19459 const splitRunElement = (runElement, token) => { 19460 var _a, _b; 19461 let splitIndex = 0; 19462 const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => { 19463 var _a2, _b2; 19464 if (e.type === "element" && e.name === "w:t") { 19465 const text = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0].text) != null ? _b2 : ""; 19466 const splitText = text.split(token); 19467 const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), { 19468 elements: createTextElementContents(t) 19469 })); 19470 splitIndex = i; 19471 return newElements; 19472 } else { 19473 return e; 19474 } 19475 }).flat()) != null ? _b : []; 19476 const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), { 19477 elements: splitElements.slice(0, splitIndex + 1) 19478 }); 19479 const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), { 19480 elements: splitElements.slice(splitIndex + 1) 19481 }); 19482 return { left: leftRunElement, right: rightRunElement }; 19483 }; 19484 const formatter = new Formatter(); 19485 const SPLIT_TOKEN = "ɵ"; 19486 const replacer = (json, patch, patchText, renderedParagraphs, context, keepOriginalStyles = false) => { 19487 for (const renderedParagraph of renderedParagraphs) { 19488 const textJson = patch.children.map((c) => toJson(xml$1(formatter.format(c, context)))).map((c) => c.elements[0]); 19489 switch (patch.type) { 19490 case PatchType.DOCUMENT: { 19491 const parentElement = goToParentElementFromPath(json, renderedParagraph.path); 19492 const elementIndex = getLastElementIndexFromPath(renderedParagraph.path); 19493 parentElement.elements.splice(elementIndex, 1, ...textJson); 19494 break; 19495 } 19496 case PatchType.PARAGRAPH: 19497 default: { 19498 const paragraphElement = goToElementFromPath(json, renderedParagraph.path); 19499 replaceTokenInParagraphElement({ 19500 paragraphElement, 19501 renderedParagraph, 19502 originalText: patchText, 19503 replacementText: SPLIT_TOKEN 19504 }); 19505 const index = findRunElementIndexWithToken(paragraphElement, SPLIT_TOKEN); 19506 const runElementToBeReplaced = paragraphElement.elements[index]; 19507 const { left, right } = splitRunElement(runElementToBeReplaced, SPLIT_TOKEN); 19508 let newRunElements = textJson; 19509 let patchedRightElement = right; 19510 if (keepOriginalStyles) { 19511 const runElementNonTextualElements = runElementToBeReplaced.elements.filter( 19512 (e) => e.type === "element" && e.name !== "w:t" 19513 ); 19514 newRunElements = textJson.map((e) => __spreadProps(__spreadValues({}, e), { 19515 elements: [...runElementNonTextualElements, ...e.elements] 19516 })); 19517 patchedRightElement = __spreadProps(__spreadValues({}, right), { 19518 elements: [...runElementNonTextualElements, ...right.elements] 19519 }); 19520 } 19521 paragraphElement.elements.splice(index, 1, left, ...newRunElements, patchedRightElement); 19522 break; 19523 } 19524 } 19525 } 19526 return json; 19527 }; 19528 const goToElementFromPath = (json, path) => { 19529 let element2 = json; 19530 for (let i = 1; i < path.length; i++) { 19531 const index = path[i]; 19532 const nextElements = element2.elements; 19533 if (!nextElements) { 19534 throw new Error("Could not find element"); 19535 } 19536 element2 = nextElements[index]; 19537 } 19538 return element2; 19539 }; 19540 const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1)); 19541 const getLastElementIndexFromPath = (path) => path[path.length - 1]; 19542 const renderParagraphNode = (node) => { 19543 if (node.element.name !== "w:p") { 19544 throw new Error(`Invalid node type: ${node.element.name}`); 19545 } 19546 if (!node.element.elements) { 19547 return { 19548 text: "", 19549 runs: [], 19550 index: -1, 19551 path: [] 19552 }; 19553 }
19554 let currentRunStringLength = 0; 19555 const runs = node.element.elements.map((element2, i) => ({ element: element2, i })).filter(({ element: element2 }) => element2.name === "w:r").map(({ element: element2, i }) => { 19556 const renderedRunNode = renderRunNode(element2, i, currentRunStringLength); 19557 currentRunStringLength += renderedRunNode.text.length; 19558 return renderedRunNode; 19559 }).filter((e) => !!e).map((e) => e); 19560 const text = runs.reduce((acc, curr) => acc + curr.text, ""); 19561 return { 19562 text, 19563 runs, 19564 index: node.index, 19565 path: buildNodePath(node) 19566 }; 19567 }; 19568 const renderRunNode = (node, index, currentRunStringIndex) => { 19569 if (!node.elements) { 19570 return { 19571 text: "", 19572 parts: [], 19573 index: -1, 19574 start: currentRunStringIndex, 19575 end: currentRunStringIndex 19576 }; 19577 } 19578 let currentTextStringIndex = currentRunStringIndex; 19579 const parts = node.elements.map( 19580 (element2, i) => { 19581 var _a, _b; 19582 return element2.name === "w:t" && element2.elements && element2.elements.length > 0 ? { 19583 text: (_b = (_a = element2.elements[0].text) == null ? void 0 : _a.toString()) != null ? _b : "", 19584 index: i, 19585 start: currentTextStringIndex, 19586 end: (() => { 19587 var _a2, _b2; 19588 currentTextStringIndex += ((_b2 = (_a2 = element2.elements[0].text) == null ? void 0 : _a2.toString()) != null ? _b2 : "").length - 1; 19589 return currentTextStringIndex; 19590 })() 19591 } : void 0; 19592 } 19593 ).filter((e) => !!e).map((e) => e); 19594 const text = parts.reduce((acc, curr) => acc + curr.text, ""); 19595 return { 19596 text, 19597 parts, 19598 index, 19599 start: currentRunStringIndex, 19600 end: currentTextStringIndex 19601 }; 19602 }; 19603 const buildNodePath = (node) => node.parent ? [...buildNodePath(node.parent), node.index] : [node.index]; 19604 const elementsToWrapper = (wrapper) => { 19605 var _a, _b; 19606 return (_b = (_a = wrapper.element.elements) == null ? void 0 : _a.map((e, i) => ({ 19607 element: e, 19608 index: i, 19609 parent: wrapper 19610 }))) != null ? _b : []; 19611 }; 19612 const findLocationOfText = (node, text) => { 19613 let renderedParagraphs = []; 19614 const queue2 = [ 19615 ...elementsToWrapper({ 19616 element: node, 19617 index: 0, 19618 parent: void 0 19619 }) 19620 ]; 19621 let currentNode; 19622 while (queue2.length > 0) { 19623 currentNode = queue2.shift(); 19624 if (currentNode.element.name === "w:p") { 19625 renderedParagraphs = [...renderedParagraphs, renderParagraphNode(currentNode)]; 19626 } else { 19627 queue2.push(...elementsToWrapper(currentNode)); 19628 } 19629 } 19630 return renderedParagraphs.filter((p) => p.text.includes(text)); 19631 }; 19632 const getIdFromRelationshipId = (relationshipId) => { 19633 const output = parseInt(relationshipId.substring(3), 10); 19634 return isNaN(output) ? 0 : output; 19635 }; 19636 const getNextRelationshipIndex = (relationships) => { 19637 const relationshipElements = getFirstLevelElements(relationships, "Relationships"); 19638 return relationshipElements.map((e) => { 19639 var _a, _b, _c; 19640 return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : ""); 19641 }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1; 19642 }; 19643 const appendRelationship = (relationships, id, type, target, targetMode) => { 19644 const relationshipElements = getFirstLevelElements(relationships, "Relationships"); 19645 relationshipElements.push({ 19646 attributes: { 19647 Id: `rId${id}`, 19648 Type: type, 19649 Target: target, 19650 TargetMode: targetMode 19651 }, 19652 name: "Relationship", 19653 type: "element" 19654 }); 19655 return relationshipElements; 19656 }; 19657 const appendContentType = (element2, contentType, extension) => { 19658 const relationshipElements = getFirstLevelElements(element2, "Types"); 19659 const exist = relationshipElements.some( 19660 (el) => { 19661 var _a, _b; 19662 return el.type === "element" && el.name === "Default" && ((_a = el == null ? void 0 : el.attributes) == null ? void 0 : _a.ContentType) === contentType && ((_b = el == null ? void 0 : el.attributes) == null ? void 0 : _b.Extension) === extension; 19663 } 19664 ); 19665 if (exist) { 19666 return; 19667 } 19668 relationshipElements.push({ 19669 attributes: { 19670 ContentType: contentType, 19671 Extension: extension 19672 }, 19673 name: "Default", 19674 type: "element" 19675 }); 19676 }; 19677 const PatchType = { 19678 DOCUMENT: "file", 19679 PARAGRAPH: "paragraph" 19680 }; 19681 const imageReplacer = new ImageReplacer(); 19682 const patchDocument = (data, options2) => __async(this, null, function* () { 19683 var _a, _b;
19684 const zipContent = yield JSZip.loadAsync(data); 19685 const contexts = /* @__PURE__ */ new Map(); 19686 const file = { 19687 Media: new Media() 19688 }; 19689 const map = /* @__PURE__ */ new Map(); 19690 const imageRelationshipAdditions = []; 19691 const hyperlinkRelationshipAdditions = []; 19692 let hasMedia = false; 19693 const binaryContentMap = /* @__PURE__ */ new Map(); 19694 for (const [key, value] of Object.entries(zipContent.files)) { 19695 if (!key.endsWith(".xml") && !key.endsWith(".rels")) { 19696 binaryContentMap.set(key, yield value.async("uint8array")); 19697 continue; 19698 } 19699 const json = toJson(yield value.async("text")); 19700 if (key.startsWith("word/") && !key.endsWith(".xml.rels")) { 19701 const context = { 19702 file, 19703 viewWrapper: { 19704 Relationships: { 19705 createRelationship: (linkId, _, target, __) => { 19706 hyperlinkRelationshipAdditions.push({ 19707 key, 19708 hyperlink: { 19709 id: linkId, 19710 link: target 19711 } 19712 }); 19713 } 19714 } 19715 }, 19716 stack: [] 19717 }; 19718 contexts.set(key, context); 19719 for (const [patchKey, patchValue] of Object.entries(options2.patches)) { 19720 const patchText = `{{${patchKey}}}`; 19721 const renderedParagraphs = findLocationOfText(json, patchText); 19722 replacer( 19723 json, 19724 __spreadProps(__spreadValues({}, patchValue), { 19725 children: patchValue.children.map((element2) => { 19726 if (element2 instanceof ExternalHyperlink) { 19727 const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId()); 19728 hyperlinkRelationshipAdditions.push({ 19729 key, 19730 hyperlink: { 19731 id: concreteHyperlink.linkId, 19732 link: element2.options.link 19733 } 19734 }); 19735 return concreteHyperlink; 19736 } else { 19737 return element2; 19738 } 19739 }) 19740 // eslint-disable-next-line @typescript-eslint/no-explicit-any 19741 }), 19742 patchText, 19743 renderedParagraphs, 19744 context, 19745 options2.keepOriginalStyles 19746 ); 19747 } 19748 const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media); 19749 if (mediaDatas.length > 0) { 19750 hasMedia = true; 19751 imageRelationshipAdditions.push({ 19752 key, 19753 mediaDatas 19754 }); 19755 } 19756 } 19757 map.set(key, json); 19758 } 19759 for (const { key, mediaDatas } of imageRelationshipAdditions) { 19760 const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`; 19761 const relationshipsJson = (_a = map.get(relationshipKey)) != null ? _a : createRelationshipFile(); 19762 map.set(relationshipKey, relationshipsJson); 19763 const index = getNextRelationshipIndex(relationshipsJson); 19764 const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index); 19765 map.set(key, JSON.parse(newJson)); 19766 for (let i = 0; i < mediaDatas.length; i++) { 19767 const { fileName } = mediaDatas[i]; 19768 appendRelationship( 19769 relationshipsJson, 19770 index + i, 19771 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", 19772 `media/${fileName}` 19773 ); 19774 } 19775 } 19776 for (const { key, hyperlink } of hyperlinkRelationshipAdditions) { 19777 const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`; 19778 const relationshipsJson = (_b = map.get(relationshipKey)) != null ? _b : createRelationshipFile(); 19779 map.set(relationshipKey, relationshipsJson); 19780 appendRelationship( 19781 relationshipsJson, 19782 hyperlink.id, 19783 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", 19784 hyperlink.link, 19785 TargetModeType.EXTERNAL 19786 ); 19787 } 19788 if (hasMedia) { 19789 const contentTypesJson = map.get("[Content_Types].xml"); 19790 if (!contentTypesJson) { 19791 throw new Error("Could not find content types file"); 19792 } 19793 appendContentType(contentTypesJson, "image/png", "png"); 19794 appendContentType(contentTypesJson, "image/jpeg", "jpeg"); 19795 appendContentType(contentTypesJson, "image/jpeg", "jpg"); 19796 appendContentType(contentTypesJson, "image/bmp", "bmp"); 19797 appendContentType(contentTypesJson, "image/gif", "gif"); 19798 } 19799 const zip = new JSZip(); 19800 for (const [key, value] of map) { 19801 const output = toXml(value); 19802 zip.file(key, output); 19803 } 19804 for (const [key, value] of binaryContentMap) { 19805 zip.file(key, value); 19806 } 19807 for (const { stream, fileName } of file.Media.Array) { 19808 zip.file(`word/media/${fileName}`, stream); 19809 } 19810 return zip.generateAsync({ 19811 type: "uint8array", 19812 mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 19813 compression: "DEFLATE" 19814 }); 19815 }); 19816 const toXml = (jsonObj) => { 19817 const output = lib.js2xml(jsonObj); 19818 return output; 19819 }; 19820 const createRelationshipFile = () => ({ 19821 declaration: { 19822 attributes: { 19823 version: "1.0", 19824 encoding: "UTF-8", 19825 standalone: "yes" 19826 } 19827 }, 19828 elements: [ 19829 { 19830 type: "element", 19831 name: "Relationships", 19832 attributes: { 19833 xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" 19834 }, 19835 elements: [] 19836 } 19837 ] 19838 }); 19839 exports2.AbstractNumbering = AbstractNumbering; 19840 exports2.Alignment = Alignment; 19841 exports2.AlignmentAttributes = AlignmentAttributes; 19842 exports2.AlignmentType = AlignmentType; 19843 exports2.AnnotationReference = AnnotationReference; 19844 exports2.Attributes = Attributes; 19845 exports2.BaseEmphasisMark = BaseEmphasisMark; 19846 exports2.BaseXmlComponent = BaseXmlComponent; 19847 exports2.Body = Body; 19848 exports2.Bookmark = Bookmark; 19849 exports2.BookmarkEnd = BookmarkEnd; 19850 exports2.BookmarkStart = BookmarkStart; 19851 exports2.Border = Border; 19852 exports2.BorderElement = BorderElement; 19853 exports2.BorderStyle = BorderStyle; 19854 exports2.BuilderElement = BuilderElement; 19855 exports2.CarriageReturn = CarriageReturn; 19856 exports2.CharacterSet = CharacterSet; 19857 exports2.CheckBox = CheckBox; 19858 exports2.CheckBoxSymbolElement = CheckBoxSymbolElement; 19859 exports2.CheckBoxUtil = CheckBoxUtil; 19860 exports2.Column = Column; 19861 exports2.ColumnBreak = ColumnBreak; 19862 exports2.Columns = Columns; 19863 exports2.Comment = Comment; 19864 exports2.CommentRangeEnd = CommentRangeEnd; 19865 exports2.CommentRangeStart = CommentRangeStart; 19866 exports2.CommentReference = CommentReference; 19867 exports2.Comments = Comments; 19868 exports2.ConcreteHyperlink = ConcreteHyperlink; 19869 exports2.ConcreteNumbering = ConcreteNumbering; 19870 exports2.ContinuationSeparator = ContinuationSeparator; 19871 exports2.DayLong = DayLong; 19872 exports2.DayShort = DayShort; 19873 exports2.DeletedTextRun = DeletedTextRun; 19874 exports2.DocGridAttributes = DocGridAttributes; 19875 exports2.Document = File; 19876 exports2.DocumentAttributes = DocumentAttributes;
19877 exports2.DocumentBackground = DocumentBackground; 19878 exports2.DocumentBackgroundAttributes = DocumentBackgroundAttributes; 19879 exports2.DocumentDefaults = DocumentDefaults; 19880 exports2.DocumentGrid = DocumentGrid; 19881 exports2.DocumentGridType = DocumentGridType; 19882 exports2.DotEmphasisMark = DotEmphasisMark; 19883 exports2.Drawing = Drawing; 19884 exports2.DropCapType = DropCapType; 19885 exports2.EMPTY_OBJECT = EMPTY_OBJECT; 19886 exports2.EmphasisMark = EmphasisMark; 19887 exports2.EmphasisMarkType = EmphasisMarkType; 19888 exports2.EmptyElement = EmptyElement; 19889 exports2.EndnoteReference = EndnoteReference; 19890 exports2.ExternalHyperlink = ExternalHyperlink; 19891 exports2.File = File; 19892 exports2.FootNoteReferenceRunAttributes = FootNoteReferenceRunAttributes; 19893 exports2.FootNotes = FootNotes; 19894 exports2.Footer = Footer; 19895 exports2.FooterWrapper = FooterWrapper; 19896 exports2.FootnoteReference = FootnoteReference; 19897 exports2.FootnoteReferenceElement = FootnoteReferenceElement; 19898 exports2.FootnoteReferenceRun = FootnoteReferenceRun; 19899 exports2.FrameAnchorType = FrameAnchorType; 19900 exports2.FrameWrap = FrameWrap; 19901 exports2.GridSpan = GridSpan; 19902 exports2.Header = Header; 19903 exports2.HeaderFooterReference = HeaderFooterReference; 19904 exports2.HeaderFooterReferenceType = HeaderFooterReferenceType; 19905 exports2.HeaderFooterType = HeaderFooterType; 19906 exports2.HeaderWrapper = HeaderWrapper; 19907 exports2.HeadingLevel = HeadingLevel; 19908 exports2.HeightRule = HeightRule; 19909 exports2.HorizontalPosition = HorizontalPosition; 19910 exports2.HorizontalPositionAlign = HorizontalPositionAlign; 19911 exports2.HorizontalPositionRelativeFrom = HorizontalPositionRelativeFrom; 19912 exports2.HpsMeasureElement = HpsMeasureElement; 19913 exports2.HyperlinkType = HyperlinkType; 19914 exports2.IgnoreIfEmptyXmlComponent = IgnoreIfEmptyXmlComponent; 19915 exports2.ImageRun = ImageRun; 19916 exports2.ImportedRootElementAttributes = ImportedRootElementAttributes; 19917 exports2.ImportedXmlComponent = ImportedXmlComponent; 19918 exports2.Indent = Indent; 19919 exports2.InitializableXmlComponent = InitializableXmlComponent; 19920 exports2.InsertedTextRun = InsertedTextRun; 19921 exports2.InternalHyperlink = InternalHyperlink; 19922 exports2.LastRenderedPageBreak = LastRenderedPageBreak; 19923 exports2.LeaderType = LeaderType; 19924 exports2.Level = Level; 19925 exports2.LevelBase = LevelBase; 19926 exports2.LevelForOverride = LevelForOverride; 19927 exports2.LevelFormat = LevelFormat; 19928 exports2.LevelOverride = LevelOverride; 19929 exports2.LevelSuffix = LevelSuffix; 19930 exports2.LineNumberRestartFormat = LineNumberRestartFormat; 19931 exports2.LineRuleType = LineRuleType; 19932 exports2.Math = Math$1; 19933 exports2.MathAccentCharacter = MathAccentCharacter; 19934 exports2.MathAngledBrackets = MathAngledBrackets; 19935 exports2.MathBase = MathBase; 19936 exports2.MathCurlyBrackets = MathCurlyBrackets; 19937 exports2.MathDegree = MathDegree; 19938 exports2.MathDenominator = MathDenominator; 19939 exports2.MathFraction = MathFraction; 19940 exports2.MathFunction = MathFunction; 19941 exports2.MathFunctionName = MathFunctionName; 19942 exports2.MathFunctionProperties = MathFunctionProperties; 19943 exports2.MathIntegral = MathIntegral; 19944 exports2.MathLimitLocation = MathLimitLocation; 19945 exports2.MathNAryProperties = MathNAryProperties; 19946 exports2.MathNumerator = MathNumerator; 19947 exports2.MathPreSubSuperScript = MathPreSubSuperScript; 19948 exports2.MathPreSubSuperScriptProperties = MathPreSubSuperScriptProperties; 19949 exports2.MathRadical = MathRadical; 19950 exports2.MathRadicalProperties = MathRadicalProperties; 19951 exports2.MathRoundBrackets = MathRoundBrackets; 19952 exports2.MathRun = MathRun; 19953 exports2.MathSquareBrackets = MathSquareBrackets; 19954 exports2.MathSubScript = MathSubScript; 19955 exports2.MathSubScriptElement = MathSubScriptElement; 19956 exports2.MathSubScriptProperties = MathSubScriptProperties; 19957 exports2.MathSubSuperScript = MathSubSuperScript; 19958 exports2.MathSubSuperScriptProperties = MathSubSuperScriptProperties; 19959 exports2.MathSum = MathSum; 19960 exports2.MathSuperScript = MathSuperScript; 19961 exports2.MathSuperScriptElement = MathSuperScriptElement; 19962 exports2.MathSuperScriptProperties = MathSuperScriptProperties; 19963 exports2.Media = Media; 19964 exports2.MonthLong = MonthLong; 19965 exports2.MonthShort = MonthShort; 19966 exports2.NextAttributeComponent = NextAttributeComponent; 19967 exports2.NoBreakHyphen = NoBreakHyphen; 19968 exports2.NumberFormat = NumberFormat$1; 19969 exports2.NumberProperties = NumberProperties; 19970 exports2.NumberValueElement = NumberValueElement; 19971 exports2.Numbering = Numbering; 19972 exports2.OnOffElement = OnOffElement; 19973 exports2.OutlineLevel = OutlineLevel; 19974 exports2.OverlapType = OverlapType; 19975 exports2.Packer = Packer; 19976 exports2.PageBorderDisplay = PageBorderDisplay; 19977 exports2.PageBorderOffsetFrom = PageBorderOffsetFrom; 19978 exports2.PageBorderZOrder = PageBorderZOrder; 19979 exports2.PageBorders = PageBorders; 19980 exports2.PageBreak = PageBreak; 19981 exports2.PageBreakBefore = PageBreakBefore; 19982 exports2.PageMargin = PageMargin; 19983 exports2.PageNumber = PageNumber; 19984 exports2.PageNumberElement = PageNumberElement; 19985 exports2.PageNumberSeparator = PageNumberSeparator; 19986 exports2.PageNumberType = PageNumberType; 19987 exports2.PageNumberTypeAttributes = PageNumberTypeAttributes; 19988 exports2.PageOrientation = PageOrientation; 19989 exports2.PageReference = PageReference; 19990 exports2.PageSize = PageSize; 19991 exports2.PageTextDirection = PageTextDirection; 19992 exports2.PageTextDirectionType = PageTextDirectionType; 19993 exports2.Paragraph = Paragraph; 19994 exports2.ParagraphProperties = ParagraphProperties; 19995 exports2.ParagraphPropertiesDefaults = ParagraphPropertiesDefaults; 19996 exports2.PatchType = PatchType; 19997 exports2.PositionalTab = PositionalTab; 19998 exports2.PositionalTabAlignment = PositionalTabAlignment; 19999 exports2.PositionalTabLeader = PositionalTabLeader; 20000 exports2.PositionalTabRelativeTo = PositionalTabRelativeTo; 20001 exports2.PrettifyType = PrettifyType; 20002 exports2.RelativeHorizontalPosition = RelativeHorizontalPosition; 20003 exports2.RelativeVerticalPosition = RelativeVerticalPosition; 20004 exports2.Run = Run; 20005 exports2.RunFonts = RunFonts; 20006 exports2.RunProperties = RunProperties; 20007 exports2.RunPropertiesChange = RunPropertiesChange; 20008 exports2.RunPropertiesDefaults = RunPropertiesDefaults; 20009 exports2.SectionProperties = SectionProperties; 20010 exports2.SectionType = SectionType; 20011 exports2.SectionTypeAttributes = SectionTypeAttributes; 20012 exports2.Separator = Separator; 20013 exports2.SequentialIdentifier = SequentialIdentifier; 20014 exports2.Shading = Shading; 20015 exports2.ShadingType = ShadingType; 20016 exports2.SimpleField = SimpleField; 20017 exports2.SimpleMailMergeField = SimpleMailMergeField; 20018 exports2.SimplePos = SimplePos; 20019 exports2.SoftHyphen = SoftHyphen; 20020 exports2.SpaceType = SpaceType; 20021 exports2.Spacing = Spacing; 20022 exports2.StringContainer = StringContainer; 20023 exports2.StringEnumValueElement = StringEnumValueElement; 20024 exports2.StringValueElement = StringValueElement; 20025 exports2.Style = Style$1; 20026 exports2.StyleForCharacter = StyleForCharacter; 20027 exports2.StyleForParagraph = StyleForParagraph; 20028 exports2.StyleLevel = StyleLevel; 20029 exports2.Styles = Styles; 20030 exports2.SymbolRun = SymbolRun; 20031 exports2.TDirection = TDirection; 20032 exports2.Tab = Tab; 20033 exports2.TabAttributes = TabAttributes; 20034 exports2.TabStop = TabStop; 20035 exports2.TabStopItem = TabStopItem; 20036 exports2.TabStopPosition = TabStopPosition; 20037 exports2.TabStopType = TabStopType; 20038 exports2.Table = Table; 20039 exports2.TableAnchorType = TableAnchorType; 20040 exports2.TableBorders = TableBorders; 20041 exports2.TableCell = TableCell; 20042 exports2.TableCellBorders = TableCellBorders; 20043 exports2.TableFloatProperties = TableFloatProperties; 20044 exports2.TableLayout = TableLayout; 20045 exports2.TableLayoutType = TableLayoutType; 20046 exports2.TableOfContents = TableOfContents; 20047 exports2.TableProperties = TableProperties; 20048 exports2.TableRow = TableRow; 20049 exports2.TableRowHeight = TableRowHeight; 20050 exports2.TableRowHeightAttributes = TableRowHeightAttributes; 20051 exports2.TableRowProperties = TableRowProperties; 20052 exports2.TableWidthElement = TableWidthElement; 20053 exports2.TextDirection = TextDirection; 20054 exports2.TextEffect = TextEffect; 20055 exports2.TextRun = TextRun; 20056 exports2.TextWrappingSide = TextWrappingSide; 20057 exports2.TextWrappingType = TextWrappingType; 20058 exports2.ThematicBreak = ThematicBreak; 20059 exports2.Type = Type; 20060 exports2.Underline = Underline; 20061 exports2.UnderlineType = UnderlineType; 20062 exports2.VerticalAlign = VerticalAlign; 20063 exports2.VerticalAlignAttributes = VerticalAlignAttributes; 20064 exports2.VerticalAlignElement = VerticalAlignElement; 20065 exports2.VerticalMerge = VerticalMerge; 20066 exports2.VerticalMergeType = VerticalMergeType; 20067 exports2.VerticalPosition = VerticalPosition; 20068 exports2.VerticalPositionAlign = VerticalPositionAlign; 20069 exports2.VerticalPositionRelativeFrom = VerticalPositionRelativeFrom; 20070 exports2.WORKAROUND2 = WORKAROUND2; 20071 exports2.WORKAROUND3 = WORKAROUND3; 20072 exports2.WORKAROUND4 = WORKAROUND4;
20073 exports2.WidthType = WidthType; 20074 exports2.WrapNone = WrapNone; 20075 exports2.WrapSquare = WrapSquare; 20076 exports2.WrapTight = WrapTight; 20077 exports2.WrapTopAndBottom = WrapTopAndBottom; 20078 exports2.XmlAttributeComponent = XmlAttributeComponent; 20079 exports2.XmlComponent = XmlComponent; 20080 exports2.YearLong = YearLong; 20081 exports2.YearShort = YearShort; 20082 exports2.abstractNumUniqueNumericIdGen = abstractNumUniqueNumericIdGen; 20083 exports2.bookmarkUniqueNumericIdGen = bookmarkUniqueNumericIdGen; 20084 exports2.concreteNumUniqueNumericIdGen = concreteNumUniqueNumericIdGen; 20085 exports2.convertInchesToTwip = convertInchesToTwip; 20086 exports2.convertMillimetersToTwip = convertMillimetersToTwip; 20087 exports2.convertToXmlComponent = convertToXmlComponent; 20088 exports2.createFrameProperties = createFrameProperties; 20089 exports2.createLineNumberType = createLineNumberType; 20090 exports2.createStringElement = createStringElement; 20091 exports2.dateTimeValue = dateTimeValue; 20092 exports2.decimalNumber = decimalNumber; 20093 exports2.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen; 20094 exports2.eighthPointMeasureValue = eighthPointMeasureValue; 20095 exports2.hexColorValue = hexColorValue; 20096 exports2.hpsMeasureValue = hpsMeasureValue; 20097 exports2.longHexNumber = longHexNumber; 20098 exports2.measurementOrPercentValue = measurementOrPercentValue; 20099 exports2.patchDocument = patchDocument; 20100 exports2.percentageValue = percentageValue; 20101 exports2.pointMeasureValue = pointMeasureValue; 20102 exports2.positiveUniversalMeasureValue = positiveUniversalMeasureValue; 20103 exports2.sectionMarginDefaults = sectionMarginDefaults; 20104 exports2.sectionPageSizeDefaults = sectionPageSizeDefaults; 20105 exports2.shortHexNumber = shortHexNumber; 20106 exports2.signedHpsMeasureValue = signedHpsMeasureValue; 20107 exports2.signedTwipsMeasureValue = signedTwipsMeasureValue; 20108 exports2.twipsMeasureValue = twipsMeasureValue; 20109 exports2.uCharHexNumber = uCharHexNumber; 20110 exports2.uniqueId = uniqueId; 20111 exports2.uniqueNumericIdCreator = uniqueNumericIdCreator; 20112 exports2.uniqueUuid = uniqueUuid; 20113 exports2.universalMeasureValue = universalMeasureValue; 20114 exports2.unsignedDecimalNumber = unsignedDecimalNumber; 20115 Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" }); 20116});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.