vendor: 46,172 bytes, lines 1-1479
1import { b2 as commonjsGlobal, aZ as getDefaultExportFromCjs } from './index-CNT5CkK7.js'; 2import { _ as _typeof$1 } from './jspdf.es.min-CWHF2JOV.js'; 3 4var es_promise = {}; 5 6var es_promise_constructor = {}; 7 8var globalThis_1; 9var hasRequiredGlobalThis; 10 11function requireGlobalThis () { 12 if (hasRequiredGlobalThis) return globalThis_1; 13 hasRequiredGlobalThis = 1; 14 var check = function (it) { 15 return it && it.Math === Math && it; 16 }; 17 18 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 19 globalThis_1 = 20 // eslint-disable-next-line es/no-global-this -- safe 21 check(typeof globalThis == 'object' && globalThis) || 22 check(typeof window == 'object' && window) || 23 // eslint-disable-next-line no-restricted-globals -- safe 24 check(typeof self == 'object' && self) || 25 check(typeof commonjsGlobal == 'object' && commonjsGlobal) || 26 check(typeof globalThis_1 == 'object' && globalThis_1) || 27 // eslint-disable-next-line no-new-func -- fallback 28 (function () { return this; })() || Function('return this')(); 29 return globalThis_1; 30} 31 32var objectGetOwnPropertyDescriptor = {}; 33 34var fails; 35var hasRequiredFails; 36 37function requireFails () { 38 if (hasRequiredFails) return fails; 39 hasRequiredFails = 1; 40 fails = function (exec) { 41 try { 42 return !!exec(); 43 } catch (error) { 44 return true; 45 } 46 }; 47 return fails; 48} 49 50var descriptors; 51var hasRequiredDescriptors; 52 53function requireDescriptors () { 54 if (hasRequiredDescriptors) return descriptors; 55 hasRequiredDescriptors = 1; 56 var fails = requireFails(); 57 58 // Detect IE8's incomplete defineProperty implementation 59 descriptors = !fails(function () { 60 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 61 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; 62 }); 63 return descriptors; 64} 65 66var functionBindNative; 67var hasRequiredFunctionBindNative; 68 69function requireFunctionBindNative () { 70 if (hasRequiredFunctionBindNative) return functionBindNative; 71 hasRequiredFunctionBindNative = 1; 72 var fails = requireFails(); 73 74 functionBindNative = !fails(function () { 75 // eslint-disable-next-line es/no-function-prototype-bind -- safe 76 var test = function () { /* empty */ }.bind(); 77 // eslint-disable-next-line no-prototype-builtins -- safe 78 return typeof test != 'function' || test.hasOwnProperty('prototype'); 79 }); 80 return functionBindNative; 81} 82 83var functionCall; 84var hasRequiredFunctionCall; 85 86function requireFunctionCall () { 87 if (hasRequiredFunctionCall) return functionCall; 88 hasRequiredFunctionCall = 1; 89 var NATIVE_BIND = requireFunctionBindNative(); 90 91 var call = Function.prototype.call; 92 // eslint-disable-next-line es/no-function-prototype-bind -- safe 93 functionCall = NATIVE_BIND ? call.bind(call) : function () { 94 return call.apply(call, arguments); 95 }; 96 return functionCall; 97} 98 99var objectPropertyIsEnumerable = {}; 100 101var hasRequiredObjectPropertyIsEnumerable; 102 103function requireObjectPropertyIsEnumerable () { 104 if (hasRequiredObjectPropertyIsEnumerable) return objectPropertyIsEnumerable; 105 hasRequiredObjectPropertyIsEnumerable = 1; 106 var $propertyIsEnumerable = {}.propertyIsEnumerable; 107 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 108 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 109 110 // Nashorn ~ JDK8 bug 111 var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); 112 113 // `Object.prototype.propertyIsEnumerable` method implementation 114 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable 115 objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { 116 var descriptor = getOwnPropertyDescriptor(this, V); 117 return !!descriptor && descriptor.enumerable; 118 } : $propertyIsEnumerable; 119 return objectPropertyIsEnumerable; 120} 121 122var createPropertyDescriptor; 123var hasRequiredCreatePropertyDescriptor; 124 125function requireCreatePropertyDescriptor () { 126 if (hasRequiredCreatePropertyDescriptor) return createPropertyDescriptor; 127 hasRequiredCreatePropertyDescriptor = 1; 128 createPropertyDescriptor = function (bitmap, value) { 129 return { 130 enumerable: !(bitmap & 1), 131 configurable: !(bitmap & 2), 132 writable: !(bitmap & 4), 133 value: value 134 }; 135 }; 136 return createPropertyDescriptor; 137} 138 139var functionUncurryThis; 140var hasRequiredFunctionUncurryThis; 141 142function requireFunctionUncurryThis () { 143 if (hasRequiredFunctionUncurryThis) return functionUncurryThis; 144 hasRequiredFunctionUncurryThis = 1; 145 var NATIVE_BIND = requireFunctionBindNative(); 146 147 var FunctionPrototype = Function.prototype; 148 var call = FunctionPrototype.call; 149 // eslint-disable-next-line es/no-function-prototype-bind -- safe 150 var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); 151 152 functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function (fn) { 153 return function () { 154 return call.apply(fn, arguments); 155 }; 156 }; 157 return functionUncurryThis; 158} 159 160var classofRaw; 161var hasRequiredClassofRaw; 162 163function requireClassofRaw () { 164 if (hasRequiredClassofRaw) return classofRaw; 165 hasRequiredClassofRaw = 1; 166 var uncurryThis = requireFunctionUncurryThis(); 167 168 var toString = uncurryThis({}.toString); 169 var stringSlice = uncurryThis(''.slice); 170 171 classofRaw = function (it) { 172 return stringSlice(toString(it), 8, -1); 173 }; 174 return classofRaw; 175} 176 177var indexedObject; 178var hasRequiredIndexedObject; 179 180function requireIndexedObject () { 181 if (hasRequiredIndexedObject) return indexedObject; 182 hasRequiredIndexedObject = 1; 183 var uncurryThis = requireFunctionUncurryThis(); 184 var fails = requireFails(); 185 var classof = requireClassofRaw(); 186 187 var $Object = Object; 188 var split = uncurryThis(''.split); 189 190 // fallback for non-array-like ES3 and non-enumerable old V8 strings 191 indexedObject = fails(function () { 192 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 193 // eslint-disable-next-line no-prototype-builtins -- safe 194 return !$Object('z').propertyIsEnumerable(0); 195 }) ? function (it) { 196 return classof(it) === 'String' ? split(it, '') : $Object(it); 197 } : $Object; 198 return indexedObject; 199} 200 201var isNullOrUndefined; 202var hasRequiredIsNullOrUndefined; 203 204function requireIsNullOrUndefined () { 205 if (hasRequiredIsNullOrUndefined) return isNullOrUndefined; 206 hasRequiredIsNullOrUndefined = 1; 207 // we can't use just `it == null` since of `document.all` special case 208 // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec 209 isNullOrUndefined = function (it) { 210 return it === null || it === undefined; 211 }; 212 return isNullOrUndefined; 213} 214 215var requireObjectCoercible; 216var hasRequiredRequireObjectCoercible; 217 218function requireRequireObjectCoercible () { 219 if (hasRequiredRequireObjectCoercible) return requireObjectCoercible; 220 hasRequiredRequireObjectCoercible = 1; 221 var isNullOrUndefined = requireIsNullOrUndefined(); 222 223 var $TypeError = TypeError; 224 225 // `RequireObjectCoercible` abstract operation 226 // https://tc39.es/ecma262/#sec-requireobjectcoercible 227 requireObjectCoercible = function (it) { 228 if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it); 229 return it; 230 }; 231 return requireObjectCoercible; 232} 233 234var toIndexedObject; 235var hasRequiredToIndexedObject; 236 237function requireToIndexedObject () { 238 if (hasRequiredToIndexedObject) return toIndexedObject; 239 hasRequiredToIndexedObject = 1; 240 // toObject with fallback for non-array-like ES3 strings 241 var IndexedObject = requireIndexedObject(); 242 var requireObjectCoercible = requireRequireObjectCoercible(); 243 244 toIndexedObject = function (it) { 245 return IndexedObject(requireObjectCoercible(it)); 246 }; 247 return toIndexedObject; 248} 249 250var isCallable; 251var hasRequiredIsCallable; 252 253function requireIsCallable () { 254 if (hasRequiredIsCallable) return isCallable; 255 hasRequiredIsCallable = 1; 256 // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot 257 var documentAll = typeof document == 'object' && document.all; 258 259 // `IsCallable` abstract operation 260 // https://tc39.es/ecma262/#sec-iscallable 261 // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing 262 isCallable = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) { 263 return typeof argument == 'function' || argument === documentAll; 264 } : function (argument) { 265 return typeof argument == 'function'; 266 }; 267 return isCallable; 268} 269 270var isObject; 271var hasRequiredIsObject; 272 273function requireIsObject () { 274 if (hasRequiredIsObject) return isObject; 275 hasRequiredIsObject = 1; 276 var isCallable = requireIsCallable(); 277 278 isObject = function (it) { 279 return typeof it == 'object' ? it !== null : isCallable(it); 280 }; 281 return isObject; 282} 283 284var getBuiltIn; 285var hasRequiredGetBuiltIn; 286 287function requireGetBuiltIn () { 288 if (hasRequiredGetBuiltIn) return getBuiltIn; 289 hasRequiredGetBuiltIn = 1; 290 var globalThis = requireGlobalThis(); 291 var isCallable = requireIsCallable(); 292 293 var aFunction = function (argument) { 294 return isCallable(argument) ? argument : undefined; 295 }; 296 297 getBuiltIn = function (namespace, method) { 298 return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method]; 299 }; 300 return getBuiltIn; 301} 302 303var objectIsPrototypeOf; 304var hasRequiredObjectIsPrototypeOf; 305 306function requireObjectIsPrototypeOf () { 307 if (hasRequiredObjectIsPrototypeOf) return objectIsPrototypeOf; 308 hasRequiredObjectIsPrototypeOf = 1; 309 var uncurryThis = requireFunctionUncurryThis(); 310 311 objectIsPrototypeOf = uncurryThis({}.isPrototypeOf); 312 return objectIsPrototypeOf; 313} 314 315var environmentUserAgent; 316var hasRequiredEnvironmentUserAgent; 317 318function requireEnvironmentUserAgent () { 319 if (hasRequiredEnvironmentUserAgent) return environmentUserAgent; 320 hasRequiredEnvironmentUserAgent = 1; 321 var globalThis = requireGlobalThis(); 322 323 var navigator = globalThis.navigator; 324 var userAgent = navigator && navigator.userAgent; 325 326 environmentUserAgent = userAgent ? String(userAgent) : ''; 327 return environmentUserAgent; 328} 329 330var environmentV8Version; 331var hasRequiredEnvironmentV8Version; 332 333function requireEnvironmentV8Version () { 334 if (hasRequiredEnvironmentV8Version) return environmentV8Version; 335 hasRequiredEnvironmentV8Version = 1; 336 var globalThis = requireGlobalThis(); 337 var userAgent = requireEnvironmentUserAgent(); 338 339 var process = globalThis.process; 340 var Deno = globalThis.Deno; 341 var versions = process && process.versions || Deno && Deno.version; 342 var v8 = versions && versions.v8; 343 var match, version; 344 345 if (v8) { 346 match = v8.split('.'); 347 // in old Chrome, versions of V8 isn't V8 = Chrome / 10 348 // but their correct versions are not interesting for us 349 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); 350 } 351 352 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` 353 // so check `userAgent` even if `.v8` exists, but 0 354 if (!version && userAgent) { 355 match = userAgent.match(/Edge\/(\d+)/); 356 if (!match || match[1] >= 74) { 357 match = userAgent.match(/Chrome\/(\d+)/); 358 if (match) version = +match[1]; 359 } 360 } 361 362 environmentV8Version = version; 363 return environmentV8Version; 364} 365 366var symbolConstructorDetection; 367var hasRequiredSymbolConstructorDetection; 368 369function requireSymbolConstructorDetection () { 370 if (hasRequiredSymbolConstructorDetection) return symbolConstructorDetection; 371 hasRequiredSymbolConstructorDetection = 1; 372 /* eslint-disable es/no-symbol -- required for testing */ 373 var V8_VERSION = requireEnvironmentV8Version(); 374 var fails = requireFails(); 375 var globalThis = requireGlobalThis(); 376 377 var $String = globalThis.String; 378 379 // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing 380 symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function () { 381 var symbol = Symbol('symbol detection'); 382 // Chrome 38 Symbol has incorrect toString conversion 383 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances 384 // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, 385 // of course, fail. 386 return !$String(symbol) || !(Object(symbol) instanceof Symbol) || 387 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances 388 !Symbol.sham && V8_VERSION && V8_VERSION < 41; 389 }); 390 return symbolConstructorDetection; 391} 392 393var useSymbolAsUid; 394var hasRequiredUseSymbolAsUid; 395 396function requireUseSymbolAsUid () { 397 if (hasRequiredUseSymbolAsUid) return useSymbolAsUid; 398 hasRequiredUseSymbolAsUid = 1; 399 /* eslint-disable es/no-symbol -- required for testing */ 400 var NATIVE_SYMBOL = requireSymbolConstructorDetection(); 401 402 useSymbolAsUid = NATIVE_SYMBOL && 403 !Symbol.sham && 404 typeof Symbol.iterator == 'symbol'; 405 return useSymbolAsUid; 406} 407 408var isSymbol; 409var hasRequiredIsSymbol; 410 411function requireIsSymbol () { 412 if (hasRequiredIsSymbol) return isSymbol; 413 hasRequiredIsSymbol = 1; 414 var getBuiltIn = requireGetBuiltIn(); 415 var isCallable = requireIsCallable(); 416 var isPrototypeOf = requireObjectIsPrototypeOf(); 417 var USE_SYMBOL_AS_UID = requireUseSymbolAsUid(); 418 419 var $Object = Object; 420 421 isSymbol = USE_SYMBOL_AS_UID ? function (it) { 422 return typeof it == 'symbol'; 423 } : function (it) { 424 var $Symbol = getBuiltIn('Symbol'); 425 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); 426 }; 427 return isSymbol; 428} 429 430var tryToString; 431var hasRequiredTryToString; 432 433function requireTryToString () { 434 if (hasRequiredTryToString) return tryToString; 435 hasRequiredTryToString = 1; 436 var $String = String; 437 438 tryToString = function (argument) { 439 try { 440 return $String(argument); 441 } catch (error) { 442 return 'Object'; 443 } 444 }; 445 return tryToString; 446} 447 448var aCallable; 449var hasRequiredACallable; 450 451function requireACallable () { 452 if (hasRequiredACallable) return aCallable; 453 hasRequiredACallable = 1; 454 var isCallable = requireIsCallable(); 455 var tryToString = requireTryToString(); 456 457 var $TypeError = TypeError; 458 459 // `Assert: IsCallable(argument) is true` 460 aCallable = function (argument) { 461 if (isCallable(argument)) return argument; 462 throw new $TypeError(tryToString(argument) + ' is not a function'); 463 }; 464 return aCallable; 465} 466 467var getMethod; 468var hasRequiredGetMethod; 469 470function requireGetMethod () { 471 if (hasRequiredGetMethod) return getMethod; 472 hasRequiredGetMethod = 1; 473 var aCallable = requireACallable(); 474 var isNullOrUndefined = requireIsNullOrUndefined(); 475 476 // `GetMethod` abstract operation 477 // https://tc39.es/ecma262/#sec-getmethod 478 getMethod = function (V, P) { 479 var func = V[P]; 480 return isNullOrUndefined(func) ? undefined : aCallable(func); 481 }; 482 return getMethod; 483} 484 485var ordinaryToPrimitive; 486var hasRequiredOrdinaryToPrimitive; 487 488function requireOrdinaryToPrimitive () { 489 if (hasRequiredOrdinaryToPrimitive) return ordinaryToPrimitive; 490 hasRequiredOrdinaryToPrimitive = 1; 491 var call = requireFunctionCall(); 492 var isCallable = requireIsCallable(); 493 var isObject = requireIsObject(); 494 495 var $TypeError = TypeError; 496 497 // `OrdinaryToPrimitive` abstract operation 498 // https://tc39.es/ecma262/#sec-ordinarytoprimitive 499 ordinaryToPrimitive = function (input, pref) { 500 var fn, val; 501 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; 502 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; 503 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; 504 throw new $TypeError("Can't convert object to primitive value"); 505 }; 506 return ordinaryToPrimitive; 507} 508 509var sharedStore = {exports: {}}; 510 511var isPure; 512var hasRequiredIsPure; 513 514function requireIsPure () { 515 if (hasRequiredIsPure) return isPure; 516 hasRequiredIsPure = 1; 517 isPure = false; 518 return isPure; 519} 520 521var defineGlobalProperty; 522var hasRequiredDefineGlobalProperty; 523 524function requireDefineGlobalProperty () { 525 if (hasRequiredDefineGlobalProperty) return defineGlobalProperty; 526 hasRequiredDefineGlobalProperty = 1; 527 var globalThis = requireGlobalThis(); 528 529 // eslint-disable-next-line es/no-object-defineproperty -- safe 530 var defineProperty = Object.defineProperty; 531 532 defineGlobalProperty = function (key, value) { 533 try { 534 defineProperty(globalThis, key, { value: value, configurable: true, writable: true }); 535 } catch (error) { 536 globalThis[key] = value; 537 } return value; 538 }; 539 return defineGlobalProperty; 540} 541 542var hasRequiredSharedStore; 543 544function requireSharedStore () { 545 if (hasRequiredSharedStore) return sharedStore.exports; 546 hasRequiredSharedStore = 1; 547 var IS_PURE = requireIsPure(); 548 var globalThis = requireGlobalThis(); 549 var defineGlobalProperty = requireDefineGlobalProperty(); 550 551 var SHARED = '__core-js_shared__'; 552 var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {}); 553 554 (store.versions || (store.versions = [])).push({ 555 version: '3.49.0', 556 mode: IS_PURE ? 'pure' : 'global', 557 copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.', 558 license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE', 559 source: 'https://github.com/zloirock/core-js' 560 }); 561 return sharedStore.exports; 562} 563 564var shared; 565var hasRequiredShared; 566 567function requireShared () { 568 if (hasRequiredShared) return shared; 569 hasRequiredShared = 1; 570 var store = requireSharedStore(); 571 572 shared = function (key, value) { 573 return store[key] || (store[key] = value || {}); 574 }; 575 return shared; 576} 577 578var toObject; 579var hasRequiredToObject; 580 581function requireToObject () { 582 if (hasRequiredToObject) return toObject; 583 hasRequiredToObject = 1; 584 var requireObjectCoercible = requireRequireObjectCoercible(); 585 586 var $Object = Object; 587 588 // `ToObject` abstract operation 589 // https://tc39.es/ecma262/#sec-toobject 590 toObject = function (argument) { 591 return $Object(requireObjectCoercible(argument)); 592 }; 593 return toObject; 594} 595 596var hasOwnProperty_1; 597var hasRequiredHasOwnProperty; 598 599function requireHasOwnProperty () { 600 if (hasRequiredHasOwnProperty) return hasOwnProperty_1; 601 hasRequiredHasOwnProperty = 1; 602 var uncurryThis = requireFunctionUncurryThis(); 603 var toObject = requireToObject(); 604 605 var hasOwnProperty = uncurryThis({}.hasOwnProperty); 606 607 // `HasOwnProperty` abstract operation 608 // https://tc39.es/ecma262/#sec-hasownproperty 609 // eslint-disable-next-line es/no-object-hasown -- safe 610 hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { 611 return hasOwnProperty(toObject(it), key); 612 }; 613 return hasOwnProperty_1; 614} 615 616var uid; 617var hasRequiredUid; 618 619function requireUid () { 620 if (hasRequiredUid) return uid; 621 hasRequiredUid = 1; 622 var uncurryThis = requireFunctionUncurryThis(); 623 624 var id = 0; 625 var postfix = Math.random(); 626 var toString = uncurryThis(1.1.toString); 627 628 uid = function (key) { 629 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); 630 }; 631 return uid; 632} 633 634var wellKnownSymbol; 635var hasRequiredWellKnownSymbol; 636 637function requireWellKnownSymbol () { 638 if (hasRequiredWellKnownSymbol) return wellKnownSymbol; 639 hasRequiredWellKnownSymbol = 1; 640 var globalThis = requireGlobalThis(); 641 var shared = requireShared(); 642 var hasOwn = requireHasOwnProperty(); 643 var uid = requireUid(); 644 var NATIVE_SYMBOL = requireSymbolConstructorDetection(); 645 var USE_SYMBOL_AS_UID = requireUseSymbolAsUid(); 646 647 var Symbol = globalThis.Symbol; 648 var WellKnownSymbolsStore = shared('wks'); 649 var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid; 650 651 wellKnownSymbol = function (name) { 652 if (!hasOwn(WellKnownSymbolsStore, name)) { 653 WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) 654 ? Symbol[name] 655 : createWellKnownSymbol('Symbol.' + name); 656 } return WellKnownSymbolsStore[name]; 657 }; 658 return wellKnownSymbol; 659} 660 661var toPrimitive$1; 662var hasRequiredToPrimitive; 663 664function requireToPrimitive () { 665 if (hasRequiredToPrimitive) return toPrimitive$1; 666 hasRequiredToPrimitive = 1; 667 var call = requireFunctionCall(); 668 var isObject = requireIsObject(); 669 var isSymbol = requireIsSymbol(); 670 var getMethod = requireGetMethod(); 671 var ordinaryToPrimitive = requireOrdinaryToPrimitive(); 672 var wellKnownSymbol = requireWellKnownSymbol(); 673 674 var $TypeError = TypeError; 675 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); 676 677 // `ToPrimitive` abstract operation 678 // https://tc39.es/ecma262/#sec-toprimitive 679 toPrimitive$1 = function (input, pref) { 680 if (!isObject(input) || isSymbol(input)) return input; 681 var exoticToPrim = getMethod(input, TO_PRIMITIVE); 682 var result; 683 if (exoticToPrim) { 684 if (pref === undefined) pref = 'default'; 685 result = call(exoticToPrim, input, pref); 686 if (!isObject(result) || isSymbol(result)) return result; 687 throw new $TypeError("Can't convert object to primitive value"); 688 } 689 if (pref === undefined) pref = 'number'; 690 return ordinaryToPrimitive(input, pref); 691 }; 692 return toPrimitive$1; 693} 694 695var toPropertyKey$1; 696var hasRequiredToPropertyKey; 697 698function requireToPropertyKey () { 699 if (hasRequiredToPropertyKey) return toPropertyKey$1; 700 hasRequiredToPropertyKey = 1; 701 var toPrimitive = requireToPrimitive(); 702 var isSymbol = requireIsSymbol(); 703 704 // `ToPropertyKey` abstract operation 705 // https://tc39.es/ecma262/#sec-topropertykey 706 toPropertyKey$1 = function (argument) { 707 var key = toPrimitive(argument, 'string'); 708 return isSymbol(key) ? key : key + ''; 709 }; 710 return toPropertyKey$1; 711} 712 713var documentCreateElement; 714var hasRequiredDocumentCreateElement; 715 716function requireDocumentCreateElement () { 717 if (hasRequiredDocumentCreateElement) return documentCreateElement; 718 hasRequiredDocumentCreateElement = 1; 719 var globalThis = requireGlobalThis(); 720 var isObject = requireIsObject(); 721 722 var document = globalThis.document; 723 // typeof document.createElement is 'object' in old IE 724 var EXISTS = isObject(document) && isObject(document.createElement); 725 726 documentCreateElement = function (it) { 727 return EXISTS ? document.createElement(it) : {}; 728 }; 729 return documentCreateElement; 730} 731 732var ie8DomDefine; 733var hasRequiredIe8DomDefine; 734 735function requireIe8DomDefine () { 736 if (hasRequiredIe8DomDefine) return ie8DomDefine; 737 hasRequiredIe8DomDefine = 1; 738 var DESCRIPTORS = requireDescriptors(); 739 var fails = requireFails(); 740 var createElement = requireDocumentCreateElement(); 741 742 // Thanks to IE8 for its funny defineProperty 743 ie8DomDefine = !DESCRIPTORS && !fails(function () { 744 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 745 return Object.defineProperty(createElement('div'), 'a', { 746 get: function () { return 7; } 747 }).a !== 7; 748 }); 749 return ie8DomDefine; 750} 751 752var hasRequiredObjectGetOwnPropertyDescriptor; 753 754function requireObjectGetOwnPropertyDescriptor () { 755 if (hasRequiredObjectGetOwnPropertyDescriptor) return objectGetOwnPropertyDescriptor; 756 hasRequiredObjectGetOwnPropertyDescriptor = 1; 757 var DESCRIPTORS = requireDescriptors(); 758 var call = requireFunctionCall(); 759 var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable(); 760 var createPropertyDescriptor = requireCreatePropertyDescriptor(); 761 var toIndexedObject = requireToIndexedObject(); 762 var toPropertyKey = requireToPropertyKey(); 763 var hasOwn = requireHasOwnProperty(); 764 var IE8_DOM_DEFINE = requireIe8DomDefine(); 765 766 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 767 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 768 769 // `Object.getOwnPropertyDescriptor` method 770 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor 771 objectGetOwnPropertyDescriptor.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { 772 O = toIndexedObject(O); 773 P = toPropertyKey(P); 774 if (IE8_DOM_DEFINE) try { 775 return $getOwnPropertyDescriptor(O, P); 776 } catch (error) { /* empty */ } 777 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); 778 }; 779 return objectGetOwnPropertyDescriptor; 780} 781 782var objectDefineProperty = {}; 783 784var v8PrototypeDefineBug; 785var hasRequiredV8PrototypeDefineBug; 786 787function requireV8PrototypeDefineBug () { 788 if (hasRequiredV8PrototypeDefineBug) return v8PrototypeDefineBug; 789 hasRequiredV8PrototypeDefineBug = 1; 790 var DESCRIPTORS = requireDescriptors(); 791 var fails = requireFails(); 792 793 // V8 ~ Chrome 36- 794 // https://bugs.chromium.org/p/v8/issues/detail?id=3334 795 v8PrototypeDefineBug = DESCRIPTORS && fails(function () { 796 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 797 return Object.defineProperty(function () { /* empty */ }, 'prototype', { 798 value: 42, 799 writable: false 800 }).prototype !== 42; 801 }); 802 return v8PrototypeDefineBug; 803} 804 805var anObject; 806var hasRequiredAnObject; 807 808function requireAnObject () { 809 if (hasRequiredAnObject) return anObject; 810 hasRequiredAnObject = 1; 811 var isObject = requireIsObject(); 812 813 var $String = String; 814 var $TypeError = TypeError; 815 816 // `Assert: Type(argument) is Object` 817 anObject = function (argument) { 818 if (isObject(argument)) return argument; 819 throw new $TypeError($String(argument) + ' is not an object'); 820 }; 821 return anObject; 822} 823 824var hasRequiredObjectDefineProperty; 825 826function requireObjectDefineProperty () { 827 if (hasRequiredObjectDefineProperty) return objectDefineProperty; 828 hasRequiredObjectDefineProperty = 1; 829 var DESCRIPTORS = requireDescriptors(); 830 var IE8_DOM_DEFINE = requireIe8DomDefine(); 831 var V8_PROTOTYPE_DEFINE_BUG = requireV8PrototypeDefineBug(); 832 var anObject = requireAnObject(); 833 var toPropertyKey = requireToPropertyKey(); 834 835 var $TypeError = TypeError; 836 // eslint-disable-next-line es/no-object-defineproperty -- safe 837 var $defineProperty = Object.defineProperty; 838 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 839 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 840 var ENUMERABLE = 'enumerable'; 841 var CONFIGURABLE = 'configurable'; 842 var WRITABLE = 'writable'; 843 844 // `Object.defineProperty` method 845 // https://tc39.es/ecma262/#sec-object.defineproperty 846 objectDefineProperty.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { 847 anObject(O); 848 P = toPropertyKey(P); 849 anObject(Attributes); 850 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { 851 var current = $getOwnPropertyDescriptor(O, P); 852 if (current && current[WRITABLE]) { 853 O[P] = Attributes.value; 854 Attributes = { 855 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], 856 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], 857 writable: false 858 }; 859 } 860 } return $defineProperty(O, P, Attributes); 861 } : $defineProperty : function defineProperty(O, P, Attributes) { 862 anObject(O); 863 P = toPropertyKey(P); 864 anObject(Attributes); 865 if (IE8_DOM_DEFINE) try { 866 return $defineProperty(O, P, Attributes); 867 } catch (error) { /* empty */ } 868 if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported'); 869 if ('value' in Attributes) O[P] = Attributes.value; 870 return O; 871 }; 872 return objectDefineProperty; 873} 874 875var createNonEnumerableProperty; 876var hasRequiredCreateNonEnumerableProperty; 877 878function requireCreateNonEnumerableProperty () { 879 if (hasRequiredCreateNonEnumerableProperty) return createNonEnumerableProperty; 880 hasRequiredCreateNonEnumerableProperty = 1; 881 var DESCRIPTORS = requireDescriptors(); 882 var definePropertyModule = requireObjectDefineProperty(); 883 var createPropertyDescriptor = requireCreatePropertyDescriptor(); 884 885 createNonEnumerableProperty = DESCRIPTORS ? function (object, key, value) { 886 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); 887 } : function (object, key, value) { 888 object[key] = value; 889 return object; 890 }; 891 return createNonEnumerableProperty; 892} 893 894var makeBuiltIn = {exports: {}}; 895 896var functionName; 897var hasRequiredFunctionName; 898 899function requireFunctionName () { 900 if (hasRequiredFunctionName) return functionName; 901 hasRequiredFunctionName = 1; 902 var DESCRIPTORS = requireDescriptors(); 903 var hasOwn = requireHasOwnProperty(); 904 905 var FunctionPrototype = Function.prototype; 906 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 907 var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; 908 909 var EXISTS = hasOwn(FunctionPrototype, 'name'); 910 // additional protection from minified / mangled / dropped function names 911 var PROPER = EXISTS && function something() { /* empty */ }.name === 'something'; 912 var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); 913 914 functionName = { 915 EXISTS: EXISTS, 916 PROPER: PROPER, 917 CONFIGURABLE: CONFIGURABLE 918 }; 919 return functionName; 920} 921 922var inspectSource; 923var hasRequiredInspectSource; 924 925function requireInspectSource () { 926 if (hasRequiredInspectSource) return inspectSource; 927 hasRequiredInspectSource = 1; 928 var uncurryThis = requireFunctionUncurryThis(); 929 var isCallable = requireIsCallable(); 930 var store = requireSharedStore(); 931 932 var functionToString = uncurryThis(Function.toString); 933 934 // this helper broken in `[email protected]`, so we can't use `shared` helper 935 if (!isCallable(store.inspectSource)) { 936 store.inspectSource = function (it) { 937 return functionToString(it); 938 }; 939 } 940 941 inspectSource = store.inspectSource; 942 return inspectSource; 943} 944 945var weakMapBasicDetection; 946var hasRequiredWeakMapBasicDetection; 947 948function requireWeakMapBasicDetection () { 949 if (hasRequiredWeakMapBasicDetection) return weakMapBasicDetection; 950 hasRequiredWeakMapBasicDetection = 1; 951 var globalThis = requireGlobalThis(); 952 var isCallable = requireIsCallable(); 953 954 var WeakMap = globalThis.WeakMap; 955 956 weakMapBasicDetection = isCallable(WeakMap) && /native code/.test(String(WeakMap)); 957 return weakMapBasicDetection; 958} 959 960var sharedKey; 961var hasRequiredSharedKey; 962 963function requireSharedKey () { 964 if (hasRequiredSharedKey) return sharedKey; 965 hasRequiredSharedKey = 1; 966 var shared = requireShared(); 967 var uid = requireUid(); 968 969 var keys = shared('keys'); 970 971 sharedKey = function (key) { 972 return keys[key] || (keys[key] = uid(key)); 973 }; 974 return sharedKey; 975} 976 977var hiddenKeys; 978var hasRequiredHiddenKeys; 979 980function requireHiddenKeys () { 981 if (hasRequiredHiddenKeys) return hiddenKeys; 982 hasRequiredHiddenKeys = 1; 983 hiddenKeys = {}; 984 return hiddenKeys; 985} 986 987var internalState; 988var hasRequiredInternalState; 989 990function requireInternalState () { 991 if (hasRequiredInternalState) return internalState; 992 hasRequiredInternalState = 1; 993 var NATIVE_WEAK_MAP = requireWeakMapBasicDetection(); 994 var globalThis = requireGlobalThis(); 995 var isObject = requireIsObject(); 996 var createNonEnumerableProperty = requireCreateNonEnumerableProperty(); 997 var hasOwn = requireHasOwnProperty(); 998 var shared = requireSharedStore(); 999 var sharedKey = requireSharedKey(); 1000 var hiddenKeys = requireHiddenKeys(); 1001 1002 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; 1003 var TypeError = globalThis.TypeError; 1004 var WeakMap = globalThis.WeakMap; 1005 var set, get, has; 1006 1007 var enforce = function (it) { 1008 return has(it) ? get(it) : set(it, {}); 1009 }; 1010 1011 var getterFor = function (TYPE) { 1012 return function (it) { 1013 var state; 1014 if (!isObject(it) || (state = get(it)).type !== TYPE) { 1015 throw new TypeError('Incompatible receiver, ' + TYPE + ' required'); 1016 } return state; 1017 }; 1018 }; 1019 1020 if (NATIVE_WEAK_MAP || shared.state) { 1021 var store = shared.state || (shared.state = new WeakMap()); 1022 /* eslint-disable no-self-assign -- prototype methods protection */ 1023 store.get = store.get; 1024 store.has = store.has; 1025 store.set = store.set; 1026 /* eslint-enable no-self-assign -- prototype methods protection */ 1027 set = function (it, metadata) { 1028 if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); 1029 metadata.facade = it; 1030 store.set(it, metadata); 1031 return metadata; 1032 }; 1033 get = function (it) { 1034 return store.get(it) || {}; 1035 }; 1036 has = function (it) { 1037 return store.has(it); 1038 }; 1039 } else { 1040 var STATE = sharedKey('state'); 1041 hiddenKeys[STATE] = true; 1042 set = function (it, metadata) { 1043 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); 1044 metadata.facade = it; 1045 createNonEnumerableProperty(it, STATE, metadata); 1046 return metadata; 1047 }; 1048 get = function (it) { 1049 return hasOwn(it, STATE) ? it[STATE] : {}; 1050 }; 1051 has = function (it) { 1052 return hasOwn(it, STATE); 1053 }; 1054 } 1055 1056 internalState = { 1057 set: set, 1058 get: get, 1059 has: has, 1060 enforce: enforce, 1061 getterFor: getterFor 1062 }; 1063 return internalState; 1064} 1065 1066var hasRequiredMakeBuiltIn; 1067 1068function requireMakeBuiltIn () { 1069 if (hasRequiredMakeBuiltIn) return makeBuiltIn.exports; 1070 hasRequiredMakeBuiltIn = 1; 1071 var uncurryThis = requireFunctionUncurryThis(); 1072 var fails = requireFails(); 1073 var isCallable = requireIsCallable(); 1074 var hasOwn = requireHasOwnProperty(); 1075 var DESCRIPTORS = requireDescriptors(); 1076 var CONFIGURABLE_FUNCTION_NAME = requireFunctionName().CONFIGURABLE; 1077 var inspectSource = requireInspectSource(); 1078 var InternalStateModule = requireInternalState(); 1079 1080 var enforceInternalState = InternalStateModule.enforce; 1081 var getInternalState = InternalStateModule.get; 1082 var $String = String; 1083 // eslint-disable-next-line es/no-object-defineproperty -- safe 1084 var defineProperty = Object.defineProperty; 1085 var stringSlice = uncurryThis(''.slice); 1086 var replace = uncurryThis(''.replace); 1087 var join = uncurryThis([].join); 1088 1089 var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { 1090 return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; 1091 }); 1092 1093 var TEMPLATE = String(String).split('String'); 1094 1095 var makeBuiltIn$1 = makeBuiltIn.exports = function (value, name, options) { 1096 if (stringSlice($String(name), 0, 7) === 'Symbol(') { 1097 name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']'; 1098 } 1099 if (options && options.getter) name = 'get ' + name; 1100 if (options && options.setter) name = 'set ' + name; 1101 if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { 1102 if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); 1103 else value.name = name; 1104 } 1105 if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { 1106 defineProperty(value, 'length', { value: options.arity }); 1107 } 1108 try { 1109 if (options && hasOwn(options, 'constructor') && options.constructor) { 1110 if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); 1111 // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable 1112 } else if (value.prototype) value.prototype = undefined; 1113 } catch (error) { /* empty */ } 1114 var state = enforceInternalState(value); 1115 if (!hasOwn(state, 'source')) { 1116 state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); 1117 } return value; 1118 }; 1119 1120 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 1121 // eslint-disable-next-line no-extend-native -- required 1122 Function.prototype.toString = makeBuiltIn$1(function toString() { 1123 return isCallable(this) && getInternalState(this).source || inspectSource(this); 1124 }, 'toString'); 1125 return makeBuiltIn.exports; 1126} 1127 1128var defineBuiltIn; 1129var hasRequiredDefineBuiltIn; 1130 1131function requireDefineBuiltIn () { 1132 if (hasRequiredDefineBuiltIn) return defineBuiltIn; 1133 hasRequiredDefineBuiltIn = 1; 1134 var isCallable = requireIsCallable(); 1135 var definePropertyModule = requireObjectDefineProperty(); 1136 var makeBuiltIn = requireMakeBuiltIn(); 1137 var defineGlobalProperty = requireDefineGlobalProperty(); 1138 1139 defineBuiltIn = function (O, key, value, options) { 1140 if (!options) options = {}; 1141 var simple = options.enumerable; 1142 var name = options.name !== undefined ? options.name : key; 1143 if (isCallable(value)) makeBuiltIn(value, name, options); 1144 if (options.global) { 1145 if (simple) O[key] = value; 1146 else defineGlobalProperty(key, value); 1147 } else { 1148 try { 1149 if (!options.unsafe) delete O[key]; 1150 else if (O[key]) simple = true; 1151 } catch (error) { /* empty */ } 1152 if (simple) O[key] = value; 1153 else definePropertyModule.f(O, key, { 1154 value: value, 1155 enumerable: false, 1156 configurable: !options.nonConfigurable, 1157 writable: !options.nonWritable 1158 }); 1159 } return O; 1160 }; 1161 return defineBuiltIn; 1162} 1163 1164var objectGetOwnPropertyNames = {}; 1165 1166var mathTrunc; 1167var hasRequiredMathTrunc; 1168 1169function requireMathTrunc () { 1170 if (hasRequiredMathTrunc) return mathTrunc; 1171 hasRequiredMathTrunc = 1; 1172 var ceil = Math.ceil; 1173 var floor = Math.floor; 1174 1175 // `Math.trunc` method 1176 // https://tc39.es/ecma262/#sec-math.trunc 1177 // eslint-disable-next-line es/no-math-trunc -- safe 1178 mathTrunc = Math.trunc || function trunc(x) { 1179 var n = +x; 1180 return (n > 0 ? floor : ceil)(n); 1181 }; 1182 return mathTrunc; 1183} 1184 1185var toIntegerOrInfinity; 1186var hasRequiredToIntegerOrInfinity; 1187 1188function requireToIntegerOrInfinity () { 1189 if (hasRequiredToIntegerOrInfinity) return toIntegerOrInfinity; 1190 hasRequiredToIntegerOrInfinity = 1; 1191 var trunc = requireMathTrunc(); 1192 1193 // `ToIntegerOrInfinity` abstract operation 1194 // https://tc39.es/ecma262/#sec-tointegerorinfinity 1195 toIntegerOrInfinity = function (argument) { 1196 var number = +argument; 1197 // eslint-disable-next-line no-self-compare -- NaN check 1198 return number !== number || number === 0 ? 0 : trunc(number); 1199 }; 1200 return toIntegerOrInfinity; 1201} 1202 1203var toAbsoluteIndex; 1204var hasRequiredToAbsoluteIndex; 1205 1206function requireToAbsoluteIndex () { 1207 if (hasRequiredToAbsoluteIndex) return toAbsoluteIndex; 1208 hasRequiredToAbsoluteIndex = 1; 1209 var toIntegerOrInfinity = requireToIntegerOrInfinity(); 1210 1211 var max = Math.max; 1212 var min = Math.min; 1213 1214 // Helper for a popular repeating case of the spec: 1215 // Let integer be ? ToInteger(index). 1216 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). 1217 toAbsoluteIndex = function (index, length) { 1218 var integer = toIntegerOrInfinity(index); 1219 return integer < 0 ? max(integer + length, 0) : min(integer, length); 1220 }; 1221 return toAbsoluteIndex; 1222} 1223 1224var toLength; 1225var hasRequiredToLength; 1226 1227function requireToLength () { 1228 if (hasRequiredToLength) return toLength; 1229 hasRequiredToLength = 1; 1230 var toIntegerOrInfinity = requireToIntegerOrInfinity(); 1231 1232 var min = Math.min; 1233 1234 // `ToLength` abstract operation 1235 // https://tc39.es/ecma262/#sec-tolength 1236 toLength = function (argument) { 1237 var len = toIntegerOrInfinity(argument); 1238 return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 1239 }; 1240 return toLength; 1241} 1242 1243var lengthOfArrayLike; 1244var hasRequiredLengthOfArrayLike; 1245 1246function requireLengthOfArrayLike () { 1247 if (hasRequiredLengthOfArrayLike) return lengthOfArrayLike; 1248 hasRequiredLengthOfArrayLike = 1; 1249 var toLength = requireToLength(); 1250 1251 // `LengthOfArrayLike` abstract operation 1252 // https://tc39.es/ecma262/#sec-lengthofarraylike 1253 lengthOfArrayLike = function (obj) { 1254 return toLength(obj.length); 1255 }; 1256 return lengthOfArrayLike; 1257} 1258 1259var arrayIncludes; 1260var hasRequiredArrayIncludes; 1261 1262function requireArrayIncludes () { 1263 if (hasRequiredArrayIncludes) return arrayIncludes; 1264 hasRequiredArrayIncludes = 1; 1265 var toIndexedObject = requireToIndexedObject(); 1266 var toAbsoluteIndex = requireToAbsoluteIndex(); 1267 var lengthOfArrayLike = requireLengthOfArrayLike(); 1268 1269 // `Array.prototype.{ indexOf, includes }` methods implementation 1270 var createMethod = function (IS_INCLUDES) { 1271 return function ($this, el, fromIndex) { 1272 var O = toIndexedObject($this); 1273 var length = lengthOfArrayLike(O); 1274 if (length === 0) return !IS_INCLUDES && -1; 1275 var index = toAbsoluteIndex(fromIndex, length); 1276 var value; 1277 // Array#includes uses SameValueZero equality algorithm 1278 // eslint-disable-next-line no-self-compare -- NaN check 1279 if (IS_INCLUDES && el !== el) while (length > index) { 1280 value = O[index++]; 1281 // eslint-disable-next-line no-self-compare -- NaN check 1282 if (value !== value) return true; 1283 // Array#indexOf ignores holes, Array#includes - not 1284 } else for (;length > index; index++) { 1285 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; 1286 } return !IS_INCLUDES && -1; 1287 }; 1288 }; 1289 1290 arrayIncludes = { 1291 // `Array.prototype.includes` method 1292 // https://tc39.es/ecma262/#sec-array.prototype.includes 1293 includes: createMethod(true), 1294 // `Array.prototype.indexOf` method 1295 // https://tc39.es/ecma262/#sec-array.prototype.indexof 1296 indexOf: createMethod(false) 1297 }; 1298 return arrayIncludes; 1299} 1300 1301var objectKeysInternal; 1302var hasRequiredObjectKeysInternal; 1303 1304function requireObjectKeysInternal () { 1305 if (hasRequiredObjectKeysInternal) return objectKeysInternal; 1306 hasRequiredObjectKeysInternal = 1; 1307 var uncurryThis = requireFunctionUncurryThis(); 1308 var hasOwn = requireHasOwnProperty(); 1309 var toIndexedObject = requireToIndexedObject(); 1310 var indexOf = requireArrayIncludes().indexOf; 1311 var hiddenKeys = requireHiddenKeys(); 1312 1313 var push = uncurryThis([].push); 1314 1315 objectKeysInternal = function (object, names) { 1316 var O = toIndexedObject(object); 1317 var i = 0; 1318 var result = []; 1319 var key; 1320 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); 1321 // Don't enum bug & hidden keys 1322 while (names.length > i) if (hasOwn(O, key = names[i++])) { 1323 ~indexOf(result, key) || push(result, key); 1324 } 1325 return result; 1326 }; 1327 return objectKeysInternal; 1328} 1329 1330var enumBugKeys; 1331var hasRequiredEnumBugKeys; 1332 1333function requireEnumBugKeys () { 1334 if (hasRequiredEnumBugKeys) return enumBugKeys; 1335 hasRequiredEnumBugKeys = 1; 1336 // IE8- don't enum bug keys 1337 enumBugKeys = [ 1338 'constructor', 1339 'hasOwnProperty', 1340 'isPrototypeOf', 1341 'propertyIsEnumerable', 1342 'toLocaleString', 1343 'toString', 1344 'valueOf' 1345 ]; 1346 return enumBugKeys; 1347} 1348 1349var hasRequiredObjectGetOwnPropertyNames; 1350 1351function requireObjectGetOwnPropertyNames () { 1352 if (hasRequiredObjectGetOwnPropertyNames) return objectGetOwnPropertyNames; 1353 hasRequiredObjectGetOwnPropertyNames = 1; 1354 var internalObjectKeys = requireObjectKeysInternal(); 1355 var enumBugKeys = requireEnumBugKeys(); 1356 1357 var hiddenKeys = enumBugKeys.concat('length', 'prototype'); 1358 1359 // `Object.getOwnPropertyNames` method 1360 // https://tc39.es/ecma262/#sec-object.getownpropertynames 1361 // eslint-disable-next-line es/no-object-getownpropertynames -- safe 1362 objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 1363 return internalObjectKeys(O, hiddenKeys); 1364 }; 1365 return objectGetOwnPropertyNames; 1366} 1367 1368var objectGetOwnPropertySymbols = {}; 1369 1370var hasRequiredObjectGetOwnPropertySymbols; 1371 1372function requireObjectGetOwnPropertySymbols () { 1373 if (hasRequiredObjectGetOwnPropertySymbols) return objectGetOwnPropertySymbols; 1374 hasRequiredObjectGetOwnPropertySymbols = 1; 1375 // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe 1376 objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; 1377 return objectGetOwnPropertySymbols; 1378} 1379 1380var ownKeys$3; 1381var hasRequiredOwnKeys; 1382 1383function requireOwnKeys () { 1384 if (hasRequiredOwnKeys) return ownKeys$3; 1385 hasRequiredOwnKeys = 1; 1386 var getBuiltIn = requireGetBuiltIn(); 1387 var uncurryThis = requireFunctionUncurryThis(); 1388 var getOwnPropertyNamesModule = requireObjectGetOwnPropertyNames(); 1389 var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols(); 1390 var anObject = requireAnObject(); 1391 1392 var concat = uncurryThis([].concat); 1393 1394 // all object keys, includes non-enumerable and symbols 1395 ownKeys$3 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { 1396 var keys = getOwnPropertyNamesModule.f(anObject(it)); 1397 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; 1398 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; 1399 }; 1400 return ownKeys$3; 1401} 1402 1403var copyConstructorProperties; 1404var hasRequiredCopyConstructorProperties; 1405 1406function requireCopyConstructorProperties () { 1407 if (hasRequiredCopyConstructorProperties) return copyConstructorProperties; 1408 hasRequiredCopyConstructorProperties = 1; 1409 var hasOwn = requireHasOwnProperty(); 1410 var ownKeys = requireOwnKeys(); 1411 var getOwnPropertyDescriptorModule = requireObjectGetOwnPropertyDescriptor(); 1412 var definePropertyModule = requireObjectDefineProperty(); 1413 1414 copyConstructorProperties = function (target, source, exceptions) { 1415 var keys = ownKeys(source); 1416 var defineProperty = definePropertyModule.f; 1417 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; 1418 for (var i = 0; i < keys.length; i++) { 1419 var key = keys[i]; 1420 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) { 1421 defineProperty(target, key, getOwnPropertyDescriptor(source, key)); 1422 } 1423 } 1424 }; 1425 return copyConstructorProperties; 1426} 1427 1428var isForced_1; 1429var hasRequiredIsForced; 1430 1431function requireIsForced () { 1432 if (hasRequiredIsForced) return isForced_1; 1433 hasRequiredIsForced = 1; 1434 var fails = requireFails(); 1435 var isCallable = requireIsCallable(); 1436 1437 var replacement = /#|\.prototype\./; 1438 1439 var isForced = function (feature, detection) { 1440 var value = data[normalize(feature)]; 1441 return value === POLYFILL ? true 1442 : value === NATIVE ? false 1443 : isCallable(detection) ? fails(detection) 1444 : !!detection; 1445 }; 1446 1447 var normalize = isForced.normalize = function (string) { 1448 return String(string).replace(replacement, '.').toLowerCase(); 1449 }; 1450 1451 var data = isForced.data = {}; 1452 var NATIVE = isForced.NATIVE = 'N'; 1453 var POLYFILL = isForced.POLYFILL = 'P'; 1454 1455 isForced_1 = isForced; 1456 return isForced_1; 1457} 1458 1459var _export; 1460var hasRequired_export; 1461 1462function require_export () { 1463 if (hasRequired_export) return _export; 1464 hasRequired_export = 1; 1465 var globalThis = requireGlobalThis(); 1466 var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f; 1467 var createNonEnumerableProperty = requireCreateNonEnumerableProperty(); 1468 var defineBuiltIn = requireDefineBuiltIn(); 1469 var defineGlobalProperty = requireDefineGlobalProperty(); 1470 var copyConstructorProperties = requireCopyConstructorProperties(); 1471 var isForced = requireIsForced(); 1472 1473 /* 1474 options.target - name of the target object 1475 options.global - target is the global object 1476 options.stat - export as static methods of target 1477 options.proto - export as prototype methods of target 1478 options.real - real prototype method for the `pure` version 1479 options.forced - export even if the native feature is available
1480 options.bind - bind methods to the target, required for the `pure` version 1481 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version 1482 options.unsafe - use the simple assignment of property instead of delete + defineProperty 1483 options.sham - add a flag to not completely full polyfills 1484 options.enumerable - export as enumerable property 1485 options.dontCallGetSet - prevent calling a getter on target 1486 options.name - the .name of the function if it does not match the key 1487 */ 1488 _export = function (options, source) { 1489 var TARGET = options.target; 1490 var GLOBAL = options.global; 1491 var STATIC = options.stat; 1492 var FORCED, target, key, targetProperty, sourceProperty, descriptor; 1493 if (GLOBAL) { 1494 target = globalThis; 1495 } else if (STATIC) { 1496 target = globalThis[TARGET] || defineGlobalProperty(TARGET, {}); 1497 } else { 1498 target = globalThis[TARGET] && globalThis[TARGET].prototype; 1499 } 1500 if (target) for (key in source) { 1501 sourceProperty = source[key]; 1502 if (options.dontCallGetSet) { 1503 descriptor = getOwnPropertyDescriptor(target, key); 1504 targetProperty = descriptor && descriptor.value; 1505 } else targetProperty = target[key]; 1506 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); 1507 // contained in target 1508 if (!FORCED && targetProperty !== undefined) { 1509 if (typeof sourceProperty == typeof targetProperty) continue; 1510 copyConstructorProperties(sourceProperty, targetProperty); 1511 } 1512 // add a flag to not completely full polyfills 1513 if (options.sham || (targetProperty && targetProperty.sham)) { 1514 createNonEnumerableProperty(sourceProperty, 'sham', true); 1515 } 1516 defineBuiltIn(target, key, sourceProperty, options); 1517 } 1518 }; 1519 return _export; 1520} 1521 1522var environment; 1523var hasRequiredEnvironment; 1524 1525function requireEnvironment () { 1526 if (hasRequiredEnvironment) return environment; 1527 hasRequiredEnvironment = 1; 1528 /* global Bun, Deno -- detection */ 1529 var globalThis = requireGlobalThis(); 1530 var userAgent = requireEnvironmentUserAgent(); 1531 var classof = requireClassofRaw(); 1532 1533 var userAgentStartsWith = function (string) { 1534 return userAgent.slice(0, string.length) === string; 1535 }; 1536 1537 environment = (function () { 1538 if (userAgentStartsWith('Bun/')) return 'BUN'; 1539 if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE'; 1540 if (userAgentStartsWith('Deno/')) return 'DENO'; 1541 if (userAgentStartsWith('Node.js/')) return 'NODE'; 1542 if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN'; 1543 if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO'; 1544 if (classof(globalThis.process) === 'process') return 'NODE'; 1545 if (globalThis.window && globalThis.document) return 'BROWSER'; 1546 return 'REST'; 1547 })(); 1548 return environment; 1549} 1550 1551var environmentIsNode; 1552var hasRequiredEnvironmentIsNode; 1553 1554function requireEnvironmentIsNode () { 1555 if (hasRequiredEnvironmentIsNode) return environmentIsNode; 1556 hasRequiredEnvironmentIsNode = 1; 1557 var ENVIRONMENT = requireEnvironment(); 1558 1559 environmentIsNode = ENVIRONMENT === 'NODE'; 1560 return environmentIsNode; 1561} 1562 1563var path; 1564var hasRequiredPath; 1565 1566function requirePath () { 1567 if (hasRequiredPath) return path; 1568 hasRequiredPath = 1; 1569 var globalThis = requireGlobalThis(); 1570 1571 path = globalThis; 1572 return path; 1573} 1574 1575var functionUncurryThisAccessor; 1576var hasRequiredFunctionUncurryThisAccessor; 1577 1578function requireFunctionUncurryThisAccessor () { 1579 if (hasRequiredFunctionUncurryThisAccessor) return functionUncurryThisAccessor; 1580 hasRequiredFunctionUncurryThisAccessor = 1; 1581 var uncurryThis = requireFunctionUncurryThis(); 1582 var aCallable = requireACallable(); 1583 1584 functionUncurryThisAccessor = function (object, key, method) { 1585 try { 1586 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 1587 return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method])); 1588 } catch (error) { /* empty */ } 1589 }; 1590 return functionUncurryThisAccessor; 1591} 1592 1593var isPossiblePrototype; 1594var hasRequiredIsPossiblePrototype; 1595 1596function requireIsPossiblePrototype () { 1597 if (hasRequiredIsPossiblePrototype) return isPossiblePrototype; 1598 hasRequiredIsPossiblePrototype = 1; 1599 var isObject = requireIsObject(); 1600 1601 isPossiblePrototype = function (argument) { 1602 return isObject(argument) || argument === null; 1603 }; 1604 return isPossiblePrototype; 1605} 1606 1607var aPossiblePrototype; 1608var hasRequiredAPossiblePrototype; 1609 1610function requireAPossiblePrototype () { 1611 if (hasRequiredAPossiblePrototype) return aPossiblePrototype; 1612 hasRequiredAPossiblePrototype = 1; 1613 var isPossiblePrototype = requireIsPossiblePrototype(); 1614 1615 var $String = String; 1616 var $TypeError = TypeError; 1617 1618 aPossiblePrototype = function (argument) { 1619 if (isPossiblePrototype(argument)) return argument; 1620 throw new $TypeError("Can't set " + $String(argument) + ' as a prototype'); 1621 }; 1622 return aPossiblePrototype; 1623} 1624 1625var objectSetPrototypeOf; 1626var hasRequiredObjectSetPrototypeOf; 1627 1628function requireObjectSetPrototypeOf () { 1629 if (hasRequiredObjectSetPrototypeOf) return objectSetPrototypeOf; 1630 hasRequiredObjectSetPrototypeOf = 1; 1631 /* eslint-disable no-proto -- safe */ 1632 var uncurryThisAccessor = requireFunctionUncurryThisAccessor(); 1633 var isObject = requireIsObject(); 1634 var requireObjectCoercible = requireRequireObjectCoercible(); 1635 var aPossiblePrototype = requireAPossiblePrototype(); 1636 1637 // `Object.setPrototypeOf` method 1638 // https://tc39.es/ecma262/#sec-object.setprototypeof 1639 // Works with __proto__ only. Old v8 can't work with null proto objects. 1640 // eslint-disable-next-line es/no-object-setprototypeof -- safe 1641 objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { 1642 var CORRECT_SETTER = false;
vendor: 9,388 bytes, lines 1643-1948
1643 var test = {}; 1644 var setter; 1645 try { 1646 setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set'); 1647 setter(test, []); 1648 CORRECT_SETTER = test instanceof Array; 1649 } catch (error) { /* empty */ } 1650 return function setPrototypeOf(O, proto) { 1651 requireObjectCoercible(O); 1652 aPossiblePrototype(proto); 1653 if (!isObject(O)) return O; 1654 if (CORRECT_SETTER) setter(O, proto); 1655 else O.__proto__ = proto; 1656 return O; 1657 }; 1658 }() : undefined); 1659 return objectSetPrototypeOf; 1660} 1661 1662var setToStringTag; 1663var hasRequiredSetToStringTag; 1664 1665function requireSetToStringTag () { 1666 if (hasRequiredSetToStringTag) return setToStringTag; 1667 hasRequiredSetToStringTag = 1; 1668 var defineProperty = requireObjectDefineProperty().f; 1669 var hasOwn = requireHasOwnProperty(); 1670 var wellKnownSymbol = requireWellKnownSymbol(); 1671 1672 var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 1673 1674 setToStringTag = function (target, TAG, STATIC) { 1675 if (target && !STATIC) target = target.prototype; 1676 if (target && !hasOwn(target, TO_STRING_TAG)) { 1677 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG }); 1678 } 1679 }; 1680 return setToStringTag; 1681} 1682 1683var defineBuiltInAccessor; 1684var hasRequiredDefineBuiltInAccessor; 1685 1686function requireDefineBuiltInAccessor () { 1687 if (hasRequiredDefineBuiltInAccessor) return defineBuiltInAccessor; 1688 hasRequiredDefineBuiltInAccessor = 1; 1689 var makeBuiltIn = requireMakeBuiltIn(); 1690 var defineProperty = requireObjectDefineProperty(); 1691 1692 defineBuiltInAccessor = function (target, name, descriptor) { 1693 if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true }); 1694 if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true }); 1695 return defineProperty.f(target, name, descriptor); 1696 }; 1697 return defineBuiltInAccessor; 1698} 1699 1700var setSpecies; 1701var hasRequiredSetSpecies; 1702 1703function requireSetSpecies () { 1704 if (hasRequiredSetSpecies) return setSpecies; 1705 hasRequiredSetSpecies = 1; 1706 var getBuiltIn = requireGetBuiltIn(); 1707 var defineBuiltInAccessor = requireDefineBuiltInAccessor(); 1708 var wellKnownSymbol = requireWellKnownSymbol(); 1709 var DESCRIPTORS = requireDescriptors(); 1710 1711 var SPECIES = wellKnownSymbol('species'); 1712 1713 setSpecies = function (CONSTRUCTOR_NAME) { 1714 var Constructor = getBuiltIn(CONSTRUCTOR_NAME); 1715 1716 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { 1717 defineBuiltInAccessor(Constructor, SPECIES, { 1718 configurable: true, 1719 get: function () { return this; } 1720 }); 1721 } 1722 }; 1723 return setSpecies; 1724} 1725 1726var anInstance; 1727var hasRequiredAnInstance; 1728 1729function requireAnInstance () { 1730 if (hasRequiredAnInstance) return anInstance; 1731 hasRequiredAnInstance = 1; 1732 var isPrototypeOf = requireObjectIsPrototypeOf(); 1733 1734 var $TypeError = TypeError; 1735 1736 anInstance = function (it, Prototype) { 1737 if (isPrototypeOf(Prototype, it)) return it; 1738 throw new $TypeError('Incorrect invocation'); 1739 }; 1740 return anInstance; 1741} 1742 1743var toStringTagSupport; 1744var hasRequiredToStringTagSupport; 1745 1746function requireToStringTagSupport () { 1747 if (hasRequiredToStringTagSupport) return toStringTagSupport; 1748 hasRequiredToStringTagSupport = 1; 1749 var wellKnownSymbol = requireWellKnownSymbol(); 1750 1751 var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 1752 var test = {}; 1753 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 1754 test[TO_STRING_TAG] = 'z'; 1755 1756 toStringTagSupport = String(test) === '[object z]'; 1757 return toStringTagSupport; 1758} 1759 1760var classof; 1761var hasRequiredClassof; 1762 1763function requireClassof () { 1764 if (hasRequiredClassof) return classof; 1765 hasRequiredClassof = 1; 1766 var TO_STRING_TAG_SUPPORT = requireToStringTagSupport(); 1767 var isCallable = requireIsCallable(); 1768 var classofRaw = requireClassofRaw(); 1769 var wellKnownSymbol = requireWellKnownSymbol(); 1770 1771 var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 1772 var $Object = Object; 1773 1774 // ES3 wrong here 1775 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments'; 1776 1777 // fallback for IE11 Script Access Denied error 1778 var tryGet = function (it, key) { 1779 try { 1780 return it[key]; 1781 } catch (error) { /* empty */ } 1782 }; 1783 1784 // getting tag from ES6+ `Object.prototype.toString` 1785 classof = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { 1786 var O, tag, result; 1787 return it === undefined ? 'Undefined' : it === null ? 'Null' 1788 // @@toStringTag case 1789 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag 1790 // builtinTag case 1791 : CORRECT_ARGUMENTS ? classofRaw(O) 1792 // ES3 arguments fallback 1793 : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result; 1794 }; 1795 return classof; 1796} 1797 1798var isConstructor; 1799var hasRequiredIsConstructor; 1800 1801function requireIsConstructor () { 1802 if (hasRequiredIsConstructor) return isConstructor; 1803 hasRequiredIsConstructor = 1; 1804 var uncurryThis = requireFunctionUncurryThis(); 1805 var fails = requireFails(); 1806 var isCallable = requireIsCallable(); 1807 var classof = requireClassof(); 1808 var getBuiltIn = requireGetBuiltIn(); 1809 var inspectSource = requireInspectSource(); 1810 1811 var noop = function () { /* empty */ }; 1812 var construct = getBuiltIn('Reflect', 'construct'); 1813 var constructorRegExp = /^\s*(?:class|function)\b/; 1814 var exec = uncurryThis(constructorRegExp.exec); 1815 var INCORRECT_TO_STRING = !constructorRegExp.test(noop); 1816 1817 var isConstructorModern = function isConstructor(argument) { 1818 if (!isCallable(argument)) return false; 1819 try { 1820 construct(noop, [], argument); 1821 return true; 1822 } catch (error) { 1823 return false; 1824 } 1825 }; 1826 1827 var isConstructorLegacy = function isConstructor(argument) { 1828 if (!isCallable(argument)) return false; 1829 switch (classof(argument)) { 1830 case 'AsyncFunction': 1831 case 'GeneratorFunction': 1832 case 'AsyncGeneratorFunction': return false; 1833 } 1834 try { 1835 // we can't check .prototype since constructors produced by .bind haven't it 1836 // `Function#toString` throws on some built-it function in some legacy engines 1837 // (for example, `DOMQuad` and similar in FF41-) 1838 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); 1839 } catch (error) { 1840 return true; 1841 } 1842 }; 1843 1844 isConstructorLegacy.sham = true; 1845 1846 // `IsConstructor` abstract operation 1847 // https://tc39.es/ecma262/#sec-isconstructor 1848 isConstructor = !construct || fails(function () { 1849 var called; 1850 return isConstructorModern(isConstructorModern.call) 1851 || !isConstructorModern(Object) 1852 || !isConstructorModern(function () { called = true; }) 1853 || called; 1854 }) ? isConstructorLegacy : isConstructorModern; 1855 return isConstructor; 1856} 1857 1858var aConstructor; 1859var hasRequiredAConstructor; 1860 1861function requireAConstructor () { 1862 if (hasRequiredAConstructor) return aConstructor; 1863 hasRequiredAConstructor = 1; 1864 var isConstructor = requireIsConstructor(); 1865 var tryToString = requireTryToString(); 1866 1867 var $TypeError = TypeError; 1868 1869 // `Assert: IsConstructor(argument) is true` 1870 aConstructor = function (argument) { 1871 if (isConstructor(argument)) return argument; 1872 throw new $TypeError(tryToString(argument) + ' is not a constructor'); 1873 }; 1874 return aConstructor; 1875} 1876 1877var speciesConstructor; 1878var hasRequiredSpeciesConstructor; 1879 1880function requireSpeciesConstructor () { 1881 if (hasRequiredSpeciesConstructor) return speciesConstructor; 1882 hasRequiredSpeciesConstructor = 1; 1883 var anObject = requireAnObject(); 1884 var aConstructor = requireAConstructor(); 1885 var isNullOrUndefined = requireIsNullOrUndefined(); 1886 var wellKnownSymbol = requireWellKnownSymbol(); 1887 1888 var SPECIES = wellKnownSymbol('species'); 1889 1890 // `SpeciesConstructor` abstract operation 1891 // https://tc39.es/ecma262/#sec-speciesconstructor 1892 speciesConstructor = function (O, defaultConstructor) { 1893 var C = anObject(O).constructor; 1894 var S; 1895 return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S); 1896 }; 1897 return speciesConstructor; 1898} 1899 1900var functionApply; 1901var hasRequiredFunctionApply; 1902 1903function requireFunctionApply () { 1904 if (hasRequiredFunctionApply) return functionApply; 1905 hasRequiredFunctionApply = 1; 1906 var NATIVE_BIND = requireFunctionBindNative(); 1907 1908 var FunctionPrototype = Function.prototype; 1909 var apply = FunctionPrototype.apply; 1910 var call = FunctionPrototype.call; 1911 1912 // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe 1913 functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { 1914 return call.apply(apply, arguments); 1915 }); 1916 return functionApply; 1917} 1918 1919var functionUncurryThisClause; 1920var hasRequiredFunctionUncurryThisClause; 1921 1922function requireFunctionUncurryThisClause () { 1923 if (hasRequiredFunctionUncurryThisClause) return functionUncurryThisClause; 1924 hasRequiredFunctionUncurryThisClause = 1; 1925 var classofRaw = requireClassofRaw(); 1926 var uncurryThis = requireFunctionUncurryThis(); 1927 1928 functionUncurryThisClause = function (fn) { 1929 // Nashorn bug: 1930 // https://github.com/zloirock/core-js/issues/1128 1931 // https://github.com/zloirock/core-js/issues/1130 1932 if (classofRaw(fn) === 'Function') return uncurryThis(fn); 1933 }; 1934 return functionUncurryThisClause; 1935} 1936 1937var functionBindContext; 1938var hasRequiredFunctionBindContext; 1939 1940function requireFunctionBindContext () { 1941 if (hasRequiredFunctionBindContext) return functionBindContext; 1942 hasRequiredFunctionBindContext = 1; 1943 var uncurryThis = requireFunctionUncurryThisClause(); 1944 var aCallable = requireACallable(); 1945 var NATIVE_BIND = requireFunctionBindNative(); 1946 1947 var bind = uncurryThis(uncurryThis.bind); 1948
vendor: 17,165 bytes, lines 1949-2487
1949 // optional / simple context binding 1950 functionBindContext = function (fn, that) { 1951 aCallable(fn); 1952 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { 1953 return fn.apply(that, arguments); 1954 }; 1955 }; 1956 return functionBindContext; 1957} 1958 1959var html; 1960var hasRequiredHtml; 1961 1962function requireHtml () { 1963 if (hasRequiredHtml) return html; 1964 hasRequiredHtml = 1; 1965 var getBuiltIn = requireGetBuiltIn(); 1966 1967 html = getBuiltIn('document', 'documentElement'); 1968 return html; 1969} 1970 1971var arraySlice; 1972var hasRequiredArraySlice; 1973 1974function requireArraySlice () { 1975 if (hasRequiredArraySlice) return arraySlice; 1976 hasRequiredArraySlice = 1; 1977 var uncurryThis = requireFunctionUncurryThis(); 1978 1979 arraySlice = uncurryThis([].slice); 1980 return arraySlice; 1981} 1982 1983var validateArgumentsLength; 1984var hasRequiredValidateArgumentsLength; 1985 1986function requireValidateArgumentsLength () { 1987 if (hasRequiredValidateArgumentsLength) return validateArgumentsLength; 1988 hasRequiredValidateArgumentsLength = 1; 1989 var $TypeError = TypeError; 1990 1991 validateArgumentsLength = function (passed, required) { 1992 if (passed < required) throw new $TypeError('Not enough arguments'); 1993 return passed; 1994 }; 1995 return validateArgumentsLength; 1996} 1997 1998var environmentIsIos; 1999var hasRequiredEnvironmentIsIos; 2000 2001function requireEnvironmentIsIos () { 2002 if (hasRequiredEnvironmentIsIos) return environmentIsIos; 2003 hasRequiredEnvironmentIsIos = 1; 2004 var userAgent = requireEnvironmentUserAgent(); 2005 2006 environmentIsIos = /ipad|iphone|ipod/i.test(userAgent) && /applewebkit/i.test(userAgent); 2007 return environmentIsIos; 2008} 2009 2010var task; 2011var hasRequiredTask; 2012 2013function requireTask () { 2014 if (hasRequiredTask) return task; 2015 hasRequiredTask = 1; 2016 var globalThis = requireGlobalThis(); 2017 var apply = requireFunctionApply(); 2018 var bind = requireFunctionBindContext(); 2019 var isCallable = requireIsCallable(); 2020 var hasOwn = requireHasOwnProperty(); 2021 var fails = requireFails(); 2022 var html = requireHtml(); 2023 var arraySlice = requireArraySlice(); 2024 var createElement = requireDocumentCreateElement(); 2025 var validateArgumentsLength = requireValidateArgumentsLength(); 2026 var IS_IOS = requireEnvironmentIsIos(); 2027 var IS_NODE = requireEnvironmentIsNode(); 2028 2029 var set = globalThis.setImmediate; 2030 var clear = globalThis.clearImmediate; 2031 var process = globalThis.process; 2032 var Dispatch = globalThis.Dispatch; 2033 var Function = globalThis.Function; 2034 var MessageChannel = globalThis.MessageChannel; 2035 var String = globalThis.String; 2036 var counter = 0; 2037 var queue = {}; 2038 var ONREADYSTATECHANGE = 'onreadystatechange'; 2039 var $location, defer, channel, port; 2040 2041 fails(function () { 2042 // Deno throws a ReferenceError on `location` access without `--location` flag 2043 $location = globalThis.location; 2044 }); 2045 2046 var run = function (id) { 2047 if (hasOwn(queue, id)) { 2048 var fn = queue[id]; 2049 delete queue[id]; 2050 fn(); 2051 } 2052 }; 2053 2054 var runner = function (id) { 2055 return function () { 2056 run(id); 2057 }; 2058 }; 2059 2060 var eventListener = function (event) { 2061 run(event.data); 2062 }; 2063 2064 var globalPostMessageDefer = function (id) { 2065 // old engines have not location.origin 2066 globalThis.postMessage(String(id), $location.protocol + '//' + $location.host); 2067 }; 2068 2069 // Node.js 0.9+ & IE10+ has setImmediate, otherwise: 2070 if (!set || !clear) { 2071 set = function setImmediate(handler) { 2072 validateArgumentsLength(arguments.length, 1); 2073 var fn = isCallable(handler) ? handler : Function(handler); 2074 var args = arraySlice(arguments, 1); 2075 queue[++counter] = function () { 2076 apply(fn, undefined, args); 2077 }; 2078 defer(counter); 2079 return counter; 2080 }; 2081 clear = function clearImmediate(id) { 2082 delete queue[id]; 2083 }; 2084 // Node.js 0.8- 2085 if (IS_NODE) { 2086 defer = function (id) { 2087 process.nextTick(runner(id)); 2088 }; 2089 // Sphere (JS game engine) Dispatch API 2090 } else if (Dispatch && Dispatch.now) { 2091 defer = function (id) { 2092 Dispatch.now(runner(id)); 2093 }; 2094 // Browsers with MessageChannel, includes WebWorkers 2095 // except iOS - https://github.com/zloirock/core-js/issues/624 2096 } else if (MessageChannel && !IS_IOS) { 2097 channel = new MessageChannel(); 2098 port = channel.port2; 2099 channel.port1.onmessage = eventListener; 2100 defer = bind(port.postMessage, port); 2101 // Browsers with postMessage, skip WebWorkers 2102 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' 2103 } else if ( 2104 globalThis.addEventListener && 2105 isCallable(globalThis.postMessage) && 2106 !globalThis.importScripts && 2107 $location && $location.protocol !== 'file:' && 2108 !fails(globalPostMessageDefer) 2109 ) { 2110 defer = globalPostMessageDefer; 2111 globalThis.addEventListener('message', eventListener, false); 2112 // IE8- 2113 } else if (ONREADYSTATECHANGE in createElement('script')) { 2114 defer = function (id) { 2115 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { 2116 html.removeChild(this); 2117 run(id); 2118 }; 2119 }; 2120 // Rest old browsers 2121 } else { 2122 defer = function (id) { 2123 setTimeout(runner(id), 0); 2124 }; 2125 } 2126 } 2127 2128 task = { 2129 set: set, 2130 clear: clear 2131 }; 2132 return task; 2133} 2134 2135var safeGetBuiltIn; 2136var hasRequiredSafeGetBuiltIn; 2137 2138function requireSafeGetBuiltIn () { 2139 if (hasRequiredSafeGetBuiltIn) return safeGetBuiltIn; 2140 hasRequiredSafeGetBuiltIn = 1; 2141 var globalThis = requireGlobalThis(); 2142 var DESCRIPTORS = requireDescriptors(); 2143 2144 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 2145 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 2146 2147 // Avoid NodeJS experimental warning 2148 safeGetBuiltIn = function (name) { 2149 if (!DESCRIPTORS) return globalThis[name]; 2150 var descriptor = getOwnPropertyDescriptor(globalThis, name); 2151 return descriptor && descriptor.value; 2152 }; 2153 return safeGetBuiltIn; 2154} 2155 2156var queue; 2157var hasRequiredQueue; 2158 2159function requireQueue () { 2160 if (hasRequiredQueue) return queue; 2161 hasRequiredQueue = 1; 2162 var Queue = function () { 2163 this.head = null; 2164 this.tail = null; 2165 }; 2166 2167 Queue.prototype = { 2168 add: function (item) { 2169 var entry = { item: item, next: null }; 2170 var tail = this.tail; 2171 if (tail) tail.next = entry; 2172 else this.head = entry; 2173 this.tail = entry; 2174 }, 2175 get: function () { 2176 var entry = this.head; 2177 if (entry) { 2178 var next = this.head = entry.next; 2179 if (next === null) this.tail = null; 2180 return entry.item; 2181 } 2182 } 2183 }; 2184 2185 queue = Queue; 2186 return queue; 2187} 2188 2189var environmentIsIosPebble; 2190var hasRequiredEnvironmentIsIosPebble; 2191 2192function requireEnvironmentIsIosPebble () { 2193 if (hasRequiredEnvironmentIsIosPebble) return environmentIsIosPebble; 2194 hasRequiredEnvironmentIsIosPebble = 1; 2195 var userAgent = requireEnvironmentUserAgent(); 2196 2197 environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent) && typeof Pebble != 'undefined'; 2198 return environmentIsIosPebble; 2199} 2200 2201var environmentIsWebosWebkit; 2202var hasRequiredEnvironmentIsWebosWebkit; 2203 2204function requireEnvironmentIsWebosWebkit () { 2205 if (hasRequiredEnvironmentIsWebosWebkit) return environmentIsWebosWebkit; 2206 hasRequiredEnvironmentIsWebosWebkit = 1; 2207 var userAgent = requireEnvironmentUserAgent(); 2208 2209 environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent); 2210 return environmentIsWebosWebkit; 2211} 2212 2213var microtask_1; 2214var hasRequiredMicrotask; 2215 2216function requireMicrotask () { 2217 if (hasRequiredMicrotask) return microtask_1; 2218 hasRequiredMicrotask = 1; 2219 var globalThis = requireGlobalThis(); 2220 var safeGetBuiltIn = requireSafeGetBuiltIn(); 2221 var bind = requireFunctionBindContext(); 2222 var macrotask = requireTask().set; 2223 var Queue = requireQueue(); 2224 var IS_IOS = requireEnvironmentIsIos(); 2225 var IS_IOS_PEBBLE = requireEnvironmentIsIosPebble(); 2226 var IS_WEBOS_WEBKIT = requireEnvironmentIsWebosWebkit(); 2227 var IS_NODE = requireEnvironmentIsNode(); 2228 2229 var MutationObserver = globalThis.MutationObserver || globalThis.WebKitMutationObserver; 2230 var document = globalThis.document; 2231 var process = globalThis.process; 2232 var Promise = globalThis.Promise; 2233 var microtask = safeGetBuiltIn('queueMicrotask'); 2234 var notify, toggle, node, promise, then; 2235 2236 // modern engines have queueMicrotask method 2237 if (!microtask) { 2238 var queue = new Queue(); 2239 2240 var flush = function () { 2241 var parent, fn; 2242 if (IS_NODE && (parent = process.domain)) parent.exit(); 2243 while (fn = queue.get()) try { 2244 fn(); 2245 } catch (error) { 2246 if (queue.head) notify(); 2247 throw error; 2248 } 2249 if (parent) parent.enter(); 2250 }; 2251 2252 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 2253 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 2254 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) { 2255 toggle = true; 2256 node = document.createTextNode(''); 2257 new MutationObserver(flush).observe(node, { characterData: true }); 2258 notify = function () { 2259 node.data = toggle = !toggle; 2260 }; 2261 // environments with maybe non-completely correct, but existent Promise 2262 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) { 2263 // Promise.resolve without an argument throws an error in LG WebOS 2 2264 promise = Promise.resolve(undefined); 2265 // workaround of WebKit ~ iOS Safari 10.1 bug 2266 promise.constructor = Promise; 2267 then = bind(promise.then, promise); 2268 notify = function () { 2269 then(flush); 2270 }; 2271 // Node.js without promises 2272 } else if (IS_NODE) { 2273 notify = function () { 2274 process.nextTick(flush); 2275 }; 2276 // for other environments - macrotask based on: 2277 // - setImmediate 2278 // - MessageChannel 2279 // - window.postMessage 2280 // - onreadystatechange 2281 // - setTimeout 2282 } else { 2283 // `webpack` dev server bug on IE global methods - use bind(fn, global) 2284 macrotask = bind(macrotask, globalThis); 2285 notify = function () { 2286 macrotask(flush); 2287 }; 2288 } 2289 2290 microtask = function (fn) { 2291 if (!queue.head) notify(); 2292 queue.add(fn); 2293 }; 2294 } 2295 2296 microtask_1 = microtask; 2297 return microtask_1; 2298} 2299 2300var hostReportErrors; 2301var hasRequiredHostReportErrors; 2302 2303function requireHostReportErrors () { 2304 if (hasRequiredHostReportErrors) return hostReportErrors; 2305 hasRequiredHostReportErrors = 1; 2306 hostReportErrors = function (a, b) { 2307 try { 2308 // eslint-disable-next-line no-console -- safe 2309 arguments.length === 1 ? console.error(a) : console.error(a, b); 2310 } catch (error) { /* empty */ } 2311 }; 2312 return hostReportErrors; 2313} 2314 2315var perform; 2316var hasRequiredPerform; 2317 2318function requirePerform () { 2319 if (hasRequiredPerform) return perform; 2320 hasRequiredPerform = 1; 2321 perform = function (exec) { 2322 try { 2323 return { error: false, value: exec() }; 2324 } catch (error) { 2325 return { error: true, value: error }; 2326 } 2327 }; 2328 return perform; 2329} 2330 2331var promiseNativeConstructor; 2332var hasRequiredPromiseNativeConstructor; 2333 2334function requirePromiseNativeConstructor () { 2335 if (hasRequiredPromiseNativeConstructor) return promiseNativeConstructor; 2336 hasRequiredPromiseNativeConstructor = 1; 2337 var globalThis = requireGlobalThis(); 2338 2339 promiseNativeConstructor = globalThis.Promise; 2340 return promiseNativeConstructor; 2341} 2342 2343var promiseConstructorDetection; 2344var hasRequiredPromiseConstructorDetection; 2345 2346function requirePromiseConstructorDetection () { 2347 if (hasRequiredPromiseConstructorDetection) return promiseConstructorDetection; 2348 hasRequiredPromiseConstructorDetection = 1; 2349 var globalThis = requireGlobalThis(); 2350 var NativePromiseConstructor = requirePromiseNativeConstructor(); 2351 var isCallable = requireIsCallable(); 2352 var isForced = requireIsForced(); 2353 var inspectSource = requireInspectSource(); 2354 var wellKnownSymbol = requireWellKnownSymbol(); 2355 var ENVIRONMENT = requireEnvironment(); 2356 var IS_PURE = requireIsPure(); 2357 var V8_VERSION = requireEnvironmentV8Version(); 2358 2359 var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; 2360 var SPECIES = wellKnownSymbol('species'); 2361 var SUBCLASSING = false; 2362 var NATIVE_PROMISE_REJECTION_EVENT = isCallable(globalThis.PromiseRejectionEvent); 2363 2364 var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () { 2365 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor); 2366 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor); 2367 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables 2368 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 2369 // We can't detect it synchronously, so just check versions 2370 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; 2371 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution 2372 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true; 2373 // We can't use @@species feature detection in V8 since it causes 2374 // deoptimization and performance degradation 2375 // https://github.com/zloirock/core-js/issues/679 2376 if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { 2377 // Detect correctness of subclassing with @@species support 2378 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); }); 2379 var FakePromise = function (exec) { 2380 exec(function () { /* empty */ }, function () { /* empty */ }); 2381 }; 2382 var constructor = promise.constructor = {}; 2383 constructor[SPECIES] = FakePromise; 2384 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; 2385 if (!SUBCLASSING) return true; 2386 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test 2387 } return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT; 2388 }); 2389 2390 promiseConstructorDetection = { 2391 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR, 2392 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT, 2393 SUBCLASSING: SUBCLASSING 2394 }; 2395 return promiseConstructorDetection; 2396} 2397 2398var newPromiseCapability = {}; 2399 2400var hasRequiredNewPromiseCapability; 2401 2402function requireNewPromiseCapability () { 2403 if (hasRequiredNewPromiseCapability) return newPromiseCapability; 2404 hasRequiredNewPromiseCapability = 1; 2405 var aCallable = requireACallable(); 2406 2407 var $TypeError = TypeError; 2408 2409 var PromiseCapability = function (C) { 2410 var resolve, reject; 2411 this.promise = new C(function ($$resolve, $$reject) { 2412 if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor'); 2413 resolve = $$resolve; 2414 reject = $$reject; 2415 }); 2416 this.resolve = aCallable(resolve); 2417 this.reject = aCallable(reject); 2418 }; 2419 2420 // `NewPromiseCapability` abstract operation 2421 // https://tc39.es/ecma262/#sec-newpromisecapability 2422 newPromiseCapability.f = function (C) { 2423 return new PromiseCapability(C); 2424 }; 2425 return newPromiseCapability; 2426} 2427 2428var hasRequiredEs_promise_constructor; 2429 2430function requireEs_promise_constructor () { 2431 if (hasRequiredEs_promise_constructor) return es_promise_constructor; 2432 hasRequiredEs_promise_constructor = 1; 2433 var $ = require_export(); 2434 var IS_PURE = requireIsPure(); 2435 var IS_NODE = requireEnvironmentIsNode(); 2436 var globalThis = requireGlobalThis(); 2437 var path = requirePath(); 2438 var call = requireFunctionCall(); 2439 var defineBuiltIn = requireDefineBuiltIn(); 2440 var setPrototypeOf = requireObjectSetPrototypeOf(); 2441 var setToStringTag = requireSetToStringTag(); 2442 var setSpecies = requireSetSpecies(); 2443 var aCallable = requireACallable(); 2444 var isCallable = requireIsCallable(); 2445 var isObject = requireIsObject(); 2446 var anInstance = requireAnInstance(); 2447 var speciesConstructor = requireSpeciesConstructor(); 2448 var task = requireTask().set; 2449 var microtask = requireMicrotask(); 2450 var hostReportErrors = requireHostReportErrors(); 2451 var perform = requirePerform(); 2452 var Queue = requireQueue(); 2453 var InternalStateModule = requireInternalState(); 2454 var NativePromiseConstructor = requirePromiseNativeConstructor(); 2455 var PromiseConstructorDetection = requirePromiseConstructorDetection(); 2456 var newPromiseCapabilityModule = requireNewPromiseCapability(); 2457 2458 var PROMISE = 'Promise'; 2459 var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR; 2460 var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT; 2461 var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING; 2462 var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); 2463 var setInternalState = InternalStateModule.set; 2464 var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; 2465 var PromiseConstructor = NativePromiseConstructor; 2466 var PromisePrototype = NativePromisePrototype; 2467 var TypeError = globalThis.TypeError; 2468 var document = globalThis.document; 2469 var process = globalThis.process; 2470 var newPromiseCapability = newPromiseCapabilityModule.f; 2471 var newGenericPromiseCapability = newPromiseCapability; 2472 2473 var DISPATCH_EVENT = !!(document && document.createEvent && globalThis.dispatchEvent); 2474 var UNHANDLED_REJECTION = 'unhandledrejection'; 2475 var REJECTION_HANDLED = 'rejectionhandled'; 2476 var PENDING = 0; 2477 var FULFILLED = 1; 2478 var REJECTED = 2; 2479 var HANDLED = 1; 2480 var UNHANDLED = 2; 2481 2482 var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; 2483 2484 // helpers 2485 var isThenable = function (it) { 2486 var then; 2487 return isObject(it) && isCallable(then = it.then) ? then : false;
vendor: 5,350 bytes, lines 2488-2664
2488 }; 2489 2490 var callReaction = function (reaction, state) { 2491 var value = state.value; 2492 var ok = state.state === FULFILLED; 2493 var handler = ok ? reaction.ok : reaction.fail; 2494 var resolve = reaction.resolve; 2495 var reject = reaction.reject; 2496 var domain = reaction.domain; 2497 var result, then, exited; 2498 try { 2499 if (handler) { 2500 if (!ok) { 2501 if (state.rejection === UNHANDLED) onHandleUnhandled(state); 2502 state.rejection = HANDLED; 2503 } 2504 if (handler === true) result = value; 2505 else { 2506 if (domain) domain.enter(); 2507 result = handler(value); // can throw 2508 if (domain) { 2509 domain.exit(); 2510 exited = true; 2511 } 2512 } 2513 if (result === reaction.promise) { 2514 reject(new TypeError('Promise-chain cycle')); 2515 } else if (then = isThenable(result)) { 2516 call(then, result, resolve, reject); 2517 } else resolve(result); 2518 } else reject(value); 2519 } catch (error) { 2520 if (domain && !exited) domain.exit(); 2521 reject(error); 2522 } 2523 }; 2524 2525 var notify = function (state, isReject) { 2526 if (state.notified) return; 2527 state.notified = true; 2528 microtask(function () { 2529 var reactions = state.reactions; 2530 var reaction; 2531 while (reaction = reactions.get()) { 2532 callReaction(reaction, state); 2533 } 2534 state.notified = false; 2535 if (isReject && !state.rejection) onUnhandled(state); 2536 }); 2537 }; 2538 2539 var dispatchEvent = function (name, promise, reason) { 2540 var event, handler; 2541 if (DISPATCH_EVENT) { 2542 event = document.createEvent('Event'); 2543 event.promise = promise; 2544 event.reason = reason; 2545 event.initEvent(name, false, true); 2546 globalThis.dispatchEvent(event); 2547 } else event = { promise: promise, reason: reason }; 2548 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis['on' + name])) handler(event); 2549 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); 2550 }; 2551 2552 var onUnhandled = function (state) { 2553 call(task, globalThis, function () { 2554 var promise = state.facade; 2555 var value = state.value; 2556 var IS_UNHANDLED = isUnhandled(state); 2557 var result; 2558 if (IS_UNHANDLED) { 2559 result = perform(function () { 2560 if (IS_NODE) { 2561 process.emit('unhandledRejection', value, promise); 2562 } else dispatchEvent(UNHANDLED_REJECTION, promise, value); 2563 }); 2564 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should 2565 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; 2566 if (result.error) throw result.value; 2567 } 2568 }); 2569 }; 2570 2571 var isUnhandled = function (state) { 2572 return state.rejection !== HANDLED && !state.parent; 2573 }; 2574 2575 var onHandleUnhandled = function (state) { 2576 call(task, globalThis, function () { 2577 var promise = state.facade; 2578 if (IS_NODE) { 2579 process.emit('rejectionHandled', promise); 2580 } else dispatchEvent(REJECTION_HANDLED, promise, state.value); 2581 }); 2582 }; 2583 2584 var bind = function (fn, state, unwrap) { 2585 return function (value) { 2586 fn(state, value, unwrap); 2587 }; 2588 }; 2589 2590 var internalReject = function (state, value, unwrap) { 2591 if (state.done) return; 2592 state.done = true; 2593 if (unwrap) state = unwrap; 2594 state.value = value; 2595 state.state = REJECTED; 2596 notify(state, true); 2597 }; 2598 2599 var internalResolve = function (state, value, unwrap) { 2600 if (state.done) return; 2601 state.done = true; 2602 if (unwrap) state = unwrap; 2603 try { 2604 if (state.facade === value) throw new TypeError("Promise can't be resolved itself"); 2605 var then = isThenable(value); 2606 if (then) { 2607 microtask(function () { 2608 var wrapper = { done: false }; 2609 try { 2610 call(then, value, 2611 bind(internalResolve, wrapper, state), 2612 bind(internalReject, wrapper, state) 2613 ); 2614 } catch (error) { 2615 internalReject(wrapper, error, state); 2616 } 2617 }); 2618 } else { 2619 state.value = value; 2620 state.state = FULFILLED; 2621 notify(state, false); 2622 } 2623 } catch (error) { 2624 internalReject({ done: false }, error, state); 2625 } 2626 }; 2627 2628 // constructor polyfill 2629 if (FORCED_PROMISE_CONSTRUCTOR) { 2630 // 25.4.3.1 Promise(executor) 2631 PromiseConstructor = function Promise(executor) { 2632 anInstance(this, PromisePrototype); 2633 aCallable(executor); 2634 call(Internal, this); 2635 var state = getInternalPromiseState(this); 2636 try { 2637 executor(bind(internalResolve, state), bind(internalReject, state)); 2638 } catch (error) { 2639 internalReject(state, error); 2640 } 2641 }; 2642 2643 PromisePrototype = PromiseConstructor.prototype; 2644 2645 // eslint-disable-next-line no-unused-vars -- required for `.length` 2646 Internal = function Promise(executor) { 2647 setInternalState(this, { 2648 type: PROMISE, 2649 done: false, 2650 notified: false, 2651 parent: false, 2652 reactions: new Queue(), 2653 rejection: false, 2654 state: PENDING, 2655 value: null 2656 }); 2657 }; 2658 2659 // `Promise.prototype.then` method 2660 // https://tc39.es/ecma262/#sec-promise.prototype.then 2661 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) { 2662 var state = getInternalPromiseState(this); 2663 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); 2664 state.parent = true;
vendor: 16,869 bytes, lines 2665-3179
2665 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; 2666 reaction.fail = isCallable(onRejected) && onRejected; 2667 reaction.domain = IS_NODE ? process.domain : undefined; 2668 if (state.state === PENDING) state.reactions.add(reaction); 2669 else microtask(function () { 2670 callReaction(reaction, state); 2671 }); 2672 return reaction.promise; 2673 }); 2674 2675 OwnPromiseCapability = function () { 2676 var promise = new Internal(); 2677 var state = getInternalPromiseState(promise); 2678 this.promise = promise; 2679 this.resolve = bind(internalResolve, state); 2680 this.reject = bind(internalReject, state); 2681 }; 2682 2683 newPromiseCapabilityModule.f = newPromiseCapability = function (C) { 2684 return C === PromiseConstructor || C === PromiseWrapper 2685 ? new OwnPromiseCapability(C) 2686 : newGenericPromiseCapability(C); 2687 }; 2688 2689 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) { 2690 nativeThen = NativePromisePrototype.then; 2691 2692 if (!NATIVE_PROMISE_SUBCLASSING) { 2693 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs 2694 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { 2695 var that = this; 2696 return new PromiseConstructor(function (resolve, reject) { 2697 call(nativeThen, that, resolve, reject); 2698 }).then(onFulfilled, onRejected); 2699 // https://github.com/zloirock/core-js/issues/640 2700 }, { unsafe: true }); 2701 } 2702 2703 // make `.constructor === Promise` work for native promise-based APIs 2704 try { 2705 delete NativePromisePrototype.constructor; 2706 } catch (error) { /* empty */ } 2707 2708 // make `instanceof Promise` work for native promise-based APIs 2709 if (setPrototypeOf) { 2710 setPrototypeOf(NativePromisePrototype, PromisePrototype); 2711 } 2712 } 2713 } 2714 2715 // `Promise` constructor 2716 // https://tc39.es/ecma262/#sec-promise-executor 2717 $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { 2718 Promise: PromiseConstructor 2719 }); 2720 2721 PromiseWrapper = path.Promise; 2722 2723 setToStringTag(PromiseConstructor, PROMISE, false, true); 2724 setSpecies(PROMISE); 2725 return es_promise_constructor; 2726} 2727 2728var es_promise_all = {}; 2729 2730var iterators; 2731var hasRequiredIterators; 2732 2733function requireIterators () { 2734 if (hasRequiredIterators) return iterators; 2735 hasRequiredIterators = 1; 2736 iterators = {}; 2737 return iterators; 2738} 2739 2740var isArrayIteratorMethod; 2741var hasRequiredIsArrayIteratorMethod; 2742 2743function requireIsArrayIteratorMethod () { 2744 if (hasRequiredIsArrayIteratorMethod) return isArrayIteratorMethod; 2745 hasRequiredIsArrayIteratorMethod = 1; 2746 var wellKnownSymbol = requireWellKnownSymbol(); 2747 var Iterators = requireIterators(); 2748 2749 var ITERATOR = wellKnownSymbol('iterator'); 2750 var ArrayPrototype = Array.prototype; 2751 2752 // check on default Array iterator 2753 isArrayIteratorMethod = function (it) { 2754 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); 2755 }; 2756 return isArrayIteratorMethod; 2757} 2758 2759var getIteratorMethod; 2760var hasRequiredGetIteratorMethod; 2761 2762function requireGetIteratorMethod () { 2763 if (hasRequiredGetIteratorMethod) return getIteratorMethod; 2764 hasRequiredGetIteratorMethod = 1; 2765 var classof = requireClassof(); 2766 var getMethod = requireGetMethod(); 2767 var isNullOrUndefined = requireIsNullOrUndefined(); 2768 var Iterators = requireIterators(); 2769 var wellKnownSymbol = requireWellKnownSymbol(); 2770 2771 var ITERATOR = wellKnownSymbol('iterator'); 2772 2773 getIteratorMethod = function (it) { 2774 if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) 2775 || getMethod(it, '@@iterator') 2776 || Iterators[classof(it)]; 2777 }; 2778 return getIteratorMethod; 2779} 2780 2781var getIterator; 2782var hasRequiredGetIterator; 2783 2784function requireGetIterator () { 2785 if (hasRequiredGetIterator) return getIterator; 2786 hasRequiredGetIterator = 1; 2787 var call = requireFunctionCall(); 2788 var aCallable = requireACallable(); 2789 var anObject = requireAnObject(); 2790 var tryToString = requireTryToString(); 2791 var getIteratorMethod = requireGetIteratorMethod(); 2792 2793 var $TypeError = TypeError; 2794 2795 getIterator = function (argument, usingIterator) { 2796 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; 2797 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); 2798 throw new $TypeError(tryToString(argument) + ' is not iterable'); 2799 }; 2800 return getIterator; 2801} 2802 2803var iteratorClose; 2804var hasRequiredIteratorClose; 2805 2806function requireIteratorClose () { 2807 if (hasRequiredIteratorClose) return iteratorClose; 2808 hasRequiredIteratorClose = 1; 2809 var call = requireFunctionCall(); 2810 var anObject = requireAnObject(); 2811 var getMethod = requireGetMethod(); 2812 2813 iteratorClose = function (iterator, kind, value) { 2814 var innerResult, innerError; 2815 anObject(iterator); 2816 try { 2817 innerResult = getMethod(iterator, 'return'); 2818 if (!innerResult) { 2819 if (kind === 'throw') throw value; 2820 return value; 2821 } 2822 innerResult = call(innerResult, iterator); 2823 } catch (error) { 2824 innerError = true; 2825 innerResult = error; 2826 } 2827 if (kind === 'throw') throw value; 2828 if (innerError) throw innerResult; 2829 anObject(innerResult); 2830 return value; 2831 }; 2832 return iteratorClose; 2833} 2834 2835var iterate; 2836var hasRequiredIterate; 2837 2838function requireIterate () { 2839 if (hasRequiredIterate) return iterate; 2840 hasRequiredIterate = 1; 2841 var bind = requireFunctionBindContext(); 2842 var call = requireFunctionCall(); 2843 var anObject = requireAnObject(); 2844 var tryToString = requireTryToString(); 2845 var isArrayIteratorMethod = requireIsArrayIteratorMethod(); 2846 var lengthOfArrayLike = requireLengthOfArrayLike(); 2847 var isPrototypeOf = requireObjectIsPrototypeOf(); 2848 var getIterator = requireGetIterator(); 2849 var getIteratorMethod = requireGetIteratorMethod(); 2850 var iteratorClose = requireIteratorClose(); 2851 2852 var $TypeError = TypeError; 2853 2854 var Result = function (stopped, result) { 2855 this.stopped = stopped; 2856 this.result = result; 2857 }; 2858 2859 var ResultPrototype = Result.prototype; 2860 2861 iterate = function (iterable, unboundFunction, options) { 2862 var that = options && options.that; 2863 var AS_ENTRIES = !!(options && options.AS_ENTRIES); 2864 var IS_RECORD = !!(options && options.IS_RECORD); 2865 var IS_ITERATOR = !!(options && options.IS_ITERATOR); 2866 var INTERRUPTED = !!(options && options.INTERRUPTED); 2867 var fn = bind(unboundFunction, that); 2868 var iterator, iterFn, index, length, result, next, step; 2869 2870 var stop = function (condition) { 2871 var $iterator = iterator; 2872 iterator = undefined; 2873 if ($iterator) iteratorClose($iterator, 'normal'); 2874 return new Result(true, condition); 2875 }; 2876 2877 var callFn = function (value) { 2878 if (AS_ENTRIES) { 2879 anObject(value); 2880 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); 2881 } return INTERRUPTED ? fn(value, stop) : fn(value); 2882 }; 2883 2884 if (IS_RECORD) { 2885 iterator = iterable.iterator; 2886 } else if (IS_ITERATOR) { 2887 iterator = iterable; 2888 } else { 2889 iterFn = getIteratorMethod(iterable); 2890 if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable'); 2891 // optimisation for array iterators 2892 if (isArrayIteratorMethod(iterFn)) { 2893 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { 2894 result = callFn(iterable[index]); 2895 if (result && isPrototypeOf(ResultPrototype, result)) return result; 2896 } return new Result(false); 2897 } 2898 iterator = getIterator(iterable, iterFn); 2899 } 2900 2901 next = IS_RECORD ? iterable.next : iterator.next; 2902 while (!(step = call(next, iterator)).done) { 2903 // `IteratorValue` errors should propagate without closing the iterator 2904 var value = step.value; 2905 try { 2906 result = callFn(value); 2907 } catch (error) { 2908 if (iterator) iteratorClose(iterator, 'throw', error); 2909 else throw error; 2910 } 2911 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; 2912 } return new Result(false); 2913 }; 2914 return iterate; 2915} 2916 2917var checkCorrectnessOfIteration; 2918var hasRequiredCheckCorrectnessOfIteration; 2919 2920function requireCheckCorrectnessOfIteration () { 2921 if (hasRequiredCheckCorrectnessOfIteration) return checkCorrectnessOfIteration; 2922 hasRequiredCheckCorrectnessOfIteration = 1; 2923 var wellKnownSymbol = requireWellKnownSymbol(); 2924 2925 var ITERATOR = wellKnownSymbol('iterator'); 2926 var SAFE_CLOSING = false; 2927 2928 try { 2929 var called = 0; 2930 var iteratorWithReturn = { 2931 next: function () { 2932 return { done: !!called++ }; 2933 }, 2934 'return': function () { 2935 SAFE_CLOSING = true; 2936 } 2937 }; 2938 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 2939 iteratorWithReturn[ITERATOR] = function () { 2940 return this; 2941 }; 2942 // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing 2943 Array.from(iteratorWithReturn, function () { throw 2; }); 2944 } catch (error) { /* empty */ } 2945 2946 checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) { 2947 try { 2948 if (!SKIP_CLOSING && !SAFE_CLOSING) return false; 2949 } catch (error) { return false; } // workaround of old WebKit + `eval` bug 2950 var ITERATION_SUPPORT = false; 2951 try { 2952 var object = {}; 2953 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 2954 object[ITERATOR] = function () { 2955 return { 2956 next: function () { 2957 return { done: ITERATION_SUPPORT = true }; 2958 } 2959 }; 2960 }; 2961 exec(object); 2962 } catch (error) { /* empty */ } 2963 return ITERATION_SUPPORT; 2964 }; 2965 return checkCorrectnessOfIteration; 2966} 2967 2968var promiseStaticsIncorrectIteration; 2969var hasRequiredPromiseStaticsIncorrectIteration; 2970 2971function requirePromiseStaticsIncorrectIteration () { 2972 if (hasRequiredPromiseStaticsIncorrectIteration) return promiseStaticsIncorrectIteration; 2973 hasRequiredPromiseStaticsIncorrectIteration = 1; 2974 var NativePromiseConstructor = requirePromiseNativeConstructor(); 2975 var checkCorrectnessOfIteration = requireCheckCorrectnessOfIteration(); 2976 var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR; 2977 2978 promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) { 2979 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ }); 2980 }); 2981 return promiseStaticsIncorrectIteration; 2982} 2983 2984var hasRequiredEs_promise_all; 2985 2986function requireEs_promise_all () { 2987 if (hasRequiredEs_promise_all) return es_promise_all; 2988 hasRequiredEs_promise_all = 1; 2989 var $ = require_export(); 2990 var call = requireFunctionCall(); 2991 var aCallable = requireACallable(); 2992 var newPromiseCapabilityModule = requireNewPromiseCapability(); 2993 var perform = requirePerform(); 2994 var iterate = requireIterate(); 2995 var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration(); 2996 2997 // `Promise.all` method 2998 // https://tc39.es/ecma262/#sec-promise.all 2999 $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { 3000 all: function all(iterable) { 3001 var C = this; 3002 var capability = newPromiseCapabilityModule.f(C); 3003 var resolve = capability.resolve; 3004 var reject = capability.reject; 3005 var result = perform(function () { 3006 var $promiseResolve = aCallable(C.resolve); 3007 var values = []; 3008 var counter = 0; 3009 var remaining = 1; 3010 iterate(iterable, function (promise) { 3011 var index = counter++; 3012 var alreadyCalled = false; 3013 remaining++; 3014 call($promiseResolve, C, promise).then(function (value) { 3015 if (alreadyCalled) return; 3016 alreadyCalled = true; 3017 values[index] = value; 3018 --remaining || resolve(values); 3019 }, reject); 3020 }); 3021 --remaining || resolve(values); 3022 }); 3023 if (result.error) reject(result.value); 3024 return capability.promise; 3025 } 3026 }); 3027 return es_promise_all; 3028} 3029 3030var es_promise_catch = {}; 3031 3032var hasRequiredEs_promise_catch; 3033 3034function requireEs_promise_catch () { 3035 if (hasRequiredEs_promise_catch) return es_promise_catch; 3036 hasRequiredEs_promise_catch = 1; 3037 var $ = require_export(); 3038 var IS_PURE = requireIsPure(); 3039 var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR; 3040 var NativePromiseConstructor = requirePromiseNativeConstructor(); 3041 var getBuiltIn = requireGetBuiltIn(); 3042 var isCallable = requireIsCallable(); 3043 var defineBuiltIn = requireDefineBuiltIn(); 3044 3045 var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; 3046 3047 // `Promise.prototype.catch` method 3048 // https://tc39.es/ecma262/#sec-promise.prototype.catch 3049 $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, { 3050 'catch': function (onRejected) { 3051 return this.then(undefined, onRejected); 3052 } 3053 }); 3054 3055 // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` 3056 if (!IS_PURE && isCallable(NativePromiseConstructor)) { 3057 var method = getBuiltIn('Promise').prototype['catch']; 3058 if (NativePromisePrototype['catch'] !== method) { 3059 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true }); 3060 } 3061 } 3062 return es_promise_catch; 3063} 3064 3065var es_promise_race = {}; 3066 3067var hasRequiredEs_promise_race; 3068 3069function requireEs_promise_race () { 3070 if (hasRequiredEs_promise_race) return es_promise_race; 3071 hasRequiredEs_promise_race = 1; 3072 var $ = require_export(); 3073 var call = requireFunctionCall(); 3074 var aCallable = requireACallable(); 3075 var newPromiseCapabilityModule = requireNewPromiseCapability(); 3076 var perform = requirePerform(); 3077 var iterate = requireIterate(); 3078 var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration(); 3079 3080 // `Promise.race` method 3081 // https://tc39.es/ecma262/#sec-promise.race 3082 $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { 3083 race: function race(iterable) { 3084 var C = this; 3085 var capability = newPromiseCapabilityModule.f(C); 3086 var reject = capability.reject; 3087 var result = perform(function () { 3088 var $promiseResolve = aCallable(C.resolve); 3089 iterate(iterable, function (promise) { 3090 call($promiseResolve, C, promise).then(capability.resolve, reject); 3091 }); 3092 }); 3093 if (result.error) reject(result.value); 3094 return capability.promise; 3095 } 3096 }); 3097 return es_promise_race; 3098} 3099 3100var es_promise_reject = {}; 3101 3102var hasRequiredEs_promise_reject; 3103 3104function requireEs_promise_reject () { 3105 if (hasRequiredEs_promise_reject) return es_promise_reject; 3106 hasRequiredEs_promise_reject = 1; 3107 var $ = require_export(); 3108 var newPromiseCapabilityModule = requireNewPromiseCapability(); 3109 var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR; 3110 3111 // `Promise.reject` method 3112 // https://tc39.es/ecma262/#sec-promise.reject 3113 $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { 3114 reject: function reject(r) { 3115 var capability = newPromiseCapabilityModule.f(this); 3116 var capabilityReject = capability.reject; 3117 capabilityReject(r); 3118 return capability.promise; 3119 } 3120 }); 3121 return es_promise_reject; 3122} 3123 3124var es_promise_resolve = {}; 3125 3126var promiseResolve; 3127var hasRequiredPromiseResolve; 3128 3129function requirePromiseResolve () { 3130 if (hasRequiredPromiseResolve) return promiseResolve; 3131 hasRequiredPromiseResolve = 1; 3132 var anObject = requireAnObject(); 3133 var isObject = requireIsObject(); 3134 var newPromiseCapability = requireNewPromiseCapability(); 3135 3136 promiseResolve = function (C, x) { 3137 anObject(C); 3138 if (isObject(x) && x.constructor === C) return x; 3139 var promiseCapability = newPromiseCapability.f(C); 3140 var resolve = promiseCapability.resolve; 3141 resolve(x); 3142 return promiseCapability.promise; 3143 }; 3144 return promiseResolve; 3145} 3146 3147var hasRequiredEs_promise_resolve; 3148 3149function requireEs_promise_resolve () { 3150 if (hasRequiredEs_promise_resolve) return es_promise_resolve; 3151 hasRequiredEs_promise_resolve = 1; 3152 var $ = require_export(); 3153 var getBuiltIn = requireGetBuiltIn(); 3154 var IS_PURE = requireIsPure(); 3155 var NativePromiseConstructor = requirePromiseNativeConstructor(); 3156 var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR; 3157 var promiseResolve = requirePromiseResolve(); 3158 3159 var PromiseConstructorWrapper = getBuiltIn('Promise'); 3160 var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR; 3161 3162 // `Promise.resolve` method 3163 // https://tc39.es/ecma262/#sec-promise.resolve 3164 $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, { 3165 resolve: function resolve(x) { 3166 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x); 3167 } 3168 }); 3169 return es_promise_resolve; 3170} 3171 3172var hasRequiredEs_promise; 3173 3174function requireEs_promise () { 3175 if (hasRequiredEs_promise) return es_promise; 3176 hasRequiredEs_promise = 1; 3177 // TODO: Remove this module from `core-js@4` since it's split to modules listed below 3178 requireEs_promise_constructor(); 3179 requireEs_promise_all();
vendor: 5,923 bytes, lines 3180-3387
3180 requireEs_promise_catch(); 3181 requireEs_promise_race(); 3182 requireEs_promise_reject(); 3183 requireEs_promise_resolve(); 3184 return es_promise; 3185} 3186 3187requireEs_promise(); 3188 3189function asyncGeneratorStep(n, t, e, r, o, a, c) { 3190 try { 3191 var i = n[a](c), 3192 u = i.value; 3193 } catch (n) { 3194 return void e(n); 3195 } 3196 i.done ? t(u) : Promise.resolve(u).then(r, o); 3197} 3198function _asyncToGenerator(n) { 3199 return function () { 3200 var t = this, 3201 e = arguments; 3202 return new Promise(function (r, o) { 3203 var a = n.apply(t, e); 3204 function _next(n) { 3205 asyncGeneratorStep(a, r, o, _next, _throw, "next", n); 3206 } 3207 function _throw(n) { 3208 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); 3209 } 3210 _next(void 0); 3211 }); 3212 }; 3213} 3214 3215var es_string_match = {}; 3216 3217var es_regexp_exec = {}; 3218 3219var toString; 3220var hasRequiredToString; 3221 3222function requireToString () { 3223 if (hasRequiredToString) return toString; 3224 hasRequiredToString = 1; 3225 var classof = requireClassof(); 3226 3227 var $String = String; 3228 3229 toString = function (argument) { 3230 if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); 3231 return $String(argument); 3232 }; 3233 return toString; 3234} 3235 3236var regexpFlags; 3237var hasRequiredRegexpFlags; 3238 3239function requireRegexpFlags () { 3240 if (hasRequiredRegexpFlags) return regexpFlags; 3241 hasRequiredRegexpFlags = 1; 3242 var anObject = requireAnObject(); 3243 3244 // `RegExp.prototype.flags` getter implementation 3245 // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags 3246 regexpFlags = function () { 3247 var that = anObject(this); 3248 var result = ''; 3249 if (that.hasIndices) result += 'd'; 3250 if (that.global) result += 'g'; 3251 if (that.ignoreCase) result += 'i'; 3252 if (that.multiline) result += 'm'; 3253 if (that.dotAll) result += 's'; 3254 if (that.unicode) result += 'u'; 3255 if (that.unicodeSets) result += 'v'; 3256 if (that.sticky) result += 'y'; 3257 return result; 3258 }; 3259 return regexpFlags; 3260} 3261 3262var regexpStickyHelpers; 3263var hasRequiredRegexpStickyHelpers; 3264 3265function requireRegexpStickyHelpers () { 3266 if (hasRequiredRegexpStickyHelpers) return regexpStickyHelpers; 3267 hasRequiredRegexpStickyHelpers = 1; 3268 var fails = requireFails(); 3269 var globalThis = requireGlobalThis(); 3270 3271 // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError 3272 var $RegExp = globalThis.RegExp; 3273 3274 var UNSUPPORTED_Y = fails(function () { 3275 var re = $RegExp('a', 'y'); 3276 re.lastIndex = 2; 3277 return re.exec('abcd') !== null; 3278 }); 3279 3280 // UC Browser bug 3281 // https://github.com/zloirock/core-js/issues/1008 3282 var MISSED_STICKY = UNSUPPORTED_Y || fails(function () { 3283 return !$RegExp('a', 'y').sticky; 3284 }); 3285 3286 var BROKEN_CARET = UNSUPPORTED_Y || fails(function () { 3287 // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 3288 var re = $RegExp('^r', 'gy'); 3289 re.lastIndex = 2; 3290 return re.exec('str') !== null; 3291 }); 3292 3293 regexpStickyHelpers = { 3294 BROKEN_CARET: BROKEN_CARET, 3295 MISSED_STICKY: MISSED_STICKY, 3296 UNSUPPORTED_Y: UNSUPPORTED_Y 3297 }; 3298 return regexpStickyHelpers; 3299} 3300 3301var objectDefineProperties = {}; 3302 3303var objectKeys; 3304var hasRequiredObjectKeys; 3305 3306function requireObjectKeys () { 3307 if (hasRequiredObjectKeys) return objectKeys; 3308 hasRequiredObjectKeys = 1; 3309 var internalObjectKeys = requireObjectKeysInternal(); 3310 var enumBugKeys = requireEnumBugKeys(); 3311 3312 // `Object.keys` method 3313 // https://tc39.es/ecma262/#sec-object.keys 3314 // eslint-disable-next-line es/no-object-keys -- safe 3315 objectKeys = Object.keys || function keys(O) { 3316 return internalObjectKeys(O, enumBugKeys); 3317 }; 3318 return objectKeys; 3319} 3320 3321var hasRequiredObjectDefineProperties; 3322 3323function requireObjectDefineProperties () { 3324 if (hasRequiredObjectDefineProperties) return objectDefineProperties; 3325 hasRequiredObjectDefineProperties = 1; 3326 var DESCRIPTORS = requireDescriptors(); 3327 var V8_PROTOTYPE_DEFINE_BUG = requireV8PrototypeDefineBug(); 3328 var definePropertyModule = requireObjectDefineProperty(); 3329 var anObject = requireAnObject(); 3330 var toIndexedObject = requireToIndexedObject(); 3331 var objectKeys = requireObjectKeys(); 3332 3333 // `Object.defineProperties` method 3334 // https://tc39.es/ecma262/#sec-object.defineproperties 3335 // eslint-disable-next-line es/no-object-defineproperties -- safe 3336 objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { 3337 anObject(O); 3338 var props = toIndexedObject(Properties); 3339 var keys = objectKeys(Properties); 3340 var length = keys.length; 3341 var index = 0; 3342 var key; 3343 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); 3344 return O; 3345 }; 3346 return objectDefineProperties; 3347} 3348 3349var objectCreate; 3350var hasRequiredObjectCreate; 3351 3352function requireObjectCreate () { 3353 if (hasRequiredObjectCreate) return objectCreate; 3354 hasRequiredObjectCreate = 1; 3355 /* global ActiveXObject -- old IE, WSH */ 3356 var anObject = requireAnObject(); 3357 var definePropertiesModule = requireObjectDefineProperties(); 3358 var enumBugKeys = requireEnumBugKeys(); 3359 var hiddenKeys = requireHiddenKeys(); 3360 var html = requireHtml(); 3361 var documentCreateElement = requireDocumentCreateElement(); 3362 var sharedKey = requireSharedKey(); 3363 3364 var GT = '>'; 3365 var LT = '<'; 3366 var PROTOTYPE = 'prototype'; 3367 var SCRIPT = 'script'; 3368 var IE_PROTO = sharedKey('IE_PROTO'); 3369 3370 var EmptyConstructor = function () { /* empty */ }; 3371 3372 var scriptTag = function (content) { 3373 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; 3374 }; 3375 3376 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype 3377 var NullProtoObjectViaActiveX = function (activeXDocument) { 3378 activeXDocument.write(scriptTag('')); 3379 activeXDocument.close(); 3380 var temp = activeXDocument.parentWindow.Object; 3381 // eslint-disable-next-line no-useless-assignment -- avoid memory leak 3382 activeXDocument = null; 3383 return temp; 3384 }; 3385 3386 // Create object with fake `null` prototype: use iframe Object with cleared prototype 3387 var NullProtoObjectViaIFrame = function () {
vendor: 41,801 bytes, lines 3388-4591
3388 // Thrash, waste and sodomy: IE GC bug 3389 var iframe = documentCreateElement('iframe'); 3390 var JS = 'java' + SCRIPT + ':'; 3391 var iframeDocument; 3392 iframe.style.display = 'none'; 3393 html.appendChild(iframe); 3394 // https://github.com/zloirock/core-js/issues/475 3395 iframe.src = String(JS); 3396 iframeDocument = iframe.contentWindow.document; 3397 iframeDocument.open(); 3398 iframeDocument.write(scriptTag('document.F=Object')); 3399 iframeDocument.close(); 3400 return iframeDocument.F; 3401 }; 3402 3403 // Check for document.domain and active x support 3404 // No need to use active x approach when document.domain is not set 3405 // see https://github.com/es-shims/es5-shim/issues/150 3406 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 3407 // avoid IE GC bug 3408 var activeXDocument; 3409 var NullProtoObject = function () { 3410 try { 3411 activeXDocument = new ActiveXObject('htmlfile'); 3412 } catch (error) { /* ignore */ } 3413 NullProtoObject = typeof document != 'undefined' 3414 ? document.domain && activeXDocument 3415 ? NullProtoObjectViaActiveX(activeXDocument) // old IE 3416 : NullProtoObjectViaIFrame() 3417 : NullProtoObjectViaActiveX(activeXDocument); // WSH 3418 var length = enumBugKeys.length; 3419 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; 3420 return NullProtoObject(); 3421 }; 3422 3423 hiddenKeys[IE_PROTO] = true; 3424 3425 // `Object.create` method 3426 // https://tc39.es/ecma262/#sec-object.create 3427 // eslint-disable-next-line es/no-object-create -- safe 3428 objectCreate = Object.create || function create(O, Properties) { 3429 var result; 3430 if (O !== null) { 3431 EmptyConstructor[PROTOTYPE] = anObject(O); 3432 result = new EmptyConstructor(); 3433 EmptyConstructor[PROTOTYPE] = null; 3434 // add "__proto__" for Object.getPrototypeOf polyfill 3435 result[IE_PROTO] = O; 3436 } else result = NullProtoObject(); 3437 return Properties === undefined ? result : definePropertiesModule.f(result, Properties); 3438 }; 3439 return objectCreate; 3440} 3441 3442var regexpUnsupportedDotAll; 3443var hasRequiredRegexpUnsupportedDotAll; 3444 3445function requireRegexpUnsupportedDotAll () { 3446 if (hasRequiredRegexpUnsupportedDotAll) return regexpUnsupportedDotAll; 3447 hasRequiredRegexpUnsupportedDotAll = 1; 3448 var fails = requireFails(); 3449 var globalThis = requireGlobalThis(); 3450 3451 // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError 3452 var $RegExp = globalThis.RegExp; 3453 3454 regexpUnsupportedDotAll = fails(function () { 3455 var re = $RegExp('.', 's'); 3456 return !(re.dotAll && re.test('\n') && re.flags === 's'); 3457 }); 3458 return regexpUnsupportedDotAll; 3459} 3460 3461var regexpUnsupportedNcg; 3462var hasRequiredRegexpUnsupportedNcg; 3463 3464function requireRegexpUnsupportedNcg () { 3465 if (hasRequiredRegexpUnsupportedNcg) return regexpUnsupportedNcg; 3466 hasRequiredRegexpUnsupportedNcg = 1; 3467 var fails = requireFails(); 3468 var globalThis = requireGlobalThis(); 3469 3470 // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError 3471 var $RegExp = globalThis.RegExp; 3472 3473 regexpUnsupportedNcg = fails(function () { 3474 var re = $RegExp('(?<a>b)', 'g'); 3475 return re.exec('b').groups.a !== 'b' || 3476 'b'.replace(re, '$<a>c') !== 'bc'; 3477 }); 3478 return regexpUnsupportedNcg; 3479} 3480 3481var regexpExec; 3482var hasRequiredRegexpExec; 3483 3484function requireRegexpExec () { 3485 if (hasRequiredRegexpExec) return regexpExec; 3486 hasRequiredRegexpExec = 1; 3487 /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ 3488 /* eslint-disable regexp/no-useless-quantifier -- testing */ 3489 var call = requireFunctionCall(); 3490 var uncurryThis = requireFunctionUncurryThis(); 3491 var toString = requireToString(); 3492 var regexpFlags = requireRegexpFlags(); 3493 var stickyHelpers = requireRegexpStickyHelpers(); 3494 var shared = requireShared(); 3495 var create = requireObjectCreate(); 3496 var getInternalState = requireInternalState().get; 3497 var UNSUPPORTED_DOT_ALL = requireRegexpUnsupportedDotAll(); 3498 var UNSUPPORTED_NCG = requireRegexpUnsupportedNcg(); 3499 3500 var nativeReplace = shared('native-string-replace', String.prototype.replace); 3501 var nativeExec = RegExp.prototype.exec; 3502 var patchedExec = nativeExec; 3503 var charAt = uncurryThis(''.charAt); 3504 var indexOf = uncurryThis(''.indexOf); 3505 var replace = uncurryThis(''.replace); 3506 var stringSlice = uncurryThis(''.slice); 3507 3508 var UPDATES_LAST_INDEX_WRONG = (function () { 3509 var re1 = /a/; 3510 var re2 = /b*/g; 3511 call(nativeExec, re1, 'a'); 3512 call(nativeExec, re2, 'a'); 3513 return re1.lastIndex !== 0 || re2.lastIndex !== 0; 3514 })(); 3515 3516 var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET; 3517 3518 // nonparticipating capturing group, copied from es5-shim's String#split patch. 3519 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; 3520 3521 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG; 3522 3523 var setGroups = function (re, groups) { 3524 var object = re.groups = create(null); 3525 for (var i = 0; i < groups.length; i++) { 3526 var group = groups[i]; 3527 object[group[0]] = re[group[1]]; 3528 } 3529 }; 3530 3531 if (PATCH) { 3532 patchedExec = function exec(string) { 3533 var re = this; 3534 var state = getInternalState(re); 3535 var str = toString(string); 3536 var raw = state.raw; 3537 var result, reCopy, lastIndex; 3538 3539 if (raw) { 3540 raw.lastIndex = re.lastIndex; 3541 result = call(patchedExec, raw, str); 3542 re.lastIndex = raw.lastIndex; 3543 3544 if (result && state.groups) setGroups(result, state.groups); 3545 3546 return result; 3547 } 3548 3549 var groups = state.groups; 3550 var sticky = UNSUPPORTED_Y && re.sticky; 3551 var flags = call(regexpFlags, re); 3552 var source = re.source; 3553 var charsAdded = 0; 3554 var strCopy = str; 3555 3556 if (sticky) { 3557 flags = replace(flags, 'y', ''); 3558 if (indexOf(flags, 'g') === -1) { 3559 flags += 'g'; 3560 } 3561 3562 strCopy = stringSlice(str, re.lastIndex); 3563 // Support anchored sticky behavior. 3564 var prevChar = re.lastIndex > 0 && charAt(str, re.lastIndex - 1); 3565 if (re.lastIndex > 0 && 3566 (!re.multiline || re.multiline && prevChar !== '\n' && prevChar !== '\r' && prevChar !== '\u2028' && prevChar !== '\u2029')) { 3567 source = '(?: (?:' + source + '))'; 3568 strCopy = ' ' + strCopy; 3569 charsAdded++; 3570 } 3571 // ^(? + rx + ) is needed, in combination with some str slicing, to 3572 // simulate the 'y' flag. 3573 reCopy = new RegExp('^(?:' + source + ')', flags); 3574 } 3575 3576 if (NPCG_INCLUDED) { 3577 reCopy = new RegExp('^' + source + '$(?!\\s)', flags); 3578 } 3579 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; 3580 3581 var match = call(nativeExec, sticky ? reCopy : re, strCopy); 3582 3583 if (sticky) { 3584 if (match) { 3585 match.input = str; 3586 match[0] = stringSlice(match[0], charsAdded); 3587 match.index = re.lastIndex; 3588 re.lastIndex += match[0].length; 3589 } else re.lastIndex = 0; 3590 } else if (UPDATES_LAST_INDEX_WRONG && match) { 3591 re.lastIndex = re.global ? match.index + match[0].length : lastIndex; 3592 } 3593 if (NPCG_INCLUDED && match && match.length > 1) { 3594 // Fix browsers whose `exec` methods don't consistently return `undefined` 3595 // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/ 3596 call(nativeReplace, match[0], reCopy, function () { 3597 for (var i = 1; i < arguments.length - 2; i++) { 3598 if (arguments[i] === undefined) match[i] = undefined; 3599 } 3600 }); 3601 } 3602 3603 if (match && groups) setGroups(match, groups); 3604 3605 return match; 3606 }; 3607 } 3608 3609 regexpExec = patchedExec; 3610 return regexpExec; 3611} 3612 3613var hasRequiredEs_regexp_exec; 3614 3615function requireEs_regexp_exec () { 3616 if (hasRequiredEs_regexp_exec) return es_regexp_exec; 3617 hasRequiredEs_regexp_exec = 1; 3618 var $ = require_export(); 3619 var exec = requireRegexpExec(); 3620 3621 // `RegExp.prototype.exec` method 3622 // https://tc39.es/ecma262/#sec-regexp.prototype.exec 3623 $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { 3624 exec: exec 3625 }); 3626 return es_regexp_exec; 3627} 3628 3629var fixRegexpWellKnownSymbolLogic; 3630var hasRequiredFixRegexpWellKnownSymbolLogic; 3631 3632function requireFixRegexpWellKnownSymbolLogic () { 3633 if (hasRequiredFixRegexpWellKnownSymbolLogic) return fixRegexpWellKnownSymbolLogic; 3634 hasRequiredFixRegexpWellKnownSymbolLogic = 1; 3635 // TODO: Remove from `core-js@4` since it's moved to entry points 3636 requireEs_regexp_exec(); 3637 var call = requireFunctionCall(); 3638 var defineBuiltIn = requireDefineBuiltIn(); 3639 var regexpExec = requireRegexpExec(); 3640 var fails = requireFails(); 3641 var wellKnownSymbol = requireWellKnownSymbol(); 3642 var createNonEnumerableProperty = requireCreateNonEnumerableProperty(); 3643 3644 var SPECIES = wellKnownSymbol('species'); 3645 var RegExpPrototype = RegExp.prototype; 3646 3647 fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { 3648 var SYMBOL = wellKnownSymbol(KEY); 3649 3650 var DELEGATES_TO_SYMBOL = !fails(function () { 3651 // String methods call symbol-named RegExp methods 3652 var O = {}; 3653 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 3654 O[SYMBOL] = function () { return 7; }; 3655 return ''[KEY](O) !== 7; 3656 }); 3657 3658 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { 3659 // Symbol-named RegExp methods call .exec 3660 var execCalled = false; 3661 var re = /a/; 3662 3663 if (KEY === 'split') { 3664 // We can't use real regex here since it causes deoptimization 3665 // and serious performance degradation in V8 3666 // https://github.com/zloirock/core-js/issues/306 3667 // RegExp[@@split] doesn't call the regex's exec method, but first creates 3668 // a new one. We need to return the patched regex when creating the new one. 3669 var constructor = {}; 3670 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 3671 constructor[SPECIES] = function () { return re; }; 3672 re = { constructor: constructor, flags: '' }; 3673 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 3674 re[SYMBOL] = /./[SYMBOL]; 3675 } 3676 3677 re.exec = function () { 3678 execCalled = true; 3679 return null; 3680 }; 3681 3682 re[SYMBOL](''); 3683 return !execCalled; 3684 }); 3685 3686 if ( 3687 !DELEGATES_TO_SYMBOL || 3688 !DELEGATES_TO_EXEC || 3689 FORCED 3690 ) { 3691 var nativeRegExpMethod = /./[SYMBOL]; 3692 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { 3693 var $exec = regexp.exec; 3694 if ($exec === regexpExec || $exec === RegExpPrototype.exec) { 3695 if (DELEGATES_TO_SYMBOL && !forceStringMethod) { 3696 // The native String method already delegates to @@method (this 3697 // polyfilled function), leasing to infinite recursion. 3698 // We avoid it by directly calling the native @@method method. 3699 return { done: true, value: call(nativeRegExpMethod, regexp, str, arg2) }; 3700 } 3701 return { done: true, value: call(nativeMethod, str, regexp, arg2) }; 3702 } 3703 return { done: false }; 3704 }); 3705 3706 defineBuiltIn(String.prototype, KEY, methods[0]); 3707 defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]); 3708 } 3709 3710 if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true); 3711 }; 3712 return fixRegexpWellKnownSymbolLogic; 3713} 3714 3715var stringMultibyte; 3716var hasRequiredStringMultibyte; 3717 3718function requireStringMultibyte () { 3719 if (hasRequiredStringMultibyte) return stringMultibyte; 3720 hasRequiredStringMultibyte = 1; 3721 var uncurryThis = requireFunctionUncurryThis(); 3722 var toIntegerOrInfinity = requireToIntegerOrInfinity(); 3723 var toString = requireToString(); 3724 var requireObjectCoercible = requireRequireObjectCoercible(); 3725 3726 var charAt = uncurryThis(''.charAt); 3727 var charCodeAt = uncurryThis(''.charCodeAt); 3728 var stringSlice = uncurryThis(''.slice); 3729 3730 var createMethod = function (CONVERT_TO_STRING) { 3731 return function ($this, pos) { 3732 var S = toString(requireObjectCoercible($this)); 3733 var position = toIntegerOrInfinity(pos); 3734 var size = S.length; 3735 var first, second; 3736 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; 3737 first = charCodeAt(S, position); 3738 return first < 0xD800 || first > 0xDBFF || position + 1 === size 3739 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF 3740 ? CONVERT_TO_STRING 3741 ? charAt(S, position) 3742 : first 3743 : CONVERT_TO_STRING 3744 ? stringSlice(S, position, position + 2) 3745 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; 3746 }; 3747 }; 3748 3749 stringMultibyte = { 3750 // `String.prototype.codePointAt` method 3751 // https://tc39.es/ecma262/#sec-string.prototype.codepointat 3752 codeAt: createMethod(false), 3753 // `String.prototype.at` method 3754 // https://github.com/mathiasbynens/String.prototype.at 3755 charAt: createMethod(true) 3756 }; 3757 return stringMultibyte; 3758} 3759 3760var advanceStringIndex; 3761var hasRequiredAdvanceStringIndex; 3762 3763function requireAdvanceStringIndex () { 3764 if (hasRequiredAdvanceStringIndex) return advanceStringIndex; 3765 hasRequiredAdvanceStringIndex = 1; 3766 var charAt = requireStringMultibyte().charAt; 3767 3768 // `AdvanceStringIndex` abstract operation 3769 // https://tc39.es/ecma262/#sec-advancestringindex 3770 advanceStringIndex = function (S, index, unicode) { 3771 return index + (unicode ? charAt(S, index).length || 1 : 1); 3772 }; 3773 return advanceStringIndex; 3774} 3775 3776var regexpFlagsDetection; 3777var hasRequiredRegexpFlagsDetection; 3778 3779function requireRegexpFlagsDetection () { 3780 if (hasRequiredRegexpFlagsDetection) return regexpFlagsDetection; 3781 hasRequiredRegexpFlagsDetection = 1; 3782 var globalThis = requireGlobalThis(); 3783 var fails = requireFails(); 3784 3785 // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError 3786 var RegExp = globalThis.RegExp; 3787 3788 var FLAGS_GETTER_IS_CORRECT = !fails(function () { 3789 var INDICES_SUPPORT = true; 3790 try { 3791 RegExp('.', 'd'); 3792 } catch (error) { 3793 INDICES_SUPPORT = false; 3794 } 3795 3796 var O = {}; 3797 // modern V8 bug 3798 var calls = ''; 3799 var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; 3800 3801 var addGetter = function (key, chr) { 3802 // eslint-disable-next-line es/no-object-defineproperty -- safe 3803 Object.defineProperty(O, key, { get: function () { 3804 calls += chr; 3805 return true; 3806 } }); 3807 }; 3808 3809 var pairs = { 3810 dotAll: 's', 3811 global: 'g', 3812 ignoreCase: 'i', 3813 multiline: 'm', 3814 sticky: 'y' 3815 }; 3816 3817 if (INDICES_SUPPORT) pairs.hasIndices = 'd'; 3818 3819 for (var key in pairs) addGetter(key, pairs[key]); 3820 3821 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 3822 var result = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(O); 3823 3824 return result !== expected || calls !== expected; 3825 }); 3826 3827 regexpFlagsDetection = { correct: FLAGS_GETTER_IS_CORRECT }; 3828 return regexpFlagsDetection; 3829} 3830 3831var regexpGetFlags; 3832var hasRequiredRegexpGetFlags; 3833 3834function requireRegexpGetFlags () { 3835 if (hasRequiredRegexpGetFlags) return regexpGetFlags; 3836 hasRequiredRegexpGetFlags = 1; 3837 var call = requireFunctionCall(); 3838 var hasOwn = requireHasOwnProperty(); 3839 var isPrototypeOf = requireObjectIsPrototypeOf(); 3840 var regExpFlagsDetection = requireRegexpFlagsDetection(); 3841 var regExpFlagsGetterImplementation = requireRegexpFlags(); 3842 3843 var RegExpPrototype = RegExp.prototype; 3844 3845 regexpGetFlags = regExpFlagsDetection.correct ? function (it) { 3846 return it.flags; 3847 } : function (it) { 3848 return (!regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype, it) && !hasOwn(it, 'flags')) 3849 ? call(regExpFlagsGetterImplementation, it) 3850 : it.flags; 3851 }; 3852 return regexpGetFlags; 3853} 3854 3855var regexpExecAbstract; 3856var hasRequiredRegexpExecAbstract; 3857 3858function requireRegexpExecAbstract () { 3859 if (hasRequiredRegexpExecAbstract) return regexpExecAbstract; 3860 hasRequiredRegexpExecAbstract = 1; 3861 var call = requireFunctionCall(); 3862 var anObject = requireAnObject(); 3863 var isCallable = requireIsCallable(); 3864 var classof = requireClassofRaw(); 3865 var regexpExec = requireRegexpExec(); 3866 3867 var $TypeError = TypeError; 3868 3869 // `RegExpExec` abstract operation 3870 // https://tc39.es/ecma262/#sec-regexpexec 3871 regexpExecAbstract = function (R, S) { 3872 var exec = R.exec; 3873 if (isCallable(exec)) { 3874 var result = call(exec, R, S); 3875 if (result !== null) anObject(result); 3876 return result; 3877 } 3878 if (classof(R) === 'RegExp') return call(regexpExec, R, S); 3879 throw new $TypeError('RegExp#exec called on incompatible receiver'); 3880 }; 3881 return regexpExecAbstract; 3882} 3883 3884var hasRequiredEs_string_match; 3885 3886function requireEs_string_match () { 3887 if (hasRequiredEs_string_match) return es_string_match; 3888 hasRequiredEs_string_match = 1; 3889 var call = requireFunctionCall(); 3890 var uncurryThis = requireFunctionUncurryThis(); 3891 var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic(); 3892 var anObject = requireAnObject(); 3893 var isObject = requireIsObject(); 3894 var toLength = requireToLength(); 3895 var toString = requireToString(); 3896 var requireObjectCoercible = requireRequireObjectCoercible(); 3897 var getMethod = requireGetMethod(); 3898 var advanceStringIndex = requireAdvanceStringIndex(); 3899 var getRegExpFlags = requireRegexpGetFlags(); 3900 var regExpExec = requireRegexpExecAbstract(); 3901 3902 var stringIndexOf = uncurryThis(''.indexOf); 3903 3904 // @@match logic 3905 fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) { 3906 return [ 3907 // `String.prototype.match` method 3908 // https://tc39.es/ecma262/#sec-string.prototype.match 3909 function match(regexp) { 3910 var O = requireObjectCoercible(this); 3911 var matcher = isObject(regexp) ? getMethod(regexp, MATCH) : undefined; 3912 return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O)); 3913 }, 3914 // `RegExp.prototype[@@match]` method 3915 // https://tc39.es/ecma262/#sec-regexp.prototype-@@match 3916 function (string) { 3917 var rx = anObject(this); 3918 var S = toString(string); 3919 var res = maybeCallNative(nativeMatch, rx, S); 3920 3921 if (res.done) return res.value; 3922 3923 var flags = toString(getRegExpFlags(rx)); 3924 3925 if (!~stringIndexOf(flags, 'g')) return regExpExec(rx, S); 3926 3927 var fullUnicode = !!~stringIndexOf(flags, 'u') || !!~stringIndexOf(flags, 'v'); 3928 rx.lastIndex = 0; 3929 var A = []; 3930 var n = 0; 3931 var result; 3932 while ((result = regExpExec(rx, S)) !== null) { 3933 var matchStr = toString(result[0]); 3934 A[n] = matchStr; 3935 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); 3936 n++; 3937 } 3938 return n === 0 ? null : A; 3939 } 3940 ]; 3941 }); 3942 return es_string_match; 3943} 3944 3945requireEs_string_match(); 3946 3947var es_string_replace = {}; 3948 3949var getSubstitution; 3950var hasRequiredGetSubstitution; 3951 3952function requireGetSubstitution () { 3953 if (hasRequiredGetSubstitution) return getSubstitution; 3954 hasRequiredGetSubstitution = 1; 3955 var uncurryThis = requireFunctionUncurryThis(); 3956 var toObject = requireToObject(); 3957 3958 var floor = Math.floor; 3959 var charAt = uncurryThis(''.charAt); 3960 var replace = uncurryThis(''.replace); 3961 var stringSlice = uncurryThis(''.slice); 3962 // eslint-disable-next-line redos/no-vulnerable -- safe 3963 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; 3964 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; 3965 3966 // `GetSubstitution` abstract operation 3967 // https://tc39.es/ecma262/#sec-getsubstitution 3968 getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) { 3969 var tailPos = position + matched.length; 3970 var m = captures.length; 3971 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; 3972 if (namedCaptures !== undefined) { 3973 namedCaptures = toObject(namedCaptures); 3974 symbols = SUBSTITUTION_SYMBOLS; 3975 } 3976 return replace(replacement, symbols, function (match, ch) { 3977 var capture; 3978 switch (charAt(ch, 0)) { 3979 case '$': return '$'; 3980 case '&': return matched; 3981 case '`': return stringSlice(str, 0, position); 3982 case "'": return stringSlice(str, tailPos); 3983 case '<': 3984 capture = namedCaptures[stringSlice(ch, 1, -1)]; 3985 break; 3986 default: // \d\d? 3987 var n = +ch; 3988 if (n === 0) return match; 3989 if (n > m) { 3990 var f = floor(n / 10); 3991 if (f === 0) return match; 3992 if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); 3993 return match; 3994 } 3995 capture = captures[n - 1]; 3996 } 3997 return capture === undefined ? '' : capture; 3998 }); 3999 }; 4000 return getSubstitution; 4001} 4002 4003var hasRequiredEs_string_replace; 4004 4005function requireEs_string_replace () { 4006 if (hasRequiredEs_string_replace) return es_string_replace; 4007 hasRequiredEs_string_replace = 1; 4008 var apply = requireFunctionApply(); 4009 var call = requireFunctionCall(); 4010 var uncurryThis = requireFunctionUncurryThis(); 4011 var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic(); 4012 var fails = requireFails(); 4013 var anObject = requireAnObject(); 4014 var isCallable = requireIsCallable(); 4015 var isObject = requireIsObject(); 4016 var toIntegerOrInfinity = requireToIntegerOrInfinity(); 4017 var toLength = requireToLength(); 4018 var toString = requireToString(); 4019 var requireObjectCoercible = requireRequireObjectCoercible(); 4020 var advanceStringIndex = requireAdvanceStringIndex(); 4021 var getMethod = requireGetMethod(); 4022 var getSubstitution = requireGetSubstitution(); 4023 var getRegExpFlags = requireRegexpGetFlags(); 4024 var regExpExec = requireRegexpExecAbstract(); 4025 var wellKnownSymbol = requireWellKnownSymbol(); 4026 4027 var REPLACE = wellKnownSymbol('replace'); 4028 var max = Math.max; 4029 var min = Math.min; 4030 var concat = uncurryThis([].concat); 4031 var push = uncurryThis([].push); 4032 var stringIndexOf = uncurryThis(''.indexOf); 4033 var stringSlice = uncurryThis(''.slice); 4034 4035 var maybeToString = function (it) { 4036 return it === undefined ? it : String(it); 4037 }; 4038 4039 // IE <= 11 replaces $0 with the whole match, as if it was $& 4040 // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 4041 var REPLACE_KEEPS_$0 = (function () { 4042 // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing 4043 return 'a'.replace(/./, '$0') === '$0'; 4044 })(); 4045 4046 // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string 4047 var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { 4048 if (/./[REPLACE]) { 4049 return /./[REPLACE]('a', '$0') === ''; 4050 } 4051 return false; 4052 })(); 4053 4054 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { 4055 var re = /./; 4056 re.exec = function () { 4057 var result = []; 4058 result.groups = { a: '7' }; 4059 return result; 4060 }; 4061 // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive 4062 return ''.replace(re, '$<a>') !== '7'; 4063 }); 4064 4065 // @@replace logic 4066 fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) { 4067 var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; 4068 4069 return [ 4070 // `String.prototype.replace` method 4071 // https://tc39.es/ecma262/#sec-string.prototype.replace 4072 function replace(searchValue, replaceValue) { 4073 var O = requireObjectCoercible(this); 4074 var replacer = isObject(searchValue) ? getMethod(searchValue, REPLACE) : undefined; 4075 return replacer 4076 ? call(replacer, searchValue, O, replaceValue) 4077 : call(nativeReplace, toString(O), searchValue, replaceValue); 4078 }, 4079 // `RegExp.prototype[@@replace]` method 4080 // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace 4081 function (string, replaceValue) { 4082 var rx = anObject(this); 4083 var S = toString(string); 4084 4085 var functionalReplace = isCallable(replaceValue); 4086 if (!functionalReplace) replaceValue = toString(replaceValue); 4087 var flags = toString(getRegExpFlags(rx)); 4088 4089 if ( 4090 typeof replaceValue == 'string' && 4091 !~stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) && 4092 !~stringIndexOf(replaceValue, '$<') && 4093 !~stringIndexOf(flags, 'y') 4094 ) { 4095 var res = maybeCallNative(nativeReplace, rx, S, replaceValue); 4096 if (res.done) return res.value; 4097 } 4098 4099 var global = !!~stringIndexOf(flags, 'g'); 4100 var fullUnicode; 4101 if (global) { 4102 fullUnicode = !!~stringIndexOf(flags, 'u') || !!~stringIndexOf(flags, 'v'); 4103 rx.lastIndex = 0; 4104 } 4105 4106 var results = []; 4107 var result; 4108 while (true) { 4109 result = regExpExec(rx, S); 4110 if (result === null) break; 4111 4112 push(results, result); 4113 if (!global) break; 4114 4115 var matchStr = toString(result[0]); 4116 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); 4117 } 4118 4119 var accumulatedResult = ''; 4120 var nextSourcePosition = 0; 4121 for (var i = 0; i < results.length; i++) { 4122 result = results[i]; 4123 4124 var matched = toString(result[0]); 4125 var position = max(min(toIntegerOrInfinity(result.index), S.length), 0); 4126 var captures = []; 4127 var replacement; 4128 // NOTE: This is equivalent to 4129 // captures = result.slice(1).map(maybeToString) 4130 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in 4131 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and 4132 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. 4133 for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j])); 4134 var namedCaptures = result.groups; 4135 if (functionalReplace) { 4136 var replacerArgs = concat([matched], captures, position, S); 4137 if (namedCaptures !== undefined) push(replacerArgs, namedCaptures); 4138 replacement = toString(apply(replaceValue, undefined, replacerArgs)); 4139 } else { 4140 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); 4141 } 4142 if (position >= nextSourcePosition) { 4143 accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement; 4144 nextSourcePosition = position + matched.length; 4145 } 4146 } 4147 4148 return accumulatedResult + stringSlice(S, nextSourcePosition); 4149 } 4150 ]; 4151 }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); 4152 return es_string_replace; 4153} 4154 4155requireEs_string_replace(); 4156 4157var es_string_startsWith = {}; 4158 4159var isRegexp; 4160var hasRequiredIsRegexp; 4161 4162function requireIsRegexp () { 4163 if (hasRequiredIsRegexp) return isRegexp; 4164 hasRequiredIsRegexp = 1; 4165 var isObject = requireIsObject(); 4166 var classof = requireClassofRaw(); 4167 var wellKnownSymbol = requireWellKnownSymbol(); 4168 4169 var MATCH = wellKnownSymbol('match'); 4170 4171 // `IsRegExp` abstract operation 4172 // https://tc39.es/ecma262/#sec-isregexp 4173 isRegexp = function (it) { 4174 var isRegExp; 4175 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === 'RegExp'); 4176 }; 4177 return isRegexp; 4178} 4179 4180var notARegexp; 4181var hasRequiredNotARegexp; 4182 4183function requireNotARegexp () { 4184 if (hasRequiredNotARegexp) return notARegexp; 4185 hasRequiredNotARegexp = 1; 4186 var isRegExp = requireIsRegexp(); 4187 4188 var $TypeError = TypeError; 4189 4190 notARegexp = function (it) { 4191 if (isRegExp(it)) { 4192 throw new $TypeError("The method doesn't accept regular expressions"); 4193 } return it; 4194 }; 4195 return notARegexp; 4196} 4197 4198var correctIsRegexpLogic; 4199var hasRequiredCorrectIsRegexpLogic; 4200 4201function requireCorrectIsRegexpLogic () { 4202 if (hasRequiredCorrectIsRegexpLogic) return correctIsRegexpLogic; 4203 hasRequiredCorrectIsRegexpLogic = 1; 4204 var wellKnownSymbol = requireWellKnownSymbol(); 4205 4206 var MATCH = wellKnownSymbol('match'); 4207 4208 correctIsRegexpLogic = function (METHOD_NAME) { 4209 var regexp = /./; 4210 try { 4211 '/./'[METHOD_NAME](regexp); 4212 } catch (error1) { 4213 try { 4214 regexp[MATCH] = false; 4215 return '/./'[METHOD_NAME](regexp); 4216 } catch (error2) { /* empty */ } 4217 } return false; 4218 }; 4219 return correctIsRegexpLogic; 4220} 4221 4222var hasRequiredEs_string_startsWith; 4223 4224function requireEs_string_startsWith () { 4225 if (hasRequiredEs_string_startsWith) return es_string_startsWith; 4226 hasRequiredEs_string_startsWith = 1; 4227 var $ = require_export(); 4228 var uncurryThis = requireFunctionUncurryThisClause(); 4229 var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f; 4230 var toLength = requireToLength(); 4231 var toString = requireToString(); 4232 var notARegExp = requireNotARegexp(); 4233 var requireObjectCoercible = requireRequireObjectCoercible(); 4234 var correctIsRegExpLogic = requireCorrectIsRegexpLogic(); 4235 var IS_PURE = requireIsPure(); 4236 4237 var stringSlice = uncurryThis(''.slice); 4238 var min = Math.min; 4239 4240 var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); 4241 // https://github.com/zloirock/core-js/pull/702 4242 var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { 4243 var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); 4244 return descriptor && !descriptor.writable; 4245 }(); 4246 4247 // `String.prototype.startsWith` method 4248 // https://tc39.es/ecma262/#sec-string.prototype.startswith 4249 $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { 4250 startsWith: function startsWith(searchString /* , position = 0 */) { 4251 var that = toString(requireObjectCoercible(this)); 4252 notARegExp(searchString); 4253 var search = toString(searchString); 4254 var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); 4255 return stringSlice(that, index, index + search.length) === search; 4256 } 4257 }); 4258 return es_string_startsWith; 4259} 4260 4261requireEs_string_startsWith(); 4262 4263var addToUnscopables; 4264var hasRequiredAddToUnscopables; 4265 4266function requireAddToUnscopables () { 4267 if (hasRequiredAddToUnscopables) return addToUnscopables; 4268 hasRequiredAddToUnscopables = 1; 4269 var wellKnownSymbol = requireWellKnownSymbol(); 4270 var create = requireObjectCreate(); 4271 var defineProperty = requireObjectDefineProperty().f; 4272 4273 var UNSCOPABLES = wellKnownSymbol('unscopables'); 4274 var ArrayPrototype = Array.prototype; 4275 4276 // Array.prototype[@@unscopables] 4277 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables 4278 if (ArrayPrototype[UNSCOPABLES] === undefined) { 4279 defineProperty(ArrayPrototype, UNSCOPABLES, { 4280 configurable: true, 4281 value: create(null) 4282 }); 4283 } 4284 4285 // add a key to Array.prototype[@@unscopables] 4286 addToUnscopables = function (key) { 4287 ArrayPrototype[UNSCOPABLES][key] = true; 4288 }; 4289 return addToUnscopables; 4290} 4291 4292var correctPrototypeGetter; 4293var hasRequiredCorrectPrototypeGetter; 4294 4295function requireCorrectPrototypeGetter () { 4296 if (hasRequiredCorrectPrototypeGetter) return correctPrototypeGetter; 4297 hasRequiredCorrectPrototypeGetter = 1; 4298 var fails = requireFails(); 4299 4300 correctPrototypeGetter = !fails(function () { 4301 function F() { /* empty */ } 4302 F.prototype.constructor = null; 4303 // eslint-disable-next-line es/no-object-getprototypeof -- required for testing 4304 return Object.getPrototypeOf(new F()) !== F.prototype; 4305 }); 4306 return correctPrototypeGetter; 4307} 4308 4309var objectGetPrototypeOf; 4310var hasRequiredObjectGetPrototypeOf; 4311 4312function requireObjectGetPrototypeOf () { 4313 if (hasRequiredObjectGetPrototypeOf) return objectGetPrototypeOf; 4314 hasRequiredObjectGetPrototypeOf = 1; 4315 var hasOwn = requireHasOwnProperty(); 4316 var isCallable = requireIsCallable(); 4317 var toObject = requireToObject(); 4318 var sharedKey = requireSharedKey(); 4319 var CORRECT_PROTOTYPE_GETTER = requireCorrectPrototypeGetter(); 4320 4321 var IE_PROTO = sharedKey('IE_PROTO'); 4322 var $Object = Object; 4323 var ObjectPrototype = $Object.prototype; 4324 4325 // `Object.getPrototypeOf` method 4326 // https://tc39.es/ecma262/#sec-object.getprototypeof 4327 // eslint-disable-next-line es/no-object-getprototypeof -- safe 4328 objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) { 4329 var object = toObject(O); 4330 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; 4331 var constructor = object.constructor; 4332 if (isCallable(constructor) && object instanceof constructor) { 4333 return constructor.prototype; 4334 } return object instanceof $Object ? ObjectPrototype : null; 4335 }; 4336 return objectGetPrototypeOf; 4337} 4338 4339var iteratorsCore; 4340var hasRequiredIteratorsCore; 4341 4342function requireIteratorsCore () { 4343 if (hasRequiredIteratorsCore) return iteratorsCore; 4344 hasRequiredIteratorsCore = 1; 4345 var fails = requireFails(); 4346 var isCallable = requireIsCallable(); 4347 var isObject = requireIsObject(); 4348 var create = requireObjectCreate(); 4349 var getPrototypeOf = requireObjectGetPrototypeOf(); 4350 var defineBuiltIn = requireDefineBuiltIn(); 4351 var wellKnownSymbol = requireWellKnownSymbol(); 4352 var IS_PURE = requireIsPure(); 4353 4354 var ITERATOR = wellKnownSymbol('iterator'); 4355 var BUGGY_SAFARI_ITERATORS = false; 4356 4357 // `%IteratorPrototype%` object 4358 // https://tc39.es/ecma262/#sec-%iteratorprototype%-object 4359 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; 4360 4361 /* eslint-disable es/no-array-prototype-keys -- safe */ 4362 if ([].keys) { 4363 arrayIterator = [].keys(); 4364 // Safari 8 has buggy iterators w/o `next` 4365 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; 4366 else { 4367 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); 4368 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; 4369 } 4370 } 4371 4372 var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () { 4373 var test = {}; 4374 // FF44- legacy iterators case 4375 return IteratorPrototype[ITERATOR].call(test) !== test; 4376 }); 4377 4378 if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; 4379 else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); 4380 4381 // `%IteratorPrototype%[@@iterator]()` method 4382 // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator 4383 if (!isCallable(IteratorPrototype[ITERATOR])) { 4384 defineBuiltIn(IteratorPrototype, ITERATOR, function () { 4385 return this; 4386 }); 4387 } 4388 4389 iteratorsCore = { 4390 IteratorPrototype: IteratorPrototype, 4391 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS 4392 }; 4393 return iteratorsCore; 4394} 4395 4396var iteratorCreateConstructor; 4397var hasRequiredIteratorCreateConstructor; 4398 4399function requireIteratorCreateConstructor () { 4400 if (hasRequiredIteratorCreateConstructor) return iteratorCreateConstructor; 4401 hasRequiredIteratorCreateConstructor = 1; 4402 var IteratorPrototype = requireIteratorsCore().IteratorPrototype; 4403 var create = requireObjectCreate(); 4404 var createPropertyDescriptor = requireCreatePropertyDescriptor(); 4405 var setToStringTag = requireSetToStringTag(); 4406 var Iterators = requireIterators(); 4407 4408 var returnThis = function () { return this; }; 4409 4410 iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { 4411 var TO_STRING_TAG = NAME + ' Iterator'; 4412 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); 4413 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); 4414 Iterators[TO_STRING_TAG] = returnThis; 4415 return IteratorConstructor; 4416 }; 4417 return iteratorCreateConstructor; 4418} 4419 4420var iteratorDefine; 4421var hasRequiredIteratorDefine; 4422 4423function requireIteratorDefine () { 4424 if (hasRequiredIteratorDefine) return iteratorDefine; 4425 hasRequiredIteratorDefine = 1; 4426 var $ = require_export(); 4427 var call = requireFunctionCall(); 4428 var IS_PURE = requireIsPure(); 4429 var FunctionName = requireFunctionName(); 4430 var isCallable = requireIsCallable(); 4431 var createIteratorConstructor = requireIteratorCreateConstructor(); 4432 var getPrototypeOf = requireObjectGetPrototypeOf(); 4433 var setPrototypeOf = requireObjectSetPrototypeOf(); 4434 var setToStringTag = requireSetToStringTag(); 4435 var createNonEnumerableProperty = requireCreateNonEnumerableProperty(); 4436 var defineBuiltIn = requireDefineBuiltIn(); 4437 var wellKnownSymbol = requireWellKnownSymbol(); 4438 var Iterators = requireIterators(); 4439 var IteratorsCore = requireIteratorsCore(); 4440 4441 var PROPER_FUNCTION_NAME = FunctionName.PROPER; 4442 var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; 4443 var IteratorPrototype = IteratorsCore.IteratorPrototype; 4444 var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; 4445 var ITERATOR = wellKnownSymbol('iterator'); 4446 var KEYS = 'keys'; 4447 var VALUES = 'values'; 4448 var ENTRIES = 'entries'; 4449 4450 var returnThis = function () { return this; }; 4451 4452 iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { 4453 createIteratorConstructor(IteratorConstructor, NAME, next); 4454 4455 var getIterationMethod = function (KIND) { 4456 if (KIND === DEFAULT && defaultIterator) return defaultIterator; 4457 if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; 4458 4459 switch (KIND) { 4460 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; 4461 case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; 4462 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; 4463 } 4464 4465 return function () { return new IteratorConstructor(this); }; 4466 }; 4467 4468 var TO_STRING_TAG = NAME + ' Iterator'; 4469 var INCORRECT_VALUES_NAME = false; 4470 var IterablePrototype = Iterable.prototype; 4471 var nativeIterator = IterablePrototype[ITERATOR] 4472 || IterablePrototype['@@iterator'] 4473 || DEFAULT && IterablePrototype[DEFAULT]; 4474 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); 4475 var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; 4476 var CurrentIteratorPrototype, methods, KEY; 4477 4478 // fix native 4479 if (anyNativeIterator) { 4480 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); 4481 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { 4482 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { 4483 if (setPrototypeOf) { 4484 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); 4485 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) { 4486 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis); 4487 } 4488 } 4489 // Set @@toStringTag to native iterators 4490 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); 4491 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; 4492 } 4493 } 4494 4495 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF 4496 if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) { 4497 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) { 4498 createNonEnumerableProperty(IterablePrototype, 'name', VALUES); 4499 } else { 4500 INCORRECT_VALUES_NAME = true; 4501 defaultIterator = function values() { return call(nativeIterator, this); }; 4502 } 4503 } 4504 4505 // export additional methods 4506 if (DEFAULT) { 4507 methods = { 4508 values: getIterationMethod(VALUES), 4509 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), 4510 entries: getIterationMethod(ENTRIES) 4511 }; 4512 if (FORCED) for (KEY in methods) { 4513 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { 4514 defineBuiltIn(IterablePrototype, KEY, methods[KEY]); 4515 } 4516 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); 4517 } 4518 4519 // define iterator 4520 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { 4521 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); 4522 } 4523 Iterators[NAME] = defaultIterator; 4524 4525 return methods; 4526 }; 4527 return iteratorDefine; 4528} 4529 4530var createIterResultObject; 4531var hasRequiredCreateIterResultObject; 4532 4533function requireCreateIterResultObject () { 4534 if (hasRequiredCreateIterResultObject) return createIterResultObject; 4535 hasRequiredCreateIterResultObject = 1; 4536 // `CreateIterResultObject` abstract operation 4537 // https://tc39.es/ecma262/#sec-createiterresultobject 4538 createIterResultObject = function (value, done) { 4539 return { value: value, done: done }; 4540 }; 4541 return createIterResultObject; 4542} 4543 4544var es_array_iterator; 4545var hasRequiredEs_array_iterator; 4546 4547function requireEs_array_iterator () { 4548 if (hasRequiredEs_array_iterator) return es_array_iterator; 4549 hasRequiredEs_array_iterator = 1; 4550 var toIndexedObject = requireToIndexedObject(); 4551 var addToUnscopables = requireAddToUnscopables(); 4552 var Iterators = requireIterators(); 4553 var InternalStateModule = requireInternalState(); 4554 var defineProperty = requireObjectDefineProperty().f; 4555 var defineIterator = requireIteratorDefine(); 4556 var createIterResultObject = requireCreateIterResultObject(); 4557 var IS_PURE = requireIsPure(); 4558 var DESCRIPTORS = requireDescriptors(); 4559 4560 var ARRAY_ITERATOR = 'Array Iterator'; 4561 var setInternalState = InternalStateModule.set; 4562 var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); 4563 4564 // `Array.prototype.entries` method 4565 // https://tc39.es/ecma262/#sec-array.prototype.entries 4566 // `Array.prototype.keys` method 4567 // https://tc39.es/ecma262/#sec-array.prototype.keys 4568 // `Array.prototype.values` method 4569 // https://tc39.es/ecma262/#sec-array.prototype.values 4570 // `Array.prototype[@@iterator]` method 4571 // https://tc39.es/ecma262/#sec-array.prototype-@@iterator 4572 // `CreateArrayIterator` internal method 4573 // https://tc39.es/ecma262/#sec-createarrayiterator 4574 es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { 4575 setInternalState(this, { 4576 type: ARRAY_ITERATOR, 4577 target: toIndexedObject(iterated), // target 4578 index: 0, // next index 4579 kind: kind // kind 4580 }); 4581 // `%ArrayIteratorPrototype%.next` method 4582 // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next 4583 }, function () { 4584 var state = getInternalState(this); 4585 var target = state.target; 4586 var index = state.index++; 4587 if (!target || index >= target.length) { 4588 state.target = null; 4589 return createIterResultObject(undefined, true); 4590 } 4591 switch (state.kind) {
vendor: 5,488 bytes, lines 4592-4763
4592 case 'keys': return createIterResultObject(index, false); 4593 case 'values': return createIterResultObject(target[index], false); 4594 } return createIterResultObject([index, target[index]], false); 4595 }, 'values'); 4596 4597 // argumentsList[@@iterator] is %ArrayProto_values% 4598 // https://tc39.es/ecma262/#sec-createunmappedargumentsobject 4599 // https://tc39.es/ecma262/#sec-createmappedargumentsobject 4600 var values = Iterators.Arguments = Iterators.Array; 4601 4602 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables 4603 addToUnscopables('keys'); 4604 addToUnscopables('values'); 4605 addToUnscopables('entries'); 4606 4607 // V8 ~ Chrome 45- bug 4608 if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try { 4609 defineProperty(values, 'name', { value: 'values' }); 4610 } catch (error) { /* empty */ } 4611 return es_array_iterator; 4612} 4613 4614requireEs_array_iterator(); 4615 4616var web_domCollections_iterator = {}; 4617 4618var domIterables; 4619var hasRequiredDomIterables; 4620 4621function requireDomIterables () { 4622 if (hasRequiredDomIterables) return domIterables; 4623 hasRequiredDomIterables = 1; 4624 // iterable DOM collections 4625 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods 4626 domIterables = { 4627 CSSRuleList: 0, 4628 CSSStyleDeclaration: 0, 4629 CSSValueList: 0, 4630 ClientRectList: 0, 4631 DOMRectList: 0, 4632 DOMStringList: 0, 4633 DOMTokenList: 1, 4634 DataTransferItemList: 0, 4635 FileList: 0, 4636 HTMLAllCollection: 0, 4637 HTMLCollection: 0, 4638 HTMLFormElement: 0, 4639 HTMLSelectElement: 0, 4640 MediaList: 0, 4641 MimeTypeArray: 0, 4642 NamedNodeMap: 0, 4643 NodeList: 1, 4644 PaintRequestList: 0, 4645 Plugin: 0, 4646 PluginArray: 0, 4647 SVGLengthList: 0, 4648 SVGNumberList: 0, 4649 SVGPathSegList: 0, 4650 SVGPointList: 0, 4651 SVGStringList: 0, 4652 SVGTransformList: 0, 4653 SourceBufferList: 0, 4654 StyleSheetList: 0, 4655 TextTrackCueList: 0, 4656 TextTrackList: 0, 4657 TouchList: 0 4658 }; 4659 return domIterables; 4660} 4661 4662var domTokenListPrototype; 4663var hasRequiredDomTokenListPrototype; 4664 4665function requireDomTokenListPrototype () { 4666 if (hasRequiredDomTokenListPrototype) return domTokenListPrototype; 4667 hasRequiredDomTokenListPrototype = 1; 4668 // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList` 4669 var documentCreateElement = requireDocumentCreateElement(); 4670 4671 var classList = documentCreateElement('span').classList; 4672 var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype; 4673 4674 domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype; 4675 return domTokenListPrototype; 4676} 4677 4678var hasRequiredWeb_domCollections_iterator; 4679 4680function requireWeb_domCollections_iterator () { 4681 if (hasRequiredWeb_domCollections_iterator) return web_domCollections_iterator; 4682 hasRequiredWeb_domCollections_iterator = 1; 4683 var globalThis = requireGlobalThis(); 4684 var DOMIterables = requireDomIterables(); 4685 var DOMTokenListPrototype = requireDomTokenListPrototype(); 4686 var ArrayIteratorMethods = requireEs_array_iterator(); 4687 var createNonEnumerableProperty = requireCreateNonEnumerableProperty(); 4688 var setToStringTag = requireSetToStringTag(); 4689 var wellKnownSymbol = requireWellKnownSymbol(); 4690 4691 var ITERATOR = wellKnownSymbol('iterator'); 4692 var ArrayValues = ArrayIteratorMethods.values; 4693 4694 var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { 4695 if (CollectionPrototype) { 4696 // some Chrome versions have non-configurable methods on DOMTokenList 4697 if (CollectionPrototype[ITERATOR] !== ArrayValues) try { 4698 createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); 4699 } catch (error) { 4700 CollectionPrototype[ITERATOR] = ArrayValues; 4701 } 4702 setToStringTag(CollectionPrototype, COLLECTION_NAME, true); 4703 if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { 4704 // some Chrome versions have non-configurable methods on DOMTokenList 4705 if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { 4706 createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); 4707 } catch (error) { 4708 CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; 4709 } 4710 } 4711 } 4712 }; 4713 4714 for (var COLLECTION_NAME in DOMIterables) { 4715 handlePrototype(globalThis[COLLECTION_NAME] && globalThis[COLLECTION_NAME].prototype, COLLECTION_NAME); 4716 } 4717 4718 handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); 4719 return web_domCollections_iterator; 4720} 4721 4722requireWeb_domCollections_iterator(); 4723 4724function toPrimitive(t, r) { 4725 if ("object" != _typeof$1(t) || !t) return t; 4726 var e = t[Symbol.toPrimitive]; 4727 if (void 0 !== e) { 4728 var i = e.call(t, r); 4729 if ("object" != _typeof$1(i)) return i; 4730 throw new TypeError("@@toPrimitive must return a primitive value."); 4731 } 4732 return ("string" === r ? String : Number)(t); 4733} 4734 4735function toPropertyKey(t) { 4736 var i = toPrimitive(t, "string"); 4737 return "symbol" == _typeof$1(i) ? i : i + ""; 4738} 4739 4740function _defineProperty(e, r, t) { 4741 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 4742 value: t, 4743 enumerable: true, 4744 configurable: true, 4745 writable: true 4746 }) : e[r] = t, e; 4747} 4748 4749var es_array_reduce = {}; 4750 4751var arrayReduce; 4752var hasRequiredArrayReduce; 4753 4754function requireArrayReduce () { 4755 if (hasRequiredArrayReduce) return arrayReduce; 4756 hasRequiredArrayReduce = 1; 4757 var aCallable = requireACallable(); 4758 var toObject = requireToObject(); 4759 var IndexedObject = requireIndexedObject(); 4760 var lengthOfArrayLike = requireLengthOfArrayLike(); 4761 4762 var $TypeError = TypeError; 4763
vendor: 2,328 bytes, lines 4764-4835
4764 var REDUCE_EMPTY = 'Reduce of empty array with no initial value'; 4765 4766 // `Array.prototype.{ reduce, reduceRight }` methods implementation 4767 var createMethod = function (IS_RIGHT) { 4768 return function (that, callbackfn, argumentsLength, memo) { 4769 var O = toObject(that); 4770 var self = IndexedObject(O); 4771 var length = lengthOfArrayLike(O); 4772 aCallable(callbackfn); 4773 if (length === 0 && argumentsLength < 2) throw new $TypeError(REDUCE_EMPTY); 4774 var index = IS_RIGHT ? length - 1 : 0; 4775 var i = IS_RIGHT ? -1 : 1; 4776 if (argumentsLength < 2) while (true) { 4777 if (index in self) { 4778 memo = self[index]; 4779 index += i; 4780 break; 4781 } 4782 index += i; 4783 if (IS_RIGHT ? index < 0 : length <= index) { 4784 throw new $TypeError(REDUCE_EMPTY); 4785 } 4786 } 4787 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { 4788 memo = callbackfn(memo, self[index], index, O); 4789 } 4790 return memo; 4791 }; 4792 }; 4793 4794 arrayReduce = { 4795 // `Array.prototype.reduce` method 4796 // https://tc39.es/ecma262/#sec-array.prototype.reduce 4797 left: createMethod(false), 4798 // `Array.prototype.reduceRight` method 4799 // https://tc39.es/ecma262/#sec-array.prototype.reduceright 4800 right: createMethod(true) 4801 }; 4802 return arrayReduce; 4803} 4804 4805var arrayMethodIsStrict; 4806var hasRequiredArrayMethodIsStrict; 4807 4808function requireArrayMethodIsStrict () { 4809 if (hasRequiredArrayMethodIsStrict) return arrayMethodIsStrict; 4810 hasRequiredArrayMethodIsStrict = 1; 4811 var fails = requireFails(); 4812 4813 arrayMethodIsStrict = function (METHOD_NAME, argument) { 4814 var method = [][METHOD_NAME]; 4815 return !!method && fails(function () { 4816 // eslint-disable-next-line no-useless-call -- required for testing 4817 method.call(null, argument || function () { return 1; }, 1); 4818 }); 4819 }; 4820 return arrayMethodIsStrict; 4821} 4822 4823var hasRequiredEs_array_reduce; 4824 4825function requireEs_array_reduce () { 4826 if (hasRequiredEs_array_reduce) return es_array_reduce; 4827 hasRequiredEs_array_reduce = 1; 4828 var $ = require_export(); 4829 var $reduce = requireArrayReduce().left; 4830 var arrayMethodIsStrict = requireArrayMethodIsStrict(); 4831 var CHROME_VERSION = requireEnvironmentV8Version(); 4832 var IS_NODE = requireEnvironmentIsNode(); 4833 4834 // Chrome 80-82 has a critical bug 4835 // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
vendor: 5,037 bytes, lines 4836-4962
4836 var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; 4837 var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce'); 4838 4839 // `Array.prototype.reduce` method 4840 // https://tc39.es/ecma262/#sec-array.prototype.reduce 4841 $({ target: 'Array', proto: true, forced: FORCED }, { 4842 reduce: function reduce(callbackfn /* , initialValue */) { 4843 var length = arguments.length; 4844 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); 4845 } 4846 }); 4847 return es_array_reduce; 4848} 4849 4850requireEs_array_reduce(); 4851 4852var es_string_endsWith = {}; 4853 4854var hasRequiredEs_string_endsWith; 4855 4856function requireEs_string_endsWith () { 4857 if (hasRequiredEs_string_endsWith) return es_string_endsWith; 4858 hasRequiredEs_string_endsWith = 1; 4859 var $ = require_export(); 4860 var uncurryThis = requireFunctionUncurryThisClause(); 4861 var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f; 4862 var toLength = requireToLength(); 4863 var toString = requireToString(); 4864 var notARegExp = requireNotARegexp(); 4865 var requireObjectCoercible = requireRequireObjectCoercible(); 4866 var correctIsRegExpLogic = requireCorrectIsRegexpLogic(); 4867 var IS_PURE = requireIsPure(); 4868 4869 var slice = uncurryThis(''.slice); 4870 var min = Math.min; 4871 4872 var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith'); 4873 // https://github.com/zloirock/core-js/pull/702 4874 var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { 4875 var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith'); 4876 return descriptor && !descriptor.writable; 4877 }(); 4878 4879 // `String.prototype.endsWith` method 4880 // https://tc39.es/ecma262/#sec-string.prototype.endswith 4881 $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { 4882 endsWith: function endsWith(searchString /* , endPosition = @length */) { 4883 var that = toString(requireObjectCoercible(this)); 4884 notARegExp(searchString); 4885 var search = toString(searchString); 4886 var endPosition = arguments.length > 1 ? arguments[1] : undefined; 4887 var len = that.length; 4888 var end = endPosition === undefined ? len : min(toLength(endPosition), len); 4889 return slice(that, end - search.length, end) === search; 4890 } 4891 }); 4892 return es_string_endsWith; 4893} 4894 4895requireEs_string_endsWith(); 4896 4897var es_string_split = {}; 4898 4899var hasRequiredEs_string_split; 4900 4901function requireEs_string_split () { 4902 if (hasRequiredEs_string_split) return es_string_split; 4903 hasRequiredEs_string_split = 1; 4904 var call = requireFunctionCall(); 4905 var uncurryThis = requireFunctionUncurryThis(); 4906 var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic(); 4907 var anObject = requireAnObject(); 4908 var isObject = requireIsObject(); 4909 var requireObjectCoercible = requireRequireObjectCoercible(); 4910 var speciesConstructor = requireSpeciesConstructor(); 4911 var advanceStringIndex = requireAdvanceStringIndex(); 4912 var toLength = requireToLength(); 4913 var toString = requireToString(); 4914 var getMethod = requireGetMethod(); 4915 var getRegExpFlags = requireRegexpGetFlags(); 4916 var regExpExec = requireRegexpExecAbstract(); 4917 var stickyHelpers = requireRegexpStickyHelpers(); 4918 var fails = requireFails(); 4919 4920 var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; 4921 var MAX_UINT32 = 0xFFFFFFFF; 4922 var min = Math.min; 4923 var push = uncurryThis([].push); 4924 var stringSlice = uncurryThis(''.slice); 4925 var stringIndexOf = uncurryThis(''.indexOf); 4926 4927 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec 4928 // Weex JS has frozen built-in prototypes, so use try / catch wrapper 4929 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { 4930 // eslint-disable-next-line regexp/no-empty-group -- required for testing 4931 var re = /(?:)/; 4932 var originalExec = re.exec; 4933 re.exec = function () { return originalExec.apply(this, arguments); }; 4934 var result = 'ab'.split(re); 4935 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; 4936 }); 4937 4938 var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' || 4939 // eslint-disable-next-line regexp/no-empty-group -- required for testing 4940 'test'.split(/(?:)/, -1).length !== 4 || 4941 'ab'.split(/(?:ab)*/).length !== 2 || 4942 '.'.split(/(.?)(.?)/).length !== 4 || 4943 // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing 4944 '.'.split(/()()/).length > 1 || 4945 ''.split(/.?/).length; 4946 4947 // @@split logic 4948 fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) { 4949 var internalSplit = '0'.split(undefined, 0).length ? function (separator, limit) { 4950 return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); 4951 } : nativeSplit; 4952 4953 return [ 4954 // `String.prototype.split` method 4955 // https://tc39.es/ecma262/#sec-string.prototype.split 4956 function split(separator, limit) { 4957 var O = requireObjectCoercible(this); 4958 var splitter = isObject(separator) ? getMethod(separator, SPLIT) : undefined; 4959 return splitter 4960 ? call(splitter, separator, O, limit) 4961 : call(internalSplit, toString(O), separator, limit); 4962 },
vendor: 1,316 bytes, lines 4963-4993
4963 // `RegExp.prototype[@@split]` method 4964 // https://tc39.es/ecma262/#sec-regexp.prototype-@@split 4965 // 4966 // NOTE: This cannot be properly polyfilled in engines that don't support 4967 // the 'y' flag. 4968 function (string, limit) { 4969 var rx = anObject(this); 4970 var S = toString(string); 4971 4972 if (!BUGGY) { 4973 var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit); 4974 if (res.done) return res.value; 4975 } 4976 4977 var C = speciesConstructor(rx, RegExp); 4978 var flags = toString(getRegExpFlags(rx)); 4979 var unicodeMatching = !!~stringIndexOf(flags, 'u') || !!~stringIndexOf(flags, 'v'); 4980 if (UNSUPPORTED_Y) { 4981 if (!~stringIndexOf(flags, 'g')) flags += 'g'; 4982 } else if (!~stringIndexOf(flags, 'y')) flags += 'y'; 4983 // ^(? + rx + ) is needed, in combination with some S slicing, to 4984 // simulate the 'y' flag. 4985 var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags); 4986 var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; 4987 if (lim === 0) return []; 4988 if (S.length === 0) return regExpExec(splitter, S) === null ? [S] : []; 4989 var p = 0; 4990 var q = 0; 4991 var A = []; 4992 while (q < S.length) { 4993 splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
4994 var z = regExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); 4995 var e; 4996 if ( 4997 z === null || 4998 (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p 4999 ) { 5000 q = advanceStringIndex(S, q, unicodeMatching); 5001 } else { 5002 push(A, stringSlice(S, p, q)); 5003 if (A.length === lim) return A; 5004 for (var i = 1; i <= z.length - 1; i++) { 5005 push(A, z[i]); 5006 if (A.length === lim) return A; 5007 } 5008 q = p = e; 5009 } 5010 } 5011 push(A, stringSlice(S, p)); 5012 return A; 5013 } 5014 ]; 5015 }, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); 5016 return es_string_split; 5017} 5018 5019requireEs_string_split(); 5020 5021var raf = {exports: {}}; 5022 5023var performanceNow$1 = {exports: {}}; 5024 5025var performanceNow = performanceNow$1.exports; 5026 5027var hasRequiredPerformanceNow; 5028 5029function requirePerformanceNow () { 5030 if (hasRequiredPerformanceNow) return performanceNow$1.exports; 5031 hasRequiredPerformanceNow = 1; 5032 // Generated by CoffeeScript 1.12.2 5033 (function() { 5034 var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; 5035 5036 if ((typeof performance !== "undefined" && performance !== null) && performance.now) { 5037 performanceNow$1.exports = function() { 5038 return performance.now(); 5039 }; 5040 } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) { 5041 performanceNow$1.exports = function() { 5042 return (getNanoSeconds() - nodeLoadTime) / 1e6; 5043 }; 5044 hrtime = process.hrtime; 5045 getNanoSeconds = function() { 5046 var hr; 5047 hr = hrtime(); 5048 return hr[0] * 1e9 + hr[1]; 5049 }; 5050 moduleLoadTime = getNanoSeconds(); 5051 upTime = process.uptime() * 1e9; 5052 nodeLoadTime = moduleLoadTime - upTime; 5053 } else if (Date.now) { 5054 performanceNow$1.exports = function() { 5055 return Date.now() - loadTime; 5056 }; 5057 loadTime = Date.now(); 5058 } else { 5059 performanceNow$1.exports = function() { 5060 return new Date().getTime() - loadTime; 5061 }; 5062 loadTime = new Date().getTime(); 5063 } 5064 5065 }).call(performanceNow); 5066 5067 5068 return performanceNow$1.exports; 5069} 5070 5071var hasRequiredRaf; 5072 5073function requireRaf () { 5074 if (hasRequiredRaf) return raf.exports; 5075 hasRequiredRaf = 1; 5076 var now = requirePerformanceNow() 5077 , root = typeof window === 'undefined' ? commonjsGlobal : window 5078 , vendors = ['moz', 'webkit'] 5079 , suffix = 'AnimationFrame' 5080 , raf$1 = root['request' + suffix] 5081 , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]; 5082 5083 for(var i = 0; !raf$1 && i < vendors.length; i++) { 5084 raf$1 = root[vendors[i] + 'Request' + suffix]; 5085 caf = root[vendors[i] + 'Cancel' + suffix] 5086 || root[vendors[i] + 'CancelRequest' + suffix]; 5087 } 5088 5089 // Some versions of FF have rAF but not cAF 5090 if(!raf$1 || !caf) { 5091 var last = 0 5092 , id = 0 5093 , queue = [] 5094 , frameDuration = 1000 / 60; 5095 5096 raf$1 = function(callback) { 5097 if(queue.length === 0) { 5098 var _now = now() 5099 , next = Math.max(0, frameDuration - (_now - last)); 5100 last = next + _now; 5101 setTimeout(function() { 5102 var cp = queue.slice(0); 5103 // Clear queue here to prevent 5104 // callbacks from appending listeners 5105 // to the current frame's queue 5106 queue.length = 0; 5107 for(var i = 0; i < cp.length; i++) { 5108 if(!cp[i].cancelled) { 5109 try{ 5110 cp[i].callback(last); 5111 } catch(e) { 5112 setTimeout(function() { throw e }, 0); 5113 } 5114 } 5115 } 5116 }, Math.round(next)); 5117 } 5118 queue.push({ 5119 handle: ++id, 5120 callback: callback, 5121 cancelled: false 5122 }); 5123 return id 5124 }; 5125 5126 caf = function(handle) { 5127 for(var i = 0; i < queue.length; i++) { 5128 if(queue[i].handle === handle) { 5129 queue[i].cancelled = true; 5130 } 5131 } 5132 }; 5133 } 5134 5135 raf.exports = function(fn) { 5136 // Wrap in a new function to prevent 5137 // `cancel` potentially being assigned 5138 // to the native rAF function 5139 return raf$1.call(root, fn) 5140 }; 5141 raf.exports.cancel = function() { 5142 caf.apply(root, arguments); 5143 }; 5144 raf.exports.polyfill = function(object) { 5145 if (!object) { 5146 object = root; 5147 } 5148 object.requestAnimationFrame = raf$1; 5149 object.cancelAnimationFrame = caf; 5150 }; 5151 return raf.exports; 5152} 5153 5154var rafExports = requireRaf(); 5155const requestAnimationFrame = /*@__PURE__*/getDefaultExportFromCjs(rafExports); 5156 5157var es_string_trim = {}; 5158
vendor: 6,733 bytes, lines 5159-5379
5159var whitespaces; 5160var hasRequiredWhitespaces; 5161 5162function requireWhitespaces () { 5163 if (hasRequiredWhitespaces) return whitespaces; 5164 hasRequiredWhitespaces = 1; 5165 // a string of all valid unicode whitespaces 5166 whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + 5167 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 5168 return whitespaces; 5169} 5170 5171var stringTrim; 5172var hasRequiredStringTrim; 5173 5174function requireStringTrim () { 5175 if (hasRequiredStringTrim) return stringTrim; 5176 hasRequiredStringTrim = 1; 5177 var uncurryThis = requireFunctionUncurryThis(); 5178 var requireObjectCoercible = requireRequireObjectCoercible(); 5179 var toString = requireToString(); 5180 var whitespaces = requireWhitespaces(); 5181 5182 var replace = uncurryThis(''.replace); 5183 var ltrim = RegExp('^[' + whitespaces + ']+'); 5184 var rtrim = RegExp('(^|[^' + whitespaces + '])[' + whitespaces + ']+$'); 5185 5186 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation 5187 var createMethod = function (TYPE) { 5188 return function ($this) { 5189 var string = toString(requireObjectCoercible($this)); 5190 if (TYPE & 1) string = replace(string, ltrim, ''); 5191 if (TYPE & 2) string = replace(string, rtrim, '$1'); 5192 return string; 5193 }; 5194 }; 5195 5196 stringTrim = { 5197 // `String.prototype.{ trimLeft, trimStart }` methods 5198 // https://tc39.es/ecma262/#sec-string.prototype.trimstart 5199 start: createMethod(1), 5200 // `String.prototype.{ trimRight, trimEnd }` methods 5201 // https://tc39.es/ecma262/#sec-string.prototype.trimend 5202 end: createMethod(2), 5203 // `String.prototype.trim` method 5204 // https://tc39.es/ecma262/#sec-string.prototype.trim 5205 trim: createMethod(3) 5206 }; 5207 return stringTrim; 5208} 5209 5210var stringTrimForced; 5211var hasRequiredStringTrimForced; 5212 5213function requireStringTrimForced () { 5214 if (hasRequiredStringTrimForced) return stringTrimForced; 5215 hasRequiredStringTrimForced = 1; 5216 var PROPER_FUNCTION_NAME = requireFunctionName().PROPER; 5217 var fails = requireFails(); 5218 var whitespaces = requireWhitespaces(); 5219 5220 var non = '\u200B\u0085\u180E'; 5221 5222 // check that a method works with the correct list 5223 // of whitespaces and has a correct name 5224 stringTrimForced = function (METHOD_NAME) { 5225 return fails(function () { 5226 return !!whitespaces[METHOD_NAME]() 5227 || non[METHOD_NAME]() !== non 5228 || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME); 5229 }); 5230 }; 5231 return stringTrimForced; 5232} 5233 5234var hasRequiredEs_string_trim; 5235 5236function requireEs_string_trim () { 5237 if (hasRequiredEs_string_trim) return es_string_trim; 5238 hasRequiredEs_string_trim = 1; 5239 var $ = require_export(); 5240 var $trim = requireStringTrim().trim; 5241 var forcedStringTrimMethod = requireStringTrimForced(); 5242 5243 // `String.prototype.trim` method 5244 // https://tc39.es/ecma262/#sec-string.prototype.trim 5245 $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { 5246 trim: function trim() { 5247 return $trim(this); 5248 } 5249 }); 5250 return es_string_trim; 5251} 5252 5253requireEs_string_trim(); 5254 5255/* 5256 Based on rgbcolor.js by Stoyan Stefanov <[email protected]> 5257 http://www.phpied.com/rgb-color-parser-in-javascript/ 5258*/ 5259 5260var rgbcolor; 5261var hasRequiredRgbcolor; 5262 5263function requireRgbcolor () { 5264 if (hasRequiredRgbcolor) return rgbcolor; 5265 hasRequiredRgbcolor = 1; 5266 rgbcolor = function(color_string) { 5267 this.ok = false; 5268 this.alpha = 1.0; 5269 5270 // strip any leading # 5271 if (color_string.charAt(0) == '#') { // remove # if any 5272 color_string = color_string.substr(1,6); 5273 } 5274 5275 color_string = color_string.replace(/ /g,''); 5276 color_string = color_string.toLowerCase(); 5277 5278 // before getting into regexps, try simple matches 5279 // and overwrite the input 5280 var simple_colors = { 5281 aliceblue: 'f0f8ff', 5282 antiquewhite: 'faebd7', 5283 aqua: '00ffff', 5284 aquamarine: '7fffd4', 5285 azure: 'f0ffff', 5286 beige: 'f5f5dc', 5287 bisque: 'ffe4c4', 5288 black: '000000', 5289 blanchedalmond: 'ffebcd', 5290 blue: '0000ff', 5291 blueviolet: '8a2be2', 5292 brown: 'a52a2a', 5293 burlywood: 'deb887', 5294 cadetblue: '5f9ea0', 5295 chartreuse: '7fff00', 5296 chocolate: 'd2691e', 5297 coral: 'ff7f50', 5298 cornflowerblue: '6495ed', 5299 cornsilk: 'fff8dc', 5300 crimson: 'dc143c', 5301 cyan: '00ffff', 5302 darkblue: '00008b', 5303 darkcyan: '008b8b', 5304 darkgoldenrod: 'b8860b', 5305 darkgray: 'a9a9a9', 5306 darkgreen: '006400', 5307 darkkhaki: 'bdb76b', 5308 darkmagenta: '8b008b', 5309 darkolivegreen: '556b2f', 5310 darkorange: 'ff8c00', 5311 darkorchid: '9932cc', 5312 darkred: '8b0000', 5313 darksalmon: 'e9967a', 5314 darkseagreen: '8fbc8f', 5315 darkslateblue: '483d8b', 5316 darkslategray: '2f4f4f', 5317 darkturquoise: '00ced1', 5318 darkviolet: '9400d3', 5319 deeppink: 'ff1493', 5320 deepskyblue: '00bfff', 5321 dimgray: '696969', 5322 dodgerblue: '1e90ff', 5323 feldspar: 'd19275', 5324 firebrick: 'b22222', 5325 floralwhite: 'fffaf0', 5326 forestgreen: '228b22', 5327 fuchsia: 'ff00ff', 5328 gainsboro: 'dcdcdc', 5329 ghostwhite: 'f8f8ff', 5330 gold: 'ffd700', 5331 goldenrod: 'daa520', 5332 gray: '808080', 5333 green: '008000', 5334 greenyellow: 'adff2f', 5335 honeydew: 'f0fff0', 5336 hotpink: 'ff69b4', 5337 indianred : 'cd5c5c', 5338 indigo : '4b0082', 5339 ivory: 'fffff0', 5340 khaki: 'f0e68c', 5341 lavender: 'e6e6fa', 5342 lavenderblush: 'fff0f5', 5343 lawngreen: '7cfc00', 5344 lemonchiffon: 'fffacd', 5345 lightblue: 'add8e6', 5346 lightcoral: 'f08080', 5347 lightcyan: 'e0ffff', 5348 lightgoldenrodyellow: 'fafad2', 5349 lightgrey: 'd3d3d3', 5350 lightgreen: '90ee90', 5351 lightpink: 'ffb6c1', 5352 lightsalmon: 'ffa07a', 5353 lightseagreen: '20b2aa', 5354 lightskyblue: '87cefa', 5355 lightslateblue: '8470ff', 5356 lightslategray: '778899', 5357 lightsteelblue: 'b0c4de', 5358 lightyellow: 'ffffe0', 5359 lime: '00ff00', 5360 limegreen: '32cd32', 5361 linen: 'faf0e6', 5362 magenta: 'ff00ff', 5363 maroon: '800000', 5364 mediumaquamarine: '66cdaa', 5365 mediumblue: '0000cd', 5366 mediumorchid: 'ba55d3', 5367 mediumpurple: '9370d8', 5368 mediumseagreen: '3cb371', 5369 mediumslateblue: '7b68ee', 5370 mediumspringgreen: '00fa9a', 5371 mediumturquoise: '48d1cc', 5372 mediumvioletred: 'c71585', 5373 midnightblue: '191970', 5374 mintcream: 'f5fffa', 5375 mistyrose: 'ffe4e1', 5376 moccasin: 'ffe4b5', 5377 navajowhite: 'ffdead', 5378 navy: '000080', 5379 oldlace: 'fdf5e6',
vendor: 12,922 bytes, lines 5380-5696
5380 olive: '808000', 5381 olivedrab: '6b8e23', 5382 orange: 'ffa500', 5383 orangered: 'ff4500', 5384 orchid: 'da70d6', 5385 palegoldenrod: 'eee8aa', 5386 palegreen: '98fb98', 5387 paleturquoise: 'afeeee', 5388 palevioletred: 'd87093', 5389 papayawhip: 'ffefd5', 5390 peachpuff: 'ffdab9', 5391 peru: 'cd853f', 5392 pink: 'ffc0cb', 5393 plum: 'dda0dd', 5394 powderblue: 'b0e0e6', 5395 purple: '800080', 5396 rebeccapurple: '663399', 5397 red: 'ff0000', 5398 rosybrown: 'bc8f8f', 5399 royalblue: '4169e1', 5400 saddlebrown: '8b4513', 5401 salmon: 'fa8072', 5402 sandybrown: 'f4a460', 5403 seagreen: '2e8b57', 5404 seashell: 'fff5ee', 5405 sienna: 'a0522d', 5406 silver: 'c0c0c0', 5407 skyblue: '87ceeb', 5408 slateblue: '6a5acd', 5409 slategray: '708090', 5410 snow: 'fffafa', 5411 springgreen: '00ff7f', 5412 steelblue: '4682b4', 5413 tan: 'd2b48c', 5414 teal: '008080', 5415 thistle: 'd8bfd8', 5416 tomato: 'ff6347', 5417 turquoise: '40e0d0', 5418 violet: 'ee82ee', 5419 violetred: 'd02090', 5420 wheat: 'f5deb3', 5421 white: 'ffffff', 5422 whitesmoke: 'f5f5f5', 5423 yellow: 'ffff00', 5424 yellowgreen: '9acd32' 5425 }; 5426 color_string = simple_colors[color_string] || color_string; 5427 // emd of simple type-in colors 5428 5429 // array of color definition objects 5430 var color_defs = [ 5431 { 5432 re: /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/, 5433 example: ['rgba(123, 234, 45, 0.8)', 'rgba(255,234,245,1.0)'], 5434 process: function (bits){ 5435 return [ 5436 parseInt(bits[1]), 5437 parseInt(bits[2]), 5438 parseInt(bits[3]), 5439 parseFloat(bits[4]) 5440 ]; 5441 } 5442 }, 5443 { 5444 re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, 5445 example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'], 5446 process: function (bits){ 5447 return [ 5448 parseInt(bits[1]), 5449 parseInt(bits[2]), 5450 parseInt(bits[3]) 5451 ]; 5452 } 5453 }, 5454 { 5455 re: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 5456 example: ['#00ff00', '336699'], 5457 process: function (bits){ 5458 return [ 5459 parseInt(bits[1], 16), 5460 parseInt(bits[2], 16), 5461 parseInt(bits[3], 16) 5462 ]; 5463 } 5464 }, 5465 { 5466 re: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 5467 example: ['#fb0', 'f0f'], 5468 process: function (bits){ 5469 return [ 5470 parseInt(bits[1] + bits[1], 16), 5471 parseInt(bits[2] + bits[2], 16), 5472 parseInt(bits[3] + bits[3], 16) 5473 ]; 5474 } 5475 } 5476 ]; 5477 5478 // search through the definitions to find a match 5479 for (var i = 0; i < color_defs.length; i++) { 5480 var re = color_defs[i].re; 5481 var processor = color_defs[i].process; 5482 var bits = re.exec(color_string); 5483 if (bits) { 5484 var channels = processor(bits); 5485 this.r = channels[0]; 5486 this.g = channels[1]; 5487 this.b = channels[2]; 5488 if (channels.length > 3) { 5489 this.alpha = channels[3]; 5490 } 5491 this.ok = true; 5492 } 5493 5494 } 5495 5496 // validate/cleanup values 5497 this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r); 5498 this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g); 5499 this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b); 5500 this.alpha = (this.alpha < 0) ? 0 : ((this.alpha > 1.0 || isNaN(this.alpha)) ? 1.0 : this.alpha); 5501 5502 // some getters 5503 this.toRGB = function () { 5504 return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')'; 5505 }; 5506 this.toRGBA = function () { 5507 return 'rgba(' + this.r + ', ' + this.g + ', ' + this.b + ', ' + this.alpha + ')'; 5508 }; 5509 this.toHex = function () { 5510 var r = this.r.toString(16); 5511 var g = this.g.toString(16); 5512 var b = this.b.toString(16); 5513 if (r.length == 1) r = '0' + r; 5514 if (g.length == 1) g = '0' + g; 5515 if (b.length == 1) b = '0' + b; 5516 return '#' + r + g + b; 5517 }; 5518 5519 // help 5520 this.getHelpXML = function () { 5521 5522 var examples = new Array(); 5523 // add regexps 5524 for (var i = 0; i < color_defs.length; i++) { 5525 var example = color_defs[i].example; 5526 for (var j = 0; j < example.length; j++) { 5527 examples[examples.length] = example[j]; 5528 } 5529 } 5530 // add type-in colors 5531 for (var sc in simple_colors) { 5532 examples[examples.length] = sc; 5533 } 5534 5535 var xml = document.createElement('ul'); 5536 xml.setAttribute('id', 'rgbcolor-examples'); 5537 for (var i = 0; i < examples.length; i++) { 5538 try { 5539 var list_item = document.createElement('li'); 5540 var list_color = new RGBColor(examples[i]); 5541 var example_div = document.createElement('div'); 5542 example_div.style.cssText = 5543 'margin: 3px; ' 5544 + 'border: 1px solid black; ' 5545 + 'background:' + list_color.toHex() + '; ' 5546 + 'color:' + list_color.toHex() 5547 ; 5548 example_div.appendChild(document.createTextNode('test')); 5549 var list_item_value = document.createTextNode( 5550 ' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex() 5551 ); 5552 list_item.appendChild(example_div); 5553 list_item.appendChild(list_item_value); 5554 xml.appendChild(list_item); 5555 5556 } catch(e){} 5557 } 5558 return xml; 5559 5560 }; 5561 5562 }; 5563 return rgbcolor; 5564} 5565 5566var rgbcolorExports = requireRgbcolor(); 5567const RGBColor$1 = /*@__PURE__*/getDefaultExportFromCjs(rgbcolorExports); 5568 5569var es_array_indexOf = {}; 5570 5571var hasRequiredEs_array_indexOf; 5572 5573function requireEs_array_indexOf () { 5574 if (hasRequiredEs_array_indexOf) return es_array_indexOf; 5575 hasRequiredEs_array_indexOf = 1; 5576 /* eslint-disable es/no-array-prototype-indexof -- required for testing */ 5577 var $ = require_export(); 5578 var uncurryThis = requireFunctionUncurryThisClause(); 5579 var $indexOf = requireArrayIncludes().indexOf; 5580 var arrayMethodIsStrict = requireArrayMethodIsStrict(); 5581 5582 var nativeIndexOf = uncurryThis([].indexOf); 5583 5584 var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0; 5585 var FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict('indexOf'); 5586 5587 // `Array.prototype.indexOf` method 5588 // https://tc39.es/ecma262/#sec-array.prototype.indexof 5589 $({ target: 'Array', proto: true, forced: FORCED }, { 5590 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { 5591 var fromIndex = arguments.length > 1 ? arguments[1] : undefined; 5592 return NEGATIVE_ZERO 5593 // convert -0 to +0 5594 ? nativeIndexOf(this, searchElement, fromIndex) || 0 5595 : $indexOf(this, searchElement, fromIndex); 5596 } 5597 }); 5598 return es_array_indexOf; 5599} 5600 5601requireEs_array_indexOf(); 5602 5603var es_string_includes = {}; 5604 5605var hasRequiredEs_string_includes; 5606 5607function requireEs_string_includes () { 5608 if (hasRequiredEs_string_includes) return es_string_includes; 5609 hasRequiredEs_string_includes = 1; 5610 var $ = require_export(); 5611 var uncurryThis = requireFunctionUncurryThis(); 5612 var notARegExp = requireNotARegexp(); 5613 var requireObjectCoercible = requireRequireObjectCoercible(); 5614 var toString = requireToString(); 5615 var correctIsRegExpLogic = requireCorrectIsRegexpLogic(); 5616 5617 var stringIndexOf = uncurryThis(''.indexOf); 5618 5619 // `String.prototype.includes` method 5620 // https://tc39.es/ecma262/#sec-string.prototype.includes 5621 $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { 5622 includes: function includes(searchString /* , position = 0 */) { 5623 return !!~stringIndexOf( 5624 toString(requireObjectCoercible(this)), 5625 toString(notARegExp(searchString)), 5626 arguments.length > 1 ? arguments[1] : undefined 5627 ); 5628 } 5629 }); 5630 return es_string_includes; 5631} 5632 5633requireEs_string_includes(); 5634 5635var es_array_reverse = {}; 5636 5637var isArray; 5638var hasRequiredIsArray; 5639 5640function requireIsArray () { 5641 if (hasRequiredIsArray) return isArray; 5642 hasRequiredIsArray = 1; 5643 var classof = requireClassofRaw(); 5644 5645 // `IsArray` abstract operation 5646 // https://tc39.es/ecma262/#sec-isarray 5647 // eslint-disable-next-line es/no-array-isarray -- safe 5648 isArray = Array.isArray || function isArray(argument) { 5649 return classof(argument) === 'Array'; 5650 }; 5651 return isArray; 5652} 5653 5654var hasRequiredEs_array_reverse; 5655 5656function requireEs_array_reverse () { 5657 if (hasRequiredEs_array_reverse) return es_array_reverse; 5658 hasRequiredEs_array_reverse = 1; 5659 var $ = require_export(); 5660 var uncurryThis = requireFunctionUncurryThis(); 5661 var isArray = requireIsArray(); 5662 5663 var nativeReverse = uncurryThis([].reverse); 5664 var test = [1, 2]; 5665 5666 // `Array.prototype.reverse` method 5667 // https://tc39.es/ecma262/#sec-array.prototype.reverse 5668 // fix for Safari 12.0 bug 5669 // https://bugs.webkit.org/show_bug.cgi?id=188794 5670 $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { 5671 reverse: function reverse() { 5672 // eslint-disable-next-line no-self-assign -- dirty hack 5673 if (isArray(this)) this.length = this.length; 5674 return nativeReverse(this); 5675 } 5676 }); 5677 return es_array_reverse; 5678} 5679 5680requireEs_array_reverse(); 5681 5682/*! ***************************************************************************** 5683Copyright (c) Microsoft Corporation. 5684 5685Permission to use, copy, modify, and/or distribute this software for any 5686purpose with or without fee is hereby granted. 5687 5688THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 5689REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 5690AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 5691INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 5692LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 5693OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 5694PERFORMANCE OF THIS SOFTWARE. 5695***************************************************************************** */ 5696var t=function(r,e){return (t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r;}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);})(r,e)};function r(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=r;}t(r,e),r.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i);}function e(t){var r="";Array.isArray(t)||(t=[t]);for(var e=0;e<t.length;e++){var i=t[e];if(i.type===_.CLOSE_PATH)r+="z";else if(i.type===_.HORIZ_LINE_TO)r+=(i.relative?"h":"H")+i.x;else if(i.type===_.VERT_LINE_TO)r+=(i.relative?"v":"V")+i.y;else if(i.type===_.MOVE_TO)r+=(i.relative?"m":"M")+i.x+" "+i.y;else if(i.type===_.LINE_TO)r+=(i.relative?"l":"L")+i.x+" "+i.y;else if(i.type===_.CURVE_TO)r+=(i.relative?"c":"C")+i.x1+" "+i.y1+" "+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===_.SMOOTH_CURVE_TO)r+=(i.relative?"s":"S")+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===_.QUAD_TO)r+=(i.relative?"q":"Q")+i.x1+" "+i.y1+" "+i.x+" "+i.y;else if(i.type===_.SMOOTH_QUAD_TO)r+=(i.relative?"t":"T")+i.x+" "+i.y;else {if(i.type!==_.ARC)throw new Error('Unexpected command type "'+i.type+'" at index '+e+".");r+=(i.relative?"a":"A")+i.rX+" "+i.rY+" "+i.xRot+" "+ +i.lArcFlag+" "+ +i.sweepFlag+" "+i.x+" "+i.y;}}return r}function i(t,r){var e=t[0],i=t[1];return [e*Math.cos(r)-i*Math.sin(r),e*Math.sin(r)+i*Math.cos(r)]}function a(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var e=0;e<t.length;e++)if("number"!=typeof t[e])throw new Error("assertNumbers arguments["+e+"] is not a number. "+typeof t[e]+" == typeof "+t[e]);return true}var n=Math.PI;function o(t,r,e){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;var a=t.rX,o=t.rY,s=t.x,u=t.y;a=Math.abs(t.rX),o=Math.abs(t.rY);var h=i([(r-s)/2,(e-u)/2],-t.xRot/180*n),c=h[0],y=h[1],p=Math.pow(c,2)/Math.pow(a,2)+Math.pow(y,2)/Math.pow(o,2);1<p&&(a*=Math.sqrt(p),o*=Math.sqrt(p)),t.rX=a,t.rY=o;var m=Math.pow(a,2)*Math.pow(y,2)+Math.pow(o,2)*Math.pow(c,2),O=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(a,2)*Math.pow(o,2)-m)/m)),l=a*y/o*O,T=-o*c/a*O,v=i([l,T],t.xRot/180*n);t.cX=v[0]+(r+s)/2,t.cY=v[1]+(e+u)/2,t.phi1=Math.atan2((y-T)/o,(c-l)/a
vendor: 13,520 bytes, line 5696
5696),t.phi2=Math.atan2((-y-T)/o,(-c-l)/a),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*n),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*n),t.phi1*=180/n,t.phi2*=180/n;}function s(t,r,e){a(t,r,e);var i=t*t+r*r-e*e;if(0>i)return [];if(0===i)return [[t*e/(t*t+r*r),r*e/(t*t+r*r)]];var n=Math.sqrt(i);return [[(t*e+r*n)/(t*t+r*r),(r*e-t*n)/(t*t+r*r)],[(t*e-r*n)/(t*t+r*r),(r*e+t*n)/(t*t+r*r)]]}var u,h=Math.PI/180;function c$1(t,r,e){return (1-e)*t+e*r}function y(t,r,e,i){return t+Math.cos(i/180*n)*r+Math.sin(i/180*n)*e}function p(t,r,e,i){var a=1e-6,n=r-t,o=e-r,s=3*n+3*(i-e)-6*o,u=6*(o-n),h=3*n;return Math.abs(s)<a?[-h/u]:function(t,r,e){var i=t*t/4-r;if(i<-e)return [];if(i<=e)return [-t/2];var a=Math.sqrt(i);return [-t/2-a,-t/2+a]}(u/s,h/s,a)}function m$1(t,r,e,i,a){var n=1-a;return t*(n*n*n)+r*(3*n*n*a)+e*(3*n*a*a)+i*(a*a*a)}!function(t){function r(){return u((function(t,r,e){return t.relative&&(void 0!==t.x1&&(t.x1+=r),void 0!==t.y1&&(t.y1+=e),void 0!==t.x2&&(t.x2+=r),void 0!==t.y2&&(t.y2+=e),void 0!==t.x&&(t.x+=r),void 0!==t.y&&(t.y+=e),t.relative=false),t}))}function e(){var t=NaN,r=NaN,e=NaN,i=NaN;return u((function(a,n,o){return a.type&_.SMOOTH_CURVE_TO&&(a.type=_.CURVE_TO,t=isNaN(t)?n:t,r=isNaN(r)?o:r,a.x1=a.relative?n-t:2*n-t,a.y1=a.relative?o-r:2*o-r),a.type&_.CURVE_TO?(t=a.relative?n+a.x2:a.x2,r=a.relative?o+a.y2:a.y2):(t=NaN,r=NaN),a.type&_.SMOOTH_QUAD_TO&&(a.type=_.QUAD_TO,e=isNaN(e)?n:e,i=isNaN(i)?o:i,a.x1=a.relative?n-e:2*n-e,a.y1=a.relative?o-i:2*o-i),a.type&_.QUAD_TO?(e=a.relative?n+a.x1:a.x1,i=a.relative?o+a.y1:a.y1):(e=NaN,i=NaN),a}))}function n(){var t=NaN,r=NaN;return u((function(e,i,a){if(e.type&_.SMOOTH_QUAD_TO&&(e.type=_.QUAD_TO,t=isNaN(t)?i:t,r=isNaN(r)?a:r,e.x1=e.relative?i-t:2*i-t,e.y1=e.relative?a-r:2*a-r),e.type&_.QUAD_TO){t=e.relative?i+e.x1:e.x1,r=e.relative?a+e.y1:e.y1;var n=e.x1,o=e.y1;e.type=_.CURVE_TO,e.x1=((e.relative?0:i)+2*n)/3,e.y1=((e.relative?0:a)+2*o)/3,e.x2=(e.x+2*n)/3,e.y2=(e.y+2*o)/3;}else t=NaN,r=NaN;return e}))}function u(t){var r=0,e=0,i=NaN,a=NaN;return function(n){if(isNaN(i)&&!(n.type&_.MOVE_TO))throw new Error("path must start with moveto");var o=t(n,r,e,i,a);return n.type&_.CLOSE_PATH&&(r=i,e=a),void 0!==n.x&&(r=n.relative?r+n.x:n.x),void 0!==n.y&&(e=n.relative?e+n.y:n.y),n.type&_.MOVE_TO&&(i=r,a=e),o}}function O(t,r,e,i,n,o){return a(t,r,e,i,n,o),u((function(a,s,u,h){var c=a.x1,y=a.x2,p=a.relative&&!isNaN(h),m=void 0!==a.x?a.x:p?0:s,O=void 0!==a.y?a.y:p?0:u;function l(t){return t*t}a.type&_.HORIZ_LINE_TO&&0!==r&&(a.type=_.LINE_TO,a.y=a.relative?0:u),a.type&_.VERT_LINE_TO&&0!==e&&(a.type=_.LINE_TO,a.x=a.relative?0:s),void 0!==a.x&&(a.x=a.x*t+O*e+(p?0:n)),void 0!==a.y&&(a.y=m*r+a.y*i+(p?0:o)),void 0!==a.x1&&(a.x1=a.x1*t+a.y1*e+(p?0:n)),void 0!==a.y1&&(a.y1=c*r+a.y1*i+(p?0:o)),void 0!==a.x2&&(a.x2=a.x2*t+a.y2*e+(p?0:n)),void 0!==a.y2&&(a.y2=y*r+a.y2*i+(p?0:o));var T=t*i-r*e;if(void 0!==a.xRot&&(1!==t||0!==r||0!==e||1!==i))if(0===T)delete a.rX,delete a.rY,delete a.xRot,delete a.lArcFlag,delete a.sweepFlag,a.type=_.LINE_TO;else {var v=a.xRot*Math.PI/180,f=Math.sin(v),N=Math.cos(v),x=1/l(a.rX),d=1/l(a.rY),E=l(N)*x+l(f)*d,A=2*f*N*(x-d),C=l(f)*x+l(N)*d,M=E*i*i-A*r*i+C*r*r,R=A*(t*i+r*e)-2*(E*e*i+C*t*r),g=E*e*e-A*t*e+C*t*t,I=(Math.atan2(R,M-g)+Math.PI)%Math.PI/2,S=Math.sin(I),L=Math.cos(I);a.rX=Math.abs(T)/Math.sqrt(M*l(L)+R*S*L+g*l(S)),a.rY=Math.abs(T)/Math.sqrt(M*l(S)-R*S*L+g*l(L)),a.xRot=180*I/Math.PI;}return void 0!==a.sweepFlag&&0>T&&(a.sweepFlag=+!a.sweepFlag),a}))}function l(){return function(t){var r={};for(var e in t)r[e]=t[e];return r}}t.ROUND=function(t){function r(r){return Math.round(r*t)/t}return void 0===t&&(t=1e13),a(t),function(t){return void 0!==t.x1&&(t.x1=r(t.x1)),void 0!==t.y1&&(t.y1=r(t.y1)),void 0!==t.x2&&(t.x2=r(t.x2)),void 0!==t.y2&&(t.y2=r(t.y2)),void 0!==t.x&&(t.x=r(t.x)),void 0!==t.y&&(t.y=r(t.y)),void 0!==t.rX&&(t.rX=r(t.rX)),void 0!==t.rY&&(t.rY=r(t.rY)),t}},t.TO_ABS=r,t.TO_REL=function(){return u((function(t,r,e){return t.relative||(void 0!==t.x1&&(t.x1-=r),void 0!==t.y1&&(t.y1-=e),void 0!==t.x2&&(t.x2-=r),void 0!==t.y2&&(t.y2-=e),void 0!==t.x&&(t.x-=r),void 0!==t.y&&(t.y-=e),t.relative=true),t}))},t.NORMALIZE_HVZ=function(t,r,e){return void 0===t&&(t=true),void 0===r&&(r=true),void 0===e&&(e=true),u((function(i,a,n,o,s){if(isNaN(o)&&!(i.type&_.MOVE_TO))throw new Error("path must start with moveto");return r&&i.type&_.HORIZ_LINE_TO&&(i.type=_.LINE_TO,i.y=i.relative?0:n),e&&i.type&_.VERT_LINE_TO&&(i.type=_.LINE_TO,i.x=i.relative?0:a),t&&i.type&_.CLOSE_PATH&&(i.type=_.LINE_TO,i.x=i.relative?o-a:o,i.y=i.relative?s-n:s),i.type&_.ARC&&(0===i.rX||0===i.rY)&&(i.type=_.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i}))},t.NORMALIZE_ST=e,t.QT_TO_C=n,t.INFO=u,t.SANITIZE=function(t){ void 0===t&&(t=0),a(t);var r=NaN,e=NaN,i=NaN,n=NaN;return u((function(a,o,s,u,h){var c=Math.abs,y=false,p=0,m=0;if(a.type&_.SMOOTH_CURVE_TO&&(p=isNaN(r)?0:o-r,m=isNaN(e)?0:s-e),a.type&(_.CURVE_TO|_.SMOOTH_CURVE_TO)?(r=a.relative?o+a.x2:a.x2,e=a.relative?s+a.y2:a.y2):(r=NaN,e=NaN),a.type&_.SMOOTH_QUAD_TO?(i=isNaN(i)?o:2*o-i,n=isNaN(n)?s:2*s-n):a.type&_.QUAD_TO?(i=a.relative?o+a.x1:a.x1,n=a.relative?s+a.y1:a.y2):(i=NaN,n=NaN),a.type&_.LINE_COMMANDS||a.type&_.ARC&&(0===a.rX||0===a.rY||!a.lArcFlag)||a.type&_.CURVE_TO||a.type&_.SMOOTH_CURVE_TO||a.type&_.QUAD_TO||a.type&_.SMOOTH_QUAD_TO){var O=void 0===a.x?0:a.relative?a.x:a.x-o,l=void 0===a.y?0:a.relative?a.y:a.y-s;p=isNaN(i)?void 0===a.x1?p:a.relative?a.x:a.x1-o:i-o,m=isNaN(n)?void 0===a.y1?m:a.relative?a.y:a.y1-s:n-s;var T=void 0===a.x2?0:a.relative?a.x:a.x2-o,v=void 0===a.y2?0:a.relative?a.y:a.y2-s;c(O)<=t&&c(l)<=t&&c(p)<=t&&c(m)<=t&&c(T)<=t&&c(v)<=t&&(y=true);}return a.type&_.CLOSE_PATH&&c(o-u)<=t&&c(s-h)<=t&&(y=true),y?[]:a}))},t.MATRIX=O,t.ROTATE=function(t,r,e){ void 0===r&&(r=0),void 0===e&&(e=0),a(t,r,e);var i=Math.sin(t),n=Math.cos(t);return O(n,i,-i,n,r-r*n+e*i,e-r*i-e*n)},t.TRANSLATE=function(t,r){return void 0===r&&(r=0),a(t,r),O(1,0,0,1,t,r)},t.SCALE=function(t,r){return void 0===r&&(r=t),a(t,r),O(t,0,0,r,0,0)},t.SKEW_X=function(t){return a(t),O(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return a(t),O(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),a(t),O(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),a(t),O(1,0,0,-1,0,t)},t.A_TO_C=function(){return u((function(t,r,e){return _.ARC===t.type?function(t,r,e){var a,n,s,u;t.cX||o(t,r,e);for(var y=Math.min(t.phi1,t.phi2),p=Math.max(t.phi1,t.phi2)-y,m=Math.ceil(p/90),O=new Array(m),l=r,T=e,v=0;v<m;v++){var f=c$1(t.phi1,t.phi2,v/m),N=c$1(t.phi1,t.phi2,(v+1)/m),x=N-f,d=4/3*Math.tan(x*h/4),E=[Math.cos(f*h)-d*Math.sin(f*h),Math.sin(f*h)+d*Math.cos(f*h)],A=E[0],C=E[1],M=[Math.cos(N*h),Math.sin(N*h)],R=M[0],g=M[1],I=[R+d*Math.sin(N*h),g-d*Math.cos(N*h)],S=I[0],L=I[1];O[v]={relative:t.relative,type:_.CURVE_TO};var H=function(r,e){var a=i([r*t.rX,e*t.rY],t.xRot),n=a[0],o=a[1];return [t.cX+n,t.cY+o]};a=H(A,C),O[v].x1=a[0],O[v].y1=a[1],n=H(S,L),O[v].x2=n[0],O[v].y2=n[1],s=H(R,g),O[v].x=s[0],O[v].y=s[1],t.relative&&(O[v].x1-=l,O[v].y1-=T,O[v].x2-=l,O[v].y2-=T,O[v].x-=l,O[v].y-=T),l=(u=[O[v].x,O[v].y])[0],T=u[1];}return O}(t,t.relative?0:r,t.relative?0:e):t}))},t.ANNOTATE_ARCS=function(){return u((function(t,r,e){return t.relative&&(r=0,e=0),_.ARC===t.type&&o(t,r,e),t}))},t.CLONE=l,t.CALCULATE_BOUNDS=function(){var t=function(t){var r={};for(var e in t)r[e]=t[e];return r},i=r(),a=n(),h=e(),c=u((function(r,e,n){var u=h(a(i(t(r))));function O(t){t>c.maxX&&(c.maxX=t),t<c.minX&&(c.minX=t);}function l(t){t>c.maxY&&(c.maxY=t),t<c.minY&&(c.minY=t);}if(u.type&_.DRAWING_COMMANDS&&(O(e),l(n)),u.type&_.HORIZ_LINE_TO&&O(u.x),u.type&_.VERT_LINE_TO&&l(u.y),u.type&_.LINE_TO&&(O(u.x),l(u.y)),u.type&_.CURVE_TO){O(u.x),l(u.y);for(var T=0,v=p(e,u.x1,u.x2,u.x);T<v.length;T++){0<(w=v[T])&&1>w&&O(m$1(e,u.x1,u.x2,u.x,w));}for(var f=0,N=p(n,u.y1,u.y2,u.y);f<N.length;f++){0<(w=N[f])&&1>w&&l(m$1(n,u.y1,u.y2,u.y,w));}}if(u.type&_.ARC){O(u.x),l(u.y),o(u,e,n);for(var x=u.xRot/180*Math.PI,d=Math.cos(x)*u.rX,E=Math.sin(x)*u.rX,A=-Math.sin(x)*u.rY,C=Math.cos(x)*u.rY,M=u.phi1<u.phi2?[u.phi1,u.phi2]:-180>u.phi2?[u.phi2+360,u.phi1+360]:[u.phi2,u.phi1],R=M[0],g=M[1],I=function(t){var r=t[0],e=t[1],i=180*Math.atan2(e,r)/Math.PI;return i<R?i+360:i},S=0,L=s(A,-d,0).map(I);S<L.length;S++){(w=L[S])>R&&w<g&&O(y(u.cX,d,A,w));}for(var H=0,U=s(C,-E,0).map(I);H<U.length;H++){var w;(w=U[H])>R&&w<g&&l(y(u.cY,E,C,w));}}return r}));return c.minX=1/0,c.maxX=-1/0,c.minY=1/0,c.maxY=-1/0,c};}(u||(u={}));var O,l=function(){function t(){}return t.prototype.round=function(t){return this.transform(u.ROUND(t))},t.prototype.toAbs=function(){return this.transform(u.TO_ABS())},t.prototype.toRel=function(){return this.transform(u.TO_REL())},t.prototype.normalizeHVZ=function(t,r,e){return this.transform(u.NORMALIZE_HVZ(t,r,e))},t.prototype.normalizeST=function(){return this.transform(u.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(u.QT_TO_C())},t.prototype.aToC=function(){return this.transform(u.A_TO_C())},t.prototype.sanitize=function(t){return this.transform(u.SANITIZE(t))},t.prototype.translate=function(t,r){return this.transform(u.TRANSLATE(t,r))},t.prototype.scale=function(t,r){return this.transform(u.SCALE(t,r))},t.prototype.rotate=function(t,r,e){return this.transform(u.ROTATE(t,r,e))},t.prototype.matrix=function(t,r,e,i,a,n){return this.transform(u.MATRIX(t,r,e,i,a,n))},t.prototype.skewX=function(t){return this.transform(u.SKEW_X(t))},t.prototype.skewY=function(t){return this.transform(u.SKEW_Y(t))},t.prototype.xSymmetry=function(t){return this.transform(u.X_AXIS_SYMMETRY(t))},t.prototype.ySymmetry=function(t){return this.transform(u.Y_AXIS_SYMMETRY(t))},t.prototype.annotateArcs=function(){return this.transform(u.ANNOTATE_ARCS())},t}(),T=function(t){return " "===t||"\t"===t||"\r"===t||"\n"===t},v=function(t){return "0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},f=function(t){function e(){var r=t.call(this)||this;return r.curNumber="",r.curCommandType=-1,r.curCommandRelative=false,r.canParseCommandOrComma=true,r.curNumberHasExp=false,r.curNumberHasExpDigits=false,r.curNumberHasDecimal=false,r.curArgs=[],r}return r(e,t),e.prototype.finish=function(t){if(void 0===t&&(t=[]),this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t},e.prototype.parse=function(t,r){var e=this;void 0===r&&(r=[]);for(var i=function(t){r.push(t),e.curArgs.length=0,e.canParseCommandOrComma=true;},a=0;a<t.length;a++){var n=t[a],o=!(this.curCommandType!==_.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=v(n)&&("0"===this.curNumber&&"0"===n||o);if(!v(n)||s)if("e"!==n&&"E"!==n)if("-"!==n&&"+"!==n||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==n||this.curNumberHasExp||this.curNumberHasDecimal||o){if(this.curNumber&&-1!==this.curCommandType){var u=Number(this.curNumber);if(isNaN(u))throw new SyntaxError("Invalid number ending at "+a);if(this.curCommandType===_.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>u)throw new SyntaxError('Expected positive number, got "'+u+'" at index "'+a+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+a+'"');this.curArgs.push(u),this.curArgs.length===N[this.curCommandType]&&(_.HORIZ_LINE_TO===this.curCommandType?i({type:_.HORIZ_LINE_TO,relative:this.curCommandRelative,x:u}):_.VERT_LINE_TO===this.curCommandType?i({type:_.VERT_LINE_TO,relative:this.curCommandRelative,y:u}):this.curCommandType===_.MOVE_TO||this.curCommandType===_.LINE_TO||this.curCommandType===_.SMOOTH_QUAD_TO?(i({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),_.MOVE_TO===this.curCommandType&&(this.curCommandType=_.LINE_TO)):this.curCommandType===_.CURVE_TO?i({type:_.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===_.SMOOTH_CURVE_TO?i({type:_.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.QUAD_TO?i({type:_.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.ARC&&i({type:_.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=false,this.curNumberHasExp=false,this.curNumberHasDecimal=false,this.canParseCommandOrComma=true;}if(!T(n))if(","===n&&this.canParseCommandOrComma)this.canParseCommandOrComma=false;else if("+"!==n&&"-"!==n&&"."!==n)if(s)this.curNumber=n,this.curNumberHasDecimal=false;else {if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+a+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+a+". Command cannot follow comma");if(this.canParseCommandOrComma=false,"z"!==n&&"Z"!==n)if("h"===n||"H"===n)this.curCommandType=_.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=_.VERT_LINE_TO,this.curCommandRelative="v"===n;
5696else if("m"===n||"M"===n)this.curCommandType=_.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=_.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=_.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=_.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=_.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=_.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else {if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+a+".");this.curCommandType=_.ARC,this.curCommandRelative="a"===n;}else r.push({type:_.CLOSE_PATH}),this.canParseCommandOrComma=true,this.curCommandType=-1;}else this.curNumber=n,this.curNumberHasDecimal="."===n;}else this.curNumber+=n,this.curNumberHasDecimal=true;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=true;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp;}return r},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(r,e){ void 0===e&&(e=[]);for(var i=0,a=Object.getPrototypeOf(this).parse.call(this,r);i<a.length;i++){var n=a[i],o=t(n);Array.isArray(o)?e.push.apply(e,o):e.push(o);}return e}}})},e}(l),_=function(t){function i(r){var e=t.call(this)||this;return e.commands="string"==typeof r?i.parse(r):r,e}return r(i,t),i.prototype.encode=function(){return i.encode(this.commands)},i.prototype.getBounds=function(){var t=u.CALCULATE_BOUNDS();return this.transform(t),t},i.prototype.transform=function(t){for(var r=[],e=0,i=this.commands;e<i.length;e++){var a=t(i[e]);Array.isArray(a)?r.push.apply(r,a):r.push(a);}return this.commands=r,this},i.encode=function(t){return e(t)},i.parse=function(t){var r=new f,e=[];return r.parse(t,e),r.finish(e),e},i.CLOSE_PATH=1,i.MOVE_TO=2,i.HORIZ_LINE_TO=4,i.VERT_LINE_TO=8,i.LINE_TO=16,i.CURVE_TO=32,i.SMOOTH_CURVE_TO=64,i.QUAD_TO=128,i.SMOOTH_QUAD_TO=256,i.ARC=512,i.LINE_COMMANDS=i.LINE_TO|i.HORIZ_LINE_TO|i.VERT_LINE_TO,i.DRAWING_COMMANDS=i.HORIZ_LINE_TO|i.VERT_LINE_TO|i.LINE_TO|i.CURVE_TO|i.SMOOTH_CURVE_TO|i.QUAD_TO|i.SMOOTH_QUAD_TO|i.ARC,i}(l),N=((O={})[_.MOVE_TO]=2,O[_.LINE_TO]=2,O[_.HORIZ_LINE_TO]=1,O[_.VERT_LINE_TO]=1,O[_.CLOSE_PATH]=0,O[_.QUAD_TO]=4,O[_.SMOOTH_QUAD_TO]=2,O[_.CURVE_TO]=6,O[_.SMOOTH_CURVE_TO]=4,O[_.ARC]=7,O); 5697 5698var es_regexp_toString = {}; 5699 5700var hasRequiredEs_regexp_toString; 5701 5702function requireEs_regexp_toString () { 5703 if (hasRequiredEs_regexp_toString) return es_regexp_toString; 5704 hasRequiredEs_regexp_toString = 1; 5705 var PROPER_FUNCTION_NAME = requireFunctionName().PROPER; 5706 var defineBuiltIn = requireDefineBuiltIn(); 5707 var anObject = requireAnObject(); 5708 var $toString = requireToString(); 5709 var fails = requireFails(); 5710 var getRegExpFlags = requireRegexpGetFlags(); 5711 5712 var TO_STRING = 'toString'; 5713 var RegExpPrototype = RegExp.prototype; 5714 var nativeToString = RegExpPrototype[TO_STRING]; 5715 5716 var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; }); 5717 // FF44- RegExp#toString has a wrong name 5718 var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING; 5719 5720 // `RegExp.prototype.toString` method 5721 // https://tc39.es/ecma262/#sec-regexp.prototype.tostring 5722 if (NOT_GENERIC || INCORRECT_NAME) { 5723 defineBuiltIn(RegExpPrototype, TO_STRING, function toString() { 5724 var R = anObject(this); 5725 var pattern = $toString(R.source); 5726 var flags = $toString(getRegExpFlags(R)); 5727 return '/' + pattern + '/' + flags; 5728 }, { unsafe: true }); 5729 } 5730 return es_regexp_toString; 5731} 5732 5733requireEs_regexp_toString(); 5734 5735function _typeof(obj) { 5736 "@babel/helpers - typeof"; 5737 5738 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 5739 _typeof = function (obj) { 5740 return typeof obj; 5741 }; 5742 } else { 5743 _typeof = function (obj) { 5744 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 5745 }; 5746 } 5747 5748 return _typeof(obj); 5749} 5750 5751function _classCallCheck(instance, Constructor) { 5752 if (!(instance instanceof Constructor)) { 5753 throw new TypeError("Cannot call a class as a function"); 5754 } 5755} 5756 5757/* eslint-disable no-bitwise -- used for calculations */ 5758
vendor: 5,877 bytes, lines 5759-5868
5759/* eslint-disable unicorn/prefer-query-selector -- aiming at 5760 backward-compatibility */ 5761 5762/** 5763* StackBlur - a fast almost Gaussian Blur For Canvas 5764* 5765* In case you find this class useful - especially in commercial projects - 5766* I am not totally unhappy for a small donation to my PayPal account 5767* [email protected] 5768* 5769* Or support me on flattr: 5770* {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}. 5771* 5772* @module StackBlur 5773* @author Mario Klingemann 5774* Contact: [email protected] 5775* Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html} 5776* Twitter: @quasimondo 5777* 5778* @copyright (c) 2010 Mario Klingemann 5779* 5780* Permission is hereby granted, free of charge, to any person 5781* obtaining a copy of this software and associated documentation 5782* files (the "Software"), to deal in the Software without 5783* restriction, including without limitation the rights to use, 5784* copy, modify, merge, publish, distribute, sublicense, and/or sell 5785* copies of the Software, and to permit persons to whom the 5786* Software is furnished to do so, subject to the following 5787* conditions: 5788* 5789* The above copyright notice and this permission notice shall be 5790* included in all copies or substantial portions of the Software. 5791* 5792* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 5793* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 5794* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 5795* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 5796* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 5797* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 5798* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 5799* OTHER DEALINGS IN THE SOFTWARE. 5800*/ 5801var mulTable = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; 5802var shgTable = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; 5803/** 5804 * @param {string|HTMLCanvasElement} canvas 5805 * @param {Integer} topX 5806 * @param {Integer} topY 5807 * @param {Integer} width 5808 * @param {Integer} height 5809 * @throws {Error|TypeError} 5810 * @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata} 5811 */ 5812 5813 5814function getImageDataFromCanvas(canvas, topX, topY, width, height) { 5815 if (typeof canvas === 'string') { 5816 canvas = document.getElementById(canvas); 5817 } 5818 5819 if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) { 5820 throw new TypeError('Expecting canvas with `getContext` method ' + 'in processCanvasRGB(A) calls!'); 5821 } 5822 5823 var context = canvas.getContext('2d'); 5824 5825 try { 5826 return context.getImageData(topX, topY, width, height); 5827 } catch (e) { 5828 throw new Error('unable to access image data: ' + e); 5829 } 5830} 5831/** 5832 * @param {HTMLCanvasElement} canvas 5833 * @param {Integer} topX 5834 * @param {Integer} topY 5835 * @param {Integer} width 5836 * @param {Integer} height 5837 * @param {Float} radius 5838 * @returns {undefined} 5839 */ 5840 5841 5842function processCanvasRGBA(canvas, topX, topY, width, height, radius) { 5843 if (isNaN(radius) || radius < 1) { 5844 return; 5845 } 5846 5847 radius |= 0; 5848 var imageData = getImageDataFromCanvas(canvas, topX, topY, width, height); 5849 imageData = processImageDataRGBA(imageData, topX, topY, width, height, radius); 5850 canvas.getContext('2d').putImageData(imageData, topX, topY); 5851} 5852/** 5853 * @param {ImageData} imageData 5854 * @param {Integer} topX 5855 * @param {Integer} topY 5856 * @param {Integer} width 5857 * @param {Integer} height 5858 * @param {Float} radius 5859 * @returns {ImageData} 5860 */ 5861 5862 5863function processImageDataRGBA(imageData, topX, topY, width, height, radius) { 5864 var pixels = imageData.data; 5865 var div = 2 * radius + 1; // const w4 = width << 2; 5866 5867 var widthMinus1 = width - 1; 5868 var heightMinus1 = height - 1;
vendor: 6,574 bytes, lines 5869-6134
5869 var radiusPlus1 = radius + 1; 5870 var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2; 5871 var stackStart = new BlurStack(); 5872 var stack = stackStart; 5873 var stackEnd; 5874 5875 for (var i = 1; i < div; i++) { 5876 stack = stack.next = new BlurStack(); 5877 5878 if (i === radiusPlus1) { 5879 stackEnd = stack; 5880 } 5881 } 5882 5883 stack.next = stackStart; 5884 var stackIn = null, 5885 stackOut = null, 5886 yw = 0, 5887 yi = 0; 5888 var mulSum = mulTable[radius]; 5889 var shgSum = shgTable[radius]; 5890 5891 for (var y = 0; y < height; y++) { 5892 stack = stackStart; 5893 var pr = pixels[yi], 5894 pg = pixels[yi + 1], 5895 pb = pixels[yi + 2], 5896 pa = pixels[yi + 3]; 5897 5898 for (var _i = 0; _i < radiusPlus1; _i++) { 5899 stack.r = pr; 5900 stack.g = pg; 5901 stack.b = pb; 5902 stack.a = pa; 5903 stack = stack.next; 5904 } 5905 5906 var rInSum = 0, 5907 gInSum = 0, 5908 bInSum = 0, 5909 aInSum = 0, 5910 rOutSum = radiusPlus1 * pr, 5911 gOutSum = radiusPlus1 * pg, 5912 bOutSum = radiusPlus1 * pb, 5913 aOutSum = radiusPlus1 * pa, 5914 rSum = sumFactor * pr, 5915 gSum = sumFactor * pg, 5916 bSum = sumFactor * pb, 5917 aSum = sumFactor * pa; 5918 5919 for (var _i2 = 1; _i2 < radiusPlus1; _i2++) { 5920 var p = yi + ((widthMinus1 < _i2 ? widthMinus1 : _i2) << 2); 5921 var r = pixels[p], 5922 g = pixels[p + 1], 5923 b = pixels[p + 2], 5924 a = pixels[p + 3]; 5925 var rbs = radiusPlus1 - _i2; 5926 rSum += (stack.r = r) * rbs; 5927 gSum += (stack.g = g) * rbs; 5928 bSum += (stack.b = b) * rbs; 5929 aSum += (stack.a = a) * rbs; 5930 rInSum += r; 5931 gInSum += g; 5932 bInSum += b; 5933 aInSum += a; 5934 stack = stack.next; 5935 } 5936 5937 stackIn = stackStart; 5938 stackOut = stackEnd; 5939 5940 for (var x = 0; x < width; x++) { 5941 var paInitial = aSum * mulSum >>> shgSum; 5942 pixels[yi + 3] = paInitial; 5943 5944 if (paInitial !== 0) { 5945 var _a2 = 255 / paInitial; 5946 5947 pixels[yi] = (rSum * mulSum >>> shgSum) * _a2; 5948 pixels[yi + 1] = (gSum * mulSum >>> shgSum) * _a2; 5949 pixels[yi + 2] = (bSum * mulSum >>> shgSum) * _a2; 5950 } else { 5951 pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0; 5952 } 5953 5954 rSum -= rOutSum; 5955 gSum -= gOutSum; 5956 bSum -= bOutSum; 5957 aSum -= aOutSum; 5958 rOutSum -= stackIn.r; 5959 gOutSum -= stackIn.g; 5960 bOutSum -= stackIn.b; 5961 aOutSum -= stackIn.a; 5962 5963 var _p = x + radius + 1; 5964 5965 _p = yw + (_p < widthMinus1 ? _p : widthMinus1) << 2; 5966 rInSum += stackIn.r = pixels[_p]; 5967 gInSum += stackIn.g = pixels[_p + 1]; 5968 bInSum += stackIn.b = pixels[_p + 2]; 5969 aInSum += stackIn.a = pixels[_p + 3]; 5970 rSum += rInSum; 5971 gSum += gInSum; 5972 bSum += bInSum; 5973 aSum += aInSum; 5974 stackIn = stackIn.next; 5975 var _stackOut = stackOut, 5976 _r = _stackOut.r, 5977 _g = _stackOut.g, 5978 _b = _stackOut.b, 5979 _a = _stackOut.a; 5980 rOutSum += _r; 5981 gOutSum += _g; 5982 bOutSum += _b; 5983 aOutSum += _a; 5984 rInSum -= _r; 5985 gInSum -= _g; 5986 bInSum -= _b; 5987 aInSum -= _a; 5988 stackOut = stackOut.next; 5989 yi += 4; 5990 } 5991 5992 yw += width; 5993 } 5994 5995 for (var _x = 0; _x < width; _x++) { 5996 yi = _x << 2; 5997 5998 var _pr = pixels[yi], 5999 _pg = pixels[yi + 1], 6000 _pb = pixels[yi + 2], 6001 _pa = pixels[yi + 3], 6002 _rOutSum = radiusPlus1 * _pr, 6003 _gOutSum = radiusPlus1 * _pg, 6004 _bOutSum = radiusPlus1 * _pb, 6005 _aOutSum = radiusPlus1 * _pa, 6006 _rSum = sumFactor * _pr, 6007 _gSum = sumFactor * _pg, 6008 _bSum = sumFactor * _pb, 6009 _aSum = sumFactor * _pa; 6010 6011 stack = stackStart; 6012 6013 for (var _i3 = 0; _i3 < radiusPlus1; _i3++) { 6014 stack.r = _pr; 6015 stack.g = _pg; 6016 stack.b = _pb; 6017 stack.a = _pa; 6018 stack = stack.next; 6019 } 6020 6021 var yp = width; 6022 var _gInSum = 0, 6023 _bInSum = 0, 6024 _aInSum = 0, 6025 _rInSum = 0; 6026 6027 for (var _i4 = 1; _i4 <= radius; _i4++) { 6028 yi = yp + _x << 2; 6029 6030 var _rbs = radiusPlus1 - _i4; 6031 6032 _rSum += (stack.r = _pr = pixels[yi]) * _rbs; 6033 _gSum += (stack.g = _pg = pixels[yi + 1]) * _rbs; 6034 _bSum += (stack.b = _pb = pixels[yi + 2]) * _rbs; 6035 _aSum += (stack.a = _pa = pixels[yi + 3]) * _rbs; 6036 _rInSum += _pr; 6037 _gInSum += _pg; 6038 _bInSum += _pb; 6039 _aInSum += _pa; 6040 stack = stack.next; 6041 6042 if (_i4 < heightMinus1) { 6043 yp += width; 6044 } 6045 } 6046 6047 yi = _x; 6048 stackIn = stackStart; 6049 stackOut = stackEnd; 6050 6051 for (var _y = 0; _y < height; _y++) { 6052 var _p2 = yi << 2; 6053 6054 pixels[_p2 + 3] = _pa = _aSum * mulSum >>> shgSum; 6055 6056 if (_pa > 0) { 6057 _pa = 255 / _pa; 6058 pixels[_p2] = (_rSum * mulSum >>> shgSum) * _pa; 6059 pixels[_p2 + 1] = (_gSum * mulSum >>> shgSum) * _pa; 6060 pixels[_p2 + 2] = (_bSum * mulSum >>> shgSum) * _pa; 6061 } else { 6062 pixels[_p2] = pixels[_p2 + 1] = pixels[_p2 + 2] = 0; 6063 } 6064 6065 _rSum -= _rOutSum; 6066 _gSum -= _gOutSum; 6067 _bSum -= _bOutSum; 6068 _aSum -= _aOutSum; 6069 _rOutSum -= stackIn.r; 6070 _gOutSum -= stackIn.g; 6071 _bOutSum -= stackIn.b; 6072 _aOutSum -= stackIn.a; 6073 _p2 = _x + ((_p2 = _y + radiusPlus1) < heightMinus1 ? _p2 : heightMinus1) * width << 2; 6074 _rSum += _rInSum += stackIn.r = pixels[_p2]; 6075 _gSum += _gInSum += stackIn.g = pixels[_p2 + 1]; 6076 _bSum += _bInSum += stackIn.b = pixels[_p2 + 2]; 6077 _aSum += _aInSum += stackIn.a = pixels[_p2 + 3]; 6078 stackIn = stackIn.next; 6079 _rOutSum += _pr = stackOut.r; 6080 _gOutSum += _pg = stackOut.g; 6081 _bOutSum += _pb = stackOut.b; 6082 _aOutSum += _pa = stackOut.a; 6083 _rInSum -= _pr; 6084 _gInSum -= _pg; 6085 _bInSum -= _pb; 6086 _aInSum -= _pa; 6087 stackOut = stackOut.next; 6088 yi += width; 6089 } 6090 } 6091 6092 return imageData; 6093} 6094/** 6095 * 6096 */ 6097 6098 6099var BlurStack = 6100/** 6101 * Set properties. 6102 */ 6103function BlurStack() { 6104 _classCallCheck(this, BlurStack); 6105 6106 this.r = 0; 6107 this.g = 0; 6108 this.b = 0; 6109 this.a = 0; 6110 this.next = null; 6111}; 6112 6113/** 6114 * Options preset for `OffscreenCanvas`. 6115 * @param config - Preset requirements. 6116 * @param config.DOMParser - XML/HTML parser from string into DOM Document. 6117 * @returns Preset object. 6118 */ 6119function offscreen() { 6120 var { 6121 DOMParser: DOMParserFallback 6122 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 6123 var preset = { 6124 window: null, 6125 ignoreAnimation: true, 6126 ignoreMouse: true, 6127 DOMParser: DOMParserFallback, 6128 6129 createCanvas(width, height) { 6130 return new OffscreenCanvas(width, height); 6131 }, 6132 6133 createImage(url) { 6134 return _asyncToGenerator
vendor: 12,273 bytes, lines 6134-6667
6134(function* () { 6135 var response = yield fetch(url); 6136 var blob = yield response.blob(); 6137 var img = yield createImageBitmap(blob); 6138 return img; 6139 })(); 6140 } 6141 6142 }; 6143 6144 if (typeof DOMParser !== 'undefined' || typeof DOMParserFallback === 'undefined') { 6145 Reflect.deleteProperty(preset, 'DOMParser'); 6146 } 6147 6148 return preset; 6149} 6150 6151/** 6152 * Options preset for `node-canvas`. 6153 * @param config - Preset requirements. 6154 * @param config.DOMParser - XML/HTML parser from string into DOM Document. 6155 * @param config.canvas - `node-canvas` exports. 6156 * @param config.fetch - WHATWG-compatible `fetch` function. 6157 * @returns Preset object. 6158 */ 6159function node(_ref) { 6160 var { 6161 DOMParser, 6162 canvas, 6163 fetch 6164 } = _ref; 6165 return { 6166 window: null, 6167 ignoreAnimation: true, 6168 ignoreMouse: true, 6169 DOMParser, 6170 fetch, 6171 createCanvas: canvas.createCanvas, 6172 createImage: canvas.loadImage 6173 }; 6174} 6175 6176var index = /*#__PURE__*/Object.freeze({ 6177 __proto__: null, 6178 offscreen: offscreen, 6179 node: node 6180}); 6181 6182/** 6183 * HTML-safe compress white-spaces. 6184 * @param str - String to compress. 6185 * @returns String. 6186 */ 6187function compressSpaces(str) { 6188 return str.replace(/(?!\u3000)\s+/gm, ' '); 6189} 6190/** 6191 * HTML-safe left trim. 6192 * @param str - String to trim. 6193 * @returns String. 6194 */ 6195 6196function trimLeft(str) { 6197 return str.replace(/^[\n \t]+/, ''); 6198} 6199/** 6200 * HTML-safe right trim. 6201 * @param str - String to trim. 6202 * @returns String. 6203 */ 6204 6205function trimRight(str) { 6206 return str.replace(/[\n \t]+$/, ''); 6207} 6208/** 6209 * String to numbers array. 6210 * @param str - Numbers string. 6211 * @returns Numbers array. 6212 */ 6213 6214function toNumbers(str) { 6215 var matches = (str || '').match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm) || []; 6216 return matches.map(parseFloat); 6217} // Microsoft Edge fix 6218 6219var allUppercase = /^[A-Z-]+$/; 6220/** 6221 * Normalize attribute name. 6222 * @param name - Attribute name. 6223 * @returns Normalized attribute name. 6224 */ 6225 6226function normalizeAttributeName(name) { 6227 if (allUppercase.test(name)) { 6228 return name.toLowerCase(); 6229 } 6230 6231 return name; 6232} 6233/** 6234 * Parse external URL. 6235 * @param url - CSS url string. 6236 * @returns Parsed URL. 6237 */ 6238 6239function parseExternalUrl(url) { 6240 // single quotes [2] 6241 // v double quotes [3] 6242 // v v no quotes [4] 6243 // v v v 6244 var urlMatch = /url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(url) || []; 6245 return urlMatch[2] || urlMatch[3] || urlMatch[4]; 6246} 6247/** 6248 * Transform floats to integers in rgb colors. 6249 * @param color - Color to normalize. 6250 * @returns Normalized color. 6251 */ 6252 6253function normalizeColor(color) { 6254 if (!color.startsWith('rgb')) { 6255 return color; 6256 } 6257 6258 var rgbParts = 3; 6259 var normalizedColor = color.replace(/\d+(\.\d+)?/g, (num, isFloat) => rgbParts-- && isFloat ? String(Math.round(parseFloat(num))) : num); 6260 return normalizedColor; 6261} 6262 6263// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js 6264var attributeRegex = /(\[[^\]]+\])/g; 6265var idRegex = /(#[^\s+>~.[:]+)/g; 6266var classRegex = /(\.[^\s+>~.[:]+)/g; 6267var pseudoElementRegex = /(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi; 6268var pseudoClassWithBracketsRegex = /(:[\w-]+\([^)]*\))/gi; 6269var pseudoClassRegex = /(:[^\s+>~.[:]+)/g; 6270var elementRegex = /([^\s+>~.[:]+)/g; 6271 6272function findSelectorMatch(selector, regex) { 6273 var matches = regex.exec(selector); 6274 6275 if (!matches) { 6276 return [selector, 0]; 6277 } 6278 6279 return [selector.replace(regex, ' '), matches.length]; 6280} 6281/** 6282 * Measure selector specificity. 6283 * @param selector - Selector to measure. 6284 * @returns Specificity. 6285 */ 6286 6287 6288function getSelectorSpecificity(selector) { 6289 var specificity = [0, 0, 0]; 6290 var currentSelector = selector.replace(/:not\(([^)]*)\)/g, ' $1 ').replace(/{[\s\S]*/gm, ' '); 6291 var delta = 0; 6292 [currentSelector, delta] = findSelectorMatch(currentSelector, attributeRegex); 6293 specificity[1] += delta; 6294 [currentSelector, delta] = findSelectorMatch(currentSelector, idRegex); 6295 specificity[0] += delta; 6296 [currentSelector, delta] = findSelectorMatch(currentSelector, classRegex); 6297 specificity[1] += delta; 6298 [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoElementRegex); 6299 specificity[2] += delta; 6300 [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoClassWithBracketsRegex); 6301 specificity[1] += delta; 6302 [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoClassRegex); 6303 specificity[1] += delta; 6304 currentSelector = currentSelector.replace(/[*\s+>~]/g, ' ').replace(/[#.]/g, ' '); 6305 [currentSelector, delta] = findSelectorMatch(currentSelector, elementRegex); // lgtm [js/useless-assignment-to-local] 6306 6307 specificity[2] += delta; 6308 return specificity.join(''); 6309} 6310 6311var PSEUDO_ZERO = .00000001; 6312/** 6313 * Vector magnitude. 6314 * @param v 6315 * @returns Number result. 6316 */ 6317 6318function vectorMagnitude(v) { 6319 return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2)); 6320} 6321/** 6322 * Ratio between two vectors. 6323 * @param u 6324 * @param v 6325 * @returns Number result. 6326 */ 6327 6328function vectorsRatio(u, v) { 6329 return (u[0] * v[0] + u[1] * v[1]) / (vectorMagnitude(u) * vectorMagnitude(v)); 6330} 6331/** 6332 * Angle between two vectors. 6333 * @param u 6334 * @param v 6335 * @returns Number result. 6336 */ 6337 6338function vectorsAngle(u, v) { 6339 return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vectorsRatio(u, v)); 6340} 6341function CB1(t) { 6342 return t * t * t; 6343} 6344function CB2(t) { 6345 return 3 * t * t * (1 - t); 6346} 6347function CB3(t) { 6348 return 3 * t * (1 - t) * (1 - t); 6349} 6350function CB4(t) { 6351 return (1 - t) * (1 - t) * (1 - t); 6352} 6353function QB1(t) { 6354 return t * t; 6355} 6356function QB2(t) { 6357 return 2 * t * (1 - t); 6358} 6359function QB3(t) { 6360 return (1 - t) * (1 - t); 6361} 6362 6363class Property { 6364 constructor(document, name, value) { 6365 this.document = document; 6366 this.name = name; 6367 this.value = value; 6368 this.isNormalizedColor = false; 6369 } 6370 6371 static empty(document) { 6372 return new Property(document, 'EMPTY', ''); 6373 } 6374 6375 split() { 6376 var separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ' '; 6377 var { 6378 document, 6379 name 6380 } = this; 6381 return compressSpaces(this.getString()).trim().split(separator).map(value => new Property(document, name, value)); 6382 } 6383 6384 hasValue(zeroIsValue) { 6385 var { 6386 value 6387 } = this; 6388 return value !== null && value !== '' && (zeroIsValue || value !== 0) && typeof value !== 'undefined'; 6389 } 6390 6391 isString(regexp) { 6392 var { 6393 value 6394 } = this; 6395 var result = typeof value === 'string'; 6396 6397 if (!result || !regexp) { 6398 return result; 6399 } 6400 6401 return regexp.test(value); 6402 } 6403 6404 isUrlDefinition() { 6405 return this.isString(/^url\(/); 6406 } 6407 6408 isPixels() { 6409 if (!this.hasValue()) { 6410 return false; 6411 } 6412 6413 var asString = this.getString(); 6414 6415 switch (true) { 6416 case asString.endsWith('px'): 6417 case /^[0-9]+$/.test(asString): 6418 return true; 6419 6420 default: 6421 return false; 6422 } 6423 } 6424 6425 setValue(value) { 6426 this.value = value; 6427 return this; 6428 } 6429 6430 getValue(def) { 6431 if (typeof def === 'undefined' || this.hasValue()) { 6432 return this.value; 6433 } 6434 6435 return def; 6436 } 6437 6438 getNumber(def) { 6439 if (!this.hasValue()) { 6440 if (typeof def === 'undefined') { 6441 return 0; 6442 } 6443 6444 return parseFloat(def); 6445 } 6446 6447 var { 6448 value 6449 } = this; 6450 var n = parseFloat(value); 6451 6452 if (this.isString(/%$/)) { 6453 n /= 100.0; 6454 } 6455 6456 return n; 6457 } 6458 6459 getString(def) { 6460 if (typeof def === 'undefined' || this.hasValue()) { 6461 return typeof this.value === 'undefined' ? '' : String(this.value); 6462 } 6463 6464 return String(def); 6465 } 6466 6467 getColor(def) { 6468 var color = this.getString(def); 6469 6470 if (this.isNormalizedColor) { 6471 return color; 6472 } 6473 6474 this.isNormalizedColor = true; 6475 color = normalizeColor(color); 6476 this.value = color; 6477 return color; 6478 } 6479 6480 getDpi() { 6481 return 96.0; // TODO: compute? 6482 } 6483 6484 getRem() { 6485 return this.document.rootEmSize; 6486 } 6487 6488 getEm() { 6489 return this.document.emSize; 6490 } 6491 6492 getUnits() { 6493 return this.getString().replace(/[0-9.-]/g, ''); 6494 } 6495 6496 getPixels(axisOrIsFontSize) { 6497 var processPercent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 6498 6499 if (!this.hasValue()) { 6500 return 0; 6501 } 6502 6503 var [axis, isFontSize] = typeof axisOrIsFontSize === 'boolean' ? [undefined, axisOrIsFontSize] : [axisOrIsFontSize]; 6504 var { 6505 viewPort 6506 } = this.document.screen; 6507 6508 switch (true) { 6509 case this.isString(/vmin$/): 6510 return this.getNumber() / 100.0 * Math.min(viewPort.computeSize('x'), viewPort.computeSize('y')); 6511 6512 case this.isString(/vmax$/): 6513 return this.getNumber() / 100.0 * Math.max(viewPort.computeSize('x'), viewPort.computeSize('y')); 6514 6515 case this.isString(/vw$/): 6516 return this.getNumber() / 100.0 * viewPort.computeSize('x'); 6517 6518 case this.isString(/vh$/): 6519 return this.getNumber() / 100.0 * viewPort.computeSize('y'); 6520 6521 case this.isString(/rem$/): 6522 return this.getNumber() * this.getRem(); 6523 6524 case this.isString(/em$/): 6525 return this.getNumber() * this.getEm(); 6526 6527 case this.isString(/ex$/): 6528 return this.getNumber() * this.getEm() / 2.0; 6529 6530 case this.isString(/px$/): 6531 return this.getNumber(); 6532 6533 case this.isString(/pt$/): 6534 return this.getNumber() * this.getDpi() * (1.0 / 72.0); 6535 6536 case this.isString(/pc$/): 6537 return this.getNumber() * 15; 6538 6539 case this.isString(/cm$/): 6540 return this.getNumber() * this.getDpi() / 2.54; 6541 6542 case this.isString(/mm$/): 6543 return this.getNumber() * this.getDpi() / 25.4; 6544 6545 case this.isString(/in$/): 6546 return this.getNumber() * this.getDpi(); 6547 6548 case this.isString(/%$/) && isFontSize: 6549 return this.getNumber() * this.getEm(); 6550 6551 case this.isString(/%$/): 6552 return this.getNumber() * viewPort.computeSize(axis); 6553 6554 default: 6555 { 6556 var n = this.getNumber(); 6557 6558 if (processPercent && n < 1.0) { 6559 return n * viewPort.computeSize(axis); 6560 } 6561 6562 return n; 6563 } 6564 } 6565 } 6566 6567 getMilliseconds() { 6568 if (!this.hasValue()) { 6569 return 0; 6570 } 6571 6572 if (this.isString(/ms$/)) { 6573 return this.getNumber(); 6574 } 6575 6576 return this.getNumber() * 1000; 6577 } 6578 6579 getRadians() { 6580 if (!this.hasValue()) { 6581 return 0; 6582 } 6583 6584 switch (true) { 6585 case this.isString(/deg$/): 6586 return this.getNumber() * (Math.PI / 180.0); 6587 6588 case this.isString(/grad$/): 6589 return this.getNumber() * (Math.PI / 200.0); 6590 6591 case this.isString(/rad$/): 6592 return this.getNumber(); 6593 6594 default: 6595 return this.getNumber() * (Math.PI / 180.0); 6596 } 6597 } 6598 6599 getDefinition() { 6600 var asString = this.getString(); 6601 var name = /#([^)'"]+)/.exec(asString); 6602 6603 if (name) { 6604 name = name[1]; 6605 } 6606 6607 if (!name) { 6608 name = asString; 6609 } 6610 6611 return this.document.definitions[name]; 6612 } 6613 6614 getFillStyleDefinition(element, opacity) { 6615 var def = this.getDefinition(); 6616 6617 if (!def) { 6618 return null; 6619 } // gradient 6620 6621 6622 if (typeof def.createGradient === 'function') { 6623 return def.createGradient(this.document.ctx, element, opacity); 6624 } // pattern 6625 6626 6627 if (typeof def.createPattern === 'function') { 6628 if (def.getHrefAttribute().hasValue()) { 6629 var patternTransform = def.getAttribute('patternTransform'); 6630 def = def.getHrefAttribute().getDefinition(); 6631 6632 if (patternTransform.hasValue()) { 6633 def.getAttribute('patternTransform', true).setValue(patternTransform.value); 6634 } 6635 } 6636 6637 return def.createPattern(this.document.ctx, element, opacity); 6638 } 6639 6640 return null; 6641 } 6642 6643 getTextBaseline() { 6644 if (!this.hasValue()) { 6645 return null; 6646 } 6647 6648 return Property.textBaselineMapping[this.getString()]; 6649 } 6650 6651 addOpacity(opacity) { 6652 var value = this.getColor(); 6653 var len = value.length; 6654 var commas = 0; // Simulate old RGBColor version, which can't parse rgba. 6655 6656 for (var i = 0; i < len; i++) { 6657 if (value[i] === ',') { 6658 commas++; 6659 } 6660 6661 if (commas === 3) { 6662 break; 6663 } 6664 } 6665 6666 if (opacity.hasValue() && this.isString() && commas !== 3) { 6667 var color = new
vendor: 11,559 bytes, lines 6667-7210
6667RGBColor$1(value); 6668 6669 if (color.ok) { 6670 color.alpha = opacity.getNumber(); 6671 value = color.toRGBA(); 6672 } 6673 } 6674 6675 return new Property(this.document, this.name, value); 6676 } 6677 6678} 6679Property.textBaselineMapping = { 6680 'baseline': 'alphabetic', 6681 'before-edge': 'top', 6682 'text-before-edge': 'top', 6683 'middle': 'middle', 6684 'central': 'middle', 6685 'after-edge': 'bottom', 6686 'text-after-edge': 'bottom', 6687 'ideographic': 'ideographic', 6688 'alphabetic': 'alphabetic', 6689 'hanging': 'hanging', 6690 'mathematical': 'alphabetic' 6691}; 6692 6693class ViewPort { 6694 constructor() { 6695 this.viewPorts = []; 6696 } 6697 6698 clear() { 6699 this.viewPorts = []; 6700 } 6701 6702 setCurrent(width, height) { 6703 this.viewPorts.push({ 6704 width, 6705 height 6706 }); 6707 } 6708 6709 removeCurrent() { 6710 this.viewPorts.pop(); 6711 } 6712 6713 getCurrent() { 6714 var { 6715 viewPorts 6716 } = this; 6717 return viewPorts[viewPorts.length - 1]; 6718 } 6719 6720 get width() { 6721 return this.getCurrent().width; 6722 } 6723 6724 get height() { 6725 return this.getCurrent().height; 6726 } 6727 6728 computeSize(d) { 6729 if (typeof d === 'number') { 6730 return d; 6731 } 6732 6733 if (d === 'x') { 6734 return this.width; 6735 } 6736 6737 if (d === 'y') { 6738 return this.height; 6739 } 6740 6741 return Math.sqrt(Math.pow(this.width, 2) + Math.pow(this.height, 2)) / Math.sqrt(2); 6742 } 6743 6744} 6745 6746class Point { 6747 constructor(x, y) { 6748 this.x = x; 6749 this.y = y; 6750 } 6751 6752 static parse(point) { 6753 var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 6754 var [x = defaultValue, y = defaultValue] = toNumbers(point); 6755 return new Point(x, y); 6756 } 6757 6758 static parseScale(scale) { 6759 var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; 6760 var [x = defaultValue, y = x] = toNumbers(scale); 6761 return new Point(x, y); 6762 } 6763 6764 static parsePath(path) { 6765 var points = toNumbers(path); 6766 var len = points.length; 6767 var pathPoints = []; 6768 6769 for (var i = 0; i < len; i += 2) { 6770 pathPoints.push(new Point(points[i], points[i + 1])); 6771 } 6772 6773 return pathPoints; 6774 } 6775 6776 angleTo(point) { 6777 return Math.atan2(point.y - this.y, point.x - this.x); 6778 } 6779 6780 applyTransform(transform) { 6781 var { 6782 x, 6783 y 6784 } = this; 6785 var xp = x * transform[0] + y * transform[2] + transform[4]; 6786 var yp = x * transform[1] + y * transform[3] + transform[5]; 6787 this.x = xp; 6788 this.y = yp; 6789 } 6790 6791} 6792 6793class Mouse { 6794 constructor(screen) { 6795 this.screen = screen; 6796 this.working = false; 6797 this.events = []; 6798 this.eventElements = []; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment 6799 6800 this.onClick = this.onClick.bind(this); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment 6801 6802 this.onMouseMove = this.onMouseMove.bind(this); 6803 } 6804 6805 isWorking() { 6806 return this.working; 6807 } 6808 6809 start() { 6810 if (this.working) { 6811 return; 6812 } 6813 6814 var { 6815 screen, 6816 onClick, 6817 onMouseMove 6818 } = this; 6819 var canvas = screen.ctx.canvas; 6820 canvas.onclick = onClick; 6821 canvas.onmousemove = onMouseMove; 6822 this.working = true; 6823 } 6824 6825 stop() { 6826 if (!this.working) { 6827 return; 6828 } 6829 6830 var canvas = this.screen.ctx.canvas; 6831 this.working = false; 6832 canvas.onclick = null; 6833 canvas.onmousemove = null; 6834 } 6835 6836 hasEvents() { 6837 return this.working && this.events.length > 0; 6838 } 6839 6840 runEvents() { 6841 if (!this.working) { 6842 return; 6843 } 6844 6845 var { 6846 screen: document, 6847 events, 6848 eventElements 6849 } = this; 6850 var { 6851 style 6852 } = document.ctx.canvas; 6853 6854 if (style) { 6855 style.cursor = ''; 6856 } 6857 6858 events.forEach((_ref, i) => { 6859 var { 6860 run 6861 } = _ref; 6862 var element = eventElements[i]; 6863 6864 while (element) { 6865 run(element); 6866 element = element.parent; 6867 } 6868 }); // done running, clear 6869 6870 this.events = []; 6871 this.eventElements = []; 6872 } 6873 6874 checkPath(element, ctx) { 6875 if (!this.working || !ctx) { 6876 return; 6877 } 6878 6879 var { 6880 events, 6881 eventElements 6882 } = this; 6883 events.forEach((_ref2, i) => { 6884 var { 6885 x, 6886 y 6887 } = _ref2; 6888 6889 if (!eventElements[i] && ctx.isPointInPath && ctx.isPointInPath(x, y)) { 6890 eventElements[i] = element; 6891 } 6892 }); 6893 } 6894 6895 checkBoundingBox(element, boundingBox) { 6896 if (!this.working || !boundingBox) { 6897 return; 6898 } 6899 6900 var { 6901 events, 6902 eventElements 6903 } = this; 6904 events.forEach((_ref3, i) => { 6905 var { 6906 x, 6907 y 6908 } = _ref3; 6909 6910 if (!eventElements[i] && boundingBox.isPointInBox(x, y)) { 6911 eventElements[i] = element; 6912 } 6913 }); 6914 } 6915 6916 mapXY(x, y) { 6917 var { 6918 window, 6919 ctx 6920 } = this.screen; 6921 var point = new Point(x, y); 6922 var element = ctx.canvas; 6923 6924 while (element) { 6925 point.x -= element.offsetLeft; 6926 point.y -= element.offsetTop; 6927 element = element.offsetParent; 6928 } 6929 6930 if (window.scrollX) { 6931 point.x += window.scrollX; 6932 } 6933 6934 if (window.scrollY) { 6935 point.y += window.scrollY; 6936 } 6937 6938 return point; 6939 } 6940 6941 onClick(event) { 6942 var { 6943 x, 6944 y 6945 } = this.mapXY(event.clientX, event.clientY); 6946 this.events.push({ 6947 type: 'onclick', 6948 x, 6949 y, 6950 6951 run(eventTarget) { 6952 if (eventTarget.onClick) { 6953 eventTarget.onClick(); 6954 } 6955 } 6956 6957 }); 6958 } 6959 6960 onMouseMove(event) { 6961 var { 6962 x, 6963 y 6964 } = this.mapXY(event.clientX, event.clientY); 6965 this.events.push({ 6966 type: 'onmousemove', 6967 x, 6968 y, 6969 6970 run(eventTarget) { 6971 if (eventTarget.onMouseMove) { 6972 eventTarget.onMouseMove(); 6973 } 6974 } 6975 6976 }); 6977 } 6978 6979} 6980 6981var defaultWindow = typeof window !== 'undefined' ? window : null; 6982var defaultFetch$1 = typeof fetch !== 'undefined' ? fetch.bind(undefined) // `fetch` depends on context: `someObject.fetch(...)` will throw error. 6983: null; 6984class Screen { 6985 constructor(ctx) { 6986 var { 6987 fetch = defaultFetch$1, 6988 window = defaultWindow 6989 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6990 this.ctx = ctx; 6991 this.FRAMERATE = 30; 6992 this.MAX_VIRTUAL_PIXELS = 30000; 6993 this.CLIENT_WIDTH = 800; 6994 this.CLIENT_HEIGHT = 600; 6995 this.viewPort = new ViewPort(); 6996 this.mouse = new Mouse(this); 6997 this.animations = []; 6998 this.waits = []; 6999 this.frameDuration = 0; 7000 this.isReadyLock = false; 7001 this.isFirstRender = true; 7002 this.intervalId = null; 7003 this.window = window; 7004 this.fetch = fetch; 7005 } 7006 7007 wait(checker) { 7008 this.waits.push(checker); 7009 } 7010 7011 ready() { 7012 // eslint-disable-next-line @typescript-eslint/no-misused-promises 7013 if (!this.readyPromise) { 7014 return Promise.resolve(); 7015 } 7016 7017 return this.readyPromise; 7018 } 7019 7020 isReady() { 7021 if (this.isReadyLock) { 7022 return true; 7023 } 7024 7025 var isReadyLock = this.waits.every(_ => _()); 7026 7027 if (isReadyLock) { 7028 this.waits = []; 7029 7030 if (this.resolveReady) { 7031 this.resolveReady(); 7032 } 7033 } 7034 7035 this.isReadyLock = isReadyLock; 7036 return isReadyLock; 7037 } 7038 7039 setDefaults(ctx) { 7040 // initial values and defaults 7041 ctx.strokeStyle = 'rgba(0,0,0,0)'; 7042 ctx.lineCap = 'butt'; 7043 ctx.lineJoin = 'miter'; 7044 ctx.miterLimit = 4; 7045 } 7046 7047 setViewBox(_ref) { 7048 var { 7049 document, 7050 ctx, 7051 aspectRatio, 7052 width, 7053 desiredWidth, 7054 height, 7055 desiredHeight, 7056 minX = 0, 7057 minY = 0, 7058 refX, 7059 refY, 7060 clip = false, 7061 clipX = 0, 7062 clipY = 0 7063 } = _ref; 7064 // aspect ratio - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute 7065 var cleanAspectRatio = compressSpaces(aspectRatio).replace(/^defer\s/, ''); // ignore defer 7066 7067 var [aspectRatioAlign, aspectRatioMeetOrSlice] = cleanAspectRatio.split(' '); 7068 var align = aspectRatioAlign || 'xMidYMid'; 7069 var meetOrSlice = aspectRatioMeetOrSlice || 'meet'; // calculate scale 7070 7071 var scaleX = width / desiredWidth; 7072 var scaleY = height / desiredHeight; 7073 var scaleMin = Math.min(scaleX, scaleY); 7074 var scaleMax = Math.max(scaleX, scaleY); 7075 var finalDesiredWidth = desiredWidth; 7076 var finalDesiredHeight = desiredHeight; 7077 7078 if (meetOrSlice === 'meet') { 7079 finalDesiredWidth *= scaleMin; 7080 finalDesiredHeight *= scaleMin; 7081 } 7082 7083 if (meetOrSlice === 'slice') { 7084 finalDesiredWidth *= scaleMax; 7085 finalDesiredHeight *= scaleMax; 7086 } 7087 7088 var refXProp = new Property(document, 'refX', refX); 7089 var refYProp = new Property(document, 'refY', refY); 7090 var hasRefs = refXProp.hasValue() && refYProp.hasValue(); 7091 7092 if (hasRefs) { 7093 ctx.translate(-scaleMin * refXProp.getPixels('x'), -scaleMin * refYProp.getPixels('y')); 7094 } 7095 7096 if (clip) { 7097 var scaledClipX = scaleMin * clipX; 7098 var scaledClipY = scaleMin * clipY; 7099 ctx.beginPath(); 7100 ctx.moveTo(scaledClipX, scaledClipY); 7101 ctx.lineTo(width, scaledClipY); 7102 ctx.lineTo(width, height); 7103 ctx.lineTo(scaledClipX, height); 7104 ctx.closePath(); 7105 ctx.clip(); 7106 } 7107 7108 if (!hasRefs) { 7109 var isMeetMinY = meetOrSlice === 'meet' && scaleMin === scaleY; 7110 var isSliceMaxY = meetOrSlice === 'slice' && scaleMax === scaleY; 7111 var isMeetMinX = meetOrSlice === 'meet' && scaleMin === scaleX; 7112 var isSliceMaxX = meetOrSlice === 'slice' && scaleMax === scaleX; 7113 7114 if (align.startsWith('xMid') && (isMeetMinY || isSliceMaxY)) { 7115 ctx.translate(width / 2.0 - finalDesiredWidth / 2.0, 0); 7116 } 7117 7118 if (align.endsWith('YMid') && (isMeetMinX || isSliceMaxX)) { 7119 ctx.translate(0, height / 2.0 - finalDesiredHeight / 2.0); 7120 } 7121 7122 if (align.startsWith('xMax') && (isMeetMinY || isSliceMaxY)) { 7123 ctx.translate(width - finalDesiredWidth, 0); 7124 } 7125 7126 if (align.endsWith('YMax') && (isMeetMinX || isSliceMaxX)) { 7127 ctx.translate(0, height - finalDesiredHeight); 7128 } 7129 } // scale 7130 7131 7132 switch (true) { 7133 case align === 'none': 7134 ctx.scale(scaleX, scaleY); 7135 break; 7136 7137 case meetOrSlice === 'meet': 7138 ctx.scale(scaleMin, scaleMin); 7139 break; 7140 7141 case meetOrSlice === 'slice': 7142 ctx.scale(scaleMax, scaleMax); 7143 break; 7144 } // translate 7145 7146 7147 ctx.translate(-minX, -minY); 7148 } 7149 7150 start(element) { 7151 var { 7152 enableRedraw = false, 7153 ignoreMouse = false, 7154 ignoreAnimation = false, 7155 ignoreDimensions = false, 7156 ignoreClear = false, 7157 forceRedraw, 7158 scaleWidth, 7159 scaleHeight, 7160 offsetX, 7161 offsetY 7162 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 7163 var { 7164 FRAMERATE, 7165 mouse 7166 } = this; 7167 var frameDuration = 1000 / FRAMERATE; 7168 this.frameDuration = frameDuration; 7169 this.readyPromise = new Promise(resolve => { 7170 this.resolveReady = resolve; 7171 }); 7172 7173 if (this.isReady()) { 7174 this.render(element, ignoreDimensions, ignoreClear, scaleWidth, scaleHeight, offsetX, offsetY); 7175 } 7176 7177 if (!enableRedraw) { 7178 return; 7179 } 7180 7181 var now = Date.now(); 7182 var then = now; 7183 var delta = 0; 7184 7185 var tick = () => { 7186 now = Date.now(); 7187 delta = now - then; 7188 7189 if (delta >= frameDuration) { 7190 then = now - delta % frameDuration; 7191 7192 if (this.shouldUpdate(ignoreAnimation, forceRedraw)) { 7193 this.render(element, ignoreDimensions, ignoreClear, scaleWidth, scaleHeight, offsetX, offsetY); 7194 mouse.runEvents(); 7195 } 7196 } 7197 7198 this.intervalId = requestAnimationFrame(tick); 7199 }; 7200 7201 if (!ignoreMouse) { 7202 mouse.start(); 7203 } 7204 7205 this.intervalId = requestAnimationFrame(tick); 7206 } 7207 7208 stop() { 7209 if (this.intervalId) { 7210 requestAnimationFrame
vendor: 4,298 bytes, lines 7210-7376
7210.cancel(this.intervalId); 7211 this.intervalId = null; 7212 } 7213 7214 this.mouse.stop(); 7215 } 7216 7217 shouldUpdate(ignoreAnimation, forceRedraw) { 7218 // need update from animations? 7219 if (!ignoreAnimation) { 7220 var { 7221 frameDuration 7222 } = this; 7223 var shouldUpdate = this.animations.reduce((shouldUpdate, animation) => animation.update(frameDuration) || shouldUpdate, false); 7224 7225 if (shouldUpdate) { 7226 return true; 7227 } 7228 } // need update from redraw? 7229 7230 7231 if (typeof forceRedraw === 'function' && forceRedraw()) { 7232 return true; 7233 } 7234 7235 if (!this.isReadyLock && this.isReady()) { 7236 return true; 7237 } // need update from mouse events? 7238 7239 7240 if (this.mouse.hasEvents()) { 7241 return true; 7242 } 7243 7244 return false; 7245 } 7246 7247 render(element, ignoreDimensions, ignoreClear, scaleWidth, scaleHeight, offsetX, offsetY) { 7248 var { 7249 CLIENT_WIDTH, 7250 CLIENT_HEIGHT, 7251 viewPort, 7252 ctx, 7253 isFirstRender 7254 } = this; 7255 var canvas = ctx.canvas; 7256 viewPort.clear(); 7257 7258 if (canvas.width && canvas.height) { 7259 viewPort.setCurrent(canvas.width, canvas.height); 7260 } else { 7261 viewPort.setCurrent(CLIENT_WIDTH, CLIENT_HEIGHT); 7262 } 7263 7264 var widthStyle = element.getStyle('width'); 7265 var heightStyle = element.getStyle('height'); 7266 7267 if (!ignoreDimensions && (isFirstRender || typeof scaleWidth !== 'number' && typeof scaleHeight !== 'number')) { 7268 // set canvas size 7269 if (widthStyle.hasValue()) { 7270 canvas.width = widthStyle.getPixels('x'); 7271 7272 if (canvas.style) { 7273 canvas.style.width = "".concat(canvas.width, "px"); 7274 } 7275 } 7276 7277 if (heightStyle.hasValue()) { 7278 canvas.height = heightStyle.getPixels('y'); 7279 7280 if (canvas.style) { 7281 canvas.style.height = "".concat(canvas.height, "px"); 7282 } 7283 } 7284 } 7285 7286 var cWidth = canvas.clientWidth || canvas.width; 7287 var cHeight = canvas.clientHeight || canvas.height; 7288 7289 if (ignoreDimensions && widthStyle.hasValue() && heightStyle.hasValue()) { 7290 cWidth = widthStyle.getPixels('x'); 7291 cHeight = heightStyle.getPixels('y'); 7292 } 7293 7294 viewPort.setCurrent(cWidth, cHeight); 7295 7296 if (typeof offsetX === 'number') { 7297 element.getAttribute('x', true).setValue(offsetX); 7298 } 7299 7300 if (typeof offsetY === 'number') { 7301 element.getAttribute('y', true).setValue(offsetY); 7302 } 7303 7304 if (typeof scaleWidth === 'number' || typeof scaleHeight === 'number') { 7305 var viewBox = toNumbers(element.getAttribute('viewBox').getString()); 7306 var xRatio = 0; 7307 var yRatio = 0; 7308 7309 if (typeof scaleWidth === 'number') { 7310 var _widthStyle = element.getStyle('width'); 7311 7312 if (_widthStyle.hasValue()) { 7313 xRatio = _widthStyle.getPixels('x') / scaleWidth; 7314 } else if (!isNaN(viewBox[2])) { 7315 xRatio = viewBox[2] / scaleWidth; 7316 } 7317 } 7318 7319 if (typeof scaleHeight === 'number') { 7320 var _heightStyle = element.getStyle('height'); 7321 7322 if (_heightStyle.hasValue()) { 7323 yRatio = _heightStyle.getPixels('y') / scaleHeight; 7324 } else if (!isNaN(viewBox[3])) { 7325 yRatio = viewBox[3] / scaleHeight; 7326 } 7327 } 7328 7329 if (!xRatio) { 7330 xRatio = yRatio; 7331 } 7332 7333 if (!yRatio) { 7334 yRatio = xRatio; 7335 } 7336 7337 element.getAttribute('width', true).setValue(scaleWidth); 7338 element.getAttribute('height', true).setValue(scaleHeight); 7339 var transformStyle = element.getStyle('transform', true, true); 7340 transformStyle.setValue("".concat(transformStyle.getString(), " scale(").concat(1.0 / xRatio, ", ").concat(1.0 / yRatio, ")")); 7341 } // clear and render 7342 7343 7344 if (!ignoreClear) { 7345 ctx.clearRect(0, 0, cWidth, cHeight); 7346 } 7347 7348 element.render(ctx); 7349 7350 if (isFirstRender) { 7351 this.isFirstRender = false; 7352 } 7353 } 7354 7355} 7356Screen.defaultWindow = defaultWindow; 7357Screen.defaultFetch = defaultFetch$1; 7358 7359var { 7360 defaultFetch 7361} = Screen; 7362var DefaultDOMParser = typeof DOMParser !== 'undefined' ? DOMParser : null; 7363class Parser { 7364 constructor() { 7365 var { 7366 fetch = defaultFetch, 7367 DOMParser = DefaultDOMParser 7368 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7369 this.fetch = fetch; 7370 this.DOMParser = DOMParser; 7371 } 7372 7373 parse(resource) { 7374 var _this = this; 7375 7376 return
vendor: 2,325 bytes, lines 7376-7492
7376_asyncToGenerator(function* () { 7377 if (resource.startsWith('<')) { 7378 return _this.parseFromString(resource); 7379 } 7380 7381 return _this.load(resource); 7382 })(); 7383 } 7384 7385 parseFromString(xml) { 7386 var parser = new this.DOMParser(); 7387 7388 try { 7389 return this.checkDocument(parser.parseFromString(xml, 'image/svg+xml')); 7390 } catch (err) { 7391 return this.checkDocument(parser.parseFromString(xml, 'text/xml')); 7392 } 7393 } 7394 7395 checkDocument(document) { 7396 var parserError = document.getElementsByTagName('parsererror')[0]; 7397 7398 if (parserError) { 7399 throw new Error(parserError.textContent); 7400 } 7401 7402 return document; 7403 } 7404 7405 load(url) { 7406 var _this2 = this; 7407 7408 return _asyncToGenerator(function* () { 7409 var response = yield _this2.fetch(url); 7410 var xml = yield response.text(); 7411 return _this2.parseFromString(xml); 7412 })(); 7413 } 7414 7415} 7416 7417class Translate { 7418 constructor(_, point) { 7419 this.type = 'translate'; 7420 this.point = null; 7421 this.point = Point.parse(point); 7422 } 7423 7424 apply(ctx) { 7425 var { 7426 x, 7427 y 7428 } = this.point; 7429 ctx.translate(x || 0.0, y || 0.0); 7430 } 7431 7432 unapply(ctx) { 7433 var { 7434 x, 7435 y 7436 } = this.point; 7437 ctx.translate(-1 * x || 0.0, -1 * y || 0.0); 7438 } 7439 7440 applyToPoint(point) { 7441 var { 7442 x, 7443 y 7444 } = this.point; 7445 point.applyTransform([1, 0, 0, 1, x || 0.0, y || 0.0]); 7446 } 7447 7448} 7449 7450class Rotate { 7451 constructor(document, rotate, transformOrigin) { 7452 this.type = 'rotate'; 7453 this.angle = null; 7454 this.originX = null; 7455 this.originY = null; 7456 this.cx = 0; 7457 this.cy = 0; 7458 var numbers = toNumbers(rotate); 7459 this.angle = new Property(document, 'angle', numbers[0]); 7460 this.originX = transformOrigin[0]; 7461 this.originY = transformOrigin[1]; 7462 this.cx = numbers[1] || 0; 7463 this.cy = numbers[2] || 0; 7464 } 7465 7466 apply(ctx) { 7467 var { 7468 cx, 7469 cy, 7470 originX, 7471 originY, 7472 angle 7473 } = this; 7474 var tx = cx + originX.getPixels('x'); 7475 var ty = cy + originY.getPixels('y'); 7476 ctx.translate(tx, ty); 7477 ctx.rotate(angle.getRadians()); 7478 ctx.translate(-tx, -ty); 7479 } 7480 7481 unapply(ctx) { 7482 var { 7483 cx, 7484 cy, 7485 originX, 7486 originY, 7487 angle 7488 } = this; 7489 var tx = cx + originX.getPixels('x'); 7490 var ty = cy + originY.getPixels('y'); 7491 ctx.translate(tx, ty); 7492 ctx.rotate(-1
vendor: 20,594 bytes, lines 7492-8354
7492 * angle.getRadians()); 7493 ctx.translate(-tx, -ty); 7494 } 7495 7496 applyToPoint(point) { 7497 var { 7498 cx, 7499 cy, 7500 angle 7501 } = this; 7502 var rad = angle.getRadians(); 7503 point.applyTransform([1, 0, 0, 1, cx || 0.0, cy || 0.0 // this.p.y 7504 ]); 7505 point.applyTransform([Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), 0, 0]); 7506 point.applyTransform([1, 0, 0, 1, -cx || 0.0, -cy || 0.0 // -this.p.y 7507 ]); 7508 } 7509 7510} 7511 7512class Scale { 7513 constructor(_, scale, transformOrigin) { 7514 this.type = 'scale'; 7515 this.scale = null; 7516 this.originX = null; 7517 this.originY = null; 7518 var scaleSize = Point.parseScale(scale); // Workaround for node-canvas 7519 7520 if (scaleSize.x === 0 || scaleSize.y === 0) { 7521 scaleSize.x = PSEUDO_ZERO; 7522 scaleSize.y = PSEUDO_ZERO; 7523 } 7524 7525 this.scale = scaleSize; 7526 this.originX = transformOrigin[0]; 7527 this.originY = transformOrigin[1]; 7528 } 7529 7530 apply(ctx) { 7531 var { 7532 scale: { 7533 x, 7534 y 7535 }, 7536 originX, 7537 originY 7538 } = this; 7539 var tx = originX.getPixels('x'); 7540 var ty = originY.getPixels('y'); 7541 ctx.translate(tx, ty); 7542 ctx.scale(x, y || x); 7543 ctx.translate(-tx, -ty); 7544 } 7545 7546 unapply(ctx) { 7547 var { 7548 scale: { 7549 x, 7550 y 7551 }, 7552 originX, 7553 originY 7554 } = this; 7555 var tx = originX.getPixels('x'); 7556 var ty = originY.getPixels('y'); 7557 ctx.translate(tx, ty); 7558 ctx.scale(1.0 / x, 1.0 / y || x); 7559 ctx.translate(-tx, -ty); 7560 } 7561 7562 applyToPoint(point) { 7563 var { 7564 x, 7565 y 7566 } = this.scale; 7567 point.applyTransform([x || 0.0, 0, 0, y || 0.0, 0, 0]); 7568 } 7569 7570} 7571 7572class Matrix { 7573 constructor(_, matrix, transformOrigin) { 7574 this.type = 'matrix'; 7575 this.matrix = []; 7576 this.originX = null; 7577 this.originY = null; 7578 this.matrix = toNumbers(matrix); 7579 this.originX = transformOrigin[0]; 7580 this.originY = transformOrigin[1]; 7581 } 7582 7583 apply(ctx) { 7584 var { 7585 originX, 7586 originY, 7587 matrix 7588 } = this; 7589 var tx = originX.getPixels('x'); 7590 var ty = originY.getPixels('y'); 7591 ctx.translate(tx, ty); 7592 ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); 7593 ctx.translate(-tx, -ty); 7594 } 7595 7596 unapply(ctx) { 7597 var { 7598 originX, 7599 originY, 7600 matrix 7601 } = this; 7602 var a = matrix[0]; 7603 var b = matrix[2]; 7604 var c = matrix[4]; 7605 var d = matrix[1]; 7606 var e = matrix[3]; 7607 var f = matrix[5]; 7608 var g = 0.0; 7609 var h = 0.0; 7610 var i = 1.0; 7611 var det = 1 / (a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g)); 7612 var tx = originX.getPixels('x'); 7613 var ty = originY.getPixels('y'); 7614 ctx.translate(tx, ty); 7615 ctx.transform(det * (e * i - f * h), det * (f * g - d * i), det * (c * h - b * i), det * (a * i - c * g), det * (b * f - c * e), det * (c * d - a * f)); 7616 ctx.translate(-tx, -ty); 7617 } 7618 7619 applyToPoint(point) { 7620 point.applyTransform(this.matrix); 7621 } 7622 7623} 7624 7625class Skew extends Matrix { 7626 constructor(document, skew, transformOrigin) { 7627 super(document, skew, transformOrigin); 7628 this.type = 'skew'; 7629 this.angle = null; 7630 this.angle = new Property(document, 'angle', skew); 7631 } 7632 7633} 7634 7635class SkewX extends Skew { 7636 constructor(document, skew, transformOrigin) { 7637 super(document, skew, transformOrigin); 7638 this.type = 'skewX'; 7639 this.matrix = [1, 0, Math.tan(this.angle.getRadians()), 1, 0, 0]; 7640 } 7641 7642} 7643 7644class SkewY extends Skew { 7645 constructor(document, skew, transformOrigin) { 7646 super(document, skew, transformOrigin); 7647 this.type = 'skewY'; 7648 this.matrix = [1, Math.tan(this.angle.getRadians()), 0, 1, 0, 0]; 7649 } 7650 7651} 7652 7653function parseTransforms(transform) { 7654 return compressSpaces(transform).trim().replace(/\)([a-zA-Z])/g, ') $1').replace(/\)(\s?,\s?)/g, ') ').split(/\s(?=[a-z])/); 7655} 7656 7657function parseTransform(transform) { 7658 var [type, value] = transform.split('('); 7659 return [type.trim(), value.trim().replace(')', '')]; 7660} 7661 7662class Transform { 7663 constructor(document, transform, transformOrigin) { 7664 this.document = document; 7665 this.transforms = []; 7666 var data = parseTransforms(transform); 7667 data.forEach(transform => { 7668 if (transform === 'none') { 7669 return; 7670 } 7671 7672 var [type, value] = parseTransform(transform); 7673 var TransformType = Transform.transformTypes[type]; 7674 7675 if (typeof TransformType !== 'undefined') { 7676 this.transforms.push(new TransformType(this.document, value, transformOrigin)); 7677 } 7678 }); 7679 } 7680 7681 static fromElement(document, element) { 7682 var transformStyle = element.getStyle('transform', false, true); 7683 var [transformOriginXProperty, transformOriginYProperty = transformOriginXProperty] = element.getStyle('transform-origin', false, true).split(); 7684 var transformOrigin = [transformOriginXProperty, transformOriginYProperty]; 7685 7686 if (transformStyle.hasValue()) { 7687 return new Transform(document, transformStyle.getString(), transformOrigin); 7688 } 7689 7690 return null; 7691 } 7692 7693 apply(ctx) { 7694 var { 7695 transforms 7696 } = this; 7697 var len = transforms.length; 7698 7699 for (var i = 0; i < len; i++) { 7700 transforms[i].apply(ctx); 7701 } 7702 } 7703 7704 unapply(ctx) { 7705 var { 7706 transforms 7707 } = this; 7708 var len = transforms.length; 7709 7710 for (var i = len - 1; i >= 0; i--) { 7711 transforms[i].unapply(ctx); 7712 } 7713 } // TODO: applyToPoint unused ... remove? 7714 7715 7716 applyToPoint(point) { 7717 var { 7718 transforms 7719 } = this; 7720 var len = transforms.length; 7721 7722 for (var i = 0; i < len; i++) { 7723 transforms[i].applyToPoint(point); 7724 } 7725 } 7726 7727} 7728Transform.transformTypes = { 7729 translate: Translate, 7730 rotate: Rotate, 7731 scale: Scale, 7732 matrix: Matrix, 7733 skewX: SkewX, 7734 skewY: SkewY 7735}; 7736 7737class Element { 7738 constructor(document, node) { 7739 var captureTextNodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 7740 this.document = document; 7741 this.node = node; 7742 this.captureTextNodes = captureTextNodes; 7743 this.attributes = Object.create(null); 7744 this.styles = Object.create(null); 7745 this.stylesSpecificity = Object.create(null); 7746 this.animationFrozen = false; 7747 this.animationFrozenValue = ''; 7748 this.parent = null; 7749 this.children = []; 7750 7751 if (!node || node.nodeType !== 1) { 7752 // ELEMENT_NODE 7753 return; 7754 } // add attributes 7755 7756 7757 Array.from(node.attributes).forEach(attribute => { 7758 var nodeName = normalizeAttributeName(attribute.nodeName); 7759 this.attributes[nodeName] = new Property(document, nodeName, attribute.value); 7760 }); 7761 this.addStylesFromStyleDefinition(); // add inline styles 7762 7763 if (this.getAttribute('style').hasValue()) { 7764 var styles = this.getAttribute('style').getString().split(';').map(_ => _.trim()); 7765 styles.forEach(style => { 7766 if (!style) { 7767 return; 7768 } 7769 7770 var [name, value] = style.split(':').map(_ => _.trim()); 7771 this.styles[name] = new Property(document, name, value); 7772 }); 7773 } 7774 7775 var { 7776 definitions 7777 } = document; 7778 var id = this.getAttribute('id'); // add id 7779 7780 if (id.hasValue()) { 7781 if (!definitions[id.getString()]) { 7782 definitions[id.getString()] = this; 7783 } 7784 } 7785 7786 Array.from(node.childNodes).forEach(childNode => { 7787 if (childNode.nodeType === 1) { 7788 this.addChild(childNode); // ELEMENT_NODE 7789 } else if (captureTextNodes && (childNode.nodeType === 3 || childNode.nodeType === 4)) { 7790 var textNode = document.createTextNode(childNode); 7791 7792 if (textNode.getText().length > 0) { 7793 this.addChild(textNode); // TEXT_NODE 7794 } 7795 } 7796 }); 7797 } 7798 7799 getAttribute(name) { 7800 var createIfNotExists = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 7801 var attr = this.attributes[name]; 7802 7803 if (!attr && createIfNotExists) { 7804 var _attr = new Property(this.document, name, ''); 7805 7806 this.attributes[name] = _attr; 7807 return _attr; 7808 } 7809 7810 return attr || Property.empty(this.document); 7811 } 7812 7813 getHrefAttribute() { 7814 for (var key in this.attributes) { 7815 if (key === 'href' || key.endsWith(':href')) { 7816 return this.attributes[key]; 7817 } 7818 } 7819 7820 return Property.empty(this.document); 7821 } 7822 7823 getStyle(name) { 7824 var createIfNotExists = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 7825 var skipAncestors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 7826 var style = this.styles[name]; 7827 7828 if (style) { 7829 return style; 7830 } 7831 7832 var attr = this.getAttribute(name); 7833 7834 if (attr !== null && attr !== void 0 && attr.hasValue()) { 7835 this.styles[name] = attr; // move up to me to cache 7836 7837 return attr; 7838 } 7839 7840 if (!skipAncestors) { 7841 var { 7842 parent 7843 } = this; 7844 7845 if (parent) { 7846 var parentStyle = parent.getStyle(name); 7847 7848 if (parentStyle !== null && parentStyle !== void 0 && parentStyle.hasValue()) { 7849 return parentStyle; 7850 } 7851 } 7852 } 7853 7854 if (createIfNotExists) { 7855 var _style = new Property(this.document, name, ''); 7856 7857 this.styles[name] = _style; 7858 return _style; 7859 } 7860 7861 return style || Property.empty(this.document); 7862 } 7863 7864 render(ctx) { 7865 // don't render display=none 7866 // don't render visibility=hidden 7867 if (this.getStyle('display').getString() === 'none' || this.getStyle('visibility').getString() === 'hidden') { 7868 return; 7869 } 7870 7871 ctx.save(); 7872 7873 if (this.getStyle('mask').hasValue()) { 7874 // mask 7875 var mask = this.getStyle('mask').getDefinition(); 7876 7877 if (mask) { 7878 this.applyEffects(ctx); 7879 mask.apply(ctx, this); 7880 } 7881 } else if (this.getStyle('filter').getValue('none') !== 'none') { 7882 // filter 7883 var filter = this.getStyle('filter').getDefinition(); 7884 7885 if (filter) { 7886 this.applyEffects(ctx); 7887 filter.apply(ctx, this); 7888 } 7889 } else { 7890 this.setContext(ctx); 7891 this.renderChildren(ctx); 7892 this.clearContext(ctx); 7893 } 7894 7895 ctx.restore(); 7896 } 7897 7898 setContext(_) {// NO RENDER 7899 } 7900 7901 applyEffects(ctx) { 7902 // transform 7903 var transform = Transform.fromElement(this.document, this); 7904 7905 if (transform) { 7906 transform.apply(ctx); 7907 } // clip 7908 7909 7910 var clipPathStyleProp = this.getStyle('clip-path', false, true); 7911 7912 if (clipPathStyleProp.hasValue()) { 7913 var clip = clipPathStyleProp.getDefinition(); 7914 7915 if (clip) { 7916 clip.apply(ctx); 7917 } 7918 } 7919 } 7920 7921 clearContext(_) {// NO RENDER 7922 } 7923 7924 renderChildren(ctx) { 7925 this.children.forEach(child => { 7926 child.render(ctx); 7927 }); 7928 } 7929 7930 addChild(childNode) { 7931 var child = childNode instanceof Element ? childNode : this.document.createElement(childNode); 7932 child.parent = this; 7933 7934 if (!Element.ignoreChildTypes.includes(child.type)) { 7935 this.children.push(child); 7936 } 7937 } 7938 7939 matchesSelector(selector) { 7940 var _node$getAttribute; 7941 7942 var { 7943 node 7944 } = this; 7945 7946 if (typeof node.matches === 'function') { 7947 return node.matches(selector); 7948 } 7949 7950 var styleClasses = (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'class'); 7951 7952 if (!styleClasses || styleClasses === '') { 7953 return false; 7954 } 7955 7956 return styleClasses.split(' ').some(styleClass => ".".concat(styleClass) === selector); 7957 } 7958 7959 addStylesFromStyleDefinition() { 7960 var { 7961 styles, 7962 stylesSpecificity 7963 } = this.document; 7964 7965 for (var selector in styles) { 7966 if (!selector.startsWith('@') && this.matchesSelector(selector)) { 7967 var style = styles[selector]; 7968 var specificity = stylesSpecificity[selector]; 7969 7970 if (style) { 7971 for (var name in style) { 7972 var existingSpecificity = this.stylesSpecificity[name]; 7973 7974 if (typeof existingSpecificity === 'undefined') { 7975 existingSpecificity = '000'; 7976 } 7977 7978 if (specificity >= existingSpecificity) { 7979 this.styles[name] = style[name]; 7980 this.stylesSpecificity[name] = specificity; 7981 } 7982 } 7983 } 7984 } 7985 } 7986 } 7987 7988 removeStyles(element, ignoreStyles) { 7989 var toRestore = ignoreStyles.reduce((toRestore, name) => { 7990 var styleProp = element.getStyle(name); 7991 7992 if (!styleProp.hasValue()) { 7993 return toRestore; 7994 } 7995 7996 var value = styleProp.getString(); 7997 styleProp.setValue(''); 7998 return [...toRestore, [name, value]]; 7999 }, []); 8000 return toRestore; 8001 } 8002 8003 restoreStyles(element, styles) { 8004 styles.forEach(_ref => { 8005 var [name, value] = _ref; 8006 element.getStyle(name, true).setValue(value); 8007 }); 8008 } 8009 8010 isFirstChild() { 8011 var _this$parent; 8012 8013 return ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.children.indexOf(this)) === 0; 8014 } 8015 8016} 8017Element.ignoreChildTypes = ['title']; 8018 8019class UnknownElement extends Element { 8020 constructor(document, node, captureTextNodes) { 8021 super(document, node, captureTextNodes); 8022 } 8023 8024} 8025 8026function wrapFontFamily(fontFamily) { 8027 var trimmed = fontFamily.trim(); 8028 return /^('|")/.test(trimmed) ? trimmed : "\"".concat(trimmed, "\""); 8029} 8030 8031function prepareFontFamily(fontFamily) { 8032 return typeof process === 'undefined' ? fontFamily : fontFamily.trim().split(',').map(wrapFontFamily).join(','); 8033} 8034/** 8035 * https://developer.mozilla.org/en-US/docs/Web/CSS/font-style 8036 * @param fontStyle 8037 * @returns CSS font style. 8038 */ 8039 8040 8041function prepareFontStyle(fontStyle) { 8042 if (!fontStyle) { 8043 return ''; 8044 } 8045 8046 var targetFontStyle = fontStyle.trim().toLowerCase(); 8047 8048 switch (targetFontStyle) { 8049 case 'normal': 8050 case 'italic': 8051 case 'oblique': 8052 case 'inherit': 8053 case 'initial': 8054 case 'unset': 8055 return targetFontStyle; 8056 8057 default: 8058 if (/^oblique\s+(-|)\d+deg$/.test(targetFontStyle)) { 8059 return targetFontStyle; 8060 } 8061 8062 return ''; 8063 } 8064} 8065/** 8066 * https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight 8067 * @param fontWeight 8068 * @returns CSS font weight. 8069 */ 8070 8071 8072function prepareFontWeight(fontWeight) { 8073 if (!fontWeight) { 8074 return ''; 8075 } 8076 8077 var targetFontWeight = fontWeight.trim().toLowerCase(); 8078 8079 switch (targetFontWeight) { 8080 case 'normal': 8081 case 'bold': 8082 case 'lighter': 8083 case 'bolder': 8084 case 'inherit': 8085 case 'initial': 8086 case 'unset': 8087 return targetFontWeight; 8088 8089 default: 8090 if (/^[\d.]+$/.test(targetFontWeight)) { 8091 return targetFontWeight; 8092 } 8093 8094 return ''; 8095 } 8096} 8097 8098class Font { 8099 constructor(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit) { 8100 var inheritFont = inherit ? typeof inherit === 'string' ? Font.parse(inherit) : inherit : {}; 8101 this.fontFamily = fontFamily || inheritFont.fontFamily; 8102 this.fontSize = fontSize || inheritFont.fontSize; 8103 this.fontStyle = fontStyle || inheritFont.fontStyle; 8104 this.fontWeight = fontWeight || inheritFont.fontWeight; 8105 this.fontVariant = fontVariant || inheritFont.fontVariant; 8106 } 8107 8108 static parse() { 8109 var font = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 8110 var inherit = arguments.length > 1 ? arguments[1] : undefined; 8111 var fontStyle = ''; 8112 var fontVariant = ''; 8113 var fontWeight = ''; 8114 var fontSize = ''; 8115 var fontFamily = ''; 8116 var parts = compressSpaces(font).trim().split(' '); 8117 var set = { 8118 fontSize: false, 8119 fontStyle: false, 8120 fontWeight: false, 8121 fontVariant: false 8122 }; 8123 parts.forEach(part => { 8124 switch (true) { 8125 case !set.fontStyle && Font.styles.includes(part): 8126 if (part !== 'inherit') { 8127 fontStyle = part; 8128 } 8129 8130 set.fontStyle = true; 8131 break; 8132 8133 case !set.fontVariant && Font.variants.includes(part): 8134 if (part !== 'inherit') { 8135 fontVariant = part; 8136 } 8137 8138 set.fontStyle = true; 8139 set.fontVariant = true; 8140 break; 8141 8142 case !set.fontWeight && Font.weights.includes(part): 8143 if (part !== 'inherit') { 8144 fontWeight = part; 8145 } 8146 8147 set.fontStyle = true; 8148 set.fontVariant = true; 8149 set.fontWeight = true; 8150 break; 8151 8152 case !set.fontSize: 8153 if (part !== 'inherit') { 8154 [fontSize] = part.split('/'); 8155 } 8156 8157 set.fontStyle = true; 8158 set.fontVariant = true; 8159 set.fontWeight = true; 8160 set.fontSize = true; 8161 break; 8162 8163 default: 8164 if (part !== 'inherit') { 8165 fontFamily += part; 8166 } 8167 8168 } 8169 }); 8170 return new Font(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit); 8171 } 8172 8173 toString() { 8174 return [prepareFontStyle(this.fontStyle), this.fontVariant, prepareFontWeight(this.fontWeight), this.fontSize, // Wrap fontFamily only on nodejs and only for canvas.ctx 8175 prepareFontFamily(this.fontFamily)].join(' ').trim(); 8176 } 8177 8178} 8179Font.styles = 'normal|italic|oblique|inherit'; 8180Font.variants = 'normal|small-caps|inherit'; 8181Font.weights = 'normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit'; 8182 8183class BoundingBox { 8184 constructor() { 8185 var x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Number.NaN; 8186 var y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.NaN; 8187 var x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.NaN; 8188 var y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Number.NaN; 8189 this.x1 = x1; 8190 this.y1 = y1; 8191 this.x2 = x2; 8192 this.y2 = y2; 8193 this.addPoint(x1, y1); 8194 this.addPoint(x2, y2); 8195 } 8196 8197 get x() { 8198 return this.x1; 8199 } 8200 8201 get y() { 8202 return this.y1; 8203 } 8204 8205 get width() { 8206 return this.x2 - this.x1; 8207 } 8208 8209 get height() { 8210 return this.y2 - this.y1; 8211 } 8212 8213 addPoint(x, y) { 8214 if (typeof x !== 'undefined') { 8215 if (isNaN(this.x1) || isNaN(this.x2)) { 8216 this.x1 = x; 8217 this.x2 = x; 8218 } 8219 8220 if (x < this.x1) { 8221 this.x1 = x; 8222 } 8223 8224 if (x > this.x2) { 8225 this.x2 = x; 8226 } 8227 } 8228 8229 if (typeof y !== 'undefined') { 8230 if (isNaN(this.y1) || isNaN(this.y2)) { 8231 this.y1 = y; 8232 this.y2 = y; 8233 } 8234 8235 if (y < this.y1) { 8236 this.y1 = y; 8237 } 8238 8239 if (y > this.y2) { 8240 this.y2 = y; 8241 } 8242 } 8243 } 8244 8245 addX(x) { 8246 this.addPoint(x, null); 8247 } 8248 8249 addY(y) { 8250 this.addPoint(null, y); 8251 } 8252 8253 addBoundingBox(boundingBox) { 8254 if (!boundingBox) { 8255 return; 8256 } 8257 8258 var { 8259 x1, 8260 y1, 8261 x2, 8262 y2 8263 } = boundingBox; 8264 this.addPoint(x1, y1); 8265 this.addPoint(x2, y2); 8266 } 8267 8268 sumCubic(t, p0, p1, p2, p3) { 8269 return Math.pow(1 - t, 3) * p0 + 3 * Math.pow(1 - t, 2) * t * p1 + 3 * (1 - t) * Math.pow(t, 2) * p2 + Math.pow(t, 3) * p3; 8270 } 8271 8272 bezierCurveAdd(forX, p0, p1, p2, p3) { 8273 var b = 6 * p0 - 12 * p1 + 6 * p2; 8274 var a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3; 8275 var c = 3 * p1 - 3 * p0; 8276 8277 if (a === 0) { 8278 if (b === 0) { 8279 return; 8280 } 8281 8282 var t = -c / b; 8283 8284 if (0 < t && t < 1) { 8285 if (forX) { 8286 this.addX(this.sumCubic(t, p0, p1, p2, p3)); 8287 } else { 8288 this.addY(this.sumCubic(t, p0, p1, p2, p3)); 8289 } 8290 } 8291 8292 return; 8293 } 8294 8295 var b2ac = Math.pow(b, 2) - 4 * c * a; 8296 8297 if (b2ac < 0) { 8298 return; 8299 } 8300 8301 var t1 = (-b + Math.sqrt(b2ac)) / (2 * a); 8302 8303 if (0 < t1 && t1 < 1) { 8304 if (forX) { 8305 this.addX(this.sumCubic(t1, p0, p1, p2, p3)); 8306 } else { 8307 this.addY(this.sumCubic(t1, p0, p1, p2, p3)); 8308 } 8309 } 8310 8311 var t2 = (-b - Math.sqrt(b2ac)) / (2 * a); 8312 8313 if (0 < t2 && t2 < 1) { 8314 if (forX) { 8315 this.addX(this.sumCubic(t2, p0, p1, p2, p3)); 8316 } else { 8317 this.addY(this.sumCubic(t2, p0, p1, p2, p3)); 8318 } 8319 } 8320 } // from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html 8321 8322 8323 addBezierCurve(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) { 8324 this.addPoint(p0x, p0y); 8325 this.addPoint(p3x, p3y); 8326 this.bezierCurveAdd(true, p0x, p1x, p2x, p3x); 8327 this.bezierCurveAdd(false, p0y, p1y, p2y, p3y); 8328 } 8329 8330 addQuadraticCurve(p0x, p0y, p1x, p1y, p2x, p2y) { 8331 var cp1x = p0x + 2 / 3 * (p1x - p0x); // CP1 = QP0 + 2/3 *(QP1-QP0) 8332 8333 var cp1y = p0y + 2 / 3 * (p1y - p0y); // CP1 = QP0 + 2/3 *(QP1-QP0) 8334 8335 var cp2x = cp1x + 1 / 3 * (p2x - p0x); // CP2 = CP1 + 1/3 *(QP2-QP0) 8336 8337 var cp2y = cp1y + 1 / 3 * (p2y - p0y); // CP2 = CP1 + 1/3 *(QP2-QP0) 8338 8339 this.addBezierCurve(p0x, p0y, cp1x, cp2x, cp1y, cp2y, p2x, p2y); 8340 } 8341 8342 isPointInBox(x, y) { 8343 var { 8344 x1, 8345 y1, 8346 x2, 8347 y2 8348 } = this; 8349 return x1 <= x && x <= x2 && y1 <= y && y <= y2; 8350 } 8351 8352} 8353 8354class PathParser extends
vendor: 1,167 bytes, lines 8354-8399
8354_ { 8355 constructor(path) { 8356 super(path // Fix spaces after signs. 8357 .replace(/([+\-.])\s+/gm, '$1') // Remove invalid part. 8358 .replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g, '')); 8359 this.control = null; 8360 this.start = null; 8361 this.current = null; 8362 this.command = null; 8363 this.commands = this.commands; 8364 this.i = -1; 8365 this.previousCommand = null; 8366 this.points = []; 8367 this.angles = []; 8368 } 8369 8370 reset() { 8371 this.i = -1; 8372 this.command = null; 8373 this.previousCommand = null; 8374 this.start = new Point(0, 0); 8375 this.control = new Point(0, 0); 8376 this.current = new Point(0, 0); 8377 this.points = []; 8378 this.angles = []; 8379 } 8380 8381 isEnd() { 8382 var { 8383 i, 8384 commands 8385 } = this; 8386 return i >= commands.length - 1; 8387 } 8388 8389 next() { 8390 var command = this.commands[++this.i]; 8391 this.previousCommand = this.command; 8392 this.command = command; 8393 return command; 8394 } 8395 8396 getPoint() { 8397 var xProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'x'; 8398 var yProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'y'; 8399 var point = new Point(this.command[xProp], this.command[yPro
8399p]); 8400 return this.makeAbsolute(point); 8401 } 8402 8403 getAsControlPoint(xProp, yProp) { 8404 var point = this.getPoint(xProp, yProp); 8405 this.control = point; 8406 return point; 8407 } 8408 8409 getAsCurrentPoint(xProp, yProp) { 8410 var point = this.getPoint(xProp, yProp); 8411 this.current = point; 8412 return point; 8413 } 8414 8415 getReflectedControlPoint() { 8416 var previousCommand = this.previousCommand.type; 8417 8418 if (previousCommand !== _.CURVE_TO && previousCommand !== _.SMOOTH_CURVE_TO && previousCommand !== _.QUAD_TO && previousCommand !== _
vendor: 19,138 bytes, lines 8418-9152
8418.SMOOTH_QUAD_TO) { 8419 return this.current; 8420 } // reflect point 8421 8422 8423 var { 8424 current: { 8425 x: cx, 8426 y: cy 8427 }, 8428 control: { 8429 x: ox, 8430 y: oy 8431 } 8432 } = this; 8433 var point = new Point(2 * cx - ox, 2 * cy - oy); 8434 return point; 8435 } 8436 8437 makeAbsolute(point) { 8438 if (this.command.relative) { 8439 var { 8440 x, 8441 y 8442 } = this.current; 8443 point.x += x; 8444 point.y += y; 8445 } 8446 8447 return point; 8448 } 8449 8450 addMarker(point, from, priorTo) { 8451 var { 8452 points, 8453 angles 8454 } = this; // if the last angle isn't filled in because we didn't have this point yet ... 8455 8456 if (priorTo && angles.length > 0 && !angles[angles.length - 1]) { 8457 angles[angles.length - 1] = points[points.length - 1].angleTo(priorTo); 8458 } 8459 8460 this.addMarkerAngle(point, from ? from.angleTo(point) : null); 8461 } 8462 8463 addMarkerAngle(point, angle) { 8464 this.points.push(point); 8465 this.angles.push(angle); 8466 } 8467 8468 getMarkerPoints() { 8469 return this.points; 8470 } 8471 8472 getMarkerAngles() { 8473 var { 8474 angles 8475 } = this; 8476 var len = angles.length; 8477 8478 for (var i = 0; i < len; i++) { 8479 if (!angles[i]) { 8480 for (var j = i + 1; j < len; j++) { 8481 if (angles[j]) { 8482 angles[i] = angles[j]; 8483 break; 8484 } 8485 } 8486 } 8487 } 8488 8489 return angles; 8490 } 8491 8492} 8493 8494class RenderedElement extends Element { 8495 constructor() { 8496 super(...arguments); 8497 this.modifiedEmSizeStack = false; 8498 } 8499 8500 calculateOpacity() { 8501 var opacity = 1.0; // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this 8502 8503 var element = this; 8504 8505 while (element) { 8506 var opacityStyle = element.getStyle('opacity', false, true); // no ancestors on style call 8507 8508 if (opacityStyle.hasValue(true)) { 8509 opacity *= opacityStyle.getNumber(); 8510 } 8511 8512 element = element.parent; 8513 } 8514 8515 return opacity; 8516 } 8517 8518 setContext(ctx) { 8519 var fromMeasure = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 8520 8521 if (!fromMeasure) { 8522 // causes stack overflow when measuring text with gradients 8523 // fill 8524 var fillStyleProp = this.getStyle('fill'); 8525 var fillOpacityStyleProp = this.getStyle('fill-opacity'); 8526 var strokeStyleProp = this.getStyle('stroke'); 8527 var strokeOpacityProp = this.getStyle('stroke-opacity'); 8528 8529 if (fillStyleProp.isUrlDefinition()) { 8530 var fillStyle = fillStyleProp.getFillStyleDefinition(this, fillOpacityStyleProp); 8531 8532 if (fillStyle) { 8533 ctx.fillStyle = fillStyle; 8534 } 8535 } else if (fillStyleProp.hasValue()) { 8536 if (fillStyleProp.getString() === 'currentColor') { 8537 fillStyleProp.setValue(this.getStyle('color').getColor()); 8538 } 8539 8540 var _fillStyle = fillStyleProp.getColor(); 8541 8542 if (_fillStyle !== 'inherit') { 8543 ctx.fillStyle = _fillStyle === 'none' ? 'rgba(0,0,0,0)' : _fillStyle; 8544 } 8545 } 8546 8547 if (fillOpacityStyleProp.hasValue()) { 8548 var _fillStyle2 = new Property(this.document, 'fill', ctx.fillStyle).addOpacity(fillOpacityStyleProp).getColor(); 8549 8550 ctx.fillStyle = _fillStyle2; 8551 } // stroke 8552 8553 8554 if (strokeStyleProp.isUrlDefinition()) { 8555 var strokeStyle = strokeStyleProp.getFillStyleDefinition(this, strokeOpacityProp); 8556 8557 if (strokeStyle) { 8558 ctx.strokeStyle = strokeStyle; 8559 } 8560 } else if (strokeStyleProp.hasValue()) { 8561 if (strokeStyleProp.getString() === 'currentColor') { 8562 strokeStyleProp.setValue(this.getStyle('color').getColor()); 8563 } 8564 8565 var _strokeStyle = strokeStyleProp.getString(); 8566 8567 if (_strokeStyle !== 'inherit') { 8568 ctx.strokeStyle = _strokeStyle === 'none' ? 'rgba(0,0,0,0)' : _strokeStyle; 8569 } 8570 } 8571 8572 if (strokeOpacityProp.hasValue()) { 8573 var _strokeStyle2 = new Property(this.document, 'stroke', ctx.strokeStyle).addOpacity(strokeOpacityProp).getString(); 8574 8575 ctx.strokeStyle = _strokeStyle2; 8576 } 8577 8578 var strokeWidthStyleProp = this.getStyle('stroke-width'); 8579 8580 if (strokeWidthStyleProp.hasValue()) { 8581 var newLineWidth = strokeWidthStyleProp.getPixels(); 8582 ctx.lineWidth = !newLineWidth ? PSEUDO_ZERO // browsers don't respect 0 (or node-canvas? :-) 8583 : newLineWidth; 8584 } 8585 8586 var strokeLinecapStyleProp = this.getStyle('stroke-linecap'); 8587 var strokeLinejoinStyleProp = this.getStyle('stroke-linejoin'); 8588 var strokeMiterlimitProp = this.getStyle('stroke-miterlimit'); // NEED TEST 8589 // const pointOrderStyleProp = this.getStyle('paint-order'); 8590 8591 var strokeDasharrayStyleProp = this.getStyle('stroke-dasharray'); 8592 var strokeDashoffsetProp = this.getStyle('stroke-dashoffset'); 8593 8594 if (strokeLinecapStyleProp.hasValue()) { 8595 ctx.lineCap = strokeLinecapStyleProp.getString(); 8596 } 8597 8598 if (strokeLinejoinStyleProp.hasValue()) { 8599 ctx.lineJoin = strokeLinejoinStyleProp.getString(); 8600 } 8601 8602 if (strokeMiterlimitProp.hasValue()) { 8603 ctx.miterLimit = strokeMiterlimitProp.getNumber(); 8604 } // NEED TEST 8605 // if (pointOrderStyleProp.hasValue()) { 8606 // // ? 8607 // ctx.paintOrder = pointOrderStyleProp.getValue(); 8608 // } 8609 8610 8611 if (strokeDasharrayStyleProp.hasValue() && strokeDasharrayStyleProp.getString() !== 'none') { 8612 var gaps = toNumbers(strokeDasharrayStyleProp.getString()); 8613 8614 if (typeof ctx.setLineDash !== 'undefined') { 8615 ctx.setLineDash(gaps); 8616 } else // @ts-expect-error Handle browser prefix. 8617 if (typeof ctx.webkitLineDash !== 'undefined') { 8618 // @ts-expect-error Handle browser prefix. 8619 ctx.webkitLineDash = gaps; 8620 } else // @ts-expect-error Handle browser prefix. 8621 if (typeof ctx.mozDash !== 'undefined' && !(gaps.length === 1 && gaps[0] === 0)) { 8622 // @ts-expect-error Handle browser prefix. 8623 ctx.mozDash = gaps; 8624 } 8625 8626 var offset = strokeDashoffsetProp.getPixels(); 8627 8628 if (typeof ctx.lineDashOffset !== 'undefined') { 8629 ctx.lineDashOffset = offset; 8630 } else // @ts-expect-error Handle browser prefix. 8631 if (typeof ctx.webkitLineDashOffset !== 'undefined') { 8632 // @ts-expect-error Handle browser prefix. 8633 ctx.webkitLineDashOffset = offset; 8634 } else // @ts-expect-error Handle browser prefix. 8635 if (typeof ctx.mozDashOffset !== 'undefined') { 8636 // @ts-expect-error Handle browser prefix. 8637 ctx.mozDashOffset = offset; 8638 } 8639 } 8640 } // font 8641 8642 8643 this.modifiedEmSizeStack = false; 8644 8645 if (typeof ctx.font !== 'undefined') { 8646 var fontStyleProp = this.getStyle('font'); 8647 var fontStyleStyleProp = this.getStyle('font-style'); 8648 var fontVariantStyleProp = this.getStyle('font-variant'); 8649 var fontWeightStyleProp = this.getStyle('font-weight'); 8650 var fontSizeStyleProp = this.getStyle('font-size'); 8651 var fontFamilyStyleProp = this.getStyle('font-family'); 8652 var font = new Font(fontStyleStyleProp.getString(), fontVariantStyleProp.getString(), fontWeightStyleProp.getString(), fontSizeStyleProp.hasValue() ? "".concat(fontSizeStyleProp.getPixels(true), "px") : '', fontFamilyStyleProp.getString(), Font.parse(fontStyleProp.getString(), ctx.font)); 8653 fontStyleStyleProp.setValue(font.fontStyle); 8654 fontVariantStyleProp.setValue(font.fontVariant); 8655 fontWeightStyleProp.setValue(font.fontWeight); 8656 fontSizeStyleProp.setValue(font.fontSize); 8657 fontFamilyStyleProp.setValue(font.fontFamily); 8658 ctx.font = font.toString(); 8659 8660 if (fontSizeStyleProp.isPixels()) { 8661 this.document.emSize = fontSizeStyleProp.getPixels(); 8662 this.modifiedEmSizeStack = true; 8663 } 8664 } 8665 8666 if (!fromMeasure) { 8667 // effects 8668 this.applyEffects(ctx); // opacity 8669 8670 ctx.globalAlpha = this.calculateOpacity(); 8671 } 8672 } 8673 8674 clearContext(ctx) { 8675 super.clearContext(ctx); 8676 8677 if (this.modifiedEmSizeStack) { 8678 this.document.popEmSize(); 8679 } 8680 } 8681 8682} 8683 8684class PathElement extends RenderedElement { 8685 constructor(document, node, captureTextNodes) { 8686 super(document, node, captureTextNodes); 8687 this.type = 'path'; 8688 this.pathParser = null; 8689 this.pathParser = new PathParser(this.getAttribute('d').getString()); 8690 } 8691 8692 path(ctx) { 8693 var { 8694 pathParser 8695 } = this; 8696 var boundingBox = new BoundingBox(); 8697 pathParser.reset(); 8698 8699 if (ctx) { 8700 ctx.beginPath(); 8701 } 8702 8703 while (!pathParser.isEnd()) { 8704 switch (pathParser.next().type) { 8705 case PathParser.MOVE_TO: 8706 this.pathM(ctx, boundingBox); 8707 break; 8708 8709 case PathParser.LINE_TO: 8710 this.pathL(ctx, boundingBox); 8711 break; 8712 8713 case PathParser.HORIZ_LINE_TO: 8714 this.pathH(ctx, boundingBox); 8715 break; 8716 8717 case PathParser.VERT_LINE_TO: 8718 this.pathV(ctx, boundingBox); 8719 break; 8720 8721 case PathParser.CURVE_TO: 8722 this.pathC(ctx, boundingBox); 8723 break; 8724 8725 case PathParser.SMOOTH_CURVE_TO: 8726 this.pathS(ctx, boundingBox); 8727 break; 8728 8729 case PathParser.QUAD_TO: 8730 this.pathQ(ctx, boundingBox); 8731 break; 8732 8733 case PathParser.SMOOTH_QUAD_TO: 8734 this.pathT(ctx, boundingBox); 8735 break; 8736 8737 case PathParser.ARC: 8738 this.pathA(ctx, boundingBox); 8739 break; 8740 8741 case PathParser.CLOSE_PATH: 8742 this.pathZ(ctx, boundingBox); 8743 break; 8744 } 8745 } 8746 8747 return boundingBox; 8748 } 8749 8750 getBoundingBox(_) { 8751 return this.path(); 8752 } 8753 8754 getMarkers() { 8755 var { 8756 pathParser 8757 } = this; 8758 var points = pathParser.getMarkerPoints(); 8759 var angles = pathParser.getMarkerAngles(); 8760 var markers = points.map((point, i) => [point, angles[i]]); 8761 return markers; 8762 } 8763 8764 renderChildren(ctx) { 8765 this.path(ctx); 8766 this.document.screen.mouse.checkPath(this, ctx); 8767 var fillRuleStyleProp = this.getStyle('fill-rule'); 8768 8769 if (ctx.fillStyle !== '') { 8770 if (fillRuleStyleProp.getString('inherit') !== 'inherit') { 8771 ctx.fill(fillRuleStyleProp.getString()); 8772 } else { 8773 ctx.fill(); 8774 } 8775 } 8776 8777 if (ctx.strokeStyle !== '') { 8778 if (this.getAttribute('vector-effect').getString() === 'non-scaling-stroke') { 8779 ctx.save(); 8780 ctx.setTransform(1, 0, 0, 1, 0, 0); 8781 ctx.stroke(); 8782 ctx.restore(); 8783 } else { 8784 ctx.stroke(); 8785 } 8786 } 8787 8788 var markers = this.getMarkers(); 8789 8790 if (markers) { 8791 var markersLastIndex = markers.length - 1; 8792 var markerStartStyleProp = this.getStyle('marker-start'); 8793 var markerMidStyleProp = this.getStyle('marker-mid'); 8794 var markerEndStyleProp = this.getStyle('marker-end'); 8795 8796 if (markerStartStyleProp.isUrlDefinition()) { 8797 var marker = markerStartStyleProp.getDefinition(); 8798 var [point, angle] = markers[0]; 8799 marker.render(ctx, point, angle); 8800 } 8801 8802 if (markerMidStyleProp.isUrlDefinition()) { 8803 var _marker = markerMidStyleProp.getDefinition(); 8804 8805 for (var i = 1; i < markersLastIndex; i++) { 8806 var [_point, _angle] = markers[i]; 8807 8808 _marker.render(ctx, _point, _angle); 8809 } 8810 } 8811 8812 if (markerEndStyleProp.isUrlDefinition()) { 8813 var _marker2 = markerEndStyleProp.getDefinition(); 8814 8815 var [_point2, _angle2] = markers[markersLastIndex]; 8816 8817 _marker2.render(ctx, _point2, _angle2); 8818 } 8819 } 8820 } 8821 8822 static pathM(pathParser) { 8823 var point = pathParser.getAsCurrentPoint(); 8824 pathParser.start = pathParser.current; 8825 return { 8826 point 8827 }; 8828 } 8829 8830 pathM(ctx, boundingBox) { 8831 var { 8832 pathParser 8833 } = this; 8834 var { 8835 point 8836 } = PathElement.pathM(pathParser); 8837 var { 8838 x, 8839 y 8840 } = point; 8841 pathParser.addMarker(point); 8842 boundingBox.addPoint(x, y); 8843 8844 if (ctx) { 8845 ctx.moveTo(x, y); 8846 } 8847 } 8848 8849 static pathL(pathParser) { 8850 var { 8851 current 8852 } = pathParser; 8853 var point = pathParser.getAsCurrentPoint(); 8854 return { 8855 current, 8856 point 8857 }; 8858 } 8859 8860 pathL(ctx, boundingBox) { 8861 var { 8862 pathParser 8863 } = this; 8864 var { 8865 current, 8866 point 8867 } = PathElement.pathL(pathParser); 8868 var { 8869 x, 8870 y 8871 } = point; 8872 pathParser.addMarker(point, current); 8873 boundingBox.addPoint(x, y); 8874 8875 if (ctx) { 8876 ctx.lineTo(x, y); 8877 } 8878 } 8879 8880 static pathH(pathParser) { 8881 var { 8882 current, 8883 command 8884 } = pathParser; 8885 var point = new Point((command.relative ? current.x : 0) + command.x, current.y); 8886 pathParser.current = point; 8887 return { 8888 current, 8889 point 8890 }; 8891 } 8892 8893 pathH(ctx, boundingBox) { 8894 var { 8895 pathParser 8896 } = this; 8897 var { 8898 current, 8899 point 8900 } = PathElement.pathH(pathParser); 8901 var { 8902 x, 8903 y 8904 } = point; 8905 pathParser.addMarker(point, current); 8906 boundingBox.addPoint(x, y); 8907 8908 if (ctx) { 8909 ctx.lineTo(x, y); 8910 } 8911 } 8912 8913 static pathV(pathParser) { 8914 var { 8915 current, 8916 command 8917 } = pathParser; 8918 var point = new Point(current.x, (command.relative ? current.y : 0) + command.y); 8919 pathParser.current = point; 8920 return { 8921 current, 8922 point 8923 }; 8924 } 8925 8926 pathV(ctx, boundingBox) { 8927 var { 8928 pathParser 8929 } = this; 8930 var { 8931 current, 8932 point 8933 } = PathElement.pathV(pathParser); 8934 var { 8935 x, 8936 y 8937 } = point; 8938 pathParser.addMarker(point, current); 8939 boundingBox.addPoint(x, y); 8940 8941 if (ctx) { 8942 ctx.lineTo(x, y); 8943 } 8944 } 8945 8946 static pathC(pathParser) { 8947 var { 8948 current 8949 } = pathParser; 8950 var point = pathParser.getPoint('x1', 'y1'); 8951 var controlPoint = pathParser.getAsControlPoint('x2', 'y2'); 8952 var currentPoint = pathParser.getAsCurrentPoint(); 8953 return { 8954 current, 8955 point, 8956 controlPoint, 8957 currentPoint 8958 }; 8959 } 8960 8961 pathC(ctx, boundingBox) { 8962 var { 8963 pathParser 8964 } = this; 8965 var { 8966 current, 8967 point, 8968 controlPoint, 8969 currentPoint 8970 } = PathElement.pathC(pathParser); 8971 pathParser.addMarker(currentPoint, controlPoint, point); 8972 boundingBox.addBezierCurve(current.x, current.y, point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 8973 8974 if (ctx) { 8975 ctx.bezierCurveTo(point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 8976 } 8977 } 8978 8979 static pathS(pathParser) { 8980 var { 8981 current 8982 } = pathParser; 8983 var point = pathParser.getReflectedControlPoint(); 8984 var controlPoint = pathParser.getAsControlPoint('x2', 'y2'); 8985 var currentPoint = pathParser.getAsCurrentPoint(); 8986 return { 8987 current, 8988 point, 8989 controlPoint, 8990 currentPoint 8991 }; 8992 } 8993 8994 pathS(ctx, boundingBox) { 8995 var { 8996 pathParser 8997 } = this; 8998 var { 8999 current, 9000 point, 9001 controlPoint, 9002 currentPoint 9003 } = PathElement.pathS(pathParser); 9004 pathParser.addMarker(currentPoint, controlPoint, point); 9005 boundingBox.addBezierCurve(current.x, current.y, point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9006 9007 if (ctx) { 9008 ctx.bezierCurveTo(point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9009 } 9010 } 9011 9012 static pathQ(pathParser) { 9013 var { 9014 current 9015 } = pathParser; 9016 var controlPoint = pathParser.getAsControlPoint('x1', 'y1'); 9017 var currentPoint = pathParser.getAsCurrentPoint(); 9018 return { 9019 current, 9020 controlPoint, 9021 currentPoint 9022 }; 9023 } 9024 9025 pathQ(ctx, boundingBox) { 9026 var { 9027 pathParser 9028 } = this; 9029 var { 9030 current, 9031 controlPoint, 9032 currentPoint 9033 } = PathElement.pathQ(pathParser); 9034 pathParser.addMarker(currentPoint, controlPoint, controlPoint); 9035 boundingBox.addQuadraticCurve(current.x, current.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9036 9037 if (ctx) { 9038 ctx.quadraticCurveTo(controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9039 } 9040 } 9041 9042 static pathT(pathParser) { 9043 var { 9044 current 9045 } = pathParser; 9046 var controlPoint = pathParser.getReflectedControlPoint(); 9047 pathParser.control = controlPoint; 9048 var currentPoint = pathParser.getAsCurrentPoint(); 9049 return { 9050 current, 9051 controlPoint, 9052 currentPoint 9053 }; 9054 } 9055 9056 pathT(ctx, boundingBox) { 9057 var { 9058 pathParser 9059 } = this; 9060 var { 9061 current, 9062 controlPoint, 9063 currentPoint 9064 } = PathElement.pathT(pathParser); 9065 pathParser.addMarker(currentPoint, controlPoint, controlPoint); 9066 boundingBox.addQuadraticCurve(current.x, current.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9067 9068 if (ctx) { 9069 ctx.quadraticCurveTo(controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 9070 } 9071 } 9072 9073 static pathA(pathParser) { 9074 var { 9075 current, 9076 command 9077 } = pathParser; 9078 var { 9079 rX, 9080 rY, 9081 xRot, 9082 lArcFlag, 9083 sweepFlag 9084 } = command; 9085 var xAxisRotation = xRot * (Math.PI / 180.0); 9086 var currentPoint = pathParser.getAsCurrentPoint(); // Conversion from endpoint to center parameterization 9087 // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes 9088 // x1', y1' 9089 9090 var currp = new Point(Math.cos(xAxisRotation) * (current.x - currentPoint.x) / 2.0 + Math.sin(xAxisRotation) * (current.y - currentPoint.y) / 2.0, -Math.sin(xAxisRotation) * (current.x - currentPoint.x) / 2.0 + Math.cos(xAxisRotation) * (current.y - currentPoint.y) / 2.0); // adjust radii 9091 9092 var l = Math.pow(currp.x, 2) / Math.pow(rX, 2) + Math.pow(currp.y, 2) / Math.pow(rY, 2); 9093 9094 if (l > 1) { 9095 rX *= Math.sqrt(l); 9096 rY *= Math.sqrt(l); 9097 } // cx', cy' 9098 9099 9100 var s = (lArcFlag === sweepFlag ? -1 : 1) * Math.sqrt((Math.pow(rX, 2) * Math.pow(rY, 2) - Math.pow(rX, 2) * Math.pow(currp.y, 2) - Math.pow(rY, 2) * Math.pow(currp.x, 2)) / (Math.pow(rX, 2) * Math.pow(currp.y, 2) + Math.pow(rY, 2) * Math.pow(currp.x, 2))); 9101 9102 if (isNaN(s)) { 9103 s = 0; 9104 } 9105 9106 var cpp = new Point(s * rX * currp.y / rY, s * -rY * currp.x / rX); // cx, cy 9107 9108 var centp = new Point((current.x + currentPoint.x) / 2.0 + Math.cos(xAxisRotation) * cpp.x - Math.sin(xAxisRotation) * cpp.y, (current.y + currentPoint.y) / 2.0 + Math.sin(xAxisRotation) * cpp.x + Math.cos(xAxisRotation) * cpp.y); // initial angle 9109 9110 var a1 = vectorsAngle([1, 0], [(currp.x - cpp.x) / rX, (currp.y - cpp.y) / rY]); // θ1 9111 // angle delta 9112 9113 var u = [(currp.x - cpp.x) / rX, (currp.y - cpp.y) / rY]; 9114 var v = [(-currp.x - cpp.x) / rX, (-currp.y - cpp.y) / rY]; 9115 var ad = vectorsAngle(u, v); // Δθ 9116 9117 if (vectorsRatio(u, v) <= -1) { 9118 ad = Math.PI; 9119 } 9120 9121 if (vectorsRatio(u, v) >= 1) { 9122 ad = 0; 9123 } 9124 9125 return { 9126 currentPoint, 9127 rX, 9128 rY, 9129 sweepFlag, 9130 xAxisRotation, 9131 centp, 9132 a1, 9133 ad 9134 }; 9135 } 9136 9137 pathA(ctx, boundingBox) { 9138 var { 9139 pathParser 9140 } = this; 9141 var { 9142 currentPoint, 9143 rX, 9144 rY, 9145 sweepFlag, 9146 xAxisRotation, 9147 centp, 9148 a1, 9149 ad 9150 } = PathElement.pathA(pathParser); // for markers 9151 9152 var dir = 1 - sweepFlag ? 1.0 : -1
vendor: 6,483 bytes, lines 9152-9384
9152; 9153 var ah = a1 + dir * (ad / 2.0); 9154 var halfWay = new Point(centp.x + rX * Math.cos(ah), centp.y + rY * Math.sin(ah)); 9155 pathParser.addMarkerAngle(halfWay, ah - dir * Math.PI / 2); 9156 pathParser.addMarkerAngle(currentPoint, ah - dir * Math.PI); 9157 boundingBox.addPoint(currentPoint.x, currentPoint.y); // TODO: this is too naive, make it better 9158 9159 if (ctx && !isNaN(a1) && !isNaN(ad)) { 9160 var r = rX > rY ? rX : rY; 9161 var sx = rX > rY ? 1 : rX / rY; 9162 var sy = rX > rY ? rY / rX : 1; 9163 ctx.translate(centp.x, centp.y); 9164 ctx.rotate(xAxisRotation); 9165 ctx.scale(sx, sy); 9166 ctx.arc(0, 0, r, a1, a1 + ad, Boolean(1 - sweepFlag)); 9167 ctx.scale(1 / sx, 1 / sy); 9168 ctx.rotate(-xAxisRotation); 9169 ctx.translate(-centp.x, -centp.y); 9170 } 9171 } 9172 9173 static pathZ(pathParser) { 9174 pathParser.current = pathParser.start; 9175 } 9176 9177 pathZ(ctx, boundingBox) { 9178 PathElement.pathZ(this.pathParser); 9179 9180 if (ctx) { 9181 // only close path if it is not a straight line 9182 if (boundingBox.x1 !== boundingBox.x2 && boundingBox.y1 !== boundingBox.y2) { 9183 ctx.closePath(); 9184 } 9185 } 9186 } 9187 9188} 9189 9190class GlyphElement extends PathElement { 9191 constructor(document, node, captureTextNodes) { 9192 super(document, node, captureTextNodes); 9193 this.type = 'glyph'; 9194 this.horizAdvX = this.getAttribute('horiz-adv-x').getNumber(); 9195 this.unicode = this.getAttribute('unicode').getString(); 9196 this.arabicForm = this.getAttribute('arabic-form').getString(); 9197 } 9198 9199} 9200 9201class TextElement extends RenderedElement { 9202 constructor(document, node, captureTextNodes) { 9203 super(document, node, new.target === TextElement ? true : captureTextNodes); 9204 this.type = 'text'; 9205 this.x = 0; 9206 this.y = 0; 9207 this.measureCache = -1; 9208 } 9209 9210 setContext(ctx) { 9211 var fromMeasure = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 9212 super.setContext(ctx, fromMeasure); 9213 var textBaseline = this.getStyle('dominant-baseline').getTextBaseline() || this.getStyle('alignment-baseline').getTextBaseline(); 9214 9215 if (textBaseline) { 9216 ctx.textBaseline = textBaseline; 9217 } 9218 } 9219 9220 initializeCoordinates() { 9221 this.x = 0; 9222 this.y = 0; 9223 this.leafTexts = []; 9224 this.textChunkStart = 0; 9225 this.minX = Number.POSITIVE_INFINITY; 9226 this.maxX = Number.NEGATIVE_INFINITY; 9227 } 9228 9229 getBoundingBox(ctx) { 9230 if (this.type !== 'text') { 9231 return this.getTElementBoundingBox(ctx); 9232 } // first, calculate child positions 9233 9234 9235 this.initializeCoordinates(); 9236 this.adjustChildCoordinatesRecursive(ctx); 9237 var boundingBox = null; // then calculate bounding box 9238 9239 this.children.forEach((_, i) => { 9240 var childBoundingBox = this.getChildBoundingBox(ctx, this, this, i); 9241 9242 if (!boundingBox) { 9243 boundingBox = childBoundingBox; 9244 } else { 9245 boundingBox.addBoundingBox(childBoundingBox); 9246 } 9247 }); 9248 return boundingBox; 9249 } 9250 9251 getFontSize() { 9252 var { 9253 document, 9254 parent 9255 } = this; 9256 var inheritFontSize = Font.parse(document.ctx.font).fontSize; 9257 var fontSize = parent.getStyle('font-size').getNumber(inheritFontSize); 9258 return fontSize; 9259 } 9260 9261 getTElementBoundingBox(ctx) { 9262 var fontSize = this.getFontSize(); 9263 return new BoundingBox(this.x, this.y - fontSize, this.x + this.measureText(ctx), this.y); 9264 } 9265 9266 getGlyph(font, text, i) { 9267 var char = text[i]; 9268 var glyph = null; 9269 9270 if (font.isArabic) { 9271 var len = text.length; 9272 var prevChar = text[i - 1]; 9273 var nextChar = text[i + 1]; 9274 var arabicForm = 'isolated'; 9275 9276 if ((i === 0 || prevChar === ' ') && i < len - 1 && nextChar !== ' ') { 9277 arabicForm = 'terminal'; 9278 } 9279 9280 if (i > 0 && prevChar !== ' ' && i < len - 1 && nextChar !== ' ') { 9281 arabicForm = 'medial'; 9282 } 9283 9284 if (i > 0 && prevChar !== ' ' && (i === len - 1 || nextChar === ' ')) { 9285 arabicForm = 'initial'; 9286 } 9287 9288 if (typeof font.glyphs[char] !== 'undefined') { 9289 // NEED TEST 9290 var maybeGlyph = font.glyphs[char]; 9291 glyph = maybeGlyph instanceof GlyphElement ? maybeGlyph : maybeGlyph[arabicForm]; 9292 } 9293 } else { 9294 glyph = font.glyphs[char]; 9295 } 9296 9297 if (!glyph) { 9298 glyph = font.missingGlyph; 9299 } 9300 9301 return glyph; 9302 } 9303 9304 getText() { 9305 return ''; 9306 } 9307 9308 getTextFromNode(node) { 9309 var textNode = node || this.node; 9310 var childNodes = Array.from(textNode.parentNode.childNodes); 9311 var index = childNodes.indexOf(textNode); 9312 var lastIndex = childNodes.length - 1; 9313 var text = compressSpaces( // textNode.value 9314 // || textNode.text 9315 textNode.textContent || ''); 9316 9317 if (index === 0) { 9318 text = trimLeft(text); 9319 } 9320 9321 if (index === lastIndex) { 9322 text = trimRight(text); 9323 } 9324 9325 return text; 9326 } 9327 9328 renderChildren(ctx) { 9329 if (this.type !== 'text') { 9330 this.renderTElementChildren(ctx); 9331 return; 9332 } // first, calculate child positions 9333 9334 9335 this.initializeCoordinates(); 9336 this.adjustChildCoordinatesRecursive(ctx); // then render 9337 9338 this.children.forEach((_, i) => { 9339 this.renderChild(ctx, this, this, i); 9340 }); 9341 var { 9342 mouse 9343 } = this.document.screen; // Do not calc bounding box if mouse is not working. 9344 9345 if (mouse.isWorking()) { 9346 mouse.checkBoundingBox(this, this.getBoundingBox(ctx)); 9347 } 9348 } 9349 9350 renderTElementChildren(ctx) { 9351 var { 9352 document, 9353 parent 9354 } = this; 9355 var renderText = this.getText(); 9356 var customFont = parent.getStyle('font-family').getDefinition(); 9357 9358 if (customFont) { 9359 var { 9360 unitsPerEm 9361 } = customFont.fontFace; 9362 var ctxFont = Font.parse(document.ctx.font); 9363 var fontSize = parent.getStyle('font-size').getNumber(ctxFont.fontSize); 9364 var fontStyle = parent.getStyle('font-style').getString(ctxFont.fontStyle); 9365 var scale = fontSize / unitsPerEm; 9366 var text = customFont.isRTL ? renderText.split('').reverse().join('') : renderText; 9367 var dx = toNumbers(parent.getAttribute('dx').getString()); 9368 var len = text.length; 9369 9370 for (var i = 0; i < len; i++) { 9371 var glyph = this.getGlyph(customFont, text, i); 9372 ctx.translate(this.x, this.y); 9373 ctx.scale(scale, -scale); 9374 var lw = ctx.lineWidth; 9375 ctx.lineWidth = ctx.lineWidth * unitsPerEm / fontSize; 9376 9377 if (fontStyle === 'italic') { 9378 ctx.transform(1, 0, .4, 1, 0, 0); 9379 } 9380 9381 glyph.render(ctx); 9382 9383 if (fontStyle === 'italic') { 9384 ctx.transform(1, 0, -0
vendor: 34,098 bytes, lines 9384-10579
9384.4, 1, 0, 0); 9385 } 9386 9387 ctx.lineWidth = lw; 9388 ctx.scale(1 / scale, -1 / scale); 9389 ctx.translate(-this.x, -this.y); 9390 this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / unitsPerEm; 9391 9392 if (typeof dx[i] !== 'undefined' && !isNaN(dx[i])) { 9393 this.x += dx[i]; 9394 } 9395 } 9396 9397 return; 9398 } 9399 9400 var { 9401 x, 9402 y 9403 } = this; // NEED TEST 9404 // if (ctx.paintOrder === 'stroke') { 9405 // if (ctx.strokeStyle) { 9406 // ctx.strokeText(renderText, x, y); 9407 // } 9408 // if (ctx.fillStyle) { 9409 // ctx.fillText(renderText, x, y); 9410 // } 9411 // } else { 9412 9413 if (ctx.fillStyle) { 9414 ctx.fillText(renderText, x, y); 9415 } 9416 9417 if (ctx.strokeStyle) { 9418 ctx.strokeText(renderText, x, y); 9419 } // } 9420 9421 } 9422 9423 applyAnchoring() { 9424 if (this.textChunkStart >= this.leafTexts.length) { 9425 return; 9426 } // This is basically the "Apply anchoring" part of https://www.w3.org/TR/SVG2/text.html#TextLayoutAlgorithm. 9427 // The difference is that we apply the anchoring as soon as a chunk is finished. This saves some extra looping. 9428 // Vertical text is not supported. 9429 9430 9431 var firstElement = this.leafTexts[this.textChunkStart]; 9432 var textAnchor = firstElement.getStyle('text-anchor').getString('start'); 9433 var isRTL = false; // we treat RTL like LTR 9434 9435 var shift = 0; 9436 9437 if (textAnchor === 'start' && !isRTL || textAnchor === 'end' && isRTL) { 9438 shift = firstElement.x - this.minX; 9439 } else if (textAnchor === 'end' && !isRTL || textAnchor === 'start' && isRTL) { 9440 shift = firstElement.x - this.maxX; 9441 } else { 9442 shift = firstElement.x - (this.minX + this.maxX) / 2; 9443 } 9444 9445 for (var i = this.textChunkStart; i < this.leafTexts.length; i++) { 9446 this.leafTexts[i].x += shift; 9447 } // start new chunk 9448 9449 9450 this.minX = Number.POSITIVE_INFINITY; 9451 this.maxX = Number.NEGATIVE_INFINITY; 9452 this.textChunkStart = this.leafTexts.length; 9453 } 9454 9455 adjustChildCoordinatesRecursive(ctx) { 9456 this.children.forEach((_, i) => { 9457 this.adjustChildCoordinatesRecursiveCore(ctx, this, this, i); 9458 }); 9459 this.applyAnchoring(); 9460 } 9461 9462 adjustChildCoordinatesRecursiveCore(ctx, textParent, parent, i) { 9463 var child = parent.children[i]; 9464 9465 if (child.children.length > 0) { 9466 child.children.forEach((_, i) => { 9467 textParent.adjustChildCoordinatesRecursiveCore(ctx, textParent, child, i); 9468 }); 9469 } else { 9470 // only leafs are relevant 9471 this.adjustChildCoordinates(ctx, textParent, parent, i); 9472 } 9473 } 9474 9475 adjustChildCoordinates(ctx, textParent, parent, i) { 9476 var child = parent.children[i]; 9477 9478 if (typeof child.measureText !== 'function') { 9479 return child; 9480 } 9481 9482 ctx.save(); 9483 child.setContext(ctx, true); 9484 var xAttr = child.getAttribute('x'); 9485 var yAttr = child.getAttribute('y'); 9486 var dxAttr = child.getAttribute('dx'); 9487 var dyAttr = child.getAttribute('dy'); 9488 var customFont = child.getStyle('font-family').getDefinition(); 9489 var isRTL = Boolean(customFont) && customFont.isRTL; 9490 9491 if (i === 0) { 9492 // First children inherit attributes from parent(s). Positional attributes 9493 // are only inherited from a parent to it's first child. 9494 if (!xAttr.hasValue()) { 9495 xAttr.setValue(child.getInheritedAttribute('x')); 9496 } 9497 9498 if (!yAttr.hasValue()) { 9499 yAttr.setValue(child.getInheritedAttribute('y')); 9500 } 9501 9502 if (!dxAttr.hasValue()) { 9503 dxAttr.setValue(child.getInheritedAttribute('dx')); 9504 } 9505 9506 if (!dyAttr.hasValue()) { 9507 dyAttr.setValue(child.getInheritedAttribute('dy')); 9508 } 9509 } 9510 9511 var width = child.measureText(ctx); 9512 9513 if (isRTL) { 9514 textParent.x -= width; 9515 } 9516 9517 if (xAttr.hasValue()) { 9518 // an "x" attribute marks the start of a new chunk 9519 textParent.applyAnchoring(); 9520 child.x = xAttr.getPixels('x'); 9521 9522 if (dxAttr.hasValue()) { 9523 child.x += dxAttr.getPixels('x'); 9524 } 9525 } else { 9526 if (dxAttr.hasValue()) { 9527 textParent.x += dxAttr.getPixels('x'); 9528 } 9529 9530 child.x = textParent.x; 9531 } 9532 9533 textParent.x = child.x; 9534 9535 if (!isRTL) { 9536 textParent.x += width; 9537 } 9538 9539 if (yAttr.hasValue()) { 9540 child.y = yAttr.getPixels('y'); 9541 9542 if (dyAttr.hasValue()) { 9543 child.y += dyAttr.getPixels('y'); 9544 } 9545 } else { 9546 if (dyAttr.hasValue()) { 9547 textParent.y += dyAttr.getPixels('y'); 9548 } 9549 9550 child.y = textParent.y; 9551 } 9552 9553 textParent.y = child.y; // update the current chunk and it's bounds 9554 9555 textParent.leafTexts.push(child); 9556 textParent.minX = Math.min(textParent.minX, child.x, child.x + width); 9557 textParent.maxX = Math.max(textParent.maxX, child.x, child.x + width); 9558 child.clearContext(ctx); 9559 ctx.restore(); 9560 return child; 9561 } 9562 9563 getChildBoundingBox(ctx, textParent, parent, i) { 9564 var child = parent.children[i]; // not a text node? 9565 9566 if (typeof child.getBoundingBox !== 'function') { 9567 return null; 9568 } 9569 9570 var boundingBox = child.getBoundingBox(ctx); 9571 9572 if (!boundingBox) { 9573 return null; 9574 } 9575 9576 child.children.forEach((_, i) => { 9577 var childBoundingBox = textParent.getChildBoundingBox(ctx, textParent, child, i); 9578 boundingBox.addBoundingBox(childBoundingBox); 9579 }); 9580 return boundingBox; 9581 } 9582 9583 renderChild(ctx, textParent, parent, i) { 9584 var child = parent.children[i]; 9585 child.render(ctx); 9586 child.children.forEach((_, i) => { 9587 textParent.renderChild(ctx, textParent, child, i); 9588 }); 9589 } 9590 9591 measureText(ctx) { 9592 var { 9593 measureCache 9594 } = this; 9595 9596 if (~measureCache) { 9597 return measureCache; 9598 } 9599 9600 var renderText = this.getText(); 9601 var measure = this.measureTargetText(ctx, renderText); 9602 this.measureCache = measure; 9603 return measure; 9604 } 9605 9606 measureTargetText(ctx, targetText) { 9607 if (!targetText.length) { 9608 return 0; 9609 } 9610 9611 var { 9612 parent 9613 } = this; 9614 var customFont = parent.getStyle('font-family').getDefinition(); 9615 9616 if (customFont) { 9617 var fontSize = this.getFontSize(); 9618 var text = customFont.isRTL ? targetText.split('').reverse().join('') : targetText; 9619 var dx = toNumbers(parent.getAttribute('dx').getString()); 9620 var len = text.length; 9621 var _measure = 0; 9622 9623 for (var i = 0; i < len; i++) { 9624 var glyph = this.getGlyph(customFont, text, i); 9625 _measure += (glyph.horizAdvX || customFont.horizAdvX) * fontSize / customFont.fontFace.unitsPerEm; 9626 9627 if (typeof dx[i] !== 'undefined' && !isNaN(dx[i])) { 9628 _measure += dx[i]; 9629 } 9630 } 9631 9632 return _measure; 9633 } 9634 9635 if (!ctx.measureText) { 9636 return targetText.length * 10; 9637 } 9638 9639 ctx.save(); 9640 this.setContext(ctx, true); 9641 var { 9642 width: measure 9643 } = ctx.measureText(targetText); 9644 this.clearContext(ctx); 9645 ctx.restore(); 9646 return measure; 9647 } 9648 /** 9649 * Inherits positional attributes from {@link TextElement} parent(s). Attributes 9650 * are only inherited from a parent to its first child. 9651 * @param name - The attribute name. 9652 * @returns The attribute value or null. 9653 */ 9654 9655 9656 getInheritedAttribute(name) { 9657 // eslint-disable-next-line @typescript-eslint/no-this-alias,consistent-this 9658 var current = this; 9659 9660 while (current instanceof TextElement && current.isFirstChild()) { 9661 var parentAttr = current.parent.getAttribute(name); 9662 9663 if (parentAttr.hasValue(true)) { 9664 return parentAttr.getValue('0'); 9665 } 9666 9667 current = current.parent; 9668 } 9669 9670 return null; 9671 } 9672 9673} 9674 9675class TSpanElement extends TextElement { 9676 constructor(document, node, captureTextNodes) { 9677 super(document, node, new.target === TSpanElement ? true : captureTextNodes); 9678 this.type = 'tspan'; // if this node has children, then they own the text 9679 9680 this.text = this.children.length > 0 ? '' : this.getTextFromNode(); 9681 } 9682 9683 getText() { 9684 return this.text; 9685 } 9686 9687} 9688 9689class TextNode extends TSpanElement { 9690 constructor() { 9691 super(...arguments); 9692 this.type = 'textNode'; 9693 } 9694 9695} 9696 9697class SVGElement extends RenderedElement { 9698 constructor() { 9699 super(...arguments); 9700 this.type = 'svg'; 9701 this.root = false; 9702 } 9703 9704 setContext(ctx) { 9705 var _this$node$parentNode; 9706 9707 var { 9708 document 9709 } = this; 9710 var { 9711 screen, 9712 window 9713 } = document; 9714 var canvas = ctx.canvas; 9715 screen.setDefaults(ctx); 9716 9717 if (canvas.style && typeof ctx.font !== 'undefined' && window && typeof window.getComputedStyle !== 'undefined') { 9718 ctx.font = window.getComputedStyle(canvas).getPropertyValue('font'); 9719 var fontSizeProp = new Property(document, 'fontSize', Font.parse(ctx.font).fontSize); 9720 9721 if (fontSizeProp.hasValue()) { 9722 document.rootEmSize = fontSizeProp.getPixels('y'); 9723 document.emSize = document.rootEmSize; 9724 } 9725 } // create new view port 9726 9727 9728 if (!this.getAttribute('x').hasValue()) { 9729 this.getAttribute('x', true).setValue(0); 9730 } 9731 9732 if (!this.getAttribute('y').hasValue()) { 9733 this.getAttribute('y', true).setValue(0); 9734 } 9735 9736 var { 9737 width, 9738 height 9739 } = screen.viewPort; 9740 9741 if (!this.getStyle('width').hasValue()) { 9742 this.getStyle('width', true).setValue('100%'); 9743 } 9744 9745 if (!this.getStyle('height').hasValue()) { 9746 this.getStyle('height', true).setValue('100%'); 9747 } 9748 9749 if (!this.getStyle('color').hasValue()) { 9750 this.getStyle('color', true).setValue('black'); 9751 } 9752 9753 var refXAttr = this.getAttribute('refX'); 9754 var refYAttr = this.getAttribute('refY'); 9755 var viewBoxAttr = this.getAttribute('viewBox'); 9756 var viewBox = viewBoxAttr.hasValue() ? toNumbers(viewBoxAttr.getString()) : null; 9757 var clip = !this.root && this.getStyle('overflow').getValue('hidden') !== 'visible'; 9758 var minX = 0; 9759 var minY = 0; 9760 var clipX = 0; 9761 var clipY = 0; 9762 9763 if (viewBox) { 9764 minX = viewBox[0]; 9765 minY = viewBox[1]; 9766 } 9767 9768 if (!this.root) { 9769 width = this.getStyle('width').getPixels('x'); 9770 height = this.getStyle('height').getPixels('y'); 9771 9772 if (this.type === 'marker') { 9773 clipX = minX; 9774 clipY = minY; 9775 minX = 0; 9776 minY = 0; 9777 } 9778 } 9779 9780 screen.viewPort.setCurrent(width, height); // Default value of transform-origin is center only for root SVG elements 9781 // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform-origin 9782 9783 if (this.node // is not temporary SVGElement 9784 && (!this.parent || ((_this$node$parentNode = this.node.parentNode) === null || _this$node$parentNode === void 0 ? void 0 : _this$node$parentNode.nodeName) === 'foreignObject') && this.getStyle('transform', false, true).hasValue() && !this.getStyle('transform-origin', false, true).hasValue()) { 9785 this.getStyle('transform-origin', true, true).setValue('50% 50%'); 9786 } 9787 9788 super.setContext(ctx); 9789 ctx.translate(this.getAttribute('x').getPixels('x'), this.getAttribute('y').getPixels('y')); 9790 9791 if (viewBox) { 9792 width = viewBox[2]; 9793 height = viewBox[3]; 9794 } 9795 9796 document.setViewBox({ 9797 ctx, 9798 aspectRatio: this.getAttribute('preserveAspectRatio').getString(), 9799 width: screen.viewPort.width, 9800 desiredWidth: width, 9801 height: screen.viewPort.height, 9802 desiredHeight: height, 9803 minX, 9804 minY, 9805 refX: refXAttr.getValue(), 9806 refY: refYAttr.getValue(), 9807 clip, 9808 clipX, 9809 clipY 9810 }); 9811 9812 if (viewBox) { 9813 screen.viewPort.removeCurrent(); 9814 screen.viewPort.setCurrent(width, height); 9815 } 9816 } 9817 9818 clearContext(ctx) { 9819 super.clearContext(ctx); 9820 this.document.screen.viewPort.removeCurrent(); 9821 } 9822 /** 9823 * Resize SVG to fit in given size. 9824 * @param width 9825 * @param height 9826 * @param preserveAspectRatio 9827 */ 9828 9829 9830 resize(width) { 9831 var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : width; 9832 var preserveAspectRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 9833 var widthAttr = this.getAttribute('width', true); 9834 var heightAttr = this.getAttribute('height', true); 9835 var viewBoxAttr = this.getAttribute('viewBox'); 9836 var styleAttr = this.getAttribute('style'); 9837 var originWidth = widthAttr.getNumber(0); 9838 var originHeight = heightAttr.getNumber(0); 9839 9840 if (preserveAspectRatio) { 9841 if (typeof preserveAspectRatio === 'string') { 9842 this.getAttribute('preserveAspectRatio', true).setValue(preserveAspectRatio); 9843 } else { 9844 var preserveAspectRatioAttr = this.getAttribute('preserveAspectRatio'); 9845 9846 if (preserveAspectRatioAttr.hasValue()) { 9847 preserveAspectRatioAttr.setValue(preserveAspectRatioAttr.getString().replace(/^\s*(\S.*\S)\s*$/, '$1')); 9848 } 9849 } 9850 } 9851 9852 widthAttr.setValue(width); 9853 heightAttr.setValue(height); 9854 9855 if (!viewBoxAttr.hasValue()) { 9856 viewBoxAttr.setValue("0 0 ".concat(originWidth || width, " ").concat(originHeight || height)); 9857 } 9858 9859 if (styleAttr.hasValue()) { 9860 var widthStyle = this.getStyle('width'); 9861 var heightStyle = this.getStyle('height'); 9862 9863 if (widthStyle.hasValue()) { 9864 widthStyle.setValue("".concat(width, "px")); 9865 } 9866 9867 if (heightStyle.hasValue()) { 9868 heightStyle.setValue("".concat(height, "px")); 9869 } 9870 } 9871 } 9872 9873} 9874 9875class RectElement extends PathElement { 9876 constructor() { 9877 super(...arguments); 9878 this.type = 'rect'; 9879 } 9880 9881 path(ctx) { 9882 var x = this.getAttribute('x').getPixels('x'); 9883 var y = this.getAttribute('y').getPixels('y'); 9884 var width = this.getStyle('width', false, true).getPixels('x'); 9885 var height = this.getStyle('height', false, true).getPixels('y'); 9886 var rxAttr = this.getAttribute('rx'); 9887 var ryAttr = this.getAttribute('ry'); 9888 var rx = rxAttr.getPixels('x'); 9889 var ry = ryAttr.getPixels('y'); 9890 9891 if (rxAttr.hasValue() && !ryAttr.hasValue()) { 9892 ry = rx; 9893 } 9894 9895 if (ryAttr.hasValue() && !rxAttr.hasValue()) { 9896 rx = ry; 9897 } 9898 9899 rx = Math.min(rx, width / 2.0); 9900 ry = Math.min(ry, height / 2.0); 9901 9902 if (ctx) { 9903 var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3); 9904 ctx.beginPath(); // always start the path so we don't fill prior paths 9905 9906 if (height > 0 && width > 0) { 9907 ctx.moveTo(x + rx, y); 9908 ctx.lineTo(x + width - rx, y); 9909 ctx.bezierCurveTo(x + width - rx + KAPPA * rx, y, x + width, y + ry - KAPPA * ry, x + width, y + ry); 9910 ctx.lineTo(x + width, y + height - ry); 9911 ctx.bezierCurveTo(x + width, y + height - ry + KAPPA * ry, x + width - rx + KAPPA * rx, y + height, x + width - rx, y + height); 9912 ctx.lineTo(x + rx, y + height); 9913 ctx.bezierCurveTo(x + rx - KAPPA * rx, y + height, x, y + height - ry + KAPPA * ry, x, y + height - ry); 9914 ctx.lineTo(x, y + ry); 9915 ctx.bezierCurveTo(x, y + ry - KAPPA * ry, x + rx - KAPPA * rx, y, x + rx, y); 9916 ctx.closePath(); 9917 } 9918 } 9919 9920 return new BoundingBox(x, y, x + width, y + height); 9921 } 9922 9923 getMarkers() { 9924 return null; 9925 } 9926 9927} 9928 9929class CircleElement extends PathElement { 9930 constructor() { 9931 super(...arguments); 9932 this.type = 'circle'; 9933 } 9934 9935 path(ctx) { 9936 var cx = this.getAttribute('cx').getPixels('x'); 9937 var cy = this.getAttribute('cy').getPixels('y'); 9938 var r = this.getAttribute('r').getPixels(); 9939 9940 if (ctx && r > 0) { 9941 ctx.beginPath(); 9942 ctx.arc(cx, cy, r, 0, Math.PI * 2, false); 9943 ctx.closePath(); 9944 } 9945 9946 return new BoundingBox(cx - r, cy - r, cx + r, cy + r); 9947 } 9948 9949 getMarkers() { 9950 return null; 9951 } 9952 9953} 9954 9955class EllipseElement extends PathElement { 9956 constructor() { 9957 super(...arguments); 9958 this.type = 'ellipse'; 9959 } 9960 9961 path(ctx) { 9962 var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3); 9963 var rx = this.getAttribute('rx').getPixels('x'); 9964 var ry = this.getAttribute('ry').getPixels('y'); 9965 var cx = this.getAttribute('cx').getPixels('x'); 9966 var cy = this.getAttribute('cy').getPixels('y'); 9967 9968 if (ctx && rx > 0 && ry > 0) { 9969 ctx.beginPath(); 9970 ctx.moveTo(cx + rx, cy); 9971 ctx.bezierCurveTo(cx + rx, cy + KAPPA * ry, cx + KAPPA * rx, cy + ry, cx, cy + ry); 9972 ctx.bezierCurveTo(cx - KAPPA * rx, cy + ry, cx - rx, cy + KAPPA * ry, cx - rx, cy); 9973 ctx.bezierCurveTo(cx - rx, cy - KAPPA * ry, cx - KAPPA * rx, cy - ry, cx, cy - ry); 9974 ctx.bezierCurveTo(cx + KAPPA * rx, cy - ry, cx + rx, cy - KAPPA * ry, cx + rx, cy); 9975 ctx.closePath(); 9976 } 9977 9978 return new BoundingBox(cx - rx, cy - ry, cx + rx, cy + ry); 9979 } 9980 9981 getMarkers() { 9982 return null; 9983 } 9984 9985} 9986 9987class LineElement extends PathElement { 9988 constructor() { 9989 super(...arguments); 9990 this.type = 'line'; 9991 } 9992 9993 getPoints() { 9994 return [new Point(this.getAttribute('x1').getPixels('x'), this.getAttribute('y1').getPixels('y')), new Point(this.getAttribute('x2').getPixels('x'), this.getAttribute('y2').getPixels('y'))]; 9995 } 9996 9997 path(ctx) { 9998 var [{ 9999 x: x0, 10000 y: y0 10001 }, { 10002 x: x1, 10003 y: y1 10004 }] = this.getPoints(); 10005 10006 if (ctx) { 10007 ctx.beginPath(); 10008 ctx.moveTo(x0, y0); 10009 ctx.lineTo(x1, y1); 10010 } 10011 10012 return new BoundingBox(x0, y0, x1, y1); 10013 } 10014 10015 getMarkers() { 10016 var [p0, p1] = this.getPoints(); 10017 var a = p0.angleTo(p1); 10018 return [[p0, a], [p1, a]]; 10019 } 10020 10021} 10022 10023class PolylineElement extends PathElement { 10024 constructor(document, node, captureTextNodes) { 10025 super(document, node, captureTextNodes); 10026 this.type = 'polyline'; 10027 this.points = []; 10028 this.points = Point.parsePath(this.getAttribute('points').getString()); 10029 } 10030 10031 path(ctx) { 10032 var { 10033 points 10034 } = this; 10035 var [{ 10036 x: x0, 10037 y: y0 10038 }] = points; 10039 var boundingBox = new BoundingBox(x0, y0); 10040 10041 if (ctx) { 10042 ctx.beginPath(); 10043 ctx.moveTo(x0, y0); 10044 } 10045 10046 points.forEach(_ref => { 10047 var { 10048 x, 10049 y 10050 } = _ref; 10051 boundingBox.addPoint(x, y); 10052 10053 if (ctx) { 10054 ctx.lineTo(x, y); 10055 } 10056 }); 10057 return boundingBox; 10058 } 10059 10060 getMarkers() { 10061 var { 10062 points 10063 } = this; 10064 var lastIndex = points.length - 1; 10065 var markers = []; 10066 points.forEach((point, i) => { 10067 if (i === lastIndex) { 10068 return; 10069 } 10070 10071 markers.push([point, point.angleTo(points[i + 1])]); 10072 }); 10073 10074 if (markers.length > 0) { 10075 markers.push([points[points.length - 1], markers[markers.length - 1][1]]); 10076 } 10077 10078 return markers; 10079 } 10080 10081} 10082 10083class PolygonElement extends PolylineElement { 10084 constructor() { 10085 super(...arguments); 10086 this.type = 'polygon'; 10087 } 10088 10089 path(ctx) { 10090 var boundingBox = super.path(ctx); 10091 var [{ 10092 x, 10093 y 10094 }] = this.points; 10095 10096 if (ctx) { 10097 ctx.lineTo(x, y); 10098 ctx.closePath(); 10099 } 10100 10101 return boundingBox; 10102 } 10103 10104} 10105 10106class PatternElement extends Element { 10107 constructor() { 10108 super(...arguments); 10109 this.type = 'pattern'; 10110 } 10111 10112 createPattern(ctx, _, parentOpacityProp) { 10113 var width = this.getStyle('width').getPixels('x', true); 10114 var height = this.getStyle('height').getPixels('y', true); // render me using a temporary svg element 10115 10116 var patternSvg = new SVGElement(this.document, null); 10117 patternSvg.attributes.viewBox = new Property(this.document, 'viewBox', this.getAttribute('viewBox').getValue()); 10118 patternSvg.attributes.width = new Property(this.document, 'width', "".concat(width, "px")); 10119 patternSvg.attributes.height = new Property(this.document, 'height', "".concat(height, "px")); 10120 patternSvg.attributes.transform = new Property(this.document, 'transform', this.getAttribute('patternTransform').getValue()); 10121 patternSvg.children = this.children; 10122 var patternCanvas = this.document.createCanvas(width, height); 10123 var patternCtx = patternCanvas.getContext('2d'); 10124 var xAttr = this.getAttribute('x'); 10125 var yAttr = this.getAttribute('y'); 10126 10127 if (xAttr.hasValue() && yAttr.hasValue()) { 10128 patternCtx.translate(xAttr.getPixels('x', true), yAttr.getPixels('y', true)); 10129 } 10130 10131 if (parentOpacityProp.hasValue()) { 10132 this.styles['fill-opacity'] = parentOpacityProp; 10133 } else { 10134 Reflect.deleteProperty(this.styles, 'fill-opacity'); 10135 } // render 3x3 grid so when we transform there's no white space on edges 10136 10137 10138 for (var x = -1; x <= 1; x++) { 10139 for (var y = -1; y <= 1; y++) { 10140 patternCtx.save(); 10141 patternSvg.attributes.x = new Property(this.document, 'x', x * patternCanvas.width); 10142 patternSvg.attributes.y = new Property(this.document, 'y', y * patternCanvas.height); 10143 patternSvg.render(patternCtx); 10144 patternCtx.restore(); 10145 } 10146 } 10147 10148 var pattern = ctx.createPattern(patternCanvas, 'repeat'); 10149 return pattern; 10150 } 10151 10152} 10153 10154class MarkerElement extends Element { 10155 constructor() { 10156 super(...arguments); 10157 this.type = 'marker'; 10158 } 10159 10160 render(ctx, point, angle) { 10161 if (!point) { 10162 return; 10163 } 10164 10165 var { 10166 x, 10167 y 10168 } = point; 10169 var orient = this.getAttribute('orient').getString('auto'); 10170 var markerUnits = this.getAttribute('markerUnits').getString('strokeWidth'); 10171 ctx.translate(x, y); 10172 10173 if (orient === 'auto') { 10174 ctx.rotate(angle); 10175 } 10176 10177 if (markerUnits === 'strokeWidth') { 10178 ctx.scale(ctx.lineWidth, ctx.lineWidth); 10179 } 10180 10181 ctx.save(); // render me using a temporary svg element 10182 10183 var markerSvg = new SVGElement(this.document, null); 10184 markerSvg.type = this.type; 10185 markerSvg.attributes.viewBox = new Property(this.document, 'viewBox', this.getAttribute('viewBox').getValue()); 10186 markerSvg.attributes.refX = new Property(this.document, 'refX', this.getAttribute('refX').getValue()); 10187 markerSvg.attributes.refY = new Property(this.document, 'refY', this.getAttribute('refY').getValue()); 10188 markerSvg.attributes.width = new Property(this.document, 'width', this.getAttribute('markerWidth').getValue()); 10189 markerSvg.attributes.height = new Property(this.document, 'height', this.getAttribute('markerHeight').getValue()); 10190 markerSvg.attributes.overflow = new Property(this.document, 'overflow', this.getAttribute('overflow').getValue()); 10191 markerSvg.attributes.fill = new Property(this.document, 'fill', this.getAttribute('fill').getColor('black')); 10192 markerSvg.attributes.stroke = new Property(this.document, 'stroke', this.getAttribute('stroke').getValue('none')); 10193 markerSvg.children = this.children; 10194 markerSvg.render(ctx); 10195 ctx.restore(); 10196 10197 if (markerUnits === 'strokeWidth') { 10198 ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth); 10199 } 10200 10201 if (orient === 'auto') { 10202 ctx.rotate(-angle); 10203 } 10204 10205 ctx.translate(-x, -y); 10206 } 10207 10208} 10209 10210class DefsElement extends Element { 10211 constructor() { 10212 super(...arguments); 10213 this.type = 'defs'; 10214 } 10215 10216 render() {// NOOP 10217 } 10218 10219} 10220 10221class GElement extends RenderedElement { 10222 constructor() { 10223 super(...arguments); 10224 this.type = 'g'; 10225 } 10226 10227 getBoundingBox(ctx) { 10228 var boundingBox = new BoundingBox(); 10229 this.children.forEach(child => { 10230 boundingBox.addBoundingBox(child.getBoundingBox(ctx)); 10231 }); 10232 return boundingBox; 10233 } 10234 10235} 10236 10237class GradientElement extends Element { 10238 constructor(document, node, captureTextNodes) { 10239 super(document, node, captureTextNodes); 10240 this.attributesToInherit = ['gradientUnits']; 10241 this.stops = []; 10242 var { 10243 stops, 10244 children 10245 } = this; 10246 children.forEach(child => { 10247 if (child.type === 'stop') { 10248 stops.push(child); 10249 } 10250 }); 10251 } 10252 10253 getGradientUnits() { 10254 return this.getAttribute('gradientUnits').getString('objectBoundingBox'); 10255 } 10256 10257 createGradient(ctx, element, parentOpacityProp) { 10258 // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this 10259 var stopsContainer = this; 10260 10261 if (this.getHrefAttribute().hasValue()) { 10262 stopsContainer = this.getHrefAttribute().getDefinition(); 10263 this.inheritStopContainer(stopsContainer); 10264 } 10265 10266 var { 10267 stops 10268 } = stopsContainer; 10269 var gradient = this.getGradient(ctx, element); 10270 10271 if (!gradient) { 10272 return this.addParentOpacity(parentOpacityProp, stops[stops.length - 1].color); 10273 } 10274 10275 stops.forEach(stop => { 10276 gradient.addColorStop(stop.offset, this.addParentOpacity(parentOpacityProp, stop.color)); 10277 }); 10278 10279 if (this.getAttribute('gradientTransform').hasValue()) { 10280 // render as transformed pattern on temporary canvas 10281 var { 10282 document 10283 } = this; 10284 var { 10285 MAX_VIRTUAL_PIXELS, 10286 viewPort 10287 } = document.screen; 10288 var [rootView] = viewPort.viewPorts; 10289 var rect = new RectElement(document, null); 10290 rect.attributes.x = new Property(document, 'x', -MAX_VIRTUAL_PIXELS / 3.0); 10291 rect.attributes.y = new Property(document, 'y', -MAX_VIRTUAL_PIXELS / 3.0); 10292 rect.attributes.width = new Property(document, 'width', MAX_VIRTUAL_PIXELS); 10293 rect.attributes.height = new Property(document, 'height', MAX_VIRTUAL_PIXELS); 10294 var group = new GElement(document, null); 10295 group.attributes.transform = new Property(document, 'transform', this.getAttribute('gradientTransform').getValue()); 10296 group.children = [rect]; 10297 var patternSvg = new SVGElement(document, null); 10298 patternSvg.attributes.x = new Property(document, 'x', 0); 10299 patternSvg.attributes.y = new Property(document, 'y', 0); 10300 patternSvg.attributes.width = new Property(document, 'width', rootView.width); 10301 patternSvg.attributes.height = new Property(document, 'height', rootView.height); 10302 patternSvg.children = [group]; 10303 var patternCanvas = document.createCanvas(rootView.width, rootView.height); 10304 var patternCtx = patternCanvas.getContext('2d'); 10305 patternCtx.fillStyle = gradient; 10306 patternSvg.render(patternCtx); 10307 return patternCtx.createPattern(patternCanvas, 'no-repeat'); 10308 } 10309 10310 return gradient; 10311 } 10312 10313 inheritStopContainer(stopsContainer) { 10314 this.attributesToInherit.forEach(attributeToInherit => { 10315 if (!this.getAttribute(attributeToInherit).hasValue() && stopsContainer.getAttribute(attributeToInherit).hasValue()) { 10316 this.getAttribute(attributeToInherit, true).setValue(stopsContainer.getAttribute(attributeToInherit).getValue()); 10317 } 10318 }); 10319 } 10320 10321 addParentOpacity(parentOpacityProp, color) { 10322 if (parentOpacityProp.hasValue()) { 10323 var colorProp = new Property(this.document, 'color', color); 10324 return colorProp.addOpacity(parentOpacityProp).getColor(); 10325 } 10326 10327 return color; 10328 } 10329 10330} 10331 10332class LinearGradientElement extends GradientElement { 10333 constructor(document, node, captureTextNodes) { 10334 super(document, node, captureTextNodes); 10335 this.type = 'linearGradient'; 10336 this.attributesToInherit.push('x1', 'y1', 'x2', 'y2'); 10337 } 10338 10339 getGradient(ctx, element) { 10340 var isBoundingBoxUnits = this.getGradientUnits() === 'objectBoundingBox'; 10341 var boundingBox = isBoundingBoxUnits ? element.getBoundingBox(ctx) : null; 10342 10343 if (isBoundingBoxUnits && !boundingBox) { 10344 return null; 10345 } 10346 10347 if (!this.getAttribute('x1').hasValue() && !this.getAttribute('y1').hasValue() && !this.getAttribute('x2').hasValue() && !this.getAttribute('y2').hasValue()) { 10348 this.getAttribute('x1', true).setValue(0); 10349 this.getAttribute('y1', true).setValue(0); 10350 this.getAttribute('x2', true).setValue(1); 10351 this.getAttribute('y2', true).setValue(0); 10352 } 10353 10354 var x1 = isBoundingBoxUnits ? boundingBox.x + boundingBox.width * this.getAttribute('x1').getNumber() : this.getAttribute('x1').getPixels('x'); 10355 var y1 = isBoundingBoxUnits ? boundingBox.y + boundingBox.height * this.getAttribute('y1').getNumber() : this.getAttribute('y1').getPixels('y'); 10356 var x2 = isBoundingBoxUnits ? boundingBox.x + boundingBox.width * this.getAttribute('x2').getNumber() : this.getAttribute('x2').getPixels('x'); 10357 var y2 = isBoundingBoxUnits ? boundingBox.y + boundingBox.height * this.getAttribute('y2').getNumber() : this.getAttribute('y2').getPixels('y'); 10358 10359 if (x1 === x2 && y1 === y2) { 10360 return null; 10361 } 10362 10363 return ctx.createLinearGradient(x1, y1, x2, y2); 10364 } 10365 10366} 10367 10368class RadialGradientElement extends GradientElement { 10369 constructor(document, node, captureTextNodes) { 10370 super(document, node, captureTextNodes); 10371 this.type = 'radialGradient'; 10372 this.attributesToInherit.push('cx', 'cy', 'r', 'fx', 'fy', 'fr'); 10373 } 10374 10375 getGradient(ctx, element) { 10376 var isBoundingBoxUnits = this.getGradientUnits() === 'objectBoundingBox'; 10377 var boundingBox = element.getBoundingBox(ctx); 10378 10379 if (isBoundingBoxUnits && !boundingBox) { 10380 return null; 10381 } 10382 10383 if (!this.getAttribute('cx').hasValue()) { 10384 this.getAttribute('cx', true).setValue('50%'); 10385 } 10386 10387 if (!this.getAttribute('cy').hasValue()) { 10388 this.getAttribute('cy', true).setValue('50%'); 10389 } 10390 10391 if (!this.getAttribute('r').hasValue()) { 10392 this.getAttribute('r', true).setValue('50%'); 10393 } 10394 10395 var cx = isBoundingBoxUnits ? boundingBox.x + boundingBox.width * this.getAttribute('cx').getNumber() : this.getAttribute('cx').getPixels('x'); 10396 var cy = isBoundingBoxUnits ? boundingBox.y + boundingBox.height * this.getAttribute('cy').getNumber() : this.getAttribute('cy').getPixels('y'); 10397 var fx = cx; 10398 var fy = cy; 10399 10400 if (this.getAttribute('fx').hasValue()) { 10401 fx = isBoundingBoxUnits ? boundingBox.x + boundingBox.width * this.getAttribute('fx').getNumber() : this.getAttribute('fx').getPixels('x'); 10402 } 10403 10404 if (this.getAttribute('fy').hasValue()) { 10405 fy = isBoundingBoxUnits ? boundingBox.y + boundingBox.height * this.getAttribute('fy').getNumber() : this.getAttribute('fy').getPixels('y'); 10406 } 10407 10408 var r = isBoundingBoxUnits ? (boundingBox.width + boundingBox.height) / 2.0 * this.getAttribute('r').getNumber() : this.getAttribute('r').getPixels(); 10409 var fr = this.getAttribute('fr').getPixels(); 10410 return ctx.createRadialGradient(fx, fy, fr, cx, cy, r); 10411 } 10412 10413} 10414 10415class StopElement extends Element { 10416 constructor(document, node, captureTextNodes) { 10417 super(document, node, captureTextNodes); 10418 this.type = 'stop'; 10419 var offset = Math.max(0, Math.min(1, this.getAttribute('offset').getNumber())); 10420 var stopOpacity = this.getStyle('stop-opacity'); 10421 var stopColor = this.getStyle('stop-color', true); 10422 10423 if (stopColor.getString() === '') { 10424 stopColor.setValue('#000'); 10425 } 10426 10427 if (stopOpacity.hasValue()) { 10428 stopColor = stopColor.addOpacity(stopOpacity); 10429 } 10430 10431 this.offset = offset; 10432 this.color = stopColor.getColor(); 10433 } 10434 10435} 10436 10437class AnimateElement extends Element { 10438 constructor(document, node, captureTextNodes) { 10439 super(document, node, captureTextNodes); 10440 this.type = 'animate'; 10441 this.duration = 0; 10442 this.initialValue = null; 10443 this.initialUnits = ''; 10444 this.removed = false; 10445 this.frozen = false; 10446 document.screen.animations.push(this); 10447 this.begin = this.getAttribute('begin').getMilliseconds(); 10448 this.maxDuration = this.begin + this.getAttribute('dur').getMilliseconds(); 10449 this.from = this.getAttribute('from'); 10450 this.to = this.getAttribute('to'); 10451 this.values = new Property(document, 'values', null); 10452 var valuesAttr = this.getAttribute('values'); 10453 10454 if (valuesAttr.hasValue()) { 10455 this.values.setValue(valuesAttr.getString().split(';')); 10456 } 10457 } 10458 10459 getProperty() { 10460 var attributeType = this.getAttribute('attributeType').getString(); 10461 var attributeName = this.getAttribute('attributeName').getString(); 10462 10463 if (attributeType === 'CSS') { 10464 return this.parent.getStyle(attributeName, true); 10465 } 10466 10467 return this.parent.getAttribute(attributeName, true); 10468 } 10469 10470 calcValue() { 10471 var { 10472 initialUnits 10473 } = this; 10474 var { 10475 progress, 10476 from, 10477 to 10478 } = this.getProgress(); // tween value linearly 10479 10480 var newValue = from.getNumber() + (to.getNumber() - from.getNumber()) * progress; 10481 10482 if (initialUnits === '%') { 10483 newValue *= 100.0; // numValue() returns 0-1 whereas properties are 0-100 10484 } 10485 10486 return "".concat(newValue).concat(initialUnits); 10487 } 10488 10489 update(delta) { 10490 var { 10491 parent 10492 } = this; 10493 var prop = this.getProperty(); // set initial value 10494 10495 if (!this.initialValue) { 10496 this.initialValue = prop.getString(); 10497 this.initialUnits = prop.getUnits(); 10498 } // if we're past the end time 10499 10500 10501 if (this.duration > this.maxDuration) { 10502 var fill = this.getAttribute('fill').getString('remove'); // loop for indefinitely repeating animations 10503 10504 if (this.getAttribute('repeatCount').getString() === 'indefinite' || this.getAttribute('repeatDur').getString() === 'indefinite') { 10505 this.duration = 0; 10506 } else if (fill === 'freeze' && !this.frozen) { 10507 this.frozen = true; 10508 parent.animationFrozen = true; 10509 parent.animationFrozenValue = prop.getString(); 10510 } else if (fill === 'remove' && !this.removed) { 10511 this.removed = true; 10512 prop.setValue(parent.animationFrozen ? parent.animationFrozenValue : this.initialValue); 10513 return true; 10514 } 10515 10516 return false; 10517 } 10518 10519 this.duration += delta; // if we're past the begin time 10520 10521 var updated = false; 10522 10523 if (this.begin < this.duration) { 10524 var newValue = this.calcValue(); // tween 10525 10526 var typeAttr = this.getAttribute('type'); 10527 10528 if (typeAttr.hasValue()) { 10529 // for transform, etc. 10530 var type = typeAttr.getString(); 10531 newValue = "".concat(type, "(").concat(newValue, ")"); 10532 } 10533 10534 prop.setValue(newValue); 10535 updated = true; 10536 } 10537 10538 return updated; 10539 } 10540 10541 getProgress() { 10542 var { 10543 document, 10544 values 10545 } = this; 10546 var result = { 10547 progress: (this.duration - this.begin) / (this.maxDuration - this.begin) 10548 }; 10549 10550 if (values.hasValue()) { 10551 var p = result.progress * (values.getValue().length - 1); 10552 var lb = Math.floor(p); 10553 var ub = Math.ceil(p); 10554 result.from = new Property(document, 'from', parseFloat(values.getValue()[lb])); 10555 result.to = new Property(document, 'to', parseFloat(values.getValue()[ub])); 10556 result.progress = (p - lb) / (ub - lb); 10557 } else { 10558 result.from = this.from; 10559 result.to = this.to; 10560 } 10561 10562 return result; 10563 } 10564 10565} 10566 10567class AnimateColorElement extends AnimateElement { 10568 constructor() { 10569 super(...arguments); 10570 this.type = 'animateColor'; 10571 } 10572 10573 calcValue() { 10574 var { 10575 progress, 10576 from, 10577 to 10578 } = this.getProgress(); 10579 var colorFrom = new
vendor: 5,316 bytes, lines 10579-10783
10579RGBColor$1(from.getColor()); 10580 var colorTo = new RGBColor$1(to.getColor()); 10581 10582 if (colorFrom.ok && colorTo.ok) { 10583 // tween color linearly 10584 var r = colorFrom.r + (colorTo.r - colorFrom.r) * progress; 10585 var g = colorFrom.g + (colorTo.g - colorFrom.g) * progress; 10586 var b = colorFrom.b + (colorTo.b - colorFrom.b) * progress; // ? alpha 10587 10588 return "rgb(".concat(Math.floor(r), ", ").concat(Math.floor(g), ", ").concat(Math.floor(b), ")"); 10589 } 10590 10591 return this.getAttribute('from').getColor(); 10592 } 10593 10594} 10595 10596class AnimateTransformElement extends AnimateElement { 10597 constructor() { 10598 super(...arguments); 10599 this.type = 'animateTransform'; 10600 } 10601 10602 calcValue() { 10603 var { 10604 progress, 10605 from, 10606 to 10607 } = this.getProgress(); // tween value linearly 10608 10609 var transformFrom = toNumbers(from.getString()); 10610 var transformTo = toNumbers(to.getString()); 10611 var newValue = transformFrom.map((from, i) => { 10612 var to = transformTo[i]; 10613 return from + (to - from) * progress; 10614 }).join(' '); 10615 return newValue; 10616 } 10617 10618} 10619 10620class FontElement extends Element { 10621 constructor(document, node, captureTextNodes) { 10622 super(document, node, captureTextNodes); 10623 this.type = 'font'; 10624 this.glyphs = Object.create(null); 10625 this.horizAdvX = this.getAttribute('horiz-adv-x').getNumber(); 10626 var { 10627 definitions 10628 } = document; 10629 var { 10630 children 10631 } = this; 10632 10633 for (var child of children) { 10634 switch (child.type) { 10635 case 'font-face': 10636 { 10637 this.fontFace = child; 10638 var fontFamilyStyle = child.getStyle('font-family'); 10639 10640 if (fontFamilyStyle.hasValue()) { 10641 definitions[fontFamilyStyle.getString()] = this; 10642 } 10643 10644 break; 10645 } 10646 10647 case 'missing-glyph': 10648 this.missingGlyph = child; 10649 break; 10650 10651 case 'glyph': 10652 { 10653 var glyph = child; 10654 10655 if (glyph.arabicForm) { 10656 this.isRTL = true; 10657 this.isArabic = true; 10658 10659 if (typeof this.glyphs[glyph.unicode] === 'undefined') { 10660 this.glyphs[glyph.unicode] = Object.create(null); 10661 } 10662 10663 this.glyphs[glyph.unicode][glyph.arabicForm] = glyph; 10664 } else { 10665 this.glyphs[glyph.unicode] = glyph; 10666 } 10667 10668 break; 10669 } 10670 } 10671 } 10672 } 10673 10674 render() {// NO RENDER 10675 } 10676 10677} 10678 10679class FontFaceElement extends Element { 10680 constructor(document, node, captureTextNodes) { 10681 super(document, node, captureTextNodes); 10682 this.type = 'font-face'; 10683 this.ascent = this.getAttribute('ascent').getNumber(); 10684 this.descent = this.getAttribute('descent').getNumber(); 10685 this.unitsPerEm = this.getAttribute('units-per-em').getNumber(); 10686 } 10687 10688} 10689 10690class MissingGlyphElement extends PathElement { 10691 constructor() { 10692 super(...arguments); 10693 this.type = 'missing-glyph'; 10694 this.horizAdvX = 0; 10695 } 10696 10697} 10698 10699class TRefElement extends TextElement { 10700 constructor() { 10701 super(...arguments); 10702 this.type = 'tref'; 10703 } 10704 10705 getText() { 10706 var element = this.getHrefAttribute().getDefinition(); 10707 10708 if (element) { 10709 var firstChild = element.children[0]; 10710 10711 if (firstChild) { 10712 return firstChild.getText(); 10713 } 10714 } 10715 10716 return ''; 10717 } 10718 10719} 10720 10721class AElement extends TextElement { 10722 constructor(document, node, captureTextNodes) { 10723 super(document, node, captureTextNodes); 10724 this.type = 'a'; 10725 var { 10726 childNodes 10727 } = node; 10728 var firstChild = childNodes[0]; 10729 var hasText = childNodes.length > 0 && Array.from(childNodes).every(node => node.nodeType === 3); 10730 this.hasText = hasText; 10731 this.text = hasText ? this.getTextFromNode(firstChild) : ''; 10732 } 10733 10734 getText() { 10735 return this.text; 10736 } 10737 10738 renderChildren(ctx) { 10739 if (this.hasText) { 10740 // render as text element 10741 super.renderChildren(ctx); 10742 var { 10743 document, 10744 x, 10745 y 10746 } = this; 10747 var { 10748 mouse 10749 } = document.screen; 10750 var fontSize = new Property(document, 'fontSize', Font.parse(document.ctx.font).fontSize); // Do not calc bounding box if mouse is not working. 10751 10752 if (mouse.isWorking()) { 10753 mouse.checkBoundingBox(this, new BoundingBox(x, y - fontSize.getPixels('y'), x + this.measureText(ctx), y)); 10754 } 10755 } else if (this.children.length > 0) { 10756 // render as temporary group 10757 var g = new GElement(this.document, null); 10758 g.children = this.children; 10759 g.parent = this; 10760 g.render(ctx); 10761 } 10762 } 10763 10764 onClick() { 10765 var { 10766 window 10767 } = this.document; 10768 10769 if (window) { 10770 window.open(this.getHrefAttribute().getString()); 10771 } 10772 } 10773 10774 onMouseMove() { 10775 var ctx = this.document.ctx; 10776 ctx.canvas.style.cursor = 'pointer'; 10777 } 10778 10779} 10780 10781function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } 10782 10783function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty
vendor: 17,013 bytes, lines 10783-11416
10783(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 10784class TextPathElement extends TextElement { 10785 constructor(document, node, captureTextNodes) { 10786 super(document, node, captureTextNodes); 10787 this.type = 'textPath'; 10788 this.textWidth = 0; 10789 this.textHeight = 0; 10790 this.pathLength = -1; 10791 this.glyphInfo = null; 10792 this.letterSpacingCache = []; 10793 this.measuresCache = new Map([['', 0]]); 10794 var pathElement = this.getHrefAttribute().getDefinition(); 10795 this.text = this.getTextFromNode(); 10796 this.dataArray = this.parsePathData(pathElement); 10797 } 10798 10799 getText() { 10800 return this.text; 10801 } 10802 10803 path(ctx) { 10804 var { 10805 dataArray 10806 } = this; 10807 10808 if (ctx) { 10809 ctx.beginPath(); 10810 } 10811 10812 dataArray.forEach(_ref => { 10813 var { 10814 type, 10815 points 10816 } = _ref; 10817 10818 switch (type) { 10819 case PathParser.LINE_TO: 10820 if (ctx) { 10821 ctx.lineTo(points[0], points[1]); 10822 } 10823 10824 break; 10825 10826 case PathParser.MOVE_TO: 10827 if (ctx) { 10828 ctx.moveTo(points[0], points[1]); 10829 } 10830 10831 break; 10832 10833 case PathParser.CURVE_TO: 10834 if (ctx) { 10835 ctx.bezierCurveTo(points[0], points[1], points[2], points[3], points[4], points[5]); 10836 } 10837 10838 break; 10839 10840 case PathParser.QUAD_TO: 10841 if (ctx) { 10842 ctx.quadraticCurveTo(points[0], points[1], points[2], points[3]); 10843 } 10844 10845 break; 10846 10847 case PathParser.ARC: 10848 { 10849 var [cx, cy, rx, ry, theta, dTheta, psi, fs] = points; 10850 var r = rx > ry ? rx : ry; 10851 var scaleX = rx > ry ? 1 : rx / ry; 10852 var scaleY = rx > ry ? ry / rx : 1; 10853 10854 if (ctx) { 10855 ctx.translate(cx, cy); 10856 ctx.rotate(psi); 10857 ctx.scale(scaleX, scaleY); 10858 ctx.arc(0, 0, r, theta, theta + dTheta, Boolean(1 - fs)); 10859 ctx.scale(1 / scaleX, 1 / scaleY); 10860 ctx.rotate(-psi); 10861 ctx.translate(-cx, -cy); 10862 } 10863 10864 break; 10865 } 10866 10867 case PathParser.CLOSE_PATH: 10868 if (ctx) { 10869 ctx.closePath(); 10870 } 10871 10872 break; 10873 } 10874 }); 10875 } 10876 10877 renderChildren(ctx) { 10878 this.setTextData(ctx); 10879 ctx.save(); 10880 var textDecoration = this.parent.getStyle('text-decoration').getString(); 10881 var fontSize = this.getFontSize(); 10882 var { 10883 glyphInfo 10884 } = this; 10885 var fill = ctx.fillStyle; 10886 10887 if (textDecoration === 'underline') { 10888 ctx.beginPath(); 10889 } 10890 10891 glyphInfo.forEach((glyph, i) => { 10892 var { 10893 p0, 10894 p1, 10895 rotation, 10896 text: partialText 10897 } = glyph; 10898 ctx.save(); 10899 ctx.translate(p0.x, p0.y); 10900 ctx.rotate(rotation); 10901 10902 if (ctx.fillStyle) { 10903 ctx.fillText(partialText, 0, 0); 10904 } 10905 10906 if (ctx.strokeStyle) { 10907 ctx.strokeText(partialText, 0, 0); 10908 } 10909 10910 ctx.restore(); 10911 10912 if (textDecoration === 'underline') { 10913 if (i === 0) { 10914 ctx.moveTo(p0.x, p0.y + fontSize / 8); 10915 } 10916 10917 ctx.lineTo(p1.x, p1.y + fontSize / 5); 10918 } // // To assist with debugging visually, uncomment following 10919 // 10920 // ctx.beginPath(); 10921 // if (i % 2) 10922 // ctx.strokeStyle = 'red'; 10923 // else 10924 // ctx.strokeStyle = 'green'; 10925 // ctx.moveTo(p0.x, p0.y); 10926 // ctx.lineTo(p1.x, p1.y); 10927 // ctx.stroke(); 10928 // ctx.closePath(); 10929 10930 }); 10931 10932 if (textDecoration === 'underline') { 10933 ctx.lineWidth = fontSize / 20; 10934 ctx.strokeStyle = fill; 10935 ctx.stroke(); 10936 ctx.closePath(); 10937 } 10938 10939 ctx.restore(); 10940 } 10941 10942 getLetterSpacingAt() { 10943 var idx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 10944 return this.letterSpacingCache[idx] || 0; 10945 } 10946 10947 findSegmentToFitChar(ctx, anchor, textFullWidth, fullPathWidth, spacesNumber, inputOffset, dy, c, charI) { 10948 var offset = inputOffset; 10949 var glyphWidth = this.measureText(ctx, c); 10950 10951 if (c === ' ' && anchor === 'justify' && textFullWidth < fullPathWidth) { 10952 glyphWidth += (fullPathWidth - textFullWidth) / spacesNumber; 10953 } 10954 10955 if (charI > -1) { 10956 offset += this.getLetterSpacingAt(charI); 10957 } 10958 10959 var splineStep = this.textHeight / 20; 10960 var p0 = this.getEquidistantPointOnPath(offset, splineStep, 0); 10961 var p1 = this.getEquidistantPointOnPath(offset + glyphWidth, splineStep, 0); 10962 var segment = { 10963 p0, 10964 p1 10965 }; 10966 var rotation = p0 && p1 ? Math.atan2(p1.y - p0.y, p1.x - p0.x) : 0; 10967 10968 if (dy) { 10969 var dyX = Math.cos(Math.PI / 2 + rotation) * dy; 10970 var dyY = Math.cos(-rotation) * dy; 10971 segment.p0 = _objectSpread$2(_objectSpread$2({}, p0), {}, { 10972 x: p0.x + dyX, 10973 y: p0.y + dyY 10974 }); 10975 segment.p1 = _objectSpread$2(_objectSpread$2({}, p1), {}, { 10976 x: p1.x + dyX, 10977 y: p1.y + dyY 10978 }); 10979 } 10980 10981 offset += glyphWidth; 10982 return { 10983 offset, 10984 segment, 10985 rotation 10986 }; 10987 } 10988 10989 measureText(ctx, text) { 10990 var { 10991 measuresCache 10992 } = this; 10993 var targetText = text || this.getText(); 10994 10995 if (measuresCache.has(targetText)) { 10996 return measuresCache.get(targetText); 10997 } 10998 10999 var measure = this.measureTargetText(ctx, targetText); 11000 measuresCache.set(targetText, measure); 11001 return measure; 11002 } // This method supposes what all custom fonts already loaded. 11003 // If some font will be loaded after this method call, <textPath> will not be rendered correctly. 11004 // You need to call this method manually to update glyphs cache. 11005 11006 11007 setTextData(ctx) { 11008 if (this.glyphInfo) { 11009 return; 11010 } 11011 11012 var renderText = this.getText(); 11013 var chars = renderText.split(''); 11014 var spacesNumber = renderText.split(' ').length - 1; 11015 var dx = this.parent.getAttribute('dx').split().map(_ => _.getPixels('x')); 11016 var dy = this.parent.getAttribute('dy').getPixels('y'); 11017 var anchor = this.parent.getStyle('text-anchor').getString('start'); 11018 var thisSpacing = this.getStyle('letter-spacing'); 11019 var parentSpacing = this.parent.getStyle('letter-spacing'); 11020 var letterSpacing = 0; 11021 11022 if (!thisSpacing.hasValue() || thisSpacing.getValue() === 'inherit') { 11023 letterSpacing = parentSpacing.getPixels(); 11024 } else if (thisSpacing.hasValue()) { 11025 if (thisSpacing.getValue() !== 'initial' && thisSpacing.getValue() !== 'unset') { 11026 letterSpacing = thisSpacing.getPixels(); 11027 } 11028 } // fill letter-spacing cache 11029 11030 11031 var letterSpacingCache = []; 11032 var textLen = renderText.length; 11033 this.letterSpacingCache = letterSpacingCache; 11034 11035 for (var i = 0; i < textLen; i++) { 11036 letterSpacingCache.push(typeof dx[i] !== 'undefined' ? dx[i] : letterSpacing); 11037 } 11038 11039 var dxSum = letterSpacingCache.reduce((acc, cur, i) => i === 0 ? 0 : acc + cur || 0, 0); 11040 var textWidth = this.measureText(ctx); 11041 var textFullWidth = Math.max(textWidth + dxSum, 0); 11042 this.textWidth = textWidth; 11043 this.textHeight = this.getFontSize(); 11044 this.glyphInfo = []; 11045 var fullPathWidth = this.getPathLength(); 11046 var startOffset = this.getStyle('startOffset').getNumber(0) * fullPathWidth; 11047 var offset = 0; 11048 11049 if (anchor === 'middle' || anchor === 'center') { 11050 offset = -textFullWidth / 2; 11051 } 11052 11053 if (anchor === 'end' || anchor === 'right') { 11054 offset = -textFullWidth; 11055 } 11056 11057 offset += startOffset; 11058 chars.forEach((char, i) => { 11059 // Find such segment what distance between p0 and p1 is approx. width of glyph 11060 var { 11061 offset: nextOffset, 11062 segment, 11063 rotation 11064 } = this.findSegmentToFitChar(ctx, anchor, textFullWidth, fullPathWidth, spacesNumber, offset, dy, char, i); 11065 offset = nextOffset; 11066 11067 if (!segment.p0 || !segment.p1) { 11068 return; 11069 } // const width = this.getLineLength( 11070 // segment.p0.x, 11071 // segment.p0.y, 11072 // segment.p1.x, 11073 // segment.p1.y 11074 // ); 11075 // Note: Since glyphs are rendered one at a time, any kerning pair data built into the font will not be used. 11076 // Can foresee having a rough pair table built in that the developer can override as needed. 11077 // Or use "dx" attribute of the <text> node as a naive replacement 11078 // const kern = 0; 11079 // placeholder for future implementation 11080 // const midpoint = this.getPointOnLine( 11081 // kern + width / 2.0, 11082 // segment.p0.x, segment.p0.y, segment.p1.x, segment.p1.y 11083 // ); 11084 11085 11086 this.glyphInfo.push({ 11087 // transposeX: midpoint.x, 11088 // transposeY: midpoint.y, 11089 text: chars[i], 11090 p0: segment.p0, 11091 p1: segment.p1, 11092 rotation 11093 }); 11094 }); 11095 } 11096 11097 parsePathData(path) { 11098 this.pathLength = -1; // reset path length 11099 11100 if (!path) { 11101 return []; 11102 } 11103 11104 var pathCommands = []; 11105 var { 11106 pathParser 11107 } = path; 11108 pathParser.reset(); // convert l, H, h, V, and v to L 11109 11110 while (!pathParser.isEnd()) { 11111 var { 11112 current 11113 } = pathParser; 11114 var startX = current ? current.x : 0; 11115 var startY = current ? current.y : 0; 11116 var command = pathParser.next(); 11117 var nextCommandType = command.type; 11118 var points = []; 11119 11120 switch (command.type) { 11121 case PathParser.MOVE_TO: 11122 this.pathM(pathParser, points); 11123 break; 11124 11125 case PathParser.LINE_TO: 11126 nextCommandType = this.pathL(pathParser, points); 11127 break; 11128 11129 case PathParser.HORIZ_LINE_TO: 11130 nextCommandType = this.pathH(pathParser, points); 11131 break; 11132 11133 case PathParser.VERT_LINE_TO: 11134 nextCommandType = this.pathV(pathParser, points); 11135 break; 11136 11137 case PathParser.CURVE_TO: 11138 this.pathC(pathParser, points); 11139 break; 11140 11141 case PathParser.SMOOTH_CURVE_TO: 11142 nextCommandType = this.pathS(pathParser, points); 11143 break; 11144 11145 case PathParser.QUAD_TO: 11146 this.pathQ(pathParser, points); 11147 break; 11148 11149 case PathParser.SMOOTH_QUAD_TO: 11150 nextCommandType = this.pathT(pathParser, points); 11151 break; 11152 11153 case PathParser.ARC: 11154 points = this.pathA(pathParser); 11155 break; 11156 11157 case PathParser.CLOSE_PATH: 11158 PathElement.pathZ(pathParser); 11159 break; 11160 } 11161 11162 if (command.type !== PathParser.CLOSE_PATH) { 11163 pathCommands.push({ 11164 type: nextCommandType, 11165 points, 11166 start: { 11167 x: startX, 11168 y: startY 11169 }, 11170 pathLength: this.calcLength(startX, startY, nextCommandType, points) 11171 }); 11172 } else { 11173 pathCommands.push({ 11174 type: PathParser.CLOSE_PATH, 11175 points: [], 11176 pathLength: 0 11177 }); 11178 } 11179 } 11180 11181 return pathCommands; 11182 } 11183 11184 pathM(pathParser, points) { 11185 var { 11186 x, 11187 y 11188 } = PathElement.pathM(pathParser).point; 11189 points.push(x, y); 11190 } 11191 11192 pathL(pathParser, points) { 11193 var { 11194 x, 11195 y 11196 } = PathElement.pathL(pathParser).point; 11197 points.push(x, y); 11198 return PathParser.LINE_TO; 11199 } 11200 11201 pathH(pathParser, points) { 11202 var { 11203 x, 11204 y 11205 } = PathElement.pathH(pathParser).point; 11206 points.push(x, y); 11207 return PathParser.LINE_TO; 11208 } 11209 11210 pathV(pathParser, points) { 11211 var { 11212 x, 11213 y 11214 } = PathElement.pathV(pathParser).point; 11215 points.push(x, y); 11216 return PathParser.LINE_TO; 11217 } 11218 11219 pathC(pathParser, points) { 11220 var { 11221 point, 11222 controlPoint, 11223 currentPoint 11224 } = PathElement.pathC(pathParser); 11225 points.push(point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 11226 } 11227 11228 pathS(pathParser, points) { 11229 var { 11230 point, 11231 controlPoint, 11232 currentPoint 11233 } = PathElement.pathS(pathParser); 11234 points.push(point.x, point.y, controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 11235 return PathParser.CURVE_TO; 11236 } 11237 11238 pathQ(pathParser, points) { 11239 var { 11240 controlPoint, 11241 currentPoint 11242 } = PathElement.pathQ(pathParser); 11243 points.push(controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 11244 } 11245 11246 pathT(pathParser, points) { 11247 var { 11248 controlPoint, 11249 currentPoint 11250 } = PathElement.pathT(pathParser); 11251 points.push(controlPoint.x, controlPoint.y, currentPoint.x, currentPoint.y); 11252 return PathParser.QUAD_TO; 11253 } 11254 11255 pathA(pathParser) { 11256 var { 11257 rX, 11258 rY, 11259 sweepFlag, 11260 xAxisRotation, 11261 centp, 11262 a1, 11263 ad 11264 } = PathElement.pathA(pathParser); 11265 11266 if (sweepFlag === 0 && ad > 0) { 11267 ad -= 2 * Math.PI; 11268 } 11269 11270 if (sweepFlag === 1 && ad < 0) { 11271 ad += 2 * Math.PI; 11272 } 11273 11274 return [centp.x, centp.y, rX, rY, a1, ad, xAxisRotation, sweepFlag]; 11275 } 11276 11277 calcLength(x, y, commandType, points) { 11278 var len = 0; 11279 var p1 = null; 11280 var p2 = null; 11281 var t = 0; 11282 11283 switch (commandType) { 11284 case PathParser.LINE_TO: 11285 return this.getLineLength(x, y, points[0], points[1]); 11286 11287 case PathParser.CURVE_TO: 11288 // Approximates by breaking curve into 100 line segments 11289 len = 0.0; 11290 p1 = this.getPointOnCubicBezier(0, x, y, points[0], points[1], points[2], points[3], points[4], points[5]); 11291 11292 for (t = 0.01; t <= 1; t += 0.01) { 11293 p2 = this.getPointOnCubicBezier(t, x, y, points[0], points[1], points[2], points[3], points[4], points[5]); 11294 len += this.getLineLength(p1.x, p1.y, p2.x, p2.y); 11295 p1 = p2; 11296 } 11297 11298 return len; 11299 11300 case PathParser.QUAD_TO: 11301 // Approximates by breaking curve into 100 line segments 11302 len = 0.0; 11303 p1 = this.getPointOnQuadraticBezier(0, x, y, points[0], points[1], points[2], points[3]); 11304 11305 for (t = 0.01; t <= 1; t += 0.01) { 11306 p2 = this.getPointOnQuadraticBezier(t, x, y, points[0], points[1], points[2], points[3]); 11307 len += this.getLineLength(p1.x, p1.y, p2.x, p2.y); 11308 p1 = p2; 11309 } 11310 11311 return len; 11312 11313 case PathParser.ARC: 11314 { 11315 // Approximates by breaking curve into line segments 11316 len = 0.0; 11317 var start = points[4]; // 4 = theta 11318 11319 var dTheta = points[5]; // 5 = dTheta 11320 11321 var end = points[4] + dTheta; 11322 var inc = Math.PI / 180.0; // 1 degree resolution 11323 11324 if (Math.abs(start - end) < inc) { 11325 inc = Math.abs(start - end); 11326 } // Note: for purpose of calculating arc length, not going to worry about rotating X-axis by angle psi 11327 11328 11329 p1 = this.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], start, 0); 11330 11331 if (dTheta < 0) { 11332 // clockwise 11333 for (t = start - inc; t > end; t -= inc) { 11334 p2 = this.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0); 11335 len += this.getLineLength(p1.x, p1.y, p2.x, p2.y); 11336 p1 = p2; 11337 } 11338 } else { 11339 // counter-clockwise 11340 for (t = start + inc; t < end; t += inc) { 11341 p2 = this.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0); 11342 len += this.getLineLength(p1.x, p1.y, p2.x, p2.y); 11343 p1 = p2; 11344 } 11345 } 11346 11347 p2 = this.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], end, 0); 11348 len += this.getLineLength(p1.x, p1.y, p2.x, p2.y); 11349 return len; 11350 } 11351 } 11352 11353 return 0; 11354 } 11355 11356 getPointOnLine(dist, p1x, p1y, p2x, p2y) { 11357 var fromX = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : p1x; 11358 var fromY = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : p1y; 11359 var m = (p2y - p1y) / (p2x - p1x + PSEUDO_ZERO); 11360 var run = Math.sqrt(dist * dist / (1 + m * m)); 11361 11362 if (p2x < p1x) { 11363 run *= -1; 11364 } 11365 11366 var rise = m * run; 11367 var pt = null; 11368 11369 if (p2x === p1x) { 11370 // vertical line 11371 pt = { 11372 x: fromX, 11373 y: fromY + rise 11374 }; 11375 } else if ((fromY - p1y) / (fromX - p1x + PSEUDO_ZERO) === m) { 11376 pt = { 11377 x: fromX + run, 11378 y: fromY + rise 11379 }; 11380 } else { 11381 var ix = 0; 11382 var iy = 0; 11383 var len = this.getLineLength(p1x, p1y, p2x, p2y); 11384 11385 if (len < PSEUDO_ZERO) { 11386 return null; 11387 } 11388 11389 var u = (fromX - p1x) * (p2x - p1x) + (fromY - p1y) * (p2y - p1y); 11390 u /= len * len; 11391 ix = p1x + u * (p2x - p1x); 11392 iy = p1y + u * (p2y - p1y); 11393 var pRise = this.getLineLength(fromX, fromY, ix, iy); 11394 var pRun = Math.sqrt(dist * dist - pRise * pRise); 11395 run = Math.sqrt(pRun * pRun / (1 + m * m)); 11396 11397 if (p2x < p1x) { 11398 run *= -1; 11399 } 11400 11401 rise = m * run; 11402 pt = { 11403 x: ix + run, 11404 y: iy + rise 11405 }; 11406 } 11407 11408 return pt; 11409 } 11410 11411 getPointOnPath(distance) { 11412 var fullLen = this.getPathLength(); 11413 var cumulativePathLength = 0; 11414 var p = null; 11415 11416 if (distance < -
114165e-
vendor: 5,280 bytes, lines 11416-11608
114165 || distance - 0.00005 > fullLen) { 11417 return null; 11418 } 11419 11420 var { 11421 dataArray 11422 } = this; 11423 11424 for (var command of dataArray) { 11425 if (command && (command.pathLength < 0.00005 || cumulativePathLength + command.pathLength + 0.00005 < distance)) { 11426 cumulativePathLength += command.pathLength; 11427 continue; 11428 } 11429 11430 var delta = distance - cumulativePathLength; 11431 var currentT = 0; 11432 11433 switch (command.type) { 11434 case PathParser.LINE_TO: 11435 p = this.getPointOnLine(delta, command.start.x, command.start.y, command.points[0], command.points[1], command.start.x, command.start.y); 11436 break; 11437 11438 case PathParser.ARC: 11439 { 11440 var start = command.points[4]; // 4 = theta 11441 11442 var dTheta = command.points[5]; // 5 = dTheta 11443 11444 var end = command.points[4] + dTheta; 11445 currentT = start + delta / command.pathLength * dTheta; 11446 11447 if (dTheta < 0 && currentT < end || dTheta >= 0 && currentT > end) { 11448 break; 11449 } 11450 11451 p = this.getPointOnEllipticalArc(command.points[0], command.points[1], command.points[2], command.points[3], currentT, command.points[6]); 11452 break; 11453 } 11454 11455 case PathParser.CURVE_TO: 11456 currentT = delta / command.pathLength; 11457 11458 if (currentT > 1) { 11459 currentT = 1; 11460 } 11461 11462 p = this.getPointOnCubicBezier(currentT, command.start.x, command.start.y, command.points[0], command.points[1], command.points[2], command.points[3], command.points[4], command.points[5]); 11463 break; 11464 11465 case PathParser.QUAD_TO: 11466 currentT = delta / command.pathLength; 11467 11468 if (currentT > 1) { 11469 currentT = 1; 11470 } 11471 11472 p = this.getPointOnQuadraticBezier(currentT, command.start.x, command.start.y, command.points[0], command.points[1], command.points[2], command.points[3]); 11473 break; 11474 } 11475 11476 if (p) { 11477 return p; 11478 } 11479 11480 break; 11481 } 11482 11483 return null; 11484 } 11485 11486 getLineLength(x1, y1, x2, y2) { 11487 return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); 11488 } 11489 11490 getPathLength() { 11491 if (this.pathLength === -1) { 11492 this.pathLength = this.dataArray.reduce((length, command) => command.pathLength > 0 ? length + command.pathLength : length, 0); 11493 } 11494 11495 return this.pathLength; 11496 } 11497 11498 getPointOnCubicBezier(pct, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y) { 11499 var x = p4x * CB1(pct) + p3x * CB2(pct) + p2x * CB3(pct) + p1x * CB4(pct); 11500 var y = p4y * CB1(pct) + p3y * CB2(pct) + p2y * CB3(pct) + p1y * CB4(pct); 11501 return { 11502 x, 11503 y 11504 }; 11505 } 11506 11507 getPointOnQuadraticBezier(pct, p1x, p1y, p2x, p2y, p3x, p3y) { 11508 var x = p3x * QB1(pct) + p2x * QB2(pct) + p1x * QB3(pct); 11509 var y = p3y * QB1(pct) + p2y * QB2(pct) + p1y * QB3(pct); 11510 return { 11511 x, 11512 y 11513 }; 11514 } 11515 11516 getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) { 11517 var cosPsi = Math.cos(psi); 11518 var sinPsi = Math.sin(psi); 11519 var pt = { 11520 x: rx * Math.cos(theta), 11521 y: ry * Math.sin(theta) 11522 }; 11523 return { 11524 x: cx + (pt.x * cosPsi - pt.y * sinPsi), 11525 y: cy + (pt.x * sinPsi + pt.y * cosPsi) 11526 }; 11527 } // TODO need some optimisations. possibly build cache only for curved segments? 11528 11529 11530 buildEquidistantCache(inputStep, inputPrecision) { 11531 var fullLen = this.getPathLength(); 11532 var precision = inputPrecision || 0.25; // accuracy vs performance 11533 11534 var step = inputStep || fullLen / 100; 11535 11536 if (!this.equidistantCache || this.equidistantCache.step !== step || this.equidistantCache.precision !== precision) { 11537 // Prepare cache 11538 this.equidistantCache = { 11539 step, 11540 precision, 11541 points: [] 11542 }; // Calculate points 11543 11544 var s = 0; 11545 11546 for (var l = 0; l <= fullLen; l += precision) { 11547 var p0 = this.getPointOnPath(l); 11548 var p1 = this.getPointOnPath(l + precision); 11549 11550 if (!p0 || !p1) { 11551 continue; 11552 } 11553 11554 s += this.getLineLength(p0.x, p0.y, p1.x, p1.y); 11555 11556 if (s >= step) { 11557 this.equidistantCache.points.push({ 11558 x: p0.x, 11559 y: p0.y, 11560 distance: l 11561 }); 11562 s -= step; 11563 } 11564 } 11565 } 11566 } 11567 11568 getEquidistantPointOnPath(targetDistance, step, precision) { 11569 this.buildEquidistantCache(step, precision); 11570 11571 if (targetDistance < 0 || targetDistance - this.getPathLength() > 0.00005) { 11572 return null; 11573 } 11574 11575 var idx = Math.round(targetDistance / this.getPathLength() * (this.equidistantCache.points.length - 1)); 11576 return this.equidistantCache.points[idx] || null; 11577 } 11578 11579} 11580 11581var dataUriRegex = /^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i; 11582class ImageElement extends RenderedElement { 11583 constructor(document, node, captureTextNodes) { 11584 super(document, node, captureTextNodes); 11585 this.type = 'image'; 11586 this.loaded = false; 11587 var href = this.getHrefAttribute().getString(); 11588 11589 if (!href) { 11590 return; 11591 } 11592 11593 var isSvg = href.endsWith('.svg') || /^\s*data:image\/svg\+xml/i.test(href); 11594 document.images.push(this); 11595 11596 if (!isSvg) { 11597 void this.loadImage(href); 11598 } else { 11599 void this.loadSvg(href); 11600 } 11601 11602 this.isSvg = isSvg; 11603 } 11604 11605 loadImage(href) { 11606 var _this = this; 11607 11608 return
vendor: 2,901 bytes, lines 11608-11731
11608_asyncToGenerator(function* () { 11609 try { 11610 var image = yield _this.document.createImage(href); 11611 _this.image = image; 11612 } catch (err) { 11613 console.error("Error while loading image \"".concat(href, "\":"), err); 11614 } 11615 11616 _this.loaded = true; 11617 })(); 11618 } 11619 11620 loadSvg(href) { 11621 var _this2 = this; 11622 11623 return _asyncToGenerator(function* () { 11624 var match = dataUriRegex.exec(href); 11625 11626 if (match) { 11627 var data = match[5]; 11628 11629 if (match[4] === 'base64') { 11630 _this2.image = atob(data); 11631 } else { 11632 _this2.image = decodeURIComponent(data); 11633 } 11634 } else { 11635 try { 11636 var response = yield _this2.document.fetch(href); 11637 var svg = yield response.text(); 11638 _this2.image = svg; 11639 } catch (err) { 11640 console.error("Error while loading image \"".concat(href, "\":"), err); 11641 } 11642 } 11643 11644 _this2.loaded = true; 11645 })(); 11646 } 11647 11648 renderChildren(ctx) { 11649 var { 11650 document, 11651 image, 11652 loaded 11653 } = this; 11654 var x = this.getAttribute('x').getPixels('x'); 11655 var y = this.getAttribute('y').getPixels('y'); 11656 var width = this.getStyle('width').getPixels('x'); 11657 var height = this.getStyle('height').getPixels('y'); 11658 11659 if (!loaded || !image || !width || !height) { 11660 return; 11661 } 11662 11663 ctx.save(); 11664 ctx.translate(x, y); 11665 11666 if (this.isSvg) { 11667 var subDocument = document.canvg.forkString(ctx, this.image, { 11668 ignoreMouse: true, 11669 ignoreAnimation: true, 11670 ignoreDimensions: true, 11671 ignoreClear: true, 11672 offsetX: 0, 11673 offsetY: 0, 11674 scaleWidth: width, 11675 scaleHeight: height 11676 }); 11677 subDocument.document.documentElement.parent = this; 11678 void subDocument.render(); 11679 } else { 11680 var _image = this.image; 11681 document.setViewBox({ 11682 ctx, 11683 aspectRatio: this.getAttribute('preserveAspectRatio').getString(), 11684 width, 11685 desiredWidth: _image.width, 11686 height, 11687 desiredHeight: _image.height 11688 }); 11689 11690 if (this.loaded) { 11691 if (typeof _image.complete === 'undefined' || _image.complete) { 11692 ctx.drawImage(_image, 0, 0); 11693 } 11694 } 11695 } 11696 11697 ctx.restore(); 11698 } 11699 11700 getBoundingBox() { 11701 var x = this.getAttribute('x').getPixels('x'); 11702 var y = this.getAttribute('y').getPixels('y'); 11703 var width = this.getStyle('width').getPixels('x'); 11704 var height = this.getStyle('height').getPixels('y'); 11705 return new BoundingBox(x, y, x + width, y + height); 11706 } 11707 11708} 11709 11710class SymbolElement extends RenderedElement { 11711 constructor() { 11712 super(...arguments); 11713 this.type = 'symbol'; 11714 } 11715 11716 render(_) {// NO RENDER 11717 } 11718 11719} 11720 11721class SVGFontLoader { 11722 constructor(document) { 11723 this.document = document; 11724 this.loaded = false; 11725 document.fonts.push(this); 11726 } 11727 11728 load(fontFamily, url) { 11729 var _this = this; 11730 11731 return _asyncToGenerator
vendor: 14,623 bytes, lines 11731-12254
11731(function* () { 11732 try { 11733 var { 11734 document 11735 } = _this; 11736 var svgDocument = yield document.canvg.parser.load(url); 11737 var fonts = svgDocument.getElementsByTagName('font'); 11738 Array.from(fonts).forEach(fontNode => { 11739 var font = document.createElement(fontNode); 11740 document.definitions[fontFamily] = font; 11741 }); 11742 } catch (err) { 11743 console.error("Error while loading font \"".concat(url, "\":"), err); 11744 } 11745 11746 _this.loaded = true; 11747 })(); 11748 } 11749 11750} 11751 11752class StyleElement extends Element { 11753 constructor(document, node, captureTextNodes) { 11754 super(document, node, captureTextNodes); 11755 this.type = 'style'; 11756 var css = compressSpaces(Array.from(node.childNodes) // NEED TEST 11757 .map(_ => _.textContent).join('').replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, '') // remove comments 11758 .replace(/@import.*;/g, '') // remove imports 11759 ); 11760 var cssDefs = css.split('}'); 11761 cssDefs.forEach(_ => { 11762 var def = _.trim(); 11763 11764 if (!def) { 11765 return; 11766 } 11767 11768 var cssParts = def.split('{'); 11769 var cssClasses = cssParts[0].split(','); 11770 var cssProps = cssParts[1].split(';'); 11771 cssClasses.forEach(_ => { 11772 var cssClass = _.trim(); 11773 11774 if (!cssClass) { 11775 return; 11776 } 11777 11778 var props = document.styles[cssClass] || {}; 11779 cssProps.forEach(cssProp => { 11780 var prop = cssProp.indexOf(':'); 11781 var name = cssProp.substr(0, prop).trim(); 11782 var value = cssProp.substr(prop + 1, cssProp.length - prop).trim(); 11783 11784 if (name && value) { 11785 props[name] = new Property(document, name, value); 11786 } 11787 }); 11788 document.styles[cssClass] = props; 11789 document.stylesSpecificity[cssClass] = getSelectorSpecificity(cssClass); 11790 11791 if (cssClass === '@font-face') { 11792 // && !nodeEnv 11793 var fontFamily = props['font-family'].getString().replace(/"|'/g, ''); 11794 var srcs = props.src.getString().split(','); 11795 srcs.forEach(src => { 11796 if (src.indexOf('format("svg")') > 0) { 11797 var url = parseExternalUrl(src); 11798 11799 if (url) { 11800 void new SVGFontLoader(document).load(fontFamily, url); 11801 } 11802 } 11803 }); 11804 } 11805 }); 11806 }); 11807 } 11808 11809} 11810StyleElement.parseExternalUrl = parseExternalUrl; 11811 11812class UseElement extends RenderedElement { 11813 constructor() { 11814 super(...arguments); 11815 this.type = 'use'; 11816 } 11817 11818 setContext(ctx) { 11819 super.setContext(ctx); 11820 var xAttr = this.getAttribute('x'); 11821 var yAttr = this.getAttribute('y'); 11822 11823 if (xAttr.hasValue()) { 11824 ctx.translate(xAttr.getPixels('x'), 0); 11825 } 11826 11827 if (yAttr.hasValue()) { 11828 ctx.translate(0, yAttr.getPixels('y')); 11829 } 11830 } 11831 11832 path(ctx) { 11833 var { 11834 element 11835 } = this; 11836 11837 if (element) { 11838 element.path(ctx); 11839 } 11840 } 11841 11842 renderChildren(ctx) { 11843 var { 11844 document, 11845 element 11846 } = this; 11847 11848 if (element) { 11849 var tempSvg = element; 11850 11851 if (element.type === 'symbol') { 11852 // render me using a temporary svg element in symbol cases (http://www.w3.org/TR/SVG/struct.html#UseElement) 11853 tempSvg = new SVGElement(document, null); 11854 tempSvg.attributes.viewBox = new Property(document, 'viewBox', element.getAttribute('viewBox').getString()); 11855 tempSvg.attributes.preserveAspectRatio = new Property(document, 'preserveAspectRatio', element.getAttribute('preserveAspectRatio').getString()); 11856 tempSvg.attributes.overflow = new Property(document, 'overflow', element.getAttribute('overflow').getString()); 11857 tempSvg.children = element.children; // element is still the parent of the children 11858 11859 element.styles.opacity = new Property(document, 'opacity', this.calculateOpacity()); 11860 } 11861 11862 if (tempSvg.type === 'svg') { 11863 var widthStyle = this.getStyle('width', false, true); 11864 var heightStyle = this.getStyle('height', false, true); // if symbol or svg, inherit width/height from me 11865 11866 if (widthStyle.hasValue()) { 11867 tempSvg.attributes.width = new Property(document, 'width', widthStyle.getString()); 11868 } 11869 11870 if (heightStyle.hasValue()) { 11871 tempSvg.attributes.height = new Property(document, 'height', heightStyle.getString()); 11872 } 11873 } 11874 11875 var oldParent = tempSvg.parent; 11876 tempSvg.parent = this; 11877 tempSvg.render(ctx); 11878 tempSvg.parent = oldParent; 11879 } 11880 } 11881 11882 getBoundingBox(ctx) { 11883 var { 11884 element 11885 } = this; 11886 11887 if (element) { 11888 return element.getBoundingBox(ctx); 11889 } 11890 11891 return null; 11892 } 11893 11894 elementTransform() { 11895 var { 11896 document, 11897 element 11898 } = this; 11899 return Transform.fromElement(document, element); 11900 } 11901 11902 get element() { 11903 if (!this.cachedElement) { 11904 this.cachedElement = this.getHrefAttribute().getDefinition(); 11905 } 11906 11907 return this.cachedElement; 11908 } 11909 11910} 11911 11912function imGet(img, x, y, width, _height, rgba) { 11913 return img[y * width * 4 + x * 4 + rgba]; 11914} 11915 11916function imSet(img, x, y, width, _height, rgba, val) { 11917 img[y * width * 4 + x * 4 + rgba] = val; 11918} 11919 11920function m(matrix, i, v) { 11921 var mi = matrix[i]; 11922 return mi * v; 11923} 11924 11925function c(a, m1, m2, m3) { 11926 return m1 + Math.cos(a) * m2 + Math.sin(a) * m3; 11927} 11928 11929class FeColorMatrixElement extends Element { 11930 constructor(document, node, captureTextNodes) { 11931 super(document, node, captureTextNodes); 11932 this.type = 'feColorMatrix'; 11933 var matrix = toNumbers(this.getAttribute('values').getString()); 11934 11935 switch (this.getAttribute('type').getString('matrix')) { 11936 // http://www.w3.org/TR/SVG/filters.html#feColorMatrixElement 11937 case 'saturate': 11938 { 11939 var s = matrix[0]; 11940 /* eslint-disable array-element-newline */ 11941 11942 matrix = [0.213 + 0.787 * s, 0.715 - 0.715 * s, 0.072 - 0.072 * s, 0, 0, 0.213 - 0.213 * s, 0.715 + 0.285 * s, 0.072 - 0.072 * s, 0, 0, 0.213 - 0.213 * s, 0.715 - 0.715 * s, 0.072 + 0.928 * s, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]; 11943 /* eslint-enable array-element-newline */ 11944 11945 break; 11946 } 11947 11948 case 'hueRotate': 11949 { 11950 var a = matrix[0] * Math.PI / 180.0; 11951 /* eslint-disable array-element-newline */ 11952 11953 matrix = [c(a, 0.213, 0.787, -0.213), c(a, 0.715, -0.715, -0.715), c(a, 0.072, -0.072, 0.928), 0, 0, c(a, 0.213, -0.213, 0.143), c(a, 0.715, 0.285, 0.140), c(a, 0.072, -0.072, -0.283), 0, 0, c(a, 0.213, -0.213, -0.787), c(a, 0.715, -0.715, 0.715), c(a, 0.072, 0.928, 0.072), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]; 11954 /* eslint-enable array-element-newline */ 11955 11956 break; 11957 } 11958 11959 case 'luminanceToAlpha': 11960 /* eslint-disable array-element-newline */ 11961 matrix = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2125, 0.7154, 0.0721, 0, 0, 0, 0, 0, 0, 1]; 11962 /* eslint-enable array-element-newline */ 11963 11964 break; 11965 } 11966 11967 this.matrix = matrix; 11968 this.includeOpacity = this.getAttribute('includeOpacity').hasValue(); 11969 } 11970 11971 apply(ctx, _x, _y, width, height) { 11972 // assuming x==0 && y==0 for now 11973 var { 11974 includeOpacity, 11975 matrix 11976 } = this; 11977 var srcData = ctx.getImageData(0, 0, width, height); 11978 11979 for (var y = 0; y < height; y++) { 11980 for (var x = 0; x < width; x++) { 11981 var r = imGet(srcData.data, x, y, width, height, 0); 11982 var g = imGet(srcData.data, x, y, width, height, 1); 11983 var b = imGet(srcData.data, x, y, width, height, 2); 11984 var a = imGet(srcData.data, x, y, width, height, 3); 11985 var nr = m(matrix, 0, r) + m(matrix, 1, g) + m(matrix, 2, b) + m(matrix, 3, a) + m(matrix, 4, 1); 11986 var ng = m(matrix, 5, r) + m(matrix, 6, g) + m(matrix, 7, b) + m(matrix, 8, a) + m(matrix, 9, 1); 11987 var nb = m(matrix, 10, r) + m(matrix, 11, g) + m(matrix, 12, b) + m(matrix, 13, a) + m(matrix, 14, 1); 11988 var na = m(matrix, 15, r) + m(matrix, 16, g) + m(matrix, 17, b) + m(matrix, 18, a) + m(matrix, 19, 1); 11989 11990 if (includeOpacity) { 11991 nr = 0; 11992 ng = 0; 11993 nb = 0; 11994 na *= a / 255; 11995 } 11996 11997 imSet(srcData.data, x, y, width, height, 0, nr); 11998 imSet(srcData.data, x, y, width, height, 1, ng); 11999 imSet(srcData.data, x, y, width, height, 2, nb); 12000 imSet(srcData.data, x, y, width, height, 3, na); 12001 } 12002 } 12003 12004 ctx.clearRect(0, 0, width, height); 12005 ctx.putImageData(srcData, 0, 0); 12006 } 12007 12008} 12009 12010class MaskElement extends Element { 12011 constructor() { 12012 super(...arguments); 12013 this.type = 'mask'; 12014 } 12015 12016 apply(ctx, element) { 12017 var { 12018 document 12019 } = this; // render as temp svg 12020 12021 var x = this.getAttribute('x').getPixels('x'); 12022 var y = this.getAttribute('y').getPixels('y'); 12023 var width = this.getStyle('width').getPixels('x'); 12024 var height = this.getStyle('height').getPixels('y'); 12025 12026 if (!width && !height) { 12027 var boundingBox = new BoundingBox(); 12028 this.children.forEach(child => { 12029 boundingBox.addBoundingBox(child.getBoundingBox(ctx)); 12030 }); 12031 x = Math.floor(boundingBox.x1); 12032 y = Math.floor(boundingBox.y1); 12033 width = Math.floor(boundingBox.width); 12034 height = Math.floor(boundingBox.height); 12035 } 12036 12037 var ignoredStyles = this.removeStyles(element, MaskElement.ignoreStyles); 12038 var maskCanvas = document.createCanvas(x + width, y + height); 12039 var maskCtx = maskCanvas.getContext('2d'); 12040 document.screen.setDefaults(maskCtx); 12041 this.renderChildren(maskCtx); // convert mask to alpha with a fake node 12042 // TODO: refactor out apply from feColorMatrix 12043 12044 new FeColorMatrixElement(document, { 12045 nodeType: 1, 12046 childNodes: [], 12047 attributes: [{ 12048 nodeName: 'type', 12049 value: 'luminanceToAlpha' 12050 }, { 12051 nodeName: 'includeOpacity', 12052 value: 'true' 12053 }] 12054 }).apply(maskCtx, 0, 0, x + width, y + height); 12055 var tmpCanvas = document.createCanvas(x + width, y + height); 12056 var tmpCtx = tmpCanvas.getContext('2d'); 12057 document.screen.setDefaults(tmpCtx); 12058 element.render(tmpCtx); 12059 tmpCtx.globalCompositeOperation = 'destination-in'; 12060 tmpCtx.fillStyle = maskCtx.createPattern(maskCanvas, 'no-repeat'); 12061 tmpCtx.fillRect(0, 0, x + width, y + height); 12062 ctx.fillStyle = tmpCtx.createPattern(tmpCanvas, 'no-repeat'); 12063 ctx.fillRect(0, 0, x + width, y + height); // reassign mask 12064 12065 this.restoreStyles(element, ignoredStyles); 12066 } 12067 12068 render(_) {// NO RENDER 12069 } 12070 12071} 12072MaskElement.ignoreStyles = ['mask', 'transform', 'clip-path']; 12073 12074var noop = () => {// NOOP 12075}; 12076 12077class ClipPathElement extends Element { 12078 constructor() { 12079 super(...arguments); 12080 this.type = 'clipPath'; 12081 } 12082 12083 apply(ctx) { 12084 var { 12085 document 12086 } = this; 12087 var contextProto = Reflect.getPrototypeOf(ctx); 12088 var { 12089 beginPath, 12090 closePath 12091 } = ctx; 12092 12093 if (contextProto) { 12094 contextProto.beginPath = noop; 12095 contextProto.closePath = noop; 12096 } 12097 12098 Reflect.apply(beginPath, ctx, []); 12099 this.children.forEach(child => { 12100 if (typeof child.path === 'undefined') { 12101 return; 12102 } 12103 12104 var transform = typeof child.elementTransform !== 'undefined' ? child.elementTransform() : null; // handle <use /> 12105 12106 if (!transform) { 12107 transform = Transform.fromElement(document, child); 12108 } 12109 12110 if (transform) { 12111 transform.apply(ctx); 12112 } 12113 12114 child.path(ctx); 12115 12116 if (contextProto) { 12117 contextProto.closePath = closePath; 12118 } 12119 12120 if (transform) { 12121 transform.unapply(ctx); 12122 } 12123 }); 12124 Reflect.apply(closePath, ctx, []); 12125 ctx.clip(); 12126 12127 if (contextProto) { 12128 contextProto.beginPath = beginPath; 12129 contextProto.closePath = closePath; 12130 } 12131 } 12132 12133 render(_) {// NO RENDER 12134 } 12135 12136} 12137 12138class FilterElement extends Element { 12139 constructor() { 12140 super(...arguments); 12141 this.type = 'filter'; 12142 } 12143 12144 apply(ctx, element) { 12145 // render as temp svg 12146 var { 12147 document, 12148 children 12149 } = this; 12150 var boundingBox = element.getBoundingBox(ctx); 12151 12152 if (!boundingBox) { 12153 return; 12154 } 12155 12156 var px = 0; 12157 var py = 0; 12158 children.forEach(child => { 12159 var efd = child.extraFilterDistance || 0; 12160 px = Math.max(px, efd); 12161 py = Math.max(py, efd); 12162 }); 12163 var width = Math.floor(boundingBox.width); 12164 var height = Math.floor(boundingBox.height); 12165 var tmpCanvasWidth = width + 2 * px; 12166 var tmpCanvasHeight = height + 2 * py; 12167 12168 if (tmpCanvasWidth < 1 || tmpCanvasHeight < 1) { 12169 return; 12170 } 12171 12172 var x = Math.floor(boundingBox.x); 12173 var y = Math.floor(boundingBox.y); 12174 var ignoredStyles = this.removeStyles(element, FilterElement.ignoreStyles); 12175 var tmpCanvas = document.createCanvas(tmpCanvasWidth, tmpCanvasHeight); 12176 var tmpCtx = tmpCanvas.getContext('2d'); 12177 document.screen.setDefaults(tmpCtx); 12178 tmpCtx.translate(-x + px, -y + py); 12179 element.render(tmpCtx); // apply filters 12180 12181 children.forEach(child => { 12182 if (typeof child.apply === 'function') { 12183 child.apply(tmpCtx, 0, 0, tmpCanvasWidth, tmpCanvasHeight); 12184 } 12185 }); // render on me 12186 12187 ctx.drawImage(tmpCanvas, 0, 0, tmpCanvasWidth, tmpCanvasHeight, x - px, y - py, tmpCanvasWidth, tmpCanvasHeight); 12188 this.restoreStyles(element, ignoredStyles); 12189 } 12190 12191 render(_) {// NO RENDER 12192 } 12193 12194} 12195FilterElement.ignoreStyles = ['filter', 'transform', 'clip-path']; 12196 12197class FeDropShadowElement extends Element { 12198 constructor(document, node, captureTextNodes) { 12199 super(document, node, captureTextNodes); 12200 this.type = 'feDropShadow'; 12201 this.addStylesFromStyleDefinition(); 12202 } 12203 12204 apply(_, _x, _y, _width, _height) {// TODO: implement 12205 } 12206 12207} 12208 12209class FeMorphologyElement extends Element { 12210 constructor() { 12211 super(...arguments); 12212 this.type = 'feMorphology'; 12213 } 12214 12215 apply(_, _x, _y, _width, _height) {// TODO: implement 12216 } 12217 12218} 12219 12220class FeCompositeElement extends Element { 12221 constructor() { 12222 super(...arguments); 12223 this.type = 'feComposite'; 12224 } 12225 12226 apply(_, _x, _y, _width, _height) {// TODO: implement 12227 } 12228 12229} 12230 12231class FeGaussianBlurElement extends Element { 12232 constructor(document, node, captureTextNodes) { 12233 super(document, node, captureTextNodes); 12234 this.type = 'feGaussianBlur'; 12235 this.blurRadius = Math.floor(this.getAttribute('stdDeviation').getNumber()); 12236 this.extraFilterDistance = this.blurRadius; 12237 } 12238 12239 apply(ctx, x, y, width, height) { 12240 var { 12241 document, 12242 blurRadius 12243 } = this; 12244 var body = document.window ? document.window.document.body : null; 12245 var canvas = ctx.canvas; // StackBlur requires canvas be on document 12246 12247 canvas.id = document.getUniqueId(); 12248 12249 if (body) { 12250 canvas.style.display = 'none'; 12251 body.appendChild(canvas); 12252 } 12253 12254
12254processCanvasRGBA(canvas, x, y, width, height, blurRadius); 12255 12256 if (body) { 12257 body.removeChild(canvas); 12258 } 12259 } 12260 12261} 12262
vendor: 5,641 bytes, lines 12263-12464
12263class TitleElement extends Element { 12264 constructor() { 12265 super(...arguments); 12266 this.type = 'title'; 12267 } 12268 12269} 12270 12271class DescElement extends Element { 12272 constructor() { 12273 super(...arguments); 12274 this.type = 'desc'; 12275 } 12276 12277} 12278 12279var elements = { 12280 'svg': SVGElement, 12281 'rect': RectElement, 12282 'circle': CircleElement, 12283 'ellipse': EllipseElement, 12284 'line': LineElement, 12285 'polyline': PolylineElement, 12286 'polygon': PolygonElement, 12287 'path': PathElement, 12288 'pattern': PatternElement, 12289 'marker': MarkerElement, 12290 'defs': DefsElement, 12291 'linearGradient': LinearGradientElement, 12292 'radialGradient': RadialGradientElement, 12293 'stop': StopElement, 12294 'animate': AnimateElement, 12295 'animateColor': AnimateColorElement, 12296 'animateTransform': AnimateTransformElement, 12297 'font': FontElement, 12298 'font-face': FontFaceElement, 12299 'missing-glyph': MissingGlyphElement, 12300 'glyph': GlyphElement, 12301 'text': TextElement, 12302 'tspan': TSpanElement, 12303 'tref': TRefElement, 12304 'a': AElement, 12305 'textPath': TextPathElement, 12306 'image': ImageElement, 12307 'g': GElement, 12308 'symbol': SymbolElement, 12309 'style': StyleElement, 12310 'use': UseElement, 12311 'mask': MaskElement, 12312 'clipPath': ClipPathElement, 12313 'filter': FilterElement, 12314 'feDropShadow': FeDropShadowElement, 12315 'feMorphology': FeMorphologyElement, 12316 'feComposite': FeCompositeElement, 12317 'feColorMatrix': FeColorMatrixElement, 12318 'feGaussianBlur': FeGaussianBlurElement, 12319 'title': TitleElement, 12320 'desc': DescElement 12321}; 12322 12323function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } 12324 12325function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 12326 12327function createCanvas(width, height) { 12328 var canvas = document.createElement('canvas'); 12329 canvas.width = width; 12330 canvas.height = height; 12331 return canvas; 12332} 12333 12334function createImage(_x) { 12335 return _createImage.apply(this, arguments); 12336} 12337 12338function _createImage() { 12339 _createImage = _asyncToGenerator(function* (src) { 12340 var anonymousCrossOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 12341 var image = document.createElement('img'); 12342 12343 if (anonymousCrossOrigin) { 12344 image.crossOrigin = 'Anonymous'; 12345 } 12346 12347 return new Promise((resolve, reject) => { 12348 image.onload = () => { 12349 resolve(image); 12350 }; 12351 12352 image.onerror = (_event, _source, _lineno, _colno, error) => { 12353 reject(error); 12354 }; 12355 12356 image.src = src; 12357 }); 12358 }); 12359 return _createImage.apply(this, arguments); 12360} 12361 12362class Document { 12363 constructor(canvg) { 12364 var { 12365 rootEmSize = 12, 12366 emSize = 12, 12367 createCanvas = Document.createCanvas, 12368 createImage = Document.createImage, 12369 anonymousCrossOrigin 12370 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 12371 this.canvg = canvg; 12372 this.definitions = Object.create(null); 12373 this.styles = Object.create(null); 12374 this.stylesSpecificity = Object.create(null); 12375 this.images = []; 12376 this.fonts = []; 12377 this.emSizeStack = []; 12378 this.uniqueId = 0; 12379 this.screen = canvg.screen; 12380 this.rootEmSize = rootEmSize; 12381 this.emSize = emSize; 12382 this.createCanvas = createCanvas; 12383 this.createImage = this.bindCreateImage(createImage, anonymousCrossOrigin); 12384 this.screen.wait(this.isImagesLoaded.bind(this)); 12385 this.screen.wait(this.isFontsLoaded.bind(this)); 12386 } 12387 12388 bindCreateImage(createImage, anonymousCrossOrigin) { 12389 if (typeof anonymousCrossOrigin === 'boolean') { 12390 return (source, forceAnonymousCrossOrigin) => createImage(source, typeof forceAnonymousCrossOrigin === 'boolean' ? forceAnonymousCrossOrigin : anonymousCrossOrigin); 12391 } 12392 12393 return createImage; 12394 } 12395 12396 get window() { 12397 return this.screen.window; 12398 } 12399 12400 get fetch() { 12401 return this.screen.fetch; 12402 } 12403 12404 get ctx() { 12405 return this.screen.ctx; 12406 } 12407 12408 get emSize() { 12409 var { 12410 emSizeStack 12411 } = this; 12412 return emSizeStack[emSizeStack.length - 1]; 12413 } 12414 12415 set emSize(value) { 12416 var { 12417 emSizeStack 12418 } = this; 12419 emSizeStack.push(value); 12420 } 12421 12422 popEmSize() { 12423 var { 12424 emSizeStack 12425 } = this; 12426 emSizeStack.pop(); 12427 } 12428 12429 getUniqueId() { 12430 return "canvg".concat(++this.uniqueId); 12431 } 12432 12433 isImagesLoaded() { 12434 return this.images.every(_ => _.loaded); 12435 } 12436 12437 isFontsLoaded() { 12438 return this.fonts.every(_ => _.loaded); 12439 } 12440 12441 createDocumentElement(document) { 12442 var documentElement = this.createElement(document.documentElement); 12443 documentElement.root = true; 12444 documentElement.addStylesFromStyleDefinition(); 12445 this.documentElement = documentElement; 12446 return documentElement; 12447 } 12448 12449 createElement(node) { 12450 var elementType = node.nodeName.replace(/^[^:]+:/, ''); 12451 var ElementType = Document.elementTypes[elementType]; 12452 12453 if (typeof ElementType !== 'undefined') { 12454 return new ElementType(this, node); 12455 } 12456 12457 return new UnknownElement(this, node); 12458 } 12459 12460 createTextNode(node) { 12461 return new TextNode(this, node); 12462 } 12463 12464 setViewBox(config) {
vendor: 5,223 bytes, lines 12465-12635
12465 this.screen.setViewBox(_objectSpread$1({ 12466 document: this 12467 }, config)); 12468 } 12469 12470} 12471Document.createCanvas = createCanvas; 12472Document.createImage = createImage; 12473Document.elementTypes = elements; 12474 12475function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } 12476 12477function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 12478/** 12479 * SVG renderer on canvas. 12480 */ 12481 12482class Canvg { 12483 /** 12484 * Main constructor. 12485 * @param ctx - Rendering context. 12486 * @param svg - SVG Document. 12487 * @param options - Rendering options. 12488 */ 12489 constructor(ctx, svg) { 12490 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 12491 this.parser = new Parser(options); 12492 this.screen = new Screen(ctx, options); 12493 this.options = options; 12494 var document = new Document(this, options); 12495 var documentElement = document.createDocumentElement(svg); 12496 this.document = document; 12497 this.documentElement = documentElement; 12498 } 12499 /** 12500 * Create Canvg instance from SVG source string or URL. 12501 * @param ctx - Rendering context. 12502 * @param svg - SVG source string or URL. 12503 * @param options - Rendering options. 12504 * @returns Canvg instance. 12505 */ 12506 12507 12508 static from(ctx, svg) { 12509 var _arguments = arguments; 12510 return _asyncToGenerator(function* () { 12511 var options = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : {}; 12512 var parser = new Parser(options); 12513 var svgDocument = yield parser.parse(svg); 12514 return new Canvg(ctx, svgDocument, options); 12515 })(); 12516 } 12517 /** 12518 * Create Canvg instance from SVG source string. 12519 * @param ctx - Rendering context. 12520 * @param svg - SVG source string. 12521 * @param options - Rendering options. 12522 * @returns Canvg instance. 12523 */ 12524 12525 12526 static fromString(ctx, svg) { 12527 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 12528 var parser = new Parser(options); 12529 var svgDocument = parser.parseFromString(svg); 12530 return new Canvg(ctx, svgDocument, options); 12531 } 12532 /** 12533 * Create new Canvg instance with inherited options. 12534 * @param ctx - Rendering context. 12535 * @param svg - SVG source string or URL. 12536 * @param options - Rendering options. 12537 * @returns Canvg instance. 12538 */ 12539 12540 12541 fork(ctx, svg) { 12542 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 12543 return Canvg.from(ctx, svg, _objectSpread(_objectSpread({}, this.options), options)); 12544 } 12545 /** 12546 * Create new Canvg instance with inherited options. 12547 * @param ctx - Rendering context. 12548 * @param svg - SVG source string. 12549 * @param options - Rendering options. 12550 * @returns Canvg instance. 12551 */ 12552 12553 12554 forkString(ctx, svg) { 12555 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 12556 return Canvg.fromString(ctx, svg, _objectSpread(_objectSpread({}, this.options), options)); 12557 } 12558 /** 12559 * Document is ready promise. 12560 * @returns Ready promise. 12561 */ 12562 12563 12564 ready() { 12565 return this.screen.ready(); 12566 } 12567 /** 12568 * Document is ready value. 12569 * @returns Is ready or not. 12570 */ 12571 12572 12573 isReady() { 12574 return this.screen.isReady(); 12575 } 12576 /** 12577 * Render only first frame, ignoring animations and mouse. 12578 * @param options - Rendering options. 12579 */ 12580 12581 12582 render() { 12583 var _arguments2 = arguments, 12584 _this = this; 12585 12586 return _asyncToGenerator(function* () { 12587 var options = _arguments2.length > 0 && _arguments2[0] !== undefined ? _arguments2[0] : {}; 12588 12589 _this.start(_objectSpread({ 12590 enableRedraw: true, 12591 ignoreAnimation: true, 12592 ignoreMouse: true 12593 }, options)); 12594 12595 yield _this.ready(); 12596 12597 _this.stop(); 12598 })(); 12599 } 12600 /** 12601 * Start rendering. 12602 * @param options - Render options. 12603 */ 12604 12605 12606 start() { 12607 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 12608 var { 12609 documentElement, 12610 screen, 12611 options: baseOptions 12612 } = this; 12613 screen.start(documentElement, _objectSpread(_objectSpread({ 12614 enableRedraw: true 12615 }, baseOptions), options)); 12616 } 12617 /** 12618 * Stop rendering. 12619 */ 12620 12621 12622 stop() { 12623 this.screen.stop(); 12624 } 12625 /** 12626 * Resize SVG to fit in given size. 12627 * @param width 12628 * @param height 12629 * @param preserveAspectRatio 12630 */ 12631 12632 12633 resize(width) { 12634 var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : width; 12635 var preserveAspectRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12636 this.documentElement.resize(width, height, preserveAspectRatio); 12637 } 12638 12639} 12640 12641export { AElement, AnimateColorElement, AnimateElement, AnimateTransformElement, BoundingBox, CB1, CB2, CB3, CB4, Canvg, CircleElement, ClipPathElement, DefsElement, DescElement, Document, Element, EllipseElement, FeColorMatrixElement, FeCompositeElement, FeDropShadowElement, FeGaussianBlurElement, FeMorphologyElement, FilterElement, Font, FontElement, FontFaceElement, GElement, GlyphElement, GradientElement, ImageElement, LineElement, LinearGradientElement, MarkerElement, MaskElement, Matrix, MissingGlyphElement, Mouse, PSEUDO_ZERO, Parser, PathElement, PathParser, PatternElement, Point, PolygonElement, PolylineElement, Property, QB1, QB2, QB3, RadialGradientElement, RectElement, RenderedElement, Rotate, SVGElement, SVGFontLoader, Scale, Screen, Skew, SkewX, SkewY, StopElement, StyleElement, SymbolElement, TRefElement, TSpanElement, TextElement, TextPathElement, TitleElement, Transform, Translate, UnknownElement, UseElement, ViewPort, compressSpaces, Canvg as default, get
12641SelectorSpecificity, normalizeAttributeName, normalizeColor, parseExternalUrl, index as presets, toNumbers, trimLeft, trimRight, vectorMagnitude, vectorsAngle, vectorsRatio };
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.