) => {\n event.preventDefault();\n\n const otp = getOTPValue();\n let nextActiveInput = activeInput;\n\n // Get pastedData in an array of max size (num of inputs - current position)\n const pastedData = event.clipboardData\n .getData('text/plain')\n .slice(0, numInputs - activeInput)\n .split('');\n\n // Prevent pasting if the clipboard data contains non-numeric values for number inputs\n if (isInputNum && pastedData.some((value) => isNaN(Number(value)))) {\n return;\n }\n\n // Paste data from focused input onwards\n for (let pos = 0; pos < numInputs; ++pos) {\n if (pos >= activeInput && pastedData.length > 0) {\n otp[pos] = pastedData.shift() ?? '';\n nextActiveInput++;\n }\n }\n\n focusInput(nextActiveInput);\n handleOTPChange(otp);\n };\n\n return (\n \n {Array.from({ length: numInputs }, (_, index) => index).map((index) => (\n \n {renderInput(\n {\n value: getOTPValue()[index] ?? '',\n placeholder: getPlaceholderValue()?.[index] ?? undefined,\n ref: (element) => (inputRefs.current[index] = element),\n onChange: handleChange,\n onFocus: (event) => handleFocus(event)(index),\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onPaste: handlePaste,\n autoComplete: 'off',\n 'aria-label': `Please enter OTP character ${index + 1}`,\n style: Object.assign(\n !skipDefaultStyles ? ({ width: '1em', textAlign: 'center' } as const) : {},\n isStyleObject(inputStyle) ? inputStyle : {}\n ),\n className: typeof inputStyle === 'string' ? inputStyle : undefined,\n type: inputType,\n inputMode: isInputNum ? 'numeric' : 'text',\n onInput: handleInputChange,\n },\n index\n )}\n {index < numInputs - 1 && (typeof renderSeparator === 'function' ? renderSeparator(index) : renderSeparator)}\n \n ))}\n
\n );\n};\n\nexport type { OTPInputProps, InputProps, AllowedInputTypes };\nexport default OTPInput;\n","'use strict';\n\nvar undefined;\n\nvar $Error = require('es-errors');\nvar $EvalError = require('es-errors/eval');\nvar $RangeError = require('es-errors/range');\nvar $ReferenceError = require('es-errors/ref');\nvar $SyntaxError = require('es-errors/syntax');\nvar $TypeError = require('es-errors/type');\nvar $URIError = require('es-errors/uri');\n\nvar $Function = Function;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\nvar hasProto = require('has-proto')();\n\nvar getProto = Object.getPrototypeOf || (\n\thasProto\n\t\t? function (x) { return x.__proto__; } // eslint-disable-line no-proto\n\t\t: null\n);\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t__proto__: null,\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': $Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': $EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': $RangeError,\n\t'%ReferenceError%': $ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': $URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nif (getProto) {\n\ttry {\n\t\tnull.error; // eslint-disable-line no-unused-expressions\n\t} catch (e) {\n\t\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\t\tvar errorProto = getProto(getProto(e));\n\t\tINTRINSICS['%Error.prototype%'] = errorProto;\n\t}\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen && getProto) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t__proto__: null,\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('hasown');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar defineDataProperty = require('define-data-property');\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar supportsDescriptors = require('has-property-descriptors')();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object) {\n\t\tif (predicate === true) {\n\t\t\tif (object[name] === value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (!isFunction(predicate) || !predicate()) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (supportsDescriptors) {\n\t\tdefineDataProperty(object, name, value, true);\n\t} else {\n\t\tdefineDataProperty(object, name, value);\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","/*\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n*\n* By Eli Grey, http://eligrey.com\n*\n* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n* source : http://purl.eligrey.com/github/FileSaver.js\n*/\n\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nvar _global = typeof window === 'object' && window.window === window\n ? window : typeof self === 'object' && self.self === self\n ? self : typeof global === 'object' && global.global === global\n ? global\n : this\n\nfunction bom (blob, opts) {\n if (typeof opts === 'undefined') opts = { autoBom: false }\n else if (typeof opts !== 'object') {\n console.warn('Deprecated: Expected third argument to be a object')\n opts = { autoBom: !opts }\n }\n\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })\n }\n return blob\n}\n\nfunction download (url, name, opts) {\n var xhr = new XMLHttpRequest()\n xhr.open('GET', url)\n xhr.responseType = 'blob'\n xhr.onload = function () {\n saveAs(xhr.response, name, opts)\n }\n xhr.onerror = function () {\n console.error('could not download file')\n }\n xhr.send()\n}\n\nfunction corsEnabled (url) {\n var xhr = new XMLHttpRequest()\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false)\n try {\n xhr.send()\n } catch (e) {}\n return xhr.status >= 200 && xhr.status <= 299\n}\n\n// `a.click()` doesn't work for all browsers (#465)\nfunction click (node) {\n try {\n node.dispatchEvent(new MouseEvent('click'))\n } catch (e) {\n var evt = document.createEvent('MouseEvents')\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,\n 20, false, false, false, false, 0, null)\n node.dispatchEvent(evt)\n }\n}\n\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nvar isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)\n\nvar saveAs = _global.saveAs || (\n // probably in some web worker\n (typeof window !== 'object' || window !== _global)\n ? function saveAs () { /* noop */ }\n\n // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)\n ? function saveAs (blob, name, opts) {\n var URL = _global.URL || _global.webkitURL\n var a = document.createElement('a')\n name = name || blob.name || 'download'\n\n a.download = name\n a.rel = 'noopener' // tabnabbing\n\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob\n if (a.origin !== location.origin) {\n corsEnabled(a.href)\n ? download(blob, name, opts)\n : click(a, a.target = '_blank')\n } else {\n click(a)\n }\n } else {\n // Support blobs\n a.href = URL.createObjectURL(blob)\n setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s\n setTimeout(function () { click(a) }, 0)\n }\n }\n\n // Use msSaveOrOpenBlob as a second approach\n : 'msSaveOrOpenBlob' in navigator\n ? function saveAs (blob, name, opts) {\n name = name || blob.name || 'download'\n\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts)\n } else {\n var a = document.createElement('a')\n a.href = blob\n a.target = '_blank'\n setTimeout(function () { click(a) })\n }\n } else {\n navigator.msSaveOrOpenBlob(bom(blob, opts), name)\n }\n }\n\n // Fallback to using FileReader and a popup\n : function saveAs (blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank')\n if (popup) {\n popup.document.title =\n popup.document.body.innerText = 'downloading...'\n }\n\n if (typeof blob === 'string') return download(blob, name, opts)\n\n var force = blob.type === 'application/octet-stream'\n var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari\n var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent)\n\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n var reader = new FileReader()\n reader.onloadend = function () {\n var url = reader.result\n url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')\n if (popup) popup.location.href = url\n else location = url\n popup = null // reverse-tabnabbing #460\n }\n reader.readAsDataURL(blob)\n } else {\n var URL = _global.URL || _global.webkitURL\n var url = URL.createObjectURL(blob)\n if (popup) popup.location = url\n else location.href = url\n popup = null // reverse-tabnabbing #460\n setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s\n }\n }\n)\n\n_global.saveAs = saveAs.saveAs = saveAs\n\nif (typeof module !== 'undefined') {\n module.exports = saveAs;\n}\n","import _inheritsLoose from \"@babel/runtime/helpers/inheritsLoose\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport createContext from '@hypnosphi/create-react-context';\nexport var ManagerReferenceNodeContext = createContext();\nexport var ManagerReferenceNodeSetterContext = createContext();\n\nvar Manager =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inheritsLoose(Manager, _React$Component);\n\n function Manager() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"referenceNode\", void 0);\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"setReferenceNode\", function (newReferenceNode) {\n if (newReferenceNode && _this.referenceNode !== newReferenceNode) {\n _this.referenceNode = newReferenceNode;\n\n _this.forceUpdate();\n }\n });\n\n return _this;\n }\n\n var _proto = Manager.prototype;\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.referenceNode = null;\n };\n\n _proto.render = function render() {\n return React.createElement(ManagerReferenceNodeContext.Provider, {\n value: this.referenceNode\n }, React.createElement(ManagerReferenceNodeSetterContext.Provider, {\n value: this.setReferenceNode\n }, this.props.children));\n };\n\n return Manager;\n}(React.Component);\n\nexport { Manager as default };","/*!\n* sweetalert2 v11.12.4\n* Released under the MIT License.\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Sweetalert2 = factory());\n})(this, (function () { 'use strict';\n\n function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n }\n function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n }\n function _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return _arrayLikeToArray(r);\n }\n function _assertClassBrand(e, t, n) {\n if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;\n throw new TypeError(\"Private element is not present on this object\");\n }\n function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n }\n function _callSuper(t, o, e) {\n return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));\n }\n function _checkPrivateRedeclaration(e, t) {\n if (t.has(e)) throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function _classPrivateFieldGet2(s, a) {\n return s.get(_assertClassBrand(s, a));\n }\n function _classPrivateFieldInitSpec(e, t, a) {\n _checkPrivateRedeclaration(e, t), t.set(e, a);\n }\n function _classPrivateFieldSet2(s, a, r) {\n return s.set(_assertClassBrand(s, a), r), r;\n }\n function _construct(t, e, r) {\n if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);\n var o = [null];\n o.push.apply(o, e);\n var p = new (t.bind.apply(t, o))();\n return p;\n }\n function _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n }\n function _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n }\n function _createForOfIteratorHelper(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (!t) {\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {\n t && (r = t);\n var n = 0,\n F = function () {};\n return {\n s: F,\n n: function () {\n return n >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[n++]\n };\n },\n e: function (r) {\n throw r;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var o,\n a = !0,\n u = !1;\n return {\n s: function () {\n t = t.call(r);\n },\n n: function () {\n var r = t.next();\n return a = r.done, r;\n },\n e: function (r) {\n u = !0, o = r;\n },\n f: function () {\n try {\n a || null == t.return || t.return();\n } finally {\n if (u) throw o;\n }\n }\n };\n }\n function _get() {\n return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {\n var p = _superPropBase(e, t);\n if (p) {\n var n = Object.getOwnPropertyDescriptor(p, t);\n return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;\n }\n }, _get.apply(null, arguments);\n }\n function _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n }\n function _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && _setPrototypeOf(t, e);\n }\n function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function () {\n return !!t;\n })();\n }\n function _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n }\n function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n }\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == typeof e || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return _assertThisInitialized(t);\n }\n function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n }\n function _slicedToArray(r, e) {\n return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();\n }\n function _superPropBase(t, o) {\n for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););\n return t;\n }\n function _superPropGet(t, e, r, o) {\n var p = _get(_getPrototypeOf(t.prototype ), e, r);\n return function (t) {\n return p.apply(r, t);\n } ;\n }\n function _toConsumableArray(r) {\n return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();\n }\n function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r);\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (String )(t);\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n }\n function _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n }\n\n var RESTORE_FOCUS_TIMEOUT = 100;\n\n /** @type {GlobalState} */\n var globalState = {};\n var focusPreviousActiveElement = function focusPreviousActiveElement() {\n if (globalState.previousActiveElement instanceof HTMLElement) {\n globalState.previousActiveElement.focus();\n globalState.previousActiveElement = null;\n } else if (document.body) {\n document.body.focus();\n }\n };\n\n /**\n * Restore previous active (focused) element\n *\n * @param {boolean} returnFocus\n * @returns {Promise}\n */\n var restoreActiveElement = function restoreActiveElement(returnFocus) {\n return new Promise(function (resolve) {\n if (!returnFocus) {\n return resolve();\n }\n var x = window.scrollX;\n var y = window.scrollY;\n globalState.restoreFocusTimeout = setTimeout(function () {\n focusPreviousActiveElement();\n resolve();\n }, RESTORE_FOCUS_TIMEOUT); // issues/900\n\n window.scrollTo(x, y);\n });\n };\n\n var swalPrefix = 'swal2-';\n\n /**\n * @typedef {Record} SwalClasses\n */\n\n /**\n * @typedef {'success' | 'warning' | 'info' | 'question' | 'error'} SwalIcon\n * @typedef {Record} SwalIcons\n */\n\n /** @type {SwalClass[]} */\n var classNames = ['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error'];\n var swalClasses = classNames.reduce(function (acc, className) {\n acc[className] = swalPrefix + className;\n return acc;\n }, /** @type {SwalClasses} */{});\n\n /** @type {SwalIcon[]} */\n var icons = ['success', 'warning', 'info', 'question', 'error'];\n var iconTypes = icons.reduce(function (acc, icon) {\n acc[icon] = swalPrefix + icon;\n return acc;\n }, /** @type {SwalIcons} */{});\n\n var consolePrefix = 'SweetAlert2:';\n\n /**\n * Capitalize the first letter of a string\n *\n * @param {string} str\n * @returns {string}\n */\n var capitalizeFirstLetter = function capitalizeFirstLetter(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n /**\n * Standardize console warnings\n *\n * @param {string | string[]} message\n */\n var warn = function warn(message) {\n console.warn(\"\".concat(consolePrefix, \" \").concat(_typeof(message) === 'object' ? message.join(' ') : message));\n };\n\n /**\n * Standardize console errors\n *\n * @param {string} message\n */\n var error = function error(message) {\n console.error(\"\".concat(consolePrefix, \" \").concat(message));\n };\n\n /**\n * Private global state for `warnOnce`\n *\n * @type {string[]}\n * @private\n */\n var previousWarnOnceMessages = [];\n\n /**\n * Show a console warning, but only if it hasn't already been shown\n *\n * @param {string} message\n */\n var warnOnce = function warnOnce(message) {\n if (!previousWarnOnceMessages.includes(message)) {\n previousWarnOnceMessages.push(message);\n warn(message);\n }\n };\n\n /**\n * Show a one-time console warning about deprecated params/methods\n *\n * @param {string} deprecatedParam\n * @param {string?} useInstead\n */\n var warnAboutDeprecation = function warnAboutDeprecation(deprecatedParam) {\n var useInstead = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n warnOnce(\"\\\"\".concat(deprecatedParam, \"\\\" is deprecated and will be removed in the next major release.\").concat(useInstead ? \" Use \\\"\".concat(useInstead, \"\\\" instead.\") : ''));\n };\n\n /**\n * If `arg` is a function, call it (with no arguments or context) and return the result.\n * Otherwise, just pass the value through\n *\n * @param {Function | any} arg\n * @returns {any}\n */\n var callIfFunction = function callIfFunction(arg) {\n return typeof arg === 'function' ? arg() : arg;\n };\n\n /**\n * @param {any} arg\n * @returns {boolean}\n */\n var hasToPromiseFn = function hasToPromiseFn(arg) {\n return arg && typeof arg.toPromise === 'function';\n };\n\n /**\n * @param {any} arg\n * @returns {Promise}\n */\n var asPromise = function asPromise(arg) {\n return hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);\n };\n\n /**\n * @param {any} arg\n * @returns {boolean}\n */\n var isPromise = function isPromise(arg) {\n return arg && Promise.resolve(arg) === arg;\n };\n\n /**\n * Gets the popup container which contains the backdrop and the popup itself.\n *\n * @returns {HTMLElement | null}\n */\n var getContainer = function getContainer() {\n return document.body.querySelector(\".\".concat(swalClasses.container));\n };\n\n /**\n * @param {string} selectorString\n * @returns {HTMLElement | null}\n */\n var elementBySelector = function elementBySelector(selectorString) {\n var container = getContainer();\n return container ? container.querySelector(selectorString) : null;\n };\n\n /**\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n var elementByClass = function elementByClass(className) {\n return elementBySelector(\".\".concat(className));\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getPopup = function getPopup() {\n return elementByClass(swalClasses.popup);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getIcon = function getIcon() {\n return elementByClass(swalClasses.icon);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getIconContent = function getIconContent() {\n return elementByClass(swalClasses['icon-content']);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getTitle = function getTitle() {\n return elementByClass(swalClasses.title);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getHtmlContainer = function getHtmlContainer() {\n return elementByClass(swalClasses['html-container']);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getImage = function getImage() {\n return elementByClass(swalClasses.image);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getProgressSteps = function getProgressSteps() {\n return elementByClass(swalClasses['progress-steps']);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getValidationMessage = function getValidationMessage() {\n return elementByClass(swalClasses['validation-message']);\n };\n\n /**\n * @returns {HTMLButtonElement | null}\n */\n var getConfirmButton = function getConfirmButton() {\n return /** @type {HTMLButtonElement} */elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.confirm));\n };\n\n /**\n * @returns {HTMLButtonElement | null}\n */\n var getCancelButton = function getCancelButton() {\n return /** @type {HTMLButtonElement} */elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.cancel));\n };\n\n /**\n * @returns {HTMLButtonElement | null}\n */\n var getDenyButton = function getDenyButton() {\n return /** @type {HTMLButtonElement} */elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.deny));\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getInputLabel = function getInputLabel() {\n return elementByClass(swalClasses['input-label']);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getLoader = function getLoader() {\n return elementBySelector(\".\".concat(swalClasses.loader));\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getActions = function getActions() {\n return elementByClass(swalClasses.actions);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getFooter = function getFooter() {\n return elementByClass(swalClasses.footer);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getTimerProgressBar = function getTimerProgressBar() {\n return elementByClass(swalClasses['timer-progress-bar']);\n };\n\n /**\n * @returns {HTMLElement | null}\n */\n var getCloseButton = function getCloseButton() {\n return elementByClass(swalClasses.close);\n };\n\n // https://github.com/jkup/focusable/blob/master/index.js\n var focusable = \"\\n a[href],\\n area[href],\\n input:not([disabled]),\\n select:not([disabled]),\\n textarea:not([disabled]),\\n button:not([disabled]),\\n iframe,\\n object,\\n embed,\\n [tabindex=\\\"0\\\"],\\n [contenteditable],\\n audio[controls],\\n video[controls],\\n summary\\n\";\n /**\n * @returns {HTMLElement[]}\n */\n var getFocusableElements = function getFocusableElements() {\n var popup = getPopup();\n if (!popup) {\n return [];\n }\n /** @type {NodeListOf} */\n var focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])');\n var focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex)\n // sort according to tabindex\n .sort(function (a, b) {\n var tabindexA = parseInt(a.getAttribute('tabindex') || '0');\n var tabindexB = parseInt(b.getAttribute('tabindex') || '0');\n if (tabindexA > tabindexB) {\n return 1;\n } else if (tabindexA < tabindexB) {\n return -1;\n }\n return 0;\n });\n\n /** @type {NodeListOf} */\n var otherFocusableElements = popup.querySelectorAll(focusable);\n var otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(function (el) {\n return el.getAttribute('tabindex') !== '-1';\n });\n return _toConsumableArray(new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))).filter(function (el) {\n return isVisible$1(el);\n });\n };\n\n /**\n * @returns {boolean}\n */\n var isModal = function isModal() {\n return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);\n };\n\n /**\n * @returns {boolean}\n */\n var isToast = function isToast() {\n var popup = getPopup();\n if (!popup) {\n return false;\n }\n return hasClass(popup, swalClasses.toast);\n };\n\n /**\n * @returns {boolean}\n */\n var isLoading = function isLoading() {\n var popup = getPopup();\n if (!popup) {\n return false;\n }\n return popup.hasAttribute('data-loading');\n };\n\n /**\n * Securely set innerHTML of an element\n * https://github.com/sweetalert2/sweetalert2/issues/1926\n *\n * @param {HTMLElement} elem\n * @param {string} html\n */\n var setInnerHtml = function setInnerHtml(elem, html) {\n elem.textContent = '';\n if (html) {\n var parser = new DOMParser();\n var parsed = parser.parseFromString(html, \"text/html\");\n var head = parsed.querySelector('head');\n if (head) {\n Array.from(head.childNodes).forEach(function (child) {\n elem.appendChild(child);\n });\n }\n var body = parsed.querySelector('body');\n if (body) {\n Array.from(body.childNodes).forEach(function (child) {\n if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {\n elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507\n } else {\n elem.appendChild(child);\n }\n });\n }\n }\n };\n\n /**\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {boolean}\n */\n var hasClass = function hasClass(elem, className) {\n if (!className) {\n return false;\n }\n var classList = className.split(/\\s+/);\n for (var i = 0; i < classList.length; i++) {\n if (!elem.classList.contains(classList[i])) {\n return false;\n }\n }\n return true;\n };\n\n /**\n * @param {HTMLElement} elem\n * @param {SweetAlertOptions} params\n */\n var removeCustomClasses = function removeCustomClasses(elem, params) {\n Array.from(elem.classList).forEach(function (className) {\n if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) {\n elem.classList.remove(className);\n }\n });\n };\n\n /**\n * @param {HTMLElement} elem\n * @param {SweetAlertOptions} params\n * @param {string} className\n */\n var applyCustomClass = function applyCustomClass(elem, params, className) {\n removeCustomClasses(elem, params);\n if (!params.customClass) {\n return;\n }\n var customClass = params.customClass[( /** @type {keyof SweetAlertCustomClass} */className)];\n if (!customClass) {\n return;\n }\n if (typeof customClass !== 'string' && !customClass.forEach) {\n warn(\"Invalid type of customClass.\".concat(className, \"! Expected string or iterable object, got \\\"\").concat(_typeof(customClass), \"\\\"\"));\n return;\n }\n addClass(elem, customClass);\n };\n\n /**\n * @param {HTMLElement} popup\n * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass\n * @returns {HTMLInputElement | null}\n */\n var getInput$1 = function getInput(popup, inputClass) {\n if (!inputClass) {\n return null;\n }\n switch (inputClass) {\n case 'select':\n case 'textarea':\n case 'file':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses[inputClass]));\n case 'checkbox':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.checkbox, \" input\"));\n case 'radio':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:checked\")) || popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:first-child\"));\n case 'range':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.range, \" input\"));\n default:\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.input));\n }\n };\n\n /**\n * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input\n */\n var focusInput = function focusInput(input) {\n input.focus();\n\n // place cursor at end of text in text input\n if (input.type !== 'file') {\n // http://stackoverflow.com/a/2345915\n var val = input.value;\n input.value = '';\n input.value = val;\n }\n };\n\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[] | undefined} classList\n * @param {boolean} condition\n */\n var toggleClass = function toggleClass(target, classList, condition) {\n if (!target || !classList) {\n return;\n }\n if (typeof classList === 'string') {\n classList = classList.split(/\\s+/).filter(Boolean);\n }\n classList.forEach(function (className) {\n if (Array.isArray(target)) {\n target.forEach(function (elem) {\n if (condition) {\n elem.classList.add(className);\n } else {\n elem.classList.remove(className);\n }\n });\n } else {\n if (condition) {\n target.classList.add(className);\n } else {\n target.classList.remove(className);\n }\n }\n });\n };\n\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[] | undefined} classList\n */\n var addClass = function addClass(target, classList) {\n toggleClass(target, classList, true);\n };\n\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[] | undefined} classList\n */\n var removeClass = function removeClass(target, classList) {\n toggleClass(target, classList, false);\n };\n\n /**\n * Get direct child of an element by class name\n *\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {HTMLElement | undefined}\n */\n var getDirectChildByClass = function getDirectChildByClass(elem, className) {\n var children = Array.from(elem.children);\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child instanceof HTMLElement && hasClass(child, className)) {\n return child;\n }\n }\n };\n\n /**\n * @param {HTMLElement} elem\n * @param {string} property\n * @param {*} value\n */\n var applyNumericalStyle = function applyNumericalStyle(elem, property, value) {\n if (value === \"\".concat(parseInt(value))) {\n value = parseInt(value);\n }\n if (value || parseInt(value) === 0) {\n elem.style.setProperty(property, typeof value === 'number' ? \"\".concat(value, \"px\") : value);\n } else {\n elem.style.removeProperty(property);\n }\n };\n\n /**\n * @param {HTMLElement | null} elem\n * @param {string} display\n */\n var show = function show(elem) {\n var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';\n if (!elem) {\n return;\n }\n elem.style.display = display;\n };\n\n /**\n * @param {HTMLElement | null} elem\n */\n var hide = function hide(elem) {\n if (!elem) {\n return;\n }\n elem.style.display = 'none';\n };\n\n /**\n * @param {HTMLElement | null} elem\n * @param {string} display\n */\n var showWhenInnerHtmlPresent = function showWhenInnerHtmlPresent(elem) {\n var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block';\n if (!elem) {\n return;\n }\n new MutationObserver(function () {\n toggle(elem, elem.innerHTML, display);\n }).observe(elem, {\n childList: true,\n subtree: true\n });\n };\n\n /**\n * @param {HTMLElement} parent\n * @param {string} selector\n * @param {string} property\n * @param {string} value\n */\n var setStyle = function setStyle(parent, selector, property, value) {\n /** @type {HTMLElement | null} */\n var el = parent.querySelector(selector);\n if (el) {\n el.style.setProperty(property, value);\n }\n };\n\n /**\n * @param {HTMLElement} elem\n * @param {any} condition\n * @param {string} display\n */\n var toggle = function toggle(elem, condition) {\n var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';\n if (condition) {\n show(elem, display);\n } else {\n hide(elem);\n }\n };\n\n /**\n * borrowed from jquery $(elem).is(':visible') implementation\n *\n * @param {HTMLElement | null} elem\n * @returns {boolean}\n */\n var isVisible$1 = function isVisible(elem) {\n return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));\n };\n\n /**\n * @returns {boolean}\n */\n var allButtonsAreHidden = function allButtonsAreHidden() {\n return !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton());\n };\n\n /**\n * @param {HTMLElement} elem\n * @returns {boolean}\n */\n var isScrollable = function isScrollable(elem) {\n return !!(elem.scrollHeight > elem.clientHeight);\n };\n\n /**\n * borrowed from https://stackoverflow.com/a/46352119\n *\n * @param {HTMLElement} elem\n * @returns {boolean}\n */\n var hasCssAnimation = function hasCssAnimation(elem) {\n var style = window.getComputedStyle(elem);\n var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');\n var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');\n return animDuration > 0 || transDuration > 0;\n };\n\n /**\n * @param {number} timer\n * @param {boolean} reset\n */\n var animateTimerProgressBar = function animateTimerProgressBar(timer) {\n var reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var timerProgressBar = getTimerProgressBar();\n if (!timerProgressBar) {\n return;\n }\n if (isVisible$1(timerProgressBar)) {\n if (reset) {\n timerProgressBar.style.transition = 'none';\n timerProgressBar.style.width = '100%';\n }\n setTimeout(function () {\n timerProgressBar.style.transition = \"width \".concat(timer / 1000, \"s linear\");\n timerProgressBar.style.width = '0%';\n }, 10);\n }\n };\n var stopTimerProgressBar = function stopTimerProgressBar() {\n var timerProgressBar = getTimerProgressBar();\n if (!timerProgressBar) {\n return;\n }\n var timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = '100%';\n var timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n var timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;\n timerProgressBar.style.width = \"\".concat(timerProgressBarPercent, \"%\");\n };\n\n /**\n * Detect Node env\n *\n * @returns {boolean}\n */\n var isNodeEnv = function isNodeEnv() {\n return typeof window === 'undefined' || typeof document === 'undefined';\n };\n\n var sweetHTML = \"\\n \\n\").replace(/(^|\\n)\\s*/g, '');\n\n /**\n * @returns {boolean}\n */\n var resetOldContainer = function resetOldContainer() {\n var oldContainer = getContainer();\n if (!oldContainer) {\n return false;\n }\n oldContainer.remove();\n removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);\n return true;\n };\n var resetValidationMessage$1 = function resetValidationMessage() {\n globalState.currentInstance.resetValidationMessage();\n };\n var addInputChangeListeners = function addInputChangeListeners() {\n var popup = getPopup();\n var input = getDirectChildByClass(popup, swalClasses.input);\n var file = getDirectChildByClass(popup, swalClasses.file);\n /** @type {HTMLInputElement} */\n var range = popup.querySelector(\".\".concat(swalClasses.range, \" input\"));\n /** @type {HTMLOutputElement} */\n var rangeOutput = popup.querySelector(\".\".concat(swalClasses.range, \" output\"));\n var select = getDirectChildByClass(popup, swalClasses.select);\n /** @type {HTMLInputElement} */\n var checkbox = popup.querySelector(\".\".concat(swalClasses.checkbox, \" input\"));\n var textarea = getDirectChildByClass(popup, swalClasses.textarea);\n input.oninput = resetValidationMessage$1;\n file.onchange = resetValidationMessage$1;\n select.onchange = resetValidationMessage$1;\n checkbox.onchange = resetValidationMessage$1;\n textarea.oninput = resetValidationMessage$1;\n range.oninput = function () {\n resetValidationMessage$1();\n rangeOutput.value = range.value;\n };\n range.onchange = function () {\n resetValidationMessage$1();\n rangeOutput.value = range.value;\n };\n };\n\n /**\n * @param {string | HTMLElement} target\n * @returns {HTMLElement}\n */\n var getTarget = function getTarget(target) {\n return typeof target === 'string' ? document.querySelector(target) : target;\n };\n\n /**\n * @param {SweetAlertOptions} params\n */\n var setupAccessibility = function setupAccessibility(params) {\n var popup = getPopup();\n popup.setAttribute('role', params.toast ? 'alert' : 'dialog');\n popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');\n if (!params.toast) {\n popup.setAttribute('aria-modal', 'true');\n }\n };\n\n /**\n * @param {HTMLElement} targetElement\n */\n var setupRTL = function setupRTL(targetElement) {\n if (window.getComputedStyle(targetElement).direction === 'rtl') {\n addClass(getContainer(), swalClasses.rtl);\n }\n };\n\n /**\n * Add modal + backdrop + no-war message for Russians to DOM\n *\n * @param {SweetAlertOptions} params\n */\n var init = function init(params) {\n // Clean up the old popup container if it exists\n var oldContainerExisted = resetOldContainer();\n if (isNodeEnv()) {\n error('SweetAlert2 requires document to initialize');\n return;\n }\n var container = document.createElement('div');\n container.className = swalClasses.container;\n if (oldContainerExisted) {\n addClass(container, swalClasses['no-transition']);\n }\n setInnerHtml(container, sweetHTML);\n var targetElement = getTarget(params.target);\n targetElement.appendChild(container);\n setupAccessibility(params);\n setupRTL(targetElement);\n addInputChangeListeners();\n };\n\n /**\n * @param {HTMLElement | object | string} param\n * @param {HTMLElement} target\n */\n var parseHtmlToContainer = function parseHtmlToContainer(param, target) {\n // DOM element\n if (param instanceof HTMLElement) {\n target.appendChild(param);\n }\n\n // Object\n else if (_typeof(param) === 'object') {\n handleObject(param, target);\n }\n\n // Plain string\n else if (param) {\n setInnerHtml(target, param);\n }\n };\n\n /**\n * @param {any} param\n * @param {HTMLElement} target\n */\n var handleObject = function handleObject(param, target) {\n // JQuery element(s)\n if (param.jquery) {\n handleJqueryElem(target, param);\n }\n\n // For other objects use their string representation\n else {\n setInnerHtml(target, param.toString());\n }\n };\n\n /**\n * @param {HTMLElement} target\n * @param {any} elem\n */\n var handleJqueryElem = function handleJqueryElem(target, elem) {\n target.textContent = '';\n if (0 in elem) {\n for (var i = 0; i in elem; i++) {\n target.appendChild(elem[i].cloneNode(true));\n }\n } else {\n target.appendChild(elem.cloneNode(true));\n }\n };\n\n /**\n * @returns {'webkitAnimationEnd' | 'animationend' | false}\n */\n var animationEndEvent = function () {\n // Prevent run in Node env\n if (isNodeEnv()) {\n return false;\n }\n var testEl = document.createElement('div');\n\n // Chrome, Safari and Opera\n if (typeof testEl.style.webkitAnimation !== 'undefined') {\n return 'webkitAnimationEnd';\n }\n\n // Standard syntax\n if (typeof testEl.style.animation !== 'undefined') {\n return 'animationend';\n }\n return false;\n }();\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderActions = function renderActions(instance, params) {\n var actions = getActions();\n var loader = getLoader();\n if (!actions || !loader) {\n return;\n }\n\n // Actions (buttons) wrapper\n if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {\n hide(actions);\n } else {\n show(actions);\n }\n\n // Custom class\n applyCustomClass(actions, params, 'actions');\n\n // Render all the buttons\n renderButtons(actions, loader, params);\n\n // Loader\n setInnerHtml(loader, params.loaderHtml || '');\n applyCustomClass(loader, params, 'loader');\n };\n\n /**\n * @param {HTMLElement} actions\n * @param {HTMLElement} loader\n * @param {SweetAlertOptions} params\n */\n function renderButtons(actions, loader, params) {\n var confirmButton = getConfirmButton();\n var denyButton = getDenyButton();\n var cancelButton = getCancelButton();\n if (!confirmButton || !denyButton || !cancelButton) {\n return;\n }\n\n // Render buttons\n renderButton(confirmButton, 'confirm', params);\n renderButton(denyButton, 'deny', params);\n renderButton(cancelButton, 'cancel', params);\n handleButtonsStyling(confirmButton, denyButton, cancelButton, params);\n if (params.reverseButtons) {\n if (params.toast) {\n actions.insertBefore(cancelButton, confirmButton);\n actions.insertBefore(denyButton, confirmButton);\n } else {\n actions.insertBefore(cancelButton, loader);\n actions.insertBefore(denyButton, loader);\n actions.insertBefore(confirmButton, loader);\n }\n }\n }\n\n /**\n * @param {HTMLElement} confirmButton\n * @param {HTMLElement} denyButton\n * @param {HTMLElement} cancelButton\n * @param {SweetAlertOptions} params\n */\n function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {\n if (!params.buttonsStyling) {\n removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n return;\n }\n addClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n\n // Buttons background colors\n if (params.confirmButtonColor) {\n confirmButton.style.backgroundColor = params.confirmButtonColor;\n addClass(confirmButton, swalClasses['default-outline']);\n }\n if (params.denyButtonColor) {\n denyButton.style.backgroundColor = params.denyButtonColor;\n addClass(denyButton, swalClasses['default-outline']);\n }\n if (params.cancelButtonColor) {\n cancelButton.style.backgroundColor = params.cancelButtonColor;\n addClass(cancelButton, swalClasses['default-outline']);\n }\n }\n\n /**\n * @param {HTMLElement} button\n * @param {'confirm' | 'deny' | 'cancel'} buttonType\n * @param {SweetAlertOptions} params\n */\n function renderButton(button, buttonType, params) {\n var buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType);\n toggle(button, params[\"show\".concat(buttonName, \"Button\")], 'inline-block');\n setInnerHtml(button, params[\"\".concat(buttonType, \"ButtonText\")] || ''); // Set caption text\n button.setAttribute('aria-label', params[\"\".concat(buttonType, \"ButtonAriaLabel\")] || ''); // ARIA label\n\n // Add buttons custom classes\n button.className = swalClasses[buttonType];\n applyCustomClass(button, params, \"\".concat(buttonType, \"Button\"));\n }\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderCloseButton = function renderCloseButton(instance, params) {\n var closeButton = getCloseButton();\n if (!closeButton) {\n return;\n }\n setInnerHtml(closeButton, params.closeButtonHtml || '');\n\n // Custom class\n applyCustomClass(closeButton, params, 'closeButton');\n toggle(closeButton, params.showCloseButton);\n closeButton.setAttribute('aria-label', params.closeButtonAriaLabel || '');\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderContainer = function renderContainer(instance, params) {\n var container = getContainer();\n if (!container) {\n return;\n }\n handleBackdropParam(container, params.backdrop);\n handlePositionParam(container, params.position);\n handleGrowParam(container, params.grow);\n\n // Custom class\n applyCustomClass(container, params, 'container');\n };\n\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['backdrop']} backdrop\n */\n function handleBackdropParam(container, backdrop) {\n if (typeof backdrop === 'string') {\n container.style.background = backdrop;\n } else if (!backdrop) {\n addClass([document.documentElement, document.body], swalClasses['no-backdrop']);\n }\n }\n\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['position']} position\n */\n function handlePositionParam(container, position) {\n if (!position) {\n return;\n }\n if (position in swalClasses) {\n addClass(container, swalClasses[position]);\n } else {\n warn('The \"position\" parameter is not valid, defaulting to \"center\"');\n addClass(container, swalClasses.center);\n }\n }\n\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['grow']} grow\n */\n function handleGrowParam(container, grow) {\n if (!grow) {\n return;\n }\n addClass(container, swalClasses[\"grow-\".concat(grow)]);\n }\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n\n var privateProps = {\n innerParams: new WeakMap(),\n domCache: new WeakMap()\n };\n\n /** @type {InputClass[]} */\n var inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderInput = function renderInput(instance, params) {\n var popup = getPopup();\n if (!popup) {\n return;\n }\n var innerParams = privateProps.innerParams.get(instance);\n var rerender = !innerParams || params.input !== innerParams.input;\n inputClasses.forEach(function (inputClass) {\n var inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]);\n if (!inputContainer) {\n return;\n }\n\n // set attributes\n setAttributes(inputClass, params.inputAttributes);\n\n // set class\n inputContainer.className = swalClasses[inputClass];\n if (rerender) {\n hide(inputContainer);\n }\n });\n if (params.input) {\n if (rerender) {\n showInput(params);\n }\n // set custom class\n setCustomClass(params);\n }\n };\n\n /**\n * @param {SweetAlertOptions} params\n */\n var showInput = function showInput(params) {\n if (!params.input) {\n return;\n }\n if (!renderInputType[params.input]) {\n error(\"Unexpected type of input! Expected \".concat(Object.keys(renderInputType).join(' | '), \", got \\\"\").concat(params.input, \"\\\"\"));\n return;\n }\n var inputContainer = getInputContainer(params.input);\n if (!inputContainer) {\n return;\n }\n var input = renderInputType[params.input](inputContainer, params);\n show(inputContainer);\n\n // input autofocus\n if (params.inputAutoFocus) {\n setTimeout(function () {\n focusInput(input);\n });\n }\n };\n\n /**\n * @param {HTMLInputElement} input\n */\n var removeAttributes = function removeAttributes(input) {\n for (var i = 0; i < input.attributes.length; i++) {\n var attrName = input.attributes[i].name;\n if (!['id', 'type', 'value', 'style'].includes(attrName)) {\n input.removeAttribute(attrName);\n }\n }\n };\n\n /**\n * @param {InputClass} inputClass\n * @param {SweetAlertOptions['inputAttributes']} inputAttributes\n */\n var setAttributes = function setAttributes(inputClass, inputAttributes) {\n var popup = getPopup();\n if (!popup) {\n return;\n }\n var input = getInput$1(popup, inputClass);\n if (!input) {\n return;\n }\n removeAttributes(input);\n for (var attr in inputAttributes) {\n input.setAttribute(attr, inputAttributes[attr]);\n }\n };\n\n /**\n * @param {SweetAlertOptions} params\n */\n var setCustomClass = function setCustomClass(params) {\n if (!params.input) {\n return;\n }\n var inputContainer = getInputContainer(params.input);\n if (inputContainer) {\n applyCustomClass(inputContainer, params, 'input');\n }\n };\n\n /**\n * @param {HTMLInputElement | HTMLTextAreaElement} input\n * @param {SweetAlertOptions} params\n */\n var setInputPlaceholder = function setInputPlaceholder(input, params) {\n if (!input.placeholder && params.inputPlaceholder) {\n input.placeholder = params.inputPlaceholder;\n }\n };\n\n /**\n * @param {Input} input\n * @param {Input} prependTo\n * @param {SweetAlertOptions} params\n */\n var setInputLabel = function setInputLabel(input, prependTo, params) {\n if (params.inputLabel) {\n var label = document.createElement('label');\n var labelClass = swalClasses['input-label'];\n label.setAttribute('for', input.id);\n label.className = labelClass;\n if (_typeof(params.customClass) === 'object') {\n addClass(label, params.customClass.inputLabel);\n }\n label.innerText = params.inputLabel;\n prependTo.insertAdjacentElement('beforebegin', label);\n }\n };\n\n /**\n * @param {SweetAlertInput} inputType\n * @returns {HTMLElement | undefined}\n */\n var getInputContainer = function getInputContainer(inputType) {\n var popup = getPopup();\n if (!popup) {\n return;\n }\n return getDirectChildByClass(popup, swalClasses[( /** @type {SwalClass} */inputType)] || swalClasses.input);\n };\n\n /**\n * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input\n * @param {SweetAlertOptions['inputValue']} inputValue\n */\n var checkAndSetInputValue = function checkAndSetInputValue(input, inputValue) {\n if (['string', 'number'].includes(_typeof(inputValue))) {\n input.value = \"\".concat(inputValue);\n } else if (!isPromise(inputValue)) {\n warn(\"Unexpected type of inputValue! Expected \\\"string\\\", \\\"number\\\" or \\\"Promise\\\", got \\\"\".concat(_typeof(inputValue), \"\\\"\"));\n }\n };\n\n /** @type {Record Input>} */\n var renderInputType = {};\n\n /**\n * @param {HTMLInputElement} input\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */\n function (input, params) {\n checkAndSetInputValue(input, params.inputValue);\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n input.type = params.input;\n return input;\n };\n\n /**\n * @param {HTMLInputElement} input\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n renderInputType.file = function (input, params) {\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n return input;\n };\n\n /**\n * @param {HTMLInputElement} range\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n renderInputType.range = function (range, params) {\n var rangeInput = range.querySelector('input');\n var rangeOutput = range.querySelector('output');\n checkAndSetInputValue(rangeInput, params.inputValue);\n rangeInput.type = params.input;\n checkAndSetInputValue(rangeOutput, params.inputValue);\n setInputLabel(rangeInput, range, params);\n return range;\n };\n\n /**\n * @param {HTMLSelectElement} select\n * @param {SweetAlertOptions} params\n * @returns {HTMLSelectElement}\n */\n renderInputType.select = function (select, params) {\n select.textContent = '';\n if (params.inputPlaceholder) {\n var placeholder = document.createElement('option');\n setInnerHtml(placeholder, params.inputPlaceholder);\n placeholder.value = '';\n placeholder.disabled = true;\n placeholder.selected = true;\n select.appendChild(placeholder);\n }\n setInputLabel(select, select, params);\n return select;\n };\n\n /**\n * @param {HTMLInputElement} radio\n * @returns {HTMLInputElement}\n */\n renderInputType.radio = function (radio) {\n radio.textContent = '';\n return radio;\n };\n\n /**\n * @param {HTMLLabelElement} checkboxContainer\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n renderInputType.checkbox = function (checkboxContainer, params) {\n var checkbox = getInput$1(getPopup(), 'checkbox');\n checkbox.value = '1';\n checkbox.checked = Boolean(params.inputValue);\n var label = checkboxContainer.querySelector('span');\n setInnerHtml(label, params.inputPlaceholder);\n return checkbox;\n };\n\n /**\n * @param {HTMLTextAreaElement} textarea\n * @param {SweetAlertOptions} params\n * @returns {HTMLTextAreaElement}\n */\n renderInputType.textarea = function (textarea, params) {\n checkAndSetInputValue(textarea, params.inputValue);\n setInputPlaceholder(textarea, params);\n setInputLabel(textarea, textarea, params);\n\n /**\n * @param {HTMLElement} el\n * @returns {number}\n */\n var getMargin = function getMargin(el) {\n return parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight);\n };\n\n // https://github.com/sweetalert2/sweetalert2/issues/2291\n setTimeout(function () {\n // https://github.com/sweetalert2/sweetalert2/issues/1699\n if ('MutationObserver' in window) {\n var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);\n var textareaResizeHandler = function textareaResizeHandler() {\n // check if texarea is still in document (i.e. popup wasn't closed in the meantime)\n if (!document.body.contains(textarea)) {\n return;\n }\n var textareaWidth = textarea.offsetWidth + getMargin(textarea);\n if (textareaWidth > initialPopupWidth) {\n getPopup().style.width = \"\".concat(textareaWidth, \"px\");\n } else {\n applyNumericalStyle(getPopup(), 'width', params.width);\n }\n };\n new MutationObserver(textareaResizeHandler).observe(textarea, {\n attributes: true,\n attributeFilter: ['style']\n });\n }\n });\n return textarea;\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderContent = function renderContent(instance, params) {\n var htmlContainer = getHtmlContainer();\n if (!htmlContainer) {\n return;\n }\n showWhenInnerHtmlPresent(htmlContainer);\n applyCustomClass(htmlContainer, params, 'htmlContainer');\n\n // Content as HTML\n if (params.html) {\n parseHtmlToContainer(params.html, htmlContainer);\n show(htmlContainer, 'block');\n }\n\n // Content as plain text\n else if (params.text) {\n htmlContainer.textContent = params.text;\n show(htmlContainer, 'block');\n }\n\n // No content\n else {\n hide(htmlContainer);\n }\n renderInput(instance, params);\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderFooter = function renderFooter(instance, params) {\n var footer = getFooter();\n if (!footer) {\n return;\n }\n showWhenInnerHtmlPresent(footer);\n toggle(footer, params.footer, 'block');\n if (params.footer) {\n parseHtmlToContainer(params.footer, footer);\n }\n\n // Custom class\n applyCustomClass(footer, params, 'footer');\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderIcon = function renderIcon(instance, params) {\n var innerParams = privateProps.innerParams.get(instance);\n var icon = getIcon();\n if (!icon) {\n return;\n }\n\n // if the given icon already rendered, apply the styling without re-rendering the icon\n if (innerParams && params.icon === innerParams.icon) {\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n return;\n }\n if (!params.icon && !params.iconHtml) {\n hide(icon);\n return;\n }\n if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {\n error(\"Unknown icon! Expected \\\"success\\\", \\\"error\\\", \\\"warning\\\", \\\"info\\\" or \\\"question\\\", got \\\"\".concat(params.icon, \"\\\"\"));\n hide(icon);\n return;\n }\n show(icon);\n\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n\n // Animate icon\n addClass(icon, params.showClass && params.showClass.icon);\n };\n\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n var applyStyles = function applyStyles(icon, params) {\n for (var _i = 0, _Object$entries = Object.entries(iconTypes); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),\n iconType = _Object$entries$_i[0],\n iconClassName = _Object$entries$_i[1];\n if (params.icon !== iconType) {\n removeClass(icon, iconClassName);\n }\n }\n addClass(icon, params.icon && iconTypes[params.icon]);\n\n // Icon color\n setColor(icon, params);\n\n // Success icon background color\n adjustSuccessIconBackgroundColor();\n\n // Custom class\n applyCustomClass(icon, params, 'icon');\n };\n\n // Adjust success icon background color to match the popup background color\n var adjustSuccessIconBackgroundColor = function adjustSuccessIconBackgroundColor() {\n var popup = getPopup();\n if (!popup) {\n return;\n }\n var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');\n /** @type {NodeListOf} */\n var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');\n for (var i = 0; i < successIconParts.length; i++) {\n successIconParts[i].style.backgroundColor = popupBackgroundColor;\n }\n };\n var successIconHtml = \"\\n
\\n \\n
\\n
\\n\";\n var errorIconHtml = \"\\n \\n \\n \\n \\n\";\n\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n var setContent = function setContent(icon, params) {\n if (!params.icon && !params.iconHtml) {\n return;\n }\n var oldContent = icon.innerHTML;\n var newContent = '';\n if (params.iconHtml) {\n newContent = iconContent(params.iconHtml);\n } else if (params.icon === 'success') {\n newContent = successIconHtml;\n oldContent = oldContent.replace(/ style=\".*?\"/g, ''); // undo adjustSuccessIconBackgroundColor()\n } else if (params.icon === 'error') {\n newContent = errorIconHtml;\n } else if (params.icon) {\n var defaultIconHtml = {\n question: '?',\n warning: '!',\n info: 'i'\n };\n newContent = iconContent(defaultIconHtml[params.icon]);\n }\n if (oldContent.trim() !== newContent.trim()) {\n setInnerHtml(icon, newContent);\n }\n };\n\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n var setColor = function setColor(icon, params) {\n if (!params.iconColor) {\n return;\n }\n icon.style.color = params.iconColor;\n icon.style.borderColor = params.iconColor;\n for (var _i2 = 0, _arr = ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']; _i2 < _arr.length; _i2++) {\n var sel = _arr[_i2];\n setStyle(icon, sel, 'background-color', params.iconColor);\n }\n setStyle(icon, '.swal2-success-ring', 'border-color', params.iconColor);\n };\n\n /**\n * @param {string} content\n * @returns {string}\n */\n var iconContent = function iconContent(content) {\n return \"\").concat(content, \"
\");\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderImage = function renderImage(instance, params) {\n var image = getImage();\n if (!image) {\n return;\n }\n if (!params.imageUrl) {\n hide(image);\n return;\n }\n show(image, '');\n\n // Src, alt\n image.setAttribute('src', params.imageUrl);\n image.setAttribute('alt', params.imageAlt || '');\n\n // Width, height\n applyNumericalStyle(image, 'width', params.imageWidth);\n applyNumericalStyle(image, 'height', params.imageHeight);\n\n // Class\n image.className = swalClasses.image;\n applyCustomClass(image, params, 'image');\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderPopup = function renderPopup(instance, params) {\n var container = getContainer();\n var popup = getPopup();\n if (!container || !popup) {\n return;\n }\n\n // Width\n // https://github.com/sweetalert2/sweetalert2/issues/2170\n if (params.toast) {\n applyNumericalStyle(container, 'width', params.width);\n popup.style.width = '100%';\n var loader = getLoader();\n if (loader) {\n popup.insertBefore(loader, getIcon());\n }\n } else {\n applyNumericalStyle(popup, 'width', params.width);\n }\n\n // Padding\n applyNumericalStyle(popup, 'padding', params.padding);\n\n // Color\n if (params.color) {\n popup.style.color = params.color;\n }\n\n // Background\n if (params.background) {\n popup.style.background = params.background;\n }\n hide(getValidationMessage());\n\n // Classes\n addClasses$1(popup, params);\n };\n\n /**\n * @param {HTMLElement} popup\n * @param {SweetAlertOptions} params\n */\n var addClasses$1 = function addClasses(popup, params) {\n var showClass = params.showClass || {};\n // Default Class + showClass when updating Swal.update({})\n popup.className = \"\".concat(swalClasses.popup, \" \").concat(isVisible$1(popup) ? showClass.popup : '');\n if (params.toast) {\n addClass([document.documentElement, document.body], swalClasses['toast-shown']);\n addClass(popup, swalClasses.toast);\n } else {\n addClass(popup, swalClasses.modal);\n }\n\n // Custom class\n applyCustomClass(popup, params, 'popup');\n // TODO: remove in the next major\n if (typeof params.customClass === 'string') {\n addClass(popup, params.customClass);\n }\n\n // Icon class (#1842)\n if (params.icon) {\n addClass(popup, swalClasses[\"icon-\".concat(params.icon)]);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderProgressSteps = function renderProgressSteps(instance, params) {\n var progressStepsContainer = getProgressSteps();\n if (!progressStepsContainer) {\n return;\n }\n var progressSteps = params.progressSteps,\n currentProgressStep = params.currentProgressStep;\n if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) {\n hide(progressStepsContainer);\n return;\n }\n show(progressStepsContainer);\n progressStepsContainer.textContent = '';\n if (currentProgressStep >= progressSteps.length) {\n warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');\n }\n progressSteps.forEach(function (step, index) {\n var stepEl = createStepElement(step);\n progressStepsContainer.appendChild(stepEl);\n if (index === currentProgressStep) {\n addClass(stepEl, swalClasses['active-progress-step']);\n }\n if (index !== progressSteps.length - 1) {\n var lineEl = createLineElement(params);\n progressStepsContainer.appendChild(lineEl);\n }\n });\n };\n\n /**\n * @param {string} step\n * @returns {HTMLLIElement}\n */\n var createStepElement = function createStepElement(step) {\n var stepEl = document.createElement('li');\n addClass(stepEl, swalClasses['progress-step']);\n setInnerHtml(stepEl, step);\n return stepEl;\n };\n\n /**\n * @param {SweetAlertOptions} params\n * @returns {HTMLLIElement}\n */\n var createLineElement = function createLineElement(params) {\n var lineEl = document.createElement('li');\n addClass(lineEl, swalClasses['progress-step-line']);\n if (params.progressStepsDistance) {\n applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);\n }\n return lineEl;\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var renderTitle = function renderTitle(instance, params) {\n var title = getTitle();\n if (!title) {\n return;\n }\n showWhenInnerHtmlPresent(title);\n toggle(title, params.title || params.titleText, 'block');\n if (params.title) {\n parseHtmlToContainer(params.title, title);\n }\n if (params.titleText) {\n title.innerText = params.titleText;\n }\n\n // Custom class\n applyCustomClass(title, params, 'title');\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var render = function render(instance, params) {\n renderPopup(instance, params);\n renderContainer(instance, params);\n renderProgressSteps(instance, params);\n renderIcon(instance, params);\n renderImage(instance, params);\n renderTitle(instance, params);\n renderCloseButton(instance, params);\n renderContent(instance, params);\n renderActions(instance, params);\n renderFooter(instance, params);\n var popup = getPopup();\n if (typeof params.didRender === 'function' && popup) {\n params.didRender(popup);\n }\n };\n\n /*\n * Global function to determine if SweetAlert2 popup is shown\n */\n var isVisible = function isVisible() {\n return isVisible$1(getPopup());\n };\n\n /*\n * Global function to click 'Confirm' button\n */\n var clickConfirm = function clickConfirm() {\n var _dom$getConfirmButton;\n return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click();\n };\n\n /*\n * Global function to click 'Deny' button\n */\n var clickDeny = function clickDeny() {\n var _dom$getDenyButton;\n return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click();\n };\n\n /*\n * Global function to click 'Cancel' button\n */\n var clickCancel = function clickCancel() {\n var _dom$getCancelButton;\n return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click();\n };\n\n /** @typedef {'cancel' | 'backdrop' | 'close' | 'esc' | 'timer'} DismissReason */\n\n /** @type {Record} */\n var DismissReason = Object.freeze({\n cancel: 'cancel',\n backdrop: 'backdrop',\n close: 'close',\n esc: 'esc',\n timer: 'timer'\n });\n\n /**\n * @param {GlobalState} globalState\n */\n var removeKeydownHandler = function removeKeydownHandler(globalState) {\n if (globalState.keydownTarget && globalState.keydownHandlerAdded) {\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n };\n\n /**\n * @param {GlobalState} globalState\n * @param {SweetAlertOptions} innerParams\n * @param {*} dismissWith\n */\n var addKeydownHandler = function addKeydownHandler(globalState, innerParams, dismissWith) {\n removeKeydownHandler(globalState);\n if (!innerParams.toast) {\n globalState.keydownHandler = function (e) {\n return keydownHandler(innerParams, e, dismissWith);\n };\n globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();\n globalState.keydownListenerCapture = innerParams.keydownListenerCapture;\n globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = true;\n }\n };\n\n /**\n * @param {number} index\n * @param {number} increment\n */\n var setFocus = function setFocus(index, increment) {\n var _dom$getPopup;\n var focusableElements = getFocusableElements();\n // search for visible elements and select the next possible match\n if (focusableElements.length) {\n index = index + increment;\n\n // rollover to first item\n if (index === focusableElements.length) {\n index = 0;\n\n // go to last item\n } else if (index === -1) {\n index = focusableElements.length - 1;\n }\n focusableElements[index].focus();\n return;\n }\n // no visible focusable elements, focus the popup\n (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus();\n };\n var arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];\n var arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];\n\n /**\n * @param {SweetAlertOptions} innerParams\n * @param {KeyboardEvent} event\n * @param {Function} dismissWith\n */\n var keydownHandler = function keydownHandler(innerParams, event, dismissWith) {\n if (!innerParams) {\n return; // This instance has already been destroyed\n }\n\n // Ignore keydown during IME composition\n // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition\n // https://github.com/sweetalert2/sweetalert2/issues/720\n // https://github.com/sweetalert2/sweetalert2/issues/2406\n if (event.isComposing || event.keyCode === 229) {\n return;\n }\n if (innerParams.stopKeydownPropagation) {\n event.stopPropagation();\n }\n\n // ENTER\n if (event.key === 'Enter') {\n handleEnter(event, innerParams);\n }\n\n // TAB\n else if (event.key === 'Tab') {\n handleTab(event);\n }\n\n // ARROWS - switch focus between buttons\n else if ([].concat(arrowKeysNextButton, arrowKeysPreviousButton).includes(event.key)) {\n handleArrows(event.key);\n }\n\n // ESC\n else if (event.key === 'Escape') {\n handleEsc(event, innerParams, dismissWith);\n }\n };\n\n /**\n * @param {KeyboardEvent} event\n * @param {SweetAlertOptions} innerParams\n */\n var handleEnter = function handleEnter(event, innerParams) {\n // https://github.com/sweetalert2/sweetalert2/issues/2386\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return;\n }\n var input = getInput$1(getPopup(), innerParams.input);\n if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) {\n if (['textarea', 'file'].includes(innerParams.input)) {\n return; // do not submit\n }\n clickConfirm();\n event.preventDefault();\n }\n };\n\n /**\n * @param {KeyboardEvent} event\n */\n var handleTab = function handleTab(event) {\n var targetElement = event.target;\n var focusableElements = getFocusableElements();\n var btnIndex = -1;\n for (var i = 0; i < focusableElements.length; i++) {\n if (targetElement === focusableElements[i]) {\n btnIndex = i;\n break;\n }\n }\n\n // Cycle to the next button\n if (!event.shiftKey) {\n setFocus(btnIndex, 1);\n }\n\n // Cycle to the prev button\n else {\n setFocus(btnIndex, -1);\n }\n event.stopPropagation();\n event.preventDefault();\n };\n\n /**\n * @param {string} key\n */\n var handleArrows = function handleArrows(key) {\n var actions = getActions();\n var confirmButton = getConfirmButton();\n var denyButton = getDenyButton();\n var cancelButton = getCancelButton();\n if (!actions || !confirmButton || !denyButton || !cancelButton) {\n return;\n }\n /** @type HTMLElement[] */\n var buttons = [confirmButton, denyButton, cancelButton];\n if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) {\n return;\n }\n var sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';\n var buttonToFocus = document.activeElement;\n if (!buttonToFocus) {\n return;\n }\n for (var i = 0; i < actions.children.length; i++) {\n buttonToFocus = buttonToFocus[sibling];\n if (!buttonToFocus) {\n return;\n }\n if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) {\n break;\n }\n }\n if (buttonToFocus instanceof HTMLButtonElement) {\n buttonToFocus.focus();\n }\n };\n\n /**\n * @param {KeyboardEvent} event\n * @param {SweetAlertOptions} innerParams\n * @param {Function} dismissWith\n */\n var handleEsc = function handleEsc(event, innerParams, dismissWith) {\n if (callIfFunction(innerParams.allowEscapeKey)) {\n event.preventDefault();\n dismissWith(DismissReason.esc);\n }\n };\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n\n var privateMethods = {\n swalPromiseResolve: new WeakMap(),\n swalPromiseReject: new WeakMap()\n };\n\n // From https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/\n // Adding aria-hidden=\"true\" to elements outside of the active modal dialog ensures that\n // elements not within the active modal dialog will not be surfaced if a user opens a screen\n // reader’s list of elements (headings, form controls, landmarks, etc.) in the document.\n\n var setAriaHidden = function setAriaHidden() {\n var container = getContainer();\n var bodyChildren = Array.from(document.body.children);\n bodyChildren.forEach(function (el) {\n if (el.contains(container)) {\n return;\n }\n if (el.hasAttribute('aria-hidden')) {\n el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden') || '');\n }\n el.setAttribute('aria-hidden', 'true');\n });\n };\n var unsetAriaHidden = function unsetAriaHidden() {\n var bodyChildren = Array.from(document.body.children);\n bodyChildren.forEach(function (el) {\n if (el.hasAttribute('data-previous-aria-hidden')) {\n el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || '');\n el.removeAttribute('data-previous-aria-hidden');\n } else {\n el.removeAttribute('aria-hidden');\n }\n });\n };\n\n // @ts-ignore\n var isSafariOrIOS = typeof window !== 'undefined' && !!window.GestureEvent; // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394\n\n /**\n * Fix iOS scrolling\n * http://stackoverflow.com/q/39626302\n */\n var iOSfix = function iOSfix() {\n if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) {\n var offset = document.body.scrollTop;\n document.body.style.top = \"\".concat(offset * -1, \"px\");\n addClass(document.body, swalClasses.iosfix);\n lockBodyScroll();\n }\n };\n\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1246\n */\n var lockBodyScroll = function lockBodyScroll() {\n var container = getContainer();\n if (!container) {\n return;\n }\n /** @type {boolean} */\n var preventTouchMove;\n /**\n * @param {TouchEvent} event\n */\n container.ontouchstart = function (event) {\n preventTouchMove = shouldPreventTouchMove(event);\n };\n /**\n * @param {TouchEvent} event\n */\n container.ontouchmove = function (event) {\n if (preventTouchMove) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n };\n\n /**\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n var shouldPreventTouchMove = function shouldPreventTouchMove(event) {\n var target = event.target;\n var container = getContainer();\n var htmlContainer = getHtmlContainer();\n if (!container || !htmlContainer) {\n return false;\n }\n if (isStylus(event) || isZoom(event)) {\n return false;\n }\n if (target === container) {\n return true;\n }\n if (!isScrollable(container) && target instanceof HTMLElement && target.tagName !== 'INPUT' &&\n // #1603\n target.tagName !== 'TEXTAREA' &&\n // #2266\n !(isScrollable(htmlContainer) &&\n // #1944\n htmlContainer.contains(target))) {\n return true;\n }\n return false;\n };\n\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1786\n *\n * @param {*} event\n * @returns {boolean}\n */\n var isStylus = function isStylus(event) {\n return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';\n };\n\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1891\n *\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n var isZoom = function isZoom(event) {\n return event.touches && event.touches.length > 1;\n };\n var undoIOSfix = function undoIOSfix() {\n if (hasClass(document.body, swalClasses.iosfix)) {\n var offset = parseInt(document.body.style.top, 10);\n removeClass(document.body, swalClasses.iosfix);\n document.body.style.top = '';\n document.body.scrollTop = offset * -1;\n }\n };\n\n /**\n * Measure scrollbar width for padding body during modal show/hide\n * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js\n *\n * @returns {number}\n */\n var measureScrollbar = function measureScrollbar() {\n var scrollDiv = document.createElement('div');\n scrollDiv.className = swalClasses['scrollbar-measure'];\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n };\n\n /**\n * Remember state in cases where opening and handling a modal will fiddle with it.\n * @type {number | null}\n */\n var previousBodyPadding = null;\n\n /**\n * @param {string} initialBodyOverflow\n */\n var replaceScrollbarWithPadding = function replaceScrollbarWithPadding(initialBodyOverflow) {\n // for queues, do not do this more than once\n if (previousBodyPadding !== null) {\n return;\n }\n // if the body has overflow\n if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === 'scroll' // https://github.com/sweetalert2/sweetalert2/issues/2663\n ) {\n // add padding so the content doesn't shift after removal of scrollbar\n previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));\n document.body.style.paddingRight = \"\".concat(previousBodyPadding + measureScrollbar(), \"px\");\n }\n };\n var undoReplaceScrollbarWithPadding = function undoReplaceScrollbarWithPadding() {\n if (previousBodyPadding !== null) {\n document.body.style.paddingRight = \"\".concat(previousBodyPadding, \"px\");\n previousBodyPadding = null;\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {HTMLElement} container\n * @param {boolean} returnFocus\n * @param {Function} didClose\n */\n function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(function () {\n return triggerDidCloseAndDispose(instance, didClose);\n });\n removeKeydownHandler(globalState);\n }\n\n // workaround for https://github.com/sweetalert2/sweetalert2/issues/2088\n // for some reason removing the container in Safari will scroll the document to bottom\n if (isSafariOrIOS) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n if (isModal()) {\n undoReplaceScrollbarWithPadding();\n undoIOSfix();\n unsetAriaHidden();\n }\n removeBodyClasses();\n }\n\n /**\n * Remove SweetAlert2 classes from body\n */\n function removeBodyClasses() {\n removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);\n }\n\n /**\n * Instance method to close sweetAlert\n *\n * @param {any} resolveValue\n */\n function close(resolveValue) {\n resolveValue = prepareResolveValue(resolveValue);\n var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);\n var didClose = triggerClosePopup(this);\n if (this.isAwaitingPromise) {\n // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335\n if (!resolveValue.isDismissed) {\n handleAwaitingPromise(this);\n swalPromiseResolve(resolveValue);\n }\n } else if (didClose) {\n // Resolve Swal promise\n swalPromiseResolve(resolveValue);\n }\n }\n var triggerClosePopup = function triggerClosePopup(instance) {\n var popup = getPopup();\n if (!popup) {\n return false;\n }\n var innerParams = privateProps.innerParams.get(instance);\n if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {\n return false;\n }\n removeClass(popup, innerParams.showClass.popup);\n addClass(popup, innerParams.hideClass.popup);\n var backdrop = getContainer();\n removeClass(backdrop, innerParams.showClass.backdrop);\n addClass(backdrop, innerParams.hideClass.backdrop);\n handlePopupAnimation(instance, popup, innerParams);\n return true;\n };\n\n /**\n * @param {any} error\n */\n function rejectPromise(error) {\n var rejectPromise = privateMethods.swalPromiseReject.get(this);\n handleAwaitingPromise(this);\n if (rejectPromise) {\n // Reject Swal promise\n rejectPromise(error);\n }\n }\n\n /**\n * @param {SweetAlert} instance\n */\n var handleAwaitingPromise = function handleAwaitingPromise(instance) {\n if (instance.isAwaitingPromise) {\n delete instance.isAwaitingPromise;\n // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335\n if (!privateProps.innerParams.get(instance)) {\n instance._destroy();\n }\n }\n };\n\n /**\n * @param {any} resolveValue\n * @returns {SweetAlertResult}\n */\n var prepareResolveValue = function prepareResolveValue(resolveValue) {\n // When user calls Swal.close()\n if (typeof resolveValue === 'undefined') {\n return {\n isConfirmed: false,\n isDenied: false,\n isDismissed: true\n };\n }\n return Object.assign({\n isConfirmed: false,\n isDenied: false,\n isDismissed: false\n }, resolveValue);\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {HTMLElement} popup\n * @param {SweetAlertOptions} innerParams\n */\n var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) {\n var container = getContainer();\n // If animation is supported, animate\n var animationIsSupported = animationEndEvent && hasCssAnimation(popup);\n if (typeof innerParams.willClose === 'function') {\n innerParams.willClose(popup);\n }\n if (animationIsSupported) {\n animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose);\n } else {\n // Otherwise, remove immediately\n removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {HTMLElement} popup\n * @param {HTMLElement} container\n * @param {boolean} returnFocus\n * @param {Function} didClose\n */\n var animatePopup = function animatePopup(instance, popup, container, returnFocus, didClose) {\n if (!animationEndEvent) {\n return;\n }\n globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);\n popup.addEventListener(animationEndEvent, function (e) {\n if (e.target === popup) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n });\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {Function} didClose\n */\n var triggerDidCloseAndDispose = function triggerDidCloseAndDispose(instance, didClose) {\n setTimeout(function () {\n if (typeof didClose === 'function') {\n didClose.bind(instance.params)();\n }\n // instance might have been destroyed already\n if (instance._destroy) {\n instance._destroy();\n }\n });\n };\n\n /**\n * Shows loader (spinner), this is useful with AJAX requests.\n * By default the loader be shown instead of the \"Confirm\" button.\n *\n * @param {HTMLButtonElement | null} [buttonToReplace]\n */\n var showLoading = function showLoading(buttonToReplace) {\n var popup = getPopup();\n if (!popup) {\n new Swal();\n }\n popup = getPopup();\n if (!popup) {\n return;\n }\n var loader = getLoader();\n if (isToast()) {\n hide(getIcon());\n } else {\n replaceButton(popup, buttonToReplace);\n }\n show(loader);\n popup.setAttribute('data-loading', 'true');\n popup.setAttribute('aria-busy', 'true');\n popup.focus();\n };\n\n /**\n * @param {HTMLElement} popup\n * @param {HTMLButtonElement | null} [buttonToReplace]\n */\n var replaceButton = function replaceButton(popup, buttonToReplace) {\n var actions = getActions();\n var loader = getLoader();\n if (!actions || !loader) {\n return;\n }\n if (!buttonToReplace && isVisible$1(getConfirmButton())) {\n buttonToReplace = getConfirmButton();\n }\n show(actions);\n if (buttonToReplace) {\n hide(buttonToReplace);\n loader.setAttribute('data-button-to-replace', buttonToReplace.className);\n actions.insertBefore(loader, buttonToReplace);\n }\n addClass([popup, actions], swalClasses.loading);\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) {\n if (params.input === 'select' || params.input === 'radio') {\n handleInputOptions(instance, params);\n } else if (['text', 'email', 'number', 'tel', 'textarea'].some(function (i) {\n return i === params.input;\n }) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {\n showLoading(getConfirmButton());\n handleInputValue(instance, params);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} innerParams\n * @returns {SweetAlertInputValue}\n */\n var getInputValue = function getInputValue(instance, innerParams) {\n var input = instance.getInput();\n if (!input) {\n return null;\n }\n switch (innerParams.input) {\n case 'checkbox':\n return getCheckboxValue(input);\n case 'radio':\n return getRadioValue(input);\n case 'file':\n return getFileValue(input);\n default:\n return innerParams.inputAutoTrim ? input.value.trim() : input.value;\n }\n };\n\n /**\n * @param {HTMLInputElement} input\n * @returns {number}\n */\n var getCheckboxValue = function getCheckboxValue(input) {\n return input.checked ? 1 : 0;\n };\n\n /**\n * @param {HTMLInputElement} input\n * @returns {string | null}\n */\n var getRadioValue = function getRadioValue(input) {\n return input.checked ? input.value : null;\n };\n\n /**\n * @param {HTMLInputElement} input\n * @returns {FileList | File | null}\n */\n var getFileValue = function getFileValue(input) {\n return input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var handleInputOptions = function handleInputOptions(instance, params) {\n var popup = getPopup();\n if (!popup) {\n return;\n }\n /**\n * @param {Record} inputOptions\n */\n var processInputOptions = function processInputOptions(inputOptions) {\n if (params.input === 'select') {\n populateSelectOptions(popup, _formatInputOptions(inputOptions), params);\n } else if (params.input === 'radio') {\n populateRadioOptions(popup, _formatInputOptions(inputOptions), params);\n }\n };\n if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {\n showLoading(getConfirmButton());\n asPromise(params.inputOptions).then(function (inputOptions) {\n instance.hideLoading();\n processInputOptions(inputOptions);\n });\n } else if (_typeof(params.inputOptions) === 'object') {\n processInputOptions(params.inputOptions);\n } else {\n error(\"Unexpected type of inputOptions! Expected object, Map or Promise, got \".concat(_typeof(params.inputOptions)));\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertOptions} params\n */\n var handleInputValue = function handleInputValue(instance, params) {\n var input = instance.getInput();\n if (!input) {\n return;\n }\n hide(input);\n asPromise(params.inputValue).then(function (inputValue) {\n input.value = params.input === 'number' ? \"\".concat(parseFloat(inputValue) || 0) : \"\".concat(inputValue);\n show(input);\n input.focus();\n instance.hideLoading();\n })[\"catch\"](function (err) {\n error(\"Error in inputValue promise: \".concat(err));\n input.value = '';\n show(input);\n input.focus();\n instance.hideLoading();\n });\n };\n\n /**\n * @param {HTMLElement} popup\n * @param {InputOptionFlattened[]} inputOptions\n * @param {SweetAlertOptions} params\n */\n function populateSelectOptions(popup, inputOptions, params) {\n var select = getDirectChildByClass(popup, swalClasses.select);\n if (!select) {\n return;\n }\n /**\n * @param {HTMLElement} parent\n * @param {string} optionLabel\n * @param {string} optionValue\n */\n var renderOption = function renderOption(parent, optionLabel, optionValue) {\n var option = document.createElement('option');\n option.value = optionValue;\n setInnerHtml(option, optionLabel);\n option.selected = isSelected(optionValue, params.inputValue);\n parent.appendChild(option);\n };\n inputOptions.forEach(function (inputOption) {\n var optionValue = inputOption[0];\n var optionLabel = inputOption[1];\n // spec:\n // https://www.w3.org/TR/html401/interact/forms.html#h-17.6\n // \"...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)...\"\n // check whether this is a \n if (Array.isArray(optionLabel)) {\n // if it is an array, then it is an \n var optgroup = document.createElement('optgroup');\n optgroup.label = optionValue;\n optgroup.disabled = false; // not configurable for now\n select.appendChild(optgroup);\n optionLabel.forEach(function (o) {\n return renderOption(optgroup, o[1], o[0]);\n });\n } else {\n // case of \n renderOption(select, optionLabel, optionValue);\n }\n });\n select.focus();\n }\n\n /**\n * @param {HTMLElement} popup\n * @param {InputOptionFlattened[]} inputOptions\n * @param {SweetAlertOptions} params\n */\n function populateRadioOptions(popup, inputOptions, params) {\n var radio = getDirectChildByClass(popup, swalClasses.radio);\n if (!radio) {\n return;\n }\n inputOptions.forEach(function (inputOption) {\n var radioValue = inputOption[0];\n var radioLabel = inputOption[1];\n var radioInput = document.createElement('input');\n var radioLabelElement = document.createElement('label');\n radioInput.type = 'radio';\n radioInput.name = swalClasses.radio;\n radioInput.value = radioValue;\n if (isSelected(radioValue, params.inputValue)) {\n radioInput.checked = true;\n }\n var label = document.createElement('span');\n setInnerHtml(label, radioLabel);\n label.className = swalClasses.label;\n radioLabelElement.appendChild(radioInput);\n radioLabelElement.appendChild(label);\n radio.appendChild(radioLabelElement);\n });\n var radios = radio.querySelectorAll('input');\n if (radios.length) {\n radios[0].focus();\n }\n }\n\n /**\n * Converts `inputOptions` into an array of `[value, label]`s\n *\n * @param {Record} inputOptions\n * @typedef {string[]} InputOptionFlattened\n * @returns {InputOptionFlattened[]}\n */\n var _formatInputOptions = function formatInputOptions(inputOptions) {\n /** @type {InputOptionFlattened[]} */\n var result = [];\n if (inputOptions instanceof Map) {\n inputOptions.forEach(function (value, key) {\n var valueFormatted = value;\n if (_typeof(valueFormatted) === 'object') {\n // case of \n valueFormatted = _formatInputOptions(valueFormatted);\n }\n result.push([key, valueFormatted]);\n });\n } else {\n Object.keys(inputOptions).forEach(function (key) {\n var valueFormatted = inputOptions[key];\n if (_typeof(valueFormatted) === 'object') {\n // case of \n valueFormatted = _formatInputOptions(valueFormatted);\n }\n result.push([key, valueFormatted]);\n });\n }\n return result;\n };\n\n /**\n * @param {string} optionValue\n * @param {SweetAlertInputValue} inputValue\n * @returns {boolean}\n */\n var isSelected = function isSelected(optionValue, inputValue) {\n return !!inputValue && inputValue.toString() === optionValue.toString();\n };\n\n var _this = undefined;\n\n /**\n * @param {SweetAlert} instance\n */\n var handleConfirmButtonClick = function handleConfirmButtonClick(instance) {\n var innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n if (innerParams.input) {\n handleConfirmOrDenyWithInput(instance, 'confirm');\n } else {\n confirm(instance, true);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n */\n var handleDenyButtonClick = function handleDenyButtonClick(instance) {\n var innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n if (innerParams.returnInputValueOnDeny) {\n handleConfirmOrDenyWithInput(instance, 'deny');\n } else {\n deny(instance, false);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {Function} dismissWith\n */\n var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) {\n instance.disableButtons();\n dismissWith(DismissReason.cancel);\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {'confirm' | 'deny'} type\n */\n var handleConfirmOrDenyWithInput = function handleConfirmOrDenyWithInput(instance, type) {\n var innerParams = privateProps.innerParams.get(instance);\n if (!innerParams.input) {\n error(\"The \\\"input\\\" parameter is needed to be set when using returnInputValueOn\".concat(capitalizeFirstLetter(type)));\n return;\n }\n var input = instance.getInput();\n var inputValue = getInputValue(instance, innerParams);\n if (innerParams.inputValidator) {\n handleInputValidator(instance, inputValue, type);\n } else if (input && !input.checkValidity()) {\n instance.enableButtons();\n instance.showValidationMessage(innerParams.validationMessage || input.validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {SweetAlertInputValue} inputValue\n * @param {'confirm' | 'deny'} type\n */\n var handleInputValidator = function handleInputValidator(instance, inputValue, type) {\n var innerParams = privateProps.innerParams.get(instance);\n instance.disableInput();\n var validationPromise = Promise.resolve().then(function () {\n return asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage));\n });\n validationPromise.then(function (validationMessage) {\n instance.enableButtons();\n instance.enableInput();\n if (validationMessage) {\n instance.showValidationMessage(validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n });\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {any} value\n */\n var deny = function deny(instance, value) {\n var innerParams = privateProps.innerParams.get(instance || _this);\n if (innerParams.showLoaderOnDeny) {\n showLoading(getDenyButton());\n }\n if (innerParams.preDeny) {\n instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received\n var preDenyPromise = Promise.resolve().then(function () {\n return asPromise(innerParams.preDeny(value, innerParams.validationMessage));\n });\n preDenyPromise.then(function (preDenyValue) {\n if (preDenyValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n instance.close({\n isDenied: true,\n value: typeof preDenyValue === 'undefined' ? value : preDenyValue\n });\n }\n })[\"catch\"](function (error) {\n return rejectWith(instance || _this, error);\n });\n } else {\n instance.close({\n isDenied: true,\n value: value\n });\n }\n };\n\n /**\n * @param {SweetAlert} instance\n * @param {any} value\n */\n var succeedWith = function succeedWith(instance, value) {\n instance.close({\n isConfirmed: true,\n value: value\n });\n };\n\n /**\n *\n * @param {SweetAlert} instance\n * @param {string} error\n */\n var rejectWith = function rejectWith(instance, error) {\n instance.rejectPromise(error);\n };\n\n /**\n *\n * @param {SweetAlert} instance\n * @param {any} value\n */\n var confirm = function confirm(instance, value) {\n var innerParams = privateProps.innerParams.get(instance || _this);\n if (innerParams.showLoaderOnConfirm) {\n showLoading();\n }\n if (innerParams.preConfirm) {\n instance.resetValidationMessage();\n instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received\n var preConfirmPromise = Promise.resolve().then(function () {\n return asPromise(innerParams.preConfirm(value, innerParams.validationMessage));\n });\n preConfirmPromise.then(function (preConfirmValue) {\n if (isVisible$1(getValidationMessage()) || preConfirmValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);\n }\n })[\"catch\"](function (error) {\n return rejectWith(instance || _this, error);\n });\n } else {\n succeedWith(instance, value);\n }\n };\n\n /**\n * Hides loader and shows back the button which was hidden by .showLoading()\n */\n function hideLoading() {\n // do nothing if popup is closed\n var innerParams = privateProps.innerParams.get(this);\n if (!innerParams) {\n return;\n }\n var domCache = privateProps.domCache.get(this);\n hide(domCache.loader);\n if (isToast()) {\n if (innerParams.icon) {\n show(getIcon());\n }\n } else {\n showRelatedButton(domCache);\n }\n removeClass([domCache.popup, domCache.actions], swalClasses.loading);\n domCache.popup.removeAttribute('aria-busy');\n domCache.popup.removeAttribute('data-loading');\n domCache.confirmButton.disabled = false;\n domCache.denyButton.disabled = false;\n domCache.cancelButton.disabled = false;\n }\n var showRelatedButton = function showRelatedButton(domCache) {\n var buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));\n if (buttonToReplace.length) {\n show(buttonToReplace[0], 'inline-block');\n } else if (allButtonsAreHidden()) {\n hide(domCache.actions);\n }\n };\n\n /**\n * Gets the input DOM node, this method works with input parameter.\n *\n * @returns {HTMLInputElement | null}\n */\n function getInput() {\n var innerParams = privateProps.innerParams.get(this);\n var domCache = privateProps.domCache.get(this);\n if (!domCache) {\n return null;\n }\n return getInput$1(domCache.popup, innerParams.input);\n }\n\n /**\n * @param {SweetAlert} instance\n * @param {string[]} buttons\n * @param {boolean} disabled\n */\n function setButtonsDisabled(instance, buttons, disabled) {\n var domCache = privateProps.domCache.get(instance);\n buttons.forEach(function (button) {\n domCache[button].disabled = disabled;\n });\n }\n\n /**\n * @param {HTMLInputElement | null} input\n * @param {boolean} disabled\n */\n function setInputDisabled(input, disabled) {\n var popup = getPopup();\n if (!popup || !input) {\n return;\n }\n if (input.type === 'radio') {\n /** @type {NodeListOf} */\n var radios = popup.querySelectorAll(\"[name=\\\"\".concat(swalClasses.radio, \"\\\"]\"));\n for (var i = 0; i < radios.length; i++) {\n radios[i].disabled = disabled;\n }\n } else {\n input.disabled = disabled;\n }\n }\n\n /**\n * Enable all the buttons\n * @this {SweetAlert}\n */\n function enableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);\n }\n\n /**\n * Disable all the buttons\n * @this {SweetAlert}\n */\n function disableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);\n }\n\n /**\n * Enable the input field\n * @this {SweetAlert}\n */\n function enableInput() {\n setInputDisabled(this.getInput(), false);\n }\n\n /**\n * Disable the input field\n * @this {SweetAlert}\n */\n function disableInput() {\n setInputDisabled(this.getInput(), true);\n }\n\n /**\n * Show block with validation message\n *\n * @param {string} error\n * @this {SweetAlert}\n */\n function showValidationMessage(error) {\n var domCache = privateProps.domCache.get(this);\n var params = privateProps.innerParams.get(this);\n setInnerHtml(domCache.validationMessage, error);\n domCache.validationMessage.className = swalClasses['validation-message'];\n if (params.customClass && params.customClass.validationMessage) {\n addClass(domCache.validationMessage, params.customClass.validationMessage);\n }\n show(domCache.validationMessage);\n var input = this.getInput();\n if (input) {\n input.setAttribute('aria-invalid', 'true');\n input.setAttribute('aria-describedby', swalClasses['validation-message']);\n focusInput(input);\n addClass(input, swalClasses.inputerror);\n }\n }\n\n /**\n * Hide block with validation message\n *\n * @this {SweetAlert}\n */\n function resetValidationMessage() {\n var domCache = privateProps.domCache.get(this);\n if (domCache.validationMessage) {\n hide(domCache.validationMessage);\n }\n var input = this.getInput();\n if (input) {\n input.removeAttribute('aria-invalid');\n input.removeAttribute('aria-describedby');\n removeClass(input, swalClasses.inputerror);\n }\n }\n\n var defaultParams = {\n title: '',\n titleText: '',\n text: '',\n html: '',\n footer: '',\n icon: undefined,\n iconColor: undefined,\n iconHtml: undefined,\n template: undefined,\n toast: false,\n animation: true,\n showClass: {\n popup: 'swal2-show',\n backdrop: 'swal2-backdrop-show',\n icon: 'swal2-icon-show'\n },\n hideClass: {\n popup: 'swal2-hide',\n backdrop: 'swal2-backdrop-hide',\n icon: 'swal2-icon-hide'\n },\n customClass: {},\n target: 'body',\n color: undefined,\n backdrop: true,\n heightAuto: true,\n allowOutsideClick: true,\n allowEscapeKey: true,\n allowEnterKey: true,\n stopKeydownPropagation: true,\n keydownListenerCapture: false,\n showConfirmButton: true,\n showDenyButton: false,\n showCancelButton: false,\n preConfirm: undefined,\n preDeny: undefined,\n confirmButtonText: 'OK',\n confirmButtonAriaLabel: '',\n confirmButtonColor: undefined,\n denyButtonText: 'No',\n denyButtonAriaLabel: '',\n denyButtonColor: undefined,\n cancelButtonText: 'Cancel',\n cancelButtonAriaLabel: '',\n cancelButtonColor: undefined,\n buttonsStyling: true,\n reverseButtons: false,\n focusConfirm: true,\n focusDeny: false,\n focusCancel: false,\n returnFocus: true,\n showCloseButton: false,\n closeButtonHtml: '×',\n closeButtonAriaLabel: 'Close this dialog',\n loaderHtml: '',\n showLoaderOnConfirm: false,\n showLoaderOnDeny: false,\n imageUrl: undefined,\n imageWidth: undefined,\n imageHeight: undefined,\n imageAlt: '',\n timer: undefined,\n timerProgressBar: false,\n width: undefined,\n padding: undefined,\n background: undefined,\n input: undefined,\n inputPlaceholder: '',\n inputLabel: '',\n inputValue: '',\n inputOptions: {},\n inputAutoFocus: true,\n inputAutoTrim: true,\n inputAttributes: {},\n inputValidator: undefined,\n returnInputValueOnDeny: false,\n validationMessage: undefined,\n grow: false,\n position: 'center',\n progressSteps: [],\n currentProgressStep: undefined,\n progressStepsDistance: undefined,\n willOpen: undefined,\n didOpen: undefined,\n didRender: undefined,\n willClose: undefined,\n didClose: undefined,\n didDestroy: undefined,\n scrollbarPadding: true\n };\n var updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];\n\n /** @type {Record} */\n var deprecatedParams = {\n allowEnterKey: undefined\n };\n var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];\n\n /**\n * Is valid parameter\n *\n * @param {string} paramName\n * @returns {boolean}\n */\n var isValidParameter = function isValidParameter(paramName) {\n return Object.prototype.hasOwnProperty.call(defaultParams, paramName);\n };\n\n /**\n * Is valid parameter for Swal.update() method\n *\n * @param {string} paramName\n * @returns {boolean}\n */\n var isUpdatableParameter = function isUpdatableParameter(paramName) {\n return updatableParams.indexOf(paramName) !== -1;\n };\n\n /**\n * Is deprecated parameter\n *\n * @param {string} paramName\n * @returns {string | undefined}\n */\n var isDeprecatedParameter = function isDeprecatedParameter(paramName) {\n return deprecatedParams[paramName];\n };\n\n /**\n * @param {string} param\n */\n var checkIfParamIsValid = function checkIfParamIsValid(param) {\n if (!isValidParameter(param)) {\n warn(\"Unknown parameter \\\"\".concat(param, \"\\\"\"));\n }\n };\n\n /**\n * @param {string} param\n */\n var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) {\n if (toastIncompatibleParams.includes(param)) {\n warn(\"The parameter \\\"\".concat(param, \"\\\" is incompatible with toasts\"));\n }\n };\n\n /**\n * @param {string} param\n */\n var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) {\n var isDeprecated = isDeprecatedParameter(param);\n if (isDeprecated) {\n warnAboutDeprecation(param, isDeprecated);\n }\n };\n\n /**\n * Show relevant warnings for given params\n *\n * @param {SweetAlertOptions} params\n */\n var showWarningsForParams = function showWarningsForParams(params) {\n if (params.backdrop === false && params.allowOutsideClick) {\n warn('\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`');\n }\n for (var param in params) {\n checkIfParamIsValid(param);\n if (params.toast) {\n checkIfToastParamIsValid(param);\n }\n checkIfParamIsDeprecated(param);\n }\n };\n\n /**\n * Updates popup parameters.\n *\n * @param {SweetAlertOptions} params\n */\n function update(params) {\n var popup = getPopup();\n var innerParams = privateProps.innerParams.get(this);\n if (!popup || hasClass(popup, innerParams.hideClass.popup)) {\n warn(\"You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.\");\n return;\n }\n var validUpdatableParams = filterValidParams(params);\n var updatedParams = Object.assign({}, innerParams, validUpdatableParams);\n render(this, updatedParams);\n privateProps.innerParams.set(this, updatedParams);\n Object.defineProperties(this, {\n params: {\n value: Object.assign({}, this.params, params),\n writable: false,\n enumerable: true\n }\n });\n }\n\n /**\n * @param {SweetAlertOptions} params\n * @returns {SweetAlertOptions}\n */\n var filterValidParams = function filterValidParams(params) {\n var validUpdatableParams = {};\n Object.keys(params).forEach(function (param) {\n if (isUpdatableParameter(param)) {\n validUpdatableParams[param] = params[param];\n } else {\n warn(\"Invalid parameter to update: \".concat(param));\n }\n });\n return validUpdatableParams;\n };\n\n /**\n * Dispose the current SweetAlert2 instance\n */\n function _destroy() {\n var domCache = privateProps.domCache.get(this);\n var innerParams = privateProps.innerParams.get(this);\n if (!innerParams) {\n disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335\n return; // This instance has already been destroyed\n }\n\n // Check if there is another Swal closing\n if (domCache.popup && globalState.swalCloseEventFinishedCallback) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n if (typeof innerParams.didDestroy === 'function') {\n innerParams.didDestroy();\n }\n disposeSwal(this);\n }\n\n /**\n * @param {SweetAlert} instance\n */\n var disposeSwal = function disposeSwal(instance) {\n disposeWeakMaps(instance);\n // Unset this.params so GC will dispose it (#1569)\n delete instance.params;\n // Unset globalState props so GC will dispose globalState (#1569)\n delete globalState.keydownHandler;\n delete globalState.keydownTarget;\n // Unset currentInstance\n delete globalState.currentInstance;\n };\n\n /**\n * @param {SweetAlert} instance\n */\n var disposeWeakMaps = function disposeWeakMaps(instance) {\n // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335\n if (instance.isAwaitingPromise) {\n unsetWeakMaps(privateProps, instance);\n instance.isAwaitingPromise = true;\n } else {\n unsetWeakMaps(privateMethods, instance);\n unsetWeakMaps(privateProps, instance);\n delete instance.isAwaitingPromise;\n // Unset instance methods\n delete instance.disableButtons;\n delete instance.enableButtons;\n delete instance.getInput;\n delete instance.disableInput;\n delete instance.enableInput;\n delete instance.hideLoading;\n delete instance.disableLoading;\n delete instance.showValidationMessage;\n delete instance.resetValidationMessage;\n delete instance.close;\n delete instance.closePopup;\n delete instance.closeModal;\n delete instance.closeToast;\n delete instance.rejectPromise;\n delete instance.update;\n delete instance._destroy;\n }\n };\n\n /**\n * @param {object} obj\n * @param {SweetAlert} instance\n */\n var unsetWeakMaps = function unsetWeakMaps(obj, instance) {\n for (var i in obj) {\n obj[i][\"delete\"](instance);\n }\n };\n\n var instanceMethods = /*#__PURE__*/Object.freeze({\n __proto__: null,\n _destroy: _destroy,\n close: close,\n closeModal: close,\n closePopup: close,\n closeToast: close,\n disableButtons: disableButtons,\n disableInput: disableInput,\n disableLoading: hideLoading,\n enableButtons: enableButtons,\n enableInput: enableInput,\n getInput: getInput,\n handleAwaitingPromise: handleAwaitingPromise,\n hideLoading: hideLoading,\n rejectPromise: rejectPromise,\n resetValidationMessage: resetValidationMessage,\n showValidationMessage: showValidationMessage,\n update: update\n });\n\n /**\n * @param {SweetAlertOptions} innerParams\n * @param {DomCache} domCache\n * @param {Function} dismissWith\n */\n var handlePopupClick = function handlePopupClick(innerParams, domCache, dismissWith) {\n if (innerParams.toast) {\n handleToastClick(innerParams, domCache, dismissWith);\n } else {\n // Ignore click events that had mousedown on the popup but mouseup on the container\n // This can happen when the user drags a slider\n handleModalMousedown(domCache);\n\n // Ignore click events that had mousedown on the container but mouseup on the popup\n handleContainerMousedown(domCache);\n handleModalClick(innerParams, domCache, dismissWith);\n }\n };\n\n /**\n * @param {SweetAlertOptions} innerParams\n * @param {DomCache} domCache\n * @param {Function} dismissWith\n */\n var handleToastClick = function handleToastClick(innerParams, domCache, dismissWith) {\n // Closing toast by internal click\n domCache.popup.onclick = function () {\n if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {\n return;\n }\n dismissWith(DismissReason.close);\n };\n };\n\n /**\n * @param {SweetAlertOptions} innerParams\n * @returns {boolean}\n */\n var isAnyButtonShown = function isAnyButtonShown(innerParams) {\n return !!(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton);\n };\n var ignoreOutsideClick = false;\n\n /**\n * @param {DomCache} domCache\n */\n var handleModalMousedown = function handleModalMousedown(domCache) {\n domCache.popup.onmousedown = function () {\n domCache.container.onmouseup = function (e) {\n domCache.container.onmouseup = function () {};\n // We only check if the mouseup target is the container because usually it doesn't\n // have any other direct children aside of the popup\n if (e.target === domCache.container) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n /**\n * @param {DomCache} domCache\n */\n var handleContainerMousedown = function handleContainerMousedown(domCache) {\n domCache.container.onmousedown = function (e) {\n // prevent the modal text from being selected on double click on the container (allowOutsideClick: false)\n if (e.target === domCache.container) {\n e.preventDefault();\n }\n domCache.popup.onmouseup = function (e) {\n domCache.popup.onmouseup = function () {};\n // We also need to check if the mouseup target is a child of the popup\n if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n /**\n * @param {SweetAlertOptions} innerParams\n * @param {DomCache} domCache\n * @param {Function} dismissWith\n */\n var handleModalClick = function handleModalClick(innerParams, domCache, dismissWith) {\n domCache.container.onclick = function (e) {\n if (ignoreOutsideClick) {\n ignoreOutsideClick = false;\n return;\n }\n if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {\n dismissWith(DismissReason.backdrop);\n }\n };\n };\n\n var isJqueryElement = function isJqueryElement(elem) {\n return _typeof(elem) === 'object' && elem.jquery;\n };\n var isElement = function isElement(elem) {\n return elem instanceof Element || isJqueryElement(elem);\n };\n var argsToParams = function argsToParams(args) {\n var params = {};\n if (_typeof(args[0]) === 'object' && !isElement(args[0])) {\n Object.assign(params, args[0]);\n } else {\n ['title', 'html', 'icon'].forEach(function (name, index) {\n var arg = args[index];\n if (typeof arg === 'string' || isElement(arg)) {\n params[name] = arg;\n } else if (arg !== undefined) {\n error(\"Unexpected type of \".concat(name, \"! Expected \\\"string\\\" or \\\"Element\\\", got \").concat(_typeof(arg)));\n }\n });\n }\n return params;\n };\n\n /**\n * Main method to create a new SweetAlert2 popup\n *\n * @param {...SweetAlertOptions} args\n * @returns {Promise}\n */\n function fire() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _construct(this, args);\n }\n\n /**\n * Returns an extended version of `Swal` containing `params` as defaults.\n * Useful for reusing Swal configuration.\n *\n * For example:\n *\n * Before:\n * const textPromptOptions = { input: 'text', showCancelButton: true }\n * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })\n * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })\n *\n * After:\n * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })\n * const {value: firstName} = await TextPrompt('What is your first name?')\n * const {value: lastName} = await TextPrompt('What is your last name?')\n *\n * @param {SweetAlertOptions} mixinParams\n * @returns {SweetAlert}\n */\n function mixin(mixinParams) {\n var MixinSwal = /*#__PURE__*/function (_this) {\n function MixinSwal() {\n _classCallCheck(this, MixinSwal);\n return _callSuper(this, MixinSwal, arguments);\n }\n _inherits(MixinSwal, _this);\n return _createClass(MixinSwal, [{\n key: \"_main\",\n value: function _main(params, priorityMixinParams) {\n return _superPropGet(MixinSwal, \"_main\", this)([params, Object.assign({}, mixinParams, priorityMixinParams)]);\n }\n }]);\n }(this); // @ts-ignore\n return MixinSwal;\n }\n\n /**\n * If `timer` parameter is set, returns number of milliseconds of timer remained.\n * Otherwise, returns undefined.\n *\n * @returns {number | undefined}\n */\n var getTimerLeft = function getTimerLeft() {\n return globalState.timeout && globalState.timeout.getTimerLeft();\n };\n\n /**\n * Stop timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n *\n * @returns {number | undefined}\n */\n var stopTimer = function stopTimer() {\n if (globalState.timeout) {\n stopTimerProgressBar();\n return globalState.timeout.stop();\n }\n };\n\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n *\n * @returns {number | undefined}\n */\n var resumeTimer = function resumeTimer() {\n if (globalState.timeout) {\n var remaining = globalState.timeout.start();\n animateTimerProgressBar(remaining);\n return remaining;\n }\n };\n\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n *\n * @returns {number | undefined}\n */\n var toggleTimer = function toggleTimer() {\n var timer = globalState.timeout;\n return timer && (timer.running ? stopTimer() : resumeTimer());\n };\n\n /**\n * Increase timer. Returns number of milliseconds of an updated timer.\n * If `timer` parameter isn't set, returns undefined.\n *\n * @param {number} ms\n * @returns {number | undefined}\n */\n var increaseTimer = function increaseTimer(ms) {\n if (globalState.timeout) {\n var remaining = globalState.timeout.increase(ms);\n animateTimerProgressBar(remaining, true);\n return remaining;\n }\n };\n\n /**\n * Check if timer is running. Returns true if timer is running\n * or false if timer is paused or stopped.\n * If `timer` parameter isn't set, returns undefined\n *\n * @returns {boolean}\n */\n var isTimerRunning = function isTimerRunning() {\n return !!(globalState.timeout && globalState.timeout.isRunning());\n };\n\n var bodyClickListenerAdded = false;\n var clickHandlers = {};\n\n /**\n * @param {string} attr\n */\n function bindClickHandler() {\n var attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template';\n clickHandlers[attr] = this;\n if (!bodyClickListenerAdded) {\n document.body.addEventListener('click', bodyClickListener);\n bodyClickListenerAdded = true;\n }\n }\n var bodyClickListener = function bodyClickListener(event) {\n for (var el = event.target; el && el !== document; el = el.parentNode) {\n for (var attr in clickHandlers) {\n var template = el.getAttribute(attr);\n if (template) {\n clickHandlers[attr].fire({\n template: template\n });\n return;\n }\n }\n }\n };\n\n var staticMethods = /*#__PURE__*/Object.freeze({\n __proto__: null,\n argsToParams: argsToParams,\n bindClickHandler: bindClickHandler,\n clickCancel: clickCancel,\n clickConfirm: clickConfirm,\n clickDeny: clickDeny,\n enableLoading: showLoading,\n fire: fire,\n getActions: getActions,\n getCancelButton: getCancelButton,\n getCloseButton: getCloseButton,\n getConfirmButton: getConfirmButton,\n getContainer: getContainer,\n getDenyButton: getDenyButton,\n getFocusableElements: getFocusableElements,\n getFooter: getFooter,\n getHtmlContainer: getHtmlContainer,\n getIcon: getIcon,\n getIconContent: getIconContent,\n getImage: getImage,\n getInputLabel: getInputLabel,\n getLoader: getLoader,\n getPopup: getPopup,\n getProgressSteps: getProgressSteps,\n getTimerLeft: getTimerLeft,\n getTimerProgressBar: getTimerProgressBar,\n getTitle: getTitle,\n getValidationMessage: getValidationMessage,\n increaseTimer: increaseTimer,\n isDeprecatedParameter: isDeprecatedParameter,\n isLoading: isLoading,\n isTimerRunning: isTimerRunning,\n isUpdatableParameter: isUpdatableParameter,\n isValidParameter: isValidParameter,\n isVisible: isVisible,\n mixin: mixin,\n resumeTimer: resumeTimer,\n showLoading: showLoading,\n stopTimer: stopTimer,\n toggleTimer: toggleTimer\n });\n\n var Timer = /*#__PURE__*/function () {\n /**\n * @param {Function} callback\n * @param {number} delay\n */\n function Timer(callback, delay) {\n _classCallCheck(this, Timer);\n this.callback = callback;\n this.remaining = delay;\n this.running = false;\n this.start();\n }\n\n /**\n * @returns {number}\n */\n return _createClass(Timer, [{\n key: \"start\",\n value: function start() {\n if (!this.running) {\n this.running = true;\n this.started = new Date();\n this.id = setTimeout(this.callback, this.remaining);\n }\n return this.remaining;\n }\n\n /**\n * @returns {number}\n */\n }, {\n key: \"stop\",\n value: function stop() {\n if (this.started && this.running) {\n this.running = false;\n clearTimeout(this.id);\n this.remaining -= new Date().getTime() - this.started.getTime();\n }\n return this.remaining;\n }\n\n /**\n * @param {number} n\n * @returns {number}\n */\n }, {\n key: \"increase\",\n value: function increase(n) {\n var running = this.running;\n if (running) {\n this.stop();\n }\n this.remaining += n;\n if (running) {\n this.start();\n }\n return this.remaining;\n }\n\n /**\n * @returns {number}\n */\n }, {\n key: \"getTimerLeft\",\n value: function getTimerLeft() {\n if (this.running) {\n this.stop();\n this.start();\n }\n return this.remaining;\n }\n\n /**\n * @returns {boolean}\n */\n }, {\n key: \"isRunning\",\n value: function isRunning() {\n return this.running;\n }\n }]);\n }();\n\n var swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];\n\n /**\n * @param {SweetAlertOptions} params\n * @returns {SweetAlertOptions}\n */\n var getTemplateParams = function getTemplateParams(params) {\n var template = typeof params.template === 'string' ? ( /** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template;\n if (!template) {\n return {};\n }\n /** @type {DocumentFragment} */\n var templateContent = template.content;\n showWarningsForElements(templateContent);\n var result = Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Record}\n */\n var getSwalParams = function getSwalParams(templateContent) {\n /** @type {Record} */\n var result = {};\n /** @type {HTMLElement[]} */\n var swalParams = Array.from(templateContent.querySelectorAll('swal-param'));\n swalParams.forEach(function (param) {\n showWarningsForAttributes(param, ['name', 'value']);\n var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');\n var value = param.getAttribute('value');\n if (!paramName || !value) {\n return;\n }\n if (typeof defaultParams[paramName] === 'boolean') {\n result[paramName] = value !== 'false';\n } else if (_typeof(defaultParams[paramName]) === 'object') {\n result[paramName] = JSON.parse(value);\n } else {\n result[paramName] = value;\n }\n });\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Record}\n */\n var getSwalFunctionParams = function getSwalFunctionParams(templateContent) {\n /** @type {Record} */\n var result = {};\n /** @type {HTMLElement[]} */\n var swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));\n swalFunctions.forEach(function (param) {\n var paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');\n var value = param.getAttribute('value');\n if (!paramName || !value) {\n return;\n }\n result[paramName] = new Function(\"return \".concat(value))();\n });\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Record}\n */\n var getSwalButtons = function getSwalButtons(templateContent) {\n /** @type {Record} */\n var result = {};\n /** @type {HTMLElement[]} */\n var swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));\n swalButtons.forEach(function (button) {\n showWarningsForAttributes(button, ['type', 'color', 'aria-label']);\n var type = button.getAttribute('type');\n if (!type || !['confirm', 'cancel', 'deny'].includes(type)) {\n return;\n }\n result[\"\".concat(type, \"ButtonText\")] = button.innerHTML;\n result[\"show\".concat(capitalizeFirstLetter(type), \"Button\")] = true;\n if (button.hasAttribute('color')) {\n result[\"\".concat(type, \"ButtonColor\")] = button.getAttribute('color');\n }\n if (button.hasAttribute('aria-label')) {\n result[\"\".concat(type, \"ButtonAriaLabel\")] = button.getAttribute('aria-label');\n }\n });\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Pick}\n */\n var getSwalImage = function getSwalImage(templateContent) {\n var result = {};\n /** @type {HTMLElement | null} */\n var image = templateContent.querySelector('swal-image');\n if (image) {\n showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);\n if (image.hasAttribute('src')) {\n result.imageUrl = image.getAttribute('src') || undefined;\n }\n if (image.hasAttribute('width')) {\n result.imageWidth = image.getAttribute('width') || undefined;\n }\n if (image.hasAttribute('height')) {\n result.imageHeight = image.getAttribute('height') || undefined;\n }\n if (image.hasAttribute('alt')) {\n result.imageAlt = image.getAttribute('alt') || undefined;\n }\n }\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Record}\n */\n var getSwalIcon = function getSwalIcon(templateContent) {\n var result = {};\n /** @type {HTMLElement | null} */\n var icon = templateContent.querySelector('swal-icon');\n if (icon) {\n showWarningsForAttributes(icon, ['type', 'color']);\n if (icon.hasAttribute('type')) {\n result.icon = icon.getAttribute('type');\n }\n if (icon.hasAttribute('color')) {\n result.iconColor = icon.getAttribute('color');\n }\n result.iconHtml = icon.innerHTML;\n }\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @returns {Record}\n */\n var getSwalInput = function getSwalInput(templateContent) {\n /** @type {Record} */\n var result = {};\n /** @type {HTMLElement | null} */\n var input = templateContent.querySelector('swal-input');\n if (input) {\n showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);\n result.input = input.getAttribute('type') || 'text';\n if (input.hasAttribute('label')) {\n result.inputLabel = input.getAttribute('label');\n }\n if (input.hasAttribute('placeholder')) {\n result.inputPlaceholder = input.getAttribute('placeholder');\n }\n if (input.hasAttribute('value')) {\n result.inputValue = input.getAttribute('value');\n }\n }\n /** @type {HTMLElement[]} */\n var inputOptions = Array.from(templateContent.querySelectorAll('swal-input-option'));\n if (inputOptions.length) {\n result.inputOptions = {};\n inputOptions.forEach(function (option) {\n showWarningsForAttributes(option, ['value']);\n var optionValue = option.getAttribute('value');\n if (!optionValue) {\n return;\n }\n var optionName = option.innerHTML;\n result.inputOptions[optionValue] = optionName;\n });\n }\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n * @param {string[]} paramNames\n * @returns {Record}\n */\n var getSwalStringParams = function getSwalStringParams(templateContent, paramNames) {\n /** @type {Record} */\n var result = {};\n for (var i in paramNames) {\n var paramName = paramNames[i];\n /** @type {HTMLElement | null} */\n var tag = templateContent.querySelector(paramName);\n if (tag) {\n showWarningsForAttributes(tag, []);\n result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();\n }\n }\n return result;\n };\n\n /**\n * @param {DocumentFragment} templateContent\n */\n var showWarningsForElements = function showWarningsForElements(templateContent) {\n var allowedElements = swalStringParams.concat(['swal-param', 'swal-function-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);\n Array.from(templateContent.children).forEach(function (el) {\n var tagName = el.tagName.toLowerCase();\n if (!allowedElements.includes(tagName)) {\n warn(\"Unrecognized element <\".concat(tagName, \">\"));\n }\n });\n };\n\n /**\n * @param {HTMLElement} el\n * @param {string[]} allowedAttributes\n */\n var showWarningsForAttributes = function showWarningsForAttributes(el, allowedAttributes) {\n Array.from(el.attributes).forEach(function (attribute) {\n if (allowedAttributes.indexOf(attribute.name) === -1) {\n warn([\"Unrecognized attribute \\\"\".concat(attribute.name, \"\\\" on <\").concat(el.tagName.toLowerCase(), \">.\"), \"\".concat(allowedAttributes.length ? \"Allowed attributes are: \".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]);\n }\n });\n };\n\n var SHOW_CLASS_TIMEOUT = 10;\n\n /**\n * Open popup, add necessary classes and styles, fix scrollbar\n *\n * @param {SweetAlertOptions} params\n */\n var openPopup = function openPopup(params) {\n var container = getContainer();\n var popup = getPopup();\n if (typeof params.willOpen === 'function') {\n params.willOpen(popup);\n }\n var bodyStyles = window.getComputedStyle(document.body);\n var initialBodyOverflow = bodyStyles.overflowY;\n addClasses(container, popup, params);\n\n // scrolling is 'hidden' until animation is done, after that 'auto'\n setTimeout(function () {\n setScrollingVisibility(container, popup);\n }, SHOW_CLASS_TIMEOUT);\n if (isModal()) {\n fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow);\n setAriaHidden();\n }\n if (!isToast() && !globalState.previousActiveElement) {\n globalState.previousActiveElement = document.activeElement;\n }\n if (typeof params.didOpen === 'function') {\n setTimeout(function () {\n return params.didOpen(popup);\n });\n }\n removeClass(container, swalClasses['no-transition']);\n };\n\n /**\n * @param {AnimationEvent} event\n */\n var _swalOpenAnimationFinished = function swalOpenAnimationFinished(event) {\n var popup = getPopup();\n if (event.target !== popup || !animationEndEvent) {\n return;\n }\n var container = getContainer();\n popup.removeEventListener(animationEndEvent, _swalOpenAnimationFinished);\n container.style.overflowY = 'auto';\n };\n\n /**\n * @param {HTMLElement} container\n * @param {HTMLElement} popup\n */\n var setScrollingVisibility = function setScrollingVisibility(container, popup) {\n if (animationEndEvent && hasCssAnimation(popup)) {\n container.style.overflowY = 'hidden';\n popup.addEventListener(animationEndEvent, _swalOpenAnimationFinished);\n } else {\n container.style.overflowY = 'auto';\n }\n };\n\n /**\n * @param {HTMLElement} container\n * @param {boolean} scrollbarPadding\n * @param {string} initialBodyOverflow\n */\n var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding, initialBodyOverflow) {\n iOSfix();\n if (scrollbarPadding && initialBodyOverflow !== 'hidden') {\n replaceScrollbarWithPadding(initialBodyOverflow);\n }\n\n // sweetalert2/issues/1247\n setTimeout(function () {\n container.scrollTop = 0;\n });\n };\n\n /**\n * @param {HTMLElement} container\n * @param {HTMLElement} popup\n * @param {SweetAlertOptions} params\n */\n var addClasses = function addClasses(container, popup, params) {\n addClass(container, params.showClass.backdrop);\n if (params.animation) {\n // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059\n popup.style.setProperty('opacity', '0', 'important');\n show(popup, 'grid');\n setTimeout(function () {\n // Animate popup right after showing it\n addClass(popup, params.showClass.popup);\n // and remove the opacity workaround\n popup.style.removeProperty('opacity');\n }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062\n } else {\n show(popup, 'grid');\n }\n addClass([document.documentElement, document.body], swalClasses.shown);\n if (params.heightAuto && params.backdrop && !params.toast) {\n addClass([document.documentElement, document.body], swalClasses['height-auto']);\n }\n };\n\n var defaultInputValidators = {\n /**\n * @param {string} string\n * @param {string} [validationMessage]\n * @returns {Promise}\n */\n email: function email(string, validationMessage) {\n return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]+$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');\n },\n /**\n * @param {string} string\n * @param {string} [validationMessage]\n * @returns {Promise}\n */\n url: function url(string, validationMessage) {\n // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013\n return /^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-z]{2,63}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');\n }\n };\n\n /**\n * @param {SweetAlertOptions} params\n */\n function setDefaultInputValidators(params) {\n // Use default `inputValidator` for supported input types if not provided\n if (params.inputValidator) {\n return;\n }\n if (params.input === 'email') {\n params.inputValidator = defaultInputValidators['email'];\n }\n if (params.input === 'url') {\n params.inputValidator = defaultInputValidators['url'];\n }\n }\n\n /**\n * @param {SweetAlertOptions} params\n */\n function validateCustomTargetElement(params) {\n // Determine if the custom target element is valid\n if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {\n warn('Target parameter is not valid, defaulting to \"body\"');\n params.target = 'body';\n }\n }\n\n /**\n * Set type, text and actions on popup\n *\n * @param {SweetAlertOptions} params\n */\n function setParameters(params) {\n setDefaultInputValidators(params);\n\n // showLoaderOnConfirm && preConfirm\n if (params.showLoaderOnConfirm && !params.preConfirm) {\n warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\\n' + 'https://sweetalert2.github.io/#ajax-request');\n }\n validateCustomTargetElement(params);\n\n // Replace newlines with in title\n if (typeof params.title === 'string') {\n params.title = params.title.split('\\n').join(' ');\n }\n init(params);\n }\n\n /** @type {SweetAlert} */\n var currentInstance;\n var _promise = /*#__PURE__*/new WeakMap();\n var SweetAlert = /*#__PURE__*/function () {\n /**\n * @param {...any} args\n * @this {SweetAlert}\n */\n function SweetAlert() {\n _classCallCheck(this, SweetAlert);\n /**\n * @type {Promise}\n */\n _classPrivateFieldInitSpec(this, _promise, void 0);\n // Prevent run in Node env\n if (typeof window === 'undefined') {\n return;\n }\n currentInstance = this;\n\n // @ts-ignore\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var outerParams = Object.freeze(this.constructor.argsToParams(args));\n\n /** @type {Readonly} */\n this.params = outerParams;\n\n /** @type {boolean} */\n this.isAwaitingPromise = false;\n _classPrivateFieldSet2(_promise, this, this._main(currentInstance.params));\n }\n return _createClass(SweetAlert, [{\n key: \"_main\",\n value: function _main(userParams) {\n var mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n showWarningsForParams(Object.assign({}, mixinParams, userParams));\n if (globalState.currentInstance) {\n var swalPromiseResolve = privateMethods.swalPromiseResolve.get(globalState.currentInstance);\n var isAwaitingPromise = globalState.currentInstance.isAwaitingPromise;\n globalState.currentInstance._destroy();\n if (!isAwaitingPromise) {\n swalPromiseResolve({\n isDismissed: true\n });\n }\n if (isModal()) {\n unsetAriaHidden();\n }\n }\n globalState.currentInstance = currentInstance;\n var innerParams = prepareParams(userParams, mixinParams);\n setParameters(innerParams);\n Object.freeze(innerParams);\n\n // clear the previous timer\n if (globalState.timeout) {\n globalState.timeout.stop();\n delete globalState.timeout;\n }\n\n // clear the restore focus timeout\n clearTimeout(globalState.restoreFocusTimeout);\n var domCache = populateDomCache(currentInstance);\n render(currentInstance, innerParams);\n privateProps.innerParams.set(currentInstance, innerParams);\n return swalPromise(currentInstance, domCache, innerParams);\n }\n\n // `catch` cannot be the name of a module export, so we define our thenable methods here instead\n }, {\n key: \"then\",\n value: function then(onFulfilled) {\n return _classPrivateFieldGet2(_promise, this).then(onFulfilled);\n }\n }, {\n key: \"finally\",\n value: function _finally(onFinally) {\n return _classPrivateFieldGet2(_promise, this)[\"finally\"](onFinally);\n }\n }]);\n }();\n\n /**\n * @param {SweetAlert} instance\n * @param {DomCache} domCache\n * @param {SweetAlertOptions} innerParams\n * @returns {Promise}\n */\n var swalPromise = function swalPromise(instance, domCache, innerParams) {\n return new Promise(function (resolve, reject) {\n // functions to handle all closings/dismissals\n /**\n * @param {DismissReason} dismiss\n */\n var dismissWith = function dismissWith(dismiss) {\n instance.close({\n isDismissed: true,\n dismiss: dismiss\n });\n };\n privateMethods.swalPromiseResolve.set(instance, resolve);\n privateMethods.swalPromiseReject.set(instance, reject);\n domCache.confirmButton.onclick = function () {\n handleConfirmButtonClick(instance);\n };\n domCache.denyButton.onclick = function () {\n handleDenyButtonClick(instance);\n };\n domCache.cancelButton.onclick = function () {\n handleCancelButtonClick(instance, dismissWith);\n };\n domCache.closeButton.onclick = function () {\n dismissWith(DismissReason.close);\n };\n handlePopupClick(innerParams, domCache, dismissWith);\n addKeydownHandler(globalState, innerParams, dismissWith);\n handleInputOptionsAndValue(instance, innerParams);\n openPopup(innerParams);\n setupTimer(globalState, innerParams, dismissWith);\n initFocus(domCache, innerParams);\n\n // Scroll container to top on open (#1247, #1946)\n setTimeout(function () {\n domCache.container.scrollTop = 0;\n });\n });\n };\n\n /**\n * @param {SweetAlertOptions} userParams\n * @param {SweetAlertOptions} mixinParams\n * @returns {SweetAlertOptions}\n */\n var prepareParams = function prepareParams(userParams, mixinParams) {\n var templateParams = getTemplateParams(userParams);\n var params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131\n params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);\n params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);\n if (params.animation === false) {\n params.showClass = {\n backdrop: 'swal2-noanimation'\n };\n params.hideClass = {};\n }\n return params;\n };\n\n /**\n * @param {SweetAlert} instance\n * @returns {DomCache}\n */\n var populateDomCache = function populateDomCache(instance) {\n var domCache = {\n popup: getPopup(),\n container: getContainer(),\n actions: getActions(),\n confirmButton: getConfirmButton(),\n denyButton: getDenyButton(),\n cancelButton: getCancelButton(),\n loader: getLoader(),\n closeButton: getCloseButton(),\n validationMessage: getValidationMessage(),\n progressSteps: getProgressSteps()\n };\n privateProps.domCache.set(instance, domCache);\n return domCache;\n };\n\n /**\n * @param {GlobalState} globalState\n * @param {SweetAlertOptions} innerParams\n * @param {Function} dismissWith\n */\n var setupTimer = function setupTimer(globalState, innerParams, dismissWith) {\n var timerProgressBar = getTimerProgressBar();\n hide(timerProgressBar);\n if (innerParams.timer) {\n globalState.timeout = new Timer(function () {\n dismissWith('timer');\n delete globalState.timeout;\n }, innerParams.timer);\n if (innerParams.timerProgressBar) {\n show(timerProgressBar);\n applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');\n setTimeout(function () {\n if (globalState.timeout && globalState.timeout.running) {\n // timer can be already stopped or unset at this point\n animateTimerProgressBar(innerParams.timer);\n }\n });\n }\n }\n };\n\n /**\n * Initialize focus in the popup:\n *\n * 1. If `toast` is `true`, don't steal focus from the document.\n * 2. Else if there is an [autofocus] element, focus it.\n * 3. Else if `focusConfirm` is `true` and confirm button is visible, focus it.\n * 4. Else if `focusDeny` is `true` and deny button is visible, focus it.\n * 5. Else if `focusCancel` is `true` and cancel button is visible, focus it.\n * 6. Else focus the first focusable element in a popup (if any).\n *\n * @param {DomCache} domCache\n * @param {SweetAlertOptions} innerParams\n */\n var initFocus = function initFocus(domCache, innerParams) {\n if (innerParams.toast) {\n return;\n }\n // TODO: this is dumb, remove `allowEnterKey` param in the next major version\n if (!callIfFunction(innerParams.allowEnterKey)) {\n warnAboutDeprecation('allowEnterKey');\n blurActiveElement();\n return;\n }\n if (focusAutofocus(domCache)) {\n return;\n }\n if (focusButton(domCache, innerParams)) {\n return;\n }\n setFocus(-1, 1);\n };\n\n /**\n * @param {DomCache} domCache\n * @returns {boolean}\n */\n var focusAutofocus = function focusAutofocus(domCache) {\n var autofocusElements = domCache.popup.querySelectorAll('[autofocus]');\n var _iterator = _createForOfIteratorHelper(autofocusElements),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var autofocusElement = _step.value;\n if (autofocusElement instanceof HTMLElement && isVisible$1(autofocusElement)) {\n autofocusElement.focus();\n return true;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return false;\n };\n\n /**\n * @param {DomCache} domCache\n * @param {SweetAlertOptions} innerParams\n * @returns {boolean}\n */\n var focusButton = function focusButton(domCache, innerParams) {\n if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) {\n domCache.denyButton.focus();\n return true;\n }\n if (innerParams.focusCancel && isVisible$1(domCache.cancelButton)) {\n domCache.cancelButton.focus();\n return true;\n }\n if (innerParams.focusConfirm && isVisible$1(domCache.confirmButton)) {\n domCache.confirmButton.focus();\n return true;\n }\n return false;\n };\n var blurActiveElement = function blurActiveElement() {\n if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {\n document.activeElement.blur();\n }\n };\n\n // Dear russian users visiting russian sites. Let's have fun.\n if (typeof window !== 'undefined' && /^ru\\b/.test(navigator.language) && location.host.match(/\\.(ru|su|by|xn--p1ai)$/)) {\n var now = new Date();\n var initiationDate = localStorage.getItem('swal-initiation');\n if (!initiationDate) {\n localStorage.setItem('swal-initiation', \"\".concat(now));\n } else if ((now.getTime() - Date.parse(initiationDate)) / (1000 * 60 * 60 * 24) > 3) {\n setTimeout(function () {\n document.body.style.pointerEvents = 'none';\n var ukrainianAnthem = document.createElement('audio');\n ukrainianAnthem.src = 'https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3';\n ukrainianAnthem.loop = true;\n document.body.appendChild(ukrainianAnthem);\n setTimeout(function () {\n ukrainianAnthem.play()[\"catch\"](function () {\n // ignore\n });\n }, 2500);\n }, 500);\n }\n }\n\n // Assign instance methods from src/instanceMethods/*.js to prototype\n SweetAlert.prototype.disableButtons = disableButtons;\n SweetAlert.prototype.enableButtons = enableButtons;\n SweetAlert.prototype.getInput = getInput;\n SweetAlert.prototype.disableInput = disableInput;\n SweetAlert.prototype.enableInput = enableInput;\n SweetAlert.prototype.hideLoading = hideLoading;\n SweetAlert.prototype.disableLoading = hideLoading;\n SweetAlert.prototype.showValidationMessage = showValidationMessage;\n SweetAlert.prototype.resetValidationMessage = resetValidationMessage;\n SweetAlert.prototype.close = close;\n SweetAlert.prototype.closePopup = close;\n SweetAlert.prototype.closeModal = close;\n SweetAlert.prototype.closeToast = close;\n SweetAlert.prototype.rejectPromise = rejectPromise;\n SweetAlert.prototype.update = update;\n SweetAlert.prototype._destroy = _destroy;\n\n // Assign static methods from src/staticMethods/*.js to constructor\n Object.assign(SweetAlert, staticMethods);\n\n // Proxy to instance methods to constructor, for now, for backwards compatibility\n Object.keys(instanceMethods).forEach(function (key) {\n /**\n * @param {...any} args\n * @returns {any | undefined}\n */\n SweetAlert[key] = function () {\n if (currentInstance && currentInstance[key]) {\n var _currentInstance;\n return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments);\n }\n return null;\n };\n });\n SweetAlert.DismissReason = DismissReason;\n SweetAlert.version = '11.12.4';\n\n var Swal = SweetAlert;\n // @ts-ignore\n Swal[\"default\"] = Swal;\n\n return Swal;\n\n}));\nif (typeof this !== 'undefined' && this.Sweetalert2){this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}\n\"undefined\"!=typeof document&&function(e,t){var n=e.createElement(\"style\");if(e.getElementsByTagName(\"head\")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,\".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\\\"top-start top top-end\\\" \\\"center-start center center-end\\\" \\\"bottom-start bottom-center bottom-end\\\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus-visible{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:0;padding:1em 1.6em .3em;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\\\"!\\\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}\");","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Much of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// Many optimizations have been made, so the bundle size is ultimately smaller but performance is similar.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var u = ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([c], { type: 'text/javascript' })));\n var w = new Worker(u);\n w.onerror = function (e) { return cb(e.error, null); };\n w.onmessage = function (e) { return cb(null, e.data); };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i)\n ++l[cd[i] - 1];\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i)\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) >> 0;\n return ((d[o] | (d[o + 1] << 8)) >>> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) >> 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >>> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p / 8) >> 0) + (p & 7 && 1); };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v instanceof u16 ? u16 : v instanceof u32 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n st.f = final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n if (!noSt && pos + tl * (clb + 7) > tbts)\n break;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n throw 'invalid block type';\n if (pos > tbts)\n throw 'unexpected EOF';\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var mxa = lbt + dbt + 18;\n while (noSt || pos + mxa < tbts) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts)\n throw 'unexpected EOF';\n if (!c)\n throw 'invalid length/literal';\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n throw 'invalid distance';\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts)\n throw 'unexpected EOF';\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = pos, st.b = bt;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) >> 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) >> 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [new u8(0), 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.floor(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e < s) {\n // write full block\n pos = wfblk(w, pos, dat.subarray(i, e));\n }\n else {\n // write final block\n w[i] = lst;\n pos = wfblk(w, pos, dat.subarray(i, s));\n }\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768\n var imod = i & 32767;\n // previous index with this value\n var pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst)\n pos = wfblk(w, pos, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new u32(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && 0xEDB88320) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = 0xFFFFFFFF;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return c ^ 0xFFFFFFFF; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 5552, l);\n for (; i < e; ++i)\n n += d[i], m += n;\n n %= 65521, m %= 65521;\n }\n a = n, b = m;\n },\n d: function () { return ((a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8)) + ((a & 255) << 23) * 2; }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/ /g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k] instanceof u8 || v[k] instanceof u16 || v[k] instanceof u32)\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, hMap, max, bits, bits16, shft, slc, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n if (!opts.consume)\n dat = new u8(dat);\n w.postMessage([dat, opts], [dat.buffer]);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (t)\n throw 'stream finished';\n if (!strm.ondata)\n throw 'no stream handler';\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16)) + (d[b + 3] << 23) * 2; };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n throw 'invalid gzip data';\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) + (2 * (d[l - 1] << 23));\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n throw 'invalid zlib data';\n if (d[1] & 32)\n throw 'invalid zlib data: preset dictionaries not supported';\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n if (opts === void 0) { opts = {}; }\n return dopt(data, opts, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) >> 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (opts === void 0) { opts = {}; }\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = gzs(this.p);\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n throw 'invalid gzip stream';\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (opts === void 0) { opts = {}; }\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n throw 'invalid zlib stream';\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no stream handler';\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k;\n if (val instanceof u8)\n t[n] = [val, o];\n else if (Array.isArray(val))\n t[n] = [val[0], mrg(o, val[1])];\n else\n fltn(val, n + '/', t, o);\n }\n};\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n var r = '';\n if (!latin1 && typeof TextDecoder != 'undefined')\n return new TextDecoder().decode(dat);\n for (var i = 0; i < dat.length;) {\n var c = dat[i++];\n if (c < 128 || latin1)\n r += String.fromCharCode(c);\n else if (c < 224)\n r += String.fromCharCode((c & 31) << 6 | (dat[i++] & 63));\n else if (c < 240)\n r += String.fromCharCode((c & 15) << 12 | (dat[i++] & 63) << 6 | (dat[i++] & 63));\n else\n c = ((c & 15) << 18 | (dat[i++] & 63) << 12 | (dat[i++] & 63) << 6 | (dat[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n return r;\n}\n;\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;\n var _a = z ? z64e(d, es) : [b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b4(d, b + 12), b4(d, b + 4), b4(d, b + 20)];\n};\n// write zip header\nvar wzh = function (d, b, c, cmp, su, fn, u, o, ce, t) {\n var fl = fn.length, l = cmp.length;\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b] = 20, b += 2;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (t == 8 && (o.level == 1 ? 6 : o.level < 6 ? 4 : o.level == 9 ? 2 : 0)), d[b++] = u && 8;\n d[b] = t, b += 2;\n var dt = new Date(o.mtime || Date.now()), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n throw 'date not in range 1980-2099';\n wbytes(d, b, ((y << 24) * 2) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1));\n b += 4;\n wbytes(d, b, c);\n wbytes(d, b + 4, l);\n wbytes(d, b + 8, su);\n wbytes(d, b + 12, fl), b += 16; // skip extra field, comment\n if (ce != null)\n wbytes(d, b += 10, ce), b += 4;\n d.set(fn, b);\n b += fl;\n if (ce == null)\n d.set(cmp, b);\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n wzh(out, tot, f.c, f.d, f.m, f.n, f.u, f.p, null, f.t);\n wzh(out, o, f.c, f.d, f.m, f.n, f.u, f.p, tot, f.t), o += 46 + f.n.length, tot += 30 + f.n.length + f.d.length;\n }\n catch (e) {\n return cb(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cb(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), m = file.length;\n c.p(file);\n var n = strToU8(fn), s = n.length;\n var t = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n var l = d.length;\n files[i] = {\n t: t,\n d: d,\n m: m,\n c: c.d(),\n u: fn.length != l,\n n: n,\n p: p\n };\n o += 30 + s + l;\n tot += 76 + 2 * s + l;\n if (!--lft)\n cbf();\n }\n };\n if (n.length > 65535)\n cbl('filename too long', null);\n if (!t)\n cbl(null, file);\n else if (m < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (opts === void 0) { opts = {}; }\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var t = p.level == 0 ? 0 : 8;\n var n = strToU8(fn), s = n.length;\n if (n.length > 65535)\n throw 'filename too long';\n var d = t ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push({\n t: t,\n d: d,\n m: file.length,\n c: c.d(),\n u: fn.length != s,\n n: n,\n o: o,\n p: p\n });\n o += 30 + s + l;\n tot += 76 + 2 * s + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f.c, f.d, f.m, f.n, f.u, f.p, null, f.t);\n wzh(out, o, f.c, f.d, f.m, f.n, f.u, f.p, f.o, f.t), o += 46 + f.n.length;\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Asynchronously decompresses a ZIP archive\n * @param data The raw compressed ZIP file\n * @param cb The callback to call with the decompressed files\n * @returns A function that can be used to immediately terminate the unzipping\n */\nexport function unzip(data, cb) {\n if (typeof cb != 'function')\n throw 'no callback';\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cb('invalid zip file', null);\n return;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (!lft)\n cb(null, {});\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n throw 'invalid zip file';\n c = lft = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var _loop_2 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n files[fn] = d;\n if (!--lft)\n cb(null, files);\n }\n };\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl('unknown compression type ' + c_1, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_2(i);\n }\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @returns The decompressed files\n */\nexport function unzipSync(data) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n throw 'invalid zip file';\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n throw 'invalid zip file';\n c = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n throw 'unknown compression type ' + c_2;\n }\n return files;\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var X32WordArray = C_lib.WordArray;\n\n\t /**\n\t * x64 namespace.\n\t */\n\t var C_x64 = C.x64 = {};\n\n\t /**\n\t * A 64-bit word.\n\t */\n\t var X64Word = C_x64.Word = Base.extend({\n\t /**\n\t * Initializes a newly created 64-bit word.\n\t *\n\t * @param {number} high The high 32 bits.\n\t * @param {number} low The low 32 bits.\n\t *\n\t * @example\n\t *\n\t * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);\n\t */\n\t init: function (high, low) {\n\t this.high = high;\n\t this.low = low;\n\t }\n\n\t /**\n\t * Bitwise NOTs this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after negating.\n\t *\n\t * @example\n\t *\n\t * var negated = x64Word.not();\n\t */\n\t // not: function () {\n\t // var high = ~this.high;\n\t // var low = ~this.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ANDs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to AND with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ANDing.\n\t *\n\t * @example\n\t *\n\t * var anded = x64Word.and(anotherX64Word);\n\t */\n\t // and: function (word) {\n\t // var high = this.high & word.high;\n\t // var low = this.low & word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to OR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ORing.\n\t *\n\t * @example\n\t *\n\t * var ored = x64Word.or(anotherX64Word);\n\t */\n\t // or: function (word) {\n\t // var high = this.high | word.high;\n\t // var low = this.low | word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise XORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to XOR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after XORing.\n\t *\n\t * @example\n\t *\n\t * var xored = x64Word.xor(anotherX64Word);\n\t */\n\t // xor: function (word) {\n\t // var high = this.high ^ word.high;\n\t // var low = this.low ^ word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftL(25);\n\t */\n\t // shiftL: function (n) {\n\t // if (n < 32) {\n\t // var high = (this.high << n) | (this.low >>> (32 - n));\n\t // var low = this.low << n;\n\t // } else {\n\t // var high = this.low << (n - 32);\n\t // var low = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftR(7);\n\t */\n\t // shiftR: function (n) {\n\t // if (n < 32) {\n\t // var low = (this.low >>> n) | (this.high << (32 - n));\n\t // var high = this.high >>> n;\n\t // } else {\n\t // var low = this.high >>> (n - 32);\n\t // var high = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotL(25);\n\t */\n\t // rotL: function (n) {\n\t // return this.shiftL(n).or(this.shiftR(64 - n));\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotR(7);\n\t */\n\t // rotR: function (n) {\n\t // return this.shiftR(n).or(this.shiftL(64 - n));\n\t // },\n\n\t /**\n\t * Adds this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to add with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after adding.\n\t *\n\t * @example\n\t *\n\t * var added = x64Word.add(anotherX64Word);\n\t */\n\t // add: function (word) {\n\t // var low = (this.low + word.low) | 0;\n\t // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;\n\t // var high = (this.high + word.high + carry) | 0;\n\n\t // return X64Word.create(high, low);\n\t // }\n\t });\n\n\t /**\n\t * An array of 64-bit words.\n\t *\n\t * @property {Array} words The array of CryptoJS.x64.Word objects.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var X64WordArray = C_x64.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create();\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ]);\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ], 10);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 8;\n\t }\n\t },\n\n\t /**\n\t * Converts this 64-bit word array to a 32-bit word array.\n\t *\n\t * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.\n\t *\n\t * @example\n\t *\n\t * var x32WordArray = x64WordArray.toX32();\n\t */\n\t toX32: function () {\n\t // Shortcuts\n\t var x64Words = this.words;\n\t var x64WordsLength = x64Words.length;\n\n\t // Convert\n\t var x32Words = [];\n\t for (var i = 0; i < x64WordsLength; i++) {\n\t var x64Word = x64Words[i];\n\t x32Words.push(x64Word.high);\n\t x32Words.push(x64Word.low);\n\t }\n\n\t return X32WordArray.create(x32Words, this.sigBytes);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {X64WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = x64WordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\n\t // Clone \"words\" array\n\t var words = clone.words = this.words.slice(0);\n\n\t // Clone each X64Word object\n\t var wordsLength = words.length;\n\t for (var i = 0; i < wordsLength; i++) {\n\t words[i] = words[i].clone();\n\t }\n\n\t return clone;\n\t }\n\t });\n\t}());\n\n\n\treturn CryptoJS;\n\n}));","/*!\n * \n * jsPDF AutoTable plugin v3.8.2\n *\n * Copyright (c) 2024 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable\n * Licensed under the MIT License.\n * http://opensource.org/licenses/mit-license\n *\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory((function webpackLoadOptionalExternalModule() { try { return require(\"jspdf\"); } catch(e) {} }()));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jspdf\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory((function webpackLoadOptionalExternalModule() { try { return require(\"jspdf\"); } catch(e) {} }())) : factory(root[\"jspdf\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(typeof globalThis !== 'undefined' ? globalThis : typeof this !== 'undefined' ? this : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : global , function(__WEBPACK_EXTERNAL_MODULE__964__) {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 172:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.CellHookData = exports.HookData = void 0;\nvar HookData = /** @class */ (function () {\n function HookData(doc, table, cursor) {\n this.table = table;\n this.pageNumber = table.pageNumber;\n this.pageCount = this.pageNumber;\n this.settings = table.settings;\n this.cursor = cursor;\n this.doc = doc.getDocument();\n }\n return HookData;\n}());\nexports.HookData = HookData;\nvar CellHookData = /** @class */ (function (_super) {\n __extends(CellHookData, _super);\n function CellHookData(doc, table, cell, row, column, cursor) {\n var _this = _super.call(this, doc, table, cursor) || this;\n _this.cell = cell;\n _this.row = row;\n _this.column = column;\n _this.section = row.section;\n return _this;\n }\n return CellHookData;\n}(HookData));\nexports.CellHookData = CellHookData;\n\n\n/***/ }),\n\n/***/ 340:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar htmlParser_1 = __webpack_require__(4);\nvar autoTableText_1 = __webpack_require__(136);\nvar documentHandler_1 = __webpack_require__(744);\nvar inputParser_1 = __webpack_require__(776);\nvar tableDrawer_1 = __webpack_require__(664);\nvar tableCalculator_1 = __webpack_require__(972);\nfunction default_1(jsPDF) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n jsPDF.API.autoTable = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var options;\n if (args.length === 1) {\n options = args[0];\n }\n else {\n console.error('Use of deprecated autoTable initiation');\n options = args[2] || {};\n options.columns = args[0];\n options.body = args[1];\n }\n var input = (0, inputParser_1.parseInput)(this, options);\n var table = (0, tableCalculator_1.createTable)(this, input);\n (0, tableDrawer_1.drawTable)(this, table);\n return this;\n };\n // Assign false to enable `doc.lastAutoTable.finalY || 40` sugar\n jsPDF.API.lastAutoTable = false;\n jsPDF.API.previousAutoTable = false; // deprecated in v3\n jsPDF.API.autoTable.previous = false; // deprecated in v3\n jsPDF.API.autoTableText = function (text, x, y, styles) {\n (0, autoTableText_1.default)(text, x, y, styles, this);\n };\n jsPDF.API.autoTableSetDefaults = function (defaults) {\n documentHandler_1.DocHandler.setDefaults(defaults, this);\n return this;\n };\n jsPDF.autoTableSetDefaults = function (defaults, doc) {\n documentHandler_1.DocHandler.setDefaults(defaults, doc);\n };\n jsPDF.API.autoTableHtmlToJson = function (tableElem, includeHiddenElements) {\n var _a;\n if (includeHiddenElements === void 0) { includeHiddenElements = false; }\n if (typeof window === 'undefined') {\n console.error('Cannot run autoTableHtmlToJson in non browser environment');\n return null;\n }\n var doc = new documentHandler_1.DocHandler(this);\n var _b = (0, htmlParser_1.parseHtml)(doc, tableElem, window, includeHiddenElements, false), head = _b.head, body = _b.body;\n var columns = ((_a = head[0]) === null || _a === void 0 ? void 0 : _a.map(function (c) { return c.content; })) || [];\n return { columns: columns, rows: body, data: body };\n };\n /**\n * @deprecated\n */\n jsPDF.API.autoTableEndPosY = function () {\n console.error('Use of deprecated function: autoTableEndPosY. Use doc.lastAutoTable.finalY instead.');\n var prev = this.lastAutoTable;\n if (prev && prev.finalY) {\n return prev.finalY;\n }\n else {\n return 0;\n }\n };\n /**\n * @deprecated\n */\n jsPDF.API.autoTableAddPageContent = function (hook) {\n console.error('Use of deprecated function: autoTableAddPageContent. Use jsPDF.autoTableSetDefaults({didDrawPage: () => {}}) instead.');\n if (!jsPDF.API.autoTable.globalDefaults) {\n jsPDF.API.autoTable.globalDefaults = {};\n }\n jsPDF.API.autoTable.globalDefaults.addPageContent = hook;\n return this;\n };\n /**\n * @deprecated\n */\n jsPDF.API.autoTableAddPage = function () {\n console.error('Use of deprecated function: autoTableAddPage. Use doc.addPage()');\n this.addPage();\n return this;\n };\n}\nexports[\"default\"] = default_1;\n\n\n/***/ }),\n\n/***/ 136:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Improved text function with halign and valign support\n * Inspiration from: http://stackoverflow.com/questions/28327510/align-text-right-using-jspdf/28433113#28433113\n */\nfunction default_1(text, x, y, styles, doc) {\n styles = styles || {};\n var PHYSICAL_LINE_HEIGHT = 1.15;\n var k = doc.internal.scaleFactor;\n var fontSize = doc.internal.getFontSize() / k;\n var lineHeightFactor = doc.getLineHeightFactor\n ? doc.getLineHeightFactor()\n : PHYSICAL_LINE_HEIGHT;\n var lineHeight = fontSize * lineHeightFactor;\n var splitRegex = /\\r\\n|\\r|\\n/g;\n var splitText = '';\n var lineCount = 1;\n if (styles.valign === 'middle' ||\n styles.valign === 'bottom' ||\n styles.halign === 'center' ||\n styles.halign === 'right') {\n splitText = typeof text === 'string' ? text.split(splitRegex) : text;\n lineCount = splitText.length || 1;\n }\n // Align the top\n y += fontSize * (2 - PHYSICAL_LINE_HEIGHT);\n if (styles.valign === 'middle')\n y -= (lineCount / 2) * lineHeight;\n else if (styles.valign === 'bottom')\n y -= lineCount * lineHeight;\n if (styles.halign === 'center' || styles.halign === 'right') {\n var alignSize = fontSize;\n if (styles.halign === 'center')\n alignSize *= 0.5;\n if (splitText && lineCount >= 1) {\n for (var iLine = 0; iLine < splitText.length; iLine++) {\n doc.text(splitText[iLine], x - doc.getStringUnitWidth(splitText[iLine]) * alignSize, y);\n y += lineHeight;\n }\n return doc;\n }\n x -= doc.getStringUnitWidth(text) * alignSize;\n }\n if (styles.halign === 'justify') {\n doc.text(text, x, y, {\n maxWidth: styles.maxWidth || 100,\n align: 'justify',\n });\n }\n else {\n doc.text(text, x, y);\n }\n return doc;\n}\nexports[\"default\"] = default_1;\n\n\n/***/ }),\n\n/***/ 420:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.getPageAvailableWidth = exports.parseSpacing = exports.getFillStyle = exports.addTableBorder = exports.getStringWidth = void 0;\nfunction getStringWidth(text, styles, doc) {\n doc.applyStyles(styles, true);\n var textArr = Array.isArray(text) ? text : [text];\n var widestLineWidth = textArr\n .map(function (text) { return doc.getTextWidth(text); })\n .reduce(function (a, b) { return Math.max(a, b); }, 0);\n return widestLineWidth;\n}\nexports.getStringWidth = getStringWidth;\nfunction addTableBorder(doc, table, startPos, cursor) {\n var lineWidth = table.settings.tableLineWidth;\n var lineColor = table.settings.tableLineColor;\n doc.applyStyles({ lineWidth: lineWidth, lineColor: lineColor });\n var fillStyle = getFillStyle(lineWidth, false);\n if (fillStyle) {\n doc.rect(startPos.x, startPos.y, table.getWidth(doc.pageSize().width), cursor.y - startPos.y, fillStyle);\n }\n}\nexports.addTableBorder = addTableBorder;\nfunction getFillStyle(lineWidth, fillColor) {\n var drawLine = lineWidth > 0;\n var drawBackground = fillColor || fillColor === 0;\n if (drawLine && drawBackground) {\n return 'DF'; // Fill then stroke\n }\n else if (drawLine) {\n return 'S'; // Only stroke (transparent background)\n }\n else if (drawBackground) {\n return 'F'; // Only fill, no stroke\n }\n else {\n return null;\n }\n}\nexports.getFillStyle = getFillStyle;\nfunction parseSpacing(value, defaultValue) {\n var _a, _b, _c, _d;\n value = value || defaultValue;\n if (Array.isArray(value)) {\n if (value.length >= 4) {\n return {\n top: value[0],\n right: value[1],\n bottom: value[2],\n left: value[3],\n };\n }\n else if (value.length === 3) {\n return {\n top: value[0],\n right: value[1],\n bottom: value[2],\n left: value[1],\n };\n }\n else if (value.length === 2) {\n return {\n top: value[0],\n right: value[1],\n bottom: value[0],\n left: value[1],\n };\n }\n else if (value.length === 1) {\n value = value[0];\n }\n else {\n value = defaultValue;\n }\n }\n if (typeof value === 'object') {\n if (typeof value.vertical === 'number') {\n value.top = value.vertical;\n value.bottom = value.vertical;\n }\n if (typeof value.horizontal === 'number') {\n value.right = value.horizontal;\n value.left = value.horizontal;\n }\n return {\n left: (_a = value.left) !== null && _a !== void 0 ? _a : defaultValue,\n top: (_b = value.top) !== null && _b !== void 0 ? _b : defaultValue,\n right: (_c = value.right) !== null && _c !== void 0 ? _c : defaultValue,\n bottom: (_d = value.bottom) !== null && _d !== void 0 ? _d : defaultValue,\n };\n }\n if (typeof value !== 'number') {\n value = defaultValue;\n }\n return { top: value, right: value, bottom: value, left: value };\n}\nexports.parseSpacing = parseSpacing;\nfunction getPageAvailableWidth(doc, table) {\n var margins = parseSpacing(table.settings.margin, 0);\n return doc.pageSize().width - (margins.left + margins.right);\n}\nexports.getPageAvailableWidth = getPageAvailableWidth;\n\n\n/***/ }),\n\n/***/ 796:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.getTheme = exports.defaultStyles = exports.HtmlRowInput = void 0;\nvar HtmlRowInput = /** @class */ (function (_super) {\n __extends(HtmlRowInput, _super);\n function HtmlRowInput(element) {\n var _this = _super.call(this) || this;\n _this._element = element;\n return _this;\n }\n return HtmlRowInput;\n}(Array));\nexports.HtmlRowInput = HtmlRowInput;\n// Base style for all themes\nfunction defaultStyles(scaleFactor) {\n return {\n font: 'helvetica', // helvetica, times, courier\n fontStyle: 'normal', // normal, bold, italic, bolditalic\n overflow: 'linebreak', // linebreak, ellipsize, visible or hidden\n fillColor: false, // Either false for transparent, rbg array e.g. [255, 255, 255] or gray level e.g 200\n textColor: 20,\n halign: 'left', // left, center, right, justify\n valign: 'top', // top, middle, bottom\n fontSize: 10,\n cellPadding: 5 / scaleFactor, // number or {top,left,right,left,vertical,horizontal}\n lineColor: 200,\n lineWidth: 0,\n cellWidth: 'auto', // 'auto'|'wrap'|number\n minCellHeight: 0,\n minCellWidth: 0,\n };\n}\nexports.defaultStyles = defaultStyles;\nfunction getTheme(name) {\n var themes = {\n striped: {\n table: { fillColor: 255, textColor: 80, fontStyle: 'normal' },\n head: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },\n body: {},\n foot: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },\n alternateRow: { fillColor: 245 },\n },\n grid: {\n table: {\n fillColor: 255,\n textColor: 80,\n fontStyle: 'normal',\n lineWidth: 0.1,\n },\n head: {\n textColor: 255,\n fillColor: [26, 188, 156],\n fontStyle: 'bold',\n lineWidth: 0,\n },\n body: {},\n foot: {\n textColor: 255,\n fillColor: [26, 188, 156],\n fontStyle: 'bold',\n lineWidth: 0,\n },\n alternateRow: {},\n },\n plain: {\n head: { fontStyle: 'bold' },\n foot: { fontStyle: 'bold' },\n },\n };\n return themes[name];\n}\nexports.getTheme = getTheme;\n\n\n/***/ }),\n\n/***/ 903:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.parseCss = void 0;\n// Limitations\n// - No support for border spacing\n// - No support for transparency\nvar common_1 = __webpack_require__(420);\nfunction parseCss(supportedFonts, element, scaleFactor, style, window) {\n var result = {};\n var pxScaleFactor = 96 / 72;\n var backgroundColor = parseColor(element, function (elem) {\n return window.getComputedStyle(elem)['backgroundColor'];\n });\n if (backgroundColor != null)\n result.fillColor = backgroundColor;\n var textColor = parseColor(element, function (elem) {\n return window.getComputedStyle(elem)['color'];\n });\n if (textColor != null)\n result.textColor = textColor;\n var padding = parsePadding(style, scaleFactor);\n if (padding)\n result.cellPadding = padding;\n var borderColorSide = 'borderTopColor';\n var finalScaleFactor = pxScaleFactor * scaleFactor;\n var btw = style.borderTopWidth;\n if (style.borderBottomWidth === btw &&\n style.borderRightWidth === btw &&\n style.borderLeftWidth === btw) {\n var borderWidth = (parseFloat(btw) || 0) / finalScaleFactor;\n if (borderWidth)\n result.lineWidth = borderWidth;\n }\n else {\n result.lineWidth = {\n top: (parseFloat(style.borderTopWidth) || 0) / finalScaleFactor,\n right: (parseFloat(style.borderRightWidth) || 0) / finalScaleFactor,\n bottom: (parseFloat(style.borderBottomWidth) || 0) / finalScaleFactor,\n left: (parseFloat(style.borderLeftWidth) || 0) / finalScaleFactor,\n };\n // Choose border color of first available side\n // could be improved by supporting object as lineColor\n if (!result.lineWidth.top) {\n if (result.lineWidth.right) {\n borderColorSide = 'borderRightColor';\n }\n else if (result.lineWidth.bottom) {\n borderColorSide = 'borderBottomColor';\n }\n else if (result.lineWidth.left) {\n borderColorSide = 'borderLeftColor';\n }\n }\n }\n console.log(result.lineWidth);\n var borderColor = parseColor(element, function (elem) {\n return window.getComputedStyle(elem)[borderColorSide];\n });\n if (borderColor != null)\n result.lineColor = borderColor;\n var accepted = ['left', 'right', 'center', 'justify'];\n if (accepted.indexOf(style.textAlign) !== -1) {\n result.halign = style.textAlign;\n }\n accepted = ['middle', 'bottom', 'top'];\n if (accepted.indexOf(style.verticalAlign) !== -1) {\n result.valign = style.verticalAlign;\n }\n var res = parseInt(style.fontSize || '');\n if (!isNaN(res))\n result.fontSize = res / pxScaleFactor;\n var fontStyle = parseFontStyle(style);\n if (fontStyle)\n result.fontStyle = fontStyle;\n var font = (style.fontFamily || '').toLowerCase();\n if (supportedFonts.indexOf(font) !== -1) {\n result.font = font;\n }\n return result;\n}\nexports.parseCss = parseCss;\nfunction parseFontStyle(style) {\n var res = '';\n if (style.fontWeight === 'bold' ||\n style.fontWeight === 'bolder' ||\n parseInt(style.fontWeight) >= 700) {\n res = 'bold';\n }\n if (style.fontStyle === 'italic' || style.fontStyle === 'oblique') {\n res += 'italic';\n }\n return res;\n}\nfunction parseColor(element, styleGetter) {\n var cssColor = realColor(element, styleGetter);\n if (!cssColor)\n return null;\n var rgba = cssColor.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d*\\.?\\d*))?\\)$/);\n if (!rgba || !Array.isArray(rgba)) {\n return null;\n }\n var color = [\n parseInt(rgba[1]),\n parseInt(rgba[2]),\n parseInt(rgba[3]),\n ];\n var alpha = parseInt(rgba[4]);\n if (alpha === 0 || isNaN(color[0]) || isNaN(color[1]) || isNaN(color[2])) {\n return null;\n }\n return color;\n}\nfunction realColor(elem, styleGetter) {\n var bg = styleGetter(elem);\n if (bg === 'rgba(0, 0, 0, 0)' ||\n bg === 'transparent' ||\n bg === 'initial' ||\n bg === 'inherit') {\n if (elem.parentElement == null) {\n return null;\n }\n return realColor(elem.parentElement, styleGetter);\n }\n else {\n return bg;\n }\n}\nfunction parsePadding(style, scaleFactor) {\n var val = [\n style.paddingTop,\n style.paddingRight,\n style.paddingBottom,\n style.paddingLeft,\n ];\n var pxScaleFactor = 96 / (72 / scaleFactor);\n var linePadding = (parseInt(style.lineHeight) - parseInt(style.fontSize)) / scaleFactor / 2;\n var inputPadding = val.map(function (n) {\n return parseInt(n || '0') / pxScaleFactor;\n });\n var padding = (0, common_1.parseSpacing)(inputPadding, 0);\n if (linePadding > padding.top) {\n padding.top = linePadding;\n }\n if (linePadding > padding.bottom) {\n padding.bottom = linePadding;\n }\n return padding;\n}\n\n\n/***/ }),\n\n/***/ 744:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DocHandler = void 0;\nvar globalDefaults = {};\nvar DocHandler = /** @class */ (function () {\n function DocHandler(jsPDFDocument) {\n this.jsPDFDocument = jsPDFDocument;\n this.userStyles = {\n // Black for versions of jspdf without getTextColor\n textColor: jsPDFDocument.getTextColor\n ? this.jsPDFDocument.getTextColor()\n : 0,\n fontSize: jsPDFDocument.internal.getFontSize(),\n fontStyle: jsPDFDocument.internal.getFont().fontStyle,\n font: jsPDFDocument.internal.getFont().fontName,\n // 0 for versions of jspdf without getLineWidth\n lineWidth: jsPDFDocument.getLineWidth\n ? this.jsPDFDocument.getLineWidth()\n : 0,\n // Black for versions of jspdf without getDrawColor\n lineColor: jsPDFDocument.getDrawColor\n ? this.jsPDFDocument.getDrawColor()\n : 0,\n };\n }\n DocHandler.setDefaults = function (defaults, doc) {\n if (doc === void 0) { doc = null; }\n if (doc) {\n doc.__autoTableDocumentDefaults = defaults;\n }\n else {\n globalDefaults = defaults;\n }\n };\n DocHandler.unifyColor = function (c) {\n if (Array.isArray(c)) {\n return c;\n }\n else if (typeof c === 'number') {\n return [c, c, c];\n }\n else if (typeof c === 'string') {\n return [c];\n }\n else {\n return null;\n }\n };\n DocHandler.prototype.applyStyles = function (styles, fontOnly) {\n // Font style needs to be applied before font\n // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/632\n var _a, _b, _c;\n if (fontOnly === void 0) { fontOnly = false; }\n if (styles.fontStyle)\n this.jsPDFDocument.setFontStyle &&\n this.jsPDFDocument.setFontStyle(styles.fontStyle);\n var _d = this.jsPDFDocument.internal.getFont(), fontStyle = _d.fontStyle, fontName = _d.fontName;\n if (styles.font)\n fontName = styles.font;\n if (styles.fontStyle) {\n fontStyle = styles.fontStyle;\n var availableFontStyles = this.getFontList()[fontName];\n if (availableFontStyles &&\n availableFontStyles.indexOf(fontStyle) === -1) {\n // Common issue was that the default bold in headers\n // made custom fonts not work. For example:\n // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/653\n this.jsPDFDocument.setFontStyle &&\n this.jsPDFDocument.setFontStyle(availableFontStyles[0]);\n fontStyle = availableFontStyles[0];\n }\n }\n this.jsPDFDocument.setFont(fontName, fontStyle);\n if (styles.fontSize)\n this.jsPDFDocument.setFontSize(styles.fontSize);\n if (fontOnly) {\n return; // Performance improvement\n }\n var color = DocHandler.unifyColor(styles.fillColor);\n if (color)\n (_a = this.jsPDFDocument).setFillColor.apply(_a, color);\n color = DocHandler.unifyColor(styles.textColor);\n if (color)\n (_b = this.jsPDFDocument).setTextColor.apply(_b, color);\n color = DocHandler.unifyColor(styles.lineColor);\n if (color)\n (_c = this.jsPDFDocument).setDrawColor.apply(_c, color);\n if (typeof styles.lineWidth === 'number') {\n this.jsPDFDocument.setLineWidth(styles.lineWidth);\n }\n };\n DocHandler.prototype.splitTextToSize = function (text, size, opts) {\n return this.jsPDFDocument.splitTextToSize(text, size, opts);\n };\n /**\n * Adds a rectangle to the PDF\n * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page\n * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page\n * @param width Width (in units declared at inception of PDF document)\n * @param height Height (in units declared at inception of PDF document)\n * @param fillStyle A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke.\n */\n DocHandler.prototype.rect = function (x, y, width, height, fillStyle) {\n // null is excluded from fillStyle possible values because it isn't needed\n // and is prone to bugs as it's used to postpone setting the style\n // https://rawgit.com/MrRio/jsPDF/master/docs/jsPDF.html#rect\n return this.jsPDFDocument.rect(x, y, width, height, fillStyle);\n };\n DocHandler.prototype.getLastAutoTable = function () {\n return this.jsPDFDocument.lastAutoTable || null;\n };\n DocHandler.prototype.getTextWidth = function (text) {\n return this.jsPDFDocument.getTextWidth(text);\n };\n DocHandler.prototype.getDocument = function () {\n return this.jsPDFDocument;\n };\n DocHandler.prototype.setPage = function (page) {\n this.jsPDFDocument.setPage(page);\n };\n DocHandler.prototype.addPage = function () {\n return this.jsPDFDocument.addPage();\n };\n DocHandler.prototype.getFontList = function () {\n return this.jsPDFDocument.getFontList();\n };\n DocHandler.prototype.getGlobalOptions = function () {\n return globalDefaults || {};\n };\n DocHandler.prototype.getDocumentOptions = function () {\n return this.jsPDFDocument.__autoTableDocumentDefaults || {};\n };\n DocHandler.prototype.pageSize = function () {\n var pageSize = this.jsPDFDocument.internal.pageSize;\n // JSPDF 1.4 uses get functions instead of properties on pageSize\n if (pageSize.width == null) {\n pageSize = {\n width: pageSize.getWidth(),\n height: pageSize.getHeight(),\n };\n }\n return pageSize;\n };\n DocHandler.prototype.scaleFactor = function () {\n return this.jsPDFDocument.internal.scaleFactor;\n };\n DocHandler.prototype.getLineHeightFactor = function () {\n var doc = this.jsPDFDocument;\n return doc.getLineHeightFactor ? doc.getLineHeightFactor() : 1.15;\n };\n DocHandler.prototype.getLineHeight = function (fontSize) {\n return (fontSize / this.scaleFactor()) * this.getLineHeightFactor();\n };\n DocHandler.prototype.pageNumber = function () {\n var pageInfo = this.jsPDFDocument.internal.getCurrentPageInfo();\n if (!pageInfo) {\n // Only recent versions of jspdf has pageInfo\n return this.jsPDFDocument.internal.getNumberOfPages();\n }\n return pageInfo.pageNumber;\n };\n return DocHandler;\n}());\nexports.DocHandler = DocHandler;\n\n\n/***/ }),\n\n/***/ 4:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.parseHtml = void 0;\nvar cssParser_1 = __webpack_require__(903);\nvar config_1 = __webpack_require__(796);\nfunction parseHtml(doc, input, window, includeHiddenHtml, useCss) {\n var _a, _b;\n if (includeHiddenHtml === void 0) { includeHiddenHtml = false; }\n if (useCss === void 0) { useCss = false; }\n var tableElement;\n if (typeof input === 'string') {\n tableElement = window.document.querySelector(input);\n }\n else {\n tableElement = input;\n }\n var supportedFonts = Object.keys(doc.getFontList());\n var scaleFactor = doc.scaleFactor();\n var head = [], body = [], foot = [];\n if (!tableElement) {\n console.error('Html table could not be found with input: ', input);\n return { head: head, body: body, foot: foot };\n }\n for (var i = 0; i < tableElement.rows.length; i++) {\n var element = tableElement.rows[i];\n var tagName = (_b = (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase();\n var row = parseRowContent(supportedFonts, scaleFactor, window, element, includeHiddenHtml, useCss);\n if (!row)\n continue;\n if (tagName === 'thead') {\n head.push(row);\n }\n else if (tagName === 'tfoot') {\n foot.push(row);\n }\n else {\n // Add to body both if parent is tbody or table\n body.push(row);\n }\n }\n return { head: head, body: body, foot: foot };\n}\nexports.parseHtml = parseHtml;\nfunction parseRowContent(supportedFonts, scaleFactor, window, row, includeHidden, useCss) {\n var resultRow = new config_1.HtmlRowInput(row);\n for (var i = 0; i < row.cells.length; i++) {\n var cell = row.cells[i];\n var style_1 = window.getComputedStyle(cell);\n if (includeHidden || style_1.display !== 'none') {\n var cellStyles = void 0;\n if (useCss) {\n cellStyles = (0, cssParser_1.parseCss)(supportedFonts, cell, scaleFactor, style_1, window);\n }\n resultRow.push({\n rowSpan: cell.rowSpan,\n colSpan: cell.colSpan,\n styles: cellStyles,\n _element: cell,\n content: parseCellContent(cell),\n });\n }\n }\n var style = window.getComputedStyle(row);\n if (resultRow.length > 0 && (includeHidden || style.display !== 'none')) {\n return resultRow;\n }\n}\nfunction parseCellContent(orgCell) {\n // Work on cloned node to make sure no changes are applied to html table\n var cell = orgCell.cloneNode(true);\n // Remove extra space and line breaks in markup to make it more similar to\n // what would be shown in html\n cell.innerHTML = cell.innerHTML.replace(/\\n/g, '').replace(/ +/g, ' ');\n // Preserve tags as line breaks in the pdf\n cell.innerHTML = cell.innerHTML\n .split(//) //start with ' '.\n .map(function (part) { return part.trim(); })\n .join('\\n');\n // innerText for ie\n return cell.innerText || cell.textContent || '';\n}\n\n\n/***/ }),\n\n/***/ 776:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.parseInput = void 0;\nvar htmlParser_1 = __webpack_require__(4);\nvar polyfills_1 = __webpack_require__(356);\nvar common_1 = __webpack_require__(420);\nvar documentHandler_1 = __webpack_require__(744);\nvar inputValidator_1 = __webpack_require__(792);\nfunction parseInput(d, current) {\n var doc = new documentHandler_1.DocHandler(d);\n var document = doc.getDocumentOptions();\n var global = doc.getGlobalOptions();\n (0, inputValidator_1.default)(doc, global, document, current);\n var options = (0, polyfills_1.assign)({}, global, document, current);\n var win;\n if (typeof window !== 'undefined') {\n win = window;\n }\n var styles = parseStyles(global, document, current);\n var hooks = parseHooks(global, document, current);\n var settings = parseSettings(doc, options);\n var content = parseContent(doc, options, win);\n return {\n id: current.tableId,\n content: content,\n hooks: hooks,\n styles: styles,\n settings: settings,\n };\n}\nexports.parseInput = parseInput;\nfunction parseStyles(gInput, dInput, cInput) {\n var styleOptions = {\n styles: {},\n headStyles: {},\n bodyStyles: {},\n footStyles: {},\n alternateRowStyles: {},\n columnStyles: {},\n };\n var _loop_1 = function (prop) {\n if (prop === 'columnStyles') {\n var global_1 = gInput[prop];\n var document_1 = dInput[prop];\n var current = cInput[prop];\n styleOptions.columnStyles = (0, polyfills_1.assign)({}, global_1, document_1, current);\n }\n else {\n var allOptions = [gInput, dInput, cInput];\n var styles = allOptions.map(function (opts) { return opts[prop] || {}; });\n styleOptions[prop] = (0, polyfills_1.assign)({}, styles[0], styles[1], styles[2]);\n }\n };\n for (var _i = 0, _a = Object.keys(styleOptions); _i < _a.length; _i++) {\n var prop = _a[_i];\n _loop_1(prop);\n }\n return styleOptions;\n}\nfunction parseHooks(global, document, current) {\n var allOptions = [global, document, current];\n var result = {\n didParseCell: [],\n willDrawCell: [],\n didDrawCell: [],\n willDrawPage: [],\n didDrawPage: [],\n };\n for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {\n var options = allOptions_1[_i];\n if (options.didParseCell)\n result.didParseCell.push(options.didParseCell);\n if (options.willDrawCell)\n result.willDrawCell.push(options.willDrawCell);\n if (options.didDrawCell)\n result.didDrawCell.push(options.didDrawCell);\n if (options.willDrawPage)\n result.willDrawPage.push(options.willDrawPage);\n if (options.didDrawPage)\n result.didDrawPage.push(options.didDrawPage);\n }\n return result;\n}\nfunction parseSettings(doc, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;\n var margin = (0, common_1.parseSpacing)(options.margin, 40 / doc.scaleFactor());\n var startY = (_a = getStartY(doc, options.startY)) !== null && _a !== void 0 ? _a : margin.top;\n var showFoot;\n if (options.showFoot === true) {\n showFoot = 'everyPage';\n }\n else if (options.showFoot === false) {\n showFoot = 'never';\n }\n else {\n showFoot = (_b = options.showFoot) !== null && _b !== void 0 ? _b : 'everyPage';\n }\n var showHead;\n if (options.showHead === true) {\n showHead = 'everyPage';\n }\n else if (options.showHead === false) {\n showHead = 'never';\n }\n else {\n showHead = (_c = options.showHead) !== null && _c !== void 0 ? _c : 'everyPage';\n }\n var useCss = (_d = options.useCss) !== null && _d !== void 0 ? _d : false;\n var theme = options.theme || (useCss ? 'plain' : 'striped');\n var horizontalPageBreak = !!options.horizontalPageBreak;\n var horizontalPageBreakRepeat = (_e = options.horizontalPageBreakRepeat) !== null && _e !== void 0 ? _e : null;\n return {\n includeHiddenHtml: (_f = options.includeHiddenHtml) !== null && _f !== void 0 ? _f : false,\n useCss: useCss,\n theme: theme,\n startY: startY,\n margin: margin,\n pageBreak: (_g = options.pageBreak) !== null && _g !== void 0 ? _g : 'auto',\n rowPageBreak: (_h = options.rowPageBreak) !== null && _h !== void 0 ? _h : 'auto',\n tableWidth: (_j = options.tableWidth) !== null && _j !== void 0 ? _j : 'auto',\n showHead: showHead,\n showFoot: showFoot,\n tableLineWidth: (_k = options.tableLineWidth) !== null && _k !== void 0 ? _k : 0,\n tableLineColor: (_l = options.tableLineColor) !== null && _l !== void 0 ? _l : 200,\n horizontalPageBreak: horizontalPageBreak,\n horizontalPageBreakRepeat: horizontalPageBreakRepeat,\n horizontalPageBreakBehaviour: (_m = options.horizontalPageBreakBehaviour) !== null && _m !== void 0 ? _m : 'afterAllRows',\n };\n}\nfunction getStartY(doc, userStartY) {\n var previous = doc.getLastAutoTable();\n var sf = doc.scaleFactor();\n var currentPage = doc.pageNumber();\n var isSamePageAsPreviousTable = false;\n if (previous && previous.startPageNumber) {\n var endingPage = previous.startPageNumber + previous.pageNumber - 1;\n isSamePageAsPreviousTable = endingPage === currentPage;\n }\n if (typeof userStartY === 'number') {\n return userStartY;\n }\n else if (userStartY == null || userStartY === false) {\n if (isSamePageAsPreviousTable && (previous === null || previous === void 0 ? void 0 : previous.finalY) != null) {\n // Some users had issues with overlapping tables when they used multiple\n // tables without setting startY so setting it here to a sensible default.\n return previous.finalY + 20 / sf;\n }\n }\n return null;\n}\nfunction parseContent(doc, options, window) {\n var head = options.head || [];\n var body = options.body || [];\n var foot = options.foot || [];\n if (options.html) {\n var hidden = options.includeHiddenHtml;\n if (window) {\n var htmlContent = (0, htmlParser_1.parseHtml)(doc, options.html, window, hidden, options.useCss) || {};\n head = htmlContent.head || head;\n body = htmlContent.body || head;\n foot = htmlContent.foot || head;\n }\n else {\n console.error('Cannot parse html in non browser environment');\n }\n }\n var columns = options.columns || parseColumns(head, body, foot);\n return {\n columns: columns,\n head: head,\n body: body,\n foot: foot,\n };\n}\nfunction parseColumns(head, body, foot) {\n var firstRow = head[0] || body[0] || foot[0] || [];\n var result = [];\n Object.keys(firstRow)\n .filter(function (key) { return key !== '_element'; })\n .forEach(function (key) {\n var colSpan = 1;\n var input;\n if (Array.isArray(firstRow)) {\n input = firstRow[parseInt(key)];\n }\n else {\n input = firstRow[key];\n }\n if (typeof input === 'object' && !Array.isArray(input)) {\n colSpan = (input === null || input === void 0 ? void 0 : input.colSpan) || 1;\n }\n for (var i = 0; i < colSpan; i++) {\n var id = void 0;\n if (Array.isArray(firstRow)) {\n id = result.length;\n }\n else {\n id = key + (i > 0 ? \"_\".concat(i) : '');\n }\n var rowResult = { dataKey: id };\n result.push(rowResult);\n }\n });\n return result;\n}\n\n\n/***/ }),\n\n/***/ 792:\n/***/ (function(__unused_webpack_module, exports) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction default_1(doc, global, document, current) {\n var _loop_1 = function (options) {\n if (options && typeof options !== 'object') {\n console.error('The options parameter should be of type object, is: ' + typeof options);\n }\n if (typeof options.extendWidth !== 'undefined') {\n options.tableWidth = options.extendWidth ? 'auto' : 'wrap';\n console.error('Use of deprecated option: extendWidth, use tableWidth instead.');\n }\n if (typeof options.margins !== 'undefined') {\n if (typeof options.margin === 'undefined')\n options.margin = options.margins;\n console.error('Use of deprecated option: margins, use margin instead.');\n }\n if (options.startY && typeof options.startY !== 'number') {\n console.error('Invalid value for startY option', options.startY);\n delete options.startY;\n }\n if (!options.didDrawPage &&\n (options.afterPageContent ||\n options.beforePageContent ||\n options.afterPageAdd)) {\n console.error('The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead');\n options.didDrawPage = function (data) {\n doc.applyStyles(doc.userStyles);\n if (options.beforePageContent)\n options.beforePageContent(data);\n doc.applyStyles(doc.userStyles);\n if (options.afterPageContent)\n options.afterPageContent(data);\n doc.applyStyles(doc.userStyles);\n if (options.afterPageAdd && data.pageNumber > 1) {\n ;\n data.afterPageAdd(data);\n }\n doc.applyStyles(doc.userStyles);\n };\n }\n ;\n [\n 'createdHeaderCell',\n 'drawHeaderRow',\n 'drawRow',\n 'drawHeaderCell',\n ].forEach(function (name) {\n if (options[name]) {\n console.error(\"The \\\"\".concat(name, \"\\\" hook has changed in version 3.0, check the changelog for how to migrate.\"));\n }\n });\n [\n ['showFoot', 'showFooter'],\n ['showHead', 'showHeader'],\n ['didDrawPage', 'addPageContent'],\n ['didParseCell', 'createdCell'],\n ['headStyles', 'headerStyles'],\n ].forEach(function (_a) {\n var current = _a[0], deprecated = _a[1];\n if (options[deprecated]) {\n console.error(\"Use of deprecated option \".concat(deprecated, \". Use \").concat(current, \" instead\"));\n options[current] = options[deprecated];\n }\n });\n [\n ['padding', 'cellPadding'],\n ['lineHeight', 'rowHeight'],\n 'fontSize',\n 'overflow',\n ].forEach(function (o) {\n var deprecatedOption = typeof o === 'string' ? o : o[0];\n var style = typeof o === 'string' ? o : o[1];\n if (typeof options[deprecatedOption] !== 'undefined') {\n if (typeof options.styles[style] === 'undefined') {\n options.styles[style] = options[deprecatedOption];\n }\n console.error('Use of deprecated option: ' +\n deprecatedOption +\n ', use the style ' +\n style +\n ' instead.');\n }\n });\n for (var _b = 0, _c = [\n 'styles',\n 'bodyStyles',\n 'headStyles',\n 'footStyles',\n ]; _b < _c.length; _b++) {\n var styleProp = _c[_b];\n checkStyles(options[styleProp] || {});\n }\n var columnStyles = options['columnStyles'] || {};\n for (var _d = 0, _e = Object.keys(columnStyles); _d < _e.length; _d++) {\n var key = _e[_d];\n checkStyles(columnStyles[key] || {});\n }\n };\n for (var _i = 0, _a = [global, document, current]; _i < _a.length; _i++) {\n var options = _a[_i];\n _loop_1(options);\n }\n}\nexports[\"default\"] = default_1;\nfunction checkStyles(styles) {\n if (styles.rowHeight) {\n console.error('Use of deprecated style rowHeight. It is renamed to minCellHeight.');\n if (!styles.minCellHeight) {\n styles.minCellHeight = styles.rowHeight;\n }\n }\n else if (styles.columnWidth) {\n console.error('Use of deprecated style columnWidth. It is renamed to cellWidth.');\n if (!styles.cellWidth) {\n styles.cellWidth = styles.columnWidth;\n }\n }\n}\n\n\n/***/ }),\n\n/***/ 260:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Column = exports.Cell = exports.Row = exports.Table = void 0;\nvar config_1 = __webpack_require__(796);\nvar HookData_1 = __webpack_require__(172);\nvar common_1 = __webpack_require__(420);\nvar Table = /** @class */ (function () {\n function Table(input, content) {\n this.pageNumber = 1;\n // Deprecated, use pageNumber instead\n // Not using getter since:\n // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/596\n this.pageCount = 1;\n this.id = input.id;\n this.settings = input.settings;\n this.styles = input.styles;\n this.hooks = input.hooks;\n this.columns = content.columns;\n this.head = content.head;\n this.body = content.body;\n this.foot = content.foot;\n }\n Table.prototype.getHeadHeight = function (columns) {\n return this.head.reduce(function (acc, row) { return acc + row.getMaxCellHeight(columns); }, 0);\n };\n Table.prototype.getFootHeight = function (columns) {\n return this.foot.reduce(function (acc, row) { return acc + row.getMaxCellHeight(columns); }, 0);\n };\n Table.prototype.allRows = function () {\n return this.head.concat(this.body).concat(this.foot);\n };\n Table.prototype.callCellHooks = function (doc, handlers, cell, row, column, cursor) {\n for (var _i = 0, handlers_1 = handlers; _i < handlers_1.length; _i++) {\n var handler = handlers_1[_i];\n var data = new HookData_1.CellHookData(doc, this, cell, row, column, cursor);\n var result = handler(data) === false;\n // Make sure text is always string[] since user can assign string\n cell.text = Array.isArray(cell.text) ? cell.text : [cell.text];\n if (result) {\n return false;\n }\n }\n return true;\n };\n Table.prototype.callEndPageHooks = function (doc, cursor) {\n doc.applyStyles(doc.userStyles);\n for (var _i = 0, _a = this.hooks.didDrawPage; _i < _a.length; _i++) {\n var handler = _a[_i];\n handler(new HookData_1.HookData(doc, this, cursor));\n }\n };\n Table.prototype.callWillDrawPageHooks = function (doc, cursor) {\n for (var _i = 0, _a = this.hooks.willDrawPage; _i < _a.length; _i++) {\n var handler = _a[_i];\n handler(new HookData_1.HookData(doc, this, cursor));\n }\n };\n Table.prototype.getWidth = function (pageWidth) {\n if (typeof this.settings.tableWidth === 'number') {\n return this.settings.tableWidth;\n }\n else if (this.settings.tableWidth === 'wrap') {\n var wrappedWidth = this.columns.reduce(function (total, col) { return total + col.wrappedWidth; }, 0);\n return wrappedWidth;\n }\n else {\n var margin = this.settings.margin;\n return pageWidth - margin.left - margin.right;\n }\n };\n return Table;\n}());\nexports.Table = Table;\nvar Row = /** @class */ (function () {\n function Row(raw, index, section, cells, spansMultiplePages) {\n if (spansMultiplePages === void 0) { spansMultiplePages = false; }\n this.height = 0;\n this.raw = raw;\n if (raw instanceof config_1.HtmlRowInput) {\n this.raw = raw._element;\n this.element = raw._element;\n }\n this.index = index;\n this.section = section;\n this.cells = cells;\n this.spansMultiplePages = spansMultiplePages;\n }\n Row.prototype.getMaxCellHeight = function (columns) {\n var _this = this;\n return columns.reduce(function (acc, column) { var _a; return Math.max(acc, ((_a = _this.cells[column.index]) === null || _a === void 0 ? void 0 : _a.height) || 0); }, 0);\n };\n Row.prototype.hasRowSpan = function (columns) {\n var _this = this;\n return (columns.filter(function (column) {\n var cell = _this.cells[column.index];\n if (!cell)\n return false;\n return cell.rowSpan > 1;\n }).length > 0);\n };\n Row.prototype.canEntireRowFit = function (height, columns) {\n return this.getMaxCellHeight(columns) <= height;\n };\n Row.prototype.getMinimumRowHeight = function (columns, doc) {\n var _this = this;\n return columns.reduce(function (acc, column) {\n var cell = _this.cells[column.index];\n if (!cell)\n return 0;\n var lineHeight = doc.getLineHeight(cell.styles.fontSize);\n var vPadding = cell.padding('vertical');\n var oneRowHeight = vPadding + lineHeight;\n return oneRowHeight > acc ? oneRowHeight : acc;\n }, 0);\n };\n return Row;\n}());\nexports.Row = Row;\nvar Cell = /** @class */ (function () {\n function Cell(raw, styles, section) {\n var _a, _b;\n this.contentHeight = 0;\n this.contentWidth = 0;\n this.wrappedWidth = 0;\n this.minReadableWidth = 0;\n this.minWidth = 0;\n this.width = 0;\n this.height = 0;\n this.x = 0;\n this.y = 0;\n this.styles = styles;\n this.section = section;\n this.raw = raw;\n var content = raw;\n if (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {\n this.rowSpan = raw.rowSpan || 1;\n this.colSpan = raw.colSpan || 1;\n content = (_b = (_a = raw.content) !== null && _a !== void 0 ? _a : raw.title) !== null && _b !== void 0 ? _b : raw;\n if (raw._element) {\n this.raw = raw._element;\n }\n }\n else {\n this.rowSpan = 1;\n this.colSpan = 1;\n }\n // Stringify 0 and false, but not undefined or null\n var text = content != null ? '' + content : '';\n var splitRegex = /\\r\\n|\\r|\\n/g;\n this.text = text.split(splitRegex);\n }\n Cell.prototype.getTextPos = function () {\n var y;\n if (this.styles.valign === 'top') {\n y = this.y + this.padding('top');\n }\n else if (this.styles.valign === 'bottom') {\n y = this.y + this.height - this.padding('bottom');\n }\n else {\n var netHeight = this.height - this.padding('vertical');\n y = this.y + netHeight / 2 + this.padding('top');\n }\n var x;\n if (this.styles.halign === 'right') {\n x = this.x + this.width - this.padding('right');\n }\n else if (this.styles.halign === 'center') {\n var netWidth = this.width - this.padding('horizontal');\n x = this.x + netWidth / 2 + this.padding('left');\n }\n else {\n x = this.x + this.padding('left');\n }\n return { x: x, y: y };\n };\n // TODO (v4): replace parameters with only (lineHeight)\n Cell.prototype.getContentHeight = function (scaleFactor, lineHeightFactor) {\n if (lineHeightFactor === void 0) { lineHeightFactor = 1.15; }\n var lineCount = Array.isArray(this.text) ? this.text.length : 1;\n var lineHeight = (this.styles.fontSize / scaleFactor) * lineHeightFactor;\n var height = lineCount * lineHeight + this.padding('vertical');\n return Math.max(height, this.styles.minCellHeight);\n };\n Cell.prototype.padding = function (name) {\n var padding = (0, common_1.parseSpacing)(this.styles.cellPadding, 0);\n if (name === 'vertical') {\n return padding.top + padding.bottom;\n }\n else if (name === 'horizontal') {\n return padding.left + padding.right;\n }\n else {\n return padding[name];\n }\n };\n return Cell;\n}());\nexports.Cell = Cell;\nvar Column = /** @class */ (function () {\n function Column(dataKey, raw, index) {\n this.wrappedWidth = 0;\n this.minReadableWidth = 0;\n this.minWidth = 0;\n this.width = 0;\n this.dataKey = dataKey;\n this.raw = raw;\n this.index = index;\n }\n Column.prototype.getMaxCustomCellWidth = function (table) {\n var max = 0;\n for (var _i = 0, _a = table.allRows(); _i < _a.length; _i++) {\n var row = _a[_i];\n var cell = row.cells[this.index];\n if (cell && typeof cell.styles.cellWidth === 'number') {\n max = Math.max(max, cell.styles.cellWidth);\n }\n }\n return max;\n };\n return Column;\n}());\nexports.Column = Column;\n\n\n/***/ }),\n\n/***/ 356:\n/***/ (function(__unused_webpack_module, exports) {\n\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.assign = void 0;\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\nfunction assign(target, s, s1, s2, s3) {\n if (target == null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var to = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n // eslint-disable-next-line prefer-rest-params\n var nextSource = arguments[index];\n if (nextSource != null) {\n // Skip over if undefined or null\n for (var nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n return to;\n}\nexports.assign = assign;\n\n\n/***/ }),\n\n/***/ 972:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.createTable = void 0;\nvar documentHandler_1 = __webpack_require__(744);\nvar models_1 = __webpack_require__(260);\nvar widthCalculator_1 = __webpack_require__(324);\nvar config_1 = __webpack_require__(796);\nvar polyfills_1 = __webpack_require__(356);\nfunction createTable(jsPDFDoc, input) {\n var doc = new documentHandler_1.DocHandler(jsPDFDoc);\n var content = parseContent(input, doc.scaleFactor());\n var table = new models_1.Table(input, content);\n (0, widthCalculator_1.calculateWidths)(doc, table);\n doc.applyStyles(doc.userStyles);\n return table;\n}\nexports.createTable = createTable;\nfunction parseContent(input, sf) {\n var content = input.content;\n var columns = createColumns(content.columns);\n // If no head or foot is set, try generating it with content from columns\n if (content.head.length === 0) {\n var sectionRow = generateSectionRow(columns, 'head');\n if (sectionRow)\n content.head.push(sectionRow);\n }\n if (content.foot.length === 0) {\n var sectionRow = generateSectionRow(columns, 'foot');\n if (sectionRow)\n content.foot.push(sectionRow);\n }\n var theme = input.settings.theme;\n var styles = input.styles;\n return {\n columns: columns,\n head: parseSection('head', content.head, columns, styles, theme, sf),\n body: parseSection('body', content.body, columns, styles, theme, sf),\n foot: parseSection('foot', content.foot, columns, styles, theme, sf),\n };\n}\nfunction parseSection(sectionName, sectionRows, columns, styleProps, theme, scaleFactor) {\n var rowSpansLeftForColumn = {};\n var result = sectionRows.map(function (rawRow, rowIndex) {\n var skippedRowForRowSpans = 0;\n var cells = {};\n var colSpansAdded = 0;\n var columnSpansLeft = 0;\n for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {\n var column = columns_1[_i];\n if (rowSpansLeftForColumn[column.index] == null ||\n rowSpansLeftForColumn[column.index].left === 0) {\n if (columnSpansLeft === 0) {\n var rawCell = void 0;\n if (Array.isArray(rawRow)) {\n rawCell =\n rawRow[column.index - colSpansAdded - skippedRowForRowSpans];\n }\n else {\n rawCell = rawRow[column.dataKey];\n }\n var cellInputStyles = {};\n if (typeof rawCell === 'object' && !Array.isArray(rawCell)) {\n cellInputStyles = (rawCell === null || rawCell === void 0 ? void 0 : rawCell.styles) || {};\n }\n var styles = cellStyles(sectionName, column, rowIndex, theme, styleProps, scaleFactor, cellInputStyles);\n var cell = new models_1.Cell(rawCell, styles, sectionName);\n // dataKey is not used internally no more but keep for\n // backwards compat in hooks\n cells[column.dataKey] = cell;\n cells[column.index] = cell;\n columnSpansLeft = cell.colSpan - 1;\n rowSpansLeftForColumn[column.index] = {\n left: cell.rowSpan - 1,\n times: columnSpansLeft,\n };\n }\n else {\n columnSpansLeft--;\n colSpansAdded++;\n }\n }\n else {\n rowSpansLeftForColumn[column.index].left--;\n columnSpansLeft = rowSpansLeftForColumn[column.index].times;\n skippedRowForRowSpans++;\n }\n }\n return new models_1.Row(rawRow, rowIndex, sectionName, cells);\n });\n return result;\n}\nfunction generateSectionRow(columns, section) {\n var sectionRow = {};\n columns.forEach(function (col) {\n if (col.raw != null) {\n var title = getSectionTitle(section, col.raw);\n if (title != null)\n sectionRow[col.dataKey] = title;\n }\n });\n return Object.keys(sectionRow).length > 0 ? sectionRow : null;\n}\nfunction getSectionTitle(section, column) {\n if (section === 'head') {\n if (typeof column === 'object') {\n return column.header || column.title || null;\n }\n else if (typeof column === 'string' || typeof column === 'number') {\n return column;\n }\n }\n else if (section === 'foot' && typeof column === 'object') {\n return column.footer;\n }\n return null;\n}\nfunction createColumns(columns) {\n return columns.map(function (input, index) {\n var _a, _b;\n var key;\n if (typeof input === 'object') {\n key = (_b = (_a = input.dataKey) !== null && _a !== void 0 ? _a : input.key) !== null && _b !== void 0 ? _b : index;\n }\n else {\n key = index;\n }\n return new models_1.Column(key, input, index);\n });\n}\nfunction cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFactor, cellInputStyles) {\n var theme = (0, config_1.getTheme)(themeName);\n var sectionStyles;\n if (sectionName === 'head') {\n sectionStyles = styles.headStyles;\n }\n else if (sectionName === 'body') {\n sectionStyles = styles.bodyStyles;\n }\n else if (sectionName === 'foot') {\n sectionStyles = styles.footStyles;\n }\n var otherStyles = (0, polyfills_1.assign)({}, theme.table, theme[sectionName], styles.styles, sectionStyles);\n var columnStyles = styles.columnStyles[column.dataKey] ||\n styles.columnStyles[column.index] ||\n {};\n var colStyles = sectionName === 'body' ? columnStyles : {};\n var rowStyles = sectionName === 'body' && rowIndex % 2 === 0\n ? (0, polyfills_1.assign)({}, theme.alternateRow, styles.alternateRowStyles)\n : {};\n var defaultStyle = (0, config_1.defaultStyles)(scaleFactor);\n var themeStyles = (0, polyfills_1.assign)({}, defaultStyle, otherStyles, rowStyles, colStyles);\n return (0, polyfills_1.assign)(themeStyles, cellInputStyles);\n}\n\n\n/***/ }),\n\n/***/ 664:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.addPage = exports.drawTable = void 0;\nvar common_1 = __webpack_require__(420);\nvar models_1 = __webpack_require__(260);\nvar documentHandler_1 = __webpack_require__(744);\nvar polyfills_1 = __webpack_require__(356);\nvar autoTableText_1 = __webpack_require__(136);\nvar tablePrinter_1 = __webpack_require__(224);\nfunction drawTable(jsPDFDoc, table) {\n var settings = table.settings;\n var startY = settings.startY;\n var margin = settings.margin;\n var cursor = {\n x: margin.left,\n y: startY,\n };\n var sectionsHeight = table.getHeadHeight(table.columns) + table.getFootHeight(table.columns);\n var minTableBottomPos = startY + margin.bottom + sectionsHeight;\n if (settings.pageBreak === 'avoid') {\n var rows = table.body;\n var tableHeight = rows.reduce(function (acc, row) { return acc + row.height; }, 0);\n minTableBottomPos += tableHeight;\n }\n var doc = new documentHandler_1.DocHandler(jsPDFDoc);\n if (settings.pageBreak === 'always' ||\n (settings.startY != null && minTableBottomPos > doc.pageSize().height)) {\n nextPage(doc);\n cursor.y = margin.top;\n }\n table.callWillDrawPageHooks(doc, cursor);\n var startPos = (0, polyfills_1.assign)({}, cursor);\n table.startPageNumber = doc.pageNumber();\n if (settings.horizontalPageBreak) {\n // managed flow for split columns\n printTableWithHorizontalPageBreak(doc, table, startPos, cursor);\n }\n else {\n // normal flow\n doc.applyStyles(doc.userStyles);\n if (settings.showHead === 'firstPage' ||\n settings.showHead === 'everyPage') {\n table.head.forEach(function (row) {\n return printRow(doc, table, row, cursor, table.columns);\n });\n }\n doc.applyStyles(doc.userStyles);\n table.body.forEach(function (row, index) {\n var isLastRow = index === table.body.length - 1;\n printFullRow(doc, table, row, isLastRow, startPos, cursor, table.columns);\n });\n doc.applyStyles(doc.userStyles);\n if (settings.showFoot === 'lastPage' || settings.showFoot === 'everyPage') {\n table.foot.forEach(function (row) {\n return printRow(doc, table, row, cursor, table.columns);\n });\n }\n }\n (0, common_1.addTableBorder)(doc, table, startPos, cursor);\n table.callEndPageHooks(doc, cursor);\n table.finalY = cursor.y;\n jsPDFDoc.lastAutoTable = table;\n jsPDFDoc.previousAutoTable = table; // Deprecated\n if (jsPDFDoc.autoTable)\n jsPDFDoc.autoTable.previous = table; // Deprecated\n doc.applyStyles(doc.userStyles);\n}\nexports.drawTable = drawTable;\nfunction printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {\n // calculate width of columns and render only those which can fit into page\n var allColumnsCanFitResult = (0, tablePrinter_1.calculateAllColumnsCanFitInPage)(doc, table);\n var settings = table.settings;\n if (settings.horizontalPageBreakBehaviour === 'afterAllRows') {\n allColumnsCanFitResult.forEach(function (colsAndIndexes, index) {\n doc.applyStyles(doc.userStyles);\n // add page to print next columns in new page\n if (index > 0) {\n // When adding a page here, make sure not to print the footers\n // because they were already printed before on this same loop\n addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);\n }\n else {\n // print head for selected columns\n printHead(doc, table, cursor, colsAndIndexes.columns);\n }\n // print body & footer for selected columns\n printBody(doc, table, startPos, cursor, colsAndIndexes.columns);\n printFoot(doc, table, cursor, colsAndIndexes.columns);\n });\n }\n else {\n var lastRowIndexOfLastPage_1 = -1;\n var firstColumnsToFitResult = allColumnsCanFitResult[0];\n var _loop_1 = function () {\n // Print the first columns, taking note of the last row printed\n var lastPrintedRowIndex = lastRowIndexOfLastPage_1;\n if (firstColumnsToFitResult) {\n doc.applyStyles(doc.userStyles);\n var firstColumnsToFit = firstColumnsToFitResult.columns;\n if (lastRowIndexOfLastPage_1 >= 0) {\n // When adding a page here, make sure not to print the footers\n // because they were already printed before on this same loop\n addPage(doc, table, startPos, cursor, firstColumnsToFit, true);\n }\n else {\n printHead(doc, table, cursor, firstColumnsToFit);\n }\n lastPrintedRowIndex = printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, firstColumnsToFit);\n printFoot(doc, table, cursor, firstColumnsToFit);\n }\n // Check how many rows were printed, so that the next columns would not print more rows than that\n var maxNumberOfRows = lastPrintedRowIndex - lastRowIndexOfLastPage_1;\n // Print the next columns, never exceding maxNumberOfRows\n allColumnsCanFitResult.slice(1).forEach(function (colsAndIndexes) {\n doc.applyStyles(doc.userStyles);\n // When adding a page here, make sure not to print the footers\n // because they were already printed before on this same loop\n addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);\n printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, colsAndIndexes.columns, maxNumberOfRows);\n printFoot(doc, table, cursor, colsAndIndexes.columns);\n });\n lastRowIndexOfLastPage_1 = lastPrintedRowIndex;\n };\n while (lastRowIndexOfLastPage_1 < table.body.length - 1) {\n _loop_1();\n }\n }\n}\nfunction printHead(doc, table, cursor, columns) {\n var settings = table.settings;\n doc.applyStyles(doc.userStyles);\n if (settings.showHead === 'firstPage' || settings.showHead === 'everyPage') {\n table.head.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });\n }\n}\nfunction printBody(doc, table, startPos, cursor, columns) {\n doc.applyStyles(doc.userStyles);\n table.body.forEach(function (row, index) {\n var isLastRow = index === table.body.length - 1;\n printFullRow(doc, table, row, isLastRow, startPos, cursor, columns);\n });\n}\nfunction printBodyWithoutPageBreaks(doc, table, startRowIndex, cursor, columns, maxNumberOfRows) {\n doc.applyStyles(doc.userStyles);\n maxNumberOfRows = maxNumberOfRows !== null && maxNumberOfRows !== void 0 ? maxNumberOfRows : table.body.length;\n var endRowIndex = Math.min(startRowIndex + maxNumberOfRows, table.body.length);\n var lastPrintedRowIndex = -1;\n table.body.slice(startRowIndex, endRowIndex).forEach(function (row, index) {\n var isLastRow = startRowIndex + index === table.body.length - 1;\n var remainingSpace = getRemainingPageSpace(doc, table, isLastRow, cursor);\n if (row.canEntireRowFit(remainingSpace, columns)) {\n printRow(doc, table, row, cursor, columns);\n lastPrintedRowIndex = startRowIndex + index;\n }\n });\n return lastPrintedRowIndex;\n}\nfunction printFoot(doc, table, cursor, columns) {\n var settings = table.settings;\n doc.applyStyles(doc.userStyles);\n if (settings.showFoot === 'lastPage' || settings.showFoot === 'everyPage') {\n table.foot.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });\n }\n}\nfunction getRemainingLineCount(cell, remainingPageSpace, doc) {\n var lineHeight = doc.getLineHeight(cell.styles.fontSize);\n var vPadding = cell.padding('vertical');\n var remainingLines = Math.floor((remainingPageSpace - vPadding) / lineHeight);\n return Math.max(0, remainingLines);\n}\nfunction modifyRowToFit(row, remainingPageSpace, table, doc) {\n var cells = {};\n row.spansMultiplePages = true;\n row.height = 0;\n var rowHeight = 0;\n for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {\n var column = _a[_i];\n var cell = row.cells[column.index];\n if (!cell)\n continue;\n if (!Array.isArray(cell.text)) {\n cell.text = [cell.text];\n }\n var remainderCell = new models_1.Cell(cell.raw, cell.styles, cell.section);\n remainderCell = (0, polyfills_1.assign)(remainderCell, cell);\n remainderCell.text = [];\n var remainingLineCount = getRemainingLineCount(cell, remainingPageSpace, doc);\n if (cell.text.length > remainingLineCount) {\n remainderCell.text = cell.text.splice(remainingLineCount, cell.text.length);\n }\n var scaleFactor = doc.scaleFactor();\n var lineHeightFactor = doc.getLineHeightFactor();\n cell.contentHeight = cell.getContentHeight(scaleFactor, lineHeightFactor);\n if (cell.contentHeight >= remainingPageSpace) {\n cell.contentHeight = remainingPageSpace;\n remainderCell.styles.minCellHeight -= remainingPageSpace;\n }\n if (cell.contentHeight > row.height) {\n row.height = cell.contentHeight;\n }\n remainderCell.contentHeight = remainderCell.getContentHeight(scaleFactor, lineHeightFactor);\n if (remainderCell.contentHeight > rowHeight) {\n rowHeight = remainderCell.contentHeight;\n }\n cells[column.index] = remainderCell;\n }\n var remainderRow = new models_1.Row(row.raw, -1, row.section, cells, true);\n remainderRow.height = rowHeight;\n for (var _b = 0, _c = table.columns; _b < _c.length; _b++) {\n var column = _c[_b];\n var remainderCell = remainderRow.cells[column.index];\n if (remainderCell) {\n remainderCell.height = remainderRow.height;\n }\n var cell = row.cells[column.index];\n if (cell) {\n cell.height = row.height;\n }\n }\n return remainderRow;\n}\nfunction shouldPrintOnCurrentPage(doc, row, remainingPageSpace, table) {\n var pageHeight = doc.pageSize().height;\n var margin = table.settings.margin;\n var marginHeight = margin.top + margin.bottom;\n var maxRowHeight = pageHeight - marginHeight;\n if (row.section === 'body') {\n // Should also take into account that head and foot is not\n // on every page with some settings\n maxRowHeight -=\n table.getHeadHeight(table.columns) + table.getFootHeight(table.columns);\n }\n var minRowHeight = row.getMinimumRowHeight(table.columns, doc);\n var minRowFits = minRowHeight < remainingPageSpace;\n if (minRowHeight > maxRowHeight) {\n console.error(\"Will not be able to print row \".concat(row.index, \" correctly since it's minimum height is larger than page height\"));\n return true;\n }\n if (!minRowFits) {\n return false;\n }\n var rowHasRowSpanCell = row.hasRowSpan(table.columns);\n var rowHigherThanPage = row.getMaxCellHeight(table.columns) > maxRowHeight;\n if (rowHigherThanPage) {\n if (rowHasRowSpanCell) {\n console.error(\"The content of row \".concat(row.index, \" will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported.\"));\n }\n return true;\n }\n if (rowHasRowSpanCell) {\n // Currently a new page is required whenever a rowspan row don't fit a page.\n return false;\n }\n if (table.settings.rowPageBreak === 'avoid') {\n return false;\n }\n // In all other cases print the row on current page\n return true;\n}\nfunction printFullRow(doc, table, row, isLastRow, startPos, cursor, columns) {\n var remainingSpace = getRemainingPageSpace(doc, table, isLastRow, cursor);\n if (row.canEntireRowFit(remainingSpace, columns)) {\n // The row fits in the current page\n printRow(doc, table, row, cursor, columns);\n }\n else if (shouldPrintOnCurrentPage(doc, row, remainingSpace, table)) {\n // The row gets split in two here, each piece in one page\n var remainderRow = modifyRowToFit(row, remainingSpace, table, doc);\n printRow(doc, table, row, cursor, columns);\n addPage(doc, table, startPos, cursor, columns);\n printFullRow(doc, table, remainderRow, isLastRow, startPos, cursor, columns);\n }\n else {\n // The row get printed entirelly on the next page\n addPage(doc, table, startPos, cursor, columns);\n printFullRow(doc, table, row, isLastRow, startPos, cursor, columns);\n }\n}\nfunction printRow(doc, table, row, cursor, columns) {\n cursor.x = table.settings.margin.left;\n for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {\n var column = columns_1[_i];\n var cell = row.cells[column.index];\n if (!cell) {\n cursor.x += column.width;\n continue;\n }\n doc.applyStyles(cell.styles);\n cell.x = cursor.x;\n cell.y = cursor.y;\n var result = table.callCellHooks(doc, table.hooks.willDrawCell, cell, row, column, cursor);\n if (result === false) {\n cursor.x += column.width;\n continue;\n }\n drawCellRect(doc, cell, cursor);\n var textPos = cell.getTextPos();\n (0, autoTableText_1.default)(cell.text, textPos.x, textPos.y, {\n halign: cell.styles.halign,\n valign: cell.styles.valign,\n maxWidth: Math.ceil(cell.width - cell.padding('left') - cell.padding('right')),\n }, doc.getDocument());\n table.callCellHooks(doc, table.hooks.didDrawCell, cell, row, column, cursor);\n cursor.x += column.width;\n }\n cursor.y += row.height;\n}\nfunction drawCellRect(doc, cell, cursor) {\n var cellStyles = cell.styles;\n // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/774\n // TODO (v4): better solution?\n doc.getDocument().setFillColor(doc.getDocument().getFillColor());\n if (typeof cellStyles.lineWidth === 'number') {\n // Draw cell background with normal borders\n var fillStyle = (0, common_1.getFillStyle)(cellStyles.lineWidth, cellStyles.fillColor);\n if (fillStyle) {\n doc.rect(cell.x, cursor.y, cell.width, cell.height, fillStyle);\n }\n }\n else if (typeof cellStyles.lineWidth === 'object') {\n // Draw cell background\n if (cellStyles.fillColor) {\n doc.rect(cell.x, cursor.y, cell.width, cell.height, 'F');\n }\n // Draw cell individual borders\n drawCellBorders(doc, cell, cursor, cellStyles.lineWidth);\n }\n}\n/**\n * Draw all specified borders. Borders are centered on cell's edge and lengthened\n * to overlap with neighbours to create sharp corners.\n * @param doc\n * @param cell\n * @param cursor\n * @param fillColor\n * @param lineWidth\n */\nfunction drawCellBorders(doc, cell, cursor, lineWidth) {\n var x1, y1, x2, y2;\n if (lineWidth.top) {\n x1 = cursor.x;\n y1 = cursor.y;\n x2 = cursor.x + cell.width;\n y2 = cursor.y;\n if (lineWidth.right) {\n x2 += 0.5 * lineWidth.right;\n }\n if (lineWidth.left) {\n x1 -= 0.5 * lineWidth.left;\n }\n drawLine(lineWidth.top, x1, y1, x2, y2);\n }\n if (lineWidth.bottom) {\n x1 = cursor.x;\n y1 = cursor.y + cell.height;\n x2 = cursor.x + cell.width;\n y2 = cursor.y + cell.height;\n if (lineWidth.right) {\n x2 += 0.5 * lineWidth.right;\n }\n if (lineWidth.left) {\n x1 -= 0.5 * lineWidth.left;\n }\n drawLine(lineWidth.bottom, x1, y1, x2, y2);\n }\n if (lineWidth.left) {\n x1 = cursor.x;\n y1 = cursor.y;\n x2 = cursor.x;\n y2 = cursor.y + cell.height;\n if (lineWidth.top) {\n y1 -= 0.5 * lineWidth.top;\n }\n if (lineWidth.bottom) {\n y2 += 0.5 * lineWidth.bottom;\n }\n drawLine(lineWidth.left, x1, y1, x2, y2);\n }\n if (lineWidth.right) {\n x1 = cursor.x + cell.width;\n y1 = cursor.y;\n x2 = cursor.x + cell.width;\n y2 = cursor.y + cell.height;\n if (lineWidth.top) {\n y1 -= 0.5 * lineWidth.top;\n }\n if (lineWidth.bottom) {\n y2 += 0.5 * lineWidth.bottom;\n }\n drawLine(lineWidth.right, x1, y1, x2, y2);\n }\n function drawLine(width, x1, y1, x2, y2) {\n doc.getDocument().setLineWidth(width);\n doc.getDocument().line(x1, y1, x2, y2, 'S');\n }\n}\nfunction getRemainingPageSpace(doc, table, isLastRow, cursor) {\n var bottomContentHeight = table.settings.margin.bottom;\n var showFoot = table.settings.showFoot;\n if (showFoot === 'everyPage' || (showFoot === 'lastPage' && isLastRow)) {\n bottomContentHeight += table.getFootHeight(table.columns);\n }\n return doc.pageSize().height - cursor.y - bottomContentHeight;\n}\nfunction addPage(doc, table, startPos, cursor, columns, suppressFooter) {\n if (columns === void 0) { columns = []; }\n if (suppressFooter === void 0) { suppressFooter = false; }\n doc.applyStyles(doc.userStyles);\n if (table.settings.showFoot === 'everyPage' && !suppressFooter) {\n table.foot.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });\n }\n // Add user content just before adding new page ensure it will\n // be drawn above other things on the page\n table.callEndPageHooks(doc, cursor);\n var margin = table.settings.margin;\n (0, common_1.addTableBorder)(doc, table, startPos, cursor);\n nextPage(doc);\n table.pageNumber++;\n table.pageCount++;\n cursor.x = margin.left;\n cursor.y = margin.top;\n startPos.y = margin.top;\n // call didAddPage hooks before any content is added to the page\n table.callWillDrawPageHooks(doc, cursor);\n if (table.settings.showHead === 'everyPage') {\n table.head.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });\n doc.applyStyles(doc.userStyles);\n }\n}\nexports.addPage = addPage;\nfunction nextPage(doc) {\n var current = doc.pageNumber();\n doc.setPage(current + 1);\n var newCurrent = doc.pageNumber();\n if (newCurrent === current) {\n doc.addPage();\n return true;\n }\n return false;\n}\n\n\n/***/ }),\n\n/***/ 224:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.calculateAllColumnsCanFitInPage = void 0;\nvar common_1 = __webpack_require__(420);\n// get columns can be fit into page\nfunction getColumnsCanFitInPage(doc, table, config) {\n var _a;\n if (config === void 0) { config = {}; }\n // Get page width\n var remainingWidth = (0, common_1.getPageAvailableWidth)(doc, table);\n // Get column data key to repeat\n var repeatColumnsMap = new Map();\n var colIndexes = [];\n var columns = [];\n var horizontalPageBreakRepeat = [];\n table.settings.horizontalPageBreakRepeat;\n if (Array.isArray(table.settings.horizontalPageBreakRepeat)) {\n horizontalPageBreakRepeat = table.settings.horizontalPageBreakRepeat;\n // It can be a single value of type string or number (even number: 0)\n }\n else if (typeof table.settings.horizontalPageBreakRepeat === 'string' ||\n typeof table.settings.horizontalPageBreakRepeat === 'number') {\n horizontalPageBreakRepeat = [table.settings.horizontalPageBreakRepeat];\n }\n // Code to repeat the given column in split pages\n horizontalPageBreakRepeat.forEach(function (field) {\n var col = table.columns.find(function (item) { return item.dataKey === field || item.index === field; });\n if (col && !repeatColumnsMap.has(col.index)) {\n repeatColumnsMap.set(col.index, true);\n colIndexes.push(col.index);\n columns.push(table.columns[col.index]);\n remainingWidth -= col.wrappedWidth;\n }\n });\n var first = true;\n var i = (_a = config === null || config === void 0 ? void 0 : config.start) !== null && _a !== void 0 ? _a : 0; // make sure couter is initiated outside the loop\n while (i < table.columns.length) {\n // Prevent duplicates\n if (repeatColumnsMap.has(i)) {\n i++;\n continue;\n }\n var colWidth = table.columns[i].wrappedWidth;\n // Take at least one column even if it doesn't fit\n if (first || remainingWidth >= colWidth) {\n first = false;\n colIndexes.push(i);\n columns.push(table.columns[i]);\n remainingWidth -= colWidth;\n }\n else {\n break;\n }\n i++;\n }\n return { colIndexes: colIndexes, columns: columns, lastIndex: i - 1 };\n}\nfunction calculateAllColumnsCanFitInPage(doc, table) {\n var allResults = [];\n for (var i = 0; i < table.columns.length; i++) {\n var result = getColumnsCanFitInPage(doc, table, { start: i });\n if (result.columns.length) {\n allResults.push(result);\n i = result.lastIndex;\n }\n }\n return allResults;\n}\nexports.calculateAllColumnsCanFitInPage = calculateAllColumnsCanFitInPage;\n\n\n/***/ }),\n\n/***/ 324:\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ellipsize = exports.resizeColumns = exports.calculateWidths = void 0;\nvar common_1 = __webpack_require__(420);\n/**\n * Calculate the column widths\n */\nfunction calculateWidths(doc, table) {\n calculate(doc, table);\n var resizableColumns = [];\n var initialTableWidth = 0;\n table.columns.forEach(function (column) {\n var customWidth = column.getMaxCustomCellWidth(table);\n if (customWidth) {\n // final column width\n column.width = customWidth;\n }\n else {\n // initial column width (will be resized)\n column.width = column.wrappedWidth;\n resizableColumns.push(column);\n }\n initialTableWidth += column.width;\n });\n // width difference that needs to be distributed\n var resizeWidth = table.getWidth(doc.pageSize().width) - initialTableWidth;\n // first resize attempt: with respect to minReadableWidth and minWidth\n if (resizeWidth) {\n resizeWidth = resizeColumns(resizableColumns, resizeWidth, function (column) {\n return Math.max(column.minReadableWidth, column.minWidth);\n });\n }\n // second resize attempt: ignore minReadableWidth but respect minWidth\n if (resizeWidth) {\n resizeWidth = resizeColumns(resizableColumns, resizeWidth, function (column) { return column.minWidth; });\n }\n resizeWidth = Math.abs(resizeWidth);\n if (!table.settings.horizontalPageBreak &&\n resizeWidth > 0.1 / doc.scaleFactor()) {\n // Table can't get smaller due to custom-width or minWidth restrictions\n // We can't really do much here. Up to user to for example\n // reduce font size, increase page size or remove custom cell widths\n // to allow more columns to be reduced in size\n resizeWidth = resizeWidth < 1 ? resizeWidth : Math.round(resizeWidth);\n console.warn(\"Of the table content, \".concat(resizeWidth, \" units width could not fit page\"));\n }\n applyColSpans(table);\n fitContent(table, doc);\n applyRowSpans(table);\n}\nexports.calculateWidths = calculateWidths;\nfunction calculate(doc, table) {\n var sf = doc.scaleFactor();\n var horizontalPageBreak = table.settings.horizontalPageBreak;\n var availablePageWidth = (0, common_1.getPageAvailableWidth)(doc, table);\n table.allRows().forEach(function (row) {\n for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {\n var column = _a[_i];\n var cell = row.cells[column.index];\n if (!cell)\n continue;\n var hooks = table.hooks.didParseCell;\n table.callCellHooks(doc, hooks, cell, row, column, null);\n var padding = cell.padding('horizontal');\n cell.contentWidth = (0, common_1.getStringWidth)(cell.text, cell.styles, doc) + padding;\n var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/\\s+/), cell.styles, doc);\n cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');\n if (typeof cell.styles.cellWidth === 'number') {\n cell.minWidth = cell.styles.cellWidth;\n cell.wrappedWidth = cell.styles.cellWidth;\n }\n else if (cell.styles.cellWidth === 'wrap' ||\n horizontalPageBreak === true) {\n // cell width should not be more than available page width\n if (cell.contentWidth > availablePageWidth) {\n cell.minWidth = availablePageWidth;\n cell.wrappedWidth = availablePageWidth;\n }\n else {\n cell.minWidth = cell.contentWidth;\n cell.wrappedWidth = cell.contentWidth;\n }\n }\n else {\n // auto\n var defaultMinWidth = 10 / sf;\n cell.minWidth = cell.styles.minCellWidth || defaultMinWidth;\n cell.wrappedWidth = cell.contentWidth;\n if (cell.minWidth > cell.wrappedWidth) {\n cell.wrappedWidth = cell.minWidth;\n }\n }\n }\n });\n table.allRows().forEach(function (row) {\n for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {\n var column = _a[_i];\n var cell = row.cells[column.index];\n // For now we ignore the minWidth and wrappedWidth of colspan cells when calculating colspan widths.\n // Could probably be improved upon however.\n if (cell && cell.colSpan === 1) {\n column.wrappedWidth = Math.max(column.wrappedWidth, cell.wrappedWidth);\n column.minWidth = Math.max(column.minWidth, cell.minWidth);\n column.minReadableWidth = Math.max(column.minReadableWidth, cell.minReadableWidth);\n }\n else {\n // Respect cellWidth set in columnStyles even if there is no cells for this column\n // or if the column only have colspan cells. Since the width of colspan cells\n // does not affect the width of columns, setting columnStyles cellWidth enables the\n // user to at least do it manually.\n // Note that this is not perfect for now since for example row and table styles are\n // not accounted for\n var columnStyles = table.styles.columnStyles[column.dataKey] ||\n table.styles.columnStyles[column.index] ||\n {};\n var cellWidth = columnStyles.cellWidth || columnStyles.minCellWidth;\n if (cellWidth && typeof cellWidth === 'number') {\n column.minWidth = cellWidth;\n column.wrappedWidth = cellWidth;\n }\n }\n if (cell) {\n // Make sure all columns get at least min width even though width calculations are not based on them\n if (cell.colSpan > 1 && !column.minWidth) {\n column.minWidth = cell.minWidth;\n }\n if (cell.colSpan > 1 && !column.wrappedWidth) {\n column.wrappedWidth = cell.minWidth;\n }\n }\n }\n });\n}\n/**\n * Distribute resizeWidth on passed resizable columns\n */\nfunction resizeColumns(columns, resizeWidth, getMinWidth) {\n var initialResizeWidth = resizeWidth;\n var sumWrappedWidth = columns.reduce(function (acc, column) { return acc + column.wrappedWidth; }, 0);\n for (var i = 0; i < columns.length; i++) {\n var column = columns[i];\n var ratio = column.wrappedWidth / sumWrappedWidth;\n var suggestedChange = initialResizeWidth * ratio;\n var suggestedWidth = column.width + suggestedChange;\n var minWidth = getMinWidth(column);\n var newWidth = suggestedWidth < minWidth ? minWidth : suggestedWidth;\n resizeWidth -= newWidth - column.width;\n column.width = newWidth;\n }\n resizeWidth = Math.round(resizeWidth * 1e10) / 1e10;\n // Run the resizer again if there's remaining width needs\n // to be distributed and there're columns that can be resized\n if (resizeWidth) {\n var resizableColumns = columns.filter(function (column) {\n return resizeWidth < 0\n ? column.width > getMinWidth(column) // check if column can shrink\n : true; // check if column can grow\n });\n if (resizableColumns.length) {\n resizeWidth = resizeColumns(resizableColumns, resizeWidth, getMinWidth);\n }\n }\n return resizeWidth;\n}\nexports.resizeColumns = resizeColumns;\nfunction applyRowSpans(table) {\n var rowSpanCells = {};\n var colRowSpansLeft = 1;\n var all = table.allRows();\n for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {\n var row = all[rowIndex];\n for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {\n var column = _a[_i];\n var data = rowSpanCells[column.index];\n if (colRowSpansLeft > 1) {\n colRowSpansLeft--;\n delete row.cells[column.index];\n }\n else if (data) {\n data.cell.height += row.height;\n colRowSpansLeft = data.cell.colSpan;\n delete row.cells[column.index];\n data.left--;\n if (data.left <= 1) {\n delete rowSpanCells[column.index];\n }\n }\n else {\n var cell = row.cells[column.index];\n if (!cell) {\n continue;\n }\n cell.height = row.height;\n if (cell.rowSpan > 1) {\n var remaining = all.length - rowIndex;\n var left = cell.rowSpan > remaining ? remaining : cell.rowSpan;\n rowSpanCells[column.index] = { cell: cell, left: left, row: row };\n }\n }\n }\n }\n}\nfunction applyColSpans(table) {\n var all = table.allRows();\n for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {\n var row = all[rowIndex];\n var colSpanCell = null;\n var combinedColSpanWidth = 0;\n var colSpansLeft = 0;\n for (var columnIndex = 0; columnIndex < table.columns.length; columnIndex++) {\n var column = table.columns[columnIndex];\n // Width and colspan\n colSpansLeft -= 1;\n if (colSpansLeft > 1 && table.columns[columnIndex + 1]) {\n combinedColSpanWidth += column.width;\n delete row.cells[column.index];\n }\n else if (colSpanCell) {\n var cell = colSpanCell;\n delete row.cells[column.index];\n colSpanCell = null;\n cell.width = column.width + combinedColSpanWidth;\n }\n else {\n var cell = row.cells[column.index];\n if (!cell)\n continue;\n colSpansLeft = cell.colSpan;\n combinedColSpanWidth = 0;\n if (cell.colSpan > 1) {\n colSpanCell = cell;\n combinedColSpanWidth += column.width;\n continue;\n }\n cell.width = column.width + combinedColSpanWidth;\n }\n }\n }\n}\nfunction fitContent(table, doc) {\n var rowSpanHeight = { count: 0, height: 0 };\n for (var _i = 0, _a = table.allRows(); _i < _a.length; _i++) {\n var row = _a[_i];\n for (var _b = 0, _c = table.columns; _b < _c.length; _b++) {\n var column = _c[_b];\n var cell = row.cells[column.index];\n if (!cell)\n continue;\n doc.applyStyles(cell.styles, true);\n var textSpace = cell.width - cell.padding('horizontal');\n if (cell.styles.overflow === 'linebreak') {\n // Add one pt to textSpace to fix rounding error\n cell.text = doc.splitTextToSize(cell.text, textSpace + 1 / doc.scaleFactor(), { fontSize: cell.styles.fontSize });\n }\n else if (cell.styles.overflow === 'ellipsize') {\n cell.text = ellipsize(cell.text, textSpace, cell.styles, doc, '...');\n }\n else if (cell.styles.overflow === 'hidden') {\n cell.text = ellipsize(cell.text, textSpace, cell.styles, doc, '');\n }\n else if (typeof cell.styles.overflow === 'function') {\n var result = cell.styles.overflow(cell.text, textSpace);\n if (typeof result === 'string') {\n cell.text = [result];\n }\n else {\n cell.text = result;\n }\n }\n cell.contentHeight = cell.getContentHeight(doc.scaleFactor(), doc.getLineHeightFactor());\n var realContentHeight = cell.contentHeight / cell.rowSpan;\n if (cell.rowSpan > 1 &&\n rowSpanHeight.count * rowSpanHeight.height <\n realContentHeight * cell.rowSpan) {\n rowSpanHeight = { height: realContentHeight, count: cell.rowSpan };\n }\n else if (rowSpanHeight && rowSpanHeight.count > 0) {\n if (rowSpanHeight.height > realContentHeight) {\n realContentHeight = rowSpanHeight.height;\n }\n }\n if (realContentHeight > row.height) {\n row.height = realContentHeight;\n }\n }\n rowSpanHeight.count--;\n }\n}\nfunction ellipsize(text, width, styles, doc, overflow) {\n return text.map(function (str) { return ellipsizeStr(str, width, styles, doc, overflow); });\n}\nexports.ellipsize = ellipsize;\nfunction ellipsizeStr(text, width, styles, doc, overflow) {\n var precision = 10000 * doc.scaleFactor();\n width = Math.ceil(width * precision) / precision;\n if (width >= (0, common_1.getStringWidth)(text, styles, doc)) {\n return text;\n }\n while (width < (0, common_1.getStringWidth)(text + overflow, styles, doc)) {\n if (text.length <= 1) {\n break;\n }\n text = text.substring(0, text.length - 1);\n }\n return text.trim() + overflow;\n}\n\n\n/***/ }),\n\n/***/ 964:\n/***/ (function(module) {\n\nif(typeof __WEBPACK_EXTERNAL_MODULE__964__ === 'undefined') { var e = new Error(\"Cannot find module 'undefined'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE__964__;\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.\n!function() {\nvar exports = __webpack_exports__;\n\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Cell = exports.Column = exports.Row = exports.Table = exports.CellHookData = exports.__drawTable = exports.__createTable = exports.applyPlugin = void 0;\nvar applyPlugin_1 = __webpack_require__(340);\nvar inputParser_1 = __webpack_require__(776);\nvar tableDrawer_1 = __webpack_require__(664);\nvar tableCalculator_1 = __webpack_require__(972);\nvar models_1 = __webpack_require__(260);\nObject.defineProperty(exports, \"Table\", ({ enumerable: true, get: function () { return models_1.Table; } }));\nvar HookData_1 = __webpack_require__(172);\nObject.defineProperty(exports, \"CellHookData\", ({ enumerable: true, get: function () { return HookData_1.CellHookData; } }));\nvar models_2 = __webpack_require__(260);\nObject.defineProperty(exports, \"Cell\", ({ enumerable: true, get: function () { return models_2.Cell; } }));\nObject.defineProperty(exports, \"Column\", ({ enumerable: true, get: function () { return models_2.Column; } }));\nObject.defineProperty(exports, \"Row\", ({ enumerable: true, get: function () { return models_2.Row; } }));\n// export { applyPlugin } didn't export applyPlugin\n// to index.d.ts for some reason\nfunction applyPlugin(jsPDF) {\n (0, applyPlugin_1.default)(jsPDF);\n}\nexports.applyPlugin = applyPlugin;\nfunction autoTable(d, options) {\n var input = (0, inputParser_1.parseInput)(d, options);\n var table = (0, tableCalculator_1.createTable)(d, input);\n (0, tableDrawer_1.drawTable)(d, table);\n}\n// Experimental export\nfunction __createTable(d, options) {\n var input = (0, inputParser_1.parseInput)(d, options);\n return (0, tableCalculator_1.createTable)(d, input);\n}\nexports.__createTable = __createTable;\nfunction __drawTable(d, table) {\n (0, tableDrawer_1.drawTable)(d, table);\n}\nexports.__drawTable = __drawTable;\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var jsPDF = __webpack_require__(964);\n // Webpack imported jspdf instead of jsPDF for some reason\n // while it seemed to work everywhere else.\n if (jsPDF.jsPDF)\n jsPDF = jsPDF.jsPDF;\n applyPlugin(jsPDF);\n}\ncatch (error) {\n // Importing jspdf in nodejs environments does not work as of jspdf\n // 1.5.3 so we need to silence potential errors to support using for example\n // the nodejs jspdf dist files with the exported applyPlugin\n}\nexports[\"default\"] = autoTable;\n\n}();\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});","import { CANCEL } from '@redux-saga/symbols';\n\nvar MAX_SIGNED_INT = 2147483647;\nfunction delayP(ms, val) {\n if (val === void 0) {\n val = true;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value\n if (process.env.NODE_ENV !== 'production' && ms > MAX_SIGNED_INT) {\n throw new Error('delay only supports a maximum value of ' + MAX_SIGNED_INT + 'ms');\n }\n\n var timeoutId;\n var promise = new Promise(function (resolve) {\n timeoutId = setTimeout(resolve, Math.min(MAX_SIGNED_INT, ms), val);\n });\n\n promise[CANCEL] = function () {\n clearTimeout(timeoutId);\n };\n\n return promise;\n}\n\nexport default delayP;\n","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","import React from 'react';\n/**\n * TabContext\n * {\n * activeTabId: PropTypes.any\n * }\n */\n\nexport var TabContext = /*#__PURE__*/React.createContext({});","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = \"InvalidCharacterError\";\n\nfunction polyfill(input) {\n var str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\n \"'atob' failed: The string to be decoded is not correctly encoded.\"\n );\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\nexport default (typeof window !== \"undefined\" &&\n window.atob &&\n window.atob.bind(window)) ||\npolyfill;","import atob from \"./atob\";\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, function(m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\n\nexport default function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}","\"use strict\";\n\nimport base64_url_decode from \"./base64_url_decode\";\n\nexport function InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\n\nexport default function(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified\");\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split(\".\")[pos]));\n } catch (e) {\n throw new InvalidTokenError(\"Invalid token specified: \" + e.message);\n }\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar NODE_ENV = process.env.NODE_ENV;\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","import { useContext, createContext } from 'react'\nimport invariant from 'invariant'\n\nconst MapContext = createContext(null)\n\nexport function useGoogleMap(): google.maps.Map | null {\n invariant(!!useContext, 'useGoogleMap is React hook and requires React version 16.8+')\n\n const map = useContext(MapContext)\n\n invariant(!!map, 'useGoogleMap needs a GoogleMap available up in the tree')\n\n return map\n}\n\nexport default MapContext\n","/* global google */\n/* eslint-disable filenames/match-regex */\nimport { reduce } from './reduce'\nimport { forEach } from './foreach'\n\nexport function applyUpdaterToNextProps(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n updaterMap: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n prevProps: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nextProps: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n instance: any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const map: any = {}\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const iter = (fn: any, key: string): void => {\n const nextValue = nextProps[key]\n\n if (nextValue !== prevProps[key]) {\n map[key] = nextValue\n fn(instance, nextValue)\n }\n }\n\n forEach(updaterMap, iter)\n\n return map\n}\n\nexport function registerEvents(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n instance: any,\n eventMap: Record\n): google.maps.MapsEventListener[] {\n const registeredList = reduce(\n eventMap,\n function reducer(\n acc: google.maps.MapsEventListener[],\n googleEventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onEventName: any\n ): google.maps.MapsEventListener[] {\n if (typeof props[onEventName] === 'function') {\n acc.push(google.maps.event.addListener(instance, googleEventName, props[onEventName]))\n }\n\n return acc\n },\n []\n )\n\n return registeredList\n}\n\nfunction unregisterEvent(registered: google.maps.MapsEventListener): void {\n google.maps.event.removeListener(registered)\n}\n\nexport function unregisterEvents(events: google.maps.MapsEventListener[] = []): void {\n events.forEach(unregisterEvent)\n}\n\nexport function applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps,\n nextProps,\n instance,\n}: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n updaterMap: any\n eventMap: Record\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n prevProps: any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nextProps: any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n instance: any\n}): google.maps.MapsEventListener[] {\n const registeredEvents = registerEvents(nextProps, instance, eventMap)\n\n applyUpdaterToNextProps(updaterMap, prevProps, nextProps, instance)\n\n return registeredEvents\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function forEach(obj: any, fn: any): any {\n Object.keys(obj).forEach((key) => {\n return fn(obj[key], key)\n })\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function reduce(obj: any, fn: any, acc: any): any {\n return Object.keys(obj).reduce(function reducer(newAcc, key) {\n return fn(newAcc, obj[key], key)\n }, acc)\n}\n","import { type CSSProperties, PureComponent, type JSX, type ReactNode, useState, useRef, useEffect, memo } from 'react'\n\nimport MapContext from './map-context'\n\nimport { unregisterEvents, applyUpdatersToPropsAndRegisterEvents } from './utils/helper'\n\nconst eventMap = {\n onDblClick: 'dblclick',\n onDragEnd: 'dragend',\n onDragStart: 'dragstart',\n onMapTypeIdChanged: 'maptypeid_changed',\n onMouseMove: 'mousemove',\n onMouseOut: 'mouseout',\n onMouseOver: 'mouseover',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n onRightClick: 'rightclick',\n onTilesLoaded: 'tilesloaded',\n onBoundsChanged: 'bounds_changed',\n onCenterChanged: 'center_changed',\n onClick: 'click',\n onDrag: 'drag',\n onHeadingChanged: 'heading_changed',\n onIdle: 'idle',\n onProjectionChanged: 'projection_changed',\n onResize: 'resize',\n onTiltChanged: 'tilt_changed',\n onZoomChanged: 'zoom_changed',\n}\n\nconst updaterMap = {\n extraMapTypes(map: google.maps.Map, extra: google.maps.MapType[]): void {\n extra.forEach(function forEachExtra(it, i) {\n map.mapTypes.set(String(i), it)\n })\n },\n center(map: google.maps.Map, center: google.maps.LatLng | google.maps.LatLngLiteral): void {\n map.setCenter(center)\n },\n clickableIcons(map: google.maps.Map, clickable: boolean): void {\n map.setClickableIcons(clickable)\n },\n heading(map: google.maps.Map, heading: number): void {\n map.setHeading(heading)\n },\n mapTypeId(map: google.maps.Map, mapTypeId: string): void {\n map.setMapTypeId(mapTypeId)\n },\n options(map: google.maps.Map, options: google.maps.MapOptions): void {\n map.setOptions(options)\n },\n streetView(map: google.maps.Map, streetView: google.maps.StreetViewPanorama): void {\n map.setStreetView(streetView)\n },\n tilt(map: google.maps.Map, tilt: number): void {\n map.setTilt(tilt)\n },\n zoom(map: google.maps.Map, zoom: number): void {\n map.setZoom(zoom)\n },\n}\n\nexport interface GoogleMapState {\n map: google.maps.Map | null\n}\n\nexport interface GoogleMapProps {\n children?: ReactNode | undefined\n id?: string | undefined\n mapContainerStyle?: CSSProperties | undefined\n mapContainerClassName?: string | undefined\n options?: google.maps.MapOptions | undefined\n /** Additional map types to overlay. Overlay map types will display on top of the base map they are attached to, in the order in which they appear in the overlayMapTypes array (overlays with higher index values are displayed in front of overlays with lower index values). */\n extraMapTypes?: google.maps.MapType[] | undefined\n /** The initial Map center. */\n center?: google.maps.LatLng | google.maps.LatLngLiteral | undefined\n /** When false, map icons are not clickable. A map icon represents a point of interest, also known as a POI. By default map icons are clickable. */\n clickableIcons?: boolean | undefined\n /** The heading for aerial imagery in degrees measured clockwise from cardinal direction North. Headings are snapped to the nearest available angle for which imagery is available. */\n heading?: number | undefined\n /** The initial Map mapTypeId. Defaults to ROADMAP. */\n mapTypeId?: string | undefined\n /** A StreetViewPanorama to display when the Street View pegman is dropped on the map. If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped. */\n streetView?: google.maps.StreetViewPanorama | undefined\n /** Controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45. The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. Note: getTilt returns the current tilt angle, not the value specified by this option. Because getTilt and this option refer to different things, do not bind() the tilt property; doing so may yield unpredictable effects. */\n tilt?: number | undefined\n /** The initial Map zoom level. Required. Valid values: Integers between zero, and up to the supported maximum zoom level. */\n zoom?: number | undefined\n /** This event is fired when the user clicks on the map. An ApiMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a placeId is returned. IconMouseEvent and ApiMouseEvent are identical, except that IconMouseEvent has the placeId field. The event can always be treated as an ApiMouseEvent when the placeId is not important. The click event is not fired if a Marker or InfoWindow was clicked. */\n onClick?:( (e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the user double-clicks on the map. Note that the click event will also fire, right before this one. */\n onDblClick?:( (e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is repeatedly fired while the user drags the map. */\n onDrag?:( () => void) | undefined\n /** This event is fired when the user stops dragging the map. */\n onDragEnd?:( () => void) | undefined\n /** This event is fired when the user starts dragging the map. */\n onDragStart?:( () => void) | undefined\n /** This event is fired whenever the user's mouse moves over the map container. */\n onMouseMove?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the user's mouse exits the map container. */\n onMouseOut?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the user's mouse enters the map container. */\n onMouseOver?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the DOM mousedown event is fired on the map container. */\n onMouseDown?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the DOM mouseup event is fired on the map container. */\n onMouseUp?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the DOM contextmenu event is fired on the map container. */\n onRightClick?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the mapTypeId property changes. */\n onMapTypeIdChanged?:( () => void) | undefined\n /** This event is fired when the visible tiles have finished loading. */\n onTilesLoaded?: (() => void) | undefined\n /** This event is fired when the viewport bounds have changed. */\n onBoundsChanged?: (() => void) | undefined\n /** This event is fired when the map center property changes. */\n onCenterChanged?: (() => void) | undefined\n /** This event is fired when the map heading property changes. */\n onHeadingChanged?: (() => void) | undefined\n /** This event is fired when the map becomes idle after panning or zooming. */\n onIdle?: (() => void) | undefined\n /** This event is fired when the projection has changed. */\n onProjectionChanged?: (() => void) | undefined\n /** This event is fired when the map size has changed. */\n onResize?: (() => void) | undefined\n /** This event is fired when the map tilt property changes. */\n onTiltChanged?: (() => void) | undefined\n /** This event is fired when the map zoom property changes. */\n onZoomChanged?: (() => void) | undefined\n /** This callback is called when the map instance has loaded. It is called with the map instance. */\n onLoad?: ((map: google.maps.Map) => void | Promise) | undefined\n /** This callback is called when the component unmounts. It is called with the map instance. */\n onUnmount?: ((map: google.maps.Map) => void | Promise) | undefined\n}\n\n\n// TODO: unfinished!\nfunction GoogleMapFunctional({\n children,\n options,\n id,\n mapContainerStyle,\n mapContainerClassName,\n center,\n // clickableIcons,\n // extraMapTypes,\n // heading,\n // mapTypeId,\n onClick,\n onDblClick,\n onDrag,\n onDragEnd,\n onDragStart,\n onMouseMove,\n onMouseOut,\n onMouseOver,\n onMouseDown,\n onMouseUp,\n onRightClick,\n // onMapTypeIdChanged,\n // onTilesLoaded,\n // onBoundsChanged,\n onCenterChanged,\n // onHeadingChanged,\n // onIdle,\n // onProjectionChanged,\n // onResize,\n // onTiltChanged,\n // onZoomChanged,\n onLoad,\n onUnmount,\n}: GoogleMapProps): JSX.Element {\n const [map, setMap] = useState(null)\n const ref = useRef(null)\n\n // const [extraMapTypesListener, setExtraMapTypesListener] = useState(null)\n const [centerChangedListener, setCenterChangedListener] = useState(null)\n\n const [dblclickListener, setDblclickListener] = useState(null)\n const [dragendListener, setDragendListener] = useState(null)\n const [dragstartListener, setDragstartListener] = useState(null)\n const [mousedownListener, setMousedownListener] = useState(null)\n const [mousemoveListener, setMousemoveListener] = useState(null)\n const [mouseoutListener, setMouseoutListener] = useState(null)\n const [mouseoverListener, setMouseoverListener] = useState(null)\n const [mouseupListener, setMouseupListener] = useState(null)\n const [rightclickListener, setRightclickListener] = useState(null)\n const [clickListener, setClickListener] = useState(null)\n const [dragListener, setDragListener] = useState(null)\n\n // Order does matter\n useEffect(() => {\n if (options && map !== null) {\n map.setOptions(options)\n }\n }, [map, options])\n\n useEffect(() => {\n if (map !== null && typeof center !== 'undefined') {\n map.setCenter(center)\n }\n }, [map, center])\n\n useEffect(() => {\n if (map && onDblClick) {\n if (dblclickListener !== null) {\n google.maps.event.removeListener(dblclickListener)\n }\n\n setDblclickListener(\n google.maps.event.addListener(map, 'dblclick', onDblClick)\n )\n }\n }, [onDblClick])\n\n useEffect(() => {\n if (map && onDragEnd) {\n if (dragendListener !== null) {\n google.maps.event.removeListener(dragendListener)\n }\n\n setDragendListener(\n google.maps.event.addListener(map, 'dragend', onDragEnd)\n )\n }\n }, [onDragEnd])\n\n useEffect(() => {\n if (map && onDragStart) {\n if (dragstartListener !== null) {\n google.maps.event.removeListener(dragstartListener)\n }\n\n setDragstartListener(\n google.maps.event.addListener(map, 'dragstart', onDragStart)\n )\n }\n }, [onDragStart])\n\n useEffect(() => {\n if (map && onMouseDown) {\n if (mousedownListener !== null) {\n google.maps.event.removeListener(mousedownListener)\n }\n\n setMousedownListener(\n google.maps.event.addListener(map, 'mousedown', onMouseDown)\n )\n }\n }, [onMouseDown])\n\n useEffect(() => {\n if (map && onMouseMove) {\n if (mousemoveListener !== null) {\n google.maps.event.removeListener(mousemoveListener)\n }\n\n setMousemoveListener(\n google.maps.event.addListener(map, 'mousemove', onMouseMove)\n )\n }\n }, [onMouseMove])\n\n useEffect(() => {\n if (map && onMouseOut) {\n if (mouseoutListener !== null) {\n google.maps.event.removeListener(mouseoutListener)\n }\n\n setMouseoutListener(\n google.maps.event.addListener(map, 'mouseout', onMouseOut)\n )\n }\n }, [onMouseOut])\n\n useEffect(() => {\n if (map && onMouseOver) {\n if (mouseoverListener !== null) {\n google.maps.event.removeListener(mouseoverListener)\n }\n\n setMouseoverListener(\n google.maps.event.addListener(map, 'mouseover', onMouseOver)\n )\n }\n }, [onMouseOver])\n\n useEffect(() => {\n if (map && onMouseUp) {\n if (mouseupListener !== null) {\n google.maps.event.removeListener(mouseupListener)\n }\n\n setMouseupListener(\n google.maps.event.addListener(map, 'mouseup', onMouseUp)\n )\n }\n }, [onMouseUp])\n\n useEffect(() => {\n if (map && onRightClick) {\n if (rightclickListener !== null) {\n google.maps.event.removeListener(rightclickListener)\n }\n\n setRightclickListener(\n google.maps.event.addListener(map, 'rightclick', onRightClick)\n )\n }\n }, [onRightClick])\n\n useEffect(() => {\n if (map && onClick) {\n if (clickListener !== null) {\n google.maps.event.removeListener(clickListener)\n }\n\n setClickListener(\n google.maps.event.addListener(map, 'click', onClick)\n )\n }\n }, [onClick])\n\n useEffect(() => {\n if (map && onDrag) {\n if (dragListener !== null) {\n google.maps.event.removeListener(dragListener)\n }\n\n setDragListener(\n google.maps.event.addListener(map, 'drag', onDrag)\n )\n }\n }, [onDrag])\n\n useEffect(() => {\n if (map && onCenterChanged) {\n if (centerChangedListener !== null) {\n google.maps.event.removeListener(centerChangedListener)\n }\n\n setCenterChangedListener(\n google.maps.event.addListener(map, 'center_changed', onCenterChanged)\n )\n }\n }, [onClick])\n\n useEffect(() => {\n const map = ref.current === null\n ? null\n : new google.maps.Map(ref.current, options)\n\n setMap(map)\n\n if (map !== null && onLoad) {\n onLoad(map)\n }\n\n return () => {\n if (map !== null) {\n if (onUnmount) {\n onUnmount(map)\n }\n }\n }\n }, [])\n\n return (\n \n \n {map !== null ? children : null}\n \n
\n )\n}\n\nexport const GoogleMapF = memo(GoogleMapFunctional)\n\nexport class GoogleMap extends PureComponent {\n override state: GoogleMapState = {\n map: null,\n }\n\n registeredEvents: google.maps.MapsEventListener[] = []\n\n mapRef: HTMLDivElement | null = null\n\n getInstance = (): google.maps.Map | null => {\n if (this.mapRef === null) {\n return null\n }\n\n return new google.maps.Map(this.mapRef, this.props.options)\n }\n\n panTo = (latLng: google.maps.LatLng | google.maps.LatLngLiteral): void => {\n const map = this.getInstance()\n if (map) {\n map.panTo(latLng)\n }\n }\n\n setMapCallback = (): void => {\n if (this.state.map !== null) {\n if (this.props.onLoad) {\n this.props.onLoad(this.state.map)\n }\n }\n }\n\n override componentDidMount(): void {\n const map = this.getInstance()\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps: {},\n nextProps: this.props,\n instance: map,\n })\n\n this.setState(function setMap() {\n return {\n map,\n }\n }, this.setMapCallback)\n }\n\n override componentDidUpdate(prevProps: GoogleMapProps): void {\n if (this.state.map !== null) {\n unregisterEvents(this.registeredEvents)\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps,\n nextProps: this.props,\n instance: this.state.map,\n })\n }\n }\n\n override componentWillUnmount(): void {\n if (this.state.map !== null) {\n if (this.props.onUnmount) {\n this.props.onUnmount(this.state.map)\n }\n\n unregisterEvents(this.registeredEvents)\n }\n }\n\n getRef: React.LegacyRef = (ref: HTMLDivElement | null): void => {\n this.mapRef = ref\n }\n\n override render(): ReactNode {\n return (\n \n \n {this.state.map !== null ? this.props.children : null}\n \n
\n )\n }\n}\n\nexport default GoogleMap\n","export const isBrowser: boolean = typeof document !== 'undefined'\n","import { isBrowser } from './isbrowser'\n\ninterface WindowWithGoogleMap extends Window {\n initMap?: (() => void) | undefined\n}\n\ninterface InjectScriptArg {\n url: string\n id: string\n nonce?: string | undefined\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function injectScript({ url, id, nonce }: InjectScriptArg): Promise {\n if (!isBrowser) {\n return Promise.reject(new Error('document is undefined'))\n }\n\n return new Promise(function injectScriptCallback(resolve, reject) {\n const existingScript = document.getElementById(id) as HTMLScriptElement | undefined\n\n const windowWithGoogleMap: WindowWithGoogleMap = window\n\n if (existingScript) {\n // Same script id/url: keep same script\n const dataStateAttribute = existingScript.getAttribute('data-state')\n\n if (existingScript.src === url && dataStateAttribute !== 'error') {\n if (dataStateAttribute === 'ready') {\n return resolve(id)\n } else {\n const originalInitMap = windowWithGoogleMap.initMap\n\n const originalErrorCallback = existingScript.onerror\n\n windowWithGoogleMap.initMap = function initMap(): void {\n if (originalInitMap) {\n originalInitMap()\n }\n resolve(id)\n }\n\n existingScript.onerror = function(err): void {\n if (originalErrorCallback) {\n originalErrorCallback(err)\n }\n reject(err)\n }\n\n return\n }\n }\n // Same script id, but either\n // 1. requested URL is different\n // 2. script failed to load\n else {\n existingScript.remove()\n }\n }\n\n const script = document.createElement('script')\n\n script.type = 'text/javascript'\n script.src = url\n script.id = id\n script.async = true\n script.nonce = nonce || ''\n script.onerror = function onerror(err): void {\n script.setAttribute('data-state', 'error')\n\n reject(err)\n }\n\n windowWithGoogleMap.initMap = function onload(): void {\n script.setAttribute('data-state', 'ready')\n\n resolve(id)\n }\n\n document.head.appendChild(script)\n }).catch(err => {\n console.error('injectScript error: ', err)\n\n throw err\n })\n}\n","function isGoogleFontStyle(element: Node): boolean {\n // 'Roboto' or 'Google Sans Text' font download\n const href = (element as HTMLLinkElement).href;\n if (\n href && (\n href.indexOf('https://fonts.googleapis.com/css?family=Roboto') === 0 ||\n href.indexOf('https://fonts.googleapis.com/css?family=Google+Sans+Text') === 0\n )\n ) {\n return true\n }\n // font style elements\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.tagName.toLowerCase() === 'style' &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.styleSheet &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.styleSheet.cssText &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.styleSheet.cssText.replace('\\r\\n', '').indexOf('.gm-style') === 0\n ) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.styleSheet.cssText = ''\n return true\n }\n // font style elements for other browsers\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.tagName.toLowerCase() === 'style' &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.innerHTML &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.innerHTML.replace('\\r\\n', '').indexOf('.gm-style') === 0\n ) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.innerHTML = ''\n return true\n }\n // when google tries to add empty style\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n element.tagName.toLowerCase() === 'style' &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n !element.styleSheet &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n !element.innerHTML\n ) {\n return true\n }\n\n return false\n}\n\n// Preventing the Google Maps library from downloading an extra font\nexport function preventGoogleFonts (): void {\n // we override these methods only for one particular head element\n // default methods for other elements are not affected\n const head = document.getElementsByTagName('head')[0]\n\n if (head) {\n const trueInsertBefore = head.insertBefore.bind(head)\n\n // TODO: adding return before reflect solves the TS issue\n\n head.insertBefore = function insertBefore(\n newElement: T,\n referenceElement: HTMLElement\n ): T {\n if (!isGoogleFontStyle(newElement)) {\n Reflect.apply(trueInsertBefore, head, [newElement, referenceElement])\n }\n\n return newElement\n }\n\n const trueAppend = head.appendChild.bind(head)\n\n // TODO: adding return before reflect solves the TS issue\n\n head.appendChild = function appendChild(textNode: T): T {\n if (!isGoogleFontStyle(textNode)) {\n Reflect.apply(trueAppend, head, [textNode])\n }\n\n return textNode\n }\n }\n\n}\n","import type { Library } from '@googlemaps/js-api-loader'\nimport invariant from 'invariant'\n\nexport type Libraries = Library[]\n\nexport interface LoadScriptUrlOptions {\n googleMapsApiKey: string | \"\"\n googleMapsClientId?: string | undefined\n version?: string | undefined\n language?: string | undefined\n region?: string | undefined\n libraries?: Libraries | undefined\n channel?: string | undefined\n mapIds?: string[] | undefined\n authReferrerPolicy?: 'origin' | undefined\n}\n\nexport function makeLoadScriptUrl({\n googleMapsApiKey,\n googleMapsClientId,\n version = 'weekly',\n language,\n region,\n libraries,\n channel,\n mapIds,\n authReferrerPolicy\n}: LoadScriptUrlOptions): string {\n const params = []\n\n invariant(\n (googleMapsApiKey && googleMapsClientId) || !(googleMapsApiKey && googleMapsClientId),\n 'You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time.'\n )\n\n if (googleMapsApiKey) {\n params.push(`key=${googleMapsApiKey}`)\n } else if (googleMapsClientId) {\n params.push(`client=${googleMapsClientId}`)\n }\n\n if (version) {\n params.push(`v=${version}`)\n }\n\n if (language) {\n params.push(`language=${language}`)\n }\n\n if (region) {\n params.push(`region=${region}`)\n }\n\n if (libraries && libraries.length) {\n params.push(`libraries=${libraries.sort().join(',')}`)\n }\n\n if (channel) {\n params.push(`channel=${channel}`)\n }\n\n if (mapIds && mapIds.length) {\n params.push(`map_ids=${mapIds.join(',')}`)\n }\n\n if (authReferrerPolicy) {\n params.push(`auth_referrer_policy=${authReferrerPolicy}`)\n }\n\n params.push('callback=initMap')\n\n return `https://maps.googleapis.com/maps/api/js?${params.join('&')}`\n}\n","import { createRef, PureComponent, type ReactNode, type RefObject } from 'react'\nimport invariant from 'invariant'\n\nimport { injectScript } from './utils/injectscript'\nimport { preventGoogleFonts } from './utils/prevent-google-fonts'\n\nimport { isBrowser } from './utils/isbrowser'\nimport { LoadScriptUrlOptions, makeLoadScriptUrl } from './utils/make-load-script-url'\n\nlet cleaningUp = false\n\ninterface LoadScriptState {\n loaded: boolean\n}\n\nexport interface LoadScriptProps extends LoadScriptUrlOptions {\n children?: ReactNode | undefined\n id: string\n nonce?: string | undefined\n loadingElement?: ReactNode\n onLoad?: () => void\n onError?: (error: Error) => void\n onUnmount?: () => void\n preventGoogleFontsLoading?: boolean\n}\n\nexport function DefaultLoadingElement(): JSX.Element {\n return {`Loading...`}
\n}\n\nexport const defaultLoadScriptProps = {\n id: 'script-loader',\n version: 'weekly',\n}\n\nclass LoadScript extends PureComponent {\n public static defaultProps = defaultLoadScriptProps\n\n check: RefObject = createRef()\n\n override state = {\n loaded: false,\n }\n\n cleanupCallback = (): void => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete window.google.maps\n\n this.injectScript()\n }\n\n override componentDidMount(): void {\n if (isBrowser) {\n if (window.google && window.google.maps && !cleaningUp) {\n console.error('google api is already presented')\n\n return\n }\n\n this.isCleaningUp()\n .then(this.injectScript)\n .catch(function error(err) {\n console.error('Error at injecting script after cleaning up: ', err)\n })\n }\n }\n\n override componentDidUpdate(prevProps: LoadScriptProps): void {\n if (this.props.libraries !== prevProps.libraries) {\n console.warn(\n 'Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables'\n )\n }\n\n if (isBrowser && prevProps.language !== this.props.language) {\n this.cleanup()\n // TODO: refactor to use gDSFP maybe... wait for hooks refactoring.\n this.setState(function setLoaded() {\n return {\n loaded: false,\n }\n }, this.cleanupCallback)\n }\n }\n\n override componentWillUnmount(): void {\n if (isBrowser) {\n this.cleanup()\n\n const timeoutCallback = (): void => {\n if (!this.check.current) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete window.google\n cleaningUp = false\n }\n }\n\n window.setTimeout(timeoutCallback, 1)\n\n if (this.props.onUnmount) {\n this.props.onUnmount()\n }\n }\n }\n\n isCleaningUp = async (): Promise => {\n function promiseCallback(resolve: () => void): void {\n if (!cleaningUp) {\n resolve()\n } else {\n if (isBrowser) {\n const timer = window.setInterval(function interval() {\n if (!cleaningUp) {\n window.clearInterval(timer)\n\n resolve()\n }\n }, 1)\n }\n }\n\n return\n }\n\n return new Promise(promiseCallback)\n }\n\n cleanup = (): void => {\n cleaningUp = true\n const script = document.getElementById(this.props.id)\n\n if (script && script.parentNode) {\n script.parentNode.removeChild(script)\n }\n\n Array.prototype.slice\n .call(document.getElementsByTagName('script'))\n .filter(function filter(script: HTMLScriptElement): boolean {\n return typeof script.src === 'string' && script.src.includes('maps.googleapis')\n })\n .forEach(function forEach(script: HTMLScriptElement): void {\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n })\n\n Array.prototype.slice\n .call(document.getElementsByTagName('link'))\n .filter(function filter(link: HTMLLinkElement): boolean {\n return (\n link.href === 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans'\n )\n })\n .forEach(function forEach(link: HTMLLinkElement) {\n if (link.parentNode) {\n link.parentNode.removeChild(link)\n }\n })\n\n Array.prototype.slice\n .call(document.getElementsByTagName('style'))\n .filter(function filter(style: HTMLStyleElement): boolean {\n return (\n style.innerText !== undefined &&\n style.innerText.length > 0 &&\n style.innerText.includes('.gm-')\n )\n })\n .forEach(function forEach(style: HTMLStyleElement) {\n if (style.parentNode) {\n style.parentNode.removeChild(style)\n }\n })\n }\n\n injectScript = (): void => {\n if (this.props.preventGoogleFontsLoading) {\n preventGoogleFonts()\n }\n\n invariant(!!this.props.id, 'LoadScript requires \"id\" prop to be a string: %s', this.props.id)\n\n const injectScriptOptions = {\n id: this.props.id,\n nonce: this.props.nonce,\n url: makeLoadScriptUrl(this.props),\n }\n\n injectScript(injectScriptOptions)\n .then(() => {\n if (this.props.onLoad) {\n this.props.onLoad()\n }\n\n this.setState(function setLoaded() {\n return {\n loaded: true,\n }\n })\n\n return\n })\n .catch(err => {\n if (this.props.onError) {\n this.props.onError(err)\n }\n\n console.error(`\n There has been an Error with loading Google Maps API script, please check that you provided correct google API key (${this\n .props.googleMapsApiKey || '-'}) or Client ID (${this.props.googleMapsClientId ||\n '-'}) to \n Otherwise it is a Network issue.\n `)\n })\n }\n\n override render(): ReactNode {\n return (\n <>\n
\n\n {this.state.loaded\n ? this.props.children\n : this.props.loadingElement || }\n >\n )\n }\n}\n\nexport default LoadScript\n","/* eslint-disable filenames/match-regex */\nimport { useEffect, useRef, useState } from 'react'\nimport invariant from 'invariant'\n\nimport { isBrowser } from './utils/isbrowser'\nimport { injectScript } from './utils/injectscript'\nimport { preventGoogleFonts } from './utils/prevent-google-fonts'\nimport { makeLoadScriptUrl, LoadScriptUrlOptions } from './utils/make-load-script-url'\n\nimport { defaultLoadScriptProps } from './LoadScript'\n\nexport interface UseLoadScriptOptions extends LoadScriptUrlOptions {\n id?: string | undefined\n nonce?: string | undefined\n preventGoogleFontsLoading?: boolean | undefined\n}\n\nlet previouslyLoadedUrl: string\n\nexport function useLoadScript({\n id = defaultLoadScriptProps.id,\n version = defaultLoadScriptProps.version,\n nonce,\n googleMapsApiKey,\n googleMapsClientId,\n language,\n region,\n libraries,\n preventGoogleFontsLoading,\n channel,\n mapIds,\n authReferrerPolicy,\n}: UseLoadScriptOptions): {\n isLoaded: boolean\n loadError: Error | undefined\n url: string\n} {\n const isMounted = useRef(false)\n const [isLoaded, setLoaded] = useState(false)\n const [loadError, setLoadError] = useState(undefined)\n\n useEffect(function trackMountedState() {\n isMounted.current = true\n return (): void => {\n isMounted.current = false\n }\n }, [])\n\n useEffect(\n function applyPreventGoogleFonts() {\n if (isBrowser && preventGoogleFontsLoading) {\n preventGoogleFonts()\n }\n },\n [preventGoogleFontsLoading]\n )\n\n useEffect(\n function validateLoadedState() {\n if (isLoaded) {\n invariant(\n !!window.google,\n 'useLoadScript was marked as loaded, but window.google is not present. Something went wrong.'\n )\n }\n },\n [isLoaded]\n )\n\n const url = makeLoadScriptUrl({\n version,\n googleMapsApiKey,\n googleMapsClientId,\n language,\n region,\n libraries,\n channel,\n mapIds,\n authReferrerPolicy\n })\n\n useEffect(\n function loadScriptAndModifyLoadedState() {\n if (!isBrowser) {\n return\n }\n\n function setLoadedIfMounted(): void {\n if (isMounted.current) {\n setLoaded(true)\n previouslyLoadedUrl = url\n }\n }\n\n if (window.google && window.google.maps && previouslyLoadedUrl === url) {\n setLoadedIfMounted()\n return\n }\n\n injectScript({ id, url, nonce })\n .then(setLoadedIfMounted)\n .catch(function handleInjectError(err) {\n if (isMounted.current) {\n setLoadError(err)\n }\n console.warn(`\n There has been an Error with loading Google Maps API script, please check that you provided correct google API key (${googleMapsApiKey ||\n '-'}) or Client ID (${googleMapsClientId || '-'})\n Otherwise it is a Network issue.\n `)\n console.error(err)\n })\n },\n [id, url, nonce]\n )\n\n const prevLibraries = useRef()\n\n useEffect(\n function checkPerformance() {\n if (prevLibraries.current && libraries !== prevLibraries.current) {\n console.warn(\n 'Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables'\n )\n }\n prevLibraries.current = libraries\n },\n [libraries]\n )\n\n return { isLoaded, loadError, url }\n}\n","import { memo, ReactElement, useEffect, type JSX } from 'react'\n\nimport { DefaultLoadingElement } from './LoadScript'\nimport { useLoadScript, UseLoadScriptOptions } from './useLoadScript'\n\nexport interface LoadScriptNextProps extends UseLoadScriptOptions {\n loadingElement?: ReactElement | undefined\n onLoad?: (() => void) | undefined\n onError?: ((error: Error) => void) | undefined\n onUnmount?: (() => void) | undefined\n children: ReactElement\n}\n\nconst defaultLoadingElement = \n\nfunction LoadScriptNext({\n loadingElement,\n onLoad,\n onError,\n onUnmount,\n children,\n ...hookOptions\n}: LoadScriptNextProps): JSX.Element {\n const { isLoaded, loadError } = useLoadScript(hookOptions)\n\n useEffect(\n function handleOnLoad() {\n if (isLoaded && typeof onLoad === 'function') {\n onLoad()\n }\n },\n [isLoaded, onLoad]\n )\n\n useEffect(\n function handleOnError() {\n if (loadError && typeof onError === 'function') {\n onError(loadError)\n }\n },\n [loadError, onError]\n )\n\n useEffect(\n function handleOnUnmount() {\n return () => {\n if (onUnmount) {\n onUnmount()\n }\n }\n },\n [onUnmount]\n )\n\n return isLoaded ? children : loadingElement || defaultLoadingElement\n}\n\nexport default memo(LoadScriptNext)\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nvar fastDeepEqual = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n\n/**\n * Copyright 2019 Google LLC. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at.\n *\n * Http://www.apache.org/licenses/LICENSE-2.0.\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DEFAULT_ID = \"__googleMapsScriptId\";\n/**\n * The status of the [[Loader]].\n */\nvar LoaderStatus;\n(function (LoaderStatus) {\n LoaderStatus[LoaderStatus[\"INITIALIZED\"] = 0] = \"INITIALIZED\";\n LoaderStatus[LoaderStatus[\"LOADING\"] = 1] = \"LOADING\";\n LoaderStatus[LoaderStatus[\"SUCCESS\"] = 2] = \"SUCCESS\";\n LoaderStatus[LoaderStatus[\"FAILURE\"] = 3] = \"FAILURE\";\n})(LoaderStatus || (LoaderStatus = {}));\n/**\n * [[Loader]] makes it easier to add Google Maps JavaScript API to your application\n * dynamically using\n * [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n * It works by dynamically creating and appending a script node to the the\n * document head and wrapping the callback function so as to return a promise.\n *\n * ```\n * const loader = new Loader({\n * apiKey: \"\",\n * version: \"weekly\",\n * libraries: [\"places\"]\n * });\n *\n * loader.load().then((google) => {\n * const map = new google.maps.Map(...)\n * })\n * ```\n */\nclass Loader {\n /**\n * Creates an instance of Loader using [[LoaderOptions]]. No defaults are set\n * using this library, instead the defaults are set by the Google Maps\n * JavaScript API server.\n *\n * ```\n * const loader = Loader({apiKey, version: 'weekly', libraries: ['places']});\n * ```\n */\n constructor({ apiKey, authReferrerPolicy, channel, client, id = DEFAULT_ID, language, libraries = [], mapIds, nonce, region, retries = 3, url = \"https://maps.googleapis.com/maps/api/js\", version, }) {\n this.callbacks = [];\n this.done = false;\n this.loading = false;\n this.errors = [];\n this.apiKey = apiKey;\n this.authReferrerPolicy = authReferrerPolicy;\n this.channel = channel;\n this.client = client;\n this.id = id || DEFAULT_ID; // Do not allow empty string\n this.language = language;\n this.libraries = libraries;\n this.mapIds = mapIds;\n this.nonce = nonce;\n this.region = region;\n this.retries = retries;\n this.url = url;\n this.version = version;\n if (Loader.instance) {\n if (!fastDeepEqual(this.options, Loader.instance.options)) {\n throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(Loader.instance.options)}`);\n }\n return Loader.instance;\n }\n Loader.instance = this;\n }\n get options() {\n return {\n version: this.version,\n apiKey: this.apiKey,\n channel: this.channel,\n client: this.client,\n id: this.id,\n libraries: this.libraries,\n language: this.language,\n region: this.region,\n mapIds: this.mapIds,\n nonce: this.nonce,\n url: this.url,\n authReferrerPolicy: this.authReferrerPolicy,\n };\n }\n get status() {\n if (this.errors.length) {\n return LoaderStatus.FAILURE;\n }\n if (this.done) {\n return LoaderStatus.SUCCESS;\n }\n if (this.loading) {\n return LoaderStatus.LOADING;\n }\n return LoaderStatus.INITIALIZED;\n }\n get failed() {\n return this.done && !this.loading && this.errors.length >= this.retries + 1;\n }\n /**\n * CreateUrl returns the Google Maps JavaScript API script url given the [[LoaderOptions]].\n *\n * @ignore\n * @deprecated\n */\n createUrl() {\n let url = this.url;\n url += `?callback=__googleMapsCallback`;\n if (this.apiKey) {\n url += `&key=${this.apiKey}`;\n }\n if (this.channel) {\n url += `&channel=${this.channel}`;\n }\n if (this.client) {\n url += `&client=${this.client}`;\n }\n if (this.libraries.length > 0) {\n url += `&libraries=${this.libraries.join(\",\")}`;\n }\n if (this.language) {\n url += `&language=${this.language}`;\n }\n if (this.region) {\n url += `®ion=${this.region}`;\n }\n if (this.version) {\n url += `&v=${this.version}`;\n }\n if (this.mapIds) {\n url += `&map_ids=${this.mapIds.join(\",\")}`;\n }\n if (this.authReferrerPolicy) {\n url += `&auth_referrer_policy=${this.authReferrerPolicy}`;\n }\n return url;\n }\n deleteScript() {\n const script = document.getElementById(this.id);\n if (script) {\n script.remove();\n }\n }\n /**\n * Load the Google Maps JavaScript API script and return a Promise.\n * @deprecated, use importLibrary() instead.\n */\n load() {\n return this.loadPromise();\n }\n /**\n * Load the Google Maps JavaScript API script and return a Promise.\n *\n * @ignore\n * @deprecated, use importLibrary() instead.\n */\n loadPromise() {\n return new Promise((resolve, reject) => {\n this.loadCallback((err) => {\n if (!err) {\n resolve(window.google);\n }\n else {\n reject(err.error);\n }\n });\n });\n }\n importLibrary(name) {\n this.execute();\n return google.maps.importLibrary(name);\n }\n /**\n * Load the Google Maps JavaScript API script with a callback.\n * @deprecated, use importLibrary() instead.\n */\n loadCallback(fn) {\n this.callbacks.push(fn);\n this.execute();\n }\n /**\n * Set the script on document.\n */\n setScript() {\n var _a, _b;\n if (document.getElementById(this.id)) {\n // TODO wrap onerror callback for cases where the script was loaded elsewhere\n this.callback();\n return;\n }\n const params = {\n key: this.apiKey,\n channel: this.channel,\n client: this.client,\n libraries: this.libraries.length && this.libraries,\n v: this.version,\n mapIds: this.mapIds,\n language: this.language,\n region: this.region,\n authReferrerPolicy: this.authReferrerPolicy,\n };\n // keep the URL minimal:\n Object.keys(params).forEach(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (key) => !params[key] && delete params[key]);\n if (!((_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.importLibrary)) {\n // tweaked copy of https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import\n // which also sets the base url, the id, and the nonce\n /* eslint-disable */\n ((g) => {\n // @ts-ignore\n let h, a, k, p = \"The Google Maps JavaScript API\", c = \"google\", l = \"importLibrary\", q = \"__ib__\", m = document, b = window;\n // @ts-ignore\n b = b[c] || (b[c] = {});\n // @ts-ignore\n const d = b.maps || (b.maps = {}), r = new Set(), e = new URLSearchParams(), u = () => \n // @ts-ignore\n h || (h = new Promise((f, n) => __awaiter(this, void 0, void 0, function* () {\n var _a;\n yield (a = m.createElement(\"script\"));\n a.id = this.id;\n e.set(\"libraries\", [...r] + \"\");\n // @ts-ignore\n for (k in g)\n e.set(k.replace(/[A-Z]/g, (t) => \"_\" + t[0].toLowerCase()), g[k]);\n e.set(\"callback\", c + \".maps.\" + q);\n a.src = this.url + `?` + e;\n d[q] = f;\n a.onerror = () => (h = n(Error(p + \" could not load.\")));\n // @ts-ignore\n a.nonce = this.nonce || ((_a = m.querySelector(\"script[nonce]\")) === null || _a === void 0 ? void 0 : _a.nonce) || \"\";\n m.head.append(a);\n })));\n // @ts-ignore\n d[l] ? console.warn(p + \" only loads once. Ignoring:\", g) : (d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n)));\n })(params);\n /* eslint-enable */\n }\n // While most libraries populate the global namespace when loaded via bootstrap params,\n // this is not the case for \"marker\" when used with the inline bootstrap loader\n // (and maybe others in the future). So ensure there is an importLibrary for each:\n const libraryPromises = this.libraries.map((library) => this.importLibrary(library));\n // ensure at least one library, to kick off loading...\n if (!libraryPromises.length) {\n libraryPromises.push(this.importLibrary(\"core\"));\n }\n Promise.all(libraryPromises).then(() => this.callback(), (error) => {\n const event = new ErrorEvent(\"error\", { error }); // for backwards compat\n this.loadErrorCallback(event);\n });\n }\n /**\n * Reset the loader state.\n */\n reset() {\n this.deleteScript();\n this.done = false;\n this.loading = false;\n this.errors = [];\n this.onerrorEvent = null;\n }\n resetIfRetryingFailed() {\n if (this.failed) {\n this.reset();\n }\n }\n loadErrorCallback(e) {\n this.errors.push(e);\n if (this.errors.length <= this.retries) {\n const delay = this.errors.length * Math.pow(2, this.errors.length);\n console.error(`Failed to load Google Maps script, retrying in ${delay} ms.`);\n setTimeout(() => {\n this.deleteScript();\n this.setScript();\n }, delay);\n }\n else {\n this.onerrorEvent = e;\n this.callback();\n }\n }\n callback() {\n this.done = true;\n this.loading = false;\n this.callbacks.forEach((cb) => {\n cb(this.onerrorEvent);\n });\n this.callbacks = [];\n }\n execute() {\n this.resetIfRetryingFailed();\n if (this.done) {\n this.callback();\n }\n else {\n // short circuit and warn if google.maps is already loaded\n if (window.google && window.google.maps && window.google.maps.version) {\n console.warn(\"Google Maps already loaded outside @googlemaps/js-api-loader.\" +\n \"This may result in undesirable behavior as options and script parameters may not match.\");\n this.callback();\n return;\n }\n if (this.loading) ;\n else {\n this.loading = true;\n this.setScript();\n }\n }\n }\n}\n\nexport { DEFAULT_ID, Loader, LoaderStatus };\n//# sourceMappingURL=index.esm.js.map\n","import { useEffect, useMemo, useRef, useState } from 'react'\nimport { Loader } from '@googlemaps/js-api-loader'\n\nimport { isBrowser } from './utils/isbrowser'\nimport { preventGoogleFonts } from './utils/prevent-google-fonts'\nimport type { LoadScriptUrlOptions, Libraries } from './utils/make-load-script-url'\n\nimport { defaultLoadScriptProps } from './LoadScript'\n\nexport interface UseLoadScriptOptions extends LoadScriptUrlOptions {\n id?: string | undefined\n nonce?: string | undefined\n preventGoogleFontsLoading?: boolean | undefined\n}\n\nconst defaultLibraries: Libraries = ['maps']\n\nexport function useJsApiLoader({\n id = defaultLoadScriptProps.id,\n version = defaultLoadScriptProps.version,\n nonce,\n googleMapsApiKey,\n // googleMapsClientId,\n language,\n region,\n libraries = defaultLibraries,\n preventGoogleFontsLoading,\n // channel,\n mapIds,\n authReferrerPolicy,\n}: UseLoadScriptOptions): {\n isLoaded: boolean\n loadError: Error | undefined\n} {\n const isMounted = useRef(false)\n const [isLoaded, setLoaded] = useState(false)\n const [loadError, setLoadError] = useState(undefined)\n\n useEffect(function trackMountedState() {\n isMounted.current = true\n return (): void => {\n isMounted.current = false\n }\n }, [])\n\n const loader = useMemo(() => {\n return new Loader({\n id,\n apiKey: googleMapsApiKey,\n version,\n libraries,\n language: language || 'en',\n region: region || 'US',\n mapIds: mapIds || [],\n nonce: nonce || '',\n authReferrerPolicy: authReferrerPolicy || 'origin',\n })\n }, [id, googleMapsApiKey, version, libraries, language, region, mapIds, nonce, authReferrerPolicy])\n\n useEffect(function effect() {\n if (isLoaded) {\n return\n } else {\n loader.load().then(() => {\n if (isMounted.current) {setLoaded(true)}\n\n return\n })\n .catch((error) => {\n setLoadError(error)\n })\n }\n }, [])\n\n\n useEffect(\n () => {\n if (isBrowser && preventGoogleFontsLoading) {\n preventGoogleFonts()\n }\n },\n [preventGoogleFontsLoading]\n )\n\n const prevLibraries = useRef()\n\n useEffect(\n () => {\n if (prevLibraries.current && libraries !== prevLibraries.current) {\n console.warn(\n 'Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables'\n )\n }\n prevLibraries.current = libraries\n },\n [libraries]\n )\n\n return { isLoaded, loadError }\n}\n","import { memo, PureComponent, useContext, useEffect, useState, type ContextType } from 'react'\n\nimport { applyUpdatersToPropsAndRegisterEvents, unregisterEvents } from '../../utils/helper'\nimport MapContext from '../../map-context'\n\nconst eventMap = {}\n\nconst updaterMap = {\n options(instance: google.maps.TrafficLayer, options: google.maps.TrafficLayerOptions): void {\n instance.setOptions(options)\n },\n}\n\ninterface TrafficLayerState {\n trafficLayer: google.maps.TrafficLayer | null\n}\n\nexport interface TrafficLayerProps {\n options?: google.maps.TrafficLayerOptions | undefined\n /** This callback is called when the trafficLayer instance has loaded. It is called with the trafficLayer instance. */\n onLoad?: ((trafficLayer: google.maps.TrafficLayer) => void) | undefined\n /** This callback is called when the component unmounts. It is called with the trafficLayer instance. */\n onUnmount?: ((trafficLayer: google.maps.TrafficLayer) => void) | undefined\n}\n\nfunction TrafficLayerFunctional({ options, onLoad, onUnmount }: TrafficLayerProps): null {\n const map = useContext(MapContext)\n\n const [instance, setInstance] = useState(null)\n\n // Order does matter\n useEffect(() => {\n if (instance !== null) {\n instance.setMap(map)\n }\n }, [map])\n\n useEffect(() => {\n if (options && instance !== null) {\n\n instance.setOptions(options)\n }\n }, [instance, options])\n\n useEffect(() => {\n const trafficLayer = new google.maps.TrafficLayer({\n ...(options || {}),\n map,\n })\n\n setInstance(trafficLayer)\n\n if (onLoad) {\n onLoad(trafficLayer)\n }\n\n return () => {\n if (instance !== null) {\n if (onUnmount) {\n onUnmount(instance)\n }\n\n instance.setMap(null)\n }\n }\n }, [])\n\n return null\n}\n\nexport const TrafficLayerF = memo(TrafficLayerFunctional)\n\nexport class TrafficLayer extends PureComponent {\n static override contextType = MapContext\n declare context: ContextType\n\n override state: TrafficLayerState = {\n trafficLayer: null,\n }\n\n setTrafficLayerCallback = () => {\n if (this.state.trafficLayer !== null && this.props.onLoad) {\n this.props.onLoad(this.state.trafficLayer)\n }\n }\n\n registeredEvents: google.maps.MapsEventListener[] = []\n\n override componentDidMount(): void {\n const trafficLayer = new google.maps.TrafficLayer({\n ...(this.props.options || {}),\n map: this.context,\n })\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps: {},\n nextProps: this.props,\n instance: trafficLayer,\n })\n\n this.setState(function setTrafficLayer() {\n return {\n trafficLayer,\n }\n }, this.setTrafficLayerCallback)\n }\n\n override componentDidUpdate(prevProps: TrafficLayerProps): void {\n if (this.state.trafficLayer !== null) {\n unregisterEvents(this.registeredEvents)\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps,\n nextProps: this.props,\n instance: this.state.trafficLayer,\n })\n }\n }\n\n override componentWillUnmount(): void {\n if (this.state.trafficLayer !== null) {\n if (this.props.onUnmount) {\n this.props.onUnmount(this.state.trafficLayer)\n }\n\n unregisterEvents(this.registeredEvents)\n\n\n this.state.trafficLayer.setMap(null)\n }\n }\n\n override render(): null {\n return null\n }\n}\n\nexport default TrafficLayer\n","import { memo, PureComponent, useContext, useEffect, useState, type ContextType } from 'react'\n\nimport MapContext from '../../map-context'\n\ninterface BicyclingLayerState {\n bicyclingLayer: google.maps.BicyclingLayer | null\n}\n\nexport interface BicyclingLayerProps {\n /** This callback is called when the bicyclingLayer instance has loaded. It is called with the bicyclingLayer instance. */\n onLoad?: ((bicyclingLayer: google.maps.BicyclingLayer) => void) | undefined\n /** This callback is called when the component unmounts. It is called with the bicyclingLayer instance. */\n onUnmount?: ((bicyclingLayer: google.maps.BicyclingLayer) => void) | undefined\n}\n\nfunction BicyclingLayerFunctional({ onLoad, onUnmount }: BicyclingLayerProps): null {\n const map = useContext(MapContext)\n\n const [instance, setInstance] = useState(null)\n\n // Order does matter\n useEffect(() => {\n if (instance !== null) {\n instance.setMap(map)\n }\n }, [map])\n\n useEffect(() => {\n const bicyclingLayer = new google.maps.BicyclingLayer()\n\n setInstance(bicyclingLayer)\n\n bicyclingLayer.setMap(map)\n\n if (onLoad) {\n onLoad(bicyclingLayer)\n }\n\n return () => {\n if (bicyclingLayer !== null) {\n if (onUnmount) {\n onUnmount(bicyclingLayer)\n }\n\n bicyclingLayer.setMap(null)\n }\n }\n }, [])\n\n return null\n}\n\nexport const BicyclingLayerF = memo(BicyclingLayerFunctional)\n\nexport class BicyclingLayer extends PureComponent {\n static override contextType = MapContext\n declare context: ContextType\n\n override state: BicyclingLayerState = {\n bicyclingLayer: null,\n }\n\n override componentDidMount(): void {\n const bicyclingLayer = new google.maps.BicyclingLayer()\n\n this.setState(() => {\n return {\n bicyclingLayer,\n }\n }, this.setBicyclingLayerCallback)\n }\n\n override componentWillUnmount(): void {\n if (this.state.bicyclingLayer !== null) {\n if (this.props.onUnmount) {\n this.props.onUnmount(this.state.bicyclingLayer)\n }\n\n this.state.bicyclingLayer.setMap(null)\n }\n }\n\n setBicyclingLayerCallback = (): void => {\n if (this.state.bicyclingLayer !== null) {\n\n this.state.bicyclingLayer.setMap(this.context)\n\n if (this.props.onLoad) {\n this.props.onLoad(this.state.bicyclingLayer)\n }\n }\n }\n\n override render(): null {\n return null\n }\n}\n\nexport default BicyclingLayer\n","import { type ContextType, PureComponent, useContext, useEffect, useState, memo } from 'react'\n\nimport MapContext from '../../map-context'\n\ninterface TransitLayerState {\n transitLayer: google.maps.TransitLayer | null\n}\n\nexport interface TransitLayerProps {\n /** This callback is called when the transitLayer instance has loaded. It is called with the transitLayer instance. */\n onLoad?: ((transitLayer: google.maps.TransitLayer) => void) | undefined\n /** This callback is called when the component unmounts. It is called with the transitLayer instance. */\n onUnmount?: ((transitLayer: google.maps.TransitLayer) => void) | undefined\n}\n\nfunction TransitLayerFunctional({ onLoad, onUnmount }: TransitLayerProps): null {\n const map = useContext(MapContext)\n\n const [instance, setInstance] = useState(null)\n\n // Order does matter\n useEffect(() => {\n if (instance !== null) {\n instance.setMap(map)\n }\n }, [map])\n\n useEffect(() => {\n const transitLayer = new google.maps.TransitLayer()\n\n setInstance(transitLayer)\n\n transitLayer.setMap(map)\n\n if (onLoad) {\n onLoad(transitLayer)\n }\n\n return () => {\n if (instance !== null) {\n if (onUnmount) {\n onUnmount(instance)\n }\n\n instance.setMap(null)\n }\n }\n }, [])\n\n return null\n}\n\nexport const TransitLayerF = memo(TransitLayerFunctional)\n\nexport class TransitLayer extends PureComponent {\n static override contextType = MapContext\n declare context: ContextType\n\n override state: TransitLayerState = {\n transitLayer: null,\n }\n\n setTransitLayerCallback = (): void => {\n if (this.state.transitLayer !== null) {\n\n this.state.transitLayer.setMap(this.context)\n\n if (this.props.onLoad) {\n this.props.onLoad(this.state.transitLayer)\n }\n }\n }\n\n override componentDidMount(): void {\n const transitLayer = new google.maps.TransitLayer()\n\n this.setState(function setTransitLayer() {\n return {\n transitLayer,\n }\n }, this.setTransitLayerCallback)\n }\n\n override componentWillUnmount(): void {\n if (this.state.transitLayer !== null) {\n if (this.props.onUnmount) {\n this.props.onUnmount(this.state.transitLayer)\n }\n\n this.state.transitLayer.setMap(null)\n }\n }\n\n override render(): null {\n return null\n }\n}\n\nexport default TransitLayer\n","/* globals google */\nimport { type ContextType, memo, PureComponent, useContext, useEffect, useState } from 'react'\n\nimport invariant from 'invariant'\n\nimport { unregisterEvents, applyUpdatersToPropsAndRegisterEvents } from '../../utils/helper'\n\nimport MapContext from '../../map-context'\n\nconst eventMap = {\n onCircleComplete: 'circlecomplete',\n onMarkerComplete: 'markercomplete',\n onOverlayComplete: 'overlaycomplete',\n onPolygonComplete: 'polygoncomplete',\n onPolylineComplete: 'polylinecomplete',\n onRectangleComplete: 'rectanglecomplete',\n}\n\nconst updaterMap = {\n drawingMode(\n instance: google.maps.drawing.DrawingManager,\n drawingMode: google.maps.drawing.OverlayType | null\n ): void {\n instance.setDrawingMode(drawingMode)\n },\n options(\n instance: google.maps.drawing.DrawingManager,\n options: google.maps.drawing.DrawingManagerOptions\n ): void {\n instance.setOptions(options)\n },\n}\n\ninterface DrawingManagerState {\n drawingManager: google.maps.drawing.DrawingManager | null\n}\n\nexport interface DrawingManagerProps {\n options?: google.maps.drawing.DrawingManagerOptions | undefined\n /** Changes the DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are 'marker', 'polygon', 'polyline', 'rectangle', 'circle', or null. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything. */\n drawingMode?: google.maps.drawing.OverlayType | null | undefined\n /** This event is fired when the user has finished drawing a circle. */\n onCircleComplete?: ((circle: google.maps.Circle) => void) | undefined\n /** This event is fired when the user has finished drawing a marker. */\n onMarkerComplete?: ((marker: google.maps.Marker) => void) | undefined\n /** This event is fired when the user has finished drawing an overlay of any type. */\n onOverlayComplete?: ((e: google.maps.drawing.OverlayCompleteEvent) => void) | undefined\n /** This event is fired when the user has finished drawing a polygon. */\n onPolygonComplete?: ((polygon: google.maps.Polygon) => void) | undefined\n /** This event is fired when the user has finished drawing a polyline. */\n onPolylineComplete?: ((polyline: google.maps.Polyline) => void) | undefined\n /** This event is fired when the user has finished drawing a rectangle. */\n onRectangleComplete?: ((rectangle: google.maps.Rectangle) => void) | undefined\n /** This callback is called when the drawingManager instance has loaded. It is called with the drawingManager instance. */\n onLoad?: ((drawingManager: google.maps.drawing.DrawingManager) => void) | undefined\n /** This callback is called when the component unmounts. It is called with the drawingManager instance. */\n onUnmount?: ((drawingManager: google.maps.drawing.DrawingManager) => void) | undefined\n}\n\nfunction DrawingManagerFunctional({\n options,\n drawingMode,\n onCircleComplete,\n onMarkerComplete,\n onOverlayComplete,\n onPolygonComplete,\n onPolylineComplete,\n onRectangleComplete,\n onLoad,\n onUnmount\n}: DrawingManagerProps): null {\n const map = useContext(MapContext)\n\n const [instance, setInstance] = useState(null)\n\n const [circlecompleteListener, setCircleCompleteListener] = useState(null)\n const [markercompleteListener, setMarkerCompleteListener] = useState(null)\n const [overlaycompleteListener, setOverlayCompleteListener] = useState(null)\n const [polygoncompleteListener, setPolygonCompleteListener] = useState(null)\n const [polylinecompleteListener, setPolylineCompleteListener] = useState(null)\n const [rectanglecompleteListener, setRectangleCompleteListener] = useState(null)\n\n // Order does matter\n useEffect(() => {\n if (instance !== null) {\n instance.setMap(map)\n }\n }, [map])\n\n useEffect(() => {\n if (options && instance !== null) {\n instance.setOptions(options)\n }\n }, [instance, options])\n\n useEffect(() => {\n if (instance !== null) {\n instance.setDrawingMode(drawingMode ?? null)\n }\n }, [instance, drawingMode])\n\n useEffect(() => {\n if (instance && onCircleComplete) {\n if (circlecompleteListener !== null) {\n google.maps.event.removeListener(circlecompleteListener)\n }\n\n setCircleCompleteListener(\n google.maps.event.addListener(instance, 'circlecomplete', onCircleComplete)\n )\n }\n }, [instance, onCircleComplete])\n\n useEffect(() => {\n if (instance && onMarkerComplete) {\n if (markercompleteListener !== null) {\n google.maps.event.removeListener(markercompleteListener)\n }\n\n setMarkerCompleteListener(\n google.maps.event.addListener(instance, 'markercomplete', onMarkerComplete)\n )\n }\n }, [instance, onMarkerComplete])\n\n useEffect(() => {\n if (instance && onOverlayComplete) {\n if (overlaycompleteListener !== null) {\n google.maps.event.removeListener(overlaycompleteListener)\n }\n\n setOverlayCompleteListener(\n google.maps.event.addListener(instance, 'overlaycomplete', onOverlayComplete)\n )\n }\n }, [instance, onOverlayComplete])\n\n useEffect(() => {\n if (instance && onPolygonComplete) {\n if (polygoncompleteListener !== null) {\n google.maps.event.removeListener(polygoncompleteListener)\n }\n\n setPolygonCompleteListener(\n google.maps.event.addListener(instance, 'polygoncomplete', onPolygonComplete)\n )\n }\n }, [instance, onPolygonComplete])\n\n useEffect(() => {\n if (instance && onPolylineComplete) {\n if (polylinecompleteListener !== null) {\n google.maps.event.removeListener(polylinecompleteListener)\n }\n\n setPolylineCompleteListener(\n google.maps.event.addListener(instance, 'polylinecomplete', onPolylineComplete)\n )\n }\n }, [instance, onPolylineComplete])\n\n useEffect(() => {\n if (instance && onRectangleComplete) {\n if (rectanglecompleteListener !== null) {\n google.maps.event.removeListener(rectanglecompleteListener)\n }\n\n setRectangleCompleteListener(\n google.maps.event.addListener(instance, 'rectanglecomplete', onRectangleComplete)\n )\n }\n }, [instance, onRectangleComplete])\n\n useEffect(() => {\n invariant(\n !!google.maps.drawing,\n `Did you include prop libraries={['drawing']} in the URL? %s`,\n google.maps.drawing\n )\n\n const drawingManager = new google.maps.drawing.DrawingManager({\n ...(options || {}),\n map,\n })\n\n if (drawingMode) {\n drawingManager.setDrawingMode(drawingMode)\n }\n\n if (onCircleComplete) {\n setCircleCompleteListener(\n google.maps.event.addListener(drawingManager, 'circlecomplete', onCircleComplete)\n )\n }\n\n if (onMarkerComplete) {\n setMarkerCompleteListener(\n google.maps.event.addListener(drawingManager, 'markercomplete', onMarkerComplete)\n )\n }\n\n if (onOverlayComplete) {\n setOverlayCompleteListener(\n google.maps.event.addListener(drawingManager, 'overlaycomplete', onOverlayComplete)\n )\n }\n\n if (onPolygonComplete) {\n setPolygonCompleteListener(\n google.maps.event.addListener(drawingManager, 'polygoncomplete', onPolygonComplete)\n )\n }\n\n if (onPolylineComplete) {\n setPolylineCompleteListener(\n google.maps.event.addListener(drawingManager, 'polylinecomplete', onPolylineComplete)\n )\n }\n\n if (onRectangleComplete) {\n setRectangleCompleteListener(\n google.maps.event.addListener(drawingManager, 'rectanglecomplete', onRectangleComplete)\n )\n }\n\n setInstance(drawingManager)\n\n if (onLoad) {\n onLoad(drawingManager)\n }\n\n return () => {\n if (instance !== null) {\n if (circlecompleteListener) {\n google.maps.event.removeListener(circlecompleteListener)\n }\n\n if (markercompleteListener) {\n google.maps.event.removeListener(markercompleteListener)\n }\n\n if (overlaycompleteListener) {\n google.maps.event.removeListener(overlaycompleteListener)\n }\n\n if (polygoncompleteListener) {\n google.maps.event.removeListener(polygoncompleteListener)\n }\n\n if (polylinecompleteListener) {\n google.maps.event.removeListener(polylinecompleteListener)\n }\n\n if (rectanglecompleteListener) {\n google.maps.event.removeListener(rectanglecompleteListener)\n }\n\n if (onUnmount) {\n onUnmount(instance)\n }\n\n instance.setMap(null)\n }\n }\n }, [])\n\n return null\n}\n\nexport const DrawingManagerF = memo(DrawingManagerFunctional)\n\nexport class DrawingManager extends PureComponent {\n static override contextType = MapContext\n\n declare context: ContextType\n\n registeredEvents: google.maps.MapsEventListener[] = []\n\n override state: DrawingManagerState = {\n drawingManager: null,\n }\n\n constructor(props: DrawingManagerProps) {\n super(props)\n\n invariant(\n !!google.maps.drawing,\n `Did you include prop libraries={['drawing']} in the URL? %s`,\n google.maps.drawing\n )\n }\n\n setDrawingManagerCallback = (): void => {\n if (this.state.drawingManager !== null && this.props.onLoad) {\n this.props.onLoad(this.state.drawingManager)\n }\n }\n\n override componentDidMount(): void {\n const drawingManager = new google.maps.drawing.DrawingManager({\n ...(this.props.options || {}),\n map: this.context,\n })\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps: {},\n nextProps: this.props,\n instance: drawingManager,\n })\n\n this.setState(function setDrawingManager() {\n return {\n drawingManager,\n }\n }, this.setDrawingManagerCallback)\n }\n\n override componentDidUpdate(prevProps: DrawingManagerProps): void {\n if (this.state.drawingManager !== null) {\n unregisterEvents(this.registeredEvents)\n\n this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({\n updaterMap,\n eventMap,\n prevProps,\n nextProps: this.props,\n instance: this.state.drawingManager,\n })\n }\n }\n\n override componentWillUnmount(): void {\n if (this.state.drawingManager !== null) {\n if (this.props.onUnmount) {\n this.props.onUnmount(this.state.drawingManager)\n }\n\n unregisterEvents(this.registeredEvents)\n\n this.state.drawingManager.setMap(null)\n }\n }\n\n override render(): null {\n return null\n }\n}\n\nexport default DrawingManager\n","import {\n memo,\n useMemo,\n Children,\n useState,\n useEffect,\n useContext,\n cloneElement,\n PureComponent,\n isValidElement,\n type ReactNode,\n type ContextType,\n type ReactElement,\n} from 'react'\n\nimport { unregisterEvents, applyUpdatersToPropsAndRegisterEvents } from '../../utils/helper'\n\nimport MapContext from '../../map-context'\nimport type { HasMarkerAnchor } from '../../types'\n\nimport type{ Clusterer } from '@react-google-maps/marker-clusterer'\nimport type { MarkerClusterer as GoogleClusterer} from '@googlemaps/markerclusterer'\n\nconst eventMap = {\n onAnimationChanged: 'animation_changed',\n onClick: 'click',\n onClickableChanged: 'clickable_changed',\n onCursorChanged: 'cursor_changed',\n onDblClick: 'dblclick',\n onDrag: 'drag',\n onDragEnd: 'dragend',\n onDraggableChanged: 'draggable_changed',\n onDragStart: 'dragstart',\n onFlatChanged: 'flat_changed',\n onIconChanged: 'icon_changed',\n onMouseDown: 'mousedown',\n onMouseOut: 'mouseout',\n onMouseOver: 'mouseover',\n onMouseUp: 'mouseup',\n onPositionChanged: 'position_changed',\n onRightClick: 'rightclick',\n onShapeChanged: 'shape_changed',\n onTitleChanged: 'title_changed',\n onVisibleChanged: 'visible_changed',\n onZindexChanged: 'zindex_changed',\n}\n\nconst updaterMap = {\n animation(instance: google.maps.Marker, animation: google.maps.Animation): void {\n instance.setAnimation(animation)\n },\n clickable(instance: google.maps.Marker, clickable: boolean): void {\n instance.setClickable(clickable)\n },\n cursor(instance: google.maps.Marker, cursor: string): void {\n instance.setCursor(cursor)\n },\n draggable(instance: google.maps.Marker, draggable: boolean): void {\n instance.setDraggable(draggable)\n },\n icon(instance: google.maps.Marker, icon: string | google.maps.Icon | google.maps.Symbol): void {\n instance.setIcon(icon)\n },\n label(instance: google.maps.Marker, label: string | google.maps.MarkerLabel): void {\n instance.setLabel(label)\n },\n map(instance: google.maps.Marker, map: google.maps.Map): void {\n instance.setMap(map)\n },\n opacity(instance: google.maps.Marker, opacity: number): void {\n instance.setOpacity(opacity)\n },\n options(instance: google.maps.Marker, options: google.maps.MarkerOptions): void {\n instance.setOptions(options)\n },\n position(\n instance: google.maps.Marker,\n position: google.maps.LatLng | google.maps.LatLngLiteral\n ): void {\n instance.setPosition(position)\n },\n shape(instance: google.maps.Marker, shape: google.maps.MarkerShape): void {\n instance.setShape(shape)\n },\n title(instance: google.maps.Marker, title: string): void {\n instance.setTitle(title)\n },\n visible(instance: google.maps.Marker, visible: boolean): void {\n instance.setVisible(visible)\n },\n zIndex(instance: google.maps.Marker, zIndex: number): void {\n instance.setZIndex(zIndex)\n },\n}\n\nexport interface MarkerProps {\n // required\n /** Marker position. */\n position: google.maps.LatLng | google.maps.LatLngLiteral\n\n children?: ReactNode | undefined\n options?: google.maps.MarkerOptions | undefined\n /** Start an animation. Any ongoing animation will be cancelled. Currently supported animations are: BOUNCE, DROP. Passing in null will cause any animation to stop. */\n animation?: google.maps.Animation | undefined\n /** If true, the marker receives mouse and touch events. Default value is true. */\n clickable?: boolean | undefined\n /** Mouse cursor to show on hover */\n cursor?: string | undefined\n /** If true, the marker can be dragged. Default value is false. */\n draggable?: boolean | undefined\n /** Icon for the foreground. If a string is provided, it is treated as though it were an Icon with the string as url. */\n icon?: string | google.maps.Icon | google.maps.Symbol | undefined\n /** Adds a label to the marker. The label can either be a string, or a MarkerLabel object. */\n label?: string | google.maps.MarkerLabel | undefined\n /** The marker's opacity between 0.0 and 1.0. */\n opacity?: number | undefined\n\n /** Image map region definition used for drag/click. */\n shape?: google.maps.MarkerShape | undefined\n /** Rollover text */\n title?: string | undefined\n /** If true, the marker is visible */\n visible?: boolean | undefined\n /** All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen. */\n zIndex?: number | undefined\n /** Render prop that handles clustering markers */\n clusterer?: Clusterer | GoogleClusterer | undefined\n /** Clusters are redrawn when a Marker is added unless noClustererRedraw? is set to true. */\n noClustererRedraw?: boolean | undefined\n /** This event is fired when the marker icon was clicked. */\n onClick?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the marker's clickable property changes. */\n onClickableChanged?: (() => void) | undefined\n /** This event is fired when the marker's cursor property changes. */\n onCursorChanged?: (() => void) | undefined\n /** This event is fired when the marker's animation property changes. */\n onAnimationChanged?: (() => void) | undefined\n /** This event is fired when the marker icon was double clicked. */\n onDblClick?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is repeatedly fired while the user drags the marker. */\n onDrag?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the user stops dragging the marker. */\n onDragEnd?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the marker's draggable property changes. */\n onDraggableChanged?: (() => void) | undefined\n /** This event is fired when the user starts dragging the marker. */\n onDragStart?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the marker's flat property changes. */\n onFlatChanged?: (() => void) | undefined\n /** This event is fired when the marker icon property changes. */\n onIconChanged?: (() => void) | undefined\n /** This event is fired for a mousedown on the marker. */\n onMouseDown?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the mouse leaves the area of the marker icon. */\n onMouseOut?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the mouse enters the area of the marker icon. */\n onMouseOver?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired for a mouseup on the marker. */\n onMouseUp?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the marker position property changes. */\n onPositionChanged?: (() => void) | undefined\n /** This event is fired for a rightclick on the marker. */\n onRightClick?: ((e: google.maps.MapMouseEvent) => void) | undefined\n /** This event is fired when the marker's shape property changes. */\n onShapeChanged?: (() => void) | undefined\n /** This event is fired when the marker title property changes. */\n onTitleChanged?: (() => void) | undefined\n /** This event is fired when the marker's visible property changes. */\n onVisibleChanged?: (() => void) | undefined\n /** This event is fired when the marker's zIndex property changes. */\n onZindexChanged?: (() => void) | undefined\n /** This callback is called when the marker instance has loaded. It is called with the marker instance. */\n onLoad?: ((marker: google.maps.Marker) => void) | undefined\n /** This callback is called when the component unmounts. It is called with the marker instance. */\n onUnmount?: ((marker: google.maps.Marker) => void) | undefined\n}\n\nconst defaultOptions = {}\n\nfunction MarkerFunctional({\n position,\n options,\n clusterer,\n noClustererRedraw,\n\n children,\n\n draggable,\n visible,\n animation,\n clickable,\n cursor,\n icon,\n label,\n opacity,\n shape,\n title,\n zIndex,\n onClick,\n onDblClick,\n onDrag,\n onDragEnd,\n onDragStart,\n onMouseOut,\n onMouseOver,\n onMouseUp,\n onMouseDown,\n onRightClick,\n onClickableChanged,\n onCursorChanged,\n onAnimationChanged,\n onDraggableChanged,\n onFlatChanged,\n onIconChanged,\n onPositionChanged,\n onShapeChanged,\n onTitleChanged,\n onVisibleChanged,\n onZindexChanged,\n onLoad,\n onUnmount\n}: MarkerProps): JSX.Element | null {\n const map = useContext(MapContext)\n\n const [instance, setInstance] = useState(null)\n\n const [dblclickListener, setDblclickListener] = useState(null)\n const [dragendListener, setDragendListener] = useState(null)\n const [dragstartListener, setDragstartListener] = useState(null)\n const [mousedownListener, setMousedownListener] = useState(null)\n const [mouseoutListener, setMouseoutListener] = useState(null)\n const [mouseoverListener, setMouseoverListener] = useState(null)\n const [mouseupListener, setMouseupListener] = useState(null)\n const [rightclickListener, setRightclickListener] = useState(null)\n const [clickListener, setClickListener] = useState(null)\n const [dragListener, setDragListener] = useState(null)\n\n const [clickableChangedListener, setClickableChangedListener] = useState(null)\n const [cursorChangedListener, setCursorChangedListener] = useState(null)\n const [animationChangedListener, setAnimationChangedListener] = useState(null)\n const [draggableChangedListener, setDraggableChangedListener] = useState(null)\n const [flatChangedListener, setFlatChangedListener] = useState(null)\n const [iconChangedListener, setIconChangedListener] = useState(null)\n const [positionChangedListener, setPositionChangedListener] = useState(null)\n const [shapeChangedListener, setShapeChangedListener] = useState(null)\n const [titleChangedListener, setTitleChangedListener] = useState